public function postProcess() { global $currentIndex; if (Tools::isSubmit('submitPrint')) { if (!Validate::isDate(Tools::getValue('date_from'))) { $this->_errors[] = $this->l('Invalid from date'); } if (!Validate::isDate(Tools::getValue('date_to'))) { $this->_errors[] = $this->l('Invalid end date'); } if (!sizeof($this->_errors)) { $orders = Order::getOrdersIdInvoiceByDate(Tools::getValue('date_from'), Tools::getValue('date_to'), NULL, 'invoice'); if (sizeof($orders)) { Tools::redirectAdmin('pdf.php?invoices&date_from=' . urlencode(Tools::getValue('date_from')) . '&date_to=' . urlencode(Tools::getValue('date_to')) . '&token=' . $this->token); } $this->_errors[] = $this->l('No invoice found for this period'); } } elseif (Tools::isSubmit('submitOptionsinvoice')) { if (intval(Tools::getValue('PS_INVOICE_NUMBER')) == 0) { $this->_errors[] = $this->l('Invalid invoice number'); } else { parent::postProcess(); } } else { parent::postProcess(); } }
public function __construct() { MondialRelay::initModuleAccess(); $this->table = 'mr_selected'; $this->className = 'MondialRelayClass'; parent::__construct(); }
public function displayForm($isMainTab = true) { global $currentIndex; parent::displayForm(); if (!($banner = $this->loadObject(true))) { return; } //echo '<pre>'; print_r( $banner ); exit; echo ' <form action="' . $currentIndex . '&submitAdd' . $this->table . '=1&token=' . $this->token . '" method="post" enctype="multipart/form-data"> ' . ($banner->id_banner ? '<input type="hidden" name="id_' . $this->table . '" value="' . $banner->id_banner . '" />' : '') . ' <fieldset> <legend><img src="../img/admin/suppliers.gif" />' . $this->l('Banners') . '</legend> <label>' . $this->l('Title:') . ' </label> <div class="margin-form"> <input type="text" size="40" name="title" value="' . htmlentities(Tools::getValue('title', $banner->title), ENT_COMPAT, 'UTF-8') . '" /> <sup>*</sup> <span class="hint" name="help_box">' . $this->l('Invalid characters:') . ' <>;=#{}<span class="hint-pointer"> </span></span> </div> <label>' . $this->l('URL:') . ' </label> <div class="margin-form"> <input type="text" size="40" name="url" value="' . htmlentities(Tools::getValue('url', $banner->url), ENT_COMPAT, 'UTF-8') . '" /> <sup>*</sup> <span class="hint" name="help_box">' . $this->l('Invalid characters:') . ' <>;=#{}<span class="hint-pointer"> </span></span> </div> <label>' . $this->l('Image Path:') . ' </label> <div class="margin-form"> <input type="hidden" name="image_path" value="' . htmlentities(Tools::getValue('image_path', $banner->image_path), ENT_COMPAT, 'UTF-8') . '" /> <input type="file" size="40" name="banner_image"/>'; $image_path = Tools::getValue('image_path', $banner->image_path); if (!empty($image_path)) { echo '<a href="http://' . _MEDIA_SERVER_1_ . $this->image_dir . Tools::getValue('image_path', $banner->image_path) . '" target="__blank">'; echo ' <img src="http://' . _MEDIA_SERVER_1_ . $this->image_dir . Tools::getValue('image_path', $banner->image_path) . '" width="200px" />'; echo '</a>'; } echo '</div> <label>' . $this->l('Display Order:') . ' </label> <div class="margin-form"> <input type="text" size="40" name="display_order" value="' . htmlentities(Tools::getValue('display_order', $banner->display_order), ENT_COMPAT, 'UTF-8') . '" /> <span class="hint" name="help_box">' . $this->l('Invalid characters:') . ' <>;=#{}<span class="hint-pointer"> </span></span> </div> <label>' . $this->l('Enable:') . ' </label> <div class="margin-form"> <input type="radio" name="is_active" id="active_on" value="1" ' . ($this->getFieldValue($banner, 'is_active') ? 'checked="checked" ' : '') . '/> <label class="t" for="active_on"> <img src="../img/admin/enabled.gif" alt="' . $this->l('Enabled') . '" title="' . $this->l('Enabled') . '" /></label> <input type="radio" name="is_active" id="active_off" value="0" ' . (!$this->getFieldValue($banner, 'is_active') ? 'checked="checked" ' : '') . '/> <label class="t" for="active_off"> <img src="../img/admin/disabled.gif" alt="' . $this->l('Disabled') . '" title="' . $this->l('Disabled') . '" /></label> </div> <div class="margin-form"> <input type="submit" value="' . $this->l(' Save ') . '" name="submitAdd' . $this->table . '" class="button" /> </div> <div class="small"><sup>*</sup> ' . $this->l('Required field') . '</div> </fieldset> </form>'; }
public function postProcess() { if (Tools::isSubmit('submitAdd' . $this->table)) { if ($id = intval(Tools::getValue('id_attachment')) and $a = new Attachment($id)) { $_POST['file'] = $a->file; $_POST['mime'] = $a->mime; } if (!sizeof($this->_errors)) { if (isset($_FILES['file']) and is_uploaded_file($_FILES['file']['tmp_name'])) { if ($_FILES['file']['size'] > $this->maxFileSize) { $this->_errors[] = $this->l('File too large, maximum size allowed:') . ' ' . $this->maxFileSize / 1000 . ' ' . $this->l('kb'); } else { $uploadDir = dirname(__FILE__) . '/../../download/'; do { $uniqid = sha1(microtime()); } while (file_exists($uploadDir . $uniqid)); if (!copy($_FILES['file']['tmp_name'], $uploadDir . $uniqid)) { $this->_errors[] = $this->l('File copy failed'); } @unlink($_FILES['file']['tmp_name']); $_POST['file'] = $uniqid; $_POST['mime'] = $_FILES['file']['type']; } } } $this->validateRules(); } return parent::postProcess(); }
public function displayForm($isMainTab = true) { global $currentIndex; parent::displayForm(); if (!($obj = $this->loadObject(true))) { return; } echo ' <form action="' . $currentIndex . '&submitAdd' . $this->table . '=1&token=' . $this->token . '" method="post"> ' . ($obj->id ? '<input type="hidden" name="id_' . $this->table . '" value="' . $obj->id . '" />' : '') . ' <fieldset><legend><img src="../img/admin/profiles.png" />' . $this->l('Profiles') . '</legend> <label>' . $this->l('Name:') . ' </label> <div class="margin-form">'; foreach ($this->_languages as $language) { echo ' <div id="name_' . $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none') . '; float: left;"> <input size="33" type="text" name="name_' . $language['id_lang'] . '" value="' . htmlentities($this->getFieldValue($obj, 'name', (int) $language['id_lang']), ENT_COMPAT, 'UTF-8') . '" /><sup> *</sup> </div>'; } $this->displayFlags($this->_languages, $this->_defaultFormLanguage, 'name', 'name'); echo ' <div class="clear"></div> </div> <div class="margin-form"> <input type="submit" value="' . $this->l(' Save ') . '" name="submitAdd' . $this->table . '" class="button" /> </div> <div class="small"><sup>*</sup> ' . $this->l('Required field') . '</div> </fieldset> </form>'; }
public function postProcess() { if (isset($_POST['submitAdd' . $this->table])) { $search = strval(Tools::getValue('search')); $string = strval(Tools::getValue('alias')); $aliases = explode(',', $string); if (empty($search) or empty($string)) { $this->_errors[] = $this->l('aliases and result are both required'); } if (!Validate::isValidSearch($search)) { $this->_errors[] = $search . ' ' . $this->l('is not a valid result'); } foreach ($aliases as $alias) { if (!Validate::isValidSearch($alias)) { $this->_errors[] = $alias . ' ' . $this->l('is not a valid alias'); } } if (!sizeof($this->_errors)) { Alias::deleteAliases($search); foreach ($aliases as $alias) { $obj = new Alias(NULL, trim($alias), trim($search)); $obj->save(); } } } else { parent::postProcess(); } }
public function postProcess() { global $currentIndex; $this->product = new Product(intval(Tools::getValue('id_product'))); if (isset($_POST['generate'])) { if (!is_array(Tools::getValue('options'))) { $this->_errors[] = Tools::displayError('You need to choose at least 1 attribute.'); } else { $tab = array_values($_POST['options']); if (sizeof($tab) and Validate::isLoadedObject($this->product)) { self::setAttributesImpacts($this->product->id, $tab); $this->combinations = array_values(self::createCombinations($tab)); $values = array_values(array_map(array($this, 'addAttribute'), $this->combinations)); $this->product->deleteProductAttributes(); $res = $this->product->addProductAttributeMultiple($values); $this->product->addAttributeCombinationMultiple($res, $this->combinations); } else { $this->_errors[] = Tools::displayError('Unable to initialize parameters, combinations is missing or object cannot be load.'); } } } elseif (isset($_POST['back'])) { Tools::redirectAdmin($currentIndex . '&id_product=' . intval(Tools::getValue('id_product')) . '&id_category=' . intval(Tools::getValue('id_category')) . '&addproduct' . '&tabs=2&token=' . Tools::getValue('token')); } parent::postProcess(); }
public function displayForm($isMainTab = true) { global $currentIndex; parent::displayForm(); if (!($obj = $this->loadObject(true))) { return; } echo ' <form action="' . $currentIndex . '&submitAdd' . $this->table . '=1&token=' . $this->token . '" method="post"> ' . ($obj->id ? '<input type="hidden" name="id_' . $this->table . '" value="' . $obj->id . '" />' : '') . ' <fieldset><legend><img src="../img/admin/search.gif" />' . $this->l('Aliases') . '</legend> <label>' . $this->l('Alias:') . ' </label> <div class="margin-form"> <input type="text" size="40" name="alias" value="' . Tools::getValue('alias', htmlentities($obj->getAliases(), ENT_COMPAT, 'UTF-8')) . '" /> <sup>*</sup> <p class="clear">' . $this->l('Enter each alias separated by a comma (\',\')') . ' ' . $this->l('(e.g., \'prestshop,preztashop,prestasohp\')') . '<br /> ' . $this->l('Forbidden characters:') . ' <>;=#{}</p> </div> <label>' . $this->l('Result:') . ' </label> <div class="margin-form"> <input type="text" size="15" name="search" value="' . htmlentities($this->getFieldValue($obj, 'search'), ENT_COMPAT, 'UTF-8') . '" /> <sup>*</sup> <p class="clear">' . $this->l('Search this word instead.') . '</p> </div> <div class="margin-form"> <input type="submit" value="' . $this->l(' Save ') . '" name="submitAdd' . $this->table . '" class="button" /> </div> <div class="small"><sup>*</sup> ' . $this->l('Required field') . '</div> </fieldset> </form>'; }
public function viewAccess($disable = false) { $result = parent::viewAccess($disable); $this->adminCategories->tabAccess = $this->tabAccess; $this->adminProducts->tabAccess = $this->tabAccess; return $result; }
public function __construct() { $this->table = 'delivery'; $currency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT')); $this->_fieldsHandling = array('PS_SHIPPING_HANDLING' => array('title' => $this->l('Handling charges'), 'suffix' => $currency, 'validation' => 'isPrice', 'cast' => 'floatval'), 'PS_SHIPPING_FREE_PRICE' => array('title' => $this->l('Free shipping starts at'), 'suffix' => $currency, 'validation' => 'isPrice', 'cast' => 'floatval'), 'PS_SHIPPING_FREE_WEIGHT' => array('title' => $this->l('Free shipping starts at'), 'suffix' => Configuration::get('PS_WEIGHT_UNIT'), 'validation' => 'isUnsignedFloat', 'cast' => 'floatval'), 'PS_SHIPPING_METHOD' => array('title' => $this->l('Billing'), 'validation' => 'isBool', 'cast' => 'intval')); parent::__construct(); }
function __construct() { parent::__construct(); $this->_moduleCacheFile = _PS_ROOT_DIR_ . '/config/modules_list.xml'; //refresh modules_list.xml every week if (!$this->isFresh()) { $this->refresh(); } $this->listTabModules = array('administration' => $this->l('Administration'), 'advertising_marketing' => $this->l('Advertising & Marketing'), 'analytics_stats' => $this->l('Analytics & Stats'), 'billing_invoicing' => $this->l('Billing & Invoicing'), 'checkout' => $this->l('Checkout'), 'content_management' => $this->l('Content Management'), 'export' => $this->l('Export'), 'front_office_features' => $this->l('Front Office Features'), 'i18n_localization' => $this->l('I18n & Localization'), 'merchandizing' => $this->l('Merchandizing'), 'migration_tools' => $this->l('Migration Tools'), 'payments_gateways' => $this->l('Payments & Gateways'), 'payment_security' => $this->l('Payment Security'), 'pricing_promotion' => $this->l('Pricing & Promotion'), 'quick_bulk_update' => $this->l('Quick / Bulk update'), 'search_filter' => $this->l('Search & Filter'), 'seo' => $this->l('SEO'), 'shipping_logistics' => $this->l('Shipping & Logistics'), 'slideshows' => $this->l('Slideshows'), 'smart_shopping' => $this->l('Smart Shopping'), 'market_place' => $this->l('Market Place'), 'social_networks' => $this->l('Social Networks'), 'others' => $this->l('Other Modules')); $xmlModules = @simplexml_load_file($this->_moduleCacheFile); foreach ($xmlModules->children() as $xmlModule) { if ($xmlModule->attributes() == 'native') { foreach ($xmlModule->children() as $module) { foreach ($module->attributes() as $key => $value) { if ($key == 'name') { $this->listNativeModules[] = (string) $value; } } } } } if ($xmlModule->attributes() == 'partner') { foreach ($xmlModule->children() as $module) { foreach ($module->attributes() as $key => $value) { if ($key == 'name') { $this->listPartnerModules[] = (string) $value; } } } } }
public function viewAccess($disable = false) { $result = parent::viewAccess($disable); $this->adminOrdersStates->tabAccess = $this->tabAccess; $this->adminReturnStates->tabAccess = $this->tabAccess; return $result; }
public function displayForm($isMainTab = true) { global $currentIndex; parent::displayForm(); if (!($obj = $this->loadObject(true))) { return; } echo ' <form action="' . $currentIndex . '&submitAdd' . $this->table . '=1&token=' . $this->token . '" method="post"> ' . ($obj->id ? '<input type="hidden" name="id_' . $this->table . '" value="' . $obj->id . '" />' : '') . ' <fieldset><legend>' . $this->l('Referrer') . '</legend> <label>' . $this->l('Server') . ' </label> <div class="margin-form"> <input type="text" size="20" name="server" value="' . htmlentities($this->getFieldValue($obj, 'server'), ENT_COMPAT, 'UTF-8') . '" /> <sup>*</sup> </div> <label>' . $this->l('$_GET variable') . ' </label> <div class="margin-form"> <input type="text" size="40" name="getvar" value="' . htmlentities($this->getFieldValue($obj, 'getvar'), ENT_COMPAT, 'UTF-8') . '" /> <sup>*</sup> </div> <div class="margin-form"> <input type="submit" value="' . $this->l(' Save ') . '" name="submitAdd' . $this->table . '" class="button" /> </div> <div class="small"><sup>*</sup> ' . $this->l('Required field') . '</div> </fieldset> </form>'; }
public function __construct() { /* Get all modules then select only payment ones*/ $modules = Module::getModulesOnDisk(); foreach ($modules as $module) { if ($module->tab == 'Payment') { if ($module->id) { $module->country = array(); $countries = DB::getInstance()->ExecuteS('SELECT id_country FROM ' . _DB_PREFIX_ . 'module_country WHERE id_module = ' . intval($module->id)); foreach ($countries as $country) { $module->country[] = $country['id_country']; } $module->currency = array(); $currencies = DB::getInstance()->ExecuteS('SELECT id_currency FROM ' . _DB_PREFIX_ . 'module_currency WHERE id_module = ' . intval($module->id)); foreach ($currencies as $currency) { $module->currency[] = $currency['id_currency']; } $module->group = array(); $groups = DB::getInstance()->ExecuteS('SELECT id_group FROM ' . _DB_PREFIX_ . 'module_group WHERE id_module = ' . intval($module->id)); foreach ($groups as $group) { $module->group[] = $group['id_group']; } } else { $module->country = NULL; $module->currency = NULL; $module->group = NULL; } $this->paymentModules[] = $module; } } parent::__construct(); }
public function __construct() { global $cookie; $this->table = 'manufacturer'; $this->className = 'Manufacturer'; $this->lang = false; $this->edit = true; $this->delete = true; // Sub tab addresses $countries = Country::getCountries(intval($cookie->id_lang)); foreach ($countries as $country) { $this->countriesArray[$country['id_country']] = $country['name']; } $this->fieldsDisplayAddresses = array('id_address' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25), 'm!manufacturer_name' => array('title' => $this->l('Manufacturer'), 'width' => 100), 'firstname' => array('title' => $this->l('First name'), 'width' => 80), 'lastname' => array('title' => $this->l('Last name'), 'width' => 100, 'filter_key' => 'a!name'), 'postcode' => array('title' => $this->l('Post/Zip code'), 'align' => 'right', 'width' => 50), 'city' => array('title' => $this->l('City'), 'width' => 150), 'country' => array('title' => $this->l('Country'), 'width' => 100, 'type' => 'select', 'select' => $this->countriesArray, 'filter_key' => 'cl!id_country')); $this->_includeTabTitle = array($this->l('Manufacturers addresses')); $this->_joinAddresses = 'LEFT JOIN `' . _DB_PREFIX_ . 'country_lang` cl ON (cl.`id_country` = a.`id_country` AND cl.`id_lang` = ' . intval($cookie->id_lang) . ') '; $this->_joinAddresses .= 'LEFT JOIN `' . _DB_PREFIX_ . 'manufacturer` m ON (a.`id_manufacturer` = m.`id_manufacturer`)'; $this->_selectAddresses = 'cl.`name` as country, m.`name` AS manufacturer_name'; $this->_includeTab = array('Addresses' => array('addressType' => 'manufacturer', 'fieldsDisplay' => $this->fieldsDisplayAddresses, '_join' => $this->_joinAddresses, '_select' => $this->_selectAddresses)); $this->view = true; $this->_select = 'COUNT(`id_product`) AS `products`, (SELECT COUNT(ad.`id_manufacturer`) as `addresses` FROM `' . _DB_PREFIX_ . 'address` ad WHERE ad.`id_manufacturer` = a.`id_manufacturer` GROUP BY ad.`id_manufacturer`) as `addresses`'; $this->_join = 'LEFT JOIN `' . _DB_PREFIX_ . 'product` p ON (a.`id_manufacturer` = p.`id_manufacturer`)'; $this->_joinCount = false; $this->_group = 'GROUP BY a.`id_manufacturer`'; $this->fieldImageSettings = array('name' => 'logo', 'dir' => 'm'); $this->fieldsDisplay = array('id_manufacturer' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25), 'name' => array('title' => $this->l('Name'), 'width' => 200), 'logo' => array('title' => $this->l('Logo'), 'align' => 'center', 'image' => 'm', 'orderby' => false, 'search' => false), 'addresses' => array('title' => $this->l('Addresses'), 'align' => 'right', 'tmpTableFilter' => true, 'width' => 20), 'products' => array('title' => $this->l('Products'), 'align' => 'right', 'tmpTableFilter' => true, 'width' => 20)); $countries = Country::getCountries(intval($cookie->id_lang)); foreach ($countries as $country) { $this->countriesArray[$country['id_country']] = $country['name']; } parent::__construct(); }
public function displayForm($isMainTab = true) { global $currentIndex; parent::displayForm(); $obj = $this->loadObject(true); echo ' <form action="' . $currentIndex . '&submitAdd' . $this->table . '=1&token=' . $this->token . '" method="post" enctype="multipart/form-data" class="width2"> ' . ($obj->id ? '<input type="hidden" name="id_' . $this->table . '" value="' . $obj->id . '" />' : '') . ' <fieldset><legend><img src="../img/admin/world.gif" />' . $this->l('Zones') . '</legend> <label>' . $this->l('Name:') . '</label> <div class="margin-form"> <input type="text" size="33" name="name" value="' . htmlentities(Tools::getValue('name', $obj->name), ENT_COMPAT, 'UTF-8') . '" /> <sup>*</sup> <span class="hint" name="help_box">' . $this->l('Allowed characters: letters, spaces and') . ' (-)<span class="hint-pointer"> </span></span> <p class="clear">' . $this->l('Zone name, e.g., Africa, West Coast, Neighboring Countries') . '</p> </div> <label>' . $this->l('Status:') . ' </label> <div class="margin-form"> <input type="radio" name="active" id="active_on" value="1" ' . ((!$obj->id or Tools::getValue('active', $obj->active)) ? 'checked="checked" ' : '') . '/> <label class="t" for="active_on"> <img src="../img/admin/enabled.gif" alt="' . $this->l('Enabled') . '" title="' . $this->l('Enabled') . '" /></label> <input type="radio" name="active" id="active_off" value="0" ' . ((!Tools::getValue('active', $obj->active) and $obj->id) ? 'checked="checked" ' : '') . '/> <label class="t" for="active_off"> <img src="../img/admin/disabled.gif" alt="' . $this->l('Disabled') . '" title="' . $this->l('Disabled') . '" /></label> <p>' . $this->l('Allow or disallow shipping to this zone') . '</p> </div> <div class="margin-form"> <input type="submit" value="' . $this->l(' Save ') . '" name="submitAdd' . $this->table . '" class="button" /> </div> <div class="small"><sup>*</sup> ' . $this->l('Required field') . '</div> </fieldset> </form>'; }
public function __construct() { parent::__construct(); self::$tpl_regexp = '/\\{l s=\'' . _PS_TRANS_PATTERN_ . '\'( mod=\'.+\')?( js=1)?\\}/U'; // added ? after spaces because some peoples forget them. see PSCFI-2501 self::$php_regexp = '/->l\\(\'' . _PS_TRANS_PATTERN_ . '\'(, ?\'(.+)\')?(, ?(.+))?\\)/U'; }
public function displayForm($isMainTab = true) { global $currentIndex; parent::displayForm(); if (!($obj = $this->loadObject(true))) { return; } echo ' <form action="' . $currentIndex . '&submitAdd' . $this->table . '=1&token=' . $this->token . '" method="post" enctype="multipart/form-data"> ' . ($obj->id ? '<input type="hidden" name="id_' . $this->table . '" value="' . $obj->id . '" />' : '') . ' <fieldset><legend><img src="../img/admin/time.gif" />' . $this->l('Order statuses') . '</legend> <label>' . $this->l('Status name:') . ' </label> <div class="margin-form">'; foreach ($this->_languages as $language) { echo ' <div id="name_' . $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none') . '; float: left;"> <input size="40" type="text" name="name_' . $language['id_lang'] . '" value="' . htmlentities($this->getFieldValue($obj, 'name', (int) $language['id_lang']), ENT_COMPAT, 'UTF-8') . '" /><sup> *</sup> <span class="hint" name="help_box">' . $this->l('Invalid characters: numbers and') . ' !<>,;?=+()@#"�{}_$%:<span class="hint-pointer"> </span></span> </div>'; } $this->displayFlags($this->_languages, $this->_defaultFormLanguage, 'name', 'name'); echo ' <p style="clear: both">' . $this->l('Order return status name') . '</p> </div> <div class="margin-form"> <input type="submit" value="' . $this->l(' Save ') . '" name="submitAdd' . $this->table . '" class="button" /> </div> <div class="small"><sup>*</sup> ' . $this->l('Required field') . '</div> </fieldset> </form>'; }
public function displayForm($isMainTab = true) { global $cookie, $currentIndex; parent::displayForm(); $currentProfile = (int) $this->getCurrentProfileId(); $tabs = Tab::getTabs($cookie->id_lang); $profiles = Profile::getProfiles((int) $cookie->id_lang); $accesses = Profile::getProfileAccesses((int) $currentProfile); echo ' <script type="text/javascript"> setLang(Array(\'' . $this->l('Profile updated') . '\', \'' . $this->l('Request failed!') . '\', \'' . $this->l('Update in progress. Please wait.') . '\', \'' . $this->l('Server connection failed!') . '\')); </script> <div id="ajax_confirmation"></div> <table class="table" cellspacing="0"> <tr> <th ' . ($currentProfile == (int) _PS_ADMIN_PROFILE_ ? 'colspan="6"' : '') . '> <select name="profile" onchange="redirect(\'' . Tools::getHttpHost(true, true) . $currentIndex . '&token=' . $this->token . '&profile=\'+this.options[this.selectedIndex].value)">'; if ($profiles) { foreach ($profiles as $profile) { echo '<option value="' . (int) $profile['id_profile'] . '" ' . ((int) $profile['id_profile'] == $currentProfile ? 'selected="selected"' : '') . '>' . $profile['name'] . '</option>'; } } $tabsize = sizeof($tabs); foreach ($tabs as $tab) { if ($tab['id_tab'] > $tabsize) { $tabsize = $tab['id_tab']; } } echo ' </select> </th>'; if ($currentProfile != (int) _PS_ADMIN_PROFILE_) { echo ' <th class="center">' . $this->l('View') . '<br /><input type="checkbox" name="1" id="viewall" onclick="ajax_power(this, \'view\', -1, ' . $currentProfile . ', \'' . $this->token . '\', \'' . $tabsize . '\', \'' . sizeof($tabs) . '\')" /></th> <th class="center">' . $this->l('Add') . '<br /><input type="checkbox" name="1" id="addall" onclick="ajax_power(this, \'add\', -1, ' . $currentProfile . ', \'' . $this->token . '\', \'' . $tabsize . '\', \'' . sizeof($tabs) . '\')" /></th> <th class="center">' . $this->l('Edit') . '<br /><input type="checkbox" name="1" id="editall" onclick="ajax_power(this, \'edit\', -1, ' . $currentProfile . ', \'' . $this->token . '\', \'' . $tabsize . '\', \'' . sizeof($tabs) . '\')" /></th> <th class="center">' . $this->l('Delete') . '<br /><input type="checkbox" name="1" id="deleteall" onclick="ajax_power(this, \'delete\', -1, ' . $currentProfile . ', \'' . $this->token . '\', \'' . $tabsize . '\', \'' . sizeof($tabs) . '\')" /></th> <th class="center">' . $this->l('All') . '<br /><input type="checkbox" name="1" id="allall" onclick="ajax_power(this, \'all\', -1, ' . $currentProfile . ', \'' . $this->token . '\', \'' . $tabsize . '\', \'' . sizeof($tabs) . '\')" /></th> </tr>'; } if (!sizeof($tabs)) { echo '<tr><td colspan="5">' . $this->l('No tab') . '</td></tr>'; } elseif ($currentProfile == (int) _PS_ADMIN_PROFILE_) { echo '<tr><td colspan="5">' . $this->l('Administrator permissions cannot be modified.') . '</td></tr>'; } else { foreach ($tabs as $tab) { if (!$tab['id_parent'] or (int) $tab['id_parent'] == -1) { $this->printTabAccess((int) $currentProfile, $tab, $accesses[$tab['id_tab']], false, $tabsize, sizeof($tabs)); foreach ($tabs as $child) { if ($child['id_parent'] === $tab['id_tab']) { if (isset($accesses[$child['id_tab']])) { $this->printTabAccess($currentProfile, $child, $accesses[$child['id_tab']], true, $tabsize, sizeof($tabs)); } } } } } } echo '</table>'; }
public function postProcess() { if (isset($_GET['delete' . $this->table]) and $_GET[$this->identifier] === '1') { $this->_errors[] = $this->l('For security reasons, you cannot delete the Administrator profile'); } else { parent::postProcess(); } }
public function postProcess() { if (isset($_GET['delete' . $this->table]) or Tools::getValue('submitDel' . $this->table)) { $this->_errors[] = Tools::displayError('You cannot delete a country. If you do not want it available for customers, please disable it.'); } else { return parent::postProcess(); } }
public function __construct() { $this->_htFile = dirname(__FILE__) . '/../../.htaccess'; $this->_rbFile = dirname(__FILE__) . '/../../robots.txt'; $this->_smFile = dirname(__FILE__) . '/../../sitemap.xml'; $this->_rbData = $this->_getRobotsContent(); return parent::__construct(); }
public function postProcess() { if (isset($_POST['submitAdd' . $this->table]) and Tools::getValue('delimiter1') >= Tools::getValue('delimiter2')) { $this->_errors[] = Tools::displayError('invalid range'); } else { parent::postProcess(); } }
public function displayForm($isMainTab = true) { global $currentIndex, $cookie; parent::displayForm(); $obj = $this->loadObject(true); echo ' <form action="' . $currentIndex . '&submitAdd' . $this->table . '=1&token=' . $this->token . '" method="post" enctype="multipart/form-data" class="width2"> ' . ($obj->id ? '<input type="hidden" name="id_' . $this->table . '" value="' . $obj->id . '" />' : '') . ' ' . ($obj->position ? '<input type="hidden" name="position" value="' . $obj->position . '" />' : '') . ' <fieldset><legend><img src="../img/admin/tab.gif" />' . $this->l('Tabs') . '</legend> <label>' . $this->l('Name:') . ' </label> <div class="margin-form">'; foreach ($this->_languages as $language) { echo ' <div id="name_' . $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none') . '; float: left;"> <input size="33" type="text" name="name_' . $language['id_lang'] . '" value="' . htmlentities($this->getFieldValue($obj, 'name', intval($language['id_lang'])), ENT_COMPAT, 'UTF-8') . '" /><sup> *</sup> <span class="hint" name="help_box">' . $this->l('Invalid characters:') . ' <>;=#{}<span class="hint-pointer"> </span></span> </div>'; } $this->displayFlags($this->_languages, $this->_defaultFormLanguage, 'name', 'name'); echo ' </div> <div class="clear"> </div> <label>' . $this->l('Class:') . ' </label> <div class="margin-form"> <input type="text" name="class_name" value="' . htmlentities($this->getFieldValue($obj, 'class_name'), ENT_COMPAT, 'UTF-8') . '" /> <sup>*</sup> </div> <div class="clear"> </div> <label>' . $this->l('Module:') . ' </label> <div class="margin-form"> <input type="text" name="module" value="' . htmlentities($this->getFieldValue($obj, 'module'), ENT_COMPAT, 'UTF-8') . '" /> </div> <div class="clear"> </div> <label>' . $this->l('Icon:') . '</label> <div class="margin-form"> ' . ($obj->id ? '<img src="../img/t/' . $obj->class_name . '.gif" /> /img/t/' . $obj->class_name . '.gif' : '') . ' <p><input type="file" name="icon" /></p> <p>' . $this->l('Upload logo from your computer') . ' (.gif, .jpg, .jpeg ' . $this->l('or') . ' .png)</p> </div> <div class="clear"> </div> <label>' . $this->l('Parent:') . '</label> <div class="margin-form"> <select name="id_parent"> <option value="-1" ' . ($this->getFieldValue($obj, 'id_parent') == -1 ? 'selected="selected"' : '') . '>' . $this->l('None') . '</option> <option value="0" ' . ($this->getFieldValue($obj, 'id_parent') == 0 ? 'selected="selected"' : '') . '>' . $this->l('Home') . '</option>'; foreach (Tab::getTabs(intval($cookie->id_lang), 0) as $tab) { echo ' <option value="' . $tab['id_tab'] . '" ' . ($tab['id_tab'] == $this->getFieldValue($obj, 'id_parent') ? 'selected="selected"' : '') . '>' . $tab['name'] . '</option>'; } echo ' </select> </div> <div class="clear"> </div> <div class="margin-form"> <input type="submit" value="' . $this->l(' Save ') . '" name="submitAdd' . $this->table . '" class="button" /> </div> <div class="small"><sup>*</sup> ' . $this->l('Required field') . '</div> </fieldset> </form>'; }
public function __construct() { $this->table = 'search_engine'; $this->className = 'SearchEngine'; $this->edit = true; $this->delete = true; $this->fieldsDisplay = array('id_search_engine' => array('title' => $this->l('ID'), 'width' => 25), 'server' => array('title' => $this->l('Server'), 'width' => 200), 'getvar' => array('title' => $this->l('GET variable'), 'width' => 40)); parent::__construct(); }
public function __construct() { $this->_path = dirname(__FILE__) . '/../../'; $this->_htFile = $this->_path . '.htaccess'; $this->_rbFile = $this->_path . 'robots.txt'; $this->_htData = $this->_getHtaccessContent(); $this->_rbData = $this->_getRobotsContent(); return parent::__construct(); }
public function displayForm($isMainTab = true) { global $currentIndex, $cookie; parent::displayForm(); if (!($obj = $this->loadObject(true))) { return; } echo ' <form action="' . $currentIndex . '&submitAdd' . $this->table . '=1&token=' . $this->token . '" method="post"> ' . ($obj->id ? '<input type="hidden" name="id_' . $this->table . '" value="' . $obj->id . '" />' : '') . ' <fieldset><legend><img src="../img/admin/world.gif" />' . $this->l('States') . '</legend> <label>' . $this->l('Name:') . ' </label> <div class="margin-form"> <input type="text" size="30" maxlength="32" name="name" value="' . htmlentities($this->getFieldValue($obj, 'name'), ENT_COMPAT, 'UTF-8') . '" /> <sup>*</sup> <p class="clear">' . $this->l('State name to display in addresses and on invoices') . '</p> </div> <label>' . $this->l('ISO code:') . ' </label> <div class="margin-form"> <input type="text" size="5" maxlength="4" name="iso_code" value="' . htmlentities($this->getFieldValue($obj, 'iso_code'), ENT_COMPAT, 'UTF-8') . '" style="text-transform: uppercase;" /> <sup>*</sup> <p>' . $this->l('1 to 4 letter ISO code (search on Wikipedia if you don\'t know)') . '</p> </div> <label>' . $this->l('Country:') . ' </label> <div class="margin-form"> <select name="id_country">'; foreach (Country::getCountries((int) $cookie->id_lang, false, true, false) as $country) { echo '<option value="' . (int) $country['id_country'] . '"' . ($this->getFieldValue($obj, 'id_country') == $country['id_country'] ? ' selected="selected"' : '') . '>' . $country['name'] . '</option>'; } echo ' </select> <p>' . $this->l('Country where state, region or city is located') . '</p> </div> <label>' . $this->l('Zone:') . ' </label> <div class="margin-form"> <select name="id_zone">'; $zones = Zone::getZones(); foreach ($zones as $zone) { echo '<option value="' . (int) $zone['id_zone'] . '"' . ($this->getFieldValue($obj, 'id_zone') == $zone['id_zone'] ? ' selected="selected"' : '') . '>' . $zone['name'] . '</option>'; } echo ' </select> <p>' . $this->l('Geographical region where this state is located') . '<br />' . $this->l('Used for shipping') . '</p> </div> <label>' . $this->l('Status:') . ' </label> <div class="margin-form"> <input type="radio" name="active" id="active_on" value="1" ' . ((!$obj->id or $this->getFieldValue($obj, 'active')) ? 'checked="checked" ' : '') . '/> <label class="t" for="active_on"> <img src="../img/admin/enabled.gif" alt="' . $this->l('Enabled') . '" title="' . $this->l('Enabled') . '" /></label> <input type="radio" name="active" id="active_off" value="0" ' . ((!$this->getFieldValue($obj, 'active') and $obj->id) ? 'checked="checked" ' : '') . '/> <label class="t" for="active_off"> <img src="../img/admin/disabled.gif" alt="' . $this->l('Disabled') . '" title="' . $this->l('Disabled') . '" /></label> <p>' . $this->l('Enabled or disabled') . '</p> </div> <div class="margin-form"> <input type="submit" value="' . $this->l(' Save ') . '" name="submitAdd' . $this->table . '" class="button" /> </div> <div class="small"><sup>*</sup> ' . $this->l('Required field') . '</div> </fieldset> </form>'; }
$this->adminComment->displayErrors(); $this->adminTags->displayErrors(); } public function viewAccess($disable = false) { $result = parent::viewAccess($disable); $this->adminCategory->tabAccess = $this->tabAccess; $this->adminPost->tabAccess = $this->tabAccess; $this->adminComment->tabAccess = $this->tabAccess;
public function postProcess() { if ($this->tabAccess['edit'] === '1' and Tools::getValue('submitAdd' . $this->table)) { if ($id = intval(Tools::getValue($this->identifier)) and $obj = new $this->className($id) and Validate::isLoadedObject($obj)) { $obj->setProducts($_POST['products']); } } return parent::postProcess(); }
public function displayForm($isMainTab = true) { global $cookie, $currentIndex; parent::displayForm(); $currentProfile = (int) Tools::getValue('id_profile'); if (!$currentProfile) { $currentProfile = 1; } $tabs = Tab::getTabs((int) $cookie->id_lang); $profiles = Profile::getProfiles((int) $cookie->id_lang); $permissions = Profile::getProfileAccesses((int) $currentProfile); echo ' <form action="' . $currentIndex . '&submitAddPermissions=1&token=' . $this->token . '" id="form_permissions" method="post"> <input type="hidden" name="id_profile" value="' . (int) $currentProfile . '" /> <table class="table" cellspacing="0"> <tr> <th ' . ($currentProfile == (int) _PS_ADMIN_PROFILE_ ? 'colspan="6"' : '') . '>' . $this->l('Profile') . ' <select name="id_profile" onchange="window.location = \'' . Tools::getHttpHost(true, true) . $currentIndex . '&token=' . $this->token . '&id_profile=\'+this.options[this.selectedIndex].value;">'; if ($profiles) { foreach ($profiles as $profile) { echo '<option value="' . (int) $profile['id_profile'] . '" ' . ((int) $profile['id_profile'] == $currentProfile ? 'selected="selected"' : '') . '>' . Tools::safeOutput($profile['name']) . '</option>'; } } echo ' </select> </th>'; if ($currentProfile != (int) _PS_ADMIN_PROFILE_) { echo ' <th class="center">' . $this->l('View') . '<br /><input type="checkbox" name="1" id="viewall" /></th> <th class="center">' . $this->l('Add') . '<br /><input type="checkbox" name="1" id="addall" /></th> <th class="center">' . $this->l('Edit') . '<br /><input type="checkbox" name="1" id="editall" /></th> <th class="center">' . $this->l('Delete') . '<br /><input type="checkbox" name="1" id="deleteall" /></th> <th class="center">' . $this->l('All') . '<br /><input type="checkbox" name="1" id="allall" /></th> </tr>'; } if (!count($tabs)) { echo '<tr><td colspan="5">' . $this->l('No tab') . '</td></tr>'; } elseif ($currentProfile == (int) _PS_ADMIN_PROFILE_) { echo '<tr><td colspan="5">' . $this->l('Administrator permissions cannot be modified.') . '</td></tr>'; } else { foreach ($tabs as $tab) { if (!$tab['id_parent'] || (int) $tab['id_parent'] == -1) { echo $this->printTabAccess((int) $currentProfile, $tab, isset($permissions[(int) $tab['id_tab']]) ? $permissions[(int) $tab['id_tab']] : 0, false); foreach ($tabs as $child) { if ($child['id_parent'] === $tab['id_tab']) { echo $this->printTabAccess($currentProfile, $child, isset($permissions[(int) $child['id_tab']]) ? $permissions[(int) $child['id_tab']] : 0, true); } } } } } echo '</table> <p><input type="submit" value="' . $this->l(' Save ') . '" name="submitAddPermissions" class="button" /></p> </form> <script type="text/javascript">managePermissions();</script>'; }