diff --git a/classes/controller/AdminController.php b/classes/controller/AdminController.php index cc66f3ab5..91af74fe3 100644 --- a/classes/controller/AdminController.php +++ b/classes/controller/AdminController.php @@ -474,9 +474,6 @@ class AdminControllerCore extends Controller } else { - // set token - $token = Tools::getValue('token') ? Tools::getValue('token') : $this->token; - // Process list filtering if ($this->filter) $this->processFilter(); @@ -488,7 +485,7 @@ class AdminControllerCore extends Controller Hook::exec('actionAdmin'.ucfirst($this->action).'Before', array('controller' => $this)); Hook::exec('action'.get_class($this).ucfirst($this->action).'Before', array('controller' => $this)); // Call process - $return = $this->{'process'.Tools::toCamelCase($this->action)}($token); + $return = $this->{'process'.Tools::toCamelCase($this->action)}(); // Hook After Action Hook::exec('actionAdmin'.ucfirst($this->action).'After', array('controller' => $this, 'return' => $return)); Hook::exec('action'.get_class($this).ucfirst($this->action).'After', array('controller' => $this, 'return' => $return)); @@ -500,16 +497,14 @@ class AdminControllerCore extends Controller /** * Object Delete images - * - * @param string $token */ - public function processDeleteImage($token) + public function processDeleteImage() { if (Validate::isLoadedObject($object = $this->loadObject())) { if (($object->deleteImage())) { - $redirect = self::$currentIndex.'&add'.$this->table.'&'.$this->identifier.'='.Tools::getValue($this->identifier).'&conf=7&token='.$token; + $redirect = self::$currentIndex.'&add'.$this->table.'&'.$this->identifier.'='.Tools::getValue($this->identifier).'&conf=7&token='.$this->token; if (!$this->ajax) $this->redirect_after = $redirect; else @@ -522,10 +517,8 @@ class AdminControllerCore extends Controller /** * Object Delete - * - * @param string $token */ - public function processDelete($token) + public function processDelete() { if (Validate::isLoadedObject($object = $this->loadObject())) { @@ -551,13 +544,13 @@ class AdminControllerCore extends Controller $object->deleted = 1; if ($object->update()) - $this->redirect_after = self::$currentIndex.'&conf=1&token='.$token; + $this->redirect_after = self::$currentIndex.'&conf=1&token='.$this->token; } elseif ($object->delete()) { if (method_exists($object, 'cleanPositions')) $object->cleanPositions(); - $this->redirect_after = self::$currentIndex.'&conf=1&token='.$token; + $this->redirect_after = self::$currentIndex.'&conf=1&token='.$this->token; } $this->errors[] = Tools::displayError('An error occurred during deletion.'); } @@ -574,26 +567,23 @@ class AdminControllerCore extends Controller /** * Call the right method for creating or updating object * - * @param $token * @return mixed */ - public function processSave($token) + public function processSave() { if ($this->id_object) { $this->object = $this->loadObject(); - return $this->processUpdate($token); + return $this->processUpdate(); } else - return $this->processAdd($token); + return $this->processAdd(); } /** * Object creation - * - * @param string $token */ - public function processAdd($token) + public function processAdd() { /* Checking fields validity */ $this->validateRules(); @@ -617,13 +607,13 @@ class AdminControllerCore extends Controller $this->updateAssoShop($object->id); // Save and stay on same form if (empty($this->redirect_after) && $this->redirect_after !== false && Tools::isSubmit('submitAdd'.$this->table.'AndStay')) - $this->redirect_after = self::$currentIndex.'&'.$this->identifier.'='.$object->id.'&conf=3&update'.$this->table.'&token='.$token; + $this->redirect_after = self::$currentIndex.'&'.$this->identifier.'='.$object->id.'&conf=3&update'.$this->table.'&token='.$this->token; // Save and back to parent if (empty($this->redirect_after) && $this->redirect_after !== false && Tools::isSubmit('submitAdd'.$this->table.'AndBackToParent')) - $this->redirect_after = self::$currentIndex.'&'.$this->identifier.'='.$parent_id.'&conf=3&token='.$token; + $this->redirect_after = self::$currentIndex.'&'.$this->identifier.'='.$parent_id.'&conf=3&token='.$this->token; // Default behavior (save and back) if (empty($this->redirect_after) && $this->redirect_after !== false) - $this->redirect_after = self::$currentIndex.($parent_id ? '&'.$this->identifier.'='.$object->id : '').'&conf=3&token='.$token; + $this->redirect_after = self::$currentIndex.($parent_id ? '&'.$this->identifier.'='.$object->id : '').'&conf=3&token='.$this->token; } } @@ -641,10 +631,8 @@ class AdminControllerCore extends Controller /** * Object update - * - * @param string $token */ - public function processUpdate($token) + public function processUpdate() { /* Checking fields validity */ $this->validateRules(); @@ -702,18 +690,18 @@ class AdminControllerCore extends Controller // Specific scene feature // @todo change stay_here submit name (not clear for redirect to scene ... ) if (Tools::getValue('stay_here') == 'on' || Tools::getValue('stay_here') == 'true' || Tools::getValue('stay_here') == '1') - $this->redirect_after = self::$currentIndex.'&'.$this->identifier.'='.$object->id.'&conf=4&updatescene&token='.$token; + $this->redirect_after = self::$currentIndex.'&'.$this->identifier.'='.$object->id.'&conf=4&updatescene&token='.$this->token; // Save and stay on same form // @todo on the to following if, we may prefer to avoid override redirect_after previous value if (Tools::isSubmit('submitAdd'.$this->table.'AndStay')) - $this->redirect_after = self::$currentIndex.'&'.$this->identifier.'='.$object->id.'&conf=4&update'.$this->table.'&token='.$token; + $this->redirect_after = self::$currentIndex.'&'.$this->identifier.'='.$object->id.'&conf=4&update'.$this->table.'&token='.$this->token; // Save and back to parent if (Tools::isSubmit('submitAdd'.$this->table.'AndBackToParent')) - $this->redirect_after = self::$currentIndex.'&'.$this->identifier.'='.$parent_id.'&conf=4&token='.$token; + $this->redirect_after = self::$currentIndex.'&'.$this->identifier.'='.$parent_id.'&conf=4&token='.$this->token; // Default behavior (save and back) if (empty($this->redirect_after)) - $this->redirect_after = self::$currentIndex.($parent_id ? '&'.$this->identifier.'='.$object->id : '').'&conf=4&token='.$token; + $this->redirect_after = self::$currentIndex.($parent_id ? '&'.$this->identifier.'='.$object->id : '').'&conf=4&token='.$this->token; } } else @@ -736,10 +724,8 @@ class AdminControllerCore extends Controller /** * Change object required fields - * - * @param string $token */ - public function processUpdateFields($token) + public function processUpdateFields() { if (!is_array($fields = Tools::getValue('fieldsBox'))) $fields = array(); @@ -748,24 +734,22 @@ class AdminControllerCore extends Controller if (!$object->addFieldsRequiredDatabase($fields)) $this->errors[] = Tools::displayError('Error in updating required fields'); else - $this->redirect_after = self::$currentIndex.'&conf=4&token='.$token; + $this->redirect_after = self::$currentIndex.'&conf=4&token='.$this->token; return $object; } /** * Change object status (active, inactive) - * - * @param string $token */ - public function processStatus($token) + public function processStatus() { if (Validate::isLoadedObject($object = $this->loadObject())) { if ($object->toggleStatus()) { $id_category = (($id_category = (int)Tools::getValue('id_category')) && Tools::getValue('id_product')) ? '&id_category='.$id_category : ''; - $this->redirect_after = self::$currentIndex.'&conf=5'.$id_category.'&token='.$token; + $this->redirect_after = self::$currentIndex.'&conf=5'.$id_category.'&token='.$this->token; } else $this->errors[] = Tools::displayError('An error occurred while updating status.'); @@ -780,10 +764,8 @@ class AdminControllerCore extends Controller /** * Change object position - * - * @param string $token */ - public function processPosition($token) + public function processPosition() { if (!Validate::isLoadedObject($object = $this->loadObject())) { @@ -795,7 +777,7 @@ class AdminControllerCore extends Controller else { $id_identifier_str = ($id_identifier = (int)Tools::getValue($this->identifier)) ? '&'.$this->identifier.'='.$id_identifier : ''; - $redirect = self::$currentIndex.'&'.$this->table.'Orderby=position&'.$this->table.'Orderway=asc&conf=5'.$id_identifier_str.'&token='.$token; + $redirect = self::$currentIndex.'&'.$this->table.'Orderby=position&'.$this->table.'Orderway=asc&conf=5'.$id_identifier_str.'&token='.$this->token; $this->redirect_after = $redirect; } return $object; @@ -803,8 +785,6 @@ class AdminControllerCore extends Controller /** * Cancel all filters for this tab - * - * @param string $token */ public function processResetFilters() { @@ -839,10 +819,8 @@ class AdminControllerCore extends Controller /** * Update options and preferences - * - * @param string $token */ - protected function processUpdateOptions($token) + protected function processUpdateOptions() { $this->beforeUpdateOptions(); @@ -2440,10 +2418,9 @@ class AdminControllerCore extends Controller /** * Delete multiple items * - * @param array $boxes ids of the item to be processed * @return boolean true if succcess */ - protected function processBulkDelete($token) + protected function processBulkDelete() { if (is_array($this->boxes) && !empty($this->boxes)) { @@ -2475,7 +2452,7 @@ class AdminControllerCore extends Controller $result = $object->deleteSelection(Tools::getValue($this->table.'Box')); if ($result) - $this->redirect_after = self::$currentIndex.'&conf=2&token='.$token; + $this->redirect_after = self::$currentIndex.'&conf=2&token='.$this->token; $this->errors[] = Tools::displayError('An error occurred while deleting selection.'); } } @@ -2488,7 +2465,7 @@ class AdminControllerCore extends Controller return false; } - protected function processBulkAffectZone($token) + protected function processBulkAffectZone() { if (is_array($this->boxes) && !empty($this->boxes)) { @@ -2496,7 +2473,7 @@ class AdminControllerCore extends Controller $result = $object->affectZoneToSelection(Tools::getValue($this->table.'Box'), Tools::getValue('zone_to_affect')); if ($result) - $this->redirect_after = self::$currentIndex.'&conf=28&token='.$token; + $this->redirect_after = self::$currentIndex.'&conf=28&token='.$this->token; $this->errors[] = Tools::displayError('An error occurred while affecting a zone to the selection.'); } else diff --git a/controllers/admin/AdminAddressesController.php b/controllers/admin/AdminAddressesController.php index 90016f842..6dcc3b9ef 100644 --- a/controllers/admin/AdminAddressesController.php +++ b/controllers/admin/AdminAddressesController.php @@ -299,7 +299,7 @@ class AdminAddressesControllerCore extends AdminController return parent::renderForm(); } - public function processSave($token) + public function processSave() { // Transform e-mail in id_customer for parent processing if (Validate::isEmail(Tools::getValue('email'))) @@ -368,7 +368,7 @@ class AdminAddressesControllerCore extends AdminController } if (empty($this->errors)) - parent::processSave($token); + parent::processSave(); else // if we have errors, we stay on the form instead of going back to the list $this->display = 'edit'; @@ -384,12 +384,12 @@ class AdminAddressesControllerCore extends AdminController } } - public function processAdd($token) + public function processAdd() { if (Tools::getValue('submitFormAjax')) $this->redirect_after = false; - return parent::processAdd($token); + return parent::processAdd(); } /** diff --git a/controllers/admin/AdminAttributeGeneratorController.php b/controllers/admin/AdminAttributeGeneratorController.php index 1a79c8711..e0e4ca946 100644 --- a/controllers/admin/AdminAttributeGeneratorController.php +++ b/controllers/admin/AdminAttributeGeneratorController.php @@ -95,7 +95,7 @@ class AdminAttributeGeneratorControllerCore extends AdminController parent::postProcess(); } - public function processGenerate($token) + public function processGenerate() { if (!is_array(Tools::getValue('options'))) $this->errors[] = Tools::displayError('Please choose at least 1 attribute.'); diff --git a/controllers/admin/AdminAttributesGroupsController.php b/controllers/admin/AdminAttributesGroupsController.php index 0973d2743..4749bbb6d 100644 --- a/controllers/admin/AdminAttributesGroupsController.php +++ b/controllers/admin/AdminAttributesGroupsController.php @@ -383,16 +383,16 @@ class AdminAttributesGroupsControllerCore extends AdminController * Override processAdd to change SaveAndStay button action * @see classes/AdminControllerCore::processUpdate() */ - public function processAdd($token) + public function processAdd() { - parent::processAdd($token); + parent::processAdd(); if (Tools::isSubmit('submitAdd'.$this->table.'AndStay') && !count($this->errors)) { if ($this->display == 'add') - $this->redirect_after = self::$currentIndex.'&'.$this->identifier.'=&conf=3&update'.$this->table.'&token='.$token; + $this->redirect_after = self::$currentIndex.'&'.$this->identifier.'=&conf=3&update'.$this->table.'&token='.$this->token; else - $this->redirect_after = self::$currentIndex.'&id_attribute_group='.(int)Tools::getValue('id_attribute_group').'&conf=3&update'.$this->table.'&token='.$token; + $this->redirect_after = self::$currentIndex.'&id_attribute_group='.(int)Tools::getValue('id_attribute_group').'&conf=3&update'.$this->table.'&token='.$this->token; } if (count($this->errors)) @@ -403,16 +403,16 @@ class AdminAttributesGroupsControllerCore extends AdminController * Override processUpdate to change SaveAndStay button action * @see classes/AdminControllerCore::processUpdate() */ - public function processUpdate($token) + public function processUpdate() { - parent::processUpdate($token); + parent::processUpdate(); if (Tools::isSubmit('submitAdd'.$this->table.'AndStay') && !count($this->errors)) { if ($this->display == 'add') - $this->redirect_after = self::$currentIndex.'&'.$this->identifier.'=&conf=3&update'.$this->table.'&token='.$token; + $this->redirect_after = self::$currentIndex.'&'.$this->identifier.'=&conf=3&update'.$this->table.'&token='.$this->token; else - $this->redirect_after = self::$currentIndex.'&'.$this->identifier.'=&id_attribute_group='.(int)Tools::getValue('id_attribute_group').'&conf=3&update'.$this->table.'&token='.$token; + $this->redirect_after = self::$currentIndex.'&'.$this->identifier.'=&id_attribute_group='.(int)Tools::getValue('id_attribute_group').'&conf=3&update'.$this->table.'&token='.$this->token; } } @@ -564,18 +564,17 @@ class AdminAttributesGroupsControllerCore extends AdminController /** * Call the right method for creating or updating object * - * @param $token * @return mixed */ - public function processSave($token) + public function processSave() { if ($this->display == 'add' || $this->display == 'edit') $this->identifier = 'id_attribute_group'; if (!$this->id_object) - return $this->processAdd($token); + return $this->processAdd(); else - return $this->processUpdate($token); + return $this->processUpdate(); } public function postProcess() @@ -714,10 +713,9 @@ class AdminAttributesGroupsControllerCore extends AdminController /** * Overrides parent to delete items from sublist * - * @param $token * @return mixed */ - public function processBulkDelete($token) + public function processBulkDelete() { // If we are deleting attributes instead of attribute_groups if (Tools::getIsset('attributeBox')) @@ -727,7 +725,7 @@ class AdminAttributesGroupsControllerCore extends AdminController $this->boxes = Tools::getValue($this->table.'Box'); } - $result = parent::processBulkDelete($token); + $result = parent::processBulkDelete(); // Restore vars $this->className = 'AttributeGroup'; $this->table = 'attribute_group'; diff --git a/controllers/admin/AdminCartRulesController.php b/controllers/admin/AdminCartRulesController.php index fbf2a108e..9264426e0 100644 --- a/controllers/admin/AdminCartRulesController.php +++ b/controllers/admin/AdminCartRulesController.php @@ -89,9 +89,9 @@ class AdminCartRulesControllerCore extends AdminController $this->afterAdd($current_object); } - public function processAdd($token) + public function processAdd() { - if ($cart_rule = parent::processAdd($token)) + if ($cart_rule = parent::processAdd()) $this->context->smarty->assign('new_cart_rule', $cart_rule); if (Tools::getValue('submitFormAjax')) $this->redirect_after = false; diff --git a/controllers/admin/AdminCategoriesController.php b/controllers/admin/AdminCategoriesController.php index 94581a501..fa6f23219 100644 --- a/controllers/admin/AdminCategoriesController.php +++ b/controllers/admin/AdminCategoriesController.php @@ -483,7 +483,7 @@ class AdminCategoriesControllerCore extends AdminController return parent::renderForm(); } - public function processAdd($token) + public function processAdd() { $id_category = (int)Tools::getValue('id_category'); $id_parent = (int)Tools::getValue('id_parent'); @@ -500,10 +500,10 @@ class AdminCategoriesControllerCore extends AdminController else $this->errors[] = Tools::displayError($this->l('Category cannot be parent of itself.')); } - parent::processAdd($token); + parent::processAdd(); } - public function processDelete($token) + public function processDelete() { if ($this->tabAccess['delete'] === '1') { @@ -573,7 +573,7 @@ class AdminCategoriesControllerCore extends AdminController $this->errors[] = Tools::displayError('You do not have permission to delete here.'); } - public function processPosition($token) + public function processPosition() { if ($this->tabAccess['edit'] !== '1') $this->errors[] = Tools::displayError('You do not have permission to edit here.'); diff --git a/controllers/admin/AdminCmsCategoriesController.php b/controllers/admin/AdminCmsCategoriesController.php index ec9880772..7365ef75a 100644 --- a/controllers/admin/AdminCmsCategoriesController.php +++ b/controllers/admin/AdminCmsCategoriesController.php @@ -75,7 +75,7 @@ class AdminCmsCategoriesControllerCore extends AdminController parent::getList($id_lang, $order_by, $order_way, $start, $limit, $id_lang_shop); } - public function postProcess($token = null) + public function postProcess() { $this->tabAccess = Profile::getProfileAccess($this->context->employee->id_profile, $this->id); if (Tools::isSubmit('submitAdd'.$this->table)) diff --git a/controllers/admin/AdminCurrenciesController.php b/controllers/admin/AdminCurrenciesController.php index 4902f57ec..53c71aeb0 100644 --- a/controllers/admin/AdminCurrenciesController.php +++ b/controllers/admin/AdminCurrenciesController.php @@ -240,9 +240,8 @@ class AdminCurrenciesControllerCore extends AdminController /** * @see AdminController::processDelete() - * @param $token */ - public function processDelete($token) + public function processDelete() { if (Validate::isLoadedObject($object = $this->loadObject())) { @@ -260,9 +259,8 @@ class AdminCurrenciesControllerCore extends AdminController /** * @see AdminController::processStatus() - * @param $token */ - public function processStatus($token) + public function processStatus() { if (Validate::isLoadedObject($object = $this->loadObject())) { @@ -281,9 +279,8 @@ class AdminCurrenciesControllerCore extends AdminController /** * Update currency exchange rates - * @param $token */ - public function processExchangeRates($token) + public function processExchangeRates() { if (!$this->errors[] = Currency::refreshCurrencies()) Tools::redirectAdmin(self::$currentIndex.'&conf=6&token='.$this->token); diff --git a/controllers/admin/AdminCustomersController.php b/controllers/admin/AdminCustomersController.php index 4ae6381d8..33a3eebc6 100644 --- a/controllers/admin/AdminCustomersController.php +++ b/controllers/admin/AdminCustomersController.php @@ -687,7 +687,7 @@ class AdminCustomersControllerCore extends AdminController return parent::renderView(); } - public function processDelete($token) + public function processDelete() { if ($this->delete_mode == 'real') { @@ -702,10 +702,10 @@ class AdminCustomersControllerCore extends AdminController return; } - parent::processDelete($token); + parent::processDelete(); } - public function processAdd($token) + public function processAdd() { if (Tools::getValue('submitFormAjax')) $this->redirect_after = false; @@ -718,7 +718,7 @@ class AdminCustomersControllerCore extends AdminController $this->errors[] = Tools::displayError('An account already exists for this e-mail address:').' '.$customer_email; else { - if ($customer = parent::processAdd($token)) + if ($customer = parent::processAdd()) { $this->context->smarty->assign('new_customer', $customer); return true; @@ -728,7 +728,7 @@ class AdminCustomersControllerCore extends AdminController } } - public function processUpdate($token) + public function processUpdate() { if (Validate::isLoadedObject($this->object)) { @@ -743,20 +743,20 @@ class AdminCustomersControllerCore extends AdminController $this->errors[] = Tools::displayError('An account already exists for this e-mail address:').' '.$customer_email; } - return parent::processUpdate($token); + return parent::processUpdate(); } else $this->errors[] = Tools::displayError('An error occurred while loading object.').' '.$this->table.' '.Tools::displayError('(cannot load object)'); } - public function processSave($token) + public function processSave() { // Check that default group is selected if (!is_array(Tools::getValue('groupBox')) || !in_array(Tools::getValue('id_default_group'), Tools::getValue('groupBox'))) $this->errors[] = Tools::displayError('Default customer group must be selected in group box.'); - return parent::processSave($token); + return parent::processSave(); } protected function afterDelete($object, $old_id) @@ -773,10 +773,8 @@ class AdminCustomersControllerCore extends AdminController } /** * Transform a guest account into a registered customer account - * - * @param string $token */ - public function processGuestToCustomer($token) + public function processGuestToCustomer() { $customer = new Customer((int)Tools::getValue('id_customer')); if (!Validate::isLoadedObject($customer)) @@ -791,10 +789,8 @@ class AdminCustomersControllerCore extends AdminController /** * Toggle the newsletter flag - * - * @param string $token */ - public function processChangeNewsletterVal($token) + public function processChangeNewsletterVal() { $customer = new Customer($this->id_object); if (!Validate::isLoadedObject($customer)) @@ -807,10 +803,8 @@ class AdminCustomersControllerCore extends AdminController /** * Toggle newsletter optin flag - * - * @param string $token */ - public function processChangeOptinVal($token) + public function processChangeOptinVal() { $customer = new Customer($this->id_object); if (!Validate::isLoadedObject($customer)) diff --git a/controllers/admin/AdminFeaturesController.php b/controllers/admin/AdminFeaturesController.php index 3a8d1940d..35d568b6f 100644 --- a/controllers/admin/AdminFeaturesController.php +++ b/controllers/admin/AdminFeaturesController.php @@ -398,33 +398,32 @@ class AdminFeaturesControllerCore extends AdminController * Override processAdd to change SaveAndStay button action * @see classes/AdminControllerCore::processAdd() */ - public function processAdd($token) + public function processAdd() { - parent::processAdd($token); + parent::processAdd(); if (Tools::isSubmit('submitAdd'.$this->table.'AndStay') && !count($this->errors)) - $this->redirect_after = self::$currentIndex.'&'.$this->identifier.'=&conf=3&update'.$this->table.'&token='.$token; + $this->redirect_after = self::$currentIndex.'&'.$this->identifier.'=&conf=3&update'.$this->table.'&token='.$this->token; } /** * Override processUpdate to change SaveAndStay button action * @see classes/AdminControllerCore::processUpdate() */ - public function processUpdate($token) + public function processUpdate() { - parent::processUpdate($token); + parent::processUpdate(); if (Tools::isSubmit('submitAdd'.$this->table.'AndStay') && !count($this->errors)) - $this->redirect_after = self::$currentIndex.'&'.$this->identifier.'=&conf=3&update'.$this->table.'&token='.$token; + $this->redirect_after = self::$currentIndex.'&'.$this->identifier.'=&conf=3&update'.$this->table.'&token='.$this->token; } /** * Call the right method for creating or updating object * - * @param $token * @return mixed */ - public function processSave($token) + public function processSave() { if ($this->table == 'feature') { @@ -443,7 +442,7 @@ class AdminFeaturesControllerCore extends AdminController if (preg_match('/^name_/Ui', $key)) $_POST[$key] = str_replace ('\n', '', str_replace('\r', '', $value)); } - parent::processSave($token); + parent::processSave(); } /** diff --git a/controllers/admin/AdminGeolocationController.php b/controllers/admin/AdminGeolocationController.php index d1f4628a4..93382dae8 100755 --- a/controllers/admin/AdminGeolocationController.php +++ b/controllers/admin/AdminGeolocationController.php @@ -82,7 +82,7 @@ class AdminGeolocationControllerCore extends AdminController /** * @see AdminController::processUpdateOptions() */ - public function processUpdateOptions($token) + public function processUpdateOptions() { if ($this->isGeoLiteCityAvailable()) Configuration::updateValue('PS_GEOLOCATION_ENABLED', intval(Tools::getValue('PS_GEOLOCATION_ENABLED'))); @@ -115,7 +115,7 @@ class AdminGeolocationControllerCore extends AdminController } } - return parent::processUpdateOptions($token); + return parent::processUpdateOptions(); } public function renderOptions() diff --git a/controllers/admin/AdminGroupsController.php b/controllers/admin/AdminGroupsController.php index cd60467ca..654149930 100644 --- a/controllers/admin/AdminGroupsController.php +++ b/controllers/admin/AdminGroupsController.php @@ -356,14 +356,14 @@ class AdminGroupsControllerCore extends AdminController return array('unauth_modules' => $unauth_modules, 'auth_modules' => $auth_modules); } - public function processSave($token) + public function processSave() { if (!$this->validateDiscount(Tools::getValue('reduction'))) $this->errors[] = Tools::displayError('Discount value is incorrect (must be a percentage)'); else { $this->updateCategoryReduction(); - parent::processSave($token); + parent::processSave(); $this->updateRestrictions(); } } @@ -452,10 +452,8 @@ class AdminGroupsControllerCore extends AdminController /** * Toggle show prices flag - * - * @param string $token */ - public function processChangeShowPricesVal($token) + public function processChangeShowPricesVal() { $group = new Group($this->id_object); if (!Validate::isLoadedObject($group)) diff --git a/controllers/admin/AdminProductsController.php b/controllers/admin/AdminProductsController.php index 213fc4b65..fbc2315a0 100644 --- a/controllers/admin/AdminProductsController.php +++ b/controllers/admin/AdminProductsController.php @@ -297,7 +297,7 @@ class AdminProductsControllerCore extends AdminController } } - public function processDeleteVirtualProduct($token) + public function processDeleteVirtualProduct() { if (!($id_product_download = ProductDownload::getIdFromIdAttribute((int)Tools::getValue('id_product'), 0))) return false; @@ -305,7 +305,7 @@ class AdminProductsControllerCore extends AdminController return $product_download->deleteFile((int)$id_product_download); } - public function processDeleteVirtualProductAttribute($token) + public function processDeleteVirtualProductAttribute() { if (!($id_product_download = ProductDownload::getIdFromIdAttribute((int)Tools::getValue('id_product'), (int)Tools::getValue('id_product_attribute')))) return false; @@ -316,10 +316,9 @@ class AdminProductsControllerCore extends AdminController /** * Upload new attachment * - * @param $token * @return void */ - public function processAddAttachments($token) + public function processAddAttachments() { $languages = Language::getLanguages(false); $is_attachment_name_valid = false; @@ -405,10 +404,9 @@ class AdminProductsControllerCore extends AdminController /** * Attach an existing attachment to the product * - * @param $token * @return void */ - public function processAttachments($token) + public function processAttachments() { if ($id = (int)Tools::getValue($this->identifier)) { @@ -419,7 +417,7 @@ class AdminProductsControllerCore extends AdminController } } - public function processDuplicate($token) + public function processDuplicate() { if (Validate::isLoadedObject($product = new Product((int)Tools::getValue('id_product')))) { @@ -452,7 +450,7 @@ class AdminProductsControllerCore extends AdminController Hook::exec('actionProductAdd', array('product' => $product)); if (in_array($product->visibility, array('both', 'search'))) Search::indexation(false, $product->id); - $this->redirect_after = self::$currentIndex.(Tools::getIsset('id_category') ? '&id_category='.(int)Tools::getValue('id_category') : '').'&conf=19&token='.($token ? $token : $this->token); + $this->redirect_after = self::$currentIndex.(Tools::getIsset('id_category') ? '&id_category='.(int)Tools::getValue('id_category') : '').'&conf=19&token='.$this->token; } } else @@ -460,7 +458,7 @@ class AdminProductsControllerCore extends AdminController } } - public function processDelete($token) + public function processDelete() { if (Validate::isLoadedObject($object = $this->loadObject()) && isset($this->fieldImageSettings)) { @@ -477,10 +475,10 @@ class AdminProductsControllerCore extends AdminController $object->deleteImages(); $object->deleted = 1; if ($object->update()) - $this->redirect_after = self::$currentIndex.'&conf=1&token='.($token ? $token : $this->token).$category_url; + $this->redirect_after = self::$currentIndex.'&conf=1&token='.$this->token.$category_url; } elseif ($object->delete()) - $this->redirect_after = self::$currentIndex.'&conf=1&token='.($token ? $token : $this->token).$category_url; + $this->redirect_after = self::$currentIndex.'&conf=1&token='.$this->token.$category_url; $this->errors[] = Tools::displayError('An error occurred during deletion.'); } } @@ -488,7 +486,7 @@ class AdminProductsControllerCore extends AdminController $this->errors[] = Tools::displayError('An error occurred while deleting object.').' '.$this->table.' '.Tools::displayError('(cannot load object)'); } - public function processImage($token) + public function processImage() { $id_image = (int)Tools::getValue('id_image'); $image = new Image((int)$id_image); @@ -516,7 +514,7 @@ class AdminProductsControllerCore extends AdminController $productId = (int)Tools::getValue('id_product'); @unlink(_PS_TMP_IMG_DIR_.'product_'.$productId.'.jpg'); @unlink(_PS_TMP_IMG_DIR_.'product_mini_'.$productId.'.jpg'); - $this->redirect_after = self::$currentIndex.'&id_product='.$image->id_product.'&id_category='.(Tools::getIsset('id_category') ? '&id_category='.(int)Tools::getValue('id_category') : '').'&action=Images&addproduct'.'&token='.($token ? $token : $this->token); + $this->redirect_after = self::$currentIndex.'&id_product='.$image->id_product.'&id_category='.(Tools::getIsset('id_category') ? '&id_category='.(int)Tools::getValue('id_category') : '').'&action=Images&addproduct'.'&token='.$this->token; } } @@ -524,14 +522,14 @@ class AdminProductsControllerCore extends AdminController elseif (Tools::getIsset('imgPosition') && Tools::getIsset('imgDirection')) { $image->updatePosition(Tools::getValue('imgDirection'), Tools::getValue('imgPosition')); - $this->redirect_after = self::$currentIndex.'&id_product='.$image->id_product.'&id_category='.(Tools::getIsset('id_category') ? '&id_category='.(int)Tools::getValue('id_category') : '').'&add'.$this->table.'&action=Images&token='.($token ? $token : $this->token); + $this->redirect_after = self::$currentIndex.'&id_product='.$image->id_product.'&id_category='.(Tools::getIsset('id_category') ? '&id_category='.(int)Tools::getValue('id_category') : '').'&add'.$this->table.'&action=Images&token='.$this->token; } } else $this->errors[] = Tools::displayError('Could not find image.'); } - protected function processBulkDelete($token) + protected function processBulkDelete() { if (is_array($this->boxes) && !empty($this->boxes)) { @@ -561,7 +559,7 @@ class AdminProductsControllerCore extends AdminController $id_category = (int)Tools::getValue('id_category'); $category_url = empty($id_category) ? '' : '&id_category='.(int)$id_category; - $this->redirect_after = self::$currentIndex.'&conf=2&token='.$token.$category_url; + $this->redirect_after = self::$currentIndex.'&conf=2&token='.$this->token.$category_url; } $this->errors[] = Tools::displayError('An error occurred while deleting selection.'); } @@ -570,7 +568,7 @@ class AdminProductsControllerCore extends AdminController $this->errors[] = Tools::displayError('You must select at least one element to delete.'); } - public function processProductAttribute($token) + public function processProductAttribute() { // Don't process if the combination fields have not been submitted if (!Combination::isFeatureActive() || !Tools::getIsset('attribute')) @@ -670,14 +668,12 @@ class AdminProductsControllerCore extends AdminController if (!empty($is_virtual)) Product::updateIsVirtual($product->id); - - //$this->redirect_after = self::$currentIndex.'&id_product='.$product->id.(Tools::getIsset('id_category') ? '&id_category='.(int)Tools::getValue('id_category') : '').'&add'.$this->table.'&conf=4&action=Combinations&token='.($token ? $token : $this->token); } } } } - public function processFeatures($token) + public function processFeatures() { if (!Feature::isFeatureActive()) return; @@ -720,10 +716,8 @@ class AdminProductsControllerCore extends AdminController /** * This function is never called at the moment (specific prices cannot be edited) - * - * @param $token */ - public function processPricesModification($token) + public function processPricesModification() { $id_specific_prices = Tools::getValue('spm_id_specific_price'); $id_combinations = Tools::getValue('spm_id_product_attribute'); @@ -759,11 +753,11 @@ class AdminProductsControllerCore extends AdminController $this->errors = Tools::displayError('An error occurred while updating the specific price.'); } if (!count($this->errors)) - $this->redirect_after = self::$currentIndex.'&id_product='.(int)(Tools::getValue('id_product')).(Tools::getIsset('id_category') ? '&id_category='.(int)Tools::getValue('id_category') : '').'&update'.$this->table.'&action=Prices&token='.($token ? $token : $this->token); + $this->redirect_after = self::$currentIndex.'&id_product='.(int)(Tools::getValue('id_product')).(Tools::getIsset('id_category') ? '&id_category='.(int)Tools::getValue('id_category') : '').'&update'.$this->table.'&action=Prices&token='.$this->token; } - public function processPriceAddition($token) + public function processPriceAddition() { // Check if a specific price has been submitted if (!Tools::getIsset('submitPriceAddition')) @@ -839,7 +833,7 @@ class AdminProductsControllerCore extends AdminController die(Tools::jsonEncode($json)); } - public function processSpecificPricePriorities($token) + public function processSpecificPricePriorities() { if (!($obj = $this->loadObject())) return; @@ -856,7 +850,7 @@ class AdminProductsControllerCore extends AdminController $this->errors[] = Tools::displayError('An error occurred while setting priorities.'); } - public function processCustomizationConfiguration($token) + public function processCustomizationConfiguration() { $product = $this->object; // Get the number of existing customization fields ($product->text_fields is the updated value, not the existing value) @@ -883,7 +877,7 @@ class AdminProductsControllerCore extends AdminController $this->errors[] = Tools::displayError('An error occurred while updating customization configuration.'); } - public function processProductCustomization($token) + public function processProductCustomization() { if (Validate::isLoadedObject($product = new Product((int)Tools::getValue('id_product')))) { @@ -901,9 +895,8 @@ class AdminProductsControllerCore extends AdminController /** * Overrides parent for custom redirect link - * @param $token */ - public function processPosition($token) + public function processPosition() { if (!Validate::isLoadedObject($object = $this->loadObject())) { @@ -1081,10 +1074,9 @@ class AdminProductsControllerCore extends AdminController /** * postProcess handle every checks before saving products information * - * @param mixed $token * @return void */ - public function postProcess($token = null) + public function postProcess() { if (!$this->redirect_after) parent::postProcess(); @@ -1444,7 +1436,7 @@ class AdminProductsControllerCore extends AdminController } } - public function processAdd($token) + public function processAdd() { $this->checkProduct(); @@ -1504,22 +1496,16 @@ class AdminProductsControllerCore extends AdminController $this->redirect_after = $preview_url; } - if (Tools::getValue('resizer') == 'man' && isset($id_image) && is_int($id_image) && $id_image) - $this->redirect_after = self::$currentIndex.'&id_product='.$this->object->id - .(Tools::getIsset('id_category') ? '&id_category='.(int)Tools::getValue('id_category') : '') - .'&id_image='.(int)$id_image.'&imageresize&toconf=3&submitAddAndStay='.(Tools::isSubmit('submitAdd'.$this->table.'AndStay') ? 'on' : 'off') - .'&token='.($token ? $token : $this->token); - // Save and stay on same form if ($this->display == 'edit') $this->redirect_after = self::$currentIndex.'&id_product='.(int)$this->object->id .(Tools::getIsset('id_category') ? '&id_category='.(int)Tools::getValue('id_category') : '') - .'&addproduct&conf=3&key_tab='.Tools::safeOutput(Tools::getValue('key_tab')).'&token='.($token ? $token : $this->token); + .'&addproduct&conf=3&key_tab='.Tools::safeOutput(Tools::getValue('key_tab')).'&token='.$this->token; else // Default behavior (save and back) $this->redirect_after = self::$currentIndex .(Tools::getIsset('id_category') ? '&id_category='.(int)Tools::getValue('id_category') : '') - .'&conf=3&token='.($token ? $token : $this->token); + .'&conf=3&token='.$this->token; } else $this->object->delete(); @@ -1528,7 +1514,7 @@ class AdminProductsControllerCore extends AdminController $this->errors[] = Tools::displayError('An error occurred while creating object.').' '.$this->table.''; } - public function processUpdate($token) + public function processUpdate() { $this->checkProduct(); if (!empty($this->errors)) @@ -1553,15 +1539,15 @@ class AdminProductsControllerCore extends AdminController $this->updateAccessories($object); $this->updateDownloadProduct($object, 1); $this->updateAssoShop((int)$object->id); - $this->processAccounting($token); - $this->processSuppliers($token); - $this->processWarehouses($token); - $this->processFeatures($token); - $this->processProductAttribute($token); - $this->processPriceAddition($token); - $this->processSpecificPricePriorities($token); - $this->processAttachments($token); - $this->processCustomizationConfiguration($token); + $this->processAccounting(); + $this->processSuppliers(); + $this->processWarehouses(); + $this->processFeatures(); + $this->processProductAttribute(); + $this->processPriceAddition(); + $this->processSpecificPricePriorities(); + $this->processAttachments(); + $this->processCustomizationConfiguration(); $this->object->setTaxRulesGroup((int)Tools::getValue('id_tax_rules_group')); if (!$this->updatePackItems($object)) $this->errors[] = Tools::displayError('An error occurred while adding products to the pack.'); @@ -1598,7 +1584,7 @@ class AdminProductsControllerCore extends AdminController $this->confirmations[] = $this->l('Update successful'); else // Default behavior (save and back) - $this->redirect_after = self::$currentIndex.(Tools::getIsset('id_category') ? '&id_category='.(int)Tools::getValue('id_category') : '').'&conf=4&token='.($token ? $token : $this->token); + $this->redirect_after = self::$currentIndex.(Tools::getIsset('id_category') ? '&id_category='.(int)Tools::getValue('id_category') : '').'&conf=4&token='.$this->token; } } } @@ -2246,7 +2232,7 @@ class AdminProductsControllerCore extends AdminController /** * Post treatment for accounting */ - public function processAccounting($token) + public function processAccounting() { if (Validate::isLoadedObject(($product = new Product((int)Tools::getValue('id_product'))))) { @@ -2275,7 +2261,7 @@ class AdminProductsControllerCore extends AdminController /** * Post treatment for suppliers */ - public function processSuppliers($token) + public function processSuppliers() { if ((int)Tools::getValue('supplier_loaded') === 1 && Validate::isLoadedObject($product = new Product((int)Tools::getValue('id_product')))) { @@ -2428,7 +2414,7 @@ class AdminProductsControllerCore extends AdminController /** * Post treatment for warehouses */ - public function processWarehouses($token) + public function processWarehouses() { if ((int)Tools::getValue('warehouse_loaded') === 1 && Validate::isLoadedObject($product = new Product((int)Tools::getValue('id_product')))) { diff --git a/controllers/admin/AdminSearchConfController.php b/controllers/admin/AdminSearchConfController.php index fab9370aa..f0798f8f7 100644 --- a/controllers/admin/AdminSearchConfController.php +++ b/controllers/admin/AdminSearchConfController.php @@ -257,7 +257,7 @@ class AdminSearchConfControllerCore extends AdminController return parent::renderForm(); } - public function processSave($token) + public function processSave() { $search = strval(Tools::getValue('search')); $string = strval(Tools::getValue('alias')); diff --git a/controllers/admin/AdminShopController.php b/controllers/admin/AdminShopController.php index 0c93c722d..f585e8823 100755 --- a/controllers/admin/AdminShopController.php +++ b/controllers/admin/AdminShopController.php @@ -207,12 +207,12 @@ class AdminShopControllerCore extends AdminController return parent::postProcess(); } - public function processDelete($token) + public function processDelete() { if (!Validate::isLoadedObject($object = $this->loadObject())) $this->errors[] = Tools::displayError('Unable to load this shop.'); else if (!Shop::hasDependency($object->id)) - return Category::deleteCategoriesFromShop($object->id) && parent::processDelete($token); + return Category::deleteCategoriesFromShop($object->id) && parent::processDelete(); else $this->errors[] = Tools::displayError('You can\'t delete this shop (customer and/or order dependency)'); @@ -452,10 +452,8 @@ class AdminShopControllerCore extends AdminController /** * Object creation - * - * @param string $token */ - public function processAdd($token) + public function processAdd() { if (Tools::isSubmit('id_category_default')) $_POST['id_category'] = (int)Tools::getValue('id_category_default'); @@ -480,13 +478,13 @@ class AdminShopControllerCore extends AdminController $this->updateAssoShop($object->id); // Save and stay on same form if (Tools::isSubmit('submitAdd'.$this->table.'AndStay')) - $this->redirect_after = self::$currentIndex.'&'.$this->identifier.'='.$object->id.'&conf=3&update'.$this->table.'&token='.$token; + $this->redirect_after = self::$currentIndex.'&'.$this->identifier.'='.$object->id.'&conf=3&update'.$this->table.'&token='.$this->token; // Save and back to parent if (Tools::isSubmit('submitAdd'.$this->table.'AndBackToParent')) - $this->redirect_after = self::$currentIndex.'&'.$this->identifier.'='.$parent_id.'&conf=3&token='.$token; + $this->redirect_after = self::$currentIndex.'&'.$this->identifier.'='.$parent_id.'&conf=3&token='.$this->token; // Default behavior (save and back) if (empty($this->redirect_after)) - $this->redirect_after = self::$currentIndex.($parent_id ? '&'.$this->identifier.'='.$object->id : '').'&conf=3&token='.$token; + $this->redirect_after = self::$currentIndex.($parent_id ? '&'.$this->identifier.'='.$object->id : '').'&conf=3&token='.$this->token; } } diff --git a/controllers/admin/AdminShopUrlController.php b/controllers/admin/AdminShopUrlController.php index e9f9517f8..97b48f073 100644 --- a/controllers/admin/AdminShopUrlController.php +++ b/controllers/admin/AdminShopUrlController.php @@ -276,16 +276,16 @@ class AdminShopUrlControllerCore extends AdminController return parent::postProcess(); } - public function processSave($token) + public function processSave() { - $return = parent::processSave($token); + $return = parent::processSave(); if (!$this->errors) Tools::generateHtaccess(); return $return; } - public function processAdd($token) + public function processAdd() { $object = $this->loadObject(true); if ($object->id && Tools::getValue('main')) @@ -300,17 +300,17 @@ class AdminShopUrlControllerCore extends AdminController if ($object->canAddThisUrl(Tools::getValue('domain'), Tools::getValue('domain_ssl'), Tools::getValue('physical_uri'), Tools::getValue('virtual_uri'))) $this->errors[] = Tools::displayError('A shop URL that use this domain and uri already exists'); - parent::processAdd($token); + parent::processAdd(); } - public function processUpdate($token) + public function processUpdate() { $this->redirect_shop_url = false; $current_url = parse_url($_SERVER['REQUEST_URI']); if (trim(dirname(dirname($current_url['path'])), '/') == trim($this->object->getBaseURI(), '/')) $this->redirect_shop_url = true; - return parent::processUpdate($token); + return parent::processUpdate(); } protected function afterUpdate($object) diff --git a/controllers/admin/AdminSpecificPriceRuleController.php b/controllers/admin/AdminSpecificPriceRuleController.php index 474a256a5..871bf9251 100755 --- a/controllers/admin/AdminSpecificPriceRuleController.php +++ b/controllers/admin/AdminSpecificPriceRuleController.php @@ -268,10 +268,9 @@ class AdminSpecificPriceRuleControllerCore extends AdminController return parent::renderForm(); } - public function processSave($token) + public function processSave() { - $conditions = array(); - if (Validate::isLoadedObject(($object = parent::processSave($token)))) + if (Validate::isLoadedObject(($object = parent::processSave()))) { $object->deleteConditions(); foreach ($_POST as $key => $values) diff --git a/controllers/admin/AdminThemesController.php b/controllers/admin/AdminThemesController.php index 9697b4a20..d689d0640 100644 --- a/controllers/admin/AdminThemesController.php +++ b/controllers/admin/AdminThemesController.php @@ -299,7 +299,7 @@ class AdminThemesControllerCore extends AdminController return $res; } - public function processAdd($token) + public function processAdd() { $new_dir = Tools::getValue('directory'); $res = true; @@ -317,10 +317,10 @@ class AdminThemesControllerCore extends AdminController $base_theme = new Theme((int)Tools::getValue('based_on')); } - return parent::processAdd($token); + return parent::processAdd(); } - public function processDelete($token) + public function processDelete() { $obj = $this->loadObject(); if ($obj && $obj->isUsed()) @@ -329,7 +329,7 @@ class AdminThemesControllerCore extends AdminController return false; } - return parent::processDelete($token); + return parent::processDelete(); } public function initContent() diff --git a/controllers/admin/AdminWarehousesController.php b/controllers/admin/AdminWarehousesController.php index 9259072f8..68891070c 100644 --- a/controllers/admin/AdminWarehousesController.php +++ b/controllers/admin/AdminWarehousesController.php @@ -492,7 +492,7 @@ class AdminWarehousesControllerCore extends AdminController /** * @see AdminController::processAdd(); */ - public function processAdd($token) + public function processAdd() { if (Tools::isSubmit('submitAdd'.$this->table)) { @@ -553,14 +553,14 @@ class AdminWarehousesControllerCore extends AdminController // hack for enable the possibility to update a warehouse without recreate new id $this->deleted = false; - return parent::processAdd($token); + return parent::processAdd(); } } /** * @see AdminController::processDelete(); */ - public function processDelete($token) + public function processDelete() { if (Tools::isSubmit('delete'.$this->table)) { @@ -583,7 +583,7 @@ class AdminWarehousesControllerCore extends AdminController $obj->setShops(array()); $obj->resetProductsLocations(); - return parent::processDelete($token); + return parent::processDelete(); } } }