public static function getUserStatus($uids) { $uid = implode("','", $uids); $limit = count($uids); $userList = DB::fetch_all('SELECT uid,username,status FROM %t WHERE uid in(%n) ORDER BY uid desc LIMIT %d', array('common_member', $uids, $limit), 'uid'); return $userList; }
function fetch_all($start, $limit, $where = '', $field = 'dateline', $sort = 'DESC') { if ($where) { $wherestr = "WHERE " . $where; } return DB::fetch_all("SELECT * FROM %t {$wherestr} ORDER BY %i {$sort} " . DB::limit($start, $limit), array($this->_table, $field)); }
public function fetch_all_by_access($access) { if (!is_numeric($access) && !is_array($access)) { return array(); } return DB::fetch_all('SELECT * FROM %t WHERE ' . DB::field('access', $access) . ' ORDER BY dateline DESC', array($this->_table)); }
public function fetch_all_by_action($action) { if (!empty($action)) { return DB::fetch_all('SELECT * FROM %t WHERE action IN(%n)', array($this->_table, $action), $this->_pk); } return array(); }
function draw() { global $display; $cmd = Url::get('cmd'); if ($cmd == 'update') { AZMemcache::do_put("prhot_ver:", 0); Url::redirect_current(); } $this->beginForm(); $list_cat = array(999999999 => 'Mặc định', 0 => 'Trang chủ'); $list_cat += AZLib::getTopCats(); $item = DB::fetch_all('SELECT item_id,status,product_hot_cat_id,end_time,start_time FROM product_hot'); $items_tmp = array(); foreach ($item as $values) { if (isset($list_cat[$values['product_hot_cat_id']])) { $items_tmp[$values['product_hot_cat_id']]['cat_name'] = $list_cat[$values['product_hot_cat_id']]; if ($values['status'] == 1) { $items_tmp[$values['product_hot_cat_id']]['item_vip'][$values['item_id']]['cat_id'] = $values['product_hot_cat_id']; $items_tmp[$values['product_hot_cat_id']]['item_vip'][$values['item_id']]['start_time'] = date("d/m/Y", $values['start_time']); $items_tmp[$values['product_hot_cat_id']]['item_vip'][$values['item_id']]['end_time'] = date("d/m/Y", $values['end_time']); } else { $items_tmp[$values['product_hot_cat_id']]['item'][$values['item_id']] = $values['product_hot_cat_id']; } } } $items = array(); foreach ($list_cat as $key => $values) { if (isset($items_tmp[$key])) { $items[$key] = $items_tmp[$key]; } } $display->add('items', $items); $display->output('ManageProductHot'); $this->endForm(); }
public static function all() { static $query; DB::prepare_query($query, "SELECT * FROM `judge_daemon` ORDER BY `judge_host`"); $query->execute(); return DB::fetch_all('JudgeDaemon', $query); }
public function fetch_all_by_fid($fid, $position = false, $moderatorid = false, $start = 0, $limit = 0) { $position = $position ? ' AND ' . DB::field('position', array(0, $position)) : ''; $moderatorid = $moderatorid ? ' AND ' . DB::field('moderatorid', array(0, $moderatorid)) : ''; $limit = $start && $limit ? ' LIMIT ' . intval($start) . ', ' . intval($limit) : ''; return DB::fetch_all('SELECT * FROM %t WHERE fid=%d %i %i ORDER BY displayorder %i', array($this->_table, $fid, $position, $moderatorid, $limit)); }
public function get_sitemap_list($type, $offset=0, $limit=0) { if ($offset >= 0 && $limit > 0) { return DB::fetch_all('SELECT * FROM %t WHERE type=%d LIMIT %d, %d', array($this->_table, $type, $offset, $limit)); } return DB::fetch_all('SELECT * FROM %t WHERE type=%d', array($this->_table, $type)); }
public function fetch_all_inviteuid($fid, $inviteuids, $uid) { if (empty($fid) || empty($uid) || empty($inviteuids)) { return array(); } return DB::fetch_all("SELECT inviteuid FROM %t WHERE fid=%d AND " . DB::field('inviteuid', $inviteuids) . " AND uid=%d", array($this->_table, $fid, $uid)); }
public function fetch_all_by_search($username, $start = 0, $limit = 0, $order = 'dateline', $sort = 'DESC') { $ordersql = $order ? " ORDER BY {$order} {$sort} " : ''; $wheresql = 'WHERE 1'; $wheresql .= $username ? ' AND ' . DB::field('username', $username, 'like') : ''; return DB::fetch_all('SELECT * FROM %t %i %i ' . DB::limit($start, $limit), array($this->_table, $wheresql, $ordersql)); }
public function fetch_all_by_default() { if (($data = $this->fetch_cache('all')) === false) { $data = DB::fetch_all("SELECT * FROM %t WHERE `default`!='' ORDER BY display DESC", array($this->_table)); } return $data; }
public function fetch_all_by_id($id) { if (!$id) { return; } return DB::fetch_all("SELECT * FROM %t WHERE %i ORDER BY displayorder", array($this->_table, DB::field('medalid', $id))); }
public function fetch_all($uids, $variables) { if (empty($uids) || empty($variables)) { return array(); } return DB::fetch_all('SELECT * FROM %t WHERE ' . DB::field('uid', $uids) . ' AND ' . DB::field('variable', $variables), array($this->_table)); }
public function fetch_all_by_uid($uid) { if (!$uid) { return null; } return DB::fetch_all('SELECT * FROM %t WHERE %i', array($this->_table, DB::field('uid', $uid)), $this->_pk); }
public function fetch_all_for_order($typeid = array()) { if (!empty($typeid)) { $where = ' WHERE ' . DB::field('typeid', $typeid); } return DB::fetch_all("SELECT * FROM " . DB::table('forum_threadtype') . " {$where} ORDER BY displayorder"); }
public function fetch_all_by_doid($doids) { if (empty($doids)) { return array(); } return DB::fetch_all('SELECT * FROM %t WHERE ' . DB::field('doid', $doids) . ' ORDER BY dateline', array($this->_table)); }
public function fetch_all_by_ctid_tid($ctid, $tids) { if (!$ctid || !$tids) { return null; } return DB::fetch_all('SELECT * FROM %t WHERE ctid=%d AND tid IN(%n)', array($this->_table, $ctid, $tids), 'tid'); }
function draw() { global $display; $cmd = Url::get('cmd'); $display->add('id_survey', $this->public_survey['id']); $display->add('title', stripslashes($this->public_survey['title'])); $display->add('question', stripslashes($this->public_survey['question'])); $display->add('url_edit', Url::build('admin_survey', array('cmd' => 'edit', 'id_survey' => $this->public_survey['id']))); $opts = DB::fetch_all('SELECT * FROM `public_survey_opinion` WHERE `id_survey`=' . $this->public_survey['id']); $i = 0; foreach ($opts as &$opt) { $i++; $opt['num'] = $i; $opt['edit'] = Url::build_current(array('id_survey' => Url::get('id_survey', 'int', 0), 'cmd' => 'edit', 'id' => $opt['id'])); $opt['del'] = Url::build_current(array('id_survey' => Url::get('id_survey', 'int', 0), 'cmd' => 'delete', 'id' => $opt['id'])); } $display->add('opts', $opts); if ($cmd == 'edit') { $public_survey_opinion = DB::select('public_survey_opinion', 'id=' . Url::get('id', 0)); if ($public_survey_opinion) { $display->add('value', $public_survey_opinion['option']); $display->add('option_id', $public_survey_opinion['id']); } } $this->beginForm(); $display->output('PublicSurveyOption'); $this->endForm(); }
public function deletetags($tags) { if (!$tags) { return; } if (!is_array($tags)) { if (strpos($tags, "','") !== false) { $tagnames = explode("','", trim($tags, "'")); } elseif (strpos($tags, ',') !== false) { $tagnames = explode(',', trim($tags)); } else { $tagnames = array($tags); } } else { $tagnames = $tags; } $tagarr = DB::fetch_all('SELECT tagid,tagname,hot FROM ' . DB::table($this->_table) . " WHERE tagname IN (" . dimplode($tagnames) . ")"); $have_tagids = array(); $delete_tagids = array(); foreach ($tagarr as $tagid => $value) { if ($value['hot'] > 1) { $have_tagids[] = $value['tagname']; } elseif ($value['hot'] < 1) { $delete_tagids[] = $value['tagid']; } } //已经存在的且hot>1的-1; DB::query("UPDATE " . DB::table($this->_table) . " SET hot=hot-1 WHERE tagid IN(" . dimplode($have_tagids) . ")"); //已经存在的且hot<=1的删除; DB::query("DELETE FROM " . DB::table($this->_table) . " WHERE tagid IN(" . dimplode($delete_tagids) . ")"); }
public function fetch_all_by_uid($uid, $new, $type, $start, $perpage) { $new = intval($new); $type = $type ? ' AND ' . DB::field('type', $type) : ''; $new = ' AND ' . DB::field('new', $new); return DB::fetch_all("SELECT * FROM %t WHERE uid=%d %i %i ORDER BY new DESC, dateline DESC %i", array($this->_table, $uid, $type, $new, DB::limit($start, $perpage))); }
public function fetch_all_by_uid($uid, $type = 0, $start = 0, $limit = 20) { if (!$uid) { return false; } return DB::fetch_all('SELECT * FROM %t WHERE uid=%d AND type=%d ORDER BY dateline DESC ' . DB::limit($start, $limit), array($this->_table, $uid, $type), 'tid'); }
public function fetch_all_by_name($name) { if (!empty($name)) { return DB::fetch_all('SELECT * FROM %t WHERE ' . DB::field('name', $name), array($this->_table)); } return array(); }
public function fetch_all_by_identifier($identifier) { if (!$identifier) { return; } return DB::fetch_all('SELECT * FROM %t WHERE %i', array($this->_table, DB::field('identifier', $identifier))); }
public function fetch_all_by_fids($fids, $start = 0, $limit = 20) { if (empty($fids)) { return array(); } return DB::fetch_all("SELECT * FROM %t WHERE %i ORDER BY dateline DESC %i", array($this->_table, DB::field('fid', $fids), DB::limit($start, $limit)), 'tid'); }
public function fetch_all_by_tid_postlength_limit($tid, $limit = 10) { if ($limit <= 0) { return array(); } return DB::fetch_all('SELECT * FROM %t WHERE tid=%d ORDER BY postlength DESC LIMIT %d', array($this->_table, $tid, $limit), 'pid'); }
function main() { global $_G; if ($_GET['onsubmit'] && check()) { foreach ($_GET[ids] as $k => $v) { $id = intval($v); if ($_GET[del][$k] == 0) { continue; } if ($_GET['_del_all'] == 1 && $_GET['del'][$k]) { DB::delete(__CLASS__, "id=" . intval($id)); } } cpmsg('操作成功', 'success', 'm=' . __CLASS__ . '&a=' . __FUNCTION__); return false; } $size = 30; $start = ($_G['page'] - 1) * $size; $url = ''; $and = ''; if ($_GET['uid']) { $uid = intval($_GET[uid]); $and .= " AND uid =" . $uid; $url .= "&uid=" . $uid; } if ($_GET['username']) { $username = urldecode_utf8(trim($_GET[username])); $and .= " AND username ='******'"; $url .= "&username="******" AND ip ='" . $ip . "'"; $url .= "&ip=" . $ip; } if ($_GET['jf_down']) { $jf_down = intval($_GET[jf_down]); $and .= " AND org_jf >='" . $jf_down . "'"; $url .= "&jf_down=" . $jf_down; } if ($_GET['jf_up']) { $jf_up = intval($_GET[jf_up]); $and .= " AND org_jf <='" . $jf_up . "'"; $url .= "&jf_up=" . $jf_up; } if ($_GET[type] && array_key_exists($_GET[type], $_G['setting']['jf_type'])) { $type = addslashes(trim($_GET[type])); $and .= " AND type='{$type}'"; $url .= "&type=" . $type; } $sign_list = DB::fetch_all("SELECT * FROM " . DB::table(__CLASS__) . " where 1 {$and} ORDER BY id DESC LIMIT {$start},{$size}"); $count = getcount(__CLASS__, $and); $showpage = multi($count, $size, $_G[page], URL . "m=sign&a=main" . $url); foreach ($sign_list as $k => $v) { $sign_list[$k][username_url] = urlencode_utf8($v[username]); $sign_list[$k][dateline] = dgmdate($v[dateline], 'u'); } $this->add(array('count' => $count, 'sign_list' => $sign_list, 'showpage' => $showpage)); $this->show('sign/main'); }
public function fetch_all($orderid, $status = '') { if (empty($orderid)) { return array(); } return DB::fetch_all('SELECT * FROM %t WHERE ' . DB::field('orderid', $orderid) . ' %i', array($this->_table, $status ? ' AND ' . DB::field('status', $status) : '')); }
public function fetch_all($start = 0, $limit = 100, $operated = 0, $fid = 0) { $where = empty($operated) ? 'opuid=0' : 'opuid>0'; $order = empty($operated) ? 'num' : 'optime'; $fidsql = $fid ? ' AND ' . DB::field('fid', $fid) : ''; return DB::fetch_all("SELECT * FROM %t WHERE {$where}.{$fidsql} ORDER BY {$order} DESC, dateline DESC LIMIT %d, %d", array($this->_table, $start, $limit)); }
public function fetch_all_by_fid($fids) { if (empty($fids)) { return array(); } return DB::fetch_all('SELECT * FROM %t WHERE ' . DB::field('fid', $fids), array($this->_table)); }
public function insert_by_exts($appid, $exts) { if (!$appid) { return false; } if (!is_array($exts)) { $exts = $exts ? explode(',', $exts) : array(); } //删除原来的ext $oexts = array(); $delids = array(); $oextarr = DB::fetch_all("select * from " . DB::table('app_open') . " where appid='{$appid}'"); foreach ($oextarr as $value) { $oexts[] = $value['ext']; if (!in_array($value['ext'], $exts)) { $delids[] = $value['extid']; } } if ($delids) { self::delete($delids); } foreach ($exts as $ext) { if ($ext && !in_array($ext, $oexts)) { parent::insert(array('ext' => $ext, 'appid' => $appid)); } } $this->clear_cache('ext_all'); $this->clear_cache('all'); return true; }