本文整理汇总了PHP中tname函数的典型用法代码示例。如果您正苦于以下问题:PHP tname函数的具体用法?PHP tname怎么用?PHP tname使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了tname函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: UpdateSql
function UpdateSql($data, $table, $where, $strict = false)
{
$f = '';
$field = array();
if ($strict) {
$fieldrows = $GLOBALS['db']->fetch_first("select * from " . tname($table));
$field = array_keys($fieldrows);
}
foreach ($data as $key => $val) {
if ($strict) {
if (in_array($key, $field)) {
$d = $i > 0 ? ',' : '';
$f .= $d . "`" . $key . "`=" . "'" . global_addslashes(trim($val)) . "'";
$i++;
}
} else {
$d = $i > 0 ? ',' : '';
$f .= $d . "`" . $key . "`=" . "'" . global_addslashes(trim($val)) . "'";
$i++;
}
}
$sql = "update " . tname($table) . " set ";
$sql .= $f . " where 1 " . $where;
return $sql;
}
示例2: setFlag
function setFlag($applications, $flag) {
global $_SGLOBAL;
$flag = ($flag == 'disabled') ? -1 : ($flag == 'default' ? 1 : 0);
$appIds = array();
if ($applications && is_array($applications)) {
foreach($applications as $application) {
$this->refreshApplication($application['appId'], $application['appName'], null, null, null, $flag, null);
$appIds[] = $application['appId'];
}
}
if ($flag == -1) {
$sql = sprintf('DELETE FROM %s WHERE icon IN (%s)', tname('feed'), simplode($appIds));
$_SGLOBAL['db']->query($sql);
$sql = sprintf('DELETE FROM %s WHERE appid IN (%s)', tname('userapp'), simplode($appIds));
$_SGLOBAL['db']->query($sql);
$sql = sprintf('DELETE FROM %s WHERE appid IN (%s)', tname('userappfield'), simplode($appIds));
$_SGLOBAL['db']->query($sql);
$sql = sprintf('DELETE FROM %s WHERE appid IN (%s)', tname('myinvite'), simplode($appIds));
$_SGLOBAL['db']->query($sql);
$sql = sprintf('DELETE FROM %s WHERE type IN (%s)', tname('notification'), simplode($appIds));
$_SGLOBAL['db']->query($sql);
}
$result = true;
return new APIResponse($result);
}
示例3: get_ad
function get_ad($adid)
{
global $_SGLOBAL;
$query = $_SGLOBAL['db']->query("SELECT * FROM " . tname('ad4dev') . " WHERE id={$adid}");
$ad = $_SGLOBAL['db']->fetch_array($query);
return $ad;
}
示例4: get_shop_nav
/**
* 商舖的自定義導航
*
* @param int $shopid 商舖 ID
*/
function get_shop_nav($shopid)
{
global $_G, $_SGLOBAL, $_BCACHE, $_SBLOCK;
$nav_default = $this->get_shop_nav_default($shopid);
$_SGLOBAL['shop_nav'] = array();
$_BCACHE->cachesql('shopnav', 'SELECT * FROM ' . tname('nav') . " WHERE (type=\\'sys\\' OR type=\\'shop\\') AND shopid='{$shopid}' AND displayorder>-1 ORDER BY displayorder ASC", 0, 0, 10, 0, 'detail', 'nav', $shopid);
foreach ($_SBLOCK['shopnav'] as $value) {
if ($value['available'] == 1) {
$value['target'] = $value['target'] ? ' target=\'_blank\'' : '';
$value['style'] = ' style=\'' . pktitlestyle($value['highlight']) . '\'';
$value['url'] = $nav_default[$value['flag']]['url'];
$_SGLOBAL['shop_nav'][$value['flag']] = $value;
unset($nav_default[$value['flag']]);
} else {
unset($nav_default[$value['flag']]);
}
}
foreach ($nav_default as $key => $value) {
if (!isset($rowitems[$key])) {
$_SGLOBAL['shop_nav'][$key] = $value;
}
$_SGLOBAL['shop_nav'][$key]['url'] = $value['url'];
}
return $_SGLOBAL['shop_nav'];
}
示例5: getrss
function getrss($catid)
{
global $_SGLOBAL, $_SCONFIG;
$rssarr = array();
$attacharr = array();
if (empty($_SCONFIG['rssnum'])) {
$_SCONFIG['rssnum'] = 10;
}
$sql = "SELECT si.itemid, si.uid, si.username, si.subject, sn.*, si.dateline, c.name FROM " . tname('spaceitems') . " si INNER JOIN " . tname('categories') . " c ON si.catid = c.catid LEFT JOIN " . tname('spacenews') . " sn ON si.itemid = sn.itemid WHERE si.type='news' ";
if (!empty($catid)) {
$sql .= " AND si.catid='{$catid}' ";
}
$sql .= " ORDER BY si.dateline DESC LIMIT 100";
$query = $_SGLOBAL['db']->query($sql);
while ($items = $_SGLOBAL['db']->fetch_array($query)) {
$othermsgarr = array();
$items['message'] = cutstr($items['message'], 255, 1);
if (!empty($othermsgarr)) {
$items['message'] = implode('<br>', $othermsgarr) . '<br>' . $items['message'];
}
if (!empty($items['hash'])) {
$attacharr[] = trim($items['hash']);
}
$rssarr[$items['itemid']] = $items;
}
return $rssarr;
}
示例6: get
function get($uId, $num) {
global $_SGLOBAL;
$result = array();
$query = $_SGLOBAL['db']->query("SELECT * FROM ".tname('feed')." WHERE uid='$uId' ORDER BY dateline DESC LIMIT 0,$num");
while($value = $_SGLOBAL['db']->fetch_array($query)) {
$result[] = array(
'appId' => $value['appid'],
'created' => $value['dateline'],
'type' => $value['icon'],
'titleTemplate' => $value['title_template'],
'titleData' => $value['title_data'],
'bodyTemplate' => $value['body_template'],
'bodyData' => $value['body_data'],
'bodyGeneral' => $value['body_general'],
'image1' => $value['image_1'],
'image1Link' => $value['image_1_link'],
'image2' => $value['image_2'],
'image2Link' => $value['image_2_link'],
'image3' => $value['image_3'],
'image3Link' => $value['image_3_link'],
'image4' => $value['image_4'],
'image4Link' => $value['image_4_link'],
'targetIds' => $value['target_ids'],
'privacy' => $value['friend']==0?'public':($value['friend']==1?'friends':'someFriends')
);
}
return new APIResponse($result);
}
示例7: get_uid
function get_uid($type, $msg)
{
global $_SGLOBAL;
if ($type == 1) {
$str = explode(",", $msg);
//print_r($str);
$collegeid = $str[0];
$startyear = $str[1];
$wheresql = "collegeid = '{$collegeid}' and startyear = {$startyear}";
//print($wheresql);
} else {
if ($type == 2) {
$str = explode(",", $msg);
$name = $str[0];
$bir = $str[1];
$wheresql = "realname = '{$name}' and birthday = {$bir}";
}
}
$query = $_SGLOBAL['db']->query("SELECT * FROM " . tname('baseprofile') . " where " . $wheresql);
if ($value = $_SGLOBAL['db']->fetch_array($query)) {
$uid = $value[uid];
if ($value[uid] == null) {
$uid = 'no uid';
}
} else {
$uid = 'no person';
}
return $uid;
}
示例8: getAstrosData
function getAstrosData()
{
$mysql = new SaeMysql();
$sql0 = "SELECT * FROM `" . tname("astro") . "` LIMIT 12";
$astros = $mysql->getData($sql0);
return $astros;
}
示例9: gettask
function gettask()
{
global $space, $_SGLOBAL;
$task = array();
if (!@(include_once S_ROOT . './data/data_task.php')) {
include_once S_ROOT . './source/function_cache.php';
task_cache();
}
if ($_SGLOBAL['task']) {
$usertasks = array();
$query = $_SGLOBAL['db']->query("SELECT * FROM " . tname('usertask') . " WHERE uid='{$_SGLOBAL['supe_uid']}'");
while ($value = $_SGLOBAL['db']->fetch_array($query)) {
$usertasks[$value['taskid']] = $value;
}
//需要执行的任务
foreach ($_SGLOBAL['task'] as $value) {
if ($value['starttime'] <= $_SGLOBAL['timestamp'] && (empty($usertasks[$value['taskid']]) || $value['nexttime'] && $_SGLOBAL['timestamp'] - $usertasks[$value['taskid']]['dateline'] >= $value['nexttime'])) {
$value['image'] = empty($value['image']) ? 'image/task.gif' : $value['image'];
$task = $value;
break;
}
}
}
return $task;
}
示例10: get_service
function get_service($serid)
{
global $_SGLOBAL;
$query = $_SGLOBAL['db']->query("SELECT * FROM " . tname('apps') . " WHERE id={$serid}");
$service = $_SGLOBAL['db']->fetch_array($query);
return $service;
}
示例11: send
function send($uId, $recipientIds, $appId, $notification) {
global $_SGLOBAL;
//过滤黑名单中的用户
$blacklist = $result = array();
// 允许匿名发送
if ($uId) {
$query = $_SGLOBAL['db']->query("SELECT * FROM ".tname('blacklist')." WHERE uid IN ('".implode("','", $recipientIds)."') AND buid='$uId'");
while($value = $_SGLOBAL['db']->fetch_array($query)) {
$blacklist[$value['uid']] = $value['uid'];
}
}
include_once(S_ROOT.'./source/function_cp.php');
foreach($recipientIds as $recipientId) {
$val = intval($recipientId);
if($val && empty($blacklist[$val])) {
$result[$val] = notification_add($val, $appId, $notification, 1);
} else {
$result[$recipientId] = null;
}
}
return new APIResponse($result);
}
示例12: main_action
function main_action()
{
global $db, $session;
$uid = $session->get('adminid');
//得到个人信息
$userinfo = $db->fetch_first('select * from ' . tname('admin') . ' where uid=' . $uid);
include ROOT_PATH . '/views/admin/adminframe.php';
}
示例13: update
/**
* 更新用户的积分
*
* @param integer $uId 用户Id
* @param integer $credits 积分值
* @return integer 更新后的用户积分
*/
function update($uId, $credits)
{
global $_SGLOBAL;
$sql = sprintf('UPDATE %s SET credit = credit + %d WHERE uid=%d', tname('space'), $credits, $uId);
$result = $_SGLOBAL['db']->query($sql);
$query = $_SGLOBAL['db']->query('SELECT credit FROM ' . tname('space') . ' WHERE uid =' . $uId);
$row = $_SGLOBAL['db']->fetch_array($query);
return new APIResponse($row['credit']);
}
示例14: areFriends
function areFriends($uId1, $uId2) {
global $_SGLOBAL;
$query = $_SGLOBAL['db']->query("SELECT uid FROM ".tname('friend')." WHERE uid='$uId1' AND fuid='$uId2' AND status='1'");
$result = false;
if($friend = $_SGLOBAL['db']->fetch_array($query)) {
$result = true;
}
return new APIResponse($result);
}
示例15: deletedoings
function deletedoings($ids)
{
global $_SGLOBAL;
$_SGLOBAL['db']->query("DELETE FROM " . tname('doing') . " WHERE doid IN (" . simplode($ids) . ")");
//删除评论
$_SGLOBAL['db']->query("DELETE FROM " . tname('docomment') . " WHERE doid IN (" . simplode($ids) . ")");
//删除feed
$_SGLOBAL['db']->query("DELETE FROM " . tname('feed') . " WHERE id IN (" . simplode($ids) . ") AND idtype='doid'");
return true;
}