diff --git a/admin-dev/ajax.php b/admin-dev/ajax.php index 8b1949ceb..00f42ec98 100644 --- a/admin-dev/ajax.php +++ b/admin-dev/ajax.php @@ -598,4 +598,54 @@ if (Tools::isSubmit('saveHook')) } die('{"hasError" : false, "errors" : ""}'); +} + +if (Tools::isSubmit('getAdminHomeElement')) +{ + $result = array(); + + // PREACTIVATION + $protocol = (!empty($_SERVER['HTTPS']) AND strtolower($_SERVER['HTTPS']) != 'off') ? 'https' : 'http'; + $isoUser = Language::getIsoById(intval($cookie->id_lang)); + $isoCountry = Country::getIsoById(Configuration::get('PS_COUNTRY_DEFAULT')); + + $context = stream_context_create(array('http' => array('method'=>"GET", 'timeout' => 5))); + $content = @file_get_contents('https://www.prestashop.com/partner/preactivation/preactivation-block.php?version=1.0&shop='.urlencode(Configuration::get('PS_SHOP_NAME')).'&protocol='.$protocol.'&url='.urlencode($_SERVER['HTTP_HOST']).'&iso_country='.$isoCountry.'&iso_lang='.Tools::strtolower($isoUser).'&id_lang='.(int)$cookie->id_lang.'&email='.urlencode(Configuration::get('PS_SHOP_EMAIL')).'&security='.md5(Configuration::get('PS_SHOP_EMAIL')._COOKIE_IV_), false, $context); + if (!$content) + die('NOK'); + $content = explode('|', $content); + if ($content[0] == 'OK') + { + $result['partner_preactivation'] = $content[2]; + $content[1] = explode('#%#', $content[1]); + foreach ($content[1] as $partnerPopUp) + if ($partnerPopUp) + { + $partnerPopUp = explode('%%', $partnerPopUp); + if (!Configuration::get('PS_PREACTIVATION_'.strtoupper($partnerPopUp[0]))) + { + $result['partner_preactivation'] .= $partnerPopUp[1]; + Configuration::updateValue('PS_PREACTIVATION_'.strtoupper($partnerPopUp[0]), 'TRUE'); + } + } + } + + // DISCOVER PRESTASHOP + $content = @file_get_contents('https://www.prestashop.com/partner/prestashop/prestashop-link.php?iso_country='.$isoCountry.'&iso_lang='.Tools::strtolower($isoUser).'&id_lang='.(int)$cookie->id_lang, false, $context); + $content = explode('|', $content); + if ($content[0] == 'OK') + $result['discover_prestashop'] = $content[1]; + else + $result['discover_prestashop'] = ''; + + if (@fsockopen('www.prestashop.com', 80, $errno, $errst, 3)) + $result['discover_prestashop'] .= ''; + + $content = @file_get_contents('https://www.prestashop.com/partner/paypal/paypal-tips.php?protocol='.$protocol.'&iso_country='.$isoCountry.'&iso_lang='.Tools::strtolower($isoUser).'&id_lang='.(int)$cookie->id_lang, false, $context); + $content = explode('|', $content); + if ($content[0] == 'OK') + $result['discover_prestashop'] .= $content[1]; + + + die(Tools::jsonEncode($result)); } \ No newline at end of file diff --git a/admin-dev/tabs/AdminHome.php b/admin-dev/tabs/AdminHome.php index 9f11b09a8..841aadc6b 100644 --- a/admin-dev/tabs/AdminHome.php +++ b/admin-dev/tabs/AdminHome.php @@ -370,73 +370,49 @@ class AdminHome extends AdminTab echo ' - - '; + +
+ +
+

'.translate('Loading...').'

+
+ '; - echo ' -
'; - - $context = stream_context_create(array('http' => array('method'=>"GET", 'timeout' => 5))); - $content = @file_get_contents('https://www.prestashop.com/partner/preactivation/preactivation-block.php?version=1.0&shop='.urlencode(Configuration::get('PS_SHOP_NAME')).'&protocol='.$protocol.'&url='.urlencode($_SERVER['HTTP_HOST']).'&iso_country='.$isoCountry.'&iso_lang='.Tools::strtolower($isoUser).'&id_lang='.(int)$cookie->id_lang.'&email='.urlencode(Configuration::get('PS_SHOP_EMAIL')).'&security='.md5(Configuration::get('PS_SHOP_EMAIL')._COOKIE_IV_), false, $context); - $content = explode('|', $content); - if ($content[0] == 'OK') - { - echo $content[2]; - $content[1] = explode('#%#', $content[1]); - foreach ($content[1] as $partnerPopUp) - if ($partnerPopUp) - { - $partnerPopUp = explode('%%', $partnerPopUp); - if (!Configuration::get('PS_PREACTIVATION_'.strtoupper($partnerPopUp[0]))) - { - echo $partnerPopUp[1]; - Configuration::updateValue('PS_PREACTIVATION_'.strtoupper($partnerPopUp[0]), 'TRUE'); - } - } - } - if (Tools::isSubmit('hideOptimizationTips')) Configuration::updateValue('PS_HIDE_OPTIMIZATION_TIPS', 1); $this->_displayOptimizationTips(); - $context = stream_context_create(array('http' => array('method'=>"GET", 'timeout' => 5))); - $content = @file_get_contents('https://www.prestashop.com/partner/prestashop/prestashop-link.php?iso_country='.$isoCountry.'&iso_lang='.Tools::strtolower($isoUser).'&id_lang='.(int)$cookie->id_lang, false, $context); - $content = explode('|', $content); - if ($content[0] == 'OK') - echo $content[1]; - else - echo ' - '; - - if (@fsockopen('www.prestashop.com', 80, $errno, $errst, 3)) - echo ''; - - $context = stream_context_create(array('http' => array('method'=>"GET", 'timeout' => 5))); - $content = @file_get_contents('https://www.prestashop.com/partner/paypal/paypal-tips.php?protocol='.$protocol.'&iso_country='.$isoCountry.'&iso_lang='.Tools::strtolower($isoUser).'&id_lang='.(int)$cookie->id_lang, false, $context); - $content = explode('|', $content); - if ($content[0] == 'OK') - echo $content[1]; - - - echo '
+ echo ' +
+

'.translate('Loading...').'

+
+
'; echo Module::hookExec('backOfficeHome'); diff --git a/install-dev/index.php b/install-dev/index.php index f6719c746..7a926e89e 100644 --- a/install-dev/index.php +++ b/install-dev/index.php @@ -97,7 +97,7 @@ if ($lm->getIncludeTradFilename()) - <?php echo lang('PrestaShop '.INSTALL_VERSION.' Installer')?> + <?php echo lang('PrestaShop '.INSTALL_VERSION.' Installer'); ?> @@ -609,7 +609,7 @@ if ($lm->getIncludeTradFilename()) return ''; } - $context = stream_context_create(array('http' => array('method'=>"GET", 'timeout' => 5))); + $context = stream_context_create(array('http' => array('method'=>"GET", 'timeout' => 3))); $content = @file_get_contents('https://www.prestashop.com/partner/preactivation/partners.php?version=1.0', false, $context); if ($content && $content[0] == '<') { @@ -829,7 +829,6 @@ if ($lm->getIncludeTradFilename()) $countNonNative = 0; if ($oldversion !== false) { - include_once(realpath(INSTALL_PATH.'/../config').'/settings.inc.php'); include_once(realpath(INSTALL_PATH.'/../config').'/config.inc.php'); $moduleList = Module::getNonNativeModuleList(); $moduleNonNativeLi = '