Beispiel #1
0
 public static function run()
 {
     if (!isset($_SERVER['REDIRECT_URL'])) {
         throw new Exception();
     }
     $_SERVER['REDIRECT_URL'] = substr($_SERVER['REDIRECT_URL'], strlen(config::prefix()));
     $path = explode('/', $_SERVER['REDIRECT_URL']);
     //array_shift($path);
     if ($path && preg_match('/^[0-9a-z]+$/i', $path[0])) {
         req::$controller = array_shift($path);
         if ($path && preg_match('/^[0-9a-z]+$/i', $path[0])) {
             req::$function = array_shift($path);
         }
     }
     unset($path);
     session::get_instance()->start();
     if (uuid::check(req::$controller)) {
         $obj = state::load(req::$controller);
         if (!$obj instanceof ctrl) {
             throw new Exception();
         }
         call_user_func(array($obj, req::$function));
     } else {
         $obj = eval('return new ' . req::$controller . '_ctrl();');
         if (!$obj instanceof ctrl) {
             throw new Exception();
         }
         util::redirect($obj, req::$function, $_GET);
     }
 }
Beispiel #2
0
 public function _storeData()
 {
     #setup some variables
     $user_id = $_SESSION['use_id'];
     $this->_isUpd();
     #get fields
     $this->fields = $this->is_update ? dbfn::_getupdatefields($this->table) : dbfn::_getinsertfields($this->table);
     #build query
     $query = $this->is_update ? dbfn::_buildupdate($this->fields, $this->table, $this->prikey) : dbfn::_buildinsert($this->fields, $this->table);
     #get changes to the data
     $this->_getDataChanges();
     #execute query
     $oResult = new db($query);
     $this->rowid = $this->is_update ? $this->rowid : $oResult->insert_id;
     #format output
     $output = $oResult->ret;
     #determine if operation was a success and store in history
     if ($output['msg_class'] == "success") {
         aimsys::_history($query, $this->changes, $this->table, $this->rowid);
         $output['js'] = $this->is_update || req::_('popup') != 0 ? "" : "Tabs.activeTab.new2view('{$this->table}','{$this->rowid}');";
         //additional javascript to run for new records
         $output['rowid'] = $this->rowid;
     }
     return $output;
 }
 function themeSaveOptionsRedirect($location, $status)
 {
     $urlData = parse_url($location);
     $reqType = req::getVar('reqType');
     if ($status == 302 && $reqType == 'ajax' && isset($urlData['path']) && isset($urlData['query']) && strpos($urlData['path'], 'wp-admin') !== false && $urlData['query'] == 'page=theme_settings&settings-updated=true') {
         return false;
     }
     return $location;
 }
Beispiel #4
0
 public static function _buildselect($table, $pkey)
 {
     $select = "SELECT * FROM `%s` WHERE `%s` = %s LIMIT 1";
     $s[] = $select;
     $s[] = $table;
     $s[] = $pkey;
     $s[] = req::_($pkey);
     $select = call_user_func_array('sprintf', $s);
     return $select;
 }
Beispiel #5
0
 public function __construct($table, $cid = 'new')
 {
     global $view;
     $this->option = $view;
     $this->table = $table;
     $this->cid = $cid;
     $this->cols = dbfn::_getfields("aimnotes");
     $this->popup = req::_('popup');
     $this->editing = req::_('editing');
     $this->params = array();
     foreach ($this->cols as $col) {
         $oTemp = new colparams($this->table, $col);
         $this->params[$col] = $oTemp->_getvalues();
     }
 }
 public function __construct($table)
 {
     $_SESSION['rows_per_page'] = req::_('rows_per_page', 10, '_SESSION');
     $this->table = $table;
     $this->order = req::_('order', dbfn::_getprimary($table));
     $this->order_dir = req::_('dir', 'ASC');
     $this->page = req::_('page', '1');
     $this->rows_per_page = $_SESSION['rows_per_page'] = req::_('rows_per_page', $_SESSION['rows_per_page']);
     $this->filter_field = req::_('filter_field');
     $this->filter_group = req::_('filter_group', -1);
     $this->filter_group = is_array($this->filter_group) ? implode(',', $this->filter_group) : $this->filter_group;
     $this->first_record = req::_chk('page') ? (req::_('page') - 1) * $this->rows_per_page + 1 : 1;
     $this->last_record = $this->first_record + $this->rows_per_page - 1;
     $this->limit = $this->first_record - 1 . "," . $this->rows_per_page;
     $this->q = req::_('q') == 'Search Records...' ? '' : req::_('q');
     $this->where = $this->q != '' ? dbfn::_buildwhere($table, $this->q) : 1;
     $this->where .= $this->filter_group != -1 ? " AND `{$this->filter_field}` IN ({$this->filter_group})" : '';
 }
 *     Set $_db data member to current database
 *
 * function validate::check($src, $items)
 *     Take an array of data to be validated (e.g. $_POST) and check whether
 *       element fit criteria specified by $items. Each criterion manually
 *       defined within validate::check()
 *     $src: associative array of data to be validated
 *     $items: criteria to judge $src by, shares keys with $src
 *     Pushes messages to $_errors if any criterion is not met, sets $_passed to
 *       true if there were no errors, else false
 *
 * function addError($error)
 *     Push $error to $_errors array
 *     $error: Error message telling the user what needs to be corrected
