<?php
// PukiWiki - Yet another WikiWikiWeb clone.
// config.php
-// Copyright 2003-2016 PukiWiki Development Team
+// Copyright 2003-2021 PukiWiki Development Team
// License: GPL v2 or (at your option) any later version
//
// Parse a PukiWiki page as a configuration page
foreach (get_source($this->page) as $line) {
if ($line == '') continue;
- $head = $line{0}; // The first letter
+ $head = $line[0]; // The first letter
$level = strspn($line, $head);
if ($level > 3) {
// PukiWiki - Yet another WikiWikiWeb clone
// convert_html.php
// Copyright
-// 2002-2016 PukiWiki Development Team
+// 2002-2021 PukiWiki Development Team
// 2001-2002 Originally written by yu-ji
// License: GPL v2 or (at your option) any later version
//
return $this->last = & $obj->last;
}
- function canContain($obj)
+ function canContain(& $obj)
{
return TRUE;
}
return $this;
}
- function canContain($obj)
+ function canContain(& $obj)
{
return is_a($obj, 'Inline');
}
$this->insert(Factory_Inline($text));
}
- function canContain($obj)
+ function canContain(& $obj)
{
return is_a($obj, 'Inline');
}
$name = $matches[2] ? 'background-color' : 'color';
$this->style[$name] = $name . ':' . htmlsc($matches[3]) . ';';
$text = $matches[5];
- } else if ($matches[4]) {
+ } else if (isset($matches[4])) {
$this->style['size'] = 'font-size:' . htmlsc($matches[4]) . 'px;';
$text = $matches[5];
}
$text = substr($text, 1);
}
- if ($text != '' && $text{0} == '#') {
+ if ($text != '' && $text[0] == '#') {
// Try using Div class for this $text
$obj = & Factory_Div($this, $text);
if (is_a($obj, 'Paragraph'))
global $preformat_ltrim;
parent::__construct();
$this->elements[] = htmlsc(
- (! $preformat_ltrim || $text == '' || $text{0} != ' ') ? $text : substr($text, 1));
+ (! $preformat_ltrim || $text == '' || $text[0] != ' ') ? $text : substr($text, 1));
}
function canContain(& $obj)
}
// The first character
- $head = $line{0};
+ $head = $line[0];
// Heading
if ($head == '*') {
// PukiWiki - Yet another WikiWikiWeb clone.
// file.php
// Copyright
-// 2002-2020 PukiWiki Development Team
+// 2002-2021 PukiWiki Development Team
// 2001-2002 Originally written by yu-ji
// License: GPL v2 or (at your option) any later version
//
$line = & $lines[$i]; // Modify directly
// Ignore null string and preformatted texts
- if ($line == '' || $line{0} == ' ' || $line{0} == "\t") continue;
+ if ($line == '' || $line[0] == ' ' || $line[0] == "\t") continue;
// Modify this line?
if ($modify) {
// PukiWiki - Yet another WikiWikiWeb clone.
// func.php
// Copyright
-// 2002-2020 PukiWiki Development Team
+// 2002-2021 PukiWiki Development Team
// 2001-2002 Originally written by yu-ji
// License: GPL v2 or (at your option) any later version
//
function input_filter($param)
{
static $magic_quotes_gpc = NULL;
- if ($magic_quotes_gpc === NULL)
- $magic_quotes_gpc = get_magic_quotes_gpc();
-
+ if ($magic_quotes_gpc === NULL) {
+ if (function_exists('get_magic_quotes_gpc')) {
+ // No 'get_magic_quotes_gpc' function in PHP8
+ $magic_quotes_gpc = get_magic_quotes_gpc();
+ } else {
+ $magic_quotes_gpc = 0;
+ }
+ }
if (is_array($param)) {
return array_map('input_filter', $param);
} else {
foreach ($matches[1] as $str) {
$len = strlen($str);
- if ($len > 1 && $str{0} == '"' && $str{$len - 1} == '"')
+ if ($len > 1 && $str[0] == '"' && $str[$len - 1] == '"')
$str = str_replace('""', '"', substr($str, 1, -1));
$retval[] = $str;
}
// Implode an array with CSV data format (escape double quotes)
function csv_implode($glue, $pieces)
{
- $_glue = ($glue != '') ? '\\' . $glue{0} : '';
+ $_glue = ($glue != '') ? '\\' . $glue[0] : '';
$arr = array();
foreach ($pieces as $str) {
if (preg_match('/[' . '"' . "\n\r" . $_glue . ']/', $str))
// PukiWiki - Yet another WikiWikiWeb clone.
// make_link.php
// Copyright
-// 2003-2020 PukiWiki Development Team
+// 2003-2021 PukiWiki Development Team
// 2001-2002 Originally written by yu-ji
// License: GPL v2 or (at your option) any later version
//
$page_filetime = fast_get_filetime($page);
$is_page = $page_filetime !== 0;
- if (! isset($related[$page]) && $page !== $vars['page'] && is_page)
+ if (! isset($related[$page]) && $page !== $vars['page'] && $is_page) {
$related[$page] = $page_filetime;
+ }
if ($isautolink || $is_page) {
// Hyperlink to the page
if ($name == '' || $name == './') return $refer;
// Absolute path
- if ($name{0} == '/') {
+ if ($name[0] == '/') {
$name = substr($name, 1);
return ($name == '') ? $defaultpage : $name;
}
} else if (preg_match('/^--\s*([A-Z][A-Z0-9]{1,10}(?:_[A-Z0-9]{1,10}){0,2})(\s+(.+?))?\s*$/', $line, $m)) {
if ($active_jira_base_url) {
$project_key = $m[1];
- $title = $m[2];
+ $title = isset($m[2]) ? $m[2] : '';
array_push($jira_projects, array(
'key' => $m[1],
'title' => $title,
// PukiWiki - Yet another WikiWikiWeb clone.
// plugin.php
// Copyright
-// 2002-2016 PukiWiki Development Team
+// 2002-2021 PukiWiki Development Team
// 2001-2002 Originally written by yu-ji
// License: GPL v2 or (at your option) any later version
//
// Check if plugin API 'action' exists
function exist_plugin_action($name) {
- return function_exists('plugin_' . $name . '_action') ? TRUE : exist_plugin($name) ?
- function_exists('plugin_' . $name . '_action') : FALSE;
+ if (function_exists('plugin_' . $name . '_action')) {
+ return TRUE;
+ }
+ if (exist_plugin($name)) {
+ return function_exists('plugin_' . $name . '_action');
+ }
+ return FALSE;
}
// Check if plugin API 'convert' exists
function exist_plugin_convert($name) {
- return function_exists('plugin_' . $name . '_convert') ? TRUE : exist_plugin($name) ?
- function_exists('plugin_' . $name . '_convert') : FALSE;
+ if (function_exists('plugin_' . $name . '_convert')) {
+ return TRUE;
+ }
+ if (exist_plugin($name)) {
+ return function_exists('plugin_' . $name . '_convert');
+ }
+ return FALSE;
}
// Check if plugin API 'inline' exists
function exist_plugin_inline($name) {
- return function_exists('plugin_' . $name . '_inline') ? TRUE : exist_plugin($name) ?
- function_exists('plugin_' . $name . '_inline') : FALSE;
+ if (function_exists('plugin_' . $name . '_inline')) {
+ return TRUE;
+ }
+ if (exist_plugin($name)) {
+ return function_exists('plugin_' . $name . '_inline');
+ }
+ return FALSE;
}
// Call 'init' function for the plugin
<?php
// PukiWiki - Yet another WikiWikiWeb clone
// proxy.php
-// Copyright: 2003-2017 PukiWiki Development Team
+// Copyright: 2003-2021 PukiWiki Development Team
// License: GPL v2 or (at your option) any later version
//
// HTTP-Proxy related functions
$url = trim($matches[1]);
if (! preg_match('/^https?:\//', $url)) {
// Relative path to Absolute
- if ($url{0} != '/')
+ if ($url[0] != '/')
$url = substr($url_path, 0, strrpos($url_path, '/')) . '/' . $url;
$url = $url_base . $url; // Add sheme, host
}
// PukiWiki - Yet another WikiWikiWeb clone
// dump.inc.php
// Copyright
-// 2004-2017 PukiWiki Development Team
+// 2004-2021 PukiWiki Development Team
// 2004 teanan / Interfair Laboratory
// License: GPL v2 or (at your option) any later version
//
// ファイル名を保存
for($i = 0; $i < strlen($filename); $i++ ) {
if ($i < TARLIB_HDR_NAME_LEN) {
- $tar_data[$i + TARLIB_HDR_NAME_OFFSET] = $filename{$i};
+ $tar_data[$i + TARLIB_HDR_NAME_OFFSET] = $filename[$i];
} else {
break; // ファイル名が長すぎ
}
// mode
$modeid = TARLIB_DATA_MODE;
for($i = 0; $i < strlen($modeid); $i++ ) {
- $tar_data[$i + TARLIB_HDR_MODE_OFFSET] = $modeid{$i};
+ $tar_data[$i + TARLIB_HDR_MODE_OFFSET] = $modeid[$i];
}
// uid / gid
$ugid = TARLIB_DATA_UGID;
for($i = 0; $i < strlen($ugid); $i++ ) {
- $tar_data[$i + TARLIB_HDR_UID_OFFSET] = $ugid{$i};
- $tar_data[$i + TARLIB_HDR_GID_OFFSET] = $ugid{$i};
+ $tar_data[$i + TARLIB_HDR_UID_OFFSET] = $ugid[$i];
+ $tar_data[$i + TARLIB_HDR_GID_OFFSET] = $ugid[$i];
}
// サイズ
$strsize = sprintf('%11o', $size);
for($i = 0; $i < strlen($strsize); $i++ ) {
- $tar_data[$i + TARLIB_HDR_SIZE_OFFSET] = $strsize{$i};
+ $tar_data[$i + TARLIB_HDR_SIZE_OFFSET] = $strsize[$i];
}
// 最終更新時刻
$strmtime = sprintf('%o', $mtime);
for($i = 0; $i < strlen($strmtime); $i++ ) {
- $tar_data[$i + TARLIB_HDR_MTIME_OFFSET] = $strmtime{$i};
+ $tar_data[$i + TARLIB_HDR_MTIME_OFFSET] = $strmtime[$i];
}
// チェックサム計算用のブランクを設定
$chkblanks = TARLIB_DATA_CHKBLANKS;
for($i = 0; $i < strlen($chkblanks); $i++ ) {
- $tar_data[$i + TARLIB_HDR_CHKSUM_OFFSET] = $chkblanks{$i};
+ $tar_data[$i + TARLIB_HDR_CHKSUM_OFFSET] = $chkblanks[$i];
}
// タイプフラグ
}
$strchksum = sprintf('%7o',$sum);
for($i = 0; $i < strlen($strchksum); $i++ ) {
- $tar_data[$i + TARLIB_HDR_CHKSUM_OFFSET] = $strchksum{$i};
+ $tar_data[$i + TARLIB_HDR_CHKSUM_OFFSET] = $strchksum[$i];
}
return $tar_data;
$longname = '';
} else {
for ($i = 0; $i < TARLIB_HDR_NAME_LEN; $i++ ) {
- if ($buff{$i + TARLIB_HDR_NAME_OFFSET} != "\0") {
- $name .= $buff{$i + TARLIB_HDR_NAME_OFFSET};
+ if ($buff[$i + TARLIB_HDR_NAME_OFFSET] != "\0") {
+ $name .= $buff[$i + TARLIB_HDR_NAME_OFFSET];
} else {
break;
}
$checksum = '';
$chkblanks = TARLIB_DATA_CHKBLANKS;
for ($i = 0; $i < TARLIB_HDR_CHKSUM_LEN; $i++ ) {
- $checksum .= $buff{$i + TARLIB_HDR_CHKSUM_OFFSET};
- $buff{$i + TARLIB_HDR_CHKSUM_OFFSET} = $chkblanks{$i};
+ $checksum .= $buff[$i + TARLIB_HDR_CHKSUM_OFFSET];
+ $buff[$i + TARLIB_HDR_CHKSUM_OFFSET] = $chkblanks[$i];
}
list($checksum) = sscanf('0' . trim($checksum), '%i');
// Compute checksum
$sum = 0;
for($i = 0; $i < TARLIB_BLK_LEN; $i++ ) {
- $sum += 0xff & ord($buff{$i});
+ $sum += 0xff & ord($buff[$i]);
}
if ($sum != $checksum) break; // Error
// Size
$size = '';
for ($i = 0; $i < TARLIB_HDR_SIZE_LEN; $i++ ) {
- $size .= $buff{$i + TARLIB_HDR_SIZE_OFFSET};
+ $size .= $buff[$i + TARLIB_HDR_SIZE_OFFSET];
}
list($size) = sscanf('0' . trim($size), '%i');
// 最終更新時刻
$strmtime = '';
for ($i = 0; $i < TARLIB_HDR_MTIME_LEN; $i++ ) {
- $strmtime .= $buff{$i + TARLIB_HDR_MTIME_OFFSET};
+ $strmtime .= $buff[$i + TARLIB_HDR_MTIME_OFFSET];
}
list($mtime) = sscanf('0' . trim($strmtime), '%i');
// タイプフラグ
-// $type = $buff{TARLIB_HDR_TYPE_OFFSET};
+// $type = $buff[TARLIB_HDR_TYPE_OFFSET];
if ($name == TARLIB_DATA_LONGLINK) {
// LongLink
<?php
// PukiWiki - Yet another WikiWikiWeb clone
// tracker.inc.php
-// Copyright 2003-2020 PukiWiki Development Team
+// Copyright 2003-2021 PukiWiki Development Team
// License: GPL v2 or (at your option) any later version
//
// Issue tracker plugin (See Also bugtrack plugin)
// Ignore empty line
continue;
}
- $this->pipe = ($line{0} == '|' or $line{0} == ':');
+ $this->pipe = ($line[0] == '|' or $line[0] == ':');
$source .= preg_replace_callback('/\[([^\[\]]+)\]/',array(&$this,'replace_item'),$line);
}
}