]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - wiki_savepage.php3
initial commit for 1.1.4
[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 = rawurldecode($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    for ($i = 1; $i <= NUM_LINKS; $i++) {
42         if (! empty(${'r'.$i}))
43               $pagehash['r'.$i] = ${'r'.$i};
44    }
45
46    InsertPage($dbi, $pagename, $pagehash);
47    UpdateRecentChanges($dbi, $pagename);
48    echo WikiHeader("Thanks for $pagename Edits");
49 ?>
50 Thank you for editing
51 <?
52    $enc_name = rawurlencode($pagename);
53    echo "<a href=\"$ScriptUrl?$enc_name\">$pagename</a><br>\n";
54
55 ?>
56 Your careful attention to detail is much appreciated.<br>
57 <img src="<? echo "$SignatureImg"; ?>"><br>
58 p.s. Be sure to <em>Reload</em> your old pages.<br>
59
60 <?
61    if ($WikiDataBase == "/tmp/wikidb") {
62       echo "<h2>Warning: the Wiki DBM file still lives in the ";
63       echo "/tmp directory. Please read the INSTALL file and move ";
64       echo "the DBM file to a permanent location or risk losing ";
65       echo "all the pages!</h2>\n";
66    }
67    echo WikiFooter();
68 ?>