diff options
186 files changed, 3444 insertions, 1202 deletions
diff --git a/.travis.yml b/.travis.yml index bbca989254..bfe58bee7d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,6 +4,7 @@ php: - 5.3 - 5.4 - 5.5 + - hhvm env: - DB=mariadb @@ -38,3 +39,7 @@ notifications: - dev-team@phpbb.com on_success: change on_failure: change + +matrix: + allow_failures: + - php: hhvm diff --git a/phpBB/adm/style/acp_attachments.html b/phpBB/adm/style/acp_attachments.html index 9ce9fb5f13..9db0fc6521 100644 --- a/phpBB/adm/style/acp_attachments.html +++ b/phpBB/adm/style/acp_attachments.html @@ -331,7 +331,7 @@ <fieldset class="tabulated"> <legend>{L_TITLE}</legend> - <table class="table1"> + <table class="table1 zebra-table"> <thead> <tr> <th>{L_FILENAME}</th> @@ -344,7 +344,7 @@ </thead> <tbody> <!-- BEGIN orphan --> - <!-- IF orphan.S_ROW_COUNT is even --><tr class="row1"><!-- ELSE --><tr class="row2"><!-- ENDIF --> + <tr> <td><a href="{orphan.U_FILE}">{orphan.REAL_FILENAME}</a></td> <td>{orphan.FILETIME}</td> <td>{orphan.FILESIZE}</td> @@ -389,7 +389,7 @@ <!-- ENDIF --> </div> - <table class="table1"> + <table class="table1 zebra-table"> <thead> <tr> <th>{L_FILENAME}</th> @@ -400,7 +400,7 @@ </thead> <tbody> <!-- BEGIN attachments --> - <!-- IF attachments.S_ROW_COUNT is even --><tr class="row1"><!-- ELSE --><tr class="row2"><!-- ENDIF --> + <tr> <td> <!-- IF attachments.S_IN_MESSAGE -->{L_EXTENSION_GROUP}{L_COLON} <strong><!-- IF attachments.EXT_GROUP_NAME -->{attachments.EXT_GROUP_NAME}<!-- ELSE -->{L_NO_EXT_GROUP}<!-- ENDIF --></strong><br />{attachments.L_DOWNLOAD_COUNT}<br />{L_IN} {L_PRIVATE_MESSAGE} <!-- ELSE --><a href="{attachments.U_FILE}" style="font-weight: bold;">{attachments.REAL_FILENAME}</a><br /><!-- IF attachments.COMMENT -->{attachments.COMMENT}<br /><!-- ENDIF -->{attachments.L_DOWNLOAD_COUNT}<br />{L_TOPIC}{L_COLON} <a href="{attachments.U_VIEW_TOPIC}">{attachments.TOPIC_TITLE}</a><!-- ENDIF --> diff --git a/phpBB/adm/style/acp_bbcodes.html b/phpBB/adm/style/acp_bbcodes.html index c22ed395e7..8c8b805975 100644 --- a/phpBB/adm/style/acp_bbcodes.html +++ b/phpBB/adm/style/acp_bbcodes.html @@ -47,6 +47,8 @@ </dl> </fieldset> + <!-- EVENT acp_bbcodes_edit_fieldsets_after --> + <fieldset class="submit-buttons"> <legend>{L_SUBMIT}</legend> <input class="button1" type="submit" id="submit" name="submit" value="{L_SUBMIT}" /> @@ -71,7 +73,7 @@ </thead> <tbody> <!-- BEGIN token --> - <tr valign="top"> + <tr style="vertical-align: top;"> <td class="row1">{token.TOKEN}</td> <td class="row2">{token.EXPLAIN}</td> </tr> @@ -90,7 +92,7 @@ <fieldset class="tabulated"> <legend>{L_ACP_BBCODES}</legend> - <table class="table1" id="down"> + <table class="table1 zebra-table" id="down"> <thead> <tr> <th>{L_BBCODE_TAG}</th> @@ -99,9 +101,9 @@ </thead> <tbody> <!-- BEGIN bbcodes --> - <!-- IF bbcodes.S_ROW_COUNT is even --><tr class="row1"><!-- ELSE --><tr class="row2"><!-- ENDIF --> + <tr> <td style="text-align: center;">{bbcodes.BBCODE_TAG}</td> - <td style="text-align: right; width: 40px;"><a href="{bbcodes.U_EDIT}">{ICON_EDIT}</a> <a href="{bbcodes.U_DELETE}" data-ajax="row_delete">{ICON_DELETE}</a></td> + <td class="actions"><!-- EVENT acp_bbcodes_actions_prepend --> <a href="{bbcodes.U_EDIT}">{ICON_EDIT}</a> <a href="{bbcodes.U_DELETE}" data-ajax="row_delete">{ICON_DELETE}</a> <!-- EVENT acp_bbcodes_actions_append --></td> </tr> <!-- BEGINELSE --> <tr class="row3"> diff --git a/phpBB/adm/style/acp_bots.html b/phpBB/adm/style/acp_bots.html index eeda13303d..b0e61015b6 100644 --- a/phpBB/adm/style/acp_bots.html +++ b/phpBB/adm/style/acp_bots.html @@ -62,7 +62,7 @@ <form id="acp_bots" method="post" action="{U_ACTION}"> - <table class="table1"> + <table class="table1 zebra-table"> <thead> <tr> <th>{L_BOT_NAME}</th> @@ -73,7 +73,7 @@ </thead> <tbody> <!-- BEGIN bots --> - <!-- IF bots.S_ROW_COUNT is even --><tr class="row1"><!-- ELSE --><tr class="row2"><!-- ENDIF --> + <tr> <td style="width: 50%;">{bots.BOT_NAME}</td> <td style="width: 15%; white-space: nowrap;" align="center"> {bots.LAST_VISIT} </td> <td style="text-align: center;"> <a href="{bots.U_ACTIVATE_DEACTIVATE}" data-ajax="activate_deactivate">{bots.L_ACTIVATE_DEACTIVATE}</a> </td> diff --git a/phpBB/adm/style/acp_groups.html b/phpBB/adm/style/acp_groups.html index 925d24f3a3..72f4f2b239 100644 --- a/phpBB/adm/style/acp_groups.html +++ b/phpBB/adm/style/acp_groups.html @@ -155,7 +155,7 @@ <a href="{U_DEFAULT_ALL}">» {L_MAKE_DEFAULT_FOR_ALL}</a> </fieldset> - <table class="table1"> + <table class="table1 zebra-table"> <thead> <tr> <th>{L_USERNAME}</th> @@ -170,7 +170,7 @@ <td class="row3" colspan="5"><strong>{L_GROUP_LEAD}</strong></td> </tr> <!-- BEGIN leader --> - <!-- IF leader.S_ROW_COUNT is even --><tr class="row1"><!-- ELSE --><tr class="row2"><!-- ENDIF --> + <tr> <td><!-- IF leader.USERNAME_COLOUR --><a href="{leader.U_USER_EDIT}" style="color: #{leader.USERNAME_COLOUR};" class="username-coloured">{leader.USERNAME}</a><!-- ELSE --><a href="{leader.U_USER_EDIT}">{leader.USERNAME}</a><!-- ENDIF --></td> <td style="text-align: center;"><!-- IF leader.S_GROUP_DEFAULT -->{L_YES}<!-- ELSE -->{L_NO}<!-- ENDIF --></td> <td style="text-align: center;">{leader.JOINED}</td> @@ -179,7 +179,7 @@ </tr> <!-- BEGINELSE --> <tr> - <td class="row1" colspan="5" style="text-align: center;">{L_GROUPS_NO_MODS}</td> + <td colspan="5" style="text-align: center;">{L_GROUPS_NO_MODS}</td> </tr> <!-- END leader --> <tr> @@ -191,7 +191,7 @@ <td class="row3" colspan="5"><strong>{L_GROUP_PENDING}</strong></td> </tr> <!-- ELSE --> - <!-- IF member.S_ROW_COUNT is even --><tr class="row1"><!-- ELSE --><tr class="row2"><!-- ENDIF --> + <tr> <td><!-- IF member.USERNAME_COLOUR --><a href="{member.U_USER_EDIT}" style="color: #{member.USERNAME_COLOUR};" class="username-coloured">{member.USERNAME}</a><!-- ELSE --><a href="{member.U_USER_EDIT}">{member.USERNAME}</a><!-- ENDIF --></td> <td style="text-align: center;"><!-- IF member.S_GROUP_DEFAULT -->{L_YES}<!-- ELSE -->{L_NO}<!-- ENDIF --></td> <td style="text-align: center;">{member.JOINED}</td> @@ -201,7 +201,7 @@ <!-- ENDIF --> <!-- BEGINELSE --> <tr> - <td class="row1" colspan="5" style="text-align: center;">{L_GROUPS_NO_MEMBERS}</td> + <td colspan="5" style="text-align: center;">{L_GROUPS_NO_MEMBERS}</td> </tr> <!-- END member --> </tbody> diff --git a/phpBB/adm/style/acp_icons.html b/phpBB/adm/style/acp_icons.html index bfe4878ba5..e96a9b86fa 100644 --- a/phpBB/adm/style/acp_icons.html +++ b/phpBB/adm/style/acp_icons.html @@ -74,7 +74,7 @@ <fieldset class="tabulated"> <legend>{L_TITLE}</legend> - <table class="table1" id="smilies"> + <table class="table1 zebra-table" id="smilies"> <thead> <tr> <th colspan="{COLSPAN}">{L_CONFIG}</th> @@ -100,7 +100,7 @@ </thead> <tbody> <!-- BEGIN items --> - <!-- IF items.S_ROW_COUNT is even --><tr class="row1"><!-- ELSE --><tr class="row2"><!-- ENDIF --> + <tr> <td style="text-align: center;"><img src="{items.IMG_SRC}" alt="" title="" /><input type="hidden" name="image[{items.IMG}]" value="1" /></td> <td style="vertical-align: top;">[{items.IMG}]</td> @@ -218,7 +218,7 @@ <legend>{L_TITLE}</legend> - <table class="table1"> + <table class="table1 zebra-table"> <thead> <tr> <th>{L_TITLE}</th> @@ -236,7 +236,7 @@ <td class="row3" colspan="{COLSPAN}" style="text-align: center;">{L_NOT_DISPLAYED}</td> </tr> <!-- ENDIF --> - <!-- IF items.S_ROW_COUNT is even --><tr class="row1"><!-- ELSE --><tr class="row2"><!-- ENDIF --> + <tr> <td style="width: 85%; text-align: center;"><img src="{items.IMG_SRC}" width="{items.WIDTH}" height="{items.HEIGHT}" alt="{items.ALT_TEXT}" title="{items.ALT_TEXT}" /></td> <!-- IF S_SMILIES --> <td style="text-align: center;">{items.CODE}</td> diff --git a/phpBB/adm/style/acp_inactive.html b/phpBB/adm/style/acp_inactive.html index 0302007861..1cdc1abe6b 100644 --- a/phpBB/adm/style/acp_inactive.html +++ b/phpBB/adm/style/acp_inactive.html @@ -16,7 +16,7 @@ </div> <!-- ENDIF --> -<table class="table1"> +<table class="table1 zebra-table"> <thead> <tr> <th>{L_USERNAME}</th> @@ -29,8 +29,7 @@ </thead> <tbody> <!-- BEGIN inactive --> - <!-- IF inactive.S_ROW_COUNT is even --><tr class="row1"><!-- ELSE --><tr class="row2"><!-- ENDIF --> - + <tr> <td style="vertical-align: top;"> {inactive.USERNAME_FULL} <!-- IF inactive.POSTS --><br />{L_POSTS}{L_COLON} <strong>{inactive.POSTS}</strong> [<a href="{inactive.U_SEARCH_USER}">{L_SEARCH_USER_POSTS}</a>]<!-- ENDIF --> @@ -53,7 +52,7 @@ </table> <fieldset class="display-options"> - {L_DISPLAY_LOG}{L_COLON} {S_LIMIT_DAYS} {L_SORT_BY}{L_COLON} {S_SORT_KEY} {S_SORT_DIR}<!-- IF .pagination --> Users per page{L_COLON} <input class="inputbox autowidth" type="number" name="users_per_page" id="users_per_page" size="3" value="{USERS_PER_PAGE}" /><!-- ENDIF --> + {L_DISPLAY_LOG}{L_COLON} {S_LIMIT_DAYS} {L_SORT_BY}{L_COLON} {S_SORT_KEY} {S_SORT_DIR}<!-- IF .pagination --> {L_USERS_PER_PAGE}{L_COLON} <input class="inputbox autowidth" type="number" name="users_per_page" id="users_per_page" size="3" value="{USERS_PER_PAGE}" /><!-- ENDIF --> <input class="button2" type="submit" value="{L_GO}" name="sort" /> </fieldset> diff --git a/phpBB/adm/style/acp_language.html b/phpBB/adm/style/acp_language.html index d4fd572376..f5267e8f7f 100644 --- a/phpBB/adm/style/acp_language.html +++ b/phpBB/adm/style/acp_language.html @@ -211,7 +211,7 @@ <p>{L_ACP_LANGUAGE_PACKS_EXPLAIN}</p> - <table class="table1"> + <table class="table1 zebra-table"> <thead> <tr> <th>{L_LANGUAGE_PACK_NAME}</th> @@ -226,7 +226,7 @@ <td class="row3" colspan="5"><strong>{L_INSTALLED_LANGUAGE_PACKS}</strong></td> </tr> <!-- BEGIN lang --> - <!-- IF lang.S_ROW_COUNT is even --><tr class="row1"><!-- ELSE --><tr class="row2"><!-- ENDIF --> + <tr> <td><a href="{lang.U_DETAILS}">{lang.ENGLISH_NAME}</a> {lang.TAG}</td> <td>{lang.LOCAL_NAME}</td> <td style="text-align: center;"><strong>{lang.ISO}</strong></td> @@ -240,7 +240,7 @@ </tr> <!-- ENDIF --> <!-- BEGIN notinst --> - <!-- IF notinst.S_ROW_COUNT is even --><tr class="row1"><!-- ELSE --><tr class="row2"><!-- ENDIF --> + <tr> <td>{notinst.NAME}</td> <td>{notinst.LOCAL_NAME}</td> <td style="text-align: center;"><strong>{notinst.ISO}</strong></td> diff --git a/phpBB/adm/style/acp_logs.html b/phpBB/adm/style/acp_logs.html index f22eb67a72..592b5bbc16 100644 --- a/phpBB/adm/style/acp_logs.html +++ b/phpBB/adm/style/acp_logs.html @@ -22,7 +22,7 @@ <div><br style="clear: both;" /></div> <!-- IF .log --> - <table class="table1"> + <table class="table1 zebra-table"> <thead> <tr> <th>{L_USERNAME}</th> @@ -36,7 +36,7 @@ </thead> <tbody> <!-- BEGIN log --> - <!-- IF log.S_ROW_COUNT is even --><tr class="row1"><!-- ELSE --><tr class="row2"><!-- ENDIF --> + <tr> <td> {log.USERNAME} <!-- IF log.REPORTEE_USERNAME --> diff --git a/phpBB/adm/style/acp_main.html b/phpBB/adm/style/acp_main.html index bb39ffe050..6e28c7a0cc 100644 --- a/phpBB/adm/style/acp_main.html +++ b/phpBB/adm/style/acp_main.html @@ -26,6 +26,12 @@ </div> <!-- ENDIF --> + <!-- IF S_SEARCH_INDEX_MISSING --> + <div class="errorbox"> + <h3>{L_WARNING}</h3> + <p>{L_NO_SEARCH_INDEX}</p> + </div> + <!-- ENDIF --> <!-- IF S_REMOVE_INSTALL --> <div class="errorbox"> @@ -216,7 +222,7 @@ <div style="text-align: right;"><a href="{U_ADMIN_LOG}">» {L_VIEW_ADMIN_LOG}</a></div> - <table class="table1"> + <table class="table1 zebra-table"> <thead> <tr> <th>{L_USERNAME}</th> @@ -227,8 +233,7 @@ </thead> <tbody> <!-- BEGIN log --> - <!-- IF log.S_ROW_COUNT is even --><tr class="row1"><!-- ELSE --><tr class="row2"><!-- ENDIF --> - + <tr> <td>{log.USERNAME}</td> <td style="text-align: center;">{log.IP}</td> <td style="text-align: center;">{log.DATE}</td> @@ -249,7 +254,7 @@ <div style="text-align: right;"><a href="{U_INACTIVE_USERS}">» {L_VIEW_INACTIVE_USERS}</a></div> - <table class="table1"> + <table class="table1 zebra-table"> <thead> <tr> <th>{L_USERNAME}</th> @@ -261,8 +266,7 @@ </thead> <tbody> <!-- BEGIN inactive --> - <!-- IF inactive.S_ROW_COUNT is even --><tr class="row1"><!-- ELSE --><tr class="row2"><!-- ENDIF --> - + <tr> <td style="vertical-align: top;"> {inactive.USERNAME_FULL} <!-- IF inactive.POSTS --><br />{L_POSTS}{L_COLON} <strong>{inactive.POSTS}</strong> [<a href="{inactive.U_SEARCH_USER}">{L_SEARCH_USER_POSTS}</a>]<!-- ENDIF --> diff --git a/phpBB/adm/style/acp_modules.html b/phpBB/adm/style/acp_modules.html index 8870c815af..5024a950b9 100644 --- a/phpBB/adm/style/acp_modules.html +++ b/phpBB/adm/style/acp_modules.html @@ -151,7 +151,7 @@ <td style="width: 15%; white-space: nowrap; text-align: center; vertical-align: middle;"> <!-- IF modules.MODULE_ENABLED --><a href="{modules.U_DISABLE}">{L_DISABLE}</a><!-- ELSE --><a href="{modules.U_ENABLE}">{L_ENABLE}</a><!-- ENDIF --> </td> <td class="actions"> <span class="up-disabled" style="display:none;">{ICON_MOVE_UP_DISABLED}</span> - <span class="up"><a href="{modules.U_MOVE_DOWN}">{ICON_MOVE_DOWN}</a></span> + <span class="up"><a href="{modules.U_MOVE_UP}">{ICON_MOVE_UP}</a></span> <span class="down-disabled" style="display:none;">{ICON_MOVE_DOWN_DISABLED}</span> <span class="down"><a href="{modules.U_MOVE_DOWN}">{ICON_MOVE_DOWN}</a></span> <a href="{modules.U_EDIT}">{ICON_EDIT}</a> diff --git a/phpBB/adm/style/acp_profile.html b/phpBB/adm/style/acp_profile.html index 3546873f6c..a5685668ba 100644 --- a/phpBB/adm/style/acp_profile.html +++ b/phpBB/adm/style/acp_profile.html @@ -185,7 +185,7 @@ </div> <!-- ENDIF --> - <table class="table1"> + <table class="table1 zebra-table"> <thead> <tr> <th>{L_FIELD_IDENT}</th> @@ -195,8 +195,7 @@ </thead> <tbody> <!-- BEGIN fields --> - <!-- IF fields.S_ROW_COUNT is even --><tr class="row1"><!-- ELSE --><tr class="row2"><!-- ENDIF --> - + <tr> <td>{fields.FIELD_IDENT}</td> <td>{fields.FIELD_TYPE}</td> <td style="text-align: center;"><a href="{fields.U_ACTIVATE_DEACTIVATE}" data-ajax="activate_deactivate">{fields.L_ACTIVATE_DEACTIVATE}</a><!-- IF fields.S_NEED_EDIT --> | <a href="{fields.U_TRANSLATE}" style="color: red;">{L_TRANSLATE}</a><!-- ENDIF --></td> diff --git a/phpBB/adm/style/acp_prune_forums.html b/phpBB/adm/style/acp_prune_forums.html index 1be9689cc7..4d748f1cce 100644 --- a/phpBB/adm/style/acp_prune_forums.html +++ b/phpBB/adm/style/acp_prune_forums.html @@ -8,7 +8,7 @@ <p>{L_PRUNE_SUCCESS}</p> - <table class="table1"> + <table class="table1 zebra-table"> <thead> <tr> <th>{L_FORUM}</th> @@ -18,7 +18,7 @@ </thead> <tbody> <!-- BEGIN pruned --> - <!-- IF pruned.S_ROW_COUNT is even --><tr class="row1"><!-- ELSE --><tr class="row2"><!-- ENDIF --> + <tr> <td style="text-align: center;">{pruned.FORUM_NAME}</td> <td style="text-align: center;">{pruned.NUM_TOPICS}</td> <td style="text-align: center;">{pruned.NUM_POSTS}</td> diff --git a/phpBB/adm/style/acp_prune_users.html b/phpBB/adm/style/acp_prune_users.html index 1257f3fb3d..2bbb03a834 100644 --- a/phpBB/adm/style/acp_prune_users.html +++ b/phpBB/adm/style/acp_prune_users.html @@ -39,11 +39,11 @@ </dl> <dl> <dt><label for="posts_on_queue">{L_POSTS_ON_QUEUE}{L_COLON}</label></dt> - <dd><select name="queue_select">{S_COUNT_OPTIONS}</select> <input type="number" id="posts_on_queue" name="posts_on_queue" /></select> + <dd><select name="queue_select">{S_COUNT_OPTIONS}</select> <input type="number" id="posts_on_queue" name="posts_on_queue" /></dd> </dl> <!-- IF S_GROUP_LIST --> <dl> - <dt><label for="group_id">{L_GROUP}{L_COLON}</label><br /><span>{L_PRUNE_USERS_GROUP_EXPLAIN}</dt> + <dt><label for="group_id">{L_GROUP}{L_COLON}</label><br /><span>{L_PRUNE_USERS_GROUP_EXPLAIN}</span></dt> <dd><select name="group_id">{S_GROUP_LIST}</select></dd> </dl> <!-- ENDIF --> diff --git a/phpBB/adm/style/acp_ranks.html b/phpBB/adm/style/acp_ranks.html index a1409b15ef..be68dda695 100644 --- a/phpBB/adm/style/acp_ranks.html +++ b/phpBB/adm/style/acp_ranks.html @@ -65,7 +65,7 @@ <fieldset class="tabulated"> <legend>{L_ACP_MANAGE_RANKS}</legend> - <table class="table1"> + <table class="table1 zebra-table"> <thead> <tr> <th>{L_RANK_IMAGE}</th> @@ -76,7 +76,7 @@ </thead> <tbody> <!-- BEGIN ranks --> - <!-- IF ranks.S_ROW_COUNT is even --><tr class="row1"><!-- ELSE --><tr class="row2"><!-- ENDIF --> + <tr> <td style="text-align: center;"><!-- IF ranks.S_RANK_IMAGE --><img src="{ranks.RANK_IMAGE}" alt="{ranks.RANK_TITLE}" title="{ranks.RANK_TITLE}" /><!-- ELSE --> - <!-- ENDIF --></td> <td style="text-align: center;">{ranks.RANK_TITLE}</td> <td style="text-align: center;"><!-- IF ranks.S_SPECIAL_RANK --> - <!-- ELSE -->{ranks.MIN_POSTS}<!-- ENDIF --></td> diff --git a/phpBB/adm/style/acp_users.html b/phpBB/adm/style/acp_users.html index b213587def..b84e32013f 100644 --- a/phpBB/adm/style/acp_users.html +++ b/phpBB/adm/style/acp_users.html @@ -125,7 +125,7 @@ <form id="user_groups" method="post" action="{U_ACTION}"> - <table class="table1"> + <table class="table1 zebra-table"> <tbody> <!-- BEGIN group --> <!-- IF group.S_NEW_GROUP_TYPE --> @@ -133,7 +133,7 @@ <td class="row3" colspan="4"><strong>{group.GROUP_TYPE}</strong></td> </tr> <!-- ELSE --> - <!-- IF group.S_ROW_COUNT is even --><tr class="row1"><!-- ELSE --><tr class="row2"><!-- ENDIF --> + <tr> <td><a href="{group.U_EDIT_GROUP}">{group.GROUP_NAME}</a></td> <td><!-- IF group.S_IS_MEMBER --><!-- IF group.S_NO_DEFAULT --><a href="{group.U_DEFAULT}">{L_GROUP_DEFAULT}</a><!-- ELSE --><strong>{L_GROUP_DEFAULT}</strong><!-- ENDIF --><!-- ELSEIF not group.S_IS_MEMBER and group.U_APPROVE --><a href="{group.U_APPROVE}">{L_GROUP_APPROVE}</a><!-- ELSE --> <!-- ENDIF --></td> <td><!-- IF group.S_IS_MEMBER and not group.S_SPECIAL_GROUP --><a href="{group.U_DEMOTE_PROMOTE}">{group.L_DEMOTE_PROMOTE}</a><!-- ELSE --> <!-- ENDIF --></td> @@ -164,7 +164,7 @@ </div> <!-- IF .attach --> - <table class="table1"> + <table class="table1 zebra-table"> <thead> <tr> <th>{L_FILENAME}</th> @@ -176,7 +176,7 @@ </thead> <tbody> <!-- BEGIN attach --> - <!-- IF attach.S_ROW_COUNT is even --><tr class="row1"><!-- ELSE --><tr class="row2"><!-- ENDIF --> + <tr> <td><a href="{attach.U_DOWNLOAD}">{attach.REAL_FILENAME}</a><br /><span class="small"><!-- IF attach.S_IN_MESSAGE --><strong>{L_PM}{L_COLON} </strong><!-- ELSE --><strong>{L_POST}{L_COLON} </strong><!-- ENDIF --><a href="{attach.U_VIEW_TOPIC}">{attach.TOPIC_TITLE}</a></span></td> <td style="text-align: center">{attach.POST_TIME}</td> <td style="text-align: center">{attach.SIZE}</td> diff --git a/phpBB/adm/style/acp_users_feedback.html b/phpBB/adm/style/acp_users_feedback.html index 95892f2822..f251724cd2 100644 --- a/phpBB/adm/style/acp_users_feedback.html +++ b/phpBB/adm/style/acp_users_feedback.html @@ -7,7 +7,7 @@ </div> <!-- IF .log --> - <table class="table1"> + <table class="table1 zebra-table"> <thead> <tr> <th>{L_REPORT_BY}</th> @@ -19,8 +19,7 @@ </thead> <tbody> <!-- BEGIN log --> - <!-- IF log.S_ROW_COUNT is even --><tr class="row1"><!-- ELSE --><tr class="row2"><!-- ENDIF --> - + <tr> <td>{log.USERNAME}</td> <td style="text-align: center;">{log.IP}</td> <td style="text-align: center;">{log.DATE}</td> diff --git a/phpBB/adm/style/acp_users_signature.html b/phpBB/adm/style/acp_users_signature.html index 0a04c411d2..fff75c993d 100644 --- a/phpBB/adm/style/acp_users_signature.html +++ b/phpBB/adm/style/acp_users_signature.html @@ -49,6 +49,7 @@ <legend>{L_SIGNATURE}</legend> <p>{L_SIGNATURE_EXPLAIN}</p> + <!-- EVENT acp_users_signature_editor_buttons_before --> <div id="format-buttons"> <input type="button" class="button2" accesskey="b" name="addbbcode0" value=" B " style="font-weight:bold; width: 30px" onclick="bbstyle(0)" title="{L_BBCODE_B_HELP}" /> <input type="button" class="button2" accesskey="i" name="addbbcode2" value=" i " style="font-style:italic; width: 30px" onclick="bbstyle(2)" title="{L_BBCODE_I_HELP}" /> @@ -84,6 +85,7 @@ <input type="button" class="button2" name="addbbcode{custom_tags.BBCODE_ID}" value="{custom_tags.BBCODE_TAG}" onclick="bbstyle({custom_tags.BBCODE_ID})" title="{custom_tags.BBCODE_HELPLINE}" /> <!-- END custom_tags --> </div> + <!-- EVENT acp_users_signature_editor_buttons_after --> <dl> <dt style="width: 90px;" id="color_palette_placeholder" data-orientation="v" data-height="12" data-width="15" data-bbcode="true"> diff --git a/phpBB/adm/style/acp_users_warnings.html b/phpBB/adm/style/acp_users_warnings.html index 9d082eda6d..6e7f521415 100644 --- a/phpBB/adm/style/acp_users_warnings.html +++ b/phpBB/adm/style/acp_users_warnings.html @@ -1,7 +1,7 @@ <form id="list" method="post" action="{U_ACTION}"> <!-- IF .warn --> - <table class="table1"> + <table class="table1 zebra-table"> <thead> <tr> <th>{L_REPORT_BY}</th> @@ -12,7 +12,7 @@ </thead> <tbody> <!-- BEGIN warn --> - <!-- IF warn.S_ROW_COUNT is even --><tr class="row1"><!-- ELSE --><tr class="row2"><!-- ENDIF --> + <tr> <td>{warn.USERNAME}</td> <td style="text-align: center; nowrap: nowrap;">{warn.DATE}</td> <td>{warn.ACTION}</td> diff --git a/phpBB/adm/style/acp_words.html b/phpBB/adm/style/acp_words.html index 7e91bc4367..6038fc6161 100644 --- a/phpBB/adm/style/acp_words.html +++ b/phpBB/adm/style/acp_words.html @@ -47,7 +47,7 @@ <input class="button2" name="add" type="submit" value="{L_ADD_WORD}" /> </p> - <table class="table1"> + <table class="table1 zebra-table"> <thead> <tr> <th>{L_WORD}</th> @@ -57,7 +57,7 @@ </thead> <tbody> <!-- BEGIN words --> - <!-- IF words.S_ROW_COUNT is even --><tr class="row1"><!-- ELSE --><tr class="row2"><!-- ENDIF --> + <tr> <td style="text-align: center;">{words.WORD}</td> <td style="text-align: center;">{words.REPLACEMENT}</td> <td> <a href="{words.U_EDIT}">{ICON_EDIT}</a> <a href="{words.U_DELETE}" data-ajax="row_delete">{ICON_DELETE}</a> </td> diff --git a/phpBB/adm/style/admin.css b/phpBB/adm/style/admin.css index c7f91d9a8a..928479a31b 100644 --- a/phpBB/adm/style/admin.css +++ b/phpBB/adm/style/admin.css @@ -840,8 +840,14 @@ td.name { text-align: right; } -.row1 { background-color: #F9F9F9; } -.row2 { background-color: #DCEBFE; } +.row1, table.zebra-table tbody tr:nth-child(odd) { + background-color: #F9F9F9; +} + +.row2, table.zebra-table tbody tr:nth-child(even) { + background-color: #DCEBFE; +} + .row3 { background-color: #DBDFE2; } .row4 { background-color: #E4E8EB; } .col1 { background-color: #DCEBFE; } @@ -1587,6 +1593,8 @@ input.button1:focus, input.button2:focus, input.button3:focus { #darkenwrapper { display: none; + position: relative; + z-index: 44; } #darken { @@ -2363,11 +2371,14 @@ fieldset.permissions .padding { .dropdown .dropdown-contents { z-index: 2; overflow: hidden; + overflow-y: auto; background: #fff; border: 1px solid #b9b9b9; border-radius: 5px; padding: 5px; position: relative; + min-width: 40px; + max-height: 200px; box-shadow: 1px 3px 5px rgba(0, 0, 0, 0.2); -webkit-box-sizing: border-box; -moz-box-sizing: border-box; diff --git a/phpBB/adm/style/captcha_qa_acp.html b/phpBB/adm/style/captcha_qa_acp.html index 4ff7c328fc..6235f9a104 100644 --- a/phpBB/adm/style/captcha_qa_acp.html +++ b/phpBB/adm/style/captcha_qa_acp.html @@ -14,7 +14,7 @@ <fieldset class="tabulated"> <legend>{L_QUESTIONS}</legend> - <table class="table1"> + <table class="table1 zebra-table"> <thead> <tr> <th colspan="3">{L_QUESTIONS}</th> @@ -27,14 +27,12 @@ </thead> <tbody> <!-- BEGIN questions --> - - <!-- IF questions.S_ROW_COUNT is even --><tr class="row1"><!-- ELSE --><tr class="row2"><!-- ENDIF --> - + <tr> <td style="text-align: left;">{questions.QUESTION_TEXT}</td> <td style="text-align: center;">{questions.QUESTION_LANG}</td> <td style="text-align: center;"><a href="{questions.U_EDIT}">{ICON_EDIT}</a> <a href="{questions.U_DELETE}">{ICON_DELETE}</a></td> - </tr> - <!-- END questions --> + </tr> + <!-- END questions --> </tbody> </table> <fieldset class="quick"> diff --git a/phpBB/adm/style/overall_footer.html b/phpBB/adm/style/overall_footer.html index 72af9d3388..8810414fc2 100644 --- a/phpBB/adm/style/overall_footer.html +++ b/phpBB/adm/style/overall_footer.html @@ -36,9 +36,9 @@ <script type="text/javascript" src="{T_ASSETS_PATH}/javascript/core.js?assets_version={T_ASSETS_VERSION}"></script> <!-- INCLUDEJS ajax.js --> <!-- INCLUDEJS admin.js --> -{$SCRIPTS} <!-- EVENT acp_overall_footer_after --> +{$SCRIPTS} </body> </html> diff --git a/phpBB/adm/style/overall_header.html b/phpBB/adm/style/overall_header.html index fcef3bb8ac..04f818f95a 100644 --- a/phpBB/adm/style/overall_header.html +++ b/phpBB/adm/style/overall_header.html @@ -103,7 +103,11 @@ function popup(url, width, height, name) // ]]> </script> + <!-- EVENT acp_overall_header_head_append --> + +{$STYLESHEETS} + </head> <body class="{S_CONTENT_DIRECTION} nojs"> diff --git a/phpBB/adm/style/viewsource.html b/phpBB/adm/style/viewsource.html deleted file mode 100644 index 03e9ff50e5..0000000000 --- a/phpBB/adm/style/viewsource.html +++ /dev/null @@ -1,21 +0,0 @@ -<!-- INCLUDE simple_header.html --> -<div id="acp" style="padding: 0;"> -<div class="panel" style="padding: 10px;"> -<div style="overflow: auto;"> - <h1>{FILENAME}</h1> - - <table class="type2"> - <tbody> - <!-- BEGIN source --> - <tr valign="top"> - <td class="sourcenum">{source.LINENUM} </td> - <td class="source">{source.LINE}</td> - </tr> - <!-- END source --> - </tbody> - </table> - -</div> -</div> -</div> -<!-- INCLUDE simple_footer.html --> diff --git a/phpBB/assets/javascript/core.js b/phpBB/assets/javascript/core.js index 8d0db5da1a..5b8331bdce 100644 --- a/phpBB/assets/javascript/core.js +++ b/phpBB/assets/javascript/core.js @@ -932,6 +932,14 @@ phpbb.toggleDropdown = function() { }; /** +* Toggle dropdown submenu +*/ +phpbb.toggleSubmenu = function(e) { + $(this).siblings('.dropdown-submenu').toggle(); + e.preventDefault(); +} + +/** * Register dropdown menu * Shows/hides dropdown, decides which side to open to * @@ -962,6 +970,7 @@ phpbb.registerDropdown = function(toggle, dropdown, options) toggle.data('dropdown-options', ops); toggle.click(phpbb.toggleDropdown); + $('.dropdown-toggle-submenu', ops.parent).click(phpbb.toggleSubmenu); }; /** diff --git a/phpBB/assets/plupload/jquery.plupload.queue/css/jquery.plupload.queue.css b/phpBB/assets/plupload/jquery.plupload.queue/css/jquery.plupload.queue.css index 8581fdd730..da60fefe2b 100644 --- a/phpBB/assets/plupload/jquery.plupload.queue/css/jquery.plupload.queue.css +++ b/phpBB/assets/plupload/jquery.plupload.queue/css/jquery.plupload.queue.css @@ -1,177 +1,177 @@ -/*
- Plupload
-------------------------------------------------------------------- */
-
-.plupload_button {
- display: -moz-inline-box; /* FF < 3*/
- display: inline-block;
- font: normal 12px sans-serif;
- text-decoration: none;
- color: #42454a;
- border: 1px solid #bababa;
- padding: 2px 8px 3px 20px;
- margin-right: 4px;
- background: #f3f3f3 url('../img/buttons.png') no-repeat 0 center;
- outline: 0;
-
- /* Optional rounded corners for browsers that support it */
- -moz-border-radius: 3px;
- -khtml-border-radius: 3px;
- -webkit-border-radius: 3px;
- border-radius: 3px;
-}
-
-.plupload_button:hover {
- color: #000;
- text-decoration: none;
-}
-
-.plupload_disabled, a.plupload_disabled:hover {
- color: #737373;
- border-color: #c5c5c5;
- background: #ededed url('../img/buttons-disabled.png') no-repeat 0 center;
- cursor: default;
-}
-
-.plupload_add {
- background-position: -181px center;
-}
-
-.plupload_wrapper {
- font: normal 11px Verdana,sans-serif;
- width: 100%;
-}
-
-.plupload_container {
- padding: 8px;
- background: url('../img/transp50.png');
- /*-moz-border-radius: 5px;*/
-}
-
-.plupload_container input {
- border: 1px solid #DDD;
- font: normal 11px Verdana,sans-serif;
- width: 98%;
-}
-
-.plupload_header {background: #2A2C2E url('../img/backgrounds.gif') repeat-x;}
-.plupload_header_content {
- background: url('../img/backgrounds.gif') no-repeat 0 -317px;
- min-height: 56px;
- padding-left: 60px;
- color: #FFF;
-}
-.plupload_header_title {
- font: normal 18px sans-serif;
- padding: 6px 0 3px;
-}
-.plupload_header_text {
- font: normal 12px sans-serif;
-}
-
-.plupload_filelist {
- margin: 0;
- padding: 0;
- list-style: none;
-}
-
-.plupload_scroll .plupload_filelist {
- height: 185px;
- background: #F5F5F5;
- overflow-y: scroll;
-}
-
-.plupload_filelist li {
- padding: 10px 8px;
- background: #F5F5F5 url('../img/backgrounds.gif') repeat-x 0 -156px;
- border-bottom: 1px solid #DDD;
-}
-
-.plupload_filelist_header, .plupload_filelist_footer {
- background: #DFDFDF;
- padding: 8px 8px;
- color: #42454A;
-}
-.plupload_filelist_header {
- border-top: 1px solid #EEE;
- border-bottom: 1px solid #CDCDCD;
-}
-
-.plupload_filelist_footer {border-top: 1px solid #FFF; height: 22px; line-height: 20px; vertical-align: middle;}
-.plupload_file_name {float: left; overflow: hidden}
-.plupload_file_status {color: #777;}
-.plupload_file_status span {color: #42454A;}
-.plupload_file_size, .plupload_file_status, .plupload_progress {
- float: right;
- width: 80px;
-}
-.plupload_file_size, .plupload_file_status, .plupload_file_action {text-align: right;}
-
-.plupload_filelist .plupload_file_name {width: 205px}
-
-.plupload_file_action {
- float: right;
- width: 16px;
- height: 16px;
- margin-left: 15px;
-}
-
-.plupload_file_action * {
- display: none;
- width: 16px;
- height: 16px;
-}
-
-li.plupload_uploading {background: #ECF3DC url('../img/backgrounds.gif') repeat-x 0 -238px;}
-li.plupload_done {color:#AAA}
-
-li.plupload_delete a {
- background: url('../img/delete.gif');
-}
-
-li.plupload_failed a {
- background: url('../img/error.gif');
- cursor: default;
-}
-
-li.plupload_done a {
- background: url('../img/done.gif');
- cursor: default;
-}
-
-.plupload_progress, .plupload_upload_status {
- display: none;
-}
-
-.plupload_progress_container {
- margin-top: 3px;
- border: 1px solid #CCC;
- background: #FFF;
- padding: 1px;
-}
-.plupload_progress_bar {
- width: 0px;
- height: 7px;
- background: #CDEB8B;
-}
-
-.plupload_scroll .plupload_filelist_header .plupload_file_action, .plupload_scroll .plupload_filelist_footer .plupload_file_action {
- margin-right: 17px;
-}
-
-/* Floats */
-
-.plupload_clear,.plupload_clearer {clear: both;}
-.plupload_clearer, .plupload_progress_bar {
- display: block;
- font-size: 0;
- line-height: 0;
-}
-
-li.plupload_droptext {
- background: transparent;
- text-align: center;
- vertical-align: middle;
- border: 0;
- line-height: 165px;
-}
+/* + Plupload +------------------------------------------------------------------- */ + +.plupload_button { + display: -moz-inline-box; /* FF < 3*/ + display: inline-block; + font: normal 12px sans-serif; + text-decoration: none; + color: #42454a; + border: 1px solid #bababa; + padding: 2px 8px 3px 20px; + margin-right: 4px; + background: #f3f3f3 url('../img/buttons.png') no-repeat 0 center; + outline: 0; + + /* Optional rounded corners for browsers that support it */ + -moz-border-radius: 3px; + -khtml-border-radius: 3px; + -webkit-border-radius: 3px; + border-radius: 3px; +} + +.plupload_button:hover { + color: #000; + text-decoration: none; +} + +.plupload_disabled, a.plupload_disabled:hover { + color: #737373; + border-color: #c5c5c5; + background: #ededed url('../img/buttons-disabled.png') no-repeat 0 center; + cursor: default; +} + +.plupload_add { + background-position: -181px center; +} + +.plupload_wrapper { + font: normal 11px Verdana, sans-serif; + width: 100%; +} + +.plupload_container { + padding: 8px; + background: url('../img/transp50.png'); + /*-moz-border-radius: 5px;*/ +} + +.plupload_container input { + border: 1px solid #DDD; + font: normal 11px Verdana,sans-serif; + width: 98%; +} + +.plupload_header {background: #2A2C2E url('../img/backgrounds.gif') repeat-x;} +.plupload_header_content { + background: url('../img/backgrounds.gif') no-repeat 0 -317px; + min-height: 56px; + padding-left: 60px; + color: #FFF; +} +.plupload_header_title { + font: normal 18px sans-serif; + padding: 6px 0 3px; +} +.plupload_header_text { + font: normal 12px sans-serif; +} + +.plupload_filelist { + margin: 0; + padding: 0; + list-style: none; +} + +.plupload_scroll .plupload_filelist { + height: 185px; + background: #F5F5F5; + overflow-y: scroll; +} + +.plupload_filelist li { + padding: 10px 8px; + background: #F5F5F5 url('../img/backgrounds.gif') repeat-x 0 -156px; + border-bottom: 1px solid #DDD; +} + +.plupload_filelist_header, .plupload_filelist_footer { + background: #DFDFDF; + padding: 8px 8px; + color: #42454A; +} +.plupload_filelist_header { + border-top: 1px solid #EEE; + border-bottom: 1px solid #CDCDCD; +} + +.plupload_filelist_footer {border-top: 1px solid #FFF; height: 22px; line-height: 20px; vertical-align: middle;} +.plupload_file_name {float: left; overflow: hidden} +.plupload_file_status {color: #777;} +.plupload_file_status span {color: #42454A;} +.plupload_file_size, .plupload_file_status, .plupload_progress { + float: right; + width: 80px; +} +.plupload_file_size, .plupload_file_status, .plupload_file_action {text-align: right;} + +.plupload_filelist .plupload_file_name {width: 205px} + +.plupload_file_action { + float: right; + width: 16px; + height: 16px; + margin-left: 15px; +} + +.plupload_file_action * { + display: none; + width: 16px; + height: 16px; +} + +li.plupload_uploading {background: #ECF3DC url('../img/backgrounds.gif') repeat-x 0 -238px;} +li.plupload_done {color:#AAA} + +li.plupload_delete a { + background: url('../img/delete.gif'); +} + +li.plupload_failed a { + background: url('../img/error.gif'); + cursor: default; +} + +li.plupload_done a { + background: url('../img/done.gif'); + cursor: default; +} + +.plupload_progress, .plupload_upload_status { + display: none; +} + +.plupload_progress_container { + margin-top: 3px; + border: 1px solid #CCC; + background: #FFF; + padding: 1px; +} +.plupload_progress_bar { + width: 0px; + height: 7px; + background: #CDEB8B; +} + +.plupload_scroll .plupload_filelist_header .plupload_file_action, .plupload_scroll .plupload_filelist_footer .plupload_file_action { + margin-right: 17px; +} + +/* Floats */ + +.plupload_clear,.plupload_clearer {clear: both;} +.plupload_clearer, .plupload_progress_bar { + display: block; + font-size: 0; + line-height: 0; +} + +li.plupload_droptext { + background: transparent; + text-align: center; + vertical-align: middle; + border: 0; + line-height: 165px; +} diff --git a/phpBB/assets/plupload/jquery.plupload.queue/jquery.plupload.queue.js b/phpBB/assets/plupload/jquery.plupload.queue/jquery.plupload.queue.js deleted file mode 100644 index 48f03f5c21..0000000000 --- a/phpBB/assets/plupload/jquery.plupload.queue/jquery.plupload.queue.js +++ /dev/null @@ -1 +0,0 @@ -(function(c){var d={};function a(e){return plupload.translate(e)||e}function b(f,e){e.contents().each(function(g,h){h=c(h);if(!h.is(".plupload")){h.remove()}});e.prepend('<div class="plupload_wrapper plupload_scroll"><div id="'+f+'_container" class="plupload_container"><div class="plupload"><div class="plupload_header"><div class="plupload_header_content"><div class="plupload_header_title">'+a("Select files")+'</div><div class="plupload_header_text">'+a("Add files to the upload queue and click the start button.")+'</div></div></div><div class="plupload_content"><div class="plupload_filelist_header"><div class="plupload_file_name">'+a("Filename")+'</div><div class="plupload_file_action"> </div><div class="plupload_file_status"><span>'+a("Status")+'</span></div><div class="plupload_file_size">'+a("Size")+'</div><div class="plupload_clearer"> </div></div><ul id="'+f+'_filelist" class="plupload_filelist"></ul><div class="plupload_filelist_footer"><div class="plupload_file_name"><div class="plupload_buttons"><a href="#" class="plupload_button plupload_add">'+a("Add files")+'</a><a href="#" class="plupload_button plupload_start">'+a("Start upload")+'</a></div><span class="plupload_upload_status"></span></div><div class="plupload_file_action"></div><div class="plupload_file_status"><span class="plupload_total_status">0%</span></div><div class="plupload_file_size"><span class="plupload_total_file_size">0 b</span></div><div class="plupload_progress"><div class="plupload_progress_container"><div class="plupload_progress_bar"></div></div></div><div class="plupload_clearer"> </div></div></div></div></div><input type="hidden" id="'+f+'_count" name="'+f+'_count" value="0" /></div>')}c.fn.pluploadQueue=function(e){if(e){this.each(function(){var j,i,k;i=c(this);k=i.attr("id");if(!k){k=plupload.guid();i.attr("id",k)}j=new plupload.Uploader(c.extend({dragdrop:true,container:k},e));d[k]=j;function h(l){var n;if(l.status==plupload.DONE){n="plupload_done"}if(l.status==plupload.FAILED){n="plupload_failed"}if(l.status==plupload.QUEUED){n="plupload_delete"}if(l.status==plupload.UPLOADING){n="plupload_uploading"}var m=c("#"+l.id).attr("class",n).find("a").css("display","block");if(l.hint){m.attr("title",l.hint)}}function f(){c("span.plupload_total_status",i).html(j.total.percent+"%");c("div.plupload_progress_bar",i).css("width",j.total.percent+"%");c("span.plupload_upload_status",i).html(a("Uploaded %d/%d files").replace(/%d\/%d/,j.total.uploaded+"/"+j.files.length))}function g(){var m=c("ul.plupload_filelist",i).html(""),n=0,l;c.each(j.files,function(p,o){l="";if(o.status==plupload.DONE){if(o.target_name){l+='<input type="hidden" name="'+k+"_"+n+'_tmpname" value="'+plupload.xmlEncode(o.target_name)+'" />'}l+='<input type="hidden" name="'+k+"_"+n+'_name" value="'+plupload.xmlEncode(o.name)+'" />';l+='<input type="hidden" name="'+k+"_"+n+'_status" value="'+(o.status==plupload.DONE?"done":"failed")+'" />';n++;c("#"+k+"_count").val(n)}m.append('<li id="'+o.id+'"><div class="plupload_file_name"><span>'+o.name+'</span></div><div class="plupload_file_action"><a href="#"></a></div><div class="plupload_file_status">'+o.percent+'%</div><div class="plupload_file_size">'+plupload.formatSize(o.size)+'</div><div class="plupload_clearer"> </div>'+l+"</li>");h(o);c("#"+o.id+".plupload_delete a").click(function(q){c("#"+o.id).remove();j.removeFile(o);q.preventDefault()})});c("span.plupload_total_file_size",i).html(plupload.formatSize(j.total.size));if(j.total.queued===0){c("span.plupload_add_text",i).html(a("Add files."))}else{c("span.plupload_add_text",i).html(j.total.queued+" files queued.")}c("a.plupload_start",i).toggleClass("plupload_disabled",j.files.length==(j.total.uploaded+j.total.failed));m[0].scrollTop=m[0].scrollHeight;f();if(!j.files.length&&j.features.dragdrop&&j.settings.dragdrop){c("#"+k+"_filelist").append('<li class="plupload_droptext">'+a("Drag files here.")+"</li>")}}j.bind("UploadFile",function(l,m){c("#"+m.id).addClass("plupload_current_file")});j.bind("Init",function(l,m){b(k,i);if(!e.unique_names&&e.rename){i.on("click","#"+k+"_filelist div.plupload_file_name span",function(s){var q=c(s.target),o,r,n,p="";o=l.getFile(q.parents("li")[0].id);n=o.name;r=/^(.+)(\.[^.]+)$/.exec(n);if(r){n=r[1];p=r[2]}q.hide().after('<input type="text" />');q.next().val(n).focus().blur(function(){q.show().next().remove()}).keydown(function(u){var t=c(this);if(c.inArray(u.keyCode,[13,27])!==-1){u.preventDefault();if(u.keyCode===13){o.name=t.val()+p;q.html(o.name)}t.blur()}})})}c("a.plupload_add",i).attr("id",k+"_browse");l.settings.browse_button=k+"_browse";if(l.features.dragdrop&&l.settings.dragdrop){l.settings.drop_element=k+"_filelist";c("#"+k+"_filelist").append('<li class="plupload_droptext">'+a("Drag files here.")+"</li>")}c("#"+k+"_container").attr("title","Using runtime: "+m.runtime);c("a.plupload_start",i).click(function(n){if(!c(this).hasClass("plupload_disabled")){j.start()}n.preventDefault()});c("a.plupload_stop",i).click(function(n){n.preventDefault();j.stop()});c("a.plupload_start",i).addClass("plupload_disabled")});j.init();j.bind("Error",function(l,o){var m=o.file,n;if(m){n=o.message;if(o.details){n+=" ("+o.details+")"}if(o.code==plupload.FILE_SIZE_ERROR){alert(a("Error: File too large: ")+m.name)}if(o.code==plupload.FILE_EXTENSION_ERROR){alert(a("Error: Invalid file extension: ")+m.name)}m.hint=n;c("#"+m.id).attr("class","plupload_failed").find("a").css("display","block").attr("title",n)}});j.bind("StateChanged",function(){if(j.state===plupload.STARTED){c("li.plupload_delete a,div.plupload_buttons",i).hide();c("span.plupload_upload_status,div.plupload_progress,a.plupload_stop",i).css("display","block");c("span.plupload_upload_status",i).html("Uploaded "+j.total.uploaded+"/"+j.files.length+" files");if(e.multiple_queues){c("span.plupload_total_status,span.plupload_total_file_size",i).show()}}else{g();c("a.plupload_stop,div.plupload_progress",i).hide();c("a.plupload_delete",i).css("display","block")}});j.bind("QueueChanged",g);j.bind("FileUploaded",function(l,m){h(m)});j.bind("UploadProgress",function(l,m){c("#"+m.id+" div.plupload_file_status",i).html(m.percent+"%");h(m);f();if(e.multiple_queues&&j.total.uploaded+j.total.failed==j.files.length){c(".plupload_buttons,.plupload_upload_status",i).css("display","inline");c(".plupload_start",i).addClass("plupload_disabled");c("span.plupload_total_status,span.plupload_total_file_size",i).hide()}});if(e.setup){e.setup(j)}});return this}else{return d[c(this[0]).attr("id")]}}})(jQuery);
\ No newline at end of file diff --git a/phpBB/assets/plupload/jquery.plupload.queue/jquery.plupload.queue.min.js b/phpBB/assets/plupload/jquery.plupload.queue/jquery.plupload.queue.min.js new file mode 100644 index 0000000000..c20be880bc --- /dev/null +++ b/phpBB/assets/plupload/jquery.plupload.queue/jquery.plupload.queue.min.js @@ -0,0 +1 @@ +;(function(e){function n(e){return plupload.translate(e)||e}function r(t,r){r.contents().each(function(t,n){n=e(n),n.is(".plupload")||n.remove()}),r.prepend('<div class="plupload_wrapper plupload_scroll"><div id="'+t+'_container" class="plupload_container">'+'<div class="plupload">'+'<div class="plupload_header">'+'<div class="plupload_header_content">'+'<div class="plupload_header_title">'+n("Select files")+"</div>"+'<div class="plupload_header_text">'+n("Add files to the upload queue and click the start button.")+"</div>"+"</div>"+"</div>"+'<div class="plupload_content">'+'<div class="plupload_filelist_header">'+'<div class="plupload_file_name">'+n("Filename")+"</div>"+'<div class="plupload_file_action"> </div>'+'<div class="plupload_file_status"><span>'+n("Status")+"</span></div>"+'<div class="plupload_file_size">'+n("Size")+"</div>"+'<div class="plupload_clearer"> </div>'+"</div>"+'<ul id="'+t+'_filelist" class="plupload_filelist"></ul>'+'<div class="plupload_filelist_footer">'+'<div class="plupload_file_name">'+'<div class="plupload_buttons">'+'<a href="#" class="plupload_button plupload_add" id="'+t+'_browse">'+n("Add Files")+"</a>"+'<a href="#" class="plupload_button plupload_start">'+n("Start Upload")+"</a>"+"</div>"+'<span class="plupload_upload_status"></span>'+"</div>"+'<div class="plupload_file_action"></div>'+'<div class="plupload_file_status"><span class="plupload_total_status">0%</span></div>'+'<div class="plupload_file_size"><span class="plupload_total_file_size">0 b</span></div>'+'<div class="plupload_progress">'+'<div class="plupload_progress_container">'+'<div class="plupload_progress_bar"></div>'+"</div>"+"</div>"+'<div class="plupload_clearer"> </div>'+"</div>"+"</div>"+"</div>"+"</div>"+'<input type="hidden" id="'+t+'_count" name="'+t+'_count" value="0" />'+"</div>")}var t={};e.fn.pluploadQueue=function(i){return i?(this.each(function(){function f(t){var n;t.status==plupload.DONE&&(n="plupload_done"),t.status==plupload.FAILED&&(n="plupload_failed"),t.status==plupload.QUEUED&&(n="plupload_delete"),t.status==plupload.UPLOADING&&(n="plupload_uploading");var r=e("#"+t.id).attr("class",n).find("a").css("display","block");t.hint&&r.attr("title",t.hint)}function l(){e("span.plupload_total_status",o).html(s.total.percent+"%"),e("div.plupload_progress_bar",o).css("width",s.total.percent+"%"),e("span.plupload_upload_status",o).html(n("Uploaded %d/%d files").replace(/%d\/%d/,s.total.uploaded+"/"+s.files.length))}function c(){var t=e("ul.plupload_filelist",o).html(""),r=0,i;e.each(s.files,function(n,o){i="",o.status==plupload.DONE&&(o.target_name&&(i+='<input type="hidden" name="'+u+"_"+r+'_tmpname" value="'+plupload.xmlEncode(o.target_name)+'" />'),i+='<input type="hidden" name="'+u+"_"+r+'_name" value="'+plupload.xmlEncode(o.name)+'" />',i+='<input type="hidden" name="'+u+"_"+r+'_status" value="'+(o.status==plupload.DONE?"done":"failed")+'" />',r++,e("#"+u+"_count").val(r)),t.append('<li id="'+o.id+'">'+'<div class="plupload_file_name"><span>'+o.name+"</span></div>"+'<div class="plupload_file_action"><a href="#"></a></div>'+'<div class="plupload_file_status">'+o.percent+"%</div>"+'<div class="plupload_file_size">'+plupload.formatSize(o.size)+"</div>"+'<div class="plupload_clearer"> </div>'+i+"</li>"),f(o),e("#"+o.id+".plupload_delete a").click(function(t){e("#"+o.id).remove(),s.removeFile(o),t.preventDefault()})}),e("span.plupload_total_file_size",o).html(plupload.formatSize(s.total.size)),s.total.queued===0?e("span.plupload_add_text",o).html(n("Add Files")):e("span.plupload_add_text",o).html(n("%d files queued").replace(/%d/,s.total.queued)),e("a.plupload_start",o).toggleClass("plupload_disabled",s.files.length==s.total.uploaded+s.total.failed),t[0].scrollTop=t[0].scrollHeight,l(),!s.files.length&&s.features.dragdrop&&s.settings.dragdrop&&e("#"+u+"_filelist").append('<li class="plupload_droptext">'+n("Drag files here.")+"</li>")}function h(){delete t[u],s.destroy(),o.html(a),s=o=a=null}var s,o,u,a;o=e(this),u=o.attr("id"),u||(u=plupload.guid(),o.attr("id",u)),a=o.html(),r(u,o),s=new plupload.Uploader(e.extend({dragdrop:!0,browse_button:u+"_browse",container:u},i)),t[u]=s,s.bind("UploadFile",function(t,n){e("#"+n.id).addClass("plupload_current_file")}),s.bind("Init",function(t,n){!i.unique_names&&i.rename&&o.on("click","#"+u+"_filelist div.plupload_file_name span",function(n){var r=e(n.target),i,s,o,u="";i=t.getFile(r.parents("li")[0].id),o=i.name,s=/^(.+)(\.[^.]+)$/.exec(o),s&&(o=s[1],u=s[2]),r.hide().after('<input type="text" />'),r.next().val(o).focus().blur(function(){r.show().next().remove()}).keydown(function(t){var n=e(this);t.keyCode==13&&(t.preventDefault(),i.name=n.val()+u,r.html(i.name),n.blur())})}),t.settings.dragdrop&&(t.settings.drop_element=u+"_filelist"),e("#"+u+"_container").attr("title","Using runtime: "+n.runtime),e("a.plupload_start",o).click(function(t){e(this).hasClass("plupload_disabled")||s.start(),t.preventDefault()}),e("a.plupload_stop",o).click(function(e){e.preventDefault(),s.stop()}),e("a.plupload_start",o).addClass("plupload_disabled")}),s.bind("Error",function(t,r){var i=r.file,s;i&&(s=r.message,r.details&&(s+=" ("+r.details+")"),r.code==plupload.FILE_SIZE_ERROR&&alert(n("Error: File too large:")+" "+i.name),r.code==plupload.FILE_EXTENSION_ERROR&&alert(n("Error: Invalid file extension:")+" "+i.name),i.hint=s,e("#"+i.id).attr("class","plupload_failed").find("a").css("display","block").attr("title",s)),r.code===plupload.INIT_ERROR&&setTimeout(function(){h()},1)}),s.bind("PostInit",function(t){t.settings.dragdrop&&t.features.dragdrop&&e("#"+u+"_filelist").append('<li class="plupload_droptext">'+n("Drag files here.")+"</li>")}),s.init(),s.bind("StateChanged",function(){s.state===plupload.STARTED?(e("li.plupload_delete a,div.plupload_buttons",o).hide(),e("span.plupload_upload_status,div.plupload_progress,a.plupload_stop",o).css("display","block"),e("span.plupload_upload_status",o).html("Uploaded "+s.total.uploaded+"/"+s.files.length+" files"),i.multiple_queues&&e("span.plupload_total_status,span.plupload_total_file_size",o).show()):(c(),e("a.plupload_stop,div.plupload_progress",o).hide(),e("a.plupload_delete",o).css("display","block"),i.multiple_queues&&s.total.uploaded+s.total.failed==s.files.length&&(e(".plupload_buttons,.plupload_upload_status",o).css("display","inline"),e(".plupload_start",o).addClass("plupload_disabled"),e("span.plupload_total_status,span.plupload_total_file_size",o).hide()))}),s.bind("QueueChanged",c),s.bind("FileUploaded",function(e,t){f(t)}),s.bind("UploadProgress",function(t,n){e("#"+n.id+" div.plupload_file_status",o).html(n.percent+"%"),f(n),l()}),i.setup&&i.setup(s)}),this):t[e(this[0]).attr("id")]}})(jQuery);
\ No newline at end of file diff --git a/phpBB/assets/plupload/plupload.full.min.js b/phpBB/assets/plupload/plupload.full.min.js new file mode 100644 index 0000000000..12e72ccfcb --- /dev/null +++ b/phpBB/assets/plupload/plupload.full.min.js @@ -0,0 +1,28 @@ +/** + * mOxie - multi-runtime File API & XMLHttpRequest L2 Polyfill + * v1.0.0 + * + * Copyright 2013, Moxiecode Systems AB + * Released under GPL License. + * + * License: http://www.plupload.com/license + * Contributing: http://www.plupload.com/contributing + * + * Date: 2013-09-23 + */ +!function(e,t){"use strict";function n(e,t){for(var n,i=[],r=0;r<e.length;++r){if(n=s[e[r]]||o(e[r]),!n)throw"module definition dependecy not found: "+e[r];i.push(n)}t.apply(null,i)}function i(e,i,r){if("string"!=typeof e)throw"invalid module definition, module id must be defined and be a string";if(i===t)throw"invalid module definition, dependencies must be specified";if(r===t)throw"invalid module definition, definition function must be specified";n(i,function(){s[e]=r.apply(null,arguments)})}function r(e){return!!s[e]}function o(t){for(var n=e,i=t.split(/[.\/]/),r=0;r<i.length;++r){if(!n[i[r]])return;n=n[i[r]]}return n}function a(n){for(var i=0;i<n.length;i++){for(var r=e,o=n[i],a=o.split(/[.\/]/),u=0;u<a.length-1;++u)r[a[u]]===t&&(r[a[u]]={}),r=r[a[u]];r[a[a.length-1]]=s[o]}}var s={},u="moxie/core/utils/Basic",c="moxie/core/I18n",l="moxie/core/utils/Mime",d="moxie/core/utils/Env",f="moxie/core/utils/Dom",p="moxie/core/Exceptions",h="moxie/core/EventTarget",m="moxie/core/utils/Encode",g="moxie/runtime/Runtime",v="moxie/runtime/RuntimeClient",y="moxie/file/Blob",E="moxie/file/File",_="moxie/file/FileInput",R="moxie/file/FileDrop",w="moxie/runtime/RuntimeTarget",x="moxie/file/FileReader",b="moxie/core/utils/Url",A="moxie/file/FileReaderSync",T="moxie/xhr/FormData",S="moxie/xhr/XMLHttpRequest",O="moxie/runtime/Transporter",I="moxie/core/JSON",D="moxie/image/Image",L="moxie/runtime/html5/Runtime",N="moxie/runtime/html5/file/Blob",M="moxie/core/utils/Events",C="moxie/runtime/html5/file/FileInput",F="moxie/runtime/html5/file/FileDrop",P="moxie/runtime/html5/file/FileReader",H="moxie/runtime/html5/xhr/XMLHttpRequest",B="moxie/runtime/html5/utils/BinaryReader",U="moxie/runtime/html5/image/JPEGHeaders",G="moxie/runtime/html5/image/ExifParser",z="moxie/runtime/html5/image/JPEG",q="moxie/runtime/html5/image/PNG",k="moxie/runtime/html5/image/ImageInfo",X="moxie/runtime/html5/image/MegaPixel",j="moxie/runtime/html5/image/Image",V="moxie/runtime/flash/Runtime",W="moxie/runtime/flash/file/Blob",Y="moxie/runtime/flash/file/FileInput",$="moxie/runtime/flash/file/FileReader",K="moxie/runtime/flash/file/FileReaderSync",Z="moxie/runtime/flash/xhr/XMLHttpRequest",J="moxie/runtime/flash/runtime/Transporter",Q="moxie/runtime/flash/image/Image",et="moxie/runtime/silverlight/Runtime",tt="moxie/runtime/silverlight/file/Blob",nt="moxie/runtime/silverlight/file/FileInput",it="moxie/runtime/silverlight/file/FileDrop",rt="moxie/runtime/silverlight/file/FileReader",ot="moxie/runtime/silverlight/file/FileReaderSync",at="moxie/runtime/silverlight/xhr/XMLHttpRequest",st="moxie/runtime/silverlight/runtime/Transporter",ut="moxie/runtime/silverlight/image/Image",ct="moxie/runtime/html4/Runtime",lt="moxie/runtime/html4/file/FileInput",dt="moxie/runtime/html4/file/FileReader",ft="moxie/runtime/html4/xhr/XMLHttpRequest",pt="moxie/runtime/html4/image/Image";i(u,[],function(){var e=function(e){var t;return e===t?"undefined":null===e?"null":e.nodeType?"node":{}.toString.call(e).match(/\s([a-z|A-Z]+)/)[1].toLowerCase()},t=function(i){var r;return n(arguments,function(a,s){s>0&&n(a,function(n,a){n!==r&&(e(i[a])===e(n)&&~o(e(n),["array","object"])?t(i[a],n):i[a]=n)})}),i},n=function(e,t){var n,i,r,o;if(e){try{n=e.length}catch(a){n=o}if(n===o){for(i in e)if(e.hasOwnProperty(i)&&t(e[i],i)===!1)return}else for(r=0;n>r;r++)if(t(e[r],r)===!1)return}},i=function(t){var n;if(!t||"object"!==e(t))return!0;for(n in t)return!1;return!0},r=function(t,n){function i(r){"function"===e(t[r])&&t[r](function(e){++r<o&&!e?i(r):n(e)})}var r=0,o=t.length;"function"!==e(n)&&(n=function(){}),t&&t.length||n(),i(r)},o=function(e,t){if(t){if(Array.prototype.indexOf)return Array.prototype.indexOf.call(t,e);for(var n=0,i=t.length;i>n;n++)if(t[n]===e)return n}return-1},a=function(t,n){var i=[];"array"!==e(t)&&(t=[t]),"array"!==e(n)&&(n=[n]);for(var r in t)-1===o(t[r],n)&&i.push(t[r]);return i.length?i:!1},s=function(e,t){var i=[];return n(e,function(e){-1!==o(e,t)&&i.push(e)}),i.length?i:null},u=function(e){var t,n=[];for(t=0;t<e.length;t++)n[t]=e[t];return n},c=function(){var e=0;return function(t){var n=(new Date).getTime().toString(32),i;for(i=0;5>i;i++)n+=Math.floor(65535*Math.random()).toString(32);return(t||"o_")+n+(e++).toString(32)}}(),l=function(e){return e?String.prototype.trim?String.prototype.trim.call(e):e.toString().replace(/^\s*/,"").replace(/\s*$/,""):e},d=function(e){if("string"!=typeof e)return e;var t={t:1099511627776,g:1073741824,m:1048576,k:1024},n;return e=/^([0-9]+)([mgk]?)$/.exec(e.toLowerCase().replace(/[^0-9mkg]/g,"")),n=e[2],e=+e[1],t.hasOwnProperty(n)&&(e*=t[n]),e};return{guid:c,typeOf:e,extend:t,each:n,isEmptyObj:i,inSeries:r,inArray:o,arrayDiff:a,arrayIntersect:s,toArray:u,trim:l,parseSizeStr:d}}),i(c,[u],function(e){var t={};return{addI18n:function(n){return e.extend(t,n)},translate:function(e){return t[e]||e},_:function(e){return this.translate(e)},sprintf:function(t){var n=[].slice.call(arguments,1),i="";return e.each(t.split(/%[a-z]/),function(e){i+=e,n.length&&(i+=n.shift())}),i}}}),i(l,[u,c],function(e,t){var n="application/msword,doc dot,application/pdf,pdf,application/pgp-signature,pgp,application/postscript,ps ai eps,application/rtf,rtf,application/vnd.ms-excel,xls xlb,application/vnd.ms-powerpoint,ppt pps pot,application/zip,zip,application/x-shockwave-flash,swf swfl,application/vnd.openxmlformats-officedocument.wordprocessingml.document,docx,application/vnd.openxmlformats-officedocument.wordprocessingml.template,dotx,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,xlsx,application/vnd.openxmlformats-officedocument.presentationml.presentation,pptx,application/vnd.openxmlformats-officedocument.presentationml.template,potx,application/vnd.openxmlformats-officedocument.presentationml.slideshow,ppsx,application/x-javascript,js,application/json,json,audio/mpeg,mp3 mpga mpega mp2,audio/x-wav,wav,audio/mp4,m4a,audio/ogg,oga ogg,audio/aiff,aiff aif,audio/flac,flac,audio/aac,aac,audio/ac3,ac3,audio/x-ms-wma,wma,image/bmp,bmp,image/gif,gif,image/jpeg,jpg jpeg jpe,image/photoshop,psd,image/png,png,image/svg+xml,svg svgz,image/tiff,tiff tif,text/plain,asc txt text diff log,text/html,htm html xhtml,text/css,css,text/csv,csv,text/rtf,rtf,video/mpeg,mpeg mpg mpe m2v,video/quicktime,qt mov,video/mp4,mp4,video/x-m4v,m4v,video/x-flv,flv,video/x-ms-wmv,wmv,video/avi,avi,video/webm,webm,video/3gpp,3gpp 3gp,video/3gpp2,3g2,video/vnd.rn-realvideo,rv,video/ogg,ogv,video/x-matroska,mkv,application/vnd.oasis.opendocument.formula-template,otf,application/octet-stream,exe",i={mimes:{},extensions:{},addMimeType:function(e){var t=e.split(/,/),n,i,r;for(n=0;n<t.length;n+=2){for(r=t[n+1].split(/ /),i=0;i<r.length;i++)this.mimes[r[i]]=t[n];this.extensions[t[n]]=r}},extList2mimes:function(t,n){var i=this,r,o,a,s,u=[];for(o=0;o<t.length;o++)for(r=t[o].extensions.split(/\s*,\s*/),a=0;a<r.length;a++){if("*"===r[a])return[];if(s=i.mimes[r[a]])-1===e.inArray(s,u)&&u.push(s);else{if(!n||!/^\w+$/.test(r[a]))return[];u.push("."+r[a])}}return u},mimes2exts:function(t){var n=this,i=[];return e.each(t,function(t){if("*"===t)return i=[],!1;var r=t.match(/^(\w+)\/(\*|\w+)$/);r&&("*"===r[2]?e.each(n.extensions,function(e,t){new RegExp("^"+r[1]+"/").test(t)&&[].push.apply(i,n.extensions[t])}):n.extensions[t]&&[].push.apply(i,n.extensions[t]))}),i},mimes2extList:function(n){var i=[],r=[];return"string"===e.typeOf(n)&&(n=e.trim(n).split(/\s*,\s*/)),r=this.mimes2exts(n),i.push({title:t.translate("Files"),extensions:r.length?r.join(","):"*"}),i.mimes=n,i},getFileExtension:function(e){var t=e&&e.match(/\.([^.]+)$/);return t?t[1].toLowerCase():""},getFileMime:function(e){return this.mimes[this.getFileExtension(e)]||""}};return i.addMimeType(n),i}),i(d,[u],function(e){function t(e){for(var t,n,i=0;i<e.length;i++)if(t=e[i].s1,n=e[i].prop,o=e[i].sv||e[i].id,t){if(-1!=t.indexOf(e[i].s2))return e[i].id}else if(n)return e[i].id}function n(e){var t=e.indexOf(o);if(-1!=t)return parseFloat(e.substring(t+o.length+1))}var i=[{s1:navigator.userAgent,s2:"Android",id:"Android Browser",sv:"Version"},{s1:navigator.userAgent,s2:"Chrome",id:"Chrome"},{s1:navigator.vendor,s2:"Apple",id:"Safari",sv:"Version"},{prop:window.opera&&window.opera.buildNumber,id:"Opera",sv:"Version"},{s1:navigator.vendor,s2:"KDE",id:"Konqueror"},{s1:navigator.userAgent,s2:"Firefox",id:"Firefox"},{s1:navigator.vendor,s2:"Camino",id:"Camino"},{s1:navigator.userAgent,s2:"Netscape",id:"Netscape"},{s1:navigator.userAgent,s2:"MSIE",id:"IE",sv:"MSIE"},{s1:navigator.userAgent,s2:"Gecko",id:"Mozilla",sv:"rv"}],r=[{s1:navigator.platform,s2:"Win",id:"Windows"},{s1:navigator.platform,s2:"Mac",id:"Mac"},{s1:navigator.userAgent,s2:"iPhone",id:"iOS"},{s1:navigator.userAgent,s2:"iPad",id:"iOS"},{s1:navigator.userAgent,s2:"Android",id:"Android"},{s1:navigator.platform,s2:"Linux",id:"Linux"}],o,a=function(){var t={define_property:function(){return!1}(),create_canvas:function(){var e=document.createElement("canvas");return!(!e.getContext||!e.getContext("2d"))}(),return_response_type:function(t){try{if(-1!==e.inArray(t,["","text","document"]))return!0;if(window.XMLHttpRequest){var n=new XMLHttpRequest;if(n.open("get","/"),"responseType"in n)return n.responseType=t,n.responseType!==t?!1:!0}}catch(i){}return!1},use_data_uri:function(){var e=new Image;return e.onload=function(){t.use_data_uri=1===e.width&&1===e.height},setTimeout(function(){e.src="data:image/gif;base64,R0lGODlhAQABAIAAAP8AAAAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw=="},1),!1}(),use_data_uri_over32kb:function(){return t.use_data_uri&&("IE"!==s.browser||s.version>=9)},use_data_uri_of:function(e){return t.use_data_uri&&33e3>e||t.use_data_uri_over32kb()},use_fileinput:function(){var e=document.createElement("input");return e.setAttribute("type","file"),!e.disabled}};return function(n){var i=[].slice.call(arguments);return i.shift(),"function"===e.typeOf(t[n])?t[n].apply(this,i):!!t[n]}}(),s={can:a,browser:t(i),version:n(navigator.userAgent)||n(navigator.appVersion),OS:t(r),swf_url:"../flash/Moxie.swf",xap_url:"../silverlight/Moxie.xap",global_event_dispatcher:"moxie.core.EventTarget.instance.dispatchEvent"};return s}),i(f,[d],function(e){var t=function(e){return"string"!=typeof e?e:document.getElementById(e)},n=function(e,t){var n;return""===e.className?!1:(n=new RegExp("(^|\\s+)"+t+"(\\s+|$)"),n.test(e.className))},i=function(e,t){n(e,t)||(e.className=""===e.className?t:e.className.replace(/\s+$/,"")+" "+t)},r=function(e,t){var n=new RegExp("(^|\\s+)"+t+"(\\s+|$)");e.className=e.className.replace(n,function(e,t,n){return" "===t&&" "===n?" ":""})},o=function(e,t){return e.currentStyle?e.currentStyle[t]:window.getComputedStyle?window.getComputedStyle(e,null)[t]:void 0},a=function(t,n){function i(e){var t,n,i=0,r=0;return e&&(n=e.getBoundingClientRect(),t="CSS1Compat"===s.compatMode?s.documentElement:s.body,i=n.left+t.scrollLeft,r=n.top+t.scrollTop),{x:i,y:r}}var r=0,o=0,a,s=document,u,c;if(t=t,n=n||s.body,t&&t.getBoundingClientRect&&"IE"===e.browser&&(!s.documentMode||s.documentMode<8))return u=i(t),c=i(n),{x:u.x-c.x,y:u.y-c.y};for(a=t;a&&a!=n&&a.nodeType;)r+=a.offsetLeft||0,o+=a.offsetTop||0,a=a.offsetParent;for(a=t.parentNode;a&&a!=n&&a.nodeType;)r-=a.scrollLeft||0,o-=a.scrollTop||0,a=a.parentNode;return{x:r,y:o}},s=function(e){return{w:e.offsetWidth||e.clientWidth,h:e.offsetHeight||e.clientHeight}};return{get:t,hasClass:n,addClass:i,removeClass:r,getStyle:o,getPos:a,getSize:s}}),i(p,[u],function(e){function t(e,t){var n;for(n in e)if(e[n]===t)return n;return null}return{RuntimeError:function(){function n(e){this.code=e,this.name=t(i,e),this.message=this.name+": RuntimeError "+this.code}var i={NOT_INIT_ERR:1,NOT_SUPPORTED_ERR:9,JS_ERR:4};return e.extend(n,i),n.prototype=Error.prototype,n}(),OperationNotAllowedException:function(){function t(e){this.code=e,this.name="OperationNotAllowedException"}return e.extend(t,{NOT_ALLOWED_ERR:1}),t.prototype=Error.prototype,t}(),ImageError:function(){function n(e){this.code=e,this.name=t(i,e),this.message=this.name+": ImageError "+this.code}var i={WRONG_FORMAT:1,MAX_RESOLUTION_ERR:2};return e.extend(n,i),n.prototype=Error.prototype,n}(),FileException:function(){function n(e){this.code=e,this.name=t(i,e),this.message=this.name+": FileException "+this.code}var i={NOT_FOUND_ERR:1,SECURITY_ERR:2,ABORT_ERR:3,NOT_READABLE_ERR:4,ENCODING_ERR:5,NO_MODIFICATION_ALLOWED_ERR:6,INVALID_STATE_ERR:7,SYNTAX_ERR:8};return e.extend(n,i),n.prototype=Error.prototype,n}(),DOMException:function(){function n(e){this.code=e,this.name=t(i,e),this.message=this.name+": DOMException "+this.code}var i={INDEX_SIZE_ERR:1,DOMSTRING_SIZE_ERR:2,HIERARCHY_REQUEST_ERR:3,WRONG_DOCUMENT_ERR:4,INVALID_CHARACTER_ERR:5,NO_DATA_ALLOWED_ERR:6,NO_MODIFICATION_ALLOWED_ERR:7,NOT_FOUND_ERR:8,NOT_SUPPORTED_ERR:9,INUSE_ATTRIBUTE_ERR:10,INVALID_STATE_ERR:11,SYNTAX_ERR:12,INVALID_MODIFICATION_ERR:13,NAMESPACE_ERR:14,INVALID_ACCESS_ERR:15,VALIDATION_ERR:16,TYPE_MISMATCH_ERR:17,SECURITY_ERR:18,NETWORK_ERR:19,ABORT_ERR:20,URL_MISMATCH_ERR:21,QUOTA_EXCEEDED_ERR:22,TIMEOUT_ERR:23,INVALID_NODE_TYPE_ERR:24,DATA_CLONE_ERR:25};return e.extend(n,i),n.prototype=Error.prototype,n}(),EventException:function(){function t(e){this.code=e,this.name="EventException"}return e.extend(t,{UNSPECIFIED_EVENT_TYPE_ERR:0}),t.prototype=Error.prototype,t}()}}),i(h,[p,u],function(e,t){function n(){var n={};t.extend(this,{uid:null,init:function(){this.uid||(this.uid=t.guid("uid_"))},addEventListener:function(e,i,r,o){var a=this,s;return e=t.trim(e),/\s/.test(e)?(t.each(e.split(/\s+/),function(e){a.addEventListener(e,i,r,o)}),void 0):(e=e.toLowerCase(),r=parseInt(r,10)||0,s=n[this.uid]&&n[this.uid][e]||[],s.push({fn:i,priority:r,scope:o||this}),n[this.uid]||(n[this.uid]={}),n[this.uid][e]=s,void 0)},hasEventListener:function(e){return e?!(!n[this.uid]||!n[this.uid][e]):!!n[this.uid]},removeEventListener:function(e,i){e=e.toLowerCase();var r=n[this.uid]&&n[this.uid][e],o;if(r){if(i){for(o=r.length-1;o>=0;o--)if(r[o].fn===i){r.splice(o,1);break}}else r=[];r.length||(delete n[this.uid][e],t.isEmptyObj(n[this.uid])&&delete n[this.uid])}},removeAllEventListeners:function(){n[this.uid]&&delete n[this.uid]},dispatchEvent:function(i){var r,o,a,s,u={};if("string"!==t.typeOf(i)){if(s=i,"string"!==t.typeOf(s.type))throw new e.EventException(e.EventException.UNSPECIFIED_EVENT_TYPE_ERR);i=s.type,s.total&&s.loaded&&(u.total=s.total,u.loaded=s.loaded),u.async=s.async||!1}if(-1!==i.indexOf("::")?function(e){r=e[0],i=e[1]}(i.split("::")):r=this.uid,i=i.toLowerCase(),o=n[r]&&n[r][i]){o.sort(function(e,t){return t.priority-e.priority}),a=[].slice.call(arguments),a.shift(),u.type=i,a.unshift(u);var c=[];t.each(o,function(e){a[0].target=e.scope,u.async?c.push(function(t){setTimeout(function(){t(e.fn.apply(e.scope,a)===!1)},1)}):c.push(function(t){t(e.fn.apply(e.scope,a)===!1)})}),c.length&&t.inSeries(c)}return!0},bind:function(){this.addEventListener.apply(this,arguments)},unbind:function(){this.removeEventListener.apply(this,arguments)},unbindAll:function(){this.removeAllEventListeners.apply(this,arguments)},trigger:function(){this.dispatchEvent.apply(this,arguments)},convertEventPropsToHandlers:function(e){var n;"array"!==t.typeOf(e)&&(e=[e]);for(var i=0;i<e.length;i++)n="on"+e[i],"function"===t.typeOf(this[n])?this.addEventListener(e[i],this[n]):"undefined"===t.typeOf(this[n])&&(this[n]=null)}})}return n.instance=new n,n}),i(m,[],function(){var e=function(e){return unescape(encodeURIComponent(e))},t=function(e){return decodeURIComponent(escape(e))},n=function(e,n){if("function"==typeof window.atob)return n?t(window.atob(e)):window.atob(e);var i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",r,o,a,s,u,c,l,d,f=0,p=0,h="",m=[];if(!e)return e;e+="";do s=i.indexOf(e.charAt(f++)),u=i.indexOf(e.charAt(f++)),c=i.indexOf(e.charAt(f++)),l=i.indexOf(e.charAt(f++)),d=s<<18|u<<12|c<<6|l,r=255&d>>16,o=255&d>>8,a=255&d,m[p++]=64==c?String.fromCharCode(r):64==l?String.fromCharCode(r,o):String.fromCharCode(r,o,a);while(f<e.length);return h=m.join(""),n?t(h):h},i=function(t,n){if(n&&e(t),"function"==typeof window.btoa)return window.btoa(t);var i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",r,o,a,s,u,c,l,d,f=0,p=0,h="",m=[];if(!t)return t;do r=t.charCodeAt(f++),o=t.charCodeAt(f++),a=t.charCodeAt(f++),d=r<<16|o<<8|a,s=63&d>>18,u=63&d>>12,c=63&d>>6,l=63&d,m[p++]=i.charAt(s)+i.charAt(u)+i.charAt(c)+i.charAt(l);while(f<t.length);h=m.join("");var g=t.length%3;return(g?h.slice(0,g-3):h)+"===".slice(g||3)};return{utf8_encode:e,utf8_decode:t,atob:n,btoa:i}}),i(g,[u,f,h],function(e,t,n){function i(n,r,a,s,u){function c(t,i){var r=null,o=n&&n.required_caps;return i=i||"browser",null!==this.mode?this.mode:(o&&!e.isEmptyObj(t)&&(e.each(o,function(n,i){if(t.hasOwnProperty(i)){var o=t[i](n);if("string"==typeof o&&(o=[o]),r){if(!(r=e.arrayIntersect(r,o)))return r=!1}else r=o}}),r?this.mode=-1!==e.inArray(i,r)?i:r[0]:r===!1&&(this.mode=!1)),null===this.mode&&(this.mode=i),this.mode&&o&&!this.can(o)&&(this.mode=!1),void 0)}var l=this,d,f=e.guid(r+"_");o[f]=this,a=e.extend({access_binary:!1,access_image_binary:!1,display_media:!1,do_cors:!1,drag_and_drop:!1,filter_by_extension:!0,resize_image:!1,report_upload_progress:!1,return_response_headers:!1,return_response_type:!1,return_status_code:!0,send_custom_headers:!1,select_file:!1,select_folder:!1,select_multiple:!0,send_binary_string:!1,send_browser_cookies:!0,send_multipart:!0,slice_blob:!1,stream_upload:!1,summon_file_dialog:!1,upload_filesize:!0,use_http_method:!0},a),d=function(){var t={};return{exec:function(e,n,i,r){return d[n]&&(t[e]||(t[e]={context:this,instance:new d[n]}),t[e].instance[i])?t[e].instance[i].apply(this,r):void 0},removeInstance:function(e){delete t[e]},removeAllInstances:function(){var n=this;e.each(t,function(t,i){"function"===e.typeOf(t.instance.destroy)&&t.instance.destroy.call(t.context),n.removeInstance(i)})}}}(),e.extend(this,{initialized:!1,uid:f,type:r,mode:null,shimid:f+"_container",clients:0,options:n,can:function(t,n){var r=arguments[2]||a;if("string"===e.typeOf(t)&&"undefined"===e.typeOf(n)&&(t=i.parseCaps(t)),"object"===e.typeOf(t)){for(var o in t)if(!this.can(o,t[o],r))return!1;return!0}return"function"===e.typeOf(r[t])?r[t].call(this,n):n===r[t]},getShimContainer:function(){var n,i=t.get(this.shimid);return i||(n=this.options.container?t.get(this.options.container):document.body,i=document.createElement("div"),i.id=this.shimid,i.className="moxie-shim moxie-shim-"+this.type,e.extend(i.style,{position:"absolute",top:"0px",left:"0px",width:"1px",height:"1px",overflow:"hidden"}),n.appendChild(i),n=null),i},getShim:function(){return d},shimExec:function(e,t){var n=[].slice.call(arguments,2);return l.getShim().exec.call(this,this.uid,e,t,n)},exec:function(e,t){var n=[].slice.call(arguments,2);return l[e]&&l[e][t]?l[e][t].apply(this,n):l.shimExec.apply(this,arguments)},destroy:function(){if(l){var e=t.get(this.shimid);e&&e.parentNode.removeChild(e),d&&d.removeAllInstances(),this.unbindAll(),delete o[this.uid],this.uid=null,f=l=d=e=null}}}),c.call(this,s,u)}var r={},o={};return i.order="html5,flash,silverlight,html4",i.getRuntime=function(e){return o[e]?o[e]:!1},i.addConstructor=function(e,t){t.prototype=n.instance,r[e]=t},i.getConstructor=function(e){return r[e]||null},i.getInfo=function(e){var t=i.getRuntime(e);return t?{uid:t.uid,type:t.type,can:function(){return t.can.apply(t,arguments)}}:null},i.parseCaps=function(t){var n={};return"string"!==e.typeOf(t)?t||{}:(e.each(t.split(","),function(e){n[e]=!0}),n)},i.can=function(e,t){var n,r=i.getConstructor(e),o;return r?(n=new r({required_caps:t}),o=n.mode,n.destroy(),!!o):!1},i.thatCan=function(e,t){var n=(t||i.order).split(/\s*,\s*/);for(var r in n)if(i.can(n[r],e))return n[r];return null},i.capTrue=function(){return!0},i.capFalse=function(){return!1},i.capTest=function(e){return function(){return!!e}},i}),i(v,[p,u,g],function(e,t,n){return function i(){var i;t.extend(this,{connectRuntime:function(r){function o(t){var s,u;return t.length?(s=t.shift(),(u=n.getConstructor(s))?(i=new u(r),i.bind("Init",function(){i.initialized=!0,setTimeout(function(){i.clients++,a.trigger("RuntimeInit",i)},1)}),i.bind("Error",function(){i.destroy(),o(t)}),i.mode?(i.init(),void 0):(i.trigger("Error"),void 0)):(o(t),void 0)):(a.trigger("RuntimeError",new e.RuntimeError(e.RuntimeError.NOT_INIT_ERR)),i=null,void 0)}var a=this,s;if("string"===t.typeOf(r)?s=r:"string"===t.typeOf(r.ruid)&&(s=r.ruid),s){if(i=n.getRuntime(s))return i.clients++,i;throw new e.RuntimeError(e.RuntimeError.NOT_INIT_ERR)}o((r.runtime_order||n.order).split(/\s*,\s*/))},getRuntime:function(){return i&&i.uid?i:(i=null,null)},disconnectRuntime:function(){i&&--i.clients<=0&&(i.destroy(),i=null)}})}}),i(y,[u,m,v],function(e,t,n){function i(o,a){function s(t,n,o){var a,s=r[this.uid];return"string"===e.typeOf(s)&&s.length?(a=new i(null,{type:o,size:n-t}),a.detach(s.substr(t,a.size)),a):null}n.call(this),o&&this.connectRuntime(o),a?"string"===e.typeOf(a)&&(a={data:a}):a={},e.extend(this,{uid:a.uid||e.guid("uid_"),ruid:o,size:a.size||0,type:a.type||"",slice:function(e,t,n){return this.isDetached()?s.apply(this,arguments):this.getRuntime().exec.call(this,"Blob","slice",this.getSource(),e,t,n)},getSource:function(){return r[this.uid]?r[this.uid]:null},detach:function(e){this.ruid&&(this.getRuntime().exec.call(this,"Blob","destroy",r[this.uid]),this.disconnectRuntime(),this.ruid=null),e=e||"";var n=e.match(/^data:([^;]*);base64,/);n&&(this.type=n[1],e=t.atob(e.substring(e.indexOf("base64,")+7))),this.size=e.length,r[this.uid]=e},isDetached:function(){return!this.ruid&&"string"===e.typeOf(r[this.uid])},destroy:function(){this.detach(),delete r[this.uid]}}),a.data?this.detach(a.data):r[this.uid]=a}var r={};return i}),i(E,[u,l,y],function(e,t,n){function i(i,r){var o,a;if(r||(r={}),a=r.type&&""!==r.type?r.type:t.getFileMime(r.name),r.name)o=r.name.replace(/\\/g,"/"),o=o.substr(o.lastIndexOf("/")+1);else{var s=a.split("/")[0];o=e.guid((""!==s?s:"file")+"_"),t.extensions[a]&&(o+="."+t.extensions[a][0])}n.apply(this,arguments),e.extend(this,{type:a||"",name:o||e.guid("file_"),lastModifiedDate:r.lastModifiedDate||(new Date).toLocaleString()})}return i.prototype=n.prototype,i}),i(_,[u,l,f,p,h,c,E,g,v],function(e,t,n,i,r,o,a,s,u){function c(r){var c=this,d,f,p;if(-1!==e.inArray(e.typeOf(r),["string","node"])&&(r={browse_button:r}),f=n.get(r.browse_button),!f)throw new i.DOMException(i.DOMException.NOT_FOUND_ERR);p={accept:[{title:o.translate("All Files"),extensions:"*"}],name:"file",multiple:!1,required_caps:!1,container:f.parentNode||document.body},r=e.extend({},p,r),"string"==typeof r.required_caps&&(r.required_caps=s.parseCaps(r.required_caps)),"string"==typeof r.accept&&(r.accept=t.mimes2extList(r.accept)),d=n.get(r.container),d||(d=document.body),"static"===n.getStyle(d,"position")&&(d.style.position="relative"),d=f=null,u.call(c),e.extend(c,{uid:e.guid("uid_"),ruid:null,files:null,init:function(){c.convertEventPropsToHandlers(l),c.bind("RuntimeInit",function(t,i){c.ruid=i.uid,c.bind("Ready",function(){c.trigger("Refresh")},999),c.bind("Change",function(){var t=i.exec.call(c,"FileInput","getFiles");c.files=[],e.each(t,function(e){return 0===e.size?!0:(c.files.push(new a(c.ruid,e)),void 0)})},999),c.bind("Refresh",function(){var t,o,a,s;a=n.get(r.browse_button),s=n.get(i.shimid),a&&(t=n.getPos(a,n.get(r.container)),o=n.getSize(a),s&&e.extend(s.style,{top:t.y+"px",left:t.x+"px",width:o.w+"px",height:o.h+"px"})),s=a=null}),i.exec.call(c,"FileInput","init",r)}),c.connectRuntime(e.extend({},r,{required_caps:{select_file:!0}}))},disable:function(t){var n=this.getRuntime();n&&n.exec.call(this,"FileInput","disable","undefined"===e.typeOf(t)?!0:t)},refresh:function(){c.trigger("Refresh")},destroy:function(){var t=this.getRuntime();t&&(t.exec.call(this,"FileInput","destroy"),this.disconnectRuntime()),"array"===e.typeOf(this.files)&&e.each(this.files,function(e){e.destroy()}),this.files=null}})}var l=["ready","change","cancel","mouseenter","mouseleave","mousedown","mouseup"];return c.prototype=r.instance,c}),i(R,[c,f,p,u,E,v,h,l],function(e,t,n,i,r,o,a,s){function u(n){var a=this,u;"string"==typeof n&&(n={drop_zone:n}),u={accept:[{title:e.translate("All Files"),extensions:"*"}],required_caps:{drag_and_drop:!0}},n="object"==typeof n?i.extend({},u,n):u,n.container=t.get(n.drop_zone)||document.body,"static"===t.getStyle(n.container,"position")&&(n.container.style.position="relative"),"string"==typeof n.accept&&(n.accept=s.mimes2extList(n.accept)),o.call(a),i.extend(a,{uid:i.guid("uid_"),ruid:null,files:null,init:function(){a.convertEventPropsToHandlers(c),a.bind("RuntimeInit",function(e,t){a.ruid=t.uid,a.bind("Drop",function(){var e=t.exec.call(a,"FileDrop","getFiles");a.files=[],i.each(e,function(e){a.files.push(new r(a.ruid,e))})},999),t.exec.call(a,"FileDrop","init",n),a.dispatchEvent("ready")}),a.connectRuntime(n)},destroy:function(){var e=this.getRuntime();e&&(e.exec.call(this,"FileDrop","destroy"),this.disconnectRuntime()),this.files=null}})}var c=["ready","dragenter","dragleave","drop","error"];return u.prototype=a.instance,u}),i(w,[u,v,h],function(e,t,n){function i(){this.uid=e.guid("uid_"),t.call(this),this.destroy=function(){this.disconnectRuntime(),this.unbindAll()}}return i.prototype=n.instance,i}),i(x,[u,m,p,h,y,E,w],function(e,t,n,i,r,o,a){function s(){function i(e,i){function l(e){o.readyState=s.DONE,o.error=e,o.trigger("error"),d()}function d(){c.destroy(),c=null,o.trigger("loadend")}function f(t){c.bind("Error",function(e,t){l(t)}),c.bind("Progress",function(e){o.result=t.exec.call(c,"FileReader","getResult"),o.trigger(e)}),c.bind("Load",function(e){o.readyState=s.DONE,o.result=t.exec.call(c,"FileReader","getResult"),o.trigger(e),d()}),t.exec.call(c,"FileReader","read",e,i)}if(c=new a,this.convertEventPropsToHandlers(u),this.readyState===s.LOADING)return l(new n.DOMException(n.DOMException.INVALID_STATE_ERR));if(this.readyState=s.LOADING,this.trigger("loadstart"),i instanceof r)if(i.isDetached()){var p=i.getSource();switch(e){case"readAsText":case"readAsBinaryString":this.result=p;break;case"readAsDataURL":this.result="data:"+i.type+";base64,"+t.btoa(p)}this.readyState=s.DONE,this.trigger("load"),d()}else f(c.connectRuntime(i.ruid));else l(new n.DOMException(n.DOMException.NOT_FOUND_ERR))}var o=this,c;e.extend(this,{uid:e.guid("uid_"),readyState:s.EMPTY,result:null,error:null,readAsBinaryString:function(e){i.call(this,"readAsBinaryString",e)},readAsDataURL:function(e){i.call(this,"readAsDataURL",e)},readAsText:function(e){i.call(this,"readAsText",e)},abort:function(){this.result=null,-1===e.inArray(this.readyState,[s.EMPTY,s.DONE])&&(this.readyState===s.LOADING&&(this.readyState=s.DONE),c&&c.getRuntime().exec.call(this,"FileReader","abort"),this.trigger("abort"),this.trigger("loadend"))},destroy:function(){this.abort(),c&&(c.getRuntime().exec.call(this,"FileReader","destroy"),c.disconnectRuntime()),o=c=null}})}var u=["loadstart","progress","load","abort","error","loadend"];return s.EMPTY=0,s.LOADING=1,s.DONE=2,s.prototype=i.instance,s}),i(b,[],function(){var e=function(e){for(var t=["source","scheme","authority","userInfo","user","pass","host","port","relative","path","directory","file","query","fragment"],n=t.length,i={http:80,https:443},r={},o=/^(?:([^:\/?#]+):)?(?:\/\/()(?:(?:()(?:([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?))?()(?:(()(?:(?:[^?#\/]*\/)*)()(?:[^?#]*))(?:\\?([^#]*))?(?:#(.*))?)/,a=o.exec(e||"");n--;)a[n]&&(r[t[n]]=a[n]);if(/^[^\/]/.test(r.path)&&!r.scheme){var s=document.location.pathname;/(\/|\/[^\.]+)$/.test(s)||(s=s.replace(/[^\/]+$/,"")),r.host=document.location.hostname,r.path=s+(r.path||"")}return r.scheme||(r.scheme=document.location.protocol.replace(/:$/,"")),r.host||(r.host=document.location.hostname),r.port||(r.port=document.location.port||i[r.scheme]||80),r.port=parseInt(r.port,10),r.path||(r.path="/"),delete r.source,r},t=function(t){var n={http:80,https:443},i=e(t);return i.scheme+"://"+i.host+(i.port!==n[i.scheme]?":"+i.port:"")+i.path+(i.query?i.query:"")},n=function(t){function n(e){return[e.scheme,e.host,e.port].join("/")}return"string"==typeof t&&(t=e(t)),n(e())===n(t)};return{parseUrl:e,resolveUrl:t,hasSameOrigin:n}}),i(A,[u,v,m],function(e,t,n){return function(){function i(e,t){if(!t.isDetached()){var i=this.connectRuntime(t.ruid).exec.call(this,"FileReaderSync","read",e,t);return this.disconnectRuntime(),i}var r=t.getSource();switch(e){case"readAsBinaryString":return r;case"readAsDataURL":return"data:"+t.type+";base64,"+n.btoa(r);case"readAsText":for(var o="",a=0,s=r.length;s>a;a++)o+=String.fromCharCode(r[a]);return o}}t.call(this),e.extend(this,{uid:e.guid("uid_"),readAsBinaryString:function(e){return i.call(this,"readAsBinaryString",e)},readAsDataURL:function(e){return i.call(this,"readAsDataURL",e)},readAsText:function(e){return i.call(this,"readAsText",e)}})}}),i(T,[p,u,y],function(e,t,n){function i(){var e,i={},r="";t.extend(this,{append:function(r,o){var a=this,s=t.typeOf(o);o instanceof n?(e&&delete i[e],e=r,i[r]=[o]):"array"===s?(r+="[]",t.each(o,function(e){a.append.call(a,r,e)})):"object"===s?t.each(o,function(e,t){a.append.call(a,r+"["+t+"]",e)}):(o=o.toString(),i[r]||(i[r]=[]),i[r].push(o))},hasBlob:function(){return!!e},getBlob:function(){return i[e]&&i[e][0]||null},getBlobName:function(){return e||null},each:function(e){t.each(i,function(n,i){t.each(n,function(t){e(t,i)})})},destroy:function(){e=null,r="",i={}}})}return i}),i(S,[u,p,h,m,b,g,w,y,A,T,d,l],function(e,t,n,i,r,o,a,s,u,c,l,d){function f(){this.uid=e.guid("uid_")}function p(){function n(e,t){return y.hasOwnProperty(e)?1===arguments.length?l.can("define_property")?y[e]:v[e]:(l.can("define_property")?y[e]=t:v[e]=t,void 0):void 0}function u(t){function i(){B.destroy(),B=null,s.dispatchEvent("loadend"),s=null}function r(r){B.bind("LoadStart",function(e){n("readyState",p.LOADING),s.dispatchEvent("readystatechange"),s.dispatchEvent(e),I&&s.upload.dispatchEvent(e)}),B.bind("Progress",function(e){n("readyState")!==p.LOADING&&(n("readyState",p.LOADING),s.dispatchEvent("readystatechange")),s.dispatchEvent(e)}),B.bind("UploadProgress",function(e){I&&s.upload.dispatchEvent({type:"progress",lengthComputable:!1,total:e.total,loaded:e.loaded})}),B.bind("Load",function(t){n("readyState",p.DONE),n("status",Number(r.exec.call(B,"XMLHttpRequest","getStatus")||0)),n("statusText",h[n("status")]||""),n("response",r.exec.call(B,"XMLHttpRequest","getResponse",n("responseType"))),~e.inArray(n("responseType"),["text",""])?n("responseText",n("response")):"document"===n("responseType")&&n("responseXML",n("response")),U=r.exec.call(B,"XMLHttpRequest","getAllResponseHeaders"),s.dispatchEvent("readystatechange"),n("status")>0?(I&&s.upload.dispatchEvent(t),s.dispatchEvent(t)):(L=!0,s.dispatchEvent("error")),i()}),B.bind("Abort",function(e){s.dispatchEvent(e),i()}),B.bind("Error",function(e){L=!0,n("readyState",p.DONE),s.dispatchEvent("readystatechange"),D=!0,s.dispatchEvent(e),i()}),r.exec.call(B,"XMLHttpRequest","send",{url:_,method:R,async:E,user:x,password:b,headers:w,mimeType:T,encoding:A,responseType:s.responseType,withCredentials:s.withCredentials,options:H},t)}var s=this;M=(new Date).getTime(),B=new a,"string"==typeof H.required_caps&&(H.required_caps=o.parseCaps(H.required_caps)),H.required_caps=e.extend({},H.required_caps,{return_response_type:s.responseType}),t instanceof c&&(H.required_caps.send_multipart=!0),N||(H.required_caps.do_cors=!0),H.ruid?r(B.connectRuntime(H)):(B.bind("RuntimeInit",function(e,t){r(t)}),B.bind("RuntimeError",function(e,t){s.dispatchEvent("RuntimeError",t)}),B.connectRuntime(H))}function g(){n("responseText",""),n("responseXML",null),n("response",null),n("status",0),n("statusText",""),M=C=null}var v=this,y={timeout:0,readyState:p.UNSENT,withCredentials:!1,status:0,statusText:"",responseType:"",responseXML:null,responseText:null,response:null},E=!0,_,R,w={},x,b,A=null,T=null,S=!1,O=!1,I=!1,D=!1,L=!1,N=!1,M,C,F=null,P=null,H={},B,U="",G; +e.extend(this,y,{uid:e.guid("uid_"),upload:new f,open:function(o,a,s,u,c){var l;if(!o||!a)throw new t.DOMException(t.DOMException.SYNTAX_ERR);if(/[\u0100-\uffff]/.test(o)||i.utf8_encode(o)!==o)throw new t.DOMException(t.DOMException.SYNTAX_ERR);if(~e.inArray(o.toUpperCase(),["CONNECT","DELETE","GET","HEAD","OPTIONS","POST","PUT","TRACE","TRACK"])&&(R=o.toUpperCase()),~e.inArray(R,["CONNECT","TRACE","TRACK"]))throw new t.DOMException(t.DOMException.SECURITY_ERR);if(a=i.utf8_encode(a),l=r.parseUrl(a),N=r.hasSameOrigin(l),_=r.resolveUrl(a),(u||c)&&!N)throw new t.DOMException(t.DOMException.INVALID_ACCESS_ERR);if(x=u||l.user,b=c||l.pass,E=s||!0,E===!1&&(n("timeout")||n("withCredentials")||""!==n("responseType")))throw new t.DOMException(t.DOMException.INVALID_ACCESS_ERR);S=!E,O=!1,w={},g.call(this),n("readyState",p.OPENED),this.convertEventPropsToHandlers(["readystatechange"]),this.dispatchEvent("readystatechange")},setRequestHeader:function(r,o){var a=["accept-charset","accept-encoding","access-control-request-headers","access-control-request-method","connection","content-length","cookie","cookie2","content-transfer-encoding","date","expect","host","keep-alive","origin","referer","te","trailer","transfer-encoding","upgrade","user-agent","via"];if(n("readyState")!==p.OPENED||O)throw new t.DOMException(t.DOMException.INVALID_STATE_ERR);if(/[\u0100-\uffff]/.test(r)||i.utf8_encode(r)!==r)throw new t.DOMException(t.DOMException.SYNTAX_ERR);return r=e.trim(r).toLowerCase(),~e.inArray(r,a)||/^(proxy\-|sec\-)/.test(r)?!1:(w[r]?w[r]+=", "+o:w[r]=o,!0)},getAllResponseHeaders:function(){return U||""},getResponseHeader:function(t){return t=t.toLowerCase(),L||~e.inArray(t,["set-cookie","set-cookie2"])?null:U&&""!==U&&(G||(G={},e.each(U.split(/\r\n/),function(t){var n=t.split(/:\s+/);2===n.length&&(n[0]=e.trim(n[0]),G[n[0].toLowerCase()]={header:n[0],value:e.trim(n[1])})})),G.hasOwnProperty(t))?G[t].header+": "+G[t].value:null},overrideMimeType:function(i){var r,o;if(~e.inArray(n("readyState"),[p.LOADING,p.DONE]))throw new t.DOMException(t.DOMException.INVALID_STATE_ERR);if(i=e.trim(i.toLowerCase()),/;/.test(i)&&(r=i.match(/^([^;]+)(?:;\scharset\=)?(.*)$/))&&(i=r[1],r[2]&&(o=r[2])),!d.mimes[i])throw new t.DOMException(t.DOMException.SYNTAX_ERR);F=i,P=o},send:function(n,r){if(H="string"===e.typeOf(r)?{ruid:r}:r?r:{},this.convertEventPropsToHandlers(m),this.upload.convertEventPropsToHandlers(m),this.readyState!==p.OPENED||O)throw new t.DOMException(t.DOMException.INVALID_STATE_ERR);if(n instanceof s)H.ruid=n.ruid,T=n.type||"application/octet-stream";else if(n instanceof c){if(n.hasBlob()){var o=n.getBlob();H.ruid=o.ruid,T=o.type||"application/octet-stream"}}else"string"==typeof n&&(A="UTF-8",T="text/plain;charset=UTF-8",n=i.utf8_encode(n));this.withCredentials||(this.withCredentials=H.required_caps&&H.required_caps.send_browser_cookies&&!N),I=!S&&this.upload.hasEventListener(),L=!1,D=!n,S||(O=!0),u.call(this,n)},abort:function(){if(L=!0,S=!1,~e.inArray(n("readyState"),[p.UNSENT,p.OPENED,p.DONE]))n("readyState",p.UNSENT);else{if(n("readyState",p.DONE),O=!1,!B)throw new t.DOMException(t.DOMException.INVALID_STATE_ERR);B.getRuntime().exec.call(B,"XMLHttpRequest","abort",D),D=!0}},destroy:function(){B&&("function"===e.typeOf(B.destroy)&&B.destroy(),B=null),this.unbindAll(),this.upload&&(this.upload.unbindAll(),this.upload=null)}})}var h={100:"Continue",101:"Switching Protocols",102:"Processing",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",226:"IM Used",300:"Multiple Choices",301:"Moved Permanently",302:"Found",303:"See Other",304:"Not Modified",305:"Use Proxy",306:"Reserved",307:"Temporary Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Request Entity Too Large",414:"Request-URI Too Long",415:"Unsupported Media Type",416:"Requested Range Not Satisfiable",417:"Expectation Failed",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",426:"Upgrade Required",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",510:"Not Extended"};f.prototype=n.instance;var m=["loadstart","progress","abort","error","load","timeout","loadend"],g=1,v=2;return p.UNSENT=0,p.OPENED=1,p.HEADERS_RECEIVED=2,p.LOADING=3,p.DONE=4,p.prototype=n.instance,p}),i(O,[u,m,v,h],function(e,t,n,i){function r(){function i(){l=d=0,c=this.result=null}function o(t,n){var i=this;u=n,i.bind("TransportingProgress",function(t){d=t.loaded,l>d&&-1===e.inArray(i.state,[r.IDLE,r.DONE])&&a.call(i)},999),i.bind("TransportingComplete",function(){d=l,i.state=r.DONE,c=null,i.result=u.exec.call(i,"Transporter","getAsBlob",t||"")},999),i.state=r.BUSY,i.trigger("TransportingStarted"),a.call(i)}function a(){var e=this,n,i=l-d;f>i&&(f=i),n=t.btoa(c.substr(d,f)),u.exec.call(e,"Transporter","receive",n,l)}var s,u,c,l,d,f;n.call(this),e.extend(this,{uid:e.guid("uid_"),state:r.IDLE,result:null,transport:function(t,n,r){var a=this;if(r=e.extend({chunk_size:204798},r),(s=r.chunk_size%3)&&(r.chunk_size+=3-s),f=r.chunk_size,i.call(this),c=t,l=t.length,"string"===e.typeOf(r)||r.ruid)o.call(a,n,this.connectRuntime(r));else{var u=function(e,t){a.unbind("RuntimeInit",u),o.call(a,n,t)};this.bind("RuntimeInit",u),this.connectRuntime(r)}},abort:function(){var e=this;e.state=r.IDLE,u&&(u.exec.call(e,"Transporter","clear"),e.trigger("TransportingAborted")),i.call(e)},destroy:function(){this.unbindAll(),u=null,this.disconnectRuntime(),i.call(this)}})}return r.IDLE=0,r.BUSY=1,r.DONE=2,r.prototype=i.instance,r}),i(I,[],function(){return!!window.JSON&&JSON.parse||function(){var e,n,i={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:"\n",r:"\r",t:" "},r,o=function(t){throw{name:"SyntaxError",message:t,at:e,text:r}},a=function(t){return t&&t!==n&&o("Expected '"+t+"' instead of '"+n+"'"),n=r.charAt(e),e+=1,n},s=function(){var e,t="";for("-"===n&&(t="-",a("-"));n>="0"&&"9">=n;)t+=n,a();if("."===n)for(t+=".";a()&&n>="0"&&"9">=n;)t+=n;if("e"===n||"E"===n)for(t+=n,a(),("-"===n||"+"===n)&&(t+=n,a());n>="0"&&"9">=n;)t+=n,a();return e=+t,isFinite(e)?e:(o("Bad number"),void 0)},u=function(){var e,t,r="",s;if('"'===n)for(;a();){if('"'===n)return a(),r;if("\\"===n)if(a(),"u"===n){for(s=0,t=0;4>t&&(e=parseInt(a(),16),isFinite(e));t+=1)s=16*s+e;r+=String.fromCharCode(s)}else{if("string"!=typeof i[n])break;r+=i[n]}else r+=n}o("Bad string")},c=function(){for(;n&&" ">=n;)a()},l=function(){switch(n){case"t":return a("t"),a("r"),a("u"),a("e"),!0;case"f":return a("f"),a("a"),a("l"),a("s"),a("e"),!1;case"n":return a("n"),a("u"),a("l"),a("l"),null}o("Unexpected '"+n+"'")},d,f=function(){var e=[];if("["===n){if(a("["),c(),"]"===n)return a("]"),e;for(;n;){if(e.push(d()),c(),"]"===n)return a("]"),e;a(","),c()}}o("Bad array")},p=function(){var e,t={};if("{"===n){if(a("{"),c(),"}"===n)return a("}"),t;for(;n;){if(e=u(),c(),a(":"),Object.hasOwnProperty.call(t,e)&&o('Duplicate key "'+e+'"'),t[e]=d(),c(),"}"===n)return a("}"),t;a(","),c()}}o("Bad object")};return d=function(){switch(c(),n){case"{":return p();case"[":return f();case'"':return u();case"-":return s();default:return n>="0"&&"9">=n?s():l()}},function(i,a){var s;return r=i,e=0,n=" ",s=d(),c(),n&&o("Syntax error"),"function"==typeof a?function u(e,n){var i,r,o=e[n];if(o&&"object"==typeof o)for(i in o)Object.prototype.hasOwnProperty.call(o,i)&&(r=u(o,i),r!==t?o[i]=r:delete o[i]);return a.call(e,n,o)}({"":s},""):s}}()}),i(D,[u,f,p,A,S,g,v,O,d,h,y,E,m,I],function(e,t,n,i,r,o,a,s,u,c,l,d,f,p){function h(){function i(t){if(t||(t=this.getRuntime().exec.call(this,"Image","getInfo")),t)if("string"===e.typeOf(t.meta))try{this.meta=p(t.meta)}catch(n){}else this.meta=t.meta;e.extend(this,{size:parseInt(t.size,10),width:parseInt(t.width,10),height:parseInt(t.height,10),type:t.type}),""===this.name&&(this.name=t.name)}function c(t){var i=e.typeOf(t);try{if(t instanceof h){if(!t.size)throw new n.DOMException(n.DOMException.INVALID_STATE_ERR);g.apply(this,arguments)}else if(t instanceof l){if(!~e.inArray(t.type,["image/jpeg","image/png"]))throw new n.ImageError(n.ImageError.WRONG_FORMAT);v.apply(this,arguments)}else if(-1!==e.inArray(i,["blob","file"]))c.call(this,new d(null,t),arguments[1]);else if("string"===i)/^data:[^;]*;base64,/.test(t)?c.call(this,new l(null,{data:t}),arguments[1]):y.apply(this,arguments);else{if("node"!==i||"img"!==t.nodeName.toLowerCase())throw new n.DOMException(n.DOMException.TYPE_MISMATCH_ERR);c.call(this,t.src,arguments[1])}}catch(r){this.trigger("error",r)}}function g(t,n){var i=this.connectRuntime(t.ruid);this.ruid=i.uid,i.exec.call(this,"Image","loadFromImage",t,"undefined"===e.typeOf(n)?!0:n)}function v(t,n){function i(e){r.ruid=e.uid,e.exec.call(r,"Image","loadFromBlob",t)}var r=this;r.name=t.name||"",t.isDetached()?(this.bind("RuntimeInit",function(e,t){i(t)}),n&&"string"==typeof n.required_caps&&(n.required_caps=o.parseCaps(n.required_caps)),this.connectRuntime(e.extend({required_caps:{access_image_binary:!0,resize_image:!0}},n))):i(this.connectRuntime(t.ruid))}function y(e,t){var n=this,i;i=new r,i.open("get",e),i.responseType="blob",i.onprogress=function(e){n.trigger(e)},i.onload=function(){v.call(n,i.response,!0)},i.onerror=function(e){n.trigger(e)},i.onloadend=function(){i.destroy()},i.bind("RuntimeError",function(e,t){n.trigger("RuntimeError",t)}),i.send(null,t)}a.call(this),e.extend(this,{uid:e.guid("uid_"),ruid:null,name:"",size:0,width:0,height:0,type:"",meta:{},clone:function(){this.load.apply(this,arguments)},load:function(){this.bind("Load Resize",function(){i.call(this)},999),this.convertEventPropsToHandlers(m),c.apply(this,arguments)},downsize:function(t,i,r,o){try{if(!this.size)throw new n.DOMException(n.DOMException.INVALID_STATE_ERR);if(this.width>h.MAX_RESIZE_WIDTH||this.height>h.MAX_RESIZE_HEIGHT)throw new n.ImageError(n.ImageError.MAX_RESOLUTION_ERR);(!t&&!i||"undefined"===e.typeOf(r))&&(r=!1),t=t||this.width,i=i||this.height,o="undefined"===e.typeOf(o)?!0:!!o,this.getRuntime().exec.call(this,"Image","downsize",t,i,r,o)}catch(a){this.trigger("error",a)}},crop:function(e,t,n){this.downsize(e,t,!0,n)},getAsCanvas:function(){if(!u.can("create_canvas"))throw new n.RuntimeError(n.RuntimeError.NOT_SUPPORTED_ERR);var e=this.connectRuntime(this.ruid);return e.exec.call(this,"Image","getAsCanvas")},getAsBlob:function(e,t){if(!this.size)throw new n.DOMException(n.DOMException.INVALID_STATE_ERR);return e||(e="image/jpeg"),"image/jpeg"!==e||t||(t=90),this.getRuntime().exec.call(this,"Image","getAsBlob",e,t)},getAsDataURL:function(e,t){if(!this.size)throw new n.DOMException(n.DOMException.INVALID_STATE_ERR);return this.getRuntime().exec.call(this,"Image","getAsDataURL",e,t)},getAsBinaryString:function(e,t){var n=this.getAsDataURL(e,t);return f.atob(n.substring(n.indexOf("base64,")+7))},embed:function(i){function r(){if(u.can("create_canvas")){var t=a.getAsCanvas();if(t)return i.appendChild(t),t=null,a.destroy(),o.trigger("embedded"),void 0}var r=a.getAsDataURL(c,l);if(!r)throw new n.ImageError(n.ImageError.WRONG_FORMAT);if(u.can("use_data_uri_of",r.length))i.innerHTML='<img src="'+r+'" width="'+a.width+'" height="'+a.height+'" />',a.destroy(),o.trigger("embedded");else{var d=new s;d.bind("TransportingComplete",function(){v=o.connectRuntime(this.result.ruid),o.bind("Embedded",function(){e.extend(v.getShimContainer().style,{top:"0px",left:"0px",width:a.width+"px",height:a.height+"px"}),v=null},999),v.exec.call(o,"ImageView","display",this.result.uid,m,g),a.destroy()}),d.transport(f.atob(r.substring(r.indexOf("base64,")+7)),c,e.extend({},p,{required_caps:{display_media:!0},runtime_order:"flash,silverlight",container:i}))}}var o=this,a,c,l,d,p=arguments[1]||{},m=this.width,g=this.height,v;try{if(!(i=t.get(i)))throw new n.DOMException(n.DOMException.INVALID_NODE_TYPE_ERR);if(!this.size)throw new n.DOMException(n.DOMException.INVALID_STATE_ERR);if(this.width>h.MAX_RESIZE_WIDTH||this.height>h.MAX_RESIZE_HEIGHT)throw new n.ImageError(n.ImageError.MAX_RESOLUTION_ERR);if(c=p.type||this.type||"image/jpeg",l=p.quality||90,d="undefined"!==e.typeOf(p.crop)?p.crop:!1,p.width)m=p.width,g=p.height||m;else{var y=t.getSize(i);y.w&&y.h&&(m=y.w,g=y.h)}return a=new h,a.bind("Resize",function(){r.call(o)}),a.bind("Load",function(){a.downsize(m,g,d,!1)}),a.clone(this,!1),a}catch(E){this.trigger("error",E)}},destroy:function(){this.ruid&&(this.getRuntime().exec.call(this,"Image","destroy"),this.disconnectRuntime()),this.unbindAll()}})}var m=["progress","load","error","resize","embedded"];return h.MAX_RESIZE_WIDTH=6500,h.MAX_RESIZE_HEIGHT=6500,h.prototype=c.instance,h}),i(L,[u,p,g,d],function(e,t,n,i){function r(t){var r=this,s=n.capTest,u=n.capTrue,c=e.extend({access_binary:s(window.FileReader||window.File&&window.File.getAsDataURL),access_image_binary:function(){return r.can("access_binary")&&!!a.Image},display_media:s(i.can("create_canvas")||i.can("use_data_uri_over32kb")),do_cors:s(window.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest),drag_and_drop:s(function(){var e=document.createElement("div");return("draggable"in e||"ondragstart"in e&&"ondrop"in e)&&("IE"!==i.browser||i.version>9)}()),filter_by_extension:s(function(){return"Chrome"===i.browser&&i.version>=28||"IE"===i.browser&&i.version>=10}()),return_response_headers:u,return_response_type:function(e){return"json"===e?!0:i.can("return_response_type",e)},return_status_code:u,report_upload_progress:s(window.XMLHttpRequest&&(new XMLHttpRequest).upload),resize_image:function(){return r.can("access_binary")&&i.can("create_canvas")},select_file:function(){return i.can("use_fileinput")&&window.File},select_folder:function(){return r.can("select_file")&&"Chrome"===i.browser&&i.version>=21},select_multiple:function(){return r.can("select_file")&&!("Safari"===i.browser&&"Windows"===i.OS)},send_binary_string:s(window.XMLHttpRequest&&((new XMLHttpRequest).sendAsBinary||window.Uint8Array&&window.ArrayBuffer)),send_custom_headers:s(window.XMLHttpRequest),send_multipart:function(){return!!(window.XMLHttpRequest&&(new XMLHttpRequest).upload&&window.FormData)||r.can("send_binary_string")},slice_blob:s(window.File&&(File.prototype.mozSlice||File.prototype.webkitSlice||File.prototype.slice)),stream_upload:function(){return r.can("slice_blob")&&r.can("send_multipart")},summon_file_dialog:s(function(){return"Firefox"===i.browser&&i.version>=4||"Opera"===i.browser&&i.version>=12||"IE"===i.browser&&i.version>=10||!!~e.inArray(i.browser,["Chrome","Safari"])}()),upload_filesize:u},arguments[2]);n.call(this,t,arguments[1]||o,c),e.extend(this,{init:function(){this.trigger("Init")},destroy:function(e){return function(){e.call(r),e=r=null}}(this.destroy)}),e.extend(this.getShim(),a)}var o="html5",a={};return n.addConstructor(o,r),a}),i(N,[L,y],function(e,t){function n(){function e(e,t,n){var i;if(!window.File.prototype.slice)return(i=window.File.prototype.webkitSlice||window.File.prototype.mozSlice)?i.call(e,t,n):null;try{return e.slice(),e.slice(t,n)}catch(r){return e.slice(t,n-t)}}this.slice=function(){return new t(this.getRuntime().uid,e.apply(this,arguments))}}return e.Blob=n}),i(M,[u],function(e){function t(){this.returnValue=!1}function n(){this.cancelBubble=!0}var i={},r="moxie_"+e.guid(),o=function(o,a,s,u){var c,l;a=a.toLowerCase(),o.addEventListener?(c=s,o.addEventListener(a,c,!1)):o.attachEvent&&(c=function(){var e=window.event;e.target||(e.target=e.srcElement),e.preventDefault=t,e.stopPropagation=n,s(e)},o.attachEvent("on"+a,c)),o[r]||(o[r]=e.guid()),i.hasOwnProperty(o[r])||(i[o[r]]={}),l=i[o[r]],l.hasOwnProperty(a)||(l[a]=[]),l[a].push({func:c,orig:s,key:u})},a=function(t,n,o){var a,s;if(n=n.toLowerCase(),t[r]&&i[t[r]]&&i[t[r]][n]){a=i[t[r]][n];for(var u=a.length-1;u>=0&&(a[u].orig!==o&&a[u].key!==o||(t.removeEventListener?t.removeEventListener(n,a[u].func,!1):t.detachEvent&&t.detachEvent("on"+n,a[u].func),a[u].orig=null,a[u].func=null,a.splice(u,1),o===s));u--);if(a.length||delete i[t[r]][n],e.isEmptyObj(i[t[r]])){delete i[t[r]];try{delete t[r]}catch(c){t[r]=s}}}},s=function(t,n){t&&t[r]&&e.each(i[t[r]],function(e,i){a(t,i,n)})};return{addEvent:o,removeEvent:a,removeAllEvents:s}}),i(C,[L,u,f,M,l,d],function(e,t,n,i,r,o){function a(){var e=[],a;t.extend(this,{init:function(s){var u=this,c=u.getRuntime(),l,d,f,p,h,m;a=s,e=[],f=a.accept.mimes||r.extList2mimes(a.accept,c.can("filter_by_extension")),d=c.getShimContainer(),d.innerHTML='<input id="'+c.uid+'" type="file" style="font-size:999px;opacity:0;"'+(a.multiple&&c.can("select_multiple")?"multiple":"")+(a.directory&&c.can("select_folder")?"webkitdirectory directory":"")+(f?' accept="'+f.join(",")+'"':"")+" />",l=n.get(c.uid),t.extend(l.style,{position:"absolute",top:0,left:0,width:"100%",height:"100%"}),p=n.get(a.browse_button),c.can("summon_file_dialog")&&("static"===n.getStyle(p,"position")&&(p.style.position="relative"),h=parseInt(n.getStyle(p,"z-index"),10)||1,p.style.zIndex=h,d.style.zIndex=h-1,i.addEvent(p,"click",function(e){var t=n.get(c.uid);t&&!t.disabled&&t.click(),e.preventDefault()},u.uid)),m=c.can("summon_file_dialog")?p:d,i.addEvent(m,"mouseover",function(){u.trigger("mouseenter")},u.uid),i.addEvent(m,"mouseout",function(){u.trigger("mouseleave")},u.uid),i.addEvent(m,"mousedown",function(){u.trigger("mousedown")},u.uid),i.addEvent(n.get(a.container),"mouseup",function(){u.trigger("mouseup")},u.uid),l.onchange=function g(){if(e=[],a.directory?t.each(this.files,function(t){"."!==t.name&&e.push(t)}):e=[].slice.call(this.files),"IE"!==o.browser)this.value="";else{var n=this.cloneNode(!0);this.parentNode.replaceChild(n,this),n.onchange=g}u.trigger("change")},u.trigger({type:"ready",async:!0}),d=null},getFiles:function(){return e},disable:function(e){var t=this.getRuntime(),i;(i=n.get(t.uid))&&(i.disabled=!!e)},destroy:function(){var t=this.getRuntime(),r=t.getShimContainer();i.removeAllEvents(r,this.uid),i.removeAllEvents(a&&n.get(a.container),this.uid),i.removeAllEvents(a&&n.get(a.browse_button),this.uid),r&&(r.innerHTML=""),e=a=null}})}return e.FileInput=a}),i(F,[L,u,f,M,l],function(e,t,n,i,r){function o(){function e(e){for(var n=[],i=0;i<e.length;i++)[].push.apply(n,e[i].extensions.split(/\s*,\s*/));return-1===t.inArray("*",n)?n:[]}function o(e){var n=r.getFileExtension(e.name);return!n||!l.length||-1!==t.inArray(n,l)}function a(e,n){var i=[];t.each(e,function(e){i.push(function(t){s(e,t)})}),t.inSeries(i,function(){n()})}function s(e,t){e.isFile?e.file(function(e){o(e)&&c.push(e),t()},function(){t()}):e.isDirectory?u(e,t):t()}function u(e,t){function n(e){r.readEntries(function(t){t.length?([].push.apply(i,t),n(e)):e()},e)}var i=[],r=e.createReader();n(function(){a(i,t)})}var c=[],l=[],d;t.extend(this,{init:function(n){var r=this,s;d=n,l=e(d.accept),s=d.container,i.addEvent(s,"dragover",function(e){e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect="copy"},r.uid),i.addEvent(s,"drop",function(e){if(e.preventDefault(),e.stopPropagation(),c=[],e.dataTransfer.items&&e.dataTransfer.items[0].webkitGetAsEntry){var n=[];t.each(e.dataTransfer.items,function(e){n.push(e.webkitGetAsEntry())}),a(n,function(){r.trigger("drop")})}else t.each(e.dataTransfer.files,function(e){o(e)&&c.push(e)}),r.trigger("drop")},r.uid),i.addEvent(s,"dragenter",function(e){e.preventDefault(),e.stopPropagation(),r.trigger("dragenter")},r.uid),i.addEvent(s,"dragleave",function(e){e.preventDefault(),e.stopPropagation(),r.trigger("dragleave")},r.uid)},getFiles:function(){return c},destroy:function(){i.removeAllEvents(d&&n.get(d.container),this.uid),c=l=d=null}})}return e.FileDrop=o}),i(P,[L,m,u],function(e,t,n){function i(){function e(e){return t.atob(e.substring(e.indexOf("base64,")+7))}var i,r=!1;n.extend(this,{read:function(e,t){var o=this;i=new window.FileReader,i.addEventListener("progress",function(e){o.trigger(e)}),i.addEventListener("load",function(e){o.trigger(e)}),i.addEventListener("error",function(e){o.trigger(e,i.error)}),i.addEventListener("loadend",function(){i=null}),"function"===n.typeOf(i[e])?(r=!1,i[e](t.getSource())):"readAsBinaryString"===e&&(r=!0,i.readAsDataURL(t.getSource()))},getResult:function(){return i&&i.result?r?e(i.result):i.result:null},abort:function(){i&&i.abort()},destroy:function(){i=null}})}return e.FileReader=i}),i(H,[L,u,l,b,E,y,T,p,d,I],function(e,t,n,i,r,o,a,s,u,c){function l(){function e(e,t){var n=this,i,r;i=t.getBlob().getSource(),r=new window.FileReader,r.onload=function(){t.append(t.getBlobName(),new o(null,{type:i.type,data:r.result})),self.send.call(n,e,t)},r.readAsBinaryString(i)}function l(){return!window.XMLHttpRequest||"IE"===u.browser&&u.version<8?function(){for(var e=["Msxml2.XMLHTTP.6.0","Microsoft.XMLHTTP"],t=0;t<e.length;t++)try{return new ActiveXObject(e[t])}catch(n){}}():new window.XMLHttpRequest}function d(e){var t=e.responseXML,n=e.responseText;return"IE"===u.browser&&n&&t&&!t.documentElement&&/[^\/]+\/[^\+]+\+xml/.test(e.getResponseHeader("Content-Type"))&&(t=new window.ActiveXObject("Microsoft.XMLDOM"),t.async=!1,t.validateOnParse=!1,t.loadXML(n)),t&&("IE"===u.browser&&0!==t.parseError||!t.documentElement||"parsererror"===t.documentElement.tagName)?null:t}function f(e){var t="----moxieboundary"+(new Date).getTime(),n="--",i="\r\n",r="",a=this.getRuntime();if(!a.can("send_binary_string"))throw new s.RuntimeError(s.RuntimeError.NOT_SUPPORTED_ERR);return p.setRequestHeader("Content-Type","multipart/form-data; boundary="+t),e.each(function(e,a){r+=e instanceof o?n+t+i+'Content-Disposition: form-data; name="'+a+'"; filename="'+unescape(encodeURIComponent(e.name||"blob"))+'"'+i+"Content-Type: "+e.type+i+i+e.getSource()+i:n+t+i+'Content-Disposition: form-data; name="'+a+'"'+i+i+unescape(encodeURIComponent(e))+i}),r+=n+t+n+i}var p,h;t.extend(this,{send:function(n,r){var s=this,c="Mozilla"===u.browser&&u.version>=4&&u.version<7,d="Android Browser"===u.browser,m=!1;if(h=n.url.replace(/^.+?\/([\w\-\.]+)$/,"$1").toLowerCase(),p=l(),p.open(n.method,n.url,n.async,n.user,n.password),r instanceof o)r.isDetached()&&(m=!0),r=r.getSource();else if(r instanceof a){if(r.hasBlob())if(r.getBlob().isDetached())r=f.call(s,r),m=!0;else if((c||d)&&"blob"===t.typeOf(r.getBlob().getSource())&&window.FileReader)return e.call(s,n,r),void 0;if(r instanceof a){var g=new window.FormData;r.each(function(e,t){e instanceof o?g.append(t,e.getSource()):g.append(t,e)}),r=g}}p.upload?(n.withCredentials&&(p.withCredentials=!0),p.addEventListener("load",function(e){s.trigger(e)}),p.addEventListener("error",function(e){s.trigger(e)}),p.addEventListener("progress",function(e){s.trigger(e)}),p.upload.addEventListener("progress",function(e){s.trigger({type:"UploadProgress",loaded:e.loaded,total:e.total})})):p.onreadystatechange=function v(){switch(p.readyState){case 1:break;case 2:break;case 3:var e,t;try{i.hasSameOrigin(n.url)&&(e=p.getResponseHeader("Content-Length")||0),p.responseText&&(t=p.responseText.length)}catch(r){e=t=0}s.trigger({type:"progress",lengthComputable:!!e,total:parseInt(e,10),loaded:t});break;case 4:p.onreadystatechange=function(){},0===p.status?s.trigger("error"):s.trigger("load")}},t.isEmptyObj(n.headers)||t.each(n.headers,function(e,t){p.setRequestHeader(t,e)}),""!==n.responseType&&"responseType"in p&&(p.responseType="json"!==n.responseType||u.can("return_response_type","json")?n.responseType:"text"),m?p.sendAsBinary?p.sendAsBinary(r):function(){for(var e=new Uint8Array(r.length),t=0;t<r.length;t++)e[t]=255&r.charCodeAt(t);p.send(e.buffer)}():p.send(r),s.trigger("loadstart")},getStatus:function(){try{if(p)return p.status}catch(e){}return 0},getResponse:function(e){var t=this.getRuntime();try{switch(e){case"blob":var i=new r(t.uid,p.response),o=p.getResponseHeader("Content-Disposition");if(o){var a=o.match(/filename=([\'\"'])([^\1]+)\1/);a&&(h=a[2])}return i.name=h,i.type||(i.type=n.getFileMime(h)),i;case"json":return u.can("return_response_type","json")?p.response:200===p.status?c(p.responseText):null;case"document":return d(p);default:return""!==p.responseText?p.responseText:null}}catch(s){return null}},getAllResponseHeaders:function(){try{return p.getAllResponseHeaders()}catch(e){}return""},abort:function(){p&&p.abort()},destroy:function(){self=h=null}})}return e.XMLHttpRequest=l}),i(B,[],function(){return function(){function e(e,t){var n=r?0:-8*(t-1),i=0,a;for(a=0;t>a;a++)i|=o.charCodeAt(e+a)<<Math.abs(n+8*a);return i}function n(e,t,n){n=3===arguments.length?n:o.length-t-1,o=o.substr(0,t)+e+o.substr(n+t)}function i(e,t,i){var o="",a=r?0:-8*(i-1),s;for(s=0;i>s;s++)o+=String.fromCharCode(255&t>>Math.abs(a+8*s));n(o,e,i)}var r=!1,o;return{II:function(e){return e===t?r:(r=e,void 0)},init:function(e){r=!1,o=e},SEGMENT:function(e,t,i){switch(arguments.length){case 1:return o.substr(e,o.length-e-1);case 2:return o.substr(e,t);case 3:n(i,e,t);break;default:return o}},BYTE:function(t){return e(t,1)},SHORT:function(t){return e(t,2)},LONG:function(n,r){return r===t?e(n,4):(i(n,r,4),void 0)},SLONG:function(t){var n=e(t,4);return n>2147483647?n-4294967296:n},STRING:function(t,n){var i="";for(n+=t;n>t;t++)i+=String.fromCharCode(e(t,1));return i}}}}),i(U,[B],function(e){return function t(n){var i=[],r,o,a,s=0;if(r=new e,r.init(n),65496===r.SHORT(0)){for(o=2;o<=n.length;)if(a=r.SHORT(o),a>=65488&&65495>=a)o+=2;else{if(65498===a||65497===a)break;s=r.SHORT(o+2)+2,a>=65505&&65519>=a&&i.push({hex:a,name:"APP"+(15&a),start:o,length:s,segment:r.SEGMENT(o,s)}),o+=s}return r.init(null),{headers:i,restore:function(e){var t,n;for(r.init(e),o=65504==r.SHORT(2)?4+r.SHORT(4):2,n=0,t=i.length;t>n;n++)r.SEGMENT(o,0,i[n].segment),o+=i[n].length;return e=r.SEGMENT(),r.init(null),e},strip:function(e){var n,i,o;for(i=new t(e),n=i.headers,i.purge(),r.init(e),o=n.length;o--;)r.SEGMENT(n[o].start,n[o].length,"");return e=r.SEGMENT(),r.init(null),e},get:function(e){for(var t=[],n=0,r=i.length;r>n;n++)i[n].name===e.toUpperCase()&&t.push(i[n].segment);return t},set:function(e,t){var n=[],r,o,a;for("string"==typeof t?n.push(t):n=t,r=o=0,a=i.length;a>r&&(i[r].name===e.toUpperCase()&&(i[r].segment=n[o],i[r].length=n[o].length,o++),!(o>=n.length));r++);},purge:function(){i=[],r.init(null),r=null}}}}}),i(G,[u,B],function(e,n){return function i(){function i(e,n){var i=a.SHORT(e),r,o,s,u,d,f,p,h,m=[],g={};for(r=0;i>r;r++)if(p=f=e+12*r+2,s=n[a.SHORT(p)],s!==t){switch(u=a.SHORT(p+=2),d=a.LONG(p+=2),p+=4,m=[],u){case 1:case 7:for(d>4&&(p=a.LONG(p)+c.tiffHeader),o=0;d>o;o++)m[o]=a.BYTE(p+o);break;case 2:d>4&&(p=a.LONG(p)+c.tiffHeader),g[s]=a.STRING(p,d-1);continue;case 3:for(d>2&&(p=a.LONG(p)+c.tiffHeader),o=0;d>o;o++)m[o]=a.SHORT(p+2*o);break;case 4:for(d>1&&(p=a.LONG(p)+c.tiffHeader),o=0;d>o;o++)m[o]=a.LONG(p+4*o);break;case 5:for(p=a.LONG(p)+c.tiffHeader,o=0;d>o;o++)m[o]=a.LONG(p+4*o)/a.LONG(p+4*o+4);break;case 9:for(p=a.LONG(p)+c.tiffHeader,o=0;d>o;o++)m[o]=a.SLONG(p+4*o);break;case 10:for(p=a.LONG(p)+c.tiffHeader,o=0;d>o;o++)m[o]=a.SLONG(p+4*o)/a.SLONG(p+4*o+4);break;default:continue}h=1==d?m[0]:m,g[s]=l.hasOwnProperty(s)&&"object"!=typeof h?l[s][h]:h}return g}function r(){var e=c.tiffHeader;return a.II(18761==a.SHORT(e)),42!==a.SHORT(e+=2)?!1:(c.IFD0=c.tiffHeader+a.LONG(e+=2),u=i(c.IFD0,s.tiff),"ExifIFDPointer"in u&&(c.exifIFD=c.tiffHeader+u.ExifIFDPointer,delete u.ExifIFDPointer),"GPSInfoIFDPointer"in u&&(c.gpsIFD=c.tiffHeader+u.GPSInfoIFDPointer,delete u.GPSInfoIFDPointer),!0)}function o(e,t,n){var i,r,o,u=0;if("string"==typeof t){var l=s[e.toLowerCase()];for(var d in l)if(l[d]===t){t=d;break}}i=c[e.toLowerCase()+"IFD"],r=a.SHORT(i);for(var f=0;r>f;f++)if(o=i+12*f+2,a.SHORT(o)==t){u=o+8;break}return u?(a.LONG(u,n),!0):!1}var a,s,u,c={},l;return a=new n,s={tiff:{274:"Orientation",270:"ImageDescription",271:"Make",272:"Model",305:"Software",34665:"ExifIFDPointer",34853:"GPSInfoIFDPointer"},exif:{36864:"ExifVersion",40961:"ColorSpace",40962:"PixelXDimension",40963:"PixelYDimension",36867:"DateTimeOriginal",33434:"ExposureTime",33437:"FNumber",34855:"ISOSpeedRatings",37377:"ShutterSpeedValue",37378:"ApertureValue",37383:"MeteringMode",37384:"LightSource",37385:"Flash",37386:"FocalLength",41986:"ExposureMode",41987:"WhiteBalance",41990:"SceneCaptureType",41988:"DigitalZoomRatio",41992:"Contrast",41993:"Saturation",41994:"Sharpness"},gps:{0:"GPSVersionID",1:"GPSLatitudeRef",2:"GPSLatitude",3:"GPSLongitudeRef",4:"GPSLongitude"}},l={ColorSpace:{1:"sRGB",0:"Uncalibrated"},MeteringMode:{0:"Unknown",1:"Average",2:"CenterWeightedAverage",3:"Spot",4:"MultiSpot",5:"Pattern",6:"Partial",255:"Other"},LightSource:{1:"Daylight",2:"Fliorescent",3:"Tungsten",4:"Flash",9:"Fine weather",10:"Cloudy weather",11:"Shade",12:"Daylight fluorescent (D 5700 - 7100K)",13:"Day white fluorescent (N 4600 -5400K)",14:"Cool white fluorescent (W 3900 - 4500K)",15:"White fluorescent (WW 3200 - 3700K)",17:"Standard light A",18:"Standard light B",19:"Standard light C",20:"D55",21:"D65",22:"D75",23:"D50",24:"ISO studio tungsten",255:"Other"},Flash:{0:"Flash did not fire.",1:"Flash fired.",5:"Strobe return light not detected.",7:"Strobe return light detected.",9:"Flash fired, compulsory flash mode",13:"Flash fired, compulsory flash mode, return light not detected",15:"Flash fired, compulsory flash mode, return light detected",16:"Flash did not fire, compulsory flash mode",24:"Flash did not fire, auto mode",25:"Flash fired, auto mode",29:"Flash fired, auto mode, return light not detected",31:"Flash fired, auto mode, return light detected",32:"No flash function",65:"Flash fired, red-eye reduction mode",69:"Flash fired, red-eye reduction mode, return light not detected",71:"Flash fired, red-eye reduction mode, return light detected",73:"Flash fired, compulsory flash mode, red-eye reduction mode",77:"Flash fired, compulsory flash mode, red-eye reduction mode, return light not detected",79:"Flash fired, compulsory flash mode, red-eye reduction mode, return light detected",89:"Flash fired, auto mode, red-eye reduction mode",93:"Flash fired, auto mode, return light not detected, red-eye reduction mode",95:"Flash fired, auto mode, return light detected, red-eye reduction mode"},ExposureMode:{0:"Auto exposure",1:"Manual exposure",2:"Auto bracket"},WhiteBalance:{0:"Auto white balance",1:"Manual white balance"},SceneCaptureType:{0:"Standard",1:"Landscape",2:"Portrait",3:"Night scene"},Contrast:{0:"Normal",1:"Soft",2:"Hard"},Saturation:{0:"Normal",1:"Low saturation",2:"High saturation"},Sharpness:{0:"Normal",1:"Soft",2:"Hard"},GPSLatitudeRef:{N:"North latitude",S:"South latitude"},GPSLongitudeRef:{E:"East longitude",W:"West longitude"}},{init:function(e){return c={tiffHeader:10},e!==t&&e.length?(a.init(e),65505===a.SHORT(0)&&"EXIF\0"===a.STRING(4,5).toUpperCase()?r():!1):!1},TIFF:function(){return u},EXIF:function(){var t;if(t=i(c.exifIFD,s.exif),t.ExifVersion&&"array"===e.typeOf(t.ExifVersion)){for(var n=0,r="";n<t.ExifVersion.length;n++)r+=String.fromCharCode(t.ExifVersion[n]);t.ExifVersion=r}return t},GPS:function(){var t;return t=i(c.gpsIFD,s.gps),t.GPSVersionID&&"array"===e.typeOf(t.GPSVersionID)&&(t.GPSVersionID=t.GPSVersionID.join(".")),t},setExif:function(e,t){return"PixelXDimension"!==e&&"PixelYDimension"!==e?!1:o("exif",e,t)},getBinary:function(){return a.SEGMENT()},purge:function(){a.init(null),a=u=null,c={}}}}}),i(z,[u,p,U,B,G],function(e,t,n,i,r){function o(o){function a(){for(var e=0,t,n;e<=u.length;){if(t=c.SHORT(e+=2),t>=65472&&65475>=t)return e+=5,{height:c.SHORT(e),width:c.SHORT(e+=2)};n=c.SHORT(e+=2),e+=n-2}return null}function s(){d&&l&&c&&(d.purge(),l.purge(),c.init(null),u=f=l=d=c=null)}var u,c,l,d,f,p;if(u=o,c=new i,c.init(u),65496!==c.SHORT(0))throw new t.ImageError(t.ImageError.WRONG_FORMAT);l=new n(o),d=new r,p=!!d.init(l.get("app1")[0]),f=a.call(this),e.extend(this,{type:"image/jpeg",size:u.length,width:f&&f.width||0,height:f&&f.height||0,setExif:function(t,n){return p?("object"===e.typeOf(t)?e.each(t,function(e,t){d.setExif(t,e) +}):d.setExif(t,n),l.set("app1",d.getBinary()),void 0):!1},writeHeaders:function(){return arguments.length?l.restore(arguments[0]):u=l.restore(u)},stripHeaders:function(e){return l.strip(e)},purge:function(){s.call(this)}}),p&&(this.meta={tiff:d.TIFF(),exif:d.EXIF(),gps:d.GPS()})}return o}),i(q,[p,u,B],function(e,t,n){function i(i){function r(){var e,t;return e=a.call(this,8),"IHDR"==e.type?(t=e.start,{width:u.LONG(t),height:u.LONG(t+=4)}):null}function o(){u&&(u.init(null),s=d=c=l=u=null)}function a(e){var t,n,i,r;return t=u.LONG(e),n=u.STRING(e+=4,4),i=e+=4,r=u.LONG(e+t),{length:t,type:n,start:i,CRC:r}}var s,u,c,l,d;s=i,u=new n,u.init(s),function(){var t=0,n=0,i=[35152,20039,3338,6666];for(n=0;n<i.length;n++,t+=2)if(i[n]!=u.SHORT(t))throw new e.ImageError(e.ImageError.WRONG_FORMAT)}(),d=r.call(this),t.extend(this,{type:"image/png",size:s.length,width:d.width,height:d.height,purge:function(){o.call(this)}}),o.call(this)}return i}),i(k,[u,p,z,q],function(e,t,n,i){return function(r){var o=[n,i],a;a=function(){for(var e=0;e<o.length;e++)try{return new o[e](r)}catch(n){}throw new t.ImageError(t.ImageError.WRONG_FORMAT)}(),e.extend(this,{type:"",size:0,width:0,height:0,setExif:function(){},writeHeaders:function(e){return e},stripHeaders:function(e){return e},purge:function(){}}),e.extend(this,a),this.purge=function(){a.purge(),a=null}}}),i(X,[],function(){function e(e,i,r){var o=e.naturalWidth,a=e.naturalHeight,s=r.width,u=r.height,c=r.x||0,l=r.y||0,d=i.getContext("2d");t(e)&&(o/=2,a/=2);var f=1024,p=document.createElement("canvas");p.width=p.height=f;for(var h=p.getContext("2d"),m=n(e,o,a),g=0;a>g;){for(var v=g+f>a?a-g:f,y=0;o>y;){var E=y+f>o?o-y:f;h.clearRect(0,0,f,f),h.drawImage(e,-y,-g);var _=y*s/o+c<<0,R=Math.ceil(E*s/o),w=g*u/a/m+l<<0,x=Math.ceil(v*u/a/m);d.drawImage(p,0,0,E,v,_,w,R,x),y+=f}g+=f}p=h=null}function t(e){var t=e.naturalWidth,n=e.naturalHeight;if(t*n>1048576){var i=document.createElement("canvas");i.width=i.height=1;var r=i.getContext("2d");return r.drawImage(e,-t+1,0),0===r.getImageData(0,0,1,1).data[3]}return!1}function n(e,t,n){var i=document.createElement("canvas");i.width=1,i.height=n;var r=i.getContext("2d");r.drawImage(e,0,0);for(var o=r.getImageData(0,0,1,n).data,a=0,s=n,u=n;u>a;){var c=o[4*(u-1)+3];0===c?s=u:a=u,u=s+a>>1}i=null;var l=u/n;return 0===l?1:l}return{isSubsampled:t,renderTo:e}}),i(j,[L,u,p,m,y,k,X,l,d],function(e,t,n,i,r,o,a,s,u){function c(){function e(){if(!_&&!y)throw new n.ImageError(n.DOMException.INVALID_STATE_ERR);return _||y}function c(e){return i.atob(e.substring(e.indexOf("base64,")+7))}function l(e,t){return"data:"+(t||"")+";base64,"+i.btoa(e)}function d(e){var t=this;y=new Image,y.onerror=function(){g.call(this),t.trigger("error",new n.ImageError(n.ImageError.WRONG_FORMAT))},y.onload=function(){t.trigger("load")},y.src=/^data:[^;]*;base64,/.test(e)?e:l(e,w.type)}function f(e,t){var i=this,r;return window.FileReader?(r=new FileReader,r.onload=function(){t(this.result)},r.onerror=function(){i.trigger("error",new n.FileException(n.FileException.NOT_READABLE_ERR))},r.readAsDataURL(e),void 0):t(e.getAsDataURL())}function p(n,i,r,o){var a=this,s,u,c,l,d,f,p,g,v;if(b=o,v=this.meta&&this.meta.tiff&&this.meta.tiff.Orientation||1,-1!==t.inArray(v,[5,6,7,8])){var y=n;n=i,i=y}return f=e(),c=r?Math.max:Math.min,u=c(n/f.width,i/f.height),u>1&&(!r||o)?(this.trigger("Resize"),void 0):(p=Math.round(f.width*u),g=Math.round(f.height*u),_||(_=document.createElement("canvas")),s=_.getContext("2d"),r?(_.width=n,_.height=i):(_.width=p,_.height=g),l=p>_.width?Math.round((p-_.width)/2):0,d=g>_.height?Math.round((g-_.height)/2):0,b||m(_.width,_.height,v),h.call(this,f,_,-l,-d,p,g),this.width=_.width,this.height=_.height,x=!0,a.trigger("Resize"),void 0)}function h(e,t,n,i,r,o){if("iOS"===u.OS)a.renderTo(e,t,{width:r,height:o,x:n,y:i});else{var s=t.getContext("2d");s.drawImage(e,n,i,r,o)}}function m(e,t,n){switch(n){case 5:case 6:case 7:case 8:_.width=t,_.height=e;break;default:_.width=e,_.height=t}var i=_.getContext("2d");switch(n){case 2:i.translate(e,0),i.scale(-1,1);break;case 3:i.translate(e,t),i.rotate(Math.PI);break;case 4:i.translate(0,t),i.scale(1,-1);break;case 5:i.rotate(.5*Math.PI),i.scale(1,-1);break;case 6:i.rotate(.5*Math.PI),i.translate(0,-t);break;case 7:i.rotate(.5*Math.PI),i.translate(e,-t),i.scale(-1,1);break;case 8:i.rotate(-.5*Math.PI),i.translate(-e,0)}}function g(){E&&(E.purge(),E=null),R=y=_=w=null,x=!1}var v=this,y,E,_,R,w,x=!1,b=!0;t.extend(this,{loadFromBlob:function(e){var t=this,i=t.getRuntime(),r=arguments.length>1?arguments[1]:!0;if(!i.can("access_binary"))throw new n.RuntimeError(n.RuntimeError.NOT_SUPPORTED_ERR);return w=e,e.isDetached()?(R=e.getSource(),d.call(this,R),void 0):(f.call(this,e.getSource(),function(e){r&&(R=c(e)),d.call(t,e)}),void 0)},loadFromImage:function(e,t){this.meta=e.meta,w=new r(null,{name:e.name,size:e.size,type:e.type}),d.call(this,t?R=e.getAsBinaryString():e.getAsDataURL())},getInfo:function(){var t=this.getRuntime(),n;return!E&&R&&t.can("access_image_binary")&&(E=new o(R)),n={width:e().width||0,height:e().height||0,type:w.type||s.getFileMime(w.name),size:R&&R.length||w.size||0,name:w.name||"",meta:E&&E.meta||this.meta||{}}},downsize:function(){p.apply(this,arguments)},getAsCanvas:function(){return _&&(_.id=this.uid+"_canvas"),_},getAsBlob:function(e,t){return e!==this.type&&p.call(this,this.width,this.height,!1),new r(null,{type:e,data:v.getAsBinaryString.call(this,e,t)})},getAsDataURL:function(e){var t=arguments[1]||90;if(!x)return y.src;if("image/jpeg"!==e)return _.toDataURL("image/png");try{return _.toDataURL("image/jpeg",t/100)}catch(n){return _.toDataURL("image/jpeg")}},getAsBinaryString:function(e,t){if(!x)return R||(R=c(v.getAsDataURL(e,t))),R;if("image/jpeg"!==e)R=c(v.getAsDataURL(e,t));else{var n;t||(t=90);try{n=_.toDataURL("image/jpeg",t/100)}catch(i){n=_.toDataURL("image/jpeg")}R=c(n),E&&(R=E.stripHeaders(R),b&&(E.meta&&E.meta.exif&&E.setExif({PixelXDimension:this.width,PixelYDimension:this.height}),R=E.writeHeaders(R)),E.purge(),E=null)}return x=!1,R},destroy:function(){v=null,g.call(this),this.getRuntime().getShim().removeInstance(this.uid)}})}return e.Image=c}),i(V,[u,d,f,p,g],function(e,t,n,i,r){function o(){var e;try{e=navigator.plugins["Shockwave Flash"],e=e.description}catch(t){try{e=new ActiveXObject("ShockwaveFlash.ShockwaveFlash").GetVariable("$version")}catch(n){e="0.0"}}return e=e.match(/\d+/g),parseFloat(e[0]+"."+e[1])}function a(a){var c=this,l;a=e.extend({swf_url:t.swf_url},a),r.call(this,a,s,{access_binary:function(e){return e&&"browser"===c.mode},access_image_binary:function(e){return e&&"browser"===c.mode},display_media:r.capTrue,do_cors:r.capTrue,drag_and_drop:!1,report_upload_progress:function(){return"client"===c.mode},resize_image:r.capTrue,return_response_headers:!1,return_response_type:function(t){return!e.arrayDiff(t,["","text","json","document"])||"browser"===c.mode},return_status_code:function(t){return"browser"===c.mode||!e.arrayDiff(t,[200,404])},select_file:r.capTrue,select_multiple:r.capTrue,send_binary_string:function(e){return e&&"browser"===c.mode},send_browser_cookies:function(e){return e&&"browser"===c.mode},send_custom_headers:function(e){return e&&"browser"===c.mode},send_multipart:r.capTrue,slice_blob:r.capTrue,stream_upload:function(e){return e&&"browser"===c.mode},summon_file_dialog:!1,upload_filesize:function(t){return e.parseSizeStr(t)<=2097152||"client"===c.mode},use_http_method:function(t){return!e.arrayDiff(t,["GET","POST"])}},{access_binary:function(e){return e?"browser":"client"},access_image_binary:function(e){return e?"browser":"client"},report_upload_progress:function(e){return e?"browser":"client"},return_response_type:function(t){return e.arrayDiff(t,["","text","json","document"])?"browser":["client","browser"]},return_status_code:function(t){return e.arrayDiff(t,[200,404])?"browser":["client","browser"]},send_binary_string:function(e){return e?"browser":"client"},send_browser_cookies:function(e){return e?"browser":"client"},send_custom_headers:function(e){return e?"browser":"client"},stream_upload:function(e){return e?"client":"browser"},upload_filesize:function(t){return e.parseSizeStr(t)>=2097152?"client":"browser"}},"client"),o()<10&&(this.mode=!1),e.extend(this,{getShim:function(){return n.get(this.uid)},shimExec:function(e,t){var n=[].slice.call(arguments,2);return c.getShim().exec(this.uid,e,t,n)},init:function(){var n,r,o;o=this.getShimContainer(),e.extend(o.style,{position:"absolute",top:"-8px",left:"-8px",width:"9px",height:"9px",overflow:"hidden"}),n='<object id="'+this.uid+'" type="application/x-shockwave-flash" data="'+a.swf_url+'" ',"IE"===t.browser&&(n+='classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" '),n+='width="100%" height="100%" style="outline:0"><param name="movie" value="'+a.swf_url+'" />'+'<param name="flashvars" value="uid='+escape(this.uid)+"&target="+t.global_event_dispatcher+'" />'+'<param name="wmode" value="transparent" />'+'<param name="allowscriptaccess" value="always" />'+"</object>","IE"===t.browser?(r=document.createElement("div"),o.appendChild(r),r.outerHTML=n,r=o=null):o.innerHTML=n,l=setTimeout(function(){c&&!c.initialized&&c.trigger("Error",new i.RuntimeError(i.RuntimeError.NOT_INIT_ERR))},5e3)},destroy:function(e){return function(){e.call(c),clearTimeout(l),a=l=e=c=null}}(this.destroy)},u)}var s="flash",u={};return r.addConstructor(s,a),u}),i(W,[V,y],function(e,t){var n={slice:function(e,n,i,r){var o=this.getRuntime();return 0>n?n=Math.max(e.size+n,0):n>0&&(n=Math.min(n,e.size)),0>i?i=Math.max(e.size+i,0):i>0&&(i=Math.min(i,e.size)),e=o.shimExec.call(this,"Blob","slice",n,i,r||""),e&&(e=new t(o.uid,e)),e}};return e.Blob=n}),i(Y,[V],function(e){var t={init:function(e){this.getRuntime().shimExec.call(this,"FileInput","init",{name:e.name,accept:e.accept,multiple:e.multiple}),this.trigger("ready")}};return e.FileInput=t}),i($,[V,m],function(e,t){function n(e,n){switch(n){case"readAsText":return t.atob(e,"utf8");case"readAsBinaryString":return t.atob(e);case"readAsDataURL":return e}return null}var i="",r={read:function(e,t){var r=this,o=r.getRuntime();return"readAsDataURL"===e&&(i="data:"+(t.type||"")+";base64,"),r.bind("Progress",function(t,r){r&&(i+=n(r,e))}),o.shimExec.call(this,"FileReader","readAsBase64",t.uid)},getResult:function(){return i},destroy:function(){i=null}};return e.FileReader=r}),i(K,[V,m],function(e,t){function n(e,n){switch(n){case"readAsText":return t.atob(e,"utf8");case"readAsBinaryString":return t.atob(e);case"readAsDataURL":return e}return null}var i={read:function(e,t){var i,r=this.getRuntime();return(i=r.shimExec.call(this,"FileReaderSync","readAsBase64",t.uid))?("readAsDataURL"===e&&(i="data:"+(t.type||"")+";base64,"+i),n(i,e,t.type)):null}};return e.FileReaderSync=i}),i(Z,[V,u,y,E,A,T,O,I],function(e,t,n,i,r,o,a,s){var u={send:function(e,i){function r(){e.transport=l.mode,l.shimExec.call(c,"XMLHttpRequest","send",e,i)}function s(e,t){l.shimExec.call(c,"XMLHttpRequest","appendBlob",e,t.uid),i=null,r()}function u(e,t){var n=new a;n.bind("TransportingComplete",function(){t(this.result)}),n.transport(e.getSource(),e.type,{ruid:l.uid})}var c=this,l=c.getRuntime();if(t.isEmptyObj(e.headers)||t.each(e.headers,function(e,t){l.shimExec.call(c,"XMLHttpRequest","setRequestHeader",t,e.toString())}),i instanceof o){var d;if(i.each(function(e,t){e instanceof n?d=t:l.shimExec.call(c,"XMLHttpRequest","append",t,e)}),i.hasBlob()){var f=i.getBlob();f.isDetached()?u(f,function(e){f.destroy(),s(d,e)}):s(d,f)}else i=null,r()}else i instanceof n?i.isDetached()?u(i,function(e){i.destroy(),i=e.uid,r()}):(i=i.uid,r()):r()},getResponse:function(e){var n,o,a=this.getRuntime();if(o=a.shimExec.call(this,"XMLHttpRequest","getResponseAsBlob")){if(o=new i(a.uid,o),"blob"===e)return o;if(~t.inArray(e,["","text"]))return n=new r,n.readAsText(o);if("arraybuffer"===e);else if("json"===e){n=new r;try{return s(n.readAsText(o))}catch(u){return null}}}return null},abort:function(e){var t=this.getRuntime();t.shimExec.call(this,"XMLHttpRequest","abort"),this.dispatchEvent("readystatechange"),this.dispatchEvent("abort")}};return e.XMLHttpRequest=u}),i(J,[V,y],function(e,t){var n={getAsBlob:function(e){var n=this.getRuntime(),i=n.shimExec.call(this,"Transporter","getAsBlob",e);return i?new t(n.uid,i):null}};return e.Transporter=n}),i(Q,[V,u,O,y,A],function(e,t,n,i,r){var o={loadFromBlob:function(e){function t(e){r.shimExec.call(i,"Image","loadFromBlob",e.uid),i=r=null}var i=this,r=i.getRuntime();if(e.isDetached()){var o=new n;o.bind("TransportingComplete",function(){t(o.result.getSource())}),o.transport(e.getSource(),e.type,{ruid:r.uid})}else t(e.getSource())},loadFromImage:function(e){var t=this.getRuntime();return t.shimExec.call(this,"Image","loadFromImage",e.uid)},getAsBlob:function(e,t){var n=this.getRuntime(),r=n.shimExec.call(this,"Image","getAsBlob",e,t);return r?new i(n.uid,r):null},getAsDataURL:function(){var e=this.getRuntime(),t=e.Image.getAsBlob.apply(this,arguments),n;return t?(n=new r,n.readAsDataURL(t)):null}};return e.Image=o}),i(et,[u,d,f,p,g],function(e,t,n,i,r){function o(e){var t=!1,n=null,i,r,o,a,s,u=0;try{try{n=new ActiveXObject("AgControl.AgControl"),n.IsVersionSupported(e)&&(t=!0),n=null}catch(c){var l=navigator.plugins["Silverlight Plug-In"];if(l){for(i=l.description,"1.0.30226.2"===i&&(i="2.0.30226.2"),r=i.split(".");r.length>3;)r.pop();for(;r.length<4;)r.push(0);for(o=e.split(".");o.length>4;)o.pop();do a=parseInt(o[u],10),s=parseInt(r[u],10),u++;while(u<o.length&&a===s);s>=a&&!isNaN(a)&&(t=!0)}}}catch(d){t=!1}return t}function a(a){var c=this,l;a=e.extend({xap_url:t.xap_url},a),r.call(this,a,s,{access_binary:r.capTrue,access_image_binary:r.capTrue,display_media:r.capTrue,do_cors:r.capTrue,drag_and_drop:!1,report_upload_progress:r.capTrue,resize_image:r.capTrue,return_response_headers:function(e){return e&&"client"===c.mode},return_response_type:r.capTrue,return_status_code:function(t){return"client"===c.mode||!e.arrayDiff(t,[200,404])},select_file:r.capTrue,select_multiple:r.capTrue,send_binary_string:r.capTrue,send_browser_cookies:function(e){return e&&"browser"===c.mode},send_custom_headers:function(e){return e&&"client"===c.mode},send_multipart:r.capTrue,slice_blob:r.capTrue,stream_upload:!0,summon_file_dialog:!1,upload_filesize:r.capTrue,use_http_method:function(t){return"client"===c.mode||!e.arrayDiff(t,["GET","POST"])}},{return_response_headers:function(e){return e?"client":"browser"},return_status_code:function(t){return e.arrayDiff(t,[200,404])?"client":["client","browser"]},send_browser_cookies:function(e){return e?"browser":"client"},send_custom_headers:function(e){return e?"client":"browser"},use_http_method:function(t){return e.arrayDiff(t,["GET","POST"])?"client":["client","browser"]}}),o("2.0.31005.0")&&"Opera"!==t.browser||(this.mode=!1),e.extend(this,{getShim:function(){return n.get(this.uid).content.Moxie},shimExec:function(e,t){var n=[].slice.call(arguments,2);return c.getShim().exec(this.uid,e,t,n)},init:function(){var e;e=this.getShimContainer(),e.innerHTML='<object id="'+this.uid+'" data="data:application/x-silverlight," type="application/x-silverlight-2" width="100%" height="100%" style="outline:none;">'+'<param name="source" value="'+a.xap_url+'"/>'+'<param name="background" value="Transparent"/>'+'<param name="windowless" value="true"/>'+'<param name="enablehtmlaccess" value="true"/>'+'<param name="initParams" value="uid='+this.uid+",target="+t.global_event_dispatcher+'"/>'+"</object>",l=setTimeout(function(){c&&!c.initialized&&c.trigger("Error",new i.RuntimeError(i.RuntimeError.NOT_INIT_ERR))},"Windows"!==t.OS?1e4:5e3)},destroy:function(e){return function(){e.call(c),clearTimeout(l),a=l=e=c=null}}(this.destroy)},u)}var s="silverlight",u={};return r.addConstructor(s,a),u}),i(tt,[et,u,W],function(e,t,n){return e.Blob=t.extend({},n)}),i(nt,[et],function(e){var t={init:function(e){function t(e){for(var t="",n=0;n<e.length;n++)t+=(""!==t?"|":"")+e[n].title+" | *."+e[n].extensions.replace(/,/g,";*.");return t}this.getRuntime().shimExec.call(this,"FileInput","init",t(e.accept),e.name,e.multiple),this.trigger("ready")}};return e.FileInput=t}),i(it,[et,f,M],function(e,t,n){var i={init:function(){var e=this,i=e.getRuntime(),r;return r=i.getShimContainer(),n.addEvent(r,"dragover",function(e){e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect="copy"},e.uid),n.addEvent(r,"dragenter",function(e){e.preventDefault();var n=t.get(i.uid).dragEnter(e);n&&e.stopPropagation()},e.uid),n.addEvent(r,"drop",function(e){e.preventDefault();var n=t.get(i.uid).dragDrop(e);n&&e.stopPropagation()},e.uid),i.shimExec.call(this,"FileDrop","init")}};return e.FileDrop=i}),i(rt,[et,u,$],function(e,t,n){return e.FileReader=t.extend({},n)}),i(ot,[et,u,K],function(e,t,n){return e.FileReaderSync=t.extend({},n)}),i(at,[et,u,Z],function(e,t,n){return e.XMLHttpRequest=t.extend({},n)}),i(st,[et,u,J],function(e,t,n){return e.Transporter=t.extend({},n)}),i(ut,[et,u,Q],function(e,t,n){return e.Image=t.extend({},n)}),i(ct,[u,p,g,d],function(e,t,n,i){function r(t){var r=this,s=n.capTest,u=n.capTrue;n.call(this,t,o,{access_binary:s(window.FileReader||window.File&&File.getAsDataURL),access_image_binary:!1,display_media:s(a.Image&&(i.can("create_canvas")||i.can("use_data_uri_over32kb"))),do_cors:!1,drag_and_drop:!1,filter_by_extension:s(function(){return"Chrome"===i.browser&&i.version>=28||"IE"===i.browser&&i.version>=10}()),resize_image:function(){return a.Image&&r.can("access_binary")&&i.can("create_canvas")},report_upload_progress:!1,return_response_headers:!1,return_response_type:function(t){return!!~e.inArray(t,["json","text","document",""])},return_status_code:function(t){return!e.arrayDiff(t,[200,404])},select_file:function(){return i.can("use_fileinput")},select_multiple:!1,send_binary_string:!1,send_custom_headers:!1,send_multipart:!0,slice_blob:!1,stream_upload:function(){return r.can("select_file")},summon_file_dialog:s(function(){return"Firefox"===i.browser&&i.version>=4||"Opera"===i.browser&&i.version>=12||"IE"===i.browser&&i.version>=10||!!~e.inArray(i.browser,["Chrome","Safari"])}()),upload_filesize:u,use_http_method:function(t){return!e.arrayDiff(t,["GET","POST"])}}),e.extend(this,{init:function(){this.trigger("Init")},destroy:function(e){return function(){e.call(r),e=r=null}}(this.destroy)}),e.extend(this.getShim(),a)}var o="html4",a={};return n.addConstructor(o,r),a}),i(lt,[ct,u,f,M,l,d],function(e,t,n,i,r,o){function a(){function e(){var r=this,l=r.getRuntime(),d,f,p,h,m,g;g=t.guid("uid_"),d=l.getShimContainer(),a&&(p=n.get(a+"_form"),p&&t.extend(p.style,{top:"100%"})),h=document.createElement("form"),h.setAttribute("id",g+"_form"),h.setAttribute("method","post"),h.setAttribute("enctype","multipart/form-data"),h.setAttribute("encoding","multipart/form-data"),t.extend(h.style,{overflow:"hidden",position:"absolute",top:0,left:0,width:"100%",height:"100%"}),m=document.createElement("input"),m.setAttribute("id",g),m.setAttribute("type","file"),m.setAttribute("name","Filedata"),m.setAttribute("accept",u.join(",")),t.extend(m.style,{fontSize:"999px",opacity:0}),h.appendChild(m),d.appendChild(h),t.extend(m.style,{position:"absolute",top:0,left:0,width:"100%",height:"100%"}),"IE"===o.browser&&o.version<10&&t.extend(m.style,{filter:"progid:DXImageTransform.Microsoft.Alpha(opacity=0)"}),m.onchange=function(){var t;this.value&&(t=this.files?this.files[0]:{name:this.value},s=[t],this.onchange=function(){},e.call(r),r.bind("change",function(){var e=n.get(g),t=n.get(g+"_form"),i;r.files.length&&e&&t&&(i=r.files[0],e.setAttribute("id",i.uid),t.setAttribute("id",i.uid+"_form"),t.setAttribute("target",i.uid+"_iframe")),e=t=null},998),m=h=null,r.trigger("change"))},l.can("summon_file_dialog")&&(f=n.get(c.browse_button),i.removeEvent(f,"click",r.uid),i.addEvent(f,"click",function(e){m&&!m.disabled&&m.click(),e.preventDefault()},r.uid)),a=g,d=p=f=null,r.trigger({type:"ready",async:!0})}var a,s=[],u=[],c;t.extend(this,{init:function(t){var o=this,a=o.getRuntime(),s;c=t,u=t.accept.mimes||r.extList2mimes(t.accept,a.can("filter_by_extension")),s=a.getShimContainer(),function(){var e,r,u;e=n.get(t.browse_button),a.can("summon_file_dialog")&&("static"===n.getStyle(e,"position")&&(e.style.position="relative"),r=parseInt(n.getStyle(e,"z-index"),10)||1,e.style.zIndex=r,s.style.zIndex=r-1),u=a.can("summon_file_dialog")?e:s,i.addEvent(u,"mouseover",function(){o.trigger("mouseenter")},o.uid),i.addEvent(u,"mouseout",function(){o.trigger("mouseleave")},o.uid),i.addEvent(u,"mousedown",function(){o.trigger("mousedown")},o.uid),i.addEvent(n.get(t.container),"mouseup",function(){o.trigger("mouseup")},o.uid),e=null}(),e.call(this),s=null},getFiles:function(){return s},disable:function(e){var t;(t=n.get(a))&&(t.disabled=!!e)},destroy:function(){var e=this.getRuntime(),t=e.getShimContainer();i.removeAllEvents(t,this.uid),i.removeAllEvents(c&&n.get(c.container),this.uid),i.removeAllEvents(c&&n.get(c.browse_button),this.uid),t&&(t.innerHTML=""),a=s=u=c=null}})}return e.FileInput=a}),i(dt,[ct,P],function(e,t){return e.FileReader=t}),i(ft,[ct,u,f,b,p,M,y,T,I],function(e,t,n,i,r,o,a,s,u){function c(){function e(e){var t=this,i,r,a,s,u=!1;if(d){if(i=d.id.replace(/_iframe$/,""),r=n.get(i+"_form")){for(a=r.getElementsByTagName("input"),s=a.length;s--;)switch(a[s].getAttribute("type")){case"hidden":a[s].parentNode.removeChild(a[s]);break;case"file":u=!0}a=[],u||r.parentNode.removeChild(r),r=null}setTimeout(function(){o.removeEvent(d,"load",t.uid),d.parentNode&&d.parentNode.removeChild(d);var n=t.getRuntime().getShimContainer();n.children.length||n.parentNode.removeChild(n),n=d=null,e()},1)}}var c,l,d;t.extend(this,{send:function(u,f){function p(){var n=m.getShimContainer()||document.body,r=document.createElement("div");r.innerHTML='<iframe id="'+g+'_iframe" name="'+g+'_iframe" src="javascript:""" style="display:none"></iframe>',d=r.firstChild,n.appendChild(d),o.addEvent(d,"load",function(){var n;try{n=d.contentWindow.document||d.contentDocument||window.frames[d.id].document,/^4\d{2}\s/.test(n.title)&&n.getElementsByTagName("address").length?c=n.title.replace(/^(\d+).*$/,"$1"):(c=200,l=t.trim(n.body.innerHTML),h.trigger({type:"progress",loaded:l.length,total:l.length}),E&&h.trigger({type:"uploadprogress",loaded:E.size||1025,total:E.size||1025}))}catch(r){if(!i.hasSameOrigin(u.url))return e.call(h,function(){h.trigger("error")}),void 0;c=404}e.call(h,function(){h.trigger("load")})},h.uid)}var h=this,m=h.getRuntime(),g,v,y,E;if(c=l=null,f instanceof s&&f.hasBlob()){if(E=f.getBlob(),g=E.uid,y=n.get(g),v=n.get(g+"_form"),!v)throw new r.DOMException(r.DOMException.NOT_FOUND_ERR)}else g=t.guid("uid_"),v=document.createElement("form"),v.setAttribute("id",g+"_form"),v.setAttribute("method",u.method),v.setAttribute("enctype","multipart/form-data"),v.setAttribute("encoding","multipart/form-data"),v.setAttribute("target",g+"_iframe"),m.getShimContainer().appendChild(v);f instanceof s&&f.each(function(e,n){if(e instanceof a)y&&y.setAttribute("name",n);else{var i=document.createElement("input");t.extend(i,{type:"hidden",name:n,value:e}),v.appendChild(i)}}),v.setAttribute("action",u.url),p(),v.submit(),h.trigger("loadstart")},getStatus:function(){return c},getResponse:function(e){if("json"===e&&"string"===t.typeOf(l))try{return u(l.replace(/^\s*<pre[^>]*>/,"").replace(/<\/pre>\s*$/,""))}catch(n){return null}return l},abort:function(){var t=this;d&&d.contentWindow&&(d.contentWindow.stop?d.contentWindow.stop():d.contentWindow.document.execCommand?d.contentWindow.document.execCommand("Stop"):d.src="about:blank"),e.call(this,function(){t.dispatchEvent("abort")})}})}return e.XMLHttpRequest=c}),i(pt,[ct,j],function(e,t){return e.Image=t}),a([u,c,l,d,f,p,h,m,g,v,y,E,_,R,w,x,b,A,T,S,O,I,D,M])}(this);;(function(){"use strict";var e={},t=moxie.core.utils.Basic.inArray;return function n(r){var i,s;for(i in r)s=typeof r[i],s==="object"&&!~t(i,["Exceptions","Env","Mime"])?n(r[i]):s==="function"&&(e[i]=r[i])}(window.moxie),e.Env=window.moxie.core.utils.Env,e.Mime=window.moxie.core.utils.Mime,e.Exceptions=window.moxie.core.Exceptions,window.mOxie=e,window.o||(window.o=e),e})(); +/** + * Plupload - multi-runtime File Uploader + * v2.0.0beta + * + * Copyright 2013, Moxiecode Systems AB + * Released under GPL License. + * + * License: http://www.plupload.com/license + * Contributing: http://www.plupload.com/contributing + * + * Date: 2012-11-30 + */ +;(function(e,t,n){function s(e){function r(e,t,r){var i={chunks:"slice_blob",resize:"send_binary_string",jpgresize:"send_binary_string",pngresize:"send_binary_string",progress:"report_upload_progress",multi_selection:"select_multiple",max_file_size:"access_binary",dragdrop:"drag_and_drop",drop_element:"drag_and_drop",headers:"send_custom_headers",canSendBinary:"send_binary",triggerDialog:"summon_file_dialog"};i[e]?n[i[e]]=t:r||(n[e]=t)}var t=e.required_features,n={};return typeof t=="string"?o.each(t.split(/\s*,\s*/),function(e){r(e,!0)}):typeof t=="object"?o.each(t,function(e,t){r(t,e)}):t===!0&&(e.multipart||(n.send_binary_string=!0),e.chunk_size>0&&(n.slice_blob=!0),o.each(e,function(e,t){r(t,!!e,!0)})),n}var r=e.setTimeout,i={},o={VERSION:"2.0.0beta",STOPPED:1,STARTED:2,QUEUED:1,UPLOADING:2,FAILED:4,DONE:5,GENERIC_ERROR:-100,HTTP_ERROR:-200,IO_ERROR:-300,SECURITY_ERROR:-400,INIT_ERROR:-500,FILE_SIZE_ERROR:-600,FILE_EXTENSION_ERROR:-601,FILE_DUPLICATE_ERROR:-602,IMAGE_FORMAT_ERROR:-700,IMAGE_MEMORY_ERROR:-701,IMAGE_DIMENSIONS_ERROR:-702,mimeTypes:t.mimes,ua:t.ua,typeOf:t.typeOf,extend:t.extend,guid:t.guid,each:t.each,getPos:t.getPos,getSize:t.getSize,xmlEncode:function(e){var t={"<":"lt",">":"gt","&":"amp",'"':"quot","'":"#39"},n=/[<>&\"\']/g;return e?(""+e).replace(n,function(e){return t[e]?"&"+t[e]+";":e}):e},toArray:t.toArray,inArray:t.inArray,addI18n:t.addI18n,translate:t.translate,isEmptyObj:t.isEmptyObj,hasClass:t.hasClass,addClass:t.addClass,removeClass:t.removeClass,getStyle:t.getStyle,addEvent:t.addEvent,removeEvent:t.removeEvent,removeAllEvents:t.removeAllEvents,cleanName:function(e){var t,n;n=[/[\300-\306]/g,"A",/[\340-\346]/g,"a",/\307/g,"C",/\347/g,"c",/[\310-\313]/g,"E",/[\350-\353]/g,"e",/[\314-\317]/g,"I",/[\354-\357]/g,"i",/\321/g,"N",/\361/g,"n",/[\322-\330]/g,"O",/[\362-\370]/g,"o",/[\331-\334]/g,"U",/[\371-\374]/g,"u"];for(t=0;t<n.length;t+=2)e=e.replace(n[t],n[t+1]);return e=e.replace(/\s+/g,"_"),e=e.replace(/[^a-z0-9_\-\.]+/gi,""),e},buildUrl:function(e,t){var n="";return o.each(t,function(e,t){n+=(n?"&":"")+encodeURIComponent(t)+"="+encodeURIComponent(e)}),n&&(e+=(e.indexOf("?")>0?"&":"?")+n),e},formatSize:function(e){return e===n||/\D/.test(e)?o.translate("N/A"):e>1099511627776?Math.round(e/1099511627776,1)+" "+o.translate("tb"):e>1073741824?Math.round(e/1073741824,1)+" "+o.translate("gb"):e>1048576?Math.round(e/1048576,1)+" "+o.translate("mb"):e>1024?Math.round(e/1024,1)+" "+o.translate("kb"):e+" "+o.translate("b")},parseSize:t.parseSizeStr,predictRuntime:function(e,t){var n,r;return t&&(e.runtimes=t),n=new o.Uploader(e),r=n.runtime,n.destroy(),r},addFileFilter:function(e,t){i[e]=t}};o.addFileFilter("mime_types",function(){function n(e){var t=[];return o.each(e,function(e){o.each(e.extensions.split(/,/),function(e){/^\s*\*\s*$/.test(e)?t.push("\\.*"):t.push("\\."+e.replace(new RegExp("["+"/^$.*+?|()[]{}\\".replace(/./g,"\\$&")+"]","g"),"\\$&"))})}),new RegExp("("+t.join("|")+")$","i")}var e,t;return function(r,i,s){if(!t||r!=e)t=n(r),e=[].slice.call(r);t.test(i.name)?s(!0):(this.trigger("Error",{code:o.FILE_EXTENSION_ERROR,message:o.translate("File extension error."),file:i}),s(!1))}}()),o.addFileFilter("max_file_size",function(e,t,n){var r;t.size!==r&&e&&t.size>e?(this.trigger("Error",{code:o.FILE_SIZE_ERROR,message:o.translate("File size error."),file:t}),n(!1)):n(!0)}),o.addFileFilter("prevent_duplicates",function(e,t,n){if(e){var r=this.files.length;while(r--)if(t.name===this.files[r].name&&t.size===this.files[r].size){this.trigger("Error",{code:o.FILE_DUPLICATE_ERROR,message:o.translate("Duplicate file error."),file:t}),n(!1);return}}n(!0)}),o.Uploader=function(e){function m(){var e,t=0,n;if(this.state==o.STARTED){for(n=0;n<u.length;n++)!e&&u[n].status==o.QUEUED?(e=u[n],this.trigger("BeforeUpload",e)&&(e.status=o.UPLOADING,this.trigger("UploadFile",e))):t++;t==u.length&&(this.state!==o.STOPPED&&(this.state=o.STOPPED,this.trigger("StateChanged")),this.trigger("UploadComplete",u))}}function g(e){e.percent=e.size>0?Math.ceil(e.loaded/e.size*100):100,y()}function y(){var e,t;c.reset();for(e=0;e<u.length;e++)t=u[e],t.size!==n?(c.size+=t.origSize,c.loaded+=t.loaded*t.origSize/t.size):c.size=n,t.status==o.DONE?c.uploaded++:t.status==o.FAILED?c.failed++:c.queued++;c.size===n?c.percent=u.length>0?Math.ceil(c.uploaded/u.length*100):0:(c.bytesPerSec=Math.ceil(c.loaded/((+(new Date)-l||1)/1e3)),c.percent=c.size>0?Math.ceil(c.loaded/c.size*100):0)}function b(){var n=this,r=0,i={accept:e.filters.mime_types,runtime_order:e.runtimes,required_caps:f,swf_url:e.flash_swf_url,xap_url:e.silverlight_xap_url};o.each(e.runtimes.split(/\s*,\s*/),function(t){e[t]&&(i[t]=e[t])}),t.inSeries([function(s){e.browse_button?(p=new t.FileInput(o.extend({},i,{name:e.file_data_name,multiple:e.multi_selection,container:e.container,browse_button:e.browse_button})),p.onready=function(){var e=t.Runtime.getInfo(this.ruid);t.extend(n.features,{chunks:e.can("slice_blob"),multipart:e.can("send_multipart"),multi_selection:e.can("select_multiple")}),r++,s()},p.onchange=function(){n.addFile(this.files)},p.bind("mouseenter mouseleave mousedown mouseup",function(n){if(!h){var r=t.get(e.browse_button);r&&(e.browse_button_hover&&("mouseenter"===n.type?t.addClass(r,e.browse_button_hover):"mouseleave"===n.type&&t.removeClass(r,e.browse_button_hover)),e.browse_button_active&&("mousedown"===n.type?t.addClass(r,e.browse_button_active):"mouseup"===n.type&&t.removeClass(r,e.browse_button_active)),r=null)}}),p.bind("error runtimeerror",function(){p=null,s()}),p.init()):s()},function(s){e.drop_element?(d=new t.FileDrop(o.extend({},i,{drop_zone:e.drop_element})),d.onready=function(){var e=t.Runtime.getInfo(this.ruid);n.features.dragdrop=e.can("drag_and_drop"),r++,s()},d.ondrop=function(){n.addFile(this.files)},d.bind("error runtimeerror",function(){d=null,s()}),d.init()):s()}],function(){typeof e.init=="function"?e.init(n):o.each(e.init,function(e,t){n.bind(t,e)}),r?n.trigger("PostInit"):n.trigger("Error",{code:o.INIT_ERROR,message:o.translate("Init error.")})})}function w(e,n){if(e.ruid){var r=t.Runtime.getInfo(e.ruid);if(r)return r.can(n)}return!1}function E(e,n,r){var i=new t.Image;try{i.onload=function(){i.downsize(n.width,n.height,n.crop,n.preserve_headers)},i.onresize=function(){r(this.getAsBlob(e.type,n.quality)),this.destroy()},i.onerror=function(){r(e)},i.load(e)}catch(s){r(e)}}var u=[],a={},f={},l,c,h=!1,p,d,v;c=new o.QueueProgress,e=o.extend({runtimes:t.Runtime.order,max_retries:0,multipart:!0,multi_selection:!0,file_data_name:"file",flash_swf_url:"js/Moxie.swf",silverlight_xap_url:"js/Moxie.xap",send_chunk_number:!0},e),e.resize&&(e.resize=o.extend({preserve_headers:!0,crop:!1},e.resize)),o.typeOf(e.filters)==="array"&&(e.filters={mime_types:e.filters}),e.filters=o.extend({mime_types:[],prevent_duplicates:!!e.prevent_duplicates,max_file_size:e.max_file_size},e.filters),e.filters.max_file_size=o.parseSize(e.filters.max_file_size)||0,e.chunk_size=o.parseSize(e.chunk_size)||0,e.required_features=f=s(o.extend({},e)),o.extend(this,{id:o.guid(),state:o.STOPPED,features:{},runtime:t.Runtime.thatCan(f,e.runtimes),files:u,settings:e,total:c,init:function(){var n=this;e.browse_button=t.get(e.browse_button),e.drop_element=t.get(e.drop_element),typeof e.preinit=="function"?e.preinit(n):o.each(e.preinit,function(e,t){n.bind(t,e)});if(!e.browse_button||!e.url){this.trigger("Error",{code:o.INIT_ERROR,message:o.translate("Init error.")});return}n.bind("FilesAdded",function(e,t){[].push.apply(u,t),r(function(){n.trigger("QueueChanged"),n.refresh()},1)}),n.bind("CancelUpload",function(){v&&v.abort()}),e.unique_names&&n.bind("BeforeUpload",function(e,t){var n=t.name.match(/\.([^.]+)$/),r="part";n&&(r=n[1]),t.target_name=t.id+"."+r}),n.bind("UploadFile",function(n,i){function p(){l-->0?r(d,1):(i.loaded=h,n.trigger("Error",{code:o.HTTP_ERROR,message:o.translate("HTTP Error."),file:i,response:v.responseText,status:v.status,responseHeaders:v.getAllResponseHeaders()}))}function d(){var l,m,g,y;if(i.status==o.DONE||i.status==o.FAILED||n.state==o.STOPPED)return;g={name:i.target_name||i.name},a&&u.chunks&&c.size>a?(y=Math.min(a,c.size-h),l=c.slice(h,h+y)):(y=c.size,l=c),a&&u.chunks&&(e.send_chunk_number?(g.chunk=Math.ceil(h/a),g.chunks=Math.ceil(c.size/a)):(g.offset=h,g.total=c.size)),v=new t.XMLHttpRequest,v.upload&&(v.upload.onprogress=function(e){i.loaded=Math.min(i.size,h+e.loaded),n.trigger("UploadProgress",i)}),v.onload=function(){if(v.status>=400){p();return}y<c.size?(l.destroy(),h+=y,i.loaded=Math.min(h,c.size),n.trigger("ChunkUploaded",i,{offset:i.loaded,total:c.size,response:v.responseText,status:v.status,responseHeaders:v.getAllResponseHeaders()}),t.Env.browser==="Android Browser"&&n.trigger("UploadProgress",i)):i.loaded=i.size,l=m=null,!h||h>=c.size?(i.size!=i.origSize&&(c.destroy(),c=null),n.trigger("UploadProgress",i),i.status=o.DONE,n.trigger("FileUploaded",i,{response:v.responseText,status:v.status,responseHeaders:v.getAllResponseHeaders()})):r(d,1)},v.onerror=function(){p()},v.onloadend=function(){this.destroy(),v=null},n.settings.multipart&&u.multipart?(g.name=i.target_name||i.name,v.open("post",s,!0),o.each(n.settings.headers,function(e,t){v.setRequestHeader(t,e)}),m=new t.FormData,o.each(o.extend(g,n.settings.multipart_params),function(e,t){m.append(t,e)}),m.append(n.settings.file_data_name,l),v.send(m,{runtime_order:n.settings.runtimes,required_caps:f,swf_url:n.settings.flash_swf_url,xap_url:n.settings.silverlight_xap_url})):(s=o.buildUrl(n.settings.url,o.extend(g,n.settings.multipart_params)),v.open("post",s,!0),v.setRequestHeader("Content-Type","application/octet-stream"),o.each(n.settings.headers,function(e,t){v.setRequestHeader(t,e)}),v.send(l,{runtime_order:n.settings.runtimes,required_caps:f,swf_url:n.settings.flash_swf_url,xap_url:n.settings.silverlight_xap_url}))}var s=n.settings.url,u=n.features,a=e.chunk_size,l=e.max_retries,c,h=0;i.loaded&&(h=i.loaded=a*Math.floor(i.loaded/a)),c=i.getSource(),!t.isEmptyObj(n.settings.resize)&&w(c,"send_binary_string")&&!!~t.inArray(c.type,["image/jpeg","image/png"])?E.call(this,c,n.settings.resize,function(e){c=e,i.size=e.size,d()}):d()}),n.bind("UploadProgress",function(e,t){g(t)}),n.bind("StateChanged",function(e){if(e.state==o.STARTED)l=+(new Date);else if(e.state==o.STOPPED)for(var t=e.files.length-1;t>=0;t--)e.files[t].status==o.UPLOADING&&(e.files[t].status=o.QUEUED,y())}),n.bind("QueueChanged",y),n.bind("Error",function(e,t){t.file&&(t.file.status=o.FAILED,g(t.file),e.state==o.STARTED&&r(function(){m.call(n)},1))}),n.bind("FileUploaded",function(){y(),r(function(){m.call(n)},1)}),n.trigger("Init",{runtime:this.runtime}),b.call(this)},refresh:function(){p&&p.trigger("Refresh"),this.trigger("Refresh")},start:function(){this.state!=o.STARTED&&(this.state=o.STARTED,this.trigger("StateChanged"),m.call(this))},stop:function(){this.state!=o.STOPPED&&(this.state=o.STOPPED,this.trigger("StateChanged"),this.trigger("CancelUpload"))},disableBrowse:function(){h=arguments[0]!==n?arguments[0]:!0,p&&p.disable(h),this.trigger("DisableBrowse",h)},getFile:function(e){var t;for(t=u.length-1;t>=0;t--)if(u[t].id===e)return u[t]},addFile:function(e,n){function f(){var e=d||p;return e?e.getRuntime().uid:!1}function l(e,n){var s=[];t.each(r.settings.filters,function(t,n){i[n]&&s.push(function(s){i[n].call(r,t,e,function(e){s(!e)})})}),t.inSeries(s,n)}function c(e){var r=t.typeOf(e);if(e instanceof t.File){if(!e.ruid&&!e.isDetached()){if(!a)return!1;e.ruid=a,e.connectRuntime(a)}c(new o.File(e))}else e instanceof t.Blob?(c(e.getSource()),e.destroy()):e instanceof o.File?(n&&(e.name=n),s.push(function(t){l(e,function(n){n||u.push(e),t()})})):t.inArray(r,["file","blob"])!==-1?c(new t.File(null,e)):r==="node"&&t.typeOf(e.files)==="filelist"?t.each(e.files,c):r==="array"&&(n=null,t.each(e,c))}var r=this,s=[],u=[],a;a=f(),c(e),s.length&&t.inSeries(s,function(){u.length&&r.trigger("FilesAdded",u)})},removeFile:function(e){var t=typeof e=="string"?e:e.id;for(var n=u.length-1;n>=0;n--)if(u[n].id===t)return this.splice(n,1)[0]},splice:function(e,t){var r=u.splice(e===n?0:e,t===n?u.length:t);return this.trigger("FilesRemoved",r),this.trigger("QueueChanged"),o.each(r,function(e){e.destroy()}),r},trigger:function(e){var t=a[e.toLowerCase()],n,r;if(t){r=Array.prototype.slice.call(arguments),r[0]=this;for(n=0;n<t.length;n++)if(t[n].func.apply(t[n].scope,r)===!1)return!1}return!0},hasEventListener:function(e){return!!a[e.toLowerCase()]},bind:function(e,t,n){var r;e=e.toLowerCase(),r=a[e]||[],r.push({func:t,scope:n||this}),a[e]=r},unbind:function(e){e=e.toLowerCase();var t=a[e],r,i=arguments[1];if(t){if(i!==n){for(r=t.length-1;r>=0;r--)if(t[r].func===i){t.splice(r,1);break}}else t=[];t.length||delete a[e]}},unbindAll:function(){var e=this;o.each(a,function(t,n){e.unbind(n)})},destroy:function(){this.stop(),o.each(u,function(e){e.destroy()}),u=[],p&&(p.destroy(),p=null),d&&(d.destroy(),d=null),f={},l=c=h=v=null,this.trigger("Destroy"),this.unbindAll(),a={}}})},o.File=function(){function n(n){o.extend(this,{id:o.guid(),name:n.name||n.fileName,type:n.type||"",size:n.size||n.fileSize,origSize:n.size||n.fileSize,loaded:0,percent:0,status:o.QUEUED,lastModifiedDate:n.lastModifiedDate||(new Date).toLocaleString(),getNative:function(){var e=this.getSource().getSource();return t.inArray(t.typeOf(e),["blob","file"])!==-1?e:null},getSource:function(){return e[this.id]?e[this.id]:null},destroy:function(){var t=this.getSource();t&&(t.destroy(),delete e[this.id])}}),e[this.id]=n}var e={};return n}(),o.QueueProgress=function(){var e=this;e.size=0,e.loaded=0,e.uploaded=0,e.failed=0,e.queued=0,e.percent=0,e.bytesPerSec=0,e.reset=function(){e.size=e.loaded=e.uploaded=e.failed=e.queued=e.percent=e.bytesPerSec=0}},e.plupload=o})(window,mOxie);
\ No newline at end of file diff --git a/phpBB/assets/plupload/plupload.html5.js b/phpBB/assets/plupload/plupload.html5.js deleted file mode 100644 index a4b2a1fc0a..0000000000 --- a/phpBB/assets/plupload/plupload.html5.js +++ /dev/null @@ -1 +0,0 @@ -(function(k,m,l,g){var d={},j;function c(s){var r=s.naturalWidth,u=s.naturalHeight;if(r*u>1024*1024){var t=m.createElement("canvas");t.width=t.height=1;var q=t.getContext("2d");q.drawImage(s,-r+1,0);return q.getImageData(0,0,1,1).data[3]===0}else{return false}}function f(u,r,z){var q=m.createElement("canvas");q.width=1;q.height=z;var A=q.getContext("2d");A.drawImage(u,0,0);var t=A.getImageData(0,0,1,z).data;var x=0;var v=z;var y=z;while(y>x){var s=t[(y-1)*4+3];if(s===0){v=y}else{x=y}y=(v+x)>>1}var w=(y/z);return(w===0)?1:w}function o(K,s,t){var v=K.naturalWidth,z=K.naturalHeight;var E=t.width,B=t.height;var F=s.getContext("2d");F.save();var r=c(K);if(r){v/=2;z/=2}var I=1024;var q=m.createElement("canvas");q.width=q.height=I;var u=q.getContext("2d");var G=f(K,v,z);var A=0;while(A<z){var J=A+I>z?z-A:I;var C=0;while(C<v){var D=C+I>v?v-C:I;u.clearRect(0,0,I,I);u.drawImage(K,-C,-A);var x=(C*E/v)<<0;var y=Math.ceil(D*E/v);var w=(A*B/z/G)<<0;var H=Math.ceil(J*B/z/G);F.drawImage(q,0,0,D,J,x,w,y,H);C+=I}A+=I}F.restore();q=u=null}function p(r,s){var q;if("FileReader" in k){q=new FileReader();q.readAsDataURL(r);q.onload=function(){s(q.result)}}else{return s(r.getAsDataURL())}}function n(r,s){var q;if("FileReader" in k){q=new FileReader();q.readAsBinaryString(r);q.onload=function(){s(q.result)}}else{return s(r.getAsBinary())}}function e(u,s,q,y){var t,r,x,v,w=this;p(d[u.id],function(z){t=m.createElement("canvas");t.style.display="none";m.body.appendChild(t);x=new Image();x.onerror=x.onabort=function(){y({success:false})};x.onload=function(){var F,A,C,B,E;if(!s.width){s.width=x.width}if(!s.height){s.height=x.height}v=Math.min(s.width/x.width,s.height/x.height);if(v<1){F=Math.round(x.width*v);A=Math.round(x.height*v)}else{if(s.quality&&q==="image/jpeg"){F=x.width;A=x.height}else{y({success:false});return}}t.width=F;t.height=A;o(x,t,{width:F,height:A});if(q==="image/jpeg"){B=new h(atob(z.substring(z.indexOf("base64,")+7)));if(B.headers&&B.headers.length){E=new a();if(E.init(B.get("exif")[0])){E.setExif("PixelXDimension",F);E.setExif("PixelYDimension",A);B.set("exif",E.getBinary());if(w.hasEventListener("ExifData")){w.trigger("ExifData",u,E.EXIF())}if(w.hasEventListener("GpsData")){w.trigger("GpsData",u,E.GPS())}}}}if(s.quality&&q==="image/jpeg"){try{z=t.toDataURL(q,s.quality/100)}catch(D){z=t.toDataURL(q)}}else{z=t.toDataURL(q)}z=z.substring(z.indexOf("base64,")+7);z=atob(z);if(B&&B.headers&&B.headers.length){z=B.restore(z);B.purge()}t.parentNode.removeChild(t);y({success:true,data:z})};x.src=z})}l.runtimes.Html5=l.addRuntime("html5",{getFeatures:function(){var v,r,u,t,s,q;r=u=s=q=false;if(k.XMLHttpRequest){v=new XMLHttpRequest();u=!!v.upload;r=!!(v.sendAsBinary||v.upload)}if(r){t=!!(v.sendAsBinary||(k.Uint8Array&&k.ArrayBuffer));s=!!(File&&(File.prototype.getAsDataURL||k.FileReader)&&t);q=!!(File&&(File.prototype.mozSlice||File.prototype.webkitSlice||File.prototype.slice))}j=l.ua.safari&&l.ua.windows;return{html5:r,dragdrop:(function(){var w=m.createElement("div");return("draggable" in w)||("ondragstart" in w&&"ondrop" in w)}()),jpgresize:s,pngresize:s,multipart:s||!!k.FileReader||!!k.FormData,canSendBinary:t,cantSendBlobInFormData:!!(l.ua.gecko&&k.FormData&&k.FileReader&&!FileReader.prototype.readAsArrayBuffer)||l.ua.android,progress:u,chunks:q,multi_selection:!(l.ua.safari&&l.ua.windows),triggerDialog:(l.ua.gecko&&k.FormData||l.ua.webkit)}},init:function(s,u){var q,t;function r(z){var x,w,y=[],A,v={};for(w=0;w<z.length;w++){x=z[w];if(v[x.name]&&l.ua.safari&&l.ua.windows){continue}v[x.name]=true;A=l.guid();d[A]=x;y.push(new l.File(A,x.fileName||x.name,x.fileSize||x.size))}if(y.length){s.trigger("FilesAdded",y)}}q=this.getFeatures();if(!q.html5){u({success:false});return}s.bind("Init",function(A){var J,I,F=[],z,G,w=A.settings.filters,x,E,v=m.body,H;J=m.createElement("div");J.id=A.id+"_html5_container";l.extend(J.style,{position:"absolute",background:s.settings.shim_bgcolor||"transparent",width:"100px",height:"100px",overflow:"hidden",zIndex:99999,opacity:s.settings.shim_bgcolor?"":0});J.className="plupload html5";if(s.settings.container){v=m.getElementById(s.settings.container);if(l.getStyle(v,"position")==="static"){v.style.position="relative"}}v.appendChild(J);no_type_restriction:for(z=0;z<w.length;z++){x=w[z].extensions.split(/,/);for(G=0;G<x.length;G++){if(x[G]==="*"){F=[];break no_type_restriction}E=l.mimeTypes[x[G]];if(E&&l.inArray(E,F)===-1){F.push(E)}}}J.innerHTML='<input id="'+s.id+'_html5" style="font-size:999px" type="file" accept="'+F.join(",")+'" '+(s.settings.multi_selection&&s.features.multi_selection?'multiple="multiple"':"")+" />";J.scrollTop=100;H=m.getElementById(s.id+"_html5");if(A.features.triggerDialog){l.extend(H.style,{position:"absolute",width:"100%",height:"100%"})}else{l.extend(H.style,{cssFloat:"right",styleFloat:"right"})}H.onchange=function(){r(this.files);this.value=""};I=m.getElementById(A.settings.browse_button);if(I){var C=A.settings.browse_button_hover,D=A.settings.browse_button_active,B=A.features.triggerDialog?I:J;if(C){l.addEvent(B,"mouseover",function(){l.addClass(I,C)},A.id);l.addEvent(B,"mouseout",function(){l.removeClass(I,C)},A.id)}if(D){l.addEvent(B,"mousedown",function(){l.addClass(I,D)},A.id);l.addEvent(m.body,"mouseup",function(){l.removeClass(I,D)},A.id)}if(A.features.triggerDialog){l.addEvent(I,"click",function(K){var y=m.getElementById(A.id+"_html5");if(y&&!y.disabled){y.click()}K.preventDefault()},A.id)}}});s.bind("PostInit",function(){var v=m.getElementById(s.settings.drop_element);if(v){if(j){l.addEvent(v,"dragenter",function(z){var y,w,x;y=m.getElementById(s.id+"_drop");if(!y){y=m.createElement("input");y.setAttribute("type","file");y.setAttribute("id",s.id+"_drop");y.setAttribute("multiple","multiple");l.addEvent(y,"change",function(){r(this.files);l.removeEvent(y,"change",s.id);y.parentNode.removeChild(y)},s.id);l.addEvent(y,"dragover",function(A){A.stopPropagation()},s.id);v.appendChild(y)}w=l.getPos(v,m.getElementById(s.settings.container));x=l.getSize(v);if(l.getStyle(v,"position")==="static"){l.extend(v.style,{position:"relative"})}l.extend(y.style,{position:"absolute",display:"block",top:0,left:0,width:x.w+"px",height:x.h+"px",opacity:0})},s.id);return}l.addEvent(v,"dragover",function(w){w.preventDefault()},s.id);l.addEvent(v,"drop",function(x){var w=x.dataTransfer;if(w&&w.files){r(w.files)}x.preventDefault()},s.id)}});s.bind("Refresh",function(v){var w,x,y,A,z;w=m.getElementById(s.settings.browse_button);if(w){x=l.getPos(w,m.getElementById(v.settings.container));y=l.getSize(w);A=m.getElementById(s.id+"_html5_container");l.extend(A.style,{top:x.y+"px",left:x.x+"px",width:y.w+"px",height:y.h+"px"});if(s.features.triggerDialog){if(l.getStyle(w,"position")==="static"){l.extend(w.style,{position:"relative"})}z=parseInt(l.getStyle(w,"zIndex"),10);if(isNaN(z)){z=0}l.extend(w.style,{zIndex:z});l.extend(A.style,{zIndex:z-1})}}});s.bind("DisableBrowse",function(v,x){var w=m.getElementById(v.id+"_html5");if(w){w.disabled=x}});s.bind("CancelUpload",function(){if(t&&t.abort){t.abort()}});s.bind("UploadFile",function(v,x){var y=v.settings,B,w;function A(D,G,C){var E;if(File.prototype.slice){try{D.slice();return D.slice(G,C)}catch(F){return D.slice(G,C-G)}}else{if(E=File.prototype.webkitSlice||File.prototype.mozSlice){return E.call(D,G,C)}else{return null}}}function z(C){var F=0,E=0;function D(){var L,P,N,O,K,M,H,G=v.settings.url;function J(S){if(t.sendAsBinary){t.sendAsBinary(S)}else{if(v.features.canSendBinary){var Q=new Uint8Array(S.length);for(var R=0;R<S.length;R++){Q[R]=(S.charCodeAt(R)&255)}t.send(Q.buffer)}}}function I(R){var V=0,W="----pluploadboundary"+l.guid(),T,S="--",U="\r\n",Q="";t=new XMLHttpRequest;if(t.upload){t.upload.onprogress=function(X){x.loaded=Math.min(x.size,E+X.loaded-V);v.trigger("UploadProgress",x)}}t.onreadystatechange=function(){var X,Z;if(t.readyState==4&&v.state!==l.STOPPED){try{X=t.status}catch(Y){X=0}if(X>=400){v.trigger("Error",{code:l.HTTP_ERROR,message:l.translate("HTTP Error."),file:x,status:X})}else{if(N){Z={chunk:F,chunks:N,response:t.responseText,status:X};v.trigger("ChunkUploaded",x,Z);E+=M;if(Z.cancelled){x.status=l.FAILED;return}x.loaded=Math.min(x.size,(F+1)*K)}else{x.loaded=x.size}v.trigger("UploadProgress",x);R=L=T=Q=null;if(!N||++F>=N){x.status=l.DONE;v.trigger("FileUploaded",x,{response:t.responseText,status:X})}else{D()}}}};if(v.settings.multipart&&q.multipart){O.name=x.target_name||x.name;t.open("post",G,true);l.each(v.settings.headers,function(Y,X){t.setRequestHeader(X,Y)});if(typeof(R)!=="string"&&!!k.FormData){T=new FormData();l.each(l.extend(O,v.settings.multipart_params),function(Y,X){T.append(X,Y)});T.append(v.settings.file_data_name,R);t.send(T);return}if(typeof(R)==="string"){t.setRequestHeader("Content-Type","multipart/form-data; boundary="+W);l.each(l.extend(O,v.settings.multipart_params),function(Y,X){Q+=S+W+U+'Content-Disposition: form-data; name="'+X+'"'+U+U;Q+=unescape(encodeURIComponent(Y))+U});H=l.mimeTypes[x.name.replace(/^.+\.([^.]+)/,"$1").toLowerCase()]||"application/octet-stream";Q+=S+W+U+'Content-Disposition: form-data; name="'+v.settings.file_data_name+'"; filename="'+unescape(encodeURIComponent(x.name))+'"'+U+"Content-Type: "+H+U+U+R+U+S+W+S+U;V=Q.length-R.length;R=Q;J(R);return}}G=l.buildUrl(v.settings.url,l.extend(O,v.settings.multipart_params));t.open("post",G,true);t.setRequestHeader("Content-Type","application/octet-stream");l.each(v.settings.headers,function(Y,X){t.setRequestHeader(X,Y)});if(typeof(R)==="string"){J(R)}else{t.send(R)}}if(x.status==l.DONE||x.status==l.FAILED||v.state==l.STOPPED){return}O={name:x.target_name||x.name};if(y.chunk_size&&x.size>y.chunk_size&&(q.chunks||typeof(C)=="string")){K=y.chunk_size;N=Math.ceil(x.size/K);M=Math.min(K,x.size-(F*K));if(typeof(C)=="string"){L=C.substring(F*K,F*K+M)}else{L=A(C,F*K,F*K+M)}O.chunk=F;O.chunks=N}else{M=x.size;L=C}if(v.settings.multipart&&q.multipart&&typeof(L)!=="string"&&k.FileReader&&q.cantSendBlobInFormData&&q.chunks&&v.settings.chunk_size){(function(){var Q=new FileReader();Q.onload=function(){I(Q.result);Q=null};Q.readAsBinaryString(L)}())}else{I(L)}}D()}B=d[x.id];if(q.jpgresize&&v.settings.resize&&/\.(png|jpg|jpeg)$/i.test(x.name)){e.call(v,x,v.settings.resize,/\.png$/i.test(x.name)?"image/png":"image/jpeg",function(C){if(C.success){x.size=C.data.length;z(C.data)}else{if(q.chunks){z(B)}else{n(B,z)}}})}else{if(!q.chunks&&q.jpgresize){n(B,z)}else{z(B)}}});s.bind("Destroy",function(v){var x,y,w=m.body,z={inputContainer:v.id+"_html5_container",inputFile:v.id+"_html5",browseButton:v.settings.browse_button,dropElm:v.settings.drop_element};for(x in z){y=m.getElementById(z[x]);if(y){l.removeAllEvents(y,v.id)}}l.removeAllEvents(m.body,v.id);if(v.settings.container){w=m.getElementById(v.settings.container)}w.removeChild(m.getElementById(z.inputContainer))});u({success:true})}});function b(){var t=false,r;function u(w,y){var v=t?0:-8*(y-1),z=0,x;for(x=0;x<y;x++){z|=(r.charCodeAt(w+x)<<Math.abs(v+x*8))}return z}function q(x,v,w){var w=arguments.length===3?w:r.length-v-1;r=r.substr(0,v)+x+r.substr(w+v)}function s(w,x,z){var A="",v=t?0:-8*(z-1),y;for(y=0;y<z;y++){A+=String.fromCharCode((x>>Math.abs(v+y*8))&255)}q(A,w,z)}return{II:function(v){if(v===g){return t}else{t=v}},init:function(v){t=false;r=v},SEGMENT:function(v,x,w){switch(arguments.length){case 1:return r.substr(v,r.length-v-1);case 2:return r.substr(v,x);case 3:q(w,v,x);break;default:return r}},BYTE:function(v){return u(v,1)},SHORT:function(v){return u(v,2)},LONG:function(v,w){if(w===g){return u(v,4)}else{s(v,w,4)}},SLONG:function(v){var w=u(v,4);return(w>2147483647?w-4294967296:w)},STRING:function(v,w){var x="";for(w+=v;v<w;v++){x+=String.fromCharCode(u(v,1))}return x}}}function h(v){var x={65505:{app:"EXIF",name:"APP1",signature:"Exif\0"},65506:{app:"ICC",name:"APP2",signature:"ICC_PROFILE\0"},65517:{app:"IPTC",name:"APP13",signature:"Photoshop 3.0\0"}},w=[],u,q,s=g,t=0,r;u=new b();u.init(v);if(u.SHORT(0)!==65496){return}q=2;r=Math.min(1048576,v.length);while(q<=r){s=u.SHORT(q);if(s>=65488&&s<=65495){q+=2;continue}if(s===65498||s===65497){break}t=u.SHORT(q+2)+2;if(x[s]&&u.STRING(q+4,x[s].signature.length)===x[s].signature){w.push({hex:s,app:x[s].app.toUpperCase(),name:x[s].name.toUpperCase(),start:q,length:t,segment:u.SEGMENT(q,t)})}q+=t}u.init(null);return{headers:w,restore:function(B){u.init(B);var z=new h(B);if(!z.headers){return false}for(var A=z.headers.length;A>0;A--){var C=z.headers[A-1];u.SEGMENT(C.start,C.length,"")}z.purge();q=u.SHORT(2)==65504?4+u.SHORT(4):2;for(var A=0,y=w.length;A<y;A++){u.SEGMENT(q,0,w[A].segment);q+=w[A].length}return u.SEGMENT()},get:function(A){var B=[];for(var z=0,y=w.length;z<y;z++){if(w[z].app===A.toUpperCase()){B.push(w[z].segment)}}return B},set:function(B,A){var C=[];if(typeof(A)==="string"){C.push(A)}else{C=A}for(var z=ii=0,y=w.length;z<y;z++){if(w[z].app===B.toUpperCase()){w[z].segment=C[ii];w[z].length=C[ii].length;ii++}if(ii>=C.length){break}}},purge:function(){w=[];u.init(null)}}}function a(){var t,q,r={},w;t=new b();q={tiff:{274:"Orientation",34665:"ExifIFDPointer",34853:"GPSInfoIFDPointer"},exif:{36864:"ExifVersion",40961:"ColorSpace",40962:"PixelXDimension",40963:"PixelYDimension",36867:"DateTimeOriginal",33434:"ExposureTime",33437:"FNumber",34855:"ISOSpeedRatings",37377:"ShutterSpeedValue",37378:"ApertureValue",37383:"MeteringMode",37384:"LightSource",37385:"Flash",41986:"ExposureMode",41987:"WhiteBalance",41990:"SceneCaptureType",41988:"DigitalZoomRatio",41992:"Contrast",41993:"Saturation",41994:"Sharpness"},gps:{0:"GPSVersionID",1:"GPSLatitudeRef",2:"GPSLatitude",3:"GPSLongitudeRef",4:"GPSLongitude"}};w={ColorSpace:{1:"sRGB",0:"Uncalibrated"},MeteringMode:{0:"Unknown",1:"Average",2:"CenterWeightedAverage",3:"Spot",4:"MultiSpot",5:"Pattern",6:"Partial",255:"Other"},LightSource:{1:"Daylight",2:"Fliorescent",3:"Tungsten",4:"Flash",9:"Fine weather",10:"Cloudy weather",11:"Shade",12:"Daylight fluorescent (D 5700 - 7100K)",13:"Day white fluorescent (N 4600 -5400K)",14:"Cool white fluorescent (W 3900 - 4500K)",15:"White fluorescent (WW 3200 - 3700K)",17:"Standard light A",18:"Standard light B",19:"Standard light C",20:"D55",21:"D65",22:"D75",23:"D50",24:"ISO studio tungsten",255:"Other"},Flash:{0:"Flash did not fire.",1:"Flash fired.",5:"Strobe return light not detected.",7:"Strobe return light detected.",9:"Flash fired, compulsory flash mode",13:"Flash fired, compulsory flash mode, return light not detected",15:"Flash fired, compulsory flash mode, return light detected",16:"Flash did not fire, compulsory flash mode",24:"Flash did not fire, auto mode",25:"Flash fired, auto mode",29:"Flash fired, auto mode, return light not detected",31:"Flash fired, auto mode, return light detected",32:"No flash function",65:"Flash fired, red-eye reduction mode",69:"Flash fired, red-eye reduction mode, return light not detected",71:"Flash fired, red-eye reduction mode, return light detected",73:"Flash fired, compulsory flash mode, red-eye reduction mode",77:"Flash fired, compulsory flash mode, red-eye reduction mode, return light not detected",79:"Flash fired, compulsory flash mode, red-eye reduction mode, return light detected",89:"Flash fired, auto mode, red-eye reduction mode",93:"Flash fired, auto mode, return light not detected, red-eye reduction mode",95:"Flash fired, auto mode, return light detected, red-eye reduction mode"},ExposureMode:{0:"Auto exposure",1:"Manual exposure",2:"Auto bracket"},WhiteBalance:{0:"Auto white balance",1:"Manual white balance"},SceneCaptureType:{0:"Standard",1:"Landscape",2:"Portrait",3:"Night scene"},Contrast:{0:"Normal",1:"Soft",2:"Hard"},Saturation:{0:"Normal",1:"Low saturation",2:"High saturation"},Sharpness:{0:"Normal",1:"Soft",2:"Hard"},GPSLatitudeRef:{N:"North latitude",S:"South latitude"},GPSLongitudeRef:{E:"East longitude",W:"West longitude"}};function s(x,F){var z=t.SHORT(x),C,I,J,E,D,y,A,G,H=[],B={};for(C=0;C<z;C++){A=y=x+12*C+2;J=F[t.SHORT(A)];if(J===g){continue}E=t.SHORT(A+=2);D=t.LONG(A+=2);A+=4;H=[];switch(E){case 1:case 7:if(D>4){A=t.LONG(A)+r.tiffHeader}for(I=0;I<D;I++){H[I]=t.BYTE(A+I)}break;case 2:if(D>4){A=t.LONG(A)+r.tiffHeader}B[J]=t.STRING(A,D-1);continue;case 3:if(D>2){A=t.LONG(A)+r.tiffHeader}for(I=0;I<D;I++){H[I]=t.SHORT(A+I*2)}break;case 4:if(D>1){A=t.LONG(A)+r.tiffHeader}for(I=0;I<D;I++){H[I]=t.LONG(A+I*4)}break;case 5:A=t.LONG(A)+r.tiffHeader;for(I=0;I<D;I++){H[I]=t.LONG(A+I*4)/t.LONG(A+I*4+4)}break;case 9:A=t.LONG(A)+r.tiffHeader;for(I=0;I<D;I++){H[I]=t.SLONG(A+I*4)}break;case 10:A=t.LONG(A)+r.tiffHeader;for(I=0;I<D;I++){H[I]=t.SLONG(A+I*4)/t.SLONG(A+I*4+4)}break;default:continue}G=(D==1?H[0]:H);if(w.hasOwnProperty(J)&&typeof G!="object"){B[J]=w[J][G]}else{B[J]=G}}return B}function v(){var y=g,x=r.tiffHeader;t.II(t.SHORT(x)==18761);if(t.SHORT(x+=2)!==42){return false}r.IFD0=r.tiffHeader+t.LONG(x+=2);y=s(r.IFD0,q.tiff);r.exifIFD=("ExifIFDPointer" in y?r.tiffHeader+y.ExifIFDPointer:g);r.gpsIFD=("GPSInfoIFDPointer" in y?r.tiffHeader+y.GPSInfoIFDPointer:g);return true}function u(z,x,C){var E,B,A,D=0;if(typeof(x)==="string"){var y=q[z.toLowerCase()];for(hex in y){if(y[hex]===x){x=hex;break}}}E=r[z.toLowerCase()+"IFD"];B=t.SHORT(E);for(i=0;i<B;i++){A=E+12*i+2;if(t.SHORT(A)==x){D=A+8;break}}if(!D){return false}t.LONG(D,C);return true}return{init:function(x){r={tiffHeader:10};if(x===g||!x.length){return false}t.init(x);if(t.SHORT(0)===65505&&t.STRING(4,5).toUpperCase()==="EXIF\0"){return v()}return false},EXIF:function(){var y;y=s(r.exifIFD,q.exif);if(y.ExifVersion&&l.typeOf(y.ExifVersion)==="array"){for(var z=0,x="";z<y.ExifVersion.length;z++){x+=String.fromCharCode(y.ExifVersion[z])}y.ExifVersion=x}return y},GPS:function(){var x;x=s(r.gpsIFD,q.gps);if(x.GPSVersionID){x.GPSVersionID=x.GPSVersionID.join(".")}return x},setExif:function(x,y){if(x!=="PixelXDimension"&&x!=="PixelYDimension"){return false}return u("exif",x,y)},getBinary:function(){return t.SEGMENT()}}}})(window,document,plupload);
\ No newline at end of file diff --git a/phpBB/assets/plupload/plupload.js b/phpBB/assets/plupload/plupload.js deleted file mode 100644 index 5b3ffb7161..0000000000 --- a/phpBB/assets/plupload/plupload.js +++ /dev/null @@ -1,2 +0,0 @@ -/*1.5.7*/ -(function(){var f=0,k=[],m={},i={},a={"<":"lt",">":"gt","&":"amp",'"':"quot","'":"#39"},l=/[<>&\"\']/g,b,c=window.setTimeout,d={},e;function h(){this.returnValue=false}function j(){this.cancelBubble=true}(function(n){var o=n.split(/,/),p,r,q;for(p=0;p<o.length;p+=2){q=o[p+1].split(/ /);for(r=0;r<q.length;r++){i[q[r]]=o[p]}}})("application/msword,doc dot,application/pdf,pdf,application/pgp-signature,pgp,application/postscript,ps ai eps,application/rtf,rtf,application/vnd.ms-excel,xls xlb,application/vnd.ms-powerpoint,ppt pps pot,application/zip,zip,application/x-shockwave-flash,swf swfl,application/vnd.openxmlformats-officedocument.wordprocessingml.document,docx,application/vnd.openxmlformats-officedocument.wordprocessingml.template,dotx,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,xlsx,application/vnd.openxmlformats-officedocument.presentationml.presentation,pptx,application/vnd.openxmlformats-officedocument.presentationml.template,potx,application/vnd.openxmlformats-officedocument.presentationml.slideshow,ppsx,application/x-javascript,js,application/json,json,audio/mpeg,mpga mpega mp2 mp3,audio/x-wav,wav,audio/mp4,m4a,image/bmp,bmp,image/gif,gif,image/jpeg,jpeg jpg jpe,image/photoshop,psd,image/png,png,image/svg+xml,svg svgz,image/tiff,tiff tif,text/plain,asc txt text diff log,text/html,htm html xhtml,text/css,css,text/csv,csv,text/rtf,rtf,video/mpeg,mpeg mpg mpe m2v,video/quicktime,qt mov,video/mp4,mp4,video/x-m4v,m4v,video/x-flv,flv,video/x-ms-wmv,wmv,video/avi,avi,video/webm,webm,video/3gpp,3gp,video/3gpp2,3g2,video/vnd.rn-realvideo,rv,application/vnd.oasis.opendocument.formula-template,otf,application/octet-stream,exe");var g={VERSION:"1.5.7",STOPPED:1,STARTED:2,QUEUED:1,UPLOADING:2,FAILED:4,DONE:5,GENERIC_ERROR:-100,HTTP_ERROR:-200,IO_ERROR:-300,SECURITY_ERROR:-400,INIT_ERROR:-500,FILE_SIZE_ERROR:-600,FILE_EXTENSION_ERROR:-601,IMAGE_FORMAT_ERROR:-700,IMAGE_MEMORY_ERROR:-701,IMAGE_DIMENSIONS_ERROR:-702,mimeTypes:i,ua:(function(){var r=navigator,q=r.userAgent,s=r.vendor,o,n,p;o=/WebKit/.test(q);p=o&&s.indexOf("Apple")!==-1;n=window.opera&&window.opera.buildNumber;return{windows:navigator.platform.indexOf("Win")!==-1,android:/Android/.test(q),ie:!o&&!n&&(/MSIE/gi).test(q)&&(/Explorer/gi).test(r.appName),webkit:o,gecko:!o&&/Gecko/.test(q),safari:p,opera:!!n}}()),typeOf:function(n){return({}).toString.call(n).match(/\s([a-z|A-Z]+)/)[1].toLowerCase()},extend:function(n){g.each(arguments,function(o,p){if(p>0){g.each(o,function(r,q){n[q]=r})}});return n},cleanName:function(n){var o,p;p=[/[\300-\306]/g,"A",/[\340-\346]/g,"a",/\307/g,"C",/\347/g,"c",/[\310-\313]/g,"E",/[\350-\353]/g,"e",/[\314-\317]/g,"I",/[\354-\357]/g,"i",/\321/g,"N",/\361/g,"n",/[\322-\330]/g,"O",/[\362-\370]/g,"o",/[\331-\334]/g,"U",/[\371-\374]/g,"u"];for(o=0;o<p.length;o+=2){n=n.replace(p[o],p[o+1])}n=n.replace(/\s+/g,"_");n=n.replace(/[^a-z0-9_\-\.]+/gi,"");return n},addRuntime:function(n,o){o.name=n;k[n]=o;k.push(o);return o},guid:function(){var n=new Date().getTime().toString(32),o;for(o=0;o<5;o++){n+=Math.floor(Math.random()*65535).toString(32)}return(g.guidPrefix||"p")+n+(f++).toString(32)},buildUrl:function(o,n){var p="";g.each(n,function(r,q){p+=(p?"&":"")+encodeURIComponent(q)+"="+encodeURIComponent(r)});if(p){o+=(o.indexOf("?")>0?"&":"?")+p}return o},each:function(q,r){var p,o,n;if(q){p=q.length;if(p===b){for(o in q){if(q.hasOwnProperty(o)){if(r(q[o],o)===false){return}}}}else{for(n=0;n<p;n++){if(r(q[n],n)===false){return}}}}},formatSize:function(n){if(n===b||/\D/.test(n)){return g.translate("N/A")}if(n>1073741824){return Math.round(n/1073741824,1)+" GB"}if(n>1048576){return Math.round(n/1048576,1)+" MB"}if(n>1024){return Math.round(n/1024,1)+" KB"}return n+" b"},getPos:function(o,s){var t=0,r=0,v,u=document,p,q;o=o;s=s||u.body;function n(B){var z,A,w=0,C=0;if(B){A=B.getBoundingClientRect();z=u.compatMode==="CSS1Compat"?u.documentElement:u.body;w=A.left+z.scrollLeft;C=A.top+z.scrollTop}return{x:w,y:C}}if(o&&o.getBoundingClientRect&&g.ua.ie&&(!u.documentMode||u.documentMode<8)){p=n(o);q=n(s);return{x:p.x-q.x,y:p.y-q.y}}v=o;while(v&&v!=s&&v.nodeType){t+=v.offsetLeft||0;r+=v.offsetTop||0;v=v.offsetParent}v=o.parentNode;while(v&&v!=s&&v.nodeType){t-=v.scrollLeft||0;r-=v.scrollTop||0;v=v.parentNode}return{x:t,y:r}},getSize:function(n){return{w:n.offsetWidth||n.clientWidth,h:n.offsetHeight||n.clientHeight}},parseSize:function(n){var o;if(typeof(n)=="string"){n=/^([0-9]+)([mgk]?)$/.exec(n.toLowerCase().replace(/[^0-9mkg]/g,""));o=n[2];n=+n[1];if(o=="g"){n*=1073741824}if(o=="m"){n*=1048576}if(o=="k"){n*=1024}}return n},xmlEncode:function(n){return n?(""+n).replace(l,function(o){return a[o]?"&"+a[o]+";":o}):n},toArray:function(p){var o,n=[];for(o=0;o<p.length;o++){n[o]=p[o]}return n},inArray:function(p,q){if(q){if(Array.prototype.indexOf){return Array.prototype.indexOf.call(q,p)}for(var n=0,o=q.length;n<o;n++){if(q[n]===p){return n}}}return -1},addI18n:function(n){return g.extend(m,n)},translate:function(n){return m[n]||n},isEmptyObj:function(n){if(n===b){return true}for(var o in n){return false}return true},hasClass:function(p,o){var n;if(p.className==""){return false}n=new RegExp("(^|\\s+)"+o+"(\\s+|$)");return n.test(p.className)},addClass:function(o,n){if(!g.hasClass(o,n)){o.className=o.className==""?n:o.className.replace(/\s+$/,"")+" "+n}},removeClass:function(p,o){var n=new RegExp("(^|\\s+)"+o+"(\\s+|$)");p.className=p.className.replace(n,function(r,q,s){return q===" "&&s===" "?" ":""})},getStyle:function(o,n){if(o.currentStyle){return o.currentStyle[n]}else{if(window.getComputedStyle){return window.getComputedStyle(o,null)[n]}}},addEvent:function(s,n,t){var r,q,p,o;o=arguments[3];n=n.toLowerCase();if(e===b){e="Plupload_"+g.guid()}if(s.addEventListener){r=t;s.addEventListener(n,r,false)}else{if(s.attachEvent){r=function(){var u=window.event;if(!u.target){u.target=u.srcElement}u.preventDefault=h;u.stopPropagation=j;t(u)};s.attachEvent("on"+n,r)}}if(s[e]===b){s[e]=g.guid()}if(!d.hasOwnProperty(s[e])){d[s[e]]={}}q=d[s[e]];if(!q.hasOwnProperty(n)){q[n]=[]}q[n].push({func:r,orig:t,key:o})},removeEvent:function(s,n){var q,t,p;if(typeof(arguments[2])=="function"){t=arguments[2]}else{p=arguments[2]}n=n.toLowerCase();if(s[e]&&d[s[e]]&&d[s[e]][n]){q=d[s[e]][n]}else{return}for(var o=q.length-1;o>=0;o--){if(q[o].key===p||q[o].orig===t){if(s.removeEventListener){s.removeEventListener(n,q[o].func,false)}else{if(s.detachEvent){s.detachEvent("on"+n,q[o].func)}}q[o].orig=null;q[o].func=null;q.splice(o,1);if(t!==b){break}}}if(!q.length){delete d[s[e]][n]}if(g.isEmptyObj(d[s[e]])){delete d[s[e]];try{delete s[e]}catch(r){s[e]=b}}},removeAllEvents:function(o){var n=arguments[1];if(o[e]===b||!o[e]){return}g.each(d[o[e]],function(q,p){g.removeEvent(o,p,n)})}};g.Uploader=function(r){var o={},u,t=[],q,p=false;u=new g.QueueProgress();r=g.extend({chunk_size:0,multipart:true,multi_selection:true,file_data_name:"file",filters:[]},r);function s(){var w,x=0,v;if(this.state==g.STARTED){for(v=0;v<t.length;v++){if(!w&&t[v].status==g.QUEUED){w=t[v];w.status=g.UPLOADING;if(this.trigger("BeforeUpload",w)){this.trigger("UploadFile",w)}}else{x++}}if(x==t.length){this.stop();this.trigger("UploadComplete",t)}}}function n(){var w,v;u.reset();for(w=0;w<t.length;w++){v=t[w];if(v.size!==b){u.size+=v.size;u.loaded+=v.loaded}else{u.size=b}if(v.status==g.DONE){u.uploaded++}else{if(v.status==g.FAILED){u.failed++}else{u.queued++}}}if(u.size===b){u.percent=t.length>0?Math.ceil(u.uploaded/t.length*100):0}else{u.bytesPerSec=Math.ceil(u.loaded/((+new Date()-q||1)/1000));u.percent=u.size>0?Math.ceil(u.loaded/u.size*100):0}}g.extend(this,{state:g.STOPPED,runtime:"",features:{},files:t,settings:r,total:u,id:g.guid(),init:function(){var A=this,B,x,w,z=0,y;if(typeof(r.preinit)=="function"){r.preinit(A)}else{g.each(r.preinit,function(D,C){A.bind(C,D)})}r.page_url=r.page_url||document.location.pathname.replace(/\/[^\/]+$/g,"/");if(!/^(\w+:\/\/|\/)/.test(r.url)){r.url=r.page_url+r.url}r.chunk_size=g.parseSize(r.chunk_size);r.max_file_size=g.parseSize(r.max_file_size);A.bind("FilesAdded",function(C,F){var E,D,H=0,I,G=r.filters;if(G&&G.length){I=[];g.each(G,function(J){g.each(J.extensions.split(/,/),function(K){if(/^\s*\*\s*$/.test(K)){I.push("\\.*")}else{I.push("\\."+K.replace(new RegExp("["+("/^$.*+?|()[]{}\\".replace(/./g,"\\$&"))+"]","g"),"\\$&"))}})});I=new RegExp(I.join("|")+"$","i")}for(E=0;E<F.length;E++){D=F[E];D.loaded=0;D.percent=0;D.status=g.QUEUED;if(I&&!I.test(D.name)){C.trigger("Error",{code:g.FILE_EXTENSION_ERROR,message:g.translate("File extension error."),file:D});continue}if(D.size!==b&&D.size>r.max_file_size){C.trigger("Error",{code:g.FILE_SIZE_ERROR,message:g.translate("File size error."),file:D});continue}t.push(D);H++}if(H){c(function(){A.trigger("QueueChanged");A.refresh()},1)}else{return false}});if(r.unique_names){A.bind("UploadFile",function(C,D){var F=D.name.match(/\.([^.]+)$/),E="tmp";if(F){E=F[1]}D.target_name=D.id+"."+E})}A.bind("UploadProgress",function(C,D){D.percent=D.size>0?Math.ceil(D.loaded/D.size*100):100;n()});A.bind("StateChanged",function(C){if(C.state==g.STARTED){q=(+new Date())}else{if(C.state==g.STOPPED){for(B=C.files.length-1;B>=0;B--){if(C.files[B].status==g.UPLOADING){C.files[B].status=g.QUEUED;n()}}}}});A.bind("QueueChanged",n);A.bind("Error",function(C,D){if(D.file){D.file.status=g.FAILED;n();if(C.state==g.STARTED){c(function(){s.call(A)},1)}}});A.bind("FileUploaded",function(C,D){D.status=g.DONE;D.loaded=D.size;C.trigger("UploadProgress",D);c(function(){s.call(A)},1)});if(r.runtimes){x=[];y=r.runtimes.split(/\s?,\s?/);for(B=0;B<y.length;B++){if(k[y[B]]){x.push(k[y[B]])}}}else{x=k}function v(){var F=x[z++],E,C,D;if(F){E=F.getFeatures();C=A.settings.required_features;if(C){C=C.split(",");for(D=0;D<C.length;D++){if(!E[C[D]]){v();return}}}F.init(A,function(G){if(G&&G.success){A.features=E;A.runtime=F.name;A.trigger("Init",{runtime:F.name});A.trigger("PostInit");A.refresh()}else{v()}})}else{A.trigger("Error",{code:g.INIT_ERROR,message:g.translate("Init error.")})}}v();if(typeof(r.init)=="function"){r.init(A)}else{g.each(r.init,function(D,C){A.bind(C,D)})}},refresh:function(){this.trigger("Refresh")},start:function(){if(t.length&&this.state!=g.STARTED){this.state=g.STARTED;this.trigger("StateChanged");s.call(this)}},stop:function(){if(this.state!=g.STOPPED){this.state=g.STOPPED;this.trigger("CancelUpload");this.trigger("StateChanged")}},disableBrowse:function(){p=arguments[0]!==b?arguments[0]:true;this.trigger("DisableBrowse",p)},getFile:function(w){var v;for(v=t.length-1;v>=0;v--){if(t[v].id===w){return t[v]}}},removeFile:function(w){var v;for(v=t.length-1;v>=0;v--){if(t[v].id===w.id){return this.splice(v,1)[0]}}},splice:function(x,v){var w;w=t.splice(x===b?0:x,v===b?t.length:v);this.trigger("FilesRemoved",w);this.trigger("QueueChanged");return w},trigger:function(w){var y=o[w.toLowerCase()],x,v;if(y){v=Array.prototype.slice.call(arguments);v[0]=this;for(x=0;x<y.length;x++){if(y[x].func.apply(y[x].scope,v)===false){return false}}}return true},hasEventListener:function(v){return !!o[v.toLowerCase()]},bind:function(v,x,w){var y;v=v.toLowerCase();y=o[v]||[];y.push({func:x,scope:w||this});o[v]=y},unbind:function(v){v=v.toLowerCase();var y=o[v],w,x=arguments[1];if(y){if(x!==b){for(w=y.length-1;w>=0;w--){if(y[w].func===x){y.splice(w,1);break}}}else{y=[]}if(!y.length){delete o[v]}}},unbindAll:function(){var v=this;g.each(o,function(x,w){v.unbind(w)})},destroy:function(){this.stop();this.trigger("Destroy");this.unbindAll()}})};g.File=function(q,o,p){var n=this;n.id=q;n.name=o;n.size=p;n.loaded=0;n.percent=0;n.status=0};g.Runtime=function(){this.getFeatures=function(){};this.init=function(n,o){}};g.QueueProgress=function(){var n=this;n.size=0;n.loaded=0;n.uploaded=0;n.failed=0;n.queued=0;n.percent=0;n.bytesPerSec=0;n.reset=function(){n.size=n.loaded=n.uploaded=n.failed=n.queued=n.percent=n.bytesPerSec=0}};g.runtimes={};window.plupload=g})();
\ No newline at end of file diff --git a/phpBB/config/mimetype_guessers.yml b/phpBB/config/mimetype_guessers.yml new file mode 100644 index 0000000000..0115146deb --- /dev/null +++ b/phpBB/config/mimetype_guessers.yml @@ -0,0 +1,43 @@ +parameters: + mimetype.guesser.priority.lowest: -2 + mimetype.guesser.priority.low: -1 + mimetype.guesser.priority.default: 0 + mimetype.guesser.priority.high: 1 + mimetype.guesser.priority.highest: 2 + +services: + mimetype.fileinfo_mimetype_guesser: + class: Symfony\Component\HttpFoundation\File\MimeType\FileinfoMimeTypeGuesser + tags: + - { name: mimetype.guessers } + + mimetype.filebinary_mimetype_guesser: + class: Symfony\Component\HttpFoundation\File\MimeType\FileBinaryMimeTypeGuesser + tags: + - { name: mimetype.guessers } + + mimetype.content_guesser: + class: phpbb\mimetype\content_guesser + calls: + - [set_priority, [%mimetype.guesser.priority.low%]] + tags: + - { name: mimetype.guessers } + + mimetype.extension_guesser: + class: phpbb\mimetype\extension_guesser + calls: + - [set_priority, [%mimetype.guesser.priority.lowest%]] + tags: + - { name: mimetype.guessers } + + mimetype.guesser_collection: + class: phpbb\di\service_collection + arguments: + - @service_container + tags: + - { name: service_collection, tag: mimetype.guessers } + + mimetype.guesser: + class: phpbb\mimetype\guesser + arguments: + - @mimetype.guesser_collection diff --git a/phpBB/config/services.yml b/phpBB/config/services.yml index 84143a2362..c11184d6b6 100644 --- a/phpBB/config/services.yml +++ b/phpBB/config/services.yml @@ -7,6 +7,7 @@ imports: - { resource: feed.yml } - { resource: auth_providers.yml } - { resource: console.yml } + - { resource: mimetype_guessers.yml } services: acl.permissions: @@ -254,6 +255,12 @@ services: - %tables.notifications% - %tables.user_notifications% + pagination: + class: phpbb\pagination + arguments: + - @template + - @user + path_helper: class: phpbb\path_helper arguments: @@ -274,6 +281,7 @@ services: - @request - @user - @php_ini + - @mimetype.guesser request: class: phpbb\request\request diff --git a/phpBB/docs/events.md b/phpBB/docs/events.md index b15b8b2e6e..f1df662f76 100644 --- a/phpBB/docs/events.md +++ b/phpBB/docs/events.md @@ -1,3 +1,21 @@ +acp_bbcodes_actions_append +=== +* Location: adm/style/acp_bbcodes.html +* Since: 3.1.0-a3 +* Purpose: Add actions to the BBCodes page, after edit/delete buttons + +acp_bbcodes_actions_prepend +=== +* Location: adm/style/acp_bbcodes.html +* Since: 3.1.0-a3 +* Purpose: Add actions to the BBCodes page, before edit/delete buttons + +acp_bbcodes_edit_fieldsets_after +=== +* Location: adm/style/acp_bbcodes.html +* Since: 3.1.0-a3 +* Purpose: Add settings to BBCode add/edit form + acp_forums_normal_settings_append === * Location: adm/style/acp_forums.html @@ -46,6 +64,20 @@ acp_users_overview_options_append * Since: 3.1.0-a1 * Purpose: Add options and settings on user overview page +acp_users_signature_editor_buttons_after +=== +* Locations: + + adm/style/acp_users_signature.html +* Since: 3.1.0-a3 +* Purpose: Add content after BBCode posting buttons in the ACP user signature + +acp_users_signature_editor_buttons_before +=== +* Locations: + + adm/style/acp_users_signature.html +* Since: 3.1.0-a3 +* Purpose: Add content before BBCode posting buttons in the ACP user signature + forumlist_body_last_post_title_prepend ==== * Locations: @@ -54,6 +86,22 @@ forumlist_body_last_post_title_prepend * Since: 3.1.0-a1 * Purpose: Add content before the post title of the latest post in a forum on the forum list. +index_body_linklist_after +=== +* Locations: + + styles/prosilver/template/index_body.html + + styles/subsilver2/template/index_body.html +* Since: 3.1.0-a3 +* Purpose: Add content after the linklist above the forum list on Board index + +index_body_linklist_before +=== +* Locations: + + styles/prosilver/template/index_body.html + + styles/subsilver2/template/index_body.html +* Since: 3.1.0-a3 +* Purpose: Add content before the linklist above the forum list on Board index + index_body_stat_blocks_before === * Locations: @@ -173,6 +221,22 @@ overall_header_navigation_prepend * Since: 3.1.0-a1 * Purpose: Add links before the navigation links in the header +posting_editor_buttons_after +=== +* Locations: + + styles/prosilver/template/posting_buttons.html + + styles/subsilver2/template/posting_buttons.html +* Since: 3.1.0-a3 +* Purpose: Add content after the BBCode posting buttons + +posting_editor_buttons_before +=== +* Locations: + + styles/prosilver/template/posting_buttons.html + + styles/subsilver2/template/posting_buttons.html +* Since: 3.1.0-a3 +* Purpose: Add content before the BBCode posting buttons + posting_editor_message_after === * Locations: @@ -391,3 +455,17 @@ viewtopic_topic_title_prepend + styles/subsilver2/template/viewtopic_body.html * Since: 3.1.0-a1 * Purpose: Add content directly before the topic title link on the View topic screen + +viewtopic_topic_tools_after +=== +* Locations: + + styles/prosilver/template/viewtopic_topic_tools.html +* Since: 3.1.0-a3 +* Purpose: Add a new topic tool after the rest of the existing ones + +viewtopic_topic_tools_before +=== +* Locations: + + styles/prosilver/template/viewtopic_topic_tools.html +* Since: 3.1.0-a3 +* Purpose: Add a new topic tool before the rest of the existing ones diff --git a/phpBB/includes/acp/acp_attachments.php b/phpBB/includes/acp/acp_attachments.php index 2282863746..e710260b35 100644 --- a/phpBB/includes/acp/acp_attachments.php +++ b/phpBB/includes/acp/acp_attachments.php @@ -25,7 +25,7 @@ class acp_attachments function main($id, $mode) { - global $db, $user, $auth, $template, $cache; + global $db, $user, $auth, $template, $cache, $phpbb_container; global $config, $phpbb_admin_path, $phpbb_root_path, $phpEx; $user->add_lang(array('posting', 'viewtopic', 'acp/attachments')); @@ -1166,10 +1166,9 @@ class acp_attachments } // Make sure $start is set to the last page if it exceeds the amount - if ($start < 0 || $start > $num_files) - { - $start = ($start < 0) ? 0 : floor(($num_files - 1) / $attachments_per_page) * $attachments_per_page; - } + + $pagination = $phpbb_container->get('pagination'); + $start = $pagination->validate_start($start, $attachments_per_page, $num_files); // If the user is trying to reach the second half of the attachments list, fetch it starting from the end $store_reverse = false; @@ -1179,15 +1178,11 @@ class acp_attachments { $store_reverse = true; - if ($start + $attachments_per_page > $num_files) - { - $sql_limit = min($attachments_per_page, max(1, $num_files - $start)); - } - // Select the sort order. Add time sort anchor for non-time sorting cases $sql_sort_anchor = ($sort_key != 't') ? ', a.filetime ' . (($sort_dir == 'd') ? 'ASC' : 'DESC') : ''; $sql_sort_order = $sort_by_sql[$sort_key] . ' ' . (($sort_dir == 'd') ? 'ASC' : 'DESC') . $sql_sort_anchor; - $sql_start = max(0, $num_files - $sql_limit - $start); + $sql_limit = $pagination->reverse_limit($start, $sql_limit, $num_files); + $sql_start = $pagination->reverse_start($start, $sql_limit, $num_files); } else { @@ -1195,7 +1190,6 @@ class acp_attachments $sql_sort_anchor = ($sort_key != 't') ? ', a.filetime ' . (($sort_dir == 'd') ? 'DESC' : 'ASC') : ''; $sql_sort_order = $sort_by_sql[$sort_key] . ' ' . (($sort_dir == 'd') ? 'DESC' : 'ASC') . $sql_sort_anchor; $sql_start = $start; - } $attachments_list = array(); @@ -1222,13 +1216,13 @@ class acp_attachments $db->sql_freeresult($result); $base_url = $this->u_action . "&$u_sort_param"; - phpbb_generate_template_pagination($template, $base_url, 'pagination', 'start', $num_files, $attachments_per_page, $start); + $pagination->generate_template_pagination($base_url, 'pagination', 'start', $num_files, $attachments_per_page, $start); $template->assign_vars(array( 'TOTAL_FILES' => $num_files, 'TOTAL_SIZE' => get_formatted_filesize($total_size), - 'S_ON_PAGE' => phpbb_on_page($template, $user, $base_url, $num_files, $attachments_per_page, $start), + 'S_ON_PAGE' => $pagination->on_page($base_url, $num_files, $attachments_per_page, $start), 'S_LIMIT_DAYS' => $s_limit_days, 'S_SORT_KEY' => $s_sort_key, 'S_SORT_DIR' => $s_sort_dir) diff --git a/phpBB/includes/acp/acp_bbcodes.php b/phpBB/includes/acp/acp_bbcodes.php index 575ac84012..84382b6276 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, $request; + global $db, $user, $auth, $template, $cache, $request, $phpbb_dispatcher; global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx; $user->add_lang('acp/posting'); @@ -96,7 +96,7 @@ class acp_bbcodes case 'edit': case 'add': - $template->assign_vars(array( + $tpl_ary = array( 'S_EDIT_BBCODE' => true, 'U_BACK' => $this->u_action, 'U_ACTION' => $this->u_action . '&action=' . (($action == 'add') ? 'create' : 'modify') . (($bbcode_id) ? "&bbcode=$bbcode_id" : ''), @@ -105,10 +105,27 @@ class acp_bbcodes 'BBCODE_MATCH' => $bbcode_match, 'BBCODE_TPL' => $bbcode_tpl, 'BBCODE_HELPLINE' => $bbcode_helpline, - 'DISPLAY_ON_POSTING' => $display_on_posting) + 'DISPLAY_ON_POSTING' => $display_on_posting, ); $bbcode_tokens = array('TEXT', 'SIMPLETEXT', 'INTTEXT', 'IDENTIFIER', 'NUMBER', 'EMAIL', 'URL', 'LOCAL_URL', 'RELATIVE_URL', 'COLOR'); + + /** + * Modify custom bbcode template data before we display the add/edit form + * + * @event core.acp_bbcodes_edit_add + * @var string action Type of the action: add|edit + * @var array tpl_ary Array with custom bbcode add/edit data + * @var int bbcode_id When editing: the bbcode id, + * when creating: 0 + * @var array bbcode_tokens Array of bbcode tokens + * @since 3.1.0-a3 + */ + $vars = array('action', 'tpl_ary', 'bbcode_id', 'bbcode_tokens'); + extract($phpbb_dispatcher->trigger_event('core.acp_bbcodes_edit_add', compact($vars))); + + $template->assign_vars($tpl_ary); + foreach ($bbcode_tokens as $token) { $template->assign_block_vars('token', array( @@ -124,6 +141,27 @@ class acp_bbcodes case 'modify': case 'create': + $sql_ary = $hidden_fields = array(); + + /** + * Modify custom bbcode data before the modify/create action + * + * @event core.acp_bbcodes_modify_create + * @var string action Type of the action: modify|create + * @var array sql_ary Array with new bbcode data + * @var int bbcode_id When editing: the bbcode id, + * when creating: 0 + * @var bool display_on_posting Display bbcode on posting form + * @var string bbcode_match The bbcode usage string to match + * @var string bbcode_tpl The bbcode HTML replacement string + * @var string bbcode_helpline The bbcode help line string + * @var array hidden_fields Array of hidden fields for use when + * submitting form when $warn_text is true + * @since 3.1.0-a3 + */ + $vars = array('action', 'sql_ary', 'bbcode_id', 'display_on_posting', 'bbcode_match', 'bbcode_tpl', 'bbcode_helpline', 'hidden_fields'); + extract($phpbb_dispatcher->trigger_event('core.acp_bbcodes_modify_create', compact($vars))); + $warn_text = preg_match('%<[^>]*\{text[\d]*\}[^>]*>%i', $bbcode_tpl); if (!$warn_text || confirm_box(true)) { @@ -178,7 +216,7 @@ class acp_bbcodes trigger_error($user->lang['BBCODE_HELPLINE_TOO_LONG'] . adm_back_link($this->u_action), E_USER_WARNING); } - $sql_ary = array( + $sql_ary = array_merge($sql_ary, array( 'bbcode_tag' => $data['bbcode_tag'], 'bbcode_match' => $bbcode_match, 'bbcode_tpl' => $bbcode_tpl, @@ -188,7 +226,7 @@ class acp_bbcodes 'first_pass_replace' => $data['first_pass_replace'], 'second_pass_match' => $data['second_pass_match'], 'second_pass_replace' => $data['second_pass_replace'] - ); + )); if ($action == 'create') { @@ -244,14 +282,14 @@ class acp_bbcodes } else { - confirm_box(false, $user->lang['BBCODE_DANGER'], build_hidden_fields(array( + confirm_box(false, $user->lang['BBCODE_DANGER'], build_hidden_fields(array_merge($hidden_fields, array( 'action' => $action, 'bbcode' => $bbcode_id, 'bbcode_match' => $bbcode_match, 'bbcode_tpl' => htmlspecialchars($bbcode_tpl), 'bbcode_helpline' => $bbcode_helpline, 'display_on_posting' => $display_on_posting, - )) + ))) , 'confirm_bbcode.html'); } @@ -300,22 +338,57 @@ class acp_bbcodes break; } - $template->assign_vars(array( - 'U_ACTION' => $this->u_action . '&action=add') + $u_action = $this->u_action; + + $template_data = array( + 'U_ACTION' => $this->u_action . '&action=add', + ); + + $sql_ary = array( + 'SELECT' => 'b.*', + 'FROM' => array(BBCODES_TABLE => 'b'), + 'ORDER_BY' => 'b.bbcode_tag', ); - $sql = 'SELECT * - FROM ' . BBCODES_TABLE . ' - ORDER BY bbcode_tag'; - $result = $db->sql_query($sql); + /** + * Modify custom bbcode template data before we display the form + * + * @event core.acp_bbcodes_display_form + * @var string action Type of the action: modify|create + * @var string sql_ary The SQL array to get custom bbcode data + * @var array template_data Array with form template data + * @var string u_action The u_action link + * @since 3.1.0-a3 + */ + $vars = array('action', 'sql_ary', 'template_data', 'u_action'); + extract($phpbb_dispatcher->trigger_event('core.acp_bbcodes_display_form', compact($vars))); + + $result = $db->sql_query($db->sql_build_query('SELECT', $sql_ary)); + + $template->assign_vars($template_data); while ($row = $db->sql_fetchrow($result)) { - $template->assign_block_vars('bbcodes', array( + $bbcodes_array = array( 'BBCODE_TAG' => $row['bbcode_tag'], - 'U_EDIT' => $this->u_action . '&action=edit&bbcode=' . $row['bbcode_id'], - 'U_DELETE' => $this->u_action . '&action=delete&bbcode=' . $row['bbcode_id']) + 'U_EDIT' => $u_action . '&action=edit&bbcode=' . $row['bbcode_id'], + 'U_DELETE' => $u_action . '&action=delete&bbcode=' . $row['bbcode_id'], ); + + /** + * Modify display of custom bbcodes in the form + * + * @event core.acp_bbcodes_display_bbcodes + * @var array row Array with current bbcode data + * @var array bbcodes_array Array of bbcodes template data + * @var string u_action The u_action link + * @since 3.1.0-a3 + */ + $vars = array('bbcodes_array', 'row', 'u_action'); + extract($phpbb_dispatcher->trigger_event('core.acp_bbcodes_display_bbcodes', compact($vars))); + + $template->assign_block_vars('bbcodes', $bbcodes_array); + } $db->sql_freeresult($result); } diff --git a/phpBB/includes/acp/acp_extensions.php b/phpBB/includes/acp/acp_extensions.php index c21c9f4e9d..2ff479d824 100644 --- a/phpBB/includes/acp/acp_extensions.php +++ b/phpBB/includes/acp/acp_extensions.php @@ -88,6 +88,11 @@ class acp_extensions break; case 'enable_pre': + if (!$md_manager->validate_dir()) + { + trigger_error($user->lang['EXTENSION_DIR_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING); + } + if (!$md_manager->validate_enable()) { trigger_error($user->lang['EXTENSION_NOT_AVAILABLE'] . adm_back_link($this->u_action), E_USER_WARNING); @@ -108,6 +113,11 @@ class acp_extensions break; case 'enable': + if (!$md_manager->validate_dir()) + { + trigger_error($user->lang['EXTENSION_DIR_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING); + } + if (!$md_manager->validate_enable()) { trigger_error($user->lang['EXTENSION_NOT_AVAILABLE'] . adm_back_link($this->u_action), E_USER_WARNING); diff --git a/phpBB/includes/acp/acp_groups.php b/phpBB/includes/acp/acp_groups.php index c170c67d49..ec78e0b32b 100644 --- a/phpBB/includes/acp/acp_groups.php +++ b/phpBB/includes/acp/acp_groups.php @@ -325,6 +325,10 @@ class acp_groups // This is normalised data, without the group_ prefix $avatar_data = \phpbb\avatar\manager::clean_row($group_row, 'group'); + if (!isset($avatar_data['id'])) + { + $avatar_data['id'] = 'g' . $group_id; + } } @@ -379,7 +383,7 @@ class acp_groups } else { - $driver = $phpbb_avatar_manager->get_driver($user->data['user_avatar_type']); + $driver = $phpbb_avatar_manager->get_driver($avatar_data['avatar_type']); if ($driver) { $driver->delete($avatar_data); @@ -672,6 +676,7 @@ class acp_groups } $this->page_title = 'GROUP_MEMBERS'; + $pagination = $phpbb_container->get('pagination'); // Grab the leaders - always, on every page... $sql = 'SELECT u.user_id, u.username, u.username_clean, u.user_regdate, u.user_colour, u.user_posts, u.group_id, ug.group_leader, ug.user_pending @@ -715,14 +720,14 @@ class acp_groups } $base_url = $this->u_action . "&action=$action&g=$group_id"; - phpbb_generate_template_pagination($template, $base_url, 'pagination', 'start', $total_members, $config['topics_per_page'], $start); + $pagination->generate_template_pagination($base_url, 'pagination', 'start', $total_members, $config['topics_per_page'], $start); $template->assign_vars(array( 'S_LIST' => true, 'S_GROUP_SPECIAL' => ($group_row['group_type'] == GROUP_SPECIAL) ? true : false, 'S_ACTION_OPTIONS' => $s_action_options, - 'S_ON_PAGE' => phpbb_on_page($template, $user, $base_url, $total_members, $config['topics_per_page'], $start), + 'S_ON_PAGE' => $pagination->on_page($base_url, $total_members, $config['topics_per_page'], $start), 'GROUP_NAME' => ($group_row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $group_row['group_name']] : $group_row['group_name'], 'U_ACTION' => $this->u_action . "&g=$group_id", diff --git a/phpBB/includes/acp/acp_icons.php b/phpBB/includes/acp/acp_icons.php index 658be4cc6b..f9295e2b47 100644 --- a/phpBB/includes/acp/acp_icons.php +++ b/phpBB/includes/acp/acp_icons.php @@ -27,7 +27,7 @@ class acp_icons { global $db, $user, $auth, $template, $cache; global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx; - global $request; + global $request, $phpbb_container; $user->add_lang('acp/posting'); @@ -893,6 +893,7 @@ class acp_icons ); $spacer = false; + $pagination = $phpbb_container->get('pagination'); $pagination_start = request_var('start', 0); $item_count = $this->item_count($table); @@ -927,7 +928,7 @@ class acp_icons } $db->sql_freeresult($result); - phpbb_generate_template_pagination($template, $this->u_action, 'pagination', 'start', $item_count, $config['smilies_per_page'], $pagination_start); + $pagination->generate_template_pagination($this->u_action, 'pagination', 'start', $item_count, $config['smilies_per_page'], $pagination_start); } /** diff --git a/phpBB/includes/acp/acp_inactive.php b/phpBB/includes/acp/acp_inactive.php index de4679b58d..305ba9ac69 100644 --- a/phpBB/includes/acp/acp_inactive.php +++ b/phpBB/includes/acp/acp_inactive.php @@ -30,7 +30,7 @@ class acp_inactive function main($id, $mode) { - global $config, $db, $user, $auth, $template; + global $config, $db, $user, $auth, $template, $phpbb_container; global $phpbb_root_path, $phpbb_admin_path, $phpEx, $table_prefix; include($phpbb_root_path . 'includes/functions_user.' . $phpEx); @@ -49,6 +49,7 @@ class acp_inactive $form_key = 'acp_inactive'; add_form_key($form_key); + $pagination = $phpbb_container->get('pagination'); // We build the sort key and per page settings here, because they may be needed later @@ -285,7 +286,7 @@ class acp_inactive } $base_url = $this->u_action . "&$u_sort_param&users_per_page=$per_page"; - phpbb_generate_template_pagination($template, $base_url, 'pagination', 'start', $inactive_count, $per_page, $start); + $pagination->generate_template_pagination($base_url, 'pagination', 'start', $inactive_count, $per_page, $start); $template->assign_vars(array( 'S_INACTIVE_USERS' => true, @@ -294,7 +295,7 @@ class acp_inactive 'S_LIMIT_DAYS' => $s_limit_days, 'S_SORT_KEY' => $s_sort_key, 'S_SORT_DIR' => $s_sort_dir, - 'S_ON_PAGE' => phpbb_on_page($template, $user, $base_url, $inactive_count, $per_page, $start), + 'S_ON_PAGE' => $pagination->on_page($base_url, $inactive_count, $per_page, $start), 'USERS_PER_PAGE' => $per_page, 'U_ACTION' => $this->u_action . "&$u_sort_param&users_per_page=$per_page&start=$start", diff --git a/phpBB/includes/acp/acp_logs.php b/phpBB/includes/acp/acp_logs.php index 229bf135ff..0ffea2737b 100644 --- a/phpBB/includes/acp/acp_logs.php +++ b/phpBB/includes/acp/acp_logs.php @@ -24,7 +24,7 @@ class acp_logs function main($id, $mode) { - global $db, $user, $auth, $template, $cache; + global $db, $user, $auth, $template, $cache, $phpbb_container; global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx; global $request; @@ -46,6 +46,7 @@ class acp_logs $this->tpl_name = 'acp_logs'; $this->log_type = constant('LOG_' . strtoupper($mode)); + $pagination = $phpbb_container->get('pagination'); // Delete entries if requested and able if (($deletemark || $deleteall) && $auth->acl_get('a_clearlogs')) @@ -130,14 +131,14 @@ class acp_logs $start = view_log($mode, $log_data, $log_count, $config['topics_per_page'], $start, $forum_id, 0, 0, $sql_where, $sql_sort, $keywords); $base_url = $this->u_action . "&$u_sort_param$keywords_param"; - phpbb_generate_template_pagination($template, $base_url, 'pagination', 'start', $log_count, $config['topics_per_page'], $start); + $pagination->generate_template_pagination($base_url, 'pagination', 'start', $log_count, $config['topics_per_page'], $start); $template->assign_vars(array( 'L_TITLE' => $l_title, 'L_EXPLAIN' => $l_title_explain, 'U_ACTION' => $this->u_action . "&$u_sort_param$keywords_param&start=$start", - 'S_ON_PAGE' => phpbb_on_page($template, $user, $base_url, $log_count, $config['topics_per_page'], $start), + 'S_ON_PAGE' => $pagination->on_page($base_url, $log_count, $config['topics_per_page'], $start), 'S_LIMIT_DAYS' => $s_limit_days, 'S_SORT_KEY' => $s_sort_key, diff --git a/phpBB/includes/acp/acp_main.php b/phpBB/includes/acp/acp_main.php index eecd8c72dc..f01cba0bcc 100644 --- a/phpBB/includes/acp/acp_main.php +++ b/phpBB/includes/acp/acp_main.php @@ -620,6 +620,22 @@ class acp_main $template->assign_var('S_REMOVE_INSTALL', true); } + // Warn if no search index is created + if ($config['num_posts'] && class_exists($config['search_type'])) + { + $error = false; + $search_type = $config['search_type']; + $search = new $search_type($error, $phpbb_root_path, $phpEx, $auth, $config, $db, $user); + + if (!$search->index_created()) + { + $template->assign_vars(array( + 'S_SEARCH_INDEX_MISSING' => true, + 'L_NO_SEARCH_INDEX' => $user->lang('NO_SEARCH_INDEX', $search->get_name(), '<a href="' . append_sid("{$phpbb_admin_path}index.$phpEx", 'i=acp_search&mode=index') . '">', '</a>'), + )); + } + } + if (!defined('PHPBB_DISABLE_CONFIG_CHECK') && file_exists($phpbb_root_path . 'config.' . $phpEx) && phpbb_is_writable($phpbb_root_path . 'config.' . $phpEx)) { // World-Writable? (000x) diff --git a/phpBB/includes/acp/acp_prune.php b/phpBB/includes/acp/acp_prune.php index 4234ec1505..5d9080b55b 100644 --- a/phpBB/includes/acp/acp_prune.php +++ b/phpBB/includes/acp/acp_prune.php @@ -331,23 +331,30 @@ class acp_prune $s_find_active_time .= '<option value="' . $key . '">' . $value . '</option>'; } - $s_group_list = '<option value="0"></option>'; $sql = 'SELECT group_id, group_name FROM ' . GROUPS_TABLE . ' WHERE group_type <> ' . GROUP_SPECIAL . ' ORDER BY group_name ASC'; $result = $db->sql_query($sql); + $s_group_list = ''; while ($row = $db->sql_fetchrow($result)) { $s_group_list .= '<option value="' . $row['group_id'] . '">' . $row['group_name'] . '</option>'; } $db->sql_freeresult($result); + if ($s_group_list) + { + // Only prepend the "All groups" option if there are groups, + // otherwise we don't want to display this option at all. + $s_group_list = '<option value="0">' . $user->lang['PRUNE_USERS_GROUP_NONE'] . '</option>' . $s_group_list; + } + $template->assign_vars(array( 'U_ACTION' => $this->u_action, 'S_ACTIVE_OPTIONS' => $s_find_active_time, - 'S_GROUP_LIST' => $s_group_list, + 'S_GROUP_LIST' => $s_group_list, 'S_COUNT_OPTIONS' => $s_find_count, 'U_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=searchuser&form=acp_prune&field=users'), )); @@ -358,12 +365,12 @@ class acp_prune */ function get_prune_users(&$user_ids, &$usernames) { - global $user, $db; + global $user, $db, $request; $users_by_name = request_var('users', '', true); $users_by_id = request_var('user_ids', array(0)); $group_id = request_var('group_id', 0); - $posts_on_queue = request_var('posts_on_queue', 0); + $posts_on_queue = (trim($request->variable('posts_on_queue', '')) === '') ? false : $request->variable('posts_on_queue', 0); if ($users_by_name) { @@ -450,8 +457,8 @@ class acp_prune } } - // Protect the admin, do not prune if no options are given... - if (!$where_sql) + // If no search criteria were provided, go no further. + if (!$where_sql && !$group_id && $posts_on_queue === false) { return; } @@ -468,34 +475,40 @@ class acp_prune } $db->sql_freeresult($result); - // Do not prune founder members - $sql = 'SELECT user_id, username - FROM ' . USERS_TABLE . ' - WHERE user_id <> ' . ANONYMOUS . ' - AND user_type <> ' . USER_FOUNDER . " - $where_sql"; - $result = $db->sql_query($sql); + // Protect the admin, do not prune if no options are given... + if ($where_sql) + { + // Do not prune founder members + $sql = 'SELECT user_id, username + FROM ' . USERS_TABLE . ' + WHERE user_id <> ' . ANONYMOUS . ' + AND user_type <> ' . USER_FOUNDER . " + $where_sql"; + $result = $db->sql_query($sql); - $user_ids = $usernames = array(); + $user_ids = $usernames = array(); - while ($row = $db->sql_fetchrow($result)) - { - // Do not prune bots and the user currently pruning. - if ($row['user_id'] != $user->data['user_id'] && !in_array($row['user_id'], $bot_ids)) + while ($row = $db->sql_fetchrow($result)) { - $user_ids[] = $row['user_id']; - $usernames[$row['user_id']] = $row['username']; + // Do not prune bots and the user currently pruning. + if ($row['user_id'] != $user->data['user_id'] && !in_array($row['user_id'], $bot_ids)) + { + $user_ids[] = $row['user_id']; + $usernames[$row['user_id']] = $row['username']; + } } + $db->sql_freeresult($result); } - $db->sql_freeresult($result); if ($group_id) { $sql = 'SELECT u.user_id, u.username FROM ' . USER_GROUP_TABLE . ' ug, ' . USERS_TABLE . ' u WHERE ug.group_id = ' . (int) $group_id . ' - AND ug.user_pending = 0 - AND ' . $db->sql_in_set('ug.user_id', $user_ids, false, true) . ' + AND ug.user_id <> ' . ANONYMOUS . ' + AND u.user_type <> ' . USER_FOUNDER . ' + AND ug.user_pending = 0 ' . + ((!empty($user_ids)) ? 'AND ' . $db->sql_in_set('ug.user_id', $user_ids) : '') . ' AND u.user_id = ug.user_id'; $result = $db->sql_query($sql); @@ -505,28 +518,39 @@ class acp_prune $user_ids = $usernames = array(); while ($row = $db->sql_fetchrow($result)) { - $user_ids[] = $row['user_id']; - $usernames[$row['user_id']] = $row['username']; + // Do not prune bots and the user currently pruning. + if ($row['user_id'] != $user->data['user_id'] && !in_array($row['user_id'], $bot_ids)) + { + $user_ids[] = $row['user_id']; + $usernames[$row['user_id']] = $row['username']; + } } $db->sql_freeresult($result); } - if ($posts_on_queue) + if ($posts_on_queue !== false) { $sql = 'SELECT u.user_id, u.username, COUNT(p.post_id) AS queue_posts FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . ' u - WHERE ' . $db->sql_in_set('p.poster_id', $user_ids, false, true) . ' + WHERE u.user_id <> ' . ANONYMOUS . ' + AND u.user_type <> ' . USER_FOUNDER . + ((!empty($user_ids)) ? 'AND ' . $db->sql_in_set('p.poster_id', $user_ids) : '') . ' + AND p.post_visibility = ' . ITEM_UNAPPROVED . ' AND u.user_id = p.poster_id GROUP BY p.poster_id HAVING queue_posts ' . $key_match[$queue_select] . ' ' . $posts_on_queue; - $result = $db->sql_query($result); + $result = $db->sql_query($sql); // same intersection logic as the above group ID portion $user_ids = $usernames = array(); while ($row = $db->sql_fetchrow($result)) { - $user_ids[] = $row['user_id']; - $usernames[$row['user_id']] = $row['username']; + // Do not prune bots and the user currently pruning. + if ($row['user_id'] != $user->data['user_id'] && !in_array($row['user_id'], $bot_ids)) + { + $user_ids[] = $row['user_id']; + $usernames[$row['user_id']] = $row['username']; + } } $db->sql_freeresult($result); } diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index fbc1cc1f14..b24adfc586 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -1096,6 +1096,7 @@ class acp_users $deleteall = (isset($_POST['delall'])) ? true : false; $marked = request_var('mark', array(0)); $message = utf8_normalize_nfc(request_var('message', '', true)); + $pagination = $phpbb_container->get('pagination'); // Sort keys $sort_days = request_var('st', 0); @@ -1166,11 +1167,11 @@ class acp_users $start = view_log('user', $log_data, $log_count, $config['topics_per_page'], $start, 0, 0, $user_id, $sql_where, $sql_sort); $base_url = $this->u_action . "&u=$user_id&$u_sort_param"; - phpbb_generate_template_pagination($template, $base_url, 'pagination', 'start', $log_count, $config['topics_per_page'], $start); + $pagination->generate_template_pagination($base_url, 'pagination', 'start', $log_count, $config['topics_per_page'], $start); $template->assign_vars(array( 'S_FEEDBACK' => true, - 'S_ON_PAGE' => phpbb_on_page($template, $user, $base_url, $log_count, $config['topics_per_page'], $start), + 'S_ON_PAGE' => $pagination->on_page($base_url, $log_count, $config['topics_per_page'], $start), 'S_LIMIT_DAYS' => $s_limit_days, 'S_SORT_KEY' => $s_sort_key, @@ -1775,7 +1776,7 @@ class acp_users } else { - $driver = $phpbb_avatar_manager->get_driver($user->data['user_avatar_type']); + $driver = $phpbb_avatar_manager->get_driver($avatar_data['avatar_type']); if ($driver) { $driver->delete($avatar_data); @@ -1998,6 +1999,7 @@ class acp_users $start = request_var('start', 0); $deletemark = (isset($_POST['delmarked'])) ? true : false; $marked = request_var('mark', array(0)); + $pagination = $phpbb_container->get('pagination'); // Sort keys $sort_key = request_var('sk', 'a'); @@ -2134,11 +2136,11 @@ class acp_users $db->sql_freeresult($result); $base_url = $this->u_action . "&u=$user_id&sk=$sort_key&sd=$sort_dir"; - phpbb_generate_template_pagination($template, $base_url, 'pagination', 'start', $num_attachments, $config['topics_per_page'], $start); + $pagination->generate_template_pagination($base_url, 'pagination', 'start', $num_attachments, $config['topics_per_page'], $start); $template->assign_vars(array( 'S_ATTACHMENTS' => true, - 'S_ON_PAGE' => phpbb_on_page($template, $user, $base_url, $num_attachments, $config['topics_per_page'], $start), + 'S_ON_PAGE' => $pagination->on_page($base_url, $num_attachments, $config['topics_per_page'], $start), 'S_SORT_KEY' => $s_sort_key, 'S_SORT_DIR' => $s_sort_dir, )); diff --git a/phpBB/includes/bbcode.php b/phpBB/includes/bbcode.php index c4076a0120..683fbf0fd2 100644 --- a/phpBB/includes/bbcode.php +++ b/phpBB/includes/bbcode.php @@ -362,7 +362,7 @@ class bbcode } // Replace {L_*} lang strings - $bbcode_tpl = preg_replace('/{L_([A-Z_]+)}/e', "(!empty(\$user->lang['\$1'])) ? \$user->lang['\$1'] : ucwords(strtolower(str_replace('_', ' ', '\$1')))", $bbcode_tpl); + $bbcode_tpl = preg_replace('/{L_([A-Z0-9_]+)}/e', "(!empty(\$user->lang['\$1'])) ? \$user->lang['\$1'] : ucwords(strtolower(str_replace('_', ' ', '\$1')))", $bbcode_tpl); if (!empty($rowset[$bbcode_id]['second_pass_replace'])) { @@ -466,7 +466,7 @@ class bbcode 'email' => array('{EMAIL}' => '$1', '{DESCRIPTION}' => '$2') ); - $tpl = preg_replace('/{L_([A-Z_]+)}/e', "(!empty(\$user->lang['\$1'])) ? \$user->lang['\$1'] : ucwords(strtolower(str_replace('_', ' ', '\$1')))", $tpl); + $tpl = preg_replace('/{L_([A-Z0-9_]+)}/e', "(!empty(\$user->lang['\$1'])) ? \$user->lang['\$1'] : ucwords(strtolower(str_replace('_', ' ', '\$1')))", $tpl); if (!empty($replacements[$tpl_name])) { diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 3a915de82b..0d6c7be117 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -2205,225 +2205,6 @@ function tracking_unserialize($string, $max_depth = 3) return $level; } -// Pagination functions -/** -* Generate a pagination link based on the url and the page information -* -* @param string $base_url is url prepended to all links generated within the function -* If you use page numbers inside your controller route, base_url should contains a placeholder (%d) -* for the page. Also be sure to specify the pagination path information into the start_name argument -* @param string $on_page is the page for which we want to generate the link -* @param string $start_name is the name of the parameter containing the first item of the given page (example: start=20) -* If you use page numbers inside your controller route, start name should be the string -* that should be removed for the first page (example: /page/%d) -* @param int $per_page the number of items, posts, etc. to display per page, used to determine the number of pages to produce -* @return URL for the requested page -*/ -function phpbb_generate_page_link($base_url, $on_page, $start_name, $per_page) -{ - - if (strpos($start_name, '%d') !== false) - { - return ($on_page > 1) ? sprintf($base_url, (int) $on_page) : str_replace($start_name, '', $base_url); - } - else - { - $url_delim = (strpos($base_url, '?') === false) ? '?' : ((strpos($base_url, '?') === strlen($base_url) - 1) ? '' : '&'); - return ($on_page > 1) ? $base_url . $url_delim . $start_name . '=' . (($on_page - 1) * $per_page) : $base_url; - } -} - -/** -* Generate template rendered pagination -* Allows full control of rendering of pagination with the template -* -* @param object $template the template object -* @param string $base_url is url prepended to all links generated within the function -* If you use page numbers inside your controller route, base_url should contains a placeholder (%d) -* for the page. Also be sure to specify the pagination path information into the start_name argument -* @param string $block_var_name is the name assigned to the pagination data block within the template (example: <!-- BEGIN pagination -->) -* @param string $start_name is the name of the parameter containing the first item of the given page (example: start=20) -* If you use page numbers inside your controller route, start name should be the string -* that should be removed for the first page (example: /page/%d) -* @param int $num_items the total number of items, posts, etc., used to determine the number of pages to produce -* @param int $per_page the number of items, posts, etc. to display per page, used to determine the number of pages to produce -* @param int $start_item the item which should be considered currently active, used to determine the page we're on -* @param bool $reverse_count determines whether we weight display of the list towards the start (false) or end (true) of the list -* @param bool $ignore_on_page decides whether we enable an active (unlinked) item, used primarily for embedded lists -* @return null -*/ -function phpbb_generate_template_pagination($template, $base_url, $block_var_name, $start_name, $num_items, $per_page, $start_item = 1, $reverse_count = false, $ignore_on_page = false) -{ - // Make sure $per_page is a valid value - $per_page = ($per_page <= 0) ? 1 : $per_page; - $total_pages = ceil($num_items / $per_page); - - if ($total_pages == 1 || !$num_items) - { - return; - } - - $on_page = floor($start_item / $per_page) + 1; - - if ($reverse_count) - { - $start_page = ($total_pages > 5) ? $total_pages - 4 : 1; - $end_page = $total_pages; - } - else - { - // What we're doing here is calculating what the "start" and "end" pages should be. We - // do this by assuming pagination is "centered" around the currently active page with - // the three previous and three next page links displayed. Anything more than that and - // we display the ellipsis, likewise anything less. - // - // $start_page is the page at which we start creating the list. When we have five or less - // pages we start at page 1 since there will be no ellipsis displayed. Anymore than that - // and we calculate the start based on the active page. This is the min/max calculation. - // First (max) would we end up starting on a page less than 1? Next (min) would we end - // up starting so close to the end that we'd not display our minimum number of pages. - // - // $end_page is the last page in the list to display. Like $start_page we use a min/max to - // determine this number. Again at most five pages? Then just display them all. More than - // five and we first (min) determine whether we'd end up listing more pages than exist. - // We then (max) ensure we're displaying the minimum number of pages. - $start_page = ($total_pages > 5) ? min(max(1, $on_page - 3), $total_pages - 4) : 1; - $end_page = ($total_pages > 5) ? max(min($total_pages, $on_page + 3), 5) : $total_pages; - } - - $u_previous_page = $u_next_page = ''; - if ($on_page != 1) - { - $u_previous_page = phpbb_generate_page_link($base_url, $on_page - 1, $start_name, $per_page); - - $template->assign_block_vars($block_var_name, array( - 'PAGE_NUMBER' => '', - 'PAGE_URL' => $u_previous_page, - 'S_IS_CURRENT' => false, - 'S_IS_PREV' => true, - 'S_IS_NEXT' => false, - 'S_IS_ELLIPSIS' => false, - )); - } - - // This do...while exists purely to negate the need for start and end assign_block_vars, i.e. - // to display the first and last page in the list plus any ellipsis. We use this loop to jump - // around a little within the list depending on where we're starting (and ending). - $at_page = 1; - do - { - // We decide whether to display the ellipsis during the loop. The ellipsis is always - // displayed as either the second or penultimate item in the list. So are we at either - // of those points and of course do we even need to display it, i.e. is the list starting - // on at least page 3 and ending three pages before the final item. - $template->assign_block_vars($block_var_name, array( - 'PAGE_NUMBER' => $at_page, - 'PAGE_URL' => phpbb_generate_page_link($base_url, $at_page, $start_name, $per_page), - 'S_IS_CURRENT' => (!$ignore_on_page && $at_page == $on_page), - 'S_IS_NEXT' => false, - 'S_IS_PREV' => false, - 'S_IS_ELLIPSIS' => ($at_page == 2 && $start_page > 2) || ($at_page == $total_pages - 1 && $end_page < $total_pages - 1), - )); - - // We may need to jump around in the list depending on whether we have or need to display - // the ellipsis. Are we on page 2 and are we more than one page away from the start - // of the list? Yes? Then we jump to the start of the list. Likewise are we at the end of - // the list and are there more than two pages left in total? Yes? Then jump to the penultimate - // page (so we can display the ellipsis next pass). Else, increment the counter and keep - // going - if ($at_page == 2 && $at_page < $start_page - 1) - { - $at_page = $start_page; - } - else if ($at_page == $end_page && $end_page < $total_pages - 1) - { - $at_page = $total_pages - 1; - } - else - { - $at_page++; - } - } - while ($at_page <= $total_pages); - - if ($on_page != $total_pages) - { - $u_next_page = phpbb_generate_page_link($base_url, $on_page + 1, $start_name, $per_page); - - $template->assign_block_vars($block_var_name, array( - 'PAGE_NUMBER' => '', - 'PAGE_URL' => $u_next_page, - 'S_IS_CURRENT' => false, - 'S_IS_PREV' => false, - 'S_IS_NEXT' => true, - 'S_IS_ELLIPSIS' => false, - )); - } - - // If the block_var_name is a nested block, we will use the last (most - // inner) block as a prefix for the template variables. If the last block - // name is pagination, the prefix is empty. If the rest of the - // block_var_name is not empty, we will modify the last row of that block - // and add our pagination items. - $tpl_block_name = $tpl_prefix = ''; - if (strrpos($block_var_name, '.') !== false) - { - $tpl_block_name = substr($block_var_name, 0, strrpos($block_var_name, '.')); - $tpl_prefix = strtoupper(substr($block_var_name, strrpos($block_var_name, '.') + 1)); - } - else - { - $tpl_prefix = strtoupper($block_var_name); - } - $tpl_prefix = ($tpl_prefix == 'PAGINATION') ? '' : $tpl_prefix . '_'; - - $template_array = array( - $tpl_prefix . 'BASE_URL' => $base_url, - $tpl_prefix . 'PER_PAGE' => $per_page, - 'U_' . $tpl_prefix . 'PREVIOUS_PAGE' => ($on_page != 1) ? $u_previous_page : '', - 'U_' . $tpl_prefix . 'NEXT_PAGE' => ($on_page != $total_pages) ? $u_next_page : '', - $tpl_prefix . 'TOTAL_PAGES' => $total_pages, - $tpl_prefix . 'CURRENT_PAGE' => $on_page, - ); - - if ($tpl_block_name) - { - $template->alter_block_array($tpl_block_name, $template_array, true, 'change'); - } - else - { - $template->assign_vars($template_array); - } -} - -/** -* Return current page -* This function also sets certain specific template variables -* -* @param object $template the template object -* @param object $user the user object -* @param string $base_url the base url used to call this page, used by Javascript for popup jump to page -* @param int $num_items the total number of items, posts, topics, etc. -* @param int $per_page the number of items, posts, etc. per page -* @param int $start the item which should be considered currently active, used to determine the page we're on -* @return null -*/ -function phpbb_on_page($template, $user, $base_url, $num_items, $per_page, $start) -{ - // Make sure $per_page is a valid value - $per_page = ($per_page <= 0) ? 1 : $per_page; - - $on_page = floor($start / $per_page) + 1; - - $template->assign_vars(array( - 'PER_PAGE' => $per_page, - 'ON_PAGE' => $on_page, - 'BASE_URL' => $base_url, - )); - - return sprintf($user->lang['PAGE_OF'], $on_page, max(ceil($num_items / $per_page), 1)); -} - // Server functions (building urls, redirecting...) /** diff --git a/phpBB/includes/functions_acp.php b/phpBB/includes/functions_acp.php index b9210114ef..cb44ed2794 100644 --- a/phpBB/includes/functions_acp.php +++ b/phpBB/includes/functions_acp.php @@ -363,7 +363,9 @@ function build_cfg_template($tpl_type, $key, &$new, $config_key, $vars) if ($tpl_type[0] == 'select') { - $tpl = '<select id="' . $key . '" name="' . $name . '">' . $return . '</select>'; + $size = (isset($tpl_type[1])) ? (int) $tpl_type[1] : 1; + + $tpl = '<select id="' . $key . '" name="' . $name . '"' . (($size > 1) ? ' size="' . $size . '"' : '') . '>' . $return . '</select>'; } else { diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index f03e4c01d0..e663ac90c5 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -919,7 +919,7 @@ function topic_status(&$topic_row, $replies, $unread_topic, &$folder_img, &$fold /** * Assign/Build custom bbcodes for display in screens supporting using of bbcodes -* The custom bbcodes buttons will be placed within the template block 'custom_codes' +* The custom bbcodes buttons will be placed within the template block 'custom_tags' */ function display_custom_bbcodes() { @@ -928,11 +928,26 @@ function display_custom_bbcodes() // Start counting from 22 for the bbcode ids (every bbcode takes two ids - opening/closing) $num_predefined_bbcodes = 22; - $sql = 'SELECT bbcode_id, bbcode_tag, bbcode_helpline - FROM ' . BBCODES_TABLE . ' - WHERE display_on_posting = 1 - ORDER BY bbcode_tag'; - $result = $db->sql_query($sql); + $sql_ary = array( + 'SELECT' => 'b.bbcode_id, b.bbcode_tag, b.bbcode_helpline', + 'FROM' => array(BBCODES_TABLE => 'b'), + 'WHERE' => 'b.display_on_posting = 1', + 'ORDER_BY' => 'b.bbcode_tag', + ); + + /** + * Event to modify the SQL query before custom bbcode data is queried + * + * @event core.display_custom_bbcodes_modify_sql + * @var array sql_ary The SQL array to get the bbcode data + * @var int num_predefined_bbcodes The number of predefined core bbcodes + * (multiplied by factor of 2) + * @since 3.1.0-a3 + */ + $vars = array('sql_ary', 'num_predefined_bbcodes'); + extract($phpbb_dispatcher->trigger_event('core.display_custom_bbcodes_modify_sql', compact($vars))); + + $result = $db->sql_query($db->sql_build_query('SELECT', $sql_ary)); $i = 0; while ($row = $db->sql_fetchrow($result)) @@ -952,7 +967,7 @@ function display_custom_bbcodes() ); /** - * Modify the template data block of a bbcode + * Event to modify the template data block of a custom bbcode * * This event is triggered once per bbcode * @@ -1167,7 +1182,12 @@ function watch_topic_forum($mode, &$s_watching, $user_id, $forum_id, $topic_id, if ($uid != $user_id || $request->variable('unwatch', '', false, \phpbb\request\request_interface::GET) != $mode) { $redirect_url = append_sid("{$phpbb_root_path}view$mode.$phpEx", "$u_url=$match_id&start=$start"); - $message = $user->lang['ERR_UNWATCHING'] . '<br /><br />' . sprintf($user->lang['RETURN_' . strtoupper($mode)], '<a href="' . $redirect_url . '">', '</a>'); + $message = $user->lang['ERR_UNWATCHING']; + + if (!$request->is_ajax()) + { + $message .= '<br /><br />' . $user->lang('RETURN_' . strtoupper($mode), '<a href="' . $redirect_url . '">', '</a>'); + } trigger_error($message); } @@ -1177,8 +1197,12 @@ function watch_topic_forum($mode, &$s_watching, $user_id, $forum_id, $topic_id, $db->sql_query($sql); $redirect_url = append_sid("{$phpbb_root_path}view$mode.$phpEx", "$u_url=$match_id&start=$start"); - $message = $user->lang['NOT_WATCHING_' . strtoupper($mode)] . '<br /><br />'; - $message .= sprintf($user->lang['RETURN_' . strtoupper($mode)], '<a href="' . $redirect_url . '">', '</a>'); + $message = $user->lang['NOT_WATCHING_' . strtoupper($mode)]; + + if (!$request->is_ajax()) + { + $message .= '<br /><br />' . $user->lang('RETURN_' . strtoupper($mode), '<a href="' . $redirect_url . '">', '</a>'); + } meta_refresh(3, $redirect_url); trigger_error($message); } @@ -1232,7 +1256,12 @@ function watch_topic_forum($mode, &$s_watching, $user_id, $forum_id, $topic_id, if ($uid != $user_id || $request->variable('watch', '', false, \phpbb\request\request_interface::GET) != $mode) { $redirect_url = append_sid("{$phpbb_root_path}view$mode.$phpEx", "$u_url=$match_id&start=$start"); - $message = $user->lang['ERR_WATCHING'] . '<br /><br />' . sprintf($user->lang['RETURN_' . strtoupper($mode)], '<a href="' . $redirect_url . '">', '</a>'); + $message = $user->lang['ERR_WATCHING']; + + if (!$request->is_ajax()) + { + $message .= '<br /><br />' . $user->lang('RETURN_' . strtoupper($mode), '<a href="' . $redirect_url . '">', '</a>'); + } trigger_error($message); } @@ -1243,7 +1272,12 @@ function watch_topic_forum($mode, &$s_watching, $user_id, $forum_id, $topic_id, $db->sql_query($sql); $redirect_url = append_sid("{$phpbb_root_path}view$mode.$phpEx", "$u_url=$match_id&start=$start"); - $message = $user->lang['ARE_WATCHING_' . strtoupper($mode)] . '<br /><br />' . sprintf($user->lang['RETURN_' . strtoupper($mode)], '<a href="' . $redirect_url . '">', '</a>'); + $message = $user->lang['ARE_WATCHING_' . strtoupper($mode)]; + + if (!$request->is_ajax()) + { + $message .= '<br /><br />' . $user->lang('RETURN_' . strtoupper($mode), '<a href="' . $redirect_url . '">', '</a>'); + } meta_refresh(3, $redirect_url); trigger_error($message); } @@ -1445,6 +1479,8 @@ function phpbb_gen_download_links($param_key, $param_val, $phpbb_root_path, $php } $methods = compress::methods(); + // Sort by preferred type. + $methods = array_intersect(array('.zip', '.tar.bz2', '.tar.gz', '.tar'), $methods); $links = array(); foreach ($methods as $method) diff --git a/phpBB/includes/functions_module.php b/phpBB/includes/functions_module.php index dca720c36e..e1259eba12 100644 --- a/phpBB/includes/functions_module.php +++ b/phpBB/includes/functions_module.php @@ -528,12 +528,12 @@ class p_master * the style paths for the extension (the ext author can change them * if necessary). */ - $module_dir = explode('_', get_class($this->module)); + $module_dir = explode('\\', get_class($this->module)); - // 0 phpbb, 1 ext, 2 vendor, 3 extension name, ... - if (isset($module_dir[3]) && $module_dir[1] === 'ext') + // 0 vendor, 1 extension name, ... + if (isset($module_dir[1])) { - $module_style_dir = 'ext/' . $module_dir[2] . '/' . $module_dir[3] . '/styles'; + $module_style_dir = 'ext/' . $module_dir[0] . '/' . $module_dir[1] . '/styles'; if (is_dir($phpbb_root_path . $module_style_dir)) { diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index 1bcef7f1f2..172f4403ac 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -1473,7 +1473,7 @@ function delete_post($forum_id, $topic_id, $post_id, &$data, $is_soft = false, $ */ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $update_message = true, $update_search_index = true) { - global $db, $auth, $user, $config, $phpEx, $template, $phpbb_root_path, $phpbb_container; + global $db, $auth, $user, $config, $phpEx, $template, $phpbb_root_path, $phpbb_container, $phpbb_dispatcher; // We do not handle erasing posts here if ($mode == 'delete') @@ -2305,6 +2305,23 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u $url = (!$params) ? "{$phpbb_root_path}viewforum.$phpEx" : "{$phpbb_root_path}viewtopic.$phpEx"; $url = append_sid($url, 'f=' . $data['forum_id'] . $params) . $add_anchor; + /** + * This event is used for performing actions directly after a post or topic + * has been submitted. When a new topic is posted, the topic ID is + * available in the $data array. + * + * The only action that can be done by altering data made available to this + * event is to modify the return URL ($url). + * + * @event core.submit_post_end + * @var string url The "Return to topic" URL + * @var array data Array of post data about the + * submitted post + * @since 3.1-A3 + */ + $vars = array('url', 'data'); + extract($phpbb_dispatcher->trigger_event('core.submit_post_end', compact($vars))); + return $url; } diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index 30891c3fb5..dba6d3d6c2 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -213,7 +213,7 @@ function user_add($user_row, $cp_data = false) 'user_occ' => '', 'user_interests' => '', 'user_avatar' => '', - 'user_avatar_type' => 0, + 'user_avatar_type' => '', 'user_avatar_width' => 0, 'user_avatar_height' => 0, 'user_new_privmsg' => 0, @@ -281,8 +281,9 @@ function user_add($user_row, $cp_data = false) include_once($phpbb_root_path . 'includes/functions_profile_fields.' . $phpEx); } + $cp = new custom_profile(); $sql = 'INSERT INTO ' . PROFILE_FIELDS_DATA_TABLE . ' ' . - $db->sql_build_array('INSERT', custom_profile::build_insert_sql_array($cp_data)); + $db->sql_build_array('INSERT', $cp->build_insert_sql_array($cp_data)); $db->sql_query($sql); } @@ -463,7 +464,7 @@ function user_delete($mode, $user_ids, $retain_username = true) $added_guest_posts = 0; foreach ($user_rows as $user_id => $user_row) { - if ($user_row['user_avatar'] && $user_row['user_avatar_type'] == AVATAR_UPLOAD) + if ($user_row['user_avatar'] && $user_row['user_avatar_type'] == 'avatar.driver.upload') { avatar_delete('user', $user_row); } @@ -2314,7 +2315,7 @@ function group_create(&$group_id, $type, $name, $desc, $group_attributes, $allow { $group_id = $db->sql_nextid(); - if (isset($sql_ary['group_avatar_type']) && $sql_ary['group_avatar_type'] == AVATAR_UPLOAD) + if (isset($sql_ary['group_avatar_type']) && $sql_ary['group_avatar_type'] == 'avatar.driver.upload') { group_correct_avatar($group_id, $sql_ary['group_avatar']); } @@ -2415,7 +2416,7 @@ function avatar_remove_db($avatar_name) $sql = 'UPDATE ' . USERS_TABLE . " SET user_avatar = '', - user_avatar_type = 0 + user_avatar_type = '' WHERE user_avatar = '" . $db->sql_escape($avatar_name) . '\''; $db->sql_query($sql); } @@ -2825,7 +2826,7 @@ function remove_default_avatar($group_id, $user_ids) $sql = 'UPDATE ' . USERS_TABLE . " SET user_avatar = '', - user_avatar_type = 0, + user_avatar_type = '', user_avatar_width = 0, user_avatar_height = 0 WHERE group_id = " . (int) $group_id . " @@ -3083,7 +3084,7 @@ function group_set_user_default($group_id, $user_id_ary, $group_attributes = fal 'group_colour' => 'string', 'group_rank' => 'int', 'group_avatar' => 'string', - 'group_avatar_type' => 'int', + 'group_avatar_type' => 'string', 'group_avatar_width' => 'int', 'group_avatar_height' => 'int', ); diff --git a/phpBB/includes/mcp/mcp_forum.php b/phpBB/includes/mcp/mcp_forum.php index d0d13aaf13..a3b2184d48 100644 --- a/phpBB/includes/mcp/mcp_forum.php +++ b/phpBB/includes/mcp/mcp_forum.php @@ -73,6 +73,8 @@ function mcp_forum_view($id, $mode, $action, $forum_info) break; } + $pagination = $phpbb_container->get('pagination'); + $selected_ids = ''; if (sizeof($post_id_list) && $action != 'merge_topics') { @@ -102,7 +104,7 @@ function mcp_forum_view($id, $mode, $action, $forum_info) $limit_time_sql = ($sort_days) ? 'AND t.topic_last_post_time >= ' . (time() - ($sort_days * 86400)) : ''; $base_url = $url . "&i=$id&action=$action&mode=$mode&sd=$sort_dir&sk=$sort_key&st=$sort_days" . (($merge_select) ? $selected_ids : ''); - phpbb_generate_template_pagination($template, $base_url, 'pagination', 'start', $forum_topics, $topics_per_page, $start); + $pagination->generate_template_pagination($base_url, 'pagination', 'start', $forum_topics, $topics_per_page, $start); $template->assign_vars(array( 'ACTION' => $action, @@ -133,7 +135,7 @@ function mcp_forum_view($id, $mode, $action, $forum_info) 'S_MCP_ACTION' => $url . "&i=$id&forum_action=$action&mode=$mode&start=$start" . (($merge_select) ? $selected_ids : ''), - 'PAGE_NUMBER' => phpbb_on_page($template, $user, $base_url, $forum_topics, $topics_per_page, $start), + 'PAGE_NUMBER' => $pagination->on_page($base_url, $forum_topics, $topics_per_page, $start), 'TOTAL_TOPICS' => $user->lang('VIEW_FORUM_TOPICS', (int) $forum_topics), )); diff --git a/phpBB/includes/mcp/mcp_logs.php b/phpBB/includes/mcp/mcp_logs.php index f706840492..ac7896606a 100644 --- a/phpBB/includes/mcp/mcp_logs.php +++ b/phpBB/includes/mcp/mcp_logs.php @@ -33,7 +33,7 @@ class mcp_logs function main($id, $mode) { global $auth, $db, $user, $template; - global $config, $phpbb_root_path, $phpEx; + global $config, $phpbb_root_path, $phpEx, $phpbb_container; $user->add_lang('acp/common'); @@ -62,6 +62,8 @@ class mcp_logs $this->tpl_name = 'mcp_logs'; $this->page_title = 'MCP_LOGS'; + $pagination = $phpbb_container->get('pagination'); + $forum_list = array_values(array_intersect(get_forum_list('f_read'), get_forum_list('m_'))); $forum_list[] = 0; @@ -172,10 +174,10 @@ class mcp_logs $start = view_log('mod', $log_data, $log_count, $config['topics_per_page'], $start, $forum_list, $topic_id, 0, $sql_where, $sql_sort, $keywords); $base_url = $this->u_action . "&$u_sort_param$keywords_param"; - phpbb_generate_template_pagination($template, $base_url, 'pagination', 'start', $log_count, $config['topics_per_page'], $start); + $pagination->generate_template_pagination($base_url, 'pagination', 'start', $log_count, $config['topics_per_page'], $start); $template->assign_vars(array( - 'PAGE_NUMBER' => phpbb_on_page($template, $user, $base_url, $log_count, $config['topics_per_page'], $start), + 'PAGE_NUMBER' => $pagination->on_page($base_url, $log_count, $config['topics_per_page'], $start), 'TOTAL' => $user->lang('TOTAL_LOGS', (int) $log_count), 'L_TITLE' => $user->lang['MCP_LOGS'], diff --git a/phpBB/includes/mcp/mcp_main.php b/phpBB/includes/mcp/mcp_main.php index 7a22c31248..d9197da07e 100644 --- a/phpBB/includes/mcp/mcp_main.php +++ b/phpBB/includes/mcp/mcp_main.php @@ -219,7 +219,7 @@ class mcp_main */ function lock_unlock($action, $ids) { - global $auth, $user, $db, $phpEx, $phpbb_root_path; + global $auth, $user, $db, $phpEx, $phpbb_root_path, $request; if ($action == 'lock' || $action == 'unlock') { @@ -256,6 +256,7 @@ function lock_unlock($action, $ids) unset($orig_ids); $redirect = request_var('redirect', build_url(array('action', 'quickmod'))); + $redirect = reapply_sid($redirect); $s_hidden_fields = build_hidden_fields(array( $sql_id . '_list' => $ids, @@ -279,24 +280,22 @@ function lock_unlock($action, $ids) } $success_msg = $l_prefix . ((sizeof($ids) == 1) ? '' : 'S') . '_' . (($action == 'lock' || $action == 'lock_post') ? 'LOCKED' : 'UNLOCKED') . '_SUCCESS'; - } - else - { - confirm_box(false, strtoupper($action) . '_' . $l_prefix . ((sizeof($ids) == 1) ? '' : 'S'), $s_hidden_fields); - } - $redirect = request_var('redirect', "index.$phpEx"); - $redirect = reapply_sid($redirect); + meta_refresh(2, $redirect); + $message = $user->lang[$success_msg]; - if (!$success_msg) - { - redirect($redirect); + if (!$request->is_ajax()) + { + $message .= '<br /><br />' . $user->lang('RETURN_PAGE', '<a href="' . $redirect . '">', '</a>'); + } + trigger_error($message); } else { - meta_refresh(2, $redirect); - trigger_error($user->lang[$success_msg] . '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], '<a href="' . $redirect . '">', '</a>')); + confirm_box(false, strtoupper($action) . '_' . $l_prefix . ((sizeof($ids) == 1) ? '' : 'S'), $s_hidden_fields); } + + redirect($redirect); } /** @@ -304,7 +303,7 @@ function lock_unlock($action, $ids) */ function change_topic_type($action, $topic_ids) { - global $auth, $user, $db, $phpEx, $phpbb_root_path; + global $auth, $user, $db, $phpEx, $phpbb_root_path, $request; switch ($action) { @@ -341,6 +340,7 @@ function change_topic_type($action, $topic_ids) } $redirect = request_var('redirect', build_url(array('action', 'quickmod'))); + $redirect = reapply_sid($redirect); $s_hidden_fields = array( 'topic_id_list' => $topic_ids, @@ -381,24 +381,22 @@ function change_topic_type($action, $topic_ids) add_log('mod', $forum_id, $topic_id, 'LOG_TOPIC_TYPE_CHANGED', $row['topic_title']); } } - } - else - { - confirm_box(false, $l_new_type, build_hidden_fields($s_hidden_fields)); - } - $redirect = request_var('redirect', "index.$phpEx"); - $redirect = reapply_sid($redirect); + meta_refresh(2, $redirect); + $message = $user->lang[$success_msg]; - if (!$success_msg) - { - redirect($redirect); + if (!$request->is_ajax()) + { + $message .= '<br /><br />' . $user->lang('RETURN_PAGE', '<a href="' . $redirect . '">', '</a>'); + } + trigger_error($message); } else { - meta_refresh(2, $redirect); - trigger_error($user->lang[$success_msg] . '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], '<a href="' . $redirect . '">', '</a>')); + confirm_box(false, $l_new_type, build_hidden_fields($s_hidden_fields)); } + + redirect($redirect); } /** diff --git a/phpBB/includes/mcp/mcp_notes.php b/phpBB/includes/mcp/mcp_notes.php index 12fcbfe91e..055ca0e882 100644 --- a/phpBB/includes/mcp/mcp_notes.php +++ b/phpBB/includes/mcp/mcp_notes.php @@ -72,7 +72,7 @@ class mcp_notes function mcp_notes_user_view($action) { global $phpEx, $phpbb_root_path, $config; - global $template, $db, $user, $auth; + global $template, $db, $user, $auth, $phpbb_container; $user_id = request_var('u', 0); $username = request_var('username', '', true); @@ -80,6 +80,7 @@ class mcp_notes $st = request_var('st', 0); $sk = request_var('sk', 'b'); $sd = request_var('sd', 'd'); + $pagination = $phpbb_container->get('pagination'); add_form_key('mcp_notes'); @@ -216,7 +217,7 @@ class mcp_notes } $base_url = $this->u_action . "&$u_sort_param$keywords_param"; - phpbb_generate_template_pagination($template, $base_url, 'pagination', 'start', $log_count, $config['topics_per_page'], $start); + $pagination->generate_template_pagination($base_url, 'pagination', 'start', $log_count, $config['topics_per_page'], $start); $template->assign_vars(array( 'U_POST_ACTION' => $this->u_action, @@ -228,7 +229,7 @@ class mcp_notes 'L_TITLE' => $user->lang['MCP_NOTES_USER'], - 'PAGE_NUMBER' => phpbb_on_page($template, $user, $base_url, $log_count, $config['topics_per_page'], $start), + 'PAGE_NUMBER' => $pagination->on_page($base_url, $log_count, $config['topics_per_page'], $start), 'TOTAL_REPORTS' => $user->lang('LIST_REPORTS', (int) $log_count), 'RANK_TITLE' => $rank_title, diff --git a/phpBB/includes/mcp/mcp_pm_reports.php b/phpBB/includes/mcp/mcp_pm_reports.php index f0452b37a5..d0801a2b47 100644 --- a/phpBB/includes/mcp/mcp_pm_reports.php +++ b/phpBB/includes/mcp/mcp_pm_reports.php @@ -39,6 +39,7 @@ class mcp_pm_reports include_once($phpbb_root_path . 'includes/functions_privmsgs.' . $phpEx); $start = request_var('start', 0); + $pagination = $phpbb_container->get('pagination'); $this->page_title = 'MCP_PM_REPORTS'; @@ -297,7 +298,7 @@ class mcp_pm_reports } $base_url = $this->u_action . "&st=$sort_days&sk=$sort_key&sd=$sort_dir"; - phpbb_generate_template_pagination($template, $base_url, 'pagination', 'start', $total, $config['topics_per_page'], $start); + $pagination->generate_template_pagination($base_url, 'pagination', 'start', $total, $config['topics_per_page'], $start); // Now display the page $template->assign_vars(array( @@ -308,7 +309,7 @@ class mcp_pm_reports 'S_MCP_ACTION' => $this->u_action, 'S_CLOSED' => ($mode == 'pm_reports_closed') ? true : false, - 'PAGE_NUMBER' => phpbb_on_page($template, $user, $base_url, $total, $config['topics_per_page'], $start), + 'PAGE_NUMBER' => $pagination->on_page($base_url, $total, $config['topics_per_page'], $start), 'TOTAL' => $total, 'TOTAL_REPORTS' => $user->lang('LIST_REPORTS', (int) $total), ) diff --git a/phpBB/includes/mcp/mcp_queue.php b/phpBB/includes/mcp/mcp_queue.php index e93cc1fe9e..9f9c22a5c5 100644 --- a/phpBB/includes/mcp/mcp_queue.php +++ b/phpBB/includes/mcp/mcp_queue.php @@ -337,6 +337,7 @@ class mcp_queue $topic_id = $request->variable('t', 0); $forum_info = array(); + $pagination = $phpbb_container->get('pagination'); if ($topic_id) { @@ -532,7 +533,7 @@ class mcp_queue unset($rowset, $forum_names); $base_url = $this->u_action . "&f=$forum_id&st=$sort_days&sk=$sort_key&sd=$sort_dir"; - phpbb_generate_template_pagination($template, $base_url, 'pagination', 'start', $total, $config['topics_per_page'], $start); + $pagination->generate_template_pagination($base_url, 'pagination', 'start', $total, $config['topics_per_page'], $start); // Now display the page $template->assign_vars(array( @@ -546,7 +547,7 @@ class mcp_queue 'S_TOPICS' => $is_topics, 'S_RESTORE' => $is_restore, - 'PAGE_NUMBER' => phpbb_on_page($template, $user, $base_url, $total, $config['topics_per_page'], $start), + 'PAGE_NUMBER' => $pagination->on_page($base_url, $total, $config['topics_per_page'], $start), 'TOPIC_ID' => $topic_id, 'TOTAL' => $user->lang(((!$is_topics) ? 'VIEW_TOPIC_POSTS' : 'VIEW_FORUM_TOPICS'), (int) $total), )); @@ -576,6 +577,7 @@ class mcp_queue } $redirect = $request->variable('redirect', build_url(array('quickmod'))); + $redirect = reapply_sid($redirect); $success_msg = $post_url = ''; $approve_log = array(); @@ -683,6 +685,28 @@ class mcp_queue } } } + + meta_refresh(3, $redirect); + $message = $user->lang[$success_msg]; + + 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, + 'visible' => true, + )); + } + $message .= '<br /><br />' . $user->lang('RETURN_PAGE', '<a href="' . $redirect . '">', '</a>'); + + // If approving one post, also give links back to post... + if (sizeof($post_info) == 1 && $post_url) + { + $message .= '<br /><br />' . $user->lang('RETURN_POST', '<a href="' . $post_url . '">', '</a>'); + } + trigger_error($message); } else { @@ -712,39 +736,7 @@ class mcp_queue confirm_box(false, strtoupper($action) . '_POST' . ((sizeof($post_id_list) == 1) ? '' : 'S'), $s_hidden_fields, 'mcp_approve.html'); } - $redirect = $request->variable('redirect', "index.$phpEx"); - $redirect = reapply_sid($redirect); - - if (!$success_msg) - { - redirect($redirect); - } - else - { - meta_refresh(3, $redirect); - - // If approving one post, also give links back to post... - $add_message = ''; - if (sizeof($post_info) == 1 && $post_url) - { - $add_message = '<br /><br />' . sprintf($user->lang['RETURN_POST'], '<a href="' . $post_url . '">', '</a>'); - } - - $message = $user->lang[$success_msg] . '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], '<a href="' . $redirect . '">', '</a>') . $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, - 'visible' => true, - )); - } - - trigger_error($message); - } + redirect($redirect); } /** @@ -767,6 +759,7 @@ class mcp_queue } $redirect = $request->variable('redirect', build_url(array('quickmod'))); + $redirect = reapply_sid($redirect); $success_msg = $topic_url = ''; $approve_log = array(); @@ -854,6 +847,28 @@ class mcp_queue } } } + + meta_refresh(3, $redirect); + $message = $user->lang[$success_msg]; + + 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, + 'visible' => true, + )); + } + $message .= '<br /><br />' . $user->lang('RETURN_PAGE', '<a href="' . $redirect . '">', '</a>'); + + // If approving one topic, also give links back to topic... + if (sizeof($topic_info) == 1 && $topic_url) + { + $message .= '<br /><br />' . $user->lang('RETURN_TOPIC', '<a href="' . $topic_url . '">', '</a>'); + } + trigger_error($message); } else { @@ -883,39 +898,7 @@ class mcp_queue confirm_box(false, strtoupper($action) . '_TOPIC' . ((sizeof($topic_id_list) == 1) ? '' : 'S'), $s_hidden_fields, 'mcp_approve.html'); } - $redirect = $request->variable('redirect', "index.$phpEx"); - $redirect = reapply_sid($redirect); - - if (!$success_msg) - { - redirect($redirect); - } - else - { - meta_refresh(3, $redirect); - - // If approving one topic, also give links back to topic... - $add_message = ''; - if (sizeof($topic_info) == 1 && $topic_url) - { - $add_message = '<br /><br />' . sprintf($user->lang['RETURN_TOPIC'], '<a href="' . $topic_url . '">', '</a>'); - } - - $message = $user->lang[$success_msg] . '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], '<a href="' . $redirect . '">', '</a>') . $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, - 'visible' => true, - )); - } - - trigger_error($message); - } + redirect($redirect); } /** @@ -937,6 +920,7 @@ class mcp_queue } $redirect = $request->variable('redirect', build_url(array('t', 'mode', 'quickmod')) . "&mode=$mode"); + $redirect = reapply_sid($redirect); $reason = $request->variable('reason', '', true); $reason_id = $request->variable('reason_id', 0); $success_msg = $additional_msg = ''; @@ -1179,6 +1163,22 @@ class mcp_queue { $success_msg .= '_DELETED_SUCCESS'; } + + meta_refresh(3, $redirect); + $message = $user->lang[$success_msg]; + + 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, + 'visible' => false, + )); + } + $message .= '<br /><br />' . $user->lang('RETURN_PAGE', '<a href="' . $redirect . '">', '</a>'); + trigger_error($message); } else { @@ -1227,30 +1227,6 @@ class mcp_queue confirm_box(false, $l_confirm_msg, $s_hidden_fields, $confirm_template); } - $redirect = $request->variable('redirect', "index.$phpEx"); - $redirect = reapply_sid($redirect); - - if (!$success_msg) - { - redirect($redirect); - } - else - { - $message = $user->lang[$success_msg] . '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], '<a href="' . $redirect . '">', '</a>'); - - 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, - 'visible' => false, - )); - } - - meta_refresh(3, $redirect); - trigger_error($message); - } + redirect($redirect); } } diff --git a/phpBB/includes/mcp/mcp_reports.php b/phpBB/includes/mcp/mcp_reports.php index 566284e411..954f8a8349 100644 --- a/phpBB/includes/mcp/mcp_reports.php +++ b/phpBB/includes/mcp/mcp_reports.php @@ -315,6 +315,7 @@ class mcp_reports $forum_list[] = 0; $forum_data = array(); + $pagination = $phpbb_container->get('pagination'); $forum_options = '<option value="0"' . (($forum_id == 0) ? ' selected="selected"' : '') . '>' . $user->lang['ALL_FORUMS'] . '</option>'; foreach ($forum_list_reports as $row) @@ -410,7 +411,7 @@ class mcp_reports } $base_url = $this->u_action . "&f=$forum_id&t=$topic_id&st=$sort_days&sk=$sort_key&sd=$sort_dir"; - phpbb_generate_template_pagination($template, $base_url, 'pagination', 'start', $total, $config['topics_per_page'], $start); + $pagination->generate_template_pagination($base_url, 'pagination', 'start', $total, $config['topics_per_page'], $start); // Now display the page $template->assign_vars(array( @@ -422,7 +423,7 @@ class mcp_reports 'S_FORUM_OPTIONS' => $forum_options, 'S_CLOSED' => ($mode == 'reports_closed') ? true : false, - 'PAGE_NUMBER' => phpbb_on_page($template, $user, $base_url, $total, $config['topics_per_page'], $start), + 'PAGE_NUMBER' => $pagination->on_page($base_url, $total, $config['topics_per_page'], $start), 'TOPIC_ID' => $topic_id, 'TOTAL' => $total, 'TOTAL_REPORTS' => $user->lang('LIST_REPORTS', (int) $total), diff --git a/phpBB/includes/mcp/mcp_topic.php b/phpBB/includes/mcp/mcp_topic.php index a2aa03c583..a4c561a3bf 100644 --- a/phpBB/includes/mcp/mcp_topic.php +++ b/phpBB/includes/mcp/mcp_topic.php @@ -26,6 +26,7 @@ function mcp_topic_view($id, $mode, $action) $url = append_sid("{$phpbb_root_path}mcp.$phpEx?" . extra_url()); $user->add_lang('viewtopic'); + $pagination = $phpbb_container->get('pagination'); $topic_id = request_var('t', 0); $topic_info = get_topic_data(array($topic_id), false, true); @@ -129,12 +130,7 @@ function mcp_topic_view($id, $mode, $action) { $start = 0; } - - // Make sure $start is set to the last page if it exceeds the amount - if ($start < 0 || $start >= $total) - { - $start = ($start < 0) ? 0 : floor(($total - 1) / $posts_per_page) * $posts_per_page; - } + $start = $pagination->validate_start($start, $posts_per_page, $total); $sql = 'SELECT u.username, u.username_clean, u.user_colour, p.* FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . ' u @@ -304,7 +300,7 @@ function mcp_topic_view($id, $mode, $action) $base_url = append_sid("{$phpbb_root_path}mcp.$phpEx", "i=$id&t={$topic_info['topic_id']}&mode=$mode&action=$action&to_topic_id=$to_topic_id&posts_per_page=$posts_per_page&st=$sort_days&sk=$sort_key&sd=$sort_dir"); if ($posts_per_page) { - phpbb_generate_template_pagination($template, $base_url, 'pagination', 'start', $total, $posts_per_page, $start); + $pagination->generate_template_pagination($base_url, 'pagination', 'start', $total, $posts_per_page, $start); } $template->assign_vars(array( @@ -347,7 +343,7 @@ function mcp_topic_view($id, $mode, $action) 'RETURN_TOPIC' => sprintf($user->lang['RETURN_TOPIC'], '<a href="' . append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f={$topic_info['forum_id']}&t={$topic_info['topic_id']}&start=$start") . '">', '</a>'), 'RETURN_FORUM' => sprintf($user->lang['RETURN_FORUM'], '<a href="' . append_sid("{$phpbb_root_path}viewforum.$phpEx", "f={$topic_info['forum_id']}&start=$start") . '">', '</a>'), - 'PAGE_NUMBER' => phpbb_on_page($template, $user, $base_url, $total, $posts_per_page, $start), + 'PAGE_NUMBER' => $pagination->on_page($base_url, $total, $posts_per_page, $start), 'TOTAL_POSTS' => $user->lang('VIEW_TOPIC_POSTS', (int) $total), )); } diff --git a/phpBB/includes/mcp/mcp_warn.php b/phpBB/includes/mcp/mcp_warn.php index 3ffd75ac78..e39bddec5b 100644 --- a/phpBB/includes/mcp/mcp_warn.php +++ b/phpBB/includes/mcp/mcp_warn.php @@ -134,10 +134,11 @@ class mcp_warn */ function mcp_warn_list_view($action) { - global $phpEx, $phpbb_root_path, $config; + global $phpEx, $phpbb_root_path, $config, $phpbb_container; global $template, $db, $user, $auth; $user->add_lang('memberlist'); + $pagination = $phpbb_container->get('pagination'); $start = request_var('start', 0); $st = request_var('st', 0); @@ -176,7 +177,7 @@ class mcp_warn } $base_url = append_sid("{$phpbb_root_path}mcp.$phpEx", "i=warn&mode=list&st=$st&sk=$sk&sd=$sd"); - phpbb_generate_template_pagination($template, $base_url, 'pagination', 'start', $user_count, $config['topics_per_page'], $start); + $pagination->generate_template_pagination($base_url, 'pagination', 'start', $user_count, $config['topics_per_page'], $start); $template->assign_vars(array( 'U_POST_ACTION' => $this->u_action, @@ -185,7 +186,7 @@ class mcp_warn 'S_SELECT_SORT_KEY' => $s_sort_key, 'S_SELECT_SORT_DAYS' => $s_limit_days, - 'PAGE_NUMBER' => phpbb_on_page($template, $user, $base_url, $user_count, $config['topics_per_page'], $start), + 'PAGE_NUMBER' => $pagination->on_page($base_url, $user_count, $config['topics_per_page'], $start), 'TOTAL_USERS' => $user->lang('LIST_USERS', (int) $user_count), )); } diff --git a/phpBB/includes/message_parser.php b/phpBB/includes/message_parser.php index acd31fd519..b29f587385 100644 --- a/phpBB/includes/message_parser.php +++ b/phpBB/includes/message_parser.php @@ -103,6 +103,8 @@ class bbcode_firstpass extends bbcode */ function bbcode_init($allow_custom_bbcode = true) { + global $phpbb_dispatcher; + static $rowset; // This array holds all bbcode data. BBCodes will be processed in this @@ -162,6 +164,21 @@ class bbcode_firstpass extends bbcode 'regexp' => array($row['first_pass_match'] => str_replace('$uid', $this->bbcode_uid, $row['first_pass_replace'])) ); } + + $bbcodes = $this->bbcodes; + + /** + * Event to modify the bbcode data for later parsing + * + * @event core.modify_bbcode_init + * @var array bbcodes Array of bbcode data for use in parsing + * @var array rowset Array of bbcode data from the database + * @since 3.1.0-a3 + */ + $vars = array('bbcodes', 'rowset'); + extract($phpbb_dispatcher->trigger_event('core.modify_bbcode_init', compact($vars))); + + $this->bbcodes = $bbcodes; } /** @@ -1198,6 +1215,8 @@ class parse_message extends bbcode_firstpass */ function format_display($allow_bbcode, $allow_magic_url, $allow_smilies, $update_this_message = true) { + global $phpbb_dispatcher; + // If false, then the parsed message get returned but internal message not processed. if (!$update_this_message) { @@ -1226,6 +1245,28 @@ class parse_message extends bbcode_firstpass $this->message = bbcode_nl2br($this->message); $this->message = smiley_text($this->message, !$allow_smilies); + $text = $this->message; + $uid = $this->bbcode_uid; + + /** + * Event to modify the text after it is parsed + * + * @event core.modify_format_display_text_after + * @var string text The message text to parse + * @var string uid The bbcode uid + * @var bool allow_bbcode Do we allow bbcodes + * @var bool allow_magic_url Do we allow magic urls + * @var bool allow_smilies Do we allow smilies + * @var bool update_this_message Do we update the internal message + * with the parsed result + * @since 3.1.0-a3 + */ + $vars = array('text', 'uid', 'allow_bbcode', 'allow_magic_url', 'allow_smilies', 'update_this_message'); + extract($phpbb_dispatcher->trigger_event('core.modify_format_display_text_after', compact($vars))); + + $this->message = $text; + $this->bbcode_uid = $uid; + if (!$update_this_message) { unset($this->message); diff --git a/phpBB/includes/ucp/ucp_attachments.php b/phpBB/includes/ucp/ucp_attachments.php index dc095e7b73..e687ee9cdc 100644 --- a/phpBB/includes/ucp/ucp_attachments.php +++ b/phpBB/includes/ucp/ucp_attachments.php @@ -26,7 +26,7 @@ class ucp_attachments function main($id, $mode) { - global $template, $user, $db, $config, $phpEx, $phpbb_root_path; + global $template, $user, $db, $config, $phpEx, $phpbb_root_path, $phpbb_container; $start = request_var('start', 0); $sort_key = request_var('sk', 'a'); @@ -119,6 +119,10 @@ class ucp_attachments $num_attachments = $db->sql_fetchfield('num_attachments'); $db->sql_freeresult($result); + // Ensure start is a valid value + $pagination = $phpbb_container->get('pagination'); + $start = $pagination->validate_start($start, $config['topics_per_page'], $num_attachments); + $sql = 'SELECT a.*, t.topic_title, p.message_subject as message_title FROM ' . ATTACHMENTS_TABLE . ' a LEFT JOIN ' . TOPICS_TABLE . ' t ON (a.topic_id = t.topic_id AND a.in_message = 0) @@ -171,10 +175,10 @@ class ucp_attachments $db->sql_freeresult($result); $base_url = $this->u_action . "&sk=$sort_key&sd=$sort_dir"; - phpbb_generate_template_pagination($template, $base_url, 'pagination', 'start', $num_attachments, $config['topics_per_page'], $start); + $pagination->generate_template_pagination($base_url, 'pagination', 'start', $num_attachments, $config['topics_per_page'], $start); $template->assign_vars(array( - 'PAGE_NUMBER' => phpbb_on_page($template, $user, $base_url, $num_attachments, $config['topics_per_page'], $start), + 'PAGE_NUMBER' => $pagination->on_page($base_url, $num_attachments, $config['topics_per_page'], $start), 'TOTAL_ATTACHMENTS' => $num_attachments, 'L_TITLE' => $user->lang['UCP_ATTACHMENTS'], diff --git a/phpBB/includes/ucp/ucp_groups.php b/phpBB/includes/ucp/ucp_groups.php index 716289eded..a17c87e5a1 100644 --- a/phpBB/includes/ucp/ucp_groups.php +++ b/phpBB/includes/ucp/ucp_groups.php @@ -509,7 +509,7 @@ class ucp_groups } else { - if ($driver = $phpbb_avatar_manager->get_driver($user->data['user_avatar_type'])) + if ($driver = $phpbb_avatar_manager->get_driver($avatar_data['avatar_type'])) { $driver->delete($avatar_data); } @@ -813,13 +813,15 @@ class ucp_groups $s_action_options .= '<option value="' . $option . '">' . $user->lang['GROUP_' . $lang] . '</option>'; } + $pagination = $phpbb_container->get('pagination'); $base_url = $this->u_action . "&action=$action&g=$group_id"; - phpbb_generate_template_pagination($template, $base_url, 'pagination', 'start', $total_members, $config['topics_per_page'], $start); + $start = $pagination->validate_start($start, $config['topics_per_page'], $total_members); + $pagination->generate_template_pagination($base_url, 'pagination', 'start', $total_members, $config['topics_per_page'], $start); $template->assign_vars(array( 'S_LIST' => true, 'S_ACTION_OPTIONS' => $s_action_options, - 'S_ON_PAGE' => phpbb_on_page($template, $user, $base_url, $total_members, $config['topics_per_page'], $start), + 'S_ON_PAGE' => $pagination->on_page($template, $user, $base_url, $total_members, $config['topics_per_page'], $start), 'U_ACTION' => $this->u_action . "&g=$group_id", 'S_UCP_ACTION' => $this->u_action . "&g=$group_id", diff --git a/phpBB/includes/ucp/ucp_main.php b/phpBB/includes/ucp/ucp_main.php index b859413d92..b9f951ace6 100644 --- a/phpBB/includes/ucp/ucp_main.php +++ b/phpBB/includes/ucp/ucp_main.php @@ -646,6 +646,7 @@ class ucp_main $table = ($mode == 'subscribed') ? TOPICS_WATCH_TABLE : BOOKMARKS_TABLE; $start = request_var('start', 0); + $pagination = $phpbb_container->get('pagination'); // Grab icons $icons = $cache->obtain_icons(); @@ -669,10 +670,11 @@ class ucp_main if ($topics_count) { - phpbb_generate_template_pagination($template, $this->u_action, 'pagination', 'start', $topics_count, $config['topics_per_page'], $start); + $start = $pagination->validate_start($start, $config['topics_per_page'], $topics_count); + $pagination->generate_template_pagination($this->u_action, 'pagination', 'start', $topics_count, $config['topics_per_page'], $start); $template->assign_vars(array( - 'PAGE_NUMBER' => phpbb_on_page($template, $user, $this->u_action, $topics_count, $config['topics_per_page'], $start), + 'PAGE_NUMBER' => $pagination->on_page($this->u_action, $topics_count, $config['topics_per_page'], $start), 'TOTAL_TOPICS' => $user->lang('VIEW_FORUM_TOPICS', (int) $topics_count), )); } @@ -839,7 +841,7 @@ class ucp_main 'U_VIEW_FORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_id), )); - phpbb_generate_template_pagination($template, append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id'] . "&t=$topic_id"), 'topicrow.pagination', 'start', $replies + 1, $config['posts_per_page'], 1, true, true); + $pagination->generate_template_pagination(append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id'] . "&t=$topic_id"), 'topicrow.pagination', 'start', $replies + 1, $config['posts_per_page'], 1, true, true); } } } diff --git a/phpBB/includes/ucp/ucp_notifications.php b/phpBB/includes/ucp/ucp_notifications.php index 63dbe79666..79055095bc 100644 --- a/phpBB/includes/ucp/ucp_notifications.php +++ b/phpBB/includes/ucp/ucp_notifications.php @@ -31,6 +31,7 @@ class ucp_notifications $form_time = ($form_time <= 0 || $form_time > time()) ? time() : $form_time; $phpbb_notifications = $phpbb_container->get('notification_manager'); + $pagination = $phpbb_container->get('pagination'); switch ($mode) { @@ -137,10 +138,11 @@ class ucp_notifications } $base_url = append_sid("{$phpbb_root_path}ucp.$phpEx", "i=ucp_notifications&mode=notification_list"); - phpbb_generate_template_pagination($template, $base_url, 'pagination', 'start', $notifications['total_count'], $config['topics_per_page'], $start); + $start = $pagination->validate_start($start, $config['topics_per_page'], $notifications['total_count']); + $pagination->generate_template_pagination($base_url, 'pagination', 'start', $notifications['total_count'], $config['topics_per_page'], $start); $template->assign_vars(array( - 'PAGE_NUMBER' => phpbb_on_page($template, $user, $base_url, $notifications['total_count'], $config['topics_per_page'], $start), + 'PAGE_NUMBER' => $pagination->on_page($base_url, $notifications['total_count'], $config['topics_per_page'], $start), 'TOTAL_COUNT' => $notifications['total_count'], 'U_MARK_ALL' => $base_url . '&mark=all&token=' . generate_link_hash('mark_all_notifications_read'), )); diff --git a/phpBB/includes/ucp/ucp_pm_viewfolder.php b/phpBB/includes/ucp/ucp_pm_viewfolder.php index 9393e65f3c..0ea94835f2 100644 --- a/phpBB/includes/ucp/ucp_pm_viewfolder.php +++ b/phpBB/includes/ucp/ucp_pm_viewfolder.php @@ -393,7 +393,7 @@ function view_folder($id, $mode, $folder_id, $folder) */ function get_pm_from($folder_id, $folder, $user_id) { - global $user, $db, $template, $config, $auth, $phpbb_root_path, $phpEx; + global $user, $db, $template, $config, $auth, $phpbb_container, $phpbb_root_path, $phpEx; $start = request_var('start', 0); @@ -402,6 +402,8 @@ function get_pm_from($folder_id, $folder, $user_id) $sort_key = request_var('sk', 't'); $sort_dir = request_var('sd', 'd'); + $pagination = $phpbb_container->get('pagination'); + // PM ordering options $limit_days = array(0 => $user->lang['ALL_MESSAGES'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']); @@ -452,10 +454,11 @@ function get_pm_from($folder_id, $folder, $user_id) } $base_url = append_sid("{$phpbb_root_path}ucp.$phpEx", "i=pm&mode=view&action=view_folder&f=$folder_id&$u_sort_param"); - phpbb_generate_template_pagination($template, $base_url, 'pagination', 'start', $pm_count, $config['topics_per_page'], $start); + $start = $pagination->validate_start($start, $config['topics_per_page'], $pm_count); + $pagination->generate_template_pagination($base_url, 'pagination', 'start', $pm_count, $config['topics_per_page'], $start); $template->assign_vars(array( - 'PAGE_NUMBER' => phpbb_on_page($template, $user, $base_url, $pm_count, $config['topics_per_page'], $start), + 'PAGE_NUMBER' => $pagination->on_page($base_url, $pm_count, $config['topics_per_page'], $start), 'TOTAL_MESSAGES' => $user->lang('VIEW_PM_MESSAGES', (int) $pm_count), 'POST_IMG' => (!$auth->acl_get('u_sendpm')) ? $user->img('button_topic_locked', 'POST_PM_LOCKED') : $user->img('button_pm_new', 'POST_NEW_PM'), @@ -481,14 +484,10 @@ function get_pm_from($folder_id, $folder, $user_id) { $store_reverse = true; - if ($start + $config['topics_per_page'] > $pm_count) - { - $sql_limit = min($config['topics_per_page'], max(1, $pm_count - $start)); - } - // Select the sort order $direction = ($sort_dir == 'd') ? 'ASC' : 'DESC'; - $sql_start = max(0, $pm_count - $sql_limit - $start); + $sql_limit = $pagination->reverse_limit($start, $sql_limit, $pm_count); + $sql_start = $pagination->reverse_start($start, $sql_limit, $pm_count); } else { diff --git a/phpBB/includes/ucp/ucp_profile.php b/phpBB/includes/ucp/ucp_profile.php index f7c6aca9e8..2252b2ea17 100644 --- a/phpBB/includes/ucp/ucp_profile.php +++ b/phpBB/includes/ucp/ucp_profile.php @@ -603,7 +603,7 @@ class ucp_profile } else { - if ($driver = $phpbb_avatar_manager->get_driver($user->data['user_avatar_type'])) + if ($driver = $phpbb_avatar_manager->get_driver($avatar_data['avatar_type'])) { $driver->delete($avatar_data); } diff --git a/phpBB/language/en/acp/common.php b/phpBB/language/en/acp/common.php index 77a7618ce0..0117d85433 100644 --- a/phpBB/language/en/acp/common.php +++ b/phpBB/language/en/acp/common.php @@ -361,6 +361,7 @@ $lang = array_merge($lang, array( 'GZIP_COMPRESSION' => 'GZip compression', + 'NO_SEARCH_INDEX' => 'The selected search backend does not have a search index.<br >Please create the index for “%1$s” in the %2$ssearch index%3$s section.', 'NOT_AVAILABLE' => 'Not available', 'NUMBER_FILES' => 'Number of attachments', 'NUMBER_POSTS' => 'Number of posts', diff --git a/phpBB/language/en/acp/extensions.php b/phpBB/language/en/acp/extensions.php index 8279a68022..67b34ff0c7 100644 --- a/phpBB/language/en/acp/extensions.php +++ b/phpBB/language/en/acp/extensions.php @@ -41,6 +41,7 @@ $lang = array_merge($lang, array( 'EXTENSIONS_EXPLAIN' => 'The Extensions Manager is a tool in your phpBB Board which allows you to manage all of your extensions statuses and view information about them.', 'EXTENSION_INVALID_LIST' => 'The “%s” extension is not valid.<br />%s<br /><br />', 'EXTENSION_NOT_AVAILABLE' => 'The selected extension is not available for this board, please verify your phpBB and PHP versions are allowed (see the details page).', + 'EXTENSION_DIR_INVALID' => 'The selected extension has an invalid directory structure and cannot be enabled.', 'DETAILS' => 'Details', diff --git a/phpBB/language/en/acp/prune.php b/phpBB/language/en/acp/prune.php index 3e890182c0..7134efd765 100644 --- a/phpBB/language/en/acp/prune.php +++ b/phpBB/language/en/acp/prune.php @@ -52,6 +52,7 @@ $lang = array_merge($lang, array( 'POSTS_ON_QUEUE' => 'Posts Awaiting Approval', 'PRUNE_USERS_GROUP_EXPLAIN' => 'Limit to users within the selected group.', + 'PRUNE_USERS_GROUP_NONE' => 'All groups', 'PRUNE_USERS_LIST' => 'Users to be pruned', 'PRUNE_USERS_LIST_DELETE' => 'With the selected critera for pruning users the following accounts will be removed. You can remove individual users from the deletion list by unchecking the box next to their username.', 'PRUNE_USERS_LIST_DEACTIVATE' => 'With the selected critera for pruning users the following accounts will be deactivated. You can remove individual users from the deactivation list by unchecking the box next to their username.', diff --git a/phpBB/language/en/common.php b/phpBB/language/en/common.php index 29e61e68c2..851ffe8ec4 100644 --- a/phpBB/language/en/common.php +++ b/phpBB/language/en/common.php @@ -143,6 +143,7 @@ $lang = array_merge($lang, array( 'BUTTON_QUOTE' => 'Quote', 'BUTTON_TOPIC_LOCKED' => 'Locked', 'BYTES' => 'Bytes', + 'BYTES_SHORT' => 'B', 'CANCEL' => 'Cancel', 'CHANGE' => 'Change', @@ -279,6 +280,8 @@ $lang = array_merge($lang, array( 'GB' => 'GB', 'GIB' => 'GiB', 'GO' => 'Go', + 'GOTO_FIRST_POST' => 'Go to first post', + 'GOTO_LAST_POST' => 'Go to last post', 'GOTO_PAGE' => 'Go to page', 'GROUP' => 'Group', 'GROUPS' => 'Groups', diff --git a/phpBB/language/en/memberlist.php b/phpBB/language/en/memberlist.php index ec21e8e904..8162f195eb 100644 --- a/phpBB/language/en/memberlist.php +++ b/phpBB/language/en/memberlist.php @@ -140,6 +140,7 @@ $lang = array_merge($lang, array( ), 'USER_ONLINE' => 'Online', 'USER_PRESENCE' => 'Board presence', + 'USERS_PER_PAGE' => 'Users per page', 'VIEWING_PROFILE' => 'Viewing profile - %s', 'VISITED' => 'Last visited', diff --git a/phpBB/language/en/plupload.php b/phpBB/language/en/plupload.php index cfdce9810e..74ae8b7c78 100644 --- a/phpBB/language/en/plupload.php +++ b/phpBB/language/en/plupload.php @@ -38,15 +38,27 @@ if (empty($lang) || !is_array($lang)) $lang = array_merge($lang, array( 'PLUPLOAD_ADD_FILES' => 'Add files', 'PLUPLOAD_ADD_FILES_TO_QUEUE' => 'Add files to the upload queue and click the start button.', + 'PLUPLOAD_ALREADY_QUEUED' => '%s already present in the queue.', + 'PLUPLOAD_CLOSE' => 'Close', 'PLUPLOAD_DRAG' => 'Drag files here.', + 'PLUPLOAD_DUPLICATE_ERROR' => 'Duplicate file error.', 'PLUPLOAD_ERR_INPUT' => 'Failed to open input stream.', 'PLUPLOAD_ERR_MOVE_UPLOADED' => 'Failed to move uploaded file.', 'PLUPLOAD_ERR_OUTPUT' => 'Failed to open output stream.', + 'PLUPLOAD_ERR_FILE_TOO_LARGE' => 'Error: File too large:', + 'PLUPLOAD_ERR_FILE_COUNT' => 'File count error.', + 'PLUPLOAD_ERR_FILE_INVALID_EXT' => 'Error: Invalid file extension:', + 'PLUPLOAD_ERR_RUNTIME_MEMORY' => 'Runtime ran out of available memory.', + 'PLUPLOAD_ERR_UPLOAD_LIMIT' => 'Upload element accepts only %d file(s) at a time. Extra files were stripped.', + 'PLUPLOAD_ERR_UPLOAD_URL' => 'Upload URL might be wrong or does not exist.', 'PLUPLOAD_EXTENSION_ERROR' => 'File extension error.', + 'PLUPLOAD_FILE' => 'File: %s', + 'PLUPLOAD_FILE_DETAILS' => 'File: %s, size: %d, max file size: %d', 'PLUPLOAD_FILENAME' => 'Filename', 'PLUPLOAD_FILES_QUEUED' => '%d files queued', 'PLUPLOAD_GENERIC_ERROR' => 'Generic error.', 'PLUPLOAD_HTTP_ERROR' => 'HTTP error.', + 'PLUPLOAD_IMAGE_FORMAT' => 'Image format either wrong or not supported.', 'PLUPLOAD_INIT_ERROR' => 'Init error.', 'PLUPLOAD_IO_ERROR' => 'IO error.', 'PLUPLOAD_NOT_APPLICABLE' => 'N/A', diff --git a/phpBB/language/en/viewtopic.php b/phpBB/language/en/viewtopic.php index 6f318c39f1..424cb9da3e 100644 --- a/phpBB/language/en/viewtopic.php +++ b/phpBB/language/en/viewtopic.php @@ -104,6 +104,7 @@ $lang = array_merge($lang, array( 'SUBMIT_VOTE' => 'Submit vote', + 'TOPIC_TOOLS' => 'Topic tools', 'TOTAL_VOTES' => 'Total votes', 'UNLOCK_TOPIC' => 'Unlock topic', diff --git a/phpBB/memberlist.php b/phpBB/memberlist.php index 941d0ca713..14425ca6e4 100644 --- a/phpBB/memberlist.php +++ b/phpBB/memberlist.php @@ -998,6 +998,7 @@ switch ($mode) // The basic memberlist $page_title = $user->lang['MEMBERLIST']; $template_html = 'memberlist_body.html'; + $pagination = $phpbb_container->get('pagination'); // Sorting $sort_key_text = array('a' => $user->lang['SORT_USERNAME'], 'b' => $user->lang['SORT_LOCATION'], 'c' => $user->lang['SORT_JOINED'], 'd' => $user->lang['SORT_POST_COUNT'], 'f' => $user->lang['WEBSITE'], 'g' => $user->lang['ICQ'], 'h' => $user->lang['AIM'], 'i' => $user->lang['MSNM'], 'j' => $user->lang['YIM'], 'k' => $user->lang['JABBER']); @@ -1487,6 +1488,8 @@ switch ($mode) ); } + $start = $pagination->validate_start($start, $config['topics_per_page'], $config['num_users']); + // Get us some users :D $sql = "SELECT u.user_id FROM " . USERS_TABLE . " u @@ -1607,11 +1610,11 @@ switch ($mode) } } - phpbb_generate_template_pagination($template, $pagination_url, 'pagination', 'start', $total_users, $config['topics_per_page'], $start); + $pagination->generate_template_pagination($pagination_url, 'pagination', 'start', $total_users, $config['topics_per_page'], $start); // Generate page $template->assign_vars(array( - 'PAGE_NUMBER' => phpbb_on_page($template, $user, $pagination_url, $total_users, $config['topics_per_page'], $start), + 'PAGE_NUMBER' => $pagination->on_page($pagination_url, $total_users, $config['topics_per_page'], $start), 'TOTAL_USERS' => $user->lang('LIST_USERS', (int) $total_users), 'PROFILE_IMG' => $user->img('icon_user_profile', $user->lang['PROFILE']), diff --git a/phpBB/phpbb/avatar/driver/driver.php b/phpBB/phpbb/avatar/driver/driver.php index d360614122..dd55f09119 100644 --- a/phpBB/phpbb/avatar/driver/driver.php +++ b/phpBB/phpbb/avatar/driver/driver.php @@ -112,17 +112,6 @@ abstract class driver implements \phpbb\avatar\driver\driver_interface /** * @inheritdoc */ - public function get_template_name() - { - $driver = preg_replace('#^phpbb\\\\avatar\\\\driver\\\\#', '', get_class($this)); - $template = "ucp_avatar_options_$driver.html"; - - return $template; - } - - /** - * @inheritdoc - */ public function get_name() { return $this->name; diff --git a/phpBB/phpbb/avatar/driver/gravatar.php b/phpBB/phpbb/avatar/driver/gravatar.php index d64f4da734..9f14b7f468 100644 --- a/phpBB/phpbb/avatar/driver/gravatar.php +++ b/phpBB/phpbb/avatar/driver/gravatar.php @@ -147,6 +147,14 @@ class gravatar extends \phpbb\avatar\driver\driver } /** + * @inheritdoc + */ + public function get_template_name() + { + return 'ucp_avatar_options_gravatar.html'; + } + + /** * Build gravatar URL for output on page * * @return string Gravatar URL diff --git a/phpBB/phpbb/avatar/driver/local.php b/phpBB/phpbb/avatar/driver/local.php index f6acc6e636..611a44cb3d 100644 --- a/phpBB/phpbb/avatar/driver/local.php +++ b/phpBB/phpbb/avatar/driver/local.php @@ -135,6 +135,14 @@ class local extends \phpbb\avatar\driver\driver } /** + * @inheritdoc + */ + public function get_template_name() + { + return 'ucp_avatar_options_local.html'; + } + + /** * Get a list of avatars that are locally available * Results get cached for 24 hours (86400 seconds) * diff --git a/phpBB/phpbb/avatar/driver/remote.php b/phpBB/phpbb/avatar/driver/remote.php index 22d50c703e..36623942df 100644 --- a/phpBB/phpbb/avatar/driver/remote.php +++ b/phpBB/phpbb/avatar/driver/remote.php @@ -186,4 +186,12 @@ class remote extends \phpbb\avatar\driver\driver 'avatar_height' => $height, ); } + + /** + * @inheritdoc + */ + public function get_template_name() + { + return 'ucp_avatar_options_remote.html'; + } } diff --git a/phpBB/phpbb/avatar/driver/upload.php b/phpBB/phpbb/avatar/driver/upload.php index 822c40af98..1e50e135e4 100644 --- a/phpBB/phpbb/avatar/driver/upload.php +++ b/phpBB/phpbb/avatar/driver/upload.php @@ -168,6 +168,14 @@ class upload extends \phpbb\avatar\driver\driver } /** + * @inheritdoc + */ + public function get_template_name() + { + return 'ucp_avatar_options_upload.html'; + } + + /** * Check if user is able to upload an avatar * * @return bool True if user can upload, false if not diff --git a/phpBB/phpbb/db/migration/data/v310/avatar_types.php b/phpBB/phpbb/db/migration/data/v310/avatar_types.php new file mode 100644 index 0000000000..bdbdccf0c5 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v310/avatar_types.php @@ -0,0 +1,60 @@ +<?php +/** +* +* @package migration +* @copyright (c) 2013 phpBB Group +* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2 +* +*/ + +namespace phpbb\db\migration\data\v310; + +class avatar_types extends \phpbb\db\migration\migration +{ + /** + * @var avatar type map + */ + protected $avatar_type_map = array( + AVATAR_UPLOAD => 'avatar.driver.upload', + AVATAR_REMOTE => 'avatar.driver.remote', + AVATAR_GALLERY => 'avatar.driver.local', + ); + + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v310\dev', + '\phpbb\db\migration\data\v310\avatars', + ); + } + + public function update_data() + { + return array( + array('custom', array(array($this, 'update_user_avatar_type'))), + array('custom', array(array($this, 'update_group_avatar_type'))), + ); + } + + public function update_user_avatar_type() + { + foreach ($this->avatar_type_map as $old => $new) + { + $sql = 'UPDATE ' . $this->table_prefix . "users + SET user_avatar_type = '$new' + WHERE user_avatar_type = '$old'"; + $this->db->sql_query($sql); + } + } + + public function update_group_avatar_type() + { + foreach ($this->avatar_type_map as $old => $new) + { + $sql = 'UPDATE ' . $this->table_prefix . "groups + SET group_avatar_type = '$new' + WHERE group_avatar_type = '$old'"; + $this->db->sql_query($sql); + } + } +} diff --git a/phpBB/phpbb/extension/manager.php b/phpBB/phpbb/extension/manager.php index 7f009867c9..23b281deaa 100644 --- a/phpBB/phpbb/extension/manager.php +++ b/phpBB/phpbb/extension/manager.php @@ -411,9 +411,24 @@ class manager if ($file_info->isFile() && $file_info->getFilename() == 'ext.' . $this->php_ext) { $ext_name = $iterator->getInnerIterator()->getSubPath(); + $composer_file = $iterator->getPath() . '/composer.json'; + // Ignore the extension if there is no composer.json. + if (!is_readable($composer_file) || !($ext_info = file_get_contents($composer_file))) + { + continue; + } + + $ext_info = json_decode($ext_info, true); $ext_name = str_replace(DIRECTORY_SEPARATOR, '/', $ext_name); + // Ignore the extension if directory depth is not correct or if the directory structure + // does not match the name value specified in composer.json. + if (substr_count($ext_name, '/') !== 1 || !isset($ext_info['name']) || $ext_name != $ext_info['name']) + { + continue; + } + $available[$ext_name] = $this->phpbb_root_path . 'ext/' . $ext_name . '/'; } } diff --git a/phpBB/phpbb/extension/metadata_manager.php b/phpBB/phpbb/extension/metadata_manager.php index d0323120d8..66cdb86513 100644 --- a/phpBB/phpbb/extension/metadata_manager.php +++ b/phpBB/phpbb/extension/metadata_manager.php @@ -266,8 +266,8 @@ class metadata_manager */ public function validate_enable() { - // Check for phpBB, PHP versions - if (!$this->validate_require_phpbb() || !$this->validate_require_php()) + // Check for valid directory & phpBB, PHP versions + if (!$this->validate_dir() || !$this->validate_require_phpbb() || !$this->validate_require_php()) { return false; } @@ -275,6 +275,16 @@ class metadata_manager return true; } + /** + * Validates the most basic directory structure to ensure it follows <vendor>/<ext> convention. + * + * @return boolean True when passes validation + */ + public function validate_dir() + { + return (substr_count($this->ext_name, '/') === 1 && $this->ext_name == $this->get_metadata('name')); + } + /** * Validates the contents of the phpbb requirement field diff --git a/phpBB/phpbb/mimetype/content_guesser.php b/phpBB/phpbb/mimetype/content_guesser.php new file mode 100644 index 0000000000..2d74582a21 --- /dev/null +++ b/phpBB/phpbb/mimetype/content_guesser.php @@ -0,0 +1,33 @@ +<?php +/** +* +* @package phpBB3 +* @copyright (c) 2013 phpBB Group +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* +*/ + +namespace phpbb\mimetype; + +/** +* @package mimetype +*/ + +class content_guesser extends guesser_base +{ + /** + * @inheritdoc + */ + public function is_supported() + { + return function_exists('mime_content_type'); + } + + /** + * @inheritdoc + */ + public function guess($file, $file_name = '') + { + return mime_content_type($file); + } +} diff --git a/phpBB/phpbb/mimetype/extension_guesser.php b/phpBB/phpbb/mimetype/extension_guesser.php new file mode 100644 index 0000000000..f6f4ae0138 --- /dev/null +++ b/phpBB/phpbb/mimetype/extension_guesser.php @@ -0,0 +1,509 @@ +<?php +/** +* +* @package phpBB3 +* @copyright (c) 2013 phpBB Group +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* +*/ + +namespace phpbb\mimetype; + +/** +* @package mimetype +*/ + +class extension_guesser extends guesser_base +{ + /** + * @var file extension map + */ + protected $extension_map = array( + '3dm' => 'x-world/x-3dmf', + '3dmf' => 'x-world/x-3dmf', + 'a' => 'application/octet-stream', + 'aab' => 'application/x-authorware-bin', + 'aam' => 'application/x-authorware-map', + 'aas' => 'application/x-authorware-seg', + 'abc' => 'text/vnd.abc', + 'acgi' => 'text/html', + 'afl' => 'video/animaflex', + 'ai' => 'application/postscript', + 'aif' => 'audio/aiff', + 'aifc' => 'audio/aiff', + 'aiff' => 'audio/aiff', + 'aim' => 'application/x-aim', + 'aip' => 'text/x-audiosoft-intra', + 'ani' => 'application/x-navi-animation', + 'aos' => 'application/x-nokia-9000-communicator-add-on-software', + 'aps' => 'application/mime', + 'arc' => 'application/octet-stream', + 'arj' => 'application/arj', + 'art' => 'image/x-jg', + 'asf' => 'video/x-ms-asf', + 'asm' => 'text/x-asm', + 'asp' => 'text/asp', + 'asx' => 'video/x-ms-asf', + 'au' => 'audio/x-au', + 'avi' => 'video/avi', + 'avs' => 'video/avs-video', + 'bcpio' => 'application/x-bcpio', + 'bin' => 'application/x-binary', + 'bm' => 'image/bmp', + 'bmp' => 'image/bmp', + 'boo' => 'application/book', + 'book' => 'application/book', + 'boz' => 'application/x-bzip2', + 'bsh' => 'application/x-bsh', + 'bz' => 'application/x-bzip', + 'bz2' => 'application/x-bzip2', + 'c' => 'text/x-c', + 'c++' => 'text/x-c', + 'cat' => 'application/vnd.ms-pki.seccat', + 'cc' => 'text/plain', + 'ccad' => 'application/clariscad', + 'cco' => 'application/x-cocoa', + 'cdf' => 'application/cdf', + 'cer' => 'application/x-x509-ca-cert', + 'cha' => 'application/x-chat', + 'chat' => 'application/x-chat', + 'class' => 'application/java', + 'com' => 'application/octet-stream', + 'conf' => 'text/plain', + 'cpio' => 'application/x-cpio', + 'cpp' => 'text/x-c', + 'cpt' => 'application/x-cpt', + 'crl' => 'application/pkix-crl', + 'crt' => 'application/x-x509-ca-cert', + 'csh' => 'application/x-csh', + 'css' => 'text/css', + 'cxx' => 'text/plain', + 'dcr' => 'application/x-director', + 'deepv' => 'application/x-deepv', + 'def' => 'text/plain', + 'der' => 'application/x-x509-ca-cert', + 'dif' => 'video/x-dv', + 'dir' => 'application/x-director', + 'dl' => 'video/dl', + 'doc' => 'application/msword', + 'dot' => 'application/msword', + 'dp' => 'application/commonground', + 'drw' => 'application/drafting', + 'dump' => 'application/octet-stream', + 'dv' => 'video/x-dv', + 'dvi' => 'application/x-dvi', + 'dwf' => 'model/vnd.dwf', + 'dwg' => 'image/x-dwg', + 'dxf' => 'image/x-dwg', + 'dxr' => 'application/x-director', + 'el' => 'text/x-script.elisp', + 'elc' => 'application/x-elc', + 'env' => 'application/x-envoy', + 'eps' => 'application/postscript', + 'es' => 'application/x-esrehber', + 'etx' => 'text/x-setext', + 'evy' => 'application/x-envoy', + 'exe' => 'application/octet-stream', + 'f' => 'text/x-fortran', + 'f77' => 'text/x-fortran', + 'f90' => 'text/x-fortran', + 'fdf' => 'application/vnd.fdf', + 'fif' => 'image/fif', + 'fli' => 'video/x-fli', + 'flo' => 'image/florian', + 'flx' => 'text/vnd.fmi.flexstor', + 'fmf' => 'video/x-atomic3d-feature', + 'for' => 'text/x-fortran', + 'fpx' => 'image/vnd.fpx', + 'frl' => 'application/freeloader', + 'funk' => 'audio/make', + 'g' => 'text/plain', + 'g3' => 'image/g3fax', + 'gif' => 'image/gif', + 'gl' => 'video/x-gl', + 'gsd' => 'audio/x-gsm', + 'gsm' => 'audio/x-gsm', + 'gsp' => 'application/x-gsp', + 'gss' => 'application/x-gss', + 'gtar' => 'application/x-gtar', + 'gz' => 'application/x-gzip', + 'gzip' => 'application/x-gzip', + 'h' => 'text/x-h', + 'hdf' => 'application/x-hdf', + 'help' => 'application/x-helpfile', + 'hgl' => 'application/vnd.hp-hpgl', + 'hh' => 'text/x-h', + 'hlb' => 'text/x-script', + 'hlp' => 'application/hlp', + 'hpg' => 'application/vnd.hp-hpgl', + 'hpgl' => 'application/vnd.hp-hpgl', + 'hqx' => 'application/x-binhex40', + 'hta' => 'application/hta', + 'htc' => 'text/x-component', + 'htm' => 'text/html', + 'html' => 'text/html', + 'htmls' => 'text/html', + 'htt' => 'text/webviewhtml', + 'htx' => 'text/html', + 'ice' => 'x-conference/x-cooltalk', + 'ico' => 'image/x-icon', + 'idc' => 'text/plain', + 'ief' => 'image/ief', + 'iefs' => 'image/ief', + 'iges' => 'application/iges', + 'igs' => 'application/iges', + 'ima' => 'application/x-ima', + 'imap' => 'application/x-httpd-imap', + 'inf' => 'application/inf', + 'ins' => 'application/x-internett-signup', + 'ip' => 'application/x-ip2', + 'isu' => 'video/x-isvideo', + 'it' => 'audio/it', + 'iv' => 'application/x-inventor', + 'ivr' => 'i-world/i-vrml', + 'ivy' => 'application/x-livescreen', + 'jam' => 'audio/x-jam', + 'jav' => 'text/plain', + 'jav' => 'text/x-java-source', + 'java' => 'text/x-java-source', + 'jcm' => 'application/x-java-commerce', + 'jfif' => 'image/jpeg', + 'jfif-tbnl' => 'image/jpeg', + 'jpe' => 'image/jpeg', + 'jpeg' => 'image/jpeg', + 'jpg' => 'image/jpeg', + 'jps' => 'image/x-jps', + 'js' => 'application/x-javascript', + 'jut' => 'image/jutvision', + 'kar' => 'audio/midi', + 'ksh' => 'text/x-script.ksh', + 'la' => 'audio/x-nspaudio', + 'lam' => 'audio/x-liveaudio', + 'latex' => 'application/x-latex', + 'lha' => 'application/x-lha', + 'lhx' => 'application/octet-stream', + 'list' => 'text/plain', + 'lma' => 'audio/x-nspaudio', + 'log' => 'text/plain', + 'lsp' => 'text/x-script.lisp', + 'lst' => 'text/plain', + 'lsx' => 'text/x-la-asf', + 'ltx' => 'application/x-latex', + 'lzh' => 'application/x-lzh', + 'lzx' => 'application/x-lzx', + 'm' => 'text/x-m', + 'm1v' => 'video/mpeg', + 'm2a' => 'audio/mpeg', + 'm2v' => 'video/mpeg', + 'm3u' => 'audio/x-mpequrl', + 'man' => 'application/x-troff-man', + 'map' => 'application/x-navimap', + 'mar' => 'text/plain', + 'mbd' => 'application/mbedlet', + 'mc$' => 'application/x-magic-cap-package-1.0', + 'mcd' => 'application/x-mathcad', + 'mcf' => 'text/mcf', + 'mcp' => 'application/netmc', + 'me' => 'application/x-troff-me', + 'mht' => 'message/rfc822', + 'mhtml' => 'message/rfc822', + 'mid' => 'audio/x-midi', + 'midi' => 'audio/x-midi', + 'mif' => 'application/x-mif', + 'mime' => 'www/mime', + 'mjf' => 'audio/x-vnd.audioexplosion.mjuicemediafile', + 'mjpg' => 'video/x-motion-jpeg', + 'mm' => 'application/x-meme', + 'mme' => 'application/base64', + 'mod' => 'audio/x-mod', + 'moov' => 'video/quicktime', + 'mov' => 'video/quicktime', + 'movie' => 'video/x-sgi-movie', + 'mp2' => 'audio/x-mpeg', + 'mp3' => 'audio/x-mpeg-3', + 'mpa' => 'audio/mpeg', + 'mpc' => 'application/x-project', + 'mpe' => 'video/mpeg', + 'mpeg' => 'video/mpeg', + 'mpg' => 'video/mpeg', + 'mpga' => 'audio/mpeg', + 'mpp' => 'application/vnd.ms-project', + 'mpt' => 'application/x-project', + 'mpv' => 'application/x-project', + 'mpx' => 'application/x-project', + 'mrc' => 'application/marc', + 'ms' => 'application/x-troff-ms', + 'mv' => 'video/x-sgi-movie', + 'my' => 'audio/make', + 'mzz' => 'application/x-vnd.audioexplosion.mzz', + 'nap' => 'image/naplps', + 'naplps' => 'image/naplps', + 'nc' => 'application/x-netcdf', + 'ncm' => 'application/vnd.nokia.configuration-message', + 'nif' => 'image/x-niff', + 'niff' => 'image/x-niff', + 'nix' => 'application/x-mix-transfer', + 'nsc' => 'application/x-conference', + 'nvd' => 'application/x-navidoc', + 'o' => 'application/octet-stream', + 'oda' => 'application/oda', + 'omc' => 'application/x-omc', + 'omcd' => 'application/x-omcdatamaker', + 'omcr' => 'application/x-omcregerator', + 'p' => 'text/x-pascal', + 'p10' => 'application/x-pkcs10', + 'p12' => 'application/x-pkcs12', + 'p7a' => 'application/x-pkcs7-signature', + 'p7c' => 'application/x-pkcs7-mime', + 'p7m' => 'application/x-pkcs7-mime', + 'p7r' => 'application/x-pkcs7-certreqresp', + 'p7s' => 'application/pkcs7-signature', + 'part' => 'application/pro_eng', + 'pas' => 'text/pascal', + 'pbm' => 'image/x-portable-bitmap', + 'pcl' => 'application/x-pcl', + 'pct' => 'image/x-pict', + 'pcx' => 'image/x-pcx', + 'pdb' => 'chemical/x-pdb', + 'pdf' => 'application/pdf', + 'pfunk' => 'audio/make.my.funk', + 'pgm' => 'image/x-portable-greymap', + 'pic' => 'image/pict', + 'pict' => 'image/pict', + 'pkg' => 'application/x-newton-compatible-pkg', + 'pko' => 'application/vnd.ms-pki.pko', + 'pl' => 'text/x-script.perl', + 'plx' => 'application/x-pixclscript', + 'pm' => 'text/x-script.perl-module', + 'pm4' => 'application/x-pagemaker', + 'pm5' => 'application/x-pagemaker', + 'png' => 'image/png', + 'pnm' => 'image/x-portable-anymap', + 'pot' => 'application/mspowerpoint', + 'pov' => 'model/x-pov', + 'ppa' => 'application/vnd.ms-powerpoint', + 'ppm' => 'image/x-portable-pixmap', + 'pps' => 'application/mspowerpoint', + 'ppt' => 'application/mspowerpoint', + 'ppz' => 'application/mspowerpoint', + 'pre' => 'application/x-freelance', + 'prt' => 'application/pro_eng', + 'ps' => 'application/postscript', + 'psd' => 'application/octet-stream', + 'pvu' => 'paleovu/x-pv', + 'pwz' => 'application/vnd.ms-powerpoint', + 'py' => 'text/x-script.phyton', + 'pyc' => 'applicaiton/x-bytecode.python', + 'qcp' => 'audio/vnd.qcelp', + 'qd3' => 'x-world/x-3dmf', + 'qd3d' => 'x-world/x-3dmf', + 'qif' => 'image/x-quicktime', + 'qt' => 'video/quicktime', + 'qtc' => 'video/x-qtc', + 'qti' => 'image/x-quicktime', + 'qtif' => 'image/x-quicktime', + 'ra' => 'audio/x-realaudio', + 'ram' => 'audio/x-pn-realaudio', + 'ras' => 'image/x-cmu-raster', + 'rast' => 'image/cmu-raster', + 'rexx' => 'text/x-script.rexx', + 'rf' => 'image/vnd.rn-realflash', + 'rgb' => 'image/x-rgb', + 'rm' => 'audio/x-pn-realaudio', + 'rmi' => 'audio/mid', + 'rmm' => 'audio/x-pn-realaudio', + 'rmp' => 'audio/x-pn-realaudio', + 'rng' => 'application/vnd.nokia.ringing-tone', + 'rnx' => 'application/vnd.rn-realplayer', + 'roff' => 'application/x-troff', + 'rp' => 'image/vnd.rn-realpix', + 'rpm' => 'audio/x-pn-realaudio-plugin', + 'rt' => 'text/richtext', + 'rtf' => 'text/richtext', + 'rtx' => 'text/richtext', + 'rv' => 'video/vnd.rn-realvideo', + 's' => 'text/x-asm', + 's3m' => 'audio/s3m', + 'saveme' => 'application/octet-stream', + 'sbk' => 'application/x-tbook', + 'scm' => 'video/x-scm', + 'sdml' => 'text/plain', + 'sdp' => 'application/x-sdp', + 'sdr' => 'application/sounder', + 'sea' => 'application/x-sea', + 'set' => 'application/set', + 'sgm' => 'text/x-sgml', + 'sgml' => 'text/x-sgml', + 'sh' => 'text/x-script.sh', + 'shar' => 'application/x-shar', + 'shtml' => 'text/x-server-parsed-html', + 'sid' => 'audio/x-psid', + 'sit' => 'application/x-stuffit', + 'skd' => 'application/x-koan', + 'skm' => 'application/x-koan', + 'skp' => 'application/x-koan', + 'skt' => 'application/x-koan', + 'sl' => 'application/x-seelogo', + 'smi' => 'application/smil', + 'smil' => 'application/smil', + 'snd' => 'audio/x-adpcm', + 'sol' => 'application/solids', + 'spc' => 'text/x-speech', + 'spl' => 'application/futuresplash', + 'spr' => 'application/x-sprite', + 'sprite' => 'application/x-sprite', + 'src' => 'application/x-wais-source', + 'ssi' => 'text/x-server-parsed-html', + 'ssm' => 'application/streamingmedia', + 'sst' => 'application/vnd.ms-pki.certstore', + 'step' => 'application/step', + 'stl' => 'application/vnd.ms-pki.stl', + 'stp' => 'application/step', + 'sv4cpio' => 'application/x-sv4cpio', + 'sv4crc' => 'application/x-sv4crc', + 'svf' => 'image/x-dwg', + 'svr' => 'application/x-world', + 'swf' => 'application/x-shockwave-flash', + 't' => 'application/x-troff', + 'talk' => 'text/x-speech', + 'tar' => 'application/x-tar', + 'tbk' => 'application/x-tbook', + 'tcl' => 'text/x-script.tcl', + 'tcsh' => 'text/x-script.tcsh', + 'tex' => 'application/x-tex', + 'texi' => 'application/x-texinfo', + 'texinfo' => 'application/x-texinfo', + 'text' => 'text/plain', + 'tgz' => 'application/x-compressed', + 'tif' => 'image/tiff', + 'tiff' => 'image/tiff', + 'tr' => 'application/x-troff', + 'tsi' => 'audio/tsp-audio', + 'tsp' => 'audio/tsplayer', + 'tsv' => 'text/tab-separated-values', + 'turbot' => 'image/florian', + 'txt' => 'text/plain', + 'uil' => 'text/x-uil', + 'uni' => 'text/uri-list', + 'unis' => 'text/uri-list', + 'unv' => 'application/i-deas', + 'uri' => 'text/uri-list', + 'uris' => 'text/uri-list', + 'ustar' => 'multipart/x-ustar', + 'uu' => 'text/x-uuencode', + 'uue' => 'text/x-uuencode', + 'vcd' => 'application/x-cdlink', + 'vcs' => 'text/x-vcalendar', + 'vda' => 'application/vda', + 'vdo' => 'video/vdo', + 'vew' => 'application/groupwise', + 'viv' => 'video/vivo', + 'vivo' => 'video/vivo', + 'vmd' => 'application/vocaltec-media-desc', + 'vmf' => 'application/vocaltec-media-file', + 'voc' => 'audio/voc', + 'vos' => 'video/vosaic', + 'vox' => 'audio/voxware', + 'vqe' => 'audio/x-twinvq-plugin', + 'vqf' => 'audio/x-twinvq', + 'vql' => 'audio/x-twinvq-plugin', + 'vrml' => 'application/x-vrml', + 'vrt' => 'x-world/x-vrt', + 'vsd' => 'application/x-visio', + 'vst' => 'application/x-visio', + 'vsw' => 'application/x-visio', + 'w60' => 'application/wordperfect6.0', + 'w61' => 'application/wordperfect6.1', + 'w6w' => 'application/msword', + 'wav' => 'audio/wav', + 'wb1' => 'application/x-qpro', + 'wbmp' => 'image/vnd.wap.wbmp', + 'web' => 'application/vnd.xara', + 'wiz' => 'application/msword', + 'wk1' => 'application/x-123', + 'wmf' => 'windows/metafile', + 'wml' => 'text/vnd.wap.wml', + 'wmlc' => 'application/vnd.wap.wmlc', + 'wmls' => 'text/vnd.wap.wmlscript', + 'wmlsc' => 'application/vnd.wap.wmlscriptc', + 'word' => 'application/msword', + 'wp' => 'application/wordperfect', + 'wp5' => 'application/wordperfect', + 'wp6' => 'application/wordperfect', + 'wpd' => 'application/wordperfect', + 'wq1' => 'application/x-lotus', + 'wri' => 'application/mswrite', + 'wrl' => 'model/vrml', + 'wrz' => 'model/vrml', + 'wsc' => 'text/scriplet', + 'wsrc' => 'application/x-wais-source', + 'wtk' => 'application/x-wintalk', + 'xbm' => 'image/xbm', + 'xdr' => 'video/x-amt-demorun', + 'xgz' => 'xgl/drawing', + 'xif' => 'image/vnd.xiff', + 'xl' => 'application/excel', + 'xla' => 'application/excel', + 'xlb' => 'application/excel', + 'xlc' => 'application/excel', + 'xld' => 'application/excel', + 'xlk' => 'application/excel', + 'xll' => 'application/excel', + 'xlm' => 'application/excel', + 'xls' => 'application/excel', + 'xlt' => 'application/excel', + 'xlv' => 'application/excel', + 'xlw' => 'application/excel', + 'xm' => 'audio/xm', + 'xml' => 'text/xml', + 'xmz' => 'xgl/movie', + 'xpix' => 'application/x-vnd.ls-xpix', + 'xpm' => 'image/xpm', + 'x-png' => 'image/png', + 'xsr' => 'video/x-amt-showrun', + 'xwd' => 'image/x-xwindowdump', + 'xyz' => 'chemical/x-pdb', + 'z' => 'application/x-compressed', + 'zip' => 'application/x-zip-compressed', + 'zoo' => 'application/octet-stream', + 'zsh' => 'text/x-script.zsh', + ); + + /** + * @inheritdoc + */ + public function is_supported() + { + return true; + } + + /** + * @inheritdoc + */ + public function guess($file, $file_name = '') + { + $file_name = (empty($file_name)) ? $file : $file_name; + return $this->map_extension_to_type($file_name); + } + + /** + * Map extension of supplied file_name to mime type + * + * @param string $file_name Path to file or filename + * + * @return string|null Mimetype if known or null if not + */ + protected function map_extension_to_type($file_name) + { + $extension = pathinfo($file_name, PATHINFO_EXTENSION); + + if (isset($this->extension_map[$extension])) + { + return $this->extension_map[$extension]; + } + else + { + return null; + } + } +} diff --git a/phpBB/phpbb/mimetype/guesser.php b/phpBB/phpbb/mimetype/guesser.php new file mode 100644 index 0000000000..3499b3b0f7 --- /dev/null +++ b/phpBB/phpbb/mimetype/guesser.php @@ -0,0 +1,130 @@ +<?php +/** +* +* @package phpBB3 +* @copyright (c) 2013 phpBB Group +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* +*/ + +namespace phpbb\mimetype; + +/** +* @package mimetype +*/ + +class guesser +{ + /** + * @const Default priority for mimetype guessers + */ + const PRIORITY_DEFAULT = 0; + + /** + * @var mimetype guessers + */ + protected $guessers; + + /** + * Construct a mimetype guesser object + * + * @param array $mimetype_guessers Mimetype guesser service collection + */ + public function __construct($mimetype_guessers) + { + $this->register_guessers($mimetype_guessers); + } + + /** + * Register MimeTypeGuessers and sort them by priority + * + * @param array $mimetype_guessers Mimetype guesser service collection + * + * @throws \LogicException If incorrect or not mimetype guessers have + * been supplied to class + */ + protected function register_guessers($mimetype_guessers) + { + foreach ($mimetype_guessers as $guesser) + { + $is_supported = (method_exists($guesser, 'is_supported')) ? 'is_supported' : ''; + $is_supported = (method_exists($guesser, 'isSupported')) ? 'isSupported' : $is_supported; + + if (empty($is_supported)) + { + throw new \LogicException('Incorrect mimetype guesser supplied.'); + } + + if ($guesser->$is_supported()) + { + $this->guessers[] = $guesser; + } + } + + if (empty($this->guessers)) + { + throw new \LogicException('No mimetype guesser supplied.'); + } + + // Sort guessers by priority + usort($this->guessers, array($this, 'sort_priority')); + } + + /** + * Sort the priority of supplied guessers + * This is a compare function for usort. A guesser with higher priority + * should be used first and vice versa. usort() orders the array values + * from low to high depending on what the comparison function returns + * to it. Return value should be smaller than 0 if value a is smaller + * than value b. This has been reversed in the comparision function in + * order to sort the guessers from high to low. + * Method has been set to public in order to allow proper testing. + * + * @param object $guesser_a Mimetype guesser a + * @param object $guesser_b Mimetype guesser b + * + * @return int If both guessers have the same priority 0, bigger + * than 0 if first guesser has lower priority, and lower + * than 0 if first guesser has higher priority + */ + public function sort_priority($guesser_a, $guesser_b) + { + $priority_a = (int) (method_exists($guesser_a, 'get_priority')) ? $guesser_a->get_priority() : self::PRIORITY_DEFAULT; + $priority_b = (int) (method_exists($guesser_b, 'get_priority')) ? $guesser_b->get_priority() : self::PRIORITY_DEFAULT; + + return $priority_b - $priority_a; + } + + /** + * Guess mimetype of supplied file + * + * @param string $file Path to file + * + * @return string Guess for mimetype of file + */ + public function guess($file, $file_name = '') + { + if (!is_file($file)) + { + return false; + } + + if (!is_readable($file)) + { + return false; + } + + foreach ($this->guessers as $guesser) + { + $mimetype = $guesser->guess($file, $file_name); + + // Try to guess something that is not the fallback application/octet-stream + if ($mimetype !== null && $mimetype !== 'application/octet-stream') + { + return $mimetype; + } + } + // Return any mimetype if we got a result or the fallback value + return (!empty($mimetype)) ? $mimetype : 'application/octet-stream'; + } +} diff --git a/phpBB/phpbb/mimetype/guesser_base.php b/phpBB/phpbb/mimetype/guesser_base.php new file mode 100644 index 0000000000..082b098028 --- /dev/null +++ b/phpBB/phpbb/mimetype/guesser_base.php @@ -0,0 +1,38 @@ +<?php +/** +* +* @package phpBB3 +* @copyright (c) 2013 phpBB Group +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* +*/ + +namespace phpbb\mimetype; + +/** +* @package mimetype +*/ + +abstract class guesser_base implements guesser_interface +{ + /** + * @var int Guesser Priority + */ + protected $priority; + + /** + * @inheritdoc + */ + public function get_priority() + { + return $this->priority; + } + + /** + * @inheritdoc + */ + public function set_priority($priority) + { + $this->priority = $priority; + } +} diff --git a/phpBB/phpbb/mimetype/guesser_interface.php b/phpBB/phpbb/mimetype/guesser_interface.php new file mode 100644 index 0000000000..103689765e --- /dev/null +++ b/phpBB/phpbb/mimetype/guesser_interface.php @@ -0,0 +1,49 @@ +<?php +/** +* +* @package phpBB3 +* @copyright (c) 2013 phpBB Group +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* +*/ + +namespace phpbb\mimetype; + +/** +* @package mimetype +*/ + +interface guesser_interface +{ + /** + * Returns whether this guesser is supported on the current OS + * + * @return bool True if guesser is supported, false if not + */ + public function is_supported(); + + /** + * Guess mimetype of supplied file + * + * @param string $file Path to file + * + * @return string Guess for mimetype of file + */ + public function guess($file, $file_name = ''); + + /** + * Get the guesser priority + * + * @return int Guesser priority + */ + public function get_priority(); + + /** + * Set the guesser priority + * + * @param int Guesser priority + * + * @return void + */ + public function set_priority($priority); +} diff --git a/phpBB/phpbb/pagination.php b/phpBB/phpbb/pagination.php new file mode 100644 index 0000000000..467dc2157f --- /dev/null +++ b/phpBB/phpbb/pagination.php @@ -0,0 +1,306 @@ +<?php +/** +* +* @package phpbb +* @copyright (c) 2013 phpBB Group +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* +*/ + +namespace phpbb; + +class pagination +{ + /** @var \phpbb\template\template */ + protected $template; + + /** @var \phpbb\user */ + protected $user; + + /** + * Constructor + * + * @param \phpbb\template\template $template + * @param \phpbb\user $user + */ + public function __construct(\phpbb\template\template $template, \phpbb\user $user) + { + $this->template = $template; + $this->user = $user; + } + + /** + * Generate a pagination link based on the url and the page information + * + * @param string $base_url is url prepended to all links generated within the function + * If you use page numbers inside your controller route, base_url should contains a placeholder (%d) + * for the page. Also be sure to specify the pagination path information into the start_name argument + * @param string $on_page is the page for which we want to generate the link + * @param string $start_name is the name of the parameter containing the first item of the given page (example: start=20) + * If you use page numbers inside your controller route, start name should be the string + * that should be removed for the first page (example: /page/%d) + * @param int $per_page the number of items, posts, etc. to display per page, used to determine the number of pages to produce + * @return URL for the requested page + */ + protected function generate_page_link($base_url, $on_page, $start_name, $per_page) + { + if (strpos($start_name, '%d') !== false) + { + return ($on_page > 1) ? sprintf($base_url, (int) $on_page) : str_replace($start_name, '', $base_url); + } + else + { + $url_delim = (strpos($base_url, '?') === false) ? '?' : ((strpos($base_url, '?') === strlen($base_url) - 1) ? '' : '&'); + return ($on_page > 1) ? $base_url . $url_delim . $start_name . '=' . (($on_page - 1) * $per_page) : $base_url; + } + } + + /** + * Generate template rendered pagination + * Allows full control of rendering of pagination with the template + * + * @param string $base_url is url prepended to all links generated within the function + * If you use page numbers inside your controller route, base_url should contains a placeholder (%d) + * for the page. Also be sure to specify the pagination path information into the start_name argument + * @param string $block_var_name is the name assigned to the pagination data block within the template (example: <!-- BEGIN pagination -->) + * @param string $start_name is the name of the parameter containing the first item of the given page (example: start=20) + * If you use page numbers inside your controller route, start name should be the string + * that should be removed for the first page (example: /page/%d) + * @param int $num_items the total number of items, posts, etc., used to determine the number of pages to produce + * @param int $per_page the number of items, posts, etc. to display per page, used to determine the number of pages to produce + * @param int $start the item which should be considered currently active, used to determine the page we're on + * @param bool $reverse_count determines whether we weight display of the list towards the start (false) or end (true) of the list + * @param bool $ignore_on_page decides whether we enable an active (unlinked) item, used primarily for embedded lists + * @return null + */ + public function generate_template_pagination($base_url, $block_var_name, $start_name, $num_items, $per_page, $start = 1, $reverse_count = false, $ignore_on_page = false) + { + $total_pages = ceil($num_items / $per_page); + + if ($total_pages == 1 || !$num_items) + { + return; + } + + $on_page = $this->get_on_page($per_page, $start); + + if ($reverse_count) + { + $start_page = ($total_pages > 5) ? $total_pages - 4 : 1; + $end_page = $total_pages; + } + else + { + // What we're doing here is calculating what the "start" and "end" pages should be. We + // do this by assuming pagination is "centered" around the currently active page with + // the three previous and three next page links displayed. Anything more than that and + // we display the ellipsis, likewise anything less. + // + // $start_page is the page at which we start creating the list. When we have five or less + // pages we start at page 1 since there will be no ellipsis displayed. Anymore than that + // and we calculate the start based on the active page. This is the min/max calculation. + // First (max) would we end up starting on a page less than 1? Next (min) would we end + // up starting so close to the end that we'd not display our minimum number of pages. + // + // $end_page is the last page in the list to display. Like $start_page we use a min/max to + // determine this number. Again at most five pages? Then just display them all. More than + // five and we first (min) determine whether we'd end up listing more pages than exist. + // We then (max) ensure we're displaying the minimum number of pages. + $start_page = ($total_pages > 5) ? min(max(1, $on_page - 3), $total_pages - 4) : 1; + $end_page = ($total_pages > 5) ? max(min($total_pages, $on_page + 3), 5) : $total_pages; + } + + $u_previous_page = $u_next_page = ''; + if ($on_page != 1) + { + $u_previous_page = $this->generate_page_link($base_url, $on_page - 1, $start_name, $per_page); + + $this->template->assign_block_vars($block_var_name, array( + 'PAGE_NUMBER' => '', + 'PAGE_URL' => $u_previous_page, + 'S_IS_CURRENT' => false, + 'S_IS_PREV' => true, + 'S_IS_NEXT' => false, + 'S_IS_ELLIPSIS' => false, + )); + } + + // This do...while exists purely to negate the need for start and end assign_block_vars, i.e. + // to display the first and last page in the list plus any ellipsis. We use this loop to jump + // around a little within the list depending on where we're starting (and ending). + $at_page = 1; + do + { + // We decide whether to display the ellipsis during the loop. The ellipsis is always + // displayed as either the second or penultimate item in the list. So are we at either + // of those points and of course do we even need to display it, i.e. is the list starting + // on at least page 3 and ending three pages before the final item. + $this->template->assign_block_vars($block_var_name, array( + 'PAGE_NUMBER' => $at_page, + 'PAGE_URL' => $this->generate_page_link($base_url, $at_page, $start_name, $per_page), + 'S_IS_CURRENT' => (!$ignore_on_page && $at_page == $on_page), + 'S_IS_NEXT' => false, + 'S_IS_PREV' => false, + 'S_IS_ELLIPSIS' => ($at_page == 2 && $start_page > 2) || ($at_page == $total_pages - 1 && $end_page < $total_pages - 1), + )); + + // We may need to jump around in the list depending on whether we have or need to display + // the ellipsis. Are we on page 2 and are we more than one page away from the start + // of the list? Yes? Then we jump to the start of the list. Likewise are we at the end of + // the list and are there more than two pages left in total? Yes? Then jump to the penultimate + // page (so we can display the ellipsis next pass). Else, increment the counter and keep + // going + if ($at_page == 2 && $at_page < $start_page - 1) + { + $at_page = $start_page; + } + else if ($at_page == $end_page && $end_page < $total_pages - 1) + { + $at_page = $total_pages - 1; + } + else + { + $at_page++; + } + } + while ($at_page <= $total_pages); + + if ($on_page != $total_pages) + { + $u_next_page = $this->generate_page_link($base_url, $on_page + 1, $start_name, $per_page); + + $this->template->assign_block_vars($block_var_name, array( + 'PAGE_NUMBER' => '', + 'PAGE_URL' => $u_next_page, + 'S_IS_CURRENT' => false, + 'S_IS_PREV' => false, + 'S_IS_NEXT' => true, + 'S_IS_ELLIPSIS' => false, + )); + } + + // If the block_var_name is a nested block, we will use the last (most + // inner) block as a prefix for the template variables. If the last block + // name is pagination, the prefix is empty. If the rest of the + // block_var_name is not empty, we will modify the last row of that block + // and add our pagination items. + $tpl_block_name = $tpl_prefix = ''; + if (strrpos($block_var_name, '.') !== false) + { + $tpl_block_name = substr($block_var_name, 0, strrpos($block_var_name, '.')); + $tpl_prefix = strtoupper(substr($block_var_name, strrpos($block_var_name, '.') + 1)); + } + else + { + $tpl_prefix = strtoupper($block_var_name); + } + $tpl_prefix = ($tpl_prefix == 'PAGINATION') ? '' : $tpl_prefix . '_'; + + $template_array = array( + $tpl_prefix . 'BASE_URL' => $base_url, + $tpl_prefix . 'PER_PAGE' => $per_page, + 'U_' . $tpl_prefix . 'PREVIOUS_PAGE' => ($on_page != 1) ? $u_previous_page : '', + 'U_' . $tpl_prefix . 'NEXT_PAGE' => ($on_page != $total_pages) ? $u_next_page : '', + $tpl_prefix . 'TOTAL_PAGES' => $total_pages, + $tpl_prefix . 'CURRENT_PAGE' => $on_page, + ); + + if ($tpl_block_name) + { + $this->template->alter_block_array($tpl_block_name, $template_array, true, 'change'); + } + else + { + $this->template->assign_vars($template_array); + } + } + + /** + * Get current page number + * + * @param int $per_page the number of items, posts, etc. per page + * @param int $start the item which should be considered currently active, used to determine the page we're on + * @return int Current page number + */ + public function get_on_page($per_page, $start) + { + return floor($start / $per_page) + 1; + } + + /** + * Return current page + * This function also sets certain specific template variables + * + * @param string $base_url the base url used to call this page, used by Javascript for popup jump to page + * @param int $num_items the total number of items, posts, topics, etc. + * @param int $per_page the number of items, posts, etc. per page + * @param int $start the item which should be considered currently active, used to determine the page we're on + * @return string Descriptive pagination string (e.g. "page 1 of 10") + */ + public function on_page($base_url, $num_items, $per_page, $start) + { + $on_page = $this->get_on_page($per_page, $start); + + $this->template->assign_vars(array( + 'PER_PAGE' => $per_page, + 'ON_PAGE' => $on_page, + 'BASE_URL' => $base_url, + )); + + return $this->user->lang('PAGE_OF', $on_page, max(ceil($num_items / $per_page), 1)); + } + + /** + * Get current page number + * + * @param int $start the item which should be considered currently active, used to determine the page we're on + * @param int $per_page the number of items, posts, etc. per page + * @param int $num_items the total number of items, posts, topics, etc. + * @return int Current page number + */ + public function validate_start($start, $per_page, $num_items) + { + if ($start < 0 || $start >= $num_items) + { + return ($start < 0) ? 0 : floor(($num_items - 1) / $per_page) * $per_page; + } + + return $start; + } + + /** + * Get new start when searching from the end + * + * If the user is trying to reach late pages, start searching from the end. + * + * @param int $start the item which should be considered currently active, used to determine the page we're on + * @param int $limit the number of items, posts, etc. to display + * @param int $num_items the total number of items, posts, topics, etc. + * @return int Current page number + */ + public function reverse_start($start, $limit, $num_items) + { + return max(0, $num_items - $limit - $start); + } + + /** + * Get new item limit when searching from the end + * + * If the user is trying to reach late pages, start searching from the end. + * In this case the items to display might be lower then the actual per_page setting. + * + * @param int $start the item which should be considered currently active, used to determine the page we're on + * @param int $per_page the number of items, posts, etc. per page + * @param int $num_items the total number of items, posts, topics, etc. + * @return int Current page number + */ + public function reverse_limit($start, $per_page, $num_items) + { + if ($start + $per_page > $num_items) + { + return min($per_page, max(1, $num_items - $start)); + } + + return $per_page; + } +} diff --git a/phpBB/phpbb/plupload/plupload.php b/phpBB/phpbb/plupload/plupload.php index f21ec40450..6bff2b8a7e 100644 --- a/phpBB/phpbb/plupload/plupload.php +++ b/phpBB/phpbb/plupload/plupload.php @@ -42,6 +42,11 @@ class plupload protected $php_ini; /** + * @var \phpbb\mimetype\guesser + */ + protected $mimetype_guesser; + + /** * Final destination for uploaded files, i.e. the "files" directory. * @var string */ @@ -61,16 +66,18 @@ class plupload * @param \phpbb\request\request_interface $request * @param \phpbb\user $user * @param \phpbb\php\ini $php_ini + * @param \phpbb\mimetype\guesser $mimetype_guesser * * @return null */ - public function __construct($phpbb_root_path, \phpbb\config\config $config, \phpbb\request\request_interface $request, \phpbb\user $user, \phpbb\php\ini $php_ini) + public function __construct($phpbb_root_path, \phpbb\config\config $config, \phpbb\request\request_interface $request, \phpbb\user $user, \phpbb\php\ini $php_ini, \phpbb\mimetype\guesser $mimetype_guesser) { $this->phpbb_root_path = $phpbb_root_path; $this->config = $config; $this->request = $request; $this->user = $user; $this->php_ini = $php_ini; + $this->mimetype_guesser = $mimetype_guesser; $this->upload_directory = $this->phpbb_root_path . $this->config['upload_path']; $this->temporary_directory = $this->upload_directory . '/plupload'; @@ -113,14 +120,12 @@ class plupload { rename("{$file_path}.part", $file_path); - $file_info = new \Symfony\Component\HttpFoundation\File\File($file_path); - // Need to modify some of the $_FILES values to reflect the new file return array( 'tmp_name' => $file_path, 'name' => $this->request->variable('real_filename', ''), 'size' => filesize($file_path), - 'type' => $file_info->getMimeType($file_path), + 'type' => $this->mimetype_guesser->guess($file_path, $file_name), ); } else diff --git a/phpBB/phpbb/request/request.php b/phpBB/phpbb/request/request.php index e158d33c01..3171a6edb7 100644 --- a/phpBB/phpbb/request/request.php +++ b/phpBB/phpbb/request/request.php @@ -217,7 +217,7 @@ class request implements \phpbb\request\request_interface * @return mixed The value of $_REQUEST[$var_name] run through {@link set_var set_var} to ensure that the type is the * the same as that of $default. If the variable is not set $default is returned. */ - public function untrimmed_variable($var_name, $default, $multibyte, $super_global = \phpbb\request\request_interface::REQUEST) + public function untrimmed_variable($var_name, $default, $multibyte = false, $super_global = \phpbb\request\request_interface::REQUEST) { return $this->_variable($var_name, $default, $multibyte, $super_global, false); } diff --git a/phpBB/posting.php b/phpBB/posting.php index 5db36007c2..0d2cff40bc 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -385,9 +385,13 @@ if ($mode == 'bump') { $meta_url = phpbb_bump_topic($forum_id, $topic_id, $post_data, $current_time); meta_refresh(3, $meta_url); + $message = $user->lang['TOPIC_BUMPED']; - $message = $user->lang['TOPIC_BUMPED'] . '<br /><br />' . $user->lang('VIEW_MESSAGE', '<a href="' . $meta_url . '">', '</a>'); - $message .= '<br /><br />' . sprintf($user->lang['RETURN_FORUM'], '<a href="' . append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_id) . '">', '</a>'); + if (!$request->is_ajax()) + { + $message .= '<br /><br />' . $user->lang('VIEW_MESSAGE', '<a href="' . $meta_url . '">', '</a>'); + $message .= '<br /><br />' . $user->lang('RETURN_FORUM', '<a href="' . append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_id) . '">', '</a>'); + } trigger_error($message); } @@ -1616,7 +1620,7 @@ function upload_popup($forum_style = 0) */ function handle_post_delete($forum_id, $topic_id, $post_id, &$post_data, $is_soft = false, $soft_delete_reason = '') { - global $user, $db, $auth, $config; + global $user, $db, $auth, $config, $request; global $phpbb_root_path, $phpEx; $perm_check = ($is_soft) ? 'softdelete' : 'delete'; @@ -1662,11 +1666,19 @@ function handle_post_delete($forum_id, $topic_id, $post_id, &$post_data, $is_sof add_log('mod', $forum_id, $topic_id, (($is_soft) ? 'LOG_SOFTDELETE_POST' : 'LOG_DELETE_POST'), $post_data['post_subject'], $post_username); $meta_info = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id&p=$next_post_id") . "#p$next_post_id"; - $message = $user->lang['POST_DELETED'] . '<br /><br />' . sprintf($user->lang['RETURN_TOPIC'], '<a href="' . $meta_info . '">', '</a>'); + $message = $user->lang['POST_DELETED']; + + if (!$request->is_ajax()) + { + $message .= '<br /><br />' . $user->lang('RETURN_TOPIC', '<a href="' . $meta_info . '">', '</a>'); + } } meta_refresh(3, $meta_info); - $message .= '<br /><br />' . sprintf($user->lang['RETURN_FORUM'], '<a href="' . append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_id) . '">', '</a>'); + if (!$request->is_ajax()) + { + $message .= '<br /><br />' . $user->lang('RETURN_FORUM', '<a href="' . append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_id) . '">', '</a>'); + } trigger_error($message); } else diff --git a/phpBB/search.php b/phpBB/search.php index ae573b18e8..4ddade90f5 100644 --- a/phpBB/search.php +++ b/phpBB/search.php @@ -120,6 +120,7 @@ $s_limit_days = $s_sort_key = $s_sort_dir = $u_sort_param = ''; gen_sort_selects($limit_days, $sort_by_text, $sort_days, $sort_key, $sort_dir, $s_limit_days, $s_sort_key, $s_sort_dir, $u_sort_param); $phpbb_content_visibility = $phpbb_container->get('content.visibility'); +$pagination = $phpbb_container->get('pagination'); if ($keywords || $author || $author_id || $search_id || $submit) { @@ -501,14 +502,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) } // Make sure $start is set to the last page if it exceeds the amount - if ($start < 0) - { - $start = 0; - } - else if ($start >= $total_match_count) - { - $start = floor(($total_match_count - 1) / $per_page) * $per_page; - } + $start = $pagination->validate_start($start, $per_page, $total_match_count); $id_ary = array_slice($id_ary, $start, $per_page); } @@ -600,7 +594,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) $phrase_search_disabled = $search->supports_phrase_search() ? false : true; } - phpbb_generate_template_pagination($template, $u_search, 'pagination', 'start', $total_match_count, $per_page, $start); + $pagination->generate_template_pagination($u_search, 'pagination', 'start', $total_match_count, $per_page, $start); $template->assign_vars(array( 'SEARCH_TITLE' => $l_search_title, @@ -608,7 +602,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) 'SEARCH_WORDS' => $keywords, 'SEARCHED_QUERY' => $search->get_search_query(), 'IGNORED_WORDS' => (sizeof($common_words)) ? implode(' ', $common_words) : '', - 'PAGE_NUMBER' => phpbb_on_page($template, $user, $u_search, $total_match_count, $per_page, $start), + 'PAGE_NUMBER' => $pagination->on_page($u_search, $total_match_count, $per_page, $start), 'PHRASE_SEARCH_DISABLED' => $phrase_search_disabled, @@ -1025,7 +1019,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) if ($show_results == 'topics') { - phpbb_generate_template_pagination($template, $view_topic_url, 'searchresults.pagination', 'start', $replies + 1, $config['posts_per_page'], 1, true, true); + $pagination->generate_template_pagination($view_topic_url, 'searchresults.pagination', 'start', $replies + 1, $config['posts_per_page'], 1, true, true); } } diff --git a/phpBB/styles/prosilver/template/forum_fn.js b/phpBB/styles/prosilver/template/forum_fn.js index 1b2b1954ef..a45f750a63 100644 --- a/phpBB/styles/prosilver/template/forum_fn.js +++ b/phpBB/styles/prosilver/template/forum_fn.js @@ -434,6 +434,39 @@ function parse_document(container) }); /** + * Dropdowns + */ + container.find('.dropdown-container').each(function() { + var $this = $(this), + trigger = $this.find('.dropdown-trigger:first'), + contents = $this.find('.dropdown'), + options = { + direction: 'auto', + verticalDirection: 'auto' + }, + data; + + if (!trigger.length) { + data = $this.attr('data-dropdown-trigger'); + trigger = data ? $this.children(data) : $this.children('a:first'); + } + + if (!contents.length) { + data = $this.attr('data-dropdown-contents'); + contents = data ? $this.children(data) : $this.children('div:first'); + } + + if (!trigger.length || !contents.length) return; + + if ($this.hasClass('dropdown-up')) options.verticalDirection = 'up'; + if ($this.hasClass('dropdown-down')) options.verticalDirection = 'down'; + if ($this.hasClass('dropdown-left')) options.direction = 'left'; + if ($this.hasClass('dropdown-right')) options.direction = 'right'; + + phpbb.registerDropdown(trigger, contents, options); + }); + + /** * Adjust HTML code for IE8 and older versions */ if (oldBrowser) { diff --git a/phpBB/styles/prosilver/template/index_body.html b/phpBB/styles/prosilver/template/index_body.html index 8acc0a8812..58a5420db3 100644 --- a/phpBB/styles/prosilver/template/index_body.html +++ b/phpBB/styles/prosilver/template/index_body.html @@ -3,6 +3,8 @@ <p class="{S_CONTENT_FLOW_END} responsive-center<!-- IF S_USER_LOGGED_IN --> rightside<!-- ENDIF -->"><!-- IF S_USER_LOGGED_IN -->{LAST_VISIT_DATE}<!-- ELSE -->{CURRENT_TIME}<!-- ENDIF --></p> <!-- IF S_USER_LOGGED_IN --><p class="responsive-center">{CURRENT_TIME}<!-- IF U_MCP or U_ACP --> <br />[ <!-- IF U_ACP --><a href="{U_ACP}" title="{L_ACP}" data-responsive-text="{L_ACP_SHORT}">{L_ACP}</a><!-- IF U_MCP --> | <!-- ENDIF --><!-- ENDIF --><!-- IF U_MCP --><a href="{U_MCP}" title="{L_MCP}" data-responsive-text="{L_MCP_SHORT}">{L_MCP}</a><!-- ENDIF --> ]<!-- ENDIF --></p><!-- ENDIF --> +<!-- EVENT index_body_linklist_before --> + <!-- IF S_DISPLAY_SEARCH or (S_USER_LOGGED_IN and not S_IS_BOT) --> <ul class="linklist bulletin"> <!-- IF S_DISPLAY_SEARCH --> @@ -19,6 +21,8 @@ </ul> <!-- ENDIF --> +<!-- EVENT index_body_linklist_after --> + <!-- INCLUDE forumlist_body.html --> <!-- IF not S_USER_LOGGED_IN and not S_IS_BOT --> diff --git a/phpBB/styles/prosilver/template/overall_footer.html b/phpBB/styles/prosilver/template/overall_footer.html index 6f297660a2..f7d0269edb 100644 --- a/phpBB/styles/prosilver/template/overall_footer.html +++ b/phpBB/styles/prosilver/template/overall_footer.html @@ -7,14 +7,11 @@ <div class="inner"> <ul class="linklist bulletin"> - <li class="small-icon icon-home breadcrumbs"><!-- IF U_SITE_HOME --><span class="crumb"><a href="{U_SITE_HOME}">{L_SITE_HOME}</a> <strong>‹</strong></span> <!-- ENDIF --><span class="crumb"><a href="{U_INDEX}" accesskey="h">{L_INDEX}</a></span> + <li class="small-icon icon-home breadcrumbs"><!-- IF U_SITE_HOME --><span class="crumb"><a href="{U_SITE_HOME}">{L_SITE_HOME}</a> <strong>‹</strong></span> <!-- ENDIF --><span class="crumb"><a href="{U_INDEX}">{L_INDEX}</a></span> <!-- EVENT overall_footer_breadcrumb_append --> </li> <!-- IF not S_IS_BOT --> <!-- IF U_WATCH_FORUM_LINK --><li class="small-icon icon-<!-- IF S_WATCHING_FORUM -->unsubscribe<!-- ELSE -->subscribe<!-- ENDIF -->"><a href="{U_WATCH_FORUM_LINK}" title="{S_WATCH_FORUM_TITLE}" data-ajax="toggle_link" data-toggle-class="small-icon icon-<!-- IF not S_WATCHING_FORUM -->unsubscribe<!-- ELSE -->subscribe<!-- ENDIF -->" data-toggle-text="{S_WATCH_FORUM_TOGGLE}" data-toggle-url="{U_WATCH_FORUM_TOGGLE}">{S_WATCH_FORUM_TITLE}</a></li><!-- ENDIF --> - <!-- IF U_WATCH_TOPIC --><li class="small-icon icon-<!-- IF S_WATCHING_TOPIC -->unsubscribe<!-- ELSE -->subscribe<!-- ENDIF -->"><a href="{U_WATCH_TOPIC}" title="{S_WATCH_TOPIC_TITLE}" data-ajax="toggle_link" data-toggle-class="small-icon icon-<!-- IF not S_WATCHING_TOPIC -->unsubscribe<!-- ELSE -->subscribe<!-- ENDIF -->" data-toggle-text="{S_WATCH_TOPIC_TOGGLE}" data-toggle-url="{U_WATCH_TOPIC_TOGGLE}">{S_WATCH_TOPIC_TITLE}</a></li><!-- ENDIF --> - <!-- IF U_BOOKMARK_TOPIC --><li class="small-icon icon-bookmark"><a href="{U_BOOKMARK_TOPIC}" title="{L_BOOKMARK_TOPIC}" data-ajax="alt_text" data-alt-text="{S_BOOKMARK_TOGGLE}">{S_BOOKMARK_TOPIC}</a></li><!-- ENDIF --> - <!-- IF U_BUMP_TOPIC --><li class="small-icon icon-bump"><a href="{U_BUMP_TOPIC}" title="{L_BUMP_TOPIC}" data-ajax="true">{L_BUMP_TOPIC}</a></li><!-- ENDIF --> <!-- ENDIF --> <li class="rightside">{S_TIMEZONE}</li> <!-- IF not S_IS_BOT --><li class="rightside"><a href="{U_DELETE_COOKIES}" data-ajax="true" data-refresh="true">{L_DELETE_COOKIES}</a></li><!-- ENDIF --> diff --git a/phpBB/styles/prosilver/template/plupload.html b/phpBB/styles/prosilver/template/plupload.html index 564c1b5c36..290992ddd6 100644 --- a/phpBB/styles/prosilver/template/plupload.html +++ b/phpBB/styles/prosilver/template/plupload.html @@ -1,31 +1,47 @@ -<script type="text/javascript" src="{T_ASSETS_PATH}/plupload/plupload.js"></script> -<script type="text/javascript" src="{T_ASSETS_PATH}/plupload/plupload.html5.js"></script> -<script type="text/javascript" src="{T_ASSETS_PATH}/plupload/jquery.plupload.queue/jquery.plupload.queue.js"></script> +<script type="text/javascript" src="{T_ASSETS_PATH}/plupload/plupload.full.min.js?assets_version={T_ASSETS_VERSION}"></script> +<script type="text/javascript" src="{T_ASSETS_PATH}/plupload/jquery.plupload.queue/jquery.plupload.queue.min.js?assets_version={T_ASSETS_VERSION}"></script> <script type="text/javascript"> //<![CDATA[ phpbb.plupload = { i18n: { - 'Select files': '{LA_PLUPLOAD_SELECT_FILES}', + 'b': '{LA_BYTES_SHORT}', + 'kb': '{LA_KB}', + 'mb': '{LA_MB}', + 'gb': '{LA_GB}', + 'tb': '{LA_TB}', + 'Add Files': '{LA_PLUPLOAD_ADD_FILES}', 'Add files to the upload queue and click the start button.': '{LA_PLUPLOAD_ADD_FILES_TO_QUEUE}', - 'Filename': '{LA_PLUPLOAD_FILENAME}', - 'Status': '{LA_PLUPLOAD_STATUS}', - 'Size': '{LA_PLUPLOAD_SIZE}', - 'Add files': '{LA_PLUPLOAD_ADD_FILES}', - 'Stop current upload': '{LA_PLUPLOAD_STOP_CURRENT_UPLOAD}', - 'Start uploading queue': '{LA_PLUPLOAD_START_CURRENT_UPLOAD}', - 'Uploaded %d/%d files': '{LA_PLUPLOAD_UPLOADED}', - 'N/A': '{LA_PLUPLOAD_NOT_APPLICABLE}', + 'Close': '{LA_PLUPLOAD_CLOSE}', 'Drag files here.': '{LA_PLUPLOAD_DRAG}', + 'Duplicate file error.': '{LA_PLUPLOAD_DUPLICATE_ERROR}', + 'Error: File too large:': '{LA_PLUPLOAD_ERR_FILE_TOO_LARGE}', + 'Error: Invalid file extension:': '{LA_PLUPLOAD_ERR_FILE_INVALID_EXT}', + 'File: %s': '{LA_PLUPLOAD_FILE}', + 'File: %s, size: %d, max file size: %d': '{LA_PLUPLOAD_FILE_DETAILS}', + 'File count error.': '{LA_PLUPLOAD_ERR_FILE_COUNT}', 'File extension error.': '{LA_PLUPLOAD_EXTENSION_ERROR}', 'File size error.': '{LA_PLUPLOAD_SIZE_ERROR}', - 'Init error.': '{LA_PLUPLOAD_INIT_ERROR}', - 'HTTP Error.': '{LA_PLUPLOAD_HTTP_ERROR}', - 'Security error.': '{LA_PLUPLOAD_SECURITY_ERROR}', + 'Filename': '{LA_PLUPLOAD_FILENAME}', 'Generic error.': '{LA_PLUPLOAD_GENERIC_ERROR}', + 'HTTP Error.': '{LA_PLUPLOAD_HTTP_ERROR}', + 'Image format either wrong or not supported.': '{LA_PLUPLOAD_IMAGE_FORMAT}', + 'Init error.': '{LA_PLUPLOAD_INIT_ERROR}', 'IO error.': '{LA_PLUPLOAD_IO_ERROR}', + 'N/A': '{LA_PLUPLOAD_NOT_APPLICABLE}', + 'Runtime ran out of available memory.': '{LA_PLUPLOAD_ERR_RUNTIME_MEMORY}', + 'Security error.': '{LA_PLUPLOAD_SECURITY_ERROR}', + 'Select files': '{LA_PLUPLOAD_SELECT_FILES}', + 'Size': '{LA_PLUPLOAD_SIZE}', + 'Start Upload': '{LA_PLUPLOAD_START_UPLOAD}', + 'Start uploading queue': '{LA_PLUPLOAD_START_CURRENT_UPLOAD}', + 'Status': '{LA_PLUPLOAD_STATUS}', 'Stop Upload': '{LA_PLUPLOAD_STOP_UPLOAD}', - 'Start upload': '{LA_PLUPLOAD_START_UPLOAD}', - '%d files queued': '{LA_PLUPLOAD_FILES_QUEUED}' + 'Stop current upload': '{LA_PLUPLOAD_STOP_CURRENT_UPLOAD}', + 'Upload element accepts only %d file(s) at a time. Extra files were stripped.': '{LA_PLUPLOAD_ERR_UPLOAD_LIMIT}', + "Upload URL might be wrong or doesn't exist.": '{LA_PLUPLOAD_ERR_UPLOAD_URL}', + 'Uploaded %d/%d files': '{LA_PLUPLOAD_UPLOADED}', + '%d files queued': '{LA_PLUPLOAD_FILES_QUEUED}', + '%s already present in the queue.': '{LA_PLUPLOAD_ALREADY_QUEUED}' }, config: { runtimes: 'html5', diff --git a/phpBB/styles/prosilver/template/posting_buttons.html b/phpBB/styles/prosilver/template/posting_buttons.html index e8338c6c86..137970bbdf 100644 --- a/phpBB/styles/prosilver/template/posting_buttons.html +++ b/phpBB/styles/prosilver/template/posting_buttons.html @@ -59,6 +59,7 @@ </dl> </div> +<!-- EVENT posting_editor_buttons_before --> <div id="format-buttons"> <input type="button" class="button2" accesskey="b" name="addbbcode0" value=" B " style="font-weight:bold; width: 30px" onclick="bbstyle(0)" title="{L_BBCODE_B_HELP}" /> <input type="button" class="button2" accesskey="i" name="addbbcode2" value=" i " style="font-style:italic; width: 30px" onclick="bbstyle(2)" title="{L_BBCODE_I_HELP}" /> @@ -95,4 +96,5 @@ <input type="button" class="button2" name="addbbcode{custom_tags.BBCODE_ID}" value="{custom_tags.BBCODE_TAG}" onclick="bbstyle({custom_tags.BBCODE_ID})" title="{custom_tags.BBCODE_HELPLINE}" /> <!-- END custom_tags --> </div> +<!-- EVENT posting_editor_buttons_after --> <!-- ENDIF --> diff --git a/phpBB/styles/prosilver/template/search_results.html b/phpBB/styles/prosilver/template/search_results.html index c5b2b990c8..1a83484235 100644 --- a/phpBB/styles/prosilver/template/search_results.html +++ b/phpBB/styles/prosilver/template/search_results.html @@ -64,8 +64,13 @@ <div class="list-inner"> <!-- EVENT topiclist_row_prepend --> - <!-- IF searchresults.S_UNREAD_TOPIC --><a href="{searchresults.U_NEWEST_POST}">{NEWEST_POST_IMG}</a> <!-- ENDIF --> - <a href="{searchresults.U_VIEW_TOPIC}" class="topictitle">{searchresults.TOPIC_TITLE}</a> {searchresults.ATTACH_ICON_IMG} + <!-- IF searchresults.S_UNREAD_TOPIC and not S_IS_BOT --> + <a href="{searchresults.U_NEWEST_POST}">{NEWEST_POST_IMG}</a> + <a href="{searchresults.U_NEWEST_POST}" class="topictitle">{searchresults.TOPIC_TITLE}</a> + <!-- ELSE --> + <a href="{searchresults.U_VIEW_TOPIC}" class="topictitle">{searchresults.TOPIC_TITLE}</a> + <!-- ENDIF --> + {searchresults.ATTACH_ICON_IMG} <!-- IF searchresults.S_TOPIC_UNAPPROVED or searchresults.S_POSTS_UNAPPROVED --><a href="{searchresults.U_MCP_QUEUE}">{searchresults.UNAPPROVED_IMG}</a> <!-- ENDIF --> <!-- IF searchresults.S_TOPIC_DELETED --><a href="{searchresults.U_MCP_QUEUE}">{DELETED_IMG}</a> <!-- ENDIF --> <!-- IF searchresults.S_TOPIC_REPORTED --><a href="{searchresults.U_MCP_REPORT}">{REPORTED_IMG}</a><!-- ENDIF --><br /> @@ -83,7 +88,7 @@ </ul> </div> <!-- ENDIF --> - {L_POST_BY_AUTHOR} {searchresults.TOPIC_AUTHOR_FULL} » {searchresults.FIRST_POST_TIME} » {L_IN} <a href="{searchresults.U_VIEW_FORUM}">{searchresults.FORUM_TITLE}</a> + {L_POST_BY_AUTHOR} {searchresults.TOPIC_AUTHOR_FULL} » <!-- IF not S_IS_BOT --><a href="{searchresults.U_VIEW_TOPIC}" title="{L_GOTO_FIRST_POST}">{searchresults.FIRST_POST_TIME}</a><!-- ELSE -->{searchresults.FIRST_POST_TIME}<!-- ENDIF --> » {L_IN} <a href="{searchresults.U_VIEW_FORUM}">{searchresults.FORUM_TITLE}</a> <!-- EVENT topiclist_row_append --> </div> @@ -92,7 +97,7 @@ <dd class="views">{searchresults.TOPIC_VIEWS}</dd> <dd class="lastpost"><span> {L_POST_BY_AUTHOR} {searchresults.LAST_POST_AUTHOR_FULL} - <!-- IF not S_IS_BOT --><a href="{searchresults.U_LAST_POST}">{LAST_POST_IMG}</a> <!-- ENDIF --><br />{searchresults.LAST_POST_TIME}<br /> </span> + <!-- IF not S_IS_BOT --><a href="{searchresults.U_LAST_POST}" title="{L_GOTO_LAST_POST}">{LAST_POST_IMG}</a> <!-- ENDIF --><br />{searchresults.LAST_POST_TIME}<br /> </span> </dd> </dl> </li> diff --git a/phpBB/styles/prosilver/template/ucp_main_bookmarks.html b/phpBB/styles/prosilver/template/ucp_main_bookmarks.html index 477b06249e..96becc42e7 100644 --- a/phpBB/styles/prosilver/template/ucp_main_bookmarks.html +++ b/phpBB/styles/prosilver/template/ucp_main_bookmarks.html @@ -37,9 +37,15 @@ <dl class="icon {topicrow.TOPIC_IMG_STYLE}"> <dt<!-- IF topicrow.TOPIC_ICON_IMG --> style="background-image: url({T_ICONS_PATH}{topicrow.TOPIC_ICON_IMG}); background-repeat: no-repeat;"<!-- ENDIF --> title="{topicrow.TOPIC_FOLDER_IMG_ALT}"> <div class="list-inner"> - <!-- IF topicrow.S_UNREAD_TOPIC --><a href="{topicrow.U_NEWEST_POST}">{NEWEST_POST_IMG}</a> <!-- ENDIF --><a href="{topicrow.U_VIEW_TOPIC}" class="topictitle">{topicrow.TOPIC_TITLE}</a> + <!-- IF topicrow.S_UNREAD_TOPIC --> + <a href="{topicrow.U_NEWEST_POST}">{NEWEST_POST_IMG}</a> + <a href="{topicrow.U_NEWEST_POST}" class="topictitle">{topicrow.TOPIC_TITLE}</a> + <!-- ELSE --> + <a href="{topicrow.U_VIEW_TOPIC}" class="topictitle">{topicrow.TOPIC_TITLE}</a> + <!-- ENDIF --> <!-- IF topicrow.S_TOPIC_UNAPPROVED or topicrow.S_POSTS_UNAPPROVED --><a href="{topicrow.U_MCP_QUEUE}">{topicrow.UNAPPROVED_IMG}</a> <!-- ENDIF --> - <!-- IF topicrow.S_TOPIC_REPORTED --><a href="{topicrow.U_MCP_REPORT}">{REPORTED_IMG}</a><!-- ENDIF --><br /> + <!-- IF topicrow.S_TOPIC_REPORTED --><a href="{topicrow.U_MCP_REPORT}">{REPORTED_IMG}</a><!-- ENDIF --> + <br /> <!-- IF .topicrow.pagination --> <div class="pagination"> <ul> @@ -56,17 +62,17 @@ <!-- ENDIF --> <div class="responsive-hide"> <!-- IF topicrow.ATTACH_ICON_IMG -->{topicrow.ATTACH_ICON_IMG} <!-- ENDIF --> - {L_POST_BY_AUTHOR} {topicrow.TOPIC_AUTHOR_FULL} » {topicrow.FIRST_POST_TIME} + {L_POST_BY_AUTHOR} {topicrow.TOPIC_AUTHOR_FULL} » <a href="{topicrow.U_VIEW_TOPIC}" title="{L_GOTO_FIRST_POST}">{topicrow.FIRST_POST_TIME}</a> </div> <div class="responsive-show" style="display: none;"> <!-- IF topicrow.ATTACH_ICON_IMG -->{topicrow.ATTACH_ICON_IMG} <!-- ENDIF --> {L_LAST_POST} {L_POST_BY_AUTHOR} {topicrow.LAST_POST_AUTHOR_FULL} « - <a href="{topicrow.U_LAST_POST}">{topicrow.LAST_POST_TIME}</a> + <a href="{topicrow.U_LAST_POST}" title="{L_GOTO_LAST_POST}">{topicrow.LAST_POST_TIME}</a> </div> </div> </dt> <dd class="lastpost"><span><dfn>{L_LAST_POST} </dfn>{L_POST_BY_AUTHOR} {topicrow.LAST_POST_AUTHOR_FULL} - <a href="{topicrow.U_LAST_POST}">{LAST_POST_IMG}</a> <br />{topicrow.LAST_POST_TIME}</span> + <a href="{topicrow.U_LAST_POST}" title="{L_GOTO_LAST_POST}">{LAST_POST_IMG}</a> <br />{topicrow.LAST_POST_TIME}</span> </dd> <dd class="mark"><input type="checkbox" name="t[{topicrow.TOPIC_ID}]" id="t{topicrow.TOPIC_ID}" /></dd> </dl> diff --git a/phpBB/styles/prosilver/template/ucp_main_front.html b/phpBB/styles/prosilver/template/ucp_main_front.html index fa3291cd6c..eca224f2d9 100644 --- a/phpBB/styles/prosilver/template/ucp_main_front.html +++ b/phpBB/styles/prosilver/template/ucp_main_front.html @@ -16,7 +16,13 @@ <dl class="icon {topicrow.TOPIC_IMG_STYLE}"> <dt <!-- IF topicrow.TOPIC_ICON_IMG -->style="background-image: url({T_ICONS_PATH}{topicrow.TOPIC_ICON_IMG}); background-repeat: no-repeat;"<!-- ENDIF -->> <div class="list-inner"> - <!-- IF topicrow.S_UNREAD --><a href="{topicrow.U_NEWEST_POST}">{NEWEST_POST_IMG}</a> <!-- ENDIF --><a href="{topicrow.U_VIEW_TOPIC}" class="topictitle">{topicrow.TOPIC_TITLE}</a><br /> + <!-- IF topicrow.S_UNREAD --> + <a href="{topicrow.U_NEWEST_POST}">{NEWEST_POST_IMG}</a> + <a href="{topicrow.U_NEWEST_POST}" class="topictitle">{topicrow.TOPIC_TITLE}</a> + <!-- ELSE --> + <a href="{topicrow.U_VIEW_TOPIC}" class="topictitle">{topicrow.TOPIC_TITLE}</a> + <!-- ENDIF --> + <br /> <!-- IF .topicrow.pagination --> <div class="pagination"> <ul> @@ -33,16 +39,16 @@ <!-- ENDIF --> <div class="responsive-hide"> <!-- IF topicrow.ATTACH_ICON_IMG -->{topicrow.ATTACH_ICON_IMG} <!-- ENDIF --> - {L_POST_BY_AUTHOR} {topicrow.TOPIC_AUTHOR_FULL} » {topicrow.FIRST_POST_TIME} + {L_POST_BY_AUTHOR} {topicrow.TOPIC_AUTHOR_FULL} » <a href="{topicrow.U_VIEW_TOPIC}" title="{L_GOTO_FIRST_POST}">{topicrow.FIRST_POST_TIME}</a> </div> <div class="responsive-show" style="display: none;"> <!-- IF topicrow.ATTACH_ICON_IMG -->{topicrow.ATTACH_ICON_IMG} <!-- ENDIF --> - {L_LAST_POST} {L_POST_BY_AUTHOR} {topicrow.LAST_POST_AUTHOR_FULL} « <a href="{topicrow.U_LAST_POST}">{topicrow.LAST_POST_TIME}</a> + {L_LAST_POST} {L_POST_BY_AUTHOR} {topicrow.LAST_POST_AUTHOR_FULL} « <a href="{topicrow.U_LAST_POST}" title="{L_GOTO_LAST_POST}">{topicrow.LAST_POST_TIME}</a> </div> </div> </dt> <dd class="lastpost"><span>{L_LAST_POST} {L_POST_BY_AUTHOR} {topicrow.LAST_POST_AUTHOR_FULL} - <a href="{topicrow.U_LAST_POST}">{LAST_POST_IMG}</a> <br />{topicrow.LAST_POST_TIME}</span> + <a href="{topicrow.U_LAST_POST}" title="{L_GOTO_LAST_POST}">{LAST_POST_IMG}</a> <br />{topicrow.LAST_POST_TIME}</span> </dd> </dl> </li> diff --git a/phpBB/styles/prosilver/template/ucp_main_subscribed.html b/phpBB/styles/prosilver/template/ucp_main_subscribed.html index 7344a4af1a..0187f3cc3f 100755 --- a/phpBB/styles/prosilver/template/ucp_main_subscribed.html +++ b/phpBB/styles/prosilver/template/ucp_main_subscribed.html @@ -72,9 +72,15 @@ <dl class="icon {topicrow.TOPIC_IMG_STYLE}"> <dt<!-- IF topicrow.TOPIC_ICON_IMG --> style="background-image: url({T_ICONS_PATH}{topicrow.TOPIC_ICON_IMG}); background-repeat: no-repeat;"<!-- ENDIF --> title="{topicrow.TOPIC_FOLDER_IMG_ALT}"> <div class="list-inner"> - <!-- IF topicrow.S_UNREAD_TOPIC --><a href="{topicrow.U_NEWEST_POST}">{NEWEST_POST_IMG}</a> <!-- ENDIF --><a href="{topicrow.U_VIEW_TOPIC}" class="topictitle">{topicrow.TOPIC_TITLE}</a> + <!-- IF topicrow.S_UNREAD_TOPIC --> + <a href="{topicrow.U_NEWEST_POST}">{NEWEST_POST_IMG}</a> + <a href="{topicrow.U_NEWEST_POST}" class="topictitle">{topicrow.TOPIC_TITLE}</a> + <!-- ELSE --> + <a href="{topicrow.U_VIEW_TOPIC}" class="topictitle">{topicrow.TOPIC_TITLE}</a> + <!-- ENDIF --> <!-- IF topicrow.S_TOPIC_UNAPPROVED or topicrow.S_POSTS_UNAPPROVED --><a href="{topicrow.U_MCP_QUEUE}">{topicrow.UNAPPROVED_IMG}</a> <!-- ENDIF --> - <!-- IF topicrow.S_TOPIC_REPORTED --><a href="{topicrow.U_MCP_REPORT}">{REPORTED_IMG}</a><!-- ENDIF --><br /> + <!-- IF topicrow.S_TOPIC_REPORTED --><a href="{topicrow.U_MCP_REPORT}">{REPORTED_IMG}</a><!-- ENDIF --> + <br /> <!-- IF .topicrow.pagination --> <div class="pagination"> <ul> @@ -91,16 +97,16 @@ <!-- ENDIF --> <div class="responsive-hide"> <!-- IF topicrow.ATTACH_ICON_IMG -->{topicrow.ATTACH_ICON_IMG} <!-- ENDIF --> - {L_POST_BY_AUTHOR} {topicrow.TOPIC_AUTHOR_FULL} » {topicrow.FIRST_POST_TIME} + {L_POST_BY_AUTHOR} {topicrow.TOPIC_AUTHOR_FULL} » <a href="{topicrow.U_VIEW_TOPIC}" title="{L_GOTO_FIRST_POST}">{topicrow.FIRST_POST_TIME}</a> </div> <div class="responsive-show" style="display: none;"> <!-- IF topicrow.ATTACH_ICON_IMG -->{topicrow.ATTACH_ICON_IMG} <!-- ENDIF --> - {L_LAST_POST} {L_POST_BY_AUTHOR} {topicrow.LAST_POST_AUTHOR_FULL} « <a href="{topicrow.U_LAST_POST}">{topicrow.LAST_POST_TIME}</a> + {L_LAST_POST} {L_POST_BY_AUTHOR} {topicrow.LAST_POST_AUTHOR_FULL} « <a href="{topicrow.U_LAST_POST}" title="{L_GOTO_LAST_POST}">{topicrow.LAST_POST_TIME}</a> </div> </div> </dt> <dd class="lastpost"><span><dfn>{L_LAST_POST} </dfn>{L_POST_BY_AUTHOR} {topicrow.LAST_POST_AUTHOR_FULL} - <a href="{topicrow.U_LAST_POST}">{LAST_POST_IMG}</a> <br />{topicrow.LAST_POST_TIME}</span> + <a href="{topicrow.U_LAST_POST}" title="{L_GOTO_LAST_POST}">{LAST_POST_IMG}</a> <br />{topicrow.LAST_POST_TIME}</span> </dd> <dd class="mark"><input type="checkbox" name="t[{topicrow.TOPIC_ID}]" id="t{topicrow.TOPIC_ID}" /></dd> </dl> diff --git a/phpBB/styles/prosilver/template/ucp_profile_reg_details.html b/phpBB/styles/prosilver/template/ucp_profile_reg_details.html index 699be4a27e..4b26bc2e99 100644 --- a/phpBB/styles/prosilver/template/ucp_profile_reg_details.html +++ b/phpBB/styles/prosilver/template/ucp_profile_reg_details.html @@ -7,7 +7,7 @@ <div class="inner"> <!-- IF S_FORCE_PASSWORD --> - <p>{L_FORCE_PASSWORD_EXPLAIN}</p> + <p class="error">{L_FORCE_PASSWORD_EXPLAIN}</p> <!-- ENDIF --> <fieldset> diff --git a/phpBB/styles/prosilver/template/viewforum_body.html b/phpBB/styles/prosilver/template/viewforum_body.html index f0994f0716..e4c0a40d3a 100644 --- a/phpBB/styles/prosilver/template/viewforum_body.html +++ b/phpBB/styles/prosilver/template/viewforum_body.html @@ -55,17 +55,15 @@ </div> <!-- ENDIF --> - <!-- IF .pagination or TOTAL_POSTS or TOTAL_TOPICS --> - <div class="pagination"> - <!-- IF not S_IS_BOT and U_MARK_TOPICS --><a href="{U_MARK_TOPICS}" accesskey="m" data-ajax="mark_topics_read" data-overlay="false">{L_MARK_TOPICS_READ}</a> • <!-- ENDIF --> - <!-- IF TOTAL_TOPICS -->{TOTAL_TOPICS} • <!-- ENDIF --> - <!-- IF .pagination --> - <!-- INCLUDE pagination.html --> - <!-- ELSE --> - {PAGE_NUMBER} - <!-- ENDIF --> - </div> - <!-- ENDIF --> + <div class="pagination"> + <!-- IF not S_IS_BOT and U_MARK_TOPICS and .topicrow --><a href="{U_MARK_TOPICS}" accesskey="m" data-ajax="mark_topics_read" data-overlay="false">{L_MARK_TOPICS_READ}</a> • <!-- ENDIF --> + {TOTAL_TOPICS} • + <!-- IF .pagination --> + <!-- INCLUDE pagination.html --> + <!-- ELSE --> + {PAGE_NUMBER} + <!-- ENDIF --> + </div> </div> <!-- ENDIF --> @@ -145,7 +143,12 @@ <dt<!-- IF topicrow.TOPIC_ICON_IMG and S_TOPIC_ICONS --> style="background-image: url({T_ICONS_PATH}{topicrow.TOPIC_ICON_IMG}); background-repeat: no-repeat;"<!-- ENDIF --> title="{topicrow.TOPIC_FOLDER_IMG_ALT}"> <div class="list-inner"> <!-- EVENT topiclist_row_prepend --> - <!-- IF topicrow.S_UNREAD_TOPIC --><a href="{topicrow.U_NEWEST_POST}">{NEWEST_POST_IMG}</a> <!-- ENDIF --><a href="{topicrow.U_VIEW_TOPIC}" class="topictitle">{topicrow.TOPIC_TITLE}</a> + <!-- IF topicrow.S_UNREAD_TOPIC and not S_IS_BOT --> + <a href="{topicrow.U_NEWEST_POST}">{NEWEST_POST_IMG}</a> + <a href="{topicrow.U_NEWEST_POST}" class="topictitle">{topicrow.TOPIC_TITLE}</a> + <!-- ELSE --> + <a href="{topicrow.U_VIEW_TOPIC}" class="topictitle">{topicrow.TOPIC_TITLE}</a> + <!-- ENDIF --> <!-- IF topicrow.S_TOPIC_UNAPPROVED or topicrow.S_POSTS_UNAPPROVED --><a href="{topicrow.U_MCP_QUEUE}">{topicrow.UNAPPROVED_IMG}</a> <!-- ENDIF --> <!-- IF topicrow.S_TOPIC_DELETED --><a href="{topicrow.U_MCP_QUEUE}">{DELETED_IMG}</a> <!-- ENDIF --> <!-- IF topicrow.S_TOPIC_REPORTED --><a href="{topicrow.U_MCP_REPORT}">{REPORTED_IMG}</a><!-- ENDIF --><br /> @@ -165,12 +168,12 @@ <!-- ENDIF --> <div class="responsive-hide"> <!-- IF topicrow.ATTACH_ICON_IMG -->{topicrow.ATTACH_ICON_IMG} <!-- ENDIF --> - {L_POST_BY_AUTHOR} {topicrow.TOPIC_AUTHOR_FULL} » {topicrow.FIRST_POST_TIME} + {L_POST_BY_AUTHOR} {topicrow.TOPIC_AUTHOR_FULL} » <!-- IF not S_IS_BOT --><a href="{topicrow.U_VIEW_TOPIC}" title="{L_GOTO_FIRST_POST}">{topicrow.FIRST_POST_TIME}</a><!-- ELSE -->{topicrow.FIRST_POST_TIME}<!-- ENDIF --> <!-- IF topicrow.S_POST_GLOBAL and FORUM_ID != topicrow.FORUM_ID --> » {L_IN} <a href="{topicrow.U_VIEW_FORUM}">{topicrow.FORUM_NAME}</a><!-- ENDIF --> </div> <!-- IF not S_IS_BOT --> <div class="responsive-show" style="display: none;"> - {L_LAST_POST} {L_POST_BY_AUTHOR} {topicrow.LAST_POST_AUTHOR_FULL} « <a href="{topicrow.U_LAST_POST}">{topicrow.LAST_POST_TIME}</a> + {L_LAST_POST} {L_POST_BY_AUTHOR} {topicrow.LAST_POST_AUTHOR_FULL} « <a href="{topicrow.U_LAST_POST}" title="{L_GOTO_LAST_POST}">{topicrow.LAST_POST_TIME}</a> <!-- IF topicrow.S_POST_GLOBAL and FORUM_ID != topicrow.FORUM_ID --><br />{L_POSTED} {L_IN} <a href="{topicrow.U_VIEW_FORUM}">{topicrow.FORUM_NAME}</a><!-- ENDIF --> <!-- IF topicrow.REPLIES --><br />{L_REPLIES}{L_COLON} <strong>{topicrow.REPLIES}</strong><!-- ENDIF --> </div> @@ -182,7 +185,7 @@ <dd class="posts">{topicrow.REPLIES} <dfn>{L_REPLIES}</dfn></dd> <dd class="views">{topicrow.VIEWS} <dfn>{L_VIEWS}</dfn></dd> <dd class="lastpost"><span><dfn>{L_LAST_POST} </dfn>{L_POST_BY_AUTHOR} {topicrow.LAST_POST_AUTHOR_FULL} - <!-- IF not S_IS_BOT --><a href="{topicrow.U_LAST_POST}">{LAST_POST_IMG}</a> <!-- ENDIF --><br />{topicrow.LAST_POST_TIME}</span> + <!-- IF not S_IS_BOT --><a href="{topicrow.U_LAST_POST}" title="{L_GOTO_LAST_POST}">{LAST_POST_IMG}</a> <!-- ENDIF --><br />{topicrow.LAST_POST_TIME}</span> </dd> </dl> </li> @@ -227,18 +230,15 @@ </div> <!-- ENDIF --> - <!-- IF PAGE_NUMBER or TOTAL_POSTS or TOTAL_TOPICS --> <div class="pagination"> - <!-- IF TOTAL_TOPICS and not S_IS_BOT and U_MARK_TOPICS --><a href="{U_MARK_TOPICS}" data-ajax="mark_topics_read" data-overlay="false">{L_MARK_TOPICS_READ}</a> • <!-- ENDIF --> - <!-- IF TOTAL_POSTS and not NEWEST_USER --> {TOTAL_POSTS}<!-- ELSEIF TOTAL_TOPICS and not NEWEST_USER --> {TOTAL_TOPICS} • <!-- ENDIF --> - <!-- IF TOTAL_USERS -->{TOTAL_USERS} • <!-- ENDIF --> + <!-- IF not S_IS_BOT and U_MARK_TOPICS and .topicrow --><a href="{U_MARK_TOPICS}" data-ajax="mark_topics_read" data-overlay="false">{L_MARK_TOPICS_READ}</a> • <!-- ENDIF --> + {TOTAL_TOPICS} • <!-- IF .pagination --> <!-- INCLUDE pagination.html --> <!-- ELSE --> {PAGE_NUMBER} <!-- ENDIF --> </div> - <!-- ENDIF --> </div> <!-- ENDIF --> diff --git a/phpBB/styles/prosilver/template/viewtopic_body.html b/phpBB/styles/prosilver/template/viewtopic_body.html index 46881d3b03..338c67dd33 100644 --- a/phpBB/styles/prosilver/template/viewtopic_body.html +++ b/phpBB/styles/prosilver/template/viewtopic_body.html @@ -33,6 +33,8 @@ <!-- ENDIF --> </div> + <!-- INCLUDE viewtopic_topic_tools.html --> + <!-- IF S_DISPLAY_SEARCHBOX --> <div class="search-box"> <form method="get" id="topic-search" action="{S_SEARCHBOX_ACTION}"> @@ -55,9 +57,8 @@ <!-- ENDIF --> </div> <!-- ENDIF --> - + <div class="clear"></div> </div> -<div class="clear"></div> <!-- IF S_HAS_POLL --> <form method="post" action="{S_POLL_ACTION}" data-ajax="vote_poll" class="topic_poll"> @@ -299,16 +300,7 @@ <!-- ENDIF --> </div> - <!-- IF S_HAS_ATTACHMENTS --> - <div class="dl_links"> - <strong>{L_DOWNLOAD_ALL_ATTACHMENTS}{L_COLON}</strong> - <ul> - <!-- BEGIN dl_method --> - <li>[ <a href="{dl_method.LINK}">{dl_method.TYPE}</a> ]</li> - <!-- END dl_method --> - </ul> - </div> - <!-- ENDIF --> + <!-- INCLUDE viewtopic_topic_tools.html --> <!-- IF .pagination or TOTAL_POSTS --> <div class="pagination"> @@ -320,6 +312,7 @@ <!-- ENDIF --> </div> <!-- ENDIF --> + <div class="clear"></div> </div> <!-- EVENT viewtopic_body_footer_before --> diff --git a/phpBB/styles/prosilver/template/viewtopic_topic_tools.html b/phpBB/styles/prosilver/template/viewtopic_topic_tools.html new file mode 100644 index 0000000000..ec17185bae --- /dev/null +++ b/phpBB/styles/prosilver/template/viewtopic_topic_tools.html @@ -0,0 +1,39 @@ +<!-- IF not S_IS_BOT and (U_WATCH_TOPIC or U_BOOKMARK_TOPIC or U_BUMP_TOPIC or S_HAS_ATTACHMENTS or S_DISPLAY_TOPIC_TOOLS) --> + <div class="dropdown-container dropdown-button-control topic-tools"> + <span title="{L_TOPIC_TOOLS}" class="dropdown-trigger dropdown-select dropdown-select-icon tools-icon"><span></span></span> + <div class="dropdown hidden"> + <div class="pointer"><div class="pointer-inner"></div></div> + <ul class="dropdown-contents"> + <!-- EVENT viewtopic_topic_tools_before --> + <!-- IF U_WATCH_TOPIC --> + <li class="small-icon icon-<!-- IF S_WATCHING_TOPIC -->unsubscribe<!-- ELSE -->subscribe<!-- ENDIF -->"> + <a href="{U_WATCH_TOPIC}" title="{S_WATCH_TOPIC_TITLE}" data-ajax="toggle_link" data-toggle-class="small-icon icon-<!-- IF not S_WATCHING_TOPIC -->unsubscribe<!-- ELSE -->subscribe<!-- ENDIF -->" data-toggle-text="{S_WATCH_TOPIC_TOGGLE}" data-toggle-url="{U_WATCH_TOPIC_TOGGLE}"> + {S_WATCH_TOPIC_TITLE} + </a> + </li> + <!-- ENDIF --> + <!-- IF U_BOOKMARK_TOPIC --> + <li class="small-icon icon-bookmark"> + <a href="{U_BOOKMARK_TOPIC}" title="{L_BOOKMARK_TOPIC}" data-ajax="alt_text" data-alt-text="{S_BOOKMARK_TOGGLE}"> + {S_BOOKMARK_TOPIC} + </a> + </li> + <!-- ENDIF --> + <!-- IF U_BUMP_TOPIC --><li class="small-icon icon-bump"><a href="{U_BUMP_TOPIC}" title="{L_BUMP_TOPIC}" data-ajax="true">{L_BUMP_TOPIC}</a></li><!-- ENDIF --> + <!-- IF S_HAS_ATTACHMENTS --> + <li class="small-icon icon-download"> + <a class="dropdown-toggle-submenu" href="{U_DOWNLOAD_ALL_ATTACHMENTS}" title="{L_DOWNLOAD_ALL_ATTACHMENTS}">{L_DOWNLOAD_ALL_ATTACHMENTS}</a> + <ul class="dropdown-submenu hidden"> + <li> + <!-- BEGIN dl_method --> + <a href="{dl_method.LINK}">{dl_method.TYPE}</a><!-- IF not dl_method.S_LAST_ROW --> • <!-- ENDIF --> + <!-- END dl_method --> + </li> + </ul> + </li> + <!-- ENDIF --> + <!-- EVENT viewtopic_topic_tools_after --> + </ul> + </div> + </div> +<!-- ENDIF --> diff --git a/phpBB/styles/prosilver/theme/bidi.css b/phpBB/styles/prosilver/theme/bidi.css index b04e6576d3..d5e98d6197 100644 --- a/phpBB/styles/prosilver/theme/bidi.css +++ b/phpBB/styles/prosilver/theme/bidi.css @@ -90,6 +90,21 @@ text-align: left; } +/* Dropdown menu +---------------------------------------- */ +.rtl .dropdown-container.topic-tools { + float: right; +} + +.rtl .dropdown li { + text-align: right; +} + +.rtl .dropdown li li { + padding-left: 0; + padding-right: 10px; +} + /* Table styles ----------------------------------------*/ .rtl table.table1 thead th { diff --git a/phpBB/styles/prosilver/theme/buttons.css b/phpBB/styles/prosilver/theme/buttons.css index cdd325fb13..89fdcd85a8 100644 --- a/phpBB/styles/prosilver/theme/buttons.css +++ b/phpBB/styles/prosilver/theme/buttons.css @@ -11,13 +11,13 @@ } /* Rollover state */ -.buttons div { +.buttons div, .dropdown-select { float: left; margin: 0 5px 0 0; } /* Rolloff state */ -.buttons div a { +.buttons div a, .dropdown-select { display: inline-block; line-height: 17.5px; height: 18px; @@ -38,7 +38,7 @@ .buttons div span { display: none; } -.buttons div a:after { +.buttons div a:after, .dropdown-select:after { content: ''; display: block; position: absolute; @@ -54,6 +54,35 @@ background-position: 0 -20px; } +.dropdown-select { + cursor: pointer; + font-family: inherit; + font-size: 1em; + font-weight: normal; +} + +.dropdown-select:after { + background-position: -103px 10px; + border-left: 1px solid; + margin-top: 0; + top: 0; + right: 0; + height: 21px; + width: 15px; +} + +.dropdown-visible .dropdown-select:after, .nojs .dropdown-container:hover .dropdown-select:after { + background-position: -103px -10px; +} + +.dropdown-select-icon:before { + content: ''; + display: block; + float: left; + margin-right: 4px; + margin-top: 2px; +} + /* Big button images */ .buttons div.reply-icon a:after, .buttons div.pmreply-icon a:after { background-position: -20px 0; } .buttons div.reply-icon a:hover:after, .buttons div.pmreply-icon a:hover:after { background-position: -20px -20px; } @@ -67,6 +96,11 @@ .buttons div.forwardpm-icon a:after { background-position: -40px 0; } .buttons div.forwardpm-icon a:hover:after { background-position: -40px -20px; } +.dropdown-select.tools-icon:before { background-position: -80px 0; height: 16px; width: 16px; } + +.dropdown-visible .dropdown-select.tools-icon:before, +.nojs .dropdown-container:hover .dropdown-select.tools-icon:before { background-position: -80px -20px; } + /* Sub-header (navigation bar) --------------------------------------------- */ a.print, a.sendemail { diff --git a/phpBB/styles/prosilver/theme/colours.css b/phpBB/styles/prosilver/theme/colours.css index 55b01f1269..68fbcde4f9 100644 --- a/phpBB/styles/prosilver/theme/colours.css +++ b/phpBB/styles/prosilver/theme/colours.css @@ -231,7 +231,6 @@ p.post-notice.reported:before, p.post-notice.error:before { background-image: url("./images/icon_topic_reported.gif"); } - /* -------------------------------------------------------------- Colours and backgrounds for links.css @@ -655,7 +654,7 @@ a.sendemail { background-image: url("./images/icon_sendemail.gif"); } -.buttons div a { +.buttons div a, .dropdown-select { border-color: #C7C3BF; background-color: #FFFFFF; background-image: -moz-linear-gradient(top, #FFFFFF, #E9E9E9); @@ -668,7 +667,16 @@ a.sendemail { color: #BC2A4D !important; } -.buttons div a:hover { +.dropdown-select { + color: #5C6482 !important; +} + +.dropdown-select:after { + border-color: #DADADA; +} + +.buttons div a:hover, .dropdown-select:hover, .dropdown-visible .dropdown-select, +.dropdown-visible .dropdown-select:hover, .nojs .dropdown-container:hover .dropdown-select { border-color: #0a8ed0; background-image: -moz-linear-gradient(top, #E9E9E9, #FFFFFF); background-image: -webkit-linear-gradient(top, #E9E9E9, #FFFFFF); @@ -678,7 +686,16 @@ a.sendemail { text-shadow: 1px 1px 0 #FFFFFF, -1px -1px 0 #FFFFFF, -1px -1px 0 rgba(188, 42, 77, 0.2); } -.buttons div a:after { +.dropdown-select:hover { + border-color: #C7C3BF; +} + +.dropdown-visible .dropdown-select, .dropdown-visible .dropdown-select:hover, .nojs .dropdown-container:hover .dropdown-select { + border-color: #A6B2BA; + color: #105289 !important; +} + +.buttons div a:after, .dropdown-select-icon:before, .dropdown-select:after { background-image: url("images/buttons.png"); } @@ -698,6 +715,7 @@ a.sendemail { .icon-search, .responsive-search a { background-image: url("./images/icon_search.gif"); } .icon-notification { background-image: url("./images/icon_notification.gif"); } .icon-pm { background-image: url("./images/icon_pm.gif"); } +.icon-download { background-image: url("./images/icon_download.gif"); } /* Profile & navigation icons */ .email-icon, .email-icon a { background-image: url("./images/icon_contact_email.gif"); } @@ -1162,6 +1180,10 @@ ul.linklist li.responsive-menu a.responsive-menu-link:hover:before, ul.linklist box-shadow: 1px 0 5px rgba(0, 0, 0, 0.2); } +.dropdown li, .dropdown li li { + border-color: #DCDCDC; +} + #minitabs .dropdown-contents { background-color: #F1F8FF; } diff --git a/phpBB/styles/prosilver/theme/common.css b/phpBB/styles/prosilver/theme/common.css index dced25f541..66ee77f60b 100644 --- a/phpBB/styles/prosilver/theme/common.css +++ b/phpBB/styles/prosilver/theme/common.css @@ -407,6 +407,14 @@ li.responsive-menu .dropdown .dropdown-contents { padding: 0 5px; } +ul.linklist .dropdown-down .dropdown { + top: 22px; +} + +ul.linklist .dropdown-up .dropdown { + bottom: 18px; +} + ul.linklist .dropdown li { clear: both; } @@ -437,27 +445,47 @@ ul.linklist.bulletin li.no-bulletin:before { /* Dropdown menu ----------------------------------------*/ +.dropdown-container { + position: relative; +} + +.nojs .dropdown-container:hover .dropdown { + display: block !important; +} + .dropdown { position: absolute; left: 0; - top: 22px; + top: 1.2em; z-index: 2; border: 1px solid transparent; border-radius: 5px; padding: 9px 0 0; } +.dropdown-container.topic-tools { + float: left; +} + .dropdown-up .dropdown { top: auto; - bottom: 18px; + bottom: 1.2em; padding: 0 0 9px; } -.dropdown-left .dropdown { +.dropdown-left .dropdown, .nojs .rightside .dropdown { left: auto; right: 0; } +.dropdown-button-control .dropdown { + top: 24px; +} + +.dropdown-button-control.dropdown-up .dropdown { + top: auto; + bottom: 24px; +} .dropdown .pointer, .dropdown .pointer-inner { position: absolute; @@ -488,7 +516,7 @@ ul.linklist.bulletin li.no-bulletin:before { top: auto; } -.dropdown-left .dropdown .pointer { +.dropdown-left .dropdown .pointer, .nojs .rightside .dropdown .pointer { left: auto; right: 10px; } @@ -507,22 +535,48 @@ ul.linklist.bulletin li.no-bulletin:before { .dropdown .dropdown-contents { z-index: 2; overflow: hidden; + overflow-y: auto; border: 1px solid transparent; border-radius: 5px; padding: 5px; position: relative; + min-width: 40px; + max-height: 200px; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; } .dropdown li { - float: none; + border-bottom: 1px dotted transparent; + float: none !important; + line-height: normal !important; + font-size: 1em !important; + list-style: none; margin: 0; + padding-top: 4px; + padding-bottom: 4px; white-space: nowrap; text-align: left; } +.dropdown li:last-child, .dropdown li li { + border-bottom: 0; +} + +.dropdown li li:first-child { + margin-top: 4px; +} + +.dropdown li li:last-child { + padding-bottom: 0; +} + +.dropdown li li { + border-top: 1px dotted transparent; + padding-left: 10px; +} + .wrap .dropdown li, .dropdown.wrap li, #notification_list li { white-space: normal; } @@ -968,6 +1022,7 @@ form > p.post-notice strong { } #notification_list .dropdown-contents { + max-height: none; padding: 0; } diff --git a/phpBB/styles/prosilver/theme/images/buttons.png b/phpBB/styles/prosilver/theme/images/buttons.png Binary files differindex a19abdc2b8..3a8c2f2f65 100644..100755 --- a/phpBB/styles/prosilver/theme/images/buttons.png +++ b/phpBB/styles/prosilver/theme/images/buttons.png diff --git a/phpBB/styles/prosilver/theme/images/icon_download.gif b/phpBB/styles/prosilver/theme/images/icon_download.gif Binary files differnew file mode 100644 index 0000000000..70cd61caf2 --- /dev/null +++ b/phpBB/styles/prosilver/theme/images/icon_download.gif diff --git a/phpBB/styles/prosilver/theme/responsive.css b/phpBB/styles/prosilver/theme/responsive.css index d7af7519b7..397ff12942 100644 --- a/phpBB/styles/prosilver/theme/responsive.css +++ b/phpBB/styles/prosilver/theme/responsive.css @@ -468,10 +468,6 @@ p.rightside { float: none; } -.topic-actions { - overflow: hidden; -} - fieldset.quickmod { width: auto; float: none; @@ -511,17 +507,14 @@ fieldset.display-actions { margin: 0; } - .topic-actions > div { - float: none; - overflow: hidden; - clear: both; - } - .topic-actions > .pagination, fieldset.jumpbox { text-align: center; } .topic-actions > .pagination { + float: none; + overflow: hidden; + clear: both; padding-bottom: 1px; } diff --git a/phpBB/styles/subsilver2/template/index_body.html b/phpBB/styles/subsilver2/template/index_body.html index 158e5f2720..763028966f 100644 --- a/phpBB/styles/subsilver2/template/index_body.html +++ b/phpBB/styles/subsilver2/template/index_body.html @@ -1,5 +1,7 @@ <!-- INCLUDE overall_header.html --> +<!-- EVENT index_body_linklist_before --> + <!-- IF U_MCP or U_ACP --> <div id="pageheader"> <p class="linkmcp">[ <!-- IF U_ACP --><a href="{U_ACP}">{L_ACP}</a><!-- IF U_MCP --> | <!-- ENDIF --><!-- ENDIF --><!-- IF U_MCP --><a href="{U_MCP}">{L_MCP}</a><!-- ENDIF --> ]</p> @@ -8,6 +10,8 @@ <br clear="all" /><br /> <!-- ENDIF --> +<!-- EVENT index_body_linklist_after --> + <!-- INCLUDE forumlist_body.html --> <!-- IF not S_IS_BOT or U_TEAM --> diff --git a/phpBB/styles/subsilver2/template/mcp_topic.html b/phpBB/styles/subsilver2/template/mcp_topic.html index d3b4408243..5bd762ec0b 100644 --- a/phpBB/styles/subsilver2/template/mcp_topic.html +++ b/phpBB/styles/subsilver2/template/mcp_topic.html @@ -73,7 +73,7 @@ <td align="center"><b class="postauthor">{postrow.POST_AUTHOR_FULL}</b></td> <td width="100%"> <table width="100%" cellspacing="0" cellpadding="0" border="0"> - <tr valign="top"> + <tr style="vertical-align: top;"> <td class="gensmall" nowrap="nowrap"> <b>{L_POST_SUBJECT}{L_COLON}</b> </td> <td class="gensmall" width="100%">{postrow.POST_SUBJECT}</td> </tr> diff --git a/phpBB/styles/subsilver2/template/posting_buttons.html b/phpBB/styles/subsilver2/template/posting_buttons.html index 06de2c3169..2c60913fc0 100644 --- a/phpBB/styles/subsilver2/template/posting_buttons.html +++ b/phpBB/styles/subsilver2/template/posting_buttons.html @@ -36,6 +36,8 @@ <!-- INCLUDEJS {T_ASSETS_PATH}/javascript/editor.js --> <!-- IF S_BBCODE_ALLOWED --> + <!-- EVENT posting_editor_buttons_before --> + <div id="core-bbcode-buttons"> <input type="button" class="btnbbcode" accesskey="b" name="addbbcode0" value=" B " style="font-weight:bold; width: 30px;" onclick="bbstyle(0)" onmouseover="helpline('b')" onmouseout="helpline('tip')" /> <input type="button" class="btnbbcode" accesskey="i" name="addbbcode2" value=" i " style="font-style:italic; width: 30px;" onclick="bbstyle(2)" onmouseover="helpline('i')" onmouseout="helpline('tip')" /> <input type="button" class="btnbbcode" accesskey="u" name="addbbcode4" value=" u " style="text-decoration: underline; width: 30px;" onclick="bbstyle(4)" onmouseover="helpline('u')" onmouseout="helpline('tip')" /> @@ -66,15 +68,19 @@ <!-- ENDIF --> <!-- ENDIF --> </select></span> + </div> + <!-- EVENT posting_editor_buttons_after --> <!-- ENDIF --> </td> </tr> <!-- IF S_BBCODE_ALLOWED and .custom_tags --> <tr valign="middle" align="{S_CONTENT_FLOW_BEGIN}"> <td colspan="2"> + <div id="custom-bbcode-buttons"> <!-- BEGIN custom_tags --> <input type="button" class="btnbbcode" name="addbbcode{custom_tags.BBCODE_ID}" value="{custom_tags.BBCODE_TAG}" onclick="bbstyle({custom_tags.BBCODE_ID})"<!-- IF custom_tags.BBCODE_HELPLINE !== '' --> onmouseover="helpline('cb_{custom_tags.BBCODE_ID}')" onmouseout="helpline('tip')"<!-- ENDIF --> /> <!-- END custom_tags --> + </div> </td> </tr> <!-- ENDIF --> diff --git a/phpBB/styles/subsilver2/template/search_results.html b/phpBB/styles/subsilver2/template/search_results.html index 19ba0b196a..092779055d 100644 --- a/phpBB/styles/subsilver2/template/search_results.html +++ b/phpBB/styles/subsilver2/template/search_results.html @@ -36,7 +36,7 @@ <td class="row1"> <!-- EVENT topiclist_row_prepend --> <!-- IF searchresults.S_UNREAD_TOPIC --><a href="{searchresults.U_NEWEST_POST}" class="imageset">{NEWEST_POST_IMG}</a><!-- ENDIF --> - {searchresults.ATTACH_ICON_IMG} <a href="{searchresults.U_VIEW_TOPIC}" class="topictitle">{searchresults.TOPIC_TITLE}</a> + {searchresults.ATTACH_ICON_IMG} <a href="<!-- IF not S_IS_BOT and searchresults.S_UNREAD_TOPIC -->{searchresults.U_NEWEST_POST}<!-- ELSE -->{searchresults.U_VIEW_TOPIC}<!-- ENDIF -->" class="topictitle">{searchresults.TOPIC_TITLE}</a> <!-- IF searchresults.S_TOPIC_UNAPPROVED or searchresults.S_POSTS_UNAPPROVED --> <a href="{searchresults.U_MCP_QUEUE}" class="imageset">{searchresults.UNAPPROVED_IMG}</a> <!-- ENDIF --> diff --git a/phpBB/styles/subsilver2/template/ucp_main_bookmarks.html b/phpBB/styles/subsilver2/template/ucp_main_bookmarks.html index e91417503f..a8c6b4a9a8 100644 --- a/phpBB/styles/subsilver2/template/ucp_main_bookmarks.html +++ b/phpBB/styles/subsilver2/template/ucp_main_bookmarks.html @@ -41,7 +41,7 @@ <td class="postdetails" style="padding: 4px" width="100%" colspan="2">{L_DELETED_TOPIC}</td> <!-- ELSE --> <td style="padding: 4px;" width="100%" valign="top"> - <p class="topictitle"><!-- IF topicrow.S_UNREAD_TOPIC --><a href="{topicrow.U_NEWEST_POST}">{NEWEST_POST_IMG}</a> <!-- ENDIF -->{topicrow.ATTACH_ICON_IMG} <a href="{topicrow.U_VIEW_TOPIC}">{topicrow.TOPIC_TITLE}</a></p> + <p class="topictitle"><!-- IF topicrow.S_UNREAD_TOPIC --><a href="{topicrow.U_NEWEST_POST}">{NEWEST_POST_IMG}</a> <!-- ENDIF -->{topicrow.ATTACH_ICON_IMG} <a href="<!-- IF topicrow.S_UNREAD_TOPIC -->{topicrow.U_NEWEST_POST}<!-- ELSE -->{topicrow.U_VIEW_TOPIC}<!-- ENDIF -->">{topicrow.TOPIC_TITLE}</a></p> <!-- IF topicrow.S_GLOBAL_TOPIC --><span class="gensmall">{L_GLOBAL_ANNOUNCEMENT}</span><!-- ELSE --><span class="gensmall"><b>{L_FORUM}{L_COLON} </b><a href="{topicrow.U_VIEW_FORUM}">{topicrow.FORUM_NAME}</a></span><!-- ENDIF --> <!-- IF .topicrow.pagination --> <p class="gensmall"> [ {GOTO_PAGE_IMG}{L_GOTO_PAGE}{L_COLON} diff --git a/phpBB/styles/subsilver2/template/ucp_main_front.html b/phpBB/styles/subsilver2/template/ucp_main_front.html index 5dea2b4f03..bc26266bef 100644 --- a/phpBB/styles/subsilver2/template/ucp_main_front.html +++ b/phpBB/styles/subsilver2/template/ucp_main_front.html @@ -16,7 +16,7 @@ <!-- IF topicrow.S_ROW_COUNT is even --><tr class="row1"><!-- ELSE --><tr class="row2"><!-- ENDIF --> <td class="row1" width="25" align="center">{topicrow.TOPIC_FOLDER_IMG}</td> <td class="row1" width="100%"> - <p class="topictitle"><!-- IF topicrow.S_UNREAD --><a href="{topicrow.U_NEWEST_POST}">{NEWEST_POST_IMG}</a> <!-- ENDIF -->{topicrow.ATTACH_ICON_IMG} <a href="{topicrow.U_VIEW_TOPIC}">{topicrow.TOPIC_TITLE}</a></p><p class="gensmall">{topicrow.GOTO_PAGE}</p> + <p class="topictitle"><!-- IF topicrow.S_UNREAD --><a href="{topicrow.U_NEWEST_POST}">{NEWEST_POST_IMG}</a> <!-- ENDIF -->{topicrow.ATTACH_ICON_IMG} <a href="<!-- IF topicrow.S_UNREAD -->{topicrow.U_NEWEST_POST}<!-- ELSE -->{topicrow.U_VIEW_TOPIC}<!-- ENDIF -->">{topicrow.TOPIC_TITLE}</a></p><p class="gensmall">{topicrow.GOTO_PAGE}</p> </td> <td class="row1" width="120" align="center" nowrap="nowrap"> <p class="topicdetails">{topicrow.LAST_POST_TIME}</p> diff --git a/phpBB/styles/subsilver2/template/ucp_main_subscribed.html b/phpBB/styles/subsilver2/template/ucp_main_subscribed.html index 45094abe5f..9de44dd9ed 100644 --- a/phpBB/styles/subsilver2/template/ucp_main_subscribed.html +++ b/phpBB/styles/subsilver2/template/ucp_main_subscribed.html @@ -50,7 +50,7 @@ <!-- IF topicrow.S_ROW_COUNT is even --><tr class="row1"><!-- ELSE --><tr class="row2"><!-- ENDIF --> <td style="padding: 4px;" width="20" align="center" valign="middle">{topicrow.TOPIC_FOLDER_IMG}</td> <td style="padding: 4px;" width="100%" valign="top"> - <p class="topictitle"><!-- IF topicrow.S_UNREAD_TOPIC --><a href="{topicrow.U_NEWEST_POST}" class="imageset">{NEWEST_POST_IMG}</a> <!-- ENDIF -->{topicrow.ATTACH_ICON_IMG} <a href="{topicrow.U_VIEW_TOPIC}">{topicrow.TOPIC_TITLE}</a></p> + <p class="topictitle"><!-- IF topicrow.S_UNREAD_TOPIC --><a href="{topicrow.U_NEWEST_POST}" class="imageset">{NEWEST_POST_IMG}</a> <!-- ENDIF -->{topicrow.ATTACH_ICON_IMG} <a href="<!-- IF topicrow.S_UNREAD_TOPIC -->{topicrow.U_NEWEST_POST}<!-- ELSE -->{topicrow.U_VIEW_TOPIC}<!-- ENDIF -->">{topicrow.TOPIC_TITLE}</a></p> <!-- IF topicrow.S_GLOBAL_TOPIC --><span class="gensmall">{L_GLOBAL_ANNOUNCEMENT}</span><!-- ELSE --><span class="gensmall"><b>{L_FORUM}{L_COLON} </b><a href="{topicrow.U_VIEW_FORUM}">{topicrow.FORUM_NAME}</a></span><!-- ENDIF --> <!-- IF .topicrow.pagination --> <p class="gensmall"> [ {GOTO_PAGE_IMG}{L_GOTO_PAGE}{L_COLON} diff --git a/phpBB/styles/subsilver2/template/ucp_profile_reg_details.html b/phpBB/styles/subsilver2/template/ucp_profile_reg_details.html index 6944a62764..d8fe84bf79 100644 --- a/phpBB/styles/subsilver2/template/ucp_profile_reg_details.html +++ b/phpBB/styles/subsilver2/template/ucp_profile_reg_details.html @@ -6,7 +6,7 @@ </tr> <!-- IF S_FORCE_PASSWORD --> <tr> - <td class="row3" colspan="2" align="center"><span class="gensmall">{L_FORCE_PASSWORD_EXPLAIN}</span></td> + <td class="row3" colspan="2" align="center"><span class="gensmall error">{L_FORCE_PASSWORD_EXPLAIN}</span></td> </tr> <!-- ENDIF --> <!-- IF ERROR --> diff --git a/phpBB/styles/subsilver2/template/viewforum_body.html b/phpBB/styles/subsilver2/template/viewforum_body.html index 612c2e42ea..3d4336a2a3 100644 --- a/phpBB/styles/subsilver2/template/viewforum_body.html +++ b/phpBB/styles/subsilver2/template/viewforum_body.html @@ -207,7 +207,8 @@ <td class="row1"> <!-- EVENT topiclist_row_prepend --> <!-- IF topicrow.S_UNREAD_TOPIC --><a href="{topicrow.U_NEWEST_POST}" class="imageset">{NEWEST_POST_IMG}</a><!-- ENDIF --> - {topicrow.ATTACH_ICON_IMG} <!-- IF topicrow.S_HAS_POLL or topicrow.S_TOPIC_MOVED --><b>{topicrow.TOPIC_TYPE}</b> <!-- ENDIF --><a title="{L_POSTED}{L_COLON} {topicrow.FIRST_POST_TIME}" href="{topicrow.U_VIEW_TOPIC}" class="topictitle">{topicrow.TOPIC_TITLE}</a> + {topicrow.ATTACH_ICON_IMG} <!-- IF topicrow.S_HAS_POLL or topicrow.S_TOPIC_MOVED --><b>{topicrow.TOPIC_TYPE}</b> <!-- ENDIF --> + <a title="{L_POSTED}{L_COLON} {topicrow.FIRST_POST_TIME}" href="<!-- IF not S_IS_BOT and topicrow.S_UNREAD_TOPIC -->{topicrow.U_NEWEST_POST}<!-- ELSE -->{topicrow.U_VIEW_TOPIC}<!-- ENDIF -->" class="topictitle">{topicrow.TOPIC_TITLE}</a> <!-- IF topicrow.S_TOPIC_UNAPPROVED or topicrow.S_POSTS_UNAPPROVED --> <a href="{topicrow.U_MCP_QUEUE}" class="imageset">{topicrow.UNAPPROVED_IMG}</a> <!-- ENDIF --> diff --git a/phpBB/viewforum.php b/phpBB/viewforum.php index c6712db46c..2c7a0a4829 100644 --- a/phpBB/viewforum.php +++ b/phpBB/viewforum.php @@ -33,6 +33,8 @@ $sort_days = request_var('st', $default_sort_days); $sort_key = request_var('sk', $default_sort_key); $sort_dir = request_var('sd', $default_sort_dir); +$pagination = $phpbb_container->get('pagination'); + // Check if the user has actually sent a forum ID with his/her request // If not give them a nice error page. if (!$forum_id) @@ -140,8 +142,13 @@ else } } +$phpbb_content_visibility = $phpbb_container->get('content.visibility'); + // Dump out the page header and load viewforum template -page_header($forum_data['forum_name'] . ($start ? ' - ' . sprintf($user->lang['PAGE_TITLE_NUMBER'], floor($start / $config['topics_per_page']) + 1) : ''), true, $forum_id); +$topics_count = $phpbb_content_visibility->get_count('forum_topics', $forum_data, $forum_id); +$start = $pagination->validate_start($start, $config['topics_per_page'], $topics_count); + +page_header($forum_data['forum_name'] . ($start ? ' - ' . $user->lang('PAGE_TITLE_NUMBER', $pagination->get_on_page($config['topics_per_page'], $start)) : ''), true, $forum_id); $template->set_filenames(array( 'body' => 'viewforum_body.html') @@ -246,8 +253,6 @@ $sort_by_sql = array('a' => 't.topic_first_poster_name', 't' => 't.topic_last_po $s_limit_days = $s_sort_key = $s_sort_dir = $u_sort_param = ''; gen_sort_selects($limit_days, $sort_by_text, $sort_days, $sort_key, $sort_dir, $s_limit_days, $s_sort_key, $s_sort_dir, $u_sort_param, $default_sort_days, $default_sort_key, $default_sort_dir); -$phpbb_content_visibility = $phpbb_container->get('content.visibility'); - // Limit topics to certain time frame, obtain correct topic count if ($sort_days) { @@ -275,16 +280,9 @@ if ($sort_days) } else { - $topics_count = $phpbb_content_visibility->get_count('forum_topics', $forum_data, $forum_id); $sql_limit_time = ''; } -// Make sure $start is set to the last page if it exceeds the amount -if ($start < 0 || $start > $topics_count) -{ - $start = ($start < 0) ? 0 : floor(($topics_count - 1) / $config['topics_per_page']) * $config['topics_per_page']; -} - // Basic pagewide vars $post_alt = ($forum_data['forum_status'] == ITEM_LOCKED) ? $user->lang['FORUM_LOCKED'] : $user->lang['POST_NEW_TOPIC']; @@ -480,14 +478,11 @@ if ($start > $topics_count / 2) { $store_reverse = true; - if ($start + $config['topics_per_page'] > $topics_count) - { - $sql_limit = min($config['topics_per_page'], max(1, $topics_count - $start)); - } - // Select the sort order $sql_sort_order = $sort_by_sql[$sort_key] . ' ' . (($sort_dir == 'd') ? 'ASC' : 'DESC'); - $sql_start = max(0, $topics_count - $sql_limit - $start); + + $sql_limit = $pagination->reverse_limit($start, $sql_limit, $topics_count); + $sql_start = $pagination->reverse_start($start, $sql_limit, $topics_count); } else { @@ -631,10 +626,10 @@ if ($s_display_active) $total_topic_count = $topics_count - sizeof($global_announce_forums); $base_url = append_sid("{$phpbb_root_path}viewforum.$phpEx", "f=$forum_id" . ((strlen($u_sort_param)) ? "&$u_sort_param" : '')); -phpbb_generate_template_pagination($template, $base_url, 'pagination', 'start', $topics_count, $config['topics_per_page'], $start); +$pagination->generate_template_pagination($base_url, 'pagination', 'start', $topics_count, $config['topics_per_page'], $start); $template->assign_vars(array( - 'PAGE_NUMBER' => phpbb_on_page($template, $user, $base_url, $topics_count, $config['topics_per_page'], $start), + 'PAGE_NUMBER' => $pagination->on_page($base_url, $topics_count, $config['topics_per_page'], $start), 'TOTAL_TOPICS' => ($s_display_active) ? false : $user->lang('VIEW_FORUM_TOPICS', (int) $total_topic_count), )); @@ -802,7 +797,7 @@ if (sizeof($topic_list)) $template->assign_block_vars('topicrow', $topic_row); - phpbb_generate_template_pagination($template, $view_topic_url, 'topicrow.pagination', 'start', $replies + 1, $config['posts_per_page'], 1, true, true); + $pagination->generate_template_pagination($view_topic_url, 'topicrow.pagination', 'start', $replies + 1, $config['posts_per_page'], 1, true, true); $s_type_switch = ($row['topic_type'] == POST_ANNOUNCE || $row['topic_type'] == POST_GLOBAL) ? 1 : 0; diff --git a/phpBB/viewonline.php b/phpBB/viewonline.php index d6a6a79342..ef8bfb888b 100644 --- a/phpBB/viewonline.php +++ b/phpBB/viewonline.php @@ -39,6 +39,8 @@ if (!$auth->acl_gets('u_viewprofile', 'a_user', 'a_useradd', 'a_userdel')) login_box('', $user->lang['LOGIN_EXPLAIN_VIEWONLINE']); } +$pagination = $phpbb_container->get('pagination'); + $sort_key_text = array('a' => $user->lang['SORT_USERNAME'], 'b' => $user->lang['SORT_JOINED'], 'c' => $user->lang['SORT_LOCATION']); $sort_key_sql = array('a' => 'u.username_clean', 'b' => 's.session_time', 'c' => 's.session_page'); @@ -419,15 +421,16 @@ $db->sql_freeresult($result); // Refreshing the page every 60 seconds... meta_refresh(60, append_sid("{$phpbb_root_path}viewonline.$phpEx", "sg=$show_guests&sk=$sort_key&sd=$sort_dir&start=$start")); +$start = $pagination->validate_start($start, $config['topics_per_page'], $counter); $base_url = append_sid("{$phpbb_root_path}viewonline.$phpEx", "sg=$show_guests&sk=$sort_key&sd=$sort_dir"); -phpbb_generate_template_pagination($template, $base_url, 'pagination', 'start', $counter, $config['topics_per_page'], $start); +$pagination->generate_template_pagination($base_url, 'pagination', 'start', $counter, $config['topics_per_page'], $start); // Send data to template $template->assign_vars(array( 'TOTAL_REGISTERED_USERS_ONLINE' => $user->lang('REG_USERS_ONLINE', (int) $logged_visible_online, $user->lang('HIDDEN_USERS_ONLINE', (int) $logged_hidden_online)), 'TOTAL_GUEST_USERS_ONLINE' => $user->lang('GUEST_USERS_ONLINE', (int) $guest_counter), 'LEGEND' => $legend, - 'PAGE_NUMBER' => phpbb_on_page($template, $user, $base_url, $counter, $config['topics_per_page'], $start), + 'PAGE_NUMBER' => $pagination->on_page($base_url, $counter, $config['topics_per_page'], $start), 'U_SORT_USERNAME' => append_sid("{$phpbb_root_path}viewonline.$phpEx", 'sk=a&sd=' . (($sort_key == 'a' && $sort_dir == 'a') ? 'd' : 'a') . '&sg=' . ((int) $show_guests)), 'U_SORT_UPDATED' => append_sid("{$phpbb_root_path}viewonline.$phpEx", 'sk=b&sd=' . (($sort_key == 'b' && $sort_dir == 'a') ? 'd' : 'a') . '&sg=' . ((int) $show_guests)), diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index a182268a71..14040176cb 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -43,6 +43,8 @@ $sort_dir = request_var('sd', $default_sort_dir); $update = request_var('update', false); +$pagination = $phpbb_container->get('pagination'); + $s_can_vote = false; /** * @todo normalize? @@ -434,10 +436,7 @@ if ($hilit_words) } // Make sure $start is set to the last page if it exceeds the amount -if ($start < 0 || $start >= $total_posts) -{ - $start = ($start < 0) ? 0 : floor(($total_posts - 1) / $config['posts_per_page']) * $config['posts_per_page']; -} +$start = $pagination->validate_start($start, $config['posts_per_page'], $total_posts); // General Viewtopic URL for return links $viewtopic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id" . (($start == 0) ? '' : "&start=$start") . ((strlen($u_sort_param)) ? "&$u_sort_param" : '') . (($highlight_match) ? "&hilit=$highlight" : '')); @@ -484,11 +483,21 @@ if ($config['allow_bookmarks'] && $user->data['is_registered'] && request_var('b AND topic_id = $topic_id"; $db->sql_query($sql); } - $message = (($topic_data['bookmarked']) ? $user->lang['BOOKMARK_REMOVED'] : $user->lang['BOOKMARK_ADDED']) . '<br /><br />' . sprintf($user->lang['RETURN_TOPIC'], '<a href="' . $viewtopic_url . '">', '</a>'); + $message = (($topic_data['bookmarked']) ? $user->lang['BOOKMARK_REMOVED'] : $user->lang['BOOKMARK_ADDED']); + + if (!$request->is_ajax()) + { + $message .= '<br /><br />' . $user->lang('RETURN_TOPIC', '<a href="' . $viewtopic_url . '">', '</a>'); + } } else { - $message = $user->lang['BOOKMARK_ERR'] . '<br /><br />' . sprintf($user->lang['RETURN_TOPIC'], '<a href="' . $viewtopic_url . '">', '</a>'); + $message = $user->lang['BOOKMARK_ERR']; + + if (!$request->is_ajax()) + { + $message .= '<br /><br />' . $user->lang('RETURN_TOPIC', '<a href="' . $viewtopic_url . '">', '</a>'); + } } meta_refresh(3, $viewtopic_url); @@ -581,7 +590,7 @@ if (!empty($_EXTRA_URL)) // If we've got a hightlight set pass it on to pagination. $base_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id" . ((strlen($u_sort_param)) ? "&$u_sort_param" : '') . (($highlight_match) ? "&hilit=$highlight" : '')); -phpbb_generate_template_pagination($template, $base_url, 'pagination', 'start', $total_posts, $config['posts_per_page'], $start); +$pagination->generate_template_pagination($base_url, 'pagination', 'start', $total_posts, $config['posts_per_page'], $start); // Send vars to template $template->assign_vars(array( @@ -596,7 +605,7 @@ $template->assign_vars(array( 'TOPIC_AUTHOR_COLOUR' => get_username_string('colour', $topic_data['topic_poster'], $topic_data['topic_first_poster_name'], $topic_data['topic_first_poster_colour']), 'TOPIC_AUTHOR' => get_username_string('username', $topic_data['topic_poster'], $topic_data['topic_first_poster_name'], $topic_data['topic_first_poster_colour']), - 'PAGE_NUMBER' => phpbb_on_page($template, $user, $base_url, $total_posts, $config['posts_per_page'], $start), + 'PAGE_NUMBER' => $pagination->on_page($base_url, $total_posts, $config['posts_per_page'], $start), 'TOTAL_POSTS' => $user->lang('VIEW_TOPIC_POSTS', (int) $total_posts), 'U_MCP' => ($auth->acl_get('m_', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", "i=main&mode=topic_view&f=$forum_id&t=$topic_id" . (($start == 0) ? '' : "&start=$start") . ((strlen($u_sort_param)) ? "&$u_sort_param" : ''), true, $user->session_id) : '', 'MODERATORS' => (isset($forum_moderators[$forum_id]) && sizeof($forum_moderators[$forum_id])) ? implode($user->lang['COMMA_SEPARATOR'], $forum_moderators[$forum_id]) : '', @@ -900,14 +909,11 @@ if ($start > $total_posts / 2) { $store_reverse = true; - if ($start + $config['posts_per_page'] > $total_posts) - { - $sql_limit = min($config['posts_per_page'], max(1, $total_posts - $start)); - } - // Select the sort order $direction = (($sort_dir == 'd') ? 'ASC' : 'DESC'); - $sql_start = max(0, $total_posts - $sql_limit - $start); + + $sql_limit = $pagination->reverse_limit($start, $sql_limit, $total_posts); + $sql_start = $pagination->reverse_start($start, $sql_limit, $total_posts); } else { @@ -1374,16 +1380,17 @@ if (sizeof($attach_list)) } } -$template->assign_vars(array( - 'S_HAS_ATTACHMENTS' => $topic_data['topic_attachment'], -)); - $methods = phpbb_gen_download_links('topic_id', $topic_id, $phpbb_root_path, $phpEx); foreach ($methods as $method) { $template->assign_block_vars('dl_method', $method); } +$template->assign_vars(array( + 'S_HAS_ATTACHMENTS' => $topic_data['topic_attachment'], + 'U_DOWNLOAD_ALL_ATTACHMENTS' => $methods[0]['LINK'], +)); + // Instantiate BBCode if need be if ($bbcode_bitfield !== '') { @@ -1898,7 +1905,7 @@ if (!request_var('t', 0) && !empty($topic_id)) $request->overwrite('t', $topic_id); } -$page_title = $topic_data['topic_title'] . ($start ? ' - ' . sprintf($user->lang['PAGE_TITLE_NUMBER'], floor($start / $config['posts_per_page']) + 1) : ''); +$page_title = $topic_data['topic_title'] . ($start ? ' - ' . sprintf($user->lang['PAGE_TITLE_NUMBER'], $pagination->get_on_page($config['topics_per_page'], $start)) : ''); /** * You can use this event to modify the page title of the viewtopic page diff --git a/tests/auth/provider_apache_test.php b/tests/auth/provider_apache_test.php index e135a1f002..d7509a72bf 100644 --- a/tests/auth/provider_apache_test.php +++ b/tests/auth/provider_apache_test.php @@ -7,7 +7,8 @@ * */ -require_once dirname(__FILE__).'/../../phpBB/includes/functions.php'; +require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; +require_once dirname(__FILE__) . '/../../phpBB/includes/utf/utf_tools.php'; class phpbb_auth_provider_apache_test extends phpbb_database_test_case { diff --git a/tests/auth/provider_db_test.php b/tests/auth/provider_db_test.php index 140a28cd3d..45a893220b 100644 --- a/tests/auth/provider_db_test.php +++ b/tests/auth/provider_db_test.php @@ -7,7 +7,8 @@ * */ -require_once dirname(__FILE__).'/../../phpBB/includes/functions.php'; +require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; +require_once dirname(__FILE__) . '/../../phpBB/includes/utf/utf_tools.php'; class phpbb_auth_provider_db_test extends phpbb_database_test_case { diff --git a/tests/avatar/driver/barfoo.php b/tests/avatar/driver/barfoo.php index 11c100db36..0bf30b8a91 100644 --- a/tests/avatar/driver/barfoo.php +++ b/tests/avatar/driver/barfoo.php @@ -18,4 +18,9 @@ class barfoo extends \phpbb\avatar\driver\driver {
return false;
}
+
+ public function get_template_name()
+ {
+ return 'barfoo.html';
+ }
}
diff --git a/tests/avatar/driver/foobar.php b/tests/avatar/driver/foobar.php index a1e7bdf7cc..aabdaf5ac4 100644 --- a/tests/avatar/driver/foobar.php +++ b/tests/avatar/driver/foobar.php @@ -18,4 +18,9 @@ class foobar extends \phpbb\avatar\driver\driver {
return false;
}
+
+ public function get_template_name()
+ {
+ return 'foobar.html';
+ }
}
diff --git a/tests/extension/ext/barfoo/composer.json b/tests/extension/ext/barfoo/composer.json new file mode 100644 index 0000000000..35d5d2a956 --- /dev/null +++ b/tests/extension/ext/barfoo/composer.json @@ -0,0 +1,22 @@ +{ + "name": "vendor/barfoo", + "type": "phpbb-extension", + "description": "An example/sample extension to be used for testing purposes in phpBB Development.", + "version": "1.0.0", + "time": "2012-02-15 01:01:01", + "licence": "GNU GPL v2", + "authors": [{ + "name": "John Smith", + "username": "JohnSmith27", + "email": "email@phpbb.com", + "homepage": "http://phpbb.com", + "role": "N/A" + }], + "require": { + "php": ">=5.3", + "phpbb/phpbb": "3.1.*@dev" + }, + "extra": { + "display-name": "phpBB BarFoo Extension" + } +} diff --git a/tests/extension/ext/barfoo/ext.php b/tests/extension/ext/barfoo/ext.php index 1b7bb7ca5e..0de403424c 100644 --- a/tests/extension/ext/barfoo/ext.php +++ b/tests/extension/ext/barfoo/ext.php @@ -1,6 +1,6 @@ <?php -namespace barfoo; +namespace vendor\barfoo; class ext extends \phpbb\extension\base { diff --git a/tests/extension/ext/vendor/moo/composer.json b/tests/extension/ext/vendor/moo/composer.json index 4dc36963b3..901cb7f17a 100644 --- a/tests/extension/ext/vendor/moo/composer.json +++ b/tests/extension/ext/vendor/moo/composer.json @@ -1,5 +1,5 @@ { - "name": "moo/example", + "name": "vendor/moo", "type": "phpbb-extension", "description": "An example/sample extension to be used for testing purposes in phpBB Development.", "version": "1.0.0", diff --git a/tests/extension/ext/barfoo/acp/a_info.php b/tests/extension/ext/vendor2/bar/acp/a_info.php index ea07189f7a..8132df587f 100644 --- a/tests/extension/ext/barfoo/acp/a_info.php +++ b/tests/extension/ext/vendor2/bar/acp/a_info.php @@ -1,14 +1,14 @@ <?php -namespace barfoo\acp; +namespace vendor2\bar\acp; class a_info { public function module() { return array( - 'filename' => 'barfoo\\acp\\a_module', - 'title' => 'Barfoo', + 'filename' => 'vendor2\\bar\\acp\\a_module', + 'title' => 'Bar', 'version' => '3.1.0-dev', 'modes' => array( 'config' => array('title' => 'Config', 'auth' => '', 'cat' => array('ACP_MODS')), diff --git a/tests/extension/ext/foo/mcp/a_module.php b/tests/extension/ext/vendor2/bar/acp/a_module.php index ca397e7004..3a3d105790 100644 --- a/tests/extension/ext/foo/mcp/a_module.php +++ b/tests/extension/ext/vendor2/bar/acp/a_module.php @@ -1,6 +1,6 @@ <?php -namespace foo\mcp; +namespace vendor2\bar\acp; class a_module { diff --git a/tests/extension/ext/vendor2/bar/composer.json b/tests/extension/ext/vendor2/bar/composer.json new file mode 100644 index 0000000000..5d60ec031e --- /dev/null +++ b/tests/extension/ext/vendor2/bar/composer.json @@ -0,0 +1,21 @@ +{ + "name": "vendor2/bar", + "type": "phpbb-extension", + "description": "An example/sample extension to be used for testing purposes in phpBB Development.", + "version": "1.0.0", + "time": "2012-02-15 01:01:01", + "licence": "GPL-2.0", + "authors": [{ + "name": "John Smith", + "email": "email@phpbb.com", + "homepage": "http://phpbb.com", + "role": "N/A" + }], + "require": { + "php": ">=5.3", + "phpbb/phpbb": "3.1.*@dev" + }, + "extra": { + "display-name": "phpBB Bar Extension" + } +} diff --git a/tests/extension/ext/bar/ext.php b/tests/extension/ext/vendor2/bar/ext.php index 22ff5e8077..f94ab9ad81 100644 --- a/tests/extension/ext/bar/ext.php +++ b/tests/extension/ext/vendor2/bar/ext.php @@ -1,6 +1,6 @@ <?php -namespace bar; +namespace vendor2\bar; class ext extends \phpbb\extension\base { diff --git a/tests/extension/ext/foo/a_class.php b/tests/extension/ext/vendor2/foo/a_class.php index 9db45a697f..06278c0e0c 100644 --- a/tests/extension/ext/foo/a_class.php +++ b/tests/extension/ext/vendor2/foo/a_class.php @@ -1,6 +1,6 @@ <?php -namespace foo; +namespace vendor2\foo; class a_class { diff --git a/tests/extension/ext/foo/acp/a_info.php b/tests/extension/ext/vendor2/foo/acp/a_info.php index 3b7d8cdd42..27e67c1556 100644 --- a/tests/extension/ext/foo/acp/a_info.php +++ b/tests/extension/ext/vendor2/foo/acp/a_info.php @@ -1,13 +1,13 @@ <?php -namespace foo\acp; +namespace vendor2\foo\acp; class a_info { public function module() { return array( - 'filename' => 'foo\\acp\\a_module', + 'filename' => 'vendor2\\foo\\acp\\a_module', 'title' => 'Foobar', 'version' => '3.1.0-dev', 'modes' => array( diff --git a/tests/extension/ext/barfoo/acp/a_module.php b/tests/extension/ext/vendor2/foo/acp/a_module.php index 0ae8775013..78d91af2fe 100644 --- a/tests/extension/ext/barfoo/acp/a_module.php +++ b/tests/extension/ext/vendor2/foo/acp/a_module.php @@ -1,6 +1,6 @@ <?php -namespace barfoo\acp; +namespace vendor2\foo\acp; class a_module { diff --git a/tests/extension/ext/foo/acp/fail_info.php b/tests/extension/ext/vendor2/foo/acp/fail_info.php index 01d29fc5eb..d9b4353957 100644 --- a/tests/extension/ext/foo/acp/fail_info.php +++ b/tests/extension/ext/vendor2/foo/acp/fail_info.php @@ -1,6 +1,6 @@ <?php -namespace foo\acp; +namespace vendor2\foo\acp; /* * Due to the mismatch between the class name and the file name, this module @@ -11,7 +11,7 @@ class foo_info public function module() { return array( - 'filename' => 'foo\acp\fail_module', + 'filename' => 'vendor2\foo\acp\fail_module', 'title' => 'Foobar', 'version' => '3.1.0-dev', 'modes' => array( diff --git a/tests/extension/ext/foo/acp/fail_module.php b/tests/extension/ext/vendor2/foo/acp/fail_module.php index 8070929d3c..c8a5eae745 100644 --- a/tests/extension/ext/foo/acp/fail_module.php +++ b/tests/extension/ext/vendor2/foo/acp/fail_module.php @@ -1,6 +1,6 @@ <?php -namespace foo\acp; +namespace vendor2\foo\acp; /* * Due to the mismatch between the class name and the file name of the module diff --git a/tests/extension/ext/foo/b_class.php b/tests/extension/ext/vendor2/foo/b_class.php index bb2a77c05e..3d0f193908 100644 --- a/tests/extension/ext/foo/b_class.php +++ b/tests/extension/ext/vendor2/foo/b_class.php @@ -1,6 +1,6 @@ <?php -namespace foo; +namespace vendor2\foo; class b_class { diff --git a/tests/extension/ext/foo/composer.json b/tests/extension/ext/vendor2/foo/composer.json index 5367eaf593..8821d9d50e 100644 --- a/tests/extension/ext/foo/composer.json +++ b/tests/extension/ext/vendor2/foo/composer.json @@ -1,5 +1,5 @@ { - "name": "foo/example", + "name": "vendor2/foo", "type": "phpbb-extension", "description": "An example/sample extension to be used for testing purposes in phpBB Development.", "version": "1.0.0", diff --git a/tests/extension/ext/foo/ext.php b/tests/extension/ext/vendor2/foo/ext.php index ac6098f2f1..15480fe92a 100644 --- a/tests/extension/ext/foo/ext.php +++ b/tests/extension/ext/vendor2/foo/ext.php @@ -1,6 +1,6 @@ <?php -namespace foo; +namespace vendor2\foo; class ext extends \phpbb\extension\base { diff --git a/tests/extension/ext/foo/mcp/a_info.php b/tests/extension/ext/vendor2/foo/mcp/a_info.php index 9a896ce808..b5599fde65 100644 --- a/tests/extension/ext/foo/mcp/a_info.php +++ b/tests/extension/ext/vendor2/foo/mcp/a_info.php @@ -1,13 +1,13 @@ <?php -namespace foo\mcp; +namespace vendor2\foo\mcp; class a_info { public function module() { return array( - 'filename' => 'foo\\mcp\\a_module', + 'filename' => 'vendor2\\foo\\mcp\\a_module', 'title' => 'Foobar', 'version' => '3.1.0-dev', 'modes' => array( diff --git a/tests/extension/ext/foo/acp/a_module.php b/tests/extension/ext/vendor2/foo/mcp/a_module.php index 7aa2351ab3..fe29783827 100644 --- a/tests/extension/ext/foo/acp/a_module.php +++ b/tests/extension/ext/vendor2/foo/mcp/a_module.php @@ -1,6 +1,6 @@ <?php -namespace foo\acp; +namespace vendor2\foo\mcp; class a_module { diff --git a/tests/extension/ext/foo/sub/type/alternative.php b/tests/extension/ext/vendor2/foo/sub/type/alternative.php index 1eaf794609..1eaf794609 100644 --- a/tests/extension/ext/foo/sub/type/alternative.php +++ b/tests/extension/ext/vendor2/foo/sub/type/alternative.php diff --git a/tests/extension/ext/foo/type/alternative.php b/tests/extension/ext/vendor2/foo/type/alternative.php index 8f753491ef..8f753491ef 100644 --- a/tests/extension/ext/foo/type/alternative.php +++ b/tests/extension/ext/vendor2/foo/type/alternative.php diff --git a/tests/extension/ext/foo/type/dummy/empty.txt b/tests/extension/ext/vendor2/foo/type/dummy/empty.txt index e69de29bb2..e69de29bb2 100644 --- a/tests/extension/ext/foo/type/dummy/empty.txt +++ b/tests/extension/ext/vendor2/foo/type/dummy/empty.txt diff --git a/tests/extension/ext/foo/typewrong/error.php b/tests/extension/ext/vendor2/foo/typewrong/error.php index 5020926043..5020926043 100644 --- a/tests/extension/ext/foo/typewrong/error.php +++ b/tests/extension/ext/vendor2/foo/typewrong/error.php diff --git a/tests/extension/ext/vendor3/bar/ext.php b/tests/extension/ext/vendor3/bar/ext.php new file mode 100644 index 0000000000..37a5e92059 --- /dev/null +++ b/tests/extension/ext/vendor3/bar/ext.php @@ -0,0 +1,26 @@ +<?php + +namespace vendor3\bar; + +class ext extends \phpbb\extension\base +{ + static public $state; + + public function enable_step($old_state) + { + // run 4 steps, then quit + if ($old_state === 4) + { + return false; + } + + if ($old_state === false) + { + $old_state = 0; + } + + self::$state = ++$old_state; + + return self::$state; + } +} diff --git a/tests/extension/ext/bar/my/hidden_class.php b/tests/extension/ext/vendor3/bar/my/hidden_class.php index 504c1873dc..38eb59aadf 100644 --- a/tests/extension/ext/bar/my/hidden_class.php +++ b/tests/extension/ext/vendor3/bar/my/hidden_class.php @@ -1,6 +1,6 @@ <?php -namespace bar\my; +namespace vendor3\bar\my; class hidden_class { diff --git a/tests/extension/ext/bar/styles/prosilver/template/foobar_body.html b/tests/extension/ext/vendor3/bar/styles/prosilver/template/foobar_body.html index 00c2a84a18..00c2a84a18 100644 --- a/tests/extension/ext/bar/styles/prosilver/template/foobar_body.html +++ b/tests/extension/ext/vendor3/bar/styles/prosilver/template/foobar_body.html diff --git a/tests/extension/finder_test.php b/tests/extension/finder_test.php index 8e6e71aaf8..d0ca5956b4 100644 --- a/tests/extension/finder_test.php +++ b/tests/extension/finder_test.php @@ -18,15 +18,15 @@ class phpbb_extension_finder_test extends phpbb_test_case $this->extension_manager = new phpbb_mock_extension_manager( dirname(__FILE__) . '/', array( - 'foo' => array( - 'ext_name' => 'foo', + 'vendor2/foo' => array( + 'ext_name' => 'vendor2/foo', 'ext_active' => '1', - 'ext_path' => 'ext/foo/', + 'ext_path' => 'ext/vendor2/foo/', ), - 'bar' => array( - 'ext_name' => 'bar', + 'vendor3/bar' => array( + 'ext_name' => 'vendor3/bar', 'ext_active' => '1', - 'ext_path' => 'ext/bar/', + 'ext_path' => 'ext/vendor3/bar/', ), )); @@ -43,10 +43,10 @@ class phpbb_extension_finder_test extends phpbb_test_case sort($classes); $this->assertEquals( array( - '\bar\my\hidden_class', - '\foo\a_class', - '\foo\b_class', '\phpbb\default\implementation', + '\vendor2\foo\a_class', + '\vendor2\foo\b_class', + '\vendor3\bar\my\hidden_class', ), $classes ); @@ -60,7 +60,7 @@ class phpbb_extension_finder_test extends phpbb_test_case sort($dirs); $this->assertEquals(array( - dirname(__FILE__) . '/ext/foo/type/', + dirname(__FILE__) . '/ext/vendor2/foo/type/', ), $dirs); } @@ -72,9 +72,9 @@ class phpbb_extension_finder_test extends phpbb_test_case sort($dirs); $this->assertEquals(array( - dirname(__FILE__) . '/ext/foo/sub/type/', - dirname(__FILE__) . '/ext/foo/type/', - dirname(__FILE__) . '/ext/foo/typewrong/', + dirname(__FILE__) . '/ext/vendor2/foo/sub/type/', + dirname(__FILE__) . '/ext/vendor2/foo/type/', + dirname(__FILE__) . '/ext/vendor2/foo/typewrong/', ), $dirs); } @@ -88,8 +88,8 @@ class phpbb_extension_finder_test extends phpbb_test_case sort($classes); $this->assertEquals( array( - '\bar\my\hidden_class', '\phpbb\default\implementation', + '\vendor3\bar\my\hidden_class', ), $classes ); @@ -105,9 +105,9 @@ class phpbb_extension_finder_test extends phpbb_test_case sort($classes); $this->assertEquals( array( - '\foo\sub\type\alternative', - '\foo\type\alternative', '\phpbb\default\implementation', + '\vendor2\foo\sub\type\alternative', + '\vendor2\foo\type\alternative', ), $classes ); @@ -122,7 +122,7 @@ class phpbb_extension_finder_test extends phpbb_test_case sort($classes); $this->assertEquals( array( - '\foo\type\alternative', + '\vendor2\foo\type\alternative', ), $classes ); @@ -137,7 +137,7 @@ class phpbb_extension_finder_test extends phpbb_test_case sort($classes); $this->assertEquals( array( - '\foo\sub\type\alternative', + '\vendor2\foo\sub\type\alternative', ), $classes ); @@ -152,7 +152,7 @@ class phpbb_extension_finder_test extends phpbb_test_case sort($classes); $this->assertEquals( array( - '\foo\sub\type\alternative', + '\vendor2\foo\sub\type\alternative', ), $classes ); @@ -162,14 +162,14 @@ class phpbb_extension_finder_test extends phpbb_test_case { $files = $this->finder ->extension_directory('/type') - ->find_from_extension('foo', dirname(__FILE__) . '/ext/foo/'); + ->find_from_extension('vendor2/foo', dirname(__FILE__) . '/ext/vendor2/foo/'); $classes = $this->finder->get_classes_from_files($files); sort($classes); $this->assertEquals( array( - '\foo\type\alternative', - '\foo\type\dummy\empty', + '\vendor2\foo\type\alternative', + '\vendor2\foo\type\dummy\empty', ), $classes ); diff --git a/tests/extension/fixtures/extensions.xml b/tests/extension/fixtures/extensions.xml index 6eb6fd11a5..6846162f0f 100644 --- a/tests/extension/fixtures/extensions.xml +++ b/tests/extension/fixtures/extensions.xml @@ -5,7 +5,7 @@ <column>ext_active</column> <column>ext_state</column> <row> - <value>foo</value> + <value>vendor2/foo</value> <value>1</value> <value></value> </row> diff --git a/tests/extension/manager_test.php b/tests/extension/manager_test.php index b127daf2ed..cc32a6af4e 100644 --- a/tests/extension/manager_test.php +++ b/tests/extension/manager_test.php @@ -7,8 +7,8 @@ * */ -require_once dirname(__FILE__) . '/ext/bar/ext.php'; -require_once dirname(__FILE__) . '/ext/foo/ext.php'; +require_once dirname(__FILE__) . '/ext/vendor2/bar/ext.php'; +require_once dirname(__FILE__) . '/ext/vendor2/foo/ext.php'; require_once dirname(__FILE__) . '/ext/vendor/moo/ext.php'; class phpbb_extension_manager_test extends phpbb_database_test_case @@ -30,52 +30,53 @@ class phpbb_extension_manager_test extends phpbb_database_test_case public function test_available() { - $this->assertEquals(array('bar', 'barfoo', 'foo', 'vendor/moo'), array_keys($this->extension_manager->all_available())); + // barfoo and vendor3/bar should not listed due to missing composer.json. barfoo also has incorrect dir structure. + $this->assertEquals(array('vendor/moo', 'vendor2/bar', 'vendor2/foo'), array_keys($this->extension_manager->all_available())); } public function test_enabled() { - $this->assertEquals(array('foo'), array_keys($this->extension_manager->all_enabled())); + $this->assertEquals(array('vendor2/foo'), array_keys($this->extension_manager->all_enabled())); } public function test_configured() { - $this->assertEquals(array('foo', 'vendor/moo'), array_keys($this->extension_manager->all_configured())); + $this->assertEquals(array('vendor/moo', 'vendor2/foo'), array_keys($this->extension_manager->all_configured())); } public function test_enable() { - bar\ext::$state = 0; + vendor2\bar\ext::$state = 0; - $this->assertEquals(array('foo'), array_keys($this->extension_manager->all_enabled())); - $this->extension_manager->enable('bar'); - $this->assertEquals(array('bar', 'foo'), array_keys($this->extension_manager->all_enabled())); - $this->assertEquals(array('bar', 'foo', 'vendor/moo'), array_keys($this->extension_manager->all_configured())); + $this->assertEquals(array('vendor2/foo'), array_keys($this->extension_manager->all_enabled())); + $this->extension_manager->enable('vendor2/bar'); + $this->assertEquals(array('vendor2/bar', 'vendor2/foo'), array_keys($this->extension_manager->all_enabled())); + $this->assertEquals(array('vendor/moo', 'vendor2/bar', 'vendor2/foo'), array_keys($this->extension_manager->all_configured())); - $this->assertEquals(4, bar\ext::$state); + $this->assertEquals(4, vendor2\bar\ext::$state); } public function test_disable() { - foo\ext::$disabled = false; + vendor2\foo\ext::$disabled = false; - $this->assertEquals(array('foo'), array_keys($this->extension_manager->all_enabled())); - $this->extension_manager->disable('foo'); + $this->assertEquals(array('vendor2/foo'), array_keys($this->extension_manager->all_enabled())); + $this->extension_manager->disable('vendor2/foo'); $this->assertEquals(array(), array_keys($this->extension_manager->all_enabled())); - $this->assertEquals(array('foo', 'vendor/moo'), array_keys($this->extension_manager->all_configured())); + $this->assertEquals(array('vendor/moo', 'vendor2/foo'), array_keys($this->extension_manager->all_configured())); - $this->assertTrue(foo\ext::$disabled); + $this->assertTrue(vendor2\foo\ext::$disabled); } public function test_purge() { vendor\moo\ext::$purged = false; - $this->assertEquals(array('foo'), array_keys($this->extension_manager->all_enabled())); - $this->assertEquals(array('foo', 'vendor/moo'), array_keys($this->extension_manager->all_configured())); + $this->assertEquals(array('vendor2/foo'), array_keys($this->extension_manager->all_enabled())); + $this->assertEquals(array('vendor/moo', 'vendor2/foo'), array_keys($this->extension_manager->all_configured())); $this->extension_manager->purge('vendor/moo'); - $this->assertEquals(array('foo'), array_keys($this->extension_manager->all_enabled())); - $this->assertEquals(array('foo'), array_keys($this->extension_manager->all_configured())); + $this->assertEquals(array('vendor2/foo'), array_keys($this->extension_manager->all_enabled())); + $this->assertEquals(array('vendor2/foo'), array_keys($this->extension_manager->all_configured())); $this->assertTrue(vendor\moo\ext::$purged); } @@ -84,7 +85,7 @@ class phpbb_extension_manager_test extends phpbb_database_test_case { $extension_manager = $this->create_extension_manager(false); - $this->assertEquals(array('foo'), array_keys($extension_manager->all_enabled())); + $this->assertEquals(array('vendor2/foo'), array_keys($extension_manager->all_enabled())); } protected function create_extension_manager($with_cache = true) diff --git a/tests/extension/metadata_manager_test.php b/tests/extension/metadata_manager_test.php index 09eb83cd86..592421f9e7 100644 --- a/tests/extension/metadata_manager_test.php +++ b/tests/extension/metadata_manager_test.php @@ -82,7 +82,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case // Should fail from missing composer.json public function test_bar() { - $ext_name = 'bar'; + $ext_name = 'vendor3/bar'; $manager = $this->get_metadata_manager($ext_name); @@ -98,7 +98,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case // Should be the same as a direct json_decode of the composer.json file public function test_foo() { - $ext_name = 'foo'; + $ext_name = 'vendor2/foo'; $manager = $this->get_metadata_manager($ext_name); @@ -111,7 +111,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case $this->fail($e); } - $json = json_decode(file_get_contents($this->phpbb_root_path . 'ext/foo/composer.json'), true); + $json = json_decode(file_get_contents($this->phpbb_root_path . 'ext/vendor2/foo/composer.json'), true); $this->assertEquals($metadata, $json); } diff --git a/tests/extension/modules_test.php b/tests/extension/modules_test.php index ef21c943c2..5dcb24c691 100644 --- a/tests/extension/modules_test.php +++ b/tests/extension/modules_test.php @@ -7,10 +7,10 @@ * */ -require_once dirname(__FILE__) . '/ext/foo/acp/a_info.php'; -require_once dirname(__FILE__) . '/ext/foo/mcp/a_info.php'; -require_once dirname(__FILE__) . '/ext/foo/acp/fail_info.php'; -require_once dirname(__FILE__) . '/ext/barfoo/acp/a_info.php'; +require_once dirname(__FILE__) . '/ext/vendor2/foo/acp/a_info.php'; +require_once dirname(__FILE__) . '/ext/vendor2/foo/mcp/a_info.php'; +require_once dirname(__FILE__) . '/ext/vendor2/foo/acp/fail_info.php'; +require_once dirname(__FILE__) . '/ext/vendor2/bar/acp/a_info.php'; require_once dirname(__FILE__) . '/../../phpBB/includes/acp/acp_modules.php'; class phpbb_extension_modules_test extends phpbb_test_case @@ -25,15 +25,15 @@ class phpbb_extension_modules_test extends phpbb_test_case $this->extension_manager = new phpbb_mock_extension_manager( dirname(__FILE__) . '/', array( - 'foo' => array( - 'ext_name' => 'foo', + 'vendor2/foo' => array( + 'ext_name' => 'vendor2/foo', 'ext_active' => '1', - 'ext_path' => 'ext/foo/', + 'ext_path' => 'ext/vendor2/foo/', ), - 'bar' => array( - 'ext_name' => 'bar', + 'vendor3/bar' => array( + 'ext_name' => 'vendor3/bar', 'ext_active' => '1', - 'ext_path' => 'ext/bar/', + 'ext_path' => 'ext/vendor3/bar/', ), )); $phpbb_extension_manager = $this->extension_manager; @@ -54,8 +54,8 @@ class phpbb_extension_modules_test extends phpbb_test_case $this->acp_modules->module_class = 'acp'; $acp_modules = $this->acp_modules->get_module_infos(); $this->assertEquals(array( - 'foo\\acp\\a_module' => array( - 'filename' => 'foo\\acp\\a_module', + 'vendor2\\foo\\acp\\a_module' => array( + 'filename' => 'vendor2\\foo\\acp\\a_module', 'title' => 'Foobar', 'version' => '3.1.0-dev', 'modes' => array( @@ -76,8 +76,8 @@ class phpbb_extension_modules_test extends phpbb_test_case $this->acp_modules->module_class = 'mcp'; $acp_modules = $this->acp_modules->get_module_infos(); $this->assertEquals(array( - 'foo\\mcp\\a_module' => array( - 'filename' => 'foo\\mcp\\a_module', + 'vendor2\\foo\\mcp\\a_module' => array( + 'filename' => 'vendor2\\foo\\mcp\\a_module', 'title' => 'Foobar', 'version' => '3.1.0-dev', 'modes' => array( @@ -90,8 +90,8 @@ class phpbb_extension_modules_test extends phpbb_test_case $this->acp_modules->module_class = 'mcp'; $acp_modules = $this->acp_modules->get_module_infos('mcp_a_module'); $this->assertEquals(array( - 'foo\\mcp\\a_module' => array( - 'filename' => 'foo\\mcp\\a_module', + 'vendor2\\foo\\mcp\\a_module' => array( + 'filename' => 'vendor2\\foo\\mcp\\a_module', 'title' => 'Foobar', 'version' => '3.1.0-dev', 'modes' => array( @@ -104,8 +104,8 @@ class phpbb_extension_modules_test extends phpbb_test_case $this->acp_modules->module_class = ''; $acp_modules = $this->acp_modules->get_module_infos('mcp_a_module', 'mcp'); $this->assertEquals(array( - 'foo\\mcp\\a_module' => array( - 'filename' => 'foo\\mcp\\a_module', + 'vendor2\\foo\\mcp\\a_module' => array( + 'filename' => 'vendor2\\foo\\mcp\\a_module', 'title' => 'Foobar', 'version' => '3.1.0-dev', 'modes' => array( @@ -128,8 +128,8 @@ class phpbb_extension_modules_test extends phpbb_test_case $this->acp_modules->module_class = 'acp'; $acp_modules = $this->acp_modules->get_module_infos('foo_acp_a_module'); $this->assertEquals(array( - 'foo\\acp\\a_module' => array ( - 'filename' => 'foo\\acp\\a_module', + 'vendor2\\foo\\acp\\a_module' => array ( + 'filename' => 'vendor2\\foo\\acp\\a_module', 'title' => 'Foobar', 'version' => '3.1.0-dev', 'modes' => array ( @@ -148,12 +148,12 @@ class phpbb_extension_modules_test extends phpbb_test_case $this->assertEquals(array(), $acp_modules); // No specific module, module class set to false (will default to the above acp) - // Setting $use_all_available will cause get_module_infos() to also load not enabled extensions (barfoo) + // Setting $use_all_available will cause get_module_infos() to also load not enabled extensions (vendor2/bar) $this->acp_modules->module_class = 'acp'; $acp_modules = $this->acp_modules->get_module_infos('', false, true); $this->assertEquals(array( - 'foo\\acp\\a_module' => array( - 'filename' => 'foo\\acp\\a_module', + 'vendor2\\foo\\acp\\a_module' => array( + 'filename' => 'vendor2\\foo\\acp\\a_module', 'title' => 'Foobar', 'version' => '3.1.0-dev', 'modes' => array( @@ -168,9 +168,9 @@ class phpbb_extension_modules_test extends phpbb_test_case 'test' => array('title' => 'Test', 'auth' => '', 'cat' => array('ACP_GENERAL')), ), ), - 'barfoo\\acp\\a_module' => array( - 'filename' => 'barfoo\\acp\\a_module', - 'title' => 'Barfoo', + 'vendor2\\bar\\acp\\a_module' => array( + 'filename' => 'vendor2\\bar\\acp\\a_module', + 'title' => 'Bar', 'version' => '3.1.0-dev', 'modes' => array( 'config' => array('title' => 'Config', 'auth' => '', 'cat' => array('ACP_MODS')), @@ -179,11 +179,11 @@ class phpbb_extension_modules_test extends phpbb_test_case ), $acp_modules); // Specific module set to disabled extension - $acp_modules = $this->acp_modules->get_module_infos('barfoo_acp_a_module', 'acp', true); + $acp_modules = $this->acp_modules->get_module_infos('vendor2_bar_acp_a_module', 'acp', true); $this->assertEquals(array( - 'barfoo\\acp\\a_module' => array( - 'filename' => 'barfoo\\acp\\a_module', - 'title' => 'Barfoo', + 'vendor2\\bar\\acp\\a_module' => array( + 'filename' => 'vendor2\\bar\\acp\\a_module', + 'title' => 'Bar', 'version' => '3.1.0-dev', 'modes' => array( 'config' => array('title' => 'Config', 'auth' => '', 'cat' => array('ACP_MODS')), diff --git a/tests/functional/avatar_acp_groups_test.php b/tests/functional/avatar_acp_groups_test.php index 5e908bc6da..5f767b44f2 100644 --- a/tests/functional/avatar_acp_groups_test.php +++ b/tests/functional/avatar_acp_groups_test.php @@ -69,4 +69,13 @@ class phpbb_functional_avatar_acp_groups_test extends phpbb_functional_common_av { $this->assert_avatar_submit($expected, $avatar_type, $data); } + + // Test if avatar was really deleted + public function test_no_avatar_acp_groups() + { + $crawler = self::request('GET', $this->get_url() . '&sid=' . $this->sid); + $form = $crawler->selectButton($this->lang('SUBMIT'))->form(); + $form_data = $form->getValues(); + $this->assertEmpty($form_data['avatar_type']); + } } diff --git a/tests/functional/extension_acp_test.php b/tests/functional/extension_acp_test.php index 5d391e42f7..53f62c4f19 100644 --- a/tests/functional/extension_acp_test.php +++ b/tests/functional/extension_acp_test.php @@ -45,7 +45,7 @@ class phpbb_functional_extension_acp_test extends phpbb_functional_test_case // Insert our base data $insert_rows = array( array( - 'ext_name' => 'foo', + 'ext_name' => 'vendor2/foo', 'ext_active' => true, 'ext_state' => 'b:0;', ), @@ -57,12 +57,12 @@ class phpbb_functional_extension_acp_test extends phpbb_functional_test_case // do not exist array( - 'ext_name' => 'test2', + 'ext_name' => 'vendor/test2', 'ext_active' => true, 'ext_state' => 'b:0;', ), array( - 'ext_name' => 'test3', + 'ext_name' => 'vendor/test3', 'ext_active' => false, 'ext_state' => 'b:0;', ), @@ -80,30 +80,38 @@ class phpbb_functional_extension_acp_test extends phpbb_functional_test_case $crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&sid=' . $this->sid); $this->assertCount(1, $crawler->filter('.ext_enabled')); - $this->assertCount(5, $crawler->filter('.ext_disabled')); + $this->assertCount(4, $crawler->filter('.ext_disabled')); $this->assertContains('phpBB Foo Extension', $crawler->filter('.ext_enabled')->eq(0)->text()); $this->assertContainsLang('EXTENSION_DISABLE', $crawler->filter('.ext_enabled')->eq(0)->text()); - $this->assertContains('The “test2” extension is not valid.', $crawler->filter('.ext_disabled')->eq(0)->text()); + $this->assertContains('phpBB Moo Extension', $crawler->filter('.ext_disabled')->eq(1)->text()); + $this->assertContainsLang('DETAILS', $crawler->filter('.ext_disabled')->eq(1)->text()); + $this->assertContainsLang('EXTENSION_ENABLE', $crawler->filter('.ext_disabled')->eq(1)->text()); + $this->assertContainsLang('EXTENSION_DELETE_DATA', $crawler->filter('.ext_disabled')->eq(1)->text()); - $this->assertContains('The “test3” extension is not valid.', $crawler->filter('.ext_disabled')->eq(1)->text()); + $this->assertContains('The “vendor/test2” extension is not valid.', $crawler->filter('.ext_disabled')->eq(0)->text()); - $this->assertContains('phpBB Moo Extension', $crawler->filter('.ext_disabled')->eq(2)->text()); - $this->assertContainsLang('DETAILS', $crawler->filter('.ext_disabled')->eq(2)->text()); - $this->assertContainsLang('EXTENSION_ENABLE', $crawler->filter('.ext_disabled')->eq(2)->text()); - $this->assertContainsLang('EXTENSION_DELETE_DATA', $crawler->filter('.ext_disabled')->eq(2)->text()); + $this->assertContains('The “vendor/test3” extension is not valid.', $crawler->filter('.ext_disabled')->eq(2)->text()); - $this->assertContains('The “bar” extension is not valid.', $crawler->filter('.ext_disabled')->eq(3)->text()); + $this->assertContains('phpBB Bar Extension', $crawler->filter('.ext_disabled')->eq(3)->text()); + $this->assertContainsLang('DETAILS', $crawler->filter('.ext_disabled')->eq(3)->text()); + $this->assertContainsLang('EXTENSION_ENABLE', $crawler->filter('.ext_disabled')->eq(3)->text()); + + // Check that invalid extensions are not listed. + $this->assertNotContains('phpBB BarFoo Extension', $crawler->filter('.table1')->text()); + $this->assertNotContains('barfoo', $crawler->filter('.table1')->text()); + + $this->assertNotContains('vendor3/bar', $crawler->filter('.table1')->text()); } public function test_details() { - $crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=details&ext_name=foo&sid=' . $this->sid); + $crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=details&ext_name=vendor2%2Ffoo&sid=' . $this->sid); $validation = array( 'DISPLAY_NAME' => 'phpBB Foo Extension', - 'CLEAN_NAME' => 'foo/example', + 'CLEAN_NAME' => 'vendor2/foo', 'TYPE' => 'phpbb-extension', 'DESCRIPTION' => 'An example/sample extension to be used for testing purposes in phpBB Development.', 'VERSION' => '1.0.0', @@ -143,7 +151,7 @@ class phpbb_functional_extension_acp_test extends phpbb_functional_test_case public function test_enable_pre() { // Foo is already enabled (redirect to list) - $crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=enable_pre&ext_name=foo&sid=' . $this->sid); + $crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=enable_pre&ext_name=vendor2%2Ffoo&sid=' . $this->sid); $this->assertContainsLang('EXTENSION_NAME', $crawler->filter('div.main thead')->text()); $this->assertContainsLang('EXTENSION_OPTIONS', $crawler->filter('div.main thead')->text()); $this->assertContainsLang('EXTENSION_ACTIONS', $crawler->filter('div.main thead')->text()); @@ -160,7 +168,7 @@ class phpbb_functional_extension_acp_test extends phpbb_functional_test_case $this->assertContainsLang('EXTENSION_OPTIONS', $crawler->filter('div.main thead')->text()); $this->assertContainsLang('EXTENSION_ACTIONS', $crawler->filter('div.main thead')->text()); - $crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=disable_pre&ext_name=foo&sid=' . $this->sid); + $crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=disable_pre&ext_name=vendor2%2Ffoo&sid=' . $this->sid); $this->assertContains($this->lang('EXTENSION_DISABLE_CONFIRM', 'phpBB Foo Extension'), $crawler->filter('.errorbox')->text()); } @@ -171,7 +179,7 @@ class phpbb_functional_extension_acp_test extends phpbb_functional_test_case $this->assertContains('The required file does not exist', $crawler->filter('.errorbox')->text()); // foo is not disabled (redirect to list) - $crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=delete_data_pre&ext_name=foo&sid=' . $this->sid); + $crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=delete_data_pre&ext_name=vendor2%2Ffoo&sid=' . $this->sid); $this->assertContainsLang('EXTENSION_NAME', $crawler->filter('div.main thead')->text()); $this->assertContainsLang('EXTENSION_OPTIONS', $crawler->filter('div.main thead')->text()); $this->assertContainsLang('EXTENSION_ACTIONS', $crawler->filter('div.main thead')->text()); @@ -211,5 +219,9 @@ class phpbb_functional_extension_acp_test extends phpbb_functional_test_case $form = $crawler->selectButton('delete_data')->form(); $crawler = self::submit($form); $this->assertContainsLang('EXTENSION_DELETE_DATA_SUCCESS', $crawler->filter('.successbox')->text()); + + // Attempt to enable invalid extension + $crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=enable_pre&ext_name=barfoo&sid=' . $this->sid); + $this->assertContainsLang('EXTENSION_DIR_INVALID', $crawler->filter('.errorbox')->text()); } } diff --git a/tests/functional/extension_module_test.php b/tests/functional/extension_module_test.php index 090cd38daf..ba025d582e 100644 --- a/tests/functional/extension_module_test.php +++ b/tests/functional/extension_module_test.php @@ -80,18 +80,53 @@ class phpbb_functional_extension_module_test extends phpbb_functional_test_case ); $modules->update_module_data($module_data, true); + $parent_data = array( + 'module_basename' => '', + 'module_enabled' => 1, + 'module_display' => 1, + 'parent_id' => 0, + 'module_class' => 'ucp', + 'module_langname' => 'UCP_FOOBAR_TITLE', + 'module_mode' => '', + 'module_auth' => '', + ); + $modules->update_module_data($parent_data, true); + + $module_data = array( + 'module_basename' => 'foo\\bar\\ucp\\main_module', + 'module_enabled' => 1, + 'module_display' => 1, + 'parent_id' => $parent_data['module_id'], + 'module_class' => 'ucp', + 'module_langname' => 'UCP_FOOBAR_TITLE', + 'module_mode' => 'mode', + 'module_auth' => '', + ); + $modules->update_module_data($module_data, true); + $this->purge_cache(); } - /** - * Check a controller for extension foo/bar. - */ - public function test_foo_bar() + public function test_acp() { $this->login(); $this->admin_login(); + $crawler = self::request('GET', 'adm/index.php?i=foo%5cbar%5cacp%5cmain_module&mode=mode&sid=' . $this->sid); - $this->assertContains("Bertie rulez!", $crawler->filter('#main')->text()); + $this->assertContains('Bertie rulez!', $crawler->filter('#main')->text()); + } + + public function test_ucp() + { + $this->login(); + + $crawler = self::request('GET', 'ucp.php?sid=' . $this->sid); + $this->assertContains('UCP_FOOBAR_TITLE', $crawler->filter('#tabs')->text()); + + $link = $crawler->selectLink('UCP_FOOBAR_TITLE')->link()->getUri(); + $crawler = self::request('GET', substr($link, strpos($link, 'ucp.'))); + $this->assertContains('UCP Extension Template Test Passed!', $crawler->filter('#content')->text()); + $this->phpbb_extension_manager->purge('foo/bar'); } } diff --git a/tests/functional/fixtures/ext/foo/bar/styles/prosilver/template/foobar.html b/tests/functional/fixtures/ext/foo/bar/styles/prosilver/template/foobar.html new file mode 100644 index 0000000000..cbded623f4 --- /dev/null +++ b/tests/functional/fixtures/ext/foo/bar/styles/prosilver/template/foobar.html @@ -0,0 +1,3 @@ +<!-- INCLUDE overall_header.html --> +<div id="content">UCP Extension Template Test Passed!</div> +<!-- INCLUDE overall_footer.html --> diff --git a/tests/functional/fixtures/ext/foo/bar/ucp/main_info.php b/tests/functional/fixtures/ext/foo/bar/ucp/main_info.php new file mode 100644 index 0000000000..2ba37f3050 --- /dev/null +++ b/tests/functional/fixtures/ext/foo/bar/ucp/main_info.php @@ -0,0 +1,26 @@ +<?php + +/** +* +* @package testing +* @copyright (c) 2013 phpBB Group +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* +*/ + +namespace foo\bar\ucp; + +class main_info +{ + function module() + { + return array( + 'filename' => '\foo\bar\ucp\main_module', + 'title' => 'ACP_FOOBAR_TITLE', + 'version' => '1.0.0', + 'modes' => array( + 'mode' => array('title' => 'ACP_FOOBAR_MODE', 'auth' => '', 'cat' => array('ACP_FOOBAR_TITLE')), + ), + ); + } +} diff --git a/tests/functional/fixtures/ext/foo/bar/ucp/main_module.php b/tests/functional/fixtures/ext/foo/bar/ucp/main_module.php new file mode 100644 index 0000000000..cd3dacc9db --- /dev/null +++ b/tests/functional/fixtures/ext/foo/bar/ucp/main_module.php @@ -0,0 +1,22 @@ +<?php + +/** +* +* @package testing +* @copyright (c) 2013 phpBB Group +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* +*/ + +namespace foo\bar\ucp; + +class main_module +{ + var $u_action; + + function main($id, $mode) + { + $this->tpl_name = 'foobar'; + $this->page_title = 'Bertie'; + } +} diff --git a/tests/functional/group_create_test.php b/tests/functional/group_create_test.php new file mode 100644 index 0000000000..96780069f7 --- /dev/null +++ b/tests/functional/group_create_test.php @@ -0,0 +1,31 @@ +<?php +/** +* +* @package testing +* @copyright (c) 2013 phpBB Group +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* +*/ + +/** +* @group functional +*/ +class phpbb_functional_group_create_test extends phpbb_functional_test_case +{ + + public function test_create_group() + { + $this->login(); + $this->admin_login(); + $this->add_lang('acp/groups'); + + $crawler = self::request('GET', 'adm/index.php?i=acp_groups&mode=manage&sid=' . $this->sid); + $form = $crawler->selectButton($this->lang('SUBMIT'))->form(); + $crawler = self::submit($form, array('group_name' => 'testtest')); + + $form = $crawler->selectButton($this->lang('SUBMIT'))->form(); + $crawler = self::submit($form, array('group_name' => 'testtest')); + + $this->assertContainsLang('GROUP_CREATED', $crawler->filter('#main')->text()); + } +} diff --git a/tests/functions/obtain_online_test.php b/tests/functions/obtain_online_test.php index 624e05f77f..cf42fd5b58 100644 --- a/tests/functions/obtain_online_test.php +++ b/tests/functions/obtain_online_test.php @@ -21,8 +21,9 @@ class phpbb_functions_obtain_online_test extends phpbb_database_test_case { parent::setUp(); - global $config, $db; + global $config, $db, $user; + $user = new StdClass; $db = $this->db = $this->new_dbal(); $config = array( 'load_online_time' => 5, diff --git a/tests/functions/validate_password_test.php b/tests/functions/validate_password_test.php index 4639f6cc89..82c5fa03c1 100644 --- a/tests/functions/validate_password_test.php +++ b/tests/functions/validate_password_test.php @@ -7,6 +7,7 @@ * */ +require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; require_once dirname(__FILE__) . '/../../phpBB/includes/functions_user.php'; require_once dirname(__FILE__) . '/validate_data_helper.php'; diff --git a/tests/functions_acp/build_cfg_template_test.php b/tests/functions_acp/build_cfg_template_test.php index acf4da1bd6..7f8db799c5 100644 --- a/tests/functions_acp/build_cfg_template_test.php +++ b/tests/functions_acp/build_cfg_template_test.php @@ -234,4 +234,54 @@ class phpbb_functions_acp_build_cfg_template_test extends phpbb_test_case $this->assertEquals($expected, build_cfg_template($tpl_type, $key, $new, $config_key, $vars)); } + + public function build_cfg_template_select_data() + { + return array( + array( + array('select'), + 'key_name', + array('config_key_name' => '0'), + 'config_key_name', + array('method' => 'select_helper'), + '<select id="key_name" name="config[config_key_name]"><option value="1">First_Option</option><option value="2" selected="selected">Second_Option</option><option value="3">Third_Option</option></select>', + ), + array( + array('select', 8), + 'key_name', + array('config_key_name' => '1'), + 'config_key_name', + array('method' => 'select_helper'), + '<select id="key_name" name="config[config_key_name]" size="8"><option value="1">First_Option</option><option value="2" selected="selected">Second_Option</option><option value="3">Third_Option</option></select>', + ), + ); + } + + /** + * @dataProvider build_cfg_template_select_data + */ + public function test_build_cfg_template_select($tpl_type, $key, $new, $config_key, $vars, $expected) + { + global $module, $user, $phpbb_dispatcher; + + $phpbb_dispatcher = new phpbb_mock_event_dispatcher(); + $user = new phpbb_mock_user(); + $user->lang = new phpbb_mock_lang(); + $user->module = $this; + $module = $user; + + $this->assertEquals($expected, build_cfg_template($tpl_type, $key, $new, $config_key, $vars)); + } + + public function select_helper() + { + return build_select( + array( + '1' => 'First_Option', + '2' => 'Second_Option', + '3' => 'Third_Option', + ), + '2' + ); + } } diff --git a/tests/functions_acp/build_select_test.php b/tests/functions_acp/build_select_test.php index aca49b7655..c44fd97ec3 100644 --- a/tests/functions_acp/build_select_test.php +++ b/tests/functions_acp/build_select_test.php @@ -11,6 +11,16 @@ require_once dirname(__FILE__) . '/../../phpBB/includes/functions_acp.php'; class phpbb_functions_acp_built_select_test extends phpbb_test_case { + protected function setUp() + { + parent::setUp(); + + global $user; + + $user = new phpbb_mock_user(); + $user->lang = new phpbb_mock_lang(); + } + public function build_select_data() { return array( @@ -46,10 +56,6 @@ class phpbb_functions_acp_built_select_test extends phpbb_test_case */ public function test_build_select($option_ary, $option_default, $expected) { - global $user; - - $user->lang = new phpbb_mock_lang(); - $this->assertEquals($expected, build_select($option_ary, $option_default)); } } diff --git a/tests/functions_acp/h_radio_test.php b/tests/functions_acp/h_radio_test.php index a61f2e8975..4c1872d341 100644 --- a/tests/functions_acp/h_radio_test.php +++ b/tests/functions_acp/h_radio_test.php @@ -11,6 +11,16 @@ require_once dirname(__FILE__) . '/../../phpBB/includes/functions_acp.php'; class phpbb_functions_acp_h_radio_test extends phpbb_test_case { + protected function setUp() + { + parent::setUp(); + + global $user; + + $user = new phpbb_mock_user(); + $user->lang = new phpbb_mock_lang(); + } + public function h_radio_data() { return array( @@ -111,10 +121,6 @@ class phpbb_functions_acp_h_radio_test extends phpbb_test_case */ public function test_h_radio($name, $input_ary, $input_default, $id, $key, $expected) { - global $user; - - $user->lang = new phpbb_mock_lang(); - $this->assertEquals($expected, h_radio($name, $input_ary, $input_default, $id, $key)); } } diff --git a/tests/functions_acp/validate_config_vars_test.php b/tests/functions_acp/validate_config_vars_test.php index 7cd7fa3892..acc98fbf0d 100644 --- a/tests/functions_acp/validate_config_vars_test.php +++ b/tests/functions_acp/validate_config_vars_test.php @@ -8,9 +8,20 @@ */ require_once dirname(__FILE__) . '/../../phpBB/includes/functions_acp.php'; +require_once dirname(__FILE__) . '/../../phpBB/includes/utf/utf_tools.php'; class phpbb_functions_acp_validate_config_vars_test extends phpbb_test_case { + protected function setUp() + { + parent::setUp(); + + global $user; + + $user = new phpbb_mock_user(); + $user->lang = new phpbb_mock_lang(); + } + /** * Data sets that don't throw an error. */ @@ -60,10 +71,6 @@ class phpbb_functions_acp_validate_config_vars_test extends phpbb_test_case */ public function test_validate_config_vars_fit($test_data, $cfg_array) { - global $user; - - $user->lang = new phpbb_mock_lang(); - $phpbb_error = array(); validate_config_vars($test_data, $cfg_array, $phpbb_error); @@ -146,10 +153,6 @@ class phpbb_functions_acp_validate_config_vars_test extends phpbb_test_case */ public function test_validate_config_vars_error($test_data, $cfg_array, $expected) { - global $user; - - $user->lang = new phpbb_mock_lang(); - $phpbb_error = array(); validate_config_vars($test_data, $cfg_array, $phpbb_error); diff --git a/tests/functions_acp/validate_range_test.php b/tests/functions_acp/validate_range_test.php index 8606158251..cb028d4d07 100644 --- a/tests/functions_acp/validate_range_test.php +++ b/tests/functions_acp/validate_range_test.php @@ -12,6 +12,16 @@ require_once dirname(__FILE__) . '/../../phpBB/includes/functions_acp.php'; class phpbb_functions_acp_validate_range_test extends phpbb_test_case { + protected function setUp() + { + parent::setUp(); + + global $user; + + $user = new phpbb_mock_user(); + $user->lang = new phpbb_mock_lang(); + } + /** * Data sets that don't throw an error. */ @@ -52,10 +62,6 @@ class phpbb_functions_acp_validate_range_test extends phpbb_test_case */ public function test_validate_range_fit($test_data) { - global $user; - - $user->lang = new phpbb_mock_lang(); - $phpbb_error = array(); validate_range($test_data, $phpbb_error); @@ -91,10 +97,6 @@ class phpbb_functions_acp_validate_range_test extends phpbb_test_case */ public function test_validate_range_too_low($test_data) { - global $user; - - $user->lang = new phpbb_mock_lang(); - $phpbb_error = array(); validate_range($test_data, $phpbb_error); @@ -130,10 +132,6 @@ class phpbb_functions_acp_validate_range_test extends phpbb_test_case */ public function test_validate_range_too_big($test_data) { - global $user; - - $user->lang = new phpbb_mock_lang(); - $phpbb_error = array(); validate_range($test_data, $phpbb_error); @@ -158,10 +156,6 @@ class phpbb_functions_acp_validate_range_test extends phpbb_test_case */ public function test_validate_range_too_long($test_data) { - global $user; - - $user->lang = new phpbb_mock_lang(); - $phpbb_error = array(); validate_range($test_data, $phpbb_error); diff --git a/tests/functions_user/group_user_attributes_test.php b/tests/functions_user/group_user_attributes_test.php index f8d52a9a6a..86e4767970 100644 --- a/tests/functions_user/group_user_attributes_test.php +++ b/tests/functions_user/group_user_attributes_test.php @@ -27,7 +27,7 @@ class phpbb_functions_user_group_user_attributes_test extends phpbb_database_tes 2, array( 'group_avatar' => '', - 'group_avatar_type' => 0, + 'group_avatar_type' => '', 'group_avatar_height' => 0, 'group_avatar_width' => 0, 'group_rank' => 0, @@ -43,7 +43,7 @@ class phpbb_functions_user_group_user_attributes_test extends phpbb_database_tes 2, array( 'group_avatar' => '', - 'group_avatar_type' => 0, + 'group_avatar_type' => '', 'group_avatar_height' => 0, 'group_avatar_width' => 0, 'group_rank' => 0, @@ -59,7 +59,7 @@ class phpbb_functions_user_group_user_attributes_test extends phpbb_database_tes 2, array( 'group_avatar' => '', - 'group_avatar_type' => 0, + 'group_avatar_type' => '', 'group_avatar_height' => 0, 'group_avatar_width' => 0, 'group_rank' => 0, @@ -75,7 +75,7 @@ class phpbb_functions_user_group_user_attributes_test extends phpbb_database_tes 3, array( 'group_avatar' => 'default2', - 'group_avatar_type' => 1, + 'group_avatar_type' => 'avatar.driver.upload', 'group_avatar_height' => 1, 'group_avatar_width' => 1, 'group_rank' => 3, @@ -91,7 +91,7 @@ class phpbb_functions_user_group_user_attributes_test extends phpbb_database_tes 3, array( 'group_avatar' => 'default2', - 'group_avatar_type' => 1, + 'group_avatar_type' => 'avatar.driver.upload', 'group_avatar_height' => 1, 'group_avatar_width' => 1, 'group_rank' => 3, @@ -107,7 +107,7 @@ class phpbb_functions_user_group_user_attributes_test extends phpbb_database_tes 3, array( 'group_avatar' => 'default2', - 'group_avatar_type' => 1, + 'group_avatar_type' => 'avatar.driver.upload', 'group_avatar_height' => 1, 'group_avatar_width' => 1, 'group_rank' => 3, @@ -127,6 +127,7 @@ class phpbb_functions_user_group_user_attributes_test extends phpbb_database_tes { global $auth, $cache, $db, $phpbb_dispatcher, $user, $phpbb_container, $phpbb_log, $phpbb_root_path, $phpEx; + $user = new phpbb_mock_user; $user->ip = ''; $cache = new phpbb_mock_cache; $db = $this->new_dbal(); diff --git a/tests/lint_test.php b/tests/lint_test.php index 905067072d..eba117839b 100644 --- a/tests/lint_test.php +++ b/tests/lint_test.php @@ -23,6 +23,10 @@ class phpbb_lint_test extends phpbb_test_case } self::$exclude = array( + dirname(__FILE__) . '/../.git', + dirname(__FILE__) . '/../build/new_version', + dirname(__FILE__) . '/../build/old_versions', + dirname(__FILE__) . '/../phpBB/cache', // PHP Fatal error: Cannot declare class Container because the name is already in use in /var/www/projects/phpbb3/tests/../phpBB/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services1-1.php on line 20 // https://gist.github.com/e003913ffd493da63cbc dirname(__FILE__) . '/../phpBB/vendor', @@ -45,7 +49,7 @@ class phpbb_lint_test extends phpbb_test_case $dh = opendir($root); while (($filename = readdir($dh)) !== false) { - if ($filename == '.' || $filename == '..' || $filename == 'git') + if ($filename == '.' || $filename == '..') { continue; } diff --git a/tests/mimetype/fixtures/jpg b/tests/mimetype/fixtures/jpg Binary files differnew file mode 100644 index 0000000000..3cd5038e38 --- /dev/null +++ b/tests/mimetype/fixtures/jpg diff --git a/tests/mimetype/guesser_test.php b/tests/mimetype/guesser_test.php new file mode 100644 index 0000000000..9f0371262b --- /dev/null +++ b/tests/mimetype/guesser_test.php @@ -0,0 +1,166 @@ +<?php +/** +* +* @package testing +* @copyright (c) 2013 phpBB Group +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* +*/ + +namespace phpbb\mimetype; + +require_once dirname(__FILE__) . '/null_guesser.php'; +require_once dirname(__FILE__) . '/incorrect_guesser.php'; + +function function_exists($name) +{ + return guesser_test::$function_exists; +} + +class guesser_test extends \phpbb_test_case +{ + public static $function_exists = true; + + public function setUp() + { + global $phpbb_root_path; + + $guessers = array( + new \Symfony\Component\HttpFoundation\File\MimeType\FileinfoMimeTypeGuesser(), + new \Symfony\Component\HttpFoundation\File\MimeType\FileBinaryMimeTypeGuesser(), + ); + $this->guesser = new \phpbb\mimetype\guesser($guessers); + $this->path = dirname(__FILE__); + $this->jpg_file = $this->path . '/fixtures/jpg'; + $this->phpbb_root_path = $phpbb_root_path; + } + + public function data_guess_files() + { + return array( + array('image/gif', 'gif'), + array('image/png', 'png'), + array('image/jpeg', 'jpg'), + array('image/tiff', 'tif'), + array('text/html', 'txt'), + array(false, 'foobar'), + ); + } + + /** + * @dataProvider data_guess_files + */ + public function test_guess_files($expected, $file) + { + $this->assertEquals($expected, $this->guesser->guess($this->path . '/../upload/fixture/' . $file)); + } + + public function test_file_not_readable() + { + @chmod($this->jpg_file, 0000); + if (is_readable($this->jpg_file)) + { + @chmod($this->jpg_file, 0644); + $this->markTestSkipped('is_readable always returns true if user is superuser or chmod does not work'); + } + $this->assertEquals(false, $this->guesser->guess($this->jpg_file)); + @chmod($this->jpg_file, 0644); + $this->assertEquals('image/jpeg', $this->guesser->guess($this->jpg_file)); + } + + public function test_null_guess() + { + $guesser = new \phpbb\mimetype\guesser(array(new \phpbb\mimetype\null_guesser)); + $this->assertEquals('application/octet-stream', $guesser->guess($this->jpg_file)); + } + + public function data_incorrect_guessers() + { + return array( + array(array(new \phpbb\mimetype\incorrect_guesser)), + array(array(new \phpbb\mimetype\null_guesser(false))), + array(array()), + ); + } + + /** + * @dataProvider data_incorrect_guessers + * + * @expectedException \LogicException + */ + public function test_incorrect_guesser($guessers) + { + $guesser = new \phpbb\mimetype\guesser($guessers); + } + + public function data_content_guesser() + { + return array( + array( + array( + 'image/jpeg', + 'image/jpeg', + ), + array(new \phpbb\mimetype\content_guesser), + false, + ), + array( + array( + 'application/octet-stream', + 'application/octet-stream', + ), + array(new \phpbb\mimetype\content_guesser), + true, + ), + array( + array( + 'application/octet-stream', + 'image/jpeg', + ), + array(new \phpbb\mimetype\extension_guesser), + ), + ); + } + + /** + * @dataProvider data_content_guesser + */ + public function test_content_guesser($expected, $guessers, $overload = false) + { + $supported = false; + self::$function_exists = !$overload; + + // Cover possible LogicExceptions + foreach ($guessers as $cur_guesser) + { + $supported += $cur_guesser->is_supported(); + } + + if (!$supported) + { + $this->setExpectedException('\LogicException'); + } + + $guesser = new \phpbb\mimetype\guesser($guessers); + $this->assertEquals($expected[0], $guesser->guess($this->jpg_file)); + $this->assertEquals($expected[1], $guesser->guess($this->jpg_file, $this->jpg_file . '.jpg')); + @copy($this->jpg_file, $this->jpg_file . '.jpg'); + $this->assertEquals($expected[1], $guesser->guess($this->jpg_file . '.jpg')); + @unlink($this->jpg_file . '.jpg'); + } + + public function test_sort_priority() + { + $guessers = array( + 'FileinfoMimeTypeGuesser' => new \Symfony\Component\HttpFoundation\File\MimeType\FileinfoMimeTypeGuesser, + 'extension_guesser' => new \phpbb\mimetype\extension_guesser, + 'FileBinaryMimeTypeGuesser' => new \Symfony\Component\HttpFoundation\File\MimeType\FileBinaryMimeTypeGuesser, + 'content_guesser' => new \phpbb\mimetype\content_guesser, + ); + $guessers['content_guesser']->set_priority(5); + $guessers['extension_guesser']->set_priority(-5); + usort($guessers, array($this->guesser, 'sort_priority')); + $this->assertInstanceOf('\phpbb\mimetype\content_guesser', $guessers[0]); + $this->assertInstanceOf('\phpbb\mimetype\extension_guesser', $guessers[3]); + } +} diff --git a/tests/mimetype/incorrect_guesser.php b/tests/mimetype/incorrect_guesser.php new file mode 100644 index 0000000000..3939826faa --- /dev/null +++ b/tests/mimetype/incorrect_guesser.php @@ -0,0 +1,18 @@ +<?php +/** +* +* @package testing +* @copyright (c) 2013 phpBB Group +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* +*/ + +namespace phpbb\mimetype; + +class incorrect_guesser +{ + public function guess($file) + { + return 'image/jpeg'; + } +} diff --git a/tests/mimetype/null_guesser.php b/tests/mimetype/null_guesser.php new file mode 100644 index 0000000000..5316d3726f --- /dev/null +++ b/tests/mimetype/null_guesser.php @@ -0,0 +1,30 @@ +<?php +/** +* +* @package testing +* @copyright (c) 2013 phpBB Group +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* +*/ + +namespace phpbb\mimetype; + +class null_guesser +{ + protected $is_supported; + + public function __construct($is_supported = true) + { + $this->is_supported = $is_supported; + } + + public function is_supported() + { + return $this->is_supported; + } + + public function guess($file) + { + return null; + } +} diff --git a/tests/notification/submit_post_base.php b/tests/notification/submit_post_base.php index a9ed59686a..fb8e2ac807 100644 --- a/tests/notification/submit_post_base.php +++ b/tests/notification/submit_post_base.php @@ -12,7 +12,7 @@ require_once dirname(__FILE__) . '/../../phpBB/includes/functions_content.php'; require_once dirname(__FILE__) . '/../../phpBB/includes/functions_posting.php'; require_once dirname(__FILE__) . '/../../phpBB/includes/utf/utf_tools.php'; -class phpbb_notification_submit_post_base extends phpbb_database_test_case +abstract class phpbb_notification_submit_post_base extends phpbb_database_test_case { protected $notifications, $db, $container, $user, $config, $auth, $cache; diff --git a/tests/pagination/generate_template_test.php b/tests/pagination/generate_template_test.php deleted file mode 100644 index 587a948583..0000000000 --- a/tests/pagination/generate_template_test.php +++ /dev/null @@ -1,111 +0,0 @@ -<?php -/** -* -* @package testing -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 -* -*/ - -require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; -require_once dirname(__FILE__) . '/../template/template_test_case.php'; - -class phpbb_pagination_generate_template_test extends phpbb_template_template_test_case -{ - protected $test_path = 'tests/pagination'; - - public function phpbb_generate_template_pagination_data() - { - return array( - array( - 'page.php', - 'start', - 95, - 10, - 10, - 'pagination - :previous::page.php - :else:1:page.php - :current:2:page.php?start=10 - :else:3:page.php?start=20 - :else:4:page.php?start=30 - :else:5:page.php?start=40 - :ellipsis:9:page.php?start=80 - :else:10:page.php?start=90 - :next::page.php?start=20 - :u_prev:page.php - :u_next:page.php?start=20', - ), - array( - 'page.php', - 'start', - 95, - 10, - 20, - 'pagination - :previous::page.php?start=10 - :else:1:page.php - :else:2:page.php?start=10 - :current:3:page.php?start=20 - :else:4:page.php?start=30 - :else:5:page.php?start=40 - :else:6:page.php?start=50 - :ellipsis:9:page.php?start=80 - :else:10:page.php?start=90 - :next::page.php?start=30 - :u_prev:page.php?start=10 - :u_next:page.php?start=30', - ), - array( - 'test/page/%d', - '/page/%d', - 95, - 10, - 10, - 'pagination - :previous::test - :else:1:test - :current:2:test/page/2 - :else:3:test/page/3 - :else:4:test/page/4 - :else:5:test/page/5 - :ellipsis:9:test/page/9 - :else:10:test/page/10 - :next::test/page/3 - :u_prev:test - :u_next:test/page/3', - ), - array( - 'test/page/%d', - '/page/%d', - 95, - 10, - 20, - 'pagination - :previous::test/page/2 - :else:1:test - :else:2:test/page/2 - :current:3:test/page/3 - :else:4:test/page/4 - :else:5:test/page/5 - :else:6:test/page/6 - :ellipsis:9:test/page/9 - :else:10:test/page/10 - :next::test/page/4 - :u_prev:test/page/2 - :u_next:test/page/4', - ), - ); - } - - /** - * @dataProvider phpbb_generate_template_pagination_data - */ - public function test_phpbb_generate_template_pagination($base_url, $start_name, $num_items, $per_page, $start_item, $expect) - { - phpbb_generate_template_pagination($this->template, $base_url, 'pagination', $start_name, $num_items, $per_page, $start_item); - $this->template->set_filenames(array('test' => 'pagination.html')); - - $this->assertEquals(str_replace("\t", '', $expect), $this->display('test')); - } -} diff --git a/tests/pagination/pagination_test.php b/tests/pagination/pagination_test.php new file mode 100644 index 0000000000..4e8083b47f --- /dev/null +++ b/tests/pagination/pagination_test.php @@ -0,0 +1,240 @@ +<?php +/** +* +* @package testing +* @copyright (c) 2013 phpBB Group +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* +*/ + +require_once dirname(__FILE__) . '/../template/template_test_case.php'; + +class phpbb_pagination_pagination_test extends phpbb_template_template_test_case +{ + protected $test_path = 'tests/pagination'; + + public function return_callback_implode() + { + return implode('-', func_get_args()); + } + + public function setUp() + { + parent::setUp(); + $user = $this->getMock('\phpbb\user'); + $user->expects($this->any()) + ->method('lang') + ->will($this->returnCallback(array($this, 'return_callback_implode'))); + $this->pagination = new \phpbb\pagination($this->template, $user); + } + + public function generate_template_pagination_data() + { + return array( + array( + 'page.php', + 'start', + 95, + 10, + 10, + 'pagination + :previous::page.php + :else:1:page.php + :current:2:page.php?start=10 + :else:3:page.php?start=20 + :else:4:page.php?start=30 + :else:5:page.php?start=40 + :ellipsis:9:page.php?start=80 + :else:10:page.php?start=90 + :next::page.php?start=20 + :u_prev:page.php + :u_next:page.php?start=20', + ), + array( + 'page.php', + 'start', + 95, + 10, + 20, + 'pagination + :previous::page.php?start=10 + :else:1:page.php + :else:2:page.php?start=10 + :current:3:page.php?start=20 + :else:4:page.php?start=30 + :else:5:page.php?start=40 + :else:6:page.php?start=50 + :ellipsis:9:page.php?start=80 + :else:10:page.php?start=90 + :next::page.php?start=30 + :u_prev:page.php?start=10 + :u_next:page.php?start=30', + ), + array( + 'test/page/%d', + '/page/%d', + 95, + 10, + 10, + 'pagination + :previous::test + :else:1:test + :current:2:test/page/2 + :else:3:test/page/3 + :else:4:test/page/4 + :else:5:test/page/5 + :ellipsis:9:test/page/9 + :else:10:test/page/10 + :next::test/page/3 + :u_prev:test + :u_next:test/page/3', + ), + array( + 'test/page/%d', + '/page/%d', + 95, + 10, + 20, + 'pagination + :previous::test/page/2 + :else:1:test + :else:2:test/page/2 + :current:3:test/page/3 + :else:4:test/page/4 + :else:5:test/page/5 + :else:6:test/page/6 + :ellipsis:9:test/page/9 + :else:10:test/page/10 + :next::test/page/4 + :u_prev:test/page/2 + :u_next:test/page/4', + ), + ); + } + + /** + * @dataProvider generate_template_pagination_data + */ + public function test_generate_template_pagination($base_url, $start_name, $num_items, $per_page, $start_item, $expect) + { + $this->pagination->generate_template_pagination($base_url, 'pagination', $start_name, $num_items, $per_page, $start_item); + $this->template->set_filenames(array('test' => 'pagination.html')); + + $this->assertEquals(str_replace("\t", '', $expect), $this->display('test')); + } + + public function on_page_data() + { + return array( + array( + 'page.php', + 10, + 10, + 0, + 'PAGE_OF-1-1', + 'on_page + per_page:10 + on_page:1 + base_url:page.php', + ), + ); + } + + /** + * @dataProvider on_page_data + */ + public function test_on_page($base_url, $num_items, $per_page, $start_item, $expect_return, $expect) + { + $this->assertEquals($expect_return, $this->pagination->on_page($base_url, $num_items, $per_page, $start_item)); + + $this->template->set_filenames(array('test' => 'on_page.html')); + + $this->assertEquals(str_replace("\t", '', $expect), $this->display('test')); + } + + public function validate_start_data() + { + return array( + array( + -1, + 0, + ), + array( + 0, + 0, + ), + array( + 10, + 10, + ), + array( + 20, + 10, + ), + array( + 30, + 10, + ), + ); + } + + /** + * @dataProvider validate_start_data + */ + public function test_validate_start($start, $expect) + { + $this->assertEquals($expect, $this->pagination->validate_start($start, 10, 20)); + } + + public function reverse_start_data() + { + return array( + array( + 10, + 5, + 15, + 0, + ), + array( + 10, + 10, + 25, + 5, + ), + ); + } + + /** + * @dataProvider reverse_start_data + */ + public function test_reverse_start($start, $limit, $num_items, $expect) + { + $this->assertEquals($expect, $this->pagination->reverse_start($start, $limit, $num_items)); + } + + public function reverse_limit_data() + { + return array( + array( + 10, + 10, + 15, + 5, + ), + array( + 20, + 10, + 15, + 1, + ), + ); + } + + /** + * @dataProvider reverse_limit_data + */ + public function test_reverse_limit($start, $per_page, $num_items, $expect) + { + $this->assertEquals($expect, $this->pagination->reverse_limit($start, $per_page, $num_items)); + } +} diff --git a/tests/pagination/templates/on_page.html b/tests/pagination/templates/on_page.html new file mode 100644 index 0000000000..364bcf9f5e --- /dev/null +++ b/tests/pagination/templates/on_page.html @@ -0,0 +1,4 @@ +on_page +per_page:{PER_PAGE} +on_page:{ON_PAGE} +base_url:{BASE_URL} diff --git a/tests/regex/password_complexity_test.php b/tests/regex/password_complexity_test.php index 07453555ee..e2aefdaac8 100644 --- a/tests/regex/password_complexity_test.php +++ b/tests/regex/password_complexity_test.php @@ -7,6 +7,7 @@ * */ +require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; require_once dirname(__FILE__) . '/../../phpBB/includes/functions_user.php'; class phpbb_password_complexity_test extends phpbb_test_case diff --git a/tests/text_processing/generate_text_for_display_test.php b/tests/text_processing/generate_text_for_display_test.php index a157fe7d9a..15905535ac 100644 --- a/tests/text_processing/generate_text_for_display_test.php +++ b/tests/text_processing/generate_text_for_display_test.php @@ -16,7 +16,7 @@ class phpbb_text_processing_generate_text_for_display_test extends phpbb_test_ca { public function setUp() { - global $cache, $user; + global $cache, $user, $phpbb_dispatcher; parent::setUp(); @@ -24,6 +24,8 @@ class phpbb_text_processing_generate_text_for_display_test extends phpbb_test_ca $user = new phpbb_mock_user; $user->optionset('viewcensors', false); + + $phpbb_dispatcher = new phpbb_mock_event_dispatcher(); } public function test_empty_string() diff --git a/tests/user/lang_test.php b/tests/user/lang_test.php index c7c858c59d..9cb9e320b3 100644 --- a/tests/user/lang_test.php +++ b/tests/user/lang_test.php @@ -7,6 +7,8 @@ * */ +require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; + class phpbb_user_lang_test extends phpbb_test_case { public function test_user_lang_sprintf() |