get() 공개 메소드

public get ( $url, $callback )
예제 #1
0
파일: main.handler.php 프로젝트: rigidus/ea
 function path()
 {
     $sep = ' <span>&rarr;</span> ';
     $first = params::get('first');
     $last = params::get('last');
     $i = 0;
     foreach (web::$pages as $v) {
         if ($first == 'no' && $v['page_folder'] == '/') {
             continue;
         }
         if ($last == 'no' && $v['page_id'] == PAGE_ID) {
             continue;
         }
         if ($v['page_folder'] == '/users/[dynamic]/') {
             $v['page_folder'] = '/users/' . router::get(1) . '/';
             $v['page_title'] = router::get(1);
         }
         if ($v['page_id'] == PAGE_ID) {
             $path_item = web::get('page_title');
         } else {
             $path_item = '<a href="' . $v['page_folder'] . '">' . $v['page_title'] . '</a>';
         }
         s::roll('page_path', array('path_item' => $path_item));
         if ($v['page_id'] != PAGE_ID) {
             s::roll('page_path', array('path_item' => $sep));
         }
     }
 }
예제 #2
0
파일: Model.php 프로젝트: meetcd/sofast
 public function getJson($addWhere = '', $addSql = '', $showMax = 12)
 {
     $sort = input::getInput("mix.sort") ? input::getInput("mix.sort") : 'id';
     $order = input::getInput("mix.order") ? input::getInput("mix.order") : "asc";
     $page = input::getInput("mix.page") ? input::getInput("mix.page") : 1;
     $rows = input::getInput("mix.rows") ? input::getInput("mix.rows") : 10;
     $db = sf::getLib("db");
     if ($select) {
         $sql = $select . " ";
     } else {
         $sql = "SELECT * FROM `" . $this->table . "` ";
     }
     $addWhere && ($sql .= "WHERE " . $addWhere . " ");
     if ($addSql) {
         $sql .= $addSql . " ";
     } else {
         $sql .= " ORDER BY {$sort} {$order} ";
     }
     if (!router::get("totalnum" . $key)) {
         $query = $db->query($sql);
         $total = $db->num_rows($query);
     } else {
         $total = router::get("totalnum" . $key);
     }
     $sql .= "LIMIT " . $rows * ($page - 1) . "," . $rows;
     $query = $db->query($sql);
     while ($row = $db->fetch_array($query)) {
         $result[] = $this->fillObject($row)->toArray();
     }
     return '{"total":' . $total . ',"rows":' . json_encode($result) . '}';
 }
예제 #3
0
function getColumnStr($subject = '', $orderfield = '')
{
    $result = router::get();
    $result['ordermode'] = $result['ordermode'] == 'DESC' ? 'ASC' : 'DESC';
    $result['orderfield'] = $orderfield;
    $str = array_shift($result);
    $str .= '/' . array_shift($result);
    foreach ($result as $key => $val) {
        $str .= '/' . $key . '/' . $val;
    }
    return link_to($str, $subject, array('class' => $result['ordermode']));
}
예제 #4
0
파일: loader.php 프로젝트: rigidus/ea
 function start()
 {
     db::connect();
     if (!router::get(1)) {
         return true;
     }
     self::$map = array('mode' => router::get(0), 'app' => router::get(1), 'module' => 'main', 'action' => router::get(2), 'id' => router::get(4));
     s::set('SYS_PATH', 'http://' . SERVER . SYS_DIR);
     define('APP', APPS . self::get('app') . '/');
     s::set('APP', APP);
     define('MODULE', APP . self::get('module') . '/');
     s::set('MODULE', MODULE);
     if (stristr(self::$map['mode'], 'admin')) {
         self::$map['mode'] = 'admin';
     } else {
         self::$map['mode'] = 'web';
     }
     if (self::$map['mode'] == 'admin') {
         if (defined('ADMIN_USER_SITE_ID')) {
             admin::observer();
             define('ADMIN_SITE_ID', ADMIN_USER_SITE_ID);
             s::set('ADMIN_SITE_ID', ADMIN_USER_SITE_ID);
             db::table('admin_sites');
             db::where('site_id', ADMIN_USER_SITE_ID);
             db::limit(1);
             $row = db::select();
             define('ADMIN_SITE', db::get('site_domain'));
             s::set('ADMIN_SITE', ADMIN_SITE);
         }
     } else {
         web::getSite();
         $lang = lang::gets(LANG_INDEX, SITE_ID);
         /*
         	Authentification webUser
         */
         web::observer();
     }
     /*
     	Set params
     */
     params::send();
     if (router::get(0) == 'feed' || router::get(0) == 'rss') {
         self::$map['module'] = 'feed';
     }
     if (self::$map['mode'] == 'admin') {
         load::module(self::get('app'), self::get('module'), self::get('action'));
     } else {
         load::handler(self::get('app'), self::get('module'), self::get('action'));
     }
 }
