Exemplo n.º 1
0
 public function render(ddUploadify $up)
 {
     $widget_id = $this->getSlug() . '-input';
     $form = new BaseForm();
     $csrf_token = $form->getCSRFToken();
     $output = '<div class="container dd-img-upload-wrapper">';
     $output .= '<div id="fileQueue"></div>';
     $output .= '<input type="file" name="' . $up->getSlug() . '" id="' . $widget_id . '" />';
     $output .= '<p><a href="javascript:jQuery(\'#' . $widget_id . '\').uploadifyClearQueue()">Cancel All Uploads</a></p>';
     $output .= '<div class="swfupload-buttontarget">
     <noscript>
       We\'re sorry.  SWFUpload could not load.  You must have JavaScript enabled to enjoy SWFUpload.
     </noscript>
   </div>';
     $output .= '<script type="text/javascript">
     //<![CDATA[
     $(document).ready(function() {
       $(\'#' . $widget_id . ' \').uploadify({
         \'scriptData\': {\' ' . array_key($up->getSession()) . ' \': \' ' . array_value($up->getSession()) . ' \', \'_csrf_token\': \' ' . $csrf_token . ' \'},
         \'uploader\': \' ' . $up->getUploader() . ' \',
         \'cancelImg\': \'cancel.png\',
         \'auto\'      : true,
         \'script\': $(\'#' . $widget_id . '\').closest(\'form\').attr(\'action\')+\'/upload\',
         \'folder\': \'\',
         \'multi\': false,
         \'displayData\': \'speed \',
         \'fileDataName\': \' ' . $widget_id . ' \',
         \'simUploadLimit\': 2
       });
     });
     //]]>
   </script>';
     printf($output);
 }
Exemplo n.º 2
0
 /**
  * Decode the XML type and return data
  *
  * @param String $text the text to decode
  * @param String $root the root element name (default is "root")
  * @return Array the decoded data as an assoc array
  */
 public static function from_xml($text, $root = Symbol::ROOT)
 {
     load_tool('XML');
     $data = object_to_array(XML::deserialize($text));
     return array_key($data, $root, $data);
     // skip the root element
 }
Exemplo n.º 3
0
 public function to_text()
 {
     $notes = $this->to_array();
     $list = array();
     foreach ($notes as $id => $note) {
         if (array_key($note, 'deleted')) {
             continue;
         }
         $x = array_key($note, 'x', 0);
         $line = sprintf('%02d', intval(array_key($note, 'y', 0) / 41));
         $text = array_key($note, 'text', '');
         $list[$line . $x / 1000] = $text;
     }
     ksort($list);
     $note = '';
     $last_pos = 0;
     foreach ($list as $pos => $text) {
         $nl = str_repeat("\n", intval($pos / 10) - intval($last_pos / 10));
         if ($note) {
             $note .= intval($pos) == intval($last_pos) ? ' ' : $nl;
         }
         $note .= $text;
         $last_pos = $pos;
     }
     return $note;
 }
Exemplo n.º 4
0
 public static function details($user_agent)
 {
     if (is_null(self::$browscap)) {
         $cache_dir = self::BROWSCAP_CACHE_DIR;
         if (!is_dir($cache_dir)) {
             mkdir($cache_dir);
         }
         self::$browscap = new Browscap($cache_dir);
     }
     // Reset the user agents cache if we've cached too many
     if (count(self::$user_agents) > self::MAX_USER_AGENTS_COUNT) {
         self::$user_agents = array();
     }
     // If user agent info is cached then return it
     if ($details = array_key(self::$user_agents, $user_agent)) {
         return $details;
     }
     // Look up the user agent using the browscap.ini file
     $browscap = self::$browscap->getBrowser($user_agent, TRUE);
     $browser = array_key($browscap, 'Browser');
     // e.g. "IE"
     $version = array_key($browscap, 'Parent');
     // e.g. "IE 9.0"
     $version = $version && $browser && strpos($version, $browser) === 0 ? substr($version, strlen($browser) + 1) : $version;
     $op_sys = array_key($browscap, 'Platform');
     $is_mobile = array_key($browscap, 'isMobileDevice');
     $details = array('op_sys' => $op_sys, 'browser' => $browser, 'version' => $version, 'browser_version' => $browser . ($version ? " {$version}" : ''), 'is_robot' => $op_sys == 'unknown' ? TRUE : FALSE, 'is_mobile' => $is_mobile);
     return self::$user_agents[$user_agent] = new Object($details);
 }
