|
|
Contents
- 1 plugin/sidebar.php
- 2 thema/ddt/header.php
- 3 thema/ddt/footer.php
- 4 Comment.php
ろ殊 譬 覦. 佔誤螻 一伎 .. 蠍磯蓋朱 る.
1 plugin/sidebar.php #
<?php // Copyright 2003 by Won-Kyu Park <wkpark at kldp.org> // All rights reserved. Distributable under GPL see COPYING // a print action plugin for the MoniWiki // // $Id: print.php,v 1.4 2004/10/02 02:44:36 wkpark Exp $
function macro_sidebar() { global $DBInfo; $filename="./data/text/SideBar"; $fp=@fopen($filename,"r"); if (!$fp) { if (file_exists($filename)) { $out="You have no permission to see this page.\n\n"; $out.="See MoniWiki/AccessControl\n"; return $out; } $out=_("File does not exists"); return $out; } $fsize=filesize($filename); if ($fsize > 0) $body=fread($fp,$fsize); fclose($fp); return $body; }
// vim:et:sts=2: ?>
2 thema/ddt/header.php #
<?php # $title, $logo # $menu, $icon, $upper_icon, $rss_icon, $user_link # $themeurl # $msg # $this->trail /*<?php echo $menu ?>|*/ /*<?php echo $rss_icon?>*/ include_once("plugin/sidebar.php"); $sidebar=macro_sidebar();
?>
<!--<div id='wikiHeader'>--> <font color=white> <table border='0' width='100%' cellpadding='0' cellspacing='0' bgcolor=black> <tr> <td> <a href=http://databaser.net/moniwiki/wiki.php/FrontPage><font color=white>Home</font></a>| <?php echo "<a style='text-decoration:none;' href=http://databaser.net/moniwiki/wiki.php/".urlencode($this->page->name)."?action=print target=blank><font color=white>Print</font></a>"; ?>| <a href=http://databaser.net/boards/bbs.php?table=qa target=blank><font color=white>Q/A</font></a>| <a href=http://databaser.net/boards/bbs.php?table=guest target=blank><font color=white>Guest</font></a>| <a href=http://databaser.net/request_news_letter.php target=blank><font color=white>NewsLetter</font></a>| <a href=http://databaser.net/moniwiki/wiki.php/RecentChanges?action=rss_rc><font color=white>RSS</font></a> </font> </td> <td> <form style='display:inline;' method='get' action='/moniwiki/wiki.php/FindPage'> <input type='hidden' name='action' value='fullsearch' /> <input name='value' size='15' value='' /> <input type='submit' value='Search' /> <input type='checkbox' name='context' value='20' checked='checked' /><font size=1>Display context of search results</font> <input type='checkbox' name='case' value='1' checked='checked' /><font size=1>Case-sensitive searching</font> </form> </td> </tr> </table> </font>
<table border='0' width='100%'> <tr> <td width='250px'></td> <td> <div id='wikiTitle'><?php echo $title?></div> </td> <td valign='bottom' align='right'> <div id='wikiTrailer'><font style='font-size:10px'><?php echo $this->trail?></font></div> </td> </tr> </table> <!--</div>--> <?php echo $msg?> <table border='0' width='100%'> <tr colspan=3> <!--<td colspan=3 width='1px' bgcolor=black> </td>--> </tr> <tr valign='top'> <td width='200px'><?php echo $sidebar ?></td> <td width='1px' bgcolor=#C0C0C0> </td> <td>
3 thema/ddt/footer.php #
</td> </tr> </table> <table><tr><td> <div class='wikiFooter'> <div class="wikiFooterMenu"> <table border='0' width='100%'> <tr> <td width='220px'></td> <td> <?php echo $menu; if ($lastedit) print "|last modified $lastedit $lasttime"; ?> |<a href=databaser.net>http://www.databaser.net</a> </td> </tr> </table> </div> </div> </td></tr></table>
4 Comment.php #
<?php // Copyright 2004-2005 Won-Kyu Park <wkpark at kldp.org> // All rights reserved. Distributable under GPL see COPYING // a Wiki comment plugin for the MoniWiki // // Usage: [[Comment]], ?action=comment // // // $Id: Comment.php,v 1.24 2006/07/15 01:16:00 wkpark Exp $
function macro_Comment($formatter,$value,$options=array()) { global $DBInfo; if (!$options['page']) $options['page']=$formatter->page->name;
if ($value) { $args=explode(',',$value); if (in_array('usemeta',$args)) $use_meta=1; }
if ($options['usemeta'] or $use_meta) { $hidden="<input type='hidden' name='usemeta' value=1 />\n"; }
if ($options['nocomment']) return ''; #if (!$DBInfo->_isWritable($options['page'])) return ''; if (!$DBInfo->security->writable($options)) return '';
$COLS_MSIE = 80; $COLS_OTHER = 85; $cols = preg_match('/MSIE/', $_SERVER['HTTP_USER_AGENT']) ? $COLS_MSIE : $COLS_OTHER;
$rows=$options['rows'] > 5 ? $options['rows']: 5; $cols=$options['cols'] > 60 ? $options['cols']: $cols;
if ($options['datestamp']) $datestamp= $options['datestamp']; else $datestamp= $formatter->page->mtime(); $savetext=$options['savetext']; $savetext= str_replace(array("&","<"),array("&","<"),$savetext); if (!$options['id']) { $user=new User(); # get from COOKIE VARS $options['id']=$user->id; }
$url=$formatter->link_url($formatter->page->urlname);
if ($value) $hidden.='<input type="hidden" name="comment_id" value="'.$value.'" />'; $form = "<form name='editform' method='post' action='$url'>\n<b>蠍 蠍郁鍵..</b>"; $form.= <<<FORM <textarea class="wiki" name="savetext" rows="$rows" cols="$cols">$savetext</textarea><br /> FORM; /* if ($options['id'] == 'Anonymous') $sig=_("Username").": <input name='name' value='$options[name]' />"; else if (!$use_meta) $sig="<input name='nosig' type='checkbox' />"._("Don't add a signature"); */ $sig=_("企: ").": <input name='name' value='' />"; $comment=_("Comment"); $preview=_("Preview"); $ttt = time(); $captcha_img = "<img src='http://databaser.net/zmSpamFree/zmSpamFree.php?zsfimg=".$ttt."' id='zsfImg' alt='るジ讓曙 襦螻豺 企Ν 譯殊語.'/>"; $form.= <<<FORM2 $hidden $sig $captcha_img <input type="text" size="8" maxlength="10" name="zsfCode" id="zsfCode" /> <a href="#" onclick="document.getElementById('zsfImg').src='http://databaser.net/zmSpamFree/zmSpamFree.php?re&zsfimg=' + new Date().getTime(); return false;" title="襦螻豺">襦螻豺</a> <input type="hidden" name="action" value="comment" /> <input type="hidden" name="datestamp" value="$datestamp" /> <input type="submit" value="$comment" /> <input type="submit" name="button_preview" value="$preview" /> </form> FORM2;
return '<div class="commentForm">'.$form.'</div>'; }
function do_comment($formatter,$options=array()) { global $DBInfo;
include '/home1/yasicom/public_html/zmSpamFree/zmSpamFree.php'; if ( !zsfCheck( $_POST['zsfCode'] ) ) { echo "<meta http-equiv='Content-Type' content='text/html;charset=utf-8' />"; echo "<center><h1><b><;;</b></h1></center>"; echo "<script language='javascript'>"; echo "alert('讖...');"; echo "history.go(-1);"; echo "</script>"; return; } else { if (!$DBInfo->security->writable($options)) { $formatter->preview=1; $options['title']=_("Page is not writable"); do_invalid($formatter,$options); return; } else if (!$DBInfo->hasPage($options['page'])) { $options['err']=_("You are not allowed to add a comment."); $options['title']=_("Page does not exists"); do_invalid($formatter,$options); return; }
if ($options['usemeta']) $use_meta=1;
$COLS_MSIE = 80; $COLS_OTHER = 85; $cols = preg_match('/MSIE/', $_SERVER['HTTP_USER_AGENT']) ? $COLS_MSIE : $COLS_OTHER;
$rows=$options['rows'] > 5 ? $options['rows']: 8; $cols=$options['cols'] > 60 ? $options['cols']: $cols;
$url=$formatter->link_url($formatter->page->urlname);
$button_preview=$options['button_preview'];
if ($options['savetext']) { $savetext=_stripslashes($options['savetext']); $savetext=str_replace("\r","",$savetext); $savetext=rtrim($savetext); #$savetext=str_replace("<","<",$savetext); }
if ($savetext and !$button_preview and $DBInfo->spam_filter) { $text=$savetext; $fts=preg_split('/(\||,)/',$DBInfo->spam_filter); foreach ($fts as $ft) { $text=$formatter->filter_repl($ft,$text,$options); } if ($text != $savetext) { $button_preview=1; $options['msg'] = _("Sorry, can not save page because some messages are blocked in this wiki."); } } if ($button_preview && $options['savetext']) { $formatter->send_header("",$options); $formatter->send_title(_("Preview comment"),"",$options); $formatter->send_page($savetext."\n----"); $options['savetext']=$savetext; print macro_Comment($formatter,'',$options); print $formatter->macro_repl('EditHints'); $formatter->send_footer("",$options); return; } else if (!$savetext) { $formatter->send_header("",$options); $formatter->send_title(_("Add comment"),"",$options); print macro_Comment($formatter,'',$options); print $formatter->macro_repl('EditHints'); $formatter->send_footer("",$options); return; }
$datestamp= $options['datestamp']; if ($formatter->page->mtime() > $datestamp) { $options['msg']=''; $formatter->send_header('',$options); $formatter->send_title(_("Error: Don't make a clone!"),'',$options); $formatter->send_footer('',$options); return; }
$body=$formatter->page->get_raw_body();
$options['id']='Anonymous'; if ($options['id']=='Anonymous') $id=$options['name'] ? _stripslashes($options['name']):$_SERVER['REMOTE_ADDR']; else $id=$options['id'];
$date=date('Y-m-d H:i:s'); if ($use_meta) { $date=gmdate('Y-m-d H:i:s').' GMT';
$idx=1; if (preg_match_all('/-{4,}\nComment-Id:\s*(\d+)\n/m',$body,$m)) { $idx=$m[1][sizeof($m[1])-1]+1; }
if ($options['id']!='Anonymous') $id='[admin]'; $meta=<<<META Comment-Id: $idx From: $id Date: $date META; $savetext="----\n$meta\n\n$savetext\n"; } else { if ($options['nosig']) $savetext="----\n$savetext\n"; else if($options['id']=='Anonymous'){ //$savetext="----\n$savetext -- $id [[Date(2011-01-11T12:45:33)]]\n"; $savetext="----\n$savetext -- $id $date\n"; } else $savetext="----\n$savetext -- [admin] [[DateTime(2011-01-11T12:45:33)]]\n"; }
if ($options['comment_id'] and preg_match("/^\[\[Comment\(".$options['comment_id']."\)\]\]/m",$body)) { $str="[[Comment($options[comment_id])]]"; $body= preg_replace('/'.preg_quote($str).'/',$savetext.$str,$body,1); } else if (preg_match("/\n##Comment\n/i",$body)) { $body= preg_replace("/\n##Comment\n/i","\n##Comment\n$savetext",$body,1); } else if (preg_match("/^\[\[Comment(\([^\)]*\))?\]\]/m",$body)) { $body= preg_replace("/^(\[\[Comment(\([^\)]*\))?\]\])/m",$savetext."\\1",$body,1); } else $body.=$savetext;
$formatter->page->write($body); $DBInfo->savePage($formatter->page,"Comment added",$options); $options['msg']=sprintf(_("%s is commented successfully"),$formatter->link_tag($formatter->page->urlname,"?action=show",$options['page'])); $title=_("Comment added successfully");
$myrefresh=''; if ($DBInfo->use_save_refresh) { $sec=$DBInfo->use_save_refresh - 1; $lnk=$formatter->link_url($formatter->page->urlname,"?action=show"); $myrefresh='Refresh: '.$sec.'; url='.qualifiedURL($lnk); } $formatter->send_header($myrefresh,$options); $formatter->send_title($title,'',$options);
$opt['pagelinks']=1; # re-generates pagelinks $formatter->send_page('',$opt); $formatter->send_footer('',$options);
return; } }
// vim:et:sts=2:sw=2 ?>
|