Alex Trofimov 10 лет назад
Родитель
Сommit
ecda483843

+ 21 - 0
modules/boonex/google_connect/classes/BxGoogleConAlerts.php

@@ -0,0 +1,21 @@
+<?php defined('BX_DOL') or die('hack attempt');
+/**
+ * Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
+ * CC-BY License - http://creativecommons.org/licenses/by/3.0/
+ *
+ * @defgroup    GoogleConnect Google Connect
+ * @ingroup     TridentModules
+ *
+ * @{
+ */
+
+class BxGoogleConAlerts extends BxBaseModConnectAlerts
+{
+    function __construct()
+    {
+        parent::__construct();
+        $this -> oModule = BxDolModule::getInstance('bx_googlecon');
+    }
+}
+
+/** @} */

+ 49 - 0
modules/boonex/google_connect/classes/BxGoogleConConfig.php

@@ -0,0 +1,49 @@
+<?php defined('BX_DOL') or die('hack attempt');
+/**
+ * Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
+ * CC-BY License - http://creativecommons.org/licenses/by/3.0/
+ *
+ * @defgroup    GoogleConnect Google Connect
+ * @ingroup     TridentModules
+ *
+ * @{
+ */
+
+class BxGoogleConConfig extends BxBaseModConnectConfig
+{
+    public $sApiID;
+    public $sApiSecret;
+    public $sApiUrl = 'https://www.googleapis.com';
+    public $sOauthUrl = 'https://accounts.google.com/o/oauth2/v2';
+
+    public $sFields = 'id,firstName,lastName,picture-url,email-address';
+
+    public $sPageStart;
+    public $sPageHandle;
+
+    public $sScope = 'email profile';
+
+    function __construct($aModule)
+    {
+        parent::__construct($aModule);
+
+        $this -> sApiID = getParam('bx_googlecon_api_key');
+        $this -> sApiSecret = getParam('bx_googlecon_secret');
+
+        $this -> sSessionUid = 'googlecon_session';
+        $this -> sSessionProfile = 'googlecon_session_profile';
+
+        $this -> sEmailTemplatePasswordGenerated = 'bx_googlecon_password_generated';
+        $this -> sDefaultTitleLangKey = '_bx_googlecon';
+
+        $this -> sRedirectPage = getParam('bx_googlecon_redirect_page');
+        $this -> sProfilesModule = getParam('bx_googlecon_module');
+        $this -> isAlwaysConfirmEmail = (bool)getParam('bx_googlecon_confirm_email'); 
+        $this -> isAlwaysAutoApprove = (bool)getParam('bx_googlecon_approve');
+
+        $this -> sPageStart = BX_DOL_URL_ROOT . $this -> getBaseUri() . 'start';
+        $this -> sPageHandle = BX_DOL_URL_ROOT . $this -> getBaseUri() . 'handle';
+    }
+}
+
+/** @} */

+ 20 - 0
modules/boonex/google_connect/classes/BxGoogleConDb.php

@@ -0,0 +1,20 @@
+<?php defined('BX_DOL') or die('hack attempt');
+/**
+ * Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
+ * CC-BY License - http://creativecommons.org/licenses/by/3.0/
+ *
+ * @defgroup    GoogleConnect Google Connect
+ * @ingroup     TridentModules
+ *
+ * @{
+ */
+
+class BxGoogleConDb extends BxBaseModConnectDb
+{
+    function __construct(&$oConfig)
+    {
+        parent::__construct($oConfig);
+    }
+}
+
+/** @} */

+ 182 - 0
modules/boonex/google_connect/classes/BxGoogleConModule.php

