diff --git a/.gitignore b/.gitignore index d875beb784..4093aeb56d 100644 --- a/.gitignore +++ b/.gitignore @@ -3,12 +3,16 @@ /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 /phpBB/ext/* /phpBB/files/* /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 new file mode 100644 index 0000000000..82f7d27e35 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,29 @@ +language: php +php: + - 5.3.2 + - 5.4 + +env: + - DB=mysql + - DB=postgres + +before_script: + - sh -c "if [ '$DB' = 'pgsql' ]; then psql -c 'DROP DATABASE IF EXISTS phpbb_tests;' -U postgres; fi" + - sh -c "if [ '$DB' = 'pgsql' ]; then psql -c 'create database phpbb_tests;' -U postgres; fi" + - 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 + - cd phpBB + - curl -s http://getcomposer.org/installer | php + - php composer.phar install + - cd ../ + +script: + - phpunit --configuration travis/phpunit-$DB-travis.xml + +notifications: + email: + recipients: + - dev-team@phpbb.com + on_success: change + on_failure: change diff --git a/README.md b/README.md index 6b94f898a3..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) @@ -15,6 +24,12 @@ Find support and lots more on [phpBB.com](http://www.phpbb.com)! Discuss the dev 3. [Read our Git Contribution Guidelines](http://wiki.phpbb.com/Git); if you're new to git, also read [the introduction guide](http://wiki.phpbb.com/display/DEV/Working+with+Git) 4. Send us a pull request +## AUTOMATED TESTING + +We have unit and functional tests in order to prevent regressions. You can view the bamboo continuous integration [here](http://bamboo.phpbb.com) or check our travis build below. +develop - [![Build Status](https://secure.travis-ci.org/phpbb/phpbb3.png?branch=develop)](http://travis-ci.org/phpbb/phpbb3) +develop-olympus - [![Build Status](https://secure.travis-ci.org/phpbb/phpbb3.png?branch=develop-olympus)](http://travis-ci.org/phpbb/phpbb3) + ## LICENSE [GNU General Public License v2](http://opensource.org/licenses/gpl-2.0.php) diff --git a/build/build.xml b/build/build.xml index 3d8d3de640..1646c10a08 100644 --- a/build/build.xml +++ b/build/build.xml @@ -11,9 +11,9 @@ - - - + + + @@ -43,7 +43,19 @@ - + + + + + + + - + + + + + + diff --git a/git-tools/hooks/pre-commit b/git-tools/hooks/pre-commit index 4d03359773..03babe47cd 100755 --- a/git-tools/hooks/pre-commit +++ b/git-tools/hooks/pre-commit @@ -12,8 +12,17 @@ # ln -s ../../git-tools/hooks/pre-commit \\ # .git/hooks/pre-commit -# NOTE: this is run through /usr/bin/env -PHP_BIN=php +if [ -z "$PHP_BIN" ] +then + PHP_BIN=php +fi + +if [ "$(echo -e test)" = test ] +then + echo_e="echo -e" +else + echo_e="echo" +fi # necessary check for initial commit if git rev-parse --verify HEAD >/dev/null 2>&1 @@ -27,7 +36,7 @@ fi error=0 errors="" -if ! which $PHP_BIN >/dev/null 2>&1 +if ! which "$PHP_BIN" >/dev/null 2>&1 then echo "PHP Syntax check failed:" echo "PHP binary does not exist or is not in path: $PHP_BIN" @@ -64,7 +73,13 @@ do # 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) + # note: if display_errors=stderr in php.ini, + # parse errors are printed on stderr; otherwise + # they are printed on stdout. + # we filter everything other than parse errors + # with a grep below, therefore it should be safe + # to combine stdout and stderr in all circumstances + result=$(git cat-file -p $sha | "$PHP_BIN" -l 2>&1) if [ $? -ne 0 ] then error=1 @@ -76,7 +91,45 @@ unset IFS if [ $error -eq 1 ] then - echo -e "PHP Syntax check failed:"; - echo -e "$errors" | grep "^Parse error:" + echo "PHP Syntax check failed:" + # php "display errors" (display_errors php.ini value) + # and "log errors" (log_errors php.ini value). + # these are independent settings - see main/main.c in php source. + # the "log errors" setting produces output which + # starts with "PHP Parse error:"; the "display errors" + # setting produces output starting with "Parse error:". + # if both are turned on php dumps the parse error twice. + # therefore here we try to grep for one version and + # if that yields no results grep for the other version. + # + # other fun php facts: + # + # 1. in cli, display_errors and log_errors have different + # destinations by default. display_errors prints to + # standard output and log_errors prints to standard error. + # whether these destinations make sense is left + # as an exercise for the reader. + # 2. as mentioned above, with all output turned on + # php will print parse errors twice, one time on stdout + # and one time on stderr. + # 3. it is possible to set both display_errors and log_errors + # to off. if this is done php will print the text + # "Errors parsing " but will not say what + # the errors are. useful behavior, this. + # 4. on my system display_errors defaults to on and + # log_errors defaults to off, therefore providing + # by default one copy of messages. your mileage may vary. + # 5. by setting display_errors=stderr and log_errors=on, + # both sets of messages will be printed on stderr. + # 6. php-cgi binary, given display_errors=stderr and + # log_errors=on, still prints both sets of messages + # on stderr, but formats one set as an html fragment. + # 7. your entry here? ;) + $echo_e "$errors" | grep "^Parse error:" + if [ $? -ne 0 ] + then + # match failed + $echo_e "$errors" | grep "^PHP Parse error:" + fi exit 1 fi 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/index.php b/phpBB/adm/index.php index e7168b210b..91894e5aec 100644 --- a/phpBB/adm/index.php +++ b/phpBB/adm/index.php @@ -50,9 +50,9 @@ $file_uploads = (@ini_get('file_uploads') == '1' || strtolower(@ini_get('file_up $module_id = request_var('i', ''); $mode = request_var('mode', ''); -// Set custom template for admin area -$template->set_ext_dir_prefix('adm/'); -$template->set_custom_template($phpbb_admin_path . 'style', 'admin'); +// Set custom style for admin area +$style->set_ext_dir_prefix('adm/'); +$style->set_custom_style('admin', $phpbb_admin_path . 'style', ''); $template->assign_var('T_ASSETS_PATH', $phpbb_root_path . 'assets'); $template->assign_var('T_TEMPLATE_PATH', $phpbb_admin_path . 'style'); 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 1c78c0c344..42cb434ad3 100644 --- a/phpBB/adm/style/acp_groups.html +++ b/phpBB/adm/style/acp_groups.html @@ -330,7 +330,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_styles.html b/phpBB/adm/style/acp_styles.html index dc89aa247a..b09cbafc95 100644 --- a/phpBB/adm/style/acp_styles.html +++ b/phpBB/adm/style/acp_styles.html @@ -2,399 +2,167 @@ - + +
- « {L_BACK} +
+

{MESSAGE_TITLE}

+

{MESSAGE_TEXT}

+ + + -

{L_TITLE}

+ {S_HIDDEN_FIELDS} -

{L_EXPLAIN}

+
+   + +
- +
+ +
+ +

{L_TITLE}

+ +

{L_EXPLAIN}

+ +
+{S_HIDDEN_FIELDS} +{S_FORM_TOKEN} + + +
- {L_TITLE}
-
-
{NAME}
+
+
-

{L_REPLACE_EXPLAIN}
-
-
- -
-
-

{L_REPLACE_TEMPLATE_EXPLAIN}
-
-
-
-

{L_REPLACE_THEME_EXPLAIN}
-
-
- - -

- - {S_FORM_TOKEN} -

-
-
- - - - « {L_BACK} - -

{L_EDIT}

- -

{L_EDIT_EXPLAIN}

- -

{L_SELECTED}: {SELECTED_TEMPLATE}

- -
- - -
- {L_SELECT} -
-
-
-
- {S_FORM_TOKEN} -
- -
- - - - -
- -
- {L_EDITOR} - -
-
-
{TEMPLATE_FILE}
-
- -
-
-
-
- -
- -
- {L_SUBMIT} - {S_HIDDEN_FIELDS} - {S_FORM_TOKEN} - -
-
- - - - - « {L_BACK} - -

{L_TEMPLATE_CACHE}

- -

{L_TEMPLATE_CACHE_EXPLAIN}

- -
-
- {L_TEMPLATE_CACHE} - - - - - - - - - - - - - - - - - - - - - - - - - - -
{L_CACHE_FILENAME}{L_CACHE_FILESIZE}{L_CACHE_CACHED}{L_CACHE_MODIFIED}{L_MARK}
{file.FILENAME_PATH}{file.FILESIZE}{file.CACHED}{file.MODIFIED}
{L_TEMPLATE_CACHE_EMPTY}
- -

- {L_MARK_ALL} :: {L_UNMARK_ALL}
- {S_FORM_TOKEN} - -

-
-
- - - - « {L_BACK} - -

{L_TITLE}

- -

{L_EXPLAIN}

- - -
-

{L_WARNING}

-

{ERROR_MSG}

-
- - -
- -
- {L_TITLE} -
-
-
{NAME}
-
- -
-
-
-
-
-
-
-
-
-
- -
-

{L_DOWNLOAD_STORE_EXPLAIN}
-
-
+
+
{STYLE_PATH}
-
-
{FORMAT_BUTTONS}
-
- -

- {S_FORM_TOKEN} - -

-
- - -
- - - -

{L_TITLE}

- -

{L_EXPLAIN}

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - colspan="2">{uninstalled.NAME}
{L_COPYRIGHT}: {uninstalled.COPYRIGHT} -
- - - -
{L_NAME}{L_STYLE_USED_BY}{L_OPTIONS}{L_ACTIONS}
{L_INSTALLED}
{L_INACTIVE_STYLES}
{installed.NAME} *{installed.STYLE_COUNT} - {installed.S_OPTIONS} - - - {installed.L_STYLE_ACT_DEACT} | - - {installed.S_ACTIONS} - - | {L_PREVIEW} - -
{L_UNINSTALLED}
{L_NO_UNINSTALLED}
{L_INSTALL}
- - -
- -
- {L_CREATE} - {L_CREATE}: {L_FROM} -
- -
- - - - - « {L_BACK} - -

{L_TITLE}

- -

{L_EXPLAIN}

- - -
-

{L_WARNING}

-

{ERROR_MSG}

-
- - -
- -
- {L_TITLE} -
-
-
{NAME}
+
+
{STYLE_COPYRIGHT}
-
-
{COPYRIGHT}
+
+
-
-
-
{S_SUPERTEMPLATE}
+
+
+
- - +
-
-
{TEMPLATE_NAME}
+
+
+
-
-
-
{THEME_NAME}
-
- - -
- -
- {L_OPTIONS} -
-
-
-
-
- -
-
-
-
-
-
{L_SUBMIT} + {L_BACK} {S_FORM_TOKEN}
+ -
+ + + + + + + + {STYLES_LIST_EXTRA} + + + + + + class="row-inactive"> + + + + + + + + + + + {styles_list.EXTRA} + + + + +
{L_STYLE_NAME}{L_STYLE_USED_BY}{L_ACTIONS} 
+ + + + + {styles_list.STYLE_NAME} +
{styles_list.STYLE_COPYRIGHT}
+ + {styles_list.STYLE_NAME} + + +
{styles_list.COMMENT}
+ + +
{L_STYLE_PATH} {styles_list.STYLE_PATH_FULL}
+ +
{styles_list.USERS} + + | + + {styles_list.actions.L_ACTION} + + {styles_list.actions.HTML} + + + + + + +   + + + + +
+ + + +
+ + + +
+ + + +
+ + {extra_links.L_ACTION} + +
+ + + 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 ceda824e5a..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; @@ -626,12 +630,29 @@ td.name { .col1 { background-color: #DCEBFE; } .col2 { background-color: #F9F9F9; } +/* 4 row background colours for trees */ +.row1a { background-color: #F9F9F9; } +.row1b { background-color: #F6F6F6; } +.row2a { background-color: #E7EEF4; } +.row2b { background-color: #E3EBF2; } + .spacer { background-color: #DBDFE2; height: 1px; line-height: 1px; } +/* Deactivated row */ +.row-inactive { + color: #999; +} +.row-inactive a, .row-inactive strong { + color: #888; +} +.row-inactive a:hover { + color: #BC2A4D; +} + /* General form styles ----------------------------------------*/ fieldset { @@ -1070,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..0d88c8bcc5 100644 --- a/phpBB/adm/style/overall_footer.html +++ b/phpBB/adm/style/overall_footer.html @@ -9,7 +9,7 @@ + + +{SCRIPTS} diff --git a/phpBB/adm/style/simple_footer.html b/phpBB/adm/style/simple_footer.html index 0d697aec1d..b6d7ee2f5c 100644 --- a/phpBB/adm/style/simple_footer.html +++ b/phpBB/adm/style/simple_footer.html @@ -5,7 +5,7 @@