function ignore_alias_fetch($al, &$is_mod) { if (!($tmp = db_saq("SELECT id, (users_opt & 1048576) FROM phpgw_fud_users WHERE alias='" . addslashes(htmlspecialchars($al)) . "'"))) { return; } $is_mod = $tmp[1]; return $tmp[0]; }
function all_hooks($args) { if (!function_exists('db_saq')) { fud_use('db.inc'); } $GLOBALS['adm_file'] = array(); list($GLOBALS['fudh_uopt'], $theme_name) = db_saq("SELECT u.users_opt, t.name FROM phpgw_fud_users u INNER JOIN phpgw_fud_themes t ON t.id=u.theme WHERE u.id!=1 AND u.egw_id=" . (int) $GLOBALS['phpgw_info']['user']['account_id']); $GLOBALS['fudh_uopt'] = (int) $GLOBALS['fudh_uopt']; if (!empty($GLOBALS['phpgw_info']['user']['apps']['admin'])) { $GLOBALS['fudh_uopt'] |= 1048576; } include_once $GLOBALS['DATA_DIR'] . 'include/theme/' . str_replace(' ', '_', $theme_name) . '/usercp.inc'; /* regular user links */ //print_r ($GLOBALS); if (!empty($GLOBALS['t']) && $GLOBALS['last_loginid'] != 'anonymous') { display_sidebox('fudforum', lang('Preferences'), $GLOBALS['usr_file']); } /* admin stuff */ if ($GLOBALS['adm_file']) { display_sidebox('fudforum', lang('Administration'), $GLOBALS['adm_file']); } }
} if (strncmp($msg_subject, 'Re: ', 4)) { $old_subject = $msg_subject = 'Re: ' . $msg_subject; } $msg_ref_msg_id = 'R' . $reply; unset($msg_r); } else { if ($forward && strncmp($msg_subject, 'Fwd: ', 5)) { $old_subject = $msg_subject = 'Fwd: ' . $msg_subject; $msg_ref_msg_id = 'F' . $forward; } } } } else { if (isset($_GET['reply']) && ($reply = (int) $_GET['reply'])) { if ($msg_r = db_saq('SELECT p.subject, u.alias FROM phpgw_fud_pmsg p INNER JOIN phpgw_fud_users u ON p.ouser_id=u.id WHERE p.id=' . $reply . ' AND p.duser_id=' . _uid)) { $msg_subject = $msg_r[0]; $msg_to_list = $msg_r[1]; if (strncmp($msg_subject, 'Re: ', 4)) { $old_subject = $msg_subject = 'Re: ' . $msg_subject; } reverse_fmt($msg_subject); unset($msg_r); $msg_ref_msg_id = 'R' . $reply; } } } } /* restore file attachments */ if (!empty($msg_r->attach_cnt) && $PRIVATE_ATTACHMENTS > 0) { $c = uq('SELECT id FROM phpgw_fud_attach WHERE message_id=' . $msg_r->id . ' AND attach_opt=1');
function get_prev_next_th_id(&$frm, &$prev, &$next) { /* determine previous thread */ if ($frm->th_page == 1 && $frm->th_pos == 1) { $prev = ''; } else { if ($frm->th_pos - 1 == 0) { $page = $frm->th_page - 1; $pos = $GLOBALS['THREADS_PER_PAGE']; } else { $page = $frm->th_page; $pos = $frm->th_pos - 1; } $p = db_saq('SELECT m.id, m.subject FROM phpgw_fud_thread_view tv INNER JOIN phpgw_fud_thread t ON tv.thread_id=t.id INNER JOIN phpgw_fud_msg m ON t.root_msg_id=m.id WHERE tv.forum_id=' . $frm->forum_id . ' AND tv.page=' . $page . ' AND tv.pos=' . $pos); $prev = $p ? '<tr><td align=right class="GenText">Previous Topic:</td><td class="GenText" align=left><a href="/egroupware/fudforum/3814588639/index.php?t=' . $_GET['t'] . '&goto=' . $p[0] . '&' . _rsid . '" class="GenLink">' . $p[1] . '</a></td></tr>' : ''; } /* determine next thread */ if ($frm->th_pos + 1 > $GLOBALS['THREADS_PER_PAGE']) { $page = $frm->th_page + 1; $pos = 1; } else { $page = $frm->th_page; $pos = $frm->th_pos + 1; } $n = db_saq('SELECT m.id, m.subject FROM phpgw_fud_thread_view tv INNER JOIN phpgw_fud_thread t ON tv.thread_id=t.id INNER JOIN phpgw_fud_msg m ON t.root_msg_id=m.id WHERE tv.forum_id=' . $frm->forum_id . ' AND tv.page=' . $page . ' AND tv.pos=' . $pos); $next = $n ? '<tr><td class="GenText" align=right>Next Topic:</td><td class="GenText" align=left><a class="GenLink" href="/egroupware/fudforum/3814588639/index.php?t=' . $_GET['t'] . '&goto=' . $n[0] . '&' . _rsid . '">' . $n[1] . '</a></td></tr>' : ''; }
} function alt_var($key) { 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']++]; } if (!isset($_GET['id']) || !($tmp = db_saq('SELECT id, alias, posted_msg_count, join_date FROM phpgw_fud_users WHERE id=' . (int) $_GET['id']))) { invl_inp_err(); } else { $uid = $tmp[0]; $u_alias = $tmp[1]; $u_pcount = $tmp[2]; $u_reg_date = $tmp[3]; } $TITLE_EXTRA = ': Show Posts by: ' . $u_alias; ses_update_status($usr->sid, 'Viewing posts by: <a class="GenLink" href="/egroupware/fudforum/3814588639/index.php?t=usrinfo&id=' . $uid . '">' . $u_alias . '</a>'); if (!isset($_GET['start']) || !($start = (int) $_GET['start'])) { $start = 0; } if (!($usr->users_opt & 1048576)) { $fids = implode(',', array_keys(get_all_read_perms(_uid, $usr->users_opt & 524288))); }
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]); } } }
$c = q('SELECT poll_id FROM phpgw_fud_msg WHERE thread_id IN(' . $tl . ') AND apr=1 AND poll_id>0'); while ($r = db_rowarr($c)) { $p[] = $r[0]; } unset($c); if (count($p)) { q('UPDATE phpgw_fud_poll SET forum_id=' . $forum . ' WHERE id IN(' . implode(',', $p) . ')'); } } q("UPDATE phpgw_fud_msg SET thread_id={$new_th} WHERE thread_id IN({$tl})"); q("DELETE FROM phpgw_fud_thread WHERE id IN({$tl})"); rebuild_forum_view($forum); if ($forum != $frm) { rebuild_forum_view($frm); foreach (array($frm, $forum) as $v) { $r = db_saq("SELECT MAX(last_post_id), SUM(replies), COUNT(*) FROM phpgw_fud_thread INNER JOIN phpgw_fud_msg ON root_msg_id=phpgw_fud_msg.id AND phpgw_fud_msg.apr=1 WHERE forum_id={$v}"); if (empty($r[2])) { $r = array(0, 0, 0); } q("UPDATE phpgw_fud_forum SET thread_count={$r[2]}, post_count={$r[1]}, last_post_id={$r[0]} WHERE id={$v}"); } } else { q("UPDATE phpgw_fud_forum SET thread_count=thread_count-" . (count($_POST['sel_th']) - 1) . " WHERE id={$frm}"); } db_unlock(); logaction(_uid, 'THRMERGE', $new_th, count($_POST['sel_th'])); unset($_POST['sel_th']); } } } /* fetch a list of accesible forums */
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; }
} else { if (isset($_POST['btn_submit']) && $c_ext) { q('INSERT INTO ' . $tbl . 'ext_block (ext) VALUES(\'' . addslashes($c_ext) . '\')'); } else { if (isset($_GET['del'])) { q('DELETE FROM ' . $tbl . 'ext_block WHERE id=' . (int) $_GET['del']); } else { $nada = 1; } } } if (!isset($nada) && db_affected()) { ext_cache_rebuild(); } if (isset($_GET['edit'])) { list($edit, $c_ext) = db_saq('SELECT id, ext FROM ' . $tbl . 'ext_block WHERE id=' . (int) $_GET['edit']); } else { $edit = $c_ext = ''; } include $WWW_ROOT_DISK . 'adm/admpanel.php'; ?> <h2>Allowed Extensions</h2> <form method="post" action="admext.php"> <table class="datatable solidtable"> <tr class="tutor"> <td colspan=2><b>note:</b> if no file extension is entered, all files will be allowed</td> </tr> <tr class="field"> <td>Extension:</td> <td><input type="text" name="c_ext" value="<?php echo htmlspecialchars($c_ext);
* (at your option) any later version. ***************************************************************************/ require './GLOBALS.php'; fud_egw(); fud_use('adm.inc', true); fud_use('widgets.inc', true); if (isset($_POST['lev_submit'])) { q("INSERT INTO " . $DBHOST_TBL_PREFIX . "level (name, img, level_opt, post_count) VALUES ('" . addslashes($_POST['lev_name']) . "', " . strnull(addslashes($_POST['lev_img'])) . ", " . (int) $_POST['lev_level_opt'] . ", " . (int) $_POST['lev_post_count'] . ")"); } else { if (isset($_POST['edit'], $_POST['lev_update'])) { q("UPDATE " . $DBHOST_TBL_PREFIX . "level SET name='" . addslashes($_POST['lev_name']) . "', img=" . strnull(addslashes($_POST['lev_img'])) . ", level_opt=" . (int) $_POST['lev_level_opt'] . ", post_count=" . (int) $_POST['lev_post_count'] . " WHERE id=" . (int) $_POST['edit']); } } if (isset($_GET['edit'])) { $edit = (int) $_GET['edit']; list($lev_name, $lev_img, $lev_level_opt, $lev_post_count) = db_saq('SELECT name, img, level_opt, post_count FROM ' . $DBHOST_TBL_PREFIX . 'level WHERE id=' . (int) $_GET['edit']); } else { $edit = $lev_name = $lev_img = $lev_level_opt = $lev_post_count = ''; } if (isset($_GET['del'])) { q('DELETE FROM ' . $DBHOST_TBL_PREFIX . 'level WHERE id=' . (int) $_GET['del']); } if (isset($_GET['rebuild_levels'])) { $pl = 2000000000; $c = q('SELECT id, post_count FROM ' . $DBHOST_TBL_PREFIX . 'level ORDER BY post_count DESC'); while ($r = db_rowarr($c)) { q('UPDATE ' . $DBHOST_TBL_PREFIX . 'users SET level_id=' . $r[0] . ' WHERE posted_msg_count<' . $pl . ' AND posted_msg_count>=' . $r[1]); $pl = $r[1]; } unset($c); }
/* sanity check */ if (!$data->replies) { header('Location: /egroupware/fudforum/3814588639/index.php?t=' . d_thread_view . '&th=' . $th_id . '&' . _rsidl); exit; } apply_custom_replace($_POST['new_title']); if ($mc != $data->replies + 1) { /* check that we need to move the entire thread */ db_lock('phpgw_fud_thread_view WRITE, phpgw_fud_thread WRITE, phpgw_fud_forum WRITE, phpgw_fud_msg WRITE, phpgw_fud_poll WRITE'); $new_th = th_add($start, $forum, $data->new_th_lps, 0, 0, $mc - 1, $data->new_th_lpi); /* Deal with the new thread */ q('UPDATE phpgw_fud_msg SET thread_id=' . $new_th . ' WHERE id IN (' . $mids . ')'); q('UPDATE phpgw_fud_msg SET reply_to=' . $start . ' WHERE thread_id=' . $new_th . ' AND reply_to NOT IN (' . $mids . ')'); q("UPDATE phpgw_fud_msg SET reply_to=0, subject='" . addslashes(htmlspecialchars($_POST['new_title'])) . "' WHERE id=" . $start); /* Deal with the old thread */ list($lpi, $lpd) = db_saq("SELECT id, post_stamp FROM phpgw_fud_msg WHERE thread_id=" . $data->id . " AND apr=1 ORDER BY post_stamp DESC LIMIT 1"); $old_root_msg_id = q_singleval("SELECT id FROM phpgw_fud_msg WHERE thread_id=" . $data->id . " AND apr=1 ORDER BY post_stamp ASC LIMIT 1"); q("UPDATE phpgw_fud_msg SET reply_to=" . $old_root_msg_id . " WHERE thread_id=" . $data->id . " AND reply_to IN(" . $mids . ")"); q('UPDATE phpgw_fud_msg SET reply_to=0 WHERE id=' . $old_root_msg_id); q('UPDATE phpgw_fud_thread SET root_msg_id=' . $old_root_msg_id . ', replies=replies-' . $mc . ', last_post_date=' . $lpd . ', last_post_id=' . $lpi . ' WHERE id=' . $data->id); if ($forum != $data->forum_id) { $c = q('SELECT poll_id FROM phpgw_fud_msg WHERE thread_id=' . $new_th . ' 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=' . $data->forum_id . ' WHERE id IN(' . implode(',', $p) . ')'); } /* deal with the source forum */ if ($data->src_lpi != $data->last_post_id || $data->last_post_date <= $lpd) {
* 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. ***************************************************************************/ @set_time_limit(6000); require './GLOBALS.php'; fud_egw(); fud_use('adm.inc', true); if (isset($_POST['tname'], $_POST['tlang'], $_POST['ret'])) { header('Location: ' . $_POST['ret'] . '.php?tname=' . $_POST['tname'] . '&tlang=' . $_POST['tlang'] . '&' . _rsidl); exit; } $ret = isset($_GET['ret']) ? $_GET['ret'] : 'tmpllist'; require $WWW_ROOT_DISK . 'adm/admpanel.php'; list($def_thm, $def_tmpl) = db_saq('SELECT name, lang FROM ' . $GLOBALS['DBHOST_TBL_PREFIX'] . 'themes WHERE theme_opt=3'); ?> <h3>Template Set Selection</h3> <form method="post" action="admthemesel.php"> <input type="hidden" name="ret" value="<?php echo $ret; ?> "> <table class="datatable solidtable"> <tr class="field"> <?php echo _hs; $path = $GLOBALS['DATA_DIR'] . '/thm'; $dp = opendir($path); echo '<td>Template Set:</td><td><select name="tname">'; while ($de = readdir($dp)) {
q('UPDATE ' . $tbl . 'thread SET root_msg_id=' . $root . ' WHERE id=' . $r[2]); } } else { $r2 = db_saq('SELECT id, post_stamp FROM ' . $tbl . 'msg WHERE thread_id=' . $r[2] . ' ORDER BY post_stamp DESC LIMIT 1'); if (!$r2) { q('DELETE FROM ' . $tbl . 'thread WHERE id=' . $r[2]); } else { q('UPDATE ' . $tbl . 'thread SET last_post_id=' . $r2[0] . ', last_post_date=' . $r2[1] . ' WHERE id=' . $r[2]); } } } draw_stat('Done: Checking thread last & first post ids'); draw_stat('Checking forum & topic relations'); $c = q('SELECT id FROM ' . $tbl . 'forum'); while ($f = db_rowarr($c)) { $r = db_saq('select SUM(replies), COUNT(*) FROM ' . $tbl . 'thread t INNER JOIN ' . $tbl . 'msg m ON t.root_msg_id=m.id AND m.apr=1 WHERE t.forum_id=' . $f[0]); if (!$r[1]) { q('UPDATE ' . $tbl . 'forum SET thread_count=0, post_count=0, last_post_id=0 WHERE id=' . $f[0]); } else { $lpi = q_singleval('SELECT MAX(last_post_id) FROM ' . $tbl . 'thread WHERE forum_id=' . $f[0] . ' AND moved_to=0'); q('UPDATE ' . $tbl . 'forum SET thread_count=' . $r[1] . ', post_count=' . ($r[0] + $r[1]) . ', last_post_id=' . (int) $lpi . ' WHERE id=' . $f[0]); } } unset($c); draw_stat('Done: Checking forum & topic relations'); draw_stat('Validating Forum Order'); $cat = 0; $c = q('SELECT id, cat_id, view_order FROM ' . $tbl . 'forum WHERE cat_id>0 ORDER BY cat_id, view_order'); while ($f = db_rowarr($c)) { if ($cat != $f[1]) { $i = 0;
fud_use('widgets.inc', true); $tbl = $GLOBALS['DBHOST_TBL_PREFIX']; $smiley_dir = '../images/smiley_icons/'; if (isset($_GET['del'])) { db_lock($tbl . 'smiley WRITE'); if ($im = q_singleval('SELECT img FROM ' . $tbl . 'smiley WHERE id=' . (int) $_GET['del'])) { q('DELETE FROM ' . $tbl . 'smiley WHERE id=' . (int) $_GET['del']); if (db_affected()) { q('UPDATE ' . $tbl . 'smiley SET vieworder=vieworder-1 WHERE id>' . (int) $_GET['del']); } @unlink($GLOBALS['WWW_ROOT_DISK'] . 'images/smiley_icons/' . $im); } db_unlock(); } if (isset($_GET['edit'])) { list($sml_code, $sml_img, $sml_descr) = db_saq('SELECT code, img, descr FROM ' . $tbl . 'smiley WHERE id=' . (int) $_GET['edit']); $edit = (int) $_GET['edit']; } else { $edit = $sml_code = $sml_img = $sml_descr = ''; } if (isset($_FILES['icoul']) && $_FILES['icoul']['size'] && preg_match('!\\.(jpg|jpeg|gif|png)$!i', $_FILES['icoul']['name'])) { move_uploaded_file($_FILES['icoul']['tmp_name'], $GLOBALS['WWW_ROOT_DISK'] . 'images/smiley_icons/' . $_FILES['icoul']['name']); if (empty($_POST['avt_img'])) { $_POST['avt_img'] = $_FILES['icoul']['name']; } $sml_img = $_FILES['icoul']['name']; } if (isset($_POST['btn_update'], $_POST['edit']) && !empty($_POST['sml_img']) && !empty($_POST['sml_code'])) { q('UPDATE ' . $tbl . 'smiley SET code=' . strnull(addslashes($_POST['sml_code'])) . ', img=' . strnull(addslashes($_POST['sml_img'])) . ', descr=' . strnull(addslashes($_POST['sml_descr'])) . ' WHERE id=' . (int) $_POST['edit']); } else { if (isset($_POST['btn_submit']) && !empty($_POST['sml_img']) && !empty($_POST['sml_code'])) {
require './GLOBALS.php'; fud_egw(); fud_use('adm.inc', true); fud_use('widgets.inc', true); $tbl = $GLOBALS['DBHOST_TBL_PREFIX']; if (isset($_GET['del'])) { if ($im = q_singleval('SELECT img FROM ' . $tbl . 'avatar WHERE id=' . (int) $_GET['del'])) { q('DELETE FROM ' . $tbl . 'avatar WHERE id=' . (int) $_GET['del']); if (db_affected()) { q('UPDATE ' . $tbl . 'users SET avatar_loc=NULL, avatar=0, users_opt=(users_opt & ~ (8388608|16777216)) | 4194304 WHERE avatar=' . (int) $_GET['del']); } @unlink($GLOBALS['WWW_ROOT_DISK'] . 'images/avatars/' . $im); } } if (isset($_GET['edit'])) { list($avt_img, $avt_descr) = db_saq('SELECT img, descr FROM ' . $tbl . 'avatar WHERE id=' . (int) $_GET['edit']); $edit = (int) $_GET['edit']; } else { $edit = $avt_img = $avt_descr = ''; } if (isset($_FILES['icoul']) && $_FILES['icoul']['size'] && preg_match('!\\.(jpg|jpeg|gif|png)$!i', $_FILES['icoul']['name'])) { move_uploaded_file($_FILES['icoul']['tmp_name'], $GLOBALS['WWW_ROOT_DISK'] . 'images/avatars/' . $_FILES['icoul']['name']); if (empty($_POST['avt_img'])) { $_POST['avt_img'] = $_FILES['icoul']['name']; } } if (isset($_POST['btn_update'], $_POST['edit']) && !empty($_POST['avt_img'])) { $old_img = q_singleval('SELECT img FROM ' . $tbl . 'avatar WHERE id=' . (int) $_POST['edit']); q('UPDATE ' . $tbl . 'avatar SET img=' . strnull(addslashes($_POST['avt_img'])) . ', descr=' . strnull(addslashes($_POST['avt_descr'])) . ' WHERE id=' . (int) $_POST['edit']); if (db_affected() && $old_img != $_POST['avt_img']) { $size = getimagesize($GLOBALS['WWW_ROOT_DISK'] . 'images/avatars/' . $_POST['avt_img']);
* * 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. ***************************************************************************/ require './GLOBALS.php'; fud_egw(); fud_use('adm.inc', true); fud_use('widgets.inc', true); $tbl = $GLOBALS['DBHOST_TBL_PREFIX']; if (isset($_GET['del'])) { q('DELETE FROM ' . $tbl . 'mime WHERE id=' . (int) $_GET['del']); } if (isset($_GET['edit'])) { list($mime_descr, $mime_mime_hdr, $mime_fl_ext, $mime_icon) = db_saq('SELECT descr, mime_hdr, fl_ext, icon FROM ' . $tbl . 'mime WHERE id=' . (int) $_GET['edit']); $edit = (int) $_GET['edit']; } else { $mime_icon = $edit = $mime_descr = $mime_mime_hdr = $mime_fl_ext = ''; } if (isset($_FILES['icoul']) && $_FILES['icoul']['size'] && preg_match('!\\.(jpg|jpeg|gif|png)$!i', $_FILES['icoul']['name'])) { move_uploaded_file($_FILES['icoul']['tmp_name'], $GLOBALS['WWW_ROOT_DISK'] . 'images/mime/' . $_FILES['icoul']['name']); if (empty($_POST['mime_icon'])) { $_POST['mime_icon'] = $_FILES['icoul']['name']; } } if (isset($_POST['btn_update'], $_POST['edit'])) { q('UPDATE ' . $tbl . 'mime SET descr=' . strnull(addslashes($_POST['mime_descr'])) . ', mime_hdr=' . strnull(addslashes($_POST['mime_mime_hdr'])) . ', fl_ext=' . strnull(addslashes($_POST['mime_fl_ext'])) . ', icon=' . strnull(addslashes($_POST['mime_icon'])) . ' WHERE id=' . (int) $_POST['edit']); } else { if (isset($_POST['btn_submit'])) { q('INSERT INTO ' . $tbl . 'mime (descr, mime_hdr, fl_ext, icon) VALUES (' . strnull(addslashes($_POST['mime_descr'])) . ', ' . strnull(addslashes($_POST['mime_mime_hdr'])) . ', ' . strnull(addslashes($_POST['mime_fl_ext'])) . ', ' . strnull(addslashes($_POST['mime_icon'])) . ')');
INNER JOIN phpgw_fud_thread t ON m.thread_id=t.id INNER JOIN phpgw_fud_group_cache g1 ON g1.user_id=' . (_uid ? 2147483647 : 0) . ' AND g1.resource_id=t.forum_id LEFT JOIN phpgw_fud_mod mod ON mod.forum_id=t.forum_id AND mod.user_id=' . _uid . ' LEFT JOIN phpgw_fud_mime mm ON mm.id=a.mime_type ' . (_uid ? 'LEFT JOIN phpgw_fud_group_cache g2 ON g2.user_id=' . _uid . ' AND g2.resource_id=t.forum_id' : '') . ' WHERE a.id=' . $id); if (!$r) { invl_inp_err(); } if (!($usr->users_opt & 1048576) && !$r[4] && !$r[5]) { std_error('access'); } } else { $r = db_saq('SELECT mm.mime_hdr, a.original_name, a.location, pm.id, a.owner FROM phpgw_fud_attach a INNER JOIN phpgw_fud_pmsg pm ON a.message_id=pm.id AND a.attach_opt=1 LEFT JOIN phpgw_fud_mime mm ON mm.id=a.mime_type WHERE a.attach_opt=1 AND a.id=' . $id); if (!$r) { invl_inp_err(); } if (!($usr->users_opt & 1048576) && $r[4] != _uid) { std_error('access'); } } if ($FUD_OPT_2 & 4194304 && !empty($_SERVER['HTTP_REFERER']) && strpos($_SERVER['HTTP_REFERER'], $WWW_ROOT) === false) { header("HTTP/1.0 404 Not Found"); exit; } reverse_fmt($r[1]); if (!$r[0]) {
$_POST['rpl_from_post'] = $_POST['rpl_to_msg'] = ''; } q('UPDATE ' . $DBHOST_TBL_PREFIX . 'replace SET replace_opt=' . (int) $_POST['rpl_replace_opt'] . ', replace_str=\'' . addslashes($_POST['rpl_replace_str']) . '\', with_str=\'' . addslashes($_POST['rpl_with_str']) . '\', from_post=\'' . addslashes($_POST['rpl_from_post']) . '\', to_msg=\'' . addslashes($_POST['rpl_to_msg']) . '\' WHERE id=' . (int) $_POST['edit']); } } if (isset($_GET['del'])) { q('DELETE FROM ' . $DBHOST_TBL_PREFIX . 'replace WHERE id=' . (int) $_GET['del']); } if (isset($_GET['edit'])) { list($rpl_replace_opt, $rpl_replace_str, $rpl_with_str, $rpl_from_post, $rpl_to_msg) = db_saq('SELECT replace_opt,replace_str,with_str,from_post,to_msg FROM ' . $DBHOST_TBL_PREFIX . 'replace WHERE id=' . (int) $_GET['edit']); $edit = (int) $_GET['edit']; if ($rpl_replace_opt) { $rpl_replace_str = str_replace('\\/', '/', substr($rpl_replace_str, 1, -1)); } else { $p = strrpos($rpl_replace_str, '/'); $rpl_preg_opt = substr($rpl_replace_str, $p + 1); $rpl_replace_str = substr($rpl_replace_str, 1, $p - 1); $p = strrpos($rpl_from_post, '/'); $rpl_from_post_opt = substr($rpl_from_post, $p + 1); $rpl_from_post = substr($rpl_from_post, 1, $p - 1); } } else { $edit = $rpl_replace_str = $rpl_with_str = $rpl_from_post = $rpl_to_msg = $rpl_from_post_opt = $rpl_preg_opt = ''; $rpl_replace_opt = isset($_POST['rpl_replace_opt']) ? (int) $_POST['rpl_replace_opt'] : 1; }
$e_email_block_opt = (int) $_POST['e_email_block_opt']; $e_string = "'" . addslashes(trim($_POST['e_string'])) . "'"; q('INSERT INTO ' . $DBHOST_TBL_PREFIX . 'email_block (email_block_opt, string) VALUES(' . $e_email_block_opt . ', ' . $e_string . ')'); } else { if (isset($_GET['del'])) { q('DELETE FROM ' . $DBHOST_TBL_PREFIX . 'email_block WHERE id=' . (int) $_GET['del']); } else { $nada = 1; } } } if (!isset($nada) && db_affected()) { email_cache_rebuild(); } if (isset($_GET['edit'])) { list($edit, $e_email_block_opt, $e_string) = db_saq('SELECT id, email_block_opt, string FROM ' . $DBHOST_TBL_PREFIX . 'email_block WHERE id=' . (int) $_GET['edit']); } else { $edit = $e_email_block_opt = $e_string = ''; } require $WWW_ROOT_DISK . 'adm/admpanel.php'; ?> <h2>Email Filter</h2> <form method="post" action="admemail.php"> <?php echo _hs; ?> <table class="datatable solidtable"> <tr class="field"> <td>Type:</td> <td><?php draw_select("e_email_block_opt", "Simple\nRegexp", "1\n0", $e_email_block_opt);
* Free Software Foundation; either version 2 of the License, or * (at your option) any later version. ***************************************************************************/ require './GLOBALS.php'; fud_egw(); fud_use('adm.inc', true); fud_use('forum_adm.inc', true); $tbl = $GLOBALS['DBHOST_TBL_PREFIX']; /* restore forum */ if (isset($_POST['frm_id'], $_POST['dst_cat'])) { $pos = (int) q_singleval('SELECT MAX(view_order) FROM ' . $tbl . 'forum WHERE cat_id=' . (int) $_POST['dst_cat']) + 1; q('UPDATE ' . $tbl . 'forum SET cat_id=' . (int) $_POST['dst_cat'] . ', view_order=' . $pos . ' WHERE id=' . (int) $_POST['frm_id']); fud_use('cat.inc', true); rebuild_forum_cat_order(); } else { if (isset($_GET['del']) && ($f = db_saq('SELECT id, thread_count, post_count, name FROM ' . $tbl . 'forum WHERE id=' . (int) $_GET['del']))) { /* user considers deleting a forum, give them final confirmation check */ ?> <html> <body bgcolor="#ffffff"> <div align="center"> <h3>You have selected to delete this forum</h3><br> "<?php echo $f[3]; ?> " which contains <?php echo $f[1]; ?> topics with <?php echo $f[2]; ?>
} else { if (isset($_POST['btn_submit']) && !empty($_POST['login'])) { q('INSERT INTO ' . $tbl . 'blocked_logins (login) VALUES(\'' . addslashes(trim($_POST['login'])) . '\')'); } else { if (isset($_GET['del'])) { q('DELETE FROM ' . $tbl . 'blocked_logins WHERE id=' . (int) $_GET['del']); } else { $nada = 1; } } } if (!isset($nada) && db_affected()) { login_cache_rebuild(); } if (isset($_GET['edit'])) { list($edit, $login) = db_saq('SELECT id, login FROM ' . $tbl . 'blocked_logins WHERE id=' . (int) $_GET['edit']); } else { $edit = $login = ''; } require $WWW_ROOT_DISK . 'adm/admpanel.php'; ?> <h2>Login Blocker</h2> <form method="post" action="admlogin.php"> <?php echo _hs; ?> <table class="datatable solidtable"> <tr class="field"> <td>Regex:</td> <td><input type="text" name="login" value="<?php echo htmlspecialchars($login);
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); }
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);
} if (isset($_POST['thm_theme']) && !$edit) { $thm = new fud_theme(); $thm->add(); compile_all($thm->theme, $thm->lang, $thm->name); } else { if (isset($_POST['edit'])) { $thm = new fud_theme(); if ($edit == 1) { $thm->name = 'default'; } $thm->sync((int) $_POST['edit']); compile_all($thm->theme, $thm->lang, $thm->name); $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;
ses_update_status($usr->sid, 'Guarda il profilo di <a class="GenLink" href="/egroupware/fudforum/3814588639/index.php?t=usrinfo&id=' . $u->id . '">' . $user_info . '</a>'); $status = !empty($level_name) || !empty($moderation) || !empty($level_image) || !empty($custom_tags) ? '<tr class="' . alt_var('search_alt', 'RowStyleA', 'RowStyleB') . '"><td nowrap valign="top" class="GenText">Status:</td><td class="GenText"> <font class="LevelText"> ' . $level_name . ' ' . $level_image . ' ' . $custom_tags . ' </font> ' . $moderation . ' </td></tr>' : ''; $avg = sprintf('%.2f', $u->posted_msg_count / ((__request_timestamp__ - $u->join_date) / 86400)); if ($avg > $u->posted_msg_count) { $avg = $u->posted_msg_count; } $last_post = ''; if ($u->u_last_post_id) { $r = db_saq('SELECT m.subject, m.id, m.post_stamp, t.forum_id FROM phpgw_fud_msg m INNER JOIN phpgw_fud_thread t ON m.thread_id=t.id WHERE m.id=' . $u->u_last_post_id); if ($usr->users_opt & 1048576 || !empty($frm_perms[$r[3]])) { $last_post = '<tr class="' . alt_var('search_alt', 'RowStyleA', 'RowStyleB') . '"><td valign="top" nowrap class="GenText">Ultimo messaggio:</td><td class="GenText"><font class="DateText">' . strftime("%a, %d %B %Y %H:%M", $r[2]) . '</font><br /><a href="/egroupware/fudforum/3814588639/index.php?t=' . d_thread_view . '&goto=' . $r[1] . '&' . _rsid . '" class="GenLink">' . $r[0] . '</a></td></tr>'; } } $user_image = $FUD_OPT_2 & 65536 && $u->user_image && strpos($u->user_image, '://') ? '<tr class="' . alt_var('search_alt', 'RowStyleA', 'RowStyleB') . '"><td nowrap valign="top" class="GenText">Immagine:</td><td class="GenText"><img src="' . $u->user_image . '" /></td></tr>' : ''; if ($u->users_opt & 1) { $email_link = '<tr class="' . alt_var('search_alt', 'RowStyleA', 'RowStyleB') . '"><td nowrap class="GenText">Email:</td><td class="GenText"><a class="GenLink" href="mailto:' . $u->email . '">' . $u->email . '</a></td></tr>'; } else { if ($FUD_OPT_2 & 1073741824) { $encoded_login = urlencode($u->alias); $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 (isset($_GET['chpos'], $_GET['newpos'])) { frm_change_pos((int) $_GET['chpos'], (int) $_GET['newpos'], $cat_id); rebuild_forum_cat_order(); unset($_GET['chpos'], $_GET['newpos']); } else { if (isset($_GET['del'])) { if (frm_move_forum((int) $_GET['del'], 0, $cat_id)) { rebuild_forum_cat_order(); logaction(_uid, 'FRMMARKDEL', q_singleval('SELECT name FROM ' . $tbl . 'forum WHERE id=' . (int) $_GET['del'])); } } else { if (isset($_POST['btn_chcat'], $_POST['frm_id'], $_POST['cat_id'], $_POST['dest_cat'])) { if (frm_move_forum((int) $_POST['frm_id'], (int) $_POST['dest_cat'], $cat_id)) { rebuild_forum_cat_order(); $r = db_saq('SELECT f.name, c1.name, c2.name FROM ' . $tbl . 'forum f INNER JOIN ' . $tbl . 'cat c1 ON c1.id=' . $cat_id . ' INNER JOIN ' . $tbl . 'cat c2 ON c2.id=' . (int) $_POST['dest_cat'] . ' WHERE f.id=' . (int) $_POST['frm_id']); logaction(_uid, 'CHCATFORUM', 'Moved forum "' . addslashes($r[0]) . '" from category: "' . addslashes($r[1]) . '" to category: "' . addslashes($r[2]) . '"'); } } } } if (isset($_GET['o'], $_GET['ot'])) { if (in_array($_GET['ot'], array('name', 'descr', 'date_created'))) { $i = 0; $r = q("SELECT id FROM {$tbl}forum WHERE cat_id={$cat_id} ORDER BY {$_GET['ot']} " . ((int) $_GET['o'] ? 'ASC' : 'DESC')); while ($o = db_rowarr($r)) { q("UPDATE {$tbl}forum SET view_order=" . ++$i . " WHERE id={$o[0]}"); } rebuild_forum_cat_order(); } }