@@ -0,0 +1,182 @@
+<?php defined('BX_DOL') or die('hack attempt');
+/**
+ * Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
+ * CC-BY License - http://creativecommons.org/licenses/by/3.0/
+ *
+ * @defgroup    GoogleConnect Google Connect
+ * @ingroup     TridentModules
+ *
+ * @{
+ */
+
+class BxGoogleConModule extends BxBaseModConnectModule
+{
+    function __construct(&$aModule)
+    {
+        parent::__construct($aModule);
+    }
+
+    /**
+     * Generate admin page;
+     *
+     * @return : (text) - html presentation data;
+     */
+    function actionAdministration()
+    {
+        parent::_actionAdministration('bx_googlecon_api_key', '_bx_googlecon_settings', '_bx_googlecon_information', '_bx_googlecon_information_block');
+    }
+
+    /**
+     * Redirect to remote site login form
+     *
+     * @return n/a - redirect or HTML page in case of error
+     */
+    function actionStart()
+    {
+        if (isLogged())
+            $this->_redirect ($this -> _oConfig -> sDefaultRedirectUrl);
+
+        if (!$this->_oConfig->sApiID || !$this->_oConfig->sApiSecret) {
+            require_once(BX_DIRECTORY_PATH_INC . 'design.inc.php');
+            bx_import('BxDolLanguages');
+            $sCode =  MsgBox( _t('_bx_googlecon_profile_error_api_keys') );
+            $this->_oTemplate->getPage(_t('_bx_googlecon'), $sCode);
+        } 
+        else {
+
+            // define redirect URL to the remote site                
+            $sUrl = bx_append_url_params($this->_oConfig->sOauthUrl . '/auth', array(
+                'response_type' => 'code',
+                'client_id' => $this->_oConfig->sApiID,
+                'redirect_uri' => $this->_oConfig->sPageHandle,
+                'scope' => $this->_oConfig->sScope,
+                'state' => $this->_genCsrfToken(),
+            ));
+            $this->_redirect($sUrl);
+        }
+    }
+
+    function actionHandle()
+    {
+        require_once(BX_DIRECTORY_PATH_INC . 'design.inc.php');
+
+        // check CSRF token
+        if ($this->_getCsrfToken() != bx_get('state')) {
+            $this->_oTemplate->getPage(_t('_Error'), MsgBox(_t('_bx_googlecon_state_invalid')));
+            return;
+        }
+
+        // check code
+        $sCode = bx_get('code');
+        if (!$sCode || bx_get('error')) {
+            $sErrorDescription = bx_get('error_description') ? bx_get('error_description') : _t('_error occured');
+            $this->_oTemplate->getPage(_t('_Error'), MsgBox($sErrorDescription));
+            return;
+        }
+
+        // make request for token
+        $s = bx_file_get_contents($this->_oConfig->sApiUrl . '/oauth2/v4/token', array(
+            'client_id'     => $this->_oConfig->sApiID,
+            'client_secret' => $this->_oConfig->sApiSecret,
+            'grant_type'    => 'authorization_code',
+            'code'          => $sCode,
+            'redirect_uri'  => $this->_oConfig->sPageHandle,
+        ), 'post', array ('Content-Type: application/x-www-form-urlencoded'));
+
+        // handle error
+        if (!$s || NULL === ($aResponse = json_decode($s, true)) || !isset($aResponse['access_token']) || isset($aResponse['error'])) {
+            $sErrorDescription = isset($aResponse['error_description']) ? $aResponse['error_description'] : _t('_error occured');
+            $this->_oTemplate->getPage(_t('_Error'), MsgBox($sErrorDescription));
+            return;
+        }
+
+        // get the data, especially access_token
+        $sAccessToken = $aResponse['access_token'];
+        $sExpiresIn = $aResponse['expires_in'];
+        $sExpiresAt = new \DateTime('+' . $sExpiresIn . ' seconds');
+
+        // request info about profile
+        $s = bx_file_get_contents($this->_oConfig->sApiUrl . '/oauth2/v1/userinfo', array(), 'get', array(
+            'Authorization: Bearer ' . $sAccessToken,
+        ));
+
+        // handle error
+        if (!$s || NULL === ($aResponse = json_decode($s, true)) || !$aResponse || isset($aResponse['error'])) {
+            $sErrorDescription = isset($aResponse['error_description']) ? $aResponse['error_description'] : _t('_error occured'); 
+            $this->_oTemplate->getPage(_t('_Error'), MsgBox($sErrorDescription));
+            return;
+        }
+
+        $aRemoteProfileInfo = $aResponse;
+
+        if ($aRemoteProfileInfo) {
+
+            // check if user logged in before
+            $iLocalProfileId = $this->_oDb->getProfileId($aRemoteProfileInfo['id']);
+            
+            if ($iLocalProfileId && $oProfile = BxDolProfile::getInstance($iLocalProfileId)) {
+                // user already exists
+                $this->setLogged($oProfile ->id());
+            }             
+            else {  
+                // register new user
+                $this->_createProfile($aRemoteProfileInfo);
+            }
+        } 
+        else {
+            $this->_oTemplate->getPage(_t('_Error'), MsgBox(_t('_bx_googlecon_profile_error_info')));
+        }
+    }
+
+    protected function _redirect($sUrl, $iStatus = 302)
+    {
+        header("Location:{$sUrl}", true, $iStatus);
+        exit;
+    }
+
+    /**
+     * @param $aProfileInfo - remote profile info
+     * @param $sAlternativeName - suffix to add to NickName to make it unique
+     * @return profile array info, ready for the local database
+     */
+    protected function _convertRemoteFields($aProfileInfo, $sAlternativeName = '')
+    {
+        $aProfileFields = $aProfileInfo;
+
+        $aProfileFields['name'] = $aProfileInfo['given_name'];
+        $aProfileFields['fullname'] = $aProfileInfo['name'];
+        $aProfileFields['email'] = isset($aProfileInfo['email']) ? $aProfileInfo['email'] : '';
+        $aProfileFields['picture'] = isset($aProfileInfo['picture']) ? $aProfileInfo['picture'] : '';
+        
+        return $aProfileFields;
+    }
+
+    protected function _genCsrfToken($bReturn = false)
+    {
+        if (getParam('sys_security_form_token_enable') != 'on' || defined('BX_DOL_CRON_EXECUTE'))
+            return false;
+
+        $oSession = BxDolSession::getInstance();
+
+        $iCsrfTokenLifetime = (int)$this->_oDb->getParam('sys_security_form_token_lifetime');
+        if ($oSession->getValue('bx_googlecon_csrf_token') === false || ($iCsrfTokenLifetime != 0 && time() - (int)$oSession->getValue('csrf_token_time') > $iCsrfTokenLifetime)) {
+            $sToken = genRndPwd(20, false);
+            $oSession->setValue('bx_googlecon_csrf_token', $sToken);
+            $oSession->setValue('bx_googlecon_csrf_token_time', time());
+        }
+        else {
+            $sToken = $oSession->getValue('bx_googlecon_csrf_token');
+        }
+
+        return $sToken;
+    }
+
+    protected function _getCsrfToken()
+    {
+        $oSession = BxDolSession::getInstance();
+        return $oSession->getValue('bx_googlecon_csrf_token');
+    }
+
+}
+
+/** @} */

