aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/includes')
-rw-r--r--phpBB/includes/auth.php79
-rw-r--r--phpBB/includes/bbcode.php9
-rw-r--r--phpBB/includes/constants.php9
-rw-r--r--phpBB/includes/db.php31
-rwxr-xr-xphpBB/includes/emailer.php9
-rw-r--r--phpBB/includes/functions.php49
-rw-r--r--phpBB/includes/message.php39
-rw-r--r--phpBB/includes/page_header.php49
-rw-r--r--phpBB/includes/page_tail.php25
-rw-r--r--phpBB/includes/post.php31
-rw-r--r--phpBB/includes/prune.php57
-rw-r--r--phpBB/includes/sessions.php9
-rw-r--r--phpBB/includes/smtp.php33
-rw-r--r--phpBB/includes/template.php191
14 files changed, 368 insertions, 252 deletions
diff --git a/phpBB/includes/auth.php b/phpBB/includes/auth.php
index 8da22c1671..575574f9e1 100644
--- a/phpBB/includes/auth.php
+++ b/phpBB/includes/auth.php
@@ -1,19 +1,28 @@
<?php
-/***************************************************************************
+/***************************************************************************
* auth.php
- * -------------------
- * begin : Saturday, Feb 13, 2001
- * copyright : (C) 2001 The phpBB Group
- * email : support@phpbb.com
- *
- * $Id$
- *
- *
- ***************************************************************************/
+ * -------------------
+ * begin : Saturday, Feb 13, 2001
+ * copyright : (C) 2001 The phpBB Group
+ * email : support@phpbb.com
+ *
+ * $Id$
+ *
+ *
+ ***************************************************************************/
+
+/***************************************************************************
+ *
+ * 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.
+ *
+ ***************************************************************************/
/*
$type's accepted (pre-pend with AUTH_):
- VIEW, READ, POST, REPLY, EDIT, DELETE, STICKY, ANNOUNCE, VOTE, VOTECREATE,
+ VIEW, READ, POST, REPLY, EDIT, DELETE, STICKY, ANNOUNCE, VOTE, VOTECREATE,
ATTACH
$types pending (for future versions, pre-pend with AUTH_):
@@ -21,7 +30,7 @@
Possible options ($type/forum_id combinations):
- * If you include a type and forum_id then a specific lookup will be done and
+ * If you include a type and forum_id then a specific lookup will be done and
the single result returned
* If you set type to AUTH_ALL and specify a forum_id an array of all auth types
@@ -30,8 +39,8 @@
* If you provide a forum_id a specific lookup on that forum will be done
* If you set forum_id to AUTH_LIST_ALL and specify a type an array listing the
- results for all forums will be returned
-
+ results for all forums will be returned
+
* If you set forum_id to AUTH_LIST_ALL and type to AUTH_ALL a multidimensional
array containing the auth permissions for all types and all forums for that
user is returned
@@ -115,8 +124,8 @@ function auth($type, $forum_id, $userdata, $f_access = -1)
{
$forum_match_sql = ($forum_id != AUTH_LIST_ALL) ? "WHERE a.forum_id = $forum_id" : "";
- $sql = "SELECT a.forum_id, $a_sql
- FROM " . FORUMS_TABLE . " a
+ $sql = "SELECT a.forum_id, $a_sql
+ FROM " . FORUMS_TABLE . " a
$forum_match_sql";
$af_result = $db->sql_query($sql);
@@ -148,23 +157,23 @@ function auth($type, $forum_id, $userdata, $f_access = -1)
{
$forum_match_sql = ($forum_id != AUTH_LIST_ALL) ? "AND a.forum_id = $forum_id" : "";
-/* $sql = "SELECT au.forum_id, $a_sql, au.auth_mod, g.group_single_user
- FROM " . AUTH_ACCESS_TABLE . " au, " . USER_GROUP_TABLE . " ug, " . GROUPS_TABLE. " g
- WHERE ug.user_id = " . $userdata['user_id'] . "
- AND g.group_id = ug.group_id
- AND (
- ( au.user_id = ug.user_id
- AND g.group_id = 0 )
- OR
+/* $sql = "SELECT au.forum_id, $a_sql, au.auth_mod, g.group_single_user
+ FROM " . AUTH_ACCESS_TABLE . " au, " . USER_GROUP_TABLE . " ug, " . GROUPS_TABLE. " g
+ WHERE ug.user_id = " . $userdata['user_id'] . "
+ AND g.group_id = ug.group_id
+ AND (
+ ( au.user_id = ug.user_id
+ AND g.group_id = 0 )
+ OR
( au.group_id = ug.group_id
AND g.group_id <> 0 )
)
$forum_match_sql";*/
- $sql = "SELECT a.forum_id, $a_sql, a.auth_mod, g.group_single_user
- FROM " . AUTH_ACCESS_TABLE . " a, " . USER_GROUP_TABLE . " ug, " . GROUPS_TABLE . " g
- WHERE ug.user_id = ".$userdata['user_id']. "
- AND g.group_id = ug.group_id
- AND a.group_id = ug.group_id
+ $sql = "SELECT a.forum_id, $a_sql, a.auth_mod, g.group_single_user
+ FROM " . AUTH_ACCESS_TABLE . " a, " . USER_GROUP_TABLE . " ug, " . GROUPS_TABLE . " g
+ WHERE ug.user_id = ".$userdata['user_id']. "
+ AND g.group_id = ug.group_id
+ AND a.group_id = ug.group_id
$forum_match_sql";
$a_result = $db->sql_query($sql);
if(!$a_result)
@@ -239,12 +248,12 @@ function auth($type, $forum_id, $userdata, $f_access = -1)
$auth_user[$key] = ( $userdata['session_logged_in'] ) ? auth_check_user(AUTH_ACL, $key, $u_access, $is_admin) : 0;
$auth_user[$key . '_type'] = $lang['Users_granted_access'];
break;
-
+
case AUTH_MOD:
$auth_user[$key] = ( $userdata['session_logged_in'] ) ? auth_check_user(AUTH_MOD, 'auth_mod', $u_access, $is_admin) : 0;
$auth_user[$key . '_type'] = $lang['Moderators'];
break;
-
+
case AUTH_ADMIN:
$auth_user[$key] = $is_admin;
$auth_user[$key . '_type'] = $lang['Administrators'];
@@ -278,12 +287,12 @@ function auth($type, $forum_id, $userdata, $f_access = -1)
$auth_user[$f_forum_id][$key] = ( $userdata['session_logged_in'] ) ? auth_check_user(AUTH_ACL, $key, $u_access[$f_forum_id], $is_admin) : 0;
$auth_user[$f_forum_id][$key . '_type'] = $lang['Users_granted_access'];
break;
-
+
case AUTH_MOD:
$auth_user[$f_forum_id][$key] = ( $userdata['session_logged_in'] ) ? auth_check_user(AUTH_MOD, 'auth_mod', $u_access[$f_forum_id], $is_admin) : 0;
$auth_user[$f_forum_id][$key . '_type'] = $lang['Moderators'];
break;
-
+
case AUTH_ADMIN:
$auth_user[$f_forum_id][$key] = $is_admin;
$auth_user[$f_forum_id][$key . '_type'] = $lang['Administrators'];
@@ -329,7 +338,7 @@ function auth_check_user($type, $key, $u_access, $is_admin)
if(!$single_user)
{
$single_user = $u_access[$j]['group_single_user'];
-
+
$result = 0;
switch($type)
{
@@ -353,7 +362,7 @@ function auth_check_user($type, $key, $u_access, $is_admin)
{
$auth_user = $is_admin;
}
-
+
return $auth_user;
}
diff --git a/phpBB/includes/bbcode.php b/phpBB/includes/bbcode.php
index 03e0f0fab4..45c6774d6c 100644
--- a/phpBB/includes/bbcode.php
+++ b/phpBB/includes/bbcode.php
@@ -10,6 +10,15 @@
*
***************************************************************************/
+/***************************************************************************
+ *
+ * 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("BBCODE_UID_LEN", 10);
/**
diff --git a/phpBB/includes/constants.php b/phpBB/includes/constants.php
index 3a6d881b38..9124fcdd47 100644
--- a/phpBB/includes/constants.php
+++ b/phpBB/includes/constants.php
@@ -11,6 +11,15 @@
*
***************************************************************************/
+/***************************************************************************
+ *
+ * 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.
+ *
+ ***************************************************************************/
+
//
// Constants
//
diff --git a/phpBB/includes/db.php b/phpBB/includes/db.php
index dba00ce7ef..1e885d56fa 100644
--- a/phpBB/includes/db.php
+++ b/phpBB/includes/db.php
@@ -1,15 +1,24 @@
<?php
-/***************************************************************************
+/***************************************************************************
* db.php
- * -------------------
- * begin : Saturday, Feb 13, 2001
- * copyright : (C) 2001 The phpBB Group
- * email : support@phpbb.com
- *
- * $Id$
- *
- *
- ***************************************************************************/
+ * -------------------
+ * begin : Saturday, Feb 13, 2001
+ * copyright : (C) 2001 The phpBB Group
+ * email : support@phpbb.com
+ *
+ * $Id$
+ *
+ *
+ ***************************************************************************/
+
+/***************************************************************************
+ *
+ * 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.
+ *
+ ***************************************************************************/
switch($dbms)
{
@@ -36,7 +45,7 @@ switch($dbms)
// Make the database connection.
$db = new sql_db($dbhost, $dbuser, $dbpasswd, $dbname, false);
-if(!$db->db_connect_id)
+if(!$db->db_connect_id)
{
message_die(CRITICAL_ERROR, "Could not connect to the database");
}
diff --git a/phpBB/includes/emailer.php b/phpBB/includes/emailer.php
index 6859f33bb2..b739a71a4d 100755
--- a/phpBB/includes/emailer.php
+++ b/phpBB/includes/emailer.php
@@ -10,6 +10,15 @@
***************************************************************************/
+/***************************************************************************
+ *
+ * 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.
+ *
+ ***************************************************************************/
+
//
// The emailer class has support for attaching files, that isn't implemented
// in the 2.0 release but we can probable find some way of using it in a future
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index 1245e9f311..1b47e1a8f3 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -11,7 +11,6 @@
*
***************************************************************************/
-
/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
@@ -184,8 +183,8 @@ function make_jumpbox()
function make_forum_box($box_name, $default_forum = -1)
{
- global $db;
-
+ global $db;
+
$limit_forums = "";
$sql = "SELECT forum_id, forum_name
@@ -218,7 +217,7 @@ function make_forum_box($box_name, $default_forum = -1)
}
return($boxstring);
-}
+}
//
// Initialise user settings on page load
function init_userprefs($userdata)
@@ -461,7 +460,7 @@ function generate_pagination($base_url, $num_items, $per_page, $start_item, $add
function validate_email($email)
{
global $db;
-
+
if($email != "")
{
$sql = "SELECT ban_email
@@ -480,7 +479,7 @@ function validate_email($email)
}
}
$sql = "SELECT user_email
- FROM " . USERS_TABLE . "
+ FROM " . USERS_TABLE . "
WHERE user_email = '" . $email . "'";
if(!$result = $db->sql_query($sql))
{
@@ -516,10 +515,10 @@ function validate_username($username)
// So we have to use two queries
case 'mysql':
$sql_users = "SELECT u.username, g.group_name
- FROM " . USERS_TABLE . " u, " . GROUPS_TABLE . " g, " . USER_GROUP_TABLE . " ug
- WHERE ug.user_id = u.user_id
- AND g.group_id = ug.group_id
- AND ( LOWER(u.username) = '" . strtolower($username) . "'
+ FROM " . USERS_TABLE . " u, " . GROUPS_TABLE . " g, " . USER_GROUP_TABLE . " ug
+ WHERE ug.user_id = u.user_id
+ AND g.group_id = ug.group_id
+ AND ( LOWER(u.username) = '" . strtolower($username) . "'
OR LOWER(g.group_name) = '" . strtolower($username) . "' )";
$sql_disallow = "SELECT disallow_username
FROM " . DISALLOW_TABLE . "
@@ -542,12 +541,12 @@ function validate_username($username)
default:
$sql = "SELECT u.username, g.group_name
- FROM " . USERS_TABLE . " u, " . GROUPS_TABLE . " g, " . USER_GROUP_TABLE . " ug
- WHERE ug.user_id = u.user_id
- AND g.group_id = ug.group_id
- AND ( LOWER(u.username) = '" . strtolower($username) . "'
+ FROM " . USERS_TABLE . " u, " . GROUPS_TABLE . " g, " . USER_GROUP_TABLE . " ug
+ WHERE ug.user_id = u.user_id
+ AND g.group_id = ug.group_id
+ AND ( LOWER(u.username) = '" . strtolower($username) . "'
OR LOWER(g.group_name) = '" . strtolower($username) . "' )
- UNION
+ UNION
SELECT disallow_username, NULL
FROM " . DISALLOW_TABLE . "
WHERE disallow_username = '$username'";
@@ -565,11 +564,11 @@ function validate_username($username)
}
-function sync($type, $id)
+function sync($type, $id)
{
global $db;
-
- switch($type)
+
+ switch($type)
{
case 'forum':
$sql = "SELECT max(p.post_id) AS last_post FROM ".POSTS_TABLE." p, ".TOPICS_TABLE." t WHERE p.forum_id = $id AND p.topic_id = t.topic_id AND t.topic_status <> ".TOPIC_MOVED;
@@ -585,7 +584,7 @@ function sync($type, $id)
{
$last_post = 0;
}
-
+
$sql = "SELECT count(post_id) AS total FROM ".POSTS_TABLE." WHERE forum_id = $id";
if(!$result = $db->sql_query($sql))
{
@@ -595,7 +594,7 @@ function sync($type, $id)
{
$total_posts = $rowset[0]['total'];
}
-
+
$sql = "SELECT count(topic_id) AS total FROM ".TOPICS_TABLE." WHERE forum_id = $id";
if(!$result = $db->sql_query($sql, $db))
{
@@ -605,7 +604,7 @@ function sync($type, $id)
{
$total_topics = $rowset[0]['total'];
}
-
+
$sql = "UPDATE ".FORUMS_TABLE." SET forum_last_post_id = '$last_post', forum_posts = $total_posts, forum_topics = $total_topics WHERE forum_id = $id";
if(!$result = $db->sql_query($sql))
{
@@ -623,7 +622,7 @@ function sync($type, $id)
{
$last_post = $row[0]["last_post"];
}
-
+
$sql = "SELECT count(post_id) AS total FROM ".POSTS_TABLE." WHERE topic_id = $id";
if(!$result = $db->sql_query($sql))
{
@@ -729,7 +728,7 @@ function theme_select($default)
global $db, $board_config, $lang;
$sql = "SELECT themes_id, themes_name
- FROM " . THEMES_TABLE . "
+ FROM " . THEMES_TABLE . "
WHERE themes_name LIKE '" . $board_config['default_template'] . "-%'
ORDER BY themes_name";
if($result = $db->sql_query($sql))
@@ -756,7 +755,7 @@ function theme_select($default)
}
else
{
- $theme_select = "<select name=\"theme\"><option value=\"-1\">" . $lang['No_themes'] . "</option></select>";
+ $theme_select = "<select name=\"theme\"><option value=\"-1\">" . $lang['No_themes'] . "</option></select>";
}
}
else
@@ -832,7 +831,7 @@ function smilies_pass($message)
if(empty($smilies))
{
- $sql = "SELECT code, smile_url
+ $sql = "SELECT code, smile_url
FROM " . SMILIES_TABLE;
if($result = $db->sql_query($sql))
{
diff --git a/phpBB/includes/message.php b/phpBB/includes/message.php
index 3ede14e842..856b9e706d 100644
--- a/phpBB/includes/message.php
+++ b/phpBB/includes/message.php
@@ -1,20 +1,29 @@
<?php
-/***************************************************************************
+/***************************************************************************
* message.php
- * -------------------
- * begin : Saturday, Feb 13, 2001
- * copyright : (C) 2001 The phpBB Group
- * email : support@phpbb.com
- *
- * $Id$
- *
- *
- ***************************************************************************/
+ * -------------------
+ * begin : Saturday, Feb 13, 2001
+ * copyright : (C) 2001 The phpBB Group
+ * email : support@phpbb.com
+ *
+ * $Id$
+ *
+ *
+ ***************************************************************************/
+
+/***************************************************************************
+ *
+ * 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 function gets called to output any message or error
-// that doesn't require additional output from the calling
-// page.
+// that doesn't require additional output from the calling
+// page.
//
// $msg_code takes one of four constant values:
//
@@ -31,12 +40,12 @@
// board configuration data is available
//
// CRITICAL_ERROR -> Used whenever a DB connection cannot be
-// guaranteed and/or we've been unable to obtain basic board
+// guaranteed and/or we've been unable to obtain basic board
// configuration data. Shouldn't be used in general
-// pages/functions (it results in a simple echo'd statement,
+// pages/functions (it results in a simple echo'd statement,
// no templates are used)
//
-function message_die($msg_code, $msg_text = "", $msg_title = "", $err_line = "", $err_file = "", $sql = "")
+function message_die($msg_code, $msg_text = "", $msg_title = "", $err_line = "", $err_file = "", $sql = "")
{
global $db, $template, $board_config, $theme, $lang, $phpEx, $phpbb_root_path;
global $userdata, $user_ip, $session_length;
diff --git a/phpBB/includes/page_header.php b/phpBB/includes/page_header.php
index 5bc749cdd7..b28d84fca2 100644
--- a/phpBB/includes/page_header.php
+++ b/phpBB/includes/page_header.php
@@ -11,6 +11,15 @@
*
***************************************************************************/
+/***************************************************************************
+ *
+ * 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(HEADER_INC, TRUE);
//
@@ -31,14 +40,14 @@ if($board_config['gzip_compress'])
else if($phpver > "4.0")
{
if(strstr($HTTP_SERVER_VARS['HTTP_ACCEPT_ENCODING'], 'gzip'))
- {
+ {
if(extension_loaded("zlib"))
{
$do_gzip_compress = TRUE;
ob_start();
- ob_implicit_flush(0);
+ ob_implicit_flush(0);
- header("Content-Encoding: gzip");
+ header("Content-Encoding: gzip");
}
}
}
@@ -71,7 +80,7 @@ $s_last_visit = create_date($board_config['default_dateformat'], $userdata['sess
// Get basic (usernames + totals) online
// situation
//
-$sql = "SELECT u.username, u.user_id, u.user_allow_viewonline, s.session_logged_in, s.session_ip
+$sql = "SELECT u.username, u.user_id, u.user_allow_viewonline, s.session_logged_in, s.session_ip
FROM ".USERS_TABLE." u, ".SESSIONS_TABLE." s
WHERE u.user_id = s.session_user_id
AND s.session_time >= ".( time() - 300 );
@@ -137,9 +146,9 @@ $online_userlist = ($logged_visible_online > 0) ? $lang['Registered'] . " $l_r_u
//
if($userdata['session_logged_in'])
{
- $sql = "SELECT COUNT(privmsgs_type) AS new_messages
- FROM " . PRIVMSGS_TABLE . "
- WHERE privmsgs_type = " . PRIVMSGS_NEW_MAIL . "
+ $sql = "SELECT COUNT(privmsgs_type) AS new_messages
+ FROM " . PRIVMSGS_TABLE . "
+ WHERE privmsgs_type = " . PRIVMSGS_NEW_MAIL . "
AND privmsgs_to_userid = " . $userdata['user_id'];
$result_pm = $db->sql_query($sql);
if(!$result_pm)
@@ -187,7 +196,7 @@ $template->assign_vars(array(
"L_PROFILE" => $lang['Profile'],
"L_SEARCH" => $lang['Search'],
"L_PRIVATEMSGS" => $lang['Private_msgs'],
- "L_WHO_IS_ONLINE" => $lang['Who_is_Online'],
+ "L_WHO_IS_ONLINE" => $lang['Who_is_Online'],
"L_MEMBERLIST" => $lang['Memberlist'],
"L_FAQ" => $lang['FAQ'],
"L_USERGROUPS" => $lang['Usergroups'],
@@ -202,7 +211,7 @@ $template->assign_vars(array(
"L_NEWPOSTS" => $lang['New_posts'],
"L_NONEWPOSTS_HOT" => $lang['No_new_posts_hot'],
"L_NEWPOSTS_HOT" => $lang['New_posts_hot'],
- "L_TOPIC_IS_LOCKED" => $lang['Topic_is_locked'],
+ "L_TOPIC_IS_LOCKED" => $lang['Topic_is_locked'],
"L_POSTED" => $lang['Posted'],
"L_JOINED" => $lang['Joined'],
"L_AUTO_LOGIN" => $lang['Log_me_in'],
@@ -240,21 +249,21 @@ $template->assign_vars(array(
"T_TR_COLOR1" => "#".$theme['tr_color1'],
"T_TR_COLOR2" => "#".$theme['tr_color2'],
"T_TR_COLOR3" => "#".$theme['tr_color3'],
- "T_TR_CLASS1" => $theme['tr_class1'],
- "T_TR_CLASS2" => $theme['tr_class2'],
- "T_TR_CLASS3" => $theme['tr_class3'],
+ "T_TR_CLASS1" => $theme['tr_class1'],
+ "T_TR_CLASS2" => $theme['tr_class2'],
+ "T_TR_CLASS3" => $theme['tr_class3'],
"T_TH_COLOR1" => "#".$theme['th_color1'],
"T_TH_COLOR2" => "#".$theme['th_color2'],
"T_TH_COLOR3" => "#".$theme['th_color3'],
- "T_TH_CLASS1" => $theme['th_class1'],
- "T_TH_CLASS2" => $theme['th_class2'],
- "T_TH_CLASS3" => $theme['th_class3'],
+ "T_TH_CLASS1" => $theme['th_class1'],
+ "T_TH_CLASS2" => $theme['th_class2'],
+ "T_TH_CLASS3" => $theme['th_class3'],
"T_TD_COLOR1" => "#".$theme['td_color1'],
"T_TD_COLOR2" => "#".$theme['td_color2'],
"T_TD_COLOR3" => "#".$theme['td_color3'],
- "T_TD_CLASS1" => $theme['td_class1'],
- "T_TD_CLASS2" => $theme['td_class2'],
- "T_TD_CLASS3" => $theme['td_class3'],
+ "T_TD_CLASS1" => $theme['td_class1'],
+ "T_TD_CLASS2" => $theme['td_class2'],
+ "T_TD_CLASS3" => $theme['td_class3'],
"T_FONTFACE1" => $theme['fontface1'],
"T_FONTFACE2" => $theme['fontface2'],
"T_FONTFACE3" => $theme['fontface3'],
@@ -264,8 +273,8 @@ $template->assign_vars(array(
"T_FONTCOLOR1" => "#".$theme['fontcolor1'],
"T_FONTCOLOR2" => "#".$theme['fontcolor2'],
"T_FONTCOLOR3" => "#".$theme['fontcolor3'],
- "T_SPAN_CLASS1" => $theme['span_class1'],
- "T_SPAN_CLASS2" => $theme['span_class2'],
+ "T_SPAN_CLASS1" => $theme['span_class1'],
+ "T_SPAN_CLASS2" => $theme['span_class2'],
"T_SPAN_CLASS3" => $theme['span_class3'])
);
diff --git a/phpBB/includes/page_tail.php b/phpBB/includes/page_tail.php
index 88f034863f..12fb490384 100644
--- a/phpBB/includes/page_tail.php
+++ b/phpBB/includes/page_tail.php
@@ -11,6 +11,15 @@
*
***************************************************************************/
+/***************************************************************************
+ *
+ * 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.
+ *
+ ***************************************************************************/
+
//
// Show the overall footer.
//
@@ -65,17 +74,17 @@ if($do_gzip_compress)
//
// Borrowed from php.net!
//
- $gzip_contents = ob_get_contents();
- ob_end_clean();
+ $gzip_contents = ob_get_contents();
+ ob_end_clean();
- $gzip_size = strlen($gzip_contents);
- $gzip_crc = crc32($gzip_contents);
+ $gzip_size = strlen($gzip_contents);
+ $gzip_crc = crc32($gzip_contents);
- $gzip_contents = gzcompress($gzip_contents, 9);
- $gzip_contents = substr($gzip_contents, 0, strlen($gzip_contents) - 4);
+ $gzip_contents = gzcompress($gzip_contents, 9);
+ $gzip_contents = substr($gzip_contents, 0, strlen($gzip_contents) - 4);
- echo "\x1f\x8b\x08\x00\x00\x00\x00\x00";
- echo $gzip_contents;
+ echo "\x1f\x8b\x08\x00\x00\x00\x00\x00";
+ echo $gzip_contents;
echo pack("V", $gzip_crc);
echo pack("V", $gzip_size);
}
diff --git a/phpBB/includes/post.php b/phpBB/includes/post.php
index 09b83ef0f6..9d41b85f28 100644
--- a/phpBB/includes/post.php
+++ b/phpBB/includes/post.php
@@ -1,18 +1,27 @@
<?php
-/***************************************************************************
+/***************************************************************************
+ *
+ * -------------------
+ * begin : Saturday, Feb 13, 2001
+ * copyright : (C) 2001 The phpBB Group
+ * email : support@phpbb.com
*
- * -------------------
- * begin : Saturday, Feb 13, 2001
- * copyright : (C) 2001 The phpBB Group
- * email : support@phpbb.com
- *
* $Id$
- *
- *
- ***************************************************************************/
+ *
+ *
+ ***************************************************************************/
+
+/***************************************************************************
+ *
+ * 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 function will prepare a posted message for
+// This function will prepare a posted message for
// entry into the database.
//
function prepare_message($message, $html_on, $bbcode_on, $smile_on, $bbcode_uid = 0)
@@ -53,7 +62,7 @@ function prepare_message($message, $html_on, $bbcode_on, $smile_on, $bbcode_uid
}
}
- if($length && !$tagallowed)
+ if($length && !$tagallowed)
{
$message = str_replace(substr($message, $start, $length), htmlspecialchars(substr($message, $start, $length)), $message);
}
diff --git a/phpBB/includes/prune.php b/phpBB/includes/prune.php
index 4163c49b43..b820f24359 100644
--- a/phpBB/includes/prune.php
+++ b/phpBB/includes/prune.php
@@ -1,29 +1,38 @@
<?php
/***************************************************************************
* prune.php
-* -------------------
-* begin : Thursday, June 14, 2001
-* copyright : (C) 2001 The phpBB Group
-* email : support@phpbb.com
-*
+* -------------------
+* begin : Thursday, June 14, 2001
+* copyright : (C) 2001 The phpBB Group
+* email : support@phpbb.com
+*
* $Id$
-*
-*
-***************************************************************************/
+*
+*
+***************************************************************************/
+
+/***************************************************************************
+ *
+ * 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.
+ *
+ ***************************************************************************/
function prune($forum_id, $prune_date)
{
global $db, $lang;
- $sql = "SELECT t.topic_id
- FROM " . POSTS_TABLE . " p, " . TOPICS_TABLE . " t
- WHERE t.forum_id = $forum_id
- AND t.topic_type = " . POST_NORMAL . "
+ $sql = "SELECT t.topic_id
+ FROM " . POSTS_TABLE . " p, " . TOPICS_TABLE . " t
+ WHERE t.forum_id = $forum_id
+ AND t.topic_type = " . POST_NORMAL . "
AND p.post_id = t.topic_last_post_id";
// Do we want to delete everything in the forum?
if ($prune_date != FALSE)
{
- $sql .= " AND p.post_time < $prune_date";
+ $sql .= " AND p.post_time < $prune_date";
}
if(!$result_topics = $db->sql_query($sql))
{
@@ -31,15 +40,15 @@ function prune($forum_id, $prune_date)
}
$pruned_topics = $db->sql_numrows($result_topics);
- $sql = "SELECT p.post_id
- FROM " . POSTS_TABLE . " p, " . TOPICS_TABLE . " t
- WHERE p.forum_id = $forum_id
- AND t.topic_id = p.topic_id
+ $sql = "SELECT p.post_id
+ FROM " . POSTS_TABLE . " p, " . TOPICS_TABLE . " t
+ WHERE p.forum_id = $forum_id
+ AND t.topic_id = p.topic_id
AND t.topic_type = " . POST_NORMAL;
// Do we want to delete everything in the forum?
if ($prune_date != FALSE)
{
- $sql .= " AND p.post_time < $prune_date";
+ $sql .= " AND p.post_time < $prune_date";
}
if(!$result_posts = $db->sql_query($sql))
{
@@ -95,7 +104,7 @@ function prune($forum_id, $prune_date)
}
$sql_post_text = "DELETE FROM " . POSTS_TEXT_TABLE . " WHERE " . $sql_post_text;
- $sql_post = "DELETE FROM " . POSTS_TABLE . " WHERE " . $sql_post;
+ $sql_post = "DELETE FROM " . POSTS_TABLE . " WHERE " . $sql_post;
if(!$result = $db->sql_query($sql_post_text, BEGIN_TRANSACTION))
{
@@ -110,8 +119,8 @@ function prune($forum_id, $prune_date)
}
}
- $sql = "UPDATE " . FORUMS_TABLE . "
- SET forum_topics = forum_topics - $pruned_topics, forum_posts = forum_posts - $pruned_posts
+ $sql = "UPDATE " . FORUMS_TABLE . "
+ SET forum_topics = forum_topics - $pruned_topics, forum_posts = forum_posts - $pruned_posts
WHERE forum_id = $forum_id";
if(!$result = $db->sql_query($sql))
{
@@ -138,10 +147,10 @@ function auto_prune($forum_id = 0)
$one_day = 60 * 60 * 24;
- $sql = "SELECT *
- FROM " . PRUNE_TABLE . "
+ $sql = "SELECT *
+ FROM " . PRUNE_TABLE . "
WHERE forum_id = $forum_id";
-
+
if(!$result = $db->sql_query($sql))
{
message_die(GENERAL_ERROR, "Auto-Prune: Couldn't read auto_prune table.", __LINE__, __FILE__);
diff --git a/phpBB/includes/sessions.php b/phpBB/includes/sessions.php
index 59a52f17fe..d0c05ddd97 100644
--- a/phpBB/includes/sessions.php
+++ b/phpBB/includes/sessions.php
@@ -11,6 +11,15 @@
*
***************************************************************************/
+/***************************************************************************
+ *
+ * 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.
+ *
+ ***************************************************************************/
+
//
// session_begin()
//
diff --git a/phpBB/includes/smtp.php b/phpBB/includes/smtp.php
index a05e6fe0f0..d508031582 100644
--- a/phpBB/includes/smtp.php
+++ b/phpBB/includes/smtp.php
@@ -10,6 +10,15 @@
***************************************************************************/
+/***************************************************************************
+ *
+ * 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 script should be included if the admin has configured the board for
* smtp mail instead of standard sendmail. It includes a function smtpmail
@@ -21,7 +30,7 @@
* Description: This funtion processes the smtp server's response codes
* Usage: This function is only used interanally by the smtpmail
* function. It takes two arguments the first a socket pointer
-* to the opened socket to the server and the second the
+* to the opened socket to the server and the second the
* response code you are looking for.
****************************************************************************/
function server_parse($socket, $response)
@@ -38,19 +47,19 @@ function server_parse($socket, $response)
/****************************************************************************
* Function: smtpmail
-* Description: This is a functional replacement for php's builtin mail
+* Description: This is a functional replacement for php's builtin mail
* function, that uses smtp.
* Usage: The usage for this function is identical to that of php's
* built in mail function.
****************************************************************************/
-function smtpmail($mail_to, $subject, $message, $headers = "")
+function smtpmail($mail_to, $subject, $message, $headers = "")
{
// For now I'm using an array based $smtp_vars to hold the smtp server
// info, but it should probably change to $board_config...
- // then the relevant info would be $board_config['smtp_host'] and
+ // then the relevant info would be $board_config['smtp_host'] and
// $board_config['smtp_port'].
global $board_config;
-
+
//
// Fix any bare linefeeds in the message to make it RFC821 Compliant.
//
@@ -63,7 +72,7 @@ function smtpmail($mail_to, $subject, $message, $headers = "")
if(sizeof($headers) > 1)
{
$headers = join("\r\n", $headers);
- }
+ }
else
{
$headers = $headers[0];
@@ -71,7 +80,7 @@ function smtpmail($mail_to, $subject, $message, $headers = "")
}
$headers = chop($headers);
- // Make sure there are no bare linefeeds in the headers
+ // Make sure there are no bare linefeeds in the headers
$headers = ereg_replace("[^\r]\n", "\r\n", $headers);
}
if(trim($mail_to) == "")
@@ -97,13 +106,13 @@ function smtpmail($mail_to, $subject, $message, $headers = "")
message_die(GENERAL_ERROR, "Could not connect to smtp host : $errno : $errstr", "", __LINE__, __FILE__);
}
server_parse($socket, "220");
-
+
// Send the RFC821 specified HELO.
fputs($socket, "HELO " . $board_config['smtp_host'] . "\r\n");
// From this point onward most server response codes should be 250
server_parse($socket, "250");
-
+
// Specify who the mail is from....
fputs($socket, "MAIL FROM: $email_from\r\n");
server_parse($socket, "250");
@@ -116,10 +125,10 @@ function smtpmail($mail_to, $subject, $message, $headers = "")
server_parse($socket, "250");
$to_header .= "<$mail_to_address>, ";
}
-
+
// Ok now we tell the server we are ready to start sending data
fputs($socket, "DATA\r\n");
-
+
// This is the last response code we look for until the end of the message.
server_parse($socket, "354");
@@ -131,7 +140,7 @@ function smtpmail($mail_to, $subject, $message, $headers = "")
// Now any custom headers....
fputs($socket, "$headers\r\n\r\n");
-
+
// Ok now we are ready for the message...
fputs($socket, "$message\r\n");
diff --git a/phpBB/includes/template.php b/phpBB/includes/template.php
index 105dcb5867..b043749721 100644
--- a/phpBB/includes/template.php
+++ b/phpBB/includes/template.php
@@ -1,21 +1,30 @@
<?php
-/***************************************************************************
+/***************************************************************************
* template.inc
- * -------------------
- * begin : Saturday, Feb 13, 2001
- * copyright : (C) 2001 The phpBB Group
- * email : support@phpbb.com
- *
+ * -------------------
+ * begin : Saturday, Feb 13, 2001
+ * copyright : (C) 2001 The phpBB Group
+ * email : support@phpbb.com
+ *
* $Id$
- *
- *
- ***************************************************************************/
+ *
+ *
+ ***************************************************************************/
+
+/***************************************************************************
+ *
+ * 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.
+ *
+ ***************************************************************************/
/**
* Template class. By Nathan Codding of the phpBB group.
* The interface was originally inspired by PHPLib templates,
* and the template file formats are quite similar.
- *
+ *
*/
class Template {
@@ -29,24 +38,24 @@ class Template {
// if it's a root-level variable, it'll be like this:
// $this->_tpldata[.][0][varname] == value
var $_tpldata = array();
-
+
// Hash of filenames for each template handle.
var $files = array();
// Root template directory.
var $root = "";
-
+
// this will hash handle names to the compiled code for that handle.
var $compiled_code = array();
-
+
// This will hold the uncompiled code for that handle.
var $uncompiled_code = array();
-
+
/**
* Constructor. Simply sets the root dir.
- *
+ *
*/
- function Template($root = ".")
+ function Template($root = ".")
{
$this->set_rootdir($root);
}
@@ -62,39 +71,39 @@ class Template {
/**
* Sets the template root directory for this Template object.
- */
- function set_rootdir($dir)
+ */
+ function set_rootdir($dir)
{
- if (!is_dir($dir))
+ if (!is_dir($dir))
{
return false;
}
-
+
$this->root = $dir;
return true;
}
- /**
+ /**
* Sets the template filenames for handles. $filename_array
* should be a hash of handle => filename pairs.
*/
- function set_filenames($filename_array)
+ function set_filenames($filename_array)
{
if (!is_array($filename_array))
{
- return false;
+ return false;
}
-
+
reset($filename_array);
- while(list($handle, $filename) = each($filename_array))
+ while(list($handle, $filename) = each($filename_array))
{
$this->files[$handle] = $this->make_filename($filename);
}
-
+
return true;
}
-
+
/**
* Load the file for the handle, compile the file,
* and run the compiled code. This will print out
@@ -104,26 +113,26 @@ class Template {
{
if (!$this->loadfile($handle))
{
- die("Template->pparse(): Couldn't load template file for handle $handle");
+ die("Template->pparse(): Couldn't load template file for handle $handle");
}
-
+
// actually compile the template now.
if (!isset($this->compiled_code[$handle]) || empty($this->compiled_code[$handle]))
{
// Actually compile the code now.
$this->compiled_code[$handle] = $this->compile($this->uncompiled_code[$handle]);
}
-
+
// Run the compiled code.
eval($this->compiled_code[$handle]);
return true;
}
-
+
/**
* Inserts the uncompiled code for $handle as the
* value of $varname in the root-level. This can be used
- * to effectively include a template in the middle of another
+ * to effectively include a template in the middle of another
* template.
* Note that all desired assignments to the variables in $handle should be done
* BEFORE calling this function.
@@ -132,33 +141,33 @@ class Template {
{
if (!$this->loadfile($handle))
{
- die("Template->assign_var_from_handle(): Couldn't load template file for handle $handle");
+ die("Template->assign_var_from_handle(): Couldn't load template file for handle $handle");
}
-
+
// Compile it, with the "no echo statements" option on.
$code = $this->compile($this->uncompiled_code[$handle], true);
// turn it into a variable assignment.
$code = '$_str = \'' . $code . '\';';
-
+
// evaluate the variable assignment.
eval($code);
-
+
// assign the value of the generated variable to the given varname.
$this->assign_var($varname, $_str);
-
+
return true;
}
-
+
/**
* Block-level variable assignment. Adds a new block iteration with the given
- * variable assignments. Note that this should only be called once per block
+ * variable assignments. Note that this should only be called once per block
* iteration.
*/
function assign_block_vars($blockname, $vararray)
{
if (strstr($blockname, '.'))
{
- // Nested block.
+ // Nested block.
$blocks = explode('.', $blockname);
$blockcount = sizeof($blocks) - 1;
$str = '$this->_tpldata';
@@ -172,7 +181,7 @@ class Template {
// We're adding a new iteration to this block with the given
// variable assignments.
$str .= '[\'' . $blocks[$blockcount] . '.\'][] = $vararray;';
-
+
// Now we evaluate this assignment we've built up.
eval($str);
}
@@ -183,10 +192,10 @@ class Template {
// we were given.
$this->_tpldata[$blockname . '.'][] = $vararray;
}
-
+
return true;
}
-
+
/**
* Root-level variable assignment. Adds to current assignments, overriding
* any existing variable assignment with the same name.
@@ -196,12 +205,12 @@ class Template {
reset ($vararray);
while (list($key, $val) = each($vararray))
{
- $this->_tpldata['.'][0][$key] = $val;
+ $this->_tpldata['.'][0][$key] = $val;
}
return true;
}
-
+
/**
* Root-level variable assignment. Adds to current assignments, overriding
* any existing variable assignment with the same name.
@@ -209,38 +218,38 @@ class Template {
function assign_var($varname, $varval)
{
$this->_tpldata['.'][0][$varname] = $varval;
-
- return true;
+
+ return true;
}
-
-
- /**
+
+
+ /**
* Generates a full path+filename for the given filename, which can either
* be an absolute name, or a name relative to the rootdir for this Template
* object.
*/
- function make_filename($filename)
+ function make_filename($filename)
{
// Check if it's an absolute or relative path.
if (substr($filename, 0, 1) != '/')
{
$filename = $this->root . '/' . $filename;
}
-
+
if (!file_exists($filename))
{
die("Template->make_filename(): Error - file $filename does not exist");
}
-
+
return $filename;
}
-
-
+
+
/**
* If not already done, load the file for the given handle and populate
* the uncompiled_code[] hash with its code. Do not compile.
*/
- function loadfile($handle)
+ function loadfile($handle)
{
// If the file for this handle is already loaded and compiled, do nothing.
if (isset($this->uncompiled_code[$handle]) && !empty($this->uncompiled_code[$handle]))
@@ -249,31 +258,31 @@ class Template {
}
// If we don't have a file assigned to this handle, die.
- if (!isset($this->files[$handle]))
+ if (!isset($this->files[$handle]))
{
die("Template->loadfile(): No file specified for handle $handle");
}
-
+
$filename = $this->files[$handle];
$str = implode("", @file($filename));
- if (empty($str))
+ if (empty($str))
{
die("Template->loadfile(): File $filename for handle $handle is empty");
}
-
+
$this->uncompiled_code[$handle] = $str;
-
+
return true;
}
-
-
-
+
+
+
/**
* Compiles the given string of code, and returns
* the result in a string.
* If "do_not_echo" is true, the returned code will not be directly
- * executable, but can be used as part of a variable assignment
+ * executable, but can be used as part of a variable assignment
* for use in assign_code_from_handle().
*/
function compile($code, $do_not_echo = false)
@@ -281,9 +290,9 @@ class Template {
// replace \ with \\ and then ' with \'.
$code = str_replace('\\', '\\\\', $code);
$code = str_replace('\'', '\\\'', $code);
-
+
// change template varrefs into PHP varrefs
-
+
// This one will handle varrefs WITH namespaces
$varrefs = array();
preg_match_all('#\{(([a-z0-9\-_]+?\.)+?)([a-z0-9\-_]+?)\}#is', $code, $varrefs);
@@ -293,20 +302,20 @@ class Template {
$namespace = $varrefs[1][$i];
$varname = $varrefs[3][$i];
$new = $this->generate_block_varref($namespace, $varname);
-
+
$code = str_replace($varrefs[0][$i], $new, $code);
}
-
+
// This will handle the remaining root-level varrefs
$code = preg_replace('#\{([a-z0-9\-_]*?)\}#is', '\' . $this->_tpldata[\'.\'][0][\'\1\'] . \'', $code);
-
+
// Break it up into lines.
$code_lines = explode("\n", $code);
-
+
$block_nesting_level = 0;
$block_names = array();
$block_names[0] = ".";
-
+
// Second: prepend echo ', append ' . "\n"; to each line.
$line_count = sizeof($code_lines);
for ($i = 0; $i < $line_count; $i++)
@@ -332,12 +341,12 @@ class Template {
else
{
// This block is nested.
-
+
// Generate a namespace string for this block.
$namespace = implode('.', $block_names);
// strip leading period from root level..
$namespace = substr($namespace, 2);
- // Get a reference to the data array for this block that depends on the
+ // Get a reference to the data array for this block that depends on the
// current indices of all parent blocks.
$varref = $this->generate_block_data_ref($namespace, false);
// Create the for loop code to iterate over this block.
@@ -345,7 +354,7 @@ class Template {
$code_lines[$i] .= "\n" . 'for ($_' . $n[1] . '_i = 0; $_' . $n[1] . '_i < $_' . $n[1] . '_count; $_' . $n[1] . '_i++)';
$code_lines[$i] .= "\n" . '{';
}
-
+
// We have the end of a block.
unset($block_names[$block_nesting_level]);
$block_nesting_level--;
@@ -368,19 +377,19 @@ class Template {
else
{
// This block is nested.
-
+
// Generate a namespace string for this block.
$namespace = implode('.', $block_names);
// strip leading period from root level..
$namespace = substr($namespace, 2);
- // Get a reference to the data array for this block that depends on the
+ // Get a reference to the data array for this block that depends on the
// current indices of all parent blocks.
$varref = $this->generate_block_data_ref($namespace, false);
// Create the for loop code to iterate over this block.
$code_lines[$i] = '$_' . $m[1] . '_count = sizeof(' . $varref . ');';
$code_lines[$i] .= "\n" . 'for ($_' . $m[1] . '_i = 0; $_' . $m[1] . '_i < $_' . $m[1] . '_count; $_' . $m[1] . '_i++)';
$code_lines[$i] .= "\n" . '{';
- }
+ }
}
}
else if (preg_match('#<!-- END (.*?) -->#', $code_lines[$i], $m))
@@ -399,14 +408,14 @@ class Template {
}
}
}
-
+
// Bring it back into a single string of lines of code.
- $code = implode("\n", $code_lines);
+ $code = implode("\n", $code_lines);
return $code ;
-
+
}
-
-
+
+
/**
* Generates a reference to the given variable inside the given (possibly nested)
* block namespace. This is a string of the form:
@@ -418,21 +427,21 @@ class Template {
{
// Strip the trailing period.
$namespace = substr($namespace, 0, strlen($namespace) - 1);
-
+
// Get a reference to the data block for this namespace.
$varref = $this->generate_block_data_ref($namespace, true);
// Prepend the necessary code to stick this in an echo line.
$varref = '\' . ' . $varref;
// Append the variable reference.
$varref .= '[\'' . $varname . '\'] . \'';
-
+
return $varref;
-
+
}
-
-
+
+
/**
- * Generates a reference to the array of data values for the given
+ * Generates a reference to the array of data values for the given
* (possibly nested) block namespace. This is a string of the form:
* $this->_tpldata['parent'][$_parent_i]['$child1'][$_child1_i]['$child2'][$_child2_i]...['$childN']
*
@@ -448,7 +457,7 @@ class Template {
// Build up the string with everything but the last child.
for ($i = 0; $i < $blockcount; $i++)
{
- $varref .= '[\'' . $blocks[$i] . '.\'][$_' . $blocks[$i] . '_i]';
+ $varref .= '[\'' . $blocks[$i] . '.\'][$_' . $blocks[$i] . '_i]';
}
// Add the block reference for the last child.
$varref .= '[\'' . $blocks[$blockcount] . '.\']';
@@ -457,7 +466,7 @@ class Template {
{
$varref .= '[$_' . $blocks[$blockcount] . '_i]';
}
-
+
return $varref;
}