/**
  * Installs the specified module in the system.
  *
  * The install() method is called statically.
  * To call other methods of this class from this method,
  * the static call is used, for example,
  * Payment_Module_Paypal_CC::getTables() instead of $this->getTables().
  */
 function install()
 {
     global $application;
     $obj =& $application->getInstance('MessageResources', "payment-module-cod-messages", "AdminZone");
     $tables = Payment_Module_Cod::getTables();
     $query = new DB_Table_Create($tables);
     $table = 'pm_cod_settings';
     //
     $columns = $tables[$table]['columns'];
     //
     $query = new DB_Insert($table);
     $query->addInsertValue(1, $columns['id']);
     $query->addInsertValue("MODULE_NAME", $columns['key']);
     $query->addInsertValue('s:' . _ml_strlen($obj->getMessage('MODULE_NAME')) . ':"' . $obj->getMessage('MODULE_NAME') . '";', $columns['value']);
     $application->db->getDB_Result($query);
     $query = new DB_Insert($table);
     $query->addInsertValue(2, $columns['id']);
     $query->addInsertValue("PER_ORDER_SHIPPING_FEE", $columns['key']);
     $query->addInsertValue('s:' . _ml_strlen("0.00") . ':"' . "0.00" . '";', $columns['value']);
     $application->db->getDB_Result($query);
     /*
             $query = new DB_Insert($table);
             $query->addInsertValue(2, $columns['id']);
             $query->addInsertValue("MODULE_DESCR", $columns['key']);
             $query->addInsertValue('s:'._ml_strlen($obj->getMessage('MODULE_DESCR')).':"'.$obj->getMessage('MODULE_DESCR').'";', $columns['value']);
             $application->db->getDB_Result($query);
     */
 }
 /**
  * Installs the specified module in the system.
  *
  * The install() method is called statically.
  * To call other methods of this class from this method,
  * the static call is used, for example,
  * Payment_Module_Paypal_CC::getTables() instead of $this->getTables().
  */
 function install()
 {
     global $application;
     $obj =& $application->getInstance('MessageResources', "payment-module-wtp-messages", "AdminZone");
     $tables = Payment_Module_Wtp_CC::getTables();
     $query = new DB_Table_Create($tables);
     $table = 'pm_wtp_settings';
     $columns = $tables[$table]['columns'];
     $query = new DB_Insert($table);
     $query->addInsertValue(1, $columns['id']);
     $query->addInsertValue("MODULE_NAME", $columns['key']);
     $query->addInsertValue('s:' . _ml_strlen($obj->getMessage('MODULE_NAME')) . ':"' . $obj->getMessage('MODULE_NAME') . '";', $columns['value']);
     $application->db->getDB_Result($query);
     $query = new DB_Insert($table);
     $query->addInsertValue(2, $columns['id']);
     $query->addInsertValue("MODULE_METHOD_ID", $columns['key']);
     $query->addInsertValue('s:' . _ml_strlen("0") . ':"' . "0" . '";', $columns['value']);
     $application->db->getDB_Result($query);
     $query = new DB_Insert($table);
     $query->addInsertValue(3, $columns['id']);
     $query->addInsertValue("MODULE_METHOD_PASS", $columns['key']);
     $query->addInsertValue('s:' . _ml_strlen("0") . ':"' . "0" . '";', $columns['value']);
     $application->db->getDB_Result($query);
     $query = new DB_Insert($table);
     $query->addInsertValue(4, $columns['id']);
     $query->addInsertValue("MODULE_MODE", $columns['key']);
     $query->addInsertValue('s:' . _ml_strlen("0") . ':"' . "0" . '";', $columns['value']);
     $application->db->getDB_Result($query);
 }
 /** Processes action. */
 function onAction()
 {
     global $application;
     $request = $application->getInstance('Request');
     $search_string = trim($request->getValueByKey('search_string'));
     $search_type = trim($request->getValueByKey('search_type'));
     $Result = [];
     $search_result = $search_string;
     if (_ml_strlen($search_string) < 1) {
         modApiFunc('Session', 'un_Set', 'search_result_menu');
         $search_result = '';
         return $search_result;
     } else {
         $Result = '';
         if ($search_type == "systemPages") {
             $SystemPages = modApiFunc('CMS', 'getSystemPageList');
             $i = 0;
             foreach ($SystemPages as $key => $value) {
                 $occurerence = stripos($value, $search_string);
                 if ($occurerence === false) {
                     continue;
                 } else {
                     $Result[$i] = $value;
                     $i++;
                 }
             }
         }
         //systemPages
         if ($search_type == "staticArticle") {
             $Static_Pages = modApiFunc('CMS', 'getPageTree', 0);
             foreach ($Static_Pages as $key => $value) {
                 $occurerence = stripos($value['name'], $search_string);
                 if ($occurerence === false) {
                     continue;
                 } else {
                     $Result[$value['page_id']] = $value['name'];
                 }
             }
         }
         //static article
         if ($search_type == "categoryList") {
             $catalog_tree = modApiFunc("Catalog", "getSubcategoriesFullListWithParent", 1);
             foreach ($catalog_tree as $key => $cat) {
                 $occurerence = stripos($cat['name'], $search_string);
                 if ($occurerence === false) {
                     continue;
                 } else {
                     $Result[$cat['id']] = $cat['name'];
                 }
             }
         }
         // category list
         return json_encode($Result);
     }
 }
 static function cut_uuid_suffix($text, $style)
 {
     //                . CCInfo             .
     // :                  getValidatedDataStructure            PersonInfoVariantID,         .
     $uuid_pattern = UUIDUtils::getRegexpPattern($style);
     $matches = array();
     if (preg_match($uuid_pattern, $text, $matches)) {
         $text = _ml_substr($text, 0, _ml_strlen($text) - UUIDUtils::getLength($style));
     } else {
     }
     return $text;
 }
 /**
  * Installs the specified module in the system.
  *
  * The install() method is called statically.
  * To call other methods of this class from this method,
  * the static call is used, for example,
  * Payment_Module_AllInactive::getTables() instead of $this->getTables().
  */
 function install()
 {
     global $application;
     $obj =& $application->getInstance('MessageResources', "payment-module-all-inactive-messages", "AdminZone");
     $tables = Payment_Module_All_Inactive::getTables();
     $query = new DB_Table_Create($tables);
     $table = 'pm_all_inactive_settings';
     #
     $columns = $tables[$table]['columns'];
     #
     $query = new DB_Insert($table);
     $query->addInsertValue(1, $columns['id']);
     $query->addInsertValue("MODULE_NAME", $columns['key']);
     $query->addInsertValue('s:' . _ml_strlen($obj->getMessage('MODULE_NAME')) . ':"' . $obj->getMessage('MODULE_NAME') . '";', $columns['value']);
     $application->db->getDB_Result($query);
 }
 /**
  * general function
  * gets an unformatted zip
  * ----------------------- !!! CURRENTLY !!!
  * formats it as a US-postal code, 5 or 5+4 digits length
  * ----------------------- !!! CURRENTLY !!!
  * gets a tax rate from DB and zip set
  * returns it as a percent tax rate
  * or returns 0 if zip is illegal or rate not found
  *
  * @param char[] $zip
  * @return float
  */
 function getTaxRateByZip($sid, $zip)
 {
     $zip = preg_replace("/[^0-9]/", '', $zip);
     $len = _ml_strlen($zip);
     if ($len != 5 && $len != 9) {
         return 0.0;
     }
     if ($len == 5) {
         $zip5 = intval($zip);
         return $this->getTaxRateByZip5($sid, $zip5);
     } else {
         $zip5 = intval(_ml_substr($zip, 0, 5));
         $zip4 = intval(_ml_substr($zip, 5, 4));
         $rlt = $this->getTaxRateByZip9($sid, $zip5, $zip4);
         if ($rlt !== FALSE) {
             return $rlt;
         }
         return $this->getTaxRateByZip5($sid, $zip5);
     }
 }
 /**
  * Processes action.
  */
 function onAction()
 {
     global $application;
     $request = $application->getInstance('Request');
     $search_pattern = trim($request->getValueByKey('search_pattern'));
     if (_ml_strlen($search_pattern) == 0) {
         modApiFunc('Session', 'un_Set', 'search_result_id');
     } else {
         $search_id = modApiFunc('CatalogSearch', 'prepareProductsSearch', $search_pattern);
         modApiFunc('CatalogSearch', 'deleteOldSearches');
         modApiFunc('Session', 'set', 'search_result_id', $search_id);
     }
     $request = new Request();
     $request->setView(CURRENT_REQUEST_URL);
     $request->encodeURLs = false;
     if (!empty($search_pattern)) {
         $request->setKey('keyword', $search_pattern);
     }
     $application->redirect($request);
 }
 /**
  * Outputs the parent page select box
  */
 function outputParentSelectBox()
 {
     $result = '<option value="0"' . ($this->_Page_Data['parent_id'] == 0 ? ' selected="selected"' : '') . '>' . getMsg('CMS', 'CMS_ROOT') . '</option>' . "\n";
     $page_tree = modApiFunc('CMS', 'getPageTree');
     $subtree = false;
     $level = '';
     foreach ($page_tree as $v) {
         if ($v['page_id'] == $this->_Page_Data['page_id']) {
             $subtree = true;
             $level = $v['level'];
         }
         if (_ml_strlen($v['level']) <= _ml_strlen($level) && $v['page_id'] != $this->_Page_Data['page_id']) {
             $level = '';
             $subtree = false;
         }
         if ($v['page_id'] != $this->_Page_Data['page_id'] && !$subtree) {
             $result .= '<option value="' . $v['page_id'] . '"' . ($this->_Page_Data['parent_id'] == $v['page_id'] ? ' selected="selected"' : '') . '>' . str_replace(' ', '&nbsp;', $v['level']) . $v['name'] . '</option>' . "\n";
         }
     }
     return $result;
 }
 /**
  * Validates the user input. It checks "New Product Type Description".
  */
 function isValidTypeDescr($data)
 {
     $retval = is_string($data) && _ml_strlen(trim($data)) > 0 && _ml_strlen(trim($data)) < 513;
     return $retval;
 }
 /**
  * Prepares data to output of possible mailing list.
  *
  * @return string - HTML code
  */
 function outputSendSourceList($dirrection)
 {
     $retval = "";
     $list = modApiFunc("Notifications", "getSendSourceList", $dirrection);
     $email_code_strlen = _ml_strlen($this->notificationInfo['Email_Code']);
     if ($this->notificationInfo['Email_Code'] == "EMAIL_ADMINISTRATOR") {
         $selected_key = "EMAIL_ADMINISTRATOR=" . $this->notificationInfo['Admin_ID'];
     }
     foreach ($list as $key => $address) {
         if ($dirrection == 'to') {
             if (!in_array($key, $this->usedSendToEmails)) {
                 $retval .= "<option value='" . $key . "' >" . $address . "</option>";
             }
         } else {
             if ($this->currentNotificationId == 'Add') {
                 $retval .= "<option value='" . $key . "' >" . $address . "</option>";
             } else {
                 //"Edit" notification.
                 if ($this->notificationInfo['Email_Code'] == "EMAIL_ADMINISTRATOR") {
                     if ($key == $selected_key) {
                         $retval .= "<option selected value='" . $key . "' >" . $address . "</option>";
                     } else {
                         $retval .= "<option value='" . $key . "' >" . $address . "</option>";
                     }
                 } else {
                     if ($this->notificationInfo['Email_Code'] != "EMAIL_CUSTOM") {
                         if (_ml_substr($key, 0, $email_code_strlen) == $this->notificationInfo['Email_Code']) {
                             $retval .= "<option selected value='" . $key . "' >" . $address . "</option>";
                         } else {
                             $retval .= "<option value='" . $key . "' >" . $address . "</option>";
                         }
                     } else {
                         $retval .= "<option value='" . $key . "' >" . $address . "</option>";
                     }
                 }
             }
         }
     }
     return $retval;
 }