+ 28 - 0
modules/boonex/google_connect/classes/BxGoogleConStudioPage.php

@@ -0,0 +1,28 @@
+<?php defined('BX_DOL') or die('hack attempt');
+/**
+ * Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
+ * CC-BY License - http://creativecommons.org/licenses/by/3.0/
+ *
+ * @defgroup    GoogleConnect Google Connect
+ * @ingroup     TridentModules
+ *
+ * @{
+ */
+
+class BxGoogleConStudioPage extends BxTemplStudioModule
+{
+    function getHelp ()
+    {
+        $oModule = BxDolModule::getInstance('bx_googlecon'); 
+        return _t('_bx_googlecon_information_block', BX_DOL_URL_ROOT . $oModule -> _oConfig -> getBaseUri() . 'handle');
+    }
+
+    protected function getPageCaptionHelp()
+    {
+        $oTemplate = BxDolStudioTemplate::getInstance();
+        $sContent = '<a href="' . BX_DOL_URL_STUDIO . 'module.php?name=bx_googlecon&page=help">' . _t('_bx_googlecon_information') . "</a>";
+        return $oTemplate->parseHtmlByName('page_caption_help.html', array('content' => $sContent));
+    }
+}
+
+/** @} */

+ 20 - 0
modules/boonex/google_connect/classes/BxGoogleConTemplate.php

