From 2f4a618900e2c3b6ea14c68cbeb5897cd2ac1a04 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Thu, 29 May 2008 12:25:56 +0000 Subject: ok... i hope i haven't messed too much with the code and everything is still working. Changes: - Ascraeus now uses constants for the phpbb root path and the php extension. This ensures more security for external applications and modifications (no more overwriting of root path and extension possible through insecure mods and register globals enabled) as well as no more globalizing needed. - A second change implemented here is an additional short-hand-notation for append_sid(). It is allowed to omit the root path and extension now (for example calling append_sid('memberlist')) - in this case the root path and extension get added automatically. The hook is called after these are added. git-svn-id: file:///svn/phpbb/trunk@8572 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/develop/fill.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'phpBB/develop/fill.php') diff --git a/phpBB/develop/fill.php b/phpBB/develop/fill.php index 336e510d06..39a9b128f5 100644 --- a/phpBB/develop/fill.php +++ b/phpBB/develop/fill.php @@ -21,10 +21,10 @@ die("Please read the first lines of this script for instructions on how to enabl define('IN_PHPBB', true); -$phpbb_root_path = './../'; -$phpEx = substr(strrchr(__FILE__, '.'), 1); -include($phpbb_root_path . 'common.'.$phpEx); -include($phpbb_root_path . 'includes/functions_admin.'.$phpEx); +define('PHPBB_ROOT_PATH', './../'); +define('PHP_EXT', substr(strrchr(__FILE__, '.'), 1)); +include(PHPBB_ROOT_PATH . 'common.' . PHP_EXT); +include(PHPBB_ROOT_PATH . 'includes/functions_admin.' . PHP_EXT); set_time_limit(0); header('Expires: 0'); @@ -117,14 +117,14 @@ switch ($mode) if ($topic_id >= $num_topics) { - echo 'And now for something completely different...'; + echo 'And now for something completely different...'; $db->sql_query('ANALYZE TABLES ' . TOPICS_TABLE . ', ' . POSTS_TABLE); flush(); } else { - echo 'To the next page... (' . $topic_id . '/' . $num_topics . ')'; + echo 'To the next page... (' . $topic_id . '/' . $num_topics . ')'; flush(); } break; @@ -141,7 +141,7 @@ switch ($mode) $e = explode(' ', microtime()); echo '
' . ($e[0] + $e[1] - $s[0] - $s[1]) . '
'; - echo 'Here we go again'; + echo 'Here we go again'; } else { @@ -157,11 +157,11 @@ switch ($mode) if ($end < $num_topics) { $start += $batch_size; - echo 'And now for something completely different... ($start/$num_topics)"; + echo 'And now for something completely different... ($start/$num_topics)"; } else { - echo 'Here we go again'; + echo 'Here we go again'; } } -- cgit v1.2.1 From e85f9f79bc892533e8b67d80ae265167f2e5d4cd Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Wed, 24 Dec 2008 13:14:24 +0000 Subject: remove no longer necessary files... hooray git-svn-id: file:///svn/phpbb/trunk@9221 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/develop/fill.php | 190 ------------------------------------------------- 1 file changed, 190 deletions(-) delete mode 100644 phpBB/develop/fill.php (limited to 'phpBB/develop/fill.php') diff --git a/phpBB/develop/fill.php b/phpBB/develop/fill.php deleted file mode 100644 index 39a9b128f5..0000000000 --- a/phpBB/develop/fill.php +++ /dev/null @@ -1,190 +0,0 @@ -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 = $posts_per_topic; //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); - flush(); - } - else - { - echo 'To the next page... (' . $topic_id . '/' . $num_topics . ')'; - flush(); - } - 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'); - } - */ -} - -$db->sql_close(); - -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 -- cgit v1.2.1 From 2e17e448deed073f8614bb555a8ef20c57291c2a Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Sun, 4 Oct 2009 18:14:59 +0000 Subject: Copy 3.0.x branch to trunk git-svn-id: file:///svn/phpbb/trunk@10211 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/develop/fill.php | 190 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 190 insertions(+) create mode 100644 phpBB/develop/fill.php (limited to 'phpBB/develop/fill.php') diff --git a/phpBB/develop/fill.php b/phpBB/develop/fill.php new file mode 100644 index 0000000000..336e510d06 --- /dev/null +++ b/phpBB/develop/fill.php @@ -0,0 +1,190 @@ +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 = $posts_per_topic; //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); + flush(); + } + else + { + echo 'To the next page... (' . $topic_id . '/' . $num_topics . ')'; + flush(); + } + 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'); + } + */ +} + +$db->sql_close(); + +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 -- cgit v1.2.1 From af5b9a96409d788733fcb1ff367e0c7fb0583702 Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Tue, 9 Nov 2010 08:59:25 +0100 Subject: [ticket/9556] Drop php closing tags, add trailing newline Closing tags converted using Oleg's script. remove-php-end-tags.py -a . Trailing newlines added using the following where $ext is file extension. find . -type f -name "*.$ext" -print | xargs printf "e %s\nw\n" | ed -s; Extensions: php, css, html, js, xml. PHPBB3-9556 --- phpBB/develop/fill.php | 2 -- 1 file changed, 2 deletions(-) (limited to 'phpBB/develop/fill.php') diff --git a/phpBB/develop/fill.php b/phpBB/develop/fill.php index 336e510d06..c9824e88e5 100644 --- a/phpBB/develop/fill.php +++ b/phpBB/develop/fill.php @@ -186,5 +186,3 @@ function rndm_username() return $usernames[array_rand($usernames)]; } - -?> \ No newline at end of file -- cgit v1.2.1 From e0df7d17f9a4d6afc1033b5ab181001eaa5afce0 Mon Sep 17 00:00:00 2001 From: Callum Macrae Date: Wed, 11 Apr 2012 13:00:02 +0100 Subject: [ticket/10785] Fixed illegal use of $_REQUEST in develop/fill.php. PHPBB3-10785 --- phpBB/develop/fill.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'phpBB/develop/fill.php') diff --git a/phpBB/develop/fill.php b/phpBB/develop/fill.php index a4cd90bfca..5c3552265d 100644 --- a/phpBB/develop/fill.php +++ b/phpBB/develop/fill.php @@ -39,8 +39,8 @@ $posts_per_topic = 500; // general vars -$mode = (isset($_REQUEST['mode'])) ? $_REQUEST['mode'] : 'generate'; -$start = (isset($_REQUEST['start'])) ? intval($_REQUEST['start']) : 0; +$mode = request_var('mode', 'generate'); +$start = request_var('start', 0); switch ($mode) { -- cgit v1.2.1 From 625e7ef58aab1b2d61505f756d53c7d85d9f2d2b Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 30 Aug 2012 22:54:24 +0200 Subject: [feature/soft-delete] Update development scripts with new column names PHPBB3-9657 --- phpBB/develop/fill.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/develop/fill.php') diff --git a/phpBB/develop/fill.php b/phpBB/develop/fill.php index e3b986e163..696b1e31c0 100644 --- a/phpBB/develop/fill.php +++ b/phpBB/develop/fill.php @@ -86,7 +86,7 @@ switch ($mode) $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) + $sql = 'INSERT IGNORE INTO ' . POSTS_TABLE . ' (topic_id, forum_id, poster_id, post_subject, post_text, post_username, post_visibility, post_time, post_reported) VALUES '; $rows = array(); -- cgit v1.2.1 From a759704b39fc1c1353f865a633759b1369589b67 Mon Sep 17 00:00:00 2001 From: Yuriy Rusko Date: Tue, 27 May 2014 20:18:06 +0200 Subject: [ticket/12594] Remove @package tags and update file headers PHPBB3-12594 --- phpBB/develop/fill.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'phpBB/develop/fill.php') diff --git a/phpBB/develop/fill.php b/phpBB/develop/fill.php index 696b1e31c0..6d08e9c206 100644 --- a/phpBB/develop/fill.php +++ b/phpBB/develop/fill.php @@ -1,9 +1,13 @@ +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ -- cgit v1.2.1