function onAction()
 {
     global $application;
     $request = new Request();
     $key = $request->getValueByKey('key');
     $passwd = array('passwd' => $request->getValueByKey('new_password'), 're-type' => $request->getValueByKey('retype_password'));
     $account_name = modApiFunc('Customer_Account', 'getAccountByActivationKey', $key);
     $errors = array();
     if ($account_name != null) {
         $validator =& $application->getInstance('CAValidator');
         if (!$validator->isValid('passwd', $passwd)) {
             $errors[] = 'E_INVALID_PASSWD';
         }
     }
     if (!empty($errors)) {
         modApiFunc('Session', 'set', 'RegisterErrors', $errors);
         $request->setView('CustomerNewPassword');
         $request->setKey('key', $key);
     } else {
         modApiFunc('Session', 'set', 'ResultMessage', 'MSG_PASSWD_UPDATED');
         modApiFunc('Customer_Account', 'dropActivationKey', $account_name, 'customer_account');
         $obj =& $application->getInstance('CCustomerInfo', $account_name);
         $obj->setPersonInfo(array(array('Status', 'A', 'base')));
         $obj->changePassword($passwd['passwd']);
         $obj->SignIn();
         $request->setView('CustomerAccountHome');
     }
     $application->redirect($request);
 }
 function OrderList()
 {
     global $application;
     #check if fatal errors of the block tag exist
     $this->NoView = false;
     if ($application->issetBlockTagFatalErrors("OrderList")) {
         $this->NoView = true;
     }
     $settings = modApiFunc('Customer_Account', 'getSettings');
     if ($settings['CHECKOUT_TYPE'] == CHECKOUT_TYPE_QUICK) {
         $this->NoView = true;
     }
     loadCoreFile('html_form.php');
     $this->customer_obj = null;
     $this->incoming_filter = null;
     $email = modApiFunc('Customer_Account', 'getCurrentSignedCustomer');
     if ($email !== null) {
         $this->customer_obj =& $application->getInstance('CCustomerInfo', $email);
         $request = new Request();
         $filter = $request->getValueByKey('filter');
         if ($filter != null) {
             $orders_search_filter = null;
             if ($filter == 'id') {
                 $orders_search_filter = array('type' => 'id', 'order_status' => ORDER_STATUS_ALL, 'order_id' => intval($request->getValueByKey('order_id')));
             } elseif ($filter != 'custom' and defined('ORDER_STATUS_' . _ml_strtoupper($filter))) {
                 $orders_search_filter = array('type' => 'quick', 'order_status' => constant('ORDER_STATUS_' . _ml_strtoupper($filter)));
             } elseif ($filter == 'custom') {
                 $orders_search_filter = array('type' => 'custom', 'order_status' => $request->getValueByKey('order_status'), 'order_payment_status' => $request->getValueByKey('order_payment_status'), 'day_from' => $request->getValueByKey('day_from'), 'month_from' => $request->getValueByKey('month_from'), 'year_from' => $request->getValueByKey('year_from'), 'day_to' => $request->getValueByKey('day_to'), 'month_to' => $request->getValueByKey('month_to'), 'year_to' => $request->getValueByKey('year_to'));
             }
             $this->incoming_filter = $orders_search_filter;
             $this->customer_obj->setOrdersHistoryFilter($this->incoming_filter);
         }
     }
 }
 function ManageCustomFields()
 {
     global $application;
     loadCoreFile('html_form.php');
     $this->MessageResources =& $application->getInstance('MessageResources');
     $this->TemplateFiller = $application->getInstance('TmplFiller');
     $this->HtmlForm = new HtmlForm();
     $request = new Request();
     $this->mode = isset($_POST["mode"]) ? $_POST["mode"] : $request->getValueByKey("mode");
     $this->var_id = isset($_POST["variant_id"]) ? $_POST["variant_id"] : $request->getValueByKey("variant_id");
     $this->attr_id = isset($_POST["attribute_id"]) ? $_POST["attribute_id"] : $request->getValueByKey("attribute_id");
     $custom_fields_data = modApiFunc("Checkout", 'getPersonCustomAttributes', $this->var_id);
     if ($this->attr_id == null && $this->mode != "add") {
         if (count($custom_fields_data) != 0) {
             $this->attr_id = $custom_fields_data[0]['person_attribute_id'];
         }
     }
     if ($this->mode == null) {
         $this->mode = "edit";
     }
     if (count($custom_fields_data) == 0) {
         $this->mode = "add";
     }
     if ($this->attr_id != null) {
         $this->field_data = modAPIFunc("Checkout", "getPersonAttributeData", $this->var_id, $this->attr_id);
     }
     if (modApiFunc("Session", "is_set", "FormData")) {
         $this->field_data['postdata'] = modApiFunc("Session", "get", "FormData");
         modApiFunc("Session", "un_set", "FormData");
     }
     if (modApiFunc("Session", "is_set", "UpdateParent") && modApiFunc("Session", "get", "UpdateParent") == true) {
         modApiFunc("Session", "un_set", "UpdateParent");
         $application->UpdateParent();
     }
 }
 function onAction()
 {
     global $application;
     $request = new Request();
     $account_name = modApiFunc('Customer_Account', 'getCurrentSignedCustomer');
     $errors = array();
     if ($account_name != null) {
         $current_password = $request->getValueByKey('current_password');
         if (!modApiFunc('Customer_Account', 'isCorrectAccountAndPasswd', $account_name, $current_password)) {
             $errors[] = 'E_INVALID_CURRENT_PASSWD';
         } else {
             $validator =& $application->getInstance('CAValidator');
             $passwd = array('passwd' => $request->getValueByKey('new_password'), 're-type' => $request->getValueByKey('retype_password'));
             if (!$validator->isValid('passwd', $passwd)) {
                 $errors[] = 'E_INVALID_PASSWD';
             }
         }
         if (!empty($errors)) {
             modApiFunc('Session', 'set', 'RegisterErrors', $errors);
         } else {
             modApiFunc('Session', 'set', 'ResultMessage', 'MSG_PASSWD_UPDATED');
             $obj =& $application->getInstance('CCustomerInfo', $account_name);
             $obj->changePassword($passwd['passwd']);
         }
     }
     $request->setView('CustomerChangePassword');
     $application->redirect($request);
 }
 function onAction()
 {
     $r = new Request();
     $to_cc = $r->getValueByKey('to_currency_code');
     $from_cc = $r->getValueByKey('from_currency_code');
     $base = $r->getValueByKey('base_rate');
     $rate = trim($base);
     $errors = array();
     if (modApiFunc('Currency_Converter', 'doesManRateExists', $from_cc, $to_cc)) {
         $errors[] = 'E_MAN_RATE_EXISTS';
     }
     #
     # base rate validation. should be integer or decimal value
     #
     if ($this->validateDecimal($rate) != true) {
         $errors[] = 'E_MAN_INVALID_RATE';
     }
     if (empty($errors)) {
         if (!modApiFunc('Currency_Converter', 'addManualRate', $from_cc, $to_cc, $rate)) {
             $errors[] = 'E_MAN_RATE_NOT_ADDED';
         }
     }
     if (empty($errors)) {
         modApiFunc('Session', 'set', 'ResultMessage', 'MSG_MAN_RATE_ADDED');
     } else {
         modApiFunc('Session', 'set', 'Errors', $errors);
     }
     $r->setView('PopupWindow');
     $r->setKey('page_view', 'CurrencyRateEditor');
     global $application;
     $application->redirect($r);
 }
 function OrderSearchByIdForm()
 {
     global $application;
     #check if fatal errors of the block tag exist
     $this->NoView = false;
     if ($application->issetBlockTagFatalErrors("OrderSearchByIdForm")) {
         $this->NoView = true;
     }
     $settings = modApiFunc('Customer_Account', 'getSettings');
     if ($settings['CHECKOUT_TYPE'] == CHECKOUT_TYPE_QUICK) {
         $this->NoView = true;
     }
     loadCoreFile('html_form.php');
     $this->customer_obj = null;
     $this->incoming_filter = null;
     $email = modApiFunc('Customer_Account', 'getCurrentSignedCustomer');
     if ($email !== null) {
         $this->customer_obj =& $application->getInstance('CCustomerInfo', $email);
         $request = new Request();
         $filter = $request->getValueByKey('filter');
         if ($filter != null) {
             $orders_search_filter = null;
             if ($filter == 'id') {
                 $o_id = $request->getValueByKey('order_id');
                 if (!$o_id || !is_int($o_id)) {
                     return;
                 }
                 $orders_search_filter = array('type' => 'id', 'order_status' => ORDER_STATUS_ALL, 'order_id' => intval($o_id));
             }
             $this->incoming_filter = $orders_search_filter;
         }
     }
 }
 function onAction()
 {
     global $application;
     $request = new Request();
     $category_id = $request->getValueByKey('category_id');
     $tree_id = $request->getValueByKey('tree_id');
     $bs_ids = $request->getValueByKey('to_save');
     modApiFunc('Bestsellers_API', 'deleteAllBSLinksFromCategory', $category_id);
     $errors = array();
     if ($bs_ids != null) {
         if (!modApiFunc('Bestsellers_API', 'addBSLinksToCategory', $category_id, $bs_ids)) {
             $errors[] = 'E_BS_NOT_SAVED';
         }
     }
     if (empty($errors)) {
         $sets = $request->getValueByKey('sets');
         $sets['BS_FROM_STAT_PERIOD'] = $sets['BS_FROM_STAT_PERIOD']['count'] * $sets['BS_FROM_STAT_PERIOD']['type'];
         modApiFunc('Bestsellers_API', 'updateSettings', $category_id, $sets);
     }
     if (empty($errors)) {
         modApiFunc('Session', 'set', 'ResultMessage', 'MSG_BS_SAVED');
     } else {
         modApiFunc('Session', 'set', 'Errors', $errors);
     }
     $request->setView('PopupWindow');
     // $request->setView('BS_LinksList');
     $request->setKey('page_view', 'BS_LinksList');
     $request->setKey('category_id', $category_id);
     $request->setKey('tree_id', $tree_id);
     $application->redirect($request);
 }
 function onAction()
 {
     global $application;
     $request = new Request();
     $category_id = $request->getValueByKey('category_id');
     $tree_id = $request->getValueByKey('tree_id');
     $fp_ids = $request->getValueByKey('to_save');
     modApiFunc('Featured_Products', 'deleteAllFPLinksFromCategory', $category_id);
     $errors = array();
     if ($fp_ids != null) {
         if (!modApiFunc('Featured_Products', 'addFPLinksToCategory', $category_id, $fp_ids)) {
             $errors[] = 'E_FP_NOT_SAVED';
         }
     }
     if (empty($errors)) {
         modApiFunc('Session', 'set', 'ResultMessage', 'MSG_FP_SAVED');
     } else {
         modApiFunc('Session', 'set', 'Errors', $errors);
     }
     $request->setView('PopupWindow');
     $request->setKey('page_view', 'FP_LinksList');
     $request->setKey('category_id', $category_id);
     $request->setKey('tree_id', $tree_id);
     $application->redirect($request);
 }
 function OrderDownloadLinks()
 {
     global $application;
     #check if fatal errors of the block tag exist
     $this->NoView = false;
     if ($application->issetBlockTagFatalErrors("OrderDownloadLinks")) {
         $this->NoView = true;
     }
     $settings = modApiFunc('Customer_Account', 'getSettings');
     if ($settings['CHECKOUT_TYPE'] == CHECKOUT_TYPE_QUICK) {
         $this->NoView = true;
     }
     $this->customer_obj = null;
     $this->order_id = null;
     $email = modApiFunc('Customer_Account', 'getCurrentSignedCustomer');
     if ($email != null) {
         $this->customer_obj =& $application->getInstance('CCustomerInfo', $email);
         $request = new Request();
         $this->order_id = $request->getValueByKey('order_id');
         $this->order_product_id = $request->getValueByKey('order_product_id');
         $q_filter = array('type' => 'quick', 'order_status' => ORDER_STATUS_ALL);
         $this->customer_obj->setOrdersHistoryFilter($q_filter);
         if (!in_array($this->order_id, $this->customer_obj->getOrdersIDs())) {
             $this->order_id = null;
         }
         if ($this->order_id != null and $this->order_product_id != null) {
             $pids = modApiFunc('Checkout', 'getOrderProductsIDs', $this->order_id);
             if (!in_array($this->order_product_id, $pids)) {
                 $this->order_product_id = null;
             }
         }
     }
 }
 function OrderSearchForm()
 {
     global $application;
     #check if fatal errors of the block tag exist
     $this->NoView = false;
     if ($application->issetBlockTagFatalErrors("OrderSearchForm")) {
         $this->NoView = true;
     }
     $settings = modApiFunc('Customer_Account', 'getSettings');
     if ($settings['CHECKOUT_TYPE'] == CHECKOUT_TYPE_QUICK) {
         $this->NoView = true;
     }
     loadCoreFile('html_form.php');
     $this->customer_obj = null;
     $this->incoming_filter = null;
     $email = modApiFunc('Customer_Account', 'getCurrentSignedCustomer');
     if ($email !== null) {
         $this->customer_obj =& $application->getInstance('CCustomerInfo', $email);
         $request = new Request();
         $filter = $request->getValueByKey('filter');
         if ($filter != null) {
             $orders_search_filter = null;
             if ($filter == 'custom') {
                 $orders_search_filter = array('type' => 'custom', 'order_status' => $request->getValueByKey('order_status'), 'order_payment_status' => $request->getValueByKey('order_payment_status'), 'day_from' => $request->getValueByKey('day_from'), 'month_from' => $request->getValueByKey('month_from'), 'year_from' => $request->getValueByKey('year_from'), 'day_to' => $request->getValueByKey('day_to'), 'month_to' => $request->getValueByKey('month_to'), 'year_to' => $request->getValueByKey('year_to'));
             }
             $this->incoming_filter = $orders_search_filter;
         }
     }
 }
 function onAction()
 {
     global $application;
     $request = new Request();
     $group_name = $request->getValueByKey('GroupName');
     $sort_order = $request->getValueByKey('SortOrder_hidden');
     if ($group_name != null and $sort_order != null) {
         $sort_order = explode("|", $sort_order);
         modApiFunc('Customer_Account', 'updateGroupAttrsSortOrder', $group_name, $sort_order);
     }
     modApiFunc('Session', 'set', 'ResultMessage', 'MSG_SORT_ORDER_UPDATED');
     $request->setView(CURRENT_REQUEST_URL);
     $application->redirect($request);
 }
 function onAction()
 {
     $request = new Request();
     $tree_str = $request->getValueByKey('tree_str');
     $tree_id = $request->getValueByKey('tree_id');
     $ctg_id = $request->getValueByKey('ctg_id');
     modApiFunc('Catalog', 'saveFullCategoriesStructure', $tree_str);
     modApiFunc('CProductListFilter', 'changeCurrentCategoryId', $ctg_id);
     global $_RESULT;
     loadClass('CategoriesBrowserDynamic');
     $cb_obj = new CategoriesBrowserDynamic(CB_MODE_MANAGE, $tree_id);
     $_RESULT['tree_json'] = $cb_obj->outputJSON();
     $_RESULT['ctg_id'] = modApiFunc('Catalog', 'getEditableCategoryID');
     $_RESULT['tree_id'] = $tree_id;
 }
 function onAction()
 {
     global $application;
     $request = new Request();
     $customers_ids = $request->getValueByKey('customers_ids');
     if ($customers_ids != null) {
         $customers_ids = explode('|', $customers_ids);
     } else {
         $customers_ids = array();
     }
     $errors = array();
     for ($i = 0; $i < count($customers_ids); $i++) {
         $account_name = modApiFunc('Customer_Account', 'getCustomerAccountNameByCustomerID', $customers_ids[$i]);
         if ($account_name == null) {
             continue;
         }
         $customer_obj =& $application->getInstance('CCustomerInfo', $account_name);
         if ($customer_obj->getPersonInfo('Status') != 'N') {
             continue;
         }
         $customer_obj->setPersonInfo(array(array('Status', 'A', 'base')));
         modApiFunc('EventsManager', 'throwEvent', 'AdminActivateCustomer', $account_name);
         modApiFunc('Customer_Account', 'dropActivationKey', $account_name, 'customer_account');
     }
     if (empty($errors)) {
         modApiFunc('Session', 'set', 'ResultMessage', 'MSG_CUSTOMERS_ACTIVATED');
     } else {
         modApiFunc('Session', 'set', 'Errors', $errors);
     }
     $request->setView('Customers');
     $application->redirect($request);
 }
 function OrderInvoice()
 {
     global $application;
     #check if fatal errors of the block tag exist
     $this->NoView = false;
     if ($application->issetBlockTagFatalErrors("OrderInvoice")) {
         $this->NoView = true;
     }
     $settings = modApiFunc('Customer_Account', 'getSettings');
     if ($settings['CHECKOUT_TYPE'] == CHECKOUT_TYPE_QUICK) {
         $this->NoView = true;
     }
     $this->customer_obj = null;
     $this->order_id = null;
     $email = modApiFunc('Customer_Account', 'getCurrentSignedCustomer');
     if ($email != null) {
         $this->customer_obj =& $application->getInstance('CCustomerInfo', $email);
         $request = new Request();
         $this->order_id = $request->getValueByKey('order_id');
         $q_filter = array('type' => 'quick', 'order_status' => ORDER_STATUS_ALL);
         $this->customer_obj->setOrdersHistoryFilter($q_filter);
         if (!in_array($this->order_id, $this->customer_obj->getOrdersIDs())) {
             $this->order_id = null;
         }
     }
     $this->order_info_groups = array();
     $this->key_details = array('ID', 'Date', 'Status', 'PaymentStatus', 'PaymentMethod', 'PaymentProcessorOrderId', 'ShippingMethod', 'TrackId');
 }
 function onAction()
 {
     $request = new Request();
     $category_id = $request->getValueByKey('category_id');
     /*
      *       :
      *                                                     ,                     .
      *                                                         default
      *               AZ (                                 AZ).
      *
      *        :
      *                   Catalog::getProductListByGlobalFilter       ,
      *                                                                                      .
      *                                 default                     .
      */
     //              default
     loadClass('CProductListFilter');
     $f = new CProductListFilter();
     $params = $f->getProductListParamsObject();
     $params->category_id = $category_id;
     $params->select_mode_recursiveness = IN_CATEGORY_ONLY;
     //
     $products_array = modApiFunc('Catalog', 'getProductListByFilter', $params, RETURN_AS_ID_LIST);
     $products = array();
     if (!empty($products_array)) {
         foreach ($products_array as $pinfo) {
             $obj = new CProductInfo($pinfo['product_id']);
             $products[] = array('id' => $pinfo['product_id'], 'name' => $obj->getProductTagValue('Name'));
         }
     }
     global $_RESULT;
     $_RESULT['products'] = $products;
 }
 /**
  * Deletes tax rate by zip set.
  */
 function onAction()
 {
     global $application;
     $SessionPost = array();
     $SessionPost = $_POST;
     $Errors = array();
     $Result = array();
     $request = new Request();
     $request->setView("PopupWindow");
     $updateSid = $request->getValueByKey("updateSid", 0);
     if ($updateSid) {
         $request->setKey("updateSid", $updateSid);
     }
     $description = '';
     if (isset($_POST['file_description'])) {
         $description = prepareHTMLDisplay(trim($_POST['file_description']));
     }
     if ($description == '') {
         $SessionPost['Errors'][] = getMsg("TAX_ZIP", "ADD_NEW_SET_EMPTY_FILE_DESCRIPTION_ERROR");
         modApiFunc('Session', 'set', 'SessionPost', $SessionPost);
         $request->setKey("page_view", "TaxRateByZip_AddNewSet");
         $application->redirect($request);
         return;
     }
     modApiFunc('Session', 'set', 'SessionPost', $SessionPost);
     $sid = modApiFunc("TaxRateByZip", "addSetToDB", $description, $_POST["csv_file_name"]);
     $request->setKey("page_view", "TaxRatesImportView");
     $request->setKey("sid", $sid);
     $application->redirect($request);
 }
 function onAction()
 {
     global $application;
     $request = new Request();
     $customers_ids = $request->getValueByKey('customers_ids');
     if ($customers_ids != null) {
         $customers_ids = explode('|', $customers_ids);
     } else {
         $customers_ids = array();
     }
     $errors = array();
     for ($i = 0; $i < count($customers_ids); $i++) {
         $account_name = modApiFunc('Customer_Account', 'getCustomerAccountNameByCustomerID', $customers_ids[$i]);
         if ($account_name == null) {
             continue;
         }
         if (modApiFunc('Customer_Account', 'getAccountStatus', $account_name) == 'B') {
             continue;
         }
         if (!modApiFunc('Customer_Account', 'dropCustomerPassword', $account_name, 'customer_account')) {
             $errors[] = 'E_PASSWORDS_NOT_DROPED';
             break;
         } else {
             modApiFunc('EventsManager', 'throwEvent', 'AdminDropCustomerPassword', $account_name);
         }
     }
     if (empty($errors)) {
         modApiFunc('Session', 'set', 'ResultMessage', 'MSG_PASSWORDS_DROPED');
     } else {
         modApiFunc('Session', 'set', 'Errors', $errors);
     }
     $request->setView('Customers');
     $application->redirect($request);
 }
 /**
  *
  */
 function onAction()
 {
     global $application;
     $request = new Request();
     $letter_id = $request->getValueByKey('letter_id');
     unset($_POST['letter_id']);
     unset($_POST['asc_action']);
     modApiFunc('Newsletter', 'deleteMessages', array($letter_id));
 }
 function CustomerAccountInfo()
 {
     global $application;
     $request = new Request();
     $customer_id = $request->getValueByKey('customer_id');
     $account_name = modApiFunc('Customer_Account', 'getCustomerAccountNameByCustomerID', $customer_id);
     $this->customer_obj =& $application->getInstance('CCustomerInfo', $account_name);
     $this->customer_obj->setPersonInfoAttrsType(PERSON_INFO_GROUP_ATTR_VISIBLE);
     $this->mTmplFiller =& $application->getInstance('TmplFiller');
 }
 function onAction()
 {
     global $application;
     $request = new Request();
     $email = $request->getValueByKey('email');
     $passwd = $request->getValueByKey('passwd');
     $remember_me = $request->getValueByKey('remember_me');
     $r = new Request();
     $r->setView(CURRENT_REQUEST_URL);
     if (!modApiFunc('Customer_Account', 'isCorrectAccountAndPasswd', $email, $passwd)) {
         modApiFunc('Session', 'set', 'RegisterErrors', array('E_INVALID_SIGN_IN_INFO'));
     } else {
         $customer_obj =& $application->getInstance('CCustomerInfo', $email);
         if ($customer_obj->getPersonInfo('Status') != 'A') {
             modApiFunc('Session', 'set', 'RegisterErrors', array('E_ACCOUNT_NOT_ACTIVATED'));
         } else {
             $customer_obj->SignIn();
             if (modApiFunc('Session', 'is_set', 'toCheckoutAfterSignIn')) {
                 modApiFunc('Session', 'un_set', 'toCheckoutAfterSignIn');
                 $r->setView('CheckoutView');
             } elseif (modApiFunc('Session', 'is_set', 'toURLAfterSignIn')) {
                 $target_url = modApiFunc('Session', 'get', 'toURLAfterSignIn');
                 if ($target_url != '') {
                     $r = new Request($target_url);
                 }
                 modApiFunc('Session', 'un_set', 'toURLAfterSignIn');
             }
             if (!empty($customer_obj->affiliate_id)) {
                 modApiFunc('Session', 'set', 'AffiliateID', $customer_obj->affiliate_id);
             }
             if (modApiFunc('Settings', 'getParamValue', 'CUSTOMER_ACCOUNT_SETTINGS', 'ENABLE_SAVE_SESSION') === 'YES') {
                 $t = time() + 3600 * 24;
                 $value = $remember_me == "save" ? $remember_me : "shared";
                 setcookie('save_session', $value, $t, '/');
             } else {
                 setcookie('save_session', '', 0, '/');
             }
         }
     }
     $application->redirect($r);
 }
 function onAction()
 {
     global $application;
     $request = new Request();
     $product_id = $request->getValueByKey('product_id');
     $rp_ids = $request->getValueByKey('to_save');
     modApiFunc('Related_Products', 'deleteAllRPLinksFromProduct', $product_id);
     $errors = array();
     if ($rp_ids != null) {
         if (!modApiFunc('Related_Products', 'addRPLinksToProduct', $product_id, $rp_ids)) {
             $errors[] = 'E_RP_NOT_SAVED';
         }
     }
     if (empty($errors)) {
         modApiFunc('Session', 'set', 'ResultMessage', 'MSG_RP_SAVED');
     } else {
         modApiFunc('Session', 'set', 'Errors', $errors);
     }
     $request->setView('related_products');
     $request->setKey('product_id', $product_id);
     $application->redirect($request);
 }
 function onAction()
 {
     global $application;
     $request = new Request();
     $customers_ids = $request->getValueByKey('customers_ids');
     $customers_groups = $request->getValueByKey('customers_groups');
     if ($customers_ids != null) {
         $customers_ids = explode('|', $customers_ids);
     } else {
         $customers_ids = array();
     }
     if ($customers_groups != null) {
         $customers_groups = explode('|', $customers_groups);
         $arr = array();
         foreach ($customers_groups as $cg) {
             $kv = explode('>>=', $cg);
             $arr[$kv[0]] = $kv[1];
         }
         $customers_groups = $arr;
     } else {
         $customers_groups = array();
     }
     $errors = array();
     for ($i = 0; $i < count($customers_ids); $i++) {
         $account_name = modApiFunc('Customer_Account', 'getCustomerAccountNameByCustomerID', $customers_ids[$i]);
         if ($account_name == null) {
             continue;
         }
         modApiFunc('Customer_Account', 'updateCustomerAccountGroup', $account_name, $customers_groups[$customers_ids[$i]]);
     }
     if (empty($errors)) {
         modApiFunc('Session', 'set', 'ResultMessage', 'MSG_CUSTOMERS_UPDATED');
     } else {
         modApiFunc('Session', 'set', 'Errors', $errors);
     }
     $request->setView('Customers');
     $application->redirect($request);
 }
 function onAction()
 {
     global $application;
     $request = new Request();
     $errors = array();
     modApiFunc('Customer_Account', 'addCustomerGroup', $request->getValueByKey('new_customer_group'));
     if (empty($errors)) {
         modApiFunc('Session', 'set', 'ResultMessage', 'MSG_CUSTOMER_GROUP_ADDED');
     } else {
         modApiFunc('Session', 'set', 'Errors', $errors);
     }
     $request->setView('CustomerGroups');
     $application->redirect($request);
 }
 function onAction()
 {
     global $application;
     $request = new Request();
     $customers_ids = $request->getValueByKey('customers_ids');
     if ($customers_ids != null) {
         $customers_ids = explode('|', $customers_ids);
     }
     if (modApiFunc('Customer_Account', 'deleteCustomers', $customers_ids)) {
         modApiFunc('Session', 'set', 'ResultMessage', 'MSG_CUSTOMERS_DELETED');
     } else {
         modApiFunc('Session', 'set', 'Errors', array('E_CUSTOEMRS_NOT_DELETED'));
     }
     $request->setView('Customers');
     $application->redirect($request);
 }
 function CustomerNewPasswordForm()
 {
     $this->NoView = false;
     $this->customer_obj = null;
     $request = new Request();
     $this->key = $request->getValueByKey('key');
     $account_name = modApiFunc('Customer_Account', 'getAccountByActivationKey', $this->key);
     if ($account_name != null) {
         global $application;
         $this->customer_obj =& $application->getInstance('CCustomerInfo', $account_name);
     }
     $settings = modApiFunc('Customer_Account', 'getSettings');
     if ($settings['CHECKOUT_TYPE'] == CHECKOUT_TYPE_QUICK) {
         $this->NoView = true;
     }
 }
 function onAction()
 {
     $r = new Request();
     $rates_ids = $r->getValueByKey('rates_ids');
     if ($rates_ids !== null) {
         $rates_ids = explode('|', $rates_ids);
     }
     if (modApiFunc('Currency_Converter', 'delManualRates', $rates_ids)) {
         modApiFunc('Session', 'set', 'ResultMessage', 'MSG_MAN_RATES_DELETED');
     } else {
         modApiFunc('Session', 'set', 'Errors', array('E_MAN_RATES_NOT_DELETED'));
     }
     $r->setView('PopupWindow');
     $r->setKey('page_view', 'CurrencyRateEditor');
     global $application;
     $application->redirect($r);
 }
 function onAction()
 {
     if (modApiFunc('Users', 'getZone') != "AdminZone") {
         die;
     }
     $r = new Request();
     $file_path = base64_decode($r->getValueByKey('fp'));
     if (file_exists($file_path) and is_readable($file_path)) {
         header("Pragma: no-cache");
         header("Expires: " . gmdate("D, d M Y H:i:s", time()) . " GMT");
         header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
         header("Content-Type: application/octet-stream");
         header("Content-Length: " . filesize($file_path));
         header("Content-Disposition: attachment; filename=\"" . basename($file_path) . "\"");
         readfile($file_path);
         die;
     }
 }
 function onAction()
 {
     global $application;
     $request = new Request();
     $find = $request->getValueByKey('find');
     if (preg_match('/^[0-9]*(\\.[0-9]+)?$/', $find)) {
         //--------- Get Modified File list------------------
         modApiFunc('SecureStore', 'ModifiedFileList', $find);
         //--------- Get Newly Added File list------------------
         modApiFunc('SecureStore', 'NewlyAddedFileList', $find);
         modApiFunc('Session', 'set', 'MailSendResultMessage', "");
     } else {
         modApiFunc('Session', 'set', 'ModifiedFileResult', "");
         modApiFunc('Session', 'set', 'NewlyAddedFileResult', "");
     }
     //--------- Return To View Page------------------
     $req_to_redirect = new Request();
     $req_to_redirect->setView(CURRENT_REQUEST_URL);
     $req_to_redirect->setKey('identifier', 'FindUpdatedFile');
     $application->redirect($req_to_redirect);
 }
 function onAction()
 {
     global $application;
     $request = new Request();
     $customer_gids = $request->getValueByKey('customer_group_ids');
     if ($customer_gids != null) {
         $customer_gids = explode('|', $customer_gids);
     } else {
         $customer_gids = array();
     }
     $errors = array();
     for ($i = 0; $i < count($customer_gids); $i++) {
         modApiFunc('Customer_Account', 'deleteCustomerGroup', $customer_gids[$i]);
     }
     if (empty($errors)) {
         modApiFunc('Session', 'set', 'ResultMessage', 'MSG_CUSTOMER_GROUPS_DELETED');
     } else {
         modApiFunc('Session', 'set', 'Errors', $errors);
     }
     $request->setView('CustomerGroups');
     $application->redirect($request);
 }
 function output()
 {
     global $application;
     $request = new Request();
     $request->setView(CURRENT_REQUEST_URL);
     $request->setKey("page_view", "TaxRateByZip_AddNewSet");
     $request->setAction('TaxRatesRedirectToImportAction');
     $formAction = $request->getURL();
     $title = getMsg('TAX_ZIP', 'ADD_NEW_SET_PAGE_TITLE');
     $descr_value = '';
     $updateSid = $request->getValueByKey("updateSid", 0);
     if ($updateSid) {
         $set_to_update = modApiFunc("TaxRateByZip", "getSet", $updateSid);
         if (isset($set_to_update[0]["name"])) {
             $descr_value = $set_to_update[0]["name"];
             $title = getMsg('TAX_ZIP', 'UPDATE_SET_PAGE_TITLE');
             $title = str_replace("%1%", $descr_value, $title);
             $request->setKey("updateSid", $updateSid);
             $formAction = $request->getURL();
         }
     }
     $ptypes_select = array('select_name' => 'TargetPType', 'id' => 'TargetPType', 'selected_value' => '0', 'values' => array());
     $ptypes = modApiFunc('Catalog', 'getProductTypes');
     foreach ($ptypes as $ptype) {
         $ptypes_select['values'][] = array('value' => $ptype['id'], 'contents' => $ptype['name']);
     }
     $cats_select = array('select_name' => 'TargetCategory', 'id' => 'TargetCategory', 'selected_value' => 1, 'values' => array());
     $cats = modApiFunc("Catalog", "getSubcategoriesFullListWithParent", 1, false);
     foreach ($cats as $cat) {
         $cats_select['values'][] = array('value' => $cat['id'], 'contents' => str_repeat('&nbsp;&nbsp;', $cat['level']) . $cat['name']);
     }
     $template_contents = array("FormAction" => $formAction, "DescriptionValue" => $descr_value, "Title" => $title, "Errors" => $this->outputResultMessage(), 'PTypesList' => HtmlForm::genDropdownSingleChoice($ptypes_select, ' style="width: 290px;"'), 'CategoriesList' => HtmlForm::genDropdownSingleChoice($cats_select, ' style="width: 290px;"'));
     $this->_Template_Contents = $template_contents;
     $application->registerAttributes($this->_Template_Contents);
     return $this->mTmplFiller->fill("", "container.tpl.html", array());
 }