@@ -0,0 +1,20 @@
+<?php defined('BX_DOL') or die('hack attempt');
+/**
+ * Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
+ * CC-BY License - http://creativecommons.org/licenses/by/3.0/
+ *
+ * @defgroup    GoogleConnect Google Connect
+ * @ingroup     TridentModules
+ *
+ * @{
+ */
+
+class BxGoogleConTemplate extends BxBaseModConnectTemplate
+{
+    function __construct(&$oConfig, &$oDb)
+    {
+        parent::__construct($oConfig, $oDb);
+    }
+}
+
+/** @} */

+ 68 - 0
modules/boonex/google_connect/install/config.php

@@ -0,0 +1,68 @@
+<?php 
+/**
+ * Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
+ * CC-BY License - http://creativecommons.org/licenses/by/3.0/
+ *
+ * @defgroup    GoogleConnect Google Connect
+ * @ingroup     TridentModules
+ *
+ * @{
+ */
+
+$aConfig = array(
+    /**
+     * Main Section.
+     */
+    'type' => BX_DOL_MODULE_TYPE_MODULE,
+    'name' => 'bx_googlecon',
+    'title' => 'Google connect',
+    'note' => 'Join the site using LinkedIn account.',
+    'version' => '9.0.1.DEV',
+    'vendor' => 'Boonex',
+    'help_url' => 'http://feed.boonex.com/?section={module_name}',
+
+    'compatible_with' => array(
+        '9.0.x'
+    ),
+
+    /**
+     * 'home_dir' and 'home_uri' - should be unique. Don't use spaces in 'home_uri' and the other special chars.
+     */
+    'home_dir' => 'boonex/google_connect/',
+    'home_uri' => 'googlecon',
+
+    'db_prefix' => 'bx_googlecon_',
+    'class_prefix' => 'BxGoogleCon',
+
+    /**
+     * Category for language keys.
+     */
+    'language_category' => 'Google Connect',
+
+    /**
+     * Installation/Uninstallation Section.
+     */
+    'install' => array(
+        'execute_sql' => 1,
+        'update_languages' => 1,
+    ),
+    'uninstall' => array (
+        'execute_sql' => 1,
+        'update_languages' => 1,
+    ),
+    'enable' => array(
+        'execute_sql' => 1,
+        'clear_db_cache' => 1,
+    ),
+    'disable' => array (
+        'execute_sql' => 1,
+        'clear_db_cache' => 1,
+    ),
+
+    /**
+     * Dependencies Section
+     */
+    'dependencies' => array(),
+);
+
+/** @} */

+ 20 - 0
modules/boonex/google_connect/install/installer.php

@@ -0,0 +1,20 @@
+<?php defined('BX_DOL') or die('hack attempt');
+/**
+ * Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
+ * CC-BY License - http://creativecommons.org/licenses/by/3.0/
+ *
+ * @defgroup    GoogleConnect Google Connect
+ * @ingroup     TridentModules
+ *
+ * @{
+ */
+
+class BxGoogleConInstaller extends BxDolStudioInstaller
+{
+    function __construct($aConfig)
+    {
+        parent::__construct($aConfig);
+    }
+}
+
+/** @} */

+ 37 - 0
modules/boonex/google_connect/install/langs/en.xml

