aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xgit-tools/hooks/commit-msg257
-rwxr-xr-xgit-tools/hooks/install17
-rwxr-xr-xgit-tools/hooks/prepare-commit-msg10
-rwxr-xr-xgit-tools/hooks/uninstall16
-rw-r--r--phpBB/adm/style/editor.js15
-rwxr-xr-xphpBB/develop/set_permissions.sh9
-rwxr-xr-x[-rw-r--r--]phpBB/includes/db/mssqlnative.php8
-rw-r--r--phpBB/includes/functions_messenger.php7
-rw-r--r--phpBB/includes/functions_privmsgs.php4
-rw-r--r--phpBB/includes/mcp/mcp_queue.php19
-rw-r--r--phpBB/includes/search/fulltext_mysql.php2
-rw-r--r--phpBB/styles/prosilver/template/forum_fn.js13
-rw-r--r--phpBB/styles/prosilver/template/ucp_pm_history.html2
-rw-r--r--phpBB/styles/prosilver/template/viewforum_body.html2
-rw-r--r--phpBB/styles/subsilver2/template/editor.js5
-rw-r--r--phpBB/styles/subsilver2/template/ucp_pm_history.html2
16 files changed, 361 insertions, 27 deletions
diff --git a/git-tools/hooks/commit-msg b/git-tools/hooks/commit-msg
new file mode 100755
index 0000000000..d6ad57a38a
--- /dev/null
+++ b/git-tools/hooks/commit-msg
@@ -0,0 +1,257 @@
+#!/bin/sh
+#
+# A hook to check syntax of a phpBB3 commit message, per:
+# * <http://wiki.phpbb.com/display/DEV/Git>
+# * <http://area51.phpbb.com/phpBB/viewtopic.php?p=209919#p209919>
+#
+# This is a commit-msg hook.
+#
+# To install this you can either copy or symlink it to
+# $GIT_DIR/hooks, example:
+#
+# ln -s ../../git-tools/hooks/commit-msg \\
+# .git/hooks/commit-msg
+
+config_ns="phpbb.hooks.commit-msg";
+
+if [ "$(git config --bool $config_ns.fatal)" = "false" ]
+then
+ fatal=0;
+else
+ fatal=1;
+fi
+
+debug_level=$(git config --int $config_ns.debug || echo 0);
+
+# Error codes
+ERR_LENGTH=1;
+ERR_HEADER=2;
+ERR_EMPTY=3;
+ERR_DESCRIPTION=4;
+ERR_FOOTER=5;
+ERR_EOF=6;
+ERR_UNKNOWN=42;
+
+debug()
+{
+ local level;
+
+ level=$1;
+ shift;
+
+ if [ $debug_level -ge $level ]
+ then
+ echo $@;
+ fi
+}
+
+quit()
+{
+ if [ $1 -gt 0 ] && [ $1 -ne $ERR_UNKNOWN ] && [ $fatal -eq 0 ]
+ then
+ exit 0;
+ else
+ exit $1;
+ fi
+}
+
+if [ "$(wc --max-line-length "$1" | cut -f1 -d" ")" -gt 80 ]
+then
+ echo "The following lines are greater than 80 characters long:\n" >&2;
+
+ grep -nE '.{81,}' "$1" >&2;
+
+ quit $ERR_LENGTH;
+fi
+
+lines=$(wc --lines "$1" | cut -f1 -d" ");
+expecting=header;
+in_description=0;
+in_empty=0;
+ticket=0;
+branch_regex="[a-z]+[a-z0-9-]*[a-z0-9]+";
+i=1;
+tickets="";
+
+while [ $i -le $lines ]
+do
+ # Grab the line we are studying
+ line=$(head -n$i "$1" | tail -n1);
+
+ debug 1 "==> [$i] $line (description: $in_description, empty: $in_empty)";
+
+ err=$ERR_UNKNOWN;
+
+ if [ -z "$expecting" ]
+ then
+ quit $err;
+ fi
+
+ if [ "${expecting#comment}" = "$expecting" ]
+ then
+ # Prefix comments to the expected tokens list
+ expecting="comment $expecting";
+ fi
+
+ debug 2 "Expecting: $expecting";
+
+ # Loop over each of the expected line formats
+ for expect in $expecting
+ do
+ # Reset the error code each iteration
+ err=$ERR_UNKNOWN;
+
+ # Test for validity of each line format
+ # This is done first so $? contains the result
+ case $expect in
+ "header")
+ err=$ERR_HEADER;
+ echo "$line" | grep -Eq "^\[(ticket/[0-9]+|feature/$branch_regex|task/$branch_regex)\] [A-Z].+$"
+ ;;
+ "empty")
+ err=$ERR_EMPTY;
+ echo "$line" | grep -Eq "^$"
+ ;;
+ "description")
+ err=$ERR_DESCRIPTION;
+ # Free flow text, the line length was constrained by the initial check
+ echo "$line" | grep -Eq "^.+$";
+ ;;
+ "footer")
+ err=$ERR_FOOTER;
+ # Each ticket is on its own line
+ echo "$line" | grep -Eq "^PHPBB3-[0-9]+$";
+ ;;
+ "eof")
+ err=$ERR_EOF;
+ # Should not end up here
+ false
+ ;;
+ "comment")
+ echo "$line" | grep -Eq "^#";
+ ;;
+ *)
+ echo "Unrecognised token $expect" >&2;
+ quit $err;
+ ;;
+ esac
+
+ # Preserve the result of the line check
+ result=$?;
+
+ debug 2 "$expect - '$line' - $result";
+
+ if [ $result -eq 0 ]
+ then
+ # Break out the loop on success
+ # otherwise roll on round and keep looking for a match
+ break;
+ fi
+ done
+
+ if [ $result -eq 0 ]
+ then
+ # Have we switched out of description mode?
+ if [ $in_description -eq 1 ] && [ "$expect" != "description" ] && [ "$expect" != "empty" ] && [ "$expect" != "comment" ]
+ then
+ # Yes, okay we need to backtrace one line and reanalyse
+ in_description=0;
+ i=$(( $i - $in_empty ));
+
+ # Reset the empty counter
+ in_empty=0;
+ continue;
+ fi
+
+ # Successful match, but on which line format
+ case $expect in
+ "header")
+ expecting="empty";
+
+ echo "$line" | grep -Eq "^\[ticket/[0-9]+\]$" && (
+ ticket=$(echo "$line" | sed 's,\[ticket/\([0-9]*\)\].*,\1,');
+ )
+ ;;
+ "empty")
+ # Description might have empty lines as spacing
+ expecting="footer description";
+ in_empty=$(($in_empty + 1));
+
+ if [ $in_description -eq 1 ]
+ then
+ expecting="$expecting empty";
+ fi
+ ;;
+ "description")
+ expecting="description empty";
+ in_description=1;
+ ;;
+ "footer")
+ expecting="footer eof";
+ if [ "$tickets" = "" ]
+ then
+ tickets="$line";
+ else
+ tickets="$tickets $line";
+ fi
+ ;;
+ "comment")
+ # Comments should expect the same thing again
+ ;;
+ *)
+ echo "Unrecognised token $expect" >&2;
+ quit 254;
+ ;;
+ esac
+
+ if [ "$expect" != "empty" ]
+ then
+ in_empty=0;
+ fi
+
+ debug 3 "Now expecting: $expecting";
+ else
+ # None of the expected line formats matched
+ # Guess we'll call it a day here then
+ echo "Syntax error on line $i:" >&2;
+ echo ">> $line" >&2;
+ echo -n "Expecting: " >&2;
+ echo "$expecting" | sed 's/ /, /g' >&2;
+ exit $err;
+ fi
+
+ i=$(( $i + 1 ));
+done
+
+# If EOF is expected exit cleanly
+echo "$expecting" | grep -q "eof" || (
+ # Unexpected EOF, error
+ echo "Unexpected EOF encountered" >&2;
+ quit $ERR_EOF;
+) && (
+ # Do post scan checks
+ if [ ! -z "$tickets" ]
+ then
+ # Check for duplicate tickets
+ dupes=$(echo "$tickets" | sed 's/ /\n/g' | sort | uniq -d);
+
+ if [ ! -z "$dupes" ]
+ then
+ echo "The following tickets are repeated:" >&2;
+ echo "$dupes" | sed 's/ /\n/g;s/^/* /g' >&2;
+ quit $ERR_FOOTER;
+ fi
+ fi
+ # Check the branch ticket is mentioned, doesn't make sense otherwise
+ if [ $ticket -gt 0 ]
+ then
+ echo "$tickets" | grep -Eq "\bPHPBB3-$ticket\b" || (
+ echo "Ticket ID [$ticket] of branch missing from list of tickets:" >&2;
+ echo "$tickets" | sed 's/ /\n/g;s/^/* /g' >&2;
+ quit $ERR_FOOTER;
+ ) || exit $?;
+ fi
+ # Got here okay exit to reality
+ exit 0;
+);
+exit $?;
diff --git a/git-tools/hooks/install b/git-tools/hooks/install
new file mode 100755
index 0000000000..a42c55a769
--- /dev/null
+++ b/git-tools/hooks/install
@@ -0,0 +1,17 @@
+#!/bin/sh
+#
+# Script to install the git hooks
+# by symlinking them into the .git/hooks directory
+#
+# Usage (from within git-tools/hooks):
+# ./install
+
+dir=$(dirname $0)
+
+for file in $(ls $dir)
+do
+ if [ $file != "install" ] && [ $file != "uninstall" ]
+ then
+ ln -s "../../git-tools/hooks/$file" "$dir/../../.git/hooks/$file"
+ fi
+done
diff --git a/git-tools/hooks/prepare-commit-msg b/git-tools/hooks/prepare-commit-msg
index 033cb187c7..2bf25e58a4 100755
--- a/git-tools/hooks/prepare-commit-msg
+++ b/git-tools/hooks/prepare-commit-msg
@@ -30,5 +30,13 @@ branch="$(echo "$branch" | sed "s/refs\/heads\///g")"
# * also make sure the branch name begins with bug/ or feature/
if [ "$2" = "" ]
then
- echo "[$branch] $(cat "$1")" > "$1"
+ tail="";
+
+ # Branch is prefixed with 'ticket/', append ticket ID to message
+ if [ "$branch" != "${branch##ticket/}" ];
+ then
+ tail="\n\nPHPBB3-${branch##ticket/}";
+ fi
+
+ echo "[$branch]$tail $(cat "$1")" > "$1"
fi
diff --git a/git-tools/hooks/uninstall b/git-tools/hooks/uninstall
new file mode 100755
index 0000000000..1b3b7fd2c9
--- /dev/null
+++ b/git-tools/hooks/uninstall
@@ -0,0 +1,16 @@
+#!/bin/sh
+#
+# Script to uninstall the git hooks
+#
+# Usage (from within git-tools/hooks):
+# ./uninstall
+
+dir=$(dirname $0)
+
+for file in $(ls $dir)
+do
+ if [ $file != "install" ] && [ $file != "uninstall" ]
+ then
+ rm -f "$dir/../../.git/hooks/$file"
+ fi
+done
diff --git a/phpBB/adm/style/editor.js b/phpBB/adm/style/editor.js
index 7e3ce1c708..217aa699e2 100644
--- a/phpBB/adm/style/editor.js
+++ b/phpBB/adm/style/editor.js
@@ -46,7 +46,11 @@ function initInsertions()
{
textarea.focus();
baseHeight = doc.selection.createRange().duplicate().boundingHeight;
- // document.body.focus();
+
+ if (!document.forms[form_name])
+ {
+ document.body.focus();
+ }
}
}
@@ -230,6 +234,7 @@ function addquote(post_id, username)
theSelection = theSelection.replace(/&lt\;/ig, '<');
theSelection = theSelection.replace(/&gt\;/ig, '>');
theSelection = theSelection.replace(/&amp\;/ig, '&');
+ theSelection = theSelection.replace(/&nbsp\;/ig, ' ');
}
else if (document.all)
{
@@ -273,8 +278,8 @@ function mozWrap(txtarea, open, close)
var s3 = (txtarea.value).substring(selEnd, selLength);
txtarea.value = s1 + open + s2 + close + s3;
- txtarea.selectionStart = selEnd + open.length + close.length;
- txtarea.selectionEnd = txtarea.selectionStart;
+ txtarea.selectionStart = selStart + open.length;
+ txtarea.selectionEnd = selEnd + open.length;
txtarea.focus();
txtarea.scrollTop = scrollTop;
@@ -327,8 +332,8 @@ function colorPalette(dir, width, height)
for (b = 0; b < 5; b++)
{
color = String(numberList[r]) + String(numberList[g]) + String(numberList[b]);
- document.write('<td bgcolor="#' + color + '">');
- document.write('<a href="#" onclick="bbfontstyle(\'[color=#' + color + ']\', \'[/color]\'); return false;" onmouseover="helpline(\'s\');" onmouseout="helpline(\'tip\');"><img src="images/spacer.gif" width="' + width + '" height="' + height + '" alt="#' + color + '" title="#' + color + '" /></a>');
+ document.write('<td bgcolor="#' + color + '" style="width: ' + width + 'px; height: ' + height + 'px;">');
+ document.write('<a href="#" onclick="bbfontstyle(\'[color=#' + color + ']\', \'[/color]\'); return false;"><img src="images/spacer.gif" width="' + width + '" height="' + height + '" alt="#' + color + '" title="#' + color + '" /></a>');
document.writeln('</td>');
}
diff --git a/phpBB/develop/set_permissions.sh b/phpBB/develop/set_permissions.sh
new file mode 100755
index 0000000000..879b94e518
--- /dev/null
+++ b/phpBB/develop/set_permissions.sh
@@ -0,0 +1,9 @@
+#!/bin/sh
+# set permissions required for installation
+
+dir=$(dirname $0)
+
+for file in cache files store config.php images/avatars/upload
+do
+ chmod a+w $dir/../$file
+done
diff --git a/phpBB/includes/db/mssqlnative.php b/phpBB/includes/db/mssqlnative.php
index 98e22d4412..44d5722e4f 100644..100755
--- a/phpBB/includes/db/mssqlnative.php
+++ b/phpBB/includes/db/mssqlnative.php
@@ -503,6 +503,7 @@ class dbal_mssqlnative extends dbal
{
$errors = @sqlsrv_errors(SQLSRV_ERR_ERRORS);
$error_message = '';
+ $code = 0;
if ($errors != null)
{
@@ -510,6 +511,7 @@ class dbal_mssqlnative extends dbal
{
$error_message .= "SQLSTATE: ".$error[ 'SQLSTATE']."\n";
$error_message .= "code: ".$error[ 'code']."\n";
+ $code = $error['code'];
$error_message .= "message: ".$error[ 'message']."\n";
}
$this->last_error_result = $error_message;
@@ -519,7 +521,11 @@ class dbal_mssqlnative extends dbal
{
$error = (isset($this->last_error_result) && $this->last_error_result) ? $this->last_error_result : array();
}
- return $error;
+
+ return array(
+ 'message' => $error,
+ 'code' => $code,
+ );
}
/**
diff --git a/phpBB/includes/functions_messenger.php b/phpBB/includes/functions_messenger.php
index 99883cd9ca..bb0d88ec1b 100644
--- a/phpBB/includes/functions_messenger.php
+++ b/phpBB/includes/functions_messenger.php
@@ -671,11 +671,18 @@ class queue
$package_size = $data_ary['package_size'];
$num_items = (!$package_size || sizeof($data_ary['data']) < $package_size) ? sizeof($data_ary['data']) : $package_size;
+ /*
+ * This code is commented out because it causes problems on some web hosts.
+ * The core problem is rather restrictive email sending limits.
+ * This code is nly useful if you have no such restrictions from the
+ * web host and the package size setting is wrong.
+
// If the amount of emails to be sent is way more than package_size than we need to increase it to prevent backlogs...
if (sizeof($data_ary['data']) > $package_size * 2.5)
{
$num_items = sizeof($data_ary['data']);
}
+ */
switch ($object)
{
diff --git a/phpBB/includes/functions_privmsgs.php b/phpBB/includes/functions_privmsgs.php
index 4fc5034f7b..c4cbb7ca1e 100644
--- a/phpBB/includes/functions_privmsgs.php
+++ b/phpBB/includes/functions_privmsgs.php
@@ -1751,6 +1751,8 @@ function message_history($msg_id, $user_id, $message_row, $folder, $in_post_mode
return false;
}
+ $title = $row['message_subject'];
+
$rowset = array();
$bbcode_bitfield = '';
$folder_url = append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm') . '&amp;folder=';
@@ -1774,8 +1776,6 @@ function message_history($msg_id, $user_id, $message_row, $folder, $in_post_mode
while ($row = $db->sql_fetchrow($result));
$db->sql_freeresult($result);
- $title = $row['message_subject'];
-
if (sizeof($rowset) == 1 && !$in_post_mode)
{
return false;
diff --git a/phpBB/includes/mcp/mcp_queue.php b/phpBB/includes/mcp/mcp_queue.php
index f84a8c5f07..e43881fab2 100644
--- a/phpBB/includes/mcp/mcp_queue.php
+++ b/phpBB/includes/mcp/mcp_queue.php
@@ -691,16 +691,19 @@ function approve_post($post_id_list, $id, $mode)
{
$show_notify = false;
- foreach ($post_info as $post_data)
+ if ($config['email_enable'] || $config['jab_enable'])
{
- if ($post_data['poster_id'] == ANONYMOUS)
- {
- continue;
- }
- else
+ foreach ($post_info as $post_data)
{
- $show_notify = true;
- break;
+ if ($post_data['poster_id'] == ANONYMOUS)
+ {
+ continue;
+ }
+ else
+ {
+ $show_notify = true;
+ break;
+ }
}
}
diff --git a/phpBB/includes/search/fulltext_mysql.php b/phpBB/includes/search/fulltext_mysql.php
index da3833754e..0be3a10e5f 100644
--- a/phpBB/includes/search/fulltext_mysql.php
+++ b/phpBB/includes/search/fulltext_mysql.php
@@ -122,7 +122,7 @@ class fulltext_mysql extends search_backend
if ($terms == 'all')
{
- $match = array('#\sand\s#iu', '#\sor\s#iu', '#\snot\s#iu', '#\+#', '#-#', '#\|#');
+ $match = array('#\sand\s#iu', '#\sor\s#iu', '#\snot\s#iu', '#(^|\s)\+#', '#(^|\s)-#', '#(^|\s)\|#');
$replace = array(' +', ' |', ' -', ' +', ' -', ' |');
$keywords = preg_replace($match, $replace, $keywords);
diff --git a/phpBB/styles/prosilver/template/forum_fn.js b/phpBB/styles/prosilver/template/forum_fn.js
index 6fb3778952..4a85858df5 100644
--- a/phpBB/styles/prosilver/template/forum_fn.js
+++ b/phpBB/styles/prosilver/template/forum_fn.js
@@ -98,16 +98,21 @@ function viewableArea(e, itself)
/**
* Set display of page element
* s[-1,0,1] = hide,toggle display,show
+* type = string: inline, block, inline-block or other CSS "display" type
*/
-function dE(n, s)
+function dE(n, s, type)
{
- var e = document.getElementById(n);
+ if (!type)
+ {
+ type = 'block';
+ }
+ var e = document.getElementById(n);
if (!s)
{
- s = (e.style.display == '' || e.style.display == 'block') ? -1 : 1;
+ s = (e.style.display == '' || e.style.display == type) ? -1 : 1;
}
- e.style.display = (s == 1) ? 'block' : 'none';
+ e.style.display = (s == 1) ? type : 'none';
}
/**
diff --git a/phpBB/styles/prosilver/template/ucp_pm_history.html b/phpBB/styles/prosilver/template/ucp_pm_history.html
index c555e90640..9051eb2ee0 100644
--- a/phpBB/styles/prosilver/template/ucp_pm_history.html
+++ b/phpBB/styles/prosilver/template/ucp_pm_history.html
@@ -1,7 +1,7 @@
<h3 id="review">
<span class="right-box"><a href="#review" onclick="viewableArea(getElementById('topicreview'), true); var rev_text = getElementById('review').getElementsByTagName('a').item(0).firstChild; if (rev_text.data == '{LA_EXPAND_VIEW}'){rev_text.data = '{LA_COLLAPSE_VIEW}'; } else if (rev_text.data == '{LA_COLLAPSE_VIEW}'){rev_text.data = '{LA_EXPAND_VIEW}'};">{L_EXPAND_VIEW}</a></span>
- {L_MESSAGE_HISTORY}: {HISTORY_TITLE}
+ {L_MESSAGE_HISTORY}:
</h3>
<div id="topicreview">
diff --git a/phpBB/styles/prosilver/template/viewforum_body.html b/phpBB/styles/prosilver/template/viewforum_body.html
index 309375c269..12073a39d2 100644
--- a/phpBB/styles/prosilver/template/viewforum_body.html
+++ b/phpBB/styles/prosilver/template/viewforum_body.html
@@ -39,7 +39,7 @@
<!-- IF not S_IS_BOT and S_DISPLAY_POST_INFO -->
<div class="buttons">
- <div class="<!-- IF S_IS_LOCKED -->locked-icon<!-- ELSE -->post-icon<!-- ENDIF -->"><a href="{U_POST_NEW_TOPIC}" title="<!-- IF S_IS_LOCKED -->{L_FORUM_LOCKED}<!-- ELSE -->{L_POST_TOPIC}<!-- ENDIF -->"><span></span><!-- IF S_IS_LOCKED -->{L_FORUM_LOCKED}<!-- ELSE -->{L_POST_TOPIC}<!-- ENDIF --></a></div>
+ <div class="<!-- IF S_IS_LOCKED -->locked-icon<!-- ELSE -->post-icon<!-- ENDIF -->" title="<!-- IF S_IS_LOCKED -->{L_FORUM_LOCKED}<!-- ELSE -->{L_POST_TOPIC}<!-- ENDIF -->"><a href="{U_POST_NEW_TOPIC}"><span></span><!-- IF S_IS_LOCKED -->{L_FORUM_LOCKED}<!-- ELSE -->{L_POST_TOPIC}<!-- ENDIF --></a></div>
</div>
<!-- ENDIF -->
diff --git a/phpBB/styles/subsilver2/template/editor.js b/phpBB/styles/subsilver2/template/editor.js
index e340bc74b5..cd22812bab 100644
--- a/phpBB/styles/subsilver2/template/editor.js
+++ b/phpBB/styles/subsilver2/template/editor.js
@@ -240,6 +240,7 @@ function addquote(post_id, username, l_wrote)
theSelection = theSelection.replace(/&lt\;/ig, '<');
theSelection = theSelection.replace(/&gt\;/ig, '>');
theSelection = theSelection.replace(/&amp\;/ig, '&');
+ theSelection = theSelection.replace(/&nbsp\;/ig, ' ');
}
else if (document.all)
{
@@ -387,8 +388,8 @@ function colorPalette(dir, width, height)
for (b = 0; b < 5; b++)
{
color = String(numberList[r]) + String(numberList[g]) + String(numberList[b]);
- document.write('<td bgcolor="#' + color + '">');
- document.write('<a href="#" onclick="bbfontstyle(\'[color=#' + color + ']\', \'[/color]\'); return false;" onmouseover="helpline(\'s\');" onmouseout="helpline(\'tip\');"><img src="images/spacer.gif" width="' + width + '" height="' + height + '" alt="#' + color + '" title="#' + color + '" /></a>');
+ document.write('<td bgcolor="#' + color + '" style="width: ' + width + 'px; height: ' + height + 'px;">');
+ document.write('<a href="#" onclick="bbfontstyle(\'[color=#' + color + ']\', \'[/color]\'); return false;"><img src="images/spacer.gif" width="' + width + '" height="' + height + '" alt="#' + color + '" title="#' + color + '" /></a>');
document.writeln('</td>');
}
diff --git a/phpBB/styles/subsilver2/template/ucp_pm_history.html b/phpBB/styles/subsilver2/template/ucp_pm_history.html
index 53391b30c9..8754acaaa2 100644
--- a/phpBB/styles/subsilver2/template/ucp_pm_history.html
+++ b/phpBB/styles/subsilver2/template/ucp_pm_history.html
@@ -6,7 +6,7 @@
<table class="tablebg" width="100%" cellspacing="1">
<tr>
- <th align="center">{L_MESSAGE_HISTORY} - {HISTORY_TITLE}</th>
+ <th align="center">{L_MESSAGE_HISTORY}</th>
</tr>
<tr>
<td class="row1"><div style="overflow: auto; width: 100%; height: 300px;">