public function __construct() { $this->_link = mysql_connect(RlxConfig::conf('database.host'), RlxConfig::conf('database.user'), RlxConfig::conf('database.password')); if ($this->_link) { mysql_select_db(RlxConfig::conf('database.db'), $this->_link); $this->query("SET CHARACTER SET " . RlxConfig::conf('database.charset')); } }
public static function ChangeLang($language, $uri) { if (!isset($_COOKIE['lang'])) { setcookie('lang', $language, time() + RlxConfig::conf('cookie.expire'), RlxConfig::conf('cookie.path'), RlxConfig::conf('cookie.domain'), RlxConfig::conf('cookie.secure'), RlxConfig::conf('cookie.httponly')); } else { if (isset($_COOKIE['lang']) && $_COOKIE['lang'] !== $language) { setcookie('lang', $language, time() + RlxConfig::conf('cookie.expire'), RlxConfig::conf('cookie.path'), RlxConfig::conf('cookie.domain'), RlxConfig::conf('cookie.secure'), RlxConfig::conf('cookie.httponly')); } } header('Location: ' . $uri); }
public static function initialize($libs = 'library', $apps = 'application') { self::$libPath = $libs; self::$appsPath = $apps; if (self::$autoloaded === false) { spl_autoload_register(array(__CLASS__, 'LoadLibs')); self::$autoloaded = true; } RlxLoader::LoadClass('RlxRoute'); RlxLoader::LoadClass('RlxError'); RlxLoader::LoadClass('RlxLanguage'); #RlxConfig::LoadConfig(); self::setCharset(RlxConfig::conf('charset')); self::setTimezone(RlxConfig::conf('time_zone')); self::$initialized = true; }
public static function MakeDebug() { if (RlxConfig::conf('debug') !== FALSE) { $extract = self::DebugTrace(); $e = $extract[1]; $message = $e['class'] . $e['type'] . $e['function'] . '(' . implode(', ', $e['args']) . ')' . ' called at [' . $e['file'] . ':' . $e['line'] . ']'; self::add('debug', $message); } }
* * Самостоятелни функции * * * @author relax4o * @copyright 2011 */ /** Махаме ескейпването, ако магическите кавички са включени **/ if (get_magic_quotes_gpc()) { function stripslashes_deep($value) { $value = is_array($value) ? array_map("stripslashes_deep", $value) : stripslashes($value); return $value; } $_GET = array_map("stripslashes_deep", $_GET); $_POST = array_map("stripslashes_deep", $_POST); $_COOKIE = array_map("stripslashes_deep", $_COOKIE); $_SESSION = array_map("stripslashes_deep", $_SESSION); } /** Махаме HTML таговете **/ if (RlxConfig::conf('strip_html') === TRUE) { function strip_html($value) { if (preg_match("@(\\<(/?[^\\>]+)\\>)@i", $value)) { $value = NULL; } return $value; } $_GET = array_map("strip_html", $_GET); $_POST = array_map("strip_html", $_POST); $_COOKIE = array_map("strip_html", $_COOKIE); $_SESSION = array_map("strip_html", $_SESSION); }