function output($mode) { global $application; loadCoreFile('html_form.php'); $this->_prefix = _ml_strtolower($mode); $this->_Prefix = _ml_strtoupper($mode[0]) . _ml_substr($this->_prefix, 1); $this->_PREFIX = _ml_strtoupper($mode); $this->_messageResources =& Subscriptions::getMessageResources(); $this->_tmplFiller = new TmplFiller(dirname(dirname(__FILE__)) . '/templates_az/'); $this->initFormData(); $result = ''; //$action = modApiFunc('Request', 'getValueByKey', 'asc_action'); $action = @$this->POST['asc_action']; $has_errors = sizeof($this->ErrorsArray) > 0; $stage = modApiFunc('Request', 'getValueByKey', 'stage'); if (empty($stage)) { $result = $this->outputAskEmails(); } elseif ($stage == 'confirm') { $result = $this->outputAskConfirmation(); } elseif ($stage == 'finish') { // @ show errors if were modApiFunc("application", "closeChild_UpdateParent"); } return $result; }
function out_AttrsGroup($group_name) { global $application; $template_contents = array('GroupName' => getMsg('CA', 'PIG_' . _ml_strtoupper($group_name)), 'GroupAttrs' => $this->out_Attributes($group_name)); $this->_Template_Contents = $template_contents; $application->registerAttributes($this->_Template_Contents); $this->mTmplFiller =& $application->getInstance('TmplFiller'); return $this->mTmplFiller->fill("customer_account/export_customers/", "group-container.tpl.html", array()); }
/** * */ function outputBackupFilesList() { if (_ml_strtoupper(_ml_substr(PHP_OS, 0, 3)) === 'WIN') { $retval = modApiFunc('TmplFiller', 'fill', "tools/backup/", "item_win_os.tpl.html", array()); return $retval; } global $application; $retval = ""; $directory = $application->getAppIni('PATH_SYSTEM_DIR') . "backup/"; $n = 0; $backup_list = array(); if ($dir = dir($directory)) { while ($file = $dir->read()) { if (_ml_substr($file, _ml_strrpos($file, '.') + 1) == "abi") { $backup_file_name = _ml_substr($file, 0, _ml_strrpos($file, '.')); if (file_exists($directory . $backup_file_name . ".tar.gz")) { $backup_info = _parse_ini_file($directory . $backup_file_name . ".abi"); if (isset($backup_info["asc_version"]) && $backup_info["asc_version"] == PRODUCT_VERSION_NUMBER) { $request = new Request(); $request->setView('Downdoad'); $request->setKey('directory', 'backup'); $request->setKey('file', $backup_file_name . ".tar.gz"); $DownloadLink = $request->getURL(); $request = new Request(); $request->setView('AdminBackup'); $request->setAction('BackupDeleteAction'); $request->setKey('file', $backup_file_name); $DeleteFormAction = $request->getURL(); $this->_Template_Contents = array('BackupFileName' => $backup_file_name, 'DownloadLink' => $DownloadLink, 'InfoLink' => "", 'BackupFileDate' => modApiFunc("Localization", "timestamp_date_format", $backup_info['backup_date']) . " " . modApiFunc("Localization", "timestamp_time_format", $backup_info['backup_date']), 'BackupFileSize' => modApiFunc("Localization", "num_format", $backup_info['backup_file_size'] / 1024) . " Kb", 'N' => $n); $backup_list[] = $this->_Template_Contents; $n++; } } } } $dir->close(); } for ($i = sizeof($backup_list) - 1; $i >= 0; $i--) { $this->_Template_Contents = $backup_list[$i]; $application->registerAttributes($this->_Template_Contents); $retval .= modApiFunc('TmplFiller', 'fill', "tools/backup/", "item.tpl.html", array()); } if ($n == 0) { $retval .= modApiFunc('TmplFiller', 'fill', "tools/backup/", "item_na.tpl.html", array()); } $retval .= modApiFunc('TmplFiller', 'fill', "tools/backup/", "item_empty.tpl.html", array()); return $retval; }
/** * quoteadPrintableEncode() * * Encodes data to quoted-printable standard. * * @param $input The data to encode * @param $line_max Optional max line length. Should * not be more than 76 chars * * @access private */ function _quotedPrintableEncode($input, $line_max = 76) { $lines = preg_split("/\r?\n/", $input); $eol = MAIL_MIMEPART_CRLF; $escape = '='; $output = ''; while (list(, $line) = each($lines)) { $linlen = _byte_strlen($line); $newline = ''; for ($i = 0; $i < $linlen; $i++) { $char = _byte_substr($line, $i, 1); $dec = _byte_ord($char); if ($dec == 32 and $i == $linlen - 1) { // convert space at eol only $char = '=20'; } elseif ($dec == 9) { // Do nothing if a tab. } elseif ($dec == 61 or $dec < 32 or $dec > 126) { $char = $escape . _ml_strtoupper(sprintf('%02s', dechex($dec))); } if (_byte_strlen($newline) + _byte_strlen($char) >= $line_max) { // MAIL_MIMEPART_CRLF is not counted $output .= $newline . $escape . $eol; // soft line break; " =\r\n" is okay $newline = ''; } $newline .= $char; } // end of for $output .= $newline . $eol; } $output = _byte_substr($output, 0, -1 * _byte_strlen($eol)); // Don't want last crlf return $output; }
function outputOptionsList() { $return_html_code = ""; if (count($this->Options) > 0) { foreach ($this->Options as $key => $option_data) { $return_html_code .= $this->outputOneOption($option_data); } } else { $return_html_code .= "<div style='padding-top: 150px; padding-bottom: 150px;'>" . str_replace("%ENTITY_NAME%", $this->MessageResources->getMessage(_ml_strtoupper('entity_' . $this->parent_entity)), $this->MessageResources->getMessage('NO_OPTIONS_DEFINED')) . "</div>"; } return $return_html_code; }
/** * , xmsg, , * . */ function getMsg() { global $application; /* if($application === NULL) { // . $application . _fatal(array( "CODE" => "CORE_060"), __FUNCTION__); } */ $arg_list = func_get_args(); if (_ml_strtoupper($arg_list[0]) == 'SYS') { array_shift($arg_list); $obj =& $application->getInstance('MessageResources'); $output = $obj->getMessage(new ActionMessage($arg_list)); } else { $obj =& $application->getInstance('MessageResources', modApiFunc("Modules_Manager", "getResFileByShortName", $arg_list[0]), 'AdminZone', $arg_list[0]); array_shift($arg_list); $output = $obj->getMessage(new ActionMessage($arg_list)); } return $output; }
/** * */ function output() { global $application; $request = new Request(); $request->setView('LicenseInfo'); $request->setAction('UpdateLicenseKey'); $formAction = $request->getURL(); $_state = modApiFunc("License", "checkLicense"); $licenseInfo = modApiFunc("License", "getLicenseInfo", $_state); $cert = modApiFunc("License", "getCertificateData"); $retval = ''; #trying to update certificate automatically. if ($_state === STATE_3 || $_state === STATE_5) { // update certificate data in background $result = $this->updateCertificate(); if ($result !== "UPDATE_SUCCESS") { // update failed if ($result === "RESPONSE_5") { $_state = STATE_2; $licenseInfo = modApiFunc("License", "getLicenseInfo", $_state); modApiFunc('Session', 'un_set', 'ResultMessage'); // do not show message } } else { // update success $cert = modApiFunc("License", "getCertificateData"); if ($_state === STATE_5) { $_state = STATE_3; # if the certificate was updated/fixed succesfully, state should be STATE_3 $licenseInfo = modApiFunc("License", "getLicenseInfo", $_state); modApiFunc('Session', 'set', 'ResultMessage', $result); } } } if (is_array($cert) && !empty($cert) && $_state === STATE_3) { foreach ($cert as $fld_name => $fld_data) { if (is_array($fld_data) && $fld_data['visibility'] === 'visible') { // multilinguas support $fld_data['title'] = $this->MessageResources->isDefined('CERT_FLD_' . _ml_strtoupper($fld_name)) ? $this->MessageResources->getMessage('CERT_FLD_' . _ml_strtoupper($fld_name)) : $fld_data['title']; $fld_data['hint'] = $this->MessageResources->isDefined('CERT_FLD_' . _ml_strtoupper($fld_name) . '_DESCR') ? $this->MessageResources->getMessage('CERT_FLD_' . _ml_strtoupper($fld_name) . '_DESCR') : $fld_data['hint']; $obj =& $application->getInstance('Hint'); $hint = $obj->getHintLink(array(urlencode($fld_data['title']), urlencode($fld_data['hint']))); $tags = array('FieldName' => $fld_data['title'], 'FieldValue' => $fld_data['value'], 'FieldStyle' => $fld_data['style'], 'FieldHint' => $fld_data['hint'], 'FieldHintLink' => $hint); $this->_Template_Contents = $tags; $application->registerAttributes($tags); $retval .= modApiFunc('TmplFiller', 'fill', "license/license_info/", "license_field.tpl.html", array()); } } } else { if ($_state === STATE_2 || $_state === STATE_1 || $_state === STATE_4) { $template_contents = array("FormAction" => $formAction, "LicenseKey" => $licenseInfo["license_key"], "CurrentURL" => $licenseInfo["current_url"], "CurrentVersionType" => $licenseInfo["current_version_type"], "NewLicenseKey" => "", "HideRegisterButton" => $_state === STATE_1 ? "true" : "false", "Message" => $licenseInfo["license_message"] ? $licenseInfo['license_message'] : "", "ResultMessage" => $this->outputResultMessage()); $this->_Template_Contents = $template_contents; $application->registerAttributes($this->_Template_Contents); return modApiFunc('TmplFiller', 'fill', "license/license_info/", "container.tpl.html", array()); } else { if ($_state === STATE_5) { $template_contents = array("FormAction" => $formAction, "LicenseKey" => $licenseInfo["license_key"], "CurrentURL" => $licenseInfo["current_url"], "CurrentVersionType" => $licenseInfo["current_version_type"], "NewLicenseKey" => "", "Message" => $licenseInfo["license_message"] ? $licenseInfo['license_message'] : "", "ResultMessage" => $this->outputResultMessage()); $this->_Template_Contents = $template_contents; $application->registerAttributes($this->_Template_Contents); return modApiFunc('TmplFiller', 'fill', "license/license_info/", "state_5.tpl.html", array()); } else { // unknown state _fatal("unknown store state"); } } } $tags = array('CertificateData' => $retval, 'Message' => "", 'ResultMessage' => $this->outputResultMessage()); $this->_Template_Contents = $tags; $application->registerAttributes($tags); return modApiFunc('TmplFiller', 'fill', "license/license_info/", "registered_container.tpl.html", array()); }
/** * Crypt_Blowfish object factory * * This is the recommended method to create a Crypt_Blowfish instance. * * When using CRYPT_BLOWFISH_AUTO, you can force the package to ignore * the MCrypt extension, by defining CRYPT_BLOWFISH_NOMCRYPT. * * @param string $mode operating mode 'ecb' or 'cbc' (case insensitive) * @param string $key * @param string $iv initialization vector (must be provided for CBC mode) * @param integer $engine one of CRYPT_BLOWFISH_AUTO, CRYPT_BLOWFISH_PHP * or CRYPT_BLOWFISH_MCRYPT * @return object Crypt_Blowfish object or PEAR_Error object on error * @access public * @static * @since 1.1.0 */ function &factory($mode = 'ecb', $key = null, $iv = null, $engine = CRYPT_BLOWFISH_AUTO) { switch ($engine) { case CRYPT_BLOWFISH_AUTO: if (!defined('CRYPT_BLOWFISH_NOMCRYPT') && extension_loaded('mcrypt')) { $engine = CRYPT_BLOWFISH_MCRYPT; } else { $engine = CRYPT_BLOWFISH_PHP; } break; case CRYPT_BLOWFISH_MCRYPT: if (!PEAR::loadExtension('mcrypt')) { return PEAR::raiseError('MCrypt extension is not available.'); } break; } switch ($engine) { case CRYPT_BLOWFISH_PHP: $mode = _ml_strtoupper($mode); $class = 'Crypt_Blowfish_' . $mode; // include_once 'Crypt/Blowfish/' . $mode . '.php'; $crypt = new $class(null); break; case CRYPT_BLOWFISH_MCRYPT: // include_once 'Crypt/Blowfish/MCrypt.php'; $crypt = new Crypt_Blowfish_MCrypt(null, $mode); break; } if (!is_null($key) || !is_null($iv)) { $result = $crypt->setKey($key, $iv); if (PEAR::isError($result)) { return $result; } } return $crypt; }
function getStatusIdbyName($status_name, $is_payment = false) { if (!$is_payment) { $statuses = modApiFunc("Checkout", "getOrderStatusList"); } else { $statuses = modApiFunc("Checkout", "getOrderPaymentStatusList"); } foreach ($statuses as $id => $s) { $s['name'] = _ml_strtoupper(preg_replace("/ /", "", $s['name'])); if ($s['name'] == $status_name) { return $s['id']; } } return -1; }
function getTag($tag) { $value = null; switch ($tag) { case 'Local_PersonInfoShipping': case 'Local_PersonInfoBilling': $group_name = _ml_strtolower(str_replace('Local_PersonInfo', '', $tag)); $lang_suffix = _ml_strtoupper($group_name . '_info'); $this->current_info_group = array('name' => $group_name, 'lang_suffix' => $lang_suffix); $value = $this->templateFiller->fill('GroupHeader'); $value .= $this->out_CustomerInfoGroup(_ml_ucfirst($group_name)); break; case 'Local_KeyDetails': $this->current_info_group = array('name' => 'key', 'lang_suffix' => 'KEY_DETAILS'); $value = $this->templateFiller->fill('GroupHeader'); $value .= $this->out_KeyDetails(); break; case 'Local_ProductsDetails': $this->current_info_group = array('name' => 'products', 'lang_suffix' => 'ORDERED_PRODUCTS'); $value = $this->templateFiller->fill('GroupHeader'); $value .= $this->templateFiller->fill('ProductsContainer'); break; default: $value = parent::getTag($tag); break; } return $value; }
/** * Prepares the query of type CREATE TABLE. * * @ to finish the function * @return a string, containing the SQL query 'CREATE' * @param DB_Table_Create object $QueryData */ function PrepareCreateQuery($QueryData) { self::$table_list_cache = null; $SQL = ' CREATE TABLE '; $table = $QueryData->getTable(); $SQL .= $table . ' ('; $fields = $QueryData->getFields(); if (sizeof($fields) > 0) { foreach ($fields as $val) { $SQL .= $val['field_name'] . ' ' . $val['field_type'] . ' ' . $val['field_NULL'] . ' ' . ($val['field_default'] != '' ? 'default ' . $val['field_default'] : '') . ' ' . $val['field_extras'] . ",\n"; } } $keys = $QueryData->getKeys(); if (sizeof($keys) > 0) { $SQL .= 'PRIMARY KEY (' . implode(', ', $keys) . "),\n"; } $indexes = $QueryData->getIndexes(); if (sizeof($indexes) > 0) { foreach ($indexes as $key => $val) { if (_ml_strpos(_ml_strtoupper($val), "UNIQUE") === 0) { $SQL .= ' ' . $val . ' (' . $key . "),\n"; } elseif (_ml_strpos(_ml_strtoupper($val), "FULLTEXT") === 0) { $SQL .= ' ' . $val . ' (' . $key . "),\n"; } else { $SQL .= ' INDEX ' . $val . ' (' . $key . "),\n"; } } } if ($SQL[_byte_strlen($SQL) - 2] == ',') { $SQL = _byte_substr($SQL, 0, _byte_strlen($SQL) - 2); } $table_engine = CConf::get('mysql_table_engine'); $SQL .= ") ENGINE={$table_engine} DEFAULT CHARSET=utf8"; return $SQL; }
/** * Converts the answer from the remote host to the array of headers, cookies * and body. * * @param $result answer from the remote host * @return array of headers, cookies and body */ function parseRequestResult($result) { $headers = array(); $cookies = array(); $body = ""; $dp = 4096; $delimiter = false; $dtrs = array("\n", "\r\n", "\n\r"); foreach ($dtrs as $v) { // trying to find a delimiter pair - headers/body border $tdp = _byte_strpos($result, $v . $v); if ($tdp != false && $dp > $tdp) { $dp = $tdp; $delimiter = $v; } } if ($delimiter == false) { CTrace::wrn('Failed to parse response, I cannot guess headers/body delimiter.'); return; } $headers = _byte_substr($result, 0, $dp); $hstr = explode($delimiter, $headers); foreach ($hstr as $key => $string) { if (preg_match("/^HTTP/", $string)) { continue; } if (trim($string) == "") { break; } $header_array = explode(": ", trim($string), 2); $header_array[0] = _ml_strtoupper($header_array[0]); $headers[$header_array[0]] = chop($header_array[1]); if ($header_array[0] == "SET-COOKIE") { array_push($cookies, $header_array[1]); } } $cookies = $this->parseCookies($cookies); $body = _byte_substr($result, $dp + _byte_strlen($delimiter) * 2); return array("headers" => $headers, "cookies" => $cookies, "body" => $body); }
/** * Converts the user inputed key into generic format (uppercase characters, no delimiters) * and applies the basic check (by length) * * @param string $key * @return string generic key representation * **/ function _prepareKey($key) { if ($key == null || _byte_strlen($key) == 0) { return KEY_BAD; } else { $_key = preg_replace("/[^0-9a-fA-F]/i", "", $key); if (_byte_strlen($_key) != KEY_LENGTH) { return KEY_BAD; } return _ml_strtoupper($_key); } }
function out_KeyDetails() { $html_code = ''; foreach ($this->key_details as $field_name) { $field_value = null; switch ($field_name) { case 'Invoice': $r = new Request(); $r->setView('CustomerOrderInvoice'); $r->setKey('order_id', $this->order_id); $field_value = '<a target="_blank" href="' . $r->getURL() . '">' . cz_getMsg('ORDER_INFO_KEY_FIELD_INVOICE_LINK') . '</a>'; break; case 'Date': $field_value = $this->__format_date($this->order_info[$field_name]); break; case "TrackId": $field_value = nl2br($this->order_info[$field_name]); break; default: $field_value = prepareHTMLDisplay($this->order_info[$field_name]); break; } $this->current_info_field = array('name' => $field_name, 'display_name' => cz_getMsg('ORDER_INFO_KEY_FIELD_' . _ml_strtoupper($field_name)), 'value' => $field_value); $html_code .= $this->templateFiller->fill('GroupField'); } return $html_code; }
function processIPNnotify($post_data, $order_id) { global $application; $obj =& $application->getInstance('MessageResources', "payment-module-paypal-messages", "AdminZone"); // read the post from PayPal system and add 'cmd' $req = 'cmd=_notify-validate'; $raw_post_data = file_get_contents('php://input'); $raw_post_array = explode('&', $raw_post_data); $myPost = array(); foreach ($raw_post_array as $keyval) { $keyval = explode('=', $keyval); if (count($keyval) == 2) { $myPost[$keyval[0]] = urldecode($keyval[1]); } } if (function_exists('get_magic_quotes_gpc')) { $get_magic_quotes_exists = true; } foreach ($myPost as $key => $value) { if ($get_magic_quotes_exists == true && get_magic_quotes_gpc() == 1) { $value = urlencode(stripslashes($value)); } else { $value = urlencode($value); } $req .= "&{$key}={$value}"; } $settings = $this->getSettings(); $socketUrl = $settings['MODULE_MODE'] == 1 ? PAYPAL_URL_TEST : PAYPAL_URL; $ch = curl_init($socketUrl); curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $req); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2); curl_setopt($ch, CURLOPT_FORBID_REUSE, 1); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Connection: Close')); // In wamp like environments that do not come bundled with root authority certificates, // please download 'cacert.pem' from "http://curl.haxx.se/docs/caextract.html" and set the directory path // of the certificate as shown below. // curl_setopt($ch, CURLOPT_CAINFO, dirname(__FILE__) . '/cacert.pem'); if (!($res = curl_exec($ch))) { error_log("Got " . curl_error($ch) . " when processing IPN data"); curl_close($ch); return array("payment_status" => array()); } curl_close($ch); /* foreach ($post_data as $key => $value) { $value = urlencode(stripslashes($value)); $req .= "&$key=$value"; } */ // assign posted variables to local variables $item_name = isset($post_data['item_name']) ? $post_data['item_name'] : ""; $item_number = isset($post_data['item_number']) ? $post_data['item_number'] : ""; $payment_status = $post_data['payment_status']; $payment_amount = $post_data['mc_gross']; $payment_currency = $post_data['mc_currency']; $txn_id = $post_data['txn_id']; $receiver_email = $post_data['receiver_email']; $payer_email = $post_data['payer_email']; /* Update the order: write txn_id */ modApiFunc("Checkout", "updateOrderPaymentProcessorOrderID", $order_id, $txn_id); modApiFunc("Checkout", "addOrderHistory", $order_id, $this->OrderHistoryMessageTag . "\n" . $this->getmicrotime() . "\n" . $obj->getMessage('MODULE_PAYMENT_PAYPAL_PAYPAL_IPN_LOG_EVENT_DESCRIPTION') . $obj->getMessage('MODULE_PAYMENT_PAYPAL_PAYPAL_IPN_LOG_MESSAGE_AZ_001')); $historyMessage = $this->OrderHistoryMessageTag; $paymentStatusId = ""; if (strcmp(strtolower($res), "verified") == 0) { $historyMessage .= "\n" . $this->getmicrotime() . "\n" . $obj->getMessage('MODULE_PAYMENT_PAYPAL_PAYPAL_IPN_LOG_EVENT_DESCRIPTION') . $obj->getMessage('MODULE_PAYMENT_PAYPAL_PAYPAL_IPN_LOG_MESSAGE_AZ_002') . "\n"; switch ($payment_status) { case "Pending": $paymentStatusId = 1; break; case "Completed": case "Canceled_Reversal": $paymentStatusId = 2; break; default: $paymentStatusId = 3; break; } $po = $this->getPresentOrderTotalAndCurrency($order_id); if (round($po['total'], 2) != round(floatval($payment_amount), 2) || $po['curr'] != $payment_currency) { $paymentStatusId = 4; $historyMessage .= "\n" . $po['msg']; } $historyMessage .= $this->getmicrotime() . "\n" . $obj->getMessage('PAYMENT_STATUS_' . _ml_strtoupper($payment_status) . '_MSG'); if ($payment_status == "Pending") { $historyMessage .= "\n" . $obj->getMessage('PAYMENT_STATUS_PENDING_' . _ml_strtoupper($post_data["pending_reason"]) . '_MSG'); } if ($payment_status == "Reversed" || $payment_status == "Refunded") { $historyMessage .= "\n" . $obj->getMessage('PAYMENT_STATUS_REVERSED_' . _ml_strtoupper($post_data["reason_code"]) . '_MSG'); } } elseif (strcmp($res, "INVALID") == 0) { modApiFunc("Checkout", "addOrderHistory", $order_id, $this->OrderHistoryMessageTag); // log for manual investigation $paymentStatusId = 3; $historyMessage .= $this->getmicrotime() . "\n" . $obj->getMessage('MODULE_PAYMENT_PAYPAL_PAYPAL_IPN_LOG_EVENT_DESCRIPTION') . $obj->getMessage('MODULE_PAYMENT_PAYPAL_PAYPAL_IPN_LOG_MESSAGE_AZ_003'); break; } else { //HTTP Header lines. } //strcmp of res return modApiFunc("Checkout", "UpdatePaymentStatusInDB", $order_id, $paymentStatusId, $historyMessage); }
/** * Checks data to add the value to the option. * * @param $data = array( * 'value_name' => value name * ,'is_default' => enum('Y','N') * ,'price_modifier' => float price modifier * ,'weight_modifier' => float weight modifier * ,'shipping_cost_modifier' => float shipping cost modifier * ); * @return array of errors */ function __checkDataFor_addValueToOption($data) { $return = array(); //check value_name if (!is_string($data["value_name"]) or $data["value_name"] == "") { $return[] = "E_INVALID_VALUE_NAME"; } //check is_default if (!in_array($data["is_default"], array('Y', 'N'))) { $return[] = "E_INVALID_IS_DEFAULT"; } //check modifiers foreach ($this->__getInnerVar("_MODIFIERS") as $modifier) { if (!is_float($data[$modifier . "_modifier"])) { $return[] = "E_INVALID_" . _ml_strtoupper($modifier) . "_MODIFIER"; } } return $return; }
function findChildRecursively($tag_name, $parent = false) { if ($parent) { $search_array = $parent->children; } else { $search_array = $this->children; } foreach ($search_array as $child) { if ($child->name == _ml_strtoupper($tag_name)) { return $child; } else { $result = $this->findChildRecursively($tag_name, $child); if ($result) { return $result; } } } return false; }
function outputValueHeader() { global $application; $modifiers = modApiFunc("Product_Options", "__getInnerVar", "_MODIFIERS"); $headers = array(); for ($i = 0; $i < count($modifiers); $i++) { $headers[] = 'MOD_' . _ml_strtoupper($modifiers[$i]); } $header_width = round(80 / count($headers)) . '%'; $tpl_contents = array("modsCount" => count($modifiers), "modsNames" => '<th class="text-center">' . implode('</th><th class="text-center">', array_map(array(&$this, "_var2msg"), $headers)) . '</th>'); $this->_Template_Contents = $tpl_contents; $application->registerAttributes($this->_Template_Contents); $this->mTmplFiller =& $application->getInstance('TmplFiller'); return $this->mTmplFiller->fill("product_options/edit-option/", "values-header.tpl.html", array()); }
function output() { global $application; $mr_info = modApiFunc('Mod_Rewrite', 'detectModRewrite'); $rw_schemes = modApiFunc('Mod_Rewrite', 'getRewriteSchemes'); // <begin> mod_rewrite $tests_results = array(); // " " echo "<!-- Tests results:\n"; for ($i = 1; $i <= 2; $i++) { $tests_results[$i] = $this->_makeTest($i, "Ok"); if ($tests_results[$i]) { echo "{$i}: Ok\n"; } else { echo "{$i}: Error\n"; } } echo " -->"; if (!in_array(true, $tests_results)) { $mr_info['tests_status'] = false; } else { // , // Options +FollowSymLinks .htaccess $mr_info['tests_status'] = true; $_sets = array('ADD_FSL_STRING' => array_search(true, $tests_results) == 2 ? 'Y' : 'N'); modApiFunc('Mod_Rewrite', 'updateSettings', $_sets); } // <end> mod_rewrite $schemes_select = array("id" => "sets[REWRITE_SCHEME]", "select_name" => "sets[REWRITE_SCHEME]", "selected_value" => $this->mr_settings['REWRITE_SCHEME'], "onChange" => "changeSampleLinks(this.value);", "values" => array()); foreach ($rw_schemes as $k => $scheme_info) { $schemes_select['values'][] = array("value" => $scheme_info['scheme_id'], "contents" => getMsg('MR', 'RS_' . _ml_strtoupper($scheme_info['scheme_name']))); } $template_contents = array('ResultMessage' => $this->outputResultMessage(), 'ServerSoft' => $mr_info['server_soft'], 'MRloaded' => $mr_info['mod_rewrite_loaded'], 'setsCatsPrefix' => HtmlForm::genInputTextField('255', 'sets[CATS_PREFIX]', '50', $this->mr_settings['CATS_PREFIX']), 'setsProdsPrefix' => HtmlForm::genInputTextField('255', 'sets[PRODS_PREFIX]', '50', $this->mr_settings['PRODS_PREFIX']), 'setsCMSPrefix' => HtmlForm::genInputTextField('255', 'sets[CMS_PREFIX]', '50', $this->mr_settings['CMS_PREFIX']), 'MRStatusMessage' => $this->outMRStatusMessage($mr_info), 'setsSchemesSelect' => HtmlForm::genDropdownSingleChoice($schemes_select), 'jsLinkSmaplesArray' => $this->out_jsLinkSmaplesArray(), 'currentSchemeID' => $this->mr_settings['REWRITE_SCHEME'], 'LayoutsSettings' => $this->_form_disabled ? '' : $this->out_LayoutsSettings(), 'disableAllCondition' => $this->_form_disabled ? 'true' : 'false'); $this->_Template_Contents = $template_contents; $application->registerAttributes($this->_Template_Contents); $this->mTmplFiller =& $application->getInstance('TmplFiller'); return $this->mTmplFiller->fill("mod_rewrite/", "container.tpl.html", array()); }
function out_FilterInfo() { $lang_suffix = 'custom'; switch ($this->incoming_filter['type']) { case 'quick': switch ($this->incoming_filter['order_status']) { case ORDER_STATUS_ALL: $lang_suffix = 'all'; break; case ORDER_STATUS_NEW: $lang_suffix = 'new'; break; case ORDER_STATUS_IN_PROGRESS: $lang_suffix = 'in_progress'; break; case ORDER_STATUS_READY_TO_SHIP: $lang_suffix = 'ready_to_ship'; break; case ORDER_STATUS_SHIPPED: $lang_suffix = 'shipped'; break; case ORDER_STATUS_CANCELLED: $lang_suffix = 'cancelled'; break; case ORDER_STATUS_DECLINED: $lang_suffix = 'declined'; break; case ORDER_STATUS_COMPLETED: $lang_suffix = 'completed'; break; } break; case 'id': $lang_suffix = 'by_id'; break; } $filter_name = cz_getMsg('ORDER_STATUS_' . _ml_strtoupper($lang_suffix)); if ($this->customer_obj->getOrdersCount() == 0) { $lang_suffix = 'none'; } else { $lang_suffix = 'summary'; } $currency_id = modApiFunc("Localization", "getMainStoreCurrency"); modApiFunc("Localization", "pushDisplayCurrency", $currency_id, $currency_id); $ret = cz_getMsg('ORDER_FILTER_INFO_' . _ml_strtoupper($lang_suffix), $filter_name, $this->customer_obj->getOrdersCount(), $this->__format_date($this->customer_obj->getOrdersMinDate()), $this->__format_date($this->customer_obj->getOrdersMaxDate()), modApiFunc('Localization', 'currency_format', $this->customer_obj->getOrdersAmount())); modApiFunc("Localization", "popDisplayCurrency"); return $ret; }