/** * login() method return succeeded HTML message of connector * * @param $sData * @return string */ protected function login($sData = '') { $sLink = ''; // get back URI $sBackURI = self::$oSession->get('back'); if (!empty($sBackURI)) { $sLink = urldecode($sBackURI); } else { if (version_compare(_PS_VERSION_, '1.4', '>')) { $sLink = BT_FPCModuleTools::getAccountPageLink(); } else { global $smarty; $sLink = $smarty->_tpl_vars['base_dir_ssl'] . 'my-account.php'; } } if (!empty($sData)) { $sLink .= (strstr($sLink, '?') ? '&' : '?') . 'data=' . $sData; } // detect user agent to redirect or close the popup windows and reload the current page if (!empty($_SERVER['HTTP_USER_AGENT']) && (stristr($_SERVER['HTTP_USER_AGENT'], 'iphone') || stristr($_SERVER['HTTP_USER_AGENT'], 'mobile'))) { header("Location: " . $sLink); exit(0); } else { return '<script>' . ' window.opener.location.href = "' . $sLink . '";' . ' window.opener.focus();' . ' window.close();' . '</script>'; } }
/** * _displayBlock() method * * @param array $aParams * @return array */ private function _displayBlock(array $aParams) { // set $aAssign = array(); // get all configured hooks if (FacebookPsConnect::$aConfiguration[_FPC_MODULE_NAME . '_DISPLAY_BLOCK'] && !empty($GLOBALS[_FPC_MODULE_NAME . '_ZONE'][$this->sHookType]['data'])) { $aAssign['sStyle'] = strtolower(_FPC_MODULE_NAME) . '_mini_button'; $aAssign['bDisplay'] = true; $aAssign['bConnectorsActive'] = self::$bConnectorsActive; $aAssign['sConnectorButtonsIncl'] = BT_FPCModuleTools::getTemplatePath(_FPC_PATH_TPL_NAME . _FPC_TPL_HOOK_PATH . _FPC_TPL_CONNECTOR_BUTTONS); $aAssign['aHookConnectors'] = $GLOBALS[_FPC_MODULE_NAME . '_ZONE'][$this->sHookType]['data']; $aAssign['aConnectors'] = $GLOBALS[_FPC_MODULE_NAME . '_CONNECTORS']; $aAssign['sPosition'] = 'blockAccount'; $aAssign['sBackUri'] = self::$sCurrentURI; $aAssign['sLinkAccount16'] = BT_FPCModuleTools::getAccountPageLink(); // customer data $aAssign['sCustomerName'] = $this->iCustomerLogged ? BT_FPCModuleTools::getCookieObj()->customer_firstname . ' ' . BT_FPCModuleTools::getCookieObj()->customer_lastname : false; $aAssign['sFirstName'] = $this->iCustomerLogged ? BT_FPCModuleTools::getCookieObj()->customer_firstname : false; $aAssign['sLastName'] = $this->iCustomerLogged ? BT_FPCModuleTools::getCookieObj()->customer_lastname : false; // customer not logged if (!empty($this->iCustomerLogged)) { $aAssign['oCart'] = BT_FPCModuleTools::getCartObj(); $aAssign['iCartQty'] = BT_FPCModuleTools::getCartObj()->nbProducts(); } } else { $aAssign['bDisplay'] = false; } return array('tpl' => _FPC_TPL_HOOK_PATH . _FPC_TPL_ACCOUNT_BLOCK, 'assign' => $aAssign); }