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); }
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); }
function getTag($tag) { global $application; $obj =& $application->getInstance('MessageResources', "payment-module-gc-messages", "AdminZone"); global $application; $value = null; switch ($tag) { // case $this->HTML_LOCAL_TAGS_PREFIX .'PaymentHTMLModuleDescription': // $value = $obj->getMessage('MODULE_PAYMENT_PAYPAL_PAYPAL_IPN_HTML_DESCRIPTION_CZ'); // break; case $this->HTML_LOCAL_TAGS_PREFIX . 'FormMethodIdFieldName': $value = "paymentModule[method_code]"; break; case $this->HTML_LOCAL_TAGS_PREFIX . 'PaymentMethodID': $ModuleInfo = modApiFunc($this->ModuleAPIClassName, "getInfo"); $value = $ModuleInfo['GlobalUniquePaymentModuleID']; break; case $this->HTML_LOCAL_TAGS_PREFIX . 'PaymentMethodName': $ModuleInfo = modApiFunc($this->ModuleAPIClassName, "getInfo"); $value = $ModuleInfo['Name']; break; default: break; } return $value; }
/** * @ describe the function ReinstallModuleAction->. */ function onAction() { global $application; $request = $application->getInstance('Request'); $this->extn_name = $request->getValueByKey('extn_name'); $extension_name = $this->extn_name; if ($this->extn_name != 'Modules_Manager') { $pathdir = $application->getAppIni('PATH_ADD_MODULES_DIR'); $this->extn_name = strtolower($this->extn_name); if (is_dir($pathdir . $this->extn_name) && $this->extn_name != "") { modApiFunc('Extension_Manager', 'updateExtensionStatus', $extension_name, true); modApiFunc("Modules_Manager", "initModules"); $moduleInfo = modApiFunc('Modules_Manager', 'getModuleInfoFromFile', '/avactis-extensions/' . $this->extn_name); $backup_created = modApiFunc('Extension_Manager', 'backup_extension', $moduleInfo); if ($backup_created) { modApiFunc('Modules_Manager', 'uninstallModule', $moduleInfo); modApiFunc("Session", "set", "UninstallMessage", 1); } else { modApiFunc('Extension_Manager', 'updateExtensionStatus', $extension_name, false); modApiFunc("Session", "set", "ErrorMessage", "ERR_EXTN_BACKUP_FAILED"); } } else { modApiFunc("Session", "set", "ErrorMessage", "ERR_UNINSTALL_FAILED"); } } }
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); }
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); }
/** * 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(); $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() { global $application; $SessionPost = $_POST; $SessionPost["ViewState"]["ShowResults"] = "true"; $request = $application->getInstance('Request'); $products = array(); $prod_prices = $request->getValueByKey("price"); $prod_qtys = $request->getValueByKey("qty"); $prod_shipping_costs = $request->getValueByKey("shipping_cost"); $prod_tax_classes = $request->getValueByKey("tax_class"); for ($i = 1; $i <= sizeof($prod_prices); $i++) { // _ _ . $price_including_taxes = modApiFunc("Localization", "FormatStrToFloat", $prod_prices[$i], "currency"); $price_excluding_taxes = modApiFunc("Catalog", "computePriceExcludingTaxes", $price_including_taxes, $prod_tax_classes[$i], true); //force to work in AZ $price_excluding_taxes = number_format($price_excluding_taxes, 2, '.', ','); $SessionPost["price"][$i] = $price_excluding_taxes; $products[] = array("CartItemSalePrice" => $price_excluding_taxes, "CartItemSalePriceExcludingTaxes" => $price_excluding_taxes, "Quantity_In_Cart" => $prod_qtys[$i], "ShippingPrice" => modApiFunc("Localization", "FormatStrToFloat", $prod_shipping_costs[$i], "currency"), "TaxClass" => $prod_tax_classes[$i]); } $country_id = modApiFunc('Configuration', 'getValue', SYSCONFIG_STORE_OWNER_COUNTRY); $state = modApiFunc('Configuration', 'getValue', SYSCONFIG_STORE_OWNER_STATE); // , , , ProductInfo, // . // - . // $price_including_taxes if (!is_numeric($country_id) || $country_id < 1 || !is_numeric($state) || $state < 1) { // : _fatal(array("CODE" => "CORE_057"), __CLASS__, __FUNCTION__); } modApiFunc('Taxes', 'setTaxDebug', $products, modApiFunc("Localization", "FormatStrToFloat", $request->getValueByKey("ShippingCost"), "currency"), $request->getValueByKey("ShippingMethod"), PRICE_N_A, array("Default" => array("CountryId" => $country_id, "StateId" => $state), "Shipping" => array("CountryId" => $request->getValueByKey("ShippingCountryId"), "StateId" => $request->getValueByKey("ShippingStateId")), "Billing" => array("CountryId" => $request->getValueByKey("BillingCountryId"), "StateId" => $request->getValueByKey("BillingStateId")))); modApiFunc('Session', 'set', 'SessionPost', $SessionPost); }
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 getPresentOrderTotalAndCurrency($order_id) { $currency_id = modApiFunc("Localization", "whichCurrencySendOrderToPaymentShippingGatewayIn", $order_id, $this->getUid()); $currency = modApiFunc("Localization", "getCurrencyCodeById", $currency_id); $order = modApiFunc('Checkout', 'getOrderInfo', $order_id, $currency_id); return array('total' => floatval($order['Total']), 'curr' => $currency, 'msg' => getMsg('CHCKT', 'PAYMENT_STATUS_SUSPICIOUS')); }
function out_MessagesList() { if (modApiFunc('Session', 'is_set', 'ResultMessage')) { $html_code = ''; $messages = modApiFunc('Session', 'get', 'ResultMessage'); modApiFunc('Session', 'un_set', 'ResultMessage'); if (!is_array($messages)) { $messages = array($messages); } foreach ($messages as $k => $message) { $this->current_message = $message; $html_code .= $this->templateFiller->fill('Message'); } return $html_code; } if (modApiFunc('Session', 'is_set', 'RegisterErrors')) { $html_code = ''; $errors = modApiFunc('Session', 'get', 'RegisterErrors'); modApiFunc('Session', 'un_set', 'RegisterErrors'); foreach ($errors as $k => $error) { $this->current_error_number = $k + 1; $this->current_error_message = $error; $html_code .= $this->templateFiller->fill('Error'); } return $html_code; } return ''; }
/** * * * @ * @param * @return */ function output() { global $application; $this->_Template_Contents = array('FieldName' => modApiFunc("Hint", "getFieldName"), 'FieldDescr' => modApiFunc("Hint", "getFieldDescription")); $application->registerAttributes($this->_Template_Contents); return modApiFunc('TmplFiller', 'fill', "hint/", "container.tpl.html", array()); }
function onAction() { global $application; $request = $application->getInstance('Request'); $pcid = $request->getValueByKey('PromoCodeID'); $categories_affected = $request->getValueByKey('cat_to_save'); $products_affected = $request->getValueByKey('prod_to_save'); $data['pcid'] = $pcid; if ($categories_affected) { $data['cats'] = implode('|', $categories_affected); } else { $data['cats'] = ''; } if ($products_affected) { $data['prods'] = implode('|', $products_affected); } else { $data['prods'] = ''; } if ($pcid) { $this->saveDataToDB($data); } $SessionPost = array('ViewState' => array('hasCloseScript' => false)); modApiFunc('Session', 'set', 'SessionPost', $SessionPost); $request->setView('EditPromoCodeArea'); $request->setKey('PromoCode_id', $pcid); $application->redirect($request); }
function SubscribeFormProfile() { $this->ini_section = 'SubscribeFormProfile'; $account = modApiFunc('Customer_Account', 'getCurrentSignedCustomer'); $this->emails = modApiFunc('Subscriptions', 'getCustomerSubscriptionEmails', $account); $this->SubscribeForm_Base(); }
function onAction() { global $application; $request = $application->getInstance('Request'); $gc_code = $request->getValueByKey('gc_code'); modApiFunc('GiftCertificateApi', 'removeCurrentGiftCertificate', $gc_code); }
function getTag($tag) { global $application; $value = null; switch ($tag) { case 'LatestCoreVersion': $value = modApiFunc('Extension_Manager', 'getLatestCoreVer'); break; case 'Local_ErrorMessage': $value = $this->getLocal_ErrorMessage(); break; case 'Local_CoreUpgradeAction': $value = 'index.php?asc_action=GetCoreUpgradeFile'; break; case 'Local_StoreStatus': $value = "javascript:openURLinNewWindow('store_settings_general.php', 'General Settings');"; break; /*case 'Local_StoreOnline': $value = 'index.php?asc_action=UpdateGeneralSettings&store_online=1'; break; case 'Local_SuccessMessage': $value = $this->getLocal_SuccessMessage(); break;*/ /*case 'Local_StoreOnline': $value = 'index.php?asc_action=UpdateGeneralSettings&store_online=1'; break; case 'Local_SuccessMessage': $value = $this->getLocal_SuccessMessage(); break;*/ default: $value = getKeyIgnoreCase($tag, $this->_Template_Contents); break; } return $value; }
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; } } }
/** * Constructor */ function CR_Select_Product() { // initializing the template filler $this->mTmplFiller = new TmplFiller(); // getting params from the request $this->_formname = modApiFunc('Request', 'getValueByKey', 'formname'); $this->_pidfield = modApiFunc('Request', 'getValueByKey', 'pidfield'); $this->_pnamefield = modApiFunc('Request', 'getValueByKey', 'pnamefield'); $this->_prefilledPID = modApiFunc('Request', 'getValueByKey', 'productid'); // if we need to run onproductselection method // in the parent window (yes/no) $this->_use_callback = modApiFunc('Request', 'getValueByKey', 'use_callback'); // validating the params if (!$this->_formname) { $this->_formname = 'SelectProductForm'; } if (!$this->_pidfield) { $this->_pidfield = 'product_id'; } if (!$this->_pnamefield) { $this->_pnamefield = 'product_name'; } if ($this->_use_callback != 'yes') { $this->_use_callback = 'no'; } }
function output() { if ($this->NoView) { return ''; } global $application; $args = func_get_args(); $this->_ManufacturerId = NULL; if (sizeof($args) > 0) { $this->_ManufacturerId = $args[0]; modApiFunc("tag_param_stack", "push", __CLASS__, array(array("key" => TAG_PARAM_MNF_ID, "value" => $this->_ManufacturerId))); } $this->templateFiller = new TemplateFiller(); $this->template = $application->getBlockTemplate('ManufacturerInfo'); $this->templateFiller->setTemplate($this->template); //mnf_id , $args[0] . , store block // 'Manufacturer' ProductInfo, mnf_id // . $mnf_id = __info_tag_output_find_tag_params('manufacturer'); $mnf_info = modApiFunc("Manufacturers", "getManufacturerInfo", $mnf_id); if ($mnf_id == PARAM_NOT_FOUND || $mnf_id == MANUFACTURER_NOT_DEFINED || $mnf_info === NULL) { $ret = $this->templateFiller->fill('ManufacturerNotDefined'); } else { $ret = $this->templateFiller->fill('Manufacturer'); } if (sizeof($args) > 0) { modApiFunc("tag_param_stack", "pop", __CLASS__); } return $ret; }
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); }
function getWarnings() { global $application; $this->MessageResources =& $application->getInstance('MessageResources'); /// $replacer = &$application->getInstance('Replacer'); $HTMLCode = ''; //Not to double the code, info on warnings // is in the table. $warnings_data = array(array("class" => "Catalog", "func" => "isImageFolderNotWritable", "warn_code" => "SETUP_WARNING_IMAGE_FOLDER_IS_NOT_WRITABLE", "replacer_params" => array("0" => modApiFunc("Catalog", "getImagesDir"))), array("class" => "Application", "func" => "isCacheFolderNotWritable", "warn_code" => "SETUP_WARNING_CACHE_FOLDER_IS_NOT_WRITABLE", "replacer_params" => array("0" => modApiFunc("Application", "getAppIni", 'PATH_CACHE_DIR'))), array("class" => "Application", "func" => "areInstallerFilesNotRemoved", "warn_code" => "SETUP_WARNING_INSTALLER_FILES_ARE_NOT_REMOVED", "replacer_params" => array()), array("class" => "Tools", "func" => "isBackupFolderNotWritable", "warn_code" => "SETUP_WARNING_BACKUP_FOLDER_IS_NOT_WRITABLE", "replacer_params" => array("0" => modApiFunc("Tools", "getBackupDir"))), array("class" => "Product_Files", "func" => "isDownloadsDirNotWritable", "warn_code" => "SETUP_WARNING_DOWNLOADS_FOLDER_IS_NOT_WRITABLE", "replacer_params" => array("0" => $application->getAppIni('PRODUCT_FILES_DIR'))), array("class" => "Product_Options", "func" => "isUploadsDirNotWritable", "warn_code" => "SETUP_WARNING_UPLOADS_FOLDER_IS_NOT_WRITABLE", "replacer_params" => array("0" => $application->getAppIni('UPLOAD_FILES_DIR')))); foreach ($warnings_data as $warning_data) { //: as for now, warnings can be generated either by the module, // or the application class. Other variants are prohibited. $check_res = $warning_data['class'] == "Application" ? call_user_func(array(&$application, $warning_data['func'])) : modApiFunc($warning_data['class'], $warning_data['func']); if ($check_res == true) { $text = $this->MessageResources->getMessage($warning_data['warn_code'], $warning_data['replacer_params']); //: fix the passing of optional parameters from the checked // function. For example, folder names are checked if they are writable. /// $text = $replacer->Replace($text, $warning_data['replacer_params']); $this->_warning = array("text" => $text); $template = "item.tpl.html"; $HTMLCode .= $this->mTmplFiller->fill("error/setup_warnings/", $template, array()); } } return $HTMLCode; }
function outputMoveObject() { global $application; $obj =& $application->getInstance('MessageResources'); $products_count = sizeof(modApiFunc('Catalog', 'getEditableProductsID')); return $obj->getMessage(new ActionMessage(array('MOVE_PRD_HEADER', $products_count))); }
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); }
function onAction() { global $application; $mm = $application->getInstance('Modules_Manager'); $lang = _ml_strtolower($application->getAppIni('LANGUAGE')); $_path = dirname(dirname(dirname(dirname(dirname(__FILE__))))) . '/avactis-themes/system/resources/messages.ini'; modApiFunc("Resources", "dropMessageGroupByMetaId", 'CZ'); modApiFunc("Resources", "dropMessageMetaByMetaId", 'CZ'); modApiFunc("Resources", "addResourceIniToDB", $_path, 'CZ', 'customer_messages', 'CZ'); modApiFunc("Resources", "dropMessageGroupByMetaId", 'SYS'); modApiFunc("Resources", "dropMessageMetaByMetaId", 'SYS'); modApiFunc("Resources", "addResourceIniToDB", $application->getAppIni('PATH_ADMIN_RESOURCES') . 'system-messages-' . $lang . '.ini', 'SYS', 'system_messages', 'AZ'); modApiFunc("Resources", "dropMessageGroupByMetaId", 'ML'); modApiFunc("Resources", "dropMessageMetaByMetaId", 'ML'); modApiFunc("Resources", "addResourceIniToDB", $application->getAppIni('PATH_ADMIN_RESOURCES') . 'multilang-messages-' . $lang . '.ini', 'ML', 'MultiLang', 'AZ'); modApiFunc("Resources", "dropMessageGroupByMetaId", 'CFG'); modApiFunc("Resources", "dropMessageMetaByMetaId", 'CFG'); modApiFunc("Resources", "addResourceIniToDB", $application->getAppIni('PATH_ADMIN_RESOURCES') . 'configuration-messages-' . $lang . '.ini', 'CFG', 'Configuration', 'AZ'); foreach ($mm->moduleList as $module_name => $moduleInfo) { if (isset($mm->modulesResFiles[$moduleInfo->shortName])) { modApiFunc("Resources", "dropMessageGroupByMetaId", $moduleInfo->shortName); modApiFunc("Resources", "dropMessageMetaByMetaId", $moduleInfo->shortName); modApiFunc("Resources", "addResourceIniToDB", $mm->modulesResFiles[$moduleInfo->shortName], $moduleInfo->shortName, $moduleInfo->name, 'AZ'); } } CCacheFactory::clearAll(); die('done'); }
/** * */ 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); }
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 onAction() { global $application; $request =& $application->getInstance('Request'); $page = $request->getValueByKey('page'); return modApiFunc('Layout_CMS', 'addNewPage', $page); }
function onAction() { global $application; $request =& $application->getInstance('Request'); $product_id = $request->getValueByKey('product_id'); $uploaded_image = $request->getValueByKey('uploaded_image'); $alt_text = preparehtmldisplay($request->getValueByKey('new_image_alt_text')); $res = array('error' => UPLOAD_ERR_OK); if ($uploaded_image != '') { $new_path = $uploaded_image; //modApiFunc('Product_Images', 'moveImageToImagesDir', $product_id, $uploaded_image); if ($new_path == null) { $res['error'] = UPLOAD_ERR_CANT_MOVE_FILE; $res['error_msg'] = modApiFunc('Shell', 'getMsgByErrorCode', $res['error']); } } else { $res = modApiFunc('Product_Images', 'moveUploadedFileToImagesDir', $product_id, 'new_product_image'); if ($res['error'] != UPLOAD_ERR_OK) { $res['error_msg'] = modApiFunc('Shell', 'getMsgByErrorCode', $res['error']); } else { $new_path = $res['full_path']; } } if ($res['error'] == UPLOAD_ERR_OK) { $thumb_path = modApiFunc('Product_Images', 'genThumbnail', $product_id, $new_path); modApiFunc('Product_Images', 'addImageToProduct', $product_id, $new_path, $alt_text, $thumb_path); } global $_RESULT; $_RESULT = $res; }
/** * */ function onAction() { global $application; loadCoreFile('licensekey.php'); loadCoreFile('licenseaccount.php'); // sending the registration request $lk = new LicenseKey(); $lac = new LicenseAccountClient(); $response = $lac->requestUpdateLicense(array("LicenseKey" => $lk->getLicenseKey(), "LicenseDomain" => $lk->getLicenseURL(), "LicenseType" => PRODUCT_VERSION_INTERNAL_TYPE)); $result_msg = "UNKNOWN_ERROR"; if ($response['CODE'] == 0 && !empty($response['CERT'])) { loadCoreFile('licensecert.php'); $lc = new LicenseCertificate(); if ($lc->_save_cert_to_file($response['CERT']) === false) { // error saving certificate $result_msg = "CERT_ERROR_CANNOT_SAVE"; } else { if ($lc->certificate_status === CERTIFICATE_OK) { // certificate saved successfully $result_msg = "UPDATE_SUCCESS"; } else { // invalid certificate received $result_msg = "CERT_ERROR_INVALID"; } } } else { if (!empty($response['CODE'])) { // error handling $result_msg = "RESPONSE_" . $response['CODE']; } } //$request = $application->getInstance('Request'); modApiFunc('Session', 'set', 'ResultMessage', $result_msg); $this->redirect(); }