Exemplo n.º 5
0
 /**
  * Parse a country code by turning 3-chars into 2-chars (in uppercase)
  *
  * @param String $code the country code to parse
  * @return String the parsed country code (2-chars in uppercase or NULL)
  */
 private static function parse_code($code)
 {
     $code = strtoupper($code);
     if (strlen($code) == 3) {
         $code = array_key(self::$trans, $code);
     }
     return $code;
 }
Exemplo n.º 6
0
 /**
  * Make a new model object, optionally with some initialization data
  *
  * @param String $model the name of the model class to make
  * @param Array $data an optional array of initialization data
  * @param Boolean $has_changed whether the newly made object has changed
  * @return SQL_model/Remote the newly made model object or its remote object
  */
 public static function make($model, $data = array(), $has_changed = TRUE)
 {
     load_model($model);
     $object = new $model($data, $has_changed);
     if (array_key(self::$is_remote, Symbol::ALL) || array_key(self::$is_remote, $model)) {
         $object = new Remote($object);
     }
     return $object;
 }
Exemplo n.º 7
0
 /**
  * Variation of the regular "render_view" that can insert test results
  *
  * @param String $file blah
  * @param Object $render data to render in the view
  * @param Array $options an array of rendering options (optional)
  * @return String the contents to send in response to the client
  */
 public function render_view($file, $render = NULL, $options = array())
 {
     $render = new Object($render);
     if (array_key($options, Symbol::FOLDER) === 'types' && array_key($_SERVER, 'REMOTE_ADDR')) {
         // to check it's a web request
         $this->render_test_run($render);
     }
     return parent::render_view($file, $render, $options);
 }
Exemplo n.º 8
0
	public function from($address) {
		if (strpos($address, '@') === false) {
			global $config;

			$address = $config['sitename'] . ' <' . $address . '@' . array_key(explode('@', $config['board_email']), 1) . '>';
		}

		$this->from = trim($address);
	}
Exemplo n.º 9
0
 /**
  * @param array $joins
  * @param array $params the binding parameters to be populated
  * @return string the JOIN clause built from [[Query::$join]].
  * @throws Exception if the $joins parameter is not in proper format
  */
 public function buildExpand($joins)
 {
     $expands = [];
     if (is_array($joins)) {
         foreach ($joins as $item) {
             $expands[] = is_array($item) ? array_key($item) : $item;
         }
     }
     return ['expand' => implode(',', $joins)];
 }
Exemplo n.º 10
0
 /**
  * Translate a word into a language, optionally with replacements
  * for example "array('NAME', $user->name)" would insert the name.
  *
  * @param String $lang the language to translate into
  * @param String $lookup the string to lookup in the translations
  * @param Array $replacements an optional array of replacements to make
  * @return String the translated string in the chosen language
  */
 public static function into($lang, $lookup, $replacements = array())
 {
     $text = array_key(self::$translations[$lang], strtolower($lookup));
     if (is_null($text)) {
         throw new Exception("Translation missing for {$lookup} in '{$lang}'");
     }
     foreach ($replacements as $find => $replace) {
         $text = str_replace($find, $replace, $text);
     }
     return $text;
 }
