function blog_read_base($fields = "*", $condition = "", $get_type = "", $num = "", $by_col = "log_id", $order = "desc", $cache = "", $cache_key = "") { global $tablePreStr; global $page_num; global $page_total; global $is_self; $is_pass = '******'; $is_admin = get_sess_admin(); $t_blog = $tablePreStr . "blog"; $result_rs = array(); $dbo = new dbex(); dbplugin('r'); $limit = $num ? " limit {$num} " : ""; $by_col = $by_col ? " {$by_col} " : " log_id "; $order = $order ? $order : "desc"; $get_type = $get_type == 'getRow' ? "getRow" : "getRs"; $is_pass = $is_self == 'Y' || $is_admin ? '1' : $is_pass; $sql = " select {$fields} from {$t_blog} where {$is_pass} {$condition} order by {$by_col} {$order} {$limit} "; if (empty($result_rs)) { if ($limit == '') { $dbo->setPages(20, $page_num); } $result_rs = $dbo->{$get_type}($sql); $page_total = $dbo->totalPage; } return $result_rs; }
function msgboard_read_base($fields = "*", $condition = "", $get_type = "", $num = "", $by_col = "mess_id", $order = "desc", $cache = "", $cache_key = "") { global $tablePreStr; global $page_num; global $page_total; global $cachePages; $t_msgboard = $tablePreStr . "msgboard"; $result_rs = array(); $dbo = new dbex(); dbplugin('r'); $limit = $num ? " limit {$num} " : ""; $by_col = $by_col ? " {$by_col} " : " mess_id "; $order = $order ? $order : "desc"; $get_type = $get_type == 'getRow' ? "getRow" : "getRs"; $sql = " select {$fields} from {$t_msgboard} where {$condition} order by {$by_col} {$order} {$limit} "; /* 可以加入缓存机制 */ if (empty($result_rs)) { if ($limit == '') { $dbo->setPages(20, $page_num); } $result_rs = $dbo->{$get_type}($sql); $page_total = $dbo->totalPage; } return $result_rs; }
function scrip_notice_get($fields = "*", $num = "", $condition = "") { global $tablePreStr; global $page_num; global $page_total; $fields = filt_fields($fields); $uid = get_sess_userid(); $t_scrip = $tablePreStr . "msg_inbox"; $result_rs = array(); $dbo = new dbex(); dbplugin('r'); $sql = " select {$fields} from {$t_scrip} where user_id = {$uid} and mesinit_id='' {$condition} order by mess_id desc "; $dbo->setPages(20, $page_num); $result_rs = $dbo->getRs($sql); $page_total = $dbo->totalPage; return $result_rs; }
function group_sub_read_base($fields = "*", $condition = "", $get_type = "", $num = "", $by_col = "subject_id", $order = "desc", $cache = "", $cache_key = "") { global $tablePreStr; global $page_num; global $page_total; $t_group_subject = $tablePreStr . "group_subject"; $result_rs = array(); $dbo = new dbex(); dbplugin('r'); $by_col = $by_col ? " {$by_col} " : " subject_id "; $order = $order ? $order : "desc"; $get_type = $get_type ? "getRow" : "getRs"; $sql = " select {$fields} from {$t_group_subject} where {$condition} order by {$by_col} {$order} "; if (empty($result_rs)) { $dbo->setPages(20, $page_num); $result_rs = $dbo->{$get_type}($sql); $page_total = $dbo->totalPage; } return $result_rs; }
$t_table = $tablePreStr . $com_table_str; $con_id = $com_type[$com_table_str]; $dbo = new dbex(); dbtarget('w', $dbServs); //当前页面参数 $page_num = trim(get_argg('page')); //变量区 $c_orderby = short_check(get_argg('order_by')); $c_ordersc = short_check(get_argg('order_sc')); $c_perpage = get_argg('perpage') ? intval(get_argg('perpage')) : 20; $eq_array = array('host_id', 'visitor_id', 'visitor_name', $con_id); $like_array = array('content'); $date_array = array("add_time"); $num_array = array(); $sql = spell_sql($t_table, $eq_array, $like_array, $date_array, $num_array, $c_orderby, $c_ordersc); $dbo->setPages($c_perpage, $page_num); //设置分页 $com_rs = $dbo->getRs($sql); $page_total = $dbo->totalPage; //分页总数 //按字段排序 $o_def = ''; $o_add_time = ''; if (get_argg('order_by') == '' || get_argg('order_by') == "com_id") { $o_def = "selected"; } if (get_argg('order_by') == "add_time") { $o_add_time = "selected"; } //显示控制 $isset_data = "";
$t_groups = $tablePreStr . "groups"; $t_group_members = $tablePreStr . "group_members"; $t_group_subject = $tablePreStr . "group_subject"; $t_group_subject_comment = $tablePreStr . "group_subject_comment"; //定义读操作 dbtarget('r', $dbServs); $dbo = new dbex(); $show_action = 0; //权限判断 $role = api_proxy("group_member_by_role", $group_id, $user_id); $role = $role[0]; if (($role == 0 || $role == 1) && isset($role)) { $show_action = 1; } $condition = "group_id={$group_id} and title like '%{$key_word}%'"; $order_by = "order by add_time desc"; $type = "getRs"; $dbo->setPages(20, $page_num); //设置分页 $subject_rs = get_db_data($dbo, $t_group_subject, $condition, $order_by, $type); $page_total = $dbo->totalPage; //分页总数 //显示控制 $isset_data = ""; $none_data = "content_none"; $isNull = 0; if (empty($subject_rs)) { $isNull = 1; $isset_data = "content_none"; $none_data = ""; }