Index: trunk/core/units/general/helpers/modules.php =================================================================== diff -u -N -r5168 -r7391 --- trunk/core/units/general/helpers/modules.php (.../modules.php) (revision 5168) +++ trunk/core/units/general/helpers/modules.php (.../modules.php) (revision 7391) @@ -1,40 +1,40 @@ _GetModules(); } - + function getWhereClause() { $where_clause = Array('Loaded = 1'); - + if (!$this->Application->IsAdmin()) return implode(' AND ', $where_clause); - + $modules = $this->_GetModules(); if ($modules) { foreach ($modules as $module_index => $module) { $modules[$module_index] = $this->Conn->qstr($module); } $where_clause[] = 'Name IN ('.implode(',', $modules).')'; } - + return implode(' AND ', $where_clause); } - + function _EnableCookieSID() { $session =& $this->Application->recallObject('Session'); return $session->CookiesEnabled; } - + function _IsSpider($UserAgent) { global $robots; $lines = file(FULL_PATH.'/robots_list.txt'); - + if (!is_array($robots)) { $robots = Array(); for($i = 0; $i < count($lines); $i++) { @@ -45,11 +45,11 @@ } return in_array($UserAgent, $robots); } - + function _MatchIp($ip1, $ip2) { $matched = TRUE; - + $ip = explode('.', $ip1); $MatchIp = explode('.', $ip2); for ($i = 0; $i < count($ip); $i++) { @@ -61,7 +61,7 @@ } return $matched; } - + function _IpAccess($IpAddress, $AllowList, $DenyList) { $allowed = explode(',', $AllowList); @@ -88,20 +88,20 @@ ($MatchAllowed && $MatchDenied)); return $Result; } - + /** * Reads config.php file and parses it * */ function _readConfig() { $vars = parse_portal_ini(FULL_PATH.'/config.php'); - + foreach ($vars as $config_key => $config_value) { $GLOBALS['g_'.$config_key] = $config_value; } } - + /** * Leaves only domain part from hostname (e.g. extract "intechnic.lv" from "test.intechnic.lv") * Used for admin login license check @@ -123,7 +123,7 @@ } } } - + if ($dotcount > 1 && !$IsIp) { $p = explode('.', $d); $ret = $p[count($p) - 2].'.'.$p[count($p) - 1]; @@ -151,7 +151,7 @@ return preg_match('/(.*)'.preg_quote($license_domain, '/').'$/', $user_domain); } } - + /** * Returns modules list, that are in license * @@ -161,13 +161,13 @@ { global $i_Keys; static $modules = null; - + if (isset($modules)) return $modules; - + $this->_readConfig(); $license = base64_decode($GLOBALS['g_License']); $this->_ParseLicense($license); - + $modules = Array(); $domain = $this->_GetDomain(); if (!$this->_IsLocalSite($domain)) { @@ -182,10 +182,10 @@ else { $modules = array_keys($this->Application->ModuleInfo); } - + array_push($modules, 'Proj-base', 'Proj-CMS', 'Custom'); return $modules; } - + /** * Allows to determine if module is licensed * @@ -197,7 +197,7 @@ $modules = $this->_GetModules(); return in_array($name, $modules); } - + /** * Returns domain from licences (and direct in case of install script) * @@ -207,7 +207,7 @@ { return $this->Application->ConfigValue('DomainDetect') ? $_SERVER['HTTP_HOST'] : $GLOBALS['g_Domain']; } - + function _keyED($txt, $encrypt_key) { $encrypt_key = md5($encrypt_key); @@ -220,8 +220,8 @@ } return $tmp; } - - + + function _decrypt($txt, $key) { $txt = $this->_keyED($txt,$key); @@ -233,17 +233,17 @@ } return $tmp; } - + function LoadFromRemote() { return ''; } - + function DLid() { die($GLOBALS['lid']."\n"); } - + function _LoadLicense($LoadRemote = false) { $f = FULL_PATH.'/intechnic.php'; @@ -257,7 +257,7 @@ } return $data; } - + function _VerifyKey($domain, $k) { $key = md5($domain); @@ -267,7 +267,7 @@ if ($k == $r) return true; return false; } - + function _ParseLicense($txt) { global $i_User, $i_Pswd, $i_Keys; @@ -282,11 +282,11 @@ case 'Username': $i_User = $p[1]; break; - + case 'UserPass': $i_Pswd = $p[1]; break; - + default: if (substr($p[0], 0, 3) == 'key') { $parts = explode('|', $p[1]); @@ -303,7 +303,7 @@ } } } - + function _GetObscureValue($i) { if ($i == 'x') return 0254; $z = ''; @@ -315,14 +315,14 @@ if ($i > 10) return '.'.($this->_GetObscureValue(6.5)+1); if ($i == 'a') return 0xa; } - + function _Chr($val) { $x = $this->_GetObscureValue(25); $f = chr($x).chr($x+5).chr($x+15); return $f($val); } - + function _IsLocalSite($domain) { $ee = $this->_GetObscureValue(35); $yy = ''; @@ -346,7 +346,7 @@ } return FALSE; } - + function _falseIsLocalSite($domain) { $localb = FALSE;