bzr branch
http://darksoft.org/webbzr/adei/trunk
96
by Suren A. Chilingaryan
WiKi integration |
1 |
<?php
|
2 |
#################################################################################
|
|
3 |
# #
|
|
4 |
# This program is free software; you can redistribute it and/or modify #
|
|
5 |
# it under the terms of the GNU General Public License as published by #
|
|
6 |
# the Free Software Foundation; either version 2 of the License, or #
|
|
7 |
# (at your option) any later version. #
|
|
8 |
# #
|
|
9 |
# This program is distributed in the hope that it will be useful, #
|
|
10 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
|
|
11 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
|
|
12 |
# GNU General Public License for more details. #
|
|
13 |
# #
|
|
14 |
# You should have received a copy of the GNU General Public License #
|
|
15 |
# along with this program; if not, write to the Free Software #
|
|
16 |
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
|
17 |
# #
|
|
18 |
#################################################################################
|
|
19 |
||
20 |
// Installation Instructions:
|
|
21 |
//
|
|
22 |
// Just save wiki.phps as wiki.php in your web directory and make sure that
|
|
23 |
// your web server is able to read and write the file. If you want a backup
|
|
24 |
// functionality, create a folder named 'history' at the place where wiki.php
|
|
25 |
// lives. Don't forget to give proper write rights to this folder.
|
|
26 |
//
|
|
27 |
// If you work with htacces, you can define an array named AUTHORS with a
|
|
28 |
// list of persons which are allowed to modify this wiki:
|
|
29 |
// - when no array named AUTHORS is defined, everybody can write. This is default.
|
|
30 |
// - when an array named AUTHORS is defined but empty, nobody can write
|
|
31 |
//
|
|
32 |
// examples:
|
|
33 |
// $AUTHORS = array('buck','jack'); // only buck and jack bauer can modify the wiki
|
|
34 |
// $AUTHORS = array(); // nobody can edit the wiki, mr. nobody can't also :-)
|
|
35 |
// //$AUTHORS = array(); // everybody can edit the wiki
|
|
36 |
// $FREE4ALL = array('public site'); // in order to enable a page which is editable by everyone,
|
|
37 |
// you can define this array which containing a string with the page title
|
|
38 |
||
119
by Suren A. Chilingaryan
New way of service handling (mod_rewrite), Various fixups, katrin stuff moved to SETUP directory |
39 |
global $ADEI; |
40 |
global $ADEI_SETUP; |
|
41 |
global $ADEI_ROOTDIR; |
|
42 |
global $WIKI_FILENAME; |
|
43 |
global $AJAX_MODE; |
|
44 |
global $REQ; |
|
96
by Suren A. Chilingaryan
WiKi integration |
45 |
|
46 |
||
47 |
function adeiChannels($type, $props) { |
|
48 |
$bygroup = false; |
|
49 |
||
268
by Suren A. Chilingaryan
WiKi: Support channel lists with uids containing [] |
50 |
$translations = array( |
51 |
"[" => "[", |
|
52 |
"]" => "]" |
|
53 |
);
|
|
54 |
||
96
by Suren A. Chilingaryan
WiKi integration |
55 |
switch($type) { |
56 |
case "channels_by_group": |
|
57 |
$bygroup = true; |
|
58 |
break; |
|
59 |
case "channels_by_name": |
|
60 |
$channels = array(); |
|
61 |
break; |
|
62 |
}
|
|
63 |
||
214
by Suren A. Chilingaryan
Support limited group listings in WiKi, vertically align tables to top in WiKi |
64 |
$tmp = preg_split("/&(amp;)?/", $props); |
65 |
$p = array(); |
|
66 |
foreach ($tmp as $pair) { |
|
67 |
$res = explode("=", $pair); |
|
68 |
if (sizeof($res) == 2) $p[$res[0]] = $res[1]; |
|
69 |
}
|
|
70 |
||
96
by Suren A. Chilingaryan
WiKi integration |
71 |
$res = ""; |
72 |
||
73 |
$req = new REQUEST($tmp = array()); |
|
74 |
$sources = $req->GetSources(REQUEST::SKIP_UNCACHED|REQUEST::LIST_ALL); |
|
75 |
foreach ($sources as $sreq) { |
|
76 |
$title = $sreq->GetSourceTitle(); |
|
77 |
||
78 |
$groupinfo = $sreq->GetGroupList(); |
|
79 |
$groups = $sreq->GetGroups(NULL, REQUEST::SKIP_UNCACHED); |
|
214
by Suren A. Chilingaryan
Support limited group listings in WiKi, vertically align tables to top in WiKi |
80 |
|
81 |
if ((isset($p["db_server"]))&&(strcmp($p["db_server"],$sreq->props["db_server"]))) continue; |
|
82 |
if ((isset($p["db_name"]))&&(strcmp($p["db_name"],$sreq->props["db_name"]))) continue; |
|
96
by Suren A. Chilingaryan
WiKi integration |
83 |
|
84 |
foreach ($groups as $gid => $greq) { |
|
214
by Suren A. Chilingaryan
Support limited group listings in WiKi, vertically align tables to top in WiKi |
85 |
if ((isset($p["db_group"]))&&(strcmp($p["db_group"],$gid))) continue; |
86 |
||
96
by Suren A. Chilingaryan
WiKi integration |
87 |
$gtitle = $title . " -- " . $groupinfo[$gid]["name"]; |
88 |
$gquery = $greq->GetGroupQueryString($props); |
|
89 |
||
90 |
$masklist = $greq->GetMaskList(REQUEST::NEED_INFO); |
|
91 |
$defaultmask = array_shift($masklist); |
|
92 |
$defaultmask = $defaultmask['mask']; |
|
93 |
unset($masklist); |
|
94 |
||
95 |
$glink = $gquery . "&db_mask=$defaultmask"; |
|
96 |
||
97 |
$list = $greq->GetItemList(); |
|
98 |
if ($bygroup) { |
|
99 |
$first = true; |
|
100 |
||
101 |
foreach ($list as &$item) { |
|
102 |
if (isset($item["uid"])) { |
|
103 |
if ($first) { |
|
104 |
$first = false; |
|
136
by Suren A. Chilingaryan
Wiki Enhancements |
105 |
$res .= "!!$gtitle ([link($glink)]" . _("View") . "[/link])[br]\n"; |
96
by Suren A. Chilingaryan
WiKi integration |
106 |
}
|
107 |
$link = $gquery . "&db_mask=" . $item['id']; |
|
108 |
||
268
by Suren A. Chilingaryan
WiKi: Support channel lists with uids containing [] |
109 |
$uid = strtr(htmlentities($item['uid']), $translations); |
110 |
$res .= "[link($link)]{$uid}[/link] - " . xml_escape($item['name']) ."[br]\n"; |
|
96
by Suren A. Chilingaryan
WiKi integration |
111 |
}
|
112 |
}
|
|
113 |
||
136
by Suren A. Chilingaryan
Wiki Enhancements |
114 |
if (!$first) $res .= "[br][br]\n"; |
96
by Suren A. Chilingaryan
WiKi integration |
115 |
} else { |
116 |
foreach ($list as &$item) { |
|
117 |
if (isset($item["uid"])) { |
|
118 |
$link = $gquery . "&db_mask=" . $item['id']; |
|
268
by Suren A. Chilingaryan
WiKi: Support channel lists with uids containing [] |
119 |
$uid = strtr(htmlentities($item['uid']), $translations); |
96
by Suren A. Chilingaryan
WiKi integration |
120 |
array_push($channels, array( |
268
by Suren A. Chilingaryan
WiKi: Support channel lists with uids containing [] |
121 |
'uid' => $uid, |
96
by Suren A. Chilingaryan
WiKi integration |
122 |
'link' => $link, |
132
by Suren A. Chilingaryan
XML escaping fix in WiKi, Katrin WiKi by Andreas |
123 |
'name' => xml_escape($item["name"]), |
96
by Suren A. Chilingaryan
WiKi integration |
124 |
'glink' => $glink, |
132
by Suren A. Chilingaryan
XML escaping fix in WiKi, Katrin WiKi by Andreas |
125 |
'gname' => xml_escape($gtitle) |
96
by Suren A. Chilingaryan
WiKi integration |
126 |
));
|
127 |
}
|
|
128 |
}
|
|
129 |
}
|
|
130 |
}
|
|
131 |
}
|
|
132 |
||
133 |
switch($type) { |
|
134 |
case "channels_by_name": |
|
135 |
usort($channels, create_function('$a, $b', ' |
|
136 |
return strcmp($a["uid"], $b["uid"]);
|
|
137 |
')); |
|
145
by Suren A. Chilingaryan
Several fixes: Axes range loading, few bugs related to support dates prior to Jan 1, 1970 |
138 |
|
139 |
$res .= "{| border=\"1px\"\n"; |
|
140 |
$res .= "UID || Group || Description\n|-\n"; |
|
141 |
foreach ($channels as &$item) { |
|
245
by Suren A. Chilingaryan
Remove extra parenthesis in WiKi channel list |
142 |
$res .= "[link({$item['link']})]{$item['uid']}[/link] || [link({$item['glink']})]{$item['gname']}[/link] || {$item['name']}\n|-\n"; |
145
by Suren A. Chilingaryan
Several fixes: Axes range loading, few bugs related to support dates prior to Jan 1, 1970 |
143 |
}
|
144 |
$res .= "|}\n"; |
|
145 |
||
146 |
/*
|
|
96
by Suren A. Chilingaryan
WiKi integration |
147 |
foreach ($channels as &$item) {
|
136
by Suren A. Chilingaryan
Wiki Enhancements |
148 |
$res .= "[link({$item['link']})]{$item['uid']}[/link] (Group: [link({$item['glink']})]{$item['gname']}[/link]) - {$item['name']}[br]\n";
|
96
by Suren A. Chilingaryan
WiKi integration |
149 |
}
|
145
by Suren A. Chilingaryan
Several fixes: Axes range loading, few bugs related to support dates prior to Jan 1, 1970 |
150 |
*/
|
96
by Suren A. Chilingaryan
WiKi integration |
151 |
break; |
152 |
}
|
|
153 |
||
154 |
return $res; |
|
155 |
}
|
|
156 |
||
157 |
function adeiGroupList($props) { |
|
214
by Suren A. Chilingaryan
Support limited group listings in WiKi, vertically align tables to top in WiKi |
158 |
$tmp = preg_split("/&(amp;)?/", $props); |
159 |
$p = array(); |
|
160 |
foreach ($tmp as $pair) { |
|
161 |
$res = explode("=", $pair); |
|
162 |
if (sizeof($res) == 2) $p[$res[0]] = $res[1]; |
|
163 |
}
|
|
164 |
||
96
by Suren A. Chilingaryan
WiKi integration |
165 |
$res = ""; |
166 |
||
167 |
$req = new REQUEST($tmp = array()); |
|
168 |
$sources = $req->GetSources(REQUEST::SKIP_UNCACHED|REQUEST::LIST_ALL); |
|
169 |
foreach ($sources as $sreq) { |
|
214
by Suren A. Chilingaryan
Support limited group listings in WiKi, vertically align tables to top in WiKi |
170 |
if ((isset($p["db_server"]))&&(strcmp($p["db_server"],$sreq->props["db_server"]))) continue; |
171 |
if ((isset($p["db_name"]))&&(strcmp($p["db_name"],$sreq->props["db_name"]))) continue; |
|
172 |
||
96
by Suren A. Chilingaryan
WiKi integration |
173 |
$title = $sreq->GetSourceTitle(); |
174 |
||
175 |
$groupinfo = $sreq->GetGroupList(); |
|
176 |
$groups = $sreq->GetGroups(NULL, REQUEST::SKIP_UNCACHED); |
|
177 |
foreach ($groups as $gid=>$greq) { |
|
214
by Suren A. Chilingaryan
Support limited group listings in WiKi, vertically align tables to top in WiKi |
178 |
if ((isset($p["db_group"]))&&(strcmp($p["db_group"],$gid))) continue; |
179 |
||
136
by Suren A. Chilingaryan
Wiki Enhancements |
180 |
$res .= "!!" . xml_escape($title . " -- " . $groupinfo[$gid]["name"]) . "[br]\n"; |
96
by Suren A. Chilingaryan
WiKi integration |
181 |
$res .= "[preview(" . |
182 |
$greq->GetGroupQueryString($props) . |
|
183 |
"), link]"; |
|
136
by Suren A. Chilingaryan
Wiki Enhancements |
184 |
$res .= "[br][br][br]\n"; |
96
by Suren A. Chilingaryan
WiKi integration |
185 |
}
|
186 |
}
|
|
187 |
||
188 |
return $res; |
|
189 |
}
|
|
190 |
||
191 |
||
192 |
class ErrorHandler { |
|
193 |
public static function reportError($error) { |
|
136
by Suren A. Chilingaryan
Wiki Enhancements |
194 |
print '<b>Error:</b> '.$error.'<br/>'; |
96
by Suren A. Chilingaryan
WiKi integration |
195 |
}
|
196 |
}
|
|
197 |
||
198 |
class CodeInterpreter { |
|
199 |
private static $instance; |
|
200 |
private $wiki; |
|
201 |
||
202 |
private function __construct($wiki) { |
|
203 |
$this->wiki = $wiki; |
|
204 |
}
|
|
205 |
||
206 |
public static function getInstance($wiki) { |
|
207 |
if(!isset($instance) || $instance == null) { |
|
208 |
$instance = new CodeInterpreter($wiki); |
|
209 |
}
|
|
210 |
return($instance); |
|
211 |
}
|
|
212 |
||
213 |
public function parseCode($string) { |
|
214 |
$string = $this->compileVersion($string); |
|
215 |
$string = $this->compileChannelList($string); |
|
216 |
$string = $this->compileGroupList($string); |
|
217 |
$string = $this->compilePreview($string); |
|
218 |
$string = $this->resolveAdeiLink($string); |
|
219 |
$string = $this->resolveInternalLink($string); |
|
220 |
$string = $this->compileImage($string); |
|
221 |
$string = $this->compileExternalLink($string); |
|
222 |
$string = $this->compileExternalCustomLink($string); |
|
223 |
$string = $this->compileMailTo($string); |
|
224 |
$string = $this->compileBoldText($string); |
|
225 |
$string = $this->compileItalicText($string); |
|
226 |
$string = $this->compileUnderlineText($string); |
|
227 |
$string = $this->compileHeader($string); |
|
213
by Suren A. Chilingaryan
Update to 0.0.6 |
228 |
$string = $this->compileEnumeration($string); |
136
by Suren A. Chilingaryan
Wiki Enhancements |
229 |
$string = $this->compileTable($string); |
230 |
$string = $this->compileNewLine($string); |
|
369
by Artur Reymers
Fix: Correct representation of the tags |
231 |
$string = $this->compileSuperscriptText($string); |
232 |
$string = $this->compileF2Text($string); |
|
136
by Suren A. Chilingaryan
Wiki Enhancements |
233 |
return($string); |
234 |
}
|
|
235 |
||
236 |
private function compileTable($string) { |
|
237 |
$string = preg_replace( |
|
238 |
array( |
|
141
by Suren A. Chilingaryan
Further WiKi improvements (page inclusion) |
239 |
"/^[ \t]*\{\|([^\r\n]*)/m", |
240 |
"/^[ \t]*\|\}/m", |
|
241 |
"/^[ \t]*\|-/m", |
|
136
by Suren A. Chilingaryan
Wiki Enhancements |
242 |
"/\|\|/m"
|
243 |
), array( |
|
214
by Suren A. Chilingaryan
Support limited group listings in WiKi, vertically align tables to top in WiKi |
244 |
'<table\\1><tr><td valign="top">', |
136
by Suren A. Chilingaryan
Wiki Enhancements |
245 |
'</td></tr></table>', |
214
by Suren A. Chilingaryan
Support limited group listings in WiKi, vertically align tables to top in WiKi |
246 |
'</td></tr><tr><td valign="top">', |
247 |
'</td><td valign="top">'
|
|
136
by Suren A. Chilingaryan
Wiki Enhancements |
248 |
), $string); |
430
by Suren A. Chilingaryan
Support table properties in wiki |
249 |
|
250 |
while (preg_match("/<table[^>]*"/", $string)) { |
|
251 |
$string = preg_replace("/<table([^>]*)"/", '<table\\1"', $string); |
|
252 |
}
|
|
253 |
||
136
by Suren A. Chilingaryan
Wiki Enhancements |
254 |
return($string); |
255 |
}
|
|
256 |
||
257 |
private function compileNewLine($string) { |
|
141
by Suren A. Chilingaryan
Further WiKi improvements (page inclusion) |
258 |
$string = preg_replace("/^[ \t]*\r?\n?$/m","<br/>",$string); |
213
by Suren A. Chilingaryan
Update to 0.0.6 |
259 |
$string = preg_replace("/\[(br|hr)\]/i","<\\1/>",$string); |
96
by Suren A. Chilingaryan
WiKi integration |
260 |
return($string); |
261 |
}
|
|
262 |
||
263 |
private function compileVersion($string) { |
|
264 |
return preg_replace_callback( |
|
265 |
"/\[\s*version\s*\]/", |
|
266 |
create_function('$matches', ' |
|
267 |
if (file_exists("VERSION")) {
|
|
268 |
$stat = stat("VERSION");
|
|
269 |
$date = date("r", $stat["mtime"]);
|
|
270 |
|
|
271 |
$version = file_get_contents("VERSION");
|
|
272 |
if (preg_match("/^\s*([\d.]+)/", $version, $m)) $version = $m[1];
|
|
273 |
|
|
274 |
return "Version: $version from $date";
|
|
275 |
} else {
|
|
276 |
return "";
|
|
277 |
}
|
|
278 |
'), |
|
279 |
$string
|
|
280 |
);
|
|
281 |
||
282 |
}
|
|
283 |
||
284 |
private function compileChannelList($string) { |
|
285 |
return preg_replace_callback( |
|
286 |
"/\[\s*(channels_by_group|channels_by_name)\s*(\(([^\)\]]+)\))?\s*\]/", |
|
287 |
create_function('$matches', ' |
|
288 |
return adeiChannels($matches[1], $matches[3]);
|
|
289 |
'), |
|
290 |
$string
|
|
291 |
);
|
|
292 |
}
|
|
293 |
||
294 |
private function compileGroupList($string) { |
|
295 |
return preg_replace_callback( |
|
296 |
"/\[\s*grouplist\s*(\(([^\)\]]+)\))?\s*\]/", |
|
297 |
create_function('$matches', ' |
|
298 |
global $AJAX_MODE;
|
|
299 |
||
300 |
if (1||$AJAX_MODE) return adeiGroupList($matches[2]);
|
|
136
by Suren A. Chilingaryan
Wiki Enhancements |
301 |
else return "[b] --- Group list would be displayed here --- [/b][br]\n";
|
96
by Suren A. Chilingaryan
WiKi integration |
302 |
'), |
303 |
$string
|
|
304 |
);
|
|
305 |
}
|
|
306 |
||
307 |
private function compilePreview($string) { |
|
308 |
return preg_replace_callback( |
|
309 |
"/\[\s*preview\s*\(([^\)\]]+)\)(\s*,\s*link\s*(\(([^\]\)]+)\))?)?\s*\]/", |
|
310 |
create_function('$matches', ' |
|
311 |
global $REQ;
|
|
312 |
global $AJAX_MODE;
|
|
313 |
/* We can get here in problems due to overriding masks, etc. */
|
|
314 |
$zreq = new REQUEST($props = array());
|
|
315 |
//$zreq = $REQ; // enable to get some props from
|
|
316 |
|
|
317 |
$img = "[img]services/getimage.php?" . $zreq->GetQueryString($matches[1], array(
|
|
318 |
"precision" => "LOW",
|
|
319 |
"hide_axes" => 1
|
|
320 |
)) . "[/img]";
|
|
321 |
if (($AJAX_MODE)&&($matches[2])) {
|
|
322 |
if ($matches[4]) {
|
|
323 |
$query = $zreq->GetQueryString($matches[4], array(
|
|
324 |
"module" => "graph"
|
|
325 |
));
|
|
326 |
} else {
|
|
327 |
$query = $zreq->GetQueryString($matches[1], array(
|
|
328 |
"module" => "graph"
|
|
329 |
));
|
|
330 |
}
|
|
331 |
$query = preg_replace("/&/", "&", $query);
|
|
332 |
$img = preg_replace("/&/", "&", $img);
|
|
333 |
return \'[url="javascript:wiki.SetConfiguration(\\\'\' . $query . \'\\\')"]\' . $img . \'[/url]\';
|
|
334 |
} else {
|
|
335 |
return $img;
|
|
336 |
}
|
|
337 |
'), |
|
338 |
$string
|
|
339 |
);
|
|
340 |
}
|
|
341 |
||
342 |
private function resolveAdeiLink($string) { |
|
343 |
return preg_replace_callback( |
|
344 |
"/\[\s*link\s*=?\s*(\(|\")([^\]]+)(\)|\")\s*\]([^\[]+)\[\s*\/link\s*\]/", |
|
345 |
create_function('$matches', ' |
|
346 |
global $AJAX_MODE;
|
|
347 |
global $ADEI_SETUP;
|
|
348 |
||
349 |
$req = new REQUEST($props = array());
|
|
350 |
$query = $req->GetQueryString($matches[2], array(
|
|
351 |
"module" => "graph"
|
|
352 |
));
|
|
353 |
$query = preg_replace("/&/", "&", $query);
|
|
354 |
if ($AJAX_MODE) {
|
|
355 |
return \'[url="javascript:wiki.SetConfiguration(\\\'\' . $query . \'\\\')"]\' . $matches[4] . \'[/url]\';
|
|
356 |
} else {
|
|
357 |
return \'[url="index.php?setup=\' . $ADEI_SETUP . \'#\' . $query . \'"]\' . $matches[4] . \'[/url]\';
|
|
358 |
}
|
|
359 |
'), |
|
360 |
$string
|
|
361 |
);
|
|
362 |
}
|
|
363 |
||
364 |
private function resolveInternalLink($string) { |
|
365 |
global $AJAX_MODE; |
|
165
by Suren A. Chilingaryan
Respect ADEI setup in WiKi editor |
366 |
global $ADEI_SETUP; |
96
by Suren A. Chilingaryan
WiKi integration |
367 |
|
369
by Artur Reymers
Fix: Correct representation of the tags |
368 |
preg_match_all('/\[\[[\w\s\d\_\-\|\']*\]\]/', $string, $hits); |
96
by Suren A. Chilingaryan
WiKi integration |
369 |
foreach($hits[0] as $hit) { |
370 |
$title = preg_replace('/\[\[/', '', $hit); |
|
371 |
$title = preg_replace('/\]\]/', '', $title); |
|
369
by Artur Reymers
Fix: Correct representation of the tags |
372 |
list($article, $display_text) = explode('|', $title); |
373 |
$display_text = (empty($display_text)) ? $article : $display_text; |
|
374 |
if($this->wiki->getPage($article)->getContent() == '...') { $class = 'newpagelink';} |
|
96
by Suren A. Chilingaryan
WiKi integration |
375 |
else {$class = 'link';} |
369
by Artur Reymers
Fix: Correct representation of the tags |
376 |
$title = preg_replace('/\|/', '\|', $title); |
377 |
if ($AJAX_MODE) { |
|
378 |
$string = preg_replace("/\[\[$title\]\]/", |
|
379 |
'<a class="'.$class.'" href="javascript:wiki.SetID('.$this->wiki->getPage($article)->getId().')">'.$display_text.'</a>',$string); |
|
96
by Suren A. Chilingaryan
WiKi integration |
380 |
} else { |
381 |
$string = preg_replace("/\[\[$title\]\]/", |
|
371
by Suren A. Chilingaryan
Adapt new WiKi syntax and provide demos on help page |
382 |
'<a class="'.$class.'" href="?setup='.$ADEI_SETUP.'&pageid='.$this->wiki->getPage($article)->getId().'">'.$display_text.'</a>',$string); |
96
by Suren A. Chilingaryan
WiKi integration |
383 |
}
|
384 |
}
|
|
385 |
return($string); |
|
386 |
}
|
|
387 |
||
388 |
private function compileExternalLink($string) { |
|
213
by Suren A. Chilingaryan
Update to 0.0.6 |
389 |
$string=preg_replace("|\[url\](javascript:[^\[]+)\[/url\]|i", |
96
by Suren A. Chilingaryan
WiKi integration |
390 |
"<a class=\"external\" href=\"\\1\">\\1</a>",$string); |
391 |
||
213
by Suren A. Chilingaryan
Update to 0.0.6 |
392 |
$string=preg_replace("|\[url\]([^\[]+)\[/url\]|i", |
96
by Suren A. Chilingaryan
WiKi integration |
393 |
"<a class=\"external\" href=\"\\1\" target=\"_blank\">\\1</a>",$string); |
394 |
return($string); |
|
395 |
}
|
|
396 |
||
397 |
private function compileExternalCustomLink($string) { |
|
321
by Suren A. Chilingaryan
Fix rendering external links in WiKi |
398 |
$string=preg_replace('/\[url=\"/i','[url="',$string); |
399 |
$string=preg_replace('/\"\]/i','"]',$string); |
|
96
by Suren A. Chilingaryan
WiKi integration |
400 |
|
213
by Suren A. Chilingaryan
Update to 0.0.6 |
401 |
$string=preg_replace('|\[url="(javascript:[^\"]+)"]([^\[]+)\[/url\]|i', |
96
by Suren A. Chilingaryan
WiKi integration |
402 |
"<a class=\"external\" href=\"\\1\">\\2</a>",$string); |
213
by Suren A. Chilingaryan
Update to 0.0.6 |
403 |
$string=preg_replace('|\[url="([^\"]+)"]([^\[]+)\[/url\]|i', |
96
by Suren A. Chilingaryan
WiKi integration |
404 |
"<a class=\"external\" href=\"\\1\" target=\"_blank\">\\2</a>",$string); |
405 |
return($string); |
|
406 |
}
|
|
407 |
||
408 |
private function compileMailTo($string) { |
|
213
by Suren A. Chilingaryan
Update to 0.0.6 |
409 |
$string = preg_replace("|\[mail\]([^\[]+)\[/mail\]|i","<a href=\"mailto:\\1\">\\1</a>",$string); |
96
by Suren A. Chilingaryan
WiKi integration |
410 |
return($string); |
411 |
}
|
|
412 |
||
413 |
private function compileImage($string) { |
|
213
by Suren A. Chilingaryan
Update to 0.0.6 |
414 |
$string = preg_replace("|\[img\]([^\[]+)\[/img\]|i","<img src=\"\\1\" border=\"0\"/>",$string); |
96
by Suren A. Chilingaryan
WiKi integration |
415 |
return($string); |
416 |
}
|
|
417 |
||
418 |
private function compileBoldText($string) { |
|
213
by Suren A. Chilingaryan
Update to 0.0.6 |
419 |
$string = preg_replace("|\[b\]([^\[]+)\[/b\]|i","<b>\\1</b>",$string); |
96
by Suren A. Chilingaryan
WiKi integration |
420 |
return($string); |
421 |
}
|
|
422 |
||
423 |
private function compileItalicText($string) { |
|
213
by Suren A. Chilingaryan
Update to 0.0.6 |
424 |
$string = preg_replace("|\[i\]([^\[]+)\[/i\]|i","<i>\\1</i>",$string); |
96
by Suren A. Chilingaryan
WiKi integration |
425 |
return($string); |
426 |
}
|
|
427 |
||
428 |
private function compileUnderlineText($string) { |
|
213
by Suren A. Chilingaryan
Update to 0.0.6 |
429 |
$string = preg_replace("|\[u\]([^\[]+)\[/u\]|i","<u>\\1</u>",$string); |
96
by Suren A. Chilingaryan
WiKi integration |
430 |
return($string); |
431 |
}
|
|
432 |
||
433 |
private function compileHeader($string) { |
|
369
by Artur Reymers
Fix: Correct representation of the tags |
434 |
$string = preg_replace('/\!\!([^\ \n].*)[\n]/e', "'\n\n<p class=\"wiki_header2\">'.'$1'.'</p>'", $string); |
435 |
$string = preg_replace('/\!([^\ \n].*)[\n]/e', "'<p class=\"wiki_header\">'.'$1'.'</p>'", $string); |
|
436 |
return($string); |
|
437 |
}
|
|
438 |
||
439 |
private function compileEnumeration($string) { |
|
440 |
$string = preg_replace("/\*([^\n]+)\n/i","<li>\\1</li>", $string); |
|
441 |
$string = preg_replace("/<li>([^\n\n]+)<\/li>/i","<ul>\\0</ul>", $string); |
|
442 |
return($string); |
|
443 |
}
|
|
444 |
||
445 |
private function compileSuperscriptText($string) { |
|
446 |
$string = preg_replace("|\[sup\]([^\[]+)\[/sup\]|i","<sup>\\1</sup>",$string); |
|
447 |
return($string); |
|
448 |
}
|
|
449 |
||
450 |
private function compileF2Text($string) { |
|
371
by Suren A. Chilingaryan
Adapt new WiKi syntax and provide demos on help page |
451 |
$string = preg_replace("|\[f2\]([^\[]+)\[/f2\]|i",'<font size="2">\\1</font>',$string); |
369
by Artur Reymers
Fix: Correct representation of the tags |
452 |
return($string); |
453 |
}
|
|
96
by Suren A. Chilingaryan
WiKi integration |
454 |
}
|
455 |
||
456 |
class Page { |
|
457 |
private $id; |
|
458 |
private $title; |
|
459 |
private $content; |
|
460 |
private $wiki; |
|
461 |
||
462 |
public function __construct($id, $title, $content, $wiki) { |
|
463 |
$this->id = $id; |
|
464 |
$this->title = $title; |
|
465 |
$this->content = $content; |
|
466 |
$this->wiki = $wiki; |
|
467 |
}
|
|
468 |
||
469 |
public function getId() { return($this->id); } |
|
470 |
public function getTitle() { return($this->title); } |
|
471 |
public function getContent() { return($this->content); } |
|
136
by Suren A. Chilingaryan
Wiki Enhancements |
472 |
|
141
by Suren A. Chilingaryan
Further WiKi improvements (page inclusion) |
473 |
public function includeHTMLContent($m) { |
474 |
$page = $this->wiki->getPage($m[1]); |
|
475 |
||
476 |
if ($page) return $page->getHTMLContent(1); |
|
477 |
return ""; |
|
478 |
}
|
|
479 |
||
96
by Suren A. Chilingaryan
WiKi integration |
480 |
public function getHTMLContent() { |
141
by Suren A. Chilingaryan
Further WiKi improvements (page inclusion) |
481 |
$string = CodeInterpreter::getInstance($this->wiki)->parseCode($this->content); |
482 |
// $string = nl2br($string);
|
|
483 |
$string = preg_replace_callback("/\[include\(([^)]+)\)\]/i", array($this, "includeHTMLContent"), $string); |
|
484 |
return $string; |
|
96
by Suren A. Chilingaryan
WiKi integration |
485 |
}
|
213
by Suren A. Chilingaryan
Update to 0.0.6 |
486 |
public function setTitle($title) { $this->title = htmlspecialchars(str_replace("\r\n", "\n", $title)); } |
487 |
public function setContent($content) { $this->content = htmlspecialchars(str_replace("\r\n", "\n", $content)); } |
|
488 |
||
96
by Suren A. Chilingaryan
WiKi integration |
489 |
}
|
490 |
||
491 |
||
492 |
class Wiki { |
|
493 |
private $fileName; |
|
494 |
private $data; |
|
495 |
private $xmlString; |
|
496 |
private $pages = array(); |
|
497 |
||
498 |
public function __construct($fileName) { |
|
499 |
$this->fileName = $fileName; |
|
500 |
$this->readDataFromFile(); |
|
501 |
$this->extractXMLStringFromData(); |
|
502 |
$this->createPagesFromXML(); |
|
503 |
}
|
|
504 |
||
505 |
public function getPage($pageidentifier) { |
|
506 |
if(is_integer($pageidentifier)) { // search with id |
|
507 |
if(!isset($this->pages[$pageidentifier])) { |
|
508 |
// this feature is dangerous, return null
|
|
509 |
//$this->pages[(int) $pageidentifier] = new Page((int)$pageidentifier, 'New Site', '...', $this);
|
|
510 |
//$this->saveWikiToFile();
|
|
511 |
return; |
|
512 |
}
|
|
513 |
return($this->pages[$pageidentifier]); |
|
514 |
} elseif(is_string($pageidentifier)) { //search with title |
|
515 |
foreach($this->pages as $page) { |
|
516 |
if($page->getTitle() == $pageidentifier) { |
|
517 |
return($page); |
|
518 |
}
|
|
519 |
}
|
|
520 |
for($i = 1; true; $i++) { |
|
521 |
if(!array_key_exists($i, $this->pages)) { |
|
522 |
break; |
|
523 |
}
|
|
524 |
}
|
|
525 |
$this->pages[$i] = new Page($i, $pageidentifier, '...', $this); |
|
526 |
$this->saveWikiToFile(); |
|
527 |
return($this->pages[$i]); |
|
528 |
}
|
|
529 |
}
|
|
530 |
||
531 |
public function readDataFromFile() { |
|
532 |
$this->data = ""; |
|
533 |
if((is_file($this->fileName))&&(filesize($this->fileName)>0)) { |
|
534 |
$handle = fopen ($this->fileName, "r"); |
|
535 |
while (!feof($handle)) { |
|
536 |
$this->data .= fgets($handle, 4096); |
|
537 |
}
|
|
538 |
fclose ($handle); |
|
539 |
} else if (is_file($_SERVER['SCRIPT_FILENAME'])) { |
|
540 |
$handle = fopen ($_SERVER['SCRIPT_FILENAME'], "r"); |
|
541 |
while (!feof($handle)) { |
|
542 |
$this->data .= fgets($handle, 4096); |
|
543 |
}
|
|
544 |
fclose ($handle); |
|
545 |
}
|
|
546 |
}
|
|
547 |
||
548 |
public function findXMLStartPosition() { |
|
549 |
$i = 0; |
|
550 |
while($i < strlen($this->data)) { |
|
551 |
$i = strpos ($this->data, '<<' , $i); |
|
552 |
if(substr($this->data, $i+2, 2) == '>>') { |
|
553 |
return($i+4); |
|
554 |
}
|
|
555 |
$i++; |
|
556 |
}
|
|
557 |
}
|
|
558 |
||
559 |
public function findXMLStopPosition() { |
|
560 |
$i = strlen($this->data); |
|
561 |
while($i >= 0) { |
|
562 |
$schrumpf = substr($this->data, 0, $i); |
|
563 |
if(substr($schrumpf, $i-2, 2) == '>>') { |
|
564 |
if(substr($schrumpf, $i-4, 2) == '<<') { |
|
565 |
return($i-4); |
|
566 |
}
|
|
567 |
}
|
|
568 |
$i--; |
|
569 |
}
|
|
570 |
}
|
|
571 |
||
572 |
public function extractXMLStringFromData() { |
|
573 |
$this->xmlString = substr($this->data, $this->findXMLStartPosition(), |
|
574 |
$this->findXMLStopPosition() - $this->findXMLStartPosition()); |
|
575 |
}
|
|
576 |
||
577 |
public function extractXMLStringFromMemory() { |
|
578 |
$xmlstr = '<!--<<'; |
|
579 |
$xmlstr .= ">>"; |
|
580 |
$xmlstr .= "<pages>\n"; |
|
581 |
foreach($this->pages as $page) { |
|
582 |
$xmlstr .= '<page id="'.$page->getId().'" title="'.htmlspecialchars($page->getTitle()).'">' |
|
583 |
. htmlspecialchars($page->getContent())."</page>\n"; |
|
584 |
}
|
|
585 |
$xmlstr .= "</pages>\n"; |
|
586 |
$xmlstr .= '<<'; |
|
587 |
$xmlstr .= '>>-->'; |
|
588 |
return($xmlstr); |
|
589 |
}
|
|
590 |
||
591 |
public function createPagesFromXML() { |
|
592 |
$xml = new SimpleXMLElement($this->xmlString); |
|
593 |
foreach($xml->page as $page) { |
|
594 |
$this->pages[(int)$page['id']] = new Page($page['id'], $page['title'], $page, $this); |
|
595 |
}
|
|
596 |
}
|
|
597 |
||
598 |
public function saveWikiToFile() { |
|
599 |
global $ADEI_SETUP; |
|
600 |
global $ADEI_ROOTDIR; |
|
601 |
global $WIKI_FILENAME; |
|
602 |
||
603 |
$stringToWrite =/* substr($this->data,0, |
|
604 |
$this->findXMLStartPosition()-8) .*/ $this->extractXMLStringFromMemory(); |
|
605 |
if (is_writable($WIKI_FILENAME)) { |
|
606 |
$handle = fopen($WIKI_FILENAME, "w+"); |
|
607 |
if ($handle) { |
|
608 |
fwrite($handle, $stringToWrite); |
|
609 |
fclose($handle); |
|
610 |
} else {ErrorHandler::reportError($WIKI_FILENAME.' not writable');} |
|
611 |
} else {ErrorHandler::reportError($WIKI_FILENAME.' not writable');} |
|
612 |
if (is_writable($ADEI_ROOTDIR . '/tmp/')) { |
|
613 |
if (!is_dir($ADEI_ROOTDIR . '/tmp/wiki')) { |
|
614 |
@mkdir($ADEI_ROOTDIR . '/tmp/wiki'); |
|
615 |
}
|
|
616 |
if (is_dir($ADEI_ROOTDIR . '/tmp/wiki')) { |
|
617 |
$handle = fopen($ADEI_ROOTDIR . '/tmp/wiki/'.$ADEI_SETUP.'-'.date('YmdTHis').'.xml', "w+"); |
|
618 |
if ($handle) { |
|
619 |
fwrite($handle, $stringToWrite); |
|
620 |
fclose($handle); |
|
621 |
}
|
|
622 |
}
|
|
623 |
} //else {ErrorHandler::reportError($ADEI_ROOTdIR.'/tmp/wiki'.' not writable');} |
|
624 |
}
|
|
625 |
||
626 |
public function editPage($id, $title, $content) { |
|
627 |
foreach($this->pages as $page) { |
|
628 |
if($page->getTitle() == $title && $page->getId() != $id) { |
|
629 |
ErrorHandler::reportError("this pagetitle is already used by another page!"); |
|
630 |
return; |
|
631 |
}
|
|
632 |
}
|
|
633 |
$this->pages[$id]->setTitle($title); |
|
634 |
$this->pages[$id]->setContent($content); |
|
635 |
$this->saveWikiToFile(); |
|
636 |
}
|
|
637 |
}
|
|
638 |
||
639 |
||
119
by Suren A. Chilingaryan
New way of service handling (mod_rewrite), Various fixups, katrin stuff moved to SETUP directory |
640 |
if (!isset($ADEI_SETUP)) { |
641 |
if (file_exists("adei.php")) require("adei.php"); |
|
642 |
else require("../adei.php"); |
|
643 |
}
|
|
96
by Suren A. Chilingaryan
WiKi integration |
644 |
|
645 |
if (file_exists("$ADEI_ROOTDIR/setups/$ADEI_SETUP/wiki.xml")) { |
|
646 |
$WIKI_FILENAME = "$ADEI_ROOTDIR/setups/$ADEI_SETUP/wiki.xml"; |
|
647 |
} else { |
|
648 |
$WIKI_FILENAME = "$ADEI_ROOTDIR/wiki.xml"; |
|
649 |
}
|
|
650 |
||
651 |
$REQ = new REQUEST($_GET); |
|
652 |
$GET_ID = $REQ->GetProp('pageid', 1); |
|
653 |
||
654 |
$wiki = new Wiki($WIKI_FILENAME); |
|
655 |
if($GET_ID <= 0 || $wiki->getPage((int)$GET_ID) == null) { |
|
656 |
$GET_ID = 1; |
|
657 |
}
|
|
658 |
||
659 |
if (preg_match("/services\\/[^\\\]+.php$/", $_SERVER['SCRIPT_FILENAME'])) { |
|
660 |
$AJAX_MODE = true; |
|
102
by Suren A. Chilingaryan
Various fixes |
661 |
$error = false; |
662 |
||
96
by Suren A. Chilingaryan
WiKi integration |
663 |
header("Content-type: text/xml"); |
102
by Suren A. Chilingaryan
Various fixes |
664 |
|
665 |
$xslt = $REQ->GetProp('xslt'); |
|
666 |
if ($xslt) { |
|
667 |
$temp_file = tempnam(sys_get_temp_dir(), 'adei_wiki.'); |
|
668 |
$out = @fopen($temp_file, "w"); |
|
669 |
if (!$out) $error = translate("I'm not able to create temporary file \"%s\"", $temp_file); |
|
670 |
} else { |
|
671 |
$out = fopen("php://output", "w"); |
|
672 |
}
|
|
673 |
||
674 |
if ($out) { |
|
675 |
fwrite($out, "<?xml version=\"1.0\" encoding=\"utf-8\"?>"); |
|
676 |
fwrite($out, "<div>" . stripslashes($wiki->getPage((int)$GET_ID)->getHTMLContent(1)) . "</div>"); |
|
677 |
fclose($out); |
|
678 |
}
|
|
679 |
||
680 |
if (($xslt)&&(!$error)) { |
|
681 |
try { |
|
682 |
echo $ADEI->TransformXML($xslt, $temp_file); |
|
683 |
} catch (ADEIException $ex) { |
|
684 |
$ex->logInfo(NULL, $reader?$reader:$req); |
|
685 |
$error = $ADEI->EscapeForXML($ex->getInfo()); |
|
686 |
}
|
|
687 |
@unlink($temp_file); |
|
688 |
}
|
|
689 |
||
690 |
if ($error) { |
|
691 |
echo "<div>$error</div>"; |
|
692 |
}
|
|
693 |
||
96
by Suren A. Chilingaryan
WiKi integration |
694 |
exit; |
695 |
} else { |
|
696 |
header("Content-type: text/html"); |
|
697 |
}
|
|
698 |
||
699 |
?>
|
|
700 |
||
701 |
<html>
|
|
702 |
<head>
|
|
703 |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
704 |
<title>Yada Yada Yada Wiki</title>
|
|
705 |
<style type="text/css">
|
|
706 |
||
707 |
body {
|
|
708 |
background-color: #f3f3f3;
|
|
709 |
color: black;
|
|
710 |
font-style: normal;
|
|
711 |
font-size: 12px;
|
|
712 |
line-height: 16px;
|
|
713 |
font-family: sans-serif, arial;
|
|
714 |
margin:0px;
|
|
715 |
}
|
|
716 |
td {
|
|
717 |
color: black;
|
|
718 |
font-style: normal;
|
|
719 |
font-size: 12px;
|
|
720 |
font-family: sans-serif, arial;
|
|
721 |
}
|
|
213
by Suren A. Chilingaryan
Update to 0.0.6 |
722 |
ul {
|
723 |
list-style-type: disc;
|
|
724 |
}
|
|
96
by Suren A. Chilingaryan
WiKi integration |
725 |
.footer {
|
726 |
color: gray;
|
|
727 |
clear:left;
|
|
728 |
margin-top:1em;
|
|
729 |
margin-right:20px;
|
|
730 |
text-align:right;
|
|
731 |
font-size: 12px;
|
|
732 |
}
|
|
733 |
.outertable {
|
|
734 |
background-color: #f3f3f3; border-width: 0px; border-color: #999999; border-style: solid;
|
|
735 |
}
|
|
736 |
.innertable {
|
|
737 |
background-color: white; border-width: 1px; border-color: #9f9f9f; border-style: solid;
|
|
738 |
}
|
|
739 |
.title {
|
|
740 |
border-bottom: 1px; border-color: #999999; border-style: solid;
|
|
741 |
border-top: none; border-left: none; border-right: none;
|
|
742 |
padding-bottom: 5px; font-size: 30px; font-weight:bold;
|
|
743 |
}
|
|
744 |
.edit {
|
|
745 |
padding: 0px; font-size: 30px; font-weight:bold;
|
|
746 |
}
|
|
747 |
.niceformelement {
|
|
748 |
border: 1px solid gray; width:80px;
|
|
749 |
}
|
|
750 |
.shyline {
|
|
751 |
border-bottom: 1px; border-color: #999999; border-style: dotted;
|
|
752 |
border-top: none; border-left: none; border-right: none;
|
|
753 |
}
|
|
754 |
a:link { color: blue; text-decoration:none; }
|
|
755 |
a:visited { color: blue; text-decoration:none;}
|
|
756 |
a:hover { color: blue; text-decoration:none;}
|
|
757 |
a:active { color: blue; text-decoration:none;}
|
|
758 |
a.newpagelink:link { color: red; text-decoration:none; }
|
|
759 |
a.newpagelink:visited { color: red; text-decoration:none;}
|
|
760 |
a.newpagelink:hover { color: red; text-decoration:none;}
|
|
761 |
a.newpagelink:active { color: red; text-decoration:none;}
|
|
762 |
a.external:link { color: blue; text-decoration:underline; }
|
|
763 |
a.external:visited { color: blue; text-decoration:underline;}
|
|
764 |
a.external:hover { color: blue; text-decoration:underline;}
|
|
765 |
a.external:active { color: blue; text-decoration:underline;}
|
|
213
by Suren A. Chilingaryan
Update to 0.0.6 |
766 |
.wiki_header{/*font-size: 18px;*/ font-weight:bold; margin-bottom: 18px; margin-top: 0px;}
|
767 |
.wiki_header2{/*font-size: 12px;*/ font-weight:bold; margin-bottom: 12px; margin-top: 0px;}
|
|
96
by Suren A. Chilingaryan
WiKi integration |
768 |
|
769 |
</style>
|
|
770 |
</head>
|
|
771 |
<body>
|
|
213
by Suren A. Chilingaryan
Update to 0.0.6 |
772 |
<?php
|
96
by Suren A. Chilingaryan
WiKi integration |
773 |
/*foreach($_GET as $key => $value) {
|
136
by Suren A. Chilingaryan
Wiki Enhancements |
774 |
print "GET: $key => $value <br/>";
|
96
by Suren A. Chilingaryan
WiKi integration |
775 |
}
|
776 |
foreach($_POST as $key => $value) {
|
|
136
by Suren A. Chilingaryan
Wiki Enhancements |
777 |
print "POST: $key => $value <br/>";
|
96
by Suren A. Chilingaryan
WiKi integration |
778 |
}*/
|
779 |
||
780 |
if($_POST['edit'] == 'true') { |
|
781 |
$wiki->editPage($_POST['id'], $_POST['title'], $_POST['content']); |
|
782 |
}
|
|
783 |
if($_POST['editmenu'] == 'true') { |
|
784 |
$wiki->editPage(0, $_POST['title'], $_POST['content']); |
|
785 |
}
|
|
786 |
?>
|
|
787 |
||
788 |
<table width="100%" class="outertable" cellspacing="20px" cellpadding="0px">
|
|
789 |
<tr>
|
|
790 |
<td class="title" colspan="2">
|
|
371
by Suren A. Chilingaryan
Adapt new WiKi syntax and provide demos on help page |
791 |
<?php print $wiki->getPage((int)$GET_ID)->getTitle();?> |
96
by Suren A. Chilingaryan
WiKi integration |
792 |
</td>
|
793 |
</tr>
|
|
794 |
<tr>
|
|
795 |
<td valign="top" width="150px">
|
|
796 |
<table width="100%" class="innertable" cellspacing="0px" cellpadding="10px">
|
|
797 |
<tr>
|
|
798 |
<td>
|
|
371
by Suren A. Chilingaryan
Adapt new WiKi syntax and provide demos on help page |
799 |
<?php |
96
by Suren A. Chilingaryan
WiKi integration |
800 |
if($_POST['modifymenu'] == 'true') { |
801 |
print '<form method="post">'; |
|
136
by Suren A. Chilingaryan
Wiki Enhancements |
802 |
print '<input type="hidden" name="editmenu" value="true" />'; |
803 |
print '<input type="hidden" name="modifymenu" value="false" />'; |
|
804 |
print '<input type="hidden" name="id" value="'.$wiki->getPage(0)->getId().'" />'; |
|
805 |
print '<textarea class="text" cols="18" rows="10" name="content" WRAP="PHYSICAL" />'; |
|
96
by Suren A. Chilingaryan
WiKi integration |
806 |
print stripslashes($wiki->getPage(0)->getContent()); |
807 |
print '</textarea>'; |
|
136
by Suren A. Chilingaryan
Wiki Enhancements |
808 |
print "<br/>"; |
809 |
print '<input type="submit" value="save" class="niceformelement" />'; |
|
96
by Suren A. Chilingaryan
WiKi integration |
810 |
print "</form>"; |
811 |
} else { |
|
812 |
print stripslashes($wiki->getPage(0)->getHTMLContent()); |
|
813 |
if(((isset($AUTHORS) && in_array(getenv('REMOTE_USER'), $AUTHORS) || !isset($AUTHORS))) |
|
814 |
|| (isset($FREE4ALL) && in_array($wiki->getPage((int)$GET_ID)->getTitle(),$FREE4ALL))) |
|
815 |
{
|
|
816 |
print '<form style="text-align:left" method="post">'; |
|
817 |
print '<p class="shyline"></p>'; |
|
818 |
print '<input type="hidden" name="modifymenu" value="true"/>'; |
|
819 |
print '<input type="submit" value="edit" class="niceformelement"/>'; |
|
820 |
print '</form>'; |
|
821 |
}
|
|
822 |
}
|
|
823 |
?>
|
|
824 |
</td>
|
|
825 |
</tr>
|
|
826 |
</table>
|
|
827 |
</td>
|
|
828 |
<td colspan="1" valign="top">
|
|
829 |
<table width="100%" class="innertable" cellspacing="0px" cellpadding="10px">
|
|
830 |
<tr>
|
|
831 |
<td>
|
|
371
by Suren A. Chilingaryan
Adapt new WiKi syntax and provide demos on help page |
832 |
<?php |
96
by Suren A. Chilingaryan
WiKi integration |
833 |
if($_POST['modify'] == 'true') { |
834 |
print '<form method="post">'; |
|
136
by Suren A. Chilingaryan
Wiki Enhancements |
835 |
print '<input type="hidden" name="edit" value="true"/>'; |
836 |
print '<input type="hidden" name="modify" value="false"/>'; |
|
837 |
print '<input type="hidden" name="id" value="'.$wiki->getPage((int)$GET_ID)->getId().'"/>'; |
|
838 |
print '<input type="text" name="title" value="'.$wiki->getPage((int)$GET_ID)->getTitle().'"/>'; |
|
839 |
print "<br/>"; |
|
96
by Suren A. Chilingaryan
WiKi integration |
840 |
print '<textarea class="text" cols="100" rows="15" name="content" WRAP="PHYSICAL">'; |
841 |
print stripslashes($wiki->getPage((int)$GET_ID)->getContent()); |
|
842 |
print '</textarea>'; |
|
136
by Suren A. Chilingaryan
Wiki Enhancements |
843 |
print "<br/>"; |
844 |
print '<input type="submit" value="save" class="niceformelement"/>'; |
|
96
by Suren A. Chilingaryan
WiKi integration |
845 |
print "</form>"; |
846 |
} else { |
|
847 |
print stripslashes($wiki->getPage((int)$GET_ID)->getHTMLContent()); |
|
848 |
if((isset($AUTHORS) && in_array(getenv('REMOTE_USER'), $AUTHORS) || !isset($AUTHORS))) { |
|
849 |
print '<form style="text-align:left;" method="post">'; |
|
850 |
print '<p class="shyline"></p>'; |
|
851 |
print '<input type="hidden" name="modify" value="true"/>'; |
|
852 |
print '<input type="submit" value="edit" class="niceformelement"/>'; |
|
853 |
print '</form>'; |
|
854 |
}
|
|
855 |
}
|
|
856 |
?>
|
|
857 |
</td>
|
|
858 |
</tr>
|
|
859 |
</table>
|
|
860 |
</td>
|
|
861 |
</tr>
|
|
862 |
</table>
|
|
863 |
<div class="footer">
|
|
371
by Suren A. Chilingaryan
Adapt new WiKi syntax and provide demos on help page |
864 |
<!--<a href="<?php print basename($WIKI_FILENAME).'s'?>">Yada Yada Yada Wiki</a> --> |
213
by Suren A. Chilingaryan
Update to 0.0.6 |
865 |
<a href="http://www.pburkhalter.net/yadawiki.php">Yada Yada Yada Wiki 0.0.6</a>
|
96
by Suren A. Chilingaryan
WiKi integration |
866 |
</div>
|
867 |
</body>
|
|
868 |
</html>
|
|
869 |
||
870 |
<!--<<>><pages>
|
|
871 |
<page id="0" title="">[[Help]]
|
|
872 |
</page>
|
|
873 |
<page id="2" title="Help">!This is a Header
|
|
874 |
!!Images
|
|
875 |
[img]http://www.rosalux.de/cms/uploads/pics/gnu.png[/img]
|
|
876 |
||
877 |
!!Links
|
|
878 |
An internal link to this Wiki: [[New Page]]
|
|
879 |
(a red link means site is empty, but created)
|
|
880 |
||
881 |
An internal link to this Wiki: [[Help]]
|
|
882 |
(a blue link means site is not empty and created)
|
|
883 |
||
884 |
An external link [url]http://www.pburkhalter.net[/url]
|
|
885 |
A [url=\&quot;http://www.pburkhalter.net\&quot;]external[/url] link to the same destination
|
|
886 |
An [url=\&quot;http://www.pburkhalter.net\&quot;][img]http://www.pburkhalter.net/images/external_image_link.png[/img][/url] to the same destination
|
|
887 |
||
888 |
!!Formating
|
|
889 |
[b]Bold[/b]
|
|
890 |
[i]Italic[/i]
|
|
891 |
[u]Underlined[/u]
|
|
213
by Suren A. Chilingaryan
Update to 0.0.6 |
892 |
|
893 |
!!Enumeration
|
|
894 |
* banana
|
|
895 |
* apple
|
|
896 |
* kiwi
|
|
897 |
||
96
by Suren A. Chilingaryan
WiKi integration |
898 |
</page>
|
899 |
</pages>
|
|
900 |
<<>>-->
|