# HG changeset patch # User Dan # Date 1193716488 14400 # Node ID d44492e34ab3c505d39f888467427083d6ae3ef7 # Parent b1530b6a06d2f6ae613d69aec6fec0238ec0c67a Failsafe page maintenance applets in index.php localized diff -r b1530b6a06d2 -r d44492e34ab3 index.php --- a/index.php Mon Oct 29 22:38:03 2007 -0400 +++ b/index.php Mon Oct 29 23:54:48 2007 -0400 @@ -125,8 +125,12 @@ { $text = $_POST['page_text']; echo PageUtils::genPreview($_POST['page_text']); + $text = htmlspecialchars($text); } - else $text = RenderMan::getPage($paths->cpage['urlname_nons'], $paths->namespace, 0, false, false, false, false); + else + { + $text = RenderMan::getPage($paths->cpage['urlname_nons'], $paths->namespace, 0, false, false, false, false); + } echo '

@@ -134,12 +138,12 @@
'; if($paths->wiki_mode) - echo 'Edit summary:

'; + echo $lang->get('editor_lbl_edit_summary') . '

'; echo '
- - - - + + + +
'; if ( getConfig('wiki_edit_notice') == '1' ) @@ -157,7 +161,7 @@
'; echo '
- + '; $template->footer(); @@ -199,7 +203,7 @@ break; case 'moreoptions': $template->header(); - echo ''; + echo ''; $template->footer(); break; case 'protect': @@ -208,32 +212,33 @@ { if(!preg_match('#^([0-2]*){1}$#', $_POST['level'])) die_friendly('Error protecting page', '

Request validation failed

'); PageUtils::protect($paths->cpage['urlname_nons'], $paths->namespace, intval($_POST['level']), $_POST['reason']); - die_friendly('Page protected', '

The protection setting has been applied. Return to the page.

'); + + die_friendly($lang->get('page_protect_lbl_success_title'), '

' . $lang->get('page_protect_lbl_success_body', array( 'page_link' => makeUrl($paths->page) )) . '

'); } $template->header(); ?>
- Error: you must enter a reason for protecting this page.

'; ?> -

Reason for protecting the page:

+ ' . $lang->get('page_protect_err_need_reason') . '

'; ?> +

get('page_protect_lbl_reason'); ?>


- Protecion level to be applied: get('page_protect_lbl_level'); ?> get('page_protect_lbl_level_none'); break; case '1': - echo 'Full protection'; + echo $lang->get('page_protect_lbl_level_full'); break; case '2': - echo 'Semi-protection'; + echo $lang->get('page_protect_lbl_level_semi'); break; default: echo 'None; Warning: request validation will fail after clicking submit'; } ?>

-

+

