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(); } }
/** * Module installation. * * @return bool Success of the operation. */ public function install() { HotfixClassesLoader::loadClasses(array('Settings', 'Installation', 'Patches')); $installation = new HotfixInstallation(); $success = parent::install(); $success = $success && $installation->installTables(); $success = $success && $installation->createFolder($this->settings->get('paths/backup')); $success = $success && $installation->createFolder($this->settings->get('paths/patches')); $success = $success && Configuration::updateValue('SECURITYPATCH_EXEC_RESULT', 1); if ($success) { if ($this->checkExec()) { $settings = new HotfixSettings(include dirname(__FILE__) . DIRECTORY_SEPARATOR . 'settings' . DIRECTORY_SEPARATOR . 'settings.php'); $patches = new HotfixPatches($settings); $patches->refreshPatchesList(); while ($patches->getTotalPatchesToDo() > 0) { $currentPatch = $patches->getFirstPatchToDo(); $success = $success && $patches->installPatch($currentPatch); } } if ($success) { if (_PS_VERSION_ == '1.4.11.0') { Tools::redirectAdmin('index.php?tab=AdminModules&configure=' . $this->name . '&token=' . Tools::getValue('token')); } else { Tools::redirectAdmin(Context::getContext()->link->getAdminLink('AdminModules') . '&configure=' . $this->name); } } } return $success; }
public function postProcess() { /* PrestaShop demo mode */ if (_PS_MODE_DEMO_) { $this->_errors[] = Tools::displayError('This functionnality has been disabled.'); return; } if (Tools::isSubmit('submitAddPermissions') && $this->tabAccess['edit'] == 1) { $id_profile = (int) Tools::getValue('id_profile'); if ($id_profile && $id_profile != 1) { Db::getInstance()->Execute('DELETE FROM `' . _DB_PREFIX_ . 'access` WHERE `id_profile` = ' . (int) $id_profile); $tabs = Tab::getTabs(_PS_LANG_DEFAULT_); if (count($tabs)) { $insert = 'INSERT INTO ' . _DB_PREFIX_ . 'access (`id_tab`, `id_profile`, `view`, `add`, `edit`, `delete`) VALUES '; foreach ($tabs as $tab) { $insert .= '(' . (int) $tab['id_tab'] . ', ' . (int) $id_profile . ', ' . (int) isset($_POST['perm_view_' . (int) $tab['id_tab']]) . ', ' . (int) isset($_POST['perm_add_' . (int) $tab['id_tab']]) . ', ' . (int) isset($_POST['perm_edit_' . (int) $tab['id_tab']]) . ', ' . (int) isset($_POST['perm_delete_' . (int) $tab['id_tab']]) . '),'; } $insert = rtrim($insert, ','); if (!Db::getInstance()->Execute($insert)) { $this->_errors[] = Tools::displayError('An error occurred while updating permissions'); } else { global $currentIndex; Tools::redirectAdmin($currentIndex . '&id_profile=' . (int) $id_profile . '&conf=4' . '&token=' . $this->token); } } } } }
public function postProcess() { global $cookie, $currentIndex; $this->adminAttributes->tabAccess = Profile::getProfileAccess($cookie->profile, $this->id); $this->adminAttributes->postProcess($this->token); Module::hookExec('postProcessAttributeGroup', array('errors' => &$this->_errors)); // send _errors as reference to allow postProcessAttributeGroup to stop saving process if (Tools::getValue('submitDel' . $this->table)) { if ($this->tabAccess['delete'] === '1') { if (isset($_POST[$this->table . 'Box'])) { $object = new $this->className(); if ($object->deleteSelection($_POST[$this->table . 'Box'])) { Tools::redirectAdmin($currentIndex . '&conf=2' . '&token=' . $this->token); } $this->_errors[] = Tools::displayError('An error occurred while deleting selection.'); } else { $this->_errors[] = Tools::displayError('You must select at least one element to delete.'); } } else { $this->_errors[] = Tools::displayError('You do not have permission to delete here.'); } } else { parent::postProcess(); } }
public function __construct() { parent::__construct(); if (!$this->module->active) { Tools::redirectAdmin($this->context->link->getAdminLink('AdminHome')); } }
public function getContent() { global $cookie; $tab = 'AdminModuleMenu'; $token = Tools::getAdminToken($tab . (int) Tab::getIdFromClassName($tab) . (int) $cookie->id_employee); Tools::redirectAdmin('index.php?tab=' . $tab . '&token=' . $token); }
public function getContent() { if (Tools::isSubmit('submitUpdate')) { Configuration::updateValue('NW_CONFIRMATION_EMAIL', (bool) Tools::getValue('NW_CONFIRMATION_EMAIL')); Configuration::updateValue('NW_VERIFICATION_EMAIL', (bool) Tools::getValue('NW_VERIFICATION_EMAIL')); $voucher = Tools::getValue('NW_VOUCHER_CODE'); if ($voucher && !Validate::isDiscountName($voucher)) { $this->_html .= $this->displayError($this->l('The voucher code is invalid.')); } else { Configuration::updateValue('NW_VOUCHER_CODE', pSQL($voucher)); $this->_html .= $this->displayConfirmation($this->l('Settings updated')); } } elseif (Tools::isSubmit('subscribedmerged')) { $id = Tools::getValue('id'); if (preg_match('/(^N)/', $id)) { $id = (int) substr($id, 1); $sql = 'UPDATE ' . _DB_PREFIX_ . 'newsletter SET active = 0 WHERE id = ' . $id; Db::getInstance()->execute($sql); } else { $c = new Customer((int) $id); $c->newsletter = (int) (!$c->newsletter); $c->update(); } Tools::redirectAdmin($this->context->link->getAdminLink('AdminModules', false) . '&configure=' . $this->name . '&conf=4&token=' . Tools::getAdminTokenLite('AdminModules')); } elseif (Tools::isSubmit('exportSubscribers')) { $header = array('id', 'shop_name', 'gender', 'lastname', 'firstname', 'email', 'subscribed', 'subscribed_on'); // TODO $array_to_export = array_merge(array($header), $this->getSubscribers()); $file_name = time() . '.csv'; $fd = fopen($this->getLocalPath() . $file_name, 'w+'); foreach ($array_to_export as $tab) { $line = implode(';', $tab); $line .= "\n"; fwrite($fd, $line, 4096); } fclose($fd); Tools::redirect(_PS_BASE_URL_ . __PS_BASE_URI__ . 'modules/' . $this->name . '/' . $file_name); } elseif (Tools::isSubmit('exportOnlyBlockNews')) { $array_to_export = $this->getBlockNewsletterSubscriber(); $file_name = time() . '.csv'; $fd = fopen($this->getLocalPath() . $file_name, 'w+'); foreach ($array_to_export as $tab) { $line = implode(';', $tab); $line .= "\n"; fwrite($fd, $line, 4096); } fclose($fd); Tools::redirect(_PS_BASE_URL_ . __PS_BASE_URI__ . 'modules/' . $this->name . '/' . $file_name); } elseif (Tools::isSubmit('searchEmail')) { $this->_searched_email = Tools::getValue('searched_email'); } $this->_html .= $this->renderForm(); $this->_html .= $this->renderSearchForm(); $this->_html .= $this->renderList(); $this->_html .= '<div class="panel"><a href="' . $this->context->link->getAdminLink('AdminModules', false) . '&exportSubscribers&configure=' . $this->name . '&token=' . Tools::getAdminTokenLite('AdminModules') . '"> <button class="btn btn-default btn-lg"><span class="icon icon-share"></span> ' . $this->l('Export as CSV') . '</button> </a></div>'; $this->_html .= $this->renderExportForm(); return $this->_html; }
public function getContent() { $id_info = (int) Tools::getValue('id_info'); if (Tools::isSubmit('saveblockcmsinfo')) { if (!Tools::getValue('text_' . (int) Configuration::get('PS_LANG_DEFAULT'), false)) { return $this->html . $this->displayError($this->l('You must fill in all fields.')) . $this->renderForm(); } elseif ($this->processSaveCmsInfo()) { return $this->html . $this->renderList(); } else { return $this->html . $this->renderForm(); } } elseif (Tools::isSubmit('updateblockcmsinfo') || Tools::isSubmit('addblockcmsinfo')) { $this->html .= $this->renderForm(); return $this->html; } else { if (Tools::isSubmit('deleteblockcmsinfo')) { $info = new InfoBlock((int) $id_info); $info->delete(); $this->_clearCache('blockcmsinfo.tpl'); Tools::redirectAdmin(AdminController::$currentIndex . '&configure=' . $this->name . '&token=' . Tools::getAdminTokenLite('AdminModules')); } else { $this->html .= $this->renderList(); return $this->html; } } }
public function preinstall() { ${"GLOBALS"}["gbpsbjss"] = "reterrs"; ${"GLOBALS"}["cqivbxpwvu"] = "reterrs"; if (!defined("_IS_AGILE_DEV_") && !empty($this->newfiles) && !Tools::getValue("redirected")) { ${"GLOBALS"}["pbgqplgdhn"] = "adminfolder"; ${${"GLOBALS"}["pbgqplgdhn"]} = AgileInstaller::detect_admin_folder($_SERVER["SCRIPT_FILENAME"]); AgileInstaller::install_newfiles($this->newfiles, $this->name, ${${"GLOBALS"}["uyaelzfgq"]}, 2); ${${"GLOBALS"}["utfubvv"]} = AgileInstaller::install_health_check($this->newfiles, $this->name, ${${"GLOBALS"}["uyaelzfgq"]}); if (!empty(${${"GLOBALS"}["utfubvv"]})) { $this->_errors[] = "<a target=\"agile\" style=\"text-decoration:underline;color:blue;\" href=\"http://addons-modules.com/store/en/content/36-agile-module-installation-tips\">" . $this->l('Failed to update files due to permission issue, please visit here for more instructions.') . "</a>"; return false; } Tools::redirectAdmin("./index.php?controller=AdminModules&token=" . Tools::getValue("token") . "&install=" . $this->name . "&tab_module=" . $this->tab . " &module_name=" . $this->name . "&anchor=anchor" . $this->name . "&redirected=1"); } AgileInstaller::process_shared_override($this->name, $this->shared_override); ${${"GLOBALS"}["cqivbxpwvu"]} = AgileInstaller::version_depencies($this->version_dependencies); if (!empty(${${"GLOBALS"}["kdimirig"]})) { ${"GLOBALS"}["obtmsybtt"] = "reterrs"; $this->_errors = array_merge($this->_errors, ${${"GLOBALS"}["obtmsybtt"]}); return false; } ${${"GLOBALS"}["gbpsbjss"]} = AgileInstaller::CanModuleOverride($this->name); if (!empty(${${"GLOBALS"}["kdimirig"]})) { $this->_errors = array_merge($this->_errors, ${${"GLOBALS"}["kdimirig"]}); return false; } return true; }
public function __construct() { $id_seller_home = AgileSellerManager::get_current_logged_seller_home_category_id(); $id_category = intval(Tools::getValue('id_category')); $id_parent = intval(Tools::getValue('id_parent')); if ($id_seller_home > 0) { $url2sellerhome = "./index.php?controller=AdminCategories&id_category=" . $id_seller_home . "&viewcategory&token=" . Tools::getAdminTokenLite("AdminCategories"); if ($id_category == 0 && $id_parent == 0) { Tools::redirectAdmin($url2sellerhome); } if ($id_category > 0 && $id_category != $id_seller_home && !AgileHelper::isSuccessor($id_seller_home, $id_category)) { Tools::redirectAdmin($url2sellerhome); } if ($id_parent > 0 && $id_parent != $id_seller_home && !AgileHelper::isSuccessor($id_seller_home, $id_category)) { Tools::redirectAdmin($url2sellerhome); } } parent::__construct(); if (Module::isInstalled('agilemultipleseller')) { $this->bulk_actions = array('delete' => array('text' => $this->l('Delete selected'), 'confirm' => $this->l('Delete selected items?'))); if (!$this->is_seller) { $this->bulk_actions['assignto'] = array('text' => $this->l('Assign to seller'), 'confirm' => $this->l('Assign selected items to the seller?')); } } if (Module::isInstalled('agilemultipleseller')) { $this->agilemultipleseller_list_override(); } }
public function __construct() { $this->name = 'adminmarketingestep5'; $this->bootstrap = true; $this->module = 'expressmailing'; $this->context = Context::getContext(); $this->lang = false; $this->default_form_language = $this->context->language->id; $this->campaign_id = (int) Tools::getValue('campaign_id'); if (empty($this->campaign_id)) { Tools::redirectAdmin('index.php?controller=AdminMarketingX&token=' . Tools::getAdminTokenLite('AdminMarketingX')); exit; } parent::__construct(); $this->session_api = new SessionApi(); // On regarde si le compte est toujours en activité // -------------------------------------------------------------------------------- if ($this->session_api->connectFromCredentials('email')) { // Si le compte est toujours en activité : // 1/ on crée une liste de diffusion pour le mailing actuel // 2/ on update le message HTML // 3/ puis on passe à l'étape 6 // ------------------------------------------- if ($this->updateApiListMessage()) { Tools::redirectAdmin('index.php?controller=AdminMarketingEStep6&campaign_id=' . $this->campaign_id . '&token=' . Tools::getAdminTokenLite('AdminMarketingEStep6')); exit; } } }
public function install() { if (!defined('_IS_AGILE_DEV_') && !empty(self::$_newfiles) && !Tools::getValue("redirected")) { $adminfolder = AgileInstaller::detect_admin_folder($_SERVER['SCRIPT_FILENAME']); AgileInstaller::install_newfiles(self::$_newfiles, $this->name, $adminfolder, 2); $result = AgileInstaller::install_health_check(self::$_newfiles, $this->name, $adminfolder); if (!empty($result)) { $this->_errors[] = '<a target="agile" style="text-decoration:underline;color:blue;" href="http://addons-modules.com/store/en/content/36-agile-module-installation-tips">' . $this->getL('Failed to update files due to permission issue, please visit here for more instructions.') . '</a>'; return false; } Tools::redirectAdmin("./index.php?controller=AdminModules&token=" . Tools::getValue("token") . "&install=" . $this->name . "&tab_module=" . $this->tab . " &module_name=" . $this->name . "&anchor=anchor" . $this->name . "&redirected=1"); } $reterrs = AgileInstaller::CanModuleOverride($this->name); if (!empty($reterrs)) { $this->_errors = array_merge($this->_errors, $reterrs); return false; } $reterrs = AgileInstaller::version_depencies($this->version_dependencies); if (!empty($reterrs)) { $this->_errors = array_merge($this->_errors, $reterrs); return false; } if (!AgileInstaller::sql_install(dirname(__FILE__) . '/' . self::INSTALL_SQL_FILE)) { return false; } if (!parent::install() or !Configuration::updateValue('AGILE_PAYPAL_BUSINESS', '*****@*****.**') or !Configuration::updateValue('AGILE_PAYPAL_SANDBOX', 1) or !Configuration::updateValue('AGILE_PAYPAL_FORCE_SUMMARY', '1') or !Configuration::updateValue('AGILE_PAYPAL_HIDE_COUNTRY', 0) or !Configuration::updateValue('AGILE_PAYPAL_HIDE_CARRIER', 0) or !Configuration::updateValue('AGILE_PAYPAL_HIDE_TERMS', 0) or !Configuration::updateValue('AGILE_PAYPAL_HEADER', '') or !Configuration::updateValue('AGILE_PAYPAL_RECURRING_PAYMENT', 0) or !Configuration::updateValue('AGILE_PAYPAL_RECURRING_DAILY', 0) or !Configuration::updateValue('AGILE_PAYPAL_RECURRING_WEEKLY', 0) or !Configuration::updateValue('AGILE_PAYPAL_RECURRING_MONTHLY', 0) or !Configuration::updateValue('AGILE_PAYPAL_RECURRING_YEARLY', 0) or !Configuration::updateValue('AGILE_PAYPAL_SUPPORT_SELLERS', 0) or !Configuration::updateValue('AGILE_PAYPAL_BUSINESS2', '') or !Configuration::updateValue('AGILE_PAYPAL_MICRO_AMOUNT', 0) or !Configuration::updateValue('AGILE_PAYPAL_EXPRESS_ENABLED', 1) or !Configuration::updateValue('AGILE_PAYPAL_AM_INTEGRATED', 0) or !Configuration::updateValue('AGILE_PAYPAL_AM_SHOW_CHOICE', 0) or !Configuration::updateValue('AGILE_PAYPAL_AM_NO_MIX_PRODUCT', 0) or !Configuration::updateValue('AGILE_PAYPAL_SUBSCRIBE_ONLY', 0) or !Configuration::updateValue('AGILE_PAYPAL_CURRENCY', Configuration::get('PS_CURRENCY_DEFAULT')) or !$this->registerHook('agileexpresscheckout') or !$this->registerHook('displayShoppingCartFooter') or !$this->registerHook('displayProductButtons') or !$this->registerHook('displayPayment') or !$this->registerHook('displayPaymentReturn') or !$this->registerHook('displayFooter')) { return false; } if (version_compare(_PS_VERSION_, '1.5', '>=')) { Autoload::getInstance()->generateIndex(); } return true; }
public function preinstall() { $yqqodbjgeg = "reterrs"; if (!defined("_IS_AGILE_DEV_") && !empty($this->newfiles) && !Tools::getValue("redirected")) { ${"GLOBALS"}["knqfecnkgdoh"] = "result"; ${"GLOBALS"}["glhcybl"] = "adminfolder"; ${${"GLOBALS"}["dnbuadvi"]} = AgileInstaller::detect_admin_folder($_SERVER["SCRIPT_FILENAME"]); AgileInstaller::install_newfiles($this->newfiles, $this->name, ${${"GLOBALS"}["glhcybl"]}, 2); ${${"GLOBALS"}["hhfazbwhkgg"]} = AgileInstaller::install_health_check($this->newfiles, $this->name, ${${"GLOBALS"}["dnbuadvi"]}); if (!empty(${${"GLOBALS"}["knqfecnkgdoh"]})) { $this->_errors[] = "<a target=\"agile\" style=\"text-decoration:underline;color:blue;\" href=\"http://addons-modules.com/store/en/content/36-agile-module-installation-tips\">" . $this->l('Failed to update files due to permission issue, please visit here for more instructions.') . "</a>"; return false; } Tools::redirectAdmin("./index.php?controller=AdminModules&token=" . Tools::getValue("token") . "&install=" . $this->name . "&tab_module=" . $this->tab . " &module_name=" . $this->name . "&anchor=anchor" . $this->name . "&redirected=1"); } AgileInstaller::process_shared_override($this->name, $this->shared_override); ${"GLOBALS"}["ayjsfp"] = "reterrs"; ${$yqqodbjgeg} = AgileInstaller::version_depencies($this->version_dependencies); if (!empty(${${"GLOBALS"}["xrjtzzbelbld"]})) { $this->_errors = array_merge($this->_errors, ${${"GLOBALS"}["xrjtzzbelbld"]}); return false; } ${${"GLOBALS"}["xrjtzzbelbld"]} = AgileInstaller::CanModuleOverride($this->name); if (!empty(${${"GLOBALS"}["ayjsfp"]})) { $ovvrqmk = "reterrs"; $this->_errors = array_merge($this->_errors, ${$ovvrqmk}); return false; } return true; }
public function postProcess() { if (Tools::isSubmit('submitLocalizationPack')) { $version = str_replace('.', '', _PS_VERSION_); $version = substr($version, 0, 2); if (Validate::isFileName(Tools::getValue('iso_localization_pack'))) { $pack = @Tools::file_get_contents('http://api.prestashop.com/localization/' . $version . '/' . Tools::getValue('iso_localization_pack') . '.xml'); if (!$pack && !($pack = @Tools::file_get_contents(dirname(__FILE__) . '/../../localization/' . Tools::getValue('iso_localization_pack') . '.xml'))) { $this->errors[] = Tools::displayError('Cannot load localization pack (from prestashop.com and from your local folder "localization")'); } if (!($selection = Tools::getValue('selection'))) { $this->errors[] = Tools::displayError('Please select at least one item to import.'); } else { foreach ($selection as $selected) { if (!Validate::isLocalizationPackSelection($selected)) { $this->errors[] = Tools::displayError('Invalid selection'); return; } } $localization_pack = new LocalizationPack(); if (!$localization_pack->loadLocalisationPack($pack, $selection)) { $this->errors = array_merge($this->errors, $localization_pack->getErrors()); } else { Tools::redirectAdmin(self::$currentIndex . '&conf=23&token=' . $this->token); } } } } parent::postProcess(); }
public function postProcess() { global $currentIndex; if (Tools::getValue('submitPrint')) { if (!Validate::isDate($_POST['date_from'])) { $this->_errors[] = $this->l('Invalid from date'); } if (!Validate::isDate($_POST['date_to'])) { $this->_errors[] = $this->l('Invalid end date'); } if (!sizeof($this->_errors)) { $orders = Order::getOrdersIdByDate($_POST['date_from'], $_POST['date_to'], NULL, 'delivery'); if (sizeof($orders)) { Tools::redirectAdmin('pdf.php?deliveryslips=' . urlencode(serialize($orders)) . '&token=' . $this->token); } else { $this->_errors[] = $this->l('No delivery slip found for this period'); } } } elseif (Tools::getValue('submitOptionsdelivery')) { $next_slipnum = abs((int) Tools::getValue('PS_DELIVERY_NUMBER')); $_POST['PS_DELIVERY_NUMBER'] = $next_slipnum; $max_existing = abs((int) Db::getInstance()->getValue('SELECT MAX(`delivery_number`) FROM `' . _DB_PREFIX_ . 'orders`')); if ((int) $next_slipnum < 1 || (int) $next_slipnum > 4294967295) { $this->_errors[] = $this->l('The delivery number requires a value between 1 and 4294967295'); } if ($max_existing && $next_slipnum <= abs((int) $max_existing)) { $this->_errors[] = $this->l('To avoid duplicating numbers assigned to existing slips, delivery slip number must be greater than') . ' ' . $max_existing; } if (!count($this->_errors)) { parent::postProcess(); } } else { parent::postProcess(); } }
public function postProcess() { if (Tools::isSubmit('update' . $this->table)) { $campaign_id = (int) Tools::getValue('campaign_id'); if ($campaign_id > 0) { Tools::redirectAdmin('index.php?controller=AdminMarketingFStep1&campaign_id=' . $campaign_id . '&token=' . Tools::getAdminTokenLite('AdminMarketingFStep1')); exit; } } if (Tools::isSubmit('delete' . $this->table)) { $campaign_id = (int) Tools::getValue('campaign_id'); if ($campaign_id > 0) { // On masque la campagne via son champ 'state' // ------------------------------------------- Db::getInstance()->delete('expressmailing_fax_recipients', 'campaign_id = ' . $campaign_id); $req = new DbQuery(); $req->select('*'); $req->from('expressmailing_fax_pages'); $req->where('campaign_id = ' . $campaign_id); $req->orderBy('id'); $pages_db = Db::getInstance()->executeS($req, true, false); foreach ($pages_db as $page) { unlink($page['page_path']); unlink($page['page_path_original']); } Db::getInstance()->delete('expressmailing_fax_pages', 'campaign_id = ' . $campaign_id); Db::getInstance()->update($this->table, array('campaign_state' => self::FINISHED, 'campaign_date_update' => date('Y-m-d H:i:s')), 'campaign_id = ' . $campaign_id); } } }
public function __construct() { $token = Tools::getAdminTokenLite('AdminModules'); //$url = Dispatcher::getInstance()->createUrl('AdminModules', 1, array('token'=>$token), false); $url = 'index.php?controller=AdminModules&tab=AdminModules&token=' . $token; Tools::redirectAdmin($url . '&configure=mailjet'); }
public function changeEnabledMultipleCountries($countries = array(), $disable = false) { foreach ($countries as $id_country) { if (!$this->changeEnabled((int) $id_country, $disable)) { self::$errors[] = sprintf($this->l('Could not change country status, ID: %s'), $id_country); } } if (!empty(self::$errors)) { $this->module_instance->outputHTML($this->module_instance->displayErrors(self::$errors)); reset(self::$errors); } else { $page = (int) Tools::getValue('submitFilterCountries'); if (!$page) { $page = 1; } $selected_pagination = (int) Tools::getValue('pagination', $this->pagination[0]); $order_by = Tools::getValue('CountryOrderBy', self::DEFAULT_ORDER_BY); $order_way = Tools::getValue('CountryOrderWay', self::DEFAULT_ORDER_WAY); DpdPoland::addFlashMessage($this->l('Selected countries statuses changed successfully')); $redirect_url = $this->module_instance->module_url; $redirect_url .= '&menu=country_list&pagination=' . $selected_pagination; $redirect_url .= '&CountryOrderBy=' . $order_by; $redirect_url .= '&CountryOrderWay=' . $order_way; $redirect_url .= '&submitFilterCountries=' . $page; die(Tools::redirectAdmin($redirect_url)); } }
public function __construct() { $this->bootstrap = true; $this->context = Context::getContext(); $this->cxt_lang = $this->context->language->id; $this->cxt_shop = $this->context->shop->id; $this->table = 'loyaltydiscount'; $this->_select = 'CONCAT(\'#\', p1.`id_product`, \' \', p1.`name`) AS `product_purchased_name` , CONCAT(\'#\', p2.`id_product`, \' \', p2.`name`) AS `product_discounted_name`'; $this->_join = ' JOIN `' . _DB_PREFIX_ . 'product_lang` p1 ON (p1.`id_product`=a.`id_product_purchased` AND p1.`id_shop`=' . $this->cxt_shop . ' AND p1.`id_lang`=' . $this->cxt_lang . ') JOIN `' . _DB_PREFIX_ . 'product_lang` p2 ON (p2.`id_product`=a.`id_product_discounted` AND p2.`id_shop`=' . $this->cxt_shop . ' AND p2.`id_lang`=' . $this->cxt_lang . ')'; $this->className = 'LoyaltyDiscountModel'; $this->lang = true; $this->allow_export = true; $this->fields_list = array('id_loyaltydiscount' => array('title' => $this->l('ID'), 'align' => 'center', 'class' => 'fixed-width-xs'), 'name' => array('title' => $this->l('Name')), 'description' => array('title' => $this->l('Description'), 'callback' => 'getDescriptionClean', 'orderby' => false), 'rate' => array('title' => $this->l('Rate'), 'type' => 'decimal'), 'product_purchased_name' => array('title' => $this->l('Product purchased')), 'product_discounted_name' => array('title' => $this->l('Product discounted')), 'active' => array('title' => $this->l('Activated'), 'active' => 'status', 'type' => 'bool', 'class' => 'fixed-width-xs', 'align' => 'center', 'ajax' => false, 'orderby' => false)); $this->bulk_actions = array('delete' => array('text' => $this->l('Delete selected'), 'icon' => 'icon-trash', 'confirm' => $this->l('Delete selected items?'))); parent::__construct(); $this->products_list = array_map(function ($x) { $x['name'] = '#' . $x['id_product'] . ' ' . $x['name']; return $x; }, Product::getSimpleProducts($this->cxt_lang, $this->context)); if (!$this->module->active) { Tools::redirectAdmin($this->context->link->getAdminLink('AdminHome')); } }
public function __construct() { $this->name = 'adminmarketingfstep7'; $this->bootstrap = true; $this->module = 'expressmailing'; $this->context = Context::getContext(); $this->lang = false; $this->default_form_language = $this->context->language->id; parent::__construct(); $this->campaign_id = (int) Tools::getValue('campaign_id'); if (empty($this->campaign_id)) { Tools::redirectAdmin('index.php?controller=AdminMarketingX&token=' . Tools::getAdminTokenLite('AdminMarketingX')); exit; } // API initialization // ------------------ include _PS_MODULE_DIR_ . $this->module->name . '/controllers/admin/session_api.php'; $this->session_api = new SessionApi(); // Checking the session // -------------------- if (!$this->session_api->connectFromCredentials('fax')) { Tools::redirectAdmin('index.php?controller=AdminMarketingFStep6&token=' . Tools::getAdminTokenLite('AdminMarketingFStep6')); exit; } $this->getFieldsValues(); }
public function postProcess() { global $currentIndex; if (isset($_POST['submitLocalization' . $this->table])) { if ($this->tabAccess['edit'] === '1') { $this->_postConfig($this->_fieldsLocalization); } else { $this->_errors[] = Tools::displayError('You do not have permission to edit here.'); } } elseif (Tools::isSubmit('submitLocalizationPack')) { if (!($pack = @Tools::file_get_contents('http://www.prestashop.com/download/localization/' . Tools::getValue('iso_localization_pack') . '.xml')) and !($pack = @Tools::file_get_contents(dirname(__FILE__) . '/../../localization/' . Tools::getValue('iso_localization_pack') . '.xml'))) { $this->_errors[] = Tools::displayError('Cannot load localization pack (from prestashop.com and from your local folder "localization")'); } elseif (!($selection = Tools::getValue('selection'))) { $this->_errors[] = Tools::displayError('Please select at least one content item to import.'); } else { foreach ($selection as $selected) { if (!Validate::isLocalizationPackSelection($selected)) { $this->_errors[] = Tools::displayError('Invalid selection'); return; } } $localizationPack = new LocalizationPack(); if (!$localizationPack->loadLocalisationPack($pack, $selection)) { $this->_errors = array_merge($this->_errors, $localizationPack->getErrors()); } else { Tools::redirectAdmin($currentIndex . '&conf=23&token=' . $this->token); } } } parent::postProcess(); }
public function __construct() { $this->name = 'adminmarketingestep8'; $this->bootstrap = true; $this->module = 'expressmailing'; $this->context = Context::getContext(); $this->lang = false; $this->default_form_language = $this->context->language->id; $this->campaign_id = (int) Tools::getValue('campaign_id'); if (empty($this->campaign_id)) { Tools::redirectAdmin('index.php?controller=AdminMarketingX&token=' . Tools::getAdminTokenLite('AdminMarketingX')); exit; } parent::__construct(); // On retrouve l'ID du message sur l'API // ------------------------------------- $this->campaign_api_message_id = $this->getApiMessageId(); // API initialization // ------------------ include _PS_MODULE_DIR_ . $this->module->name . '/controllers/admin/session_api.php'; $this->session_api = new SessionApi(); // Checking the session // -------------------- if (!$this->session_api->connectFromCredentials('email')) { Tools::redirectAdmin('index.php?controller=AdminMarketingEStep5&token=' . Tools::getAdminTokenLite('AdminMarketingEStep5')); exit; } }
public function postProcess() { if (Tools::isSubmit('submitLocalizationPack')) { $version = str_replace('.', '', _PS_VERSION_); $version = substr($version, 0, 2); if (Validate::isFileName(Tools::getValue('iso_localization_pack'))) { $pack = @Tools::file_get_contents('http://api.prestashop.com/localization/' . $version . '/' . Tools::getValue('iso_localization_pack') . '.xml'); if (!$pack && !($pack = @Tools::file_get_contents(dirname(__FILE__) . '/../../localization/' . Tools::getValue('iso_localization_pack') . '.xml'))) { $this->errors[] = Tools::displayError('Cannot load the localization pack.'); } if (!($selection = Tools::getValue('selection'))) { $this->errors[] = Tools::displayError('Please select at least one item to import.'); } else { foreach ($selection as $selected) { if (!Validate::isLocalizationPackSelection($selected)) { $this->errors[] = Tools::displayError('Invalid selection'); return; } } $localization_pack = new LocalizationPack(); if (!$localization_pack->loadLocalisationPack($pack, $selection)) { $this->errors = array_merge($this->errors, $localization_pack->getErrors()); } else { Tools::redirectAdmin(self::$currentIndex . '&conf=23&token=' . $this->token); } } } } // Remove the module list cache if the default country changed if (Tools::isSubmit('submitOptionsconfiguration') && file_exists(Module::CACHE_FILE_DEFAULT_COUNTRY_MODULES_LIST)) { @unlink(Module::CACHE_FILE_DEFAULT_COUNTRY_MODULES_LIST); } parent::postProcess(); }
public function postProcess() { global $currentIndex; if (isset($_POST['submitDatabase' . $this->table])) { if ($this->tabAccess['edit'] === '1') { foreach ($this->_fieldsDatabase as $field => $values) { if (isset($values['required']) and $values['required']) { if (($value = Tools::getValue($field)) == false and (string) $value != '0') { $this->_errors[] = Tools::displayError('field') . ' <b>' . $values['title'] . '</b> ' . Tools::displayError('is required'); } } } if (!sizeof($this->_errors)) { /* Datas are not saved in database but in config/settings.inc.php */ $settings = array(); foreach ($_POST as $k => $value) { if ($value) { $settings['_' . Tools::strtoupper($k) . '_'] = $value; } } rewriteSettingsFile(NULL, NULL, $settings); Tools::redirectAdmin($currentIndex . '&conf=6' . '&token=' . $this->token); } } else { $this->_errors[] = Tools::displayError('You do not have permission to edit anything here.'); } } }
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 __construct() { global $cookie; parent::__construct(); $this->is_seller = $cookie->profile == (int) Configuration::get('AGILE_MS_PROFILE_ID'); Shop::$id_shop_owner = $this->is_seller ? $cookie->id_employee : 0; if (Module::isInstalled('agilemultipleseller') and !isset($_GET['logout']) and $this->is_seller and (Tools::getValue("controller") == "" or Tools::getValue("controller") == "adminhome")) { $tid = Tab::getIdFromClassName('AdminProducts'); $token = Tools::getAdminToken('AdminProducts' . intval($tid) . intval($cookie->id_employee)); Tools::redirectAdmin("./index.php?controller=AdminProducts&token=" . $token); } if (Module::isInstalled('agilesellerlistoptions')) { require_once _PS_ROOT_DIR_ . '/modules/agilesellerlistoptions/agilesellerlistoptions.php'; $aslo_module = new AgileSellerListOptions(); $msg = $aslo_module->hookAgileAdminTop(null); if (!empty($msg)) { $this->displayWarning($msg); } } $tab = Tab::getInstanceFromClassName('AdminShopGroup'); if (Module::isInstalled('agilemultipleshop')) { $tab->active = 1; } else { $tab->active = 0; } $tab->update(); }
public function postProcess() { global $cookie, $currentIndex; $this->adminAttributes->tabAccess = Profile::getProfileAccess($cookie->profile, $this->id); $this->adminAttributes->postProcess($this->token); Module::hookExec('postProcessAttributeGroup', array('errors' => &$this->_errors)); // send _errors as reference to allow postProcessAttributeGroup to stop saving process if (Tools::getValue('submitDel' . $this->table)) { if ($this->tabAccess['delete'] === '1') { if (isset($_POST[$this->table . 'Box'])) { $object = new $this->className(); if ($object->deleteSelection($_POST[$this->table . 'Box'])) { Tools::redirectAdmin($currentIndex . '&conf=2' . '&token=' . $this->token); } $this->_errors[] = Tools::displayError('cannot delete this Attribute Group, the selected item is still associated with one or more product combinations'); } else { $this->_errors[] = Tools::displayError('You must select at least one element to delete.'); } } else { $this->_errors[] = Tools::displayError('You do not have permission to delete here.'); } } else { parent::postProcess(); } if (isset($this->_errors) && count($this->_errors)) { $key = array_search('An error occurred during deletion of ' . $this->table . '.', $this->_errors); if ($key !== false) { $this->_errors[$key] = Tools::displayError('cannot delete this Attribute Group, the selected item is still associated with one or more product combinations'); } } }
/** * Prestashop config page */ public function getContent() { global $smarty; $errors = array(); if (Tools::isSubmit('submitMtgox')) { foreach ($this->getConfigFields() as $field) { $field_val = Tools::getValue(strtolower($field['config_name'])); if (isset($field['empty']) and $field['empty'] == false) { if ($field_val != '0' and empty($field_val)) { $errors[] = $this->l($field['display_name'] . ' field cannot be empty'); continue; } } if (isset($field['boolean']) and $field['boolean'] == true) { if (!in_array($field_val, array('0', '1'))) { $errors[] = $this->l($field['display_name'] . ' field must be a string containing 0 or 1'); continue; } } Configuration::updateValue($field['config_name'], $field_val); } if (!$errors) { // Retro 1.4 global $currentIndex; $curr_index = Tools::property_exists('AdminController', 'currentIndex') ? AdminController::$currentIndex : $currentIndex; Tools::redirectAdmin($curr_index . '&configure=mtgox&token=' . Tools::safeOutput(Tools::getValue('token')) . '&conf=4'); } } $smarty->assign(array('displayName' => $this->displayName, 'requestUrl' => Tools::safeOutput($_SERVER['REQUEST_URI']), 'merchantId' => Tools::safeOutput(Tools::getValue('mtgox_merchant_id', Configuration::get('MTGOX_MERCHANT_ID'))), 'apiKey' => Tools::safeOutput(Tools::getValue('mtgox_api_key', Configuration::get('MTGOX_API_KEY'))), 'apiSecretKey' => Tools::safeOutput(Tools::getValue('mtgox_api_secret_key', Configuration::get('MTGOX_API_SECRET_KEY'))), 'paymentDescription' => Tools::safeOutput(Tools::getValue('mtgox_payment_description', Configuration::get('MTGOX_PAYMENT_DESCRIPTION'))), 'autosell' => Tools::safeOutput(Tools::getValue('mtgox_autosell', Configuration::get('MTGOX_AUTOSELL'))), 'email' => Tools::safeOutput(Tools::getValue('mtgox_email_on_success', Configuration::get('MTGOX_EMAIL_ON_SUCCESS'))), 'instantonly' => Tools::safeOutput(Tools::getValue('mtgox_instant_only', Configuration::get('MTGOX_INSTANT_ONLY'))), 'submit' => Tools::isSubmit('submitMtgox'), 'errors' => $errors)); return $this->display(__FILE__, 'views/templates/back/configure.tpl'); }
private function init() { if (Tools::isSubmit('printManifest')) { if ($shipment_ids = Tools::getValue('ShipmentsBox')) { $manifest = new DpdGroupManifest(); $manifest->shipments = $shipment_ids; if ($pdf_content = $manifest->printManifest()) { foreach ($shipment_ids as $id_shipment) { $shipment = new DpdGroupShipment(); $shipment->getAndSaveTrackingInfo((int) $id_shipment); } ob_end_clean(); header('Content-type: application/pdf'); header('Content-Disposition: attachment; filename="manifest_' . time() . '.pdf"'); echo $pdf_content; exit; } else { $this->module_instance->outputHTML($this->module_instance->displayError(reset(DpdGroupManifest::$errors))); } } else { $this->module_instance->outputHTML($this->module_instance->displayError($this->l('No selected shipments'))); } } if (Tools::isSubmit('printLabels')) { if ($shipment_ids = Tools::getValue('ShipmentsBox')) { $shipment = new DpdGroupShipment(); if ($pdf_content = $shipment->getLabelsPdf($shipment_ids)) { ob_end_clean(); header('Content-type: application/pdf'); header('Content-Disposition: attachment; filename="shipment_labels_' . time() . '.pdf"'); echo $pdf_content; } else { $this->module_instance->outputHTML($this->module_instance->displayError(reset(DpdGroupManifest::$errors))); } } else { $this->module_instance->outputHTML($this->module_instance->displayError($this->l('Select at least one shipment'))); } } if (Tools::isSubmit('changeOrderStatus')) { if ($shipment_ids = Tools::getValue('ShipmentsBox')) { foreach ($shipment_ids as $id_shipment) { $id_order = DpdGroupShipment::getOrderIdByShipmentId((int) $id_shipment); if (!self::changeOrderStatusToShipped($id_order)) { self::$errors[] = sprintf($this->l('Can not continue: shipment #%d order status could not be updated'), $id_shipment); break; } } if (self::$errors) { $this->module_instance->outputHTML($this->module_instance->displayError(reset(self::$errors))); } else { DpdGroup::addFlashMessage($this->l('Selected orders statuses were successfully updated')); Tools::redirectAdmin($this->module_instance->module_url . '&menu=shipment_list'); } } else { $this->module_instance->outputHTML($this->module_instance->displayError($this->l('Select at least one shipment'))); } } }
public function postProcess() { if (Tools::isSubmit('submitStoreConf')) { Configuration::updateValue('PRODUCTPAYMENTLOGOS_LINK', Tools::getValue('PRODUCTPAYMENTLOGOS_LINK')); Configuration::updateValue('PRODUCTPAYMENTLOGOS_TITLE', Tools::getValue('PRODUCTPAYMENTLOGOS_TITLE')); if (isset($_FILES['PRODUCTPAYMENTLOGOS_IMG']) && isset($_FILES['PRODUCTPAYMENTLOGOS_IMG']['tmp_name']) && !empty($_FILES['PRODUCTPAYMENTLOGOS_IMG']['tmp_name'])) { if (ImageManager::validateUpload($_FILES['PRODUCTPAYMENTLOGOS_IMG'], 4000000)) { return $this->displayError($this->l('Invalid image')); } else { $ext = Tools::substr($_FILES['PRODUCTPAYMENTLOGOS_IMG']['name'], Tools::strrpos($_FILES['PRODUCTPAYMENTLOGOS_IMG']['name'], '.') + 1); $file_name = md5($_FILES['PRODUCTPAYMENTLOGOS_IMG']['name']) . '.' . $ext; if (!move_uploaded_file($_FILES['PRODUCTPAYMENTLOGOS_IMG']['tmp_name'], dirname(__FILE__) . '/img/' . $file_name)) { return $this->displayError($this->l('An error occurred while attempting to upload the file.')); } else { $file_path = dirname(__FILE__) . '/img/' . Configuration::get('PRODUCTPAYMENTLOGOS_IMG'); if (Configuration::hasContext('PRODUCTPAYMENTLOGOS_IMG', null, Shop::getContext()) && Configuration::get('PRODUCTPAYMENTLOGOS_IMG') != $file_name && file_exists($file_path)) { unlink($file_path); } Configuration::updateValue('PRODUCTPAYMENTLOGOS_IMG', $file_name); $this->_clearCache('productpaymentlogos.tpl'); Tools::redirectAdmin('index.php?tab=AdminModules&conf=6&configure=' . $this->name . '&token=' . Tools::getAdminTokenLite('AdminModules')); } } } $this->_clearCache('productpaymentlogos.tpl'); } return ''; }