diff options
-rw-r--r-- | .gitignore | 2 | ||||
-rwxr-xr-x | build/package.php | 8 | ||||
-rw-r--r-- | build/webpi/install/mssql.sql | 39 | ||||
-rw-r--r-- | build/webpi/install/mysql.sql | 15 | ||||
-rw-r--r-- | build/webpi/manifest.xml | 13 | ||||
-rw-r--r-- | build/webpi/parameters.xml | 226 | ||||
-rwxr-xr-x | git-tools/hooks/pre-commit | 75 | ||||
-rwxr-xr-x | git-tools/hooks/prepare-commit-msg | 22 | ||||
-rw-r--r-- | phpBB/adm/style/acp_users_overview.html | 2 | ||||
-rw-r--r-- | phpBB/docs/CHANGELOG.html | 5 | ||||
-rw-r--r-- | phpBB/feed.php | 42 | ||||
-rw-r--r-- | phpBB/includes/functions_display.php | 2 | ||||
-rw-r--r-- | phpBB/includes/message_parser.php | 2 | ||||
-rw-r--r-- | phpBB/styles/prosilver/template/mcp_reports.html | 2 | ||||
-rw-r--r-- | phpBB/viewforum.php | 24 | ||||
-rw-r--r-- | phpBB/viewtopic.php | 12 |
16 files changed, 453 insertions, 38 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000..3e0f454e0c --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +phpBB/cache/*.php +*~
\ No newline at end of file diff --git a/build/package.php b/build/package.php index 7cb30bd493..a0da6404c6 100755 --- a/build/package.php +++ b/build/package.php @@ -518,6 +518,14 @@ foreach ($compress_programs as $extension => $compress_command) $package->run_command('md5sum ./release_files/' . $package->get('release_filename') . '.' . $extension . ' > ./release_files/' . $package->get('release_filename') . '.' . $extension . '.md5'); } +// Microsoft Web PI packaging +$package->begin_status('Packaging phpBB for Microsoft WebPI'); +$file = './release_files/' . $package->get('release_filename') . '.webpi.zip'; +$package->run_command("rm -v $file"); +$package->run_command('cp -p ./release_files/' . $package->get('release_filename') . ".zip $file"); +$package->run_command('cd ./../webpi && ' . $compress_programs['zip'] . " ./../new_version/$file *"); +$package->run_command("md5sum $file > $file.md5"); + // verify results chdir($package->locations['root']); $package->begin_status('********** Verifying packages **********'); diff --git a/build/webpi/install/mssql.sql b/build/webpi/install/mssql.sql new file mode 100644 index 0000000000..9c0b46678a --- /dev/null +++ b/build/webpi/install/mssql.sql @@ -0,0 +1,39 @@ +/**********************************************************************/ +/* Install.SQL */ +/* Creates a login and makes the user a member of db roles */ +/* */ +/**********************************************************************/ + +-- Declare variables for database name, username and password +DECLARE @dbName sysname, + @dbUser sysname, + @dbPwd nvarchar(max); + +-- Set variables for database name, username and password +SET @dbName = 'PlaceHolderForDb'; +SET @dbUser = 'PlaceHolderForUser'; +SET @dbPwd = 'PlaceHolderForPassword'; + +DECLARE @cmd nvarchar(max) + +-- Create login +IF( SUSER_SID(@dbUser) is null ) +BEGIN + print '-- Creating login ' + SET @cmd = N'CREATE LOGIN ' + quotename(@dbUser) + N' WITH PASSWORD ='''+ replace(@dbPwd, '''', '''''') + N'''' + EXEC(@cmd) +END + +-- Create database user and map to login +-- and add user to the datareader, datawriter, ddladmin and securityadmin roles +-- +SET @cmd = N'USE ' + quotename(@DBName) + N'; +IF( NOT EXISTS (SELECT * FROM sys.database_principals WHERE name = ''' + replace(@dbUser, '''', '''''') + N''')) +BEGIN + print ''-- Creating user''; + CREATE USER ' + quotename(@dbUser) + N' FOR LOGIN ' + quotename(@dbUser) + N'; + print ''-- Adding user''; + EXEC sp_addrolemember ''db_owner'', ''' + replace(@dbUser, '''', '''''') + N'''; +END' +EXEC(@cmd) +GO diff --git a/build/webpi/install/mysql.sql b/build/webpi/install/mysql.sql new file mode 100644 index 0000000000..5c9d8cd922 --- /dev/null +++ b/build/webpi/install/mysql.sql @@ -0,0 +1,15 @@ +USE PlaceHolderForDb$$ + +DROP PROCEDURE IF EXISTS add_user $$ + +CREATE PROCEDURE add_user() +BEGIN +DECLARE EXIT HANDLER FOR 1044 BEGIN END; +GRANT ALL PRIVILEGES ON PlaceHolderForDb.* to 'PlaceHolderForUser'@'PlaceHolderForServer' IDENTIFIED BY 'PlaceHolderForPassword'; +FLUSH PRIVILEGES; +END +$$ + +CALL add_user() $$ + +DROP PROCEDURE IF EXISTS add_user $$ diff --git a/build/webpi/manifest.xml b/build/webpi/manifest.xml new file mode 100644 index 0000000000..947377893b --- /dev/null +++ b/build/webpi/manifest.xml @@ -0,0 +1,13 @@ +<msdeploy.iisapp> + <iisapp path="phpBB3" /> + + <dbmysql path="install/mysql.sql" commandDelimiter="$$" removeCommandDelimiter="true" /> + + <dbfullsql path="install/mssql.sql" /> + + <setAcl path="phpBB3/cache" setAclAccess="Modify" setAclUser="anonymousAuthenticationUser" /> + <setAcl path="phpBB3/files" setAclAccess="Modify" setAclUser="anonymousAuthenticationUser" /> + <setAcl path="phpBB3/store" setAclAccess="Modify" setAclUser="anonymousAuthenticationUser" /> + <setAcl path="phpBB3/images/avatars/upload" setAclAccess="Modify" setAclUser="anonymousAuthenticationUser" /> + <setAcl path="phpBB3/config.php" setAclAccess="Modify" setAclUser="anonymousAuthenticationUser" setAclResourceType="File" /> +</msdeploy.iisapp> diff --git a/build/webpi/parameters.xml b/build/webpi/parameters.xml new file mode 100644 index 0000000000..770cabf95b --- /dev/null +++ b/build/webpi/parameters.xml @@ -0,0 +1,226 @@ +<parameters> + <parameter + name="AppPath" + defaultValue="Default Web Site/phpBB3" + tags="iisapp"> + + <parameterEntry + type="ProviderPath" + scope="iisapp" + match="phpBB3" /> + </parameter> + + <parameter + name="aclCache" + description="Sets the ACL on the cache/ folder" + defaultValue="{AppPath}/cache" + tags="Hidden"> + + <parameterEntry + type="ProviderPath" + scope="setAcl" + match="phpBB3/cache" /> + </parameter> + + <parameter + name="aclFiles" + description="Sets the ACL on the files/ folder" + defaultValue="{AppPath}/files" + tags="Hidden"> + + <parameterEntry + type="ProviderPath" + scope="setAcl" + match="phpBB3/files" /> + </parameter> + + <parameter + name="aclStore" + description="Sets the ACL on the store/ folder" + defaultValue="{AppPath}/store" + tags="Hidden"> + + <parameterEntry + type="ProviderPath" + scope="setAcl" + match="phpBB3/store" /> + </parameter> + + <parameter + name="aclAvatarUpload" + description="Sets the ACL on the avatars/upload/ folder" + defaultValue="{AppPath}/images/avatars/upload" + tags="Hidden"> + + <parameterEntry + type="ProviderPath" + scope="setAcl" + match="phpBB3/images/avatars/upload" /> + </parameter> + + <parameter + name="aclConfig" + description="Sets the ACL on the config.php file" + defaultValue="{AppPath}/config.php" + tags="Hidden"> + + <parameterEntry + type="ProviderPath" + scope="setAcl" + match="phpBB3/config.php" /> + </parameter> + + <parameter + name="DatabaseServer" + description="Enter the database server" + defaultValue=".\SQLExpress" + tags="SQL, dbServer" > + </parameter> + + <parameter + name="DatabaseName" + description="Database name for your application." + defaultValue="phpbb" + tags="SQL, dbName"> + + <parameterEntry + type="TextFile" + scope="install/mssql.sql" + match="PlaceHolderForDb" /> + </parameter> + + <parameter + name="DatabaseAdministrator" + description="Database server administartor username." + defaultValue="sa" + tags="SQL, DbAdminUsername" > + </parameter> + + <parameter + name="DatabaseAdministratorPassword" + description="Database server administrator password." + tags="Password,SQL,DbAdminPassword"> + </parameter> + + <parameter + name="Database Username" + description="Username to access your database." + defaultValue="phpbb" + tags="SQL, DbUsername"> + + <parameterEntry + type="TextFile" + scope="install/mssql.sql" + match="PlaceHolderForUser" /> + </parameter> + + <parameter + name="Database Password" + description="Password for your phpBB database. (Minimum 4 characters)" + tags="New, Password,SQL, DbUserPassword"> + + <parameterValidation + type = "RegularExpression" + validationString = "^.{4,}$" /> + + <parameterEntry + type="TextFile" + scope="install/mssql.sql" + match="PlaceHolderForPassword" /> + </parameter> + + <parameter + name="ConnectionString" + description="Automatically sets the connection string for the connection request." + defaultValue="Server={DatabaseServer};Database={DatabaseName};uid={DatabaseAdministrator};Pwd={DatabaseAdministratorPassword};" + tags="Hidden,SQLConnectionString,Validate"> + + <parameterEntry + type="ProviderPath" + scope="dbfullsql" + match="install/mssql.sql" /> + </parameter> + + <parameter + name="SQL Database type" + description="SQL database type" + defaultValue="mssql" + tags="SQL,Hidden"> + </parameter> + + <parameter + name="MySQL Database Server" + description="Enter the hostname" + defaultValue="localhost" + tags="MySQL, dbServer"> + + <parameterEntry + type="TextFile" + scope="install/mysql.sql" + match="PlaceHolderForServer" /> + </parameter> + + <parameter + name="Application Database Name" + description="Database Name for your application." + defaultValue="phpbb" + tags="MySQL, dbName"> + + <parameterEntry + type="TextFile" + scope="install/mysql.sql" + match="PlaceHolderForDb" /> + </parameter> + + <parameter + name="MySQL Database Administrator" + description="Database administrator username." + defaultValue="root" + tags="MySQL, DbAdminUsername" > + </parameter> + + <parameter + name="MySQL Database Administrator Password" + description="Database administrator password." + tags="Password,MySQL,DbAdminPassword" > + </parameter> + + <parameter + name="phpBB Database Username" + description="Username to access your phpBB database." + defaultValue="phpbb" + tags="MySQL, DbUsername"> + + <parameterEntry + type="TextFile" + scope="install/mysql.sql" + match="PlaceHolderForUser" /> + </parameter> + + <parameter + name="MySQL Database Password" + description="Password for your phpBB database. (Minimum 4 characters)" + tags="New, Password,MySQL,DbUserPassword"> + + <parameterValidation + type = "RegularExpression" + validationString = "^.{4,}$" /> + + <parameterEntry + type="TextFile" + scope="install/mysql.sql" + match="PlaceHolderForPassword" /> + </parameter> + + <parameter + name="MySQLConnectionString" + description="Automatically sets the connection string for the connection request." + defaultValue="Server={MySQL Database Server};Database={Application Database Name};uid={MySQL Database Administrator};Pwd={MySQL Database Administrator Password};" + tags="Hidden,MySQLConnectionString,Validate"> + + <parameterEntry + type="ProviderPath" + scope="dbmysql" + match="install/mysql.sql" /> + </parameter> +</parameters> diff --git a/git-tools/hooks/pre-commit b/git-tools/hooks/pre-commit new file mode 100755 index 0000000000..9719b91746 --- /dev/null +++ b/git-tools/hooks/pre-commit @@ -0,0 +1,75 @@ +#!/bin/sh +# +# A hook to disallow php syntax errors to be committed +# by running php -l (lint) on them. It requires php-cli +# to be installed. +# +# This is a pre-commit hook. +# +# To install this you can either copy or symlink it to +# $GIT_DIR/hooks, example: +# +# ln -s ../../git-tools/hooks/pre-commit \\ +# .git/hooks/pre-commit + +# NOTE: this is run through /usr/bin/env +PHP_BIN=php + +# necessary check for initial commit +if git rev-parse --verify HEAD >/dev/null 2>&1 +then + against=HEAD +else + # Initial commit: diff against an empty tree object + against=4b825dc642cb6eb9a060e54bf8d69288fbee4904 +fi + +error=0 +errors="" + +# dash does not support $'\n': +# http://forum.soft32.com/linux2/Bug-409179-DASH-Settings-IFS-work-properly-ftopict70039.html +IFS=' +' +# get a list of staged files +for line in $(git diff-index --cached --full-index $against) +do + # split needed values + sha=$(echo $line | cut -d' ' -f4) + temp=$(echo $line | cut -d' ' -f5) + status=$(echo $temp | cut -d' ' -f1) + filename=$(echo $temp | cut -d' ' -f2) + + # file extension + ext=$(echo $filename | sed 's/^.*\.//') + + # only check files with php extension + if [ $ext != "php" ] + then + continue + fi + + # do not check deleted files + if [ $status = "D" ] + then + continue + fi + + # check the staged file content for syntax errors + # using php -l (lint) + result=$(git cat-file -p $sha | /usr/bin/env $PHP_BIN -l 2>/dev/null) + if [ $? -ne 0 ] + then + error=1 + # Swap back in correct filenames + errors=$(echo "$errors"; echo "$result" |sed -e "s@in - on@in $filename on@g") + fi +done +unset IFS + +if [ $error -eq 1 ] +then + echo -e "PHP Syntax check failed:"; + echo -e "$errors" | grep "^Parse error:" + exit 1 +fi diff --git a/git-tools/hooks/prepare-commit-msg b/git-tools/hooks/prepare-commit-msg index e1e05d67b8..033cb187c7 100755 --- a/git-tools/hooks/prepare-commit-msg +++ b/git-tools/hooks/prepare-commit-msg @@ -10,15 +10,25 @@ # # ln -s ../../git-tools/hooks/prepare-commit-msg \\ # .git/hooks/prepare-commit-msg -# -# Make sure it is executable. -# strip off ref: refs/heads/ -branch="$(cat $GIT_DIR/HEAD | sed 's/ref: refs\/heads\///g')" +# get branch name +branch="$(git symbolic-ref HEAD)" + +# exit if no branch name is present +# (eg. detached HEAD) +if [ $? -ne 0 ] +then + exit +fi + +# strip off refs/heads/ +branch="$(echo "$branch" | sed "s/refs\/heads\///g")" +# add [branchname] to commit message # * only run when normal commit is made (without -m or -F; # not a merge, etc.) # * also make sure the branch name begins with bug/ or feature/ -if [ "$2" = "" ] && [ $(echo "$branch" | grep -e '^\(bug\|feature\)/') ]; then - echo "[$branch] $(cat $1)" > "$1" +if [ "$2" = "" ] +then + echo "[$branch] $(cat "$1")" > "$1" fi diff --git a/phpBB/adm/style/acp_users_overview.html b/phpBB/adm/style/acp_users_overview.html index d48cfa57be..7d9a0f27d3 100644 --- a/phpBB/adm/style/acp_users_overview.html +++ b/phpBB/adm/style/acp_users_overview.html @@ -148,6 +148,6 @@ {S_FORM_TOKEN} </p> </fieldset> - <!-- ENDIF --> </form> + <!-- ENDIF --> <!-- ENDIF --> diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index ba79660646..36dc3d037c 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -109,8 +109,13 @@ <li>[Fix] Fix incorrect ampersand encoding in redirect parameter. (Bug #58465)</li> <li>[Fix] Fix open_basedir issues when accessing styles- and language-management. (Bug #59135)</li> <li>[Fix] Fix table binding issues with PostgreSQL in board-wide feed. (Bug #58425)</li> + <li>[Fix] Only show unapproved posts in ATOM Feeds for moderators (Bug #58695)</li> + <li>[Fix] Various XHTML mistakes in ACP (Bug #58745)</li> + <li>[Fix] Fix dead link in MCP on reports for global announcements in prosilver. (Bug #9512)</li> + <li>[Fix] Fix broken links for reports on active topics, when the topic is in a subforum. (Bug #9047)</li> <li>[Feature] Support for Microsoft's Native SQL Server Driver for PHP (Bug #57055 - Patch by Chris Pucci at Microsoft)</li> <li>[Feature] The memcache acm plugin now supports multiple memcache servers.</li> + <li>[Feature] Show note for moderators on unapproved posts/topics with unapproved posts in ATOM Feed (Bug #9511)</li> </ul> <a name="v307"></a><h3>1.i. Changes since 3.0.7</h3> diff --git a/phpBB/feed.php b/phpBB/feed.php index 4ce983a967..88c30c5d4f 100644 --- a/phpBB/feed.php +++ b/phpBB/feed.php @@ -535,12 +535,30 @@ class phpbb_feed_base if (!isset($forum_ids)) { - $forum_ids = array_keys($auth->acl_getf('m_approve')); + $forum_ids = array_keys($auth->acl_getf('m_approve', true)); } return $forum_ids; } + function is_moderator_approve_forum($forum_id) + { + static $forum_ids; + + if (!isset($forum_ids)) + { + $forum_ids = array_flip($this->get_moderator_approve_forums()); + } + + if (!$forum_id) + { + // Global announcement, your a moderator in any forum than it's okay. + return (!empty($forum_ids)) ? true : false; + } + + return (isset($forum_ids[$forum_id])) ? true : false; + } + function get_excluded_forums() { global $db, $cache; @@ -677,7 +695,8 @@ class phpbb_feed_post_base extends phpbb_feed_base if ($config['feed_item_statistics']) { $item_row['statistics'] = $user->lang['POSTED'] . ' ' . $user->lang['POST_BY_AUTHOR'] . ' ' . $this->user_viewprofile($row) - . ' ' . $this->separator_stats . ' ' . $user->format_date($row['post_time']); + . ' ' . $this->separator_stats . ' ' . $user->format_date($row['post_time']) + . (($this->is_moderator_approve_forum($row['forum_id']) && !$row['post_approved']) ? ' ' . $this->separator_stats . ' ' . $user->lang['POST_UNAPPROVED'] : ''); } } } @@ -719,8 +738,9 @@ class phpbb_feed_topic_base extends phpbb_feed_base { $item_row['statistics'] = $user->lang['POSTED'] . ' ' . $user->lang['POST_BY_AUTHOR'] . ' ' . $this->user_viewprofile($row) . ' ' . $this->separator_stats . ' ' . $user->format_date($row[$this->get('date')]) - . ' ' . $this->separator_stats . ' ' . $user->lang['REPLIES'] . ' ' . $row['topic_replies'] - . ' ' . $this->separator_stats . ' ' . $user->lang['VIEWS'] . ' ' . $row['topic_views']; + . ' ' . $this->separator_stats . ' ' . $user->lang['REPLIES'] . ' ' . (($this->is_moderator_approve_forum($row['forum_id'])) ? $row['topic_replies_real'] : $row['topic_replies']) + . ' ' . $this->separator_stats . ' ' . $user->lang['VIEWS'] . ' ' . $row['topic_views'] + . (($this->is_moderator_approve_forum($row['forum_id']) && ($row['topic_replies_real'] != $row['topic_replies'])) ? ' ' . $this->separator_stats . ' ' . $user->lang['POSTS_UNAPPROVED'] : ''); } } } @@ -780,7 +800,7 @@ class phpbb_feed_overall extends phpbb_feed_post_base // Get the actual data $this->sql = array( 'SELECT' => 'f.forum_id, f.forum_name, ' . - 'p.post_id, p.topic_id, p.post_time, p.post_subject, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url, ' . + 'p.post_id, p.topic_id, p.post_time, p.post_approved, p.post_subject, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url, ' . 'u.username, u.user_id', 'FROM' => array( USERS_TABLE => 'u', @@ -912,7 +932,7 @@ class phpbb_feed_forum extends phpbb_feed_post_base } $this->sql = array( - 'SELECT' => 'p.post_id, p.topic_id, p.post_time, p.post_subject, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url, ' . + 'SELECT' => 'p.post_id, p.topic_id, p.post_time, p.post_approved, p.post_subject, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url, ' . 'u.username, u.user_id', 'FROM' => array( POSTS_TABLE => 'p', @@ -994,7 +1014,7 @@ class phpbb_feed_topic extends phpbb_feed_post_base if (!$this->topic_data['topic_approved']) { // Also require m_approve - $in_fid_ary = array_intersect($in_fid_ary, array_keys($auth->acl_getf('m_approve'))); + $in_fid_ary = array_intersect($in_fid_ary, $this->get_moderator_approve_forums()); if (empty($in_fid_ary)) { @@ -1077,7 +1097,7 @@ class phpbb_feed_topic extends phpbb_feed_post_base global $auth, $db; $this->sql = array( - 'SELECT' => 'p.post_id, p.post_time, p.post_subject, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url, ' . + 'SELECT' => 'p.post_id, p.post_time, p.post_approved, p.post_subject, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url, ' . 'u.username, u.user_id', 'FROM' => array( POSTS_TABLE => 'p', @@ -1241,7 +1261,7 @@ class phpbb_feed_news extends phpbb_feed_topic_base $this->sql = array( 'SELECT' => 'f.forum_id, f.forum_name, - t.topic_id, t.topic_title, t.topic_poster, t.topic_first_poster_name, t.topic_replies, t.topic_views, t.topic_time, + t.topic_id, t.topic_title, t.topic_poster, t.topic_first_poster_name, t.topic_replies, t.topic_replies_real, t.topic_views, t.topic_time, p.post_id, p.post_time, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url', 'FROM' => array( TOPICS_TABLE => 't', @@ -1314,7 +1334,7 @@ class phpbb_feed_topics extends phpbb_feed_topic_base $this->sql = array( 'SELECT' => 'f.forum_id, f.forum_name, - t.topic_id, t.topic_title, t.topic_poster, t.topic_first_poster_name, t.topic_replies, t.topic_views, t.topic_time, + t.topic_id, t.topic_title, t.topic_poster, t.topic_first_poster_name, t.topic_replies, t.topic_replies_real, t.topic_views, t.topic_time, p.post_id, p.post_time, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url', 'FROM' => array( TOPICS_TABLE => 't', @@ -1412,7 +1432,7 @@ class phpbb_feed_topics_active extends phpbb_feed_topic_base $this->sql = array( 'SELECT' => 'f.forum_id, f.forum_name, - t.topic_id, t.topic_title, t.topic_replies, t.topic_views, + t.topic_id, t.topic_title, t.topic_replies, t.topic_replies_real, t.topic_views, t.topic_last_poster_id, t.topic_last_poster_name, t.topic_last_post_time, p.post_id, p.post_time, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url', 'FROM' => array( diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index f49aa42324..ea77551fc4 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -660,7 +660,7 @@ function topic_generate_pagination($replies, $url) $times = 1; for ($j = 0; $j < $replies + 1; $j += $per_page) { - $pagination .= '<a href="' . $url . '&start=' . $j . '">' . $times . '</a>'; + $pagination .= '<a href="' . $url . ($j == 0 ? '' : '&start=' . $j) . '">' . $times . '</a>'; if ($times == 1 && $total_pages > 5) { $pagination .= ' ... '; diff --git a/phpBB/includes/message_parser.php b/phpBB/includes/message_parser.php index 50aad8588a..952b55cc8c 100644 --- a/phpBB/includes/message_parser.php +++ b/phpBB/includes/message_parser.php @@ -300,7 +300,7 @@ class bbcode_firstpass extends bbcode if ($config['max_' . $this->mode . '_img_height'] || $config['max_' . $this->mode . '_img_width']) { - $stats = @getimagesize($in); + $stats = @getimagesize(htmlspecialchars_decode($in)); if ($stats === false) { diff --git a/phpBB/styles/prosilver/template/mcp_reports.html b/phpBB/styles/prosilver/template/mcp_reports.html index 649154deb4..eefb24ee91 100644 --- a/phpBB/styles/prosilver/template/mcp_reports.html +++ b/phpBB/styles/prosilver/template/mcp_reports.html @@ -54,7 +54,7 @@ </dt> <dd class="moderation"> <span>{postrow.REPORTER_FULL} « {postrow.REPORT_TIME}<br /> - {L_FORUM}: <a href="{postrow.U_VIEWFORUM}">{postrow.FORUM_NAME}</a></span> + <!-- IF postrow.U_VIEWFORUM -->{L_FORUM}: <a href="{postrow.U_VIEWFORUM}">{postrow.FORUM_NAME}</a><!-- ELSE -->{postrow.FORUM_NAME}<!-- ENDIF --></span> </dd> <!-- ENDIF --> <dd class="mark"><input type="checkbox" name="report_id_list[]" value="{postrow.REPORT_ID}" /></dd> diff --git a/phpBB/viewforum.php b/phpBB/viewforum.php index 95c142d865..d18508ccbc 100644 --- a/phpBB/viewforum.php +++ b/phpBB/viewforum.php @@ -151,7 +151,7 @@ $template->set_filenames(array( make_jumpbox(append_sid("{$phpbb_root_path}viewforum.$phpEx"), $forum_id); $template->assign_vars(array( - 'U_VIEW_FORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", "f=$forum_id&start=$start"), + 'U_VIEW_FORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", "f=$forum_id" . (($start == 0) ? '' : "&start=$start")), )); // Not postable forum or showing active topics? @@ -302,7 +302,7 @@ $template->assign_vars(array( 'S_WATCH_FORUM_LINK' => $s_watching_forum['link'], 'S_WATCH_FORUM_TITLE' => $s_watching_forum['title'], 'S_WATCHING_FORUM' => $s_watching_forum['is_watching'], - 'S_FORUM_ACTION' => append_sid("{$phpbb_root_path}viewforum.$phpEx", "f=$forum_id&start=$start"), + 'S_FORUM_ACTION' => append_sid("{$phpbb_root_path}viewforum.$phpEx", "f=$forum_id" . (($start == 0) ? '' : "&start=$start")), 'S_DISPLAY_SEARCHBOX' => ($auth->acl_get('u_search') && $auth->acl_get('f_search', $forum_id) && $config['load_search']) ? true : false, 'S_SEARCHBOX_ACTION' => append_sid("{$phpbb_root_path}search.$phpEx", 'fid[]=' . $forum_id), 'S_SINGLE_MODERATOR' => (!empty($moderators[$forum_id]) && sizeof($moderators[$forum_id]) > 1) ? false : true, @@ -311,7 +311,7 @@ $template->assign_vars(array( 'U_MCP' => ($auth->acl_get('m_', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", "f=$forum_id&i=main&mode=forum_view", true, $user->session_id) : '', 'U_POST_NEW_TOPIC' => ($auth->acl_get('f_post', $forum_id) || $user->data['user_id'] == ANONYMOUS) ? append_sid("{$phpbb_root_path}posting.$phpEx", 'mode=post&f=' . $forum_id) : '', - 'U_VIEW_FORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", "f=$forum_id" . ((strlen($u_sort_param)) ? "&$u_sort_param" : '') . "&start=$start"), + 'U_VIEW_FORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", "f=$forum_id" . ((strlen($u_sort_param)) ? "&$u_sort_param" : '') . (($start == 0) ? '' : "&start=$start")), 'U_MARK_TOPICS' => ($user->data['is_registered'] || $config['load_anon_lastread']) ? append_sid("{$phpbb_root_path}viewforum.$phpEx", 'hash=' . generate_link_hash('global') . "&f=$forum_id&mark=topics") : '', )); @@ -592,12 +592,14 @@ if (sizeof($topic_list)) { $row = &$rowset[$topic_id]; + $topic_forum_id = ($row['forum_id']) ? (int) $row['forum_id'] : $forum_id; + // This will allow the style designer to output a different header // or even separate the list of announcements from sticky and normal topics $s_type_switch_test = ($row['topic_type'] == POST_ANNOUNCE || $row['topic_type'] == POST_GLOBAL) ? 1 : 0; // Replies - $replies = ($auth->acl_get('m_approve', $forum_id)) ? $row['topic_replies_real'] : $row['topic_replies']; + $replies = ($auth->acl_get('m_approve', $topic_forum_id)) ? $row['topic_replies_real'] : $row['topic_replies']; if ($row['topic_status'] == ITEM_MOVED) { @@ -614,16 +616,16 @@ if (sizeof($topic_list)) topic_status($row, $replies, $unread_topic, $folder_img, $folder_alt, $topic_type); // Generate all the URIs ... - $view_topic_url_params = 'f=' . (($row['forum_id']) ? $row['forum_id'] : $forum_id) . '&t=' . $topic_id; + $view_topic_url_params = 'f=' . $topic_forum_id . '&t=' . $topic_id; $view_topic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", $view_topic_url_params); - $topic_unapproved = (!$row['topic_approved'] && $auth->acl_get('m_approve', (($row['forum_id']) ? $row['forum_id'] : $forum_id))) ? true : false; - $posts_unapproved = ($row['topic_approved'] && $row['topic_replies'] < $row['topic_replies_real'] && $auth->acl_get('m_approve', (($row['forum_id']) ? $row['forum_id'] : $forum_id))) ? true : false; + $topic_unapproved = (!$row['topic_approved'] && $auth->acl_get('m_approve', $topic_forum_id)) ? true : false; + $posts_unapproved = ($row['topic_approved'] && $row['topic_replies'] < $row['topic_replies_real'] && $auth->acl_get('m_approve', $topic_forum_id)) ? true : false; $u_mcp_queue = ($topic_unapproved || $posts_unapproved) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&mode=' . (($topic_unapproved) ? 'approve_details' : 'unapproved_posts') . "&t=$topic_id", true, $user->session_id) : ''; // Send vars to template $template->assign_block_vars('topicrow', array( - 'FORUM_ID' => $forum_id, + 'FORUM_ID' => $topic_forum_id, 'TOPIC_ID' => $topic_id, 'TOPIC_AUTHOR' => get_username_string('username', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']), 'TOPIC_AUTHOR_COLOUR' => get_username_string('colour', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']), @@ -651,13 +653,13 @@ if (sizeof($topic_list)) 'TOPIC_ICON_IMG' => (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['img'] : '', 'TOPIC_ICON_IMG_WIDTH' => (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['width'] : '', 'TOPIC_ICON_IMG_HEIGHT' => (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['height'] : '', - 'ATTACH_ICON_IMG' => ($auth->acl_get('u_download') && $auth->acl_get('f_download', $forum_id) && $row['topic_attachment']) ? $user->img('icon_topic_attach', $user->lang['TOTAL_ATTACHMENTS']) : '', + 'ATTACH_ICON_IMG' => ($auth->acl_get('u_download') && $auth->acl_get('f_download', $topic_forum_id) && $row['topic_attachment']) ? $user->img('icon_topic_attach', $user->lang['TOTAL_ATTACHMENTS']) : '', 'UNAPPROVED_IMG' => ($topic_unapproved || $posts_unapproved) ? $user->img('icon_topic_unapproved', ($topic_unapproved) ? 'TOPIC_UNAPPROVED' : 'POSTS_UNAPPROVED') : '', 'S_TOPIC_TYPE' => $row['topic_type'], 'S_USER_POSTED' => (isset($row['topic_posted']) && $row['topic_posted']) ? true : false, 'S_UNREAD_TOPIC' => $unread_topic, - 'S_TOPIC_REPORTED' => (!empty($row['topic_reported']) && $auth->acl_get('m_report', $forum_id)) ? true : false, + 'S_TOPIC_REPORTED' => (!empty($row['topic_reported']) && $auth->acl_get('m_report', $topic_forum_id)) ? true : false, 'S_TOPIC_UNAPPROVED' => $topic_unapproved, 'S_POSTS_UNAPPROVED' => $posts_unapproved, 'S_HAS_POLL' => ($row['poll_start']) ? true : false, @@ -672,7 +674,7 @@ if (sizeof($topic_list)) 'U_LAST_POST_AUTHOR' => get_username_string('profile', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']), 'U_TOPIC_AUTHOR' => get_username_string('profile', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']), 'U_VIEW_TOPIC' => $view_topic_url, - 'U_MCP_REPORT' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=reports&mode=reports&f=' . $forum_id . '&t=' . $topic_id, true, $user->session_id), + 'U_MCP_REPORT' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=reports&mode=reports&f=' . $topic_forum_id . '&t=' . $topic_id, true, $user->session_id), 'U_MCP_QUEUE' => $u_mcp_queue, 'S_TOPIC_TYPE_SWITCH' => ($s_type_switch == $s_type_switch_test) ? -1 : $s_type_switch_test) diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 29c4e5cdc1..8e0521522d 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -477,7 +477,7 @@ if ($start < 0 || $start >= $total_posts) } // General Viewtopic URL for return links -$viewtopic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id&start=$start" . ((strlen($u_sort_param)) ? "&$u_sort_param" : '') . (($highlight_match) ? "&hilit=$highlight" : '')); +$viewtopic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id" . (($start == 0) ? '' : "&start=$start") . ((strlen($u_sort_param)) ? "&$u_sort_param" : '') . (($highlight_match) ? "&hilit=$highlight" : '')); // Are we watching this topic? $s_watching_topic = array( @@ -601,7 +601,7 @@ $template->assign_vars(array( 'PAGINATION' => $pagination, 'PAGE_NUMBER' => on_page($total_posts, $config['posts_per_page'], $start), 'TOTAL_POSTS' => ($total_posts == 1) ? $user->lang['VIEW_TOPIC_POST'] : sprintf($user->lang['VIEW_TOPIC_POSTS'], $total_posts), - 'U_MCP' => ($auth->acl_get('m_', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", "i=main&mode=topic_view&f=$forum_id&t=$topic_id&start=$start" . ((strlen($u_sort_param)) ? "&$u_sort_param" : ''), true, $user->session_id) : '', + 'U_MCP' => ($auth->acl_get('m_', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", "i=main&mode=topic_view&f=$forum_id&t=$topic_id" . (($start == 0) ? '' : "&start=$start") . ((strlen($u_sort_param)) ? "&$u_sort_param" : ''), true, $user->session_id) : '', 'MODERATORS' => (isset($forum_moderators[$forum_id]) && sizeof($forum_moderators[$forum_id])) ? implode(', ', $forum_moderators[$forum_id]) : '', 'POST_IMG' => ($topic_data['forum_status'] == ITEM_LOCKED) ? $user->img('button_topic_locked', 'FORUM_LOCKED') : $user->img('button_topic_new', 'POST_NEW_TOPIC'), @@ -630,9 +630,9 @@ $template->assign_vars(array( 'S_SELECT_SORT_KEY' => $s_sort_key, 'S_SELECT_SORT_DAYS' => $s_limit_days, 'S_SINGLE_MODERATOR' => (!empty($forum_moderators[$forum_id]) && sizeof($forum_moderators[$forum_id]) > 1) ? false : true, - 'S_TOPIC_ACTION' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id&start=$start"), + 'S_TOPIC_ACTION' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id" . (($start == 0) ? '' : "&start=$start")), 'S_TOPIC_MOD' => ($topic_mod != '') ? '<select name="action" id="quick-mod-select">' . $topic_mod . '</select>' : '', - 'S_MOD_ACTION' => append_sid("{$phpbb_root_path}mcp.$phpEx", "f=$forum_id&t=$topic_id&start=$start&quickmod=1&redirect=" . urlencode(str_replace('&', '&', $viewtopic_url)), true, $user->session_id), + 'S_MOD_ACTION' => append_sid("{$phpbb_root_path}mcp.$phpEx", "f=$forum_id&t=$topic_id" . (($start == 0) ? '' : "&start=$start") . "&quickmod=1&redirect=" . urlencode(str_replace('&', '&', $viewtopic_url)), true, $user->session_id), 'S_VIEWTOPIC' => true, 'S_DISPLAY_SEARCHBOX' => ($auth->acl_get('u_search') && $auth->acl_get('f_search', $forum_id) && $config['load_search']) ? true : false, @@ -722,7 +722,7 @@ if (!empty($topic_data['poll_start'])) if (!sizeof($voted_id) || sizeof($voted_id) > $topic_data['poll_max_options'] || in_array(VOTE_CONVERTED, $cur_voted_id) || !check_form_key('posting')) { - $redirect_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id&start=$start"); + $redirect_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id" . (($start == 0) ? '' : "&start=$start")); meta_refresh(5, $redirect_url); if (!sizeof($voted_id)) @@ -805,7 +805,7 @@ if (!empty($topic_data['poll_start'])) //, topic_last_post_time = ' . time() . " -- for bumping topics with new votes, ignore for now $db->sql_query($sql); - $redirect_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id&start=$start"); + $redirect_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id" . (($start == 0) ? '' : "&start=$start")); meta_refresh(5, $redirect_url); trigger_error($user->lang['VOTE_SUBMITTED'] . '<br /><br />' . sprintf($user->lang['RETURN_TOPIC'], '<a href="' . $redirect_url . '">', '</a>')); |