function add_https_settings($layout_array, $layout_file_path) { // SiteHTTPSURL [Site] // https 1.8.2 if (isset($layout_array['Site'])) { $new_vals = array(); foreach ($layout_array['Site'] as $key => $value) { if (_ml_strcasecmp($key, 'SiteHTTPSURL') != 0) { $new_vals[$key] = $value; } } $layout_array['Site'] = $new_vals; } // HTTPS = YES/NO // https 1.8.2 foreach ($layout_array as $layout_section_name => $vals) { $new_vals = array(); foreach ($vals as $key => $value) { if (_ml_strcasecmp($key, 'HTTPS') != 0) { $new_vals[$key] = $value; } } $layout_array[$layout_section_name] = $new_vals; } // SITE_HTTPS_URL if (isset($layout_array['Site']) && isset($layout_array['Site']['SiteURL'])) { $SiteHTTPSURL = modApiStaticFunc("Configuration", "getCZSiteHTTPSURL", $layout_array['Site']['SiteURL']); if ($SiteHTTPSURL !== NULL) { $layout_array['Site']['SiteHTTPSURL'] = $SiteHTTPSURL; } } // HTTPS $cz_https_settings = modApiStaticFunc("Configuration", "getLayoutSettings"); //Search for current layout path entry $target_layout_file_path = NULL; foreach ($cz_https_settings as $fpath => $info) { if (file_path_cmp($fpath, $layout_file_path) === 0) { $target_layout_file_path = $fpath; break; } } if ($target_layout_file_path !== NULL) { $map = modApiStaticFunc("Configuration", "getLayoutSettingNameByCZLayoutSectionNameMap"); foreach ($map as $layout_section_name => $settings_section_name) { if (isset($layout_array[$layout_section_name])) { $layout_array[$layout_section_name]['HTTPS'] = modApiStaticFunc("Configuration", "getCZHTTPS", $layout_section_name, $cz_https_settings[$target_layout_file_path]); } } } return $layout_array; }
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; } }
/** * Parse & decode QUERY_STRING. */ function _correctSuperglobals() { // In case of FORM loader we may go to nirvana, everything is already parsed by PHP. if ($this->LOADER == 'form') { return; } // ATTENTION!!! // HTTP_RAW_POST_DATA is only accessible when Content-Type of POST request // is NOT default "application/x-www-form-urlencoded"!!! // Library frontend sets "application/octet-stream" for that purpose, // see JavaScript code. In PHP 5.2.2.HTTP_RAW_POST_DATA is not set sometimes; // in such cases - read the POST data manually from the STDIN stream. $rawPost = _ml_strcasecmp($_SERVER['REQUEST_METHOD'], 'POST') == 0 ? isset($GLOBALS['HTTP_RAW_POST_DATA']) ? $GLOBALS['HTTP_RAW_POST_DATA'] : @file_get_contents("php://input") : null; $source = array('_GET' => !empty($_SERVER['QUERY_STRING']) ? $_SERVER['QUERY_STRING'] : null, '_POST' => $rawPost); foreach ($source as $dst => $src) { // First correct all 2-byte entities. $s = preg_replace('/%(?!5B)(?!5D)([0-9a-f]{2})/si', '%u00\\1', $src); // Now we can use standard parse_str() with no worry! $data = null; parse_str($s, $data); $GLOBALS[$dst] = $this->_ucs2EntitiesDecode($data); } $GLOBALS['HTTP_GET_VARS'] = $_GET; // deprecated vars $GLOBALS['HTTP_POST_VARS'] = $_POST; $_REQUEST = (isset($_COOKIE) ? $_COOKIE : array()) + (isset($_POST) ? $_POST : array()) + (isset($_GET) ? $_GET : array()); if (ini_get('register_globals')) { // ? } }
function createProductTypeInfo($base_product_type, $attr_names) { $names = array(); $is_custom = array(); foreach ($attr_names as $attr_name) { $names[] = $attr_name['name']; $is_custom[$attr_name['name']] = $attr_name['isCustom']; } $attr_in_base = array(); foreach ($base_product_type as $view_tag => $attr) { $attr_in_type = false; if (in_array($view_tag, $names)) { $attr_in_type = true; $attr_in_base[] = $view_tag; } else { // The name of Custom attributes are distorted: XXX turns to Xxx. To find them you should ignore the register if ($attr['type'] == 'custom') { foreach ($names as $name) { if (_ml_strcasecmp($view_tag, $name) == 0) { $attr_in_base[] = $name; $attr_in_type = true; break; } } } } if ($attr_in_type) { $base_product_type[$view_tag]['visible'] = 1; } else { $base_product_type[$view_tag]['visible'] = 0; } } // Create those attributes that doesn't exist in the base type foreach ($names as $name) { // search those attributes, that doesn't exist in the base type if (!in_array($name, $attr_in_base)) { $new_custom_attr = $this->createCustomAttr($name); $base_product_type[$name] = $new_custom_attr; } } return $base_product_type; }
function file_path_cmp($path1, $path2) { $path1 = str_replace('\\', '/', $path1); $path1 = str_replace('//', '/', $path1); $path2 = str_replace('\\', '/', $path2); $path2 = str_replace('//', '/', $path2); loadCoreFile('bouncer.php'); $bnc = new Bouncer(); $bnc->detect_OS(); if ($bnc->_os_type == "win") { return _ml_strcasecmp($path1, $path2); } else { return strcmp($path1, $path2); } }
/** * function recieves the URI from the tag attribute and checks if it is relative * if so, function converts the URI to the absolute form * using data on current URI * * @param string $new_uri */ function parse_http_redirect($new_url) { //detect if URL is absolute if ($method_pos = _ml_strpos($new_url, '://')) { $method = _ml_substr($new_url, 0, $method_pos); if (!_ml_strcasecmp($method, 'http') || !_ml_strcasecmp($method, 'https') || !_ml_strcasecmp($method, 'ftp')) { // absolute URL passed return $this->process($new_url); } else { //invalid protocol return false; } } // URL is relative //do we have GET data in the URL? $param_pos = _ml_strpos($new_url, QUERY_DELIMITER); if ($param_pos !== false) { $new_query = _ml_substr($new_url, $param_pos); $new_path = $param_pos ? _ml_substr($new_url, 0, $param_pos) : ''; } else { $new_path = $new_url; $new_query = ''; } //is URL relative to the previous URL path? if ($new_url[0] != '/') { //attach relative link to the current URI's directory $new_path = $this->dirname($this->path) . '/' . $new_path; } /* May be need in the future, but now it is not needed //replace back and repetitive slashes with a single forward one $new_path = preg_replace ('~((\\\\+)|/){2,}~', '/', $new_path); //parse links to the upper directories if (_ml_strpos($new_path, '/../') !== false) { $path_array = explode ('/', $new_path); foreach ($path_array as $key=>$value) { if ($value == '..') { if ($key > 2) { unset ($path_array[$key-1]); } unset ($path_array[$key]); } } $new_path = implode ('/', $path_array); } //parse links to the 'current' directories $new_path = str_replace('/./', '/', $new_path); */ $this->path = $new_path; $this->query = $new_query; $this->get_full_uri(); return true; }
function _cmpSkinNames($a, $b) { return _ml_strcasecmp($a['name'], $b['name']); }