Exemplo n.º 11
0
    public function in()
    {
        global $user, $core;
        if ($user->v('is_member')) {
            redirect(_link());
        }
        if (_button()) {
            $v = $this->__(w('username password lastpage'));
            $userdata = w();
            if (!f($v['username']) || !f($v['password']) || !preg_match('#^([a-z0-9\\_\\-]+)$#is', $v['username'])) {
                $this->error('LOGIN_ERROR');
            }
            if (!$this->errors()) {
                $v['username'] = array_key(explode('@', $v['username']), 0);
                $sql = 'SELECT *
					FROM _members
					WHERE user_username = ?
						AND user_id <> ?
						AND user_active = 1';
                if (!($userdata = _fieldrow(sql_filter($sql, $v['username'], U_GUEST)))) {
                    $this->error('LOGIN_ERROR');
                }
                if (!$this->errors()) {
                    if (!$core->v('signin_pop')) {
                        if (isset($userdata['user_password']) && $userdata['user_password'] === _password($v['password'])) {
                            $user->session_create($userdata['user_id']);
                            redirect($v['lastpage']);
                        }
                        $this->error('LOGIN_ERROR');
                    } else {
                        require_once XFS . 'core/pop3.php';
                        $pop3 = new pop3();
                        if (!$pop3->connect($core->v('mail_server'), $core->v('mail_port'))) {
                            $this->error('LOGIN_ERROR');
                        }
                        if (!$this->errors() && !$pop3->user($v['username'])) {
                            $this->error('LOGIN_ERROR');
                        }
                        if (!$this->errors() && !$pop3->pass($v['password'], false)) {
                            $this->error('LOGIN_ERROR');
                        }
                        $pop3->quit();
                        if (!$this->errors()) {
                            $user->session_create($userdata['user_id']);
                            redirect($v['lastpage']);
                        }
                    }
                }
            }
        }
        _login(false, $this->get_errors());
    }
Exemplo n.º 12
0
    public function __construct()
    {
        $sql = 'SELECT *
			FROM _config';
        $this->config = sql_rowset($sql, 'config_name', 'config_value');
        if ($this->v('site_disable')) {
            exit('not_running');
        }
        $address = $this->v('site_address');
        $host_addr = array_key(explode('/', array_key(explode('//', $address), 1)), 0);
        if ($host_addr != get_host()) {
            $allow_hosts = get_file(XFS . XCOR . 'store/domain_alias');
            foreach ($allow_hosts as $row) {
                if (substr($row, 0, 1) == '#') {
                    continue;
                }
                $remote = strpos($row, '*') === false;
                $row = !$remote ? str_replace('*', '', $row) : $row;
                $row = str_replace('www.', '', $row);
                if ($row == get_host()) {
                    $sub = str_replace($row, '', get_host());
                    $sub = f($sub) ? $sub . '.' : ($remote ? 'www.' : '');
                    $address = str_replace($host_addr, $sub . $row, $address);
                    $this->v('site_address', $address, true);
                    break;
                }
            }
        }
        if (strpos($address, 'www.') !== false && strpos(get_host(), 'www.') === false && strpos($address, get_host())) {
            $page_protocol = array_key(explode('//', _page()), 0);
            $a = $this->v('site_address') . str_replace(str_replace('www.', '', $page_protocol . $address), '', _page());
            redirect($a, false);
        }
        $this->cache_dir = XFS . XCOR . 'cache/';
        if (is_remote() && @file_exists($this->cache_dir) && @is_writable($this->cache_dir) && @is_readable($this->cache_dir)) {
            $this->cache_f = true;
        }
        //
        // Load additional objects.
        //
        $this->email = _import('emailer');
        $this->cache = _import('cache');
        return;
    }
