本文整理汇总了PHP中_ml_strpos函数的典型用法代码示例。如果您正苦于以下问题:PHP _ml_strpos函数的具体用法?PHP _ml_strpos怎么用?PHP _ml_strpos使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了_ml_strpos函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: output
/**
*
*/
function output()
{
global $application;
ob_start();
phpinfo(1);
$content = ob_get_contents();
ob_end_clean();
$flag = true;
while ($flag) {
$pos = _ml_strpos($content, "\n");
$line = _ml_substr($content, 0, $pos);
$content = _ml_substr($content, $pos + 1);
if (_ml_strpos($line, "System")) {
$line = _ml_substr($line, 0, _ml_strrpos($line, "<"));
$line = _ml_substr($line, 0, _ml_strrpos($line, "<"));
$line = _ml_substr($line, _ml_strrpos($line, ">") + 1);
$flag = false;
}
}
$OS = $line;
$request = new Request();
$request->setView('PHPInfo');
$link = $request->getURL();
global $db_link;
$template_contents = array("ProductVersion" => PRODUCT_VERSION_NUMBER, "ProductVersionType" => PRODUCT_VERSION_TYPE, "ProductReleaseDate" => PRODUCT_VERSION_DATE, "CoreVersion" => CORE_VERSION, "ModulesList" => $this->outputModules(), "phpVersion" => PHP_VERSION, "MySQLVersion" => mysqli_get_server_info($db_link), "ServerOS" => $OS, "WebServerVersion" => $_SERVER["SERVER_SOFTWARE"], "PHPInfoLink" => $link);
$this->_Template_Contents = $template_contents;
$application->registerAttributes($this->_Template_Contents);
return modApiFunc('TmplFiller', 'fill', "tools/server_info/", "container.tpl.html", array());
}
示例2: addTableToLock
/**
* Adds the table to the locked ones.
* : check and describe return. See db_select.php
*
* @return alias of added or already existed record (?)
* @param string $table_name table name
* @param string $locking_mode locking mode
* @param string $table_alias alias of the table name
*/
function addTableToLock($table_name, $locking_mode, $table_alias = '')
{
global $application;
$table_prefix = $application->getAppIni('DB_TABLE_PREFIX');
if ($table_prefix != NULL) {
if (_ml_strpos($table_name, $table_prefix) === false) {
$table_name = $table_prefix . $table_name;
}
}
foreach ($this->TablesToLock as $t_name => $t_info) {
if ($t_info['alias'] == $table_name) {
return $table_alias;
}
}
//else : new table name is not a previously added -alias-
//Check if table is already added
if (!array_key_exists($table_name, $this->TablesToLock)) {
foreach ($this->TablesToLock as $t_name => $t_info) {
if ($t_info['alias'] == $table_alias && $table_alias != '') {
user_error('Attempt to assign the same alias "' . $talbe_alias . '" to two different tables:"' . $t_name . '" and "' . $table_name . '".', E_USER_ERROR);
}
}
//else : new table alias is not a previously added -table-alias-
$this->TablesToLock[$table_name] = array("locking_mode" => $locking_mode, "alias" => $table_alias);
} else {
return $this->TablesToLock[$table_name]['alias'];
}
//: move this return to line "$this->TablesToLock[$table_name] = ..."?
return $table_alias;
}
示例3: outputLabelData
/**
* Outputs label information
*/
function outputLabelData($Label_Data, $lng)
{
global $application;
$template_contents = array('LabelName' => _ml_substr($Label_Data['label'], 0, 7) != 'CUSTOM_' ? $Label_Data['sh_label'] : 'CUSTOM_', 'LabelZone' => $Label_Data['zone'], 'LabelType' => $Label_Data['module_name'], 'LabelUsage' => htmlspecialchars($Label_Data['usage']), 'LabelUsageText' => htmlspecialchars(_ml_substr($Label_Data['usage'], 0, _ml_strpos($Label_Data['usage'], '\'CUSTOM_') + 8)), 'LabelStatus' => $Label_Data['status'], 'Language' => $this->outputLanguage($lng), 'DefLanguage' => $this->outputDefaultLanguage(), 'CustomName' => $this->outputCustomNameField($Label_Data), 'LabelValue' => $this->outputLabelValue($Label_Data, $lng), 'LabelDefValue' => $this->outputLabelDefValue($Label_Data));
$this->_Template_Contents = $template_contents;
$application->registerAttributes($this->_Template_Contents);
return $this->mTmplFiller->fill('multilang/label_data/', 'label-data.tpl.html', array());
}
示例4: onAction
/**
*
*/
function onAction()
{
global $application;
CCacheFactory::clearAll();
modApiFunc("Tools", "clearBackupSession");
modApiFunc("Tools", "setDBStat", modApiFunc("Modules_Manager", "getTablesAndRecordsCount"));
modApiFunc("Tools", "setCurrentBackupTable", 0);
modApiFunc("Tools", "setCurrentBackupTableLimit", 0);
modApiFunc("Tools", "setDBRecordsExported", 0);
$request = $application->getInstance('Request');
$filename = $request->getValueByKey('BackupFile');
if ($filename) {
modApiFunc("Tools", "setRestoreStatus", 'BACKUP');
modApiFunc("Tools", "setRestoreFile", $filename);
$filename = modApiFunc("Tools", "getRestoreFile");
$full_filename = $application->getAppIni('PATH_BACKUP_DIR') . $filename . "/dump.sql";
$handle = @fopen($full_filename, "rb");
$backup_file_content = @fread($handle, 1024);
@fclose($handle);
$error = "";
$backup_info = @_parse_ini_file($application->getAppIni('PATH_BACKUP_DIR') . $filename . "/info/backup.ini");
if (!isset($backup_info["asc_version"]) || $backup_info["asc_version"] != PRODUCT_VERSION) {
$error = "BCP_RESTORE_ERR_003";
} elseif (!$backup_file_content) {
$error = "BCP_RESTORE_ERR_001";
} elseif (_ml_strpos($backup_file_content, "-- HASH: ") === false) {
$error = "BCP_RESTORE_ERR_002";
} else {
$hash = _byte_substr($backup_file_content, 9, 32);
//
$handle = fopen($full_filename, "rb");
$md5_temp = '';
//
$begin = _byte_strpos($backup_file_content, "\n") + _byte_strlen("\n");
fseek($handle, $begin);
while (!feof($handle)) {
$contents = fread($handle, 1048576);
$md5_temp .= md5($contents);
}
$counted_file_hash = md5($md5_temp);
fclose($handle);
// :
if ($hash != $counted_file_hash) {
$error = "BCP_RESTORE_ERR_002";
}
}
if ($error) {
modApiFunc("Tools", "setRestoreError", $error);
} else {
modApiFunc("Tools", "setStringsCountInRestoreFile", $filename);
}
}
modApiFunc("Tools", "saveState");
}
示例5: onAction
/**
* Sets current product sort field from Request.
*
* Action: SetProductListSortField
*/
function onAction()
{
global $application;
$request = $application->getInstance('Request');
// field ,
$field = $request->getValueByKey('field');
$direction = SORT_DIRECTION_ASC;
if (_ml_strpos($field, ',') !== false) {
$list = array_map('trim', explode(',', $field));
$field = @$list[0];
$direction = @$list[1];
}
if ($field != NULL) {
modApiFunc('CProductListFilter', 'changeCurrentSortField', $field, $direction);
}
}
示例6: savePostedData
function savePostedData($data)
{
if (!is_array($data)) {
return;
}
foreach ($data as $k => $v) {
$params = array();
if (in_array(@$v['status'], array('A', 'H', 'D'))) {
$params['status'] = $v['status'];
}
if (in_array(@$v['availability'], array('A', 'R', 'C'))) {
$params['availability'] = $v['availability'];
}
if (isset($v['parent_id']) && ($v['parent_id'] == 0 || _ml_strpos('/' . modApiFunc('CMS', 'getPagePath', $v['parent_id']), '/' . $k . '/') === false)) {
$params['parent_id'] = $v['parent_id'];
}
if (!empty($params)) {
$params['page_id'] = $k;
execQuery('UPDATE_CMS_PAGE_DATA', $params);
}
}
}
示例7: onAction
/**
*
*
* Action:
*
* @ finish the functions on this page
*/
function onAction()
{
global $application;
$request = $application->getInstance('Request');
$selected_admins = $request->getValueByKey('selected_admins');
// . - .
// - Delete
$removable_admins = array();
$unremovable_admins = array();
foreach ($selected_admins as $index => $admin_id) {
if (!is_numeric($admin_id) || (int) $admin_id == 0) {
continue;
} else {
$admin_id = (int) $admin_id;
}
$results_array = modApiFunc('EventsManager', 'processEvent', 'RemoveAdmin', $admin_id);
$res_msg = "";
foreach ($results_array as $msg) {
if ($msg !== NULL) {
// - . .
if (_ml_strpos($res_msg, $msg) === FALSE) {
$res_msg .= $msg . "\n";
}
}
}
if ($res_msg == "") {
// - .
$removable_admins[] = $admin_id;
} else {
// - . .
$unremovable_admins[] = array("id" => $admin_id, "msg" => $res_msg);
}
}
$res = array("removable_admins" => $removable_admins, "unremovable_admins" => $unremovable_admins);
modApiFunc("Users", "setDeleteAdminMembersID", $res);
}
示例8: _find_header_columns
function _find_header_columns($arr, $check = false)
{
// returns false if not an array
if (!is_array($arr) || empty($arr)) {
return false;
}
// building the array of fields
$result = array('labeltype' => -1, 'labelname' => -1);
// getting the active languages
$lngs = modApiFunc('MultiLang', 'getLanguageList', false);
if (!is_array($lngs) || empty($lngs)) {
$lngs = array(0 => array('lng' => 'default', 'lng_name' => getMsg('ML', 'ML_DEFAULT')));
}
// adding the languages to the list of fields
foreach ($lngs as $v) {
$result[$v['lng']] = -1;
$lngs[$v['lng']] = $v;
}
// finding the column indexes in the $arr
$found = array();
foreach ($result as $key => $value) {
switch ($key) {
case 'labeltype':
case 'labelname':
foreach ($arr as $k => $v) {
if (in_array($k, $found)) {
continue;
}
if (_ml_strpos(_ml_strtolower(str_replace(array(' ', '_', '(', ')'), '', $v)), $key) !== false) {
$result[$key] = $k;
$found[$k] = $k;
break;
}
}
break;
default:
foreach ($arr as $k => $v) {
if (in_array($k, $found)) {
continue;
}
if (_ml_strpos(_ml_strtolower(str_replace(array(' ', '_', '(', ')'), '', $v)), 'labelvalue') !== false) {
if (_ml_strpos(' ' . _ml_strtolower(str_replace(array(' ', '_', '(', ')'), ' ', $v)) . ' ', ' ' . _ml_strtolower($key) . ' ') !== false || _ml_strpos(_ml_strtolower($v), _ml_strtolower($lngs[$key]['lng_name'])) !== false) {
$result[$key] = $k;
$found[$k] = $k;
break;
}
}
}
break;
}
}
if ($check) {
if ($result['labeltype'] >= 0 && $result['labelname'] >= 0) {
return true;
}
return false;
}
return $result;
}
示例9: getTag
//.........这里部分代码省略.........
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' : '') . '> ' . $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;
}
示例10: outputForbidden
/**
* Outputs Forbidden Template
* use case: customer is anonyous while posting a review
* is available for signed-in customers
*/
function outputForbidden()
{
global $application;
$return_url = modApiFunc('Request', 'selfURL');
if (_ml_strpos($return_url, '#') !== false) {
$return_url = _ml_substr($return_url, _ml_strpos($return_url, '#'));
}
$return_url .= '#add_review_' . $this->_product_data['product_id'];
$r = new Request();
$r->setView(CURRENT_REQUEST_URL);
$r->setAction('sign_in_required');
$r->setKey('returnURL', urlencode($return_url));
$_tags = array('Local_SignInURL' => $r->getURL());
$this->_Template_Contents = $_tags;
$application->registerAttributes($this->_Template_Contents);
return $this->mTmplFiller->fill($this->_templates['forbidden']);
}
示例11: onAction
/**
* Action: AddCat.
*
* Adds a new category record to the DB, or saves current form state
* parameters, like uploaded image names etc.
* <p> Subactions are
* <ul>
* <li>"UploadImages"</li>
* <li>"DeleteSmallImage"</li>
* <li>"DeleteLargeImage"</li>
* <li>"Save"</li>
* </ul>
* The main action is "Save". Any other subaction may occur 0 or any number
* of times. Subactions change the "View State".
*/
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;
$this->initData($SessionPost);
switch ($request->getValueByKey('FormSubmitValue')) {
case "UploadImages":
$this->uploadImages($SessionPost);
break;
case "DeleteSmallImage":
$image = $SessionPost['ViewState']['SmallImage'];
// if it was a temporary file, delete it from the general catalog.
if (_ml_strpos(basename($image), 'tmp') === 0) {
$images_dir = $application->getAppIni('PATH_IMAGES_DIR');
@unlink($images_dir . basename($image));
}
// delete it from the user interface
$SessionPost["ViewState"]["SmallImage"] = "";
break;
case "DeleteLargeImage":
$image = $SessionPost['ViewState']['LargeImage'];
// if it was a temporary file, delete it from the general catalog.
if (_ml_strpos(basename($image), 'tmp') === 0) {
$images_dir = $application->getAppIni('PATH_IMAGES_DIR');
@unlink($images_dir . basename($image));
}
// delete it from the user interface
$SessionPost["ViewState"]["LargeImage"] = "";
break;
case "UploadImagesAndSave":
$nErrors = 0;
$SessionPost["ViewState"]["ErrorsArray"] = array();
$this->uploadImages($SessionPost);
loadCoreFile('html_form.php');
$HtmlForm1 = new HtmlForm();
$error_message_text = "";
if (!$this->isValidCatName($SessionPost["Subcategory"], $error_message_text)) {
$nErrors++;
$SessionPost["ViewState"]["ErrorsArray"]["Subcategory"] = new ActionMessage(array("ERR_AZ_CAT_ADDCAT_005"));
//"ERR_AZ_CAT_ADDCAT_001";
// $SessionPost["Subcategory"] .= "<ERROR: Invalid input. See error list.>";
}
if (!$this->isValidCatStatus($SessionPost["CategoryStatus"], $error_message_text)) {
$nErrors++;
$SessionPost["ViewState"]["ErrorsArray"]["CategoryStatus"] = new ActionMessage(array("ERR_AZ_CAT_ADDCAT_008"));
$SessionPost["CategoryStatus"] = CATEGORY_STATUS_ONLINE;
}
if (!$this->isValidCatShowProductsRecursivelyStatus($SessionPost["CategoryShowProductsRecursivelyStatus"], $error_message_text)) {
$nErrors++;
$SessionPost["ViewState"]["ErrorsArray"]["CategoryShowProductsRecursivelyStatus"] = new ActionMessage(array("ERR_AZ_CAT_ADDCAT_009"));
$SessionPost["CategoryShowProductsRecursivelyStatus"] = CATEGORY_DONOTSHOW_PRODUCTS_RECURSIVELY;
}
if (!$this->isValidImageDescription($SessionPost["ImageDescription"], $error_message_text)) {
$nErrors++;
$SessionPost["ViewState"]["ErrorsArray"]["ImageDescription"] = new ActionMessage(array("ERR_AZ_CAT_ADDCAT_006"));
//"ERR_AZ_CAT_ADDCAT_001";
// $SessionPost["Subcategory"] .= "<ERROR: Invalid input. See error list.>";
}
if (!$this->isValidPageTitle($SessionPost["PageTitle"], $error_message_text)) {
$nErrors++;
$SessionPost["ViewState"]["ErrorsArray"][] = $SessionPost["ViewState"]["ErrorsArray"]["PageTitle"] = new ActionMessage(array("ERR_AZ_CAT_ADDCAT_007"));
// $SessionPost["ViewState"]["ErrorsArray"][] = "ERR_AZ_CAT_ADDCAT_002";
// $SessionPost["PageTitle"] .= "<ERROR: Invalid input. See error list.>";
}
if (!$this->isValidMetaField($SessionPost["MetaKeywords"], $error_message_text)) {
$nErrors++;
$SessionPost["ViewState"]["ErrorsArray"]["MetaKeywords"] = new ActionMessage(array("ERR_AZ_CAT_ADDCAT_003"));
//"ERR_AZ_CAT_ADDCAT_003";
}
if (!$this->isValidMetaField($SessionPost["MetaDescription"], $error_message_text)) {
$nErrors++;
$SessionPost["ViewState"]["ErrorsArray"][] = $SessionPost["ViewState"]["ErrorsArray"]["MetaDescription"] = new ActionMessage(array("ERR_AZ_CAT_ADDCAT_004"));
//"ERR_AZ_CAT_ADDCAT_004";
}
$nErrors = sizeof($SessionPost["ViewState"]["ErrorsArray"]);
if ($nErrors == 0) {
unset($SessionPost["ViewState"]["ErrorsArray"]);
$this->saveDataToDB($SessionPost);
$SessionPost["ViewState"]["hasCloseScript"] = "true";
}
//.........这里部分代码省略.........
示例12: getDirectorySize
function getDirectorySize($d = null)
{
global $application;
if ($d == null) {
$path = $application->getAppINI('PATH_CACHE_DIR');
} else {
$path = $d;
}
$totalsize = 0;
if ($handle = opendir($path)) {
while (false !== ($file = readdir($handle))) {
$nextpath = $path . '/' . $file;
if ($file != '.' && $file != '..' && !is_link($nextpath) && is_file($nextpath) && _ml_strpos($file, '_cache') === 0) {
$totalsize += filesize($nextpath);
} else {
if ($file != '.' && $file != '..' && !is_link($nextpath) && is_dir($nextpath)) {
$totalsize += $this->getDirectorySize($nextpath);
}
}
}
}
closedir($handle);
return $totalsize;
}
示例13: getTag
/**
* @ describe the function ViewCategory->getTag.
*/
function getTag($tag)
{
global $application;
$value = null;
$CatID = $this->_Current_Category->getCategoryTagValue('ID');
switch ($tag) {
case 'Breadcrumb':
$obj =& $application->getInstance('Breadcrumb');
$value = $obj->output(false);
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;
}
示例14: addOrderPerson
/**
* Adds a Custoner (List Person) to this order.
* It is used, for example, to save unregistered customers.
* A separate record is not created in the table persons.
*
* @
* @param
* @return
*/
function addOrderPerson($order_id)
{
global $application;
$tables = $this->getTables();
$ptiv = $tables["person_to_info_variants"]['columns'];
$opd = $tables["order_person_data"]['columns'];
$data = $this->getPrerequisitesValidationResults();
$payment_module_id = modApiFunc("Checkout", "getChosenPaymentModuleIdCZ");
$required_cc_info_prerequisite_name = Checkout::getAdditionalPrerequisiteName("creditCardInfo", $payment_module_id);
$required_bank_account_info_prerequisite_name = Checkout::getAdditionalPrerequisiteName("bankAccountInfo", $payment_module_id);
loadCoreFile('db_multiple_insert.php');
$query = new DB_Multiple_Insert('order_person_data');
$query->setInsertFields(array('order_id', 'person_info_variant_id', 'person_attribute_id', 'order_person_data_name', 'order_person_data_value', 'order_person_data_description', 'order_person_data_b_encrypted', 'order_person_data_encrypted_secret_key', 'order_person_data_rsa_public_key_asc_format'));
foreach ($data as $prerequisite_key => $info) {
if (_ml_strpos($prerequisite_key, "Module") || $prerequisite_key == 'subscriptionTopics') {
//"shippingModuleAndMethod","paymentModule"
} else {
if (_ml_strpos($prerequisite_key, "creditCardInfo") !== FALSE) {
/**
* Define, if this creditCardInfo instance matches
* the selected payment module.
* If it does, then write it to the DB. Make two instances:
* 1. not encrypted obfuscaed one
* 2. not obfuscated encrypted one.
*/
if ($prerequisite_key == $required_cc_info_prerequisite_name) {
/*
Ask the payment module, if it has to store Credit Card Info
in the database, or it won't be used after creating the order.
*/
$mInfo = Checkout::getPaymentModuleInfo($payment_module_id);
$mmObj =& $application->getInstance('Modules_Manager');
$mmObj->includeAPIFileOnce($mInfo["APIClassName"]);
/* This condition can be checked only after loading */
if (is_callable(array($mInfo["APIClassName"], "storeCreditCardInfoInDB"))) {
$b_storeCreditCardInfoInDB = call_user_func(array($mInfo["APIClassName"], 'storeCreditCardInfoInDB'));
if ($b_storeCreditCardInfoInDB === true) {
$symmetric_secret_key = modApiFunc("Crypto", "blowfish_gen_blowfish_key");
$rsa_public_key = modApiFunc("Payment_Module_Offline_CC", "getRSAPublicKeyInCryptRSAFormat");
$rsa_public_key_asc_format = modApiFunc("Payment_Module_Offline_CC", "getRSAPublicKeyInASCFormat");
$rsa_obj = new Crypt_RSA();
$encrypted_symmetric_secret_key = $rsa_obj->encrypt($symmetric_secret_key, $rsa_public_key);
//Decrypt data in the session
$this->decrypt_prerequisite_with_checkout_cz_blowfish_key($prerequisite_key);
$decrypted_data = $this->getPrerequisitesValidationResults();
$info = $decrypted_data[$prerequisite_key];
//Encrypt data in the session
$this->encrypt_prerequisite_with_checkout_cz_blowfish_key($prerequisite_key);
$person_info_variant_id = $this->getPersonInfoVariantId($prerequisite_key, $info['variant_tag']);
//Encrypt data in the session
foreach ($info["validatedData"] as $attribute_key => $validatedData) {
$attribute_id = $validatedData["id"];
$attribute_visible_name = $validatedData["attribute_visible_name"];
if ($attribute_key == "CreditCardType") {
$cc_type_names = modApiFunc("Configuration", "getCreditCardSettings");
$attribute_value = $cc_type_names[$validatedData["value"]]["name"];
} else {
$attribute_value = $validatedData["value"];
}
$attribute_description = $validatedData["attribute_description"];
// add the not encrypted obfuscated value
$b_encrypted = "0";
$i_arr = array('order_id' => $order_id, 'person_info_variant_id' => $person_info_variant_id, 'person_attribute_id' => $attribute_id, 'order_person_data_name' => $attribute_visible_name, 'order_person_data_value' => $this->get_public_view_of_secured_data($attribute_value, $attribute_id), 'order_person_data_description' => $attribute_description, 'order_person_data_b_encrypted' => $b_encrypted, 'order_person_data_encrypted_secret_key' => $encrypted_symmetric_secret_key, 'order_person_data_rsa_public_key_asc_format' => $rsa_public_key_asc_format);
$query->addInsertValuesArray($i_arr);
// add the not obfuscated encrypted value
$i_arr['order_person_data_b_encrypted'] = "1";
$i_arr['order_person_data_value'] = base64_encode($this->encryptOrderPersonAttribute($attribute_value, $symmetric_secret_key));
$query->addInsertValuesArray($i_arr);
}
}
}
}
} else {
// , ,
// , ,
// .
if (_ml_strpos($prerequisite_key, "bankAccountInfo") !== FALSE && $required_bank_account_info_prerequisite_name != $prerequisite_key) {
//BankAccountInfo,
} else {
$person_info_variant_id = $this->getPersonInfoVariantId($prerequisite_key, $info['variant_tag']);
// add to the table order_person_data
foreach ($info["validatedData"] as $attribute_key => $validatedData) {
if ($attribute_key == "Statemenu" || $attribute_key == "Statetext") {
//An attribute "state" from the DB matches two attributes
// state_menu and state_text in the session. They are mutually exclussive in meaning:
// state_menu is the ID of the record about the state in the DB, i.e.
// a number. sate_text is a state name, inputted manually by a customer.
// It is inputted only if the customer selected a country, which has no
// defined states in the DB. As for now (Dec 2005) in the DB
// in the field "state" is saved only one of the values, which is not empty.
// Either sate_menu, or state_text.
//.........这里部分代码省略.........
示例15: getTag
/**
* @ 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;
}