Exemple #1
0
 /**
  * 初始化参数
  * @param $page 当前页码
  * @param $size 页面大小
  * @param $count 总记录条数
  * @param $set 设置当前页的左右边有多少个链接(默认5个)
  */
 public static function init($page, $size, $count, $set = 5)
 {
     self::$page = $page;
     self::$size = $size;
     self::$count = $count;
     self::$query = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
     $i = strrpos(self::$query, 'page');
     if ($i) {
         self::$query = substr(self::$query, 0, $i);
     }
     $parse_url = parse_url(self::$query);
     $parse_url['query'] = preg_replace('/[\\?]*&*/', '', $parse_url['query']);
     if (!strlen($parse_url['query']) && self::$rewrite === false) {
         self::$is_frist = true;
         self::$query = $parse_url['scheme'] . '://' . $parse_url['host'] . $parse_url['path'] . '?';
     }
     $i = strrpos(self::$query, '/');
     if ($i != strlen(self::$query) - 1) {
         self::$query .= '/';
     }
     self::$set = $set;
     self::$total = ceil(self::$count / self::$size);
     if (self::$rewrite === true) {
         self::$op = '/';
     } else {
         self::$op = '=';
         self::$query = substr(self::$query, 0, -1);
         if (strrpos(self::$query, '&') === false) {
             if (self::$is_frist === false) {
                 self::$query .= '&';
             }
         }
     }
 }
Exemple #2
0
 /**
  * Constructor
  */
 function random(&$db, &$auth, $msg)
 {
     parent::page(&$db, &$auth, $msg);
     global $_GET;
     // limit
     $limit = $_GET['limit'];
     if (is_numeric($limit)) {
         $limit = intval($limit);
         if ($limit > 0) {
             $this->limit = $limit;
             if ($limit > $this->max) {
                 $this->limit = $this->max;
             }
         }
     }
     // min length
     $min_length = $_GET['min_length'];
     if (is_numeric($min_length)) {
         $min_length = intval($min_length);
         if ($min_length > 0) {
             $this->min_length = $min_length;
         }
     }
     // max length
     $max_length = $_GET['max_length'];
     if (is_numeric($max_length)) {
         $max_length = intval($max_length);
         if ($max_length > 0) {
             $this->max_length = $max_length;
         }
     }
     // sanity check: if min_length > max_length, then make them equal
     if ($this->min_length && $this->max_length) {
         if ($this->min_length > $this->max_length) {
             $this->min_length = $this->max_length;
         }
     }
 }
Exemple #3
0
 /**
  * Constructor
  */
 function home(&$db, &$auth, $msg)
 {
     parent::page(&$db, &$auth, $msg);
 }
Exemple #4
0
 /**
  * Constructor
  */
 function proverb(&$db, &$auth, $msg)
 {
     parent::page(&$db, &$auth, $msg);
     $this->db->defaults['rperpage'] = 20;
 }
 /**
  * Constructor
  */
 function dictionary(&$db, &$auth, $msg)
 {
     parent::page(&$db, &$auth, $msg);
     $this->abbrevs = $this->db->get_row_assoc('SELECT * FROM sys_abbrev', 'abbrev', 'label');
     $this->abbrevs['var'] = 'Variasi ejaan';
 }
Exemple #6
0
 /**
  * Constructor
  */
 function doc(&$db, &$auth, $msg)
 {
     parent::page(&$db, &$auth, $msg);
 }
 /**
  * Constructor
  */
 function comment(&$db, &$auth, $msg)
 {
     parent::page(&$db, &$auth, $msg);
 }
Exemple #8
0
 /**
  * Constructor
  */
 function user(&$db, &$auth, $msg)
 {
     parent::page(&$db, &$auth, $msg);
     $this->status = PROCESS_NONE;
 }
 /**
  * Constructor
  */
 function glossary(&$db, &$auth, $msg)
 {
     parent::page(&$db, &$auth, $msg);
 }
Exemple #10
0
 /**
  * Constructor
  */
 function abbr(&$db, &$auth, $msg)
 {
     parent::page(&$db, &$auth, $msg);
 }
 /**
  * Constructor
  */
 function dictionary(&$db, &$auth, $msg)
 {
     parent::page(&$db, &$auth, $msg);
 }