Exemplo n.º 13
0
 public function before()
 {
     // Setup extra configuration, e.g. Twitter
     $config = Config::load('notex');
     Config::define_constants($config['twitter']);
     Config::define_constants($config['notes']);
     // Setup global variables and rendering data
     $uri = $_SERVER['REQUEST_URI'];
     $this->render->username = $this->username = $this->username_from_host();
     $this->render->screen_name = $this->screen_name = Twitter::screen_name($this->session->access_token);
     $this->render->is_owner = $this->is_owner = $this->screen_name && $this->screen_name == $this->username;
     $this->render->copy = '';
     $this->render->debug = '';
     $this->render->layout = 'notepad';
     $this->host_ip = array_key($_SERVER, 'HTTP_X_FORWARDED_FOR', $_SERVER['REMOTE_ADDR']);
     $title = ($this->username ? $this->username . '.' : '') . 'noted.cc';
     $title .= $uri == '/' ? ' | web notepad' : $uri;
     $this->render->title = $title;
     // Handle alternative content types, e.g. XML and JSON
     $type = $this->app->get_content_type();
     if ($type != 'html') {
         $this->respond_with_data_as($type);
     }
 }
 public function process($pParams)
 {
     extract($pParams);
     //are there any values given ?
     if (empty($values)) {
         throw new CopixTemplateTagException("[plugin CSV] parameter 'values' cannot be empty");
         return;
     }
     //checking if values is an array
     if (!is_array($values)) {
         throw new CopixTemplateTagException("[plugin CSV] parameter 'values' must be an array");
         return;
     }
     //checinkg if value is an array of object or an array of array.
     if (count($values) <= 0) {
         $output = '';
     } else {
         $first = $values[0];
         if (is_object($first)) {
             $objectMode = true;
         } elseif (is_array($first)) {
             $objectMode = false;
         } else {
             throw new CopixTemplateTagException("[plugin CSV] parameter 'values' must be an array of object or an array of array");
         }
     }
     //the separator
     if (!(isset($separator) && is_string($separator))) {
         $separator = ',';
     }
     //no values ? empty output.
     if (count($values) <= 0) {
         $output = '';
     } else {
         $firstRow = $values[0];
         if (is_object($firstRow)) {
             $objectMode = true;
         } elseif (is_array($firstRow)) {
             $objectMode = false;
         } else {
             throw new CopixTemplateTagException("[plugin CSV] parameter 'values' must be an array of object or an array of associative array");
         }
     }
     //calculating headers.
     if (!empty($displayHeaders) && $displayHeaders) {
         if ($objectMode) {
             $headers = get_object_vars($firstRow);
         } else {
             $headers = array_key($firstRow);
         }
         $output .= implode($separator, $headers) . "\n";
     }
     //exporting values into csv
     foreach ($values as $rowNumber => $rowValues) {
         $rowValues = $objectMode ? array_values(get_object_vars($rowValues)) : array_values($rowValues);
         $output .= implode($separator, $rowValues) . "\n";
     }
     //now sorting elements.
     //TODO.
     return $output;
 }
Exemplo n.º 15
0
 /**
  * Return whether a session key is serialized (and optionally set this flag)
  *
  * @param String $key the session key
  * @param Boolean $is_serialized the flag's setting (optional)
  * @return Boolean whether or not the session key is serialized
  */
 public function is_serialized($key, $is_serialized = NULL)
 {
     $flag = '__' . $key;
     if (is_bool($is_serialized)) {
         return $this->session[$flag] = $is_serialized;
     } else {
         return array_key($this->session, $flag) ? TRUE : FALSE;
     }
 }
Exemplo n.º 16
0
 /**
  * Returns the name of a symbol from its unique ID.
  *
  * @param integer $symid  The ID of the symbol
  *
  * @return string  The name of the symbol or PEAR_Error on error
  */
 function symname($symid)
 {
     /* Don't we have this symbol in the symbol cache yet? */
     $this->_connect();
     if (in_array($symid, $this->_symcache)) {
         return array_key($symid, $this->_symcache);
     }
     $query = 'SELECT symname FROM luxor_symbols WHERE symid = ?';
     $values = array($symid);
     $symname = $this->_db->getOne($query, $values);
     $this->_symcache[$symname] = $symid;
     return $symname;
 }
Exemplo n.º 17
0
 public static function info($access_token, $key)
 {
     return is_array($access_token) ? array_key($access_token, $key) : NULL;
 }
Exemplo n.º 18
0
 /**
  * Create a new Data_MySQLi object
  *
  * @param Array $options an array of options (hostname, username, password)
  */
 public function __construct($options = array())
 {
     $this->hostname = array_key($options, Symbol::HOSTNAME, DB_HOSTNAME);
     $this->username = array_key($options, Symbol::USERNAME, DB_USERNAME);
     $this->password = array_key($options, Symbol::PASSWORD, DB_PASSWORD);
 }
