本文整理汇总了PHP中Tools::redirectAdmin方法的典型用法代码示例。如果您正苦于以下问题:PHP Tools::redirectAdmin方法的具体用法?PHP Tools::redirectAdmin怎么用?PHP Tools::redirectAdmin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tools
的用法示例。
在下文中一共展示了Tools::redirectAdmin方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: postProcess
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();
}
}
示例2: install
/**
* 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;
}
示例3: postProcess
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);
}
}
}
}
}
示例4: postProcess
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();
}
}
示例5: __construct
public function __construct()
{
parent::__construct();
if (!$this->module->active) {
Tools::redirectAdmin($this->context->link->getAdminLink('AdminHome'));
}
}
示例6: getContent
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);
}
示例7: getContent
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;
}
示例8: getContent
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;
}
}
}
示例9: preinstall
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;
}
示例10: __construct
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();
}
}
示例11: __construct
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;
}
}
}
示例12: install
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', 'paypal@prestashop.com') 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;
}
示例13: preinstall
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;
}
示例14: postProcess
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();
}
示例15: 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();
}
}