|
From: Paul S. O. <ps...@us...> - 2002-04-03 00:30:30
|
Update of /cvsroot/phpbb/phpBB2/includes
In directory usw-pr-cvs1:/tmp/cvs-serv18118/includes
Modified Files:
functions.php functions_admin.php prune.php
usercp_activate.php
Log Message:
Various updates with any luck they fix a few minor issues without causing new ones ...
Index: functions.php
===================================================================
RCS file: /cvsroot/phpbb/phpBB2/includes/functions.php,v
retrieving revision 1.132
retrieving revision 1.133
diff -C2 -r1.132 -r1.133
*** functions.php 31 Mar 2002 00:06:34 -0000 1.132
--- functions.php 2 Apr 2002 14:02:27 -0000 1.133
***************
*** 215,227 ****
}
}
- /*switch( getenv('HTTP_ACCEPT_LANGUAGE') )
- {
- case 'en-gb':
- $board_config['default_lang'] = 'english';
- break;
- case 'fr':
- $board_config['default_lang'] = 'french';
- break;
- }*/
if ( !file_exists($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_main.'.$phpEx) )
--- 215,218 ----
***************
*** 315,320 ****
function decode_ip($int_ip)
{
! $hexipbang = explode('.',chunk_split($int_ip, 2, '.'));
! return hexdec($hexipbang[0]).'.'.hexdec($hexipbang[1]).'.'.hexdec($hexipbang[2]).'.'.hexdec($hexipbang[3]);
}
--- 306,311 ----
function decode_ip($int_ip)
{
! $hexipbang = explode('.', chunk_split($int_ip, 2, '.'));
! return hexdec($hexipbang[0]). '.' . hexdec($hexipbang[1]) . '.' . hexdec($hexipbang[2]) . '.' . hexdec($hexipbang[3]);
}
***************
*** 351,355 ****
if ( $total_pages == 1 )
{
! return "";
}
--- 342,346 ----
if ( $total_pages == 1 )
{
! return '';
}
***************
*** 443,447 ****
{
$text = preg_quote($str);
! $text = str_replace($delimiter, "\\" . $delimiter, $text);
return $text;
--- 434,438 ----
{
$text = preg_quote($str);
! $text = str_replace($delimiter, '\\' . $delimiter, $text);
return $text;
***************
*** 471,475 ****
do
{
! $orig_word[] = "#\b(" . str_replace("\*", "\w*?", phpbb_preg_quote($row['word'], "#")) . ")\b#i";
$replacement_word[] = $row['replacement'];
}
--- 462,466 ----
do
{
! $orig_word[] = '#\b(' . str_replace('\*', '\w*?', phpbb_preg_quote($row['word'], '#')) . ')\b#i';
$replacement_word[] = $row['replacement'];
}
Index: functions_admin.php
===================================================================
RCS file: /cvsroot/phpbb/phpBB2/includes/functions_admin.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** functions_admin.php 18 Mar 2002 23:53:12 -0000 1.3
--- functions_admin.php 2 Apr 2002 14:02:27 -0000 1.4
***************
*** 91,97 ****
case 'forum':
! $sql = "SELECT MAX(post_id) AS last_post, COUNT(post_id) AS total
! FROM " . POSTS_TABLE . "
! WHERE forum_id = $id";
if ( !$result = $db->sql_query($sql) )
{
--- 91,99 ----
case 'forum':
! $sql = "SELECT MAX(p.post_id) AS last_post, COUNT(p.post_id) AS total
! FROM " . POSTS_TABLE . " p, " . TOPICS_TABLE . " t
! WHERE p.forum_id = $id
! AND t.topic_id = p.topic_id
! AND t.topic_status <> " . TOPIC_MOVED;
if ( !$result = $db->sql_query($sql) )
{
***************
*** 119,137 ****
}
! if ( $row = $db->sql_fetchrow($result) )
! {
! $total_topics = ($row['total']) ? $row['total'] : 0;
! }
! else
! {
! $total_topics = 0;
! }
$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) )
{
! message_die(GENERAL_ERROR, "Could not update forum $id", '', __LINE__, __FILE__, $sql);
}
break;
--- 121,132 ----
}
! $total_topics = ( $row = $db->sql_fetchrow($result) ) ? ( ( $row['total'] ) ? $row['total'] : 0 ) : 0;
$sql = "UPDATE " . FORUMS_TABLE . "
SET forum_last_post_id = $last_post, forum_posts = $total_posts, forum_topics = $total_topics
WHERE forum_id = $id";
! if ( !$db->sql_query($sql) )
{
! message_die(GENERAL_ERROR, 'Could not update forum', '', __LINE__, __FILE__, $sql);
}
break;
***************
*** 143,147 ****
if ( !$result = $db->sql_query($sql) )
{
! message_die(GENERAL_ERROR, "Could not get post ID", '', __LINE__, __FILE__, $sql);
}
--- 138,142 ----
if ( !$result = $db->sql_query($sql) )
{
! message_die(GENERAL_ERROR, 'Could not get post ID', '', __LINE__, __FILE__, $sql);
}
***************
*** 151,157 ****
SET topic_replies = " . ( $row['total_posts'] - 1 ) . ", topic_first_post_id = " . $row['first_post'] . ", topic_last_post_id = " . $row['last_post'] . "
WHERE topic_id = $id";
! if ( !($result = $db->sql_query($sql)) )
{
! message_die(GENERAL_ERROR, "Could not update topic $id", '', __LINE__, __FILE__, $sql);
}
}
--- 146,152 ----
SET topic_replies = " . ( $row['total_posts'] - 1 ) . ", topic_first_post_id = " . $row['first_post'] . ", topic_last_post_id = " . $row['last_post'] . "
WHERE topic_id = $id";
! if ( !$db->sql_query($sql) )
{
! message_die(GENERAL_ERROR, 'Could not update topic', '', __LINE__, __FILE__, $sql);
}
}
Index: prune.php
===================================================================
RCS file: /cvsroot/phpbb/phpBB2/includes/prune.php,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -r1.15 -r1.16
*** prune.php 22 Mar 2002 17:54:33 -0000 1.15
--- prune.php 2 Apr 2002 14:02:27 -0000 1.16
***************
*** 27,30 ****
--- 27,31 ----
require($phpbb_root_path . 'includes/functions_search.'.$phpEx);
+ require($phpbb_root_path . 'includes/functions_admin.'.$phpEx);
function prune($forum_id, $prune_date)
***************
*** 39,43 ****
WHERE t.forum_id = $forum_id
AND t.topic_vote = 0
! AND t.topic_type <> " . POST_ANNOUNCE . "
AND p.post_id = t.topic_last_post_id";
if ( $prune_date != '' )
--- 40,44 ----
WHERE t.forum_id = $forum_id
AND t.topic_vote = 0
! AND t.topic_type <> " . POST_ANNOUNCE . "
AND p.post_id = t.topic_last_post_id";
if ( $prune_date != '' )
***************
*** 45,48 ****
--- 46,50 ----
$sql .= " AND p.post_time < $prune_date";
}
+
if ( !($result = $db->sql_query($sql)) )
{
***************
*** 77,81 ****
$sql = "DELETE FROM " . TOPICS_TABLE . "
WHERE topic_id IN ($sql_topics)";
! if ( !($result = $db->sql_query($sql, BEGIN_TRANSACTION)) )
{
message_die(GENERAL_ERROR, 'Could not delete topics during prune', '', __LINE__, __FILE__, $sql);
--- 79,83 ----
$sql = "DELETE FROM " . TOPICS_TABLE . "
WHERE topic_id IN ($sql_topics)";
! if ( !$db->sql_query($sql, BEGIN_TRANSACTION) )
{
message_die(GENERAL_ERROR, 'Could not delete topics during prune', '', __LINE__, __FILE__, $sql);
***************
*** 86,90 ****
$sql = "DELETE FROM " . POSTS_TABLE . "
WHERE post_id IN ($sql_post)";
! if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not delete post_text during prune', '', __LINE__, __FILE__, $sql);
--- 88,92 ----
$sql = "DELETE FROM " . POSTS_TABLE . "
WHERE post_id IN ($sql_post)";
! if ( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not delete post_text during prune', '', __LINE__, __FILE__, $sql);
***************
*** 95,99 ****
$sql = "DELETE FROM " . POSTS_TEXT_TABLE . "
WHERE post_id IN ($sql_post)";
! if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not delete post during prune', '', __LINE__, __FILE__, $sql);
--- 97,101 ----
$sql = "DELETE FROM " . POSTS_TEXT_TABLE . "
WHERE post_id IN ($sql_post)";
! if ( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not delete post during prune', '', __LINE__, __FILE__, $sql);
***************
*** 102,106 ****
$sql = "DELETE FROM " . SEARCH_MATCH_TABLE . "
WHERE post_id IN ($sql_post)";
! if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not delete search matches', '', __LINE__, __FILE__, $sql);
--- 104,108 ----
$sql = "DELETE FROM " . SEARCH_MATCH_TABLE . "
WHERE post_id IN ($sql_post)";
! if ( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not delete search matches', '', __LINE__, __FILE__, $sql);
***************
*** 109,119 ****
remove_search_post($sql_post);
! $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)) )
! {
! message_die(GENERAL_ERROR, 'Could not update forum data after prune', '', __LINE__, __FILE__, $sql);
! }
return array ('topics' => $pruned_topics, 'posts' => $pruned_posts);
--- 111,115 ----
remove_search_post($sql_post);
! sync('forum', $forum_id);
return array ('topics' => $pruned_topics, 'posts' => $pruned_posts);
***************
*** 145,154 ****
{
$prune_date = time() - ( $row['prune_days'] * 86400 );
- prune($forum_id, $prune_date);
-
$next_prune = time() + ( $row['prune_freq'] * 86400 );
$sql = "UPDATE " . FORUMS_TABLE . "
! SET prune_next = $next_prune
WHERE forum_id = $forum_id";
if ( !$db->sql_query($sql) )
--- 141,150 ----
{
$prune_date = time() - ( $row['prune_days'] * 86400 );
$next_prune = time() + ( $row['prune_freq'] * 86400 );
+ $pruned = prune($forum_id, $prune_date);
+
$sql = "UPDATE " . FORUMS_TABLE . "
! SET prune_next = $next_prune
WHERE forum_id = $forum_id";
if ( !$db->sql_query($sql) )
Index: usercp_activate.php
===================================================================
RCS file: /cvsroot/phpbb/phpBB2/includes/usercp_activate.php,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** usercp_activate.php 19 Mar 2002 21:54:47 -0000 1.4
--- usercp_activate.php 2 Apr 2002 14:02:27 -0000 1.5
***************
*** 24,28 ****
if ( !defined('IN_PHPBB') )
{
! die("Hacking attempt");
exit;
}
--- 24,28 ----
if ( !defined('IN_PHPBB') )
{
! die('Hacking attempt');
exit;
}
***************
*** 35,39 ****
if ( $row = $db->sql_fetchrow($result) )
{
! $sql_update_pass = ( $row['user_newpasswd'] != "" ) ? ", user_password = '" . str_replace("\'", "''", $row['user_newpasswd']) . "', user_newpasswd = ''" : "";
$sql = "UPDATE " . USERS_TABLE . "
--- 35,39 ----
if ( $row = $db->sql_fetchrow($result) )
{
! $sql_update_pass = ( $row['user_newpasswd'] != '' ) ? ", user_password = '" . str_replace("\'", "''", $row['user_newpasswd']) . "', user_newpasswd = ''" : "";
$sql = "UPDATE " . USERS_TABLE . "
***************
*** 47,53 ****
$emailer = new emailer($board_config['smtp_delivery']);
! $email_headers = "From: " . $board_config['board_email'] . "\nReturn-Path: " . $board_config['board_email'] . "\r\n";
! $emailer->use_template("admin_welcome_activated", $row['user_lang']);
$emailer->email_address($row['user_email']);
$emailer->set_subject();//$lang['Account_activated_subject']
--- 47,53 ----
$emailer = new emailer($board_config['smtp_delivery']);
! $email_headers = 'From: ' . $board_config['board_email'] . "\nReturn-Path: " . $board_config['board_email'] . "\r\n";
! $emailer->use_template('admin_welcome_activated', $row['user_lang']);
$emailer->email_address($row['user_email']);
$emailer->set_subject();//$lang['Account_activated_subject']
***************
*** 55,62 ****
$emailer->assign_vars(array(
! "SITENAME" => $board_config['sitename'],
! "USERNAME" => $username,
! "PASSWORD" => $password_confirm,
! "EMAIL_SIG" => str_replace("<br />", "\n", "-- \n" . $board_config['board_email_sig']))
);
$emailer->send();
--- 55,62 ----
$emailer->assign_vars(array(
! 'SITENAME' => $board_config['sitename'],
! 'USERNAME' => $username,
! 'PASSWORD' => $password_confirm,
! 'EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']))
);
$emailer->send();
***************
*** 64,68 ****
$template->assign_vars(array(
! "META" => '<meta http-equiv="refresh" content="10;url=' . append_sid("index.$phpEx") . '">')
);
--- 64,68 ----
$template->assign_vars(array(
! 'META' => '<meta http-equiv="refresh" content="10;url=' . append_sid("index.$phpEx") . '">')
);
***************
*** 72,79 ****
{
$template->assign_vars(array(
! "META" => '<meta http-equiv="refresh" content="10;url=' . append_sid("index.$phpEx") . '">')
);
! $message = ( $sql_update_pass == "" ) ? $lang['Account_active'] : $lang['Password_activated'];
message_die(GENERAL_MESSAGE, $message);
}
--- 72,79 ----
{
$template->assign_vars(array(
! 'META' => '<meta http-equiv="refresh" content="10;url=' . append_sid("index.$phpEx") . '">')
);
! $message = ( $sql_update_pass == '' ) ? $lang['Account_active'] : $lang['Password_activated'];
message_die(GENERAL_MESSAGE, $message);
}
***************
*** 81,85 ****
else
{
! message_die(GENERAL_ERROR, "Couldn't update users table", "", __LINE__, __FILE__, $sql_update);
}
}
--- 81,85 ----
else
{
! message_die(GENERAL_ERROR, 'Could not update users table', '', __LINE__, __FILE__, $sql_update);
}
}
***************
*** 91,96 ****
else
{
! message_die(GENERAL_ERROR, "Couldn't obtain user information", "", __LINE__, __FILE__, $sql);
}
! ?>
--- 91,96 ----
else
{
! message_die(GENERAL_ERROR, 'Could not obtain user information', '', __LINE__, __FILE__, $sql);
}
! ?>
\ No newline at end of file
|