Example #11
0
 function isFileFromDirectoryOrSubdirectories($dir_path, $file_path)
 {
     $d = realpath($dir_path);
     $f = realpath($file_path);
     return _ml_substr($f, 0, _ml_strlen($d)) == $d;
 }
 /**
  * @ describe the function ProductList->getTag.
  */
 function getTag($tag)
 {
     global $application;
     $value = null;
     $CatID = modApiFunc('CProductListFilter', 'getCurrentCategoryId');
     switch ($tag) {
         case 'CurrentCategoryPath':
             $value = str_replace("/", "&nbsp;&gt;&gt;&nbsp;", $this->_cats_paths[modApiFunc('CProductListFilter', 'getCurrentCategoryId')]);
             break;
         case 'Local_CategoriesBrowser_GoTo':
             $cb_obj = new CategoriesBrowser();
             $this->cb_params['category_path_prefix'] = getMsg('CTL', 'PRFX_TARGET_CATEGORY');
             $this->cb_params['buttons'] = array('go' => array('label' => 'BTN_GO', 'callback' => 'OnGoButtonClick(%CID%);', 'default_state' => 'disabled', 'enable_condition' => 'category_selected'), 'cancel' => array('label' => 'BTN_CANCEL', 'callback' => 'hideBlock(\'categories_browser_goto\');', 'default_state' => 'enabled'));
             $value = $cb_obj->output($this->cb_params);
             break;
         case 'Local_CategoriesBrowser_MoveTo':
             $cb_obj = new CategoriesBrowser();
             $this->cb_params['category_path_prefix'] = getMsg('CTL', 'PRFX_TARGET_CATEGORY');
             $this->cb_params['buttons'] = array('move' => array('label' => 'BTN_MOVE_PRD', 'callback' => 'OnMoveButtonClick(%CID%);', 'default_state' => 'disabled', 'enable_condition' => 'category_selected'), 'cancel' => array('label' => 'BTN_CANCEL', 'callback' => 'hideBlock(\'categories_browser_moveto\');', 'default_state' => 'enabled'));
             $value = $cb_obj->output($this->cb_params);
             break;
         case 'Local_CategoriesBrowser_CopyTo':
             $cb_obj = new CategoriesBrowser();
             $this->cb_params['category_path_prefix'] = getMsg('CTL', 'PRFX_TARGET_CATEGORY');
             $this->cb_params['buttons'] = array('move' => array('label' => 'BTN_COPY_PRD', 'callback' => 'OnCopyButtonClick(%CID%);', 'default_state' => 'disabled', 'enable_condition' => 'category_selected'), 'cancel' => array('label' => 'BTN_CANCEL', 'callback' => 'hideBlock(\'categories_browser_copyto\');', 'default_state' => 'enabled'));
             $value = $cb_obj->output($this->cb_params);
             break;
         case 'ProductListSubcategories':
             $value = $this->getSubcategoriesList();
             break;
         case 'Breadcrumb':
             $value = modApiFunc("Breadcrumb", "output", true, "ProductList");
             break;
         case 'Items':
             $value = $this->getProductList();
             break;
         case 'CategoryName':
             $categoryInfo = new CCategoryInfo($CatID);
             $value = $categoryInfo->getCategoryTagValue('name');
             break;
         case 'PaginatorLine':
             $obj =& $application->getInstance($tag);
             $value = $obj->output($this->paginator_name, "ProductList");
             break;
             # override the PaginatorRows tag behavior
         # override the PaginatorRows tag behavior
         case 'PaginatorRows':
             $obj =& $application->getInstance($tag);
             $value = $obj->output($this->paginator_name, 'ProductList');
             break;
         case 'Add_Product_Link':
             $request = new Request();
             //                $request->setView  ( 'SelectProductType' );
             $request->setView('Catalog_AddProduct');
             $request->setKey('category_id', $CatID);
             $value = $request->getURL();
             break;
         case 'Move_Products_Link':
             $request = new Request();
             $request->setView('MoveProducts');
             $request->setAction('SetEditableProducts');
             $value = $request->getURL();
             break;
         case 'Copy_Products_Link':
             $request = new Request();
             $request->setView('CopyProducts');
             $request->setAction('SetEditableProducts');
             $value = $request->getURL();
             break;
         case 'Edit_Product_Link':
             $request = new Request();
             $request->setView('Catalog_EditProduct');
             $request->setAction('SetCurrentProduct');
             $request->setKey('prod_id', '');
             $value = $request->getURL();
             break;
         case 'Delete_Products_Link':
             $request = new Request();
             $request->setView('DeleteProducts');
             $request->setAction('SetEditableProducts');
             $value = $request->getURL();
             break;
         case 'SortProdHref':
             $request = new Request();
             $request->setView('SortProducts');
             $value = $request->getURL();
             break;
         case 'ProductsInCatTotal':
             $value = $this->ProdNumInCat;
             break;
         case 'AlertMessage':
             $MessageResources =& $application->getInstance('MessageResources');
             $err_mes = new ActionMessage(array('PRDLST_006'));
             $value = $MessageResources->getMessage($err_mes);
             break;
         case 'SortAlertMessage':
             if ($this->ProdNumInCat == 0) {
                 $MessageResources =& $application->getInstance('MessageResources');
                 $err_mes = new ActionMessage(array('PRDLST_007'));
                 $value = $MessageResources->getMessage($err_mes);
             } elseif ($this->ProdNumInCat == 1) {
                 $MessageResources =& $application->getInstance('MessageResources');
                 $err_mes = new ActionMessage(array('PRDLST_008'));
                 $value = $MessageResources->getMessage($err_mes);
             } else {
                 $value = '';
             }
             break;
         case 'ProductsNumber':
             $value = $this->_Cat_Info->getCategoryTagValue('productsnumber_non_recursively');
             break;
         case 'ProductsNumberRecursively':
             $value = $this->_Cat_Info->getCategoryTagValue('productsnumberrecursively') - $this->_Cat_Info->getCategoryTagValue('productsnumber');
             break;
         case 'SubcategoriesNumber':
             $value = $this->_Cat_Info->getCategoryTagValue('subcategoriesnumber');
             break;
         case 'From':
             $value = $this->From;
             break;
         case 'To':
             $value = $this->To;
             break;
         case 'CategoryStatistics':
             $value = $this->outputCategoryStatistics();
             break;
         case 'CurrensySign':
             $value = modApiFunc("Localization", "getCurrencySign");
             break;
         case 'ProductOfflineStatusReason':
             $prod_status_id = $this->_Current_Product->getProductTagValue('Available', PRODUCTINFO_NOT_LOCALIZED_DATA);
             $value = $prod_status_id == PRODUCT_STATUS_ONLINE ? getMsg('SYS', "PRODUCT_PARENT_STATUS_ONLINE") : "";
             break;
         case 'ProductOfflineStatusColor':
             //                   Offline.
             //                                    Online,                 ,      Offline -        .
             $prod_status_id = $this->_Current_Product->getProductTagValue('Available', PRODUCTINFO_NOT_LOCALIZED_DATA);
             $value = $prod_status_id == PRODUCT_STATUS_ONLINE ? "rgb(175, 175, 175)" : "#FF0000";
             break;
         case 'ProductCatsCount':
             $value = count($this->_Current_Product->getCategoriesIDs());
             break;
         case 'ProductCatsList':
             $_ps = array();
             $_cts = $this->_Current_Product->getCategoriesIDs();
             foreach ($_cts as $cid) {
                 $_ps[] = $this->_cats_paths[$cid];
             }
             asort($_ps);
             $_ps = array_map("addslashes", array_map("_ml_htmlentities", $_ps));
             $value = implode("<br>", $_ps);
             break;
         case 'ProductQuantityInStock':
             if ($this->_Current_Product->whichStockControlMethod() == PRODUCT_OPTIONS_INVENTORY_TRACKING) {
                 $value = "";
                 $inv_qty = modApiFunc('Product_Options', 'getQuantityInStockByInventoryTable', 'product', $this->_Current_Product->getProductTagValue('ID'));
                 if (Validator::isValidInt($inv_qty) == true) {
                     $value = $inv_qty . ' ' . modApiFunc('Localization', 'getUnitTypeValue', 'item');
                 }
             } else {
                 $value = $this->_Current_Product->getProductTagValue('QuantityInStock', PRODUCTINFO_NOT_LOCALIZED_DATA);
                 if (Validator::isValidInt($value) == true) {
                     $value = $this->_Current_Product->getProductTagValue('QuantityInStock', PRODUCTINFO_LOCALIZED_DATA);
                 }
             }
             break;
         case 'HeaderData':
             if (empty($this->psf_filter)) {
                 $value = modApiFunc('TmplFiller', 'fill', "catalog/prod_list/", "list-header-category-data.tpl.html", array());
             } else {
                 $value = modApiFunc('TmplFiller', 'fill', "catalog/prod_list/", "list-header-searchform-data.tpl.html", array());
             }
             break;
         case 'SearchFilterData':
             $value = $this->getSearchFilterDataText();
             break;
         case 'FooterData':
             if (empty($this->psf_filter)) {
                 $value = modApiFunc('TmplFiller', 'fill', "catalog/prod_list/", "list-footer-category-data.tpl.html", array());
             } else {
                 $value = modApiFunc('TmplFiller', 'fill', "catalog/prod_list/", "list-footer-searchform-data.tpl.html", array());
             }
             break;
         case 'IfSearchFormActive':
             $value = empty($this->psf_filter) ? '' : 'Y';
             break;
         case 'ProductThumbnail':
             $value = modApiFunc('TmplFiller', 'fill', 'catalog/prod_list/', 'list_item_image.tpl.html', array());
             break;
         case 'Local_NoImageSrc':
             $value = $application->getAppIni('URL_IMAGES_DIR') . 'noimage.png';
             break;
         case 'Local_SelectCategoriesProducts':
             $categorylist = modApiFunc("Catalog", "getSubcategoriesFullListWithParent", 1, false);
             foreach ($categorylist as $val => $data) {
                 $catvalid = $data["id"];
                 if ($data['level'] == 2) {
                     $value = '<option value="' . $catvalid . '" ' . ($CatID == $catvalid ? 'selected' : '') . '>&nbsp;&nbsp;&nbsp;' . $data["name"] . '</option>';
                 } else {
                     $value = '<option value="' . $catvalid . '" ' . ($CatID == $catvalid ? 'selected' : '') . '>' . $data["name"] . '</option>';
                 }
             }
             break;
         default:
             if (_ml_strpos($tag, 'Local_SortBy') === 0) {
                 $tag = _ml_substr($tag, _ml_strlen('Local_SortBy'));
                 $value = $this->getSortLink($tag);
                 break;
             }
             if (_ml_strpos($tag, 'Product') === 0) {
                 $tag = _ml_substr($tag, _ml_strlen('Product'));
             }
             if (is_object($this->_Current_Product) && $this->_Current_Product->isTagExists($tag)) {
                 $value = $this->_Current_Product->getProductTagValue($tag);
             }
             break;
     }
     return $value;
 }
 function getCZSiteHTTPSURL($SiteURL)
 {
     global $application;
     //                                - HTTPS               AVACTIS' .
     //                                - HTTP               AVACTIS' .
     //                                      SiteURL           .                                            SiteHTTPSURL.
     $AZ_AVACTIS_ROOT_HTTP_URL = $application->getAppIni("HTTP_URL_CONFIG.PHP");
     $AZ_AVACTIS_ROOT_HTTPS_URL = $application->getAppIni("HTTPS_URL");
     $url_cz = parse_url($SiteURL);
     $url_core = parse_url($AZ_AVACTIS_ROOT_HTTP_URL);
     $p_cz = explode("/", $url_cz['path']);
     $p_core = explode("/", $url_core['path']);
     foreach ($p_cz as $i => $p) {
         if (isset($p_core[$i]) && $p_cz[$i] == $p_core[$i] && !isset($p_cz[$i - 1])) {
             unset($p_cz[$i]);
             unset($p_core[$i]);
         }
     }
     $Path_CZ = implode("/", $p_cz);
     $Path_Core = implode("/", $p_core);
     $cz_https_url = preg_replace("/" . addcslashes($Path_Core, "/") . "/i", "", $AZ_AVACTIS_ROOT_HTTPS_URL);
     $cz_https_url .= $Path_CZ;
     if (_ml_strcasecmp("https://", _ml_substr($AZ_AVACTIS_ROOT_HTTPS_URL, 0, _ml_strlen("https://"))) !== 0) {
         return NULL;
     } else {
         return $cz_https_url;
     }
 }
 /**
  * Outputs the parent page select box
  */
 function outputParentSelectBox($id = -1, $selected = -1)
 {
     $result = '';
     if ($id == -1) {
         $result = '<option value="">' . getMsg('CMS', 'CMS_ANY') . '</option>' . "\n";
     }
     $result .= '<option value="0"' . ($selected == '0' ? ' selected="selected"' : '') . '>' . getMsg('CMS', 'CMS_ROOT') . '</option>' . "\n";
     $subtree = false;
     $level = '';
     foreach ($this->_page_tree as $v) {
         if ($v['page_id'] == $id) {
             $subtree = true;
             $level = $v['level'];
         }
         if (_ml_strlen($v['level']) <= _ml_strlen($level) && $v['page_id'] != $id) {
             $level = '';
             $subtree = false;
         }
         if ($v['page_id'] != $id && !$subtree) {
             $result .= '<option value="' . $v['page_id'] . '"' . ($v['page_id'] == $selected ? ' selected="selected"' : '') . '>' . str_replace(' ', '&nbsp;', $v['level']) . $v['name'] . '</option>' . "\n";
         }
     }
     return $result;
 }
