本文整理汇总了PHP中XDB::table方法的典型用法代码示例。如果您正苦于以下问题:PHP XDB::table方法的具体用法?PHP XDB::table怎么用?PHP XDB::table使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XDB
的用法示例。
在下文中一共展示了XDB::table方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update_all
public function update_all($data)
{
if (is_array($data)) {
$update = array();
foreach ($data as $key => $val) {
$update[] = "`" . $key . "` = '" . $val . "'";
}
$setwhere = implode($update, ', ');
XDB::query("UPDATE " . XDB::table($this->_table) . " SET " . $setwhere);
}
}
示例2: check_moderator_for_uid
public function check_moderator_for_uid($fid, $uid, $accessmasks = 0)
{
if (!intval($fid) || !intval($uid)) {
return false;
}
if ($accessmasks) {
$accessadd1 = ', a.allowview, a.allowpost, a.allowreply, a.allowgetattach, a.allowgetimage, a.allowpostattach';
$accessadd2 = "LEFT JOIN " . XDB::table('forum_access') . " a ON a." . XDB::field('uid', $uid) . " AND a." . XDB::field('fid', $fid);
}
return XDB::fetch_first("SELECT ff.postperm, m.uid AS istargetmod {$accessadd1}\n\t\t\t\tFROM " . XDB::table($this->_table) . " ff\n\t\t\t\t{$accessadd2}\n\t\t\t\tLEFT JOIN " . XDB::table('forum_moderator') . " m ON m.fid=%d AND m.uid=%d\n\t\t\t\tWHERE ff.fid=%d", array($fid, $uid, $fid));
}
示例3: updatestar_by_bid
public function updatestar_by_bid($uid, $username, $bid, $star = 1)
{
!in_array($star, array(1, 2, 3, 4, 5)) && ($star = 1);
$hcount = C::t('#sanree_brand#sanree_brand_voterlog')->getvoter_by_bid_uid($uid, $bid);
if ($hcount > 0) {
return 0;
}
$data = array('uid' => $uid, 'username' => $username, 'bid' => $bid, 'star' => $star, 'dateline' => TIMESTAMP);
C::t('#sanree_brand#sanree_brand_voterlog')->insert($data);
$tcount = $this->getvoter_by_bid($bid);
if ($tcount > 0) {
XDB::query("UPDATE " . XDB::table($this->_table) . " SET `star" . $star . "`= star" . $star . " + 1 WHERE `bid`=" . $bid);
} else {
$mdata = array('uid' => $uid, 'bid' => $bid, 'star' . $star => 1, 'dateline' => TIMESTAMP);
$this->insert($mdata);
}
return 1;
}
示例4: fetch_all_for_manage
public function fetch_all_for_manage($tableid, $inforum = '', $authorid = 0, $filename = '', $keyword = '', $sizeless = 0, $sizemore = 0, $dlcountless = 0, $dlcountmore = 0, $daysold = 0, $count = 0, $start = 0, $limit = 0)
{
$sql = "1";
if (!is_numeric($tableid) || $tableid < 0 || $tableid > 9) {
return;
}
if ($inforum) {
$sql .= is_numeric($inforum) ? " AND t.fid=" . XDB::quote($inforum) : '';
$sql .= $inforum == 'isgroup' ? ' AND t.isgroup=\'1\'' : ' AND t.isgroup=\'0\'';
}
if ($authorid) {
$sql .= " AND a.uid=" . XDB::quote($authorid);
}
if ($filename) {
$sql .= " AND a.filename LIKE " . XDB::quote('%' . $filename . '%');
}
if ($keyword) {
$sqlkeywords = $or = '';
foreach (explode(',', str_replace(' ', '', $keyword)) as $keyword) {
$sqlkeywords .= " {$or} a.description LIKE " . XDB::quote('%' . $keyword . '%');
$or = 'OR';
}
$sql .= " AND ({$sqlkeywords})";
}
$sql .= $sizeless ? " AND a.filesize>'{$sizeless}'" : '';
$sql .= $sizemore ? " AND a.filesize<'{$sizemore}' " : '';
$sql .= $dlcountless ? " AND ai.downloads<'{$dlcountless}'" : '';
$sql .= $dlcountmore ? " AND ai.downloads>'{$dlcountmore}'" : '';
$sql .= $daysold ? " AND a.dateline<'" . (TIMESTAMP - intval($daysold) * 86400) . "'" : '';
if ($count) {
return XDB::result_first("SELECT COUNT(*)\n\t\t\t\tFROM " . XDB::table('forum_attachment_' . $tableid) . " a\n\t\t\t\tINNER JOIN " . XDB::table('forum_attachment') . " ai USING(aid)\n\t\t\t\tINNER JOIN " . XDB::table('forum_thread') . " t\n\t\t\t\tINNER JOIN " . XDB::table('forum_forum') . " f\n\t\t\t\tWHERE t.tid=a.tid AND f.fid=t.fid AND t.displayorder>='0' AND {$sql}");
}
return XDB::fetch_all("SELECT a.*, ai.downloads, t.fid, t.tid, t.subject, f.name AS fname\n\t\t\t\tFROM " . XDB::table('forum_attachment_' . $tableid) . " a\n\t\t\t\tINNER JOIN " . XDB::table('forum_attachment') . " ai USING(aid)\n\t\t\t\tINNER JOIN " . XDB::table('forum_thread') . " t\n\t\t\t\tINNER JOIN " . XDB::table('forum_forum') . " f\n\t\t\t\tWHERE t.tid=a.tid AND f.fid=t.fid AND t.displayorder>='0' AND {$sql} ORDER BY a.aid DESC " . XDB::limit($start, $limit));
}
示例5: get_forum_by_fid
function get_forum_by_fid($fid, $field = '', $table = 'forum')
{
static $forumlist = array('forum' => array(), 'forumfield' => array());
$table = $table != 'forum' ? 'forumfield' : 'forum';
$return = array();
if (!array_key_exists($fid, $forumlist[$table])) {
$forumlist[$table][$fid] = XDB::fetch_first("SELECT * FROM " . XDB::table('forum_' . $table) . " WHERE fid=%d", array($fid));
if (!is_array($forumlist[$table][$fid])) {
$forumlist[$table][$fid] = array();
}
}
if (!empty($field)) {
$return = isset($forumlist[$table][$fid][$field]) ? $forumlist[$table][$fid][$field] : null;
} else {
$return = $forumlist[$table][$fid];
}
return $return;
}
示例6: addfield
public function addfield($addsql)
{
runquery("ALTER TABLE " . XDB::table($this->_table) . " ADD " . $addsql);
}
示例7: fetch_count
public function fetch_count()
{
return XDB::result_first("SELECT count(*) FROM " . XDB::table('forum_grouplevel'));
}
示例8: cleartable
public function cleartable()
{
runquery("TRUNCATE TABLE `" . XDB::table($this->_table) . "`;");
}
示例9: fetch_all_group_for_user
public function fetch_all_group_for_user($uid, $count = 0, $ismanager = 0, $start = 0, $num = 0)
{
$uid = intval($uid);
if (empty($uid)) {
return array();
}
if (empty($ismanager)) {
$levelsql = '';
} elseif ($ismanager == 1) {
$levelsql = ' AND level IN(1,2)';
} elseif ($ismanager == 2) {
$levelsql = ' AND level IN(3,4)';
}
if ($count == 1) {
return XDB::result_first("SELECT count(*) FROM " . XDB::table('forum_groupuser') . " WHERE uid='{$uid}' {$levelsql}");
}
empty($start) && ($start = 0);
empty($num) && ($num = 100);
return XDB::fetch_all("SELECT fid, level FROM " . XDB::table('forum_groupuser') . " WHERE uid='{$uid}' {$levelsql} ORDER BY lastupdate DESC " . XDB::limit($start, $num));
}
示例10: optimize
public function optimize()
{
XDB::query('OPTIMIZE TABLE ' . XDB::table($this->_table), 'SILENT');
}
示例11: fetch_all_by_block
public function fetch_all_by_block($aids, $bannedids, $uids, $catid, $startrow, $items, $orderby)
{
$wheres = array();
if ($aids) {
$wheres[] = XDB::field('albumid', $aids, 'in');
}
if ($bannedids) {
$wheres[] = XDB::field('albumid', $bannedids, 'notin');
}
if ($uids) {
$wheres[] = XDB::field('uid', $uids, 'in');
}
if ($catid && !in_array('0', $catid)) {
$wheres[] = XDB::field('catid', $catid, 'in');
}
$wheres[] = "friend = '0'";
$wheresql = $wheres ? implode(' AND ', $wheres) : '1';
if (!in_array($orderby, array('dateline', 'picnum', 'updatetime'))) {
$orderby = 'dateline';
}
return XDB::fetch_all('SELECT * FROM ' . XDB::table($this->_table) . ' WHERE ' . $wheresql . ' ORDER BY ' . XDB::order($orderby, 'DESC') . XDB::limit($startrow, $items));
}
示例12: create_table
public function create_table($maxtableid)
{
if ($maxtableid) {
XDB::query('SET SQL_QUOTE_SHOW_CREATE=0', 'SILENT');
$db =& XDB::object();
$query = XDB::query("SHOW CREATE TABLE %t", array($this->get_table_name()));
$create = $db->fetch_row($query);
$createsql = $create[1];
$createsql = str_replace(XDB::table($this->get_table_name()), XDB::table($this->get_table_name($maxtableid)), $createsql);
XDB::query($createsql);
return true;
} else {
return false;
}
}
示例13: getposttable
public static function getposttable($tableid = 0, $prefix = false)
{
global $_G;
$tableid = intval($tableid);
if ($tableid) {
loadcache('posttableids');
$tableid = $_G['cache']['posttableids'] && in_array($tableid, $_G['cache']['posttableids']) ? $tableid : 0;
$tablename = 'forum_post' . ($tableid ? "_{$tableid}" : '');
} else {
$tablename = 'forum_post';
}
if ($prefix) {
$tablename = XDB::table($tablename);
}
return $tablename;
}
示例14: get_total_filesize
public function get_total_filesize()
{
$attachsize = 0;
for ($i = 0; $i < 10; $i++) {
$attachsize += XDB::result_first("SELECT SUM(filesize) FROM " . XDB::table('forum_attachment_' . $i));
}
return $attachsize;
}