mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-23 08:43:02 +02:00
This commit was manufactured by cvs2svn to create tag
'release_2_0_13'. git-svn-id: file:///svn/phpbb/tags/release_2_0_13@5098 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
@@ -13,11 +13,11 @@ die("Please read the first lines of this script for instructions on how to enabl
|
||||
// Do not change anything below this line.
|
||||
//
|
||||
|
||||
|
||||
define('IN_PHPBB', true);
|
||||
$phpbb_root_path = "../";
|
||||
include($phpbb_root_path . 'extension.inc');
|
||||
include($phpbb_root_path . 'common.'.$phpEx);
|
||||
include($phpbb_root_path . 'includes/post.'.$phpEx);
|
||||
include($phpbb_root_path . 'includes/functions_post.'.$phpEx);
|
||||
include($phpbb_root_path . 'includes/bbcode.'.$phpEx);
|
||||
|
||||
srand ((double) microtime() * 1000000);
|
||||
@@ -51,6 +51,9 @@ And a quote!
|
||||
[/quote]
|
||||
';
|
||||
|
||||
$users = intval($HTTP_GET_VARS['users']);
|
||||
$posts = intval($HTTP_GET_VARS['posts']);
|
||||
$size = intval($HTTP_GET_VARS['size']);
|
||||
|
||||
// The script expects the ID's in the tables to sequential (1,2,3,4,5),
|
||||
// so no holes please (1,4,5,8)...
|
||||
@@ -88,7 +91,9 @@ if ($posts > 0)
|
||||
|
||||
$endtime = microtime();
|
||||
|
||||
if ($submit="" || !isset($submit))
|
||||
$submit = (isset($HTTP_GET_VARS['submit'])) ? true : false;
|
||||
|
||||
if (!$submit)
|
||||
{
|
||||
?>
|
||||
Hello, welcome to this little phpBB Benchmarking script :)<p>
|
||||
@@ -219,10 +224,10 @@ function make_topic($user_id, $subject, $forum_id)
|
||||
$topic_vote = 0;
|
||||
$current_time = time();
|
||||
|
||||
$sql = "INSERT INTO " . TOPICS_TABLE . " (topic_title, topic_poster, topic_time, forum_id, topic_status, topic_type, topic_vote)
|
||||
VALUES ('$subject', $user_id, $current_time, $forum_id, " . TOPIC_UNLOCKED . ", $topic_type, $topic_vote)";
|
||||
$sql = "INSERT INTO " . TOPICS_TABLE . " (topic_title, topic_poster, topic_time, forum_id, topic_status, topic_type, topic_vote)
|
||||
VALUES ('$subject', $user_id, $current_time, $forum_id, " . TOPIC_UNLOCKED . ", $topic_type, $topic_vote)";
|
||||
|
||||
if( $result = $db->sql_query($sql, BEGIN_TRANSACTION) )
|
||||
if( $result = $db->sql_query($sql) )
|
||||
{
|
||||
$new_topic_id = $db->sql_nextid();
|
||||
}
|
||||
@@ -238,17 +243,14 @@ function make_topic($user_id, $subject, $forum_id)
|
||||
|
||||
|
||||
|
||||
function create_posting($userid, $topic_id, $forum, $mode='newtopic')
|
||||
function create_posting($userid, $topic_id, $forum, $mode = 'newtopic')
|
||||
{
|
||||
$message = generatepost();
|
||||
|
||||
return make_post($topic_id, $forum, $userid, "", $message, $mode);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
function make_post($new_topic_id, $forum_id, $user_id, $post_username, $text, $mode='newtopic')
|
||||
function make_post($new_topic_id, $forum_id, $user_id, $post_username, $text, $mode = 'newtopic')
|
||||
{
|
||||
global $db;
|
||||
$current_time = time();
|
||||
@@ -261,64 +263,43 @@ function make_post($new_topic_id, $forum_id, $user_id, $post_username, $text, $m
|
||||
|
||||
$post_subject = 'random subject';
|
||||
|
||||
$post_message = prepare_message($text, $html_on, $bbcode_on, $smilies_on, $bbcode_uid);
|
||||
$post_message = prepare_message($text, $html_on, $bbcode_on, $smilies_on, $bbcode_uid);
|
||||
|
||||
$sql = "INSERT INTO " . POSTS_TABLE . " (topic_id, forum_id, poster_id, post_username, post_time, poster_ip, bbcode_uid, enable_bbcode, enable_html, enable_smilies, enable_sig)
|
||||
VALUES ($new_topic_id, $forum_id, $user_id, '$post_username', $current_time, '$user_ip', '$bbcode_uid', $bbcode_on, $html_on, $smilies_on, $attach_sig)";
|
||||
$sql = "INSERT INTO " . POSTS_TABLE . " (topic_id, forum_id, poster_id, post_username, post_time, poster_ip, enable_bbcode, enable_html, enable_smilies, enable_sig)
|
||||
VALUES ($new_topic_id, $forum_id, $user_id, '$post_username', $current_time, '$user_ip', $bbcode_on, $html_on, $smilies_on, $attach_sig)";
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
if($result)
|
||||
{
|
||||
$new_post_id = $db->sql_nextid();
|
||||
|
||||
$sql = "INSERT INTO " . POSTS_TEXT_TABLE . " (post_id, post_subject, post_text)
|
||||
VALUES ($new_post_id, '$post_subject', '$post_message')";
|
||||
$sql = "INSERT INTO " . POSTS_TEXT_TABLE . " (post_id, post_subject, bbcode_uid, post_text)
|
||||
VALUES ($new_post_id, '$post_subject', '$bbcode_uid', '$post_message')";
|
||||
|
||||
if($db->sql_query($sql))
|
||||
{
|
||||
$sql = "UPDATE " . TOPICS_TABLE . "
|
||||
SET topic_last_post_id = $new_post_id";
|
||||
if($mode == "reply")
|
||||
$post_data = array();
|
||||
$post_data['first_post'] = false;
|
||||
$post_data['last_post'] = true;
|
||||
|
||||
$sql = "SELECT SUM(post_id) as total FROM " . POSTS_TABLE . " WHERE topic_id = " . $new_topic_id;
|
||||
$result = $db->sql_query($sql);
|
||||
$row = $db->sql_fetchrow($result);
|
||||
$total = intval($row['total']);
|
||||
|
||||
if ($total == 1)
|
||||
{
|
||||
$sql .= ", topic_replies = topic_replies + 1 ";
|
||||
}
|
||||
$sql .= " WHERE topic_id = $new_topic_id";
|
||||
|
||||
if($db->sql_query($sql))
|
||||
{
|
||||
$sql = "UPDATE " . FORUMS_TABLE . "
|
||||
SET forum_last_post_id = $new_post_id, forum_posts = forum_posts + 1";
|
||||
if($mode == "newtopic")
|
||||
{
|
||||
$sql .= ", forum_topics = forum_topics + 1";
|
||||
}
|
||||
$sql .= " WHERE forum_id = $forum_id";
|
||||
|
||||
if($db->sql_query($sql))
|
||||
{
|
||||
$sql = "UPDATE " . USERS_TABLE . "
|
||||
SET user_posts = user_posts + 1
|
||||
WHERE user_id = " . $user_id;
|
||||
|
||||
if($db->sql_query($sql, END_TRANSACTION))
|
||||
{
|
||||
// SUCCESS.
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
message_die(GENERAL_ERROR, "Error updating users table", "", __LINE__, __FILE__, $sql);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
message_die(GENERAL_ERROR, "Error updating forums table", "", __LINE__, __FILE__, $sql);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
message_die(GENERAL_ERROR, "Error updating topics table", "", __LINE__, __FILE__, $sql);
|
||||
$post_data['first_post'] = true;
|
||||
}
|
||||
|
||||
$sql = "SELECT forum_last_post_id
|
||||
FROM " . FORUMS_TABLE . "
|
||||
WHERE forum_id = $forum_id";
|
||||
$result = $db->sql_query($sql);
|
||||
$row = $db->sql_fetchrow($result);
|
||||
$post_data['last_topic'] = ( $row['forum_last_post_id'] == $new_post_id ) ? true : false;
|
||||
|
||||
update_post_stats($mode, $post_data, $forum_id, $new_topic_id, $new_post_id, $user_id);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -336,11 +317,10 @@ function make_post($new_topic_id, $forum_id, $user_id, $post_username, $text, $m
|
||||
{
|
||||
message_die(GENERAL_ERROR, "Error inserting data into posts table", "", __LINE__, __FILE__, $sql);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
function generatepost($size=850)
|
||||
function generatepost($size = 850)
|
||||
{
|
||||
global $bigass_text;
|
||||
// Returns a string with a length between $size and $size*0.2
|
||||
@@ -417,22 +397,6 @@ function make_user($username)
|
||||
message_die(GENERAL_ERROR, "Couldn't obtained next user_id information.", "", __LINE__, __FILE__, $sql);
|
||||
}
|
||||
|
||||
$sql = "SELECT MAX(group_id) AS total
|
||||
FROM " . GROUPS_TABLE;
|
||||
if($result = $db->sql_query($sql))
|
||||
{
|
||||
$row = $db->sql_fetchrow($result);
|
||||
$new_group_id = $row['total'] + 1;
|
||||
|
||||
unset($result);
|
||||
unset($row);
|
||||
}
|
||||
else
|
||||
{
|
||||
message_die(GENERAL_ERROR, "Couldn't obtained next user_id information.", "", __LINE__, __FILE__, $sql);
|
||||
}
|
||||
|
||||
|
||||
$sql = "INSERT INTO " . USERS_TABLE . " (user_id, username, user_regdate, user_password, user_email, user_icq, user_website, user_occ, user_from, user_interests, user_sig, user_sig_bbcode_uid, user_avatar, user_viewemail, user_aim, user_yim, user_msnm, user_attachsig, user_allowsmile, user_allowhtml, user_allowbbcode, user_allow_viewonline, user_notify, user_notify_pm, user_timezone, user_dateformat, user_lang, user_style, user_level, user_allow_pm, user_active, user_actkey)
|
||||
VALUES ($new_user_id, '$username', " . time() . ", '$password', '$email', '$icq', '$website', '$occupation', '$location', '$interests', '$signature', '$signature_bbcode_uid', '$avatar_filename', $viewemail, '$aim', '$yim', '$msn', $attachsig, $allowsmilies, $allowhtml, $allowbbcode, $allowviewonline, $notifyreply, $notifypm, $user_timezone, '$user_dateformat', '$user_lang', $user_style, 0, 1, ";
|
||||
|
||||
@@ -441,12 +405,14 @@ function make_user($username)
|
||||
|
||||
if($result = $db->sql_query($sql, BEGIN_TRANSACTION))
|
||||
{
|
||||
$sql = "INSERT INTO " . GROUPS_TABLE . " (group_id, group_name, group_description, group_single_user, group_moderator)
|
||||
VALUES ($new_group_id, '', 'Personal User', 1, 0)";
|
||||
$sql = "INSERT INTO " . GROUPS_TABLE . " (group_name, group_description, group_single_user, group_moderator)
|
||||
VALUES ('', 'Personal User', 1, 0)";
|
||||
if($result = $db->sql_query($sql))
|
||||
{
|
||||
$group_id = $db->sql_nextid();
|
||||
|
||||
$sql = "INSERT INTO " . USER_GROUP_TABLE . " (user_id, group_id, user_pending)
|
||||
VALUES ($new_user_id, $new_group_id, 0)";
|
||||
VALUES ($new_user_id, $group_id, 0)";
|
||||
if($result = $db->sql_query($sql, END_TRANSACTION))
|
||||
{
|
||||
|
||||
@@ -474,4 +440,4 @@ function make_user($username)
|
||||
|
||||
|
||||
|
||||
?>
|
||||
?>
|
67
phpBB/develop/convert_usernames.php
Normal file
67
phpBB/develop/convert_usernames.php
Normal file
@@ -0,0 +1,67 @@
|
||||
<html>
|
||||
<body>
|
||||
<?php
|
||||
|
||||
//
|
||||
// Security message:
|
||||
//
|
||||
// This script is potentially dangerous.
|
||||
// Remove or comment the next line (die(".... ) to enable this script.
|
||||
// Do NOT FORGET to either remove this script or disable it after you have used it.
|
||||
//
|
||||
die("Please read the first lines of this script for instructions on how to enable it");
|
||||
|
||||
//
|
||||
// Do not change anything below this line.
|
||||
//
|
||||
|
||||
|
||||
//
|
||||
// Convert 2.0.x Usernames to the new 2.0.5 Username format.
|
||||
//
|
||||
|
||||
chdir("../");
|
||||
|
||||
define('IN_PHPBB', true);
|
||||
include('extension.inc');
|
||||
include('config.'.$phpEx);
|
||||
include('includes/constants.'.$phpEx);
|
||||
include('includes/db.'.$phpEx);
|
||||
|
||||
$sql = "SELECT user_id, username
|
||||
FROM " . USERS_TABLE;
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
if(!$result)
|
||||
{
|
||||
die("Unable to get users");
|
||||
}
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
if (!preg_match('#(>)|(<)|(")|(&)#', $row['username']))
|
||||
{
|
||||
if ($row['username'] != htmlspecialchars($row['username']))
|
||||
{
|
||||
flush();
|
||||
$sql = "UPDATE " . USERS_TABLE . "
|
||||
SET username = '" . str_replace("'", "''", htmlspecialchars($row['username'])) . "'
|
||||
WHERE user_id = " . $row['user_id'];
|
||||
if (!$db->sql_query($sql))
|
||||
{
|
||||
echo "ERROR: Unable to rename user " . htmlspecialchars($row['username']) . " with ID " . $row['user_id'] . "<br>";
|
||||
echo "<pre>" . print_r($db->sql_error()) . "</pre><br />$sql";
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "Renamed User " . htmlspecialchars($row['username']) . " with ID " . $row['user_id'] . "<br>";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
echo "<br>That's All Folks!";
|
||||
|
||||
?>
|
||||
</body>
|
||||
</html>
|
73
phpBB/develop/encoding_emails.php
Normal file
73
phpBB/develop/encoding_emails.php
Normal file
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
/***************************************************************************
|
||||
* revar_lang_files.php
|
||||
* -------------------
|
||||
* 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.
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
//
|
||||
// Security message:
|
||||
//
|
||||
// This script is potentially dangerous.
|
||||
// Remove or comment the next line (die(".... ) to enable this script.
|
||||
// Do NOT FORGET to either remove this script or disable it after you have used it.
|
||||
//
|
||||
//die("Please read the first lines of this script for instructions on how to enable it");
|
||||
|
||||
$dirname = "./../language";
|
||||
$dir = opendir($dirname);
|
||||
|
||||
while ( $file = readdir($dir) )
|
||||
{
|
||||
if ( ereg('^lang_', $file) && !is_file(phpbb_realpath($dirname . '/' . $file)) && !is_link(phpbb_realpath($dirname . '/' . $file)) )
|
||||
{
|
||||
include($dirname . '/' . $file . '/lang_main.php');
|
||||
|
||||
$lang_dir = opendir($dirname . '/' . $file . '/email');
|
||||
|
||||
while ( $email = readdir($lang_dir) )
|
||||
{
|
||||
if ( ereg('\.tpl$', $email) && is_file(phpbb_realpath($dirname . '/' . $file . '/email/' . $email)) )
|
||||
{
|
||||
$fp = fopen($dirname . '/' . $file . '/email/' . $email, 'r+');
|
||||
|
||||
$email_file = "";
|
||||
while ( $line = fread($fp, 100000) )
|
||||
{
|
||||
$email_file .= $line;
|
||||
}
|
||||
|
||||
if ( !preg_match('/^Charset: .*?$/m', $email_file) )
|
||||
{
|
||||
$email_file = preg_replace('/^((Subject: .*?\n)(\n))?/i', "\\2Charset: " . $lang['ENCODING'] . "\n\n", $email_file);
|
||||
}
|
||||
|
||||
echo '<b>' . $dirname . '/' . $file . '/email/' . $email . "</b><br />\n";
|
||||
echo nl2br($email_file);
|
||||
echo "\n\n<br /><br />\n\n";
|
||||
|
||||
fseek($fp, 0);
|
||||
fwrite($fp, $email_file);
|
||||
fclose($fp);
|
||||
}
|
||||
}
|
||||
echo "\n\n<hr />\n\n";
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@@ -36,7 +36,7 @@ $dir = opendir($dirname);
|
||||
|
||||
while ( $file = readdir($dir) )
|
||||
{
|
||||
if ( ereg("^lang_", $file) && !is_file($dirname . "/" . $file) && !is_link($dirname . "/" . $file) )
|
||||
if ( ereg("^lang_", $file) && !is_file(realpath($dirname . "/" . $file)) && !is_link(realpath($dirname . "/" . $file)) )
|
||||
{
|
||||
foreach($vars as $lang_file => $lang_var)
|
||||
{
|
||||
|
Reference in New Issue
Block a user