]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - wiki_savepage.php3
This commit was generated by cvs2svn to compensate for changes in r2,
[SourceForge/phpwiki.git] / wiki_savepage.php3
1 <?
2
3 /*
4    All page saving events take place here. All page info is also 
5    taken care of here.
6    This is klugey. But it works. There's probably a slicker way of
7    coding it.
8 */
9
10    $pagename = $post;
11    $pagehash = RetrievePage($dbi, $pagename);
12
13    // if this page doesn't exist yet, now's the time!
14    if (! is_array($pagehash)) {
15       $pagehash = array();
16       $pagehash["version"] = 0;
17    } else {
18       // archive it if it's a new author
19       if ($pagehash["author"] != $remoteuser) {
20          SaveCopyToArchive($pagename, $pagehash);
21       }
22    }
23
24    $pagehash["date"] = GetCurrentDate();
25    $pagehash["version"]++;
26    $pagehash["author"] = $remoteuser;
27
28    if (! empty($text)) {
29       // patch from Grant Morgan <grant@ryuuguu.com> for
30       // magic_quotes_gpc
31       if(get_magic_quotes_gpc()) { $text = stripslashes($text); }
32
33       $pagehash["text"] = explode("\n", $text);
34
35       // convert spaces to tabs at user request
36       if ($convert) {
37          $pagehash["text"] = CookSpaces($pagehash["text"]);      
38       }
39    }
40
41    // Ward Cunningham has deprecated these, but I already 
42    // implented them. You are discouraged from using them.
43    if (! empty($r1)) { $pagehash["r1"] = $r1; } 
44    if (! empty($r2)) { $pagehash["r2"] = $r2; }
45    if (! empty($r3)) { $pagehash["r3"] = $r3; } 
46    if (! empty($r4)) { $pagehash["r4"] = $r4; }
47
48    InsertPage($dbi, $pagename, $pagehash);
49    UpdateRecentChanges($dbi, $pagename);
50    WikiHeader("Thanks for $pagename Edits");
51 ?>
52 Thank you for editing
53 <?
54
55    echo "<a href=\"$ScriptUrl?$pagename\">$pagename</a><br>\n";
56
57 ?>
58 Your careful attention to detail is much appreciated.<br>
59 <img src="<? echo "$SignatureImg"; ?>"><br>
60 p.s. Be sure to <em>Reload</em> your old pages.<br>
61
62 <?
63    if ($WikiDataBase == "/tmp/wikidb") {
64       echo "<h2>Warning: the Wiki DBM file still lives in the ";
65       echo "/tmp directory. Please read the INSTALL file and move ";
66       echo "the DBM file to a permanent location or risk losing ";
67       echo "all the pages!</h2>\n";
68    }
69    WikiFooter();
70 ?>