*/
req::once('functions/email_validate.php');
class validate
{
    private $_passed = false, $_errors = array(), $_db = null;
    public function __construct()
    {
        $this->_db = db::getInstance();
    }
    public function check($src, $items = array())
    {
        foreach ($items as $item => $rules) {
            foreach ($rules as $rule => $rule_value) {
                $value = $src[$item];
                $item = str_replace('-', ' ', escape($item));
                if ($rule === 'required' && (empty($value) || $value == '')) {
                    $this->addError("{$item} cannot be left blank");
Beispiel #8
0
/*********************************************************************************************************************************
||																																||
||										AIMSys - Aircraft Inventory & Maintenance System										||
||										Jeremy Bloomstrom																		||
||										Ingenious Design																		||
||										jeremy@in.genio.us																		||
||										March 27, 2013																			||
||																																||
|________________________________________________________________________________________________________________________________|
||																																||
||																																||
||										popup.php																				||
||										VIEW																					||
||																																||
*********************************************************************************************************************************/
// Do Some Logic stuff
$table = req::_('table');
$rowid = req::_('rowid', 'new');
$editing = true;
// Initialize table by getting params and populating with data.
$oEditor = new editor($table, $rowid);
$oEditor->_getData();
$editor_html = $oEditor->_html();
// Get View
$oView = new view($view);
// Display View Script and View HTML
echo document::_addScript($oView->_script());
echo document::_addScript("ready.js");
include_once $oView->_html();
echo '<div class="clear"></div>';
//pre($data);
Beispiel #9
0
/*********************************************************************************************************************************
||																																||
||										AIMSys - Aircraft Inventory & Maintenance System										||
||										Jeremy Bloomstrom																		||
||										Ingenious Design																		||
||										jeremy@in.genio.us																		||
||										March 27, 2013																			||
||																																||
|________________________________________________________________________________________________________________________________|
||																																||
||																																||
||										editor.php																				||
||										VIEW																					||
||																																||
*********************************************************************************************************************************/
// Do Some Logic stuff
$table = req::_('table');
$rowid = req::_('rowid', 'new');
$editing = req::_('editing', false);
$editing = $editing == "false" ? false : $editing;
// Determine if new record or update
$content_header = $rowid != 'new' ? 'View' : 'New';
// Initialize table by getting params and populating with data.
$oEditor = new editor($table, $rowid);
$oEditor->_getData();
$editor_html = $oEditor->_refresh_edit_html();
// Get View
$oView = new view($view);
// Display View Script and View HTML
include_once $oView->_html();
echo document::_addScript($oView->_script());
Beispiel #10
0
 *  Last Updated: 	8/21/2014
 *  
 *  Changelog:
 *   8/21/2014 - Added comment header
 */
/**  **  **  **  **  **  **  **  **  **
 *   SETUP PARAMETERS
 */
global $view;
global $option;
$option = req::_('option', 'default');
$view = req::_('view', $option);
/**  **  **  **  **  **  **  **  **  **
 *   PROCESS THE REQUEST
 */
switch ($option) {
    case 'update_options':
        $table = req::_('table');
        $col = req::_('col');
        $val = req::_('value');
        $oParams = new colparams($table, $col);
        $params = $oParams->_getvalues();
        $return = editor::_getOptions($params, $val);
        echo $return;
        break;
}
?>



Beispiel #11
0
    } else {
        echo "<pre>" . $s . "</pre>";
    }
}
function preh($s)
{
    echo pre(htmlentities($s));
}
function consoleLog($s)
{
    if (is_array($s) || is_object($s)) {
        $return = "console.log(\"{\\n\"";
        foreach ($s as $key => $value) {
            $return .= " + \"\t[" . addslashes($key) . "] => " . addslashes($s->{$key}) . " \\n \"";
        }
        $return .= "+\"}\" );";
    } else {
        $return = "console.log(\"" . addslashes($s) . "\");";
    }
    return $return;
}
// RESET USER PASSWORD
if (req::_chk('reset') > 0) {
    $id = req::_('reset');
    $_REQUEST['use_id'] = $id;
    $query = "UPDATE `aimusers` SET `use_password` = md5(concat(`use_firstname`,`use_lastname`)) WHERE `use_id` = {$id} LIMIT 1";
    $oResult = new db($query);
    foreach ($oResult->ret as $key => $value) {
        ${$key} = $value;
    }
}
Beispiel #12
0
    //Prepare table object
    $oTable = new table($table, $data[$v]->rows);
    echo trim($oTable->_getJSON());
} else {
    // Iterate through each object in the data array
    foreach ($data as $view => $datum) {
        $table = TABLEPREFIX . $view;
        //Prepare table object
        $oTable = new table($table, $datum->rows);
        $body_html = $oTable->_quickview();
        //Prepare form object
        $form_html = $formdata[$view]->_getFormHTML();
        $footer_html = $formdata[$view]->_getFooterHTML();
        // Prepare subtabs
        $subtab_name = "Manage " . ucwords(str_replace("_", " ", $view));
        $subtab_class = req::_('subtab', "manage-{$content_header}") == "manage-{$view}" ? 'active' : '';
        $subtabs_html .= <<<HTML
    <li id="manage-{$view}" class="{$subtab_class} ui-corner-top">{$subtab_name}</li>
HTML;
        // Prepare content
        $content_html .= <<<HTML
\t<div id="manage-{$view}" class="{$subtab_class} part">
\t\t<div class="data row controls">{$form_html}</div>
\t\t{$body_html}
\t\t<div class="data row footer">{$footer_html}</div>
\t</div>
HTML;
    }
    // Get View
    $oView = new view('qv');
    // Display View Script and View HTML
Beispiel #13
0
 *  Created: 		11/27/2012
 *  Last Updated: 	8/21/2014
 *  
 *  Changelog:
 *   8/21/2014 - Added comment header
 */
session_start();
/**  **  **  **  **  **  **  **  **  **
 *   INCLUDES
 */
include_once "system/includes.php";
/**  **  **  **  **  **  **  **  **  **
 *   SET PARAMETERS AND DETERMINE ACTION
 */
$action = req::_("action");
$controller = req::_("controller", "main");
if ($action == "logout") {
    include_once "controllers/logout.php";
}
/**  **  **  **  **  **  **  **  **  **
 *   DETERMINE IF SESSION IS VALID
 */
$valid_session = session::_check_session();
/**  **  **  **  **  **  **  **  **  **
 *   LOAD CONTROLLER
 */
if ($valid_session) {
    include_once "controllers/{$controller}.php";
} else {
    include_once "controllers/login.php";
}
Beispiel #14
0
 *  Superuser view, where table parameters are set up
 *  
 *  Ingenious Design - http://in.genio.us 
 *  Jeremy Bloomstrom | jeremy@in.genio.us
 *  
 *  Created: 	11/27/2012
 *  Last Updated: 	8/21/2014
 *  
 *  Changelog:
 *   8/21/2014 - Added comment header
 */
/**  **  **  **  **  **  **  **  **  **
 *   SETUP PARAMETERS
 */
global $view;
global $option;
$option = req::_('option', 'login');
$view = req::_('view', $option);
/**  **  **  **  **  **  **  **  **  **
 *   SHOW THE SUPERUSER VIEW
 */
switch ($option) {
    default:
        include "views/su.php";
        break;
}
?>



Beispiel #15
0
 public function __invoke($a)
 {
     return req::_($this->{$a}, false);
 }
Beispiel #16
0
 /**
  * 获取图片集列表
  *
  * @param  string time
  * @param  string uuid
  * @param  string page_Index 当前页数
  * @param  string pageSize	 每页显示页数
  * @return string
  */
 public function get_pic_list(req $req, res $res, $args)
 {
     if (isset($_GET['time']) && isset($_GET['uuid']) && isset($_GET['pageIndex']) && isset($_GET['pageSize'])) {
         //验证sign
         $time = $_GET['time'];
         $uuid = $_GET['uuid'];
         $str = $time . $uuid;
         $sign = $req->getQueryParam('sign');
         if ($sign) {
             $signs = $this->des->decrypt($sign);
             if ($str !== $signs) {
                 return $res->error(-101, 'sign值无效');
             }
         } else {
             return $res->error(-1004, 'sign值不能为空');
         }
         $pic = new \App\Model\Pics();
         $page_Index = $req->getQueryParam('pageIndex');
         $page_Size = $req->getQueryParam('pageSize');
         if ($result['list'] = $pic->pic_list($page_Index, $page_Size)) {
             return $res->success($result);
         } else {
             return $res->error(-1004, '请求数据为空');
         }
     } else {
         return $res->error(-1, 'time和uuid与pageIndex跟pageSize不能为空');
     }
 }
Beispiel #17
0
 *  Jeremy Bloomstrom | jeremy@in.genio.us
 *  
 *  Created: 		11/27/2012
 *  Last Updated: 	8/21/2014
 *  
 *  Changelog:
 *   8/21/2014 - Added comment header
 */
/**  **  **  **  **  **  **  **  **  **
 *   SETUP PARAMETERS
 */
global $option;
$option = req::_('option', 'default');
global $view;
$view = req::_('view', $option);
$views = explode('|', req::_('view', $option));
$data = array();
// array containing select query db object
$formdata = array();
// array containing filter/pagination form data objects
/**  **  **  **  **  **  **  **  **  **
 *   INITIALIZE VIEWS FOR EACH TAB
 */
foreach ($views as $v) {
    // Set some params
    $table = TABLEPREFIX . $v;
    $joins = dbfn::_getJoins($table);
    // Prepare the parameters for the query.
    $oQ = new formfilterpage($table, $joins);
    #Get filter and pagination data
    $select = $oQ->_getQuery();
<?php

require_once '../core/init.php';
req::once('functions/rand_pass.php');
$user = new user();
if ($user->notHasPermission('logged in')) {
    redirect::to('index.php');
}
if (input::exists()) {
    $validate = new validate();
    $validate->check($_POST, array());
    if ($validate->passed()) {
        try {
            //database actions
        } catch (Exception $e) {
            die($e->getMessage());
        }
    }
}
Beispiel #19
0
    public function _quickview()
    {
        if (!empty($this->dataout)) {
            $return = <<<HTML
<div class="qv-table" id="qv_table_{$this->table}" name="{$this->friendlytable}">
\t<div class="qv-col">
    \t<div class="qv-cell">
        \t<input type="checkbox" name="sel_all_{$this->table}" id="chk_sel_all" title="Check/Uncheck All" tt="Check/Uncheck All Rows" />
        </div>
        <div class="qv-cell search"></div>
HTML;
            $id = key($this->dataout);
            for ($ii = 0; $ii < count($this->dataout[$id]); $ii++) {
                $return .= <<<HTML
    \t<div class="qv-cell">
        \t<input type="checkbox" name="cid[]" id="cid_{$ii}" value="{$this->dataout[$id][$ii]}" />
        </div>
HTML;
            }
            $return .= "</div>";
            $prev_order = req::_('prev_order');
            foreach ($this->cols as $col_index => $col) {
                if ($this->params[$col]->visible && $this->params[$col]->qv_enabled) {
                    // make sure column is visible and quickview enabled
                    // Prepare the column header
                    $class = req::_('order') == $col ? 'active' : '';
                    $dir_icon = $prev_order == $col && req::_('dir') == 'DESC' ? 'icon-desc' : 'icon-asc';
                    $input_qv_search_name = empty($this->params[$col]->qv_sub_col) ? $col : $this->params[$col]->qv_sub_col;
                    $val = req::_($input_qv_search_name);
                    $return .= <<<HTML
\t\t\t\t<div class="qv-col">
\t\t\t\t\t<div class="qv-cell">
                    <a tt="Click to sort by {$this->params[$col]->qv_label} in ascending order. Click again to sort descending." class="easyui-linkbutton table_heading {$class}" iconcls="{$dir_icon}" href="#" rel="{$input_qv_search_name}"> {$this->params[$col]->qv_label} </a>\t<span class="icon"></span>
                    </div>
                    <div class="qv-cell search">
                    \t<input type="text" name="{$input_qv_search_name}" size="{$this->params[$col]->input_size}" value="{$val}" tt="Search records by {$this->params[$col]->qv_label}" class="input-qv-cell-search"  />
                    </div>  
HTML;
                    // Prepare the cell data
                    foreach ($this->dataout[$col] as $cell_index => $cell_value) {
                        $is_sub = false;
                        // Determine if we are dealing with a substitute value
                        if (empty($this->params[$col]->qv_sub_col)) {
                            # no sub
                            $cid = $this->dataout[$id][$cell_index];
                            # pid of current row
                            $table_temp = $this->table;
                            $cell_val_temp = strlen($cell_value) <= 100 ? $cell_value : substr($cell_value, 0, 100) . "...";
                        } else {
                            # sub one or more cols
                            $is_sub = true;
                            $sub_col = $this->params[$col]->qv_sub_col;
                            $cid = $cell_value;
                            #pid of subbed col
                            $table_temp = $this->params[$col]->qv_sub_col_table;
                            $sub_col_temp = explode(",,", $sub_col);
                            $cell_val_temp = array();
                            foreach ($sub_col_temp as $sub_col_col) {
                                @($cell_val_temp[] = $this->dataout[$sub_col_col][$cell_index]);
                            }
                            $cell_val_temp = implode(" - ", $cell_val_temp);
                        }
                        $return .= $col_index != 1 && $is_sub === false ? "<div class=\"qv-cell\">{$cell_val_temp}</div>" : "<div class=\"qv-cell\"><a href=\"javascript:void(0)\" rel=\"{$table_temp}__{$cid}\" class=\"qv-a\" tt=\"View more details for: {$cell_val_temp}\">{$cell_val_temp}</a></div>";
                    }
                    $return .= <<<HTML
\t\t\t\t</div>
HTML;
                }
            }
            $return .= <<<HTML
            <div class="qv-col">
            \t<div class="qv-cell">
                <a href="#" id="lb-go" class="easyui-linkbutton" iconcls="icon-search" tt="Perform search">Go</a> 
               \t</div>
                <div class="qv-cell search">
                <a href="#" id="lb-reset" class="easyui-linkbutton" iconcls="icon-reload" tt="Reset search results">Reset</a> 
                </div>
            </div>
HTML;
            $return .= <<<HTML
\t\t\t\t</div>
HTML;
            //print_r($this->dataout);
            return $return;
        } else {
            return false;
        }
    }
Beispiel #20
0
 *  Ingenious Design - http://in.genio.us 
 *  Jeremy Bloomstrom | jeremy@in.genio.us
 *  
 *  Created: 		3/27/2013
 *  Last Updated: 	8/21/2014
 *  
 *  Changelog:
 *   8/21/2014 - Added comment header
 */
/**  **  **  **  **  **  **  **  **  **
 *   SETUP PARAMETERS
 */
$return = 0;
$table = req::_('table_name');
$prikey = dbfn::_getprimary($table);
$id = req::_($prikey);
$userid = $_SESSION['use_id'];
#id of currently logged in user
/**  **  **  **  **  **  **  **  **  **
 *   SEE IF RECORD IS ALREADY CHECKED IN
 */
$query = "SELECT `checked_out`,`checked_out_id`,`checked_out_time` FROM `{$table}` WHERE `{$prikey}` = {$id} LIMIT 1";
$oDB = new db($query);
$checkedout = count($oDB->rows) ? $oDB->rows[0]['checked_out'] : 0;
$checkedout_id = count($oDB->rows) ? $oDB->rows[0]['checked_out_id'] : 0;
$checkedout_time = count($oDB->rows) ? $oDB->rows[0]['checked_out_time'] : 0;
if ($checkedout === 0) {
    // record is already checked in
    $return = <<<HTML
checkout_message('That record has been checked in already.','information');
\$('.main-content.active .part.active #lb-edit').show();
Beispiel #21
0
 *  Last Updated: 	8/21/2014
 *  
 *  Changelog:
 *   8/21/2014 - Added comment header
 */
/**  **  **  **  **  **  **  **  **  **
 *   SETUP PARAMETERS
 */
global $view;
$view = req::_('view', 'login');
/**  **  **  **  **  **  **  **  **  **
 *   PROCESS LOGIN REQUEST
 */
if (req::_('frm_name') == 'frm_login') {
    $username = req::_('use_username');
    $password = req::_('use_password');
    $login_attempt = session::_login($username, $password);
    if ($login_attempt) {
        // If login is successful, redirect back to router.
        $message = "Login Successful!";
        header("Location: index.php");
    }
}
/**  **  **  **  **  **  **  **  **  **
 *   SHOW LOGIN FORM VIEW
 */
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link rel="icon" href="http://aimsys.home/favicon.ico" />
Beispiel #22
0
        $output = $oParams->_store();
        break;
    case 'frm_editor':
        $table = req::_('table_name');
        // table name
        $prikey = dbfn::_getprimary($table);
        // get primary key name of table
        $id = req::_($prikey);
        // get id of record
        $oEditor = new editor($table, $id);
        $oEditor->_getData();
        $oEditor->_setData($_POST);
        $output = $oEditor->_storeData();
        break;
    case 'frm_storetabs':
        $tabs = req::_('Tabs', '');
        $oResult = aimsys::_storeTabs($tabs);
        $output = $oResult->ret;
        break;
    case 'frm_gettabs':
        $t = aimsys::_getTabs();
        break;
}
/**  **  **  **  **  **  **  **  **  **
 *   OUTPUT THE RESULTS
 */
switch ($frm_name) {
    case 'frm_editor':
    case 'frm_tableparam':
        if ($option != 'popup') {
            header('content-type: application/x-javascript');
 function __construct($table, $joins = false)
 {
     global $option;
     global $view;
     $this->table = $table;
     $this->friendlytable = ucfirst(str_replace(TABLEPREFIX, '', $table));
     $this->option = $option;
     $this->view = $view;
     $this->frm_name = "{$table}_filter_form";
     $this->joins = $joins;
     // Are we actively performing a filter
     $this->apply = req::_('frm_name') == $this->frm_name ? true : false;
     if ($this->apply) {
         // actively applying this filter to the current table
         // Filter Params
         $filter = req::_('filter', -1);
         $this->filter = is_array($filter) ? implode(',', $filter) : $filter;
         // Build Pagination params
         $_SESSION['rows_per_page'] = req::_('rows_per_page', ROWS_PER_PAGE, '_SESSION');
         $rows_per_page = $_SESSION['rows_per_page'] = req::_('rows_per_page', $_SESSION['rows_per_page']);
         $first_record = req::_chk('page') ? (req::_('page') - 1) * $rows_per_page + 1 : 1;
         $last_record = $first_record + $rows_per_page - 1;
         // Build where statement
         $search_criteria = req::_('search_criteria', '');
         if (!empty($search_criteria)) {
             $search_criteria = urldecode($search_criteria);
             $pairs = explode('&', $search_criteria);
             $this->search_criteria = array();
             foreach ($pairs as $pair) {
                 $p = explode('=', $pair);
                 $this->search_criteria[$p[0]] = $p[1];
             }
         }
         $this->where = !empty($this->search_criteria) ? dbfn::_buildwhere2($this->search_criteria) : 1;
         // Build order criteria
         $this->order = req::_('order', dbfn::_getPrimary($table));
         $this->dir = req::_('dir', 'ASC');
     } else {
         // not actively applying any filters to this table
         $this->filter = -1;
         $rows_per_page = $_SESSION['rows_per_page'];
         $first_record = 1;
         $last_record = $first_record + $rows_per_page - 1;
         $this->where = 1;
         $this->order = dbfn::_getPrimary($table);
         $this->dir = 'ASC';
     }
     $this->limit = $first_record - 1 . "," . $rows_per_page;
     $this->page = req::_('page', 1);
     $this->rows_per_page = $rows_per_page;
     // Find total records
     $select2 = "SELECT count(*) AS `c` FROM `{$table}` {$joins} WHERE {$this->where}";
     $oTemp = new db($select2);
     $this->total_rows = $oTemp->_getResult();
     $this->first_record = $this->rows_per_page < $this->total_rows ? $first_record : 1;
     $this->last_record = $this->total_rows <= $last_record ? $this->total_rows : $last_record;
     $this->total_pages = ceil($this->total_rows / $this->rows_per_page);
     // Update limit and page number if necessary
     $this->limit = $this->first_record - 1 . "," . $rows_per_page;
     $this->page = $this->rows_per_page < $this->total_rows ? $this->page : 1;
     // Row message: Displaying x - y of z records...
     $this->row_message = $this->total_rows > 0 ? "Showing " . $this->first_record . " - " . $this->last_record . " of " . $this->total_rows . " rows." : "<font style='color:red'>No records found.</font>";
     $this->row_message_class = $this->total_rows > 0 ? "ui-state-success" : "ui-state-error";
 }