Esempio n. 1
0
 protected static function addConfToResponse()
 {
     self::$response['app'] = Conf::get('app');
     self::$response['routeInfo'] = Conf::get('routeInfo');
     self::$response['session'] = Session::getAll();
     self::$response['server'] = Server::getAll();
 }
Esempio n. 2
0
 /**
  * add app conf
  */
 public static function initApp()
 {
     static::add('etc/app.ini', 'app');
     $foundApp = false;
     static::$isCli = php_sapi_name() === static::CLI;
     foreach (static::get('app') as $appName => $app) {
         if (static::$isCli) {
             $argv = Server::get('argv');
             if ($argv !== null && !empty($argv[1])) {
                 if (strtolower($argv[1]) === strtolower($appName)) {
                     $app['serverName'] = $app['serverName'][0];
                     $app['name'] = $appName;
                     $app['href'] = $argv[0];
                     $app['root'] = static::$rootDir;
                     static::set('app', $app);
                     $foundApp = true;
                     break;
                 }
             } else {
                 break;
             }
         } else {
             $serverNameIndex = array_search(Server::get('serverName'), $app['serverName']);
             $serverNameIndex = $serverNameIndex === false ? array_search(Server::get('serverName') . ':' . Server::get('serverPort'), $app['serverName']) : $serverNameIndex;
             if (false !== $serverNameIndex) {
                 $app['serverName'] = $app['serverName'][$serverNameIndex];
                 $app['name'] = $appName;
                 $app['href'] = (!empty($app["protocole"]) ? $app["protocole"] : 'http') . '://' . $app['serverName'] . '/';
                 $app['root'] = static::$rootDir;
                 static::set('app', $app);
                 $foundApp = true;
                 break;
             }
         }
     }
     if (!$foundApp) {
         static::set('app', []);
     }
 }
Esempio n. 3
0
 /**
  * Return $_GET parameters from URI informations Server
  *
  * @return array
  */
 private static function getUriParameters()
 {
     $queryStringServer = Server::get('queryString');
     $queryStringExploded = explode('&', $queryStringServer);
     $getParameters = array();
     foreach ($queryStringExploded as $parameter) {
         if (!empty($parameter)) {
             list($key, $value) = explode('=', $parameter);
             $getParameters[$key] = $value;
         }
     }
     return $getParameters;
 }