diff --git a/admin-dev/ajax.php b/admin-dev/ajax.php index 52b90a571..ed22a4566 100644 --- a/admin-dev/ajax.php +++ b/admin-dev/ajax.php @@ -170,8 +170,6 @@ if (Tools::isSubmit('ajaxDiscountCustomers')) if (Tools::getValue('page') == 'prestastore' AND @fsockopen('addons.prestashop.com', 80, $errno, $errst, 3)) readfile('http://addons.prestashop.com/adminmodules.php?lang='.$context->language->iso_code); -if (Tools::getValue('page') == 'themes' AND @fsockopen('addons.prestashop.com', 80, $errno, $errst, 3)) - readfile('http://addons.prestashop.com/adminthemes.php?lang='.$context->language->iso_code); if ($step = (int)(Tools::getValue('ajaxProductTab'))) { diff --git a/admin-dev/themes/template/themes/options.tpl b/admin-dev/themes/template/themes/options.tpl new file mode 100644 index 000000000..8bfc6f531 --- /dev/null +++ b/admin-dev/themes/template/themes/options.tpl @@ -0,0 +1,43 @@ +{* +* 2007-2011 PrestaShop +* +* NOTICE OF LICENSE +* +* This source file is subject to the Academic Free License (AFL 3.0) +* that is bundled with this package in the file LICENSE.txt. +* It is also available through the world-wide-web at this URL: +* http://opensource.org/licenses/afl-3.0.php +* If you did not receive a copy of the license and are unable to +* obtain it through the world-wide-web, please send an email +* to license@prestashop.com so we can send you a copy immediately. +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade PrestaShop to newer +* versions in the future. If you wish to customize PrestaShop for your +* needs please refer to http://www.prestashop.com for more information. +* +* @author PrestaShop SA +* @copyright 2007-2011 PrestaShop SA +* @version Release: $Revision: 9920 $ +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*} +{extends file="helper/options/options.tpl"} +{block name="after"} +

+
+ +{/block} diff --git a/classes/AdminTab.php b/classes/AdminTab.php index 8df2d849e..377b5dc29 100644 --- a/classes/AdminTab.php +++ b/classes/AdminTab.php @@ -1104,23 +1104,6 @@ abstract class AdminTabCore } - - protected function uploadIco($name, $dest) - { - - if (isset($_FILES[$name]['tmp_name']) && !empty($_FILES[$name]['tmp_name'])) - { - /* Check ico validity */ - if ($error = checkIco($_FILES[$name])) - $this->_errors[] = $error; - - /* Copy new ico */ - elseif(!copy($_FILES[$name]['tmp_name'], $dest)) - $this->_errors[] = Tools::displayError('an error occurred while uploading favicon: '.$_FILES[$name]['tmp_name'].' to '.$dest); - } - return !count($this->_errors) ? true : false; - } - /** * Overload this method for custom checking * diff --git a/admin-dev/tabs/AdminThemes.php b/controllers/admin/AdminThemesController.php similarity index 90% rename from admin-dev/tabs/AdminThemes.php rename to controllers/admin/AdminThemesController.php index f80aa2caf..d58a909a6 100644 --- a/admin-dev/tabs/AdminThemes.php +++ b/controllers/admin/AdminThemesController.php @@ -25,9 +25,7 @@ * International Registered Trademark & Property of PrestaShop SA */ -include_once(_PS_ADMIN_DIR_.'/tabs/AdminPreferences.php'); - -class AdminThemes extends AdminPreferences +class AdminThemesController extends AdminController { /** This value is used in isThemeCompatible method. only version node with an * higher version number will be used in [theme]/config.xml @@ -99,7 +97,7 @@ class AdminThemes extends AdminPreferences parent::__construct(); $id_shop = Context::getContext()->shop->getID(); - $this->optionsList = array( + $this->options = array( 'appearance' => array( 'title' => $this->l('Appearance'), 'icon' => 'email', @@ -112,32 +110,43 @@ class AdminThemes extends AdminPreferences 'PS_STORES_ICON' => array('title' => $this->l('Store icon:'), 'desc' => $this->l('Will appear on the store locator (inside Google Maps)').'
'.$this->l('Suggested size: 30x30, Transparent GIF'), 'type' => 'file', 'thumb' => array('file' => _PS_IMG_.'logo_stores-'.(int)$id_shop.'.gif?date='.time(), 'pos' => 'before')), 'PS_NAVIGATION_PIPE' => array('title' => $this->l('Navigation pipe:'), 'desc' => $this->l('Used for navigation path inside categories/product'), 'cast' => 'strval', 'type' => 'text', 'size' => 20), ), + 'submit' => array('title' => $this->l(' Save '), 'class' => 'button') ), ); } - public function display() + public function initContent() { + $content = ''; if (file_exists(_PS_IMG_DIR_.'logo.jpg')) { list($width, $height, $type, $attr) = getimagesize(_PS_IMG_DIR_.'logo.jpg'); Configuration::updateValue('SHOP_LOGO_WIDTH', (int)round($width)); Configuration::updateValue('SHOP_LOGO_HEIGHT', (int)round($height)); } - // No cache for auto-refresh uploaded logo header('Cache-Control: no-cache, must-revalidate'); header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); - $this->displayOptionsList(); + // $this->displayOptionsList(); - echo '

'; - if (@ini_get('allow_url_fopen') AND @fsockopen('addons.prestashop.com', 80, $errno, $errst, 3)) - echo ' -
'; +
ZZZZZ
'; else - echo ''.$this->l('Find new themes on PrestaShop Addons!').''; + $content .= ''.$this->l('Find new themes on PrestaShop Addons!').''; + */ + $this->content .= $content; + return parent::initContent(); + } + + public function ajaxProcessGetAddonsThemes() + { + // notice : readfile should be replaced by something else + if (@fsockopen('addons.prestashop.com', 80, $errno, $errst, 3)) + readfile('http://addons.prestashop.com/adminmodules.php?lang='.$this->context->language->iso_code); + $this->content = ''; } /** @@ -349,4 +358,20 @@ class AdminThemes extends AdminPreferences $this->uploadIco('PS_FAVICON', _PS_IMG_DIR_.'favicon.ico'); $this->uploadIco('PS_FAVICON', _PS_IMG_DIR_.'favicon-'.(int)$id_shop.'.ico'); } + + protected function uploadIco($name, $dest) + { + + if (isset($_FILES[$name]['tmp_name']) && !empty($_FILES[$name]['tmp_name'])) + { + /* Check ico validity */ + if ($error = checkIco($_FILES[$name])) + $this->_errors[] = $error; + + /* Copy new ico */ + elseif(!copy($_FILES[$name]['tmp_name'], $dest)) + $this->_errors[] = Tools::displayError('an error occurred while uploading favicon: '.$_FILES[$name]['tmp_name'].' to '.$dest); + } + return !count($this->_errors) ? true : false; + } }