Example #15
0
 function __is_valid_string(&$string)
 {
     if (!is_string($string)) {
         return false;
     }
     if (_ml_strlen($string) > 256) {
         $string = _ml_substr($string, 0, 256);
         return true;
     }
     return true;
 }
Example #16
0
 function createXML($tagID, $parentXML = '')
 {
     // Creates XML string for a tag object
     // Specify parent XML to insert new string into parent XML
     $final = '';
     // Get Reference to tag object
     $tag =& $this->xml_index[$tagID];
     $name = $tag->name;
     $contents = $tag->contents;
     $attr_count = count($tag->attributes);
     $child_count = count($tag->tags);
     $empty_tag = $tag->contents == '' ? true : false;
     // Create intial tag
     if ($attr_count == 0) {
         // No attributes
         if ($empty_tag === true) {
             $final = "<{$name} />";
         } else {
             $final = "<{$name}>{$contents}</{$name}>";
         }
     } else {
         // Attributes present
         $attribs = '';
         foreach ($tag->attributes as $key => $value) {
             $attribs .= ' ' . $key . "=\"{$value}\"";
         }
         if ($empty_tag === true) {
             $final = "<{$name}{$attribs} />";
         } else {
             $final = "<{$name}{$attribs}>{$contents}</{$name}>";
         }
     }
     // Search for children
     if ($child_count > 0) {
         foreach ($tag->tags as $childID) {
             $final = $this->createXML($childID, $final);
         }
     }
     if ($parentXML != '') {
         // Add tag XML to parent XML
         $stop1 = _ml_strrpos($parentXML, '</');
         $stop2 = _ml_strrpos($parentXML, ' />');
         if ($stop1 > $stop2) {
             // Parent already has children
             $begin_chunk = _ml_substr($parentXML, 0, $stop1);
             $end_chunk = _ml_substr($parentXML, $stop1, _ml_strlen($parentXML) - $stop1 + 1);
             $final = $begin_chunk . $final . $end_chunk;
         } elseif ($stop2 > $stop1) {
             // No previous children
             $spc = _ml_strpos($parentXML, ' ', 0);
             $parent_name = _ml_substr($parentXML, 1, $spc - 1);
             if ($spc != $stop2) {
                 // Attributes present
                 $parent_attribs = _ml_substr($parentXML, $spc, $stop2 - $spc);
             } else {
                 // No attributes
                 $parent_attribs = '';
             }
             $final = "<{$parent_name}{$parent_attribs}>{$final}</{$parent_name}>";
         }
     }
     return $final;
 }
 /**
  * Prepares and returns necessary data, passed to the payment gateway.
  *
  * @ not all data is defined
  */
 function getConfirmationData($orderId)
 {
     global $application;
     loadCoreFile('aal.class.php');
     $request = new Request();
     $request->setView(CURRENT_REQUEST_URL);
     $request->setAction("UpdatePaymentStatus");
     $request->setKey("asc_oid", $orderId);
     $self_link = $request->getURL("", true);
     $currency_id = modApiFunc("Localization", "whichCurrencySendOrderToPaymentShippingGatewayIn", $orderId, $this->getUid());
     $currency = modApiFunc("Localization", "getCurrencyCodeById", $currency_id);
     $ocntr = modApiFunc("Location", "getCountryCode", modApiFunc("Configuration", "getValue", SYSCONFIG_STORE_OWNER_COUNTRY));
     $bn_code = "PentasoftCorp_Cart_WPS_" . $ocntr;
     $orderInfo = modApiFunc("Checkout", "getOrderInfo", $orderId, $currency_id);
     $discount = $this->export_PRICE_N_A(modApiFunc("Checkout", "getOrderPrice", "DiscountsSum", $currency_id));
     $gc = $this->export_PRICE_N_A(modApiFunc("Checkout", "getOrderPrice", "TotalPrepaidByGC", $currency_id));
     $amount = $this->export_PRICE_N_A(modApiFunc("Checkout", "getOrderPrice", "Subtotal", $currency_id) - $discount - $gc);
     if ($amount < 0) {
         $amount = 0;
     }
     $this->getSettings();
     $confirmationData = array("FormMethod" => "POST", "DataFields" => array("cmd" => "_xclick", "rm" => "2", "business" => $this->Settings["MODULE_EMAIL"], "item_name" => modApiFunc("Configuration", "getValue", SYSCONFIG_STORE_OWNER_NAME), "amount" => number_format($amount, 2, '.', ''), "shipping" => number_format($this->export_PRICE_N_A(modApiFunc("Checkout", "getOrderPrice", "TotalShippingAndHandlingCost", $currency_id)), 2, '.', ''), "tax" => number_format($this->export_PRICE_N_A(modApiFunc("Checkout", "getOrderPrice", "NotIncludedTax", $currency_id)), 2, '.', ''), "currency_code" => $currency, "bn" => $bn_code, "return" => $self_link . "&status=return", "notify_url" => $self_link . "&status=notify", "cancel_return" => $self_link . "&status=cancel"));
     if ($this->Settings['MODULE_CART'] == 1 && $discount == 0) {
         $items = array();
         $n = 1;
         foreach ($orderInfo["Products"] as $productInfo) {
             $items["item_name_" . $n] = prepareHTMLDisplay($productInfo["name"]);
             $items["amount_" . $n] = number_format($productInfo["SalePrice"], 2);
             $items["quantity_" . $n] = $productInfo["qty"];
             foreach ($productInfo["options"] as $i => $option) {
                 if ($i > 1) {
                     $items["os1_" . $n] .= ", " . $option["option_name"] . ": " . $option["option_value"];
                     if (_ml_strlen($items["os1_" . $n]) >= 200) {
                         $items["os1_" . $n] = _ml_substr($items["os1_" . $n], 0, 197) . "...";
                     }
                 } else {
                     $items["on" . $i . "_" . $n] = $option["option_name"];
                     $items["os" . $i . "_" . $n] = $option["option_value"];
                 }
             }
             $n++;
         }
         $confirmationData["DataFields"] = array_merge($confirmationData["DataFields"], $items);
         $confirmationData["DataFields"]["cmd"] = "_cart";
         $confirmationData["DataFields"]["upload"] = "1";
         $confirmationData["DataFields"]["handling_cart"] = $this->export_PRICE_N_A(modApiFunc("Checkout", "getOrderPrice", "TotalShippingAndHandlingCost", $currency_id));
         $confirmationData["DataFields"]["tax_cart"] = $this->export_PRICE_N_A(modApiFunc("Checkout", "getOrderPrice", "NotIncludedTax", $currency_id));
         unset($confirmationData["DataFields"]["shipping"]);
         unset($confirmationData["DataFields"]["tax"]);
     }
     if ($this->Settings['MODULE_BILLING_INFO'] == 1) {
         $billingInfo = new ArrayAccessLayer($orderInfo);
         $billingInfo->setAccessMask("Billing", "attr", AAL_CUSTOM_PARAM, "value");
         if ($confirmationData["DataFields"]["cmd"] == "_xclick") {
             $confirmationData["DataFields"]["cmd"] = "_ext-enter";
             $confirmationData["DataFields"]["redirect_cmd"] = "_xclick";
         }
         $confirmationData["DataFields"]["first_name"] = $billingInfo->getByMask('Firstname');
         $confirmationData["DataFields"]["last_name"] = $billingInfo->getByMask('Lastname');
         $confirmationData["DataFields"]["address1"] = $billingInfo->getByMask('Streetline1');
         $confirmationData["DataFields"]["address2"] = $billingInfo->getByMask('Streetline2');
         $confirmationData["DataFields"]["city"] = $billingInfo->getByMask('City');
         $confirmationData["DataFields"]["state"] = modApiFunc("Location", "getStateCodeByStateName", $billingInfo->getByMask('State'));
         if (!$confirmationData["DataFields"]["state"]) {
             $confirmationData["DataFields"]["state"] = $billingInfo->getByMask('State');
         }
         $confirmationData["DataFields"]["zip"] = $billingInfo->getByMask('Postcode');
         $confirmationData["DataFields"]["country"] = modApiFunc("Location", "getCountryCodeByCountryName", $billingInfo->getByMask('Country'));
         $confirmationData["DataFields"]["email"] = $billingInfo->getByMask('Email');
         if ($billingInfo->getByMask('Phone')) {
             $phone = $billingInfo->getByMask('Phone');
             $phone = preg_replace("/[^0-9]/", "", $phone);
             if (isset($confirmationData["DataFields"]["country"]) && $confirmationData["DataFields"]["country"] == "US") {
                 if (_ml_strlen($phone) == 10) {
                     $confirmationData["DataFields"]["night_phone_c"] = _ml_substr($phone, -4);
                     $phone = _ml_substr($phone, 0, -4);
                     $confirmationData["DataFields"]["night_phone_b"] = _ml_substr($phone, -3);
                     $phone = _ml_substr($phone, 0, -3);
                     $confirmationData["DataFields"]["night_phone_a"] = _ml_substr($phone, -3);
                 }
             }
         }
     }
     if ($this->Settings['MODULE_ADDRESS_OVERRIDE'] == 1) {
         $shippingInfo = new ArrayAccessLayer($orderInfo);
         $shippingInfo->setAccessMask("Shipping", "attr", AAL_CUSTOM_PARAM, "value");
         $confirmationData["DataFields"]["address_override"] = "1";
         $confirmationData["DataFields"]["first_name"] = $shippingInfo->getByMask('Firstname');
         $confirmationData["DataFields"]["last_name"] = $shippingInfo->getByMask('Lastname');
         $confirmationData["DataFields"]["address1"] = $shippingInfo->getByMask('Streetline1');
         $confirmationData["DataFields"]["address2"] = $shippingInfo->getByMask('Streetline2');
         $confirmationData["DataFields"]["city"] = $shippingInfo->getByMask('City');
         $confirmationData["DataFields"]["state"] = modApiFunc("Location", "getStateCodeByStateName", $shippingInfo->getByMask('State'));
         if (!$confirmationData["DataFields"]["state"]) {
             $confirmationData["DataFields"]["state"] = $shippingInfo->getByMask('State');
         }
         $confirmationData["DataFields"]["zip"] = $shippingInfo->getByMask('Postcode');
         $confirmationData["DataFields"]["country"] = modApiFunc("Location", "getCountryCodeByCountryName", $shippingInfo->getByMask('Country'));
         $confirmationData["DataFields"]["email"] = $shippingInfo->getByMask('Email');
         if ($shippingInfo->getByMask('Phone')) {
             $phone = $shippingInfo->getByMask('Phone');
             $phone = preg_replace("/[^0-9]/", "", $phone);
             if (isset($confirmationData["DataFields"]["country"]) && $confirmationData["DataFields"]["country"] == "US") {
                 if (_ml_strlen($phone) == 10) {
                     $confirmationData["DataFields"]["night_phone_c"] = _ml_substr($phone, -4);
                     $phone = _ml_substr($phone, 0, -4);
                     $confirmationData["DataFields"]["night_phone_b"] = _ml_substr($phone, -3);
                     $phone = _ml_substr($phone, 0, -3);
                     $confirmationData["DataFields"]["night_phone_a"] = _ml_substr($phone, -3);
                 }
             }
         }
     }
     $confirmationData['FormAction'] = $this->Settings['MODULE_MODE'] == 1 ? PAYPAL_URL_TEST : PAYPAL_URL;
     //=========================== logging request ========================
     $msgObj = $application->getInstance("MessageResources", "payment-module-paypal-messages", "AdminZone");
     $title = $msgObj->getMessage("MODULE_PAYMENT_TIMELINE_HEADER_CONFIRMATION_DATA");
     $title = str_replace('{ORDER_ID}', $orderId, $title);
     $this->addRequestLog("LOG_PM_INPUT", "Payment Module Logs", $title, prepareArrayDisplay($confirmationData));
     //=========================== logging request ========================
     return $confirmationData;
 }
 /**
  * Deletes tax rate by zip set.
  */
 function onAction()
 {
     global $application;
     $SessionPost = array();
     $SessionPost = $_POST;
     $Errors = array();
     $Results = array();
     $sets = modApiFunc("TaxRateByZip", "getSetsList");
     if (isset($SessionPost["item_n"])) {
         $sid = $SessionPost["item_n"];
     } else {
         //  errors
     }
     if (isset($SessionPost["ViewState"]["FormSubmitValue"])) {
         switch ($SessionPost["ViewState"]["FormSubmitValue"]) {
             case "deleteSet":
                 // check if set is used in tax rates
                 if (modApiFunc("Taxes", "checkIfSetIsUsed", $sid)) {
                     $Errors[] = str_replace("%1%", $sets[$sid], getMsg("TAX_ZIP", "SETS_LIST_CANNOT_DELETE_SET_IN_USE"));
                     break;
                 } else {
                     modApiFunc("TaxRateByZip", "deleteSetFromDB", $sid);
                 }
                 break;
             case "checkRate":
                 $sid = $SessionPost['CheckRate_sid'];
                 $zip = $SessionPost['CheckRate_zip'];
                 $Results[] = str_replace("%1%", $sets[$sid], getMsg("TAX_ZIP", "CHECK_RATES_GOT_ARCHIVE"));
                 $Results[] = str_replace("%1%", prepareHTMLDisplay($zip), getMsg("TAX_ZIP", "CHECK_RATES_GOT_ZIP"));
                 modApiFunc('Session', 'set', 'CheckRateByZip', array("sid" => $sid, "zip" => $zip));
                 $zip = preg_replace("/[^0-9]/", '', $zip);
                 $len = _ml_strlen($zip);
                 if ($len != 5 && $len != 9) {
                     $Results[] = getMsg("TAX_ZIP", "CHECK_RATES_NOT_5_9_ZIP_ERROR");
                     break;
                 }
                 if ($len == 5) {
                     $zip5 = intval($zip);
                     $Results[] = str_replace("%1%", $zip5, getMsg("TAX_ZIP", "CHECK_RATES_GOT_ZIP5"));
                     $Results[] = getMsg("TAX_ZIP", "CHECK_RATES_NO_ZIP4");
                     $rlt5 = modApiFunc("TaxRateByZip", "getTaxRateByZip5Strict", $sid, $zip5);
                     $rlt5 = $rlt5 === FALSE ? 0.0 : $rlt5;
                     $Results[] = str_replace("%1%", $rlt5, getMsg("TAX_ZIP", "CHECK_RATES_STRICT_RLT"));
                     $rlt5i = modApiFunc("TaxRateByZip", "getTaxRateByZip5Interval", $sid, $zip5);
                     $rlt5i = $rlt5i === FALSE ? 0.0 : $rlt5i;
                     $Results[] = str_replace("%1%", $rlt5i, getMsg("TAX_ZIP", "CHECK_RATES_INTERVAL_RLT"));
                     $rlt5m = modApiFunc("TaxRateByZip", "getTaxRateByZip5Mask", $sid, $zip5);
                     $rlt5m = $rlt5m === FALSE ? 0.0 : $rlt5m;
                     $Results[] = str_replace("%1%", $rlt5m, getMsg("TAX_ZIP", "CHECK_RATES_MASK_RLT"));
                 } else {
                     $zip5 = intval(_ml_substr($zip, 0, 5));
                     $zip4 = intval(_ml_substr($zip, 5, 4));
                     $Results[] = str_replace("%1%", $zip5, getMsg("TAX_ZIP", "CHECK_RATES_GOT_ZIP5"));
                     $Results[] = str_replace("%1%", $zip4, getMsg("TAX_ZIP", "CHECK_RATES_GOT_ZIP4"));
                     $rlt5 = modApiFunc("TaxRateByZip", "getTaxRateByZip9Strict", $sid, $zip5, $zip4);
                     $rlt5 = $rlt5 === FALSE ? 0.0 : $rlt5;
                     $Results[] = str_replace("%1%", $rlt5, getMsg("TAX_ZIP", "CHECK_RATES_STRICT_RLT"));
                     $rlt5i = modApiFunc("TaxRateByZip", "getTaxRateByZip9Interval", $sid, $zip5, $zip4);
                     $rlt5i = $rlt5i === FALSE ? 0.0 : $rlt5i;
                     $Results[] = str_replace("%1%", $rlt5i, getMsg("TAX_ZIP", "CHECK_RATES_INTERVAL_RLT"));
                     $rlt5m = modApiFunc("TaxRateByZip", "getTaxRateByZip9Mask", $sid, $zip5, $zip4);
                     $rlt5m = $rlt5m === FALSE ? 0.0 : $rlt5m;
                     $Results[] = str_replace("%1%", $rlt5m, getMsg("TAX_ZIP", "CHECK_RATES_MASK_RLT"));
                     //                        if (!$rlt5 && !$rlt5i && !$rlt5m)
                     //                        {
                     //                            $Results[] = getMsg("TAX_ZIP", "CHECK_RATES_COULDNT_FIND_RATE_WITH_ZIP4");
                     //
                     //                            $rlt5 = modApiFunc("TaxRateByZip", "getTaxRateByZip5Strict", $sid, $zip5);
                     //                            $rlt5 = ($rlt5 === FALSE) ? 0.0 : $rlt5;
                     //                            $Results[] = str_replace("%1%", $rlt5, getMsg("TAX_ZIP", "CHECK_RATES_STRICT_RLT"));
                     //
                     //                            $rlt5i = modApiFunc("TaxRateByZip", "getTaxRateByZip5Interval", $sid, $zip5);
                     //                            $rlt5i = ($rlt5i === FALSE) ? 0.0 : $rlt5i;
                     //                            $Results[] = str_replace("%1%", $rlt5i, getMsg("TAX_ZIP", "CHECK_RATES_INTERVAL_RLT"));
                     //
                     //                            $rlt5m = modApiFunc("TaxRateByZip", "getTaxRateByZip5Mask", $sid, $zip5);
                     //                            $rlt5m = ($rlt5m === FALSE) ? 0.0 : $rlt5m;
                     //                            $Results[] = str_replace("%1%", $rlt5m, getMsg("TAX_ZIP", "CHECK_RATES_MASK_RLT"));
                     //                        }
                 }
                 if ($rlt5) {
                     $Results[] = str_replace("%1%", $rlt5, getMsg("TAX_ZIP", "CHECK_RATES_STRICT_RLT_USED"));
                 } else {
                     if ($rlt5i) {
                         $Results[] = str_replace("%1%", $rlt5i, getMsg("TAX_ZIP", "CHECK_RATES_INTERVAL_RLT_USED"));
                     } else {
                         if ($rlt5m) {
                             $Results[] = str_replace("%1%", $rlt5m, getMsg("TAX_ZIP", "CHECK_RATES_MASK_RLT_USED"));
                         } else {
                             $Results[] = getMsg("TAX_ZIP", "CHECK_RATES_NO_RLT");
                         }
                     }
                 }
                 break;
             default:
                 _fatal(array("CODE" => "CORE_051"), __CLASS__, __FUNCTION__, $SessionPost["ViewState"]["FormSubmitValue"]);
                 break;
         }
     } else {
         _fatal(array("CODE" => "CORE_051"), __CLASS__, __FUNCTION__, $SessionPost["ViewState"]["FormSubmitValue"]);
     }
     if (!empty($Errors)) {
         modApiFunc('Session', 'set', 'Errors', $Errors);
     }
     if (!empty($Results)) {
         modApiFunc('Session', 'set', 'Results', $Results);
     }
     //        modApiFunc('Session', 'set', 'SessionPost', $SessionPost);
     $request = new Request();
     $request->setView('TaxRateByZip_Sets');
     $application->redirect($request);
 }
 function genThumbnail($product_id, $original_image_path, $thumb_side = null, $subfolder = '')
 {
     if (!function_exists('gd_info')) {
         return null;
     }
     $img_info = getimagesize($original_image_path);
     if (!(imagetypes() & $this->__imageTypeToBit($img_info[2]))) {
         return null;
     }
     $oimage = $this->getImageRes($original_image_path);
     if ($oimage == null) {
         return null;
     }
     $sets = $this->getSettings();
     if ($thumb_side == null || intval($thumb_side) <= 0) {
         $thumb_side = $sets['THUMB_SIDE'];
     } else {
         $thum_side = intval($thumb_side);
     }
     list($dst_x, $dst_y) = $this->convertSizes($img_info[0], $img_info[1], $thumb_side);
     $dst_image = imagecreatetruecolor($dst_x, $dst_y);
     imagecolortransparent($dst_image, imagecolorallocatealpha($dst_image, 0, 0, 0, 127));
     imagealphablending($dst_image, false);
     imagesavealpha($dst_image, true);
     imagecopyresampled($dst_image, $oimage, 0, 0, 0, 0, $dst_x, $dst_y, $img_info[0], $img_info[1]);
     global $application;
     $large_image_path_parts = pathinfo($original_image_path);
     $large_image_basename = $large_image_path_parts['basename'];
     $large_image_ext = $large_image_path_parts['extension'];
     $large_image_basename_without_ext = _ml_substr($large_image_basename, 0, -1 * _ml_strlen("." . $large_image_ext));
     $thumb_basename = "thumb_" . $large_image_basename_without_ext . "." . $large_image_ext;
     $new_image_path = $application->getUploadImageName($thumb_basename, $subfolder);
     if ($large_image_ext == 'png' && imagepng($dst_image, $new_image_path)) {
         return $new_image_path;
     }
     if (imagejpeg($dst_image, $new_image_path, $application->getAppIni('JPEG_THUMBNAIL_QUALITY'))) {
         return $new_image_path;
     } else {
         return null;
     }
 }
 function getCategoryName()
 {
     if ($this->_Current_Category == null) {
         return null;
     }
     $value = $this->_Current_Category['name'];
     if (_ml_strlen($value) > 27) {
         $value = preg_replace('/^(\\S+)\\s.*\\s(\\S+)$/', '\\1 ... \\2', $value);
         if (_ml_strlen($value) > 27) {
             $value = _ml_substr($value, 0, 12) . '...';
         }
     }
     return $value;
 }
 function getTag($tag)
 {
     global $application;
     $value = null;
     //$CatID = $this->_Current_Category->getCategoryTagValue('ID');
     switch ($tag) {
         case 'CategoryProducts':
             $value = $this->_Current_Category->getCategoryTagValue('productsnumber_non_recursively');
             break;
         case 'CategoryProductsRec':
             $value = $this->_Current_Category->getCategoryTagValue('productsnumberrecursively_all_product_links');
             break;
         case 'FeaturedProducts':
             $value = $this->outputFeaturedProducts();
             break;
         case 'BestsellersProducts':
             $value = $this->outputBestsellersProducts();
             break;
         default:
             if (is_object($this->_Current_Category) && $this->_Current_Category->isTagExists($tag)) {
                 $value = $this->_Current_Category->getCategoryTagValue($tag);
             } else {
                 if (_ml_strpos($tag, 'Category') === 0) {
                     $tag = _ml_substr($tag, _ml_strlen('Category'));
                     if (is_object($this->_Current_Category) && $this->_Current_Category->isTagExists($tag)) {
                         $value = $this->_Current_Category->getCategoryTagValue($tag);
                     }
                 }
             }
             break;
     }
     return $value;
 }
 /**
  *
  */
 function outputCCTypes()
 {
     global $application;
     $cc_types = modApiFunc("Configuration", "getCreditCardSettings", false);
     $retval = "";
     $name_input_id = 1;
     foreach ($cc_types as $type) {
         $this->_CCType = array("id" => $type["id"], "name" => $type["name"], "name_input_id" => $name_input_id, "tag" => $type["tag"], "visible" => $type["visible"], "type" => _ml_substr($type["tag"], _ml_strlen("common_cc_type")) == "common_cc_type" ? "common" : $type["tag"], "StatusVisible" => $type["visible"] == DB_TRUE ? "SELECTED" : "", "StatusInvisible" => $type["visible"] == DB_TRUE ? "" : "SELECTED");
         $name_input_id++;
         if (_ml_strpos($this->_CCType["tag"], "without_validation") === 0) {
             $this->_CCType["tag"] = getMsg('SYS', 'CREDIT_CARDS_TAG_COMMON_TYPE');
         }
         $application->registerAttributes($this->_CCType);
         $retval .= $this->mTmplFiller->fill("configuration/credit_card_settings/", "credit_cards_list_item.tpl.html", array());
     }
     return $retval;
 }
 /**
  * @ describe the function ProductList->getTag.
  */
 function getTag($tag)
 {
     global $application;
     $value = null;
     $CatID = modApiFunc('CProductListFilter', 'getCurrentCategoryId');
     $moveto_category_full_path = modApiFunc("Catalog", "getCategoryFullPath", modApiFunc("Catalog", "getMoveToCategoryID"));
     switch ($tag) {
         case 'HiddenArrayViewState':
             $value = $this->outputViewState();
             break;
         case 'asc_action':
             $value = $this->outputAction();
             break;
         case 'Items':
             $value = $this->outputSubcategoriesList(modApiFunc("Catalog", "getMoveToCategoryID"));
             break;
         case 'New_Path':
             $value = $this->outputLocationBreadcrumb($moveto_category_full_path, true);
             break;
         case 'New_Path_Breadcrumb':
             $value = $this->outputNewLocation($moveto_category_full_path);
             break;
         case 'Move_Href':
             $value = $this->outputMoveHref();
             break;
         case 'Move_Object':
             $value = $this->outputMoveObject();
             break;
         case 'Move_Subject':
             $value = $this->outputMoveSubject();
             break;
         case 'Breadcrumb':
             $obj =& $application->getInstance('Breadcrumb');
             $value = $obj->output(false);
             break;
         case 'Button':
             $value = $this->outputButton();
             break;
         default:
             if (_ml_strpos($tag, 'Category') === 0) {
                 $tag = _ml_substr($tag, _ml_strlen('Category'));
             }
             if ($this->_Current_Category->isTagExists($tag)) {
                 $value = $this->_Current_Category->getCategoryTagValue($tag);
             }
             break;
     }
     return $value;
 }
 function __getBottomHeight()
 {
     //                                      x
     $len = 0;
     $xlabels = $this->bar_chart->get_xlabels();
     if (!empty($xlabels)) {
         foreach ($xlabels as $label) {
             $len = max($len, _ml_strlen($label['text']));
         }
     }
     // 4                     35
     return max(round($len / 4 * 28), 35);
 }
 /**
  * Checks, whether the password length is valid.
  *
  * @param string $new_password - a new admin password
  * @return boolean true, if the length is from 8 to 32, false, otherwise
  */
 function isValidNewPasswordLength($new_password)
 {
     $retval = true;
     $lenght = _ml_strlen($new_password);
     if ($lenght < 8 || $lenght > 32) {
         $retval = false;
     }
     return $retval;
 }
 /**
    2.1 Mask account numbers when displayed (the first six and last four
    digits are the maximum number of digits to be displayed).
            CVV                      .
 
    Visa U.S.A. Cardholder Information Security Program (CISP)
    Payment Application Best Practices
 */
 function cvv2public($cvv)
 {
     $len = _ml_strlen($cvv);
     for ($i = 0; $i < $len; $i++) {
         $cvv[$i] = "*";
     }
     return $cvv;
 }
 /**
  * @ describe the function ManageOrders->.
  */
 function getTag($tag)
 {
     global $application;
     $value = null;
     switch ($tag) {
         case 'CountByStatus0':
             $value = modApiFunc('Checkout', 'getOrderCount', 0);
             break;
         case 'CountByStatus1':
             $value = modApiFunc('Checkout', 'getOrderCount', 1);
             break;
         case 'CountByStatus2':
             $value = modApiFunc('Checkout', 'getOrderCount', 2);
             break;
         case 'CountByStatus3':
             $value = modApiFunc('Checkout', 'getOrderCount', 3);
             break;
         case 'SearchStatusSelector':
             $this->_simple_selector['options'] = array();
             $status_array = modApiFunc('Checkout', 'getOrderStatusList');
             if (isset($this->_filter['status_id']) && $this->_filter['status_id'] != "") {
                 $this->_simple_selector['selected'] = $this->_filter['status_id'];
             }
             foreach ($status_array as $status) {
                 $sel = 0;
                 if (isset($this->_filter['order_statuses']) && is_array($this->_filter['order_statuses']) && isset($this->_filter['order_statuses'][$status['id']])) {
                     $sel = 1;
                 }
                 $this->_simple_selector['options'][] = array('value' => $status['id'], 'name' => $status['name'], 'selected' => $sel);
             }
             $value = $this->TemplateFiller->fill("checkout/orders/", "search-status-selector.tpl.html", array());
             break;
         case 'SearchPaymentStatusSelector':
             $this->_simple_selector['options'] = array();
             if (isset($this->_filter['payment_status_id']) && $this->_filter['payment_status_id'] != "") {
                 $this->_simple_selector['selected'] = $this->_filter['payment_status_id'];
             }
             $status_array = modApiFunc('Checkout', 'getOrderPaymentStatusList');
             foreach ($status_array as $status) {
                 $sel = 0;
                 if (isset($this->_filter['payment_statuses']) && is_array($this->_filter['payment_statuses']) && isset($this->_filter['payment_statuses'][$status['id']])) {
                     $sel = 1;
                 }
                 $this->_simple_selector['options'][] = array('value' => $status['id'], 'name' => $status['name'], 'selected' => $sel);
             }
             $value = $this->TemplateFiller->fill("checkout/orders/", "search-payment-status-selector.tpl.html", array());
             break;
         case 'SearchFromDaySelector':
             $this->_simple_selector['selected'] = $this->_filter['from_day'];
             $this->_simple_selector['options'] = array();
             for ($i = 1; $i <= 31; $i++) {
                 $num = sprintf("%02d", $i);
                 $this->_simple_selector['options'][] = array('value' => $num, 'name' => $i);
             }
             $value = $this->TemplateFiller->fill("checkout/orders/", "search-from-day-selector.tpl.html", array());
             break;
         case 'SearchFromMonthSelector':
             $this->_simple_selector['selected'] = $this->_filter['from_month'];
             $this->_simple_selector['options'] = array();
             for ($i = 1; $i <= 12; $i++) {
                 $num = sprintf("%02d", $i);
                 $this->_simple_selector['options'][] = array('value' => $num, 'name' => $this->MessageResources->getMessage("GENERAL_MONTH_" . $num));
             }
             $value = $this->TemplateFiller->fill("checkout/orders/", "search-from-month-selector.tpl.html", array());
             break;
         case 'SearchFromYearSelector':
             $this->_simple_selector['selected'] = $this->_filter['from_year'];
             $this->_simple_selector['options'] = array();
             $curr_year_4digits = date('Y');
             $start_year = (int) modApiFunc('Settings', 'getParamValue', 'VISUAL_INTERFACE', 'SEARCH_START_YEAR');
             $offset_to = modApiFunc('Settings', 'getParamValue', 'VISUAL_INTERFACE', 'SEARCH_YEAR_OFFSET');
             for ($i = $start_year; $i <= $curr_year_4digits + $offset_to; $i++) {
                 $this->_simple_selector['options'][] = array('value' => $i, 'name' => $i);
             }
             $value = $this->TemplateFiller->fill("checkout/orders/", "search-from-year-selector.tpl.html", array());
             break;
         case 'SearchToDaySelector':
             if (empty($this->_filter['to_day']) == false) {
                 $this->_simple_selector['selected'] = $this->_filter['to_day'];
             } else {
                 $this->_simple_selector['selected'] = date("j");
             }
             $this->_simple_selector['options'] = array();
             for ($i = 1; $i <= 31; $i++) {
                 $num = sprintf("%02d", $i);
                 $this->_simple_selector['options'][] = array('value' => $num, 'name' => $i);
             }
             $value = $this->TemplateFiller->fill("checkout/orders/", "search-to-day-selector.tpl.html", array());
             break;
         case 'SearchToMonthSelector':
             if (empty($this->_filter['to_month']) == false) {
                 $this->_simple_selector['selected'] = $this->_filter['to_month'];
             } else {
                 $this->_simple_selector['selected'] = date("m");
             }
             $this->_simple_selector['options'] = array();
             for ($i = 1; $i <= 12; $i++) {
                 $num = sprintf("%02d", $i);
                 $this->_simple_selector['options'][] = array('value' => $num, 'name' => $this->MessageResources->getMessage("GENERAL_MONTH_" . $num));
             }
             $value = $this->TemplateFiller->fill("checkout/orders/", "search-to-month-selector.tpl.html", array());
             break;
         case 'SearchToYearSelector':
             if (empty($this->_filter['to_year']) == false) {
                 $this->_simple_selector['selected'] = $this->_filter['to_year'];
             } else {
                 $this->_simple_selector['selected'] = date("Y");
             }
             $this->_simple_selector['options'] = array();
             $curr_year_4digits = date('Y');
             $start_year = (int) modApiFunc('Settings', 'getParamValue', 'VISUAL_INTERFACE', 'SEARCH_START_YEAR');
             $offset_to = modApiFunc('Settings', 'getParamValue', 'VISUAL_INTERFACE', 'SEARCH_YEAR_OFFSET');
             for ($i = $start_year; $i <= $curr_year_4digits + $offset_to; $i++) {
                 $this->_simple_selector['options'][] = array('value' => $i, 'name' => $i);
             }
             $value = $this->TemplateFiller->fill("checkout/orders/", "search-to-year-selector.tpl.html", array());
             break;
         case 'SimpleSelectorOption':
             $selected = $this->_simple_selector['selected'];
             $value = "";
             foreach ($this->_simple_selector['options'] as $option) {
                 $sel = $option['value'] == $selected ? " selected" : "";
                 $value .= "<OPTION value=\"" . $option['value'] . "\"" . $sel . ">" . $option['name'] . "</OPTION>\n";
             }
             break;
         case 'SimpleCheckBoxGroup_Orders':
             $selected = $this->_simple_selector['selected'];
             $value = "";
             $items_per_col = 2;
             // number of items per column
             $idx = 0;
             $flag = 0;
             foreach ($this->_simple_selector['options'] as $option) {
                 if ($idx % $items_per_col == 0) {
                     $value .= "<TR>\n";
                     $flag = 0;
                 }
                 $sel = "";
                 $highlight = "";
                 if ($option['selected'] == 1) {
                     $sel = "checked";
                     if ($this->_filter['search_by'] == "date") {
                         $highlight = "style='color: black;'";
                     }
                 }
                 $name = "order_" . preg_replace("/ /", "", $option['name']);
                 $value .= "<TD {$highlight}><INPUT class='form-control input-inline input-sm' id='" . $name . "' name='order_status[" . $option['value'] . "]' type='checkbox' " . $sel . "> " . $option['name'] . "</TD>\n";
                 if ($idx % $items_per_col == 0 && $flag == 1) {
                     $value .= "</TR>\n";
                     $flag = 0;
                 }
                 $flag = 1;
                 $idx++;
             }
             break;
         case 'SimpleCheckBoxGroup_Payments':
             $selected = $this->_simple_selector['selected'];
             $value = "";
             $items_per_col = 1;
             // number of items per column
             $idx = 0;
             $flag = 0;
             foreach ($this->_simple_selector['options'] as $option) {
                 if ($idx % $items_per_col == 0) {
                     $value .= "<TR>\n";
                     $flag = 0;
                 }
                 $sel = "";
                 $highlight = "";
                 if ($option['selected'] == 1) {
                     $sel = "checked";
                     if ($this->_filter['search_by'] == "date") {
                         $highlight = "color: black;";
                     }
                 }
                 $name = "payment_" . preg_replace("/ /", "", $option['name']);
                 $value .= "<TD style='margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px;" . $highlight . "'><INPUT class='form-control input-inline input-sm' id='" . $name . "' name='payment_status[" . $option['value'] . "]' type='checkbox' " . $sel . "> " . $option['name'] . "</TD>\n";
                 if ($idx % $items_per_col == 0 && $flag == 1) {
                     $value .= "</TR>\n";
                     $flag = 0;
                 }
                 $flag = 1;
                 $idx++;
             }
             break;
         case 'ResultCount':
             $from = modApiFunc("Paginator", "getCurrentPaginatorOffset") + 1;
             $to = modApiFunc("Paginator", "getCurrentPaginatorOffset") + modApiFunc("Paginator", "getPaginatorRowsPerPage", "Checkout_Orders");
             $total = modApiFunc("Paginator", "getCurrentPaginatorTotalRows");
             if ($to > $total) {
                 $to = $total;
             }
             if ($total <= modApiFunc("Paginator", "getPaginatorRowsPerPage", "Checkout_Orders")) {
                 $value = $this->MessageResources->getMessage(new ActionMessage(array("ORDERS_RESULTS_LESS_THEN_ROWS_PER_PAGE_FOUND", $total)));
             } else {
                 $value = $this->MessageResources->getMessage(new ActionMessage(array("ORDERS_RESULTS_MORE_THEN_ROWS_PER_PAGE_FOUND", $from, $to, $total)));
             }
             break;
         case 'ResultDateRange':
             $count = count($this->_orders);
             if ($count == 0) {
                 $value = "";
                 break;
             } elseif ($count == 1) {
                 $orderInfo = $this->_fetched_orders[$this->_orders[0]];
                 $value = modApiFunc("Localization", "SQL_date_format", $orderInfo['order_date']);
                 break;
             }
             $first_in_list_order_info = $this->_fetched_orders[$this->_orders[0]];
             $last_in_list_order_info = $this->_fetched_orders[$this->_orders[$count - 1]];
             $value = $value = modApiFunc("Localization", "SQL_date_format", $last_in_list_order_info['order_date']) . " - " . modApiFunc("Localization", "SQL_date_format", $first_in_list_order_info['order_date']);
             break;
         case 'ResultAmount':
             if (count($this->_orders) == 0) {
                 $value = 0;
                 break;
             }
             $amount = 0;
             $all_orders_are_in_main_currency = true;
             $main_store_currency = modApiFunc("Localization", "getCurrencyCodeById", modApiFunc("Localization", "getMainStoreCurrency"));
             foreach ($this->_orders as $order_id) {
                 //           order_total   main_store_currency       .
                 //           order'                      ,                                 default ( . .
                 //       main_store_currency                 ).
                 //     default currency                                                 main_store_currency,
                 //                                               ,            .          order_total
                 //                                          .
                 $order_default_currency = modApiFunc("Localization", "getOrderMainCurrency", $order_id, $this->_fetched_orders[$order_id]['order_currencies_list']);
                 $order_total_in_order_default_currency = $this->_fetched_orders[$order_id]['price_total'][$order_default_currency]['order_total'];
                 if ($order_default_currency == $main_store_currency) {
                     //var_dump($order);
                     $amount += $order_total_in_order_default_currency;
                 } else {
                     $all_orders_are_in_main_currency = false;
                     $total = modApiFunc('Currency_Converter', 'convert', $order_total_in_order_default_currency, $order_default_currency, $main_store_currency);
                     $amount += $total;
                 }
             }
             $main_store_currency_id = modApiFunc("Localization", "getMainStoreCurrency");
             modApiFunc("Localization", "pushDisplayCurrency", $main_store_currency_id, $main_store_currency_id);
             $value = modApiFunc("Localization", "currency_format", $amount);
             modApiFunc("Localization", "popDisplayCurrency");
             if ($all_orders_are_in_main_currency == false) {
                 $value = "~" . $value;
             }
             break;
         case 'ResultTaxTotal':
             break;
         case 'ResultFullTaxExempt':
             break;
         case 'ResultTaxTotalMinusFullTaxExempt':
             $tax_summary = $this->__getTaxSummary();
             $value = $tax_summary[$tag];
             break;
         case 'Items':
             $value = $this->getOrders();
             break;
         case 'OrderStatusSelector':
             $value = '<select class="form-control input-sm input-small" name="status_id[' . $this->_order['IdInt'] . ']" onchange="onStatusChanged(' . $this->_order['IdInt'] . ')">';
             if (!isset($this->OrderStatusList)) {
                 $this->OrderStatusList = modApiFunc('Checkout', 'getOrderStatusList');
             }
             foreach ($this->OrderStatusList as $status) {
                 $value .= '<option value="' . $status['id'] . '" ' . ($status['id'] == $this->_order['StatusId'] ? " selected" : "") . '>' . $status['name'] . '</option>';
             }
             $value .= '</select>';
             break;
         case 'OrderIdLinkTitle':
             $value = $this->MessageResources->getMessage('ORDERS_RESULTS_ORDER_ID_LINK_TITLE');
             break;
         case 'OrderCustomerNameLinkTitle':
             $value = $this->MessageResources->getMessage('ORDERS_RESULTS_ORDER_CUSTOMER_NAME_LINK_TITLE');
             break;
         case 'OrderPaymentStatusSelector':
             $value = '<select class="form-control input-sm input-small" name="payment_status_id[' . $this->_order['IdInt'] . ']" onchange="onStatusChanged(' . $this->_order['IdInt'] . ')">\\n';
             if (!isset($this->OrderPaymentStatusList)) {
                 $this->OrderPaymentStatusList = modApiFunc('Checkout', 'getOrderPaymentStatusList');
             }
             foreach ($this->OrderPaymentStatusList as $status) {
                 $this->_payment_status = $status;
                 $value .= '<option value="' . $status['id'] . '" ' . ($status['id'] == $this->_order['PaymentStatusId'] ? ' selected' : '') . '>' . $status['name'] . '</option>';
             }
             $value .= '</select>';
             break;
         case 'SearchOrders':
             $value = $this->TemplateFiller->fill("checkout/orders/", "search.tpl.html", array());
             break;
         case 'SearchBy':
             if ($this->_filter['search_by'] == 'status') {
                 $msg = "";
                 switch ($this->_filter['filter_status_id']) {
                     case 0:
                         $msg = $this->MessageResources->getMessage('ORDERS_SEARCH_ALL');
                         break;
                     case 1:
                         $msg = $this->MessageResources->getMessage('ORDERS_SEARCH_NEW_ORDERS');
                         break;
                     case 2:
                         $msg = $this->MessageResources->getMessage('ORDERS_SEARCH_IN_PROGRESS');
                         break;
                     case 3:
                         $msg = $this->MessageResources->getMessage('ORDERS_SEARCH_READY_TO_SHIP');
                         break;
                 }
                 $value = $msg;
             } elseif ($this->_filter['search_by'] == 'date') {
                 $value = $this->MessageResources->getMessage('ORDERS_SEARCH_FILTER');
             } elseif ($this->_filter['search_by'] == 'id') {
                 $value = $this->MessageResources->getMessage('ORDERS_SEARCH_ORDER_ID');
             }
             break;
         case 'SearchResults':
             if (count($this->_orders) == 0) {
                 $value = modApiFunc('TmplFiller', 'fill', "checkout/orders/", "empty.tpl.html", array());
             } else {
                 $value = $this->TemplateFiller->fill("checkout/orders/", "results.tpl.html", array());
             }
             break;
         case 'HighLightAll':
             if ($this->_filter['search_by'] == 'status' && $this->_filter['filter_status_id'] == 0) {
                 $value = "color: blue;";
             }
             break;
         case 'HighLightNewOrders':
             if ($this->_filter['search_by'] == 'status' && $this->_filter['filter_status_id'] == 1) {
                 $value = "color: blue;";
             }
             break;
         case 'HighLightInProgress':
             if ($this->_filter['search_by'] == 'status' && $this->_filter['filter_status_id'] == 2) {
                 $value = "color: blue;";
             }
             break;
         case 'HighLightReadyToShip':
             if ($this->_filter['search_by'] == 'status' && $this->_filter['filter_status_id'] == 3) {
                 $value = "color: blue;";
             }
             break;
         case 'HighLightDate':
             if ($this->_filter['search_by'] == 'date') {
                 $value = "color: blue;";
             }
             break;
         case 'HighLightDateOrderStatus':
             if ($this->_filter['search_by'] == 'date' && isset($this->_filter['order_statuses'])) {
                 $value = "color: blue;";
             }
             break;
         case 'HighLightDateOrderPaymentStatus':
             if ($this->_filter['search_by'] == 'date' && isset($this->_filter['payment_statuses'])) {
                 $value = "color: blue;";
             }
             break;
         case 'HighLightOrderId':
             if ($this->_filter['search_by'] == 'id') {
                 $value = "color: blue;";
             }
             break;
         case 'HighLightAffiliateId':
             if ($this->_filter['search_by'] == 'date' && !empty($this->_filter['affiliate_id'])) {
                 $value = "style='color: blue;font-weight:bold;'";
             }
             break;
         case 'SearchingOrderId':
             $value = "";
             if ($this->_filter['search_by'] == 'id' && !empty($this->_filter['order_id'])) {
                 $value = $this->_filter['order_id'];
             }
             break;
         case 'DeleteOrdersLink':
             $request = new Request();
             $request->setView('DeleteOrders');
             $request->setAction('SetOrdersForDeleteAction');
             $value = $request->getURL();
             break;
         case 'PaginatorLine':
             $obj =& $application->getInstance($tag);
             $value = $obj->output("Checkout_Orders", "Orders");
             break;
             #                               PaginatorRows
         #                               PaginatorRows
         case 'PaginatorRows':
             $obj =& $application->getInstance($tag);
             $value = $obj->output("Checkout_Orders", 'Orders', 'PGNTR_ORD_ITEMS');
             break;
         case 'ResultMessageRow':
             $value = $this->outputResultMessage();
             break;
         case 'ResultMessage':
             $value = $this->_Template_Contents['ResultMessage'];
             break;
         case 'PackingSlipLink':
             $request = new Request();
             $request->setView('OrderPackingSlip');
             $request->setAction('SetCurrentOrder');
             $request->setKey('order_id', $this->_order['IdInt']);
             // uncomment the following link to force printing
             // $request -> setKey('do_print', 'Y');
             $value = $request->getURL();
             break;
         case 'InvoiceLink':
             $request = new Request();
             $request->setView('OrderInvoice');
             $request->setAction('SetCurrentOrder');
             $request->setKey('order_id', $this->_order['IdInt']);
             // uncomment the following link to force printing
             // $request -> setKey('do_print', 'Y');
             $value = $request->getURL();
             break;
         case 'AffiliateIDSearch':
             $v = isset($this->_filter['affiliate_id']) ? $this->_filter['affiliate_id'] : "";
             $value = "<input type='text' name='affiliate_id' size='28' class='form-control form-filter input-sm' value='" . $v . "' />";
             break;
         default:
             list($entity, $tag) = getTagName($tag);
             if ($entity == 'order') {
                 if (_ml_strpos($tag, 'price') === 0) {
                     $tag = _ml_strtolower(_ml_substr($tag, _ml_strlen('price')));
                     if ($tag == 'total') {
                         $value = $this->_order['Total'];
                         if ($this->_order['TotalInMainStoreCurrency'] !== NULL) {
                             $value = $this->_order['TotalInMainStoreCurrency'] . ' (' . $value . ')';
                         }
                     } elseif ($tag == 'subtotal') {
                         $value = $this->_order['Subtotal'];
                     } else {
                         if ($tag == 'taxes') {
                             $full_tax_exempt_orders = $this->__getFullTaxExemptOrders();
                             $code = $this->_fetched_orders[$this->_order['IdInt']]["order_currencies_list"]["CURRENCY_TYPE_MAIN_STORE_CURRENCY"]["currency_code"];
                             $value = $this->_fetched_orders[$this->_order['IdInt']]["price_total"][$code]["order_tax_total"];
                             $crcy_id = modApiFunc("Localization", "getCurrencyIdByCode", $code);
                             modApiFunc("Localization", "pushDisplayCurrency", $crcy_id, $crcy_id);
                             $value = modApiFunc("Localization", "currency_format", $value);
                             $null_value = modApiFunc("Localization", "currency_format", "0.0000");
                             modApiFunc("Localization", "popDisplayCurrency");
                             if (array_key_exists($this->_order['IdInt'], $full_tax_exempt_orders)) {
                                 $value = $null_value . " (ex. {$value})";
                             }
                         } else {
                             $prices = getKeyIgnoreCase('price', $this->_order);
                             $value = $prices[$tag];
                         }
                     }
                 } elseif (_ml_strpos($tag, 'customer') === 0) {
                     $tag = _ml_strtolower(_ml_substr($tag, _ml_strlen('customer')));
                     switch ($tag) {
                         case 'name':
                             $value = $this->_order['PersonName'];
                             break;
                         case 'id':
                             $value = $this->_order['PersonId'];
                             break;
                         case 'infoname':
                             $value = $this->_order['PersonInfoName'];
                             break;
                     }
                 } else {
                     $value = getKeyIgnoreCase($tag, $this->_order);
                 }
             }
             break;
     }
     return $value;
 }
