function send_pmsg() { $this->pmsg_opt |= 16 | 32; $this->pmsg_opt &= 16 | 32 | 1 | 2 | 4; foreach ($GLOBALS['recv_user_id'] as $v) { $id = db_qid("INSERT INTO phpgw_fud_pmsg (\n\t\t\t\tto_list,\n\t\t\t\touser_id,\n\t\t\t\tip_addr,\n\t\t\t\thost_name,\n\t\t\t\tpost_stamp,\n\t\t\t\ticon,\n\t\t\t\tfldr,\n\t\t\t\tsubject,\n\t\t\t\tattach_cnt,\n\t\t\t\tfoff,\n\t\t\t\tlength,\n\t\t\t\tduser_id,\n\t\t\t\tref_msg_id,\n\t\t\t\tpmsg_opt\n\t\t\t) VALUES (\n\t\t\t\t" . strnull(addslashes($this->to_list)) . ",\n\t\t\t\t" . $this->ouser_id . ",\n\t\t\t\t'" . $this->ip_addr . "',\n\t\t\t\t" . $this->host_name . ",\n\t\t\t\t" . $this->post_stamp . ",\n\t\t\t\t" . strnull($this->icon) . ",\n\t\t\t\t1,\n\t\t\t\t'" . addslashes($this->subject) . "',\n\t\t\t\t" . intzero($this->attach_cnt) . ",\n\t\t\t\t" . $this->foff . ",\n\t\t\t\t" . $this->length . ",\n\t\t\t\t" . $v . ",\n\t\t\t\t" . strnull($this->ref_msg_id) . ",\n\t\t\t\t" . $this->pmsg_opt . ")"); $GLOBALS['send_to_array'][] = array($v, $id); $um[$v] = $id; } $c = uq('SELECT id, email, users_opt, icq FROM phpgw_fud_users WHERE id IN(' . implode(',', $GLOBALS['recv_user_id']) . ') AND users_opt>=64 AND (users_opt & 64) > 0'); $from = $GLOBALS['usr']->alias; reverse_fmt($from); $subject = $this->subject; reverse_fmt($subject); while ($r = db_rowarr($c)) { /* do not send notifications about messages sent to self */ if ($r[0] == $this->ouser_id) { continue; } if (!($r[2] & 4)) { $r[1] = $r[3] . '@pager.icq.com'; } send_pm_notification($r[1], $um[$r[0]], $subject, $from, $r[2]); } }
function attach_rebuild_cache($id) { $c = uq('SELECT a.id, a.original_name, a.fsize, a.dlcount, CASE WHEN m.icon IS NULL THEN \'unknown.gif\' ELSE m.icon END FROM phpgw_fud_attach a LEFT JOIN phpgw_fud_mime m ON a.mime_type=m.id WHERE message_id=' . $id . ' AND attach_opt=0'); while ($r = db_rowarr($c)) { $ret[] = $r; } return isset($ret) ? $ret : null; }
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 grp_rebuild_cache($user_id = null) { $list = array(); if ($user_id !== null) { $lmt = ' user_id IN(' . implode(',', $user_id) . ') '; } else { $lmt = ''; } /* generate an array of permissions, in the end we end up with 1ist of permissions */ $r = uq("SELECT gm.user_id AS uid, gm.group_members_opt AS gco, gr.resource_id AS rid FROM phpgw_fud_group_members gm INNER JOIN phpgw_fud_group_resources gr ON gr.group_id=gm.group_id WHERE gm.group_members_opt>=65536 AND (gm.group_members_opt & 65536) > 0" . ($lmt ? ' AND ' . $lmt : '')); while ($o = db_rowobj($r)) { foreach ($o as $k => $v) { $o->{$k} = (int) $v; } if (isset($list[$o->rid][$o->uid])) { if ($o->gco & 131072) { $list[$o->rid][$o->uid] |= $o->gco; } else { $list[$o->rid][$o->uid] &= $o->gco; } } else { $list[$o->rid][$o->uid] = $o->gco; } } $tmp_t = "phpgw_fud_gc_" . __request_timestamp__; q("CREATE TEMPORARY TABLE " . $tmp_t . " (a INT, b INT, c INT)"); $tmp = array(); foreach ($list as $k => $v) { foreach ($v as $u => $p) { $tmp[] = $k . ", " . $p . ", " . $u; } } if ($tmp) { if (__dbtype__ == 'mysql') { ins_m($tmp_t, "a,b,c", $tmp, 1); } else { ins_m($tmp_t, "a,b,c", $tmp, "integer, integer, integer"); } } if (!db_locked()) { $ll = 1; db_lock("phpgw_fud_group_cache WRITE"); } q("DELETE FROM phpgw_fud_group_cache" . ($lmt ? ' WHERE ' . $lmt : '')); q("INSERT INTO phpgw_fud_group_cache (resource_id, group_cache_opt, user_id) SELECT a,b,c FROM " . $tmp_t); if (isset($ll)) { db_unlock(); } q("DROP TABLE " . $tmp_t); }
function ignore_rebuild_cache($uid) { $q = uq('SELECT ignore_id FROM phpgw_fud_user_ignore WHERE user_id=' . $uid); while ($ent = db_rowarr($q)) { $arr[$ent[0]] = 1; } if (isset($arr)) { q('UPDATE phpgw_fud_users SET ignore_list=\'' . addslashes(serialize($arr)) . '\' WHERE id=' . $uid); return $arr; } else { q('UPDATE phpgw_fud_users SET ignore_list=NULL WHERE id=' . $uid); return; } }
function &get_all_read_perms($uid, $mod) { $limit = array(0); $r = uq('SELECT resource_id, group_cache_opt FROM phpgw_fud_group_cache WHERE user_id=' . _uid); while ($ent = db_rowarr($r)) { $limit[$ent[0]] = $ent[1] & 2; } if (_uid) { $r = uq("SELECT resource_id FROM phpgw_fud_group_cache WHERE resource_id NOT IN (" . implode(',', array_keys($limit)) . ") AND user_id=2147483647 AND (group_cache_opt & 2) > 0"); while ($ent = db_rowarr($r)) { if (!isset($limit[$ent[0]])) { $limit[$ent[0]] = 1; } } if ($mod) { $r = uq('SELECT forum_id FROM phpgw_fud_mod WHERE user_id=' . _uid); while ($ent = db_rowarr($r)) { $limit[$ent[0]] = 1; } } } return $limit; }
} $c = uq('SELECT f.id, f.name FROM phpgw_fud_forum_notify fn LEFT JOIN phpgw_fud_forum f ON fn.forum_id=f.id WHERE fn.user_id=' . _uid . ' ' . $lmt . ' ORDER BY f.last_post_id DESC'); $subscribed_forum_data = ''; while ($r = db_rowarr($c)) { $subscribed_forum_data .= '<tr class="' . alt_var('search_alt', 'RowStyleA', 'RowStyleB') . '"><td width="100%"><a class="GenLink" href="/egroupware/fudforum/3814588639/index.php?t=' . t_thread_view . '&frm_id=' . $r[0] . '&' . _rsid . '">' . htmlspecialchars($r[1]) . '</a></td><td nowrap><a class="GenLink" href="/egroupware/fudforum/3814588639/index.php?t=subscribed&frm_id=' . $r[0] . '&' . _rsid . '">Unsubscribe</a> | <a class="GenLink" href="/egroupware/fudforum/3814588639/index.php?t=' . t_thread_view . '&frm_id=' . $r[0] . '&' . _rsid . '" target="_blank">View Forum</a></td></tr>'; } if (!$subscribed_forum_data) { $subscribed_forum_data = '<tr class="' . alt_var('search_alt', 'RowStyleA', 'RowStyleB') . '"><td colspan=2>No subscribed forums</td></tr>'; } /* Since a person can have MANY subscribed threads, we need a pager & for the pager we need a entry count */ $total = q_singleval('SELECT count(*) FROM phpgw_fud_thread_notify tn LEFT JOIN phpgw_fud_thread t ON tn.thread_id=t.id INNER JOIN phpgw_fud_msg m ON t.root_msg_id=m.id WHERE tn.user_id=' . _uid . ' ' . $lmt); if (!isset($_GET['start']) || !($start = (int) $_GET['start'])) { $start = 0; } $subscribed_thread_data = ''; $c = uq('SELECT t.id, m.subject FROM phpgw_fud_thread_notify tn INNER JOIN phpgw_fud_thread t ON tn.thread_id=t.id INNER JOIN phpgw_fud_msg m ON t.root_msg_id=m.id WHERE tn.user_id=' . _uid . ' ' . $lmt . ' ORDER BY t.last_post_id DESC LIMIT ' . qry_limit($THREADS_PER_PAGE, $start)); while ($r = db_rowarr($c)) { $subscribed_thread_data .= '<tr class="' . alt_var('search_alt', 'RowStyleA', 'RowStyleB') . '"><td width="100%"><a class="GenLink" href="/egroupware/fudforum/3814588639/index.php?t=' . d_thread_view . '&th=' . $r[0] . '&' . _rsid . '">' . $r[1] . '</a></td><td nowrap><a class="GenLink" href="/egroupware/fudforum/3814588639/index.php?t=subscribed&th=' . $r[0] . '&' . _rsid . '">Unsubscribe</a> | <a class="GenLink" href="/egroupware/fudforum/3814588639/index.php?t=' . d_thread_view . '&th=' . $r[0] . '&' . _rsid . '" target="_blank">View Topic</a></td></tr>'; } if (!$subscribed_thread_data) { $subscribed_thread_data = '<tr class="' . alt_var('search_alt', 'RowStyleA', 'RowStyleB') . '"><td colspan=2>No subscribed topics</td></tr>'; } $pager = tmpl_create_pager($start, $THREADS_PER_PAGE, $total, '/egroupware/fudforum/3814588639/index.php?t=subscribed&a=1&' . _rsid, '#fff'); 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 make_reverse_replace_array() { $c = uq('SELECT replace_opt, with_str, replace_str, from_post, to_msg FROM phpgw_fud_replace'); while ($r = db_rowarr($c)) { if (!$r[0]) { $GLOBALS['__FUD_REPLR__']['pattern'][] = $r[3]; $GLOBALS['__FUD_REPLR__']['replace'][] = $r[4]; } else { if ($r[0] && strlen($r[1]) && strlen($r[2])) { $GLOBALS['__FUD_REPLR__']['pattern'][] = '/' . str_replace('/', '\\/', preg_quote(stripslashes($r[1]))) . '/'; preg_match('/\\/(.+)\\/(.*)/', $r[2], $regs); $GLOBALS['__FUD_REPLR__']['replace'][] = str_replace('\\/', '/', $regs[1]); } } } define('__fud_replacer_init', 1); }
* copyright : (C) 2001-2003 Advanced Internet Designs Inc. * email : forum@prohost.org * $Id: smladd.php.t,v 1.2 2003/12/18 18:20:49 iliaa Exp $ * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2 of the License, or * (at your option) any later version. ***************************************************************************/ if (_uid === '_uid') { exit('sorry, you can not access this page'); } $col_count = '7' - 2; $col_pos = -1; $sml_smiley_entry = $sml_smiley_row = ''; $c = uq('SELECT code,img,descr FROM phpgw_fud_smiley ORDER BY vieworder'); while ($r = db_rowarr($c)) { if ($col_pos++ > $col_count) { $sml_smiley_row .= '<tr valign="bottom"><td>' . $sml_smiley_entry . '</td></tr>'; $sml_smiley_entry = ''; $col_pos = 0; } $r[0] = ($a = strpos($r[0], '~')) ? substr($r[0], 0, $a) : $r[0]; $sml_smiley_entry .= '<a href="javascript: insertParentTag(\' ' . $r[0] . ' \',\'\');"><img src="images/smiley_icons/' . $r[1] . '" title="' . $r[2] . '" alt="' . $r[2] . '" /></a> '; } if ($col_pos > -1) { $sml_smiley_row .= '<tr valign="bottom"><td>' . $sml_smiley_entry . '</td></tr>'; } else { if ($col_pos == -1) { $sml_smiley_row = 'No emoticons available.'; }
} if (!($FUD_OPT_1 & (8388608 | 4194304)) || !_uid) { std_error('disabled'); } $usr_login = isset($_GET['usr_login']) ? trim($_GET['usr_login']) : ''; $usr_email = isset($_GET['usr_email']) ? trim($_GET['usr_email']) : ''; $overwrite = isset($_GET['overwrite']) ? (int) $_GET['overwrite'] : 0; $js_redr = $_GET['js_redr']; if ($usr_login || $usr_email) { if ($usr_login) { $qry = "WHERE alias LIKE '" . addslashes(str_replace('\\', '\\\\', $usr_login)) . "%'"; } else { $qry = "WHERE email LIKE '" . addslashes(str_replace('\\', '\\\\', $usr_email)) . "%'"; } $find_user_data = ''; $c = uq('SELECT alias FROM phpgw_fud_users ' . $qry . ' AND id>1'); $i = 0; while ($r = db_rowarr($c)) { if ($overwrite) { $retlink = 'javascript: window.opener.document.' . $js_redr . '.value=\'' . addcslashes($r[0], "'\\") . '\'; window.close();'; } else { $retlink = 'javascript: if (!window.opener.document.' . $js_redr . '.value) { window.opener.document.' . $js_redr . '.value = \'' . addcslashes($r[0], "'\\") . '\'; } else { window.opener.document.' . $js_redr . '.value = window.opener.document.' . $js_redr . '.value + \'; \' + \'' . addcslashes($r[0], "'\\") . '; \'; } window.close();'; } $find_user_data .= '<tr class="' . alt_var('pmuserloc_alt', 'RowStyleA', 'RowStyleB') . '"><td><a href="' . $retlink . '">' . $r[0] . '</a></td></tr>'; $i++;
?> </td> </tr> </table> <input type="hidden" name="edit" value="<?php echo $edit; ?> "> </form> <table class="resulttable fulltable"> <tr bgcolor="#e5ffe7"> <td>Address/Regex</td> <td>Type</td> <td>Action</td> </tr> <?php $c = uq('SELECT id, email_block_opt, string FROM ' . $DBHOST_TBL_PREFIX . 'email_block'); $i = 1; while ($r = db_rowarr($c)) { if ($edit == $r[0]) { $bgcolor = ' class="resultrow1"'; } else { $bgcolor = $i++ % 2 ? ' class="resultrow2"' : ' class="resultrow1"'; } echo '<tr ' . $bgcolor . '><td>' . htmlspecialchars($r[2]) . '</td><td>' . ($r[1] ? 'Simple' : 'Regex') . '</td><td>[<a href="admemail.php?edit=' . $r[0] . '&' . _rsid . '">Edit</a>] [<a href="admemail.php?del=' . $r[0] . '&' . _rsid . '">Delete</a>]</td></tr>'; } ?> </table> <?php require $WWW_ROOT_DISK . 'adm/admclose.php';
echo '<tr><td>' . $r[0] . '</td></tr>'; } echo '</table>'; } else { echo 'None<br>'; } unset($c); ?> <a name="mod_here"> </a> <a href="#mod_here" onClick="javascript: window.open('admmodfrm.php?usr_id=<?php echo $usr_id . '&' . _rsidl; ?> ', 'frm_mod', 'menubar=false,width=200,height=400,screenX=100,screenY=100,scrollbars=yes');">Modify Moderation Permissions</a> <tr class="field"><td valign=top>Custom Tags:</td><td valign="top"> <?php $c = uq('SELECT name, id FROM ' . $DBHOST_TBL_PREFIX . 'custom_tags WHERE user_id=' . $usr_id); while ($r = db_rowarr($c)) { echo $r[0] . ' [<a href="admuser.php?act=nada&usr_id=' . $usr_id . '&deltag=' . $r[1] . '&' . _rsidl . '">Delete</a>]<br>'; } ?> <form name="extra_tags" action="admuser.php" method="post"> <?php echo _hs; ?> <input type="text" name="c_tag"> <input type="submit" value="Add"> <input type="hidden" name="usr_id" value="<?php echo $usr_id; ?> "> <input type="hidden" name="act" value="nada">
?> <html> <head> <link rel="StyleSheet" href="adm.css" type="text/css"> <body class="popup"> <h3>Allowing <?php echo $login; ?> to moderate:</h3> <form name="frm_mod" action="admmodfrm.php" method="post"> <?php echo _hs; ?> <table class="datatable fulltable"> <?php $c = uq('SELECT CASE WHEN c.name IS NULL THEN \'DELETED FORUMS\' ELSE c.name END, f.name, f.id, mm.id FROM ' . $tbl . 'forum f LEFT JOIN ' . $tbl . 'cat c ON c.id=f.cat_id LEFT JOIN ' . $tbl . 'mod mm ON mm.forum_id=f.id AND mm.user_id=' . $usr_id . ' ORDER BY c.view_order, f.view_order'); $pc = ''; while ($r = db_rowarr($c)) { if ($pc != $r[0]) { echo '<tr class="fieldtopic"><td colspan=2>' . $r[0] . '</td></tr>'; $pc = $r[0]; } echo '<tr class="field"><td><input type="checkbox" name="mod_allow[]" value="' . $r[2] . '"' . ($r[3] ? ' checked' : '') . '>' . $r[1] . '</td></tr>'; } ?> <tr class="fieldaction"> <td colspan=2 align=right><input type="submit" name="mod_submit" value="Apply"></td> </tr> </table> <input type="hidden" name="usr_id" value="<?php echo $usr_id;
function create_theme_select($name, $def = null) { $theme_select_values = ''; $r = uq("SELECT id, name FROM phpgw_fud_themes WHERE theme_opt>=1 AND (theme_opt & 1) > 0 ORDER BY ((theme_opt & 2) > 0) DESC"); while ($t = db_rowarr($r)) { $selected = $t[0] == $def ? ' selected' : ''; $theme_select_values .= '<option value="' . $t[0] . '"' . $selected . '>' . $t[1] . '</option>'; } return '<select name="' . $name . '"> ' . $theme_select_values . ' </select>'; }
<td valign="top"><b>Group Name</b></td> <?php $src = array('!\\s!', '!([A-Za-z]{1})!\\e'); $dst = array('', '\\1<br />'); foreach ($hdr as $k => $v) { echo '<td align="center" valign="top" title="' . $v[1] . '"><b>'; echo preg_replace('!([^0]{1})!e', "strtoupper('\\1').'<br />'", $v[1]); echo '</b></td>'; } ?> <td valign="top"><b>Leaders</b></td> <td valign="top" align="center"><b>Actions</b></td> </tr> <?php /* fetch all group leaders */ $c = uq('SELECT gm.group_id, u.alias FROM ' . $DBHOST_TBL_PREFIX . 'group_members gm INNER JOIN ' . $DBHOST_TBL_PREFIX . 'users u ON gm.user_id=u.id WHERE gm.group_members_opt>=131072 AND (gm.group_members_opt & 131072) > 0'); while ($r = db_rowarr($c)) { $gll[$r[0]][] = $r[1]; } foreach ($gl as $k => $v) { if (isset($gll[$k])) { $grl = '<font size="-1">(total: ' . count($gll[$k]) . ')</font><br><select name="gr_leaders"><option>' . implode('</option><option>', $gll[$k]) . '</option></select>'; } else { $grl = 'No Leaders'; } $del_link = !$v['forum_id'] ? '[<a href="admgroups.php?del=' . $k . '&' . _rsidl . '">Delete</a>]' : ''; $user_grp_mgr = $k > 2 ? ' ' . $del_link . '<br>[<a href="admgrouplead.php?group_id=' . $k . '&' . _rsidl . '">Manage Leaders</a>] [<a href="../' . __fud_index_name__ . '?t=groupmgr&group_id=' . $k . '&' . _rsidl . '" target=_new>Manage Users</a>]' : ''; echo '<tr class="tiny field"><td><a name="g' . $k . '">' . $v['gn'] . '</a></td>'; foreach ($hdr as $v2) { echo '<td nowrap align="center" title="' . $v2[1] . '">'; if ($v['inherit_id'] && $v['groups_opti'] & $v2[0]) {
</tr> <input type="hidden" name="edit" value="<?php echo $edit; ?> "> </form> </table> <p> <table class="resulttable fulltable"> <tr class="resulttopic"> <td>Icon</td> <td>MIME Header</td> <td>Description</td> <td>Extension</td> <td align="center">Action</td> </tr> <?php $c = uq('SELECT id, icon, mime_hdr, fl_ext, descr FROM ' . $tbl . 'mime'); $i = 1; while ($r = db_rowarr($c)) { if ($edit == $r[0]) { $bgcolor = ' class="resultrow1"'; } else { $bgcolor = $i++ % 2 ? ' class="resultrow2""' : ' class="resultrow1"'; } echo '<tr' . $bgcolor . ' valign="top"><td><img src="' . $GLOBALS['WWW_ROOT'] . 'images/mime/' . $r[1] . '" border=0></td><td>' . $r[2] . '</td><td>' . $r[4] . '</td><td>' . $r[3] . '</td><td nowrap>[<a href="admmime.php?edit=' . $r[0] . '&' . _rsidl . '#img">Edit</a>] [<a href="admmime.php?del=' . $r[0] . '&' . _rsidl . '">Delete</a>]</td></tr>'; } ?> </table> <?php require $WWW_ROOT_DISK . 'adm/admclose.php';
</form> <table class="resulttable fulltable"> <tr class="resulttopic"> <td>Name</td> <td>Theme</td> <td>Language</td> <td>Locale</td> <td>pSpell Lang</td> <td>Enabled</td> <td>Default</td> <td>Action</td> </tr> <?php $i = 1; $c = uq('SELECT * FROM ' . $DBHOST_TBL_PREFIX . 'themes ORDER BY id'); while ($r = db_rowobj($c)) { if ($edit == $r->id) { $bgcolor = ' class="resultrow1"'; } else { $bgcolor = $i++ % 2 ? ' class="resultrow2"' : ' class="resultrow1"'; } echo '<tr ' . $bgcolor . '> <td>' . htmlspecialchars($r->name) . '</td> <td>' . htmlspecialchars($r->theme) . '</td> <td>' . htmlspecialchars($r->lang) . '</td> <td>' . htmlspecialchars($r->locale) . '</td> <td>' . (!$r->pspell_lang ? '<font color="green">disabled</font> ' : htmlspecialchars($r->pspell_lang)) . '</td> <td>' . ($r->theme_opt & 1 ? 'Yes' : '<font color="green">No</font>') . '</td> <td>' . ($r->theme_opt & 2 ? 'Yes' : '<font color="green">No</font>') . '</td> <td nowrap>[<a href="admthemes.php?' . _rsidl . '&edit=' . $r->id . '">Edit</a>] [<a href="admthemes.php?' . _rsidl . '&rebuild=' . $r->id . '">Rebuild Theme</a>]
function get_fud_table_list() { $r = uq("SHOW TABLES LIKE '" . str_replace("_", "\\_", $GLOBALS['DBHOST_TBL_PREFIX']) . "%'"); while (list($ret[]) = db_rowarr($r)) { } array_pop($ret); return $ret; }
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 INNER JOIN phpgw_fud_group_cache g1 ON g1.user_id=' . (_uid ? '2147483647' : '0') . ' AND g1.resource_id=p.forum_id INNER JOIN phpgw_fud_forum f ON p.forum_id=f.id INNER JOIN phpgw_fud_cat c ON c.id=f.cat_id INNER JOIN phpgw_fud_msg m ON m.poll_id=p.id INNER JOIN phpgw_fud_thread t ON m.thread_id=t.id LEFT JOIN phpgw_fud_group_cache g2 ON g2.user_id=' . _uid . ' AND g2.resource_id=p.forum_id LEFT JOIN phpgw_fud_mod mm ON mm.forum_id=p.forum_id AND mm.user_id=' . _uid . ' LEFT JOIN phpgw_fud_users u ON u.id=m.poster_id LEFT JOIN phpgw_fud_poll_opt_track pot ON pot.poll_id=p.id AND pot.user_id=' . _uid . ' 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)') . ' ORDER BY p.creation_date ' . $oby . ' LIMIT ' . qry_limit($POLLS_PER_PAGE, $start)); while ($obj = db_rowobj($c)) { if (!$obj->total_votes) { $obj->total_votes = '0'; } $vote_lnk = ''; if (!$obj->cant_vote && (!$obj->poll_expiry_date || $obj->poll_expiry_date < __request_timestamp__)) {
<input type="hidden" name="edit" value="<?php echo $edit; ?> "> </form> <table class="resulttable fulltable"> <tr class="resulttopic"> <td>Subject</td> <td>Body</td> <td>Starting Date</td> <td>Ending Date</td> <td>Action</td> </tr> <?php $c = uq('SELECT * FROM ' . $tbl . 'announce ORDER BY date_started'); $i = 1; while ($r = db_rowobj($c)) { if ($edit == $r->id) { $bgcolor = ' class="resultrow1"'; } else { $bgcolor = $i++ % 2 ? ' class="resultrow2"' : ' class="resultrow1"'; } $b = htmlspecialchars(strlen($r->text) > 25 ? substr($r->text, 0, 25) . '...' : $r->text); $st_dt = raw_date($r->date_started); $st_dt = gmdate('F j, Y', gmmktime(1, 1, 1, $st_dt[1], $st_dt[2], $st_dt[0])); $en_dt = raw_date($r->date_ended); $en_dt = gmdate('F j, Y', gmmktime(1, 1, 1, $en_dt[1], $en_dt[2], $en_dt[0])); echo '<tr' . $bgcolor . '><td>' . $r->subject . '</td><td>' . $b . '</td><td>' . $st_dt . '</td><td>' . $en_dt . '</td><td>[<a href="admannounce.php?edit=' . $r->id . '&' . _rsidl . '">Edit</a>] [<a href="admannounce.php?del=' . $r->id . '&' . _rsidl . '">Delete</a>]</td></tr>'; } ?>
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]); } } }
require './GLOBALS.php'; fud_egw(); fud_use('adm.inc', true); fud_use('users_adm.inc', true); fud_use('ssu.inc'); if (isset($_GET['usr_id'])) { usr_adm_avatar((int) $_GET['usr_id'], 0); } else { if (isset($_GET['del'])) { usr_adm_avatar((int) $_GET['del'], 1); } } require $WWW_ROOT_DISK . 'adm/admpanel.php'; ?> <h2>Avatar Approval System</h2> <table class="datatable solidtable"> <?php $a = 0; $c = uq('SELECT id, avatar_loc, alias FROM ' . $GLOBALS['DBHOST_TBL_PREFIX'] . 'users WHERE users_opt>=16777216 AND (users_opt & 16777216) > 0 ORDER BY id'); while ($r = db_rowarr($c)) { $a = 1; echo '<tr class="field"><td>' . $r[2] . '</td><td>[<a href="admapprove_avatar.php?usr_id=' . $r[0] . '&' . _rsidl . '">Approve</a>] [<a href="admapprove_avatar.php?del=' . $r[0] . '&' . _rsidl . '">Delete</a>]</td></tr>'; echo '<tr class="field"><td align="center" colspan=2>' . $r[1] . '</td></tr>'; } ?> </table> <?php if (!$a) { echo 'There are no avatars pending approval.'; } require $WWW_ROOT_DISK . 'adm/admclose.php';
$groups = array(); $c = uq('select count(*), g.id, g.name from ' . $DBHOST_TBL_PREFIX . 'group_members gm INNER JOIN ' . $DBHOST_TBL_PREFIX . 'groups g ON g.id=gm.group_id WHERE gm.user_id NOT IN(0,2147483647) GROUP BY g.id, g.name'); while (list($cnt, $gid, $gname) = db_rowarr($c)) { $groups[$gid] = array($gname, $cnt); } $err = 0; if (!empty($_POST['subject']) && !empty($_POST['body'])) { if (!$_POST['group']) { $c = uq('SELECT email FROM ' . $DBHOST_TBL_PREFIX . 'users ' . (isset($POST['ignore_override']) ? '' : 'WHERE (users_opt & 8)=0')); } else { if (!isset($groups[$_POST['group']])) { echo '<font color="+1" color="red">Invalid group id</font><br />'; $err = 1; $c = uq('SELECT id FROM ' . $DBHOST_TBL_PREFIX . 'users WHERE id=-1'); } else { $c = uq('SELECT email FROM ' . $DBHOST_TBL_PREFIX . 'group_members gm INNER JOIN ' . $DBHOST_TBL_PREFIX . 'users u ON u.id=gm.user_id WHERE gm.group_id=' . $_POST['group'] . (isset($POST['ignore_override']) ? '' : ' AND (users_opt & 8)=0')); } } $email_block = 50; $total = $email_block_stat = 0; $send_to = $ADMIN_EMAIL; $to = array(); if (!($FUD_OPT_1 & 512)) { if (version_compare("4.3.3RC2", PHP_VERSION, ">")) { $_POST['body'] = str_replace("\n.", "\n..", $_POST['body']); } while ($r = db_rowarr($c)) { $to[] = $r[0]; if (!(++$email_block_stat % $email_block)) { $email_block_stat = 0; $send_to = array_pop($to);
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)); }
</table> <input type="hidden" name="edit" value="<?php echo $edit; ?> "> </form> <br> <table class="resulttable fulltable"> <tr class="resulttopic"> <td nowrap>Mailing List Rule</td> <td>Forum</td> <td>Exec Line</td> <td align="center">Action</td> </tr> <?php $c = uq('SELECT ml.id, ml.name, f.name FROM ' . $tbl . 'mlist ml INNER JOIN ' . $tbl . 'forum f ON f.id=ml.forum_id'); $i = 1; while ($r = db_rowarr($c)) { if ($edit == $r[0]) { $bgcolor = ' class="resultrow1"'; } else { $bgcolor = $i++ % 2 ? ' class="resultrow2"' : ' class="resultrow1"'; } echo '<tr' . $bgcolor . '><td>' . htmlspecialchars($r[1]) . '</td><td>' . $r[2] . '</td> <td nowrap><font size="-1">' . $GLOBALS['DATA_DIR'] . 'scripts/maillist.php ' . $r[0] . '</font></td> <td>[<a href="admmlist.php?edit=' . $r[0] . '&' . _rsidl . '">Edit</a>] [<a href="admmlist.php?del=' . $r[0] . '&' . _rsidl . '">Delete</a>]</td></tr>'; } ?> </table> <p> <b>***Notes***</b><br>
if ($edit) { echo '<input type="submit" name="btn_cancel" value="Cancel"> <input type="submit" name="btn_update" value="Update">'; } else { echo '<input type="submit" name="btn_submit" value="Add">'; } ?> </td> </tr> </table> <input type="hidden" name="edit" value="<?php echo $edit; ?> "> </form> <table class="resulttable fulltable"> <tr class="resulttopic"> <td>Regex</td> <td>Action</td> </tr> <?php $c = uq('SELECT login,id FROM ' . $tbl . 'blocked_logins'); $i = 1; while ($r = db_rowarr($c)) { if ($edit == $r[0]) { $bgcolor = ' class="resultrow1"'; } else { $bgcolor = $i++ % 2 ? ' class="resultrow2"' : ' class="resultrow1"'; } echo '<tr ' . $bgcolor . '><td>' . htmlspecialchars($r[0]) . '</td><td>[<a href="admlogin.php?edit=' . $r[1] . '&' . _rsid . '">Edit</a>] [<a href="admlogin.php?del=' . $r[1] . '&' . _rsid . '">Delete</a>]</td></tr>'; } require $WWW_ROOT_DISK . 'adm/admclose.php';
if (!isset($GLOBALS['_ALTERNATOR_'][$key])) { $args = func_get_args(); array_shift($args); $GLOBALS['_ALTERNATOR_'][$key] = array('p' => 1, 't' => count($args), 'v' => $args); return $args[0]; } $k =& $GLOBALS['_ALTERNATOR_'][$key]; if ($k['p'] == $k['t']) { $k['p'] = 0; } return $k['v'][$k['p']++]; } $TITLE_EXTRA = ': Avatar Selection Form'; /* here we draw the avatar control */ $icons_per_row = 5; $c = uq('SELECT id, descr, img FROM phpgw_fud_avatar ORDER BY id'); $avatars_data = ''; $col = 0; while ($r = db_rowarr($c)) { if (!($col++ % $icons_per_row)) { $avatars_data .= '</tr><tr>'; } $avatars_data .= '<td class="' . alt_var('avatarsel_cl', 'Av1', 'Av2') . '"> <a class="GenLink" href="javascript: window.opener.document.fud_register.reg_avatar.value=\'' . $r[0] . '\'; window.opener.document.reg_avatar_img.src=\'images/avatars/' . $r[2] . '\'; window.close();"><img src="images/avatars/' . $r[2] . '" alt="" /><br /><font class="SmallText">' . $r[1] . '</font></a></td>'; } if (!$avatars_data) { $avatars_data = '<td class="NoAvatar">No Avatars available</td>'; } ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html>
} window.close(); //--></script></body></html>'; exit; } $buddies = ''; if ($all) { $all_v = ''; $all_d = 'none'; } else { $all_v = '1'; $all_d = 'all'; } $c = uq('SELECT u.alias FROM phpgw_fud_buddy b INNER JOIN phpgw_fud_users u ON b.bud_id=u.id WHERE b.user_id=' . _uid . ' AND b.user_id>1'); while ($r = db_rowarr($c)) { $checked = $all ? ' checked' : ''; $buddies .= '<tr class="' . alt_var('search_alt', 'RowStyleA', 'RowStyleB') . '"><td class="GenText">' . $r[0] . '</td><td align="center"><input type="checkbox" name="names[]" value="' . $r[0] . '"' . $checked . '></td></tr>'; } $qbud_data = $buddies ? '<tr><th width="100%">Nick Name</th><th nowrap>Selected [<a class="thLnk" href="/egroupware/fudforum/3814588639/index.php?t=qbud&' . _rsid . '&all=' . $all_v . '">' . $all_d . '</a>]</th></tr> ' . $buddies . ' <tr class="' . alt_var('search_alt', 'RowStyleA', 'RowStyleB') . '"><td colspan=2 class="GenText" align="right"><input type="submit" class="button" name="submit" value="Add Selected"></td></tr>' : '<tr class="RowStyleA"><td class="GenText" align="center">No buddies to choose from</td></tr>'; ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-15"> <title><?php echo $GLOBALS['FORUM_TITLE'] . $TITLE_EXTRA; ?>
function poll_cache_rebuild($poll_id, &$data) { if (!$poll_id) { $data = null; return; } if (!$data) { /* rebuild from cratch */ $c = uq('SELECT id, name, count FROM phpgw_fud_poll_opt WHERE poll_id=' . $poll_id); while ($r = db_rowarr($c)) { $data[$r[0]] = array($r[1], $r[2]); } if (!$data) { $data = null; } } else { /* register single vote */ $data[$poll_id][1] += 1; } }
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; }