コード例 #1
0
ファイル: aries_login.php プロジェクト: andhikatri3/aries-php
 public static function isInactive()
 {
     @session_start();
     $current_time = strtotime('now');
     if (!isset($_SESSION[self::$session_inactive])) {
         $_SESSION[self::$session_inactive] = $current_time;
     } else {
         if (strtotime('now') - $_SESSION[self::$session_inactive] > self::$inactive_length && self::isLogged()) {
             self::logout();
             header('Location:' . Config::getConfig(Config::$base));
         } else {
             $_SESSION[self::$session_inactive] = $current_time;
         }
     }
 }
コード例 #2
0
ファイル: connection.php プロジェクト: andhikatri3/aries-php
 /**
  * Make connection to the database.
  */
 public static function init()
 {
     $host = Config::getConfig(Config::$host);
     $port = Config::getConfig(Config::$port);
     $dbName = Config::getConfig(Config::$databaseName);
     $user = Config::getConfig(Config::$user);
     $password = Config::getConfig(Config::$password);
     $file = Config::getConfig(Config::$file);
     if ('' == $host) {
         throw new AriesException('Your host config is null.');
     } else {
         if ('' == $port) {
             throw new AriesException('Your port config is null.');
         } else {
             if ('' == $dbName) {
                 throw new AriesException('Your dbName config is null.');
             } else {
                 if ('' == $user) {
                     throw new AriesException('Your user config is null.');
                 }
             }
         }
     }
     if (Config::getConfig(Config::$driver) == Config::$mysql) {
         self::$db = new \PDO("mysql:host={$host};port={$port};dbname={$dbName}", $user, $password);
     } else {
         if (Config::getConfig(Config::$driver) == Config::$postgree) {
             self::$db = new \PDO("pgsql:host={$host};port={$port};dbname={$dbName}", $user, $password);
         } else {
             if (Config::getConfig(Config::$driver) == Config::$sqlite) {
                 if ('' == $file) {
                     throw new AriesException('Your file config is null.');
                 }
                 self::$db = new \PDO("sqlite:{$file}", $user, $password);
             }
         }
     }
 }
コード例 #3
0
ファイル: controller.php プロジェクト: andhikatri3/aries-php
 /**
  * Generating js for the header.
  *
  * @return null|string
  */
 public function jsBuilder()
 {
     $js = glob($this->js_folder . '*.js');
     $result = null;
     foreach ($js as $value) {
         $result .= '<script src="' . Config::getConfig(Config::$base) . $value . '" type="text/javascript"></script>';
     }
     return $result;
 }
コード例 #4
0
ファイル: index.php プロジェクト: andhikatri3/aries-php
if (Config::getPlugins('css') == 'lessCSS') {
    $lessFile = glob('public/less/*.less');
    if (sizeof($lessFile) > 0) {
        $less = new lessc();
        foreach ($lessFile as $value) {
            $filenames = explode('/', $value);
            $filename = $filenames[2];
            $less->checkedCompile($value, strstr($value, '/', true) . '/css/' . substr($filename, 0, strpos($filename, '.')) . '.css');
        }
    }
}
//Call caches header
if (Config::getConfig(Config::$cache) == 'true') {
    $router->headerCache();
}
AR_Config::initialize(function ($cfg) {
    $cfg->set_model_directory('app/models');
    $cfg->set_connections(Config::getDatabases());
    $cfg->set_default_connection(Config::getConfig(Config::$default_connection));
});
//Call controller
$router->route();
//Call caches footer
if (Config::getConfig(Config::$cache) == 'true') {
    $router->footerCache();
}
//Stop timer
$time_end = microtime(true);
$time = $time_end - $time_start;
//Comment below to hide timer
//echo 'Web executed in '.$time.' seconds';
コード例 #5
0
 /**
  * Getting base URL.
  *
  * @return mixed
  */
 public static function getBaseUrl()
 {
     return Config::getConfig(Config::$base);
 }