function send_email($from, $to, $subj, $body, $header = '') { if (empty($to) || !count($to)) { return; } $body = str_replace('\\n', "\n", $body); if ($GLOBALS['FUD_OPT_1'] & 512) { if (!class_exists('fud_smtp')) { fud_use('smtp.inc'); } $smtp = new fud_smtp(); $smtp->msg = str_replace("\n.", "\n..", $body); $smtp->subject = $subj; $smtp->to = $to; $smtp->from = $from; $smtp->headers = $header; $smtp->send_smtp_email(); } else { $bcc = ''; if (is_array($to)) { $to = $to[0]; if (count($to) > 1) { unset($to[0]); $bcc = 'Bcc: ' . implode(', ', $to); } } if ($header) { $header = "\n" . str_replace("\r", "", $header); } else { if ($bcc) { $bcc = "\n" . $bcc; } } if (version_compare("4.3.3RC2", phpversion(), ">")) { $body = str_replace("\n.", "\n..", $body); } mail($to, $subj, str_replace("\r", "", $body), "From: " . $from . "\nErrors-To: " . $from . "\nReturn-Path: " . $from . "\nX-Mailer: FUDforum v" . $GLOBALS['FORUM_VERSION'] . $header . $bcc); } }
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']); } }
} } for ($i = 1; $i < 10; $i++) { if (!isset($GLOBALS['FUD_OPT_' . $i])) { break; } if ($GLOBALS['FUD_OPT_' . $i] != $GLOBALS['NEW_FUD_OPT_' . $i]) { $ch_list['FUD_OPT_' . $i] = $GLOBALS['NEW_FUD_OPT_' . $i]; } } if (isset($ch_list)) { change_global_settings($ch_list); /* some fields require us to make special changes */ if (isset($ch_list['SHOW_N_MODS'])) { $GLOBALS['SHOW_N_MODS'] = $ch_list['SHOW_N_MODS']; fud_use('users_reg.inc'); rebuildmodlist(); } /* Handle disabling of aliases */ if (($FUD_OPT_2 ^ $NEW_FUD_OPT_2) & 128 && !($NEW_FUD_OPT_2 & 128)) { q('UPDATE ' . $DBHOST_TBL_PREFIX . 'users SET alias=login'); rebuildmodlist(); } /* Topic/Message tree view disabling code */ $o = 0; if (($FUD_OPT_2 ^ $NEW_FUD_OPT_2) & 512 && !($NEW_FUD_OPT_2 & 512)) { $o |= 128; } if (($FUD_OPT_3 ^ $NEW_FUD_OPT_3) & 2 && !($NEW_FUD_OPT_3 & 2)) { $o |= 256; }
* email : forum@prohost.org * $Id: indexdb.php,v 1.2 2003/12/18 16:42:31 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. ***************************************************************************/ @set_time_limit(2400); require './GLOBALS.php'; fud_egw(); fud_use('adm.inc', true); fud_use('glob.inc', true); fud_use('isearch.inc'); fud_use('fileio.inc'); fud_use('rev_fmt.inc'); require $WWW_ROOT_DISK . 'adm/admpanel.php'; if (!isset($_POST['conf'])) { ?> <form method="post" action="indexdb.php"> <div class="alert"> This script will attempt to rebuild the search indices for the entire forum. This is a VERY CPU-intensive process and can take a VERY LONG time, especially on large forums. You should ONLY run this if you absolutely must. </div> <h2>Do you wish to proceed?</h2> <input type="submit" name="btn_cancel" value="No"> <input type="submit" name="conf" value="Yes"> <?php echo _hs; ?> </form> <?php
} if (!($fp = fopen($path, 'w'))) { exit("unable to write to " . $path . "<br>\n"); } fwrite($fp, $r); fclose($fp); $saved = $old_size - strlen($r); return $saved; } $is_tok = extension_loaded('tokenizer'); require './GLOBALS.php'; fud_egw(); fud_use('widgets.inc', true); fud_use('adm.inc', true); fud_use('compiler.inc', true); fud_use('theme.inc', true); $edit = isset($_GET['edit']) ? (int) $_GET['edit'] : (isset($_POST['edit']) ? (int) $_POST['edit'] : ''); /* Limit theme names to sane characters */ if (isset($_POST['newname'])) { $_POST['newname'] = preg_replace('![^A-Za-z0-9_]!', '_', $_POST['newname']); } if (isset($_POST['newname']) && !q_singleval("SELECT id FROM " . $DBHOST_TBL_PREFIX . "themes WHERE name='" . addslashes($_POST['newname']) . "'")) { $root = $DATA_DIR . 'thm/'; $root_nn = $root . preg_replace('![^A-Za-z0-9_]!', '_', $_POST['newname']); $u = umask(0); if (!@is_dir($root_nn) && !@mkdir($root_nn, 0777)) { exit('can\'t create (' . $root_nn . ')<br>'); } $ts = $_POST['base_template_set'] == 'path_info' ? 'path_info/' : 'default/'; fudcopy($root . $ts, $root_nn, '!.*!', true); umask($u);
/*************************************************************************** * copyright : (C) 2001-2003 Advanced Internet Designs Inc. * email : forum@prohost.org * $Id: admmassemail.php,v 1.3 2004/02/26 21:15:42 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. ***************************************************************************/ require './GLOBALS.php'; fud_egw(); fud_use('adm.inc', true); fud_use('widgets.inc', true); fud_use('smtp.inc'); /* find groups with members */ $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');
function format_regex(&$regex) { if (empty($regex)) { return; } $s = strpos($regex, '/') + 1; $e = strrpos($regex, '/'); $ret = substr($regex, $e + 1); $regex = substr($regex, $s, $e - $s); return $ret; } require './GLOBALS.php'; fud_egw(); fud_use('adm.inc', true); fud_use('widgets.inc', true); fud_use('mlist.inc', true); $tbl = $GLOBALS['DBHOST_TBL_PREFIX']; $edit = isset($_GET['edit']) ? (int) $_GET['edit'] : (isset($_POST['edit']) ? (int) $_POST['edit'] : ''); if (isset($_POST['ml_forum_id'])) { $mlist = new fud_mlist(); if ($edit) { $mlist->sync($edit); $edit = ''; } else { $mlist->add(); } } else { if (isset($_GET['del'])) { fud_mlist::del((int) $_GET['del']); } }
<?php /*************************************************************************** * copyright : (C) 2001-2003 Advanced Internet Designs Inc. * email : forum@prohost.org * $Id: admmime.php,v 1.2 2003/12/18 16:42:31 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. ***************************************************************************/ 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']; }
/*************************************************************************** * copyright : (C) 2001-2003 Advanced Internet Designs Inc. * email : forum@prohost.org * $Id: admnntp.php,v 1.3 2003/12/18 16:42:31 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. ***************************************************************************/ require './GLOBALS.php'; fud_egw(); fud_use('adm.inc', true); fud_use('widgets.inc', true); fud_use('nntp_adm.inc', true); $tbl = $GLOBALS['DBHOST_TBL_PREFIX']; $edit = isset($_GET['edit']) ? (int) $_GET['edit'] : (isset($_POST['edit']) ? (int) $_POST['edit'] : ''); if (isset($_POST['nntp_forum_id'])) { $nntp_adm = new fud_nntp_adm(); if ($edit) { $nntp_adm->sync($edit); $edit = ''; } else { $nntp_adm->add(); } } else { if (isset($_GET['del'])) { nntp_del((int) $_GET['del']); } }
* * 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('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]; ?>
<?php /*************************************************************************** * copyright : (C) 2001-2003 Advanced Internet Designs Inc. * email : forum@prohost.org * $Id: admlock.php,v 1.3 2004/07/08 14:25:47 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. ***************************************************************************/ require './GLOBALS.php'; fud_egw(); fud_use('adm.inc', true); fud_use('glob.inc', true); function chmoddir($dirn, $dirp, $filep, $rec = false) { @chmod($dirn, $dirp); if (!($d = opendir($dirn))) { echo 'ERROR: Unable to open "' . $dirn . '" directory<br>'; return; } 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 {
<?php /*************************************************************************** * copyright : (C) 2001-2003 Advanced Internet Designs Inc. * email : forum@prohost.org * $Id: admext.php,v 1.2 2003/12/18 16:42:31 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. ***************************************************************************/ require './GLOBALS.php'; fud_egw(); fud_use('adm.inc', true); fud_use('ext.inc', true); $tbl = $GLOBALS['DBHOST_TBL_PREFIX']; if (!empty($_POST['c_ext'])) { if (($p = strrpos($_POST['c_ext'], '.')) !== false) { $c_ext = rtrim(substr($_POST['c_ext'], $p + 1)); } else { $c_ext = trim($_POST['c_ext']); } } if (isset($_POST['edit'], $_POST['btn_update']) && $c_ext) { q('UPDATE ' . $tbl . 'ext_block SET ext=\'' . addslashes($c_ext) . '\' WHERE id=' . (int) $_POST['edit']); } else { if (isset($_POST['btn_submit']) && $c_ext) { q('INSERT INTO ' . $tbl . 'ext_block (ext) VALUES(\'' . addslashes($c_ext) . '\')'); } else { if (isset($_GET['del'])) {
} } if (isset($ll)) { db_unlock(); } } $th = isset($_POST['th']) ? (int) $_POST['th'] : (isset($_GET['th']) ? (int) $_GET['th'] : 0); $thx = isset($_POST['thx']) ? (int) $_POST['thx'] : (isset($_GET['thx']) ? (int) $_GET['thx'] : 0); $to = isset($_GET['to']) ? (int) $_GET['to'] : 0; /* thread x-change */ if ($th && $thx) { if (!($usr->users_opt & 1048576) && q_singleval('SELECT id FROM phpgw_fud_mod WHERE forum_id=' . $thx . ' AND user_id=' . _uid)) { std_error('access'); } if (!empty($_POST['reason_msg'])) { fud_use('thrx_adm.inc', true); if (thx_add($_POST['reason_msg'], $th, $thx, _uid)) { logaction(_uid, 'THRXREQUEST', $th); } exit('<html><script>window.close();</script></html>'); } else { $thr = db_sab('SELECT f.name AS frm_name, m.subject FROM phpgw_fud_forum f INNER JOIN phpgw_fud_thread t ON t.id=' . $th . ' INNER JOIN phpgw_fud_msg m ON t.root_msg_id=m.id WHERE f.id=' . $thx); $table_data = '<tr><td><font size="-1"><b>' . htmlspecialchars($thr->frm_name) . '</b></font></td></tr> <tr><td><font size="-1">Perchè vuoi che il topic sia spostato?</font><br /><textarea name="reason_msg" rows=7 cols=30></textarea><td></tr> <tr><td align="right"><input type="submit" class="button" name="submit" value="Invia la richiesta"></td></tr>'; } } /* moving a thread */ if ($th && $to) { $thr = db_sab('SELECT t.id, t.forum_id, t.last_post_id, t.root_msg_id, t.last_post_date, t.last_post_id,
/*************************************************************************** * copyright : (C) 2001-2003 Advanced Internet Designs Inc. * email : forum@prohost.org * $Id: admrdf.php,v 1.2 2003/12/18 16:42:31 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. ***************************************************************************/ require './GLOBALS.php'; fud_egw(); fud_use('adm.inc', true); fud_use('glob.inc', true); fud_use('widgets.inc', true); fud_use('draw_select_opt.inc'); $help_ar = read_help(); if (isset($_POST['form_posted'])) { $NEW_FUD_OPT_2 = 0; foreach ($_POST as $k => $v) { if (!strncmp($k, 'CF_', 3)) { $k = substr($k, 3); if (!isset($GLOBALS[$k]) || $GLOBALS[$k] != $v) { $ch_list[$k] = is_numeric($v) ? (int) $v : $v; } } else { if (!strncmp($k, 'FUD_OPT_2', 9)) { $NEW_FUD_OPT_2 |= (int) $v; } } }
* * 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); fud_use('widgets.inc', true); fud_use('imsg_edt.inc'); fud_use('th.inc'); fud_use('ipoll.inc'); fud_use('attach.inc'); fud_use('th_adm.inc'); if (isset($_POST['btn_prune']) && !empty($_POST['thread_age'])) { /* figure out our limit if any */ if ($_POST['forumsel'] == '0') { $lmt = ''; $msg = '<font color="red">from all forums</font>'; } else { if (!strncmp($_POST['forumsel'], 'cat_', 4)) { $c = uq('SELECT id FROM ' . $DBHOST_TBL_PREFIX . 'forum WHERE cat_id=' . (int) substr($_POST['forumsel'], 4)); while ($r = db_rowarr($c)) { $l[] = $r[0]; } if ($lmt = implode(',', $l)) { $lmt = ' AND forum_id IN(' . $lmt . ') '; } $msg = '<font color="red">from all forums in category "' . q_singleval('SELECT name FROM ' . $DBHOST_TBL_PREFIX . 'cat WHERE id=' . (int) substr($_POST['forumsel'], 4)) . '"</font>';
<?php /*************************************************************************** * copyright : (C) 2001-2003 Advanced Internet Designs Inc. * email : forum@prohost.org * $Id: admipfilter.php,v 1.2 2003/12/18 16:42:31 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. ***************************************************************************/ require './GLOBALS.php'; fud_egw(); fud_use('adm.inc', true); fud_use('ipfilter.inc', true); /* validate the address */ $bits = null; if (isset($_POST['ipaddr'])) { $bits = explode('.', trim($_POST['ipaddr'])); foreach ($bits as $k => $v) { $bits[$k] = $v == '..' || $v == '*' || !$v && $v !== '0' ? 256 : (int) $v; } for ($i = count($bits); $i < 4; $i++) { $bits[$i] = 256; } } $tbl = $GLOBALS['DBHOST_TBL_PREFIX']; if (isset($_POST['edit'], $_POST['btn_update']) && isset($bits)) { q('UPDATE ' . $tbl . 'ip_block SET ca=' . $bits[0] . ', cb=' . $bits[1] . ', cc=' . $bits[2] . ', cd=' . $bits[3] . ' WHERE id=' . (int) $_POST['edit']); } else {
} unset($GLOBALS['__MSG_FP__']); } function read_msg_body($off, $len, $file_id) { $fp = register_fp($file_id); fseek($fp, $off); return fread($fp, $len); } function reverse_fmt(&$data) { $data = str_replace(array('&', '"', '<', '>'), array('&', '"', '<', '>'), $data); } if (!($FUD_OPT_2 & 16777216) || !($FUD_OPT_2 & 67108864) && $mode == 'u') { fud_use('cookies.inc'); fud_use('users.inc'); std_error('disabled'); } if ($FUD_OPT_2 & 16384) { ob_start(array('ob_gzhandler', $PHP_COMPRESSION_LEVEL)); } function sp($data) { return '<![CDATA[' . str_replace(array('[', ']'), array('[', ']'), $data) . ']]>'; } function email_format($data) { return str_replace(array('.', '@'), array(' dot ', ' at '), $data); } function multi_id($data) {
<?php /*************************************************************************** * copyright : (C) 2001-2003 Advanced Internet Designs Inc. * email : forum@prohost.org * $Id: admsysinfo.php,v 1.2 2003/12/18 16:42:31 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. ***************************************************************************/ require './GLOBALS.php'; fud_egw(); fud_use('adm.inc', true); function get_php_setting($val) { $r = ini_get($val) == '1' ? 1 : 0; return $r ? 'ON' : 'OFF'; } function get_server_software() { if (isset($_SERVER['SERVER_SOFTWARE'])) { return $_SERVER['SERVER_SOFTWARE']; } else { if ($sf = getenv('SERVER_SOFTWARE')) { return $sf; } else { return 'n/a'; } }
} q('UPDATE phpgw_fud_group_members SET group_members_opt=' . $perm . ' WHERE id=' . (int) $_POST['edit']); grp_rebuild_cache(array($usr_id)); } } if (!$login_error) { unset($_POST); $gr_member = ''; } } if (isset($_GET['del']) && ($del = (int) $_GET['del']) && $group_id) { $is_gl = q_singleval("SELECT user_id FROM phpgw_fud_group_members WHERE group_id=" . $group_id . " AND user_id=" . $del . " AND group_members_opt>=131072 AND (group_members_opt & 131072) > 0"); grp_delete_member($group_id, $del); /* if the user was a group moderator, rebuild moderation cache */ if ($is_gl) { fud_use('groups_adm.inc', true); rebuild_group_ldr_cache($del); } } $edit = 0; if (isset($_GET['edit']) && ($edit = (int) $_GET['edit'])) { if (!($mbr = db_sab('SELECT gm.*, u.alias FROM phpgw_fud_group_members gm LEFT JOIN phpgw_fud_users u ON u.id=gm.user_id WHERE gm.group_id=' . $group_id . ' AND gm.id=' . $edit))) { invl_inp_err(); } if ($mbr->user_id == 0) { $gr_member = '<font class="anon">Anonimo</font>'; } else { if ($mbr->user_id == '2147483647') { $gr_member = '<font class="reg">Tutti gli utenti registrati</font>'; } else { $gr_member = $mbr->alias;
exit('Section parameter not avaliable<br>'); } if (($sdata = fetch_section($data, $f_path, $tmpl, $tmpl_type)) === false) { exit('Couldn\'t locate template "' . $tmpl . '" inside "' . $f_path . '"<br>'); } if (!isset($_POST['submitted'])) { $tmpl_data = $sdata['data']; } else { $tmpl_data = $_POST['tmpl_data']; $data = substr_replace($data, str_replace("\r", '', $tmpl_data), $sdata['offset'], $sdata['len']); if (!($fp = fopen($f_path, 'wb'))) { exit('unable to save modifications to "' . $f_path . '"'); } fwrite($fp, $data); fclose($fp); fud_use('compiler.inc', true); $c = q("SELECT theme FROM " . $GLOBALS['DBHOST_TBL_PREFIX'] . "themes WHERE theme='" . addslashes($tname) . "' AND lang='" . addslashes($tlang) . "'"); while ($r = db_rowarr($c)) { compile_all($tname, $tlang, $r[0]); } unset($c); $update_ok = 1; } $p = 0; while (($p = strpos($tmpl_data, '{MSG: ', $p)) !== false) { $p += 6; $e = strpos($tmpl_data, '}', $p); $msg_list[] = substr($tmpl_data, $p, $e - $p); $p = $e; } if (isset($msg_list)) {
/*************************************************************************** * copyright : (C) 2001-2003 Advanced Internet Designs Inc. * email : forum@prohost.org * $Id: admapprove_avatar.php,v 1.2 2003/12/18 16:42:31 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. ***************************************************************************/ define('no_inline', 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)) {
* * 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); define('back_to_main', 1); require './GLOBALS.php'; fud_egw(); fud_use('db.inc'); fud_use('fileio.inc'); fud_use('adm.inc', true); fud_use('private.inc'); fud_use('glob.inc', true); fud_use('imsg_edt.inc'); include $WWW_ROOT_DISK . 'adm/admpanel.php'; if (!isset($_POST['conf'])) { ?> <form method="post" action="compact.php"> <div class="alert"> The compactor will rebuild the storage files were the message bodies are kept. While the compactor is running your forum will be temporarily inaccessible. This process may take a while to run, depending on your harddrive speed and the amount of messages your forum has. </div> <h2>Do you wish to proceed?</h2> <input type="submit" name="cancel" value="No"> <input type="submit" name="conf" value="Yes"> <?php echo _hs; ?> </form>
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]); } } }
fud_use('wordwrap.inc'); fud_use('isearch.inc'); fud_use('replace.inc'); fud_use('forum.inc'); fud_use('rev_fmt.inc'); fud_use('iemail.inc'); fud_use('post_proc.inc'); fud_use('is_perms.inc'); fud_use('users.inc'); fud_use('users_reg.inc'); fud_use('attach.inc'); fud_use('rhost.inc'); fud_use('smiley.inc'); fud_use('fileio.inc'); fud_use('mlist.inc', true); fud_use('scripts_common.inc', true); define('sql_p', $DBHOST_TBL_PREFIX); if (is_numeric($_SERVER['argv'][1])) { $mlist = db_sab('SELECT * FROM ' . sql_p . 'mlist WHERE id=' . $_SERVER['argv'][1]); } else { $mlist = db_sab("SELECT * FROM " . sql_p . "mlist WHERE name='" . addslashes($_SERVER['argv'][1]) . "'"); } if (!$mlist) { exit('Invalid list identifier'); } $CREATE_NEW_USERS = $mlist->mlist_opt & 64; $FUD_OPT_2 |= $FUD_OPT_2 & ~(1024 | 8388608); $FUD_OPT_2 |= 128; $frm = db_sab('SELECT id, forum_opt, message_threshold, (max_attach_size * 1024) AS max_attach_size, max_file_attachments FROM ' . sql_p . 'forum WHERE id=' . $mlist->forum_id); $emsg = new fud_emsg(); $emsg->subject_cleanup_rgx = $mlist->subject_regex_haystack;
/*************************************************************************** * copyright : (C) 2001-2003 Advanced Internet Designs Inc. * email : forum@prohost.org * $Id: admgroups.php,v 1.2 2003/12/18 16:42:31 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. ***************************************************************************/ require './GLOBALS.php'; fud_egw(); fud_use('adm.inc', true); fud_use('widgets.inc', true); fud_use('groups_adm.inc', true); fud_use('groups.inc'); $edit = isset($_GET['edit']) ? (int) $_GET['edit'] : (isset($_POST['edit']) ? (int) $_POST['edit'] : 0); if (isset($_GET['del'])) { group_delete((int) $_GET['del']); } $hdr = group_perm_array(); $error_reason = $error = 0; /* check for errors */ if (isset($_POST['btn_submit'])) { $gr_inherit_id = (int) $_POST['gr_inherit_id']; if (isset($_POST['gr_resource'])) { $gr_resource = is_string($_POST['gr_resource']) ? array($_POST['gr_resource']) : array_unique($_POST['gr_resource']); } else { $gr_resource = array(); } $gr_ramasks = (int) (!empty($_POST['gr_ramasks']));
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); } }
* $Id: admuser.php,v 1.3 2004/01/29 16:34:55 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. ***************************************************************************/ require './GLOBALS.php'; fud_egw(); fud_use('adm.inc', true); fud_use('customtags.inc', true); fud_use('users_reg.inc'); fud_use('users_adm.inc', true); fud_use('logaction.inc'); fud_use('iemail.inc'); fud_use('private.inc'); if (isset($_GET['act'], $_GET['usr_id'])) { $act = $_GET['act']; $usr_id = (int) $_GET['usr_id']; } else { if (isset($_POST['act'], $_POST['usr_id'])) { $act = $_POST['act']; $usr_id = (int) $_POST['usr_id']; } else { $usr_id = $act = ''; } } if ($act && $usr_id && !($u = db_sab('SELECT * FROM ' . $DBHOST_TBL_PREFIX . 'users WHERE id=' . $usr_id))) { $usr_id = $act = ''; } switch ($act) {
<?php /*************************************************************************** * copyright : (C) 2001-2003 Advanced Internet Designs Inc. * email : forum@prohost.org * $Id: admlogin.php,v 1.2 2003/12/18 16:42:31 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. ***************************************************************************/ require './GLOBALS.php'; fud_egw(); fud_use('adm.inc', true); fud_use('login_filter.inc', true); $tbl = $GLOBALS['DBHOST_TBL_PREFIX']; if (isset($_POST['edit'], $_POST['btn_update']) && !empty($_POST['login'])) { q('UPDATE ' . $tbl . 'blocked_logins SET login=\'' . addslashes(trim($_POST['login'])) . '\' WHERE id=' . (int) $_POST['edit']); } 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()) {
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)); }
function init_user() { $o1 =& $GLOBALS['FUD_OPT_1']; $o2 =& $GLOBALS['FUD_OPT_2']; $phpgw =& $GLOBALS['phpgw_info']['user']; /* delete old sessions */ if (!(rand() % 10)) { q("DELETE FROM phpgw_fud_ses WHERE time_sec+" . $GLOBALS['phpgw_info']['server']['sessions_timeout'] . " < " . __request_timestamp__); } $u = db_sab("SELECT \n\t\t\ts.id AS sid, s.data, s.returnto, \n\t\t\tt.id AS theme_id, t.lang, t.name AS theme_name, t.locale, t.theme, t.pspell_lang, t.theme_opt, \n\t\t\tu.alias, u.posts_ppg, u.time_zone, u.sig, u.last_visit, u.last_read, u.cat_collapse_status, u.users_opt, u.ignore_list, u.ignore_list, u.buddy_list, u.id, u.group_leader_list, u.email, u.login \n\t\t\tFROM phpgw_fud_ses s\n\t\t\tINNER JOIN phpgw_fud_users u ON u.id=(CASE WHEN s.user_id>2000000000 THEN 1 ELSE s.user_id END) \n\t\t\tINNER JOIN phpgw_fud_themes t ON t.id=u.theme WHERE s.ses_id='" . s . "'"); if (!$u) { /* registered user */ if ($phpgw['account_lid'] != $GLOBALS['ANON_NICK']) { /* this means we do not have an entry for this user in the sessions table */ $uid = q_singleval("SELECT id FROM phpgw_fud_users WHERE egw_id=" . (int) $phpgw['account_id']); $id = db_qid("INSERT INTO phpgw_fud_ses (user_id, ses_id, time_sec) VALUES(" . $uid . ", '" . s . "', " . __request_timestamp__ . ")"); $u = db_sab('SELECT s.id AS sid, s.data, s.returnto, t.id AS theme_id, t.lang, t.name AS theme_name, t.locale, t.theme, t.pspell_lang, t.theme_opt, u.alias, u.posts_ppg, u.time_zone, u.sig, u.last_visit, u.last_read, u.cat_collapse_status, u.users_opt, u.ignore_list, u.ignore_list, u.buddy_list, u.id, u.group_leader_list, u.email, u.login FROM phpgw_fud_ses s INNER JOIN phpgw_fud_users u ON u.id=s.user_id INNER JOIN phpgw_fud_themes t ON t.id=u.theme WHERE s.id=' . $id); } else { /* anonymous user */ do { $uid = 2000000000 + mt_rand(1, 147483647); } while (!($id = db_li("INSERT INTO phpgw_fud_ses (time_sec, ses_id, user_id) VALUES (" . __request_timestamp__ . ", '" . s . "', " . $uid . ")", $ef, 1))); $u = db_sab('SELECT s.id AS sid, s.data, s.returnto, t.id AS theme_id, t.lang, t.name AS theme_name, t.locale, t.theme, t.pspell_lang, t.theme_opt, u.alias, u.posts_ppg, u.time_zone, u.sig, u.last_visit, u.last_read, u.cat_collapse_status, u.users_opt, u.ignore_list, u.ignore_list, u.buddy_list, u.id, u.group_leader_list, u.email, u.login FROM phpgw_fud_ses s INNER JOIN phpgw_fud_users u ON u.id=1 INNER JOIN phpgw_fud_themes t ON t.id=u.theme WHERE s.id=' . $id); } } /* grant admin access */ if (!empty($phpgw['apps']['admin'])) { $u->users_opt |= 1048576; } /* this is ugly, very ugly, but there is no way around it, we need to see if the * user's language had changed and we can only do it this way. */ $langl = array('bg' => 'bulgarian', 'zh' => 'chinese_big5', 'cs' => 'czech', 'nl' => 'dutch', 'fr' => 'french', 'de' => 'german', 'it' => 'italian', 'lv' => 'latvian', 'no' => 'norwegian', 'pl' => 'polish', 'pt' => 'portuguese', 'ro' => 'romanian', 'ru' => 'russian', 'sk' => 'slovak', 'es' => 'spanish', 'sv' => 'swedish', 'tr' => 'turkish', 'en' => 'english'); $lang =& $phpgw['preferences']['common']['lang']; if (isset($langl[$lang]) && $langl[$lang] != $u->lang) { if (!($o = db_sab("SELECT * FROM phpgw_fud_themes WHERE lang='{$langl[$lang]}'"))) { fud_use('compiler.inc', true); fud_use('theme.inc', true); $thm = new fud_theme(); $thm->name = $thm->lang = $langl[$lang]; $thm->theme = 'default'; $thm->pspell_lang = file_get_contents($GLOBALS['DATA_DIR'] . 'thm/default/i18n/' . $langl[$lang] . '/pspell_lang'); $thm->locale = file_get_contents($GLOBALS['DATA_DIR'] . 'thm/default/i18n/' . $langl[$lang] . '/locale'); $thm->theme_opt = 1; $thm->add(); compile_all('default', $langl[$lang], $langl[$lang]); $o = db_sab("SELECT * FROM phpgw_fud_themes WHERE lang='{$langl[$lang]}'"); } $u->lang = $o->lang; $u->theme_name = $o->name; $u->locale = $o->locale; $u->theme_id = $o->id; $u->theme = $o->theme; $u->pspell_lang = $o->pspell_lang; $u->theme_opt = $o->theme_opt; q("UPDATE phpgw_fud_users SET theme=" . $u->theme_id . " WHERE id=" . $u->id); } if ($u->data) { $u->data = @unserialize($u->data); } $u->users_opt = (int) $u->users_opt; /* set timezone */ @putenv('TZ=' . $u->time_zone); /* set locale */ setlocale(LC_ALL, $u->locale); /* view format for threads & messages */ define('d_thread_view', $u->users_opt & 256 ? 'msg' : 'tree'); define('t_thread_view', $u->users_opt & 128 ? 'thread' : 'threadt'); /* theme path */ @define('fud_theme', 'theme/' . ($u->theme_name ? $u->theme_name : 'default') . '/'); /* define _uid, which, will tell us if this is a 'real' user or not */ define('__fud_real_user__', $u->id != 1 ? $u->id : 0); define('_uid', __fud_real_user__); if (__fud_real_user__) { q('UPDATE phpgw_fud_users SET last_visit=' . __request_timestamp__ . ' WHERE id=' . $u->id); } return $u; }