Example #28
0
 function isValidStringMinLength($value, $len)
 {
     return Validator::isNotEmpty($value) and _ml_strlen($value) >= $len;
 }
 /**
  * @ describe the function OrderInfo->.
  */
 function getTag($tag)
 {
     global $application;
     $value = null;
     switch ($tag) {
         case 'CustomerInfo':
             $value = $this->getCustomerInfo();
             break;
         case 'BillingInfo':
             $value = $this->getBillingInfo();
             break;
         case 'ShippingInfo':
             $value = $this->getShippingInfo();
             break;
         case 'CreditCardInfo':
             $value = $this->getCreditCardInfo();
             break;
         case 'Orders':
             $value = $this->getOrders();
             break;
         case 'LastOrderId':
             $value = $this->_customer['ID'];
             break;
         case 'CHECKOUT_ORDER_INFO_REMOVE_ENCRYPTED_PERSON_INFO_MSG':
         case 'CHECKOUT_ORDER_INFO_REMOVE_ENCRYPTED_PERSON_INFO_CONFIRM_MSG':
             $value = $this->_msg[$tag];
             break;
         default:
             list($entity, $tag) = getTagName($tag);
             if ($entity == 'group') {
                 $value = getKeyIgnoreCase($tag, $this->_group);
             } elseif ($entity == 'attribute') {
                 $value = getKeyIgnoreCase($tag, $this->_attr);
             } elseif ($entity == 'order') {
                 if (_ml_strpos($tag, 'price') === 0) {
                     $tag = _ml_strtolower(_ml_substr($tag, _ml_strlen('price')));
                     if ($tag == 'total') {
                         $value = $this->_order['Total'];
                     } elseif ($tag == 'subtotal') {
                         $value = $this->_order['Subtotal'];
                     } else {
                         $prices = getKeyIgnoreCase('price', $this->_order);
                         $value = getKeyIgnoreCase($tag, $prices);
                     }
                 } elseif (_ml_strpos($tag, 'customer') === 0) {
                     $tag = _ml_strtolower(_ml_substr($tag, _ml_strlen('customer')));
                     $customer = getKeyIgnoreCase('customer', $this->_order);
                     $value = $customer['attr'][$tag]['value'];
                 } else {
                     $value = getKeyIgnoreCase($tag, $this->_order);
                 }
             }
             break;
     }
     return $value;
 }
 /**
  * Validates the user input. It check "Meta Keywords" and "Meta Description".
  */
 function isValidMetaField($data)
 {
     $retval = _ml_strlen(trim($data)) <= 1024;
     return $retval;
 }