From 9439a3f49a0c528782ed9e7d34aee4770e07bdc2 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Mon, 3 Oct 2005 15:44:41 +0000 Subject: [PATCH] blabla git-svn-id: file:///svn/phpbb/trunk@5250 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/develop/benchmark.php | 2 +- phpBB/develop/change_smiley_ref.php | 62 ++++++++++ phpBB/develop/fill.php | 176 ++++++++++++++++++++++++++++ phpBB/includes/db/db2.php | 8 +- phpBB/install/install.php | 2 +- phpBB/language/en/ucp.php | 4 + phpBB/report.php | 12 +- 7 files changed, 256 insertions(+), 10 deletions(-) create mode 100644 phpBB/develop/change_smiley_ref.php create mode 100644 phpBB/develop/fill.php diff --git a/phpBB/develop/benchmark.php b/phpBB/develop/benchmark.php index c320e0f9ec..2a88818975 100644 --- a/phpBB/develop/benchmark.php +++ b/phpBB/develop/benchmark.php @@ -422,7 +422,7 @@ function make_user($username) } - $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) + $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_allowsmilies, 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, "; diff --git a/phpBB/develop/change_smiley_ref.php b/phpBB/develop/change_smiley_ref.php new file mode 100644 index 0000000000..db65dd52d4 --- /dev/null +++ b/phpBB/develop/change_smiley_ref.php @@ -0,0 +1,62 @@ +sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false); + +$sql = "SELECT post_id, post_text FROM {$table_prefix}posts WHERE post_text LIKE '%{SMILE_PATH}%'"; +$result = $db->sql_query($sql); + +while ($row = $db->sql_fetchrow($result)) +{ + $db->sql_query("UPDATE {$table_prefix}posts SET post_text = '" . $db->sql_escape(str_replace('{SMILE_PATH}', '{SMILIES_PATH}', $row['post_text'])) . "' WHERE post_id = " . $row['post_id']); +} +$db->sql_freeresult($result); + +echo "

Done