Exemplo n.º 19
0
 /**
  * Convert a word into a URL-friendly equivalent without any accents
  * e.g. "súper mercado" ==> "super_mercado"
  *
  * @param String $word the word to urlize
  * @return String the urlized word
  */
 public static function urlize($word)
 {
     static $urlized = array();
     if ($found = array_key($urlized, $word)) {
         return $found;
     }
     return $urlized[$word] = self::singleton()->urlize($word);
 }
Exemplo n.º 20
0
function _rowset_style_row($row, $style, $prefix = '', $comp_orig = false, $comp_dest = false)
{
    if (f($prefix)) {
        $prefix .= '_';
    }
    $f = w();
    foreach ($row as $_f => $_v) {
        $g = array_key(array_slice(explode('_', $_f), -1), 0);
        $f[strtoupper($prefix . $g)] = $_v;
    }
    if ($comp_orig !== false && isset($row[$comp_orig])) {
        $f['SELECTED'] = $comp_dest === $row[$comp_orig];
    }
    return _style($style . '.row', $f);
}
Exemplo n.º 21
0
    $c->addAscendingOrderByColumn(AbsenceSaisiePeer::CREATED_ON);
  }

  // On ne veut que les absences qui concernent le jour d'aujourd'hui :
  $deb_creneau  = CreneauPeer::getFirstCreneau();
  $_ts          = $deb_creneau->getDebutCreneau() + mktime(0, 0, 0, date("m"), date("d"), date("Y")) - 3600; // on conserve une marge de 1 heure avant le premier creneau
  $c->add(AbsenceSaisiePeer::FIN_ABS, $_ts, Criteria::GREATER_EQUAL);
  
  $liste_absents_brute = AbsenceSaisiePeer::doSelect($c);
  //aff_debug($liste_absents_brute[3]->getJTraitementSaisies());exit();

  foreach ($liste_absents_brute as $absents){
     if (!in_array($absents->getEleve()->getIdEleve(), $tab_absents)){
       $tab_absents[$absents->getEleve()->getIdEleve()][] = $absents;
     }else{
       $place = array_key($tab_absents, $absents->getEleve()->getIdEleve());
       $tab_absents[$place][] = $absents;
     }
  }


  /***************** On élabore un petit tableau du suivi créneau par créneau *******************/
  $aff_creneaux = CreneauHelper::afficherPetitTableauDesCreneaux();
  $tab_creneaux = CreneauPeer::getAllCreneauxOrderByTime();
  /********************* Fin du petit tableau des créneaux **************************************/


}catch(exception $e){
  affExceptions($e);
}
//**************** EN-TETE *****************
Exemplo n.º 22
0
function _rowset_style_row($row, $style, $prefix = '')
{
    if (f($prefix)) {
        $prefix .= '_';
    }
    $f = w();
    foreach ($row as $_f => $_v) {
        $g = array_key(array_slice(explode('_', $_f), -1), 0);
        $f[strtoupper($prefix . $g)] = $_v;
    }
    return _style($style . '.row', $f);
}
Exemplo n.º 23
0
            <li<?php 
echo array_key($active_tab, 'project/code');
?>
><?php 
echo HTML::link("project/code", 'Code browser');
?>
</li>
            <li<?php 
echo array_key($active_tab, 'phpdocs');
?>
><?php 
echo HTML::link("phpdocs", 'PHP Docs');
?>
</li>
            <li<?php 
echo array_key($active_tab, 'project/download');
?>
><?php 
echo HTML::link("project/download", 'Download');
?>
</li>
        </ul>
    </div>

    <div id="widgets">
        <!-- TODO -->
    </div>

    <div id="body">
        <div id="main_col">
            <div id="content">
