197 echo $c[1]; |
201 echo $c[1]; |
198 $template->footer(); |
202 $template->footer(); |
199 break; |
203 break; |
200 case 'moreoptions': |
204 case 'moreoptions': |
201 $template->header(); |
205 $template->header(); |
202 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>'; |
203 $template->footer(); |
207 $template->footer(); |
204 break; |
208 break; |
205 case 'protect': |
209 case 'protect': |
206 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>'); |
207 if(!empty($_POST['reason'])) |
211 if(!empty($_POST['reason'])) |
208 { |
212 { |
209 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>'); |
210 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']); |
211 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>'); |
212 } |
217 } |
213 $template->header(); |
218 $template->header(); |
214 ?> |
219 ?> |
215 <form action="<?php echo makeUrl($paths->page, 'do=protect'); ?>" method="post"> |
220 <form action="<?php echo makeUrl($paths->page, 'do=protect'); ?>" method="post"> |
216 <input type="hidden" name="level" value="<?php echo $_REQUEST['level']; ?>" /> |
221 <input type="hidden" name="level" value="<?php echo $_REQUEST['level']; ?>" /> |
217 <?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>'; ?> |
218 <p>Reason for protecting the page:</p> |
223 <p><?php echo $lang->get('page_protect_lbl_reason'); ?></p> |
219 <p><input type="text" name="reason" size="40" /><br /> |
224 <p><input type="text" name="reason" size="40" /><br /> |
220 Protecion level to be applied: <b><?php |
225 <?php echo $lang->get('page_protect_lbl_level'); ?> <b><?php |
221 switch($_REQUEST['level']) |
226 switch($_REQUEST['level']) |
222 { |
227 { |
223 case '0': |
228 case '0': |
224 echo 'No protection'; |
229 echo $lang->get('page_protect_lbl_level_none'); |
225 break; |
230 break; |
226 case '1': |
231 case '1': |
227 echo 'Full protection'; |
232 echo $lang->get('page_protect_lbl_level_full'); |
228 break; |
233 break; |
229 case '2': |
234 case '2': |
230 echo 'Semi-protection'; |
235 echo $lang->get('page_protect_lbl_level_semi'); |
231 break; |
236 break; |
232 default: |
237 default: |
233 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>'; |
234 } |
239 } |
235 ?></b></p> |
240 ?></b></p> |
236 <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> |
237 </form> |
242 </form> |
238 <?php |
243 <?php |
239 $template->footer(); |
244 $template->footer(); |
240 break; |
245 break; |
241 case 'rename': |
246 case 'rename': |
242 if(!empty($_POST['newname'])) |
247 if(!empty($_POST['newname'])) |
243 { |
248 { |
244 $r = PageUtils::rename($paths->cpage['urlname_nons'], $paths->namespace, $_POST['newname']); |
249 $r = PageUtils::rename($paths->cpage['urlname_nons'], $paths->namespace, $_POST['newname']); |
245 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>'); |
246 } |
251 } |
247 $template->header(); |
252 $template->header(); |
248 ?> |
253 ?> |
249 <form action="<?php echo makeUrl($paths->page, 'do=rename'); ?>" method="post"> |
254 <form action="<?php echo makeUrl($paths->page, 'do=rename'); ?>" method="post"> |
250 <?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>'; ?> |
251 <p>Please enter a new name for this page:</p> |
256 <p><?php echo $lang->get('page_rename_lbl'); ?></p> |
252 <p><input type="text" name="newname" size="40" /></p> |
257 <p><input type="text" name="newname" size="40" /></p> |
253 <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> |
254 </form> |
259 </form> |
255 <?php |
260 <?php |
256 $template->footer(); |
261 $template->footer(); |
257 break; |
262 break; |
258 case 'flushlogs': |
263 case 'flushlogs': |
259 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 } |
260 if(isset($_POST['_downthejohn'])) |
268 if(isset($_POST['_downthejohn'])) |
261 { |
269 { |
262 $template->header(); |
270 $template->header(); |
263 $result = PageUtils::flushlogs($paths->cpage['urlname_nons'], $paths->namespace); |
271 $result = PageUtils::flushlogs($paths->cpage['urlname_nons'], $paths->namespace); |
264 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>'; |
265 $template->footer(); |
273 $template->footer(); |
266 break; |
274 break; |
267 } |
275 } |
268 $template->header(); |
276 $template->header(); |
269 ?> |
277 ?> |
270 <form action="<?php echo makeUrl($paths->page, 'do=flushlogs'); ?>" method="post"> |
278 <form action="<?php echo makeUrl($paths->page, 'do=flushlogs'); ?>" method="post"> |
271 <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'); ?> |
272 <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> |
273 database space.</p> |
|
274 <p>Do you really want to continue?</p> |
|
275 <p><input type="submit" name="_downthejohn" value="Flush logs" style="color: red; font-weight: bold;" /></p> |
|
276 </form> |
281 </form> |
277 <?php |
282 <?php |
278 $template->footer(); |
283 $template->footer(); |
279 break; |
284 break; |
280 case 'delvote': |
285 case 'delvote': |
281 if(isset($_POST['_ballotbox'])) |
286 if(isset($_POST['_ballotbox'])) |
282 { |
287 { |
283 $template->header(); |
288 $template->header(); |
284 $result = PageUtils::delvote($paths->cpage['urlname_nons'], $paths->namespace); |
289 $result = PageUtils::delvote($paths->cpage['urlname_nons'], $paths->namespace); |
285 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>'; |
286 $template->footer(); |
291 $template->footer(); |
287 break; |
292 break; |
288 } |
293 } |
289 $template->header(); |
294 $template->header(); |
290 ?> |
295 ?> |
291 <form action="<?php echo makeUrl($paths->page, 'do=delvote'); ?>" method="post"> |
296 <form action="<?php echo makeUrl($paths->page, 'do=delvote'); ?>" method="post"> |
292 <h3>Your vote counts.</h3> |
297 <?php |
293 <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'); |
294 an attempt to spam the site, you can request that this page be deleted by an administrator.</p> |
299 echo '<p>'; |
295 <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']) |
296 vote against this page.</p> |
301 { |
297 <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; |
298 <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> |
299 </form> |
309 </form> |
300 <?php |
310 <?php |
301 $template->footer(); |
311 $template->footer(); |
302 break; |
312 break; |
303 case 'resetvotes': |
313 case 'resetvotes': |
304 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 } |
305 if(isset($_POST['_youmaylivealittlelonger'])) |
318 if(isset($_POST['_youmaylivealittlelonger'])) |
306 { |
319 { |
307 $template->header(); |
320 $template->header(); |
308 $result = PageUtils::resetdelvotes($paths->cpage['urlname_nons'], $paths->namespace); |
321 $result = PageUtils::resetdelvotes($paths->cpage['urlname_nons'], $paths->namespace); |
309 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>'; |
310 $template->footer(); |
323 $template->footer(); |
311 break; |
324 break; |
312 } |
325 } |
313 $template->header(); |
326 $template->header(); |
314 ?> |
327 ?> |
315 <form action="<?php echo makeUrl($paths->page, 'do=resetvotes'); ?>" method="post"> |
328 <form action="<?php echo makeUrl($paths->page, 'do=resetvotes'); ?>" method="post"> |
316 <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> |
317 <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> |
318 </form> |
331 </form> |
319 <?php |
332 <?php |
320 $template->footer(); |
333 $template->footer(); |
321 break; |
334 break; |
322 case 'deletepage': |
335 case 'deletepage': |
323 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 } |
324 if(isset($_POST['_adiossucker'])) |
340 if(isset($_POST['_adiossucker'])) |
325 { |
341 { |
326 $reason = ( isset($_POST['reason']) ) ? $_POST['reason'] : false; |
342 $reason = ( isset($_POST['reason']) ) ? $_POST['reason'] : false; |
327 if ( empty($reason) ) |
343 if ( empty($reason) ) |
328 $error = 'Please enter a reason for deleting this page.'; |
344 $error = $lang->get('ajax_delete_prompt_reason'); |
329 else |
345 else |
330 { |
346 { |
331 $template->header(); |
347 $template->header(); |
332 $result = PageUtils::deletepage($paths->cpage['urlname_nons'], $paths->namespace, $reason); |
348 $result = PageUtils::deletepage($paths->cpage['urlname_nons'], $paths->namespace, $reason); |
333 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>'; |
334 $template->footer(); |
350 $template->footer(); |
335 break; |
351 break; |
336 } |
352 } |
337 } |
353 } |
338 $template->header(); |
354 $template->header(); |
339 ?> |
355 ?> |
340 <form action="<?php echo makeUrl($paths->page, 'do=deletepage'); ?>" method="post"> |
356 <form action="<?php echo makeUrl($paths->page, 'do=deletepage'); ?>" method="post"> |
341 <h3>You are about to <span style="color: red;">destroy</span> this page.</h3> |
357 <?php echo $lang->get('page_delete_warning_stern'); ?> |
342 <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> |
|
343 <p>Are you <u>absolutely sure</u> that you want to continue?<br /> |
|
344 You will not be asked again.</p> |
|
345 <?php if ( isset($error) ) echo "<p>$error</p>"; ?> |
358 <?php if ( isset($error) ) echo "<p>$error</p>"; ?> |
346 <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> |
347 <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> |
348 </form> |
361 </form> |
349 <?php |
362 <?php |
350 $template->footer(); |
363 $template->footer(); |
351 break; |
364 break; |
352 case 'setwikimode': |
365 case 'setwikimode': |
353 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 } |
354 if ( isset($_POST['finish']) ) |
370 if ( isset($_POST['finish']) ) |
355 { |
371 { |
356 $level = intval($_POST['level']); |
372 $level = intval($_POST['level']); |
357 if ( !in_array($level, array(0, 1, 2) ) ) |
373 if ( !in_array($level, array(0, 1, 2) ) ) |
358 { |
374 { |
359 die_friendly('Invalid request', '<p>Level not specified</p>'); |
375 die_friendly('Invalid request', '<p>Level not specified</p>'); |
360 } |
376 } |
361 $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 . '\';'); |
362 if ( !$q ) |
378 if ( !$q ) |
363 $db->_die(); |
379 $db->_die(); |
364 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); |
365 } |
381 } |
366 else |
382 else |
367 { |
383 { |
368 $template->header(); |
384 $template->header(); |
369 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>'); |