diff options
-rwxr-xr-x | git-tools/hooks/pre-commit | 72 | ||||
-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 | 2 | ||||
-rw-r--r-- | phpBB/feed.php | 4 |
5 files changed, 93 insertions, 9 deletions
diff --git a/git-tools/hooks/pre-commit b/git-tools/hooks/pre-commit new file mode 100755 index 0000000000..23ab8d6cdb --- /dev/null +++ b/git-tools/hooks/pre-commit @@ -0,0 +1,72 @@ +#!/usr/bin/env bash +# +# 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="" + +IFS=$'\n' +# 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+=${result//in - on/"$filename"} + 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 4be97e3860..93a2bb0fd6 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -109,6 +109,8 @@ <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>[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> diff --git a/phpBB/feed.php b/phpBB/feed.php index 4ce983a967..4e286ca9b9 100644 --- a/phpBB/feed.php +++ b/phpBB/feed.php @@ -535,7 +535,7 @@ 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; @@ -994,7 +994,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)) { |