Exemplo n.º 24
0
function _link($mod = '', $attr = false, $ts = true)
{
    global $core;
    $url = get_protocol() . array_key(explode('://', $core->v('address')), 1);
    if ($mod == 'alias' && $attr !== false && is_remote()) {
        $alias = $attr;
        if (is_array($attr)) {
            $alias = '';
            if (isset($attr['alias'])) {
                $alias = $attr['alias'];
                unset($attr['alias']);
            }
            $attr = count($attr) ? $attr : false;
        }
        if ($alias != '') {
            $url = str_replace('www', $alias, $url);
        }
    }
    if (is_string($mod) && strpos($mod, ' ') !== false) {
        $attr_v = $attr;
        $attr = w();
        foreach (explode(' ', $mod) as $k => $v) {
            if (strpos($v, ':') !== false) {
                list($k, $v) = explode(':', $v);
            }
            $attr[$k] = $v;
        }
        $mod = array_shift($attr);
        if ($attr_v !== false) {
            if (!is_array($attr_v)) {
                $attr_v = array($attr_v);
            }
            $attr = array_merge($attr, $attr_v);
        }
    }
    $url .= $mod != '' ? $mod . ($ts ? '/' : '') : '';
    if ($attr !== false) {
        $url .= _linkp($attr, $mod != 'fetch' && $ts);
    }
    return strtolower($url);
}
Exemplo n.º 25
0
 /**
  * Get a data field value from this model object
  *
  * @param String $field the data field to read
  * @return String the value of the data field
  */
 public function __get($field)
 {
     return array_key($this->data, $field);
 }
Exemplo n.º 26
0
/**
* Plugin smarty type fonction
* Purpose:  generation of a CSV content file
*
* Input:    values           = (required) array of objects, or array of hash array
*           order            = (optional) if given, the resulting CSV file will be sorted by this fields.
*           separator        = (optional) the separator for the csv file. (default is "," [comma])
*           displayHeaders   = (optional) if we wants to output the headers
* Examples:
* {csv values=$arObjects displayHeaders=false order=$array displayHeaders=false}
*/
function smarty_function_csv($params, &$this)
{
    extract($params);
    //are there any values given ?
    if (empty($values)) {
        $this->_trigger_fatal_error("[plugin CSV] parameter 'values' cannot be empty");
        return;
    }
    //checking if values is an array
    if (!is_array($values)) {
        $this->_trigger_fatal_error("[plugin CSV] parameter 'values' must be an array");
        return;
    }
    //checinkg if value is an array of object or an array of array.
    if (count($values) <= 0) {
        $output = '';
    } else {
        $first = $values[0];
        if (is_object($first)) {
            $objectMode = true;
        } elseif (is_array($first)) {
            $objectMode = false;
        } else {
            $this->_trigger_fatal_error("[plugin CSV] parameter 'values' must be an array of object or an array of array");
        }
    }
    //the separator
    if (!(isset($separator) && is_string($separator))) {
        $separator = ',';
    }
    //no values ? empty output.
    if (count($values) <= 0) {
        $output = '';
    } else {
        $firstRow = $values[0];
        if (is_object($firstRow)) {
            $objectMode = true;
        } elseif (is_array($firstRow)) {
            $objectMode = false;
        } else {
            $this->_trigger_fatal_error("[plugin CSV] parameter 'values' must be an array of object or an array of associative array");
        }
    }
    //calculating headers.
    if ($displayHeaders) {
        if ($objectMode) {
            $headers = get_object_vars($firstRow);
        } else {
            $headers = array_key($firstRow);
        }
        $output .= implode($separator, $headers) . "\n";
    }
    //exporting values into csv
    foreach ($values as $rowNumber => $rowValues) {
        $rowValues = $objectMode ? array_values(get_object_vars($rowValues)) : array_values($rowValues);
        $output .= implode($separator, $rowValues) . "\n";
    }
    //now sorting elements.
    //TODO.
    //processing output
    if (!empty($assign)) {
        $this->assign($assign, $toReturn);
        return;
    } else {
        return $output;
    }
}
Exemplo n.º 27
0
 public function getHumanColumnNames()
 {
     return array_key($this->getHumanColumns());
 }
Exemplo n.º 28
0
 /**
  * Get a table that matches an alias, or return NULL if no alias was setup
  *
  * @param String $alias the alias, e.g. "parent"
  * @return String the aliased table, or NULL if no alias was setup
  */
 private function get_renaming_for($alias)
 {
     $table = $this->get_table();
     return array_key(self::$renamings, "{$table}.{$alias}");
 }