\n"; + +?> \ No newline at end of file diff --git a/phpBB/develop/fill.php b/phpBB/develop/fill.php new file mode 100644 index 0000000000..3d01b2478e --- /dev/null +++ b/phpBB/develop/fill.php @@ -0,0 +1,176 @@ +sql_query($sql); + while ($row = $db->sql_fetchrow($result)) + { + $user_ids[] = $row['user_id']; + } + $db->sql_freeresult($result); + + $sql = 'SELECT forum_id FROM ' . FORUMS_TABLE . ' WHERE forum_type = ' . FORUM_POST; + $result = $db->sql_query($sql); + while ($row = $db->sql_fetchrow($result)) + { + $forum_ids[$row['forum_id']] = $row['forum_id']; + } + $db->sql_freeresult($result); + + if (!$start) + { + $db->sql_query('TRUNCATE TABLE ' . POSTS_TABLE); + $db->sql_query('TRUNCATE TABLE ' . TOPICS_TABLE); + $db->sql_query('TRUNCATE TABLE ' . TOPICS_TABLE . '_prefetch'); + } + + $db->sql_query('LOCK TABLES ' . POSTS_TABLE . ' WRITE, ' . TOPICS_TABLE . ' WRITE'); + + for ($topic_id = $start + 1; $topic_id < min($start + $batch_size, $num_topics + 1); ++$topic_id) + { + $forum_id = array_rand($forum_ids); + + if (count($topic_rows) == 10) + { + $sql = 'INSERT IGNORE INTO ' . TOPICS_TABLE . " (topic_id, forum_id, topic_title, topic_reported) + VALUES " . implode(', ', $topic_rows); + $db->sql_query($sql); + + $topic_rows = array(); + } + + $topic_rows[] = "($topic_id, $forum_id, '$forum_id-$topic_id', " . (($topic_id % 34) ? '0' : '1') . ')'; + + $sql = 'INSERT IGNORE INTO ' . POSTS_TABLE . ' (topic_id, forum_id, poster_id, post_subject, post_text, post_username, post_approved, post_time, post_reported) + VALUES '; + + $rows = array(); + $post_time = mt_rand(0, time()); + + $num_posts = mt_rand(1, $posts_per_topic); + for ($i = 0; $i < $num_posts; ++$i) + { + $poster_id = $user_ids[array_rand($user_ids)]; + $poster_name = ($poster_id == ANONYMOUS) ? rndm_username() : ''; + $rows[] = "($topic_id, $forum_id, $poster_id, '$forum_id-$topic_id-$i', '$forum_id-$topic_id-$i', '$poster_name', " . (mt_rand(0, 12) ? '1' : '0') . ', ' . ($post_time + $i * 60) . ', ' . (mt_rand(0, 32) ? '0' : '1') . ')'; + } + + $db->sql_query($sql . implode(', ', $rows)); + } + + if (count($topic_rows)) + { + $sql = 'INSERT IGNORE INTO ' . TOPICS_TABLE . " (topic_id, forum_id, topic_title, topic_reported) + VALUES " . implode(', ', $topic_rows); + $db->sql_query($sql); + } + + $db->sql_query('UNLOCK TABLES'); + + if ($topic_id >= $num_topics) + { + echo 'And now for something completely different...'; + + $db->sql_query('ANALYZE TABLES ' . TOPICS_TABLE . ', ' . POSTS_TABLE); + } + else + { + echo 'To the next page... (' . $topic_id . '/' . $num_topics . ')'; + } + break; + + case 'sync': + error_reporting(E_ALL); + $sync_all = TRUE; + + if ($sync_all) + { + $s = explode(' ', microtime()); + sync('topic', '', '', TRUE, FALSE); +// sync('forum'); + $e = explode(' ', microtime()); + + echo '
' . ($e[0] + $e[1] - $s[0] - $s[1]) . '
'; + echo 'Here we go again'; + } + else + { + $batch_size = $batch_size * 10; + $end = $start + $batch_size; + + $s = explode(' ', microtime()); + sync('topic', 'range', "topic_id BETWEEN $start AND $end", TRUE, FALSE); + $e = explode(' ', microtime()); + + echo '
Time taken: ' . ($e[0] + $e[1] - $s[0] - $s[1]) . '
'; + + if ($end < $num_topics) + { + $start += $batch_size; + echo 'And now for something completely different... ($start/$num_topics)"; + } + else + { + echo 'Here we go again'; + } + } + + if (isset($_GET['explain'])) + { + trigger_error('Done'); + } +} + +function rndm_username() +{ + static $usernames; + + if (!isset($usernames)) + { + $usernames = get_defined_functions(); + $usernames = $usernames['internal']; + } + + return $usernames[array_rand($usernames)]; +} + +?> \ No newline at end of file diff --git a/phpBB/includes/db/db2.php b/phpBB/includes/db/db2.php index 2262210e15..b248b82b35 100644 --- a/phpBB/includes/db/db2.php +++ b/phpBB/includes/db/db2.php @@ -1,7 +1,7 @@ sql_freeresult($result); - $user->start(); + $user->session_begin(); $auth->login($admin_name, $admin_pass1); inst_page_header(); diff --git a/phpBB/language/en/ucp.php b/phpBB/language/en/ucp.php index b134e8f0dc..4d1ac239e0 100644 --- a/phpBB/language/en/ucp.php +++ b/phpBB/language/en/ucp.php @@ -353,6 +353,10 @@ $lang += array( 'UCP_PROFILE_REG_DETAILS' => 'Registration details', 'UCP_PROFILE_SIGNATURE' => 'Your signature', + 'UCP_USERGROUPS' => 'Usergroups', + 'UCP_USERGROUPS_MEMBER' => 'Memberships', + 'UCP_USERGROUPS_MANAGE' => 'Manage groups', + 'UCP_REGISTER_DISABLE' => 'Creating a new account is currently not possible.', 'UCP_REMIND' => 'Send password', 'UCP_RESEND' => 'Send activation email', diff --git a/phpBB/report.php b/phpBB/report.php index c8441f6efa..3d53d06724 100644 --- a/phpBB/report.php +++ b/phpBB/report.php @@ -14,9 +14,10 @@ define('IN_PHPBB', true); $phpbb_root_path = './'; $phpEx = substr(strrchr(__FILE__, '.'), 1); include($phpbb_root_path . 'common.'.$phpEx); +include($phpbb_root_path . 'includes/functions_display.'.$phpEx); // Start session management -$user->start(); +$user->session_begin(); $auth->acl($user->data); $user->setup('mcp'); @@ -380,8 +381,11 @@ function report_notification($notify_user, $report_post, $report_data) // do not put in reporters outbox submit_pm('post', $report_data['subject'], '', array(), array(), array( - 'address_list' => array('u' => array($user_id => 'to')), - 'icon_id' => 0, + 'address_list' => array('u' => array($user_id => 'to')), + 'from_user_id' => $user->data['user_id'], + 'from_user_ip' => $user->ip, + 'from_usernae' => $user->data['username'], + 'icon_id' => 0, 'enable_bbcode' => 0, 'enable_html' => 0, 'enable_smilies' => 0, @@ -392,7 +396,7 @@ function report_notification($notify_user, $report_post, $report_data) 'bbcode_uid' => 0, 'attachment_data' => array(), 'filename_data' => array(), - 'message' => $messenger->msg + 'message' => $messenger->msg ), true, false); } }