Ejemplo n.º 1
0
function __load__($file_path, $return = FALSE)
{
    if (!is_readable($file_path)) {
        __error__("File `{$file_path}` is not readable !");
    }
    if ($return) {
        return include $file_path;
    }
    include $file_path;
}
Ejemplo n.º 2
0
 public function load($class_name = '')
 {
     $class_path = ltrim(str_replace('\\', DS, $class_name), '\\') . '.php';
     foreach ($this->dirs as $dir) {
         if (is_readable($dir . $class_path)) {
             include $dir . $class_path;
             return TRUE;
         }
     }
     __error__('Class `' . $class_name . '` is not found !');
 }
Ejemplo n.º 3
0
 public function start($name = 'NDK', $limit = 0, $path = '/', $domain = null, $secure = null)
 {
     session_name($name . '_SESSION');
     $domain = isset($domain) ? $domain : Request::getServerName();
     $https = isset($secure) ? $secure : isset($_SERVER['HTTPS']);
     session_set_cookie_params($limit, $path, $domain, $https, true);
     session_start();
     if (empty($_SESSION['_NDK_SESSION_TOKEN_'])) {
         $_SESSION['_NDK_SESSION_TOKEN_'] = base64_encode(Request::getRemoteAddr() . Request::getHttpUserAgent());
     } elseif ($_SESSION['_NDK_SESSION_TOKEN_'] != base64_encode(Request::getRemoteAddr() . Request::getHttpUserAgent())) {
         self::destroy();
         session_start();
         session_regenerate_id(true);
         __error__('Your session has been terminated !');
     }
 }
Ejemplo n.º 4
0
 public function __call($name, $arguments)
 {
     try {
         return call_user_func_array(array($this->pdo, $name), $arguments);
     } catch (\Exception $e) {
         __error__($e->getMesssage());
     }
 }
Ejemplo n.º 5
0
 private function unregisterGlobals()
 {
     if (!ini_get('register_globals')) {
         return;
     }
     if (isset($_REQUEST['GLOBALS'])) {
         __error__('GLOBALS overwrite attempt detected');
     }
     $no_unset = array('GLOBALS', '_GET', '_POST', '_COOKIE', '_REQUEST', '_SERVER', '_ENV', '_FILES', 'table_prefix');
     $input = array_merge($_GET, $_POST, $_COOKIE, $_SERVER, $_ENV, $_FILES, isset($_SESSION) && is_array($_SESSION) ? $_SESSION : array());
     foreach ($input as $k => $v) {
         if (!in_array($k, $no_unset) && isset($GLOBALS[$k])) {
             $GLOBALS[$k] = null;
             unset($GLOBALS[$k]);
         }
     }
 }