Exemplo n.º 29
0
    protected function _search_status()
    {
        gfatal();
        $v = $this->__(array('s', 'e'));
        $sql = 'SELECT *
			FROM _tickets_status
			WHERE status_alias = ?';
        if (!($status = _fieldrow(sql_filter($sql, $v['s'])))) {
            $this->_error('#E_COMPUTER_NO_STATUS');
        }
        global $user;
        //if (_auth_get('ticket_view_all'))
        if ($user->auth_groups() != -1) {
            $build = 'SELECT t.*, mb.user_id, mb.user_active, mb.user_firstname, mb.user_lastname
				FROM _tickets t, _members mb
				WHERE t.ticket_contact = mb.user_id
					AND t.ticket_status = ?
					AND t.ticket_group IN (??)
					AND t.ticket_deleted = 0
				ORDER BY t.ticket_start DESC';
            $build = sql_filter($build, $status['status_id'], $user->auth_groups());
        } else {
            $build = 'SELECT t.*, mb.user_id, mb.user_active, mb.user_firstname, mb.user_lastname
				FROM _tickets t, _members mb
				WHERE t.ticket_contact = mb.user_id
					AND t.ticket_status = ?
					AND t.ticket_contact = ?
					AND t.ticket_deleted = 0
				ORDER BY t.ticket_start DESC';
            $build = sql_filter($build, $status['status_id'], $user->v('user_id'));
        }
        return redirect(_link($this->m(), array('x1' => 'search', 'q' => array_key(sql_cache($build), 'sid'), 'e' => $v['e'])));
    }
Exemplo n.º 30
0
Arquivo: bio.php Projeto: nopticon/npt
    public function v($d = false, $v = false)
    {
        if ($d === false) {
            if (!$this->base) {
                return false;
            }
            return $this->base;
        }
        $mode = array_key(explode('_', $d), 0);
        $key = str_replace($mode . '_', '', $d);
        $response = false;
        switch ($mode) {
            case 'ip':
                $response = $this->ip;
                break;
            case 'is':
                $bio_id = $this->v('bio_id');
                switch ($key) {
                    case 'bio':
                        if (!isset($this->auth_bio[$bio_id][$d])) {
                            $this->auth_bio[$bio_id][$d] = $this->base->bio_id > 1 && $this->base->bio_active;
                        }
                        return $this->auth_bio[$bio_id][$d];
                        break;
                    default:
                        break;
                }
                break;
            case 'auth':
                $bio_id = $this->v('bio_id');
                if (!isset($this->auth_bio[$bio_id])) {
                    $sql = 'SELECT *
						FROM _bio_auth a, _bio_auth_field f
						WHERE a.auth_bio = ?
							AND a.auth_field = f.field_id
						ORDER BY f.field_name';
                    $this->auth_bio[$bio_id] = sql_rowset(sql_filter($sql, $bio_id), 'field_alias', 'auth_value');
                }
                /*
                					// Ultimately to be removed
                					$this->base['is_member'] = ($this->base['bio_id'] != 1) ? true : false;
                					$this->base['is_founder'] = ($this->base['bio_id'] != 1 && $this->base['bio_level'] == 4) ? true : false;
                					$this->base['is_bot'] = false;
                					
                					if ($this->base['is_member'])
                					{
                						return true;
                					}
                */
                /*
                case 'founder':
                	$response = ($this->base['bio_id'] != 1 && $this->base['bio_level'] == 4);
                	break;
                case 'identity':
                	$response = ($this->base['bio_id'] != 1);
                	break;
                case 'nameless':
                	$response = ($this->base['bio_id'] == 1);
                	break;
                case 'robot':
                	
                	break;
                */
                $response = isset($this->auth_bio[$bio_id]->{$key}) ? true : false;
                break;
            case 'bio':
                switch ($key) {
                    case 'age':
                        if (!isset($this->base[$d])) {
                            // TODO: Calculate age based on birthday
                        }
                        break;
                }
                if ($v !== false) {
                    $this->base[$d] = $v;
                }
                $response = isset($this->base->{$d}) ? $this->base->{$d} : false;
                break;
            case 'session':
                if ($v !== false) {
                    $this->{$key} = $v;
                }
                $response = isset($this->{$key}) ? $this->{$key} : false;
                break;
            default:
                break;
        }
        return $response;
    }