[phpbbreloaded-checkins] SF.net SVN: phpbbreloaded: [250] phpBB Reloaded 2
Status: Planning
Brought to you by:
tehphpmaster
From: <kla...@us...> - 2006-08-12 15:11:00
|
Revision: 250 Author: klarinetking Date: 2006-08-12 08:10:37 -0700 (Sat, 12 Aug 2006) ViewCVS: http://svn.sourceforge.net/phpbbreloaded/?rev=250&view=rev Log Message: ----------- Big commit today! Mostly removing useless code, updating to internal (not yet published) coding standards. More files to come. Modified Paths: -------------- phpBB Reloaded 2/attach_rules.php phpBB Reloaded 2/calendar.php phpBB Reloaded 2/calendar_scheduler.php phpBB Reloaded 2/common.php phpBB Reloaded 2/download.php phpBB Reloaded 2/extension.inc phpBB Reloaded 2/faq.php phpBB Reloaded 2/groupcp.php phpBB Reloaded 2/index.php phpBB Reloaded 2/login.php phpBB Reloaded 2/memberlist.php phpBB Reloaded 2/modcp.php phpBB Reloaded 2/posting.php phpBB Reloaded 2/privmsg.php phpBB Reloaded 2/profile.php phpBB Reloaded 2/qpes.php phpBB Reloaded 2/ranks.php phpBB Reloaded 2/search.php phpBB Reloaded 2/shoutbox.php phpBB Reloaded 2/shoutbox_max.php phpBB Reloaded 2/shoutbox_view.php phpBB Reloaded 2/uacp.php phpBB Reloaded 2/viewonline.php phpBB Reloaded 2/viewtopic.php Modified: phpBB Reloaded 2/attach_rules.php =================================================================== --- phpBB Reloaded 2/attach_rules.php 2006-06-20 23:05:11 UTC (rev 249) +++ phpBB Reloaded 2/attach_rules.php 2006-08-12 15:10:37 UTC (rev 250) @@ -1,16 +1,16 @@ <?php -/** -* -* @package attachment_mod -* @version $Id: attach_rules.php,v 1.1.1.1 2006/02/24 02:28:06 markthedaemon Exp $ -* @copyright (c) 2002 Meik Sievertsen -* @license http://opensource.org/licenses/gpl-license.php GNU Public License -* -*/ +/** + * @package core + * @version $ID: Exp$ + * @copyright phpBB Reloaded 2006 + * @license http://opensource.org/licenses/gpl-license.php GNU Public License + */ /** -*/ -if (defined('IN_PHPBB')) + * phpBB originally created by phpBB http://www.phpbb.com + */ + +if ( defined('IN_PHPBB') ) { die('Hacking attempt'); exit; @@ -18,21 +18,23 @@ define('IN_PHPBB', TRUE); $phpbb_root_path = './'; -include($phpbb_root_path . 'extension.inc'); -include($phpbb_root_path . 'common.'.$phpEx); +include ($phpbb_root_path . 'extension.inc'); +include ($phpbb_root_path . 'common.' . $phpEx); $forum_id = get_var('f', 0); $privmsg = (!$forum_id) ? true : false; // Start Session Management + $userdata = session_pagestart($user_ip, PAGE_INDEX); init_userprefs($userdata); // Display the allowed Extension Groups and Upload Size -if ($privmsg) + +if ( $privmsg ) { - $auth['auth_attachments'] = ($userdata['user_level'] != ADMIN) ? intval($attach_config['allow_pm_attach']) : true; - $auth['auth_view'] = true; + $auth['auth_attachments'] = ($userdata['user_level'] != ADMIN) ? intval($attach_config['allow_pm_attach']) : TRUE; + $auth['auth_view'] = TRUE; $_max_filesize = $attach_config['max_filesize_pm']; } else @@ -41,7 +43,7 @@ $_max_filesize = $attach_config['max_filesize']; } -if (!($auth['auth_attachments'] && $auth['auth_view'])) +if ( !($auth['auth_attachments'] && $auth['auth_view']) ) { message_die(GENERAL_ERROR, 'You are not allowed to call this file (ID:2)'); } @@ -52,10 +54,10 @@ $sql = 'SELECT group_id, group_name, max_filesize, forum_permissions FROM ' . EXTENSION_GROUPS_TABLE . ' - WHERE allow_group = 1 + WHERE allow_group = 1 ORDER BY group_name ASC'; -if (!($result = $db->sql_query($sql))) +if ( !($result = $db->sql_query($sql)) ) { message_die(GENERAL_ERROR, 'Could not query Extension Groups.', '', __LINE__, __FILE__, $sql); } @@ -66,16 +68,18 @@ $db->sql_freeresult($result); // Ok, only process those Groups allowed within this forum -$nothing = true; + +$nothing = TRUE; + for ($i = 0; $i < $num_rows; $i++) { $auth_cache = trim($rows[$i]['forum_permissions']); - $permit = ($privmsg) ? true : ((is_forum_authed($auth_cache, $forum_id)) || trim($rows[$i]['forum_permissions']) == ''); + $permit = ($privmsg) ? TRUE : ((is_forum_authed($auth_cache, $forum_id)) || trim($rows[$i]['forum_permissions']) == ''); - if ($permit) + if ( $permit ) { - $nothing = false; + $nothing = FALSE; $group_name = $rows[$i]['group_name']; $f_size = intval(trim($rows[$i]['max_filesize'])); $det_filesize = (!$f_size) ? $_max_filesize : $f_size; @@ -98,10 +102,10 @@ $sql = 'SELECT extension FROM ' . EXTENSIONS_TABLE . " - WHERE group_id = " . (int) $rows[$i]['group_id'] . " + WHERE group_id = " . (int) $rows[$i]['group_id'] . " ORDER BY extension ASC"; - if (!($result = $db->sql_query($sql))) + if ( !($result = $db->sql_query($sql)) ) { message_die(GENERAL_ERROR, 'Could not query Extensions.', '', __LINE__, __FILE__, $sql); } @@ -121,7 +125,7 @@ $gen_simple_header = TRUE; $page_title = $lang['Attach_rules_title']; -include($phpbb_root_path . 'includes/page_header.' . $phpEx); +include ($phpbb_root_path . 'includes/page_header.' . $phpEx); $template->assign_vars(array( 'L_RULES_TITLE' => $lang['Attach_rules_title'], @@ -129,7 +133,7 @@ 'L_EMPTY_GROUP_PERMS' => $lang['Note_user_empty_group_permissions']) ); -if ($nothing) +if ( $nothing ) { $template->assign_block_vars('switch_nothing', array()); } Modified: phpBB Reloaded 2/calendar.php =================================================================== --- phpBB Reloaded 2/calendar.php 2006-06-20 23:05:11 UTC (rev 249) +++ phpBB Reloaded 2/calendar.php 2006-08-12 15:10:37 UTC (rev 250) @@ -1,46 +1,41 @@ <?php -/*************************************************************************** - * calendar.php - CH edition - * ------------ - * begin : 06/12/2004 - * copyright : Ptirhiik - * email : pti...@cl... - * - * Version : 0.0.2 - 15/05/2005 - * - ***************************************************************************/ +/** + * @package core + * @version $ID: Exp$ + * @copyright phpBB Reloaded 2006 + * @license http://opensource.org/licenses/gpl-license.php GNU Public License + */ -/*************************************************************************** - * - * 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. - * - ***************************************************************************/ +/** + * phpBB originally created by phpBB http://www.phpbb.com + */ -define('IN_PHPBB', true); -define('IN_CALENDAR', true); +define('IN_PHPBB', TRUE); +define('IN_CALENDAR', TRUE); $phpbb_root_path = './'; -include($phpbb_root_path . 'extension.inc'); -include($phpbb_root_path . 'common.' . $phpEx); +include ($phpbb_root_path . 'extension.inc'); +include ($phpbb_root_path . 'common.' . $phpEx); -include($config->url('includes/class_forums')); -include($config->url('includes/class_calendar')); +include ($config->url('includes/class_forums')); +include ($config->url('includes/class_calendar')); // date is in user format + $date = sprintf('%08d', _read('date', TYPE_INT)); $date = (intval($date) < 19700102) || (intval($date) >= 20700101) ? 0 : mktime( 0, 0, 0, intval(substr($date, 4, 2)), intval(substr($date, 6, 2)), intval(substr($date, 0, 4))); // from pull down lists + $month = _read('month', TYPE_INT); $year = _read('year', TYPE_INT); + if ( ($month > 0) && ($month <= 12) && ($year >= 1970) && ($year < 2070) ) { $date = mktime( 0, 0, 0, $month, 01, $year); } // next/previous from input buttons + if ( intval($date) ) { $aamm = date('Ym', $date); @@ -48,6 +43,7 @@ { $date = mktime( 0, 0, 0, date('m', $date) + 1, 01, $year); } + if ( _button('prev') && ($aamm > 197001) && ($aamm <= 206912) ) { $date = mktime( 0, 0, 0, date('m', $date), 00, $year); @@ -55,6 +51,7 @@ } // read forums + $forums = new forums(); $forums->read(); $forum_id = _read(POST_FORUM_URL, TYPE_INT); @@ -62,13 +59,16 @@ // // Start session management // + $userdata = session_pagestart($user_ip, PAGE_INDEX); init_userprefs($userdata); + // // End session management // // check auths + $user->get_cache(POST_FORUM_URL); if ( !$user->auth(POST_FORUM_URL, 'auth_read', $forum_id) ) { @@ -76,27 +76,31 @@ } // navigation + $navigation = new navigation(); $navigation->add('Calendar', '', 'calendar', array(POST_FORUM_URL => $forum_id, 'date' => empty($date) ? 0 : date('Ymd', $date)), ''); $navigation->display(); // send the calendar box + $calendar = new calendar(); $calendar->display('CALENDAR_MONTH', $date, $forum_id, true); // send board header + $page_title = $user->lang('Calendar'); include($config->url('includes/page_header')); // system + $template->assign_vars(array( - 'S_ACTION' => $config->url('calendar', '', true), + 'S_ACTION' => $config->url('calendar', '', TRUE), )); _hide_set(); // send to browser + $template->set_filenames(array('body' => 'calendar_body.tpl')); $template->pparse('body'); -include($config->url('includes/page_tail')); - +include ($config->url('includes/page_tail')); ?> \ No newline at end of file Modified: phpBB Reloaded 2/calendar_scheduler.php =================================================================== --- phpBB Reloaded 2/calendar_scheduler.php 2006-06-20 23:05:11 UTC (rev 249) +++ phpBB Reloaded 2/calendar_scheduler.php 2006-08-12 15:10:37 UTC (rev 250) @@ -1,41 +1,35 @@ <?php -/*************************************************************************** - * calendar_scheduler.php - CH edition - * ---------------------- - * begin : 06/12/2004 - * copyright : Ptirhiik - * email : pti...@cl... - * - * Version : 0.0.2 - 15/05/2005 - * - ***************************************************************************/ +/** + * @package core + * @version $ID: Exp$ + * @copyright phpBB Reloaded 2006 + * @license http://opensource.org/licenses/gpl-license.php GNU Public License + */ -/*************************************************************************** - * - * 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. - * - ***************************************************************************/ +/** + * phpBB originally created by phpBB http://www.phpbb.com + */ -define('IN_PHPBB', true); -define('IN_CALENDAR', true); +define('IN_PHPBB', TRUE); +define('IN_CALENDAR', TRUE); $phpbb_root_path = './'; -include($phpbb_root_path . 'extension.inc'); -include($phpbb_root_path . 'common.' . $phpEx); +include ($phpbb_root_path . 'extension.inc'); +include ($phpbb_root_path . 'common.' . $phpEx); -include($config->url('includes/class_forums')); -include($config->url('includes/class_calendar')); +include ($config->url('includes/class_forums')); +include ($config->url('includes/class_calendar')); // date is in user format + $date = sprintf('%08d', _read('date', TYPE_INT)); $date = (intval($date) < 19700102) || (intval($date) >= 20700101) ? 0 : mktime( 0, 0, 0, intval(substr($date, 4, 2)), intval(substr($date, 6, 2)), intval(substr($date, 0, 4))); // from pull down lists + $year = _read('year', TYPE_INT); $month = _read('month', TYPE_INT); $day = _read('day', TYPE_INT); + if ( ($month > 0) && ($month <= 12) && ($year >= 1970) && ($year < 2070) ) { $date = mktime( 0, 0, 0, $month, $day, $year); @@ -46,13 +40,16 @@ } // next/previous from input buttons + if ( intval($date) ) { $aamm = date('Ym', $date); + if ( _button('next') && ($aamm >= 197001) && ($aamm < 206912) ) { $date = mktime( 0, 0, 0, date('m', $date) + 1, 01, $year); } + if ( _button('prev') && ($aamm > 197001) && ($aamm <= 206912) ) { $date = mktime( 0, 0, 0, date('m', $date), 00, $year); @@ -60,6 +57,7 @@ } // hour + $hour = _read('hour', TYPE_INT); if ( ($hour < 0) || ($hour > 24) ) { @@ -67,6 +65,7 @@ } // read forums + $forums = new forums(); $forums->read(); $forum_id = _read(POST_FORUM_URL, TYPE_INT); @@ -74,43 +73,52 @@ // // Start session management // + $userdata = session_pagestart($user_ip, PAGE_INDEX); init_userprefs($userdata); + // // End session management // // check auths + $user->get_cache(POST_FORUM_URL); + if ( !$user->auth(POST_FORUM_URL, 'auth_read', $forum_id) ) { $forum_id = 0; } // navigation + $navigation = new navigation(); $navigation->add('Calendar', '', 'calendar', array(POST_FORUM_URL => $forum_id, 'date' => empty($date) ? 0 : date('Ymd', $date)), ''); $navigation->add('Calendar_scheduler', '', 'calendar_scheduler', array(POST_FORUM_URL => $forum_id, 'date' => date('Ymd', $date), 'hour' => $hour), ''); $navigation->display(); // send the calendar box + $calendar_scheduler = new calendar_scheduler(); $calendar_scheduler->display($date, $hour, $forum_id); // send board header + $page_title = $user->lang('Calendar_scheduler'); -include($config->url('includes/page_header')); +include ($config->url('includes/page_header')); // system + $template->assign_vars(array( - 'S_ACTION' => $config->url('calendar_scheduler', '', true), -)); + 'S_ACTION' => $config->url('calendar_scheduler', '', true)) +); + _hide('date', $date); _hide_set(); // send to browser + $template->set_filenames(array('body' => 'calendar_scheduler_body.tpl')); $template->pparse('body'); -include($config->url('includes/page_tail')); - +include ($config->url('includes/page_tail')); ?> \ No newline at end of file Modified: phpBB Reloaded 2/common.php =================================================================== --- phpBB Reloaded 2/common.php 2006-06-20 23:05:11 UTC (rev 249) +++ phpBB Reloaded 2/common.php 2006-08-12 15:10:37 UTC (rev 250) @@ -1,13 +1,15 @@ <?php /** -* -* @package: reloaded -* @version: $Id: common.php,v 1.1.1.1 2006/02/24 02:28:06 markthedaemon Exp $ -* @copyright: (c) 2005, 2006 phpBB Reloaded & 2002, 2006 phpBB Group -* @license: http://opensource.org/licenses/gpl-license.php GNU Public License -* -*/ + * @package core + * @version $ID: Exp$ + * @copyright phpBB Reloaded 2006 + * @license http://opensource.org/licenses/gpl-license.php GNU Public License + */ +/** + * phpBB originally created by phpBB http://www.phpbb.com + */ + if ( !defined('IN_PHPBB') ) { die("Hacking attempt"); @@ -16,8 +18,6 @@ $starttime = microtime(); $trc_loc_start = $trc_loc_end = 0; - -// error_reporting (E_ERROR | E_WARNING | E_PARSE); // This will NOT report uninitialized variables set_magic_quotes_runtime(0); // Disable magic_quotes_runtime @@ -25,6 +25,7 @@ // Thanks to Matt Kavanagh and Stefan Esser for providing feedback as well as patch files // PHP5 with register_long_arrays off? + if (@phpversion() >= '5.0.0' && (!@ini_get('register_long_arrays') || @ini_get('register_long_arrays') == '0' || strtolower(@ini_get('register_long_arrays')) == 'off')) { $HTTP_POST_VARS = $_POST; @@ -35,55 +36,62 @@ $HTTP_POST_FILES = $_FILES; // _SESSION is the only superglobal which is conditionally set - if (isset($_SESSION)) + + if ( isset($_SESSION) ) { $HTTP_SESSION_VARS = $_SESSION; } } // Protect against GLOBALS tricks -if (isset($HTTP_POST_VARS['GLOBALS']) || isset($HTTP_POST_FILES['GLOBALS']) || isset($HTTP_GET_VARS['GLOBALS']) || isset($HTTP_COOKIE_VARS['GLOBALS'])) + +if ( isset($HTTP_POST_VARS['GLOBALS']) || isset($HTTP_POST_FILES['GLOBALS']) || isset($HTTP_GET_VARS['GLOBALS']) || isset($HTTP_COOKIE_VARS['GLOBALS']) ) { die("Hacking attempt"); } // Protect against HTTP_SESSION_VARS tricks -if (isset($HTTP_SESSION_VARS) && !is_array($HTTP_SESSION_VARS)) + +if ( isset($HTTP_SESSION_VARS) && !is_array($HTTP_SESSION_VARS) ) { die("Hacking attempt"); } -if (@ini_get('register_globals') == '1' || strtolower(@ini_get('register_globals')) == 'on') +if ( @ini_get('register_globals') == '1' || strtolower(@ini_get('register_globals')) == 'on' ) { // PHP4+ path + $not_unset = array('HTTP_GET_VARS', 'HTTP_POST_VARS', 'HTTP_COOKIE_VARS', 'HTTP_SERVER_VARS', 'HTTP_SESSION_VARS', 'HTTP_ENV_VARS', 'HTTP_POST_FILES', 'phpEx', 'phpbb_root_path'); // Not only will array_merge give a warning if a parameter // is not an array, it will actually fail. So we check if // HTTP_SESSION_VARS has been initialised. - if (!isset($HTTP_SESSION_VARS) || !is_array($HTTP_SESSION_VARS)) + + if ( !isset($HTTP_SESSION_VARS) || !is_array($HTTP_SESSION_VARS) ) { $HTTP_SESSION_VARS = array(); } // Merge all into one extremely huge array; unset // this later + $input = array_merge($HTTP_GET_VARS, $HTTP_POST_VARS, $HTTP_COOKIE_VARS, $HTTP_SERVER_VARS, $HTTP_SESSION_VARS, $HTTP_ENV_VARS, $HTTP_POST_FILES); - unset($input['input']); - unset($input['not_unset']); + unset ($input['input']); + unset ($input['not_unset']); - while (list($var,) = @each($input)) + while ( list($var,) = @each($input) ) { - if (in_array($var, $not_unset)) + if ( in_array($var, $not_unset) ) { die('Hacking attempt!'); } - unset($$var); + + unset ($$var); } - unset($input); + unset ($input); } // @@ -93,16 +101,17 @@ // if( !get_magic_quotes_gpc() ) { - if( is_array($HTTP_GET_VARS) ) + if ( is_array($HTTP_GET_VARS) ) { - while( list($k, $v) = each($HTTP_GET_VARS) ) + while ( list($k, $v) = each($HTTP_GET_VARS) ) { - if( is_array($HTTP_GET_VARS[$k]) ) + if ( is_array($HTTP_GET_VARS[$k]) ) { - while( list($k2, $v2) = each($HTTP_GET_VARS[$k]) ) + while ( list($k2, $v2) = each($HTTP_GET_VARS[$k]) ) { $HTTP_GET_VARS[$k][$k2] = addslashes($v2); } + @reset($HTTP_GET_VARS[$k]); } else @@ -110,19 +119,21 @@ $HTTP_GET_VARS[$k] = addslashes($v); } } + @reset($HTTP_GET_VARS); } - if( is_array($HTTP_POST_VARS) ) + if ( is_array($HTTP_POST_VARS) ) { - while( list($k, $v) = each($HTTP_POST_VARS) ) + while ( list($k, $v) = each($HTTP_POST_VARS) ) { - if( is_array($HTTP_POST_VARS[$k]) ) + if ( is_array($HTTP_POST_VARS[$k]) ) { - while( list($k2, $v2) = each($HTTP_POST_VARS[$k]) ) + while ( list($k2, $v2) = each($HTTP_POST_VARS[$k]) ) { $HTTP_POST_VARS[$k][$k2] = addslashes($v2); } + @reset($HTTP_POST_VARS[$k]); } else @@ -130,19 +141,21 @@ $HTTP_POST_VARS[$k] = addslashes($v); } } + @reset($HTTP_POST_VARS); } - if( is_array($HTTP_COOKIE_VARS) ) + if ( is_array($HTTP_COOKIE_VARS) ) { - while( list($k, $v) = each($HTTP_COOKIE_VARS) ) + while ( list($k, $v) = each($HTTP_COOKIE_VARS) ) { - if( is_array($HTTP_COOKIE_VARS[$k]) ) + if ( is_array($HTTP_COOKIE_VARS[$k]) ) { - while( list($k2, $v2) = each($HTTP_COOKIE_VARS[$k]) ) + while ( list($k2, $v2) = each($HTTP_COOKIE_VARS[$k]) ) { $HTTP_COOKIE_VARS[$k][$k2] = addslashes($v2); } + @reset($HTTP_COOKIE_VARS[$k]); } else @@ -150,6 +163,7 @@ $HTTP_COOKIE_VARS[$k] = addslashes($v); } } + @reset($HTTP_COOKIE_VARS); } } @@ -159,6 +173,7 @@ // malicious rewriting of language and otherarray values via // URI params // + $board_config = array(); $userdata = array(); $theme = array(); @@ -168,31 +183,25 @@ $gen_simple_header = FALSE; $dss_seeded = false; -include($phpbb_root_path . 'config.'.$phpEx); +include ($phpbb_root_path . 'config.' . $phpEx); -if( !defined("PHPBB_INSTALLED") ) +if ( !defined("PHPBB_INSTALLED") ) { header('Location: ' . $phpbb_root_path . 'install/install.' . $phpEx); exit; } -include($phpbb_root_path . 'includes/constants.'.$phpEx); -//-- mod : categories hierarchy ------------------------------------------------ -//-- delete -/* -include($phpbb_root_path . 'includes/template.'.$phpEx); -*/ -//-- add -include($phpbb_root_path . 'includes/class_template.'.$phpEx); -//-- fin mod : categories hierarchy -------------------------------------------- -include($phpbb_root_path . 'includes/sessions.'.$phpEx); -include($phpbb_root_path . 'includes/auth.'.$phpEx); -include($phpbb_root_path . 'includes/functions.'.$phpEx); -include($phpbb_root_path . 'includes/db.'.$phpEx); +include ($phpbb_root_path . 'includes/constants.' . $phpEx); +include ($phpbb_root_path . 'includes/class_template.' . $phpEx); +include ($phpbb_root_path . 'includes/sessions.' . $phpEx); +include ($phpbb_root_path . 'includes/auth.' . $phpEx); +include ($phpbb_root_path . 'includes/functions.' . $phpEx); +include ($phpbb_root_path . 'includes/db.' . $phpEx); // We do not need this any longer, unset for safety purposes -unset($dbpasswd); +unset ($dbpasswd); + // // Obtain and encode users IP // @@ -201,6 +210,7 @@ // even bother complaining ... go scream and shout at the idiots out there who feel // "clever" is doing harm rather than good ... karma is a great thing ... :) // + $client_ip = ( !empty($HTTP_SERVER_VARS['REMOTE_ADDR']) ) ? $HTTP_SERVER_VARS['REMOTE_ADDR'] : ( ( !empty($HTTP_ENV_VARS['REMOTE_ADDR']) ) ? $HTTP_ENV_VARS['REMOTE_ADDR'] : getenv('REMOTE_ADDR') ); $user_ip = encode_ip($client_ip); @@ -209,40 +219,27 @@ // then we output a CRITICAL_ERROR since // basic forum information is not available // -//-- mod : categories hierarchy ------------------------------------------------ -//-- delete -/* -$sql = "SELECT * - FROM " . CONFIG_TABLE; -if( !($result = $db->sql_query($sql)) ) -{ - message_die(CRITICAL_ERROR, "Could not query config information", "", __LINE__, __FILE__, $sql); -} -while ( $row = $db->sql_fetchrow($result) ) -{ - $board_config[$row['config_name']] = $row['config_value']; -} -*/ -//-- add // include basic classes def include($phpbb_root_path . 'includes/class_config.' . $phpEx); // get config + $config = new config_class(); + if ( !$config->read() ) { define('RUN_CH_INSTALL', true); } + $board_config = &$config->data; - - // user objects -include($config->url('includes/class_groups')); -include($config->url('includes/class_user')); -include($config->url('includes/class_auth')); +include ($config->url('includes/class_groups')); +include ($config->url('includes/class_user')); +include ($config->url('includes/class_auth')); + // instantiate some objects $user = new user(); $censored_words = new words(); @@ -253,34 +250,30 @@ $topics_attr = new topics_attr(); // People never read achievement messages after after having seen "Succesfull !", tss tss :) + if ( !defined('IN_LOGIN') && !defined('IN_INSTALL') && file_exists('install_cat') ) { message_die(GENERAL_MESSAGE, 'Please ensure the install_cat/ directory is deleted'); } // messages queue -@include($config->url('includes/class_message')); + +@include ($config->url('includes/class_message')); $message_queue = defined('CH_message_queue') ? new message_queue() : ''; -//-- mod : attachmod ----------------------------------------------------------- -//-- add -// attachmod -@include($config->url('attach_mod/attachment_mod')); -//-- fin mod : attachmod ------------------------------------------------------- -//-- fin mod : categories hierarchy ------------------------------------------- +@include ($config->url('attach_mod/attachment_mod')); -//-- mod : Advanced Group Color Management ------------------------------------- -//-- add define('IN_CH', TRUE); -include($config->url('includes/class_color')); +include ($config->url('includes/class_color')); // // prepare colors class -// +/ $colors = new colors(); // // People never read achievement messages after after having seen "Succesfull !", tss tss :) // + if ( !defined('IN_INSTALL') && file_exists('install_color') ) { message_die(GENERAL_MESSAGE, 'Please ensure the install_color/ directory is deleted'); @@ -290,32 +283,20 @@ // // read colors // + if ( !defined('IN_INSTALL') ) { $colors->read(); } -//-- fin mod : Advanced Group Color Management --------------------------------- -if (file_exists('install') || file_exists('contrib')) +if ( file_exists('install') || file_exists('contrib') ) { message_die(GENERAL_MESSAGE, 'Please_remove_install_contrib'); } -// -// Show 'Board is disabled' message if needed. -// -//-- mod : categories hierarchy ------------------------------------------------ -//-- delete -/* -if( $board_config['board_disable'] && !defined("IN_ADMIN") && !defined("IN_LOGIN") ) -*/ -//-- add -/* -if( $config->data['board_disable'] && !defined('IN_ADMIN') && !defined('IN_LOGIN') && !defined('IN_INSTALL') ) -//-- fin mod : categories hierarchy --------------------------------------------- + +if ( $config->data['board_disable'] && !defined('IN_ADMIN') && !defined('IN_LOGIN') && !defined('IN_INSTALL') ) { message_die(GENERAL_MESSAGE, 'Board_disable', 'Information'); } -*/ - ?> \ No newline at end of file Modified: phpBB Reloaded 2/download.php =================================================================== --- phpBB Reloaded 2/download.php 2006-06-20 23:05:11 UTC (rev 249) +++ phpBB Reloaded 2/download.php 2006-08-12 15:10:37 UTC (rev 250) @@ -1,32 +1,25 @@ <?php -/** -* -* @package attachment_mod -* @version $Id: download.php,v 1.1.1.1 2006/02/24 02:28:09 markthedaemon Exp $ -* @copyright (c) 2002 Meik Sievertsen -* @license http://opensource.org/licenses/gpl-license.php GNU Public License -* -*/ -/*************************************************************************** - * - * This file has been modified by phpBB Reloaded - (C) 2006 phpBB Reloaded Group - * Support questions placed here: http://www.phpbbreloaded.com - * - * DO NOT EDIT THIS FILE UNLESS YOU KNOW WHAT YOU ARE DOING - * - ***************************************************************************/ /** -*/ -if (defined('IN_PHPBB')) + * @package core + * @version $ID: Exp$ + * @copyright phpBB Reloaded 2006 + * @license http://opensource.org/licenses/gpl-license.php GNU Public License + */ + +/** + * phpBB originally created by phpBB http://www.phpbb.com + */ + +if ( defined('IN_PHPBB')) { - die('Hacking attempt'); + die ('Hacking attempt'); exit; } -define('IN_PHPBB', true); +define ('IN_PHPBB', TRUE); $phpbb_root_path = './'; -include($phpbb_root_path . 'extension.inc'); -include($phpbb_root_path . 'common.' . $phpEx); +include ($phpbb_root_path . 'extension.inc'); +include ($phpbb_root_path . 'common.' . $phpEx); // // Delete the / * to uncomment the block, and edit the values (read the comments) to @@ -101,6 +94,7 @@ $thumbnail = get_var('thumb', 0); // Send file to browser + function send_file_to_browser($attachment, $upload_dir) { global $_SERVER, $HTTP_USER_AGENT, $HTTP_SERVER_VARS, $lang, $db, $attach_config; @@ -109,9 +103,9 @@ $gotit = false; - if (!intval($attach_config['allow_ftp_upload'])) + if ( !intval($attach_config['allow_ftp_upload']) ) { - if (@!file_exists(@amod_realpath($filename))) + if ( @!file_exists(@amod_realpath($filename)) ) { message_die(GENERAL_ERROR, $lang['Error_no_attachment'] . "<br /><br /><b>404 File Not Found:</b> The File <i>" . $filename . "</i> does not exist."); } @@ -125,45 +119,46 @@ // Determine the Browser the User is using, because of some nasty incompatibilities. // Most of the methods used in this function are from phpMyAdmin. :) // - if (!empty($_SERVER['HTTP_USER_AGENT'])) + + if ( !empty($_SERVER['HTTP_USER_AGENT']) ) { $HTTP_USER_AGENT = $_SERVER['HTTP_USER_AGENT']; } - else if (!empty($HTTP_SERVER_VARS['HTTP_USER_AGENT'])) + elseif ( !empty($HTTP_SERVER_VARS['HTTP_USER_AGENT']) ) { $HTTP_USER_AGENT = $HTTP_SERVER_VARS['HTTP_USER_AGENT']; } - else if (!isset($HTTP_USER_AGENT)) + elseif ( !isset($HTTP_USER_AGENT) ) { $HTTP_USER_AGENT = ''; } - if (ereg('Opera(/| )([0-9].[0-9]{1,2})', $HTTP_USER_AGENT, $log_version)) + if ( ereg('Opera(/| )([0-9].[0-9]{1,2})', $HTTP_USER_AGENT, $log_version) ) { $browser_version = $log_version[2]; $browser_agent = 'opera'; } - else if (ereg('MSIE ([0-9].[0-9]{1,2})', $HTTP_USER_AGENT, $log_version)) + elseif ( ereg('MSIE ([0-9].[0-9]{1,2})', $HTTP_USER_AGENT, $log_version) ) { $browser_version = $log_version[1]; $browser_agent = 'ie'; } - else if (ereg('OmniWeb/([0-9].[0-9]{1,2})', $HTTP_USER_AGENT, $log_version)) + elseif ( ereg('OmniWeb/([0-9].[0-9]{1,2})', $HTTP_USER_AGENT, $log_version) ) { $browser_version = $log_version[1]; $browser_agent = 'omniweb'; } - else if (ereg('Netscape([0-9]{1})', $HTTP_USER_AGENT, $log_version)) + elseif ( ereg('Netscape([0-9]{1})', $HTTP_USER_AGENT, $log_version) ) { $browser_version = $log_version[1]; $browser_agent = 'netscape'; } - else if (ereg('Mozilla/([0-9].[0-9]{1,2})', $HTTP_USER_AGENT, $log_version)) + elseif ( ereg('Mozilla/([0-9].[0-9]{1,2})', $HTTP_USER_AGENT, $log_version) ) { $browser_version = $log_version[1]; $browser_agent = 'mozilla'; } - else if (ereg('Konqueror/([0-9].[0-9]{1,2})', $HTTP_USER_AGENT, $log_version)) + elseif ( ereg('Konqueror/([0-9].[0-9]{1,2})', $HTTP_USER_AGENT, $log_version) ) { $browser_version = $log_version[1]; $browser_agent = 'konqueror'; @@ -176,38 +171,39 @@ // Correct the mime type - we force application/octetstream for all files, except images // Please do not change this, it is a security precaution + if (!strstr($attachment['mimetype'], 'image')) { $attachment['mimetype'] = ($browser_agent == 'ie' || $browser_agent == 'opera') ? 'application/octetstream' : 'application/octet-stream'; } - // Now the tricky part... let's dance -// @ob_end_clean(); -// @ini_set('zlib.output_compression', 'Off'); header('Pragma: public'); -// header('Content-Transfer-Encoding: none'); $real_filename = html_entity_decode(basename($attachment['real_filename'])); // Send out the Headers + header('Content-Type: ' . $attachment['mimetype'] . '; name="' . $real_filename . '"'); header('Content-Disposition: inline; filename="' . $real_filename . '"'); - unset($real_filename); + unset ($real_filename); // // Now send the File Contents to the Browser // - if ($gotit) + + if ( $gotit ) { $size = @filesize($filename); - if ($size) + + if ( $size ) { header("Content-length: $size"); } + readfile($filename); } - else if (!$gotit && intval($attach_config['allow_ftp_upload'])) + elseif ( !$gotit && intval($attach_config['allow_ftp_upload']) ) { $conn_id = attach_init_ftp(); @@ -219,6 +215,7 @@ @unlink($tmp_filename); $mode = FTP_BINARY; + if ( (preg_match("/text/i", $attachment['mimetype'])) || (preg_match("/html/i", $attachment['mimetype'])) ) { $mode = FTP_ASCII; @@ -226,7 +223,7 @@ $result = @ftp_get($conn_id, $tmp_filename, $filename, $mode); - if (!$result) + if ( !$result ) { message_die(GENERAL_ERROR, $lang['Error_no_attachment'] . "<br /><br /><b>404 File Not Found:</b> The File <i>" . $filename . "</i> does not exist."); } @@ -234,10 +231,12 @@ @ftp_quit($conn_id); $size = @filesize($tmp_filename); - if ($size) + + if ( $size ) { header("Content-length: $size"); } + readfile($tmp_filename); @unlink($tmp_filename); } @@ -258,26 +257,26 @@ $userdata = session_pagestart($user_ip, PAGE_INDEX); init_userprefs($userdata); -if (!$download_id) +if ( !$download_id ) { message_die(GENERAL_ERROR, $lang['No_attachment_selected']); } -if ($attach_config['disable_mod'] && $userdata['user_level'] != ADMIN) +if ( $attach_config['disable_mod'] && $userdata['user_level'] != ADMIN ) { message_die(GENERAL_MESSAGE, $lang['Attachment_feature_disabled']); } $sql = 'SELECT * FROM ' . ATTACHMENTS_DESC_TABLE . ' - WHERE attach_id = ' . (int) $download_id; + WHERE attach_id = ' . (int) $download_id; -if (!($result = $db->sql_query($sql))) +if ( !($result = $db->sql_query($sql)) ) { message_die(GENERAL_ERROR, 'Could not query attachment informations', '', __LINE__, __FILE__, $sql); } -if (!($attachment = $db->sql_fetchrow($result))) +if ( !($attachment = $db->sql_fetchrow($result)) ) { message_die(GENERAL_MESSAGE, $lang['Error_no_attachment']); } @@ -287,13 +286,14 @@ $db->sql_freeresult($result); // get forum_id for attachment authorization or private message authorization -$authorised = false; +$authorised = FALSE; + $sql = 'SELECT * FROM ' . ATTACHMENTS_TABLE . ' - WHERE attach_id = ' . (int) $attachment['attach_id']; + WHERE attach_id = ' . (int) $attachment['attach_id']; -if (!($result = $db->sql_query($sql))) +if ( !($result = $db->sql_query($sql)) ) { message_die(GENERAL_ERROR, 'Could not query attachment informations', '', __LINE__, __FILE__, $sql); } @@ -301,11 +301,11 @@ $auth_pages = $db->sql_fetchrowset($result); $num_auth_pages = $db->sql_numrows($result); -for ($i = 0; $i < $num_auth_pages && $authorised == false; $i++) +for ( $i = 0; $i < $num_auth_pages && $authorised == FALSE; $i++ ) { $auth_pages[$i]['post_id'] = intval($auth_pages[$i]['post_id']); - if ($auth_pages[$i]['post_id'] != 0) + if ( $auth_pages[$i]['post_id'] != 0 ) { $sql = 'SELECT forum_id FROM ' . POSTS_TABLE . ' @@ -323,7 +323,7 @@ $is_auth = array(); $is_auth = auth(AUTH_ALL, $forum_id, $userdata); - if ($is_auth['auth_download']) + if ( $is_auth['auth_download'] ) { $authorised = TRUE; } @@ -338,7 +338,7 @@ } -if (!$authorised) +if ( !$authorised ) { message_die(GENERAL_MESSAGE, $lang['Sorry_auth_view_attach']); } @@ -346,9 +346,10 @@ // // Get Information on currently allowed Extensions // + $sql = "SELECT e.extension, g.download_mode FROM " . EXTENSION_GROUPS_TABLE . " g, " . EXTENSIONS_TABLE . " e - WHERE (g.allow_group = 1) AND (g.group_id = e.group_id)"; + WHERE (g.allow_group = 1) AND (g.group_id = e.group_id)"; if ( !($result = $db->sql_query($sql)) ) { @@ -358,7 +359,7 @@ $rows = $db->sql_fetchrowset($result); $num_rows = $db->sql_numrows($result); -for ($i = 0; $i < $num_rows; $i++) +for ( $i = 0; $i < $num_rows; $i++ ) { $extension = strtolower(trim($rows[$i]['extension'])); $allowed_extensions[] = $extension; @@ -366,47 +367,50 @@ } // disallowed ? -if (!in_array($attachment['extension'], $allowed_extensions) && $userdata['user_level'] != ADMIN) + +if ( !in_array($attachment['extension'], $allowed_extensions) && $userdata['user_level'] != ADMIN ) { message_die(GENERAL_MESSAGE, sprintf($lang['Extension_disabled_after_posting'], $attachment['extension'])); } $download_mode = intval($download_mode[$attachment['extension']]); -if ($thumbnail) +if ( $thumbnail ) { $attachment['physical_filename'] = THUMB_DIR . '/t_' . $attachment['physical_filename']; } // Update download count -if (!$thumbnail) + +if ( !$thumbnail ) { $sql = 'UPDATE ' . ATTACHMENTS_DESC_TABLE . ' - SET download_count = download_count + 1 - WHERE attach_id = ' . (int) $attachment['attach_id']; + SET download_count = download_count + 1 + WHERE attach_id = ' . (int) $attachment['attach_id']; - if (!$db->sql_query($sql)) + if ( !$db->sql_query($sql) ) { message_die(GENERAL_ERROR, 'Couldn\'t update attachment download count', '', __LINE__, __FILE__, $sql); } } // Determine the 'presenting'-method -if ($download_mode == PHYSICAL_LINK) + +if ( $download_mode == PHYSICAL_LINK ) { $server_protocol = ($board_config['cookie_secure']) ? 'https://' : 'http://'; $server_name = preg_replace('/^\/?(.*?)\/?$/', '\1', trim($board_config['server_name'])); $server_port = ($board_config['server_port'] <> 80) ? ':' . trim($board_config['server_port']) : ''; $script_name = preg_replace('/^\/?(.*?)\/?$/', '/\1', trim($board_config['script_path'])); - if ($script_name[strlen($script_name)] != '/') + if ( $script_name[strlen($script_name)] != '/' ) { $script_name .= '/'; } - if (intval($attach_config['allow_ftp_upload'])) + if ( intval($attach_config['allow_ftp_upload']) ) { - if (trim($attach_config['download_path']) == '') + if ( trim($attach_config['download_path']) == '' ) { message_die(GENERAL_ERROR, 'Physical Download not possible with the current Attachment Setting'); } @@ -422,22 +426,26 @@ } // Redirect via an HTML form for PITA webservers - if (@preg_match('/Microsoft|WebSTAR|Xitami/', getenv('SERVER_SOFTWARE'))) + + if ( @preg_match('/Microsoft|WebSTAR|Xitami/', getenv('SERVER_SOFTWARE')) ) { header('Refresh: 0; URL=' . $redirect_path); + echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><meta http-equiv="refresh" content="0; url=' . $redirect_path . '"><title>Redirect</title></head><body><div align="center">If your browser does not support meta redirection please click <a href="' . $redirect_path . '">HERE</a> to be redirected</div></body></html>'; exit; } // Behave as per HTTP/1.1 spec for others + header('Location: ' . $redirect_path); exit; } else { - if (intval($attach_config['allow_ftp_upload'])) + if ( intval($attach_config['allow_ftp_upload']) ) { // We do not need a download path, we are not downloading physically + send_file_to_browser($attachment, ''); exit; } Modified: phpBB Reloaded 2/extension.inc =================================================================== --- phpBB Reloaded 2/extension.inc 2006-06-20 23:05:11 UTC (rev 249) +++ phpBB Reloaded 2/extension.inc 2006-08-12 15:10:37 UTC (rev 250) @@ -1,16 +1,15 @@ <?php -/*************************************************************************** - * extension.inc - * ------------------- - * begin : Saturday, Feb 13, 2001 - * copyright : (C) 2001 The phpBB Group - * email : su...@ph... - * - * $Id: extension.inc,v 1.1.1.1 2006/02/24 02:28:09 markthedaemon Exp $ - * - * - ***************************************************************************/ +/** + * @package core + * @version $ID: Exp$ + * @copyright phpBB Reloaded 2006 + * @license http://opensource.org/licenses/gpl-license.php GNU Public License + */ +/** + * phpBB originally created by phpBB http://www.phpbb.com + */ + if ( !defined('IN_PHPBB') ) { die("Hacking attempt"); Modified: phpBB Reloaded 2/faq.php =================================================================== --- phpBB Reloaded 2/faq.php 2006-06-20 23:05:11 UTC (rev 249) +++ phpBB Reloaded 2/faq.php 2006-08-12 15:10:37 UTC (rev 250) @@ -1,43 +1,27 @@ <?php -/*************************************************************************** - * faq.php - * ------------------- - * begin : Sunday, Jul 8, 2001 - * copyright : (C) 2001 The phpBB Group - * email : su...@ph... - * - * $Id: faq.php,v 1.1.1.1 2006/02/24 02:28:09 markthedaemon Exp $ - * - * - ***************************************************************************/ +/** + * @package core + * @version $ID: Exp$ + * @copyright phpBB Reloaded 2006 + * @license http://opensource.org/licenses/gpl-license.php GNU Public License + */ -/*************************************************************************** - * - * 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. - * - ***************************************************************************/ -/*************************************************************************** - * - * This file has been modified by phpBB Reloaded - (C) 2006 phpBB Reloaded Group - * Support questions placed here: http://www.phpbbreloaded.com - * - * DO NOT EDIT THIS FILE UNLESS YOU KNOW WHAT YOU ARE DOING - * - ***************************************************************************/ +/** + * phpBB originally created by phpBB http://www.phpbb.com + */ define('IN_PHPBB', true); $phpbb_root_path = './'; -include($phpbb_root_path . 'extension.inc'); -include($phpbb_root_path . 'common.'.$phpEx); +include ($phpbb_root_path . 'extension.inc'); +include ($phpbb_root_path . 'common.'.$phpEx); // // Start session management // + $userdata = session_pagestart($user_ip, PAGE_FAQ); init_userprefs($userdata); + // // End session management // @@ -46,22 +30,22 @@ $navigation->add('FAQ', '', 'faq', '', ''); $navigation->display(); - // Set vars to prevent naughtiness + $faq = array(); // // Load the appropriate faq file // -if( isset($HTTP_GET_VARS['mode']) ) +if ( isset($HTTP_GET_VARS['mode']) ) { - switch( $HTTP_GET_VARS['mode'] ) + switch ( $HTTP_GET_VARS['mode'] ) { - case 'bbcode': + case 'bbcode' : $lang_file = 'lang_bbcode'; $l_title = $lang['BBCode_guide']; break; - default: + default : $lang_file = 'lang_faq'; $l_title = $lang['FAQ']; break; @@ -72,27 +56,28 @@ $lang_file = 'lang_faq'; $l_title = $lang['FAQ']; } -include($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/' . $lang_file . '.' . $phpEx); +include ($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/' . $lang_file . '.' . $phpEx); + //attachment stuff! if ( defined('CH_mod_attachmod') ) { attach_faq_include($lang_file); } - // // Pull the array data from the lang pack // + $j = 0; $counter = 0; $counter_2 = 0; $faq_block = array(); $faq_block_titles = array(); -for($i = 0; $i < count($faq); $i++) +for ( $i = 0; $i < count($faq); $i++ ) { - if( $faq[$i][0] != '--' ) + if ( $faq[$i][0] != '--' ) { $faq_block[$j][$counter]['id'] = $counter_2; $faq_block[$j][$counter]['question'] = $faq[$i][0]; @@ -114,12 +99,14 @@ // // Lets build a page ... // + $page_title = $l_title; -include($phpbb_root_path . 'includes/page_header.'.$phpEx); +include ($phpbb_root_path . 'includes/page_header.'.$phpEx ); $template->set_filenames(array( 'body' => 'faq_body.tpl') ); + make_jumpbox('viewforum.'.$phpEx); $template->assign_vars(array( @@ -127,18 +114,19 @@ 'L_BACK_TO_TOP' => $lang['Back_to_top']) ); -for($i = 0; $i < count($faq_block); $i++) +for ( $i = 0; $i < count($faq_block); $i++ ) { - if( count($faq_block[$i]) ) + if ( count($faq_block[$i]) ) { $template->assign_block_vars('faq_block', array( 'BLOCK_TITLE' => $faq_block_titles[$i]) ); + $template->assign_block_vars('faq_block_link', array( 'BLOCK_TITLE' => $faq_block_titles[$i]) ); - for($j = 0; $j < count($faq_block[$i]); $j++) + for ( $j = 0; $j < count($faq_block[$i]); $j++ ) { $row_color = ( !($j % 2) ) ? $theme['td_color1'] : $theme['td_color2']; $row_class = ( !($j % 2) ) ? $theme['td_class1'] : $theme['td_class2']; @@ -163,13 +151,11 @@ )); $template->set_switch('faq_block.faq_row.light', !($j % 2)); $template->set_switch('faq_block_link.faq_row_link.light', !($j % 2)); -//-- fin mod : categories hierarchy -------------------------------------------- } } } $template->pparse('body'); -include($phpbb_root_path . 'includes/page_tail.'.$phpEx); - +include ($phpbb_root_path . 'includes/page_tail.'.$phpEx); ?> \ No newline at end of file Modified: phpBB Reloaded 2/groupcp.php =================================================================== --- phpBB Reloaded 2/groupcp.php 2006-06-20 23:05:11 UTC (rev 249) +++ phpBB Reloaded 2/groupcp.php 2006-08-12 15:10:37 UTC (rev 250) @@ -1,34 +1,21 @@ <?php -//-- mod : group moderatorZ ------------------------------------------------------------------------ -//-- mod : categories hierarchy ------------------------------------------------ -/*************************************************************************** - * groupcp.php - * ------------------- - * begin : Saturday, Feb 13, 2001 - * copyright : (C) 2001 The phpBB Group - * email : su...@ph... - * - * $Id: groupcp.php,v 1.2 2006/02/27 03:45:02 scioncrow Exp $ - * - * - ***************************************************************************/ +/** + * @package core + * @version $ID: Exp$ + * @copyright phpBB Reloaded 2006 + * @license http://opensource.org/licenses/gpl-license.php GNU Public License + */ -/*************************************************************************** - * - * 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. - * - ***************************************************************************/ +/** + * phpBB originally created by phpBB http://www.phpbb.com + */ -define('IN_PHPBB', true); +define('IN_PHPBB', TRUE); $phpbb_root_path = './'; -include($phpbb_root_path . 'extension.inc'); -include($phpbb_root_path . 'common.'.$phpEx); +include ($phpbb_root_path . 'extension.inc'); +include ($phpbb_root_path . 'common.'.$phpEx); -// ------------------------- -// + function generate_user_info(&$row, $date_format, $group_mod, &$from, &$posts, &$joined, &$poster_avatar, &$profile_img, &$profile, &$search_img, &$search, &$pm_img, &$pm, &$email_img, &$email, &$www_img, &$www, &$icq_status_img, &$icq_img, &$icq, &$aim_img, &$aim, &$msn_img, &$msn, &$yim_img, &$yim) { global $lang, $images, $board_config, $phpEx; @@ -38,9 +25,10 @@ $posts = ( $row['user_posts'] ) ? $row['user_posts'] : 0; $poster_avatar = ''; + if ( $row['user_avatar_type'] && $row['user_id'] != ANONYMOUS && $row['user_allowavatar'] ) { - switch( $row['user_avatar_type'] ) + switch ( $row['user_avatar_type'] ) { case USER_AVATAR_UPLOAD: $poster_avatar = ( $board_config['allow_avatar_upload'] ) ? '<img src="' . $board_config['avatar_path'] . '/' . $row['user_avatar'] . '" alt="" border="0" />' : ''; @@ -107,55 +95,61 @@ return; } -// -// -------------------------- // // Start session management // + $userdata = session_pagestart($user_ip, PAGE_GROUPCP); init_userprefs($userdata); + // // End session management // -//-- mod : categories hierarchy ------------------------------------------------ -//-- add $navigation = new navigation(); $navigation->add('Usergroups', '', 'groupcp', '', ''); $navigation->display(); // read forums and auths for the jumpbox -include($config->url('includes/class_forums')); + +include ($config->url('includes/class_forums')); $forums = new forums(); $forums->read(); $user->get_cache(array(POST_GROUPS_URL, POST_FORUM_URL, POST_FORUM_URL . 'jbox')); $user_groups_list = $user->get_groups_list(); // auth -$auth_manage = false; -$auth_membership = false; +$auth_manage = FALSE; +$auth_membership = FALSE; + // level + $is_founder = $user->data['session_logged_in'] && in_array(GROUP_FOUNDER, $user_groups_list); $is_admin = $user->data['session_logged_in'] && in_array(GROUP_ADMIN, $user_groups_list); -$is_owner = false; +$is_owner = FALSE; // read group + $group_id = _read(POST_GROUPS_URL, TYPE_INT); + if ( $group_id == GROUP_REGISTERED ) { message_return('Not_Authorised'); } + $group_status = GROUP_STANDARD; $group_row = array(); + if ( !empty($group_id) ) { $sql = 'SELECT * FROM ' . GROUPS_TABLE . ' WHERE group_id = ' . intval($group_id) . ' - AND group_single_user <> ' . true; + AND group_single_user <> ' . TRUE; $result = $db->sql_query($sql, false, __LINE__, __FILE__); + if ( $group_row = $db->sql_fetchrow($result) ) { $group_status = intval($group_row['group_status']); @@ -163,68 +157,40 @@ $group_row['group_description'] = ($group_status >= GROUP_SYSTEM) ? $user->lang($group_row['group_description']) : $group_row['group_description']; $is_owner = $user->data['session_logged_in'] && (intval($group_row['group_moderator']) == $user->data['user_id']); -//-- mod : group moderatorZ ------------------------------------------------------------------------ $sql = "SELECT * FROM " . USER_GROUP_TABLE . " WHERE group_moderator = 1 AND group_id = $group_id"; - $result = $db->sql_query($sql, false, __LINE__, __FILE__); + $result = $db->sql_query($sql, FALSE, __LINE__, __FILE__); $modZ_row = array(); $is_modZ = FALSE; - while ( ( $modZ_row = $db->sql_fetchrow($result) ) AND ( $is_modZ == FALSE ) ) + + while ( ($modZ_row = $db->sql_fetchrow($result) ) && ($is_modZ == FALSE) ) { $is_modZ = $user->data['session_logged_in'] && (intval($modZ_row['user_id']) == $user->data['user_id']); } -//-- mod : group moderatorZ - dynamic adaptation --------------------------------------------------- + // check auths + $is_auth_owner = $user->auth(POST_GROUPS_URL, 'ucp_auth_owner', $group_id); $is_auth_mod = $user->auth(POST_GROUPS_URL, 'ucp_auth_mod', $group_id); -//-- fin mod : group moderatorZ - dynamic adaptation ----------------------------------------------- -//-- fin mod : group moderatorZ -------------------------------------------------------------------- } } + switch ( $group_id ) { -//-- mod : group moderatorZ ------------------------------------------------------------------------ -// here we added -// || $is_modZ 3 times. -// ( " || $is_auth_owner" and " || $is_auth_mod" for dynamic adaptation) -// -// *** Modding Help -// * Grouplevel -// GROUP_FOUNDER = This apply's to the usergroup that acts as founder -// GROUP_ADMIN = This apply's to the usergroup that acts as admin -// default = This is any outher group. -// * Authority -// $auth_manage = who an act as owner in groups (he has to be in $auth_mebership as well) -// $auth_membership = who can act as moderator in groups -// * Userlevel -// $is_owner = user that is owner oft that group -// $is_founder = user that has founder status -// $is_admin = user that has admin status -// $is_modZ = user that is appointed moderator of that particular group -// $is_auth_owner = user that is given owner acces in the ACP -// $is_auth_mod = user that is given moderator acces in the ACP -// *** End Help -// -// ***Advice: Remove " || $is_admin" from the default if you want that admins can not manage all default groups -// and only can manage those groups set by the founder in the ACP -// -//--modify - case GROUP_FOUNDER: + case GROUP_FOUNDER : $auth_manage = $is_owner; $auth_membership = $is_owner || $is_modZ; break; - case GROUP_ADMIN: + case GROUP_ADMIN : $auth_manage = $is_founder; $auth_membership = $is_owner || $is_founder || $is_modZ; break; - default: + default : $auth_manage = $is_owner || $is_founder || $is_admin; $auth_membership = $is_owner || $is_founder || $is_admin || $is_modZ; break; -//-- fin mod : group moderatorZ -------------------------------------------------------------------- } -//-- fin mod : categories hierarchy -------------------------------------------- $script_name = preg_replace('/^\/?(.*?)\/?$/', "\\1", trim($board_config['script_path'])); $script_name = ( $script_name != '' ) ? $script_name . '/groupcp.'.$phpEx : 'groupcp.'.$phpEx; @@ -261,63 +227,43 @@ // // Default var values // + $is_moderator = FALSE; -//-- mod : Advanced Group Color Management ------------------------------------- -//-- add $colors->read_group_users($group_id); -//-- fin mod : Advanced Group Color Management --------------------------------- - if ( isset($HTTP_POST_VARS['groupstatus']) && $group_id ) { if ( !$userdata['session_logged_in'] ) { - redirect(append_sid("login.$phpEx?redirect=groupcp.$phpEx&" . POST_GROUPS_URL . "=$group_id", true)); + redirect(append_sid("login.$phpEx?redirect=groupcp.$phpEx&" . POST_GROUPS_URL . "=$group_id", TRUE)); } -//-- mod : categories hierarchy ------------------------------------------------ -//-- delete -/* - $sql = "SELECT group_moderator - FROM " . GROUPS_TABLE . " - WHERE group_id = $group_id"; - if ( !($result = $db->sql_query($sql)) ) - { - message_die(GENERAL_ERROR, 'Could not obtain user and group information', '', __LINE__, __FILE__, $sql); - } - - $row = $db->sql_fetchrow($result); -*/ -//-- add // get the group + $row = $group_row; $group_type = _read('group_type', TYPE_INT); + if ( !$auth_membership ) { _error('Not_group_moderator'); } - else if ( ($group_status >= GROUP_SYSTEM) && ($group_type < GROUP_CLOSED) ) + elseif ( ($group_status >= GROUP_SYSTEM) && ($group_type < GROUP_CLOSED) ) { _error('Change_sysgroup_type_denied'); } - else if ( ($group_type != $row['group_type']) && !$auth_manage ) + elseif ( ($group_type != $row['group_type']) && !$auth_manage ) { _error('Manage_group_denied'); } + if ( $error ) { $l_link = 'Click_return_group'; - $u_link = $config->url('groupcp', array(POST_GROUPS_URL => intval($group_id)), true); + $u_link = $config->url('groupcp', array(POST_GROUPS_URL => intval($group_id)), TRUE); message_return($error_msg, $l_link, $u_link); } -//-- fin mod : categories hierarchy -------------------------------------------- -//-- mod : group moderatorZ ------------------------------------------------------------------------ -//-- delete -// if ( $row['group_moderator'] != $userdata['user_id'] && $userdata['user_level'] != ADMIN ) -//-- add - if ( !$auth_manage ) -//-- fin mod : group moderatorZ -------------------------------------------------------------------- + if ( !$auth_manage ) { $template->assign_vars(array( 'META' => '<meta http-equiv="refresh" content="3;url=' . append_sid("index.$phpEx") . '">') @@ -331,6 +277,7 @@ $sql = "UPDATE " . GROUPS_TABLE . " SET group_type = " . intval($HTTP_POST_VARS['group_type']) . " WHERE group_id = $group_id"; + if ( !($result = $db->sql_query($sql)) ) { message_die(GENERAL_ERROR, 'Could not obtain user and group information', '', __LINE__, __FILE__, $sql); @@ -345,12 +292,13 @@ message_die(GENERAL_MESSAGE, $message); } -else if ( isset($HTTP_POST_VARS['joingroup']) && $group_id ) +elseif ( isset($HTTP_POST_VARS['joingroup']) && $group_id ) { // // First, joining a group // If the user isn't logged in redirect them to login // + if ( !$userdata['session_logged_in'] ) { redirect(append_sid("login.$phpEx?redirect=groupcp.$phpEx&" . POST_GROUPS_URL . "=$group_id", true)); @@ -358,15 +306,16 @@ $sql = "SELECT ug.user_id, g.group_type FROM " . USER_GROUP_TABLE . " ug, " . GROUPS_TABLE . " g - WHERE g.group_id = $group_id - AND g.group_type <> " . GROUP_HIDDEN . " - AND ug.group_id = g.group_id"; + WHERE g.group_id = $group_id + AND g.group_type <> " . GROUP_HIDDEN . " + AND ug.group_id = g.group_id"; + if ( !($result = $db->sql_query($sql)) ) { message_die(GENERAL_ERROR, 'Could not obtain user and group information', '', __LINE__, __FILE__, $sql); } - if ( $row = $db->sql_fetchrow($result) ) + if ( $row = $db->sql_fetchrow($result) ) { if ( $row['group_type'] == GROUP_OPEN ) { @@ -382,7 +331,8 @@ message_die(GENERAL_MESSAGE, $message); } - } while ( $row = $db->sql_fetchrow($result) ); + } + while ( $row = $db->sql_fetchrow($result) ); } else { @@ -402,64 +352,45 @@ $sql = "INSERT INTO " . USER_GROUP_TABLE . " (group_id, user_id, user_pending) VALUES ($group_id, " . $userdata['user_id'] . ", 1)"; + if ( !($result = $db->sql_query($sql)) ) { message_die(GENERAL_ERROR, "Error inserting user group subscription", "", __LINE__, __FILE__, $sql); } -//-- mod : group moderatorZ ------------------------------------------------------------------------ -// here we added -// include($phpbb_root_path . 'includes/emailer.'.$phpEx); -// and -// , " . USER_GROUP_TABLE . " ug -// and -// , ( [../..] OR ug.group_moderator = 1 ) -// and -// AND u.user_id = ug.user_id AND ug.group_id = g.group_id -//-- modify - include($phpbb_root_path . 'includes/emailer.'.$phpEx); + include ($phpbb_root_path . 'includes/emailer.'.$phpEx); + $sql = "SELECT u.user_email, u.username, u.user_lang, g.group_name FROM ".USERS_TABLE . " u, " . USER_GROUP_TABLE . " ug, " . GROUPS_TABLE . " g WHERE ( u.user_id = g.group_moderator OR ug.group_moderator = 1 ) AND g.group_id = $group_id AND u.user_id = ug.user_id AND ug.group_id = g.group_id"; -//-- fin mod : group moderatorZ -------------------------------------------------------------------- + if ( !($result = $db->sql_query($sql)) ) { message_die(GENERAL_ERROR, "Error getting group moderator data", "", __LINE__, __FILE__, $sql); } -//-- mod : group moderatorZ ------------------------------------------------------------------------ -//-- delete -// $moderator = $db->sql_fetchrow($result); -// -// include($phpbb_root_path . 'includes/emailer.'.$phpEx); -//-- add - while ($moderator = $db->sql_fetchrow($result)) + while ( $moderator = $db->sql_fetchrow($result) ) { -//-- fin mod : group moderatorZ -------------------------------------------------------------------- - $emailer = new emailer($board_config['smtp_delivery']); + $emailer = new emailer($board_config['smtp_delivery']); - $emailer->from($board_config['board_email']); - $emailer->replyto($board_config['board_email']); + $emailer->from($board_config['board_email']); + $emailer->replyto($board_config['board_email']); - $emailer->use_template('group_request', $moderator['user_lang']); - $emailer->email_address($moderator['user_email']); - $emailer->set_subject($lang['Group_request']); + $emailer->use_template('group_request', $moderator['user_lang']); + $emailer->email_address($moderator['user_email']); + $emailer->set_subject($lang['Group_request']); - $emailer->assign_vars(array( - 'SITENAME' => $board_config['sitename'], - 'GROUP_MODERATOR' => $moderator['username'], - 'EMAIL_SIG' => (!empty($board_config['board_email_sig'])) ? str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']) : '', + $emailer->assign_vars(array( + 'SITENAME' => $board_config['sitename'], + 'GROUP_MODERATOR' => $moderator['username'], + 'EMAIL_SIG' => (!empty($board_config['board_email_sig'])) ? str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']) : '', - 'U_GROUPCP' => $server_url . '?' . POST_GROUPS_URL . "=$group_id&validate=true") - ); - $emailer->send(); - $emailer->reset(); - -//-- mod : group moderatorZ ------------------------------------------------------------------------ -//-- add + 'U_GROUPCP' => $server_url . '?' . POST_GROUPS_URL . "=$group_id&validate=true") + ); + $emailer->send(); + $emailer->reset(); } -//-- fin mod : group moderatorZ -------------------------------------------------------------------- $template->assign_vars(array( 'META' => '<meta http-equiv="refresh" content="3;url=' . append_sid("index.$phpEx") . '">') @@ -469,19 +400,20 @@ message_die(GENERAL_MESSAGE, $message); } -else if ( isset($HTTP_POST_VARS['unsub']) || isset($HTTP_POST_VARS['unsubpending']) && $group_id ) +elseif ( isset($HTTP_POST_VARS['unsub']) || isset($HTTP_POST_VARS['unsubpending']) && $group_id ) { // // Second, unsubscribing from a group // Check for confirmation of unsub. // + if ( $cancel ) { - redirect(append_sid("groupcp.$phpEx", true)); + redirect(append_sid("groupcp.$phpEx", TRUE)); } elseif ( !$userdata['session_logged_in'] ) { - redirect(append_sid("login.$phpEx?redirect=groupcp.$phpEx&" . POST_GROUPS_URL . "=$group_id", true)); + redirect(append_sid("login.$phpEx?redirect=groupcp.$phpEx&" . POST_GROUPS_URL . "=$group_id", TRUE)); } if ( $confirm ) @@ -494,63 +426,27 @@ message_die(GENERAL_ERROR, 'Could not delete group memebership data', '', __LINE__, __FILE__, $sql); } -//-- mod : categories hierarchy ------------------------------------------------ -//-- delete -/* - if ( $userdata['user_level'] != ADMIN && $userdata['user_level'] == MOD ) - { - $sql = "SELECT COUNT(auth_mod) AS is_auth_mod - FROM " . AUTH_ACCESS_TABLE . " aa, " . USER_GROUP_TABLE . " ug - WHERE ug.user_id = " . $userdata['user_id'] . " - AND aa.group_id = ug.group_id - AND aa.auth_mod = 1"; - if ( !($result = $db->sql_query($sql)) ) - { - message_die(GENERAL_ERROR, 'Could not obtain moderator status', '', __LINE__, __FILE__, $sql); - } - - ... [truncated message content] |