<?php
// PukiWiki - Yet another WikiWikiWeb clone.
-// $Id: file.php,v 1.12 2005/01/18 12:54:53 henoheno Exp $
+// $Id: file.php,v 1.13 2005/01/29 13:29:34 henoheno Exp $
//
// File related functions
{
global $trackback;
+ if (PKWK_READONLY) return; // Do nothing
+
$postdata = make_str_rules($postdata);
// Create and write diff
$retvars = $matches = array();
foreach ($arr as $str) {
- if ($str != '' && $str{0} != ' ' && $str{0} != "\t") {
+ if ($str != '' && $str{0} != ' ' && $str{0} != "\t")
foreach ($str_rules as $rule => $replace)
- $str = preg_replace("/$rule/", $replace, $str);
- }
+ $str = preg_replace('/' . $rule . '/', $replace, $str);
// Adding fixed anchor into headings
if ($fixed_heading_anchor &&
// A random alphabetic letter + 7 letters of random strings from md()
$anchor = chr(mt_rand(ord('a'), ord('z'))) .
substr(md5(uniqid(substr($matches[1], 0, 100), 1)), mt_rand(0, 24), 7);
- $str = rtrim($matches[1]) . " [#$anchor]";
+ $str = rtrim($matches[1]) . ' [#' . $anchor . ']';
}
$retvars[] = $str;
}
global $smtp_server, $smtp_auth;
global $whatsdeleted, $maxshow_deleted;
+ if (PKWK_READONLY) return; // Do nothing
+
if (! is_pagename($page))
die_message(str_replace('$1', htmlspecialchars($page),
str_replace('$2', 'WikiName', $_msg_invalidiwn)));
}
if ($str != '') {
- $str = preg_replace("/\r/", '', $str);
+ $str = preg_replace('/' . "\r" . '/', '', $str);
$str = rtrim($str) . "\n";
if ($notimestamp && file_exists($file))
// Update RecentDeleted
function add_recent($page, $recentpage, $subject = '', $limit = 0)
{
- if ($limit == 0 || $page == '' || $recentpage == '') return;
+ if (PKWK_READONLY || $limit == 0 || $page == '' || $recentpage == '') return;
// Load
$lines = $matches = array();
{
global $maxshow, $whatsnew, $non_list, $autolink;
+ if (PKWK_READONLY) return; // Do nothing
+
$pages = get_existpages();
$recent_pages = array();
$non_list_pattern = '/' . $non_list . '/';
$time = get_filetime($page);
$pg_passage = ($time != 0) ? get_passage($time) : '';
- return $sw ? "<small>$pg_passage</small>" : " $pg_passage";
+ return $sw ? '<small>' . $pg_passage . '</small>' : ' ' . $pg_passage;
}
// Last-Modified header