[Home]WikiBugs/PreventBadURLs

UseModWiki | WikiBugs | RecentChanges | Preferences

Despite being an action for admins, this fix will help prevent some incoherent messages as "1001 has been deleted." for wrong URL, "http://www.usemod.com/cgi-bin/wiki.pl?action=delete" and others.

Possibly, as described, DoDeletePage? is not the only place where to apply. Others, too: DoHistory.

sub DoDeletePage {
  my ($id) = @_;

  return  if (!&ValidIdOrDie($id));
  print &GetHeader('', Ts('Delete %s', $id), '');
  return if (!&UserIsAdminOrError());
+  if (!-f &GetPageFile($id)) {
+    print T('Invalid URL or file does not exist --nothing done');
+    print &GetCommonFooter();
+    return;
+  }
  if ($ConfirmDel && !&GetParam('confirm', 0)) {
...
sub DoHistory {
  my ($id) = @_;
  my ($html, $canEdit, $row, $newText);

+ return  if (!&ValidIdOrDie($id)); 
  print &GetHeader('', Ts('History of %s', $id), '');
+  if (!-f &GetPageFile($id)) {
+    print T('Invalid URL or file does not exist --nothing done');
+    print &GetCommonFooter();
+    return;
+  }
  &OpenPage($id);
  &OpenDefaultText();
--JuanmaMP

UseModWiki | WikiBugs | RecentChanges | Preferences
Edit text of this page | View other revisions | Search MetaWiki
Last edited December 20, 2009 1:16 am by JuanmaMP (diff)
Search: