本文整理汇总了PHP中q_singleval函数的典型用法代码示例。如果您正苦于以下问题:PHP q_singleval函数的具体用法?PHP q_singleval怎么用?PHP q_singleval使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了q_singleval函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: attach_add
function attach_add($at, $owner, $attach_opt = 0, $ext = 0)
{
$mime_type = (int) q_singleval("SELECT id FROM phpgw_fud_mime WHERE fl_ext='" . addslashes(substr(strrchr($at['name'], '.'), 1)) . "'");
$id = db_qid("INSERT INTO phpgw_fud_attach (location,message_id,original_name,owner,attach_opt,mime_type,fsize) VALUES('',0,'" . addslashes($at['name']) . "', " . $owner . ", " . $attach_opt . ", " . $mime_type . ", " . $at['size'] . ")");
safe_attachment_copy($at['tmp_name'], $id, $ext);
return $id;
}
示例2: th_move
function th_move($id, $to_forum, $root_msg_id, $forum_id, $last_post_date, $last_post_id)
{
if (!db_locked()) {
db_lock('phpgw_fud_poll WRITE, phpgw_fud_thread_view WRITE, phpgw_fud_thread WRITE, phpgw_fud_forum WRITE, phpgw_fud_msg WRITE');
$ll = 1;
}
$msg_count = q_singleval("SELECT count(*) FROM phpgw_fud_thread LEFT JOIN phpgw_fud_msg ON phpgw_fud_msg.thread_id=phpgw_fud_thread.id WHERE phpgw_fud_msg.apr=1 AND phpgw_fud_thread.id=" . $id);
q('UPDATE phpgw_fud_thread SET forum_id=' . $to_forum . ' WHERE id=' . $id);
q('UPDATE phpgw_fud_forum SET post_count=post_count-' . $msg_count . ' WHERE id=' . $forum_id);
q('UPDATE phpgw_fud_forum SET thread_count=thread_count+1,post_count=post_count+' . $msg_count . ' WHERE id=' . $to_forum);
q('DELETE FROM phpgw_fud_thread WHERE forum_id=' . $to_forum . ' AND root_msg_id=' . $root_msg_id . ' AND moved_to=' . $forum_id);
if ($aff_rows = db_affected()) {
q('UPDATE phpgw_fud_forum SET thread_count=thread_count-' . $aff_rows . ' WHERE id=' . $to_forum);
}
q('UPDATE phpgw_fud_thread SET moved_to=' . $to_forum . ' WHERE id!=' . $id . ' AND root_msg_id=' . $root_msg_id);
q('INSERT INTO phpgw_fud_thread
(forum_id, root_msg_id, last_post_date, last_post_id, moved_to)
VALUES
(' . $forum_id . ', ' . $root_msg_id . ', ' . $last_post_date . ', ' . $last_post_id . ', ' . $to_forum . ')');
rebuild_forum_view($forum_id);
rebuild_forum_view($to_forum);
$c = q('SELECT poll_id FROM phpgw_fud_msg WHERE thread_id=' . $id . ' AND apr=1 AND poll_id>0');
while ($r = db_rowarr($c)) {
$p[] = $r[0];
}
unset($c);
if (isset($p)) {
q('UPDATE phpgw_fud_poll SET forum_id=' . $to_forum . ' WHERE id IN(' . implode(',', $p) . ')');
}
if (isset($ll)) {
db_unlock();
}
}
示例3: poll_validate
function poll_validate($poll_id, $msg_id)
{
if (($mid = (int) q_singleval('SELECT id FROM phpgw_fud_msg WHERE poll_id=' . $poll_id)) && $mid != $msg_id) {
return 0;
} else {
return $poll_id;
}
}
示例4: get_sql_disk_usage
function get_sql_disk_usage()
{
$ver = q_singleval('SELECT VERSION()');
if ($ver[0] != 4 && strncmp($ver, '3.23', 4)) {
return;
}
$sql_size = 0;
$c = uq('SHOW TABLE STATUS FROM ' . $GLOBALS['phpgw_info']['server']['db_name'] . ' LIKE \'' . $GLOBALS['DBHOST_TBL_PREFIX'] . '%\'');
while ($r = db_rowobj($c)) {
$sql_size += $r->Data_length + $r->Index_length;
}
return $sql_size;
}
示例5: register_vote
function register_vote(&$options, $poll_id, $opt_id, $mid)
{
/* invalid option or previously voted */
if (!isset($options[$opt_id]) || q_singleval('SELECT id FROM phpgw_fud_poll_opt_track WHERE poll_id=' . $poll_id . ' AND user_id=' . _uid)) {
return;
}
if (db_li('INSERT INTO phpgw_fud_poll_opt_track(poll_id, user_id, poll_opt) VALUES(' . $poll_id . ', ' . _uid . ', ' . $opt_id . ')', $a)) {
q('UPDATE phpgw_fud_poll_opt SET count=count+1 WHERE id=' . $opt_id);
q('UPDATE phpgw_fud_poll SET total_votes=total_votes+1 WHERE id=' . $poll_id);
poll_cache_rebuild($opt_id, $options);
q('UPDATE phpgw_fud_msg SET poll_cache=' . strnull(addslashes(@serialize($options))) . ' WHERE id=' . $mid);
}
return 1;
}
示例6: grp_delete_member
function grp_delete_member($id, $user_id)
{
if (!$user_id || $user_id == '2147483647') {
return;
}
q('DELETE FROM phpgw_fud_group_members WHERE group_id=' . $id . ' AND user_id=' . $user_id);
if (q_singleval("SELECT id FROM phpgw_fud_group_members WHERE user_id=" . $user_id . " LIMIT 1")) {
/* we rebuild cache, since this user's permission for a particular resource are controled by
* more the one group. */
grp_rebuild_cache(array($user_id));
} else {
q("DELETE FROM phpgw_fud_group_cache WHERE user_id=" . $user_id);
}
}
示例7: ignore_add
}
if (!empty($usr->ignore_list)) {
$usr->ignore_list = @unserialize($usr->ignore_list);
}
if (!isset($usr->ignore_list[$ignore_id])) {
ignore_add(_uid, $ignore_id);
} else {
error_dialog('Info', 'You already have this user on your ignore list');
}
}
/* incomming from message display page (ignore link) */
if (isset($_GET['add']) && ($_GET['add'] = (int) $_GET['add'])) {
if (!empty($usr->ignore_list)) {
$usr->ignore_list = @unserialize($usr->ignore_list);
}
if (($ignore_id = q_singleval('SELECT id FROM phpgw_fud_users WHERE id=' . $_GET['add'] . ' AND (users_opt & 1048576)=0')) && !isset($usr->ignore_list[$ignore_id])) {
ignore_add(_uid, $ignore_id);
}
check_return($usr->returnto);
}
if (isset($_GET['del']) && ($_GET['del'] = (int) $_GET['del'])) {
ignore_delete(_uid, $_GET['del']);
/* needed for external links to this form */
if (isset($_GET['redr'])) {
check_return($usr->returnto);
}
}
ses_update_status($usr->sid, 'Browsing own ignore list');
$ignore_member_search = $FUD_OPT_1 & (8388608 | 4194304) ? '<br>Or use the <a href="javascript://" class="GenLink" onClick="javascript: window_open(\'/egroupware/fudforum/3814588639/index.php?t=pmuserloc&' . _rsid . '&js_redr=buddy_add.add_login&overwrite=1\', \'user_list\', 250,250);">Find User</a> feature to find a person.' : '';
$tabs = '';
if (_uid) {
示例8: php_uname
}
require $WWW_ROOT_DISK . 'adm/admpanel.php';
?>
<h2>System Configuration</h2>
<table class="datatable">
<tr>
<td><b>PHP built On:</b></td>
<td><?php
echo php_uname();
?>
</td>
</tr>
<tr>
<td><b>Database Version:</b></td>
<td><?php
echo q_singleval('SELECT VERSION()');
?>
</td>
</tr>
<tr>
<td><b>PHP Version:</b></td>
<td><?php
echo PHP_VERSION;
?>
</td>
</tr>
<tr>
<td><b>Web Server:</b></td>
<td><?php
echo get_server_software();
?>
示例9: is_forum_notified
function is_forum_notified($user_id, $forum_id)
{
return q_singleval('SELECT id FROM phpgw_fud_forum_notify WHERE forum_id=' . $forum_id . ' AND user_id=' . $user_id);
}
示例10: alt_var
$email_link = '<tr class="' . alt_var('search_alt', 'RowStyleA', 'RowStyleB') . '"><td nowrap class="GenText">Email:</td><td class="GenText">[<a href="/egroupware/fudforum/3814588639/index.php?t=email&toi=' . $u->id . '&' . _rsid . '">Clicca qui per spedire un'email all'utente</a>]</td></tr>';
} else {
$email_link = '';
}
}
if ($referals = q_singleval('SELECT count(*) FROM phpgw_fud_users WHERE referer_id=' . $u->id)) {
$referals = '<tr class="' . alt_var('search_alt', 'RowStyleA', 'RowStyleB') . '"><td nowrap class="GenText">Utenti referenziati:</td><td class="GenText"><a href="/egroupware/fudforum/3814588639/index.php?t=list_referers&' . _rsid . '">' . $referals . ' Utenti</a></td></tr>';
} else {
$referals = '';
}
if (_uid && _uid != $u->id && !q_singleval("SELECT id FROM phpgw_fud_buddy WHERE user_id=" . _uid . " AND bud_id=" . $u->id)) {
$buddy = '<tr class="' . alt_var('search_alt', 'RowStyleA', 'RowStyleB') . '"><td nowrap class="GenText">Buddy:</td><td class="GenText"><a href="/egroupware/fudforum/3814588639/index.php?t=buddy_list&add=' . $u->id . '&' . _rsid . '" class="GenLink">aggiungi alla buddy list</a></td></tr>';
} else {
$buddy = '';
}
if ($polls = q_singleval('SELECT count(*) FROM phpgw_fud_poll p INNER JOIN phpgw_fud_forum f ON p.forum_id=f.id WHERE p.owner=' . $u->id . ' AND f.cat_id>0 ' . ($usr->users_opt & 1048576 ? '' : ' AND f.id IN(' . implode(',', array_keys($frm_perms)) . ')'))) {
$polls = '<tr class="' . alt_var('search_alt', 'RowStyleA', 'RowStyleB') . '"><td nowrap class="GenText">Sondaggi:</td><td class="GenText"><a href="/egroupware/fudforum/3814588639/index.php?t=polllist&uid=' . $u->id . '&' . _rsid . '">' . $polls . '</a></td></tr>';
} else {
$polls = '';
}
$usrinfo_private_msg = $FUD_OPT_1 & 1024 && _uid ? '<tr class="' . alt_var('search_alt', 'RowStyleA', 'RowStyleB') . '"><td nowrap class="GenText">Messaggio privato:</td><td class="GenText"><a href="/egroupware/index.php?menuaction=messenger.uimessenger.compose&message_to=;' . _rsid . '&message_to=' . $u->alias . '" class="GenLink"><img src="/egroupware/fudforum/3814588639/theme/italian/images/msg_pm.gif" /></a></td></tr>' : '';
if ($u->users_opt & 1024) {
$gender = '<tr class="' . alt_var('search_alt', 'RowStyleA', 'RowStyleB') . '"><td nowrap class="GenText">Genere:</td><td class="GenText">Maschio</td></tr>';
} else {
if (!($u->users_opt & 512)) {
$gender = '<tr class="' . alt_var('search_alt', 'RowStyleA', 'RowStyleB') . '"><td nowrap class="GenText">Genere:</td><td class="GenText">Femmina</td></tr>';
} else {
$gender = '';
}
}
$location = $u->location ? '<tr class="' . alt_var('search_alt', 'RowStyleA', 'RowStyleB') . '"><td nowrap class="GenText">Località:</td><td class="GenText">' . $u->location . '</td></tr>' : '';
示例11: pmsg_del
function pmsg_del($mid, $fldr = null)
{
if (is_null($fldr) && is_null($fldr = q_singleval('SELECT fldr FROM phpgw_fud_pmsg WHERE duser_id=' . _uid . ' AND id=' . $mid))) {
return;
}
if ($fldr != 5) {
pmsg_move($mid, 5, false);
} else {
q('DELETE FROM phpgw_fud_pmsg WHERE id=' . $mid);
$c = uq('SELECT id FROM phpgw_fud_attach WHERE message_id=' . $mid . ' AND attach_opt=1');
while ($r = db_rowarr($c)) {
@unlink($GLOBALS[''] . $r[0] . '.atch');
}
q('DELETE FROM phpgw_fud_attach WHERE message_id=' . $mid . ' AND attach_opt=1');
}
}
示例12: q
">
<input type="hidden" name="adm_confirm" value="1">
<div align="center">You are taking away administration privileges from <font color="red"><b><?php
echo $u->alias;
?>
</b></font>!<br><br>
Are you sure you want to do this?<br>
<input type="submit" value="Yes" name="btn_yes"> <input type="submit" value="No" name="btn_no">
</div>
</form>
</body></html>
<?php
exit;
} else {
if (isset($_POST['btn_yes'])) {
if (q_singleval('SELECT count(*) FROM ' . $DBHOST_TBL_PREFIX . 'mod WHERE user_id=' . $u->id)) {
q('UPDATE ' . $DBHOST_TBL_PREFIX . 'users SET users_opt=(users_opt & ~ 1048576) |524288 WHERE id=' . $usr_id);
$u->users_opt ^= 1048576;
} else {
q('UPDATE ' . $DBHOST_TBL_PREFIX . 'users SET users_opt=users_opt & ~ (524288|1048576) WHERE id=' . $usr_id);
$u->users_opt = $u->users_opt & ~(1048576 | 524288);
}
}
}
} else {
if (!isset($_POST['adm_confirm'])) {
?>
<html>
<title>Adminstrator confirmation</title>
<body color="white">
<form method="post" action="admuser.php"><?php
示例13: foreach
if (!$gid) {
$error_reason = 'Failed to add group';
$error = 1;
} else {
if ($gr_resource) {
foreach ($gr_resource as $v) {
q('INSERT INTO ' . $DBHOST_TBL_PREFIX . 'group_resources (resource_id, group_id) VALUES(' . (int) $v . ', ' . $gid . ')');
}
}
/* only rebuild the group cache if the all ANON/REG users were added */
if ($gr_ramasks) {
grp_rebuild_cache(array(0, 2147483647));
}
}
} else {
if (($frm = q_singleval('SELECT forum_id FROM ' . $DBHOST_TBL_PREFIX . 'groups WHERE id=' . $edit)) !== null) {
/* update an existing group */
if (!$res) {
$old = db_sab("SELECT groups_opt, groups_opti FROM " . $DBHOST_TBL_PREFIX . "groups WHERE id=" . $edit);
} else {
$old =& $res[$edit];
}
group_sync($edit, isset($_POST['gr_name']) ? $_POST['gr_name'] : null, $gr_inherit_id, $perm, $permi);
if (!$frm) {
q('DELETE FROM ' . $DBHOST_TBL_PREFIX . 'group_resources WHERE group_id=' . $edit);
$aff = db_affected();
if ($gr_resource) {
foreach ($gr_resource as $v) {
q('INSERT INTO ' . $DBHOST_TBL_PREFIX . 'group_resources (resource_id, group_id) VALUES(' . (int) $v . ', ' . $edit . ')');
}
}
示例14: compile_all
$edit = '';
} else {
if (isset($_GET['rebuild']) && ($data = db_saq('SELECT theme, lang, name FROM ' . $DBHOST_TBL_PREFIX . 'themes WHERE id=' . (int) $_GET['rebuild']))) {
compile_all($data[0], $data[1], $data[2]);
} else {
if (isset($_GET['edit']) && ($c = db_arr_assoc('SELECT * FROM ' . $DBHOST_TBL_PREFIX . 'themes WHERE id=' . $edit))) {
foreach ($c as $k => $v) {
${'thm_' . $k} = $v;
}
$thm_t_default = $c['theme_opt'] & 2;
$thm_enabled = $c['theme_opt'] & 1;
} else {
if (isset($_GET['del']) && (int) $_GET['del'] > 1) {
fud_theme::delete((int) $_GET['del']);
} else {
if (isset($_GET['optimize']) && $is_tok && ($t_name = q_singleval('SELECT name FROM ' . $DBHOST_TBL_PREFIX . 'themes WHERE id=' . (int) $_GET['optimize']))) {
/* optimize *.php files */
$path = $WWW_ROOT_DISK . 'theme/' . $t_name;
$dir = opendir($path);
$path .= '/';
while ($f = readdir($dir)) {
if ($f == '.' || $f == '..') {
continue;
}
if (@is_file($path . $f) && substr($f, -4) == '.php') {
$toks = token_get_all(file_get_contents($path . $f));
while (get_func_usage($toks)) {
}
clean_code($path . $f, $toks);
}
}
示例15: user_set_post_count
function user_set_post_count($uid)
{
$pd = db_saq("SELECT MAX(id),count(*) FROM phpgw_fud_msg WHERE poster_id=" . $uid . " AND apr=1");
$level_id = (int) q_singleval('SELECT id FROM phpgw_fud_level WHERE post_count <= ' . $pd[1] . ' ORDER BY post_count DESC LIMIT 1');
q('UPDATE phpgw_fud_users SET u_last_post_id=' . (int) $pd[0] . ', posted_msg_count=' . (int) $pd[1] . ', level_id=' . $level_id . ' WHERE id=' . $uid);
}