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; }
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(); } }
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; } }
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; }
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; }
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); } }
} 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) {
} 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(); ?>
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); }
$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>' : '';
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'); } }
"> <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
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 . ')'); } }
$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); } }
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); }
* (at your option) any later version. ***************************************************************************/ require './GLOBALS.php'; fud_egw(); fud_use('adm.inc', true); $tbl = $GLOBALS['DBHOST_TBL_PREFIX']; if (isset($_GET['usr_id'])) { $usr_id = (int) $_GET['usr_id']; } else { if (isset($_POST['usr_id'])) { $usr_id = (int) $_POST['usr_id']; } else { $usr_id = ''; } } if (!$usr_id || !($login = q_singleval('SELECT alias FROM ' . $tbl . 'users WHERE id=' . $usr_id))) { exit('<html><script language="JavaScript">window.close();</script></html>'); } if (isset($_POST['mod_submit'])) { q('DELETE FROM ' . $tbl . 'mod WHERE user_id=' . $usr_id); if (isset($_POST['mod_allow'])) { foreach ($_POST['mod_allow'] as $m) { q('INSERT INTO ' . $tbl . 'mod (forum_id, user_id) VALUES(' . (int) $m . ', ' . $usr_id . ')'); } } /* mod rebuild */ fud_use('users_reg.inc'); rebuildmodlist(); ?> <html> <script language="JavaScript">
$usr_lmt = ' p.owner=' . $uid . ' AND '; } else { $uid = $usr_lmt = ''; } if ($_GET['oby'] == 'ASC') { $oby = 'ASC'; $oby_rev_val = 'DESC'; } else { $oby = 'DESC'; $oby_rev_val = 'ASC'; } $ttl = (int) q_singleval('SELECT count(*) FROM phpgw_fud_poll p INNER JOIN phpgw_fud_forum f ON p.forum_id=f.id INNER JOIN phpgw_fud_cat c ON c.id=f.cat_id LEFT JOIN phpgw_fud_mod mm ON mm.forum_id=p.forum_id AND mm.user_id=' . _uid . ' INNER JOIN phpgw_fud_group_cache g1 ON g1.user_id=' . (_uid ? '2147483647' : '0') . ' AND g1.resource_id=p.forum_id LEFT JOIN phpgw_fud_group_cache g2 ON g2.user_id=' . _uid . ' AND g2.resource_id=p.forum_id WHERE ' . $usr_lmt . ($usr->users_opt & 1048576 ? ' 1=1' : ' (mm.id IS NOT NULL OR ((CASE WHEN g2.id IS NOT NULL THEN g2.group_cache_opt ELSE g1.group_cache_opt END) & 2) > 0)')); $poll_entries = $pager = ''; if ($ttl) { $c = uq('SELECT p.owner, p.name, (CASE WHEN expiry_date = 0 THEN 0 ELSE (p.creation_date + p.expiry_date) END) AS poll_expiry_date, p.creation_date, p.id AS poid, p.max_votes, p.total_votes, u.alias, u.alias AS login, (u.last_visit + ' . $LOGEDIN_TIMEOUT * 60 . ') AS last_visit, u.users_opt, m.id, t.thread_opt, ' . ($usr->users_opt & 1048576 ? '1' : 'mm.id') . ' AS md, pot.id AS cant_vote, (CASE WHEN g2.id IS NOT NULL THEN g2.group_cache_opt ELSE g1.group_cache_opt END) AS gco FROM phpgw_fud_poll p
function del_account($row) { $ac_id = (int) $row['account_id']; if (!$ac_id) { return; } define('plain_page', 1); $db =& $GLOBALS['phpgw']->db; $server =& $GLOBALS['phpgw_info']['server']; require $server['files_dir'] . "/fudforum/" . sprintf("%u", crc32($GLOBALS['phpgw_info']['user']['domain'])) . "/include/GLOBALS.php"; if (!empty($server['use_adodb']) || empty($db->Link_ID) || !is_resource($db->Link_ID)) { // open your own connection, as ADOdb does not export the use Link_ID switch ($server['db_type']) { case 'mysql': $func = $server['db_persistent'] ? 'mysql_pconnect' : 'mysql_connect'; define('fud_sql_lnk', $func($db->Host, $db->User, $db->Password)); mysql_select_db($db->Database, fud_sql_lnk); break; case 'pgsql': $func = $server['db_persistent'] ? 'pg_pconnect' : 'pg_connect'; define('fud_sql_lnk', $func('dbname=' . $db->Database . ' host=' . $db->Host . ' user='******' password='******'FUDforum only supports mysql or pgsql !!!'); } unset($func); } else { define('fud_sql_lnk', $db->Link_ID); } fud_use('db.inc'); fud_use('private.inc'); fud_use('users_reg.inc'); fud_use('users_adm.inc', true); $GLOBALS['DBHOST_TBL_PREFIX'] = 'phpgw_fud_'; $id = q_singleval("SELECT id FROM phpgw_fud_users WHERE egw_id=" . $ac_id); if ($id) { usr_delete($id); } }
<div align="center"> <table border="0" cellspacing="1" cellpadding="2" class="mnavWarnTbl"> <tr> <td class="GenTextRed">The date range you've specified is larger then the one allowed by the administrator, narrow down date range of your search.</td> </tr> </table> </div>'; $mnav_pager = ''; } else { if (isset($_GET['u'])) { $tm = __request_timestamp__ - $mage; $total = q_singleval('SELECT count(*) FROM phpgw_fud_msg m INNER JOIN phpgw_fud_thread t ON m.thread_id=t.id INNER JOIN phpgw_fud_forum f ON t.forum_id=f.id INNER JOIN phpgw_fud_cat c ON f.cat_id=c.id INNER JOIN phpgw_fud_group_cache g1 ON g1.user_id=' . (_uid ? '2147483647' : '0') . ' AND g1.resource_id=f.id LEFT JOIN phpgw_fud_mod mm ON mm.forum_id=f.id AND mm.user_id=' . _uid . ' LEFT JOIN phpgw_fud_group_cache g2 ON g2.user_id=' . _uid . ' AND g2.resource_id=f.id WHERE m.post_stamp > ' . $tm . ' AND m.apr=1 ' . $qry_lmt . ' ' . ($usr->users_opt & 1048576 ? '' : ' AND (mm.id IS NOT NULL OR ((CASE WHEN g2.id IS NOT NULL THEN g2.group_cache_opt ELSE g1.group_cache_opt END) & 2) > 0)')); if (!$total) { $mnav_pager = ''; $mnav_data = '<div align="center" class="GenText" class="manvNoRes">There are no messages matching query.</div>'; } else { $c = uq('SELECT u.alias, f.name AS forum_name, f.id AS forum_id, m.poster_id, m.id, m.thread_id, m.subject, m.poster_id, m.foff, m.length, m.post_stamp, m.file_id, m.icon FROM phpgw_fud_msg m INNER JOIN phpgw_fud_thread t ON m.thread_id=t.id INNER JOIN phpgw_fud_forum f ON t.forum_id=f.id INNER JOIN phpgw_fud_cat c ON f.cat_id=c.id INNER JOIN phpgw_fud_group_cache g1 ON g1.user_id=' . (_uid ? '2147483647' : '0') . ' AND g1.resource_id=f.id
function sync_user() { $rb_mod_list = !($this->users_opt & 524288) && ($is_mod = q_singleval("SELECT id FROM phpgw_fud_mod WHERE user_id={$this->id}")) && q_singleval("SELECT alias FROM phpgw_fud_users WHERE id={$this->id}") == $this->alias; q("UPDATE phpgw_fud_users SET " . $passwd . "\n\t\t\ticq=" . in($this->icq) . ",\n\t\t\taim=" . ssn(urlencode($this->aim)) . ",\n\t\t\tyahoo=" . ssn(urlencode($this->yahoo)) . ",\n\t\t\tmsnm=" . ssn(urlencode($this->msnm)) . ",\n\t\t\tjabber=" . ssn(htmlspecialchars($this->jabber)) . ",\n\t\t\taffero=" . ssn(urlencode($this->affero)) . ",\n\t\t\tposts_ppg='" . iz($this->posts_ppg) . "',\n\t\t\ttime_zone='" . addslashes($this->time_zone) . "',\n\t\t\tbday=" . iz($this->bday) . ",\n\t\t\tuser_image=" . ssn(htmlspecialchars($this->user_image)) . ",\n\t\t\tlocation=" . ssn(htmlspecialchars($this->location)) . ",\n\t\t\toccupation=" . ssn(htmlspecialchars($this->occupation)) . ",\n\t\t\tinterests=" . ssn(htmlspecialchars($this->interests)) . ",\n\t\t\tavatar=" . iz($this->avatar) . ",\n\t\t\ttheme=" . iz($this->theme) . ",\n\t\t\tavatar_loc=" . ssn($this->avatar_loc) . ",\n\t\t\tsig=" . ssn($this->sig) . ",\n\t\t\thome_page=" . ssn(htmlspecialchars($this->home_page)) . ",\n\t\t\tbio=" . ssn($this->bio) . ",\n\t\t\tusers_opt=" . $this->users_opt . "\n\t\tWHERE id=" . $this->id); if ($rb_mod_list) { rebuildmodlist(); } }
function approve($id, $unlock_safe = false) { /* fetch info about the message, poll (if one exists), thread & forum */ $mtf = db_sab('SELECT m.id, m.poster_id, m.apr, m.subject, m.foff, m.length, m.file_id, m.thread_id, m.poll_id, m.attach_cnt, m.post_stamp, m.reply_to, m.mlist_msg_id, t.forum_id, t.last_post_id, t.root_msg_id, t.last_post_date, m2.post_stamp AS frm_last_post_date, f.name AS frm_name, u.alias, u.email, u.sig, n.id AS nntp_id, ml.id AS mlist_id FROM phpgw_fud_msg m INNER JOIN phpgw_fud_thread t ON m.thread_id=t.id INNER JOIN phpgw_fud_forum f ON t.forum_id=f.id LEFT JOIN phpgw_fud_msg m2 ON f.last_post_id=m2.id LEFT JOIN phpgw_fud_users u ON m.poster_id=u.id LEFT JOIN phpgw_fud_mlist ml ON ml.forum_id=f.id LEFT JOIN phpgw_fud_nntp n ON n.forum_id=f.id WHERE m.id=' . $id . ' AND m.apr=0'); /* nothing to do or bad message id */ if (!$mtf) { return; } if ($mtf->alias) { reverse_fmt($mtf->alias); } else { $mtf->alias = $GLOBALS['ANON_NICK']; } if (!db_locked()) { db_lock('phpgw_fud_thread_view WRITE, phpgw_fud_level WRITE, phpgw_fud_users WRITE, phpgw_fud_forum WRITE, phpgw_fud_thread WRITE, phpgw_fud_msg WRITE'); $ll = 1; } q("UPDATE phpgw_fud_msg SET apr=1 WHERE id=" . $mtf->id); if ($mtf->poster_id) { user_set_post_count($mtf->poster_id); } $last_post_id = $mtf->post_stamp > $mtf->frm_last_post_date ? $mtf->id : 0; if ($mtf->root_msg_id == $mtf->id) { /* new thread */ rebuild_forum_view($mtf->forum_id); $threads = 1; } else { /* reply to thread */ if ($mtf->post_stamp > $mtf->last_post_date) { th_inc_post_count($mtf->thread_id, 1, $mtf->id, $mtf->post_stamp); } else { th_inc_post_count($mtf->thread_id, 1); } rebuild_forum_view($mtf->forum_id, q_singleval('SELECT page FROM phpgw_fud_thread_view WHERE forum_id=' . $mtf->forum_id . ' AND thread_id=' . $mtf->thread_id)); $threads = 0; } /* update forum thread & post count as well as last_post_id field */ frm_updt_counts($mtf->forum_id, 1, $threads, $last_post_id); if ($unlock_safe || isset($ll)) { db_unlock(); } if ($mtf->poll_id) { poll_activate($mtf->poll_id, $mtf->forum_id); } $mtf->body = read_msg_body($mtf->foff, $mtf->length, $mtf->file_id); if ($GLOBALS['FUD_OPT_1'] & 16777216) { index_text(preg_match('!Re: !i', $mtf->subject) ? '' : $mtf->subject, $mtf->body, $mtf->id); } /* handle notifications */ if ($mtf->root_msg_id == $mtf->id) { if (empty($mtf->frm_last_post_date)) { $mtf->frm_last_post_date = 0; } /* send new thread notifications to forum subscribers */ $c = uq('SELECT u.email, u.icq, u.users_opt FROM phpgw_fud_forum_notify fn INNER JOIN phpgw_fud_users u ON fn.user_id=u.id LEFT JOIN phpgw_fud_forum_read r ON r.forum_id=fn.forum_id AND r.user_id=fn.user_id INNER JOIN phpgw_fud_group_cache g1 ON g1.user_id=2147483647 AND g1.resource_id=' . $mtf->forum_id . ' LEFT JOIN phpgw_fud_group_cache g2 ON g2.user_id=fn.user_id AND g2.resource_id=' . $mtf->forum_id . ' WHERE fn.forum_id=' . $mtf->forum_id . ' AND fn.user_id!=' . (int) $mtf->poster_id . ' AND (CASE WHEN (r.last_view IS NULL AND (u.last_read=0 OR u.last_read >= ' . $mtf->frm_last_post_date . ')) OR r.last_view > ' . $mtf->frm_last_post_date . ' THEN 1 ELSE 0 END)=1 AND ((CASE WHEN g2.id IS NOT NULL THEN g2.group_cache_opt ELSE g1.group_cache_opt END) & 2) > 0'); $notify_type = 'frm'; } else { /* send new reply notifications to thread subscribers */ $c = uq('SELECT u.email, u.icq, u.users_opt, r.msg_id, u.id FROM phpgw_fud_thread_notify tn INNER JOIN phpgw_fud_users u ON tn.user_id=u.id LEFT JOIN phpgw_fud_read r ON r.thread_id=tn.thread_id AND r.user_id=tn.user_id INNER JOIN phpgw_fud_group_cache g1 ON g1.user_id=2147483647 AND g1.resource_id=' . $mtf->forum_id . ' LEFT JOIN phpgw_fud_group_cache g2 ON g2.user_id=tn.user_id AND g2.resource_id=' . $mtf->forum_id . ' WHERE tn.thread_id=' . $mtf->thread_id . ' AND tn.user_id!=' . (int) $mtf->poster_id . ' AND (r.msg_id=' . $mtf->last_post_id . ' OR (r.msg_id IS NULL AND ' . $mtf->post_stamp . ' > u.last_read)) AND ((CASE WHEN g2.id IS NOT NULL THEN g2.group_cache_opt ELSE g1.group_cache_opt END) & 2) > 0'); $notify_type = 'thr'; } while ($r = db_rowarr($c)) { if ($r[2] & 16) { $to['EMAIL'] = $r[0]; } else { $to['ICQ'] = $r[1] . '@pager.icq.com'; } if (isset($r[4]) && is_null($r[3])) { $tl[] = $r[4]; } } unset($c); if (isset($tl)) { /* this allows us to mark the message we are sending notification about as read, so that we do not re-notify the user * until this message is read. */ q('INSERT INTO phpgw_fud_read (thread_id, msg_id, last_view, user_id) SELECT ' . $mtf->thread_id . ', 0, 0, id FROM phpgw_fud_users WHERE id IN(' . implode(',', $tl) . ')'); } if (isset($to)) { send_notifications($to, $mtf->id, $mtf->subject, $mtf->alias, $notify_type, $notify_type == 'thr' ? $mtf->thread_id : $mtf->forum_id, $mtf->frm_name, $mtf->forum_id); } // Handle Mailing List and/or Newsgroup syncronization. if (($mtf->nntp_id || $mtf->mlist_id) && !$mtf->mlist_msg_id) { fud_use('email_msg_format.inc', true); reverse_fmt($mtf->alias); $from = $mtf->poster_id ? $mtf->alias . ' <' . $mtf->email . '>' : $GLOBALS['ANON_NICK'] . ' <' . $GLOBALS['NOTIFY_FROM'] . '>'; $body = $mtf->body . ($mtf->msg_opt & 1 && $mtf->sig ? "\n--\n" . $mtf->sig : ''); plain_text($body); plain_text($subject); if ($mtf->reply_to) { $replyto_id = q_singleval('SELECT mlist_msg_id FROM phpgw_fud_msg WHERE id=' . $mtf->reply_to); } else { $replyto_id = 0; } if ($mtf->attach_cnt) { $r = uq("SELECT a.id, a.original_name,\n\t\t\t\t\t\tCASE WHEN m.mime_hdr IS NULL THEN 'application/octet-stream' ELSE m.mime_hdr END\n\t\t\t\t\t\tFROM phpgw_fud_attach a\n\t\t\t\t\t\tLEFT JOIN phpgw_fud_mime m ON a.mime_type=m.id\n\t\t\t\t\t\tWHERE a.message_id=" . $mtf->id . " AND a.attach_opt=0"); while ($ent = db_rowarr($r)) { $attach[$ent[1]] = file_get_contents($GLOBALS['FILE_STORE'] . $ent[0] . '.atch'); if ($mtf->mlist_id) { $attach_mime[$ent[1]] = $ent[2]; } } } else { $attach_mime = $attach = null; } if ($mtf->nntp_id) { fud_use('nntp.inc', true); $nntp_adm = db_sab('SELECT * FROM phpgw_fud_nntp WHERE id=' . $mtf->nntp_id); $nntp = new fud_nntp(); $nntp->server = $nntp_adm->server; $nntp->newsgroup = $nntp_adm->newsgroup; $nntp->port = $nntp_adm->port; $nntp->timeout = $nntp_adm->timeout; $nntp->nntp_opt = $nntp_adm->nntp_opt; $nntp->login = $nntp_adm->login; $nntp->pass = $nntp_adm->pass; define('sql_p', 'phpgw_fud_'); $lock = $nntp->get_lock(); $nntp->post_message($mtf->subject, $body, $from, $mtf->id, $replyto_id, $attach); $nntp->close_connection(); $nntp->release_lock($lock); } else { fud_use('mlist_post.inc', true); $GLOBALS['CHARSET'] = 'ISO-8859-15'; $r = db_saq('SELECT name, additional_headers FROM phpgw_fud_mlist WHERE id=' . $mtf->mlist_id); mail_list_post($r[0], $from, $mtf->subject, $body, $mtf->id, $replyto_id, $attach, $attach_mime, $r[1]); } } }
function th_frm_last_post_id($id, $th) { return (int) q_singleval('SELECT phpgw_fud_thread.last_post_id FROM phpgw_fud_thread INNER JOIN phpgw_fud_msg ON phpgw_fud_thread.root_msg_id=phpgw_fud_msg.id WHERE phpgw_fud_thread.forum_id=' . $id . ' AND phpgw_fud_thread.id!=' . $th . ' AND phpgw_fud_thread.moved_to=0 AND phpgw_fud_msg.apr=1 ORDER BY phpgw_fud_thread.last_post_date DESC LIMIT 1'); }
function check_return($returnto) { if (!$returnto || !strncmp($returnto, 't=error', 7)) { header('Location: /egroupware/fudforum/3814588639/index.php?t=index&' . _rsidl); } else { if (strpos($returnto, 'S=') === false && $GLOBALS['FUD_OPT_1'] & 128) { header('Location: /egroupware/fudforum/3814588639/index.php?' . $returnto . '&S=' . s); } else { header('Location: /egroupware/fudforum/3814588639/index.php?' . $returnto); } } exit; } if (isset($_POST['rate_thread_id'], $_POST['sel_vote'])) { $th = (int) $_POST['rate_thread_id']; $rt = (int) $_POST['sel_vote']; /* determine if the user has permission to rate the thread */ if (!q_singleval('SELECT t.id FROM phpgw_fud_thread t LEFT JOIN phpgw_fud_mod m ON t.forum_id=m.forum_id AND m.user_id=' . _uid . ' INNER JOIN phpgw_fud_group_cache g1 ON g1.user_id=' . (_uid ? 2147483647 : 0) . ' AND g1.resource_id=t.forum_id ' . (_uid ? ' LEFT JOIN phpgw_fud_group_cache g2 ON g2.user_id=' . _uid . ' AND g2.resource_id=t.forum_id ' : '') . ' WHERE t.id=' . $th . ($usr->users_opt & 1048576 ? '' : ' AND (m.id IS NOT NULL OR ((CASE WHEN g1.id IS NULL THEN g2.group_cache_opt ELSE g1.group_cache_opt END) & 1024) > 0)') . ' LIMIT 1')) { std_error('access'); } if (db_li('INSERT INTO phpgw_fud_thread_rate_track (thread_id, user_id, stamp, rating) VALUES(' . $th . ', ' . _uid . ', ' . __request_timestamp__ . ', ' . $rt . ')', $ef)) { $rt = db_saq('SELECT count(*), ROUND(AVG(rating)) FROM phpgw_fud_thread_rate_track WHERE thread_id=' . $th); q('UPDATE phpgw_fud_thread SET rating=' . (int) $rt[1] . ', n_rating=' . (int) $rt[0] . ' WHERE id=' . $th); } } check_return($usr->returnto);
$admi = '<td class="SmallText" nowrap><a href="' . $GLOBALS['WWW_ROOT'] . 'adm/admuser.php?usr_id=' . $r->id . '&' . _rsid . '&act=1">Edit</a> || ' . $admi . '</td>'; } else { $admi = ''; } $find_user_data .= '<tr class="' . alt_var('finduser_alt', 'RowStyleA', 'RowStyleB') . '"><td nowrap class="GenText"><a class="GenLink" href="/egroupware/fudforum/3814588639/index.php?t=usrinfo&id=' . $r->id . '&' . _rsid . '">' . $r->alias . '</a></td><td align="center" nowrap>' . $r->posted_msg_count . '</td><td class="DateText" nowrap>' . strftime("%a, %d %B %Y", $r->join_date) . '</td><td nowrap class="GenText"><a href="/egroupware/fudforum/3814588639/index.php?t=showposts&id=' . $r->id . '&' . _rsid . '" class="GenLink"><img alt="" src="/egroupware/fudforum/3814588639/theme/italian/images/show_posts.gif" /></a> ' . $email_link . ' ' . $pm_link . ' ' . $homepage_link . '</td>' . $admi . '</tr>'; } if (!$find_user_data) { $colspan = $adm ? 5 : 4; $find_user_data = '<tr class="RowStyleA"><td colspan="' . $colspan . '" width="100%" class="GenText">Nessun utente trovato</td></tr>'; } $pager = ''; if (!$qry) { $total = q_singleval('SELECT count(*) FROM phpgw_fud_users ' . $qry); if ($total > $count) { $pg = '/egroupware/fudforum/3814588639/index.php?t=finduser&' . _rsid . '&'; if ($usr_login) { $pg .= urlencode($usr_login) . '&'; } if ($usr_email) { $pg .= urlencode($usr_email) . '&'; } if (isset($_GET['pc'])) { $pg .= 'pc=1&'; } if (isset($_GET['us'])) { $pg .= 'us=1&'; } if (isset($_GET['js_redr'])) {
function fetch_search_cache($qry, $start, $count, $logic, $srch_type, $order, $forum_limiter, &$total) { if (strncmp($GLOBALS['usr']->lang, 'chinese', 7)) { $cs = array('!\\W!', '!\\s+!'); $cd = array(' ', ' '); $qry = trim(preg_replace($cs, $cd, $qry)); $w = array_unique(explode(' ', strtolower($qry))); $qr = ''; $i = 0; foreach ($w as $v) { $v = trim($v); if (strlen($v) <= 2) { continue; } else { if ($i++ == 10) { /* limit query length to 10 words */ break; } } $qr .= " '" . addslashes($v) . "',"; } if (!$qr) { return; } else { $qr = substr($qr, 0, -1); } } else { /* handling for multibyte languages */ fud_use('isearch.inc'); if (!($w = mb_word_split($qry))) { return; } $qr = implode(',', $w); $i = count($w); } if ($srch_type == 'all') { $tbl = 'index'; $qt = '0'; } else { $tbl = 'title_index'; $qt = '1'; } $qry_lck = md5($qr); /* remove expired cache */ q('DELETE FROM phpgw_fud_search_cache WHERE expiry<' . (__request_timestamp__ - $GLOBALS['SEARCH_CACHE_EXPIRY'])); if (!($total = q_singleval("SELECT count(*) FROM phpgw_fud_search_cache WHERE query_type=" . $qt . " AND srch_query='" . $qry_lck . "'"))) { if (__dbtype__ == 'mysql') { q("INSERT IGNORE INTO phpgw_fud_search_cache (srch_query, query_type, expiry, msg_id, n_match) SELECT '" . $qry_lck . "', " . $qt . ", " . __request_timestamp__ . ", msg_id, count(*) as word_count FROM phpgw_fud_search s INNER JOIN phpgw_fud_" . $tbl . " i ON i.word_id=s.id WHERE word IN(" . $qr . ") GROUP BY msg_id ORDER BY word_count DESC LIMIT 500"); if (!($total = (int) db_affected())) { return; } } else { q("BEGIN; DELETE FROM phpgw_fud_search_cache; INSERT INTO phpgw_fud_search_cache (srch_query, query_type, expiry, msg_id, n_match) SELECT '" . $qry_lck . "', " . $qt . ", " . __request_timestamp__ . ", msg_id, count(*) as word_count FROM phpgw_fud_search s INNER JOIN phpgw_fud_" . $tbl . " i ON i.word_id=s.id WHERE word IN(" . $qr . ") GROUP BY msg_id ORDER BY word_count DESC LIMIT 500; COMMIT;"); } } if ($forum_limiter) { if ($forum_limiter[0] != 'c') { $qry_lmt = ' AND f.id=' . (int) $forum_limiter . ' '; } else { $qry_lmt = ' AND c.id=' . (int) substr($forum_limiter, 1) . ' '; } } else { $qry_lmt = ''; } $qry_lck = "'" . $qry_lck . "'"; $total = q_singleval('SELECT count(*) FROM phpgw_fud_search_cache sc INNER JOIN phpgw_fud_msg m ON m.id=sc.msg_id INNER JOIN phpgw_fud_thread t ON m.thread_id=t.id INNER JOIN phpgw_fud_forum f ON t.forum_id=f.id INNER JOIN phpgw_fud_cat c ON f.cat_id=c.id INNER JOIN phpgw_fud_group_cache g1 ON g1.user_id=' . (_uid ? '2147483647' : '0') . ' AND g1.resource_id=f.id LEFT JOIN phpgw_fud_mod mm ON mm.forum_id=f.id AND mm.user_id=' . _uid . ' LEFT JOIN phpgw_fud_group_cache g2 ON g2.user_id=' . _uid . ' AND g2.resource_id=f.id WHERE sc.query_type=' . $qt . ' AND sc.srch_query=' . $qry_lck . $qry_lmt . ' ' . ($logic == 'AND' ? ' AND sc.n_match>=' . $i : '') . ' ' . ($GLOBALS['usr']->users_opt & 1048576 ? '' : ' AND (mm.id IS NOT NULL OR ((CASE WHEN g2.id IS NOT NULL THEN g2.group_cache_opt ELSE g1.group_cache_opt END) & 262146) >= 262146)')); if (!$total) { return; } return uq('SELECT u.alias, f.name AS forum_name, f.id AS forum_id, m.poster_id, m.id, m.thread_id, m.subject, m.poster_id, m.foff, m.length, m.post_stamp, m.file_id, m.icon FROM phpgw_fud_search_cache sc INNER JOIN phpgw_fud_msg m ON m.id=sc.msg_id INNER JOIN phpgw_fud_thread t ON m.thread_id=t.id INNER JOIN phpgw_fud_forum f ON t.forum_id=f.id INNER JOIN phpgw_fud_cat c ON f.cat_id=c.id INNER JOIN phpgw_fud_group_cache g1 ON g1.user_id=' . (_uid ? '2147483647' : '0') . ' AND g1.resource_id=f.id LEFT JOIN phpgw_fud_users u ON m.poster_id=u.id LEFT JOIN phpgw_fud_mod mm ON mm.forum_id=f.id AND mm.user_id=' . _uid . ' LEFT JOIN phpgw_fud_group_cache g2 ON g2.user_id=' . _uid . ' AND g2.resource_id=f.id WHERE sc.query_type=' . $qt . ' AND sc.srch_query=' . $qry_lck . $qry_lmt . ' ' . ($logic == 'AND' ? ' AND sc.n_match>=' . $i : '') . ' ' . ($GLOBALS['usr']->users_opt & 1048576 ? '' : ' AND (mm.id IS NOT NULL OR ((CASE WHEN g2.id IS NOT NULL THEN g2.group_cache_opt ELSE g1.group_cache_opt END) & 262146) >= 262146)') . ' ORDER BY sc.n_match DESC, m.post_stamp ' . $order . ' LIMIT ' . qry_limit($count, $start)); }
while ($f = readdir($d)) { if ($f == '.' || $f == '..') { continue; } $path = $dirn . '/' . $f; if (@is_file($path) && !@chmod($path, $filep)) { echo 'ERROR: couldn\'t chmod "' . $path . '"<br>'; } else { if (@is_dir($path) && $rec === true) { chmoddir($path, $dirp, $filep, true); } } } closedir($d); } if (isset($_POST['usr_passwd'], $_POST['usr_login']) && q_singleval("SELECT id FROM " . $DBHOST_TBL_PREFIX . "users WHERE login='******'usr_login']) . "' AND passwd='" . md5($_POST['usr_passwd']) . "' AND (users_opt & 1048576) > 0")) { $FUD_OPT_2 |= 8388608; if (isset($_POST['btn_unlock'])) { $dirperms = 0777; $fileperms = 0666; @unlink($ERROR_PATH . 'FILE_LOCK'); $FUD_OPT_2 ^= 8388608; } else { if (!strncmp(PHP_SAPI, 'apache', 6)) { $dirperms = 0700; $fileperms = 0600; } else { $dirperms = 0711; $fileperms = 0644; } }
} if (!($usr->users_opt & 1048576)) { $fids = implode(',', array_keys(get_all_read_perms(_uid, $usr->users_opt & 524288))); } if (isset($_GET['so']) && !strcasecmp($_GET['so'], 'asc')) { $SORT_ORDER = 'ASC'; $SORT_ORDER_R = 'DESC'; } else { $SORT_ORDER = 'DESC'; $SORT_ORDER_R = 'ASC'; } $post_entry = ''; if ($usr->users_opt & 1048576 || $fids) { $qry_limit = $usr->users_opt & 1048576 ? '' : 'f.id IN (' . $fids . ') AND '; /* we need the total for the pager & we don't trust the user to pass it via GET or POST */ $total = q_singleval("SELECT count(*)\n\t\t\t\t\tFROM phpgw_fud_msg m\n\t\t\t\t\tINNER JOIN phpgw_fud_thread t ON m.thread_id=t.id\n\t\t\t\t\tINNER JOIN phpgw_fud_forum f ON t.forum_id=f.id\n\t\t\t\t\tINNER JOIN phpgw_fud_cat c ON c.id=f.cat_id\n\t\t\t\t\tWHERE " . $qry_limit . " m.apr=1 AND m.poster_id=" . $uid); $c = uq("SELECT f.name, f.id, m.subject, m.id, m.post_stamp\n\t\t\tFROM phpgw_fud_msg m\n\t\t\tINNER JOIN phpgw_fud_thread t ON m.thread_id=t.id\n\t\t\tINNER JOIN phpgw_fud_forum f ON t.forum_id=f.id\n\t\t\tINNER JOIN phpgw_fud_cat c ON c.id=f.cat_id\n\t\t\tWHERE " . $qry_limit . " m.apr=1 AND m.poster_id=" . $uid . "\n\t\t\tORDER BY m.post_stamp " . $SORT_ORDER . " LIMIT " . qry_limit($THREADS_PER_PAGE, $start)); while ($r = db_rowarr($c)) { $post_entry .= '<tr class="' . alt_var('search_alt', 'RowStyleA', 'RowStyleB') . '"><td class="GenText"><a class="GenLink" href="/egroupware/fudforum/3814588639/index.php?t=' . d_thread_view . '&goto=' . $r[3] . '&' . _rsid . '">' . $r[2] . '</a></td><td class="GenText" nowrap><a href="/egroupware/fudforum/3814588639/index.php?t=' . t_thread_view . '&frm_id=' . $r[1] . '&' . _rsid . '" class="GenLink">' . htmlspecialchars($r[0]) . '</a></td><td class="DateText" nowrap>' . strftime("%a, %d %B %Y %H:%M", $r[4]) . '</td></tr>'; } $pager = tmpl_create_pager($start, $THREADS_PER_PAGE, $total, '/egroupware/fudforum/3814588639/index.php?t=showposts&id=' . $uid . '&' . _rsid); } if ($FUD_OPT_2 & 2) { $page_gen_end = gettimeofday(); $page_gen_time = sprintf('%.5f', $page_gen_end['sec'] - $PAGE_TIME['sec'] + ($page_gen_end['usec'] - $PAGE_TIME['usec']) / 1000000); $page_stats = '<br /><div align="left" class="SmallText">Total time taken to generate the page: ' . $page_gen_time . ' seconds</div>'; } else { $page_stats = ''; } echo $GLOBALS['fud_egw_hdr']; ?>
function rebuild_stats_cache($last_msg_id) { $tm_expire = __request_timestamp__ - $GLOBALS['LOGEDIN_TIMEOUT'] * 60; list($obj->last_user_id, $obj->user_count) = db_saq('SELECT MAX(id), count(*)-1 FROM phpgw_fud_users'); $obj->online_users_anon = q_singleval('SELECT count(*) FROM phpgw_fud_ses s WHERE time_sec>' . $tm_expire . ' AND user_id>2000000000'); $obj->online_users_hidden = q_singleval('SELECT count(*) FROM phpgw_fud_ses s INNER JOIN phpgw_fud_users u ON u.id=s.user_id WHERE s.time_sec>' . $tm_expire . ' AND (u.users_opt & 32768) > 0'); $obj->online_users_reg = q_singleval('SELECT count(*) FROM phpgw_fud_ses s INNER JOIN phpgw_fud_users u ON u.id=s.user_id WHERE s.time_sec>' . $tm_expire . ' AND (u.users_opt & 32768)=0'); $c = uq('SELECT u.id, u.alias, u.users_opt, u.custom_color FROM phpgw_fud_ses s INNER JOIN phpgw_fud_users u ON u.id=s.user_id WHERE s.time_sec>' . $tm_expire . ' AND (u.users_opt & 32768)=0 ORDER BY s.time_sec DESC LIMIT ' . $GLOBALS['MAX_LOGGEDIN_USERS']); while ($r = db_rowarr($c)) { $obj->online_users_text[$r[0]] = draw_user_link($r[1], $r[2], $r[3]); } q('UPDATE phpgw_fud_stats_cache SET cache_age=' . __request_timestamp__ . ', last_user_id=' . (int) $obj->last_user_id . ', user_count=' . (int) $obj->user_count . ', online_users_anon=' . (int) $obj->online_users_anon . ', online_users_hidden=' . (int) $obj->online_users_hidden . ', online_users_reg=' . (int) $obj->online_users_reg . ', online_users_text=' . strnull(addslashes(@serialize($obj->online_users_text)))); $obj->last_user_alias = q_singleval('SELECT alias FROM phpgw_fud_users WHERE id=' . $obj->last_user_id); $obj->last_msg_subject = q_singleval('SELECT subject FROM phpgw_fud_msg WHERE id=' . $last_msg_id); return $obj; }
function is_notified($user_id, $thread_id) { return q_singleval('SELECT * FROM phpgw_fud_thread_notify WHERE thread_id=' . $thread_id . ' AND user_id=' . $user_id); }
function mail_check() { $GLOBALS['error'] = 0; if (!strlen(trim($_POST['tx_body']))) { set_err('tx_body', 'The body is required'); } if (!strlen(trim($_POST['tx_subject']))) { set_err('tx_subject', 'Subject is required'); } if (!strlen(trim($_POST['tx_name']))) { set_err('tx_name', 'Name is required'); } else { if (!q_singleval("SELECT id FROM phpgw_fud_users WHERE alias='" . addslashes(htmlspecialchars($_POST['tx_name'])) . "'")) { set_err('tx_name', 'Invalid user'); } } return $GLOBALS['error']; }