122 $template->header(); |
123 $template->header(); |
123 if(isset($_POST['_preview'])) |
124 if(isset($_POST['_preview'])) |
124 { |
125 { |
125 $text = $_POST['page_text']; |
126 $text = $_POST['page_text']; |
126 echo PageUtils::genPreview($_POST['page_text']); |
127 echo PageUtils::genPreview($_POST['page_text']); |
127 } |
128 $text = htmlspecialchars($text); |
128 else $text = RenderMan::getPage($paths->cpage['urlname_nons'], $paths->namespace, 0, false, false, false, false); |
129 } |
|
130 else |
|
131 { |
|
132 $text = RenderMan::getPage($paths->cpage['urlname_nons'], $paths->namespace, 0, false, false, false, false); |
|
133 } |
129 echo ' |
134 echo ' |
130 <form action="'.makeUrl($paths->page, 'do=edit').'" method="post" enctype="multipart/form-data"> |
135 <form action="'.makeUrl($paths->page, 'do=edit').'" method="post" enctype="multipart/form-data"> |
131 <br /> |
136 <br /> |
132 <textarea name="page_text" rows="20" cols="60" style="width: 97%;">'.$text.'</textarea><br /> |
137 <textarea name="page_text" rows="20" cols="60" style="width: 97%;">'.$text.'</textarea><br /> |
133 <br /> |
138 <br /> |
134 '; |
139 '; |
135 if($paths->wiki_mode) |
140 if($paths->wiki_mode) |
136 echo 'Edit summary: <input name="edit_summary" type="text" size="40" /><br /><label><input type="checkbox" name="minor" /> This is a minor edit</label><br />'; |
141 echo $lang->get('editor_lbl_edit_summary') . ' <input name="edit_summary" type="text" size="40" /><br /><label><input type="checkbox" name="minor" /> This is a minor edit</label><br />'; |
137 echo '<br /> |
142 echo '<br /> |
138 <input type="submit" name="_save" value="Save changes" style="font-weight: bold;" /> |
143 <input type="submit" name="_save" value="' . $lang->get('editor_btn_save') . '" style="font-weight: bold;" /> |
139 <input type="submit" name="_preview" value="Preview changes" /> |
144 <input type="submit" name="_preview" value="' . $lang->get('editor_btn_preview') . '" /> |
140 <input type="submit" name="_revert" value="Revert changes" /> |
145 <input type="submit" name="_revert" value="' . $lang->get('editor_btn_revert') . '" /> |
141 <input type="submit" name="_cancel" value="Cancel" /> |
146 <input type="submit" name="_cancel" value="' . $lang->get('editor_btn_cancel') . '" /> |
142 </form> |
147 </form> |
143 '; |
148 '; |
|
149 if ( getConfig('wiki_edit_notice') == '1' ) |
|
150 { |
|
151 $notice = getConfig('wiki_edit_notice_text'); |
|
152 echo RenderMan::render($notice); |
|
153 } |
144 $template->footer(); |
154 $template->footer(); |
145 break; |
155 break; |
146 case 'viewsource': |
156 case 'viewsource': |
147 $template->header(); |
157 $template->header(); |
148 $text = RenderMan::getPage($paths->cpage['urlname_nons'], $paths->namespace, 0, false, false, false, false); |
158 $text = RenderMan::getPage($paths->cpage['urlname_nons'], $paths->namespace, 0, false, false, false, false); |
149 echo ' |
159 echo ' |
150 <form action="'.makeUrl($paths->page, 'do=edit').'" method="post"> |
160 <form action="'.makeUrl($paths->page, 'do=edit').'" method="post"> |
151 <br /> |
161 <br /> |
152 <textarea readonly="readonly" name="page_text" rows="20" cols="60" style="width: 97%;">'.$text.'</textarea>'; |
162 <textarea readonly="readonly" name="page_text" rows="20" cols="60" style="width: 97%;">'.$text.'</textarea>'; |
153 echo '<br /> |
163 echo '<br /> |
154 <input type="submit" name="_cancel" value="Close viewer" /> |
164 <input type="submit" name="_cancel" value="' . $lang->get('editor_btn_closeviewer') . '" /> |
155 </form> |
165 </form> |
156 '; |
166 '; |
157 $template->footer(); |
167 $template->footer(); |
158 break; |
168 break; |
159 case 'history': |
169 case 'history': |
191 echo $c[1]; |
201 echo $c[1]; |
192 $template->footer(); |
202 $template->footer(); |
193 break; |
203 break; |
194 case 'moreoptions': |
204 case 'moreoptions': |
195 $template->header(); |
205 $template->header(); |
196 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>'; |
197 $template->footer(); |
207 $template->footer(); |
198 break; |
208 break; |
199 case 'protect': |
209 case 'protect': |
200 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>'); |
201 if(!empty($_POST['reason'])) |
211 if(!empty($_POST['reason'])) |
202 { |
212 { |
203 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>'); |
204 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']); |
205 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>'); |
206 } |
217 } |
207 $template->header(); |
218 $template->header(); |
208 ?> |
219 ?> |
209 <form action="<?php echo makeUrl($paths->page, 'do=protect'); ?>" method="post"> |
220 <form action="<?php echo makeUrl($paths->page, 'do=protect'); ?>" method="post"> |
210 <input type="hidden" name="level" value="<?php echo $_REQUEST['level']; ?>" /> |
221 <input type="hidden" name="level" value="<?php echo $_REQUEST['level']; ?>" /> |
211 <?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>'; ?> |
212 <p>Reason for protecting the page:</p> |
223 <p><?php echo $lang->get('page_protect_lbl_reason'); ?></p> |
213 <p><input type="text" name="reason" size="40" /><br /> |
224 <p><input type="text" name="reason" size="40" /><br /> |
214 Protecion level to be applied: <b><?php |
225 <?php echo $lang->get('page_protect_lbl_level'); ?> <b><?php |
215 switch($_REQUEST['level']) |
226 switch($_REQUEST['level']) |
216 { |
227 { |
217 case '0': |
228 case '0': |
218 echo 'No protection'; |
229 echo $lang->get('page_protect_lbl_level_none'); |
219 break; |
230 break; |
220 case '1': |
231 case '1': |
221 echo 'Full protection'; |
232 echo $lang->get('page_protect_lbl_level_full'); |
222 break; |
233 break; |
223 case '2': |
234 case '2': |
224 echo 'Semi-protection'; |
235 echo $lang->get('page_protect_lbl_level_semi'); |
225 break; |
236 break; |
226 default: |
237 default: |
227 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>'; |
228 } |
239 } |
229 ?></b></p> |
240 ?></b></p> |
230 <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> |
231 </form> |
242 </form> |
232 <?php |
243 <?php |
233 $template->footer(); |
244 $template->footer(); |
234 break; |
245 break; |
235 case 'rename': |
246 case 'rename': |
236 if(!empty($_POST['newname'])) |
247 if(!empty($_POST['newname'])) |
237 { |
248 { |
238 $r = PageUtils::rename($paths->cpage['urlname_nons'], $paths->namespace, $_POST['newname']); |
249 $r = PageUtils::rename($paths->cpage['urlname_nons'], $paths->namespace, $_POST['newname']); |
239 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>'); |
240 } |
251 } |
241 $template->header(); |
252 $template->header(); |
242 ?> |
253 ?> |
243 <form action="<?php echo makeUrl($paths->page, 'do=rename'); ?>" method="post"> |
254 <form action="<?php echo makeUrl($paths->page, 'do=rename'); ?>" method="post"> |
244 <?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>'; ?> |
245 <p>Please enter a new name for this page:</p> |
256 <p><?php echo $lang->get('page_rename_lbl'); ?></p> |
246 <p><input type="text" name="newname" size="40" /></p> |
257 <p><input type="text" name="newname" size="40" /></p> |
247 <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> |
248 </form> |
259 </form> |
249 <?php |
260 <?php |
250 $template->footer(); |
261 $template->footer(); |
251 break; |
262 break; |
252 case 'flushlogs': |
263 case 'flushlogs': |
253 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 } |
254 if(isset($_POST['_downthejohn'])) |
268 if(isset($_POST['_downthejohn'])) |
255 { |
269 { |
256 $template->header(); |
270 $template->header(); |
257 $result = PageUtils::flushlogs($paths->cpage['urlname_nons'], $paths->namespace); |
271 $result = PageUtils::flushlogs($paths->cpage['urlname_nons'], $paths->namespace); |
258 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>'; |
259 $template->footer(); |
273 $template->footer(); |
260 break; |
274 break; |
261 } |
275 } |
262 $template->header(); |
276 $template->header(); |
263 ?> |
277 ?> |
264 <form action="<?php echo makeUrl($paths->page, 'do=flushlogs'); ?>" method="post"> |
278 <form action="<?php echo makeUrl($paths->page, 'do=flushlogs'); ?>" method="post"> |
265 <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'); ?> |
266 <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> |
267 database space.</p> |
|
268 <p>Do you really want to continue?</p> |
|
269 <p><input type="submit" name="_downthejohn" value="Flush logs" style="color: red; font-weight: bold;" /></p> |
|
270 </form> |
281 </form> |
271 <?php |
282 <?php |
272 $template->footer(); |
283 $template->footer(); |
273 break; |
284 break; |
274 case 'delvote': |
285 case 'delvote': |
275 if(isset($_POST['_ballotbox'])) |
286 if(isset($_POST['_ballotbox'])) |
276 { |
287 { |
277 $template->header(); |
288 $template->header(); |
278 $result = PageUtils::delvote($paths->cpage['urlname_nons'], $paths->namespace); |
289 $result = PageUtils::delvote($paths->cpage['urlname_nons'], $paths->namespace); |
279 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>'; |
280 $template->footer(); |
291 $template->footer(); |
281 break; |
292 break; |
282 } |
293 } |
283 $template->header(); |
294 $template->header(); |
284 ?> |
295 ?> |
285 <form action="<?php echo makeUrl($paths->page, 'do=delvote'); ?>" method="post"> |
296 <form action="<?php echo makeUrl($paths->page, 'do=delvote'); ?>" method="post"> |
286 <h3>Your vote counts.</h3> |
297 <?php |
287 <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'); |
288 an attempt to spam the site, you can request that this page be deleted by an administrator.</p> |
299 echo '<p>'; |
289 <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']) |
290 vote against this page.</p> |
301 { |
291 <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; |
292 <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> |
293 </form> |
309 </form> |
294 <?php |
310 <?php |
295 $template->footer(); |
311 $template->footer(); |
296 break; |
312 break; |
297 case 'resetvotes': |
313 case 'resetvotes': |
298 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 } |
299 if(isset($_POST['_youmaylivealittlelonger'])) |
318 if(isset($_POST['_youmaylivealittlelonger'])) |
300 { |
319 { |
301 $template->header(); |
320 $template->header(); |
302 $result = PageUtils::resetdelvotes($paths->cpage['urlname_nons'], $paths->namespace); |
321 $result = PageUtils::resetdelvotes($paths->cpage['urlname_nons'], $paths->namespace); |
303 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>'; |
304 $template->footer(); |
323 $template->footer(); |
305 break; |
324 break; |
306 } |
325 } |
307 $template->header(); |
326 $template->header(); |
308 ?> |
327 ?> |
309 <form action="<?php echo makeUrl($paths->page, 'do=resetvotes'); ?>" method="post"> |
328 <form action="<?php echo makeUrl($paths->page, 'do=resetvotes'); ?>" method="post"> |
310 <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> |
311 <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> |
312 </form> |
331 </form> |
313 <?php |
332 <?php |
314 $template->footer(); |
333 $template->footer(); |
315 break; |
334 break; |
316 case 'deletepage': |
335 case 'deletepage': |
317 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 } |
318 if(isset($_POST['_adiossucker'])) |
340 if(isset($_POST['_adiossucker'])) |
319 { |
341 { |
320 $reason = ( isset($_POST['reason']) ) ? $_POST['reason'] : false; |
342 $reason = ( isset($_POST['reason']) ) ? $_POST['reason'] : false; |
321 if ( empty($reason) ) |
343 if ( empty($reason) ) |
322 $error = 'Please enter a reason for deleting this page.'; |
344 $error = $lang->get('ajax_delete_prompt_reason'); |
323 else |
345 else |
324 { |
346 { |
325 $template->header(); |
347 $template->header(); |
326 $result = PageUtils::deletepage($paths->cpage['urlname_nons'], $paths->namespace, $reason); |
348 $result = PageUtils::deletepage($paths->cpage['urlname_nons'], $paths->namespace, $reason); |
327 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>'; |
328 $template->footer(); |
350 $template->footer(); |
329 break; |
351 break; |
330 } |
352 } |
331 } |
353 } |
332 $template->header(); |
354 $template->header(); |
333 ?> |
355 ?> |
334 <form action="<?php echo makeUrl($paths->page, 'do=deletepage'); ?>" method="post"> |
356 <form action="<?php echo makeUrl($paths->page, 'do=deletepage'); ?>" method="post"> |
335 <h3>You are about to <span style="color: red;">destroy</span> this page.</h3> |
357 <?php echo $lang->get('page_delete_warning_stern'); ?> |
336 <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> |
|
337 <p>Are you <u>absolutely sure</u> that you want to continue?<br /> |
|
338 You will not be asked again.</p> |
|
339 <?php if ( isset($error) ) echo "<p>$error</p>"; ?> |
358 <?php if ( isset($error) ) echo "<p>$error</p>"; ?> |
340 <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> |
341 <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> |
342 </form> |
361 </form> |
343 <?php |
362 <?php |
344 $template->footer(); |
363 $template->footer(); |
345 break; |
364 break; |
346 case 'setwikimode': |
365 case 'setwikimode': |
347 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 } |
348 if ( isset($_POST['finish']) ) |
370 if ( isset($_POST['finish']) ) |
349 { |
371 { |
350 $level = intval($_POST['level']); |
372 $level = intval($_POST['level']); |
351 if ( !in_array($level, array(0, 1, 2) ) ) |
373 if ( !in_array($level, array(0, 1, 2) ) ) |
352 { |
374 { |
353 die_friendly('Invalid request', '<p>Level not specified</p>'); |
375 die_friendly('Invalid request', '<p>Level not specified</p>'); |
354 } |
376 } |
355 $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 . '\';'); |
356 if ( !$q ) |
378 if ( !$q ) |
357 $db->_die(); |
379 $db->_die(); |
358 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); |
359 } |
381 } |
360 else |
382 else |
361 { |
383 { |
362 $template->header(); |
384 $template->header(); |
363 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>'); |