Revision [16823]

This is an old revision of TimoK made by QgsVq8 on 2007-05-31 10:51:37.


Who is Timo K?

Full Name: Timo Kissing
Born: 1978
Living near Stuttgart, Germany
Studying 'Medieninformatik' (Media Computer Science)
Author and maintainer of several websites, you can find an overview and more information about me at

I enjoy PHP-Coding a lot, so participating on Wikka is 'the natural thing' to do.
I am thinking about a german translation of Wikka, but that won't happen to soon.

Wikka Contributions

Working already

Bingo card generating
See BingoActionInfo
discordian date action

In beta-stadium

Code-Cleanup of handlers/page/edit.php
For some other stuff I work on I had to understand the edit handler, so I can modifiy it. I found the code quite hard to read, so i re-structured it, added some more comments and tweaked the logic a bit.
I only have this running on a test installation, but I found no problems yet and will soon use it on a real wikka. If anyone would be willing the take a look at the code or test it somewhere, I am always happy about comments.
<div class="page">
if ($result = mysql_query("describe ".$this->config['table_prefix']."pages tag")) {
$field = mysql_fetch_assoc($result);
if (preg_match("/varchar\((\d )\)/", $field['Type'], $matches)) {
$maxtaglen = $matches[1];
} else {
$maxtaglen = 75;

if (!$previous = $_POST['previous']) {
$previous = $this->page['id'];

strip CRLF line endings down to LF to achieve consistency
... plus it saves database space.
Note: these codes must remain enclosed in double-quotes to work! -- JsnX
$body = str_replace("\r\n", "\n", $_POST['body']);
if (!$body) $body = $this->page['body'];

replace each 4 spaces at beginning of a line with a tab
$body = preg_replace("/^[ ]{4}/","\t", $body);
UNTESTED possible optimization of the next 2 replacements:
preg_replace("/^(( {4}) )/me","str_repeat('\t',strlen('\\1')/4)",$body)
$body = preg_replace("/\n[ ]{4}/","\n\t", $body);
while (preg_match("/\t[ ]{4}/",$body)) {
$body = preg_replace("/\t[ ]{4}/","\t\t", $body);

we don't need to escape here, we do that just before display
(i.e., treat note just like body!)
$note = trim($_POST['note']);


check for valid pagename (only for new pages!)
if (!$this->page
There are 7 comments on this page. [Show comments]
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki