コード例 #1
1
 function onAction()
 {
     global $application;
     if (modApiFunc('Session', 'is_Set', 'SessionPost')) {
         _fatal(array("CODE" => "CORE_050"), __CLASS__, __FUNCTION__);
     }
     $SessionPost = $_POST;
     $SessionPost["ViewState"]["ErrorsArray"] = array();
     $fsr_id = $SessionPost["FsRule_id"] = intval($SessionPost["FsRule_id"]);
     $SessionPost["FsRuleName"] = trim($SessionPost["FsRuleName"]);
     $SessionPost["FsRuleMinSubtotal"] = floatval($SessionPost["FsRuleMinSubtotal"]);
     $SessionPost["FsRuleStrictCart"] = intval($SessionPost["StrictCart"]);
     if ($SessionPost["FsRuleName"] == "") {
         $SessionPost["ViewState"]["ErrorsArray"][] = "ERROR_EMPTY_RULE_NAME";
     }
     $is_unique = modApiFunc("Shipping_Cost_Calculator", "checkIfFsRuleIsUnique", $SessionPost["FsRuleName"], $fsr_id);
     if (!$is_unique) {
         $SessionPost["ViewState"]["ErrorsArray"][] = "ERROR_NOT_UNIQUE_RULE_NAME";
     }
     if ($SessionPost["FormSubmitValue"] == "Save") {
         if (count($SessionPost["ViewState"]["ErrorsArray"]) == 0) {
             unset($SessionPost["ViewState"]["ErrorsArray"]);
             $this->saveSettings($SessionPost);
             $SessionPost["ViewState"]["hasCloseScript"] = "true";
         }
     }
     modApiFunc('Session', 'set', 'SessionPost', $SessionPost);
     $request = new Request();
     $request->setView(CURRENT_REQUEST_URL);
     $request->setKey('FsRule_id', $fsr_id);
     $application->redirect($request);
 }
コード例 #2
1
 function outputMoveHref()
 {
     $request = new Request();
     $request->setView('MoveProducts');
     $request->setAction('MoveToProducts');
     return $request->getURL();
 }
コード例 #3
0
 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);
 }
コード例 #4
0
 function onAction()
 {
     global $application;
     $attrs = $_POST;
     foreach ($attrs as $i => $v) {
         if (is_array($v)) {
             if (!array_key_exists('visible', $v)) {
                 $attrs[$i]['visible'] = 0;
             }
             if (!array_key_exists('required', $v)) {
                 $attrs[$i]['required'] = 0;
             }
             if ($attrs[$i]['visible'] == 0) {
                 $attrs[$i]['required'] = 0;
             }
             if ($attrs[$i]['required'] == 1) {
                 $attrs[$i]['visible'] = 1;
             }
         }
     }
     $this->saveSettings($attrs);
     $request = new Request();
     $request->setView('CheckoutInfoList');
     $application->redirect($request);
 }
コード例 #5
0
 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);
 }
コード例 #6
0
 /**
  * Redirect after action
  */
 function redirect()
 {
     global $application;
     $request = new Request();
     $request->setView('PromoCodesNavigationBar');
     $application->redirect($request);
 }
コード例 #7
0
 function onHook()
 {
     global $zone;
     if ($zone == 'CustomerZone') {
         global $application;
         $sections = $application->getSectionByCurrentPagename();
         $settings = modApiFunc('Customer_Account', 'getSettings');
         if ($settings['CHECKOUT_TYPE'] == CHECKOUT_TYPE_ACCOUNT_REQUIRED) {
             $this->redirect_scheme_not_signed['CustomerSignIn'][] = 'Checkout';
         }
         $use_scheme = modApiFunc('Customer_Account', 'getCurrentSignedCustomer') == null ? $this->redirect_scheme_not_signed : $this->redirect_scheme_signed;
         foreach ($use_scheme as $to_view => $from_views) {
             if (array_diff($from_views, $sections) != $from_views) {
                 $request = new Request();
                 $request->setView($to_view);
                 $application->redirect($request);
                 if (in_array('Checkout', $sections)) {
                     modApiFunc('Session', 'set', 'toCheckoutAfterSignIn', true);
                     modApiFunc('Session', 'set', 'ResultMessage', 'MSG_NEED_REGISTER');
                 }
                 break;
             }
         }
     }
 }
コード例 #8
0
 function onAction()
 {
     global $application;
     $request = $application->getInstance('Request');
     $SessionPost = array();
     /*
     if(modApiFunc('Session', 'is_Set', 'SessionPost'))
     {
         _fatal(array( "CODE" => "CORE_050"), __CLASS__, __FUNCTION__);
     }
     */
     $SessionPost = $_POST;
     $nErrors = 0;
     $key = $request->getValueByKey('action_key');
     // @ check key
     $topics = $request->getValueByKey('topics');
     $selected_topics = explode(',', $topics);
     if (!is_array($selected_topics) || empty($selected_topics)) {
         // @ INTERNAL
         $SessionPost['ViewState']['ErrorsArray'][] = 'INTERNAL';
         $nErrors++;
     }
     modApiFunc('Subscriptions', 'copyTempEmails', $key);
     modApiFunc('Subscriptions', 'linkTempEmails', $key);
     modApiFunc('Subscriptions', 'subscribeTempEmails', $key, $selected_topics);
     modApiFunc('Subscriptions', 'cleanTempEmails', $key);
     execQuery('SUBSCR_LINK_CUSTOMER_EMAILS', null);
     execQuery('SUBSCR_LINK_ORDERS_EMAILS', null);
     modApiFunc('Session', 'set', 'SessionPost', $SessionPost);
     $request = new Request();
     $request->setView('Subscriptions_Manage');
     //        $request->setKey('stage', 'finish');
     $application->redirect($request);
 }
コード例 #9
0
 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 onAction()
 {
     global $application;
     $request = $application->getInstance('Request');
     $cc_id = $request->getValueByKey("cc_id");
     $attrs = $request->getValueByKey("attrs");
     $post_visible = $request->getValueByKey("visible");
     $post_required = $request->getValueByKey("required");
     $SessionPost = $_POST;
     $visible = array();
     $required = array();
     foreach ($attrs as $id) {
         if (isset($post_visible[$id]) && $post_visible[$id] == 'on') {
             $visible[$id] = 1;
         } else {
             $visible[$id] = 0;
         }
         if (isset($post_required[$id]) && $post_required[$id] == 'on') {
             $required[$id] = 1;
         } else {
             $required[$id] = 0;
         }
     }
     $params = array('type' => $cc_id, 'visible' => $visible, 'required' => $required);
     modApiFunc('Configuration', 'clearAttributesForCardType', $cc_id);
     modApiFunc('Configuration', 'addAttributesForCardType', $params);
     //        modApiFunc('Session', 'set', 'ResultMessage', $messages);
     $request = new Request();
     $request->setView(CURRENT_REQUEST_URL);
     $request->setKey('cc_id', $cc_id);
     $application->redirect($request);
 }
コード例 #11
0
 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);
 }
コード例 #12
0
 function onAction()
 {
     global $application;
     $result = array();
     $SessionPost = $_POST;
     $subaction = 'calculate';
     if (isset($_POST['subaction'])) {
         $subaction = $_POST['subaction'];
     }
     switch ($subaction) {
         case 'calculate':
             $result["DstCountry"] = trim(intval($SessionPost["DstCountry"]));
             $result["DstState_menu_select"] = trim(intval($SessionPost["DstState_menu_select"]));
             $result["DstZip"] = trim($SessionPost["DstZip"]);
             modApiFunc('Session', 'set', 'ShippingCalculatorPost', $result);
             break;
         case 'remember':
             $choice = isset($_POST["ShippingCalculatorChoice"]) ? preg_replace('/[^A-Z0-9-_]/', '', trim($_POST["ShippingCalculatorChoice"])) : null;
             if ($choice != null) {
                 modApiFunc('Session', 'set', 'ShippingCalculatorChoice', $choice);
             }
             break;
     }
     $request = new Request();
     $request->setView(CURRENT_REQUEST_URL);
     $application->redirect($request);
 }
コード例 #13
0
 function onAction()
 {
     $errors = array();
     $topics = modApiFunc('Request', 'getValueByKey', 'topic');
     if ($topics && is_array($topics)) {
         $this->key = modApiFunc('Request', 'getValueByKey', 'key_unsubscribe');
         $this->rec = modApiFunc('Newsletter', 'getUnsubscribeRecord', $this->key);
         if ($this->rec) {
             $email = modApiFunc('Subscriptions', 'getEmailById', $this->rec['email_id']);
             if ($email) {
                 modApiFunc('Subscriptions', 'unsubscribeEmails', $topics, $email);
             } else {
                 $errors[] = getMsg('SUBSCR', 'ERROR_UNSUBSCRIBE_GENERAL');
             }
         } else {
             $errors[] = getMsg('SUBSCR', 'ERROR_UNSUBSCRIBE_GENERAL');
         }
     } else {
         $errors[] = getMsg('SUBSCR', 'ERROR_UNSUBSCRIBE_NO_TOPICS');
     }
     $SessionPost['ViewState']['ErrorsArray'] = $errors;
     $SessionPost['ViewState']['Stage'] = 'finish';
     modApiFunc('Session', 'set', 'SessionPost', $SessionPost);
     global $application;
     $request = new Request();
     $request->setView(CURRENT_REQUEST_URL);
     $application->redirect($request);
 }
コード例 #14
0
 function onAction()
 {
     global $application;
     $request =& $application->getInstance('Request');
     $product_id = $request->getValueByKey('product_id');
     $file_descr = $request->getValueByKey('new_file_descr');
     if ($file_descr == null) {
         $file_descr = '';
     }
     $file_path = $request->getValueByKey('new_file_name_hidden');
     if (preg_match("/^__shell_upload_\\d+\$/", basename(dirname($file_path)))) {
         $result = modApiFunc('Product_Files', 'moveFileToPFDir', $product_id, $file_path);
         $is_uploaded = true;
         modApiFunc('Shell', 'removeDirectory', dirname($file_path));
     } else {
         $result = array('error' => UPLOAD_ERR_OK, 'full_path' => $file_path, 'base_name' => basename($file_path), 'file_size' => filesize($file_path));
         $is_uploaded = false;
     }
     if ($result['error'] == UPLOAD_ERR_OK) {
         modApiFunc('Product_Files', 'addFileToProduct', $product_id, $result['base_name'], $result['full_path'], $file_descr, $is_uploaded);
         modApiFunc('Session', 'set', 'ResultMessage', 'MSG_FILE_ADDED');
     } else {
         modApiFunc('Session', 'set', 'Errors', array($result['error']));
     }
     $r = new Request();
     $r->setView('PF_FilesList');
     $r->setKey('product_id', $product_id);
     $application->redirect($r);
 }
コード例 #15
0
 /**
  * Processes tags in the templates for the given view.
  *
  * @return string tag value, if tag has been processed. NULL, otherwise.
  */
 function getTag($tag)
 {
     global $application;
     $value = null;
     switch ($tag) {
         case 'Local_SearchFormAction':
             $_request = new Request();
             $_request->setView('SearchResult');
             $value = $_request->getURL();
             break;
         case 'Local_SearchFormName':
             $value = 'CatalogSearchForm';
             break;
         case 'Local_ActionName':
             $value = 'asc_action';
             break;
         case 'Local_ActionValue':
             $value = 'SearchProducts';
             break;
         case 'Local_SearchTextFieldName':
             $value = 'search_pattern';
             break;
         case 'Local_SearchText':
             if (modApiFunc('Session', 'is_Set', 'search_result_id')) {
                 $search_id = modApiFunc('Session', 'get', 'search_result_id');
                 $value = modApiFunc('CatalogSearch', 'getSearchPatternInSearchResult', $search_id);
                 $value = prepareHTMLDisplay($value);
             } else {
                 $value = '';
             }
             break;
     }
     return $value;
 }
コード例 #16
0
 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);
 }
コード例 #17
0
 function onAction()
 {
     global $application;
     $request = $application->getInstance('Request');
     $SessionPost = array();
     if (modApiFunc('Session', 'is_Set', 'SessionPost')) {
         _fatal(array("CODE" => "CORE_050"), __CLASS__, __FUNCTION__);
     }
     $SessionPost = $_POST;
     $nErrors = 0;
     $topic_id = $request->getValueByKey('topic');
     $topic_name = $request->getValueByKey('topic_name');
     $topic_status = $request->getValueByKey('topic_status');
     $topic_access = $request->getValueByKey('topic_access');
     $topic_auto = $request->getValueByKey('topic_auto');
     if ($topic_id == '') {
         $SessionPost['ViewState']['ErrorsArray'][] = 'ALERT_EDIT_INTERNAL_ERROR';
         $SessionPost['ViewState']['hasCloseScript'] = 'false';
     } elseif ($topic_name == '') {
         $SessionPost['ViewState']['ErrorsArray'][] = 'ALERT_FILL_TOPIC_NAME';
         $SessionPost['ViewState']['ErrorFields'][] = 'topic_name';
         $SessionPost['ViewState']['hasCloseScript'] = 'false';
     } else {
         modApiStaticFunc('Subscriptions', 'updateTopic', $topic_id, $topic_name, $topic_status, $topic_access, $topic_auto);
     }
     modApiFunc('Session', 'set', 'SessionPost', $SessionPost);
     $request = new Request();
     $request->setView(CURRENT_REQUEST_URL);
     $application->redirect($request);
 }
コード例 #18
0
 function onAction()
 {
     global $application;
     $request =& $application->getInstance('Request');
     $mode = $request->getValueByKey('mode');
     switch ($mode) {
         case 'update':
             $data = $request->getValueByKey('data');
             if (is_array($data)) {
                 foreach ($data as $cr_id => $record_data) {
                     modApiFunc('Customer_Reviews', 'updateCustomerReview', $cr_id, $record_data);
                 }
             }
             modApiFunc('Session', 'set', 'ResultMessage', 'CR_MSG_CUSTOMER_REVIEWS_UPDATED');
             break;
         case 'delete':
             $review_id = $request->getValueByKey('review_id');
             if (is_array($review_id)) {
                 foreach ($review_id as $cr_id) {
                     modApiFunc('Customer_Reviews', 'deleteCustomerReview', $cr_id);
                 }
             }
             modApiFunc('Session', 'set', 'ResultMessage', 'CR_MSG_CUSTOMER_REVIEWS_DELETED');
             break;
     }
     // trying to restore GET data
     $cr_url = modApiFunc('Session', 'get', 'CR_URL');
     $req_to_redirect = new Request($cr_url);
     if ($cr_url == '') {
         $req_to_redirect->setView(CURRENT_REQUEST_URL);
     }
     $application->redirect($req_to_redirect);
 }
コード例 #19
0
 /**
  *
  */
 function onAction()
 {
     global $application;
     $request = $application->getInstance('Request');
     $SessionPost = array();
     if (modApiFunc('Session', 'is_Set', 'SessionPost')) {
         _fatal(array("CODE" => "CORE_050"), __CLASS__, __FUNCTION__);
     }
     $SessionPost = $_POST;
     switch ($SessionPost["ViewState"]["FormSubmitValue"]) {
         case "save":
             $SessionPost["ViewState"]["ErrorsArray"] = array();
             if (empty($SessionPost["ModuleName"]) == true || trim($SessionPost["ModuleName"]) == '') {
                 $SessionPost["ViewState"]["ErrorsArray"][] = "MODULE_ERROR_NO_NAME";
             }
             $nErrors = sizeof($SessionPost["ViewState"]["ErrorsArray"]);
             if ($nErrors == 0) {
                 unset($SessionPost["ViewState"]["ErrorsArray"]);
                 $this->saveDataToDB($SessionPost);
                 $SessionPost["ViewState"]["hasCloseScript"] = "true";
             }
             break;
         default:
             _fatal(array("CODE" => "CORE_051"), __CLASS__, __FUNCTION__, $request->getValueByKey('FormSubmitValue'));
             break;
     }
     modApiFunc('Session', 'set', 'SessionPost', $SessionPost);
     // get view name by action name.
     $request = new Request();
     $request->setView(CURRENT_REQUEST_URL);
     $application->redirect($request);
 }
コード例 #20
0
 function onAction()
 {
     global $application;
     $oid = $_POST["option_id"];
     unset($_POST["option_id"]);
     $data = array("value_name" => $_POST["NewValue"]["Name"], "is_default" => isset($_POST["NewValue"]["IsDefault"]) ? 'Y' : 'N');
     foreach ($_POST["NewValue"] as $key => $value) {
         if (preg_match("/_modifier\$/", $key)) {
             $data[$key] = floatval(str_replace(",", ".", trim($value)));
         }
     }
     $check_result = modApiFunc("Product_Options", "checkDataFor", "addValueToOption", $data);
     if (!empty($check_result)) {
         modApiFunc("Session", "set", "Errors", $check_result);
         modApiFunc("Session", "set", "SessionPost", $_POST);
         $request = new Request();
         $request->setKey("option_id", $oid);
         $request->setView('PO_EditOption');
         $application->redirect($request);
     } else {
         $data["option_id"] = $oid;
         $add_result = modApiFunc("Product_Options", "addValueToOption", $data);
         if ($add_result == false) {
             modApiFunc("Session", "set", "SessionPost", $_POST);
             modApiFunc("Session", "set", "ResultMessage", "MSG_VALUE_NOT_ADDED");
         } else {
             modApiFunc("Session", "un_set", "SessionPost");
             modApiFunc("Session", "set", "ResultMessage", "MSG_VALUE_ADDED");
         }
         $request = new Request();
         $request->setView('PO_EditOption');
         $request->setKey("option_id", $oid);
         $application->redirect($request);
     }
 }