예제 #5
0
 public function getPager($addWhere = '', $addSql = '', $showMax = 20, $select = '', $key = '', $form_vars = array())
 {
     $db = sf::getLib("db");
     if ($select) {
         $sql = $select . " ";
     } else {
         $sql = "SELECT * FROM `" . $this->table . "` ";
     }
     $addWhere && ($sql .= "WHERE " . $addWhere . " ");
     $addSql && ($sql .= $addSql . " ");
     if (!router::get("totalnum" . $key)) {
         $query = $db->query($sql);
         $total = $db->num_rows($query);
     } else {
         $total = router::get("totalnum" . $key);
     }
     $pager = sf::getLib("pager", $total, $showMax, $key, $form_vars);
     $sql .= "LIMIT " . $pager->getStartNum() . "," . $pager->getShowNum();
     $query = $db->query($sql);
     $pager->setField($db->result_array($query));
     $pager->setObject(clone $this);
     return $pager;
 }
예제 #6
0
파일: Helpers.php 프로젝트: meetcd/sofast
 function getColumnStr($subject = '', $orderfield = '')
 {
     $result = router::get();
     $o_orderfield = $result['orderfield'];
     $result['ordermode'] = $result['ordermode'] == 'DESC' ? 'ASC' : 'DESC';
     $result['orderfield'] = $orderfield;
     if (config::get('token_open', false)) {
         array_shift($result);
         unset($_GET['token']);
         unset($result['token']);
     }
     $str = array_shift($result);
     $str .= '/' . array_shift($result);
     foreach ($result as $key => $val) {
         $str .= '/' . $key . '/' . $val;
     }
     //为排序字段加上标记
     if ($o_orderfield == $orderfield) {
         $class = array('class' => $result['ordermode']);
     } else {
         $class = array();
     }
     return link_to($str, $subject, $class);
 }
예제 #7
0
파일: admin.php 프로젝트: rigidus/ea
 function map()
 {
     self::$map = array('app' => router::get(1), 'module' => router::get(2), 'action' => router::get(3), 'id' => router::get(4), 'title' => 'Legenda', 'mode' => 'simple', 'rule' => 'all');
     if (!router::get(1)) {
         self::$map['app'] = self::$start_app;
     }
     if (!router::get(2)) {
         self::$map['module'] = 'main';
     }
     if (!router::get(3)) {
         self::$map['action'] = 'view';
     }
 }
예제 #8
0
파일: ajax.php 프로젝트: rigidus/ea
 function start()
 {
     db::connect();
     if (!router::get(1)) {
         return true;
     }
     self::$map = array('mode' => router::get(0), 'app' => router::get(1), 'module' => 'main', 'action' => router::get(2));
     if (router::get(3)) {
         self::set('module', router::get(2));
         self::set('action', router::get(3));
     }
     s::set('SYS_PATH', 'http://' . SERVER . SYS_DIR);
     define('APP', APPS . self::get('app') . '/');
     s::set('APP', APP);
     define('MODULE', APP . self::get('module') . '/');
     s::set('MODULE', MODULE);
     /*
     	Lang items
     */
     if (self::get('mode') == 'webAjax') {
         web::getSite();
         $lang = lang::gets(LANG_INDEX, SITE_ID);
         /*
         	Authentification webUser
         */
         web::observer();
     } else {
         define('LANG_INDEX', SYS_INDEX);
         $lang = lang::gets(LANG_INDEX);
         admin::observer();
         if (defined('ADMIN_USER_SITE_ID')) {
             define('ADMIN_SITE_ID', ADMIN_USER_SITE_ID);
             s::set('ADMIN_SITE_ID', ADMIN_USER_SITE_ID);
             $group_rules = ini::parse(SYS_ROOT . 'conf/admin/groups.ini', ADMIN_USER_GROUP_ID);
             define('RULE', $group_rules['rule']);
             db::table('admin_sites');
             db::where('site_id', ADMIN_USER_SITE_ID);
             db::limit(1);
             define('ADMIN_SITE', db::get('site_domain'));
             s::set('ADMIN_SITE', ADMIN_SITE);
         }
     }
     /*
     	Set params
     */
     params::send();
     $tmpl = params::get('tmpl');
     $sys = false;
     if (self::get('mode') == 'adminAjax') {
         $sys = true;
     }
     buffer::init(0, self::get('app'), false, $tmpl);
     if (self::get('mode') == 'webAjax') {
         load::handler(self::get('app'), self::get('module'), self::get('action'));
     } else {
         load::module(self::get('app'), self::get('module'), self::get('action'));
     }
     /*
     	Get plugin action
     */
     ob_start();
     /*
     	запуск обработчика с возвратом данных
     	тут два варианта либо данные просто выводим если нет шаблона, а если есть то сначала обрабатываем шаблон
     
     	если буффер полный выводим информацию из него
     */
     $buffer = buffer::gets();
     if ($buffer[0]) {
         if ($sys) {
             buffer::$module = self::get('module');
         }
         $section = params::get('section');
         echo buffer::get($buffer[0]['app'], $buffer[0]['tmpl'], $buffer[0]['data'], $section, $sys);
     }
     $code = ob_get_contents();
     ob_clean();
     s::$mode = 'code';
     s::setTmpl($code, $lang);
     s::display();
 }
예제 #9
0
function get($url, $fun)
{
    router::get($url, $fun);
}