@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources name="en" flag="gb" title="English">
+	<string name="_sys_module_googlecon"><![CDATA[Google Connect]]></string>
+	<string name="_bx_googlecon"><![CDATA[Google Connect]]></string>
+	<string name="_bx_googlecon_settings"><![CDATA[Google Connect]]></string>
+	<string name="_bx_googlecon_information"><![CDATA[Google connect information]]></string>
+	<string name="_bx_googlecon_information_block"><![CDATA[
+        <p>This module can be used to login to this site using your Google account credentials.</p>
+        <p>To make it work, follow these instructions on <a target="_blank" href="https://developers.google.com/identity/sign-in/web/devconsole-project">how to create Google Project</a>, when creating a project specify the following info:<br />
+            <ul>
+                <li>Redirect URL: <strong>{0}</strong></li>
+            </ul>
+            Then enter generated Client ID & Secret pair in this module settings.
+        </p>]]></string>
+	<string name="_bx_googlecon_error_join_unavailable"><![CDATA[Sorry but join is unavailable now. Please try again later.]]></string>
+	<string name="_bx_googlecon_profile_error_info"><![CDATA[Can't define your profile information]]></string>
+	<string name="_bx_googlecon_profile_error_api_keys"><![CDATA[Please configure the module in admin panel (can't define API key, secret & URL)]]></string>
+	<string name="_bx_googlecon_auth_title"><![CDATA[Google Connect]]></string>
+	<string name="_bx_googlecon_state_invalid"><![CDATA[State parameter isn't matching]]></string>
+
+    <string name="_bx_googlecon_adm_stg_cpt_type"><![CDATA[Google Connect]]></string>
+    <string name="_bx_googlecon_adm_stg_cpt_category_general"><![CDATA[General]]></string>
+    <string name="_bx_googlecon_option_app_id"><![CDATA[Client ID]]></string>
+    <string name="_bx_googlecon_option_app_secret"><![CDATA[Client Secret]]></string>
+    <string name="_bx_googlecon_option_redirect"><![CDATA[Redirect page after first sign in]]></string>
+    <string name="_bx_googlecon_option_module"><![CDATA[Module to create profile in]]></string>
+    <string name="_bx_googlecon_option_confirm_email"><![CDATA[Always confirm emails when joined using Google Connect]]></string>
+    <string name="_bx_googlecon_option_approve"><![CDATA[Always approve profiles when joined using Google Connect]]></string>
+
+	<string name="_bx_googlecon_et_password_generated"><![CDATA[Google connect temporary password]]></string>
+	<string name="_bx_googlecon_et_password_generated_subject"><![CDATA[Temporary password]]></string>
+	<string name="_bx_googlecon_et_password_generated_body"><![CDATA[<bx_include_auto:_email_header.html />
+<p>Temporary password - <b>{password}</b></p>
+<p>Change it after logging-in.</p>
+<bx_include_auto:_email_footer.html />]]></string>
+    
+</resources>

+ 25 - 0
modules/boonex/google_connect/install/sql/disable.sql

@@ -0,0 +1,25 @@
+
+-- Email template
+
+DELETE FROM `sys_email_templates` WHERE `Name` = 'bx_googlecon_password_generated';
+
+-- Auth objects
+
+DELETE FROM `sys_objects_auths` WHERE `Name` = 'bx_googlecon';
+
+-- Alerts
+
+SET @iHandlerId := (SELECT `id` FROM `sys_alerts_handlers`  WHERE `name`  =  'bx_googlecon');
+
+DELETE FROM `sys_alerts_handlers` WHERE `id` = @iHandlerId;
+DELETE FROM `sys_alerts` WHERE `handler_id` =  @iHandlerId;
+
+-- Options
+
+DELETE FROM `top`, `toc`, `to` USING `sys_options_types` AS `top` LEFT JOIN `sys_options_categories` AS `toc` ON `top`.`id`=`toc`.`type_id` LEFT JOIN `sys_options` AS `to` ON `toc`.`id`=`to`.`category_id` WHERE `top`.`name` = 'bx_googlecon';
+
+-- Pages
+
+DELETE FROM `sys_objects_page` WHERE `module` = 'bx_googlecon';
+DELETE FROM `sys_pages_blocks` WHERE `module` = 'bx_googlecon';
+

+ 48 - 0
modules/boonex/google_connect/install/sql/enable.sql

@@ -0,0 +1,48 @@
+
+-- Email template
+
+INSERT INTO `sys_email_templates` (`Module`, `NameSystem`, `Name`, `Subject`, `Body`) VALUES
+('bx_googlecon', '_bx_googlecon_et_password_generated', 'bx_googlecon_password_generated', '_bx_googlecon_et_password_generated_subject', '_bx_googlecon_et_password_generated_body');
+
+-- Auth objects
+
+INSERT INTO `sys_objects_auths` (`Name`, `Title`, `Link`, `Icon`) VALUES
+('bx_googlecon', '_bx_googlecon_auth_title', 'modules/?r=googlecon/start', 'google-plus-square');
+
+-- Alerts
+
+INSERT INTO `sys_alerts_handlers` SET `name` = 'bx_googlecon', `class` = 'BxGoogleConAlerts', `file` = 'modules/boonex/dolphin_connect/classes/BxGoogleConAlerts.php';
+
+SET @iHandlerId := (SELECT `id` FROM `sys_alerts_handlers`  WHERE `name` = 'bx_googlecon');
+
+INSERT INTO `sys_alerts` (`unit`, `action`, `handler_id`) VALUES
+('account', 'logout', @iHandlerId),
+('profile', 'delete', @iHandlerId),
+('profile', 'add', @iHandlerId);
+
+-- Options
+
+SET @iTypeOrder = (SELECT MAX(`order`) FROM `sys_options_types` WHERE `group` = 'modules');
+INSERT INTO `sys_options_types` (`group`, `name`, `caption`, `icon`, `order`) VALUES 
+('modules', 'bx_googlecon', '_bx_googlecon_adm_stg_cpt_type', 'bx_googlecon@modules/boonex/googlecon/|std-mi.png', IF(NOT ISNULL(@iTypeOrder), @iTypeOrder + 1, 1));
+SET @iTypeId = LAST_INSERT_ID();
+
+INSERT INTO `sys_options_categories` (`type_id`, `name`, `caption`, `order` )  
+VALUES (@iTypeId, 'bx_googlecon_general', '_bx_googlecon_adm_stg_cpt_category_general', 1);
+SET @iCategId = LAST_INSERT_ID();
+
+INSERT INTO `sys_options` (`name`, `value`, `category_id`, `caption`, `type`, `check`, `check_error`, `order`, `extra`) VALUES
+('bx_googlecon_api_key', '', @iCategId, '_bx_googlecon_option_app_id', 'digit', '', '', 10, ''),
+('bx_googlecon_secret', '', @iCategId, '_bx_googlecon_option_app_secret', 'digit', '', '', 20, ''),
+('bx_googlecon_redirect_page', 'dashboard', @iCategId, '_bx_googlecon_option_redirect', 'select', '', '', 40, 'join,settings,dashboard,index'),
+('bx_googlecon_module', 'bx_persons', @iCategId, '_bx_googlecon_option_module', 'select', '', '', 50, 'a:2:{s:6:"module";s:12:"bx_googlecon";s:6:"method";s:20:"get_profiles_modules";}'),
+('bx_googlecon_confirm_email', 'on', @iCategId, '_bx_googlecon_option_confirm_email', 'checkbox', '', '', 70, ''),
+('bx_googlecon_approve', '', @iCategId, '_bx_googlecon_option_approve', 'checkbox', '', '', 80, '');
+
+-- Pages
+
+INSERT INTO `sys_objects_page`(`object`, `uri`, `title_system`, `title`, `module`, `layout_id`, `visible_for_levels`, `visible_for_levels_editable`, `url`, `meta_description`, `meta_keywords`, `meta_robots`, `cache_lifetime`, `cache_editable`, `deletable`, `override_class_name`, `override_class_file`) VALUES 
+('bx_googlecon_error', 'googlecon-error', '_bx_googlecon_error', '_bx_googlecon_error', 'bx_googlecon', 5, 2147483647, 0, '', '', '', '', 0, 1, 0, 'BxGoogleConPage', 'modules/boonex/googlecon/classes/BxGoogleConPage.php');
+
+INSERT INTO `sys_pages_blocks`(`object`, `cell_id`, `module`, `title`, `designbox_id`, `visible_for_levels`, `type`, `content`, `deletable`, `copyable`, `active`, `order`) VALUES 
+('bx_googlecon_error', 1, 'bx_googlecon', '_bx_googlecon_error', 11, 2147483647, 'service', 'a:2:{s:6:\"module\";s:12:\"bx_googlecon\";s:6:\"method\";s:10:\"last_error\";}', 0, 0, 1, 1);

+ 21 - 0
modules/boonex/google_connect/install/sql/install.sql

@@ -0,0 +1,21 @@
+
+CREATE TABLE `bx_googlecon_accounts` (
+  `local_profile` int(10) unsigned NOT NULL,
+  `remote_profile` varchar(16) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
+  PRIMARY KEY (`local_profile`),
+  KEY `remote_profile` (`remote_profile`)
+) ENGINE=MyISAM;
+
+-- Studio page and widget
+
+INSERT INTO `sys_std_pages`(`index`, `name`, `header`, `caption`, `icon`) VALUES
+(3, 'bx_googlecon', '_bx_googlecon', '_bx_googlecon', 'bx_googlecon@modules/boonex/google_connect/|std-pi.png');
+SET @iPageId = LAST_INSERT_ID();
+
+SET @iParentPageId = (SELECT `id` FROM `sys_std_pages` WHERE `name` = 'home');
+SET @iParentPageOrder = (SELECT MAX(`order`) FROM `sys_std_pages_widgets` WHERE `page_id` = @iParentPageId);
+INSERT INTO `sys_std_widgets` (`page_id`, `module`, `url`, `click`, `icon`, `caption`, `cnt_notices`, `cnt_actions`) VALUES
+(@iPageId, 'bx_googlecon', '{url_studio}module.php?name=bx_googlecon', '', 'bx_googlecon@modules/boonex/google_connect/|std-wi.png', '_bx_googlecon', '', 'a:4:{s:6:"module";s:6:"system";s:6:"method";s:11:"get_actions";s:6:"params";a:0:{}s:5:"class";s:18:"TemplStudioModules";}');
+INSERT INTO `sys_std_pages_widgets` (`page_id`, `widget_id`, `order`) VALUES
+(@iParentPageId, LAST_INSERT_ID(), IF(ISNULL(@iParentPageOrder), 1, @iParentPageOrder + 1));
+

+ 9 - 0
modules/boonex/google_connect/install/sql/uninstall.sql

@@ -0,0 +1,9 @@
+
+DROP TABLE IF EXISTS `bx_googlecon_accounts`;
+
+-- Studio page and widget
+
+DELETE FROM `tp`, `tw`, `tpw`
+USING `sys_std_pages` AS `tp`, `sys_std_widgets` AS `tw`, `sys_std_pages_widgets` AS `tpw`
+WHERE `tp`.`id` = `tw`.`page_id` AND `tw`.`id` = `tpw`.`widget_id` AND `tp`.`name` = 'bx_googlecon';
+

+ 18 - 0
modules/boonex/google_connect/request.php

@@ -0,0 +1,18 @@
+<?php defined('BX_DOL') or die('hack attempt');
+/**
+ * Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
+ * CC-BY License - http://creativecommons.org/licenses/by/3.0/
+ *
+ * @defgroup    GoogleConnect Google Connect
+ * @ingroup     TridentModules
+ *
+ * @{
+ */
+
+require_once(BX_DIRECTORY_PATH_INC . 'profiles.inc.php');
+
+check_logged();
+
+BxDolRequest::processAsAction($GLOBALS['aModule'], $GLOBALS['aRequest']);
+
+/** @} */

BIN
modules/boonex/google_connect/template/images/icons/std-mi.png


BIN
modules/boonex/google_connect/template/images/icons/std-pi.png


BIN
modules/boonex/google_connect/template/images/icons/std-si.png


BIN
modules/boonex/google_connect/template/images/icons/std-wi.png