コード例 #21
0
 /**
  * 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);
 }
コード例 #22
0
 function getTag($tag)
 {
     $value = null;
     switch ($tag) {
         case 'Local_SetCurrencyLink':
             $r = new Request();
             $r->setView(CURRENT_REQUEST_URL);
             $r->setAction('SetDisplayCurrency');
             $r->setKey('currency_id', '%currency_id_value%');
             $value = $r->getURL();
             break;
         case 'Local_CurrencyName':
             $value = $this->_Currency['name'];
             break;
         case 'Local_CurrencySelected':
             $b = $this->_Currency['id'] == modApiFunc("Localization", "getSessionDisplayCurrency");
             $value = $b ? 'selected="selected"' : "";
             break;
         case 'Local_CurrencyId':
             $value = $this->_Currency['id'];
             break;
         case 'Local_Items':
             $value = $this->outputItems();
             break;
         case 'Local_CurrentCurrency':
             $value = modApiFunc("Localization", "getCurrencyCodeById", modApiFunc("Localization", "getSessionDisplayCurrency"));
             break;
         case 'Local_CurrencyCode':
             $value = $this->_Currency['code'];
             break;
     }
     return $value;
 }
コード例 #23
0
 /**
  * MailInfo constructor
  */
 function MailInfo()
 {
     global $application;
     $MR =& $application->getInstance('MessageResources');
     //initialize form data with null values when adding a new notification
     $this->currentNotificationId = modApiFunc("Notifications", "getCurrentNotificationId");
     if ($this->currentNotificationId == 'Add') {
         $this->notificationInfo = array('Id' => '', 'Name' => '', 'Subject' => '', 'Body' => '', 'JavascriptBody' => '', 'From_addr' => '', 'Email_Code' => '', 'Active' => 'checked', 'Action_id' => 1);
         $request = new Request();
         $request->setView('NotificationInfo');
         $request->setAction('AddNotification');
         $formAction = $request->getURL();
         $this->properties = array('SubmitButton' => $MR->getMessage('BTN_ADD'), 'FormAction' => $formAction);
     } else {
         //initialize form data with database values when editing the notification
         $this->notificationInfo = modApiFunc("Notifications", "getNotificationInfo", $this->currentNotificationId);
         if (sizeof($this->notificationInfo) == 1) {
             $this->notificationInfo = $this->notificationInfo[0];
             $this->notificationInfo['JavascriptBody'] = addcslashes(addslashes($this->notificationInfo['Body']), "..");
             $this->notificationInfo['Body'] = prepareHTMLDisplay($this->notificationInfo['Body']);
         } else {
             $this->currentNotificationId = 'Add';
             $this->notificationInfo = array('Id' => '', 'Name' => '', 'Subject' => '', 'Body' => '', 'JavascriptBody' => '', 'From_addr' => '', 'Email_Code' => '', 'Active' => 'checked', 'Action_id' => 1);
         }
         $request = new Request();
         $request->setView('NotificationInfo');
         $request->setAction('SaveNotification');
         $formAction = $request->getURL();
         $this->properties = array('SubmitButton' => $MR->getMessage('BTN_SAVE'), 'FormAction' => $formAction);
     }
     $this->actionsList = modApiFunc("Notifications", "getActionsList");
     $this->InfoTags = modApiFunc("Notifications", "getAvailableTagsList", $this->actionsList);
 }
コード例 #24
0
 function onAction()
 {
     global $application;
     $data = array("parent_entity" => $_POST["parent_entity"], "entity_id" => intval($_POST["entity_id"]), "option_id" => intval($_POST["option_id"]));
     $check_result = modApiFunc("Product_Options", "checkDataFor", "delOptionFromEntity", $data);
     if (!empty($check_result)) {
         modApiFunc("Session", "set", "Errors", $check_result);
         $request = new Request();
         $request->setKey("parent_entity", $data["parent_entity"]);
         $request->setKey("entity_id", $data["entity_id"]);
         $request->setView('PO_OptionsList');
         $application->redirect($request);
     } else {
         $del_result = modApiFunc("Product_Options", "delOptionFromEntity", $data);
         if ($del_result == true) {
             modApiFunc("Session", "set", "ResultMessage", "MSG_OPTION_DELETED");
         } else {
             modApiFunc("Session", "set", "ResultMessage", "MSG_OPTION_NOT_DELETED");
         }
         $request = new Request();
         $request->setView('PO_OptionsList');
         $request->setKey('parent_entity', $data["parent_entity"]);
         $request->setKey('entity_id', $data["entity_id"]);
         $application->redirect($request);
     }
 }
コード例 #25
0
 /**
  * Redirects after action.
  */
 function redirect()
 {
     global $application;
     $request = new Request();
     $request->setView(CURRENT_REQUEST_URL);
     $application->redirect($request);
 }
