196 echo $c[1]; |
201 echo $c[1]; |
197 $template->footer(); |
202 $template->footer(); |
198 break; |
203 break; |
199 case 'moreoptions': |
204 case 'moreoptions': |
200 $template->header(); |
205 $template->header(); |
201 echo '<div class="menu_nojs" style="width: 150px; padding: 0;"><ul style="display: block;"><li><div class="label">More options for this page</div><div style="clear: both;"></div></li>'.$template->tpl_strings['TOOLBAR_EXTRAS'].'</ul></div>'; |
206 echo '<div class="menu_nojs" style="width: 150px; padding: 0;"><ul style="display: block;"><li><div class="label">' . $lang->get('ajax_lbl_moreoptions_nojs') . '</div><div style="clear: both;"></div></li>'.$template->toolbar_menu.'</ul></div>'; |
202 $template->footer(); |
207 $template->footer(); |
203 break; |
208 break; |
204 case 'protect': |
209 case 'protect': |
205 if (!isset($_REQUEST['level'])) die_friendly('Invalid request', '<p>No protection level specified</p>'); |
210 if (!isset($_REQUEST['level'])) die_friendly('Invalid request', '<p>No protection level specified</p>'); |
206 if(!empty($_POST['reason'])) |
211 if(!empty($_POST['reason'])) |
207 { |
212 { |
208 if(!preg_match('#^([0-2]*){1}$#', $_POST['level'])) die_friendly('Error protecting page', '<p>Request validation failed</p>'); |
213 if(!preg_match('#^([0-2]*){1}$#', $_POST['level'])) die_friendly('Error protecting page', '<p>Request validation failed</p>'); |
209 PageUtils::protect($paths->cpage['urlname_nons'], $paths->namespace, intval($_POST['level']), $_POST['reason']); |
214 PageUtils::protect($paths->cpage['urlname_nons'], $paths->namespace, intval($_POST['level']), $_POST['reason']); |
210 die_friendly('Page protected', '<p>The protection setting has been applied. <a href="'.makeUrl($paths->page).'">Return to the page</a>.</p>'); |
215 |
|
216 die_friendly($lang->get('page_protect_lbl_success_title'), '<p>' . $lang->get('page_protect_lbl_success_body', array( 'page_link' => makeUrl($paths->page) )) . '</p>'); |
211 } |
217 } |
212 $template->header(); |
218 $template->header(); |
213 ?> |
219 ?> |
214 <form action="<?php echo makeUrl($paths->page, 'do=protect'); ?>" method="post"> |
220 <form action="<?php echo makeUrl($paths->page, 'do=protect'); ?>" method="post"> |
215 <input type="hidden" name="level" value="<?php echo $_REQUEST['level']; ?>" /> |
221 <input type="hidden" name="level" value="<?php echo $_REQUEST['level']; ?>" /> |
216 <?php if(isset($_POST['reason'])) echo '<p style="color: red;">Error: you must enter a reason for protecting this page.</p>'; ?> |
222 <?php if(isset($_POST['reason'])) echo '<p style="color: red;">' . $lang->get('page_protect_err_need_reason') . '</p>'; ?> |
217 <p>Reason for protecting the page:</p> |
223 <p><?php echo $lang->get('page_protect_lbl_reason'); ?></p> |
218 <p><input type="text" name="reason" size="40" /><br /> |
224 <p><input type="text" name="reason" size="40" /><br /> |
219 Protecion level to be applied: <b><?php |
225 <?php echo $lang->get('page_protect_lbl_level'); ?> <b><?php |
220 switch($_REQUEST['level']) |
226 switch($_REQUEST['level']) |
221 { |
227 { |
222 case '0': |
228 case '0': |
223 echo 'No protection'; |
229 echo $lang->get('page_protect_lbl_level_none'); |
224 break; |
230 break; |
225 case '1': |
231 case '1': |
226 echo 'Full protection'; |
232 echo $lang->get('page_protect_lbl_level_full'); |
227 break; |
233 break; |
228 case '2': |
234 case '2': |
229 echo 'Semi-protection'; |
235 echo $lang->get('page_protect_lbl_level_semi'); |
230 break; |
236 break; |
231 default: |
237 default: |
232 echo 'None;</b> Warning: request validation will fail after clicking submit<b>'; |
238 echo 'None;</b> Warning: request validation will fail after clicking submit<b>'; |
233 } |
239 } |
234 ?></b></p> |
240 ?></b></p> |
235 <p><input type="submit" value="Protect page" style="font-weight: bold;" /></p> |
241 <p><input type="submit" value="<?php echo htmlspecialchars($lang->get('page_protect_btn_submit')) ?>" style="font-weight: bold;" /></p> |
236 </form> |
242 </form> |
237 <?php |
243 <?php |
238 $template->footer(); |
244 $template->footer(); |
239 break; |
245 break; |
240 case 'rename': |
246 case 'rename': |
241 if(!empty($_POST['newname'])) |
247 if(!empty($_POST['newname'])) |
242 { |
248 { |
243 $r = PageUtils::rename($paths->cpage['urlname_nons'], $paths->namespace, $_POST['newname']); |
249 $r = PageUtils::rename($paths->cpage['urlname_nons'], $paths->namespace, $_POST['newname']); |
244 die_friendly('Page renamed', '<p>'.nl2br($r).' <a href="'.makeUrl($paths->page).'">Return to the page</a>.</p>'); |
250 die_friendly('Page renamed', '<p>'.nl2br($r).' <a href="'.makeUrl($paths->page).'">' . $lang->get('etc_return_to_page') . '</a>.</p>'); |
245 } |
251 } |
246 $template->header(); |
252 $template->header(); |
247 ?> |
253 ?> |
248 <form action="<?php echo makeUrl($paths->page, 'do=rename'); ?>" method="post"> |
254 <form action="<?php echo makeUrl($paths->page, 'do=rename'); ?>" method="post"> |
249 <?php if(isset($_POST['newname'])) echo '<p style="color: red;">Error: you must enter a new name for this page.</p>'; ?> |
255 <?php if(isset($_POST['newname'])) echo '<p style="color: red;">' . $lang->get('page_rename_err_need_name') . '</p>'; ?> |
250 <p>Please enter a new name for this page:</p> |
256 <p><?php echo $lang->get('page_rename_lbl'); ?></p> |
251 <p><input type="text" name="newname" size="40" /></p> |
257 <p><input type="text" name="newname" size="40" /></p> |
252 <p><input type="submit" value="Rename page" style="font-weight: bold;" /></p> |
258 <p><input type="submit" value="<?php echo htmlspecialchars($lang->get('page_rename_btn_submit')); ?>" style="font-weight: bold;" /></p> |
253 </form> |
259 </form> |
254 <?php |
260 <?php |
255 $template->footer(); |
261 $template->footer(); |
256 break; |
262 break; |
257 case 'flushlogs': |
263 case 'flushlogs': |
258 if(!$session->get_permissions('clear_logs')) die_friendly('Access denied', '<p>Flushing the logs for a page <u>requires</u> administrative rights.</p>'); |
264 if(!$session->get_permissions('clear_logs')) |
|
265 { |
|
266 die_friendly($lang->get('etc_access_denied_short'), '<p>' . $lang->get('etc_access_denied') . '</p>'); |
|
267 } |
259 if(isset($_POST['_downthejohn'])) |
268 if(isset($_POST['_downthejohn'])) |
260 { |
269 { |
261 $template->header(); |
270 $template->header(); |
262 $result = PageUtils::flushlogs($paths->cpage['urlname_nons'], $paths->namespace); |
271 $result = PageUtils::flushlogs($paths->cpage['urlname_nons'], $paths->namespace); |
263 echo '<p>'.$result.' <a href="'.makeUrl($paths->page).'">Return to the page</a>.</p>'; |
272 echo '<p>'.$result.' <a href="'.makeUrl($paths->page).'">' . $lang->get('etc_return_to_page') . '</a>.</p>'; |
264 $template->footer(); |
273 $template->footer(); |
265 break; |
274 break; |
266 } |
275 } |
267 $template->header(); |
276 $template->header(); |
268 ?> |
277 ?> |
269 <form action="<?php echo makeUrl($paths->page, 'do=flushlogs'); ?>" method="post"> |
278 <form action="<?php echo makeUrl($paths->page, 'do=flushlogs'); ?>" method="post"> |
270 <h3>You are about to <span style="color: red;">destroy</span> all logged edits and actions on this page.</h3> |
279 <?php echo $lang->get('page_flushlogs_warning_stern'); ?> |
271 <p>Unlike deleting or editing this page, this action is <u>not reversible</u>! You should only do this if you are desparate for |
280 <p><input type="submit" name="_downthejohn" value="<?php echo htmlspecialchars($lang->get('page_flushlogs_btn_submit')); ?>" style="color: red; font-weight: bold;" /></p> |
272 database space.</p> |
|
273 <p>Do you really want to continue?</p> |
|
274 <p><input type="submit" name="_downthejohn" value="Flush logs" style="color: red; font-weight: bold;" /></p> |
|
275 </form> |
281 </form> |
276 <?php |
282 <?php |
277 $template->footer(); |
283 $template->footer(); |
278 break; |
284 break; |
279 case 'delvote': |
285 case 'delvote': |
280 if(isset($_POST['_ballotbox'])) |
286 if(isset($_POST['_ballotbox'])) |
281 { |
287 { |
282 $template->header(); |
288 $template->header(); |
283 $result = PageUtils::delvote($paths->cpage['urlname_nons'], $paths->namespace); |
289 $result = PageUtils::delvote($paths->cpage['urlname_nons'], $paths->namespace); |
284 echo '<p>'.$result.' <a href="'.makeUrl($paths->page).'">Return to the page</a>.</p>'; |
290 echo '<p>'.$result.' <a href="'.makeUrl($paths->page).'">' . $lang->get('etc_return_to_page') . '</a>.</p>'; |
285 $template->footer(); |
291 $template->footer(); |
286 break; |
292 break; |
287 } |
293 } |
288 $template->header(); |
294 $template->header(); |
289 ?> |
295 ?> |
290 <form action="<?php echo makeUrl($paths->page, 'do=delvote'); ?>" method="post"> |
296 <form action="<?php echo makeUrl($paths->page, 'do=delvote'); ?>" method="post"> |
291 <h3>Your vote counts.</h3> |
297 <?php |
292 <p>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 |
298 echo $lang->get('page_delvote_warning_stern'); |
293 an attempt to spam the site, you can request that this page be deleted by an administrator.</p> |
299 echo '<p>'; |
294 <p>After you vote, you should leave a comment explaining the reason for your vote, especially if you are the first person to |
300 switch($paths->cpage['delvotes']) |
295 vote against this page.</p> |
301 { |
296 <p>So far, <?php echo ( $paths->cpage['delvotes'] == 1 ) ? $paths->cpage['delvotes'] . ' person has' : $paths->cpage['delvotes'] . ' people have'; ?> voted to delete this page.</p> |
302 case 0: echo $lang->get('page_delvote_count_zero'); break; |
297 <p><input type="submit" name="_ballotbox" value="Vote to delete this page" /></p> |
303 case 1: echo $lang->get('page_delvote_count_one'); break; |
|
304 default: echo $lang->get('page_delvote_count_plural', array('delvotes' => $paths->cpage['delvotes'])); break; |
|
305 } |
|
306 echo '</p>'; |
|
307 ?> |
|
308 <p><input type="submit" name="_ballotbox" value="<?php echo htmlspecialchars($lang->get('page_delvote_btn_submit')); ?>" /></p> |
298 </form> |
309 </form> |
299 <?php |
310 <?php |
300 $template->footer(); |
311 $template->footer(); |
301 break; |
312 break; |
302 case 'resetvotes': |
313 case 'resetvotes': |
303 if(!$session->get_permissions('vote_reset')) die_friendly('Access denied', '<p>Resetting the deletion votes against this page <u>requires</u> admin rights.</p>'); |
314 if(!$session->get_permissions('vote_reset')) |
|
315 { |
|
316 die_friendly($lang->get('etc_access_denied_short'), '<p>' . $lang->get('etc_access_denied') . '</p>'); |
|
317 } |
304 if(isset($_POST['_youmaylivealittlelonger'])) |
318 if(isset($_POST['_youmaylivealittlelonger'])) |
305 { |
319 { |
306 $template->header(); |
320 $template->header(); |
307 $result = PageUtils::resetdelvotes($paths->cpage['urlname_nons'], $paths->namespace); |
321 $result = PageUtils::resetdelvotes($paths->cpage['urlname_nons'], $paths->namespace); |
308 echo '<p>'.$result.' <a href="'.makeUrl($paths->page).'">Return to the page</a>.</p>'; |
322 echo '<p>'.$result.' <a href="'.makeUrl($paths->page).'">' . $lang->get('etc_return_to_page') . '</a>.</p>'; |
309 $template->footer(); |
323 $template->footer(); |
310 break; |
324 break; |
311 } |
325 } |
312 $template->header(); |
326 $template->header(); |
313 ?> |
327 ?> |
314 <form action="<?php echo makeUrl($paths->page, 'do=resetvotes'); ?>" method="post"> |
328 <form action="<?php echo makeUrl($paths->page, 'do=resetvotes'); ?>" method="post"> |
315 <p>This action will reset the number of votes against this page to zero. Are you sure you want to do this?</p> |
329 <p><?php echo $lang->get('ajax_delvote_reset_confirm'); ?></p> |
316 <p><input type="submit" name="_youmaylivealittlelonger" value="Reset votes" /></p> |
330 <p><input type="submit" name="_youmaylivealittlelonger" value="<?php echo htmlspecialchars($lang->get('page_delvote_reset_btn_submit')); ?>" /></p> |
317 </form> |
331 </form> |
318 <?php |
332 <?php |
319 $template->footer(); |
333 $template->footer(); |
320 break; |
334 break; |
321 case 'deletepage': |
335 case 'deletepage': |
322 if(!$session->get_permissions('delete_page')) die_friendly('Access denied', '<p>Deleting pages <u>requires</u> admin rights.</p>'); |
336 if(!$session->get_permissions('delete_page')) |
|
337 { |
|
338 die_friendly($lang->get('etc_access_denied_short'), '<p>' . $lang->get('etc_access_denied') . '</p>'); |
|
339 } |
323 if(isset($_POST['_adiossucker'])) |
340 if(isset($_POST['_adiossucker'])) |
324 { |
341 { |
325 $reason = ( isset($_POST['reason']) ) ? $_POST['reason'] : false; |
342 $reason = ( isset($_POST['reason']) ) ? $_POST['reason'] : false; |
326 if ( empty($reason) ) |
343 if ( empty($reason) ) |
327 $error = 'Please enter a reason for deleting this page.'; |
344 $error = $lang->get('ajax_delete_prompt_reason'); |
328 else |
345 else |
329 { |
346 { |
330 $template->header(); |
347 $template->header(); |
331 $result = PageUtils::deletepage($paths->cpage['urlname_nons'], $paths->namespace, $reason); |
348 $result = PageUtils::deletepage($paths->cpage['urlname_nons'], $paths->namespace, $reason); |
332 echo '<p>'.$result.' <a href="'.makeUrl($paths->page).'">Return to the page</a>.</p>'; |
349 echo '<p>'.$result.' <a href="'.makeUrl($paths->page).'">' . $lang->get('etc_return_to_page') . '</a>.</p>'; |
333 $template->footer(); |
350 $template->footer(); |
334 break; |
351 break; |
335 } |
352 } |
336 } |
353 } |
337 $template->header(); |
354 $template->header(); |
338 ?> |
355 ?> |
339 <form action="<?php echo makeUrl($paths->page, 'do=deletepage'); ?>" method="post"> |
356 <form action="<?php echo makeUrl($paths->page, 'do=deletepage'); ?>" method="post"> |
340 <h3>You are about to <span style="color: red;">destroy</span> this page.</h3> |
357 <?php echo $lang->get('page_delete_warning_stern'); ?> |
341 <p>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.</p> |
|
342 <p>Are you <u>absolutely sure</u> that you want to continue?<br /> |
|
343 You will not be asked again.</p> |
|
344 <?php if ( isset($error) ) echo "<p>$error</p>"; ?> |
358 <?php if ( isset($error) ) echo "<p>$error</p>"; ?> |
345 <p>Reason for deleting: <input type="text" name="reason" size="50" /></p> |
359 <p><?php echo $lang->get('page_delete_lbl_reason'); ?> <input type="text" name="reason" size="50" /></p> |
346 <p><input type="submit" name="_adiossucker" value="Delete this page" style="color: red; font-weight: bold;" /></p> |
360 <p><input type="submit" name="_adiossucker" value="<?php echo htmlspecialchars($lang->get('page_delete_btn_submit')); ?>" style="color: red; font-weight: bold;" /></p> |
347 </form> |
361 </form> |
348 <?php |
362 <?php |
349 $template->footer(); |
363 $template->footer(); |
350 break; |
364 break; |
351 case 'setwikimode': |
365 case 'setwikimode': |
352 if(!$session->get_permissions('set_wiki_mode')) die_friendly('Access denied', '<p>Changing the wiki mode setting <u>requires</u> admin rights.</p>'); |
366 if(!$session->get_permissions('set_wiki_mode')) |
|
367 { |
|
368 die_friendly($lang->get('etc_access_denied_short'), '<p>' . $lang->get('etc_access_denied') . '</p>'); |
|
369 } |
353 if ( isset($_POST['finish']) ) |
370 if ( isset($_POST['finish']) ) |
354 { |
371 { |
355 $level = intval($_POST['level']); |
372 $level = intval($_POST['level']); |
356 if ( !in_array($level, array(0, 1, 2) ) ) |
373 if ( !in_array($level, array(0, 1, 2) ) ) |
357 { |
374 { |
358 die_friendly('Invalid request', '<p>Level not specified</p>'); |
375 die_friendly('Invalid request', '<p>Level not specified</p>'); |
359 } |
376 } |
360 $q = $db->sql_query('UPDATE '.table_prefix.'pages SET wiki_mode=' . $level . ' WHERE urlname=\'' . $db->escape($paths->cpage['urlname_nons']) . '\' AND namespace=\'' . $paths->namespace . '\';'); |
377 $q = $db->sql_query('UPDATE '.table_prefix.'pages SET wiki_mode=' . $level . ' WHERE urlname=\'' . $db->escape($paths->cpage['urlname_nons']) . '\' AND namespace=\'' . $paths->namespace . '\';'); |
361 if ( !$q ) |
378 if ( !$q ) |
362 $db->_die(); |
379 $db->_die(); |
363 redirect(makeUrl($paths->page), htmlspecialchars($paths->cpage['name']), 'Wiki mode for this page has been set. Redirecting you to the page...', 2); |
380 redirect(makeUrl($paths->page), htmlspecialchars($paths->cpage['name']), $lang->get('page_wikimode_success_redirect'), 2); |
364 } |
381 } |
365 else |
382 else |
366 { |
383 { |
367 $template->header(); |
384 $template->header(); |
368 if(!isset($_GET['level']) || ( isset($_GET['level']) && !preg_match('#^([0-9])$#', $_GET['level']))) die_friendly('Invalid request', '<p>Level not specified</p>'); |
385 if(!isset($_GET['level']) || ( isset($_GET['level']) && !preg_match('#^([0-9])$#', $_GET['level']))) die_friendly('Invalid request', '<p>Level not specified</p>'); |