footer(); @@ -242,37 +247,37 @@ if(!empty($_POST['newname'])) { $r = PageUtils::rename($paths->cpage['urlname_nons'], $paths->namespace, $_POST['newname']); - die_friendly('Page renamed', '

'.nl2br($r).' Return to the page.

'); + die_friendly('Page renamed', '

'.nl2br($r).' ' . $lang->get('etc_return_to_page') . '.

'); } $template->header(); ?>
- Error: you must enter a new name for this page.

'; ?> -

Please enter a new name for this page:

+ ' . $lang->get('page_rename_err_need_name') . '

'; ?> +

get('page_rename_lbl'); ?>

-

+

footer(); break; case 'flushlogs': - if(!$session->get_permissions('clear_logs')) die_friendly('Access denied', '

Flushing the logs for a page requires administrative rights.

'); + if(!$session->get_permissions('clear_logs')) + { + die_friendly($lang->get('etc_access_denied_short'), '

' . $lang->get('etc_access_denied') . '

'); + } if(isset($_POST['_downthejohn'])) { $template->header(); $result = PageUtils::flushlogs($paths->cpage['urlname_nons'], $paths->namespace); - echo '

'.$result.' Return to the page.

'; + echo '

'.$result.' ' . $lang->get('etc_return_to_page') . '.

'; $template->footer(); break; } $template->header(); ?>
-

You are about to destroy all logged edits and actions on this page.

-

Unlike deleting or editing this page, this action is not reversible! You should only do this if you are desparate for - database space.

-

Do you really want to continue?

-

+ get('page_flushlogs_warning_stern'); ?> +

footer(); @@ -282,55 +287,66 @@ { $template->header(); $result = PageUtils::delvote($paths->cpage['urlname_nons'], $paths->namespace); - echo '

'.$result.' Return to the page.

'; + echo '

'.$result.' ' . $lang->get('etc_return_to_page') . '.

'; $template->footer(); break; } $template->header(); ?>
-

Your vote counts.

-

If you think that this page is not relavent to the content on this site, or if it looks like this page was only created in - an attempt to spam the site, you can request that this page be deleted by an administrator.

-

After you vote, you should leave a comment explaining the reason for your vote, especially if you are the first person to - vote against this page.

-

So far, cpage['delvotes'] == 1 ) ? $paths->cpage['delvotes'] . ' person has' : $paths->cpage['delvotes'] . ' people have'; ?> voted to delete this page.

-

+ get('page_delvote_warning_stern'); + echo '

'; + switch($paths->cpage['delvotes']) + { + case 0: echo $lang->get('page_delvote_count_zero'); break; + case 1: echo $lang->get('page_delvote_count_one'); break; + default: echo $lang->get('page_delvote_count_plural', array('delvotes' => $paths->cpage['delvotes'])); break; + } + echo '

'; + ?> +

footer(); break; case 'resetvotes': - if(!$session->get_permissions('vote_reset')) die_friendly('Access denied', '

Resetting the deletion votes against this page requires admin rights.

'); + if(!$session->get_permissions('vote_reset')) + { + die_friendly($lang->get('etc_access_denied_short'), '

' . $lang->get('etc_access_denied') . '

'); + } if(isset($_POST['_youmaylivealittlelonger'])) { $template->header(); $result = PageUtils::resetdelvotes($paths->cpage['urlname_nons'], $paths->namespace); - echo '

'.$result.' Return to the page.

'; + echo '

'.$result.' ' . $lang->get('etc_return_to_page') . '.

'; $template->footer(); break; } $template->header(); ?>
-

This action will reset the number of votes against this page to zero. Are you sure you want to do this?

-

+

get('ajax_delvote_reset_confirm'); ?>

+

footer(); break; case 'deletepage': - if(!$session->get_permissions('delete_page')) die_friendly('Access denied', '

Deleting pages requires admin rights.

'); + if(!$session->get_permissions('delete_page')) + { + die_friendly($lang->get('etc_access_denied_short'), '

' . $lang->get('etc_access_denied') . '

'); + } if(isset($_POST['_adiossucker'])) { $reason = ( isset($_POST['reason']) ) ? $_POST['reason'] : false; if ( empty($reason) ) - $error = 'Please enter a reason for deleting this page.'; + $error = $lang->get('ajax_delete_prompt_reason'); else { $template->header(); $result = PageUtils::deletepage($paths->cpage['urlname_nons'], $paths->namespace, $reason); - echo '

'.$result.' Return to the page.

'; + echo '

'.$result.' ' . $lang->get('etc_return_to_page') . '.

'; $template->footer(); break; } @@ -338,19 +354,19 @@ $template->header(); ?>
-

You are about to destroy this page.

-

While the deletion of the page itself is completely reversible, it is impossible to recover any comments or category information on this page. If this is a file page, the file along with all older revisions of it will be permanently deleted. Also, any custom information that this page is tagged with, such as a custom name, protection status, or additional settings such as whether to allow comments, will be permanently lost.

-

Are you absolutely sure that you want to continue?
- You will not be asked again.

+ get('page_delete_warning_stern'); ?> $error

"; ?> -

Reason for deleting:

-

+

get('page_delete_lbl_reason'); ?>

+

footer(); break; case 'setwikimode': - if(!$session->get_permissions('set_wiki_mode')) die_friendly('Access denied', '

Changing the wiki mode setting requires admin rights.

'); + if(!$session->get_permissions('set_wiki_mode')) + { + die_friendly($lang->get('etc_access_denied_short'), '

' . $lang->get('etc_access_denied') . '

'); + } if ( isset($_POST['finish']) ) { $level = intval($_POST['level']); @@ -361,7 +377,7 @@ $q = $db->sql_query('UPDATE '.table_prefix.'pages SET wiki_mode=' . $level . ' WHERE urlname=\'' . $db->escape($paths->cpage['urlname_nons']) . '\' AND namespace=\'' . $paths->namespace . '\';'); if ( !$q ) $db->_die(); - redirect(makeUrl($paths->page), htmlspecialchars($paths->cpage['name']), 'Wiki mode for this page has been set. Redirecting you to the page...', 2); + redirect(makeUrl($paths->page), htmlspecialchars($paths->cpage['name']), $lang->get('page_wikimode_success_redirect'), 2); } else { @@ -375,17 +391,13 @@ echo '
'; echo ''; echo ''; - $level_txt = ( $level == 0 ) ? 'disabled' : ( ( $level == 1 ) ? 'enabled' : 'use the global setting' ); - $blurb = ( $level == 0 || ( $level == 2 && getConfig('wiki_mode') != '1' ) ) ? 'Because this will disable the wiki behavior on this page, several features, most - notably the ability for users to vote to have this page deleted, will be disabled as they are not relevant to non-wiki pages. In addition, users will not be able - to edit this page unless an ACL rule specifically permits them.' : 'Because this will enable the wiki behavior on this page, users will gain the ability to - freely edit this page unless an ACL rule specifically denies them. If your site is public and gets good traffic, you should be aware of the possiblity of vandalism, and you need to be ready to revert - malicious edits to this page.'; + $level_txt = ( $level == 0 ) ? 'page_wikimode_level_off' : ( ( $level == 1 ) ? 'page_wikimode_level_on' : 'page_wikimode_level_global' ); + $blurb = ( $level == 0 || ( $level == 2 && getConfig('wiki_mode') != '1' ) ) ? 'page_wikimode_blurb_disable' : 'page_wikimode_blurb_enable'; ?> -

You are changing wiki mode for this page.

-

Wiki features will be set to .

-

If you want to continue, please click the button below.

-

+

get('page_wikimode_heading'); ?>

+

get($level_txt) . ' ' . $lang->get($blurb); ?>

+

get('page_wikimode_warning'); ?>

+

'; $template->footer(); @@ -404,16 +416,16 @@ case 'detag': if ( $session->user_level < USER_LEVEL_ADMIN ) { - die_friendly('Access denied', '

You need to be an administrator to detag pages.

'); + die_friendly($lang->get('etc_access_denied_short'), '

' . $lang->get('etc_access_denied') . '

'); } if ( $paths->page_exists ) { - die_friendly('Invalid request', '

The detag action is only valid for pages that have been deleted in the past.

'); + die_friendly($lang->get('etc_invalid_request_short'), '

' . $lang->get('page_detag_err_page_exists') . '

'); } $q = $db->sql_query('DELETE FROM '.table_prefix.'tags WHERE page_id=\'' . $db->escape($paths->cpage['urlname_nons']) . '\' AND namespace=\'' . $paths->namespace . '\';'); if ( !$q ) $db->_die('Detag query, index.php:'.__LINE__); - die_friendly('Page detagged', '

All stale tags have been removed from this page.

'); + die_friendly($lang->get('page_detag_success_title'), '

' . $lang->get('page_detag_success_body') . '

'); break; case 'aclmanager': $data = ( isset($_POST['data']) ) ? $_POST['data'] : Array('mode' => 'listgroups'); diff -r b1530b6a06d2 -r d44492e34ab3 language/english/enano.json --- a/language/english/enano.json Mon Oct 29 22:38:03 2007 -0400 +++ b/language/english/enano.json Mon Oct 29 23:54:48 2007 -0400 @@ -263,6 +263,50 @@ log_uploadnew: 'Uploaded new file version', lbl_comparingrevisions: 'Comparing revisions:', }, + page: { + protect_lbl_success_title: 'Page protected', + protect_lbl_success_body: 'The protection setting has been applied. Return to the page.', + protect_err_need_reason: 'Error: you must enter a reason for protecting this page.', + protect_lbl_reason: 'Reason for protecting the page:', + protect_lbl_level: 'Protecion level to be applied:', + protect_lbl_level_none: 'No protection', + protect_lbl_level_semi: 'Semi-protection', + protect_lbl_level_full: 'Full protection', + protect_btn_submit: 'Protect page', + + rename_err_need_name: 'Error: you must enter a new name for this page.', + rename_lbl: 'Please enter a new name for this page:', + rename_btn_submit: 'Rename page', + + flushlogs_warning_stern: '

You are about to destroy all logged edits and actions on this page.

Unlike deleting or editing this page, this action is not reversible! You should only do this if you are desparate for database space.

Do you really want to continue?

', + flushlogs_btn_submit: 'Flush logs', + + delvote_warning_stern: '

Your vote counts.

If you think that this page is not relavent to the content on this site, or if it looks like this page was only created in an attempt to spam the site, you can request that this page be deleted by an administrator.

After you vote, you should leave a comment explaining the reason for your vote, especially if you are the first person to vote against this page.

', + + delvote_count_zero: 'So far, no one has voted for the deletion of this page.', + delvote_count_one: 'So far, one person has voted to delete this page.', + delvote_count_plural: 'So far, %delvotes% people have voted to delete this page.', + delvote_btn_submit: 'Vote to delete this page', + delvote_reset_btn_submit: 'Reset votes', + + delete_warning_stern: '

You are about to destroy this page.

While the deletion of the page itself is completely reversible, it is impossible to recover any comments or category information on this page. If this is a file page, the file along with all older revisions of it will be permanently deleted. Also, any custom information that this page is tagged with, such as a custom name, protection status, or additional settings such as whether to allow comments, will be permanently lost.

Are you absolutely sure that you want to continue?
You will not be asked again.

', + delete_btn_submit: 'Delete this page', + delete_lbl_reason: 'Reason for deleting:', + + wikimode_success_redirect: 'Wiki mode for this page has been set. Redirecting you to the page...', + wikimode_level_on: 'Wiki features will be enabled.', + wikimode_level_off: 'Wiki features will be disabled.', + wikimode_level_global: 'Wiki features will be synchronized to the global setting.', + wikimode_heading: 'You are changing wiki mode for this page.', + wikimode_warning: 'If you want to continue, please click the button below.', + wikimode_blurb_disable: 'Because this will disable the wiki behavior on this page, several features, most notably the ability for users to vote to have this page deleted, will be disabled as they are not relevant to non-wiki pages. In addition, users will not be able to edit this page unless an ACL rule specifically permits them.', + wikimode_blurb_enable: 'Because this will enable the wiki behavior on this page, users will gain the ability to freely edit this page unless an ACL rule specifically denies them. If your site is public and gets good traffic, you should be aware of the possiblity of vandalism, and you need to be ready to revert malicious edits to this page.', + wikimode_btn_submit: 'Set wiki mode', + + detag_err_page_exists: 'The detag action is only valid for pages that have been deleted in the past.', + detag_success_title: 'Page detagged', + detag_success_body: 'All stale tags have been removed from this page.', + }, catedit: { title: 'Select which categories this page should be included in.', no_categories: 'There are no categories on this site yet.', @@ -293,7 +337,7 @@ delete_prompt_reason: 'Please enter your reason for deleting this page.', delete_confirm: 'You are about to REVERSIBLY delete this page. Do you REALLY want to do this?\n\n(Comments and categorization data, as well as any attached files, will be permanently lost)', delvote_confirm: 'Are you sure that you want to vote that this page be deleted?', - delvote_reset_confirm: 'This will reset the number of votes against this page to zero. Do you really want to do this?', + delvote_reset_confirm: 'This action will reset the number of votes against this page to zero. Do you really want to do this?', clearlogs_confirm: 'You are about to DESTROY all log entries for this page. As opposed to (example) deleting this page, this action is completely IRREVERSIBLE and should not be used except in dire circumstances. Do you REALLY want to do this?', clearlogs_confirm_nag: 'You\'re ABSOLUTELY sure???', changestyle_select: '[Select]', @@ -304,6 +348,7 @@ changestyle_success: 'Your theme preference has been changed.\nWould you like to reload the page now to see the changes?', killphp_confirm: 'Are you really sure you want to do this? Some pages might not function if this emergency-only feature is activated.', killphp_success: 'Embedded PHP in pages has been disabled.', + lbl_moreoptions_nojs: 'More options for this page', // Server-side responses rename_too_short: 'The name you entered is too short. Please enter a longer name for this page.', @@ -440,6 +485,9 @@ lbl_notice: 'Notice:', // Generic "Access denied" access_denied: 'Access to the specified file, resource, or action is denied.', + access_denied_short: 'Access denied', + return_to_page: 'Return to the page', + invalid_request_short: 'Invalid request', // Message box buttons ok: 'OK', cancel: 'Cancel',