コード例 #26
0
 function onAction()
 {
     loadClass('GiftCertificateCreator');
     $cr = new GiftCertificateCreator();
     //                                    ,                .             ,
     //         $map                 $_POST          .
     //                              ,                     .
     $cr->initByMap($_POST);
     //                     .
     $cr->save();
     if ($cr->isError()) {
         modApiFunc('Session', 'set', 'gc_update_action_result', 'failed');
         modApiFunc('Session', 'set', 'gc_update_action_errors', $cr->errors);
         modApiFunc('Session', 'set', 'SessionPost', $_POST);
     } else {
         modApiFunc('Session', 'set', 'gc_update_action_result', 'created');
         if ($cr->sendtype === GC_SENDTYPE_EMAIL && $cr->status === GC_STATUS_ACTIVE) {
             modApiFunc('EventsManager', 'throwEvent', 'GiftCertificateCreated', $cr);
         }
         $request = new Request();
         $request->setView('GiftCertificateEditView');
         $request->setKey('gc_code', $cr->code);
         global $application;
         $application->redirect($request);
     }
 }
コード例 #27
0
 function onAction()
 {
     global $application;
     $request =& $application->getInstance('Request');
     $layout_path = $request->getValueByKey('layout_path');
     $mr_act = $request->getValueByKey('mr_act');
     if ($mr_act == 'on') {
         $hta_content = modApiFunc('Mod_Rewrite', 'genRewriteBlock', $layout_path);
         $res = modApiFunc('Mod_Rewrite', 'saveHTAcontent', $hta_content, $layout_path);
         if (empty($res)) {
             modApiFunc('Session', 'set', 'ResultMessage', 'MSG_MR_ENABLED');
             modApiFunc('Mod_Rewrite', 'enableMRforLayout', $layout_path);
         } else {
             modApiFunc('Session', 'set', 'Errors', $res);
         }
     }
     if ($mr_act == 'off') {
         modApiFunc('Mod_Rewrite', 'disableMRforLayout', $layout_path);
         modApiFunc('Session', 'set', 'ResultMessage', 'MSG_MR_DISABLED');
     }
     $r = new Request();
     $r->setView(CURRENT_REQUEST_URL);
     $r->setKey('page_view', 'MR_Settings');
     $application->redirect($r);
 }
コード例 #28
0
 function onAction()
 {
     global $application;
     $request =& $application->getInstance('Request');
     $sets = $request->getValueByKey('sets');
     $errors = array();
     $sets['CATS_PREFIX'] = preg_replace("/[^a-z0-9_\\-]/i", "", $sets['CATS_PREFIX']);
     $sets['PRODS_PREFIX'] = preg_replace("/[^a-z0-9_\\-]/i", "", $sets['PRODS_PREFIX']);
     $sets['CMS_PREFIX'] = preg_replace("/[^a-z0-9_\\-]/i", "", $sets['CMS_PREFIX']);
     if ($sets['CATS_PREFIX'] == "") {
         $errors[] = 'ERR_INVALID_CATS_PREFIX';
     }
     if ($sets['PRODS_PREFIX'] == "") {
         $errors[] = 'ERR_INVALID_PRODS_PREFIX';
     }
     if ($sets['CMS_PREFIX'] == "") {
         $errors[] = 'ERR_INVALID_CMS_PREFIX';
     }
     if (empty($errors) and ($sets['CATS_PREFIX'] == $sets['PRODS_PREFIX'] or $sets['CMS_PREFIX'] == $sets['PRODS_PREFIX'] or $sets['CATS_PREFIX'] == $sets['CMS_PREFIX'])) {
         $errors[] = 'ERR_PREFIXES_ARE_SAME';
     }
     if (empty($errors)) {
         modApiFunc('Mod_Rewrite', 'updateSettings', $sets);
         modApiFunc('Session', 'set', 'ResultMessage', 'MSG_SETTINGS_UPDATED');
     } else {
         modApiFunc('Session', 'set', 'MR_sets', $sets);
         modApiFunc('Session', 'set', 'Errors', $errors);
     }
     $r = new Request();
     $r->setView(CURRENT_REQUEST_URL);
     // $r->setKey('page_view','MR_Settings');
     $application->redirect($r);
 }
