Index: trunk/phase3/includes/Article.php |
— | — | @@ -540,7 +540,6 @@ |
541 | 541 | $wgOut->addHTML( " |
542 | 542 | <form id=\"editform\" name=\"editform\" method=\"post\" action=\"$action\" |
543 | 543 | enctype=\"application/x-www-form-urlencoded\"> |
544 | | -<br clear=\"all\" /> |
545 | 544 | <textarea tabindex=1 name=\"wpTextbox1\" rows={$rows} |
546 | 545 | cols={$cols}{$ew} wrap=\"virtual\">" . |
547 | 546 | $wgLang->recodeForEdit( $wpTextbox1 ) . |
— | — | @@ -1003,15 +1002,73 @@ |
1004 | 1003 | $wgOut->fatalError( wfMsg( "cannotdelete" ) ); |
1005 | 1004 | return; |
1006 | 1005 | } |
1007 | | - $sub = str_replace( "$1", $image, wfMsg( "deletesub" ) ); |
| 1006 | + $sub = str_replace( "$1", $image, wfMsg( "deletesub" ) ); |
1008 | 1007 | } else { |
| 1008 | + |
1009 | 1009 | if ( ( "" == trim( $wgTitle->getText() ) ) |
1010 | 1010 | or ( $wgTitle->getArticleId() == 0 ) ) { |
1011 | 1011 | $wgOut->fatalError( wfMsg( "cannotdelete" ) ); |
1012 | 1012 | return; |
1013 | 1013 | } |
1014 | 1014 | $sub = str_replace( "$1", $wgTitle->getPrefixedText(), |
1015 | | - wfMsg( "deletesub" ) ); |
| 1015 | + wfMsg( "deletesub" ) ); |
| 1016 | + |
| 1017 | + # determine whether this page has earlier revisions |
| 1018 | + # and insert a warning if it does |
| 1019 | + # we select the text because it might be useful below |
| 1020 | + $sql="SELECT old_text FROM old WHERE old_namespace=0 and old_title='" . wfStrencode($wgTitle->getPrefixedDBkey())."' ORDER BY inverse_timestamp LIMIT 1"; |
| 1021 | + $res=wfQuery($sql,$fname); |
| 1022 | + if( $old=wfFetchObject($res)) { |
| 1023 | + |
| 1024 | + $skin=new Skin(); |
| 1025 | + $wgOut->addHTML("<B>".wfMsg("historywarning")); |
| 1026 | + $wgOut->addHTML( $skin->historyLink() ."</B><P>"); |
| 1027 | + } |
| 1028 | + |
| 1029 | + $sql="SELECT cur_text FROM cur WHERE cur_namespace=0 and cur_title='" . wfStrencode($wgTitle->getPrefixedDBkey())."'"; |
| 1030 | + $res=wfQuery($sql,$fname); |
| 1031 | + if( ($s=wfFetchObject($res))) { |
| 1032 | + |
| 1033 | + # if this is a mini-text, we can paste part of it into the deletion reason |
| 1034 | + |
| 1035 | + #if this is empty, an earlier revision may contain "useful" text |
| 1036 | + if($s->cur_text!="") { |
| 1037 | + $text=$s->cur_text; |
| 1038 | + } else { |
| 1039 | + if($old) { |
| 1040 | + $text=$old->old_text; |
| 1041 | + $blanked=1; |
| 1042 | + } |
| 1043 | + |
| 1044 | + } |
| 1045 | + |
| 1046 | + $length=strlen($text); |
| 1047 | + |
| 1048 | + # this should not happen, since it is not possible to store an empty, new |
| 1049 | + # page. Let's insert a standard text in case it does, though |
| 1050 | + if($length==0) { $wpreason=wfmsg("exblank");} |
| 1051 | + |
| 1052 | + |
| 1053 | + if($length < 500) { |
| 1054 | + |
| 1055 | + # comment field=255, let's grep the first 150 to have some user |
| 1056 | + # space left |
| 1057 | + $text=substr($text,0,150); |
| 1058 | + # let's strip out newlines and HTML tags |
| 1059 | + $text=preg_replace("/\"/","'",$text); |
| 1060 | + $text=preg_replace("/\</","<",$text); |
| 1061 | + $text=preg_replace("/\>/",">",$text); |
| 1062 | + $text=preg_replace("/[\n\r]/","",$text); |
| 1063 | + if(!$blanked) { |
| 1064 | + $wpReason=wfMsg("excontent"). " '".$text; |
| 1065 | + } else { |
| 1066 | + $wpReason=wfMsg("exbeforeblank") . " '".$text; |
| 1067 | + } |
| 1068 | + if($length>150) { $wpReason .= "..."; } # we've only pasted part of the text |
| 1069 | + $wpReason.="'"; |
| 1070 | + } |
| 1071 | + } |
| 1072 | + |
1016 | 1073 | } |
1017 | 1074 | |
1018 | 1075 | # Likewise, deleting old images doesn't require confirmation |
— | — | @@ -1043,7 +1100,7 @@ |
1044 | 1101 | <form id=\"deleteconfirm\" method=\"post\" action=\"{$formaction}\"> |
1045 | 1102 | <table border=0><tr><td align=right> |
1046 | 1103 | {$delcom}:</td><td align=left> |
1047 | | -<input type=text size=20 name=\"wpReason\" value=\"{$wpReason}\"> |
| 1104 | +<input type=text size=60 name=\"wpReason\" value=\"{$wpReason}\"> |
1048 | 1105 | </td></tr><tr><td> </td></tr> |
1049 | 1106 | <tr><td align=right> |
1050 | 1107 | <input type=checkbox name=\"wpConfirm\" value='1'> |
— | — | @@ -1558,7 +1615,7 @@ |
1559 | 1616 | |
1560 | 1617 | wfDebug(" saveToFileCache()\n"); |
1561 | 1618 | $filename=$this->fileCacheName(); |
1562 | | - $mydir2=substr($filename,0,strrpos($filename,"/")); # subdirectory level 2 |
| 1619 | + $mydir2=substr($filename,0,strrpos($filename,"/")); # subdirectory level 2 |
1563 | 1620 | $mydir1=substr($mydir2,0,strrpos($mydir2,"/")); # subdirectory level 1 |
1564 | 1621 | if(!file_exists($mydir1)) { mkdir($mydir1,0777); } # create if necessary |
1565 | 1622 | if(!file_exists($mydir2)) { mkdir($mydir2,0777); } |
Index: trunk/phase3/languages/Language.php |
— | — | @@ -888,8 +888,12 @@ |
889 | 889 | # |
890 | 890 | "deletepage" => "Delete page", |
891 | 891 | "confirm" => "Confirm", |
| 892 | +"excontent" => "content was:", |
| 893 | +"exbeforeblank" => "content before blanking was:", |
| 894 | +"exblank" => "page was empty", |
892 | 895 | "confirmdelete" => "Confirm delete", |
893 | 896 | "deletesub" => "(Deleting \"$1\")", |
| 897 | +"historywarning" => "Warning: The page you are about to delete has a history: ", |
894 | 898 | "confirmdeletetext" => "You are about to permanently delete a page |
895 | 899 | or image along with all of its history from the database. |
896 | 900 | Please confirm that you intend to do this, that you understand the |