diff --git a/.gitignore b/.gitignore index e6e017f85e..4093aeb56d 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ /phpBB/cache/*.html /phpBB/cache/*.php /phpBB/cache/queue.php.lock +/phpBB/composer.phar /phpBB/config.php /phpBB/config_dev.php /phpBB/config_test.php @@ -11,6 +12,7 @@ /phpBB/images/avatars/gallery/* /phpBB/images/avatars/upload/* /phpBB/store/* +/phpBB/vendor /tests/phpbb_unit_tests.sqlite2 /tests/test_config.php /tests/tmp/* diff --git a/.travis.yml b/.travis.yml index d5e1231584..f21928dd37 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,6 +13,8 @@ before_script: - sh -c "if [ '$DB' = 'mysql' ]; then mysql -e 'create database IF NOT EXISTS phpbb_tests;'; fi" - sh -c "if [ '$TRAVIS_PHP_VERSION' = '5.2' ]; then pear install --force phpunit/DbUnit; else pyrus install --force phpunit/DbUnit; fi" - phpenv rehash + - curl -s http://getcomposer.org/installer | php + - php composer.phar install script: - phpunit --configuration travis/phpunit-$DB-travis.xml diff --git a/README.md b/README.md index 51e65176c6..a7feb8db40 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,15 @@ phpBB is a free bulletin board written in PHP. Find support and lots more on [phpBB.com](http://www.phpbb.com)! Discuss the development on [area51](http://area51.phpbb.com/phpBB/index.php). +## INSTALLING DEPENDENCIES + +To be able to run an installation from the repo (and not from a pre-built package) you need to run the following commands to install phpBB's dependencies. + + cd phpBB + curl -s http://getcomposer.org/installer | php + php composer.phar install + + ## CONTRIBUTE 1. [Create an account on phpBB.com](http://www.phpbb.com/community/ucp.php?mode=register) diff --git a/phpBB/adm/images/alert_close.png b/phpBB/adm/images/alert_close.png new file mode 100644 index 0000000000..79750a013c Binary files /dev/null and b/phpBB/adm/images/alert_close.png differ diff --git a/phpBB/adm/style/acp_attachments.html b/phpBB/adm/style/acp_attachments.html index 33ef8062a6..c2f8b34792 100644 --- a/phpBB/adm/style/acp_attachments.html +++ b/phpBB/adm/style/acp_attachments.html @@ -248,7 +248,7 @@
» {L_ALLOWED_IN_PM_POST} {groups.CATEGORY} -  {ICON_EDIT}  {ICON_DELETE}  +  {ICON_EDIT}  {ICON_DELETE}  diff --git a/phpBB/adm/style/acp_bbcodes.html b/phpBB/adm/style/acp_bbcodes.html index b85e8eca81..5939af24ae 100644 --- a/phpBB/adm/style/acp_bbcodes.html +++ b/phpBB/adm/style/acp_bbcodes.html @@ -101,7 +101,7 @@ {bbcodes.BBCODE_TAG} - {ICON_EDIT} {ICON_DELETE} + {ICON_EDIT} {ICON_DELETE} diff --git a/phpBB/adm/style/acp_bots.html b/phpBB/adm/style/acp_bots.html index 886005caa3..87679fc33a 100644 --- a/phpBB/adm/style/acp_bots.html +++ b/phpBB/adm/style/acp_bots.html @@ -76,9 +76,9 @@ {bots.BOT_NAME}  {bots.LAST_VISIT}  -  {bots.L_ACTIVATE_DEACTIVATE}  +  {bots.L_ACTIVATE_DEACTIVATE}   {L_EDIT}  -  {L_DELETE}  +  {L_DELETE}  diff --git a/phpBB/adm/style/acp_forums.html b/phpBB/adm/style/acp_forums.html index 447c0ce466..048a24a328 100644 --- a/phpBB/adm/style/acp_forums.html +++ b/phpBB/adm/style/acp_forums.html @@ -443,7 +443,7 @@ - + {forums.FOLDER_IMAGE}
{forums.FORUM_IMAGE}
@@ -453,17 +453,17 @@ - {ICON_MOVE_UP_DISABLED} - {ICON_MOVE_DOWN} + {ICON_MOVE_UP_DISABLED} + {ICON_MOVE_DOWN} - {ICON_MOVE_UP} - {ICON_MOVE_DOWN} + {ICON_MOVE_UP} + {ICON_MOVE_DOWN} - {ICON_MOVE_UP} - {ICON_MOVE_DOWN_DISABLED} + {ICON_MOVE_UP} + {ICON_MOVE_DOWN_DISABLED} - {ICON_MOVE_UP_DISABLED} - {ICON_MOVE_DOWN_DISABLED} + {ICON_MOVE_UP_DISABLED} + {ICON_MOVE_DOWN_DISABLED} {ICON_EDIT} @@ -500,6 +500,14 @@ + + diff --git a/phpBB/adm/style/acp_groups.html b/phpBB/adm/style/acp_groups.html index 158751623a..ed94fa985e 100644 --- a/phpBB/adm/style/acp_groups.html +++ b/phpBB/adm/style/acp_groups.html @@ -350,7 +350,7 @@ {groups.TOTAL_MEMBERS} {L_SETTINGS} {L_MEMBERS} - {L_DELETE}{L_DELETE} + {L_DELETE}{L_DELETE} diff --git a/phpBB/adm/style/acp_icons.html b/phpBB/adm/style/acp_icons.html index 85b5343666..a8864d42f7 100644 --- a/phpBB/adm/style/acp_icons.html +++ b/phpBB/adm/style/acp_icons.html @@ -245,7 +245,7 @@ {ICON_MOVE_UP_DISABLED}{ICON_MOVE_UP}  {ICON_MOVE_DOWN_DISABLED}{ICON_MOVE_DOWN} -  {ICON_EDIT} {ICON_DELETE} +  {ICON_EDIT} {ICON_DELETE} diff --git a/phpBB/adm/style/acp_main.html b/phpBB/adm/style/acp_main.html index 11f7fedd38..d9f833d878 100644 --- a/phpBB/adm/style/acp_main.html +++ b/phpBB/adm/style/acp_main.html @@ -152,35 +152,35 @@
{L_STATISTIC_RESYNC_OPTIONS} -
+

 
-
+

 
-
+

{L_RESYNC_STATS_EXPLAIN}
-
+

{L_RESYNC_POSTCOUNTS_EXPLAIN}
-
+

{L_RESYNC_POST_MARKING_EXPLAIN}
@@ -188,19 +188,20 @@ -
+

{L_PURGE_SESSIONS_EXPLAIN}
-
+ + +

{L_PURGE_CACHE_EXPLAIN}
-
diff --git a/phpBB/adm/style/acp_modules.html b/phpBB/adm/style/acp_modules.html index 3f1c0bf50b..6c4645e80c 100644 --- a/phpBB/adm/style/acp_modules.html +++ b/phpBB/adm/style/acp_modules.html @@ -164,7 +164,7 @@ {ICON_MOVE_DOWN_DISABLED} {ICON_EDIT} - {ICON_DELETE} + {ICON_DELETE} diff --git a/phpBB/adm/style/acp_permission_roles.html b/phpBB/adm/style/acp_permission_roles.html index 658d8dd0c8..2ac77af25d 100644 --- a/phpBB/adm/style/acp_permission_roles.html +++ b/phpBB/adm/style/acp_permission_roles.html @@ -174,7 +174,7 @@ {ICON_MOVE_DOWN_DISABLED} {ICON_EDIT} - {ICON_DELETE} + {ICON_DELETE} diff --git a/phpBB/adm/style/acp_profile.html b/phpBB/adm/style/acp_profile.html index 0ac0d78a64..4a6df768a8 100644 --- a/phpBB/adm/style/acp_profile.html +++ b/phpBB/adm/style/acp_profile.html @@ -195,7 +195,7 @@ {fields.FIELD_IDENT} {fields.FIELD_TYPE} - {fields.L_ACTIVATE_DEACTIVATE} | {L_TRANSLATE} + {fields.L_ACTIVATE_DEACTIVATE} | {L_TRANSLATE} @@ -213,7 +213,7 @@ {ICON_EDIT_DISABLED} - {ICON_DELETE} + {ICON_DELETE} diff --git a/phpBB/adm/style/acp_ranks.html b/phpBB/adm/style/acp_ranks.html index 2f77a256b1..7fb7da7095 100644 --- a/phpBB/adm/style/acp_ranks.html +++ b/phpBB/adm/style/acp_ranks.html @@ -80,7 +80,7 @@ {ranks.RANK_TITLE}  -   {ranks.RANK_TITLE}   -  {ranks.MIN_POSTS} - {ICON_EDIT} {ICON_DELETE} + {ICON_EDIT} {ICON_DELETE} diff --git a/phpBB/adm/style/acp_reasons.html b/phpBB/adm/style/acp_reasons.html index 522aec5930..7cf2cce4c9 100644 --- a/phpBB/adm/style/acp_reasons.html +++ b/phpBB/adm/style/acp_reasons.html @@ -99,7 +99,7 @@ {ICON_EDIT} - {ICON_DELETE} + {ICON_DELETE} {ICON_DELETE_DISABLED} diff --git a/phpBB/adm/style/acp_words.html b/phpBB/adm/style/acp_words.html index 113f58ef92..4acd75f933 100644 --- a/phpBB/adm/style/acp_words.html +++ b/phpBB/adm/style/acp_words.html @@ -60,7 +60,7 @@ {words.WORD} {words.REPLACEMENT} -  {ICON_EDIT}  {ICON_DELETE}  +  {ICON_EDIT}  {ICON_DELETE}  diff --git a/phpBB/adm/style/admin.css b/phpBB/adm/style/admin.css index 14a2b6dded..7afcc3d23b 100644 --- a/phpBB/adm/style/admin.css +++ b/phpBB/adm/style/admin.css @@ -101,6 +101,10 @@ hr { font-size: 0.85em; } +.hidden { + display: none; +} + /* General links */ a:link, a:visited { color: #105289; @@ -1087,6 +1091,56 @@ input.disabled { color: #666666; } +/* jQuery popups +---------------------------------------- */ +.phpbb_alert { + background-color: #FFFFFF; + border: 1px solid #999999; + position: fixed; + display: none; + top: 100px; + left: 35%; + width: 30%; + z-index: 50; + padding: 25px; + padding: 0 25px 20px 25px; +} + +.phpbb_alert .alert_close { + display: block; + float: right; + width: 16px; + height: 16px; + overflow: hidden; + text-decoration: none !important; + background: transparent url("../images/alert_close.png") 0 0 no-repeat; + margin-top: -7px; + margin-right: -31px; +} +.phpbb_alert .alert_close:hover { + background-position: 0 -16px; +} + + +.phpbb_alert p { + margin: 8px 0; + padding-bottom: 8px; +} + +#darkenwrapper { + display: none; +} + +#darken { + position: fixed; + left: 0; + top: 0; + width: 100%; + height: 100%; + background-color: #000000; + opacity: 0.5; +} + /* Pagination ---------------------------------------- */ .pagination { diff --git a/phpBB/adm/style/ajax.js b/phpBB/adm/style/ajax.js new file mode 100644 index 0000000000..fd2f7a2122 --- /dev/null +++ b/phpBB/adm/style/ajax.js @@ -0,0 +1,135 @@ +(function($) { // Avoid conflicts with other libraries + +"use strict"; + +var img_templates = { + up: $('.template-up-img'), + up_disabled: $('.template-up-img-disabled'), + down: $('.template-down-img'), + down_disabled: $('.template-down-img-disabled') +}; + +/** + * The following callbacks are for reording forums in acp_forums. forum_down + * is triggered when a forum is moved down, and forum_up is triggered when + * a forum is moved up. It moves the row up or down, and deactivates / + * activates any up / down icons that require it (the ones at the top or bottom). + */ +phpbb.add_ajax_callback('forum_down', function() { + var el = $(this), + tr = el.parents('tr'); + + if (tr.is(':first-child')) + { + var up_img = img_templates.up.clone().attr('href', tr.attr('data-up')); + el.parents('span').siblings('.up').html(up_img); + + tr.next().find('.up').html(img_templates.up_disabled); + + phpbb.ajaxify({ + selector: el.parents('span').siblings('.up').children('a'), + callback: 'forum_up' + }); + } + + tr.insertAfter(tr.next()); + + if (tr.is(':last-child')) + { + el.replaceWith(img_templates.down_disabled); + + var down_img = img_templates.down.clone().attr('href', tr.attr('data-down')); + tr.prev().find('.down').html(down_img); + + phpbb.ajaxify({ + selector: tr.prev().find('.down').children('a'), + callback: 'forum_down' + }); + } +}); + +phpbb.add_ajax_callback('forum_up', function() { + var el = $(this), + tr = el.parents('tr'); + + if (tr.is(':last-child')) + { + var down_img = img_templates.down.clone().attr('href', tr.attr('data-down')); + el.parents('span').siblings('.down').html(down_img); + + tr.prev().find('.down').html(img_templates.down_disabled); + + phpbb.ajaxify({ + selector: el.parents('span').siblings('.down').children('a'), + callback: 'forum_down' + }); + } + + tr.insertBefore(tr.prev()); + + if (tr.is(':first-child')) + { + el.replaceWith(img_templates.up_disabled); + + var up_img = img_templates.up.clone().attr('href', tr.attr('data-up')); + tr.next().find('.up').html(up_img); + + phpbb.ajaxify({ + selector: tr.next().find('.up').children('a'), + callback: 'forum_up' + }); + } +}); + +/** + * This callback replaces activate links with deactivate links and vice versa. + * It does this by replacing the text, and replacing all instances of "activate" + * in the href with "deactivate", and vice versa. + */ +phpbb.add_ajax_callback('activate_deactivate', function(res) { + var el = $(this), + new_href = el.attr('href'); + + el.text(res.text); + + if (new_href.indexOf('deactivate') !== -1) + { + new_href = new_href.replace('deactivate', 'activate') + } + else + { + new_href = new_href.replace('activate', 'deactivate') + } + + el.attr('href', new_href); +}); + +/** + * The removes the parent row of the link or form that triggered the callback, + * and is good for stuff like the removal of forums. + */ +phpbb.add_ajax_callback('row_delete', function() { + $(this).parents('tr').remove(); +}); + + + +$('[data-ajax]').each(function() { + var $this = $(this), + ajax = $this.attr('data-ajax'), + fn; + + if (ajax !== 'false') + { + fn = (ajax !== 'true') ? ajax : null; + phpbb.ajaxify({ + selector: this, + refresh: $this.attr('data-refresh') !== undefined, + callback: fn + }); + } +}); + + + +})(jQuery); // Avoid conflicts with other libraries diff --git a/phpBB/adm/style/overall_footer.html b/phpBB/adm/style/overall_footer.html index f05e9c56c5..0337080f3d 100644 --- a/phpBB/adm/style/overall_footer.html +++ b/phpBB/adm/style/overall_footer.html @@ -17,11 +17,29 @@
{DEBUG_OUTPUT} + +
+
 
+

{L_LOADING}

{L_PLEASE_WAIT}

+
+ +
+ +

+
+
+ +

+   + +
+ + diff --git a/phpBB/assets/javascript/core.js b/phpBB/assets/javascript/core.js new file mode 100644 index 0000000000..c41edfa145 --- /dev/null +++ b/phpBB/assets/javascript/core.js @@ -0,0 +1,445 @@ +var phpbb = {}; +phpbb.alert_time = 100; + +(function($) { // Avoid conflicts with other libraries + +"use strict"; + +// define a couple constants for keydown functions. +var keymap = { + ENTER: 13, + ESC: 27 +}; + +var dark = $('#darkenwrapper'); +var loading_alert = $('#loadingalert'); + + +/** + * Display a loading screen. + * + * @returns object Returns loading_alert. + */ +phpbb.loading_alert = function() { + if (dark.is(':visible')) + { + loading_alert.fadeIn(phpbb.alert_time); + } + else + { + loading_alert.show(); + dark.fadeIn(phpbb.alert_time, function() { + // Wait five seconds and display an error if nothing has been returned by then. + setTimeout(function() { + if (loading_alert.is(':visible')) + { + phpbb.alert($('#phpbb_alert').attr('data-l-err'), $('#phpbb_alert').attr('data-l-timeout-processing-req')); + } + }, 5000); + }); + } + + return loading_alert; +} + +/** + * Display a simple alert similar to JSs native alert(). + * + * You can only call one alert or confirm box at any one time. + * + * @param string title Title of the message, eg "Information" (HTML). + * @param string msg Message to display (HTML). + * @param bool fadedark Remove the dark background when done? Defaults + * to yes. + * + * @returns object Returns the div created. + */ +phpbb.alert = function(title, msg, fadedark) { + var div = $('#phpbb_alert'); + div.find('.alert_title').html(title); + div.find('.alert_text').html(msg); + + div.bind('click', function(e) { + e.stopPropagation(); + }); + dark.one('click', function(e) { + var fade; + + div.find('.alert_close').unbind('click'); + fade = (typeof fadedark !== 'undefined' && !fadedark) ? div : dark; + fade.fadeOut(phpbb.alert_time, function() { + div.hide(); + }); + + e.preventDefault(); + e.stopPropagation(); + }); + + $(document).bind('keydown', function(e) { + if (e.keyCode === keymap.ENTER || e.keyCode === keymap.ESC) { + dark.trigger('click'); + + e.preventDefault(); + e.stopPropagation(); + } + }); + + div.find('.alert_close').one('click', function(e) { + dark.trigger('click'); + + e.preventDefault(); + }); + + if (loading_alert.is(':visible')) + { + loading_alert.fadeOut(phpbb.alert_time, function() { + dark.append(div); + div.fadeIn(phpbb.alert_time); + }); + } + else if (dark.is(':visible')) + { + dark.append(div); + div.fadeIn(phpbb.alert_time); + } + else + { + dark.append(div); + div.show(); + dark.fadeIn(phpbb.alert_time); + } + + return div; +} + +/** + * Display a simple yes / no box to the user. + * + * You can only call one alert or confirm box at any one time. + * + * @param string msg Message to display (HTML). + * @param function callback Callback. Bool param, whether the user pressed + * yes or no (or whatever their language is). + * @param bool fadedark Remove the dark background when done? Defaults + * to yes. + * + * @returns object Returns the div created. + */ +phpbb.confirm = function(msg, callback, fadedark) { + var div = $('#phpbb_confirm'); + div.find('.alert_text').html(msg); + + div.bind('click', function(e) { + e.stopPropagation(); + }); + + var click_handler = function(e) { + var res = this.className === 'button1'; + var fade = (typeof fadedark !== 'undefined' && !fadedark && res) ? div : dark; + fade.fadeOut(phpbb.alert_time, function() { + div.hide(); + }); + div.find('input[type="button"]').unbind('click', click_handler); + callback(res); + + if (e) { + e.preventDefault(); + e.stopPropagation(); + } + }; + div.find('input[type="button"]').one('click', click_handler); + + dark.one('click', function(e) { + div.find('.alert_close').unbind('click'); + dark.fadeOut(phpbb.alert_time, function() { + div.hide(); + }); + callback(false); + + e.preventDefault(); + e.stopPropagation(); + }); + + $(document).bind('keydown', function(e) { + if (e.keyCode === keymap.ENTER) { + $('input[type="button"].button1').trigger('click'); + e.preventDefault(); + e.stopPropagation(); + } else if (e.keyCode === keymap.ESC) { + $('input[type="button"].button2').trigger('click'); + e.preventDefault(); + e.stopPropagation(); + } + }); + + div.find('.alert_close').one('click', function(e) { + var fade = (typeof fadedark !== 'undefined' && fadedark) ? div : dark; + fade.fadeOut(phpbb.alert_time, function() { + div.hide(); + }); + callback(false); + + e.preventDefault(); + }); + + if (loading_alert.is(':visible')) + { + loading_alert.fadeOut(phpbb.alert_time, function() { + dark.append(div); + div.fadeIn(phpbb.alert_time); + }); + } + else if (dark.is(':visible')) + { + dark.append(div); + div.fadeIn(phpbb.alert_time); + } + else + { + dark.append(div); + div.show(); + dark.fadeIn(phpbb.alert_time); + } + + return div; +} + +/** + * Turn a querystring into an array. + * + * @argument string string The querystring to parse. + * @returns object The object created. + */ +phpbb.parse_querystring = function(string) { + var params = {}, i, split; + + string = string.split('&'); + for (i = 0; i < string.length; i++) + { + split = string[i].split('='); + params[split[0]] = decodeURIComponent(split[1]); + } + return params; +} + + +/** + * Makes a link use AJAX instead of loading an entire page. + * + * This function will work for links (both standard links and links which + * invoke confirm_box) and forms. It will be called automatically for links + * and forms with the data-ajax attribute set, and will call the necessary + * callback. + * + * For more info, view the following page on the phpBB wiki: + * http://wiki.phpbb.com/JavaScript_Function.phpbb.ajaxify + * + * @param object options Options. + * @param bool/function refresh If we are sent back a refresh, should it be + * acted upon? This can either be true / false / a function. + * @param function callback Callback to call on completion of event. Has + * three parameters: the element that the event was evoked from, the JSON + * that was returned and (if it is a form) the form action. + */ +phpbb.ajaxify = function(options) { + var elements = $(options.selector), + refresh = options.refresh, + callback = options.callback, + is_form = elements.is('form'), + event_name = is_form ? 'submit' : 'click'; + + elements.bind(event_name, function(event) { + var action, method, data, submit, that = this, $this = $(this); + + if ($this.find('input[type="submit"][data-clicked]').attr('data-ajax') === 'false') + { + return; + } + + /** + * This is a private function used to handle the callbacks, refreshes + * and alert. It calls the callback, refreshes the page if necessary, and + * displays an alert to the user and removes it after an amount of time. + * + * It cannot be called from outside this function, and is purely here to + * avoid repetition of code. + * + * @param object res The object sent back by the server. + */ + function return_handler(res) + { + var alert; + + // Is a confirmation required? + if (typeof res.S_CONFIRM_ACTION === 'undefined') + { + // If a confirmation is not required, display an alert and call the + // callbacks. + if (typeof res.MESSAGE_TITLE !== 'undefined') + { + alert = phpbb.alert(res.MESSAGE_TITLE, res.MESSAGE_TEXT); + } + else + { + dark.fadeOut(phpbb.alert_time); + } + + if (typeof phpbb.ajax_callbacks[callback] === 'function') + { + phpbb.ajax_callbacks[callback].call(that, res); + } + + // If the server says to refresh the page, check whether the page should + // be refreshed and refresh page after specified time if required. + if (res.REFRESH_DATA) + { + if (typeof refresh === 'function') + { + refresh = refresh(res.REFRESH_DATA.url); + } + else if (typeof refresh !== 'boolean') + { + refresh = false; + } + + setTimeout(function() { + if (refresh) + { + window.location = res.REFRESH_DATA.url; + } + + // Hide the alert even if we refresh the page, in case the user + // presses the back button. + dark.fadeOut(phpbb.alert_time, function() { + alert.hide(); + }); + }, res.REFRESH_DATA.time * 1000); // Server specifies time in seconds + } + } + else + { + // If confirmation is required, display a diologue to the user. + phpbb.confirm(res.MESSAGE_TEXT, function(del) { + if (del) + { + phpbb.loading_alert(); + data = $('
' + res.S_HIDDEN_FIELDS + '
').serialize(); + $.ajax({ + url: res.S_CONFIRM_ACTION, + type: 'POST', + data: data + '&confirm=' + res.YES_VALUE, + success: return_handler, + error: error_handler + }); + } + }, false); + } + } + + function error_handler() + { + var alert; + + alert = phpbb.alert(dark.attr('data-ajax-error-title'), dark.attr('data-ajax-error-text')); + + setTimeout(function () { + dark.fadeOut(phpbb.alert_time, function() { + alert.hide(); + }); + }, 5000); + } + + // If the element is a form, POST must be used and some extra data must + // be taken from the form. + var run_filter = (typeof options.filter === 'function'); + + if (is_form) + { + action = $this.attr('action').replace('&', '&'); + data = $this.serializeArray(); + method = $this.attr('method') || 'GET'; + + if ($this.find('input[type="submit"][data-clicked]')) + { + submit = $this.find('input[type="submit"][data-clicked]'); + data.push({ + name: submit.attr('name'), + value: submit.val() + }); + } + } + else + { + action = this.href; + data = null; + method = 'GET'; + } + + // If filter function returns false, cancel the AJAX functionality, + // and return true (meaning that the HTTP request will be sent normally). + if (run_filter && !options.filter.call(this, data)) + { + return; + } + + phpbb.loading_alert(); + + $.ajax({ + url: action, + type: method, + data: data, + success: return_handler, + error: error_handler + }); + + event.preventDefault(); + }); + + if (is_form) { + elements.find('input:submit').click(function () { + var $this = $(this); + + $this.siblings('[data-clicked]').removeAttr('data-clicked'); + $this.attr('data-clicked', 'true'); + }); + } + + return this; +} + +phpbb.ajax_callbacks = {}; + +/** + * Adds an AJAX callback to be used by phpbb.ajaxify. + * + * See the phpbb.ajaxify comments for information on stuff like parameters. + * + * @param string id The name of the callback. + * @param function callback The callback to be called. + */ +phpbb.add_ajax_callback = function(id, callback) +{ + if (typeof callback === 'function') + { + phpbb.ajax_callbacks[id] = callback; + } + return this; +} + + +/** + * This callback alternates text - it replaces the current text with the text in + * the alt-text data attribute, and replaces the text in the attribute with the + * current text so that the process can be repeated. + */ +phpbb.add_ajax_callback('alt_text', function(data) { + var el = $(this), + alt_text; + + alt_text = el.attr('data-alt-text'); + el.attr('title', alt_text); + el.text(alt_text); +}); + + +})(jQuery); // Avoid conflicts with other libraries diff --git a/phpBB/common.php b/phpBB/common.php index 5c468d74a2..3f039e49c0 100644 --- a/phpBB/common.php +++ b/phpBB/common.php @@ -15,6 +15,8 @@ if (!defined('IN_PHPBB')) exit; } +use Symfony\Component\EventDispatcher\EventDispatcher; + require($phpbb_root_path . 'includes/startup.' . $phpEx); if (file_exists($phpbb_root_path . 'config.' . $phpEx)) @@ -98,6 +100,7 @@ $phpbb_class_loader_ext->set_cache($cache->get_driver()); $phpbb_class_loader->set_cache($cache->get_driver()); // Instantiate some basic classes +$phpbb_dispatcher = new phpbb_event_dispatcher(); $request = new phpbb_request(); $user = new user(); $auth = new auth(); @@ -124,6 +127,9 @@ $phpbb_extension_manager = new phpbb_extension_manager($db, EXT_TABLE, $phpbb_ro $style = new phpbb_style($phpbb_root_path, $phpEx, $config, $user, $phpbb_extension_manager); $template = $style->template; +$phpbb_subscriber_loader = new phpbb_event_extension_subscriber_loader($phpbb_dispatcher, $phpbb_extension_manager); +$phpbb_subscriber_loader->load(); + // Add own hook handler require($phpbb_root_path . 'includes/hooks/index.' . $phpEx); $phpbb_hook = new phpbb_hook(array('exit_handler', 'phpbb_user_session_handler', 'append_sid', array('template', 'display'))); diff --git a/phpBB/composer.json b/phpBB/composer.json new file mode 100644 index 0000000000..1059b97f84 --- /dev/null +++ b/phpBB/composer.json @@ -0,0 +1,5 @@ +{ + "require": { + "symfony/event-dispatcher": "2.0.*" + } +} diff --git a/phpBB/composer.lock b/phpBB/composer.lock new file mode 100644 index 0000000000..062ad4b3aa --- /dev/null +++ b/phpBB/composer.lock @@ -0,0 +1,10 @@ +{ + "hash": "9bada3748ec2933fe0864dcfafbcd671", + "packages": [ + { + "package": "symfony/event-dispatcher", + "version": "v2.0.10" + } + ], + "aliases": [] +} diff --git a/phpBB/docs/AUTHORS b/phpBB/docs/AUTHORS index 4fe0af6e28..8be261706e 100644 --- a/phpBB/docs/AUTHORS +++ b/phpBB/docs/AUTHORS @@ -79,3 +79,6 @@ Pear (c) 2001-2004 PHP Group, http://pear.php.net Text_Diff-0.2.1 http://pear.php.net/package/Text_Diff +MIT licenced: +Symfony2 (c) 2004-2011 Fabien Potencier, http://symfony.com/ + diff --git a/phpBB/download/file.php b/phpBB/download/file.php index 2baa9d6c8a..c01b0789de 100644 --- a/phpBB/download/file.php +++ b/phpBB/download/file.php @@ -56,6 +56,7 @@ if (isset($_GET['avatar'])) $phpbb_class_loader_ext->set_cache($cache->get_driver()); $phpbb_class_loader->set_cache($cache->get_driver()); + $phpbb_dispatcher = new phpbb_event_dispatcher(); $request = new phpbb_request(); $db = new $sql_db(); @@ -78,6 +79,9 @@ if (isset($_GET['avatar'])) // load extensions $phpbb_extension_manager = new phpbb_extension_manager($db, EXT_TABLE, $phpbb_root_path, ".$phpEx", $cache->get_driver()); + $phpbb_subscriber_loader = new phpbb_event_extension_subscriber_loader($phpbb_dispatcher, $phpbb_extension_manager); + $phpbb_subscriber_loader->load(); + $filename = request_var('avatar', ''); $avatar_group = false; $exit = false; diff --git a/phpBB/includes/acp/acp_bbcodes.php b/phpBB/includes/acp/acp_bbcodes.php index a3822a982a..e537d7a8b9 100644 --- a/phpBB/includes/acp/acp_bbcodes.php +++ b/phpBB/includes/acp/acp_bbcodes.php @@ -24,7 +24,7 @@ class acp_bbcodes function main($id, $mode) { - global $db, $user, $auth, $template, $cache; + global $db, $user, $auth, $template, $cache, $request; global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx; $user->add_lang('acp/posting'); @@ -272,6 +272,18 @@ class acp_bbcodes $db->sql_query('DELETE FROM ' . BBCODES_TABLE . " WHERE bbcode_id = $bbcode_id"); $cache->destroy('sql', BBCODES_TABLE); add_log('admin', 'LOG_BBCODE_DELETE', $row['bbcode_tag']); + + if ($request->is_ajax()) + { + $json_response = new phpbb_json_response; + $json_response->send(array( + 'MESSAGE_TITLE' => $user->lang['INFORMATION'], + 'MESSAGE_TEXT' => $user->lang['BBCODE_DELETED'], + 'REFRESH_DATA' => array( + 'time' => 3 + ) + )); + } } else { diff --git a/phpBB/includes/acp/acp_bots.php b/phpBB/includes/acp/acp_bots.php index f080b3c9fb..b9dd6664f4 100644 --- a/phpBB/includes/acp/acp_bots.php +++ b/phpBB/includes/acp/acp_bots.php @@ -24,7 +24,7 @@ class acp_bots function main($id, $mode) { - global $config, $db, $user, $auth, $template, $cache; + global $config, $db, $user, $auth, $template, $cache, $request; global $phpbb_root_path, $phpbb_admin_path, $phpEx, $table_prefix; $action = request_var('action', ''); @@ -352,6 +352,14 @@ class acp_bots break; } + + if ($request->is_ajax() && ($action == 'activate' || $action == 'deactivate')) + { + $json_response = new phpbb_json_response; + $json_response->send(array( + 'text' => $user->lang['BOT_' . (($action == 'activate') ? 'DE' : '') . 'ACTIVATE'], + )); + } $s_options = ''; $_options = array('activate' => 'BOT_ACTIVATE', 'deactivate' => 'BOT_DEACTIVATE', 'delete' => 'DELETE'); diff --git a/phpBB/includes/acp/acp_forums.php b/phpBB/includes/acp/acp_forums.php index fad22fc285..3a3b2021eb 100644 --- a/phpBB/includes/acp/acp_forums.php +++ b/phpBB/includes/acp/acp_forums.php @@ -25,7 +25,7 @@ class acp_forums function main($id, $mode) { - global $db, $user, $auth, $template, $cache; + global $db, $user, $auth, $template, $cache, $request; global $config, $phpbb_admin_path, $phpbb_root_path, $phpEx; $user->add_lang('acp/forums'); @@ -255,6 +255,12 @@ class acp_forums add_log('admin', 'LOG_FORUM_' . strtoupper($action), $row['forum_name'], $move_forum_name); $cache->destroy('sql', FORUMS_TABLE); } + + if ($request->is_ajax()) + { + $json_response = new phpbb_json_response; + $json_response->send(array('success' => ($move_forum_name !== false))); + } break; diff --git a/phpBB/includes/acp/acp_icons.php b/phpBB/includes/acp/acp_icons.php index 49a092f16b..bfe17c5007 100644 --- a/phpBB/includes/acp/acp_icons.php +++ b/phpBB/includes/acp/acp_icons.php @@ -782,6 +782,18 @@ class acp_icons $cache->destroy('_icons'); $cache->destroy('sql', $table); + + if ($request->is_ajax()) + { + $json_response = new phpbb_json_response; + $json_response->send(array( + 'MESSAGE_TITLE' => $user->lang['INFORMATION'], + 'MESSAGE_TEXT' => $notice, + 'REFRESH_DATA' => array( + 'time' => 3 + ) + )); + } } else { diff --git a/phpBB/includes/acp/acp_main.php b/phpBB/includes/acp/acp_main.php index 88c29702d4..144b225766 100644 --- a/phpBB/includes/acp/acp_main.php +++ b/phpBB/includes/acp/acp_main.php @@ -24,7 +24,7 @@ class acp_main function main($id, $mode) { - global $config, $db, $user, $auth, $template; + global $config, $db, $user, $auth, $template, $request; global $phpbb_root_path, $phpbb_admin_path, $phpEx; // Show restore permissions notice @@ -129,6 +129,11 @@ class acp_main set_config('record_online_users', 1, true); set_config('record_online_date', time(), true); add_log('admin', 'LOG_RESET_ONLINE'); + + if ($request->is_ajax()) + { + trigger_error('RESET_ONLINE_SUCCESS'); + } break; case 'stats': @@ -179,6 +184,11 @@ class acp_main update_last_username(); add_log('admin', 'LOG_RESYNC_STATS'); + + if ($request->is_ajax()) + { + trigger_error('RESYNC_STATS_SUCCESS'); + } break; case 'user': @@ -241,7 +251,11 @@ class acp_main } add_log('admin', 'LOG_RESYNC_POSTCOUNTS'); - + + if ($request->is_ajax()) + { + trigger_error('RESYNC_POSTCOUNTS_SUCCESS'); + } break; case 'date': @@ -252,6 +266,11 @@ class acp_main set_config('board_startdate', time() - 1); add_log('admin', 'LOG_RESET_DATE'); + + if ($request->is_ajax()) + { + trigger_error('RESET_DATE_SUCCESS'); + } break; case 'db_track': @@ -327,14 +346,14 @@ class acp_main } add_log('admin', 'LOG_RESYNC_POST_MARKING'); + + if ($request->is_ajax()) + { + trigger_error('RESYNC_POST_MARKING_SUCCESS'); + } break; case 'purge_cache': - if ((int) $user->data['user_type'] !== USER_FOUNDER) - { - trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING); - } - global $cache; $cache->purge(); @@ -343,6 +362,11 @@ class acp_main cache_moderators(); add_log('admin', 'LOG_PURGE_CACHE'); + + if ($request->is_ajax()) + { + trigger_error('PURGE_CACHE_SUCCESS'); + } break; case 'purge_sessions': @@ -389,6 +413,11 @@ class acp_main $db->sql_query($sql); add_log('admin', 'LOG_PURGE_SESSIONS'); + + if ($request->is_ajax()) + { + trigger_error('PURGE_SESSIONS_SUCCESS'); + } break; } } diff --git a/phpBB/includes/acp/acp_modules.php b/phpBB/includes/acp/acp_modules.php index 9d87bbbfbb..8528dc91c4 100644 --- a/phpBB/includes/acp/acp_modules.php +++ b/phpBB/includes/acp/acp_modules.php @@ -36,7 +36,7 @@ class acp_modules function main($id, $mode) { - global $db, $user, $auth, $template, $module; + global $db, $user, $auth, $template, $module, $request; global $config, $phpbb_admin_path, $phpbb_root_path, $phpEx; // Set a global define for modules we might include (the author is able to prevent execution of code by checking this constant) @@ -373,6 +373,15 @@ class acp_modules // Default management page if (sizeof($errors)) { + if ($request->is_ajax()) + { + $json_response = new phpbb_json_response; + $json_response->send(array( + 'MESSAGE_TITLE' => $user->lang('ERROR'), + 'MESSAGE_TEXT' => implode('
', $errors), + )); + } + $template->assign_vars(array( 'S_ERROR' => true, 'ERROR_MSG' => implode('
', $errors)) diff --git a/phpBB/includes/acp/acp_profile.php b/phpBB/includes/acp/acp_profile.php index 511148baf9..3ffffd3047 100644 --- a/phpBB/includes/acp/acp_profile.php +++ b/phpBB/includes/acp/acp_profile.php @@ -242,6 +242,15 @@ class acp_profile $db->sql_freeresult($result); add_log('admin', 'LOG_PROFILE_FIELD_ACTIVATE', $field_ident); + + if ($request->is_ajax()) + { + $json_response = new phpbb_json_response(); + $json_response->send(array( + 'text' => $user->lang('DEACTIVATE'), + )); + } + trigger_error($user->lang['PROFILE_FIELD_ACTIVATED'] . adm_back_link($this->u_action)); break; @@ -266,7 +275,16 @@ class acp_profile $field_ident = (string) $db->sql_fetchfield('field_ident'); $db->sql_freeresult($result); + if ($request->is_ajax()) + { + $json_response = new phpbb_json_response(); + $json_response->send(array( + 'text' => $user->lang('ACTIVATE'), + )); + } + add_log('admin', 'LOG_PROFILE_FIELD_DEACTIVATE', $field_ident); + trigger_error($user->lang['PROFILE_FIELD_DEACTIVATED'] . adm_back_link($this->u_action)); break; diff --git a/phpBB/includes/acp/acp_ranks.php b/phpBB/includes/acp/acp_ranks.php index ec5a76df87..d9ed5b17f1 100644 --- a/phpBB/includes/acp/acp_ranks.php +++ b/phpBB/includes/acp/acp_ranks.php @@ -24,7 +24,7 @@ class acp_ranks function main($id, $mode) { - global $db, $user, $auth, $template, $cache; + global $db, $user, $auth, $template, $cache, $request; global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx; $user->add_lang('acp/posting'); @@ -122,6 +122,18 @@ class acp_ranks $cache->destroy('_ranks'); add_log('admin', 'LOG_RANK_REMOVED', $rank_title); + + if ($request->is_ajax()) + { + $json_response = new phpbb_json_response; + $json_response->send(array( + 'MESSAGE_TITLE' => $user->lang['INFORMATION'], + 'MESSAGE_TEXT' => $user->lang['RANK_REMOVED'], + 'REFRESH_DATA' => array( + 'time' => 3 + ) + )); + } } else { diff --git a/phpBB/includes/event/data.php b/phpBB/includes/event/data.php new file mode 100644 index 0000000000..70718ff0ae --- /dev/null +++ b/phpBB/includes/event/data.php @@ -0,0 +1,68 @@ +set_data($data); + } + + public function set_data(array $data = array()) + { + $this->data = $data; + } + + public function get_data() + { + return $this->data; + } + + /** + * Returns data filtered to only include specified keys. + * + * This effectively discards any keys added to data by hooks. + */ + public function get_data_filtered($keys) + { + return array_intersect_key($this->data, array_flip($keys)); + } + + public function offsetExists($offset) + { + return isset($this->data[$offset]); + } + + public function offsetGet($offset) + { + return isset($this->data[$offset]) ? $this->data[$offset] : null; + } + + public function offsetSet($offset, $value) + { + $this->data[$offset] = $value; + } + + public function offsetUnset($offset) + { + unset($this->data[$offset]); + } +} diff --git a/phpBB/includes/event/dispatcher.php b/phpBB/includes/event/dispatcher.php new file mode 100644 index 0000000000..2bf46b9b06 --- /dev/null +++ b/phpBB/includes/event/dispatcher.php @@ -0,0 +1,42 @@ +trigger_event('core.index', compact($vars))); +* +*/ +class phpbb_event_dispatcher extends EventDispatcher +{ + public function trigger_event($eventName, $data = array()) + { + $event = new phpbb_event_data($data); + $this->dispatch($eventName, $event); + return $event->get_data_filtered(array_keys($data)); + } +} diff --git a/phpBB/includes/event/extension_subscriber_loader.php b/phpBB/includes/event/extension_subscriber_loader.php new file mode 100644 index 0000000000..d933b943d7 --- /dev/null +++ b/phpBB/includes/event/extension_subscriber_loader.php @@ -0,0 +1,46 @@ +dispatcher = $dispatcher; + $this->extension_manager = $extension_manager; + } + + public function load() + { + $finder = $this->extension_manager->get_finder(); + $subscriber_classes = $finder + ->extension_directory('/event') + ->suffix('listener') + ->core_path('event/') + ->get_classes(); + + foreach ($subscriber_classes as $class) + { + $subscriber = new $class(); + $this->dispatcher->addSubscriber($subscriber); + } + } +} diff --git a/phpBB/includes/extension/controller.php b/phpBB/includes/extension/controller.php new file mode 100644 index 0000000000..c7fd439a19 --- /dev/null +++ b/phpBB/includes/extension/controller.php @@ -0,0 +1,77 @@ +request = $request; + $this->db = $db; + $this->user = $user; + $this->template = $template; + $this->config = $config; + $this->phpEx = $phpEx; + $this->phpbb_root_path = $phpbb_root_path; + } +} diff --git a/phpBB/includes/extension/controller_interface.php b/phpBB/includes/extension/controller_interface.php index bcc8972db4..2b88925388 100644 --- a/phpBB/includes/extension/controller_interface.php +++ b/phpBB/includes/extension/controller_interface.php @@ -23,7 +23,7 @@ if (!defined('IN_PHPBB')) interface phpbb_extension_controller_interface { /** - * handle the request to display a page from an extension + * Handle the request to display a page from an extension * * @return null */ diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index bd6272792b..99740b753b 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -2448,15 +2448,25 @@ function build_url($strip_vars = false) */ function meta_refresh($time, $url, $disable_cd_check = false) { - global $template; + global $template, $refresh_data, $request; - $url = redirect($url, true, $disable_cd_check); - $url = str_replace('&', '&', $url); + if ($request->is_ajax()) + { + $refresh_data = array( + 'time' => $time, + 'url' => str_replace('&', '&', $url) + ); + } + else + { + $url = redirect($url, true, $disable_cd_check); + $url = str_replace('&', '&', $url); - // For XHTML compatibility we change back & to & - $template->assign_vars(array( - 'META' => '') - ); + // For XHTML compatibility we change back & to & + $template->assign_vars(array( + 'META' => '') + ); + } return $url; } @@ -2619,7 +2629,7 @@ function check_form_key($form_name, $timespan = false, $return_page = '', $trigg */ function confirm_box($check, $title = '', $hidden = '', $html_body = 'confirm_body.html', $u_action = '') { - global $user, $template, $db; + global $user, $template, $db, $request; global $phpEx, $phpbb_root_path, $request; if (isset($_POST['cancel'])) @@ -2699,6 +2709,21 @@ function confirm_box($check, $title = '', $hidden = '', $html_body = 'confirm_bo WHERE user_id = " . $user->data['user_id']; $db->sql_query($sql); + + if ($request->is_ajax()) + { + $u_action .= '&confirm_uid=' . $user->data['user_id'] . '&sess=' . $user->session_id . '&sid=' . $user->session_id; + $json_response = new phpbb_json_response; + $json_response->send(array( + 'MESSAGE_TITLE' => (!isset($user->lang[$title])) ? $user->lang['CONFIRM'] : $user->lang[$title], + 'MESSAGE_TEXT' => (!isset($user->lang[$title . '_CONFIRM'])) ? $title : $user->lang[$title . '_CONFIRM'], + + 'YES_VALUE' => $user->lang['YES'], + 'S_CONFIRM_ACTION' => str_replace('&', '&', $u_action), //inefficient, rewrite whole function + 'S_HIDDEN_FIELDS' => $hidden . $s_hidden_fields + )); + } + if (defined('IN_ADMIN') && isset($user->data['session_admin']) && $user->data['session_admin']) { adm_page_footer(); @@ -3723,7 +3748,7 @@ function phpbb_checkdnsrr($host, $type = 'MX') */ function msg_handler($errno, $msg_text, $errfile, $errline) { - global $cache, $db, $auth, $template, $config, $user; + global $cache, $db, $auth, $template, $config, $user, $request; global $phpEx, $phpbb_root_path, $msg_title, $msg_long_text; // Do not display notices if we suppress them via @ @@ -3922,6 +3947,20 @@ function msg_handler($errno, $msg_text, $errfile, $errline) 'S_USER_NOTICE' => ($errno == E_USER_NOTICE) ? true : false) ); + if ($request->is_ajax()) + { + global $refresh_data; + + $json_response = new phpbb_json_response; + $json_response->send(array( + 'MESSAGE_TITLE' => $msg_title, + 'MESSAGE_TEXT' => $msg_text, + 'S_USER_WARNING' => ($errno == E_USER_WARNING) ? true : false, + 'S_USER_NOTICE' => ($errno == E_USER_NOTICE) ? true : false, + 'REFRESH_DATA' => (!empty($refresh_data)) ? $refresh_data : null + )); + } + // We do not want the cron script to be called on error messages define('IN_CRON', true); @@ -4478,6 +4517,7 @@ function phpbb_http_login($param) function page_header($page_title = '', $display_online_list = true, $item_id = 0, $item = 'forum') { global $db, $config, $template, $SID, $_SID, $_EXTRA_URL, $user, $auth, $phpEx, $phpbb_root_path; + global $phpbb_dispatcher; if (defined('HEADER_INC')) { @@ -4761,6 +4801,9 @@ function page_header($page_title = '', $display_online_list = true, $item_id = 0 'A_COOKIE_SETTINGS' => addslashes('; path=' . $config['cookie_path'] . ((!$config['cookie_domain'] || $config['cookie_domain'] == 'localhost' || $config['cookie_domain'] == '127.0.0.1') ? '' : '; domain=' . $config['cookie_domain']) . ((!$config['cookie_secure']) ? '' : '; secure')), )); + $vars = array('page_title', 'display_online_list', 'item_id', 'item'); + extract($phpbb_dispatcher->trigger_event('core.page_header', compact($vars))); + // application/xhtml+xml not used because of IE header('Content-type: text/html; charset=UTF-8'); diff --git a/phpBB/includes/functions_content.php b/phpBB/includes/functions_content.php index 3a0124934e..f2faf20f43 100644 --- a/phpBB/includes/functions_content.php +++ b/phpBB/includes/functions_content.php @@ -1103,8 +1103,8 @@ function extension_allowed($forum_id, $extension, &$extensions) * @param string $string The text to truncate to the given length. String is specialchared. * @param int $max_length Maximum length of string (multibyte character count as 1 char / Html entity count as 1 char) * @param int $max_store_length Maximum character length of string (multibyte character count as 1 char / Html entity count as entity chars). -* @param bool $allow_reply Allow Re: in front of string -* NOTE: This parameter can cause undesired behavior (returning strings longer than $max_store_length) and is deprecated. +* @param bool $allow_reply Allow Re: in front of string +* NOTE: This parameter can cause undesired behavior (returning strings longer than $max_store_length) and is deprecated. * @param string $append String to be appended */ function truncate_string($string, $max_length = 60, $max_store_length = 255, $allow_reply = false, $append = '') @@ -1258,6 +1258,22 @@ function get_username_string($mode, $user_id, $username, $username_colour = '', return str_replace(array('{PROFILE_URL}', '{USERNAME_COLOUR}', '{USERNAME}'), array($profile_url, $username_colour, $username), (!$username_colour) ? $_profile_cache['tpl_profile'] : $_profile_cache['tpl_profile_colour']); } +/** + * Add an option to the quick-mod tools. + * + * @param string $option The language key for the value of the option. + * @param string $lang_string The language string to use. + */ +function phpbb_add_quickmod_option($option, $lang_string) +{ + global $template, $user; + $lang_string = $user->lang($lang_string); + $template->assign_block_vars('quickmod', array( + 'VALUE' => $option, + 'TITLE' => $lang_string, + )); +} + /** * @package phpBB3 */ diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index 9335cabc15..18db64cc68 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -273,6 +273,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod markread('topics', $forum_ids); $message = sprintf($user->lang['RETURN_FORUM'], '', ''); meta_refresh(3, $redirect); + trigger_error($user->lang['FORUMS_MARKED'] . '

' . $message); } else diff --git a/phpBB/includes/json_response.php b/phpBB/includes/json_response.php new file mode 100644 index 0000000000..5dd904da09 --- /dev/null +++ b/phpBB/includes/json_response.php @@ -0,0 +1,41 @@ +
' . sprintf($user->lang['RETURN_POST'], '', ''); } - trigger_error($user->lang[$success_msg] . '

' . sprintf($user->lang['RETURN_PAGE'], "", '') . $add_message); + $message = $user->lang[$success_msg] . '

' . sprintf($user->lang['RETURN_PAGE'], "", '') . $add_message; + + if ($request->is_ajax()) + { + $json_response = new phpbb_json_response; + $json_response->send(array( + 'MESSAGE_TITLE' => $user->lang['INFORMATION'], + 'MESSAGE_TEXT' => $message, + 'REFRESH_DATA' => null, + 'approved' => true + )); + } + + trigger_error($message); } } @@ -968,7 +982,20 @@ function disapprove_post($post_id_list, $id, $mode) } else { + $message = $user->lang[$success_msg] . '

' . sprintf($user->lang['RETURN_PAGE'], "", ''); + + if ($request->is_ajax()) + { + $json_response = new phpbb_json_response; + $json_response->send(array( + 'MESSAGE_TITLE' => $user->lang['INFORMATION'], + 'MESSAGE_TEXT' => $message, + 'REFRESH_DATA' => null, + 'approved' => false + )); + } + meta_refresh(3, $redirect); - trigger_error($user->lang[$success_msg] . '

' . sprintf($user->lang['RETURN_PAGE'], "", '')); + trigger_error($message); } } diff --git a/phpBB/includes/startup.php b/phpBB/includes/startup.php index fc45cd882b..f75d70e366 100644 --- a/phpBB/includes/startup.php +++ b/phpBB/includes/startup.php @@ -147,5 +147,36 @@ if (function_exists('date_default_timezone_set') && function_exists('date_defaul date_default_timezone_set(@date_default_timezone_get()); } +// Autoloading of dependencies. +// Three options are supported: +// 1. If dependencies are installed with Composer, Composer will create a +// vendor/.composer/autoload.php. If this file exists it will be +// automatically used by phpBB. This is the default mode that phpBB +// will use when shipped. +// 2. To disable composer autoloading, PHPBB_NO_COMPOSER_AUTOLOAD can be specified. +// Additionally specify PHPBB_AUTOLOAD=/path/to/autoload.php in the +// environment. This is useful for running CLI scripts and tests. +// /path/to/autoload.php should define and register class loaders +// for all of phpBB's dependencies. +// 3. You can also set PHPBB_NO_COMPOSER_AUTOLOAD without setting PHPBB_AUTOLOAD. +// In this case autoloading needs to be defined before running any phpBB +// script. This might be useful in cases when phpBB is integrated into a +// larger program. +if (getenv('PHPBB_NO_COMPOSER_AUTOLOAD')) +{ + if (getenv('PHPBB_AUTOLOAD')) + { + require(getenv('PHPBB_AUTOLOAD')); + } +} +else +{ + if (!file_exists($phpbb_root_path . 'vendor/.composer/autoload.php')) + { + trigger_error('You have not set up composer dependencies. See http://getcomposer.org/.', E_USER_ERROR); + } + require($phpbb_root_path . 'vendor/.composer/autoload.php'); +} + $starttime = explode(' ', microtime()); $starttime = $starttime[1] + $starttime[0]; diff --git a/phpBB/includes/ucp/ucp_zebra.php b/phpBB/includes/ucp/ucp_zebra.php index 004f3b80aa..efe928b387 100644 --- a/phpBB/includes/ucp/ucp_zebra.php +++ b/phpBB/includes/ucp/ucp_zebra.php @@ -25,7 +25,7 @@ class ucp_zebra function main($id, $mode) { - global $config, $db, $user, $auth, $template, $phpbb_root_path, $phpEx; + global $config, $db, $user, $auth, $template, $phpbb_root_path, $phpEx, $request; $submit = (isset($_POST['submit']) || isset($_GET['add']) || isset($_GET['remove'])) ? true : false; $s_hidden_fields = ''; @@ -198,8 +198,24 @@ class ucp_zebra } } } - - if ($updated) + + if ($request->is_ajax()) + { + $message = ($updated) ? $user->lang[$l_mode . '_UPDATED'] : implode('
', $error); + + $json_response = new phpbb_json_response; + $json_response->send(array( + 'success' => $updated, + + 'MESSAGE_TITLE' => $user->lang['INFORMATION'], + 'MESSAGE_TEXT' => $message, + 'REFRESH_DATA' => array( + 'time' => 3, + 'url' => $this->u_action + ) + )); + } + else if ($updated) { meta_refresh(3, $this->u_action); $message = $user->lang[$l_mode . '_UPDATED'] . '
' . implode('
', $error) . ((sizeof($error)) ? '
' : '') . '
' . sprintf($user->lang['RETURN_UCP'], '', ''); diff --git a/phpBB/index.php b/phpBB/index.php index d71878a885..9a57105d57 100644 --- a/phpBB/index.php +++ b/phpBB/index.php @@ -17,12 +17,11 @@ define('IN_PHPBB', true); $phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? 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->session_begin(); $auth->acl($user->data); -$user->setup('viewforum'); +$user->setup(); // Handle the display of extension front pages if ($ext = $request->variable('ext', '')) @@ -57,6 +56,10 @@ if ($ext = $request->variable('ext', '')) exit_handler(); } +include($phpbb_root_path . 'includes/functions_display.' . $phpEx); + +$user->add_lang('viewforum'); + display_forums('', $config['load_moderators']); $order_legend = ($config['legend_sort_groupname']) ? 'group_name' : 'group_legend'; diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 3e56112713..18ca4870fb 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -120,6 +120,7 @@ $cache = $cache_factory->get_service(); $phpbb_class_loader_ext->set_cache($cache->get_driver()); $phpbb_class_loader->set_cache($cache->get_driver()); +$phpbb_dispatcher = new phpbb_event_dispatcher(); $request = new phpbb_request(); $user = new user(); $db = new $sql_db(); diff --git a/phpBB/install/index.php b/phpBB/install/index.php index f3664c177c..49f7847489 100644 --- a/phpBB/install/index.php +++ b/phpBB/install/index.php @@ -92,6 +92,7 @@ $cache = $cache_factory->get_service(); $phpbb_class_loader_ext->set_cache($cache->get_driver()); $phpbb_class_loader->set_cache($cache->get_driver()); +$phpbb_dispatcher = new phpbb_event_dispatcher(); $request = new phpbb_request(); // make sure request_var uses this request instance diff --git a/phpBB/language/en/acp/common.php b/phpBB/language/en/acp/common.php index 254cd473a5..6012c59483 100644 --- a/phpBB/language/en/acp/common.php +++ b/phpBB/language/en/acp/common.php @@ -95,10 +95,10 @@ $lang = array_merge($lang, array( 'ACP_GLOBAL_MODERATORS' => 'Global moderators', 'ACP_GLOBAL_PERMISSIONS' => 'Global permissions', 'ACP_GROUPS' => 'Groups', - 'ACP_GROUPS_FORUM_PERMISSIONS' => 'Groups’ forum permissions', + 'ACP_GROUPS_FORUM_PERMISSIONS' => 'Group forum permissions', 'ACP_GROUPS_MANAGE' => 'Manage groups', 'ACP_GROUPS_MANAGEMENT' => 'Group management', - 'ACP_GROUPS_PERMISSIONS' => 'Groups’ permissions', + 'ACP_GROUPS_PERMISSIONS' => 'Group permissions', 'ACP_GROUPS_POSITION' => 'Manage group positions', 'ACP_ICONS' => 'Topic icons', @@ -177,9 +177,9 @@ $lang = array_merge($lang, array( 'ACP_THEMES' => 'Themes', 'ACP_UPDATE' => 'Updating', - 'ACP_USERS_FORUM_PERMISSIONS' => 'Users’ forum permissions', + 'ACP_USERS_FORUM_PERMISSIONS' => 'User forum permissions', 'ACP_USERS_LOGS' => 'User logs', - 'ACP_USERS_PERMISSIONS' => 'Users’ permissions', + 'ACP_USERS_PERMISSIONS' => 'User permissions', 'ACP_USER_ATTACH' => 'Attachments', 'ACP_USER_AVATAR' => 'Avatar', 'ACP_USER_FEEDBACK' => 'Feedback', @@ -370,25 +370,32 @@ $lang = array_merge($lang, array( 'PURGE_CACHE' => 'Purge the cache', 'PURGE_CACHE_CONFIRM' => 'Are you sure you wish to purge the cache?', 'PURGE_CACHE_EXPLAIN' => 'Purge all cache related items, this includes any cached template files or queries.', + 'PURGE_CACHE_SUCCESS' => 'Cache successfully purged.', 'PURGE_SESSIONS' => 'Purge all sessions', 'PURGE_SESSIONS_CONFIRM' => 'Are you sure you wish to purge all sessions? This will log out all users.', 'PURGE_SESSIONS_EXPLAIN' => 'Purge all sessions. This will log out all users by truncating the session table.', + 'PURGE_SESSIONS_SUCCESS' => 'Sessions successfully purged.', 'RESET_DATE' => 'Reset board’s start date', 'RESET_DATE_CONFIRM' => 'Are you sure you wish to reset the board’s start date?', + 'RESET_DATE_SUCCESS' => 'Board’s start date reset', 'RESET_ONLINE' => 'Reset most users ever online', 'RESET_ONLINE_CONFIRM' => 'Are you sure you wish to reset the most users ever online counter?', + 'RESET_ONLINE_SUCCESS' => 'Most users ever online reset', 'RESYNC_FILES_STATS_CONFIRM' => 'Are you sure you wish to resynchronise files statistics?', 'RESYNC_POSTCOUNTS' => 'Resynchronise post counts', 'RESYNC_POSTCOUNTS_EXPLAIN' => 'Only existing posts will be taken into consideration. Pruned posts will not be counted.', 'RESYNC_POSTCOUNTS_CONFIRM' => 'Are you sure you wish to resynchronise post counts?', + 'RESYNC_POSTCOUNTS_SUCCESS' => 'Resynchronised post counts', 'RESYNC_POST_MARKING' => 'Resynchronise dotted topics', 'RESYNC_POST_MARKING_CONFIRM' => 'Are you sure you wish to resynchronise dotted topics?', 'RESYNC_POST_MARKING_EXPLAIN' => 'First unmarks all topics and then correctly marks topics that have seen any activity during the past six months.', + 'RESYNC_POST_MARKING_SUCCESS' => 'Resynchronised dotted topics', 'RESYNC_STATS' => 'Resynchronise statistics', 'RESYNC_STATS_CONFIRM' => 'Are you sure you wish to resynchronise statistics?', 'RESYNC_STATS_EXPLAIN' => 'Recalculates the total number of posts, topics, users and files.', + 'RESYNC_STATS_SUCCESS' => 'Resynchronised statistics', 'RUN' => 'Run now', 'STATISTIC' => 'Statistic', diff --git a/phpBB/language/en/acp/permissions.php b/phpBB/language/en/acp/permissions.php index 7f7ecacfcf..2a8d857197 100644 --- a/phpBB/language/en/acp/permissions.php +++ b/phpBB/language/en/acp/permissions.php @@ -39,10 +39,10 @@ $lang = array_merge($lang, array(

Permissions are highly granular and grouped into four major sections, which are:

Global Permissions

-

These are used to control access on a global level and apply to the entire bulletin board. They are further divided into Users’ Permissions, Groups’ Permissions, Administrators and Global Moderators.

+

These are used to control access on a global level and apply to the entire bulletin board. They are further divided into User Permissions, Group Permissions, Administrators and Global Moderators.

Forum Based Permissions

-

These are used to control access on a per forum basis. They are further divided into Forum Permissions, Forum Moderators, Users’ Forum Permissions and Groups’ Forum Permissions.

+

These are used to control access on a per forum basis. They are further divided into Forum Permissions, Forum Moderators, User Forum Permissions and Group Forum Permissions.

Permission Roles

These are used to create different sets of permissions for the different permission types later being able to be assigned on a role-based basis. The default roles should cover the administration of bulletin boards large and small, though within each of the four divisions, you can add/edit/delete roles as you see fit.

@@ -82,13 +82,13 @@ $lang = array_merge($lang, array( 'ACP_FORUM_PERMISSIONS_COPY_EXPLAIN' => 'Here you can copy forum permissions from one forum to one or more other forums.', 'ACP_GLOBAL_MODERATORS_EXPLAIN' => 'Here you can assign global moderator permissions to users or groups. These moderators are like ordinary moderators except they have access to every forum on your board.', 'ACP_GROUPS_FORUM_PERMISSIONS_EXPLAIN' => 'Here you can assign forum permissions to groups.', - 'ACP_GROUPS_PERMISSIONS_EXPLAIN' => 'Here you can assign global permissions to groups - user permissions, global moderator permissions and administrator permissions. User permissions include capabilities such as the use of avatars, sending private messages, et cetera; global moderator permissions such as approving posts, manage topics, manage bans, et cetera and lastly administrator permissions such as altering permissions, define custom BBCodes, manage forums, et cetera. Individual users permissions should only be changed in rare occasions, the preferred method is putting users in groups and assigning the group’s permissions.', + 'ACP_GROUPS_PERMISSIONS_EXPLAIN' => 'Here you can assign global permissions to groups - user permissions, global moderator permissions and administrator permissions. User permissions include capabilities such as the use of avatars, sending private messages, et cetera; global moderator permissions such as approving posts, manage topics, manage bans, et cetera and lastly administrator permissions such as altering permissions, define custom BBCodes, manage forums, et cetera. Individual user permissions should only be changed in rare occasions, the preferred method is putting users in groups and assigning the group permissions.', 'ACP_ADMIN_ROLES_EXPLAIN' => 'Here you are able to manage the roles for administrative permissions. Roles are effective permissions, if you change a role the items having this role assigned will change its permissions too.', 'ACP_FORUM_ROLES_EXPLAIN' => 'Here you are able to manage the roles for forum permissions. Roles are effective permissions, if you change a role the items having this role assigned will change its permissions too.', 'ACP_MOD_ROLES_EXPLAIN' => 'Here you are able to manage the roles for moderative permissions. Roles are effective permissions, if you change a role the items having this role assigned will change its permissions too.', 'ACP_USER_ROLES_EXPLAIN' => 'Here you are able to manage the roles for user permissions. Roles are effective permissions, if you change a role the items having this role assigned will change its permissions too.', 'ACP_USERS_FORUM_PERMISSIONS_EXPLAIN' => 'Here you can assign forum permissions to users.', - 'ACP_USERS_PERMISSIONS_EXPLAIN' => 'Here you can assign global permissions to users - user permissions, global moderator permissions and administrator permissions. User permissions include capabilities such as the use of avatars, sending private messages, et cetera; global moderator permissions such as approving posts, manage topics, manage bans, et cetera and lastly administrator permissions such as altering permissions, define custom BBCodes, manage forums, et cetera. To alter these settings for large numbers of users the Group permissions system is the preferred method. User’s permissions should only be changed in rare occasions, the preferred method is putting users in groups and assigning the group’s permissions.', + 'ACP_USERS_PERMISSIONS_EXPLAIN' => 'Here you can assign global permissions to users - user permissions, global moderator permissions and administrator permissions. User permissions include capabilities such as the use of avatars, sending private messages, et cetera; global moderator permissions such as approving posts, manage topics, manage bans, et cetera and lastly administrator permissions such as altering permissions, define custom BBCodes, manage forums, et cetera. To alter these settings for large numbers of users the Group permissions system is the preferred method. User permissions should only be changed in rare occasions, the preferred method is putting users in groups and assigning the group permissions.', 'ACP_VIEW_ADMIN_PERMISSIONS_EXPLAIN' => 'Here you can view the effective administrative permissions assigned to the selected users/groups.', 'ACP_VIEW_GLOBAL_MOD_PERMISSIONS_EXPLAIN' => 'Here you can view the global moderative permissions assigned to the selected users/groups.', 'ACP_VIEW_FORUM_PERMISSIONS_EXPLAIN' => 'Here you can view the forum permissions assigned to the selected users/groups and forums.', @@ -224,8 +224,8 @@ $lang = array_merge($lang, array( 'SELECT_TYPE' => 'Select type', 'SET_PERMISSIONS' => 'Set permissions', 'SET_ROLE_PERMISSIONS' => 'Set role permissions', - 'SET_USERS_PERMISSIONS' => 'Set users permissions', - 'SET_USERS_FORUM_PERMISSIONS' => 'Set users forum permissions', + 'SET_USERS_PERMISSIONS' => 'Set user permissions', + 'SET_USERS_FORUM_PERMISSIONS' => 'Set user forum permissions', 'TRACE_DEFAULT' => 'By default every permission is NO (unset). So the permission can be overwritten by other settings.', 'TRACE_FOR' => 'Trace for', diff --git a/phpBB/language/en/acp/posting.php b/phpBB/language/en/acp/posting.php index 84cf640d1f..76d4869990 100644 --- a/phpBB/language/en/acp/posting.php +++ b/phpBB/language/en/acp/posting.php @@ -45,6 +45,7 @@ $lang = array_merge($lang, array( 'BBCODE_ADDED' => 'BBCode added successfully.', 'BBCODE_EDITED' => 'BBCode edited successfully.', + 'BBCODE_DELETED' => 'The BBCode has been removed successfully.', 'BBCODE_NOT_EXIST' => 'The BBCode you selected does not exist.', 'BBCODE_HELPLINE' => 'Help line', 'BBCODE_HELPLINE_EXPLAIN' => 'This field contains the mouse over text of the BBCode.', diff --git a/phpBB/language/en/acp/styles.php b/phpBB/language/en/acp/styles.php index 8a4a8e7308..1a6335cdbf 100644 --- a/phpBB/language/en/acp/styles.php +++ b/phpBB/language/en/acp/styles.php @@ -283,9 +283,11 @@ $lang = array_merge($lang, array( 'SELECTED_THEME_FILE' => 'Selected theme file', 'STORE_FILESYSTEM' => 'Filesystem', 'STYLE_ACTIVATE' => 'Activate', + 'STYLE_ACTIVATED' => 'Style activated successfully', 'STYLE_ACTIVE' => 'Active', 'STYLE_ADDED' => 'Style added successfully.', 'STYLE_DEACTIVATE' => 'Deactivate', + 'STYLE_DEACTIVATED' => 'Style deactivated successfully', 'STYLE_DEFAULT' => 'Make default style', 'STYLE_DEFAULT_CHANGE' => 'Change default style', 'STYLE_DEFAULT_CHANGE_INACTIVE' => 'You must activate style before making it default style.', diff --git a/phpBB/language/en/common.php b/phpBB/language/en/common.php index 94edddc6f5..b92b915623 100644 --- a/phpBB/language/en/common.php +++ b/phpBB/language/en/common.php @@ -67,6 +67,8 @@ $lang = array_merge($lang, array( 'ADMINISTRATORS' => 'Administrators', 'AGE' => 'Age', 'AIM' => 'AIM', + 'AJAX_ERROR_TITLE' => 'AJAX error', + 'AJAX_ERROR_TEXT' => 'Something went wrong when processing your request.', 'ALLOWED' => 'Allowed', 'ALL_FILES' => 'All files', 'ALL_FORUMS' => 'All forums', @@ -183,6 +185,7 @@ $lang = array_merge($lang, array( 'ERR_UNWATCHING' => 'An error occured while trying to unsubscribe.', 'ERR_WATCHING' => 'An error occured while trying to subscribe.', 'ERR_WRONG_PATH_TO_PHPBB' => 'The phpBB path specified appears to be invalid.', + 'ERROR' => 'Error', 'EXPAND_VIEW' => 'Expand view', 'EXTENSION' => 'Extension', 'EXTENSION_CONTROLLER_MISSING' => 'The extension %s is missing a controller class and cannot be accessed through the front-end.', @@ -314,6 +317,7 @@ $lang = array_merge($lang, array( 'LDAP_NO_SERVER_CONNECTION' => 'Could not connect to LDAP server.', 'LDAP_SEARCH_FAILED' => 'An error occured while searching the LDAP directory.', 'LEGEND' => 'Legend', + 'LOADING' => 'Loading', 'LOCATION' => 'Location', 'LOCK_POST' => 'Lock post', 'LOCK_POST_EXPLAIN' => 'Prevent editing', @@ -451,6 +455,7 @@ $lang = array_merge($lang, array( 2 => '%d pixels', ), 'PLAY_QUICKTIME_FILE' => 'Play Quicktime file', + 'PLEASE_WAIT' => 'Please wait.', 'PM' => 'PM', 'PM_REPORTED' => 'Click to view report', 'POSTING_MESSAGE' => 'Posting message in %s', @@ -476,7 +481,7 @@ $lang = array_merge($lang, array( 'POST_SUBJECT' => 'Post subject', 'POST_TIME' => 'Post time', 'POST_TOPIC' => 'Post a new topic', - 'POST_UNAPPROVED' => 'This post is waiting for approval', + 'POST_UNAPPROVED' => 'Post awaiting approval:', 'PREVIEW' => 'Preview', 'PREVIOUS' => 'Previous', // Used in pagination 'PREVIOUS_STEP' => 'Previous', @@ -597,6 +602,7 @@ $lang = array_merge($lang, array( 'TEST_CONNECTION' => 'Test connection', 'THE_TEAM' => 'The team', 'TIME' => 'Time', + 'TIMEOUT_PROCESSING_REQ' => 'Request timed out.', 'TOO_LARGE' => 'The value you entered is too large.', 'TOO_LARGE_MAX_RECIPIENTS' => 'The value of Maximum number of allowed recipients per private message setting you entered is too large.', diff --git a/phpBB/language/en/viewtopic.php b/phpBB/language/en/viewtopic.php index 2b20938afe..1460490672 100644 --- a/phpBB/language/en/viewtopic.php +++ b/phpBB/language/en/viewtopic.php @@ -35,6 +35,7 @@ if (empty($lang) || !is_array($lang)) // in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine $lang = array_merge($lang, array( + 'APPROVE' => 'Approve', 'ATTACHMENT' => 'Attachment', 'ATTACHMENT_FUNCTIONALITY_DISABLED' => 'The attachments feature has been disabled.', @@ -47,9 +48,9 @@ $lang = array_merge($lang, array( 'BUMP_TOPIC' => 'Bump topic', 'CODE' => 'Code', - 'COLLAPSE_QR' => 'Hide Quick Reply', 'DELETE_TOPIC' => 'Delete topic', + 'DISAPPROVE' => 'Disapprove', 'DOWNLOAD_NOTICE' => 'You do not have the required permissions to view the files attached to this post.', 'EDITED_TIMES_TOTAL' => array( @@ -97,7 +98,6 @@ $lang = array_merge($lang, array( 'REPLY_TO_TOPIC' => 'Reply to topic', 'RETURN_POST' => '%sReturn to the post%s', - 'SHOW_QR' => 'Quick Reply', 'SUBMIT_VOTE' => 'Submit vote', 'TOTAL_VOTES' => 'Total votes', diff --git a/phpBB/styles/prosilver/template/ajax.js b/phpBB/styles/prosilver/template/ajax.js new file mode 100644 index 0000000000..cc886c42b1 --- /dev/null +++ b/phpBB/styles/prosilver/template/ajax.js @@ -0,0 +1,100 @@ +(function($) { // Avoid conflicts with other libraries + +"use strict"; + +// This callback finds the post from the delete link, and removes it. +phpbb.add_ajax_callback('post_delete', function() { + var el = $(this), + post_id; + + if (el.attr('data-refresh') === undefined) + { + post_id = el[0].href.split('&p=')[1]; + var post = el.parents('#p' + post_id).css('pointer-events', 'none'); + if (post.hasClass('bg1') || post.hasClass('bg2')) + { + var posts1 = post.nextAll('.bg1'); + post.nextAll('.bg2').removeClass('bg2').addClass('bg1'); + posts1.removeClass('bg1').addClass('bg2'); + } + post.fadeOut(function() { + $(this).remove(); + }); + } +}); + +// This callback removes the approve / disapprove div or link. +phpbb.add_ajax_callback('post_approve', function(res) { + var remove = (res.approved) ? $(this) : $(this).parents('.post'); + $(remove).css('pointer-events', 'none').fadeOut(function() { + $(this).remove(); + }); +}); + +// This removes the parent row of the link or form that fired the callback. +phpbb.add_ajax_callback('row_delete', function() { + $(this).parents('tr').remove(); +}); + +// This handles friend / foe additions removals. +phpbb.add_ajax_callback('zebra', function(res) { + var zebra; + + if (res.success) { + zebra = $('.zebra'); + zebra.first().html(res.MESSAGE_TEXT); + zebra.not(':first').html(' ').prev().html(' '); + } +}); + + + +$('[data-ajax]').each(function() { + var $this = $(this), + ajax = $this.attr('data-ajax'), + fn; + + if (ajax !== 'false') + { + fn = (ajax !== 'true') ? ajax : null; + phpbb.ajaxify({ + selector: this, + refresh: $this.attr('data-refresh') !== undefined, + callback: fn + }); + } +}); + + + +/** + * This AJAXifies the quick-mod tools. The reason it cannot be a standard + * callback / data attribute is that it requires filtering - some of the options + * can be ajaxified, while others cannot. + */ +phpbb.ajaxify({ + selector: '#quickmodform', + refresh: true, + filter: function (data) { + var action = $('#quick-mod-select').val(); + + if (action === 'make_normal') + { + return $(this).find('select option[value="make_global"]').length > 0; + } + else if (action === 'lock' || action === 'unlock') + { + return true; + } + + if (action === 'delete_topic' || action === 'make_sticky' || action === 'make_announce' || action === 'make_global') { + return true; + } + + return false; + } +}); + + + +})(jQuery); // Avoid conflicts with other libraries diff --git a/phpBB/styles/prosilver/template/index_body.html b/phpBB/styles/prosilver/template/index_body.html index b183cf4372..9269f62769 100644 --- a/phpBB/styles/prosilver/template/index_body.html +++ b/phpBB/styles/prosilver/template/index_body.html @@ -8,7 +8,7 @@
  • {L_SEARCH_UNANSWERED}{L_SEARCH_UNREAD}{L_SEARCH_NEW}{L_SEARCH_ACTIVE_TOPICS}
  • -
  • {L_MARK_FORUMS_READ}
  • +
  • {L_MARK_FORUMS_READ}
  • diff --git a/phpBB/styles/prosilver/template/memberlist_view.html b/phpBB/styles/prosilver/template/memberlist_view.html index f10ec64975..d8bb92a731 100644 --- a/phpBB/styles/prosilver/template/memberlist_view.html +++ b/phpBB/styles/prosilver/template/memberlist_view.html @@ -35,15 +35,15 @@
    {custom_fields.PROFILE_FIELD_NAME}:
    {custom_fields.PROFILE_FIELD_VALUE}
    -
     
    {L_REMOVE_FRIEND}
    +
     
    {L_REMOVE_FRIEND}
    -
     
    {L_REMOVE_FOE}
    +
     
    {L_REMOVE_FOE}
    -
     
    {L_ADD_FRIEND}
    +
     
    {L_ADD_FRIEND}
    -
     
    {L_ADD_FOE}
    +
     
    {L_ADD_FOE}
    diff --git a/phpBB/styles/prosilver/template/overall_footer.html b/phpBB/styles/prosilver/template/overall_footer.html index 4456d6b37d..1561bae26a 100644 --- a/phpBB/styles/prosilver/template/overall_footer.html +++ b/phpBB/styles/prosilver/template/overall_footer.html @@ -8,12 +8,12 @@ @@ -24,6 +24,22 @@
    {DEBUG_OUTPUT}
    {L_ACP} + +
    +
     
    +

    {L_LOADING}

    {L_PLEASE_WAIT}

    +
    + +
    + +

    +
    +
    + +

    +   + +
    @@ -35,6 +51,8 @@ + + diff --git a/phpBB/styles/prosilver/template/overall_header.html b/phpBB/styles/prosilver/template/overall_header.html index 364373f439..5e095d0a0d 100644 --- a/phpBB/styles/prosilver/template/overall_header.html +++ b/phpBB/styles/prosilver/template/overall_header.html @@ -84,6 +84,10 @@ + + diff --git a/phpBB/styles/prosilver/template/quickreply_editor.html b/phpBB/styles/prosilver/template/quickreply_editor.html index ea07c2e6d8..4cd5eedd3e 100644 --- a/phpBB/styles/prosilver/template/quickreply_editor.html +++ b/phpBB/styles/prosilver/template/quickreply_editor.html @@ -1,51 +1,5 @@ - -
    -