コード例 #29
0
 /**
  *
  */
 function output()
 {
     global $application;
     ob_start();
     phpinfo(1);
     $content = ob_get_contents();
     ob_end_clean();
     $flag = true;
     while ($flag) {
         $pos = _ml_strpos($content, "\n");
         $line = _ml_substr($content, 0, $pos);
         $content = _ml_substr($content, $pos + 1);
         if (_ml_strpos($line, "System")) {
             $line = _ml_substr($line, 0, _ml_strrpos($line, "<"));
             $line = _ml_substr($line, 0, _ml_strrpos($line, "<"));
             $line = _ml_substr($line, _ml_strrpos($line, ">") + 1);
             $flag = false;
         }
     }
     $OS = $line;
     $request = new Request();
     $request->setView('PHPInfo');
     $link = $request->getURL();
     global $db_link;
     $template_contents = array("ProductVersion" => PRODUCT_VERSION_NUMBER, "ProductVersionType" => PRODUCT_VERSION_TYPE, "ProductReleaseDate" => PRODUCT_VERSION_DATE, "CoreVersion" => CORE_VERSION, "ModulesList" => $this->outputModules(), "phpVersion" => PHP_VERSION, "MySQLVersion" => mysqli_get_server_info($db_link), "ServerOS" => $OS, "WebServerVersion" => $_SERVER["SERVER_SOFTWARE"], "PHPInfoLink" => $link);
     $this->_Template_Contents = $template_contents;
     $application->registerAttributes($this->_Template_Contents);
     return modApiFunc('TmplFiller', 'fill', "tools/server_info/", "container.tpl.html", array());
 }
コード例 #30
0
 function output()
 {
     global $application;
     loadCoreFile('html_form.php');
     $this->_messageResources =& Subscriptions::getMessageResources();
     $this->_tmplFiller = new TmplFiller(dirname(dirname(__FILE__)) . '/templates_az/');
     $this->_topic_id = modApiFunc('Request', 'getValueByKey', 'topic');
     if (!empty($this->_topic_id)) {
         $this->_mode = SM_EDIT_TOPIC;
     } else {
         $this->_mode = SM_NEW_TOPIC;
     }
     $this->initFormData();
     if (@$this->ViewState['hasCloseScript'] == 'true') {
         modApiFunc("application", "closeChild_UpdateParent");
         return;
     }
     $this->_templateContents = array('ErrorsBox', 'AscAction');
     $application->registerAttributes($this->_templateContents);
     if ($this->_mode == SM_EDIT_TOPIC && empty($this->_topic)) {
         return $this->_tmplFiller->fill('', 'errors/no_topic_edit.tpl.html', array('Message' => $this->_messageResources->getMessage(new ActionMessage(array('TOPIC_DOESNT_EXISTS', $this->_topic_id)))));
     }
     $request = new Request();
     $request->setView(CURRENT_REQUEST_URL);
     $vars = array('FormAction' => $request->getURL(), 'AscAction' => $this->_mode == SM_NEW_TOPIC ? 'create_topic' : 'update_topic', 'TopicId' => $this->_topic_id, 'WinTitle' => $this->_messageResources->getMessage($this->_mode == SM_NEW_TOPIC ? 'TITLE_ADD_TOPIC' : 'TITLE_EDIT_TOPIC'), 'TopicName' => @$this->POST['topic_name'], 'TopicStatusSelect' => $this->getTopicStatusSelect('topic_status', @$this->POST['topic_status']), 'TopicAccessSelect' => $this->getTopicAccessSelect('topic_access', @$this->POST['topic_access']), 'TopicAutosubscribeSelect' => $this->getTopicAutoSubscribeSelect('topic_auto', @$this->POST['topic_auto']));
     $result = $this->_tmplFiller->fill('', 'edit_topic.tpl.html', $vars);
     return $result;
 }