예제 #1
0
파일: AddressBook.php 프로젝트: spinit/osy
 private function pageView()
 {
     if ($this->__par['row_shw'] < 1) {
         return true;
     }
     try {
         $sql = env::replaceVariable($this->get_par('datasource-sql'));
         $sql = env::parseString($sql);
         $this->__par['datasource-sql'] = $sql;
         $this->__par['row_tot'] = env::$dba->exec_unique("SELECT COUNT(*) FROM (" . $this->__par['datasource-sql'] . ") a");
     } catch (Exception $e) {
         echo $e->getMessage();
         echo $this->__par['datasource-sql'];
     }
     $this->__par['pag_tot'] = ceil($this->__par['row_tot'] / $this->__par['row_shw']);
     if ($this->__par['pag_cur'] >= $this->__par['pag_tot'] && !empty($_REQUEST['ajax'])) {
         return false;
     }
     $where = '';
     if ($filter = $this->get_par('filter')) {
         $where = 'where ' . implode(' AND ', $filter);
     }
     if (array_key_exists('osy', $_REQUEST) && !empty($_REQUEST['osy']['rid'])) {
         $where = (empty($where) ? 'WHERE ' : $where . ' AND ') . str_replace(array('pkey[', ']', '&'), array('', '', ' AND '), $_REQUEST['osy']['rid']);
     }
     $this->__par['datasource-sql'] = 'SELECT a.* 
                                       FROM (' . $this->__par['datasource-sql'] . ') a
                                      ' . $where . '
                                       ORDER BY 2
                                       LIMIT ' . $this->__par['pag_cur'] * $this->__par['row_shw'] . ',' . $this->__par['row_shw'];
     return true;
 }
예제 #2
0
파일: HelperOsy.php 프로젝트: spinit/osy
 /**
  *  Exec test on php string and return the result
  *
  *  @param string $str Contains sesssionid token
  *
  *  @return bool
  */
 public static function test($str)
 {
     $cod = str_replace('TEST', '$res = ', env::replaceVariable($str) . ';');
     eval($cod);
     return $res;
 }