Пример #1
0
 public static function Initialize()
 {
     /* Setup Registry */
     self::$_database = new Database();
     self::$_configuration = new Configuration();
     self::$_interface = new InterfaceHandler();
     self::$_authority = new Authority();
     self::$_user = new User();
     /* Set base values and cleanup */
     crunch($_GET['app']);
     crunch($_GET['arg']);
     self::$application = priority_select($_GET['app'], cfRead('Default Application'), 'System');
     exMethod('System: _application = ' . self::$application);
     self::$arg = $_GET['arg'];
 }
Пример #2
0
 private function sessionReload($session)
 {
     exMethod('Authority->sessionReload()');
     $this->sessionDestroy();
     $session['expire_time'] = time() + cfRead('Session Expire Increment');
     $this->reload = true;
     $this->type = $session['user']['type'];
     $this->role = $session['user']['role'];
     $this->username = $session['user']['username'];
     $this->user_id = $session['user']['id'];
     $this->guest = $session['guest'];
     $this->session_configuration = unserialize($session['configuration']);
     $this->session_configuration_hash = md5($session['configuration']);
     setCookie('kSessionID', $this->session['id'], $session['expire_time'], '/');
     setCookie('kSessionSeed', $this->session['seed'], $session['expire_time'], '/');
     query($this->statements['update_time'], $this->session['id'], $session['expire_time']);
 }
Пример #3
0
 public function menu($input, $pre = null, $item = null, $post = null, $pre2 = null)
 {
     if ($input == 0 and is_string($input)) {
         crunch($input);
         $result = query();
         if (is_resource($result)) {
             if (mysql_num_rows($result) == 1) {
                 $menu = mysql_fetch_assoc($result);
             } else {
                 exLog("Interface->menu({$input} 'string'): No menu found");
             }
         } else {
             exLog("Interface->menu({$input} 'string'): Result was not mysql value");
         }
     } else {
         if (is_array($input)) {
             $navigation = $input;
         } else {
             $result = query();
             if (is_resource($result)) {
                 if (mysql_num_rows($result) == 1) {
                     $menu = mysql_fetch_assoc($result);
                 } else {
                     exLog("Interface->menu({$input} 'string'): No menu found");
                 }
             } else {
                 exLog("Interface->menu({$input} 'string'): Result was not mysql value");
             }
         }
     }
     if (!isset($navigation)) {
         $result = query();
         while ($row = mysql_fetch_assoc($result)) {
             $navigation[] = $row;
         }
     }
     if ($pre == 'return formated') {
         unset($pre);
         $pre = $pre2;
         $return = true;
     } else {
         if ($pre == 'return unformatted') {
             return $navigation;
         }
     }
     if (is_null($pre)) {
         $pre = $this->template('Menu Pre');
     }
     if (is_null($item)) {
         $item = $this->template('Menu Item');
     }
     if (is_null($post)) {
         $item = $this->template('Menu Post');
     }
     $output = $pre;
     foreach ($navigation as $item) {
         if ($item['name'] == '[SESSION_PORTAL]' and $item['link'] == '[SESSION_PORTAL]') {
             if (System::Authority()->verified) {
                 $link['name'] = 'Logout';
                 $link['link'] = 'ex://Users/Logout';
             } else {
                 $link['name'] = 'Login';
                 $link['link'] = 'ex://Users/Login';
             }
         }
         if ($item['link'] == '[HOME]') {
             $item['link'] = cfRead('Home Link');
         }
         if (is_null($item['link'])) {
             $item['link'] = 'javascript:;';
         }
         $link = $this->parseLink($item['link']);
         $current = $this->isCurrentPage($link) ? ' class="current" ' : null;
         $output .= sprintf($item, $link, $link['name'], $current);
     }
     $output .= $post;
     if ($return === true) {
         return $output;
     } else {
         echo $output;
     }
 }
Пример #4
0
function mime_type($input)
{
    if (file_exists($input)) {
        $mime_types = cfRead('Mime Types');
        list($dir, $base, $ext, $file) = pathinfo($input);
        return isset($mime_types[$ext]) ? $mime_types[$ext] : 'application/octet-stream';
    } else {
        exLog("mime_type(): No file at {$input}.");
    }
}