/** * Register Form Config Methods * **/ private function _displayFormRegister() { $ebay = new eBayRequest(); if (!empty($this->context->cookie->eBaySession) && isset($_GET['action']) && $_GET['action'] == 'logged') { if (isset($_POST['eBayUsername'])) { $this->context->cookie->eBayUsername = $_POST['eBayUsername']; $this->setConfiguration('EBAY_API_USERNAME', $_POST['eBayUsername']); $this->setConfiguration('EBAY_IDENTIFIER', $_POST['eBayUsername']); } $ebay->session = $this->context->cookie->eBaySession; $ebay->username = $this->context->cookie->eBayUsername; $html = ' <script> function checkToken() { $.ajax({ url: \'' . _MODULE_DIR_ . 'ebay/ajax/checkToken.php?token=' . Configuration::get('EBAY_SECURITY_TOKEN') . '&time=' . pSQL(date('Ymdhis')) . '\', success: function(data) { if (data == \'OK\') window.location.href = \'index.php?' . ($this->isVersionOneDotFive() ? 'controller=' . Tools::safeOutput($_GET['controller']) : 'tab=' . Tools::safeOutput($_GET['tab'])) . '&configure=' . Tools::safeOutput($_GET['configure']) . '&token=' . Tools::safeOutput($_GET['token']) . '&tab_module=' . Tools::safeOutput($_GET['tab_module']) . '&module_name=' . Tools::safeOutput($_GET['module_name']) . '&action=validateToken\'; else setTimeout ("checkToken()", 5000); } }); } checkToken(); </script>'; $html .= '<fieldset><legend><img src="' . $this->_path . 'logo.gif" alt="" title="" />' . $this->l('Register the module on eBay') . '</legend>'; $html .= '<p align="center"><img src="' . $this->_path . 'loading.gif" alt="' . $this->l('Loading') . '" title="' . $this->l('Loading') . '" /></p>'; $html .= '<p align="center">' . $this->l('Once you sign in from the new eBay window, the module will automatically finish the installation a few seconds later') . '</p>'; $html .= '</fieldset>'; } else { if (empty($this->context->cookie->eBaySession)) { $ebay->login(); $this->context->cookie->eBaySession = $ebay->session; $this->setConfiguration('EBAY_API_SESSION', $ebay->session); } $html = ' <style> .ebay_dl {margin: 0 0 10px 40px} .ebay_dl > * {float: left; margin: 10px 0 0 10px} .ebay_dl > dt {min-width: 100px; display: block; clear: both; text-align: left} #ebay_label {font-weight: normal; float: none} #button_ebay{background-image:url(' . $this->_path . 'ebay.png);background-repeat:no-repeat;background-position:center 90px;width:385px;height:191px;cursor:pointer;padding-bottom:70px;font-weight:bold;font-size:22px} </style> <script> $(document).ready(function() { $(\'#button_ebay\').click(function() { if ($(\'#eBayUsername\').val() == \'\') { alert("' . $this->l('You have to set your eBay User ID') . '"); return false; } else window.open(\'' . $ebay->getLoginUrl() . '?SignIn&runame=' . $ebay->runame . '&SessID=' . $this->context->cookie->eBaySession . '\'); }); }); </script> <form action="' . Tools::safeOutput($_SERVER['REQUEST_URI']) . '&action=logged" method="post"> <fieldset> <legend><img src="' . $this->_path . 'logo.gif" alt="" title="" />' . $this->l('Register the module on eBay') . '</legend> <strong>' . $this->l('You already have a professional eBay account ?') . '</strong> <dl class="ebay_dl"> <dt><label for="eBayUsername" id="ebay_label">' . $this->l('eBay User ID') . '</label></dt> <dd><input id="eBayUsername" type="text" name="eBayUsername" value="' . $this->context->cookie->eBayUsername . '" /></dd> <dt> </dt> <dd><input type="submit" id="button_ebay" class="button" value="' . $this->l('Register the module on eBay') . '" /></dd> </dl> <br class="clear" /> <br /> <strong>' . $this->l('You do not have a professional eBay account yet ?') . '</strong><br /> <dl class="ebay_dl"> <dt><u><a href="' . $this->l('https://scgi.ebay.com/ws/eBayISAPI.dll?RegisterEnterInfo') . '" target="_blank">' . $this->l('Subscribe as a professional seller on eBay') . '</a></u></dt> <dd></dd> </dl> <br /><br /> <br /><u><a href="' . $this->l('http://pages.ebay.com/help/sell/businessfees.html') . '" target="_blank">' . $this->l('Consult eBay business fees') . '</a></u> <br />' . $this->l('Consult our "Help" section for more information') . ' </fieldset> </form>'; } return $html; }
private function _displayFormRegister() { global $cookie; $ebay = new eBayRequest(); if (!empty($cookie->eBaySession) && isset($_GET['action']) && $_GET['action'] == 'logged') { if (isset($_POST['eBayUsername'])) { $cookie->eBayUsername = $_POST['eBayUsername']; Configuration::updateValue('EBAY_API_USERNAME', $_POST['eBayUsername']); } $ebay->session = $cookie->eBaySession; $ebay->username = $cookie->eBayUsername; $html = ' <script> function checkToken() { $.ajax({ url: \'' . _MODULE_DIR_ . 'ebay/ajax/checkToken.php?token=' . Configuration::get('EBAY_SECURITY_TOKEN') . '&time=' . pSQL(date('Ymdhis')) . '\', success: function(data) { if (data == \'OK\') window.location.href = \'index.php?tab=' . Tools::safeOutput($_GET['tab']) . '&configure=' . Tools::safeOutput($_GET['configure']) . '&token=' . Tools::safeOutput($_GET['token']) . '&tab_module=' . Tools::safeOutput($_GET['tab_module']) . '&module_name=' . Tools::safeOutput($_GET['module_name']) . '&action=validateToken\'; else setTimeout ("checkToken()", 5000); } }); } checkToken(); </script>'; $html .= '<fieldset><legend><img src="' . $this->_path . 'logo.gif" alt="" title="" />' . $this->l('Register the module on eBay') . '</legend>'; $html .= '<p align="center"><img src="' . $this->_path . 'loading.gif" alt="' . $this->l('Loading') . '" title="' . $this->l('Loading') . '" /></p>'; $html .= '<p align="center">' . $this->l('Once you sign in from the new eBay window, the module will automatically finish the installation a few seconds later') . '</p>'; $html .= '</fieldset>'; } else { if (empty($cookie->eBaySession)) { $ebay->login(); $cookie->eBaySession = $ebay->session; Configuration::updateValue('EBAY_API_SESSION', $ebay->session); } $html = ' <style>#button_ebay{background-image:url(' . $this->_path . 'ebay.gif);background-repeat:no-repeat;background-position:center 100px;width:385px;height:191px;cursor:pointer;padding-bottom:70px;font-weight:bold;font-size:22px;}</style> <script> $(document).ready(function() { $(\'#button_ebay\').click(function() { if ($(\'#eBayUsername\').val() == \'\') { alert(\'' . $this->l('You have to set your eBay User ID') . '\'); return false; } else window.open(\'' . $ebay->getLoginUrl() . '?SignIn&runame=' . $ebay->runame . '&SessID=' . $cookie->eBaySession . '\'); }); }); </script> <form action="' . Tools::safeOutput($_SERVER['REQUEST_URI']) . '&action=logged" method="post"> <fieldset> <legend><img src="' . $this->_path . 'logo.gif" alt="" title="" />' . $this->l('Register the module on eBay') . '</legend> <label>' . $this->l('Click on the button below') . '</label> <div class="margin-form"> <br class="clear"/> <label for="eBayUsername">' . $this->l('eBay User ID') . ' </label><input id="eBayUsername" type="text" name="eBayUsername" value="' . $cookie->eBayUsername . '" /> <br class="clear"/><br /> <input type="submit" id="button_ebay" class="button" value="' . $this->l('Register the module on eBay') . '" /> </div> </fieldset> </form>'; } return $html; }