You can subscribe to this list here.
| 2000 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(43) |
Nov
(73) |
Dec
(10) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2001 |
Jan
(34) |
Feb
(110) |
Mar
(24) |
Apr
(44) |
May
(37) |
Jun
(22) |
Jul
(20) |
Aug
(28) |
Sep
(50) |
Oct
(11) |
Nov
(132) |
Dec
(595) |
| 2002 |
Jan
(1099) |
Feb
(579) |
Mar
(63) |
Apr
|
May
|
Jun
|
Jul
|
Aug
(125) |
Sep
(101) |
Oct
(25) |
Nov
(34) |
Dec
(47) |
| 2003 |
Jan
(82) |
Feb
(182) |
Mar
(71) |
Apr
(3) |
May
(1) |
Jun
(3) |
Jul
|
Aug
|
Sep
(14) |
Oct
(6) |
Nov
(124) |
Dec
(68) |
| 2004 |
Jan
(64) |
Feb
(191) |
Mar
(199) |
Apr
(298) |
May
(252) |
Jun
(426) |
Jul
(134) |
Aug
(13) |
Sep
(96) |
Oct
(75) |
Nov
(232) |
Dec
(171) |
| 2005 |
Jan
(205) |
Feb
(165) |
Mar
(8) |
Apr
(74) |
May
(21) |
Jun
(19) |
Jul
(37) |
Aug
(69) |
Sep
(141) |
Oct
(118) |
Nov
(31) |
Dec
(7) |
| 2006 |
Jan
(5) |
Feb
(10) |
Mar
(35) |
Apr
(24) |
May
(34) |
Jun
(29) |
Jul
(5) |
Aug
(38) |
Sep
(30) |
Oct
(37) |
Nov
(30) |
Dec
(86) |
| 2007 |
Jan
(414) |
Feb
(40) |
Mar
(18) |
Apr
(10) |
May
(66) |
Jun
(60) |
Jul
(105) |
Aug
(55) |
Sep
(64) |
Oct
(7) |
Nov
(11) |
Dec
(5) |
| 2008 |
Jan
(26) |
Feb
(28) |
Mar
(79) |
Apr
(34) |
May
(61) |
Jun
(24) |
Jul
(29) |
Aug
(160) |
Sep
(62) |
Oct
(70) |
Nov
(32) |
Dec
(14) |
| 2009 |
Jan
(140) |
Feb
(135) |
Mar
(153) |
Apr
(53) |
May
(24) |
Jun
(138) |
Jul
(90) |
Aug
(46) |
Sep
(72) |
Oct
(84) |
Nov
(32) |
Dec
(4) |
| 2010 |
Jan
(13) |
Feb
(7) |
Mar
(14) |
Apr
(55) |
May
(89) |
Jun
(131) |
Jul
(41) |
Aug
(38) |
Sep
(42) |
Oct
(11) |
Nov
(27) |
Dec
(54) |
| 2011 |
Jan
(127) |
Feb
(16) |
Mar
(71) |
Apr
(52) |
May
(32) |
Jun
(31) |
Jul
(4) |
Aug
|
Sep
(45) |
Oct
(26) |
Nov
(36) |
Dec
(10) |
| 2012 |
Jan
(23) |
Feb
(6) |
Mar
(13) |
Apr
(18) |
May
(1) |
Jun
(4) |
Jul
(3) |
Aug
(12) |
Sep
(57) |
Oct
(96) |
Nov
(163) |
Dec
(124) |
| 2013 |
Jan
(11) |
Feb
(17) |
Mar
(7) |
Apr
(48) |
May
(15) |
Jun
(29) |
Jul
(12) |
Aug
|
Sep
(9) |
Oct
|
Nov
|
Dec
(3) |
| 2014 |
Jan
(4) |
Feb
(1) |
Mar
(2) |
Apr
(1) |
May
(8) |
Jun
(90) |
Jul
(104) |
Aug
(12) |
Sep
(81) |
Oct
(139) |
Nov
(111) |
Dec
(64) |
| 2015 |
Jan
(46) |
Feb
(74) |
Mar
(56) |
Apr
(61) |
May
(3) |
Jun
(7) |
Jul
(11) |
Aug
(5) |
Sep
(15) |
Oct
(1) |
Nov
(1) |
Dec
(15) |
| 2016 |
Jan
(25) |
Feb
(33) |
Mar
(24) |
Apr
(4) |
May
(24) |
Jun
(3) |
Jul
(75) |
Aug
|
Sep
(2) |
Oct
(38) |
Nov
(4) |
Dec
(18) |
| 2017 |
Jan
(8) |
Feb
(1) |
Mar
(1) |
Apr
|
May
(14) |
Jun
|
Jul
(5) |
Aug
(9) |
Sep
|
Oct
(23) |
Nov
|
Dec
|
| 2018 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(2) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2019 |
Jan
|
Feb
|
Mar
(9) |
Apr
(60) |
May
(1) |
Jun
|
Jul
(13) |
Aug
|
Sep
(11) |
Oct
|
Nov
|
Dec
|
| 2020 |
Jan
|
Feb
|
Mar
(15) |
Apr
(4) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(47) |
| 2021 |
Jan
(24) |
Feb
(33) |
Mar
(1) |
Apr
|
May
(1) |
Jun
(64) |
Jul
(71) |
Aug
(114) |
Sep
(82) |
Oct
(32) |
Nov
(76) |
Dec
(86) |
| 2022 |
Jan
(162) |
Feb
(41) |
Mar
(11) |
Apr
(9) |
May
|
Jun
|
Jul
(1) |
Aug
(2) |
Sep
|
Oct
|
Nov
|
Dec
(7) |
| 2023 |
Jan
|
Feb
(1) |
Mar
(2) |
Apr
|
May
|
Jun
|
Jul
(25) |
Aug
|
Sep
|
Oct
|
Nov
(7) |
Dec
|
| 2024 |
Jan
(7) |
Feb
(3) |
Mar
(3) |
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2025 |
Jan
|
Feb
(90) |
Mar
(19) |
Apr
|
May
(6) |
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: <var...@us...> - 2022-04-19 14:53:49
|
Revision: 11025
http://sourceforge.net/p/phpwiki/code/11025
Author: vargenau
Date: 2022-04-19 14:53:46 +0000 (Tue, 19 Apr 2022)
Log Message:
-----------
Whitespace, braces
Modified Paths:
--------------
trunk/themes/Crao/templates/htmldump.tmpl
trunk/themes/Portland/templates/viewsource.tmpl
trunk/themes/Sidebar/templates/dump-footer.tmpl
trunk/themes/Sidebar/templates/top.tmpl
trunk/themes/Wordpress/templates/viewsource.tmpl
trunk/themes/blog/templates/browse-footer.tmpl
trunk/themes/blog/templates/calendar.tmpl
trunk/themes/blog/templates/sidebar.tmpl
trunk/themes/default/templates/addcomment.tmpl
trunk/themes/default/templates/comment.tmpl
trunk/themes/default/templates/htmldump.tmpl
trunk/themes/default/templates/login.tmpl
trunk/themes/default/templates/online.tmpl
trunk/themes/default/templates/pagelink.tmpl
trunk/themes/default/templates/userprefs.tmpl
trunk/themes/default/templates/wikiblog.tmpl
trunk/themes/default/templates/wikiforum.tmpl
trunk/themes/fusionforge/templates/userprefs.tmpl
Modified: trunk/themes/Crao/templates/htmldump.tmpl
===================================================================
--- trunk/themes/Crao/templates/htmldump.tmpl 2022-04-19 14:43:35 UTC (rev 11024)
+++ trunk/themes/Crao/templates/htmldump.tmpl 2022-04-19 14:53:46 UTC (rev 11025)
@@ -25,10 +25,11 @@
<?php echo $WikiTheme->getCSS() ?>
<?php
// avoid redundant bookmark title for custom home page
- if ($page->getName() == WIKI_NAME && HOME_PAGE == WIKI_NAME)
+ if ($page->getName() == WIKI_NAME && HOME_PAGE == WIKI_NAME) {
$pagetitle = "";
- else
+ } else {
$pagetitle = " - ". AsString($TITLE);
+ }
?>
<title><?php echo WIKI_NAME.$pagetitle?></title>
</head>
Modified: trunk/themes/Portland/templates/viewsource.tmpl
===================================================================
--- trunk/themes/Portland/templates/viewsource.tmpl 2022-04-19 14:43:35 UTC (rev 11024)
+++ trunk/themes/Portland/templates/viewsource.tmpl 2022-04-19 14:53:46 UTC (rev 11025)
@@ -6,6 +6,6 @@
><?php echo $PAGE_SOURCE ?>
</textarea>
<hr />
-<a href="<?php echo WikiURL($page,array('action'=>_("PageHistory")))?>">
+<a href="<?php echo WikiURL($page, array('action'=>_("PageHistory")))?>">
<?php echo $WikiTheme->getLastModifiedMessage($revision) ?></a>
<br />
Modified: trunk/themes/Sidebar/templates/dump-footer.tmpl
===================================================================
--- trunk/themes/Sidebar/templates/dump-footer.tmpl 2022-04-19 14:43:35 UTC (rev 11024)
+++ trunk/themes/Sidebar/templates/dump-footer.tmpl 2022-04-19 14:53:46 UTC (rev 11025)
@@ -1,5 +1,7 @@
<?php
- if (empty($revision)) $revision = $page->getCurrentRevision();
+ if (empty($revision)) {
+ $revision = $page->getCurrentRevision();
+ }
?>
<hr class="printer" />
<div class="clear-floats"></div>
Modified: trunk/themes/Sidebar/templates/top.tmpl
===================================================================
--- trunk/themes/Sidebar/templates/top.tmpl 2022-04-19 14:43:35 UTC (rev 11024)
+++ trunk/themes/Sidebar/templates/top.tmpl 2022-04-19 14:53:46 UTC (rev 11025)
@@ -1,15 +1,17 @@
<?php
$pagename = $page->getName();
$isActionPage = isActionPage($pagename);
-if (ENABLE_PAGE_PUBLIC)
+if (ENABLE_PAGE_PUBLIC) {
$public = $page->get('public');
-else
+} else {
$public = false;
+}
if (ENABLE_RATEIT && !empty($user) && $user->isAuthenticated()
- && $page->exists() && !$isActionPage && !$WikiTheme->DUMP_MODE)
+ && $page->exists() && !$isActionPage && !$WikiTheme->DUMP_MODE) {
$rating = 1;
-else
+} else {
$rating = 0;
+}
?>
<?php // Page title ?>
<a id="contentTop"></a>
Modified: trunk/themes/Wordpress/templates/viewsource.tmpl
===================================================================
--- trunk/themes/Wordpress/templates/viewsource.tmpl 2022-04-19 14:43:35 UTC (rev 11024)
+++ trunk/themes/Wordpress/templates/viewsource.tmpl 2022-04-19 14:53:46 UTC (rev 11025)
@@ -7,7 +7,7 @@
><?php echo $PAGE_SOURCE ?>
</textarea>
<hr />
-<a href="<?php echo WikiURL($page,array('action'=>_("PageHistory")))?>">
+<a href="<?php echo WikiURL($page, array('action'=>_("PageHistory")))?>">
<?php echo $WikiTheme->getLastModifiedMessage($revision) ?></a>
<br />
</div>
Modified: trunk/themes/blog/templates/browse-footer.tmpl
===================================================================
--- trunk/themes/blog/templates/browse-footer.tmpl 2022-04-19 14:43:35 UTC (rev 11024)
+++ trunk/themes/blog/templates/browse-footer.tmpl 2022-04-19 14:53:46 UTC (rev 11025)
@@ -1,6 +1,6 @@
<footer role="contentinfo">
<p class="editdate">
-<?php if( $page->getName() != _("HomePage")) { ?>
+<?php if ($page->getName() != _("HomePage")) { ?>
<?php echo $WikiTheme->getOwnerMessage($page) ?> <?php echo $WikiTheme->getLastModifiedMessage($revision) ?> <?php echo $WikiTheme->getAuthorMessage($revision) ?><br />
<?php } ?>
This site is powered by <a href="https://sourceforge.net/projects/phpwiki/">PhpWiki</a>. Page design based on Kubrick,<br />adapted by <a href="https://the.taoofmac.com">Rui Carmo</a> from an original design by <a href="https://binarybonsai.com">Michael Heilemann</a>.</p>
Modified: trunk/themes/blog/templates/calendar.tmpl
===================================================================
--- trunk/themes/blog/templates/calendar.tmpl 2022-04-19 14:43:35 UTC (rev 11024)
+++ trunk/themes/blog/templates/calendar.tmpl 2022-04-19 14:53:46 UTC (rev 11025)
@@ -7,7 +7,7 @@
var d = calendar.date.getDate(); // integer, 1..31
m = m < 10 ? "0" + m : m;
d = d < 10 ? "0" + d : d;
- window.location = "' . WikiURL($WikiTheme->calendarBase(),0,1) . '/' . '" + y + "-" + m + "-" + d;
+ window.location = "' . WikiURL($WikiTheme->calendarBase(), 0, 1) . '/' . '" + y + "-" + m + "-" + d;
}
};
Calendar.setup({flat : "calendar", flatCallback : dateChanged, setDateStatusFunc : dateStatusFunc, weekNumbers : false})') ?>
Modified: trunk/themes/blog/templates/sidebar.tmpl
===================================================================
--- trunk/themes/blog/templates/sidebar.tmpl 2022-04-19 14:43:35 UTC (rev 11024)
+++ trunk/themes/blog/templates/sidebar.tmpl 2022-04-19 14:53:46 UTC (rev 11025)
@@ -22,8 +22,9 @@
$box = new RelatedLinksBox();
$body = $box->body;
-if ($body->asString() != "")
+if ($body->asString() != "") {
printXml($box->format());
+}
$box = new PluginSidebarBox("RecentChanges");
printXml($box->format());
Modified: trunk/themes/default/templates/addcomment.tmpl
===================================================================
--- trunk/themes/default/templates/addcomment.tmpl 2022-04-19 14:43:35 UTC (rev 11024)
+++ trunk/themes/default/templates/addcomment.tmpl 2022-04-19 14:53:46 UTC (rev 11025)
@@ -1,5 +1,5 @@
<?php
- $request->setArg('action',false);
+ $request->setArg('action', false);
?>
<div class="wikicomment wikicomment-form">
<?php if (!$WikiTheme->DUMP_MODE) { ?>
Modified: trunk/themes/default/templates/comment.tmpl
===================================================================
--- trunk/themes/default/templates/comment.tmpl 2022-04-19 14:43:35 UTC (rev 11024)
+++ trunk/themes/default/templates/comment.tmpl 2022-04-19 14:53:46 UTC (rev 11025)
@@ -5,8 +5,9 @@
if ($user->isAdmin() or $user->getId() == $COMMENT_CREATOR) {
$buttons = HTML::small(array('class' => 'floatleft'),
Button('edit', false, $page));
- if ($user->isAdmin())
+ if ($user->isAdmin()) {
$buttons->pushContent($SEP, Button('remove', _("Remove Comment"), $page));
+ }
}
// This is a hack, but since we only have a fake PageRevision,
Modified: trunk/themes/default/templates/htmldump.tmpl
===================================================================
--- trunk/themes/default/templates/htmldump.tmpl 2022-04-19 14:43:35 UTC (rev 11024)
+++ trunk/themes/default/templates/htmldump.tmpl 2022-04-19 14:53:46 UTC (rev 11025)
@@ -37,10 +37,11 @@
<?php echo $WikiTheme->getCSS() ?>
<?php
// avoid redundant bookmark title for custom home page
- if ($page->getName() == WIKI_NAME && HOME_PAGE == WIKI_NAME)
+ if ($page->getName() == WIKI_NAME && HOME_PAGE == WIKI_NAME) {
$pagetitle = "";
- else
+ } else {
$pagetitle = " - ". AsString($TITLE);
+ }
?>
<title><?php echo WIKI_NAME.$pagetitle?></title>
</head>
Modified: trunk/themes/default/templates/login.tmpl
===================================================================
--- trunk/themes/default/templates/login.tmpl 2022-04-19 14:43:35 UTC (rev 11024)
+++ trunk/themes/default/templates/login.tmpl 2022-04-19 14:53:46 UTC (rev 11025)
@@ -7,9 +7,9 @@
<?php
$dbh = $request->getDbh();
if (ISREADONLY) {
- echo asXML(HTML::p(array('class' => 'warning_msg'), _("System is locked as read-only for maintenance")));
+ echo asXML(HTML::p(array('class' => 'warning_msg'), _("System is locked as read-only for maintenance")));
} elseif ($dbh->readonly) {
- echo asXML(HTML::p(array('class' => 'warning_msg'), _("Database is locked as read-only for maintenance")));
+ echo asXML(HTML::p(array('class' => 'warning_msg'), _("Database is locked as read-only for maintenance")));
}
if (DEBUG & _DEBUG_LOGIN) {
Modified: trunk/themes/default/templates/online.tmpl
===================================================================
--- trunk/themes/default/templates/online.tmpl 2022-04-19 14:43:35 UTC (rev 11024)
+++ trunk/themes/default/templates/online.tmpl 2022-04-19 14:53:46 UTC (rev 11025)
@@ -4,22 +4,23 @@
// We have two modes: 1. a simple "summary" block, and
// 2. "detail" with a table of online users, date and current actions
$header = _("Who is Online");
-if ($MAX_ONLINE_TIME and $MAX_ONLINE_NUM)
- $MAX_ONLINE_TIME = $WikiTheme->formatDateTime($MAX_ONLINE_TIME);
+if ($MAX_ONLINE_TIME and $MAX_ONLINE_NUM) {
+ $MAX_ONLINE_TIME = $WikiTheme->formatDateTime($MAX_ONLINE_TIME);
+}
?>
<?php if ($mode == 'summary') {
if ($allow_detail) {
- $url = WikiURL($pagename,array("mode"=>"detail"));
- $header = HTML::a(array('href'=>$url,'title'=>_("Switch to detailed list")),_("Who is Online"));
+ $url = WikiURL($pagename, array("mode"=>"detail"));
+ $header = HTML::a(array('href'=>$url,'title'=>_("Switch to detailed list")), _("Who is Online"));
}
?>
<table class="forumline fullwidth">
<tr><td class="cat" colspan="2"><?php echo $header ?></td></tr>
<tr><td class="row1" rowspan="3"><?php echo $ONLINE_ICON ?></td>
- <td class="row1 gensmall"><?php echo fmt("Our users created a total of %d pages.",$NUM_PAGES) ?><br />
- <?php echo fmt("We have a total of %d registered users.",$NUM_USERS) ?><br />
- <?php echo $NEWEST_USER ? fmt("The newest registered user is %s.",$NEWEST_USER) : ''?>
+ <td class="row1 gensmall"><?php echo fmt("Our users created a total of %d pages.", $NUM_PAGES) ?><br />
+ <?php echo fmt("We have a total of %d registered users.", $NUM_USERS) ?><br />
+ <?php echo $NEWEST_USER ? fmt("The newest registered user is %s.", $NEWEST_USER) : ''?>
</td></tr>
<?php if ($SESSDATA_BOOL) { ?>
<tr><td class="row1 gensmall">
@@ -30,11 +31,14 @@
<?php
$s='';
foreach ($REGISTERED as $user) {
- $link = WikiLink($user['name']);
- $s .= $link->asXML() . ", ";
+ $link = WikiLink($user['name']);
+ $s .= $link->asXML() . ", ";
}
- if (!count($REGISTERED)) echo(htmlentities(_("None")));
- else echo(substr($s,0,-2));
+ if (!count($REGISTERED)) {
+ echo(htmlentities(_("None")));
+ } else {
+ echo(substr($s, 0, -2));
+ }
?>
<?php if (!empty($ADMINS) and $dispose_admin) { ?>
<br />
@@ -42,7 +46,7 @@
<?php } ?>
</td></tr>
<tr><td class="row1 gensmall">
- <?php echo fmt("This data is based on users active over the past %s.",$SESSION_TIME) ?><br />
+ <?php echo fmt("This data is based on users active over the past %s.", $SESSION_TIME) ?><br />
</td></tr>
<?php } else { ?>
<tr><td class="row1 gensmall"><br />
@@ -53,8 +57,8 @@
<?php } ?>
<?php if ($mode == 'detail') {
- $url = WikiURL($pagename,array("mode"=>"summary"));
- $header = HTML::a(array('href'=>$url,'title'=>_("Switch to summary")),_("Who is Online"));
+ $url = WikiURL($pagename, array("mode"=>"summary"));
+ $header = HTML::a(array('href'=>$url,'title'=>_("Switch to summary")), _("Who is Online"));
?>
<table class="forumline fullwidth">
<tr><td class="cat" colspan="3"><?php echo $header ?></td></tr>
Modified: trunk/themes/default/templates/pagelink.tmpl
===================================================================
--- trunk/themes/default/templates/pagelink.tmpl 2022-04-19 14:43:35 UTC (rev 11024)
+++ trunk/themes/default/templates/pagelink.tmpl 2022-04-19 14:53:46 UTC (rev 11025)
@@ -7,8 +7,8 @@
* More ideas: FIRST, LAST, ...
*/
if ($WikiTheme->DUMP_MODE) {
- $PREV = false;
- $NEXT = false;
+ $PREV = false;
+ $NEXT = false;
}
?>
<tr><td style="width:100%" colspan="<?php echo $COLS ?>"><table class="fullwidth wikipaging"><tr class="wikipaging">
Modified: trunk/themes/default/templates/userprefs.tmpl
===================================================================
--- trunk/themes/default/templates/userprefs.tmpl 2022-04-19 14:43:35 UTC (rev 11024)
+++ trunk/themes/default/templates/userprefs.tmpl 2022-04-19 14:53:46 UTC (rev 11025)
@@ -1,5 +1,7 @@
<?php
-if (empty($errmsg)) $errmsg = '';
+if (empty($errmsg)) {
+ $errmsg = '';
+}
$plugin = $request->getArg('pagename');
$time = time();
@@ -7,8 +9,9 @@
$pref = $request->_prefs;
$num = $request->getArg('num');
-if (!$pref) return;
-
+if (!$pref) {
+ return;
+}
$offset = $pref->get('timeOffset');
$serverTime = $time - $offset * 3600;
$timeOffsetInput = HTML::input(array('type' => "text",
@@ -49,12 +52,12 @@
'value' => '1',
'checked' => (bool) $pref->get('doubleClickEdit')));
if (!function_exists('selectedOption')) {
- function selectedOption ($value, $label = false) {
- return HTML::option(array('value' => $value,'selected'=>"selected"), ($label ? $label : $value) . "\n");
- }
- function unselectedOption ($value, $label = false) {
- return HTML::option(array('value' => $value), ($label ? $label : $value) . "\n");
- }
+ function selectedOption($value, $label = false) {
+ return HTML::option(array('value' => $value,'selected'=>"selected"), ($label ? $label : $value) . "\n");
+ }
+ function unselectedOption($value, $label = false) {
+ return HTML::option(array('value' => $value), ($label ? $label : $value) . "\n");
+ }
}
$SelectThemes = ''; $SelectLanguages = '';
@@ -62,9 +65,9 @@
$SelectOptions = HTML();
if (!empty($available_themes) and is_array($available_themes)) {
if (!$pref->get('theme') or $pref->get('theme') == THEME) {
- $SelectOptions->pushContent(selectedOption("",_("<system theme>")));
+ $SelectOptions->pushContent(selectedOption("", _("<system theme>")));
} else {
- $SelectOptions->pushContent(unselectedOption("",_("<system theme>")));
+ $SelectOptions->pushContent(unselectedOption("", _("<system theme>")));
}
foreach ($available_themes as $theme) {
if ($theme == $pref->get('theme') and $theme != THEME) {
@@ -80,9 +83,9 @@
$SelectOptions = HTML();
if (!empty($available_languages) and is_array($available_languages)) {
if (!$pref->get('lang') or $pref->get('lang') == DEFAULT_LANGUAGE) {
- $SelectOptions->pushContent(selectedOption("",_("<system language>")));
+ $SelectOptions->pushContent(selectedOption("", _("<system language>")));
} else {
- $SelectOptions->pushContent(unselectedOption("",_("<system language>")));
+ $SelectOptions->pushContent(unselectedOption("", _("<system language>")));
}
foreach ($available_languages as $lang) {
if ($lang == $pref->get('lang') and $lang != DEFAULT_LANGUAGE) {
Modified: trunk/themes/default/templates/wikiblog.tmpl
===================================================================
--- trunk/themes/default/templates/wikiblog.tmpl 2022-04-19 14:43:35 UTC (rev 11024)
+++ trunk/themes/default/templates/wikiblog.tmpl 2022-04-19 14:53:46 UTC (rev 11025)
@@ -1,7 +1,9 @@
<?php
$CDATE = $WikiTheme->formatDateTime($BLOG_CTIME);
$buttons = $modified = '';
-if (empty($SEP)) $SEP = ' - ';
+if (empty($SEP)) {
+ $SEP = ' - ';
+}
if ($user->isAdmin() or $user->getId() == $BLOG_CREATOR) {
$buttons = HTML::small(array('class' => 'floatleft'),
Modified: trunk/themes/default/templates/wikiforum.tmpl
===================================================================
--- trunk/themes/default/templates/wikiforum.tmpl 2022-04-19 14:43:35 UTC (rev 11024)
+++ trunk/themes/default/templates/wikiforum.tmpl 2022-04-19 14:53:46 UTC (rev 11025)
@@ -24,7 +24,7 @@
<td class="align-left"><?php echo WikiLink($FORUM_CREATOR, 'if_known')?></td>
<td>
<table class="wikiforum wikiforum-message">
- <tr><td class="align-left"><?php echo fmt("Posted: %s",$CDATE)?></td>
+ <tr><td class="align-left"><?php echo fmt("Posted: %s", $CDATE)?></td>
<td class="align-right"><?php echo _("Reply")?></td></tr>
<tr><td><?php echo $CONTENT ?></td></tr>
</table>
Modified: trunk/themes/fusionforge/templates/userprefs.tmpl
===================================================================
--- trunk/themes/fusionforge/templates/userprefs.tmpl 2022-04-19 14:43:35 UTC (rev 11024)
+++ trunk/themes/fusionforge/templates/userprefs.tmpl 2022-04-19 14:53:46 UTC (rev 11025)
@@ -1,19 +1,23 @@
<?php
// Todo: Move the logic and code to the plugin
// This is very experimental and the read-only part an ugly hack so far.
-foreach (explode(',','errmsg,isForm') as $var) {
- if (empty($$var)) $$var = false;
+foreach (explode(',', 'errmsg,isForm') as $var) {
+ if (empty($$var)) {
+ $$var = false;
+ }
}
$plugin = $request->getArg('pagename');
$time = time();
-$user =& $request->getUser();
-$pref =& $request->_prefs;
+$user = $request->getUser();
+$pref = $request->_prefs;
-if (!$pref) return;
+if (!$pref) {
+ return;
+}
$offset = $pref->get('timeOffset');
$serverTime = $time - $offset * 3600;
-if ($isForm)
+if ($isForm) {
$timeOffsetInput = HTML::input(array('type' => "text",
'id' => 'timeOffsetInput',
'size' => 6,
@@ -21,8 +25,9 @@
'name' => "pref[timeOffset]",
'class' => "numeric",
'value' => $offset));
-else
+} else {
$timeOffsetInput = $pref->get('timeOffset');
+}
$OwnModificationsCB = HTML::input(array('type' => 'checkbox',
'id' => 'ownModifications',
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <var...@us...> - 2022-04-19 14:43:38
|
Revision: 11024
http://sourceforge.net/p/phpwiki/code/11024
Author: vargenau
Date: 2022-04-19 14:43:35 +0000 (Tue, 19 Apr 2022)
Log Message:
-----------
Whitespace, braces
Modified Paths:
--------------
trunk/themes/Crao/templates/actionbar.tmpl
trunk/themes/MonoBook/templates/actionbar.tmpl
trunk/themes/Portland/templates/actionbar.tmpl
trunk/themes/Sidebar/templates/actionbar.tmpl
trunk/themes/Wordpress/templates/actionbar.tmpl
trunk/themes/blog/templates/actionbar.tmpl
trunk/themes/fusionforge/templates/actionbar.tmpl
trunk/themes/shamino_com/templates/actionbar.tmpl
Modified: trunk/themes/Crao/templates/actionbar.tmpl
===================================================================
--- trunk/themes/Crao/templates/actionbar.tmpl 2022-04-19 14:38:46 UTC (rev 11023)
+++ trunk/themes/Crao/templates/actionbar.tmpl 2022-04-19 14:43:35 UTC (rev 11024)
@@ -16,7 +16,7 @@
<?php echo $SEP?><?php echo Button('chown') ?>
<?php echo $SEP?><?php echo Button('setacl') ?>
<?php }} ?>
-<?php if ($user->isAdmin() or mayAccessPage('remove',$page->getName())) { ?>
+<?php if ($user->isAdmin() or mayAccessPage('remove', $page->getName())) { ?>
<?php echo $SEP?><?php echo Button('remove') ?>
<?php } ?>
<?php echo $SEP?><?php echo Button(__("PageHistory"), _("Page History")) ?>
Modified: trunk/themes/MonoBook/templates/actionbar.tmpl
===================================================================
--- trunk/themes/MonoBook/templates/actionbar.tmpl 2022-04-19 14:38:46 UTC (rev 11023)
+++ trunk/themes/MonoBook/templates/actionbar.tmpl 2022-04-19 14:43:35 UTC (rev 11024)
@@ -24,7 +24,7 @@
<?php } ?>
<?php } else {
$talk = new WikiPageName($pagename); ?>
- <?php echo ActionButton(array(),$isActionPage ? _("Action Page") : _("Article"), $talk->getParent(), array('title' => "View the page")) ?>
+ <?php echo ActionButton(array(), $isActionPage ? _("Action Page") : _("Article"), $talk->getParent(), array('title' => "View the page")) ?>
<?php echo ActionButton(array(), _("Discussion"), $talk->getName(), array('class'=>$isBrowse ? "selected" : "")) ?>
<?php } ?>
<?php if (($isAdmin or mayAccessPage('edit', $pagename)) and $revision) { ?>
@@ -67,7 +67,7 @@
<?php echo ActionButton('setacl') ?>
<?php }} ?>
<?php if (!empty($revision) and ($isAdmin or mayAccessPage('remove', $pagename))) { ?>
- <?php echo ActionButton('revert',_("Revert"), $revision->isCurrent() ? $page->GetRevisionBefore() : $revision) ?>
+ <?php echo ActionButton('revert', _("Revert"), $revision->isCurrent() ? $page->GetRevisionBefore() : $revision) ?>
<?php echo ActionButton('remove') ?>
<?php } ?>
<?php } ?>
Modified: trunk/themes/Portland/templates/actionbar.tmpl
===================================================================
--- trunk/themes/Portland/templates/actionbar.tmpl 2022-04-19 14:38:46 UTC (rev 11023)
+++ trunk/themes/Portland/templates/actionbar.tmpl 2022-04-19 14:43:35 UTC (rev 11024)
@@ -16,7 +16,7 @@
?>
<?php echo $EditB ?>
<?php echo $SEP?>
-<a href="<?php echo WikiURL($revision,array('action'=>'diff'))?>"><?php echo $WikiTheme->getLastModifiedMessage($revision) ?></a>
+<a href="<?php echo WikiURL($revision, array('action'=>'diff'))?>"><?php echo $WikiTheme->getLastModifiedMessage($revision) ?></a>
<?php echo $SEP?>
<?php echo Button(__("PageHistory"), _("Page History")) ?>
<?php echo $SEP?>
Modified: trunk/themes/Sidebar/templates/actionbar.tmpl
===================================================================
--- trunk/themes/Sidebar/templates/actionbar.tmpl 2022-04-19 14:38:46 UTC (rev 11023)
+++ trunk/themes/Sidebar/templates/actionbar.tmpl 2022-04-19 14:43:35 UTC (rev 11024)
@@ -48,7 +48,7 @@
<?php if (!empty($revision) and ($isAdmin or mayAccessPage('remove', $pagename))) { ?>
<?php echo ActionButton('remove') ?>
<?php echo ActionButton('purge') ?>
- <?php echo ActionButton('revert',_("Revert"), $revision->isCurrent() ? $page->GetRevisionBefore() : $revision) ?>
+ <?php echo ActionButton('revert', _("Revert"), $revision->isCurrent() ? $page->GetRevisionBefore() : $revision) ?>
<?php } ?>
<?php if ($isAdmin or $mayChange) { ?>
<?php echo ActionButton($page->get('locked') ? 'unlock' : 'lock') ?>
Modified: trunk/themes/Wordpress/templates/actionbar.tmpl
===================================================================
--- trunk/themes/Wordpress/templates/actionbar.tmpl 2022-04-19 14:38:46 UTC (rev 11023)
+++ trunk/themes/Wordpress/templates/actionbar.tmpl 2022-04-19 14:43:35 UTC (rev 11024)
@@ -62,7 +62,7 @@
<li><?php echo _("Information") ?>
<ul>
<li>
- <a href="<?php echo WikiURL($revision,array('action'=>'diff')) ?>">
+ <a href="<?php echo WikiURL($revision, array('action'=>'diff')) ?>">
<?php echo $WikiTheme->getLastModifiedMessage($revision) ?></a>
</li>
<li>
Modified: trunk/themes/blog/templates/actionbar.tmpl
===================================================================
--- trunk/themes/blog/templates/actionbar.tmpl 2022-04-19 14:38:46 UTC (rev 11023)
+++ trunk/themes/blog/templates/actionbar.tmpl 2022-04-19 14:43:35 UTC (rev 11024)
@@ -2,7 +2,7 @@
<tr class="baseline">
<td>
<div class="actionbuttons">
- <?php echo WikiLink(HOME_PAGE, "known",_("Home")) ?>
+ <?php echo WikiLink(HOME_PAGE, "known", _("Home")) ?>
<?php echo $SEP?><?php echo WikiLink(__("About")) ?>
<?php echo $SEP?><?php echo WikiLink(__("BlogArchives"), '', _("Archives")) ?>
<?php echo $SEP?><?php echo WikiLink(__("PhotoAlbum")) ?>
@@ -11,10 +11,11 @@
<?php echo $SEP?><?php echo Button(__("PageInfo"), _("Info")) ?>
<?php
if ($user->isAuthenticated()) {
- if (mayAccessPage('edit', $page->getName()))
+ if (mayAccessPage('edit', $page->getName())) {
$EditB = Button("edit", _("Edit"), false, array('id'=>'btn-edit'));
- else
+ } else {
$EditB = Button("viewsource", _("View Source"));
+ }
?>
<?php echo $SEP?><?php echo $EditB ?>
<?php } ?>
Modified: trunk/themes/fusionforge/templates/actionbar.tmpl
===================================================================
--- trunk/themes/fusionforge/templates/actionbar.tmpl 2022-04-19 14:38:46 UTC (rev 11023)
+++ trunk/themes/fusionforge/templates/actionbar.tmpl 2022-04-19 14:43:35 UTC (rev 11024)
@@ -43,13 +43,13 @@
<li class="bold">
<?php if (! $dbh->isWikiPage($page->getName())) { ?>
<?php echo Button("edit", _("Create Page")) ?>
- <?php } else if ($revision && (($revision->isCurrent()) || ($revision->hasDefaultContents()))) { ?>
+ <?php } elseif ($revision && (($revision->isCurrent()) || ($revision->hasDefaultContents()))) { ?>
<?php echo Button("edit", _("Edit")) ?>
<?php } else { ?>
<?php echo Button("edit", _("Edit Old Version")) ?>
<?php } ?>
</li>
- <?php } else if ($dbh->isWikiPage($page->getName())) { ?>
+ <?php } elseif ($dbh->isWikiPage($page->getName())) { ?>
<li><?php echo Button("viewsource", _("View Source")) ?></li>
<?php } ?>
@@ -62,7 +62,7 @@
<?php } ?>
<?php if ($revision && $curuserprefs->get('revertMenuItem')) { ?>
- <li><?php echo Button('revert',_("Revert"), $revision->isCurrent() ? $page->GetRevisionBefore() : $revision) ?></li>
+ <li><?php echo Button('revert', _("Revert"), $revision->isCurrent() ? $page->GetRevisionBefore() : $revision) ?></li>
<?php } ?>
<li><?php echo Button(__("PageInfo"), _("Page Info")) ?></li>
Modified: trunk/themes/shamino_com/templates/actionbar.tmpl
===================================================================
--- trunk/themes/shamino_com/templates/actionbar.tmpl 2022-04-19 14:38:46 UTC (rev 11023)
+++ trunk/themes/shamino_com/templates/actionbar.tmpl 2022-04-19 14:43:35 UTC (rev 11024)
@@ -1,10 +1,12 @@
<nav role="navigation" aria-label="<?php echo _("Actions Menu") ?>">
<?php
-if (empty($revision)) $revision = $page->getCurrentRevision(false);
+if (empty($revision)) {
+ $revision = $page->getCurrentRevision(false);
+}
?>
-<?php echo Button(array('action'=>__('PageInfo')), _("Page Info"),$page->getName()) ?>
+<?php echo Button(array('action'=>__('PageInfo')), _("Page Info"), $page->getName()) ?>
<?php echo $SEP?><?php echo Button("edit", ($revision->isCurrent() || $revision->hasDefaultContents()) ? _("Edit") : _("Edit Old Version")) ?>
-<?php if ($user->isAdmin() or mayAccessPage('change',$page->getName())) { ?>
+<?php if ($user->isAdmin() or mayAccessPage('change', $page->getName())) { ?>
<?php echo $SEP?><?php echo Button($page->get('locked') ? 'unlock' : 'lock') ?>
<?php if (ENABLE_PAGEPERM) { ?>
<?php echo $SEP?><?php echo Button('chown') ?>
@@ -11,7 +13,7 @@
<?php echo $SEP?><?php echo Button('setacl') ?>
<?php } ?>
<?php } ?>
-<?php if ($user->isAdmin() or mayAccessPage('remove',$page->getName())) { ?>
+<?php if ($user->isAdmin() or mayAccessPage('remove', $page->getName())) { ?>
<?php echo $SEP?><?php echo Button('remove') ?>
<?php } ?>
<?php if (!empty($user) && $user->isAdmin()) { ?>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <var...@us...> - 2022-04-19 14:38:47
|
Revision: 11023
http://sourceforge.net/p/phpwiki/code/11023
Author: vargenau
Date: 2022-04-19 14:38:46 +0000 (Tue, 19 Apr 2022)
Log Message:
-----------
Whitespace, braces
Modified Paths:
--------------
trunk/themes/MonoBook/templates/info.tmpl
trunk/themes/default/templates/info.tmpl
trunk/themes/smaller/templates/info.tmpl
Modified: trunk/themes/MonoBook/templates/info.tmpl
===================================================================
--- trunk/themes/MonoBook/templates/info.tmpl 2022-04-19 14:36:33 UTC (rev 11022)
+++ trunk/themes/MonoBook/templates/info.tmpl 2022-04-19 14:38:46 UTC (rev 11023)
@@ -1,5 +1,7 @@
<?php
-if (empty($revision)) $revision = $page->getCurrentRevision(false);
+if (empty($revision)) {
+ $revision = $page->getCurrentRevision(false);
+}
$modified = $WikiTheme->formatDateTime($revision->get('mtime'));
$author = $revision->get('author');
@@ -7,8 +9,9 @@
$dbi = $request->getDbh();
$author = $revision->get('author');
$authorLink = $author;
-if (preg_match("/^$WikiNameRegexp\$/", $author) && $dbi->isWikiPage($author))
+if (preg_match("/^$WikiNameRegexp\$/", $author) && $dbi->isWikiPage($author)) {
$authorLink = WikiLink($author);
+}
$authorId = $revision->get('author_id');
$version = $revision->getVersion();
@@ -23,18 +26,19 @@
/* better way to do this? */
$bytes = strlen($revision->_data['%content']);
-if ($bytes < 1024 )
+if ($bytes < 1024) {
$size = fmt("%s bytes", $bytes);
-else {
+} else {
$kb = round($bytes / 1024, 1);
$size = fmt("%s KiB (%s bytes)", $kb, $bytes);
}
// Count words
preg_match_all('/\\w+\\W*/', $revision->_data['%content'], $whitespacematches);
-if (1 == ($c = count_all($whitespacematches)))
- $wordcount = fmt("1 word");
-else
- $wordcount = fmt("%s words", $c);
+if (1 == ($c = count_all($whitespacematches))) {
+ $wordcount = fmt("1 word");
+} else {
+ $wordcount = fmt("%s words", $c);
+}
$summary = HTML::textarea(array('name' => 'summary',
@@ -47,7 +51,6 @@
$revision->get('summary'));
if ($is_current = $revision->isCurrent()) {
-
$LOCKED_CB = HTML::input(array('type' => 'checkbox',
'name' => 'edit[locked]',
'id' => 'locked',
@@ -65,7 +68,6 @@
$label['date'] = _("Last Modified") . _(":");
$label['author'] = _("Last Author") . _(":");
$label['summary'] = _("Last Summary") . _(":");
-
} else {
$label['date'] = _("Saved on") . _(":");
$label['author'] = _("Author") . _(":");
@@ -172,8 +174,8 @@
<?php echo $SEP?><?php echo Button(__("PageHistory"), _("Page History")) ?>
<?php echo $SEP?><?php echo Button(__("AuthorHistory"), _("Author History")) ?>
<?php echo $SEP?><?php echo Button("Diff") ?>
- <?php echo $SEP?><?php echo Button(array('action'=>'diff','previous' => 'minor'),_("Diff previous Revision"),$page->getName()) ?>
- <?php echo $SEP?><?php echo Button(array('action'=>'diff','previous' => 'author'),_("Diff previous Author"),$page->getName()) ?>
+ <?php echo $SEP?><?php echo Button(array('action'=>'diff','previous' => 'minor'), _("Diff previous Revision"), $page->getName()) ?>
+ <?php echo $SEP?><?php echo Button(array('action'=>'diff','previous' => 'author'), _("Diff previous Author"), $page->getName()) ?>
<?php if (DEBUG || $user->isAdmin()) { ?>
<?php // Buttons really only for debugging ?>
<?php echo $SEP?><?php echo Button(__("DebugBackendInfo"), _("Debug Backend Info")) ?>
Modified: trunk/themes/default/templates/info.tmpl
===================================================================
--- trunk/themes/default/templates/info.tmpl 2022-04-19 14:36:33 UTC (rev 11022)
+++ trunk/themes/default/templates/info.tmpl 2022-04-19 14:38:46 UTC (rev 11023)
@@ -1,12 +1,15 @@
<?php
-if (empty($revision)) $revision = $page->getCurrentRevision(false);
+if (empty($revision)) {
+ $revision = $page->getCurrentRevision(false);
+}
$modified = $WikiTheme->formatDateTime($revision->get('mtime'));
$dbi = $request->getDbh();
$author = $revision->get('author');
$authorLink = $author;
-if ($dbi->isWikiPage($author))
+if ($dbi->isWikiPage($author)) {
$authorLink = WikiLink($author);
+}
$authorId = $revision->get('author_id');
$version = $revision->getVersion();
@@ -24,16 +27,16 @@
$size = ByteFormatter($bytes, /* $longformat = */true);
// Count words
preg_match_all('/\\w+\\W*/', $revision->_data['%content'], $whitespacematches);
-if (1 == ($c = count_all($whitespacematches)))
- $wordcount = fmt("1 word");
-else
- $wordcount = fmt("%s words", $c);
+if (1 == ($c = count_all($whitespacematches))) {
+ $wordcount = fmt("1 word");
+} else {
+ $wordcount = fmt("%s words", $c);
+}
$summary = $revision->get('summary');
if ($is_current = $revision->isCurrent()) {
-
$LOCKED_CB = HTML::input(array('type' => 'checkbox',
'name' => 'edit[locked]',
'id' => 'locked',
@@ -51,7 +54,6 @@
$label['date'] = _("Last Modified") . _(":");
$label['author'] = _("Last Author") . _(":");
$label['summary'] = _("Last Summary") . _(":");
-
} else {
$label['date'] = _("Saved on") . _(":");
$label['author'] = _("Author") . _(":");
Modified: trunk/themes/smaller/templates/info.tmpl
===================================================================
--- trunk/themes/smaller/templates/info.tmpl 2022-04-19 14:36:33 UTC (rev 11022)
+++ trunk/themes/smaller/templates/info.tmpl 2022-04-19 14:38:46 UTC (rev 11023)
@@ -5,8 +5,8 @@
<?php echo $SEP?><?php echo Button(__("PageHistory"), _("Page History")) ?>
<?php echo $SEP?><?php echo Button(__("AuthorHistory"), _("Author History")) ?>
<?php echo $SEP?><?php echo Button("Diff") ?>
- <?php echo $SEP?><?php echo Button(array('action'=>'diff','previous' => 'minor'),_("Diff previous Revision"),$page->getName()) ?>
- <?php echo $SEP?><?php echo Button(array('action'=>'diff','previous' => 'author'),_("Diff previous Author"),$page->getName()) ?>
+ <?php echo $SEP?><?php echo Button(array('action'=>'diff','previous' => 'minor'), _("Diff previous Revision"), $page->getName()) ?>
+ <?php echo $SEP?><?php echo Button(array('action'=>'diff','previous' => 'author'), _("Diff previous Author"), $page->getName()) ?>
<?php echo $SEP?><?php echo Button(__("PageDump"), _("Page Dump")) ?>
<?php if (DEBUG || $user->isAdmin()) { ?>
<?php // Buttons really only for debugging ?>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <var...@us...> - 2022-04-19 14:36:36
|
Revision: 11022
http://sourceforge.net/p/phpwiki/code/11022
Author: vargenau
Date: 2022-04-19 14:36:33 +0000 (Tue, 19 Apr 2022)
Log Message:
-----------
Whitespace, braces
Modified Paths:
--------------
trunk/themes/Crao/templates/signin.tmpl
trunk/themes/MonoBook/templates/signin.tmpl
trunk/themes/Sidebar/templates/signin.tmpl
trunk/themes/Wordpress/templates/signin.tmpl
trunk/themes/default/templates/signin.tmpl
trunk/themes/shamino_com/templates/signin.tmpl
trunk/themes/smaller/templates/signin.tmpl
Modified: trunk/themes/Crao/templates/signin.tmpl
===================================================================
--- trunk/themes/Crao/templates/signin.tmpl 2022-04-19 14:28:00 UTC (rev 11021)
+++ trunk/themes/Crao/templates/signin.tmpl 2022-04-19 14:36:33 UTC (rev 11022)
@@ -1,8 +1,9 @@
<?php
-if (empty($FORMNAME))
+if (empty($FORMNAME)) {
$FORMNAME = 'signin';
-else
+} else {
$NOFORM = true;
+}
?>
<?php if (empty($NOFORM)) { ?>
<form method="post" action="<?php echo $request->getPostURL() ?>" accept-charset="UTF-8" name="<?php echo $FORMNAME?>">
Modified: trunk/themes/MonoBook/templates/signin.tmpl
===================================================================
--- trunk/themes/MonoBook/templates/signin.tmpl 2022-04-19 14:28:00 UTC (rev 11021)
+++ trunk/themes/MonoBook/templates/signin.tmpl 2022-04-19 14:36:33 UTC (rev 11022)
@@ -5,10 +5,10 @@
<ul>
<?php if ($user->isAuthenticated()) { ?>
<li id="pt-userpage"><?php echo WikiLink($id, 'auto') ?></li>
- <li><?php echo WikiLink($id . "/Discussion", 'auto' , _("My Discussion")) ?></li>
+ <li><?php echo WikiLink($id . "/Discussion", 'auto', _("My Discussion")) ?></li>
<li><?php echo WikiLink(__("UserPreferences"), "", _("My Preferences")) ?></li>
<li><?php echo WikiLink(__("MyRecentChanges"), "", _("My Changes")) ?></li>
- <li><?php echo HTML::a(array('href'=>'?'.urlencode('auth[logout]').'=1'),$sp,_("Logout"),$sp) ?></li>
+ <li><?php echo HTML::a(array('href'=>'?'.urlencode('auth[logout]').'=1'), $sp, _("Logout"), $sp) ?></li>
<?php } else {
if ($id) { ?>
<li id="pt-userpage"><?php echo WikiLink($id, 'auto') ?></li>
Modified: trunk/themes/Sidebar/templates/signin.tmpl
===================================================================
--- trunk/themes/Sidebar/templates/signin.tmpl 2022-04-19 14:28:00 UTC (rev 11021)
+++ trunk/themes/Sidebar/templates/signin.tmpl 2022-04-19 14:36:33 UTC (rev 11022)
@@ -3,10 +3,10 @@
<ul>
<?php if ($user->isAuthenticated()) {
$sp = HTML::raw(" "); $id = $user->getAuthenticatedId(); ?>
- <li id="pt-mypages"><?php echo WikiLink(__("RecentChangesMyPages"), 'auto', HTML($sp,"MyPages",$sp)) ?></li>
- <li id="pt-mychanges"><?php echo WikiLink(__("MyRecentChanges"), 'auto', HTML($sp,"MyChanges",$sp)) ?></li>
+ <li id="pt-mypages"><?php echo WikiLink(__("RecentChangesMyPages"), 'auto', HTML($sp, "MyPages", $sp)) ?></li>
+ <li id="pt-mychanges"><?php echo WikiLink(__("MyRecentChanges"), 'auto', HTML($sp, "MyChanges", $sp)) ?></li>
<li id="pt-userpage"><?php echo WikiLink($id, 'auto') ?></li>
- <li id="pt-logout"><?php echo HTML::a(array('href'=>'?'.urlencode('auth[logout]').'=1'), $sp,_("Logout"),$sp) ?></li>
+ <li id="pt-logout"><?php echo HTML::a(array('href'=>'?'.urlencode('auth[logout]').'=1'), $sp, _("Logout"), $sp) ?></li>
<?php } elseif (ALLOW_ANON_USER) {
$sp = HTML::raw(" "); $id = $user->getAuthenticatedId();
if ($id) { ?>
Modified: trunk/themes/Wordpress/templates/signin.tmpl
===================================================================
--- trunk/themes/Wordpress/templates/signin.tmpl 2022-04-19 14:28:00 UTC (rev 11021)
+++ trunk/themes/Wordpress/templates/signin.tmpl 2022-04-19 14:36:33 UTC (rev 11022)
@@ -1,8 +1,9 @@
<?php
-if (empty($FORMNAME))
+if (empty($FORMNAME)) {
$FORMNAME = 'signin';
-else
+} else {
$NOFORM = true;
+}
?>
<?php if (empty($NOFORM)) { ?>
<li>
Modified: trunk/themes/default/templates/signin.tmpl
===================================================================
--- trunk/themes/default/templates/signin.tmpl 2022-04-19 14:28:00 UTC (rev 11021)
+++ trunk/themes/default/templates/signin.tmpl 2022-04-19 14:36:33 UTC (rev 11022)
@@ -1,8 +1,9 @@
<?php
-if (empty($FORMNAME))
+if (empty($FORMNAME)) {
$FORMNAME = 'signin';
-else
+} else {
$NOFORM = true;
+}
?>
<?php if (empty($NOFORM)) { ?>
<form method="post" action="<?php echo $request->getPostURL() ?>" accept-charset="UTF-8" name="<?php echo $FORMNAME?>">
@@ -27,23 +28,23 @@
<?php echo Button("submit:auth[logout]", _("Sign Out"), 'wikiaction') ?>
</noscript>
<?php } else {
- $SignInInput = HTML::input(array('type' => 'text',
- 'name' => "auth[userid]",
- 'size' => 12,
- 'maxlength' => 256,
- 'onchange' => "SignIn(this.form,false);"));
- $SignInInput->addTooltip(_("Enter your UserId to sign in"));
- $userid = $user->getId();
- if ($user->isSignedIn()) {
- echo sprintf(_("You are signed but not authenticated as %s. "),
- asXML(HTML::a(array(
- 'href'=>'#',
- 'title' => sprintf(_("Click to authenticate as %s"),$userid),
- 'onclick'=>'SignIn(document.forms["'.$FORMNAME.'"],"'.$userid.'");'),
+ $SignInInput = HTML::input(array('type' => 'text',
+ 'name' => "auth[userid]",
+ 'size' => 12,
+ 'maxlength' => 256,
+ 'onchange' => "SignIn(this.form,false);"));
+ $SignInInput->addTooltip(_("Enter your UserId to sign in"));
+ $userid = $user->getId();
+ if ($user->isSignedIn()) {
+ echo sprintf(_("You are signed but not authenticated as %s. "),
+ asXML(HTML::a(array(
+ 'href'=>'#',
+ 'title' => sprintf(_("Click to authenticate as %s"),$userid),
+ 'onclick'=>'SignIn(document.forms["'.$FORMNAME.'"],"'.$userid.'");'),
$userid)));
- }
- $editing_policy = (defined('EDITING_POLICY') and $request->_dbi->isWikiPage(EDITING_POLICY));
- $SignInJS = JavaScript('
+ }
+ $editing_policy = (defined('EDITING_POLICY') and $request->_dbi->isWikiPage(EDITING_POLICY));
+ $SignInJS = JavaScript('
function SignIn(form,userid) {
if (userid) {
form.elements["auth[userid]"].value = userid;
Modified: trunk/themes/shamino_com/templates/signin.tmpl
===================================================================
--- trunk/themes/shamino_com/templates/signin.tmpl 2022-04-19 14:28:00 UTC (rev 11021)
+++ trunk/themes/shamino_com/templates/signin.tmpl 2022-04-19 14:36:33 UTC (rev 11022)
@@ -1,8 +1,9 @@
<?php
-if (empty($FORMNAME))
+if (empty($FORMNAME)) {
$FORMNAME = 'signin';
-else
+} else {
$NOFORM = true;
+}
?>
<?php if (empty($NOFORM)) { ?>
<form method="post" action="<?php echo $request->getPostURL() ?>" accept-charset="UTF-8" name="<?php echo $FORMNAME?>">
Modified: trunk/themes/smaller/templates/signin.tmpl
===================================================================
--- trunk/themes/smaller/templates/signin.tmpl 2022-04-19 14:28:00 UTC (rev 11021)
+++ trunk/themes/smaller/templates/signin.tmpl 2022-04-19 14:36:33 UTC (rev 11022)
@@ -1,8 +1,9 @@
<?php
-if (empty($FORMNAME))
+if (empty($FORMNAME)) {
$FORMNAME = 'signin';
-else
+} else {
$NOFORM = true;
+}
?>
<?php if (empty($NOFORM)) { ?>
<form style="display:inline" method="post" action="<?php echo $request->getPostURL() ?>" accept-charset="UTF-8" name="<?php echo $FORMNAME?>">
@@ -25,17 +26,17 @@
<?php echo Button("submit:auth[logout]", _("Sign Out"), 'wikiaction') ?>
</noscript>
<?php } else {
- $SignInInput = HTML::input(array('type' => 'text',
- 'name' => "auth[userid]",
- 'size' => 12,
- 'maxlength' => 256,
- 'onchange' => "SignIn(this.form,false);"));
- if ($user->isSignedIn()) {
- $SignInInput->setAttr('value', $user->getId());
- }
- $SignInInput->addTooltip(_("Enter your UserId to sign in"));
- $editing_policy = (defined('EDITING_POLICY') and $request->_dbi->isWikiPage(EDITING_POLICY));
- $SignInJS = JavaScript('
+ $SignInInput = HTML::input(array('type' => 'text',
+ 'name' => "auth[userid]",
+ 'size' => 12,
+ 'maxlength' => 256,
+ 'onchange' => "SignIn(this.form,false);"));
+ if ($user->isSignedIn()) {
+ $SignInInput->setAttr('value', $user->getId());
+ }
+ $SignInInput->addTooltip(_("Enter your UserId to sign in"));
+ $editing_policy = (defined('EDITING_POLICY') and $request->_dbi->isWikiPage(EDITING_POLICY));
+ $SignInJS = JavaScript('
function SignIn(form,userid) {
if (userid) {
form.elements["auth[userid]"].value = userid;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <var...@us...> - 2022-04-19 14:28:03
|
Revision: 11021
http://sourceforge.net/p/phpwiki/code/11021
Author: vargenau
Date: 2022-04-19 14:28:00 +0000 (Tue, 19 Apr 2022)
Log Message:
-----------
Whitespace
Modified Paths:
--------------
trunk/themes/Crao/templates/body.tmpl
trunk/themes/MonoBook/templates/body.tmpl
trunk/themes/Portland/templates/body.tmpl
trunk/themes/Sidebar/templates/body.tmpl
trunk/themes/Wordpress/templates/body.tmpl
trunk/themes/blog/templates/body.tmpl
trunk/themes/default/templates/body.tmpl
trunk/themes/fusionforge/templates/body.tmpl
trunk/themes/wikilens/templates/body.tmpl
Modified: trunk/themes/Crao/templates/body.tmpl
===================================================================
--- trunk/themes/Crao/templates/body.tmpl 2022-04-19 14:23:13 UTC (rev 11020)
+++ trunk/themes/Crao/templates/body.tmpl 2022-04-19 14:28:00 UTC (rev 11021)
@@ -15,16 +15,16 @@
<?php
$action = $request->getArg('action');
if ($page->exists()) {
- if (empty($revision)) {
- $revision = $page->getCurrentRevision(false);
- }
- if (($action == 'edit') && $page->get('locked') && !$user->isAdmin()) { ?>
+ if (empty($revision)) {
+ $revision = $page->getCurrentRevision(false);
+ }
+ if (($action == 'edit') && $page->get('locked') && !$user->isAdmin()) { ?>
<p class="warning_msg"><strong><?php echo _("Note:") ?></strong>
<?php echo _("This page has been locked and cannot be edited.") ?>
</p>
<?php
}
- if (($action != 'edit') && ($action != 'revert')
+ if (($action != 'edit') && ($action != 'revert')
&& $revision and !$revision->isCurrent()) {
if ($revision->hasDefaultContents()) { ?>
<p class="error">
Modified: trunk/themes/MonoBook/templates/body.tmpl
===================================================================
--- trunk/themes/MonoBook/templates/body.tmpl 2022-04-19 14:23:13 UTC (rev 11020)
+++ trunk/themes/MonoBook/templates/body.tmpl 2022-04-19 14:28:00 UTC (rev 11021)
@@ -9,16 +9,16 @@
<?php
$action = $request->getArg('action');
if ($page->exists()) {
- if (empty($revision)) {
- $revision = $page->getCurrentRevision(false);
- }
- if (($action == 'edit') && $page->get('locked') && !$user->isAdmin()) { ?>
+ if (empty($revision)) {
+ $revision = $page->getCurrentRevision(false);
+ }
+ if (($action == 'edit') && $page->get('locked') && !$user->isAdmin()) { ?>
<p class="warning_msg"><strong><?php echo _("Note:") ?></strong>
<?php echo _("This page has been locked and cannot be edited.") ?>
</p>
<?php
}
- if (($action != 'edit') && ($action != 'revert')
+ if (($action != 'edit') && ($action != 'revert')
&& $revision and !$revision->isCurrent()) {
if ($revision->hasDefaultContents()) { ?>
<p class="error">
Modified: trunk/themes/Portland/templates/body.tmpl
===================================================================
--- trunk/themes/Portland/templates/body.tmpl 2022-04-19 14:23:13 UTC (rev 11020)
+++ trunk/themes/Portland/templates/body.tmpl 2022-04-19 14:28:00 UTC (rev 11021)
@@ -10,16 +10,16 @@
<?php
$action = $request->getArg('action');
if ($page->exists()) {
- if (empty($revision)) {
- $revision = $page->getCurrentRevision(false);
- }
- if (($action == 'edit') && $page->get('locked') && !$user->isAdmin()) { ?>
+ if (empty($revision)) {
+ $revision = $page->getCurrentRevision(false);
+ }
+ if (($action == 'edit') && $page->get('locked') && !$user->isAdmin()) { ?>
<p class="warning_msg"><strong><?php echo _("Note:") ?></strong>
<?php echo _("This page has been locked and cannot be edited.") ?>
</p>
<?php
}
- if (($action != 'edit') && ($action != 'revert')
+ if (($action != 'edit') && ($action != 'revert')
&& $revision and !$revision->isCurrent()) {
if ($revision->hasDefaultContents()) { ?>
<p class="error">
Modified: trunk/themes/Sidebar/templates/body.tmpl
===================================================================
--- trunk/themes/Sidebar/templates/body.tmpl 2022-04-19 14:23:13 UTC (rev 11020)
+++ trunk/themes/Sidebar/templates/body.tmpl 2022-04-19 14:28:00 UTC (rev 11021)
@@ -7,16 +7,16 @@
<?php
$action = $request->getArg('action');
if ($page->exists()) {
- if (empty($revision)) {
- $revision = $page->getCurrentRevision(false);
- }
- if (($action == 'edit') && $page->get('locked') && !$user->isAdmin()) { ?>
+ if (empty($revision)) {
+ $revision = $page->getCurrentRevision(false);
+ }
+ if (($action == 'edit') && $page->get('locked') && !$user->isAdmin()) { ?>
<p class="warning_msg"><strong><?php echo _("Note:") ?></strong>
<?php echo _("This page has been locked and cannot be edited.") ?>
</p>
<?php
}
- if (($action != 'edit') && ($action != 'revert')
+ if (($action != 'edit') && ($action != 'revert')
&& $revision and !$revision->isCurrent()) {
if ($revision->hasDefaultContents()) { ?>
<p class="error">
Modified: trunk/themes/Wordpress/templates/body.tmpl
===================================================================
--- trunk/themes/Wordpress/templates/body.tmpl 2022-04-19 14:23:13 UTC (rev 11020)
+++ trunk/themes/Wordpress/templates/body.tmpl 2022-04-19 14:28:00 UTC (rev 11021)
@@ -6,16 +6,16 @@
<?php
$action = $request->getArg('action');
if ($page->exists()) {
- if (empty($revision)) {
- $revision = $page->getCurrentRevision(false);
- }
- if (($action == 'edit') && $page->get('locked') && !$user->isAdmin()) { ?>
+ if (empty($revision)) {
+ $revision = $page->getCurrentRevision(false);
+ }
+ if (($action == 'edit') && $page->get('locked') && !$user->isAdmin()) { ?>
<p class="warning_msg"><strong><?php echo _("Note:") ?></strong>
<?php echo _("This page has been locked and cannot be edited.") ?>
</p>
<?php
}
- if (($action != 'edit') && ($action != 'revert')
+ if (($action != 'edit') && ($action != 'revert')
&& $revision and !$revision->isCurrent()) {
if ($revision->hasDefaultContents()) { ?>
<p class="error">
Modified: trunk/themes/blog/templates/body.tmpl
===================================================================
--- trunk/themes/blog/templates/body.tmpl 2022-04-19 14:23:13 UTC (rev 11020)
+++ trunk/themes/blog/templates/body.tmpl 2022-04-19 14:28:00 UTC (rev 11021)
@@ -7,16 +7,16 @@
<?php
$action = $request->getArg('action');
if ($page->exists()) {
- if (empty($revision)) {
- $revision = $page->getCurrentRevision(false);
- }
- if (($action == 'edit') && $page->get('locked') && !$user->isAdmin()) { ?>
+ if (empty($revision)) {
+ $revision = $page->getCurrentRevision(false);
+ }
+ if (($action == 'edit') && $page->get('locked') && !$user->isAdmin()) { ?>
<p class="warning_msg"><strong><?php echo _("Note:") ?></strong>
<?php echo _("This page has been locked and cannot be edited.") ?>
</p>
<?php
}
- if (($action != 'edit') && ($action != 'revert')
+ if (($action != 'edit') && ($action != 'revert')
&& $revision and !$revision->isCurrent()) {
if ($revision->hasDefaultContents()) { ?>
<p class="error">
Modified: trunk/themes/default/templates/body.tmpl
===================================================================
--- trunk/themes/default/templates/body.tmpl 2022-04-19 14:23:13 UTC (rev 11020)
+++ trunk/themes/default/templates/body.tmpl 2022-04-19 14:28:00 UTC (rev 11021)
@@ -8,16 +8,16 @@
<?php
$action = $request->getArg('action');
if ($page->exists()) {
- if (empty($revision)) {
- $revision = $page->getCurrentRevision(false);
- }
- if (($action == 'edit') && $page->get('locked') && !$user->isAdmin()) { ?>
+ if (empty($revision)) {
+ $revision = $page->getCurrentRevision(false);
+ }
+ if (($action == 'edit') && $page->get('locked') && !$user->isAdmin()) { ?>
<p class="warning_msg"><strong><?php echo _("Note:") ?></strong>
<?php echo _("This page has been locked and cannot be edited.") ?>
</p>
<?php
}
- if (($action != 'edit') && ($action != 'revert')
+ if (($action != 'edit') && ($action != 'revert')
&& $revision and !$revision->isCurrent()) {
if ($revision->hasDefaultContents()) { ?>
<p class="error">
Modified: trunk/themes/fusionforge/templates/body.tmpl
===================================================================
--- trunk/themes/fusionforge/templates/body.tmpl 2022-04-19 14:23:13 UTC (rev 11020)
+++ trunk/themes/fusionforge/templates/body.tmpl 2022-04-19 14:28:00 UTC (rev 11021)
@@ -9,10 +9,11 @@
<?php } ?>
<div id="content">
<?php
-if (ENABLE_RATEIT && $page->exists())
- $rating = 1;
-else
+if (ENABLE_RATEIT && $page->exists()) {
+ $rating = 1;
+ } else {
$rating = 0;
+}
?>
<a id="contentTop"></a>
<h1>
Modified: trunk/themes/wikilens/templates/body.tmpl
===================================================================
--- trunk/themes/wikilens/templates/body.tmpl 2022-04-19 14:23:13 UTC (rev 11020)
+++ trunk/themes/wikilens/templates/body.tmpl 2022-04-19 14:28:00 UTC (rev 11021)
@@ -23,24 +23,24 @@
<main role="main">
<h1><?php echo $HEADER ?>
<?php if (!empty($user) && $user->isSignedIn()) {
- $loader = new WikiPluginLoader();
- printXML(HTML::raw(" "));
- $dbi = $request->getDbh(); // Needed in PHP 8
- printXML($loader->expandPI("<"."?plugin RateIt ?".">", $request, $dbi->_markup));
- } ?> </h1>
+ $loader = new WikiPluginLoader();
+ printXML(HTML::raw(" "));
+ $dbi = $request->getDbh(); // Needed in PHP 8
+ printXML($loader->expandPI("<"."?plugin RateIt ?".">", $request, $dbi->_markup));
+} ?> </h1>
<?php
$action = $request->getArg('action');
if ($page->exists()) {
- if (empty($revision)) {
- $revision = $page->getCurrentRevision(false);
- }
- if (($action == 'edit') && $page->get('locked') && !$user->isAdmin()) { ?>
+ if (empty($revision)) {
+ $revision = $page->getCurrentRevision(false);
+ }
+ if (($action == 'edit') && $page->get('locked') && !$user->isAdmin()) { ?>
<p class="warning_msg"><strong><?php echo _("Note:") ?></strong>
<?php echo _("This page has been locked and cannot be edited.") ?>
</p>
<?php
}
- if (($action != 'edit') && ($action != 'revert')
+ if (($action != 'edit') && ($action != 'revert')
&& $revision and !$revision->isCurrent()) {
if ($revision->hasDefaultContents()) { ?>
<p class="error">
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <var...@us...> - 2022-04-19 14:23:16
|
Revision: 11020
http://sourceforge.net/p/phpwiki/code/11020
Author: vargenau
Date: 2022-04-19 14:23:13 +0000 (Tue, 19 Apr 2022)
Log Message:
-----------
Whitespace, braces
Modified Paths:
--------------
trunk/themes/default/templates/head.tmpl
trunk/themes/wikilens/templates/head.tmpl
Modified: trunk/themes/default/templates/head.tmpl
===================================================================
--- trunk/themes/default/templates/head.tmpl 2022-04-19 14:18:34 UTC (rev 11019)
+++ trunk/themes/default/templates/head.tmpl 2022-04-19 14:23:13 UTC (rev 11020)
@@ -27,12 +27,12 @@
$args = $request->getArgs();
$action = empty($args['action']) ? 'browse' : $args['action'];
if (!($action == "viewsource")) {
- $alternatelinkTitle = fmt("%s: %s", _("View Source"), $page->getName());
- $alternatelinkUrl = WikiURL($revision, array('action' => 'viewsource'));
+ $alternatelinkTitle = fmt("%s: %s", _("View Source"), $page->getName());
+ $alternatelinkUrl = WikiURL($revision, array('action' => 'viewsource'));
}
if (!($action == "browse")) {
- $alternatelinkTitle = $page->getName();
- $alternatelinkUrl = WikiURL($revision, array('action' => 'browse'));
+ $alternatelinkTitle = $page->getName();
+ $alternatelinkUrl = WikiURL($revision, array('action' => 'browse'));
} ?>
<link rel="alternate" title="<?php echo $alternatelinkTitle ?>" href="<?php echo $alternatelinkUrl ?>" />
<?php }
@@ -50,7 +50,7 @@
<?php if (!$user->isSignedIn()) {
/* For users not signed in */ ?>
<?php } ?>
-<link rel="alternate" type="application/x-wiki" title="Edit this page!" href="<?php echo WikiURL($page,array('action'=>'edit')) ?>" />
+<link rel="alternate" type="application/x-wiki" title="Edit this page!" href="<?php echo WikiURL($page, array('action'=>'edit')) ?>" />
<?php if ($user->isAdmin()) {
/* Only for the Administrator */ ?>
<?php } ?>
@@ -73,10 +73,11 @@
<?php echo $WikiTheme->getCSS() ?>
<?php
// avoid redundant bookmark title for custom home page
- if ($page->getName() == WIKI_NAME && HOME_PAGE == WIKI_NAME)
+ if ($page->getName() == WIKI_NAME && HOME_PAGE == WIKI_NAME) {
$pagetitle = "";
- else
+ } else {
$pagetitle = " - ". AsString($TITLE);
+ }
?>
<title><?php echo WIKI_NAME.$pagetitle ?></title>
<?php if (ENABLE_OPEN_GRAPH) { ?>
Modified: trunk/themes/wikilens/templates/head.tmpl
===================================================================
--- trunk/themes/wikilens/templates/head.tmpl 2022-04-19 14:18:34 UTC (rev 11019)
+++ trunk/themes/wikilens/templates/head.tmpl 2022-04-19 14:23:13 UTC (rev 11020)
@@ -27,12 +27,12 @@
$args = $request->getArgs();
$action = empty($args['action']) ? 'browse' : $args['action'];
if (!($action == "viewsource")) {
- $alternatelinkTitle = fmt("%s: %s", _("View Source"), $page->getName());
- $alternatelinkUrl = WikiURL($revision, array('action' => 'viewsource'));
+ $alternatelinkTitle = fmt("%s: %s", _("View Source"), $page->getName());
+ $alternatelinkUrl = WikiURL($revision, array('action' => 'viewsource'));
}
if (!($action == "browse")) {
- $alternatelinkTitle = $page->getName();
- $alternatelinkUrl = WikiURL($revision, array('action' => 'browse'));
+ $alternatelinkTitle = $page->getName();
+ $alternatelinkUrl = WikiURL($revision, array('action' => 'browse'));
} ?>
<link rel="alternate" title="<?php echo $alternatelinkTitle ?>" href="<?php echo $alternatelinkUrl ?>" />
<?php }
@@ -50,7 +50,7 @@
<?php if (!$user->isSignedIn()) {
/* For users not signed in */ ?>
<?php } ?>
-<link rel="alternate" type="application/x-wiki" title="Edit this page!" href="<?php echo WikiURL($page,array('action'=>'edit')) ?>" />
+<link rel="alternate" type="application/x-wiki" title="Edit this page!" href="<?php echo WikiURL($page, array('action'=>'edit')) ?>" />
<?php if ($user->isAdmin()) {
/* Only for the Administrator */ ?>
<?php } ?>
@@ -73,10 +73,11 @@
<?php echo $WikiTheme->getCSS() ?>
<?php
// avoid redundant bookmark title for custom home page
- if ($page->getName() == WIKI_NAME && HOME_PAGE == WIKI_NAME)
+ if ($page->getName() == WIKI_NAME && HOME_PAGE == WIKI_NAME) {
$pagetitle = "";
- else
+ } else {
$pagetitle = " - ". AsString($TITLE);
+ }
?>
<title><?php echo WIKI_NAME.$pagetitle ?></title>
<?php if (ENABLE_OPEN_GRAPH) { ?>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <var...@us...> - 2022-04-19 14:18:37
|
Revision: 11019
http://sourceforge.net/p/phpwiki/code/11019
Author: vargenau
Date: 2022-04-19 14:18:34 +0000 (Tue, 19 Apr 2022)
Log Message:
-----------
Whitespace
Modified Paths:
--------------
trunk/themes/MonoBook/templates/navbar.tmpl
trunk/themes/blog/templates/navbar.tmpl
trunk/themes/default/templates/navbar.tmpl
trunk/themes/wikilens/templates/navbar.tmpl
Modified: trunk/themes/MonoBook/templates/navbar.tmpl
===================================================================
--- trunk/themes/MonoBook/templates/navbar.tmpl 2022-04-19 14:15:16 UTC (rev 11018)
+++ trunk/themes/MonoBook/templates/navbar.tmpl 2022-04-19 14:18:34 UTC (rev 11019)
@@ -14,9 +14,9 @@
<li><?php $link = WikiLink(__("RecentChanges"), "", _("Recent Changes")); $link->addTooltip(_("The list of recent changes in the wiki.")); ?><?php echo $link ?></li>
<li><?php echo WikiLink(__("RecentComments"), "", _("Recent Comments")) ?></li>
<li><?php echo WikiLink(__("RecentNewPages"), "", _("Recent New Pages")) ?></li>
- <li><?php echo Button(array('action'=>__("LikePages")),_("Like Pages"), $page->getName()) ?></li>
+ <li><?php echo Button(array('action'=>__("LikePages")), _("Like Pages"), $page->getName()) ?></li>
<li><?php echo WikiLink(__("RandomPage"), "", _("Random Page")) ?></li>
- <li><?php echo WikiLink(__("Help"),"", _("Help")) ?></li>
+ <li><?php echo WikiLink(__("Help"), "", _("Help")) ?></li>
</ul>
</div>
</div>
Modified: trunk/themes/blog/templates/navbar.tmpl
===================================================================
--- trunk/themes/blog/templates/navbar.tmpl 2022-04-19 14:15:16 UTC (rev 11018)
+++ trunk/themes/blog/templates/navbar.tmpl 2022-04-19 14:18:34 UTC (rev 11019)
@@ -7,7 +7,7 @@
<div class="box-data">
<ul>
<?php if (!empty($revision)) { ?>
-<li><?php echo WikiLink(__("BackLinks"), "button",_("Back Links")) ?></li>
+<li><?php echo WikiLink(__("BackLinks"), "button", _("Back Links")) ?></li>
<?php } ?>
<?php if (!empty($user) && $user->isAdmin()) { ?>
<li><?php echo WikiLink(__("PhpWikiAdministration"), "button", _("Administration")) ?></li>
Modified: trunk/themes/default/templates/navbar.tmpl
===================================================================
--- trunk/themes/default/templates/navbar.tmpl 2022-04-19 14:15:16 UTC (rev 11018)
+++ trunk/themes/default/templates/navbar.tmpl 2022-04-19 14:18:34 UTC (rev 11019)
@@ -7,7 +7,7 @@
<?php echo $SEP?><?php echo WikiLink(new WikiPagename('Talk:'.$page->getName(), $page->getName()),
'button', _("Discussion")) ?>
<?php } else { ?>
- <?php echo $SEP?><?php echo Button(array(),_("Article"), $page->getName()) ?>
+ <?php echo $SEP?><?php echo Button(array(), _("Article"), $page->getName()) ?>
<?php } ?>
<?php echo $SEP?>
<?php } ?>
@@ -16,8 +16,8 @@
array('SEARCH_BEFORE' => HTML::button(_("FindPage"))))
?>
<?php if (!empty($revision)) { ?>
-<?php echo $SEP?><?php echo $WikiTheme->makeLinkButton($revision,_("LikePages"), __("LikePages")) ?>
-<?php echo $SEP?><?php echo $WikiTheme->makeLinkButton($revision,_("BackLinks"), __("BackLinks")) ?>
+<?php echo $SEP?><?php echo $WikiTheme->makeLinkButton($revision, _("LikePages"), __("LikePages")) ?>
+<?php echo $SEP?><?php echo $WikiTheme->makeLinkButton($revision, _("BackLinks"), __("BackLinks")) ?>
<?php } ?>
<?php if (!empty($user) && $user->isSignedIn()) { ?>
<?php echo $SEP?>
@@ -44,7 +44,7 @@
$p = $links->next();
$s = $p->_pagename;
while ($p = $links->next()) { $s .= ', ' . $p->_pagename; }
- echo asXML(HTML::strong("PageLinks: "),$s ? HTML::em($s) : HTML::em('<none>'));
+ echo asXML(HTML::strong("PageLinks: "), $s ? HTML::em($s) : HTML::em('<none>'));
}
} ?>
</nav>
Modified: trunk/themes/wikilens/templates/navbar.tmpl
===================================================================
--- trunk/themes/wikilens/templates/navbar.tmpl 2022-04-19 14:15:16 UTC (rev 11018)
+++ trunk/themes/wikilens/templates/navbar.tmpl 2022-04-19 14:18:34 UTC (rev 11019)
@@ -36,7 +36,7 @@
$p = $links->next();
$s = $p->_pagename;
while ($p = $links->next()) { $s .= ', ' . $p->_pagename; }
- echo asXML(HTML::strong("PageLinks: "),$s ? HTML::em($s) : HTML::em('<none>'));
+ echo asXML(HTML::strong("PageLinks: "), $s ? HTML::em($s) : HTML::em('<none>'));
}
} ?>
</div>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <var...@us...> - 2022-04-19 14:15:18
|
Revision: 11018
http://sourceforge.net/p/phpwiki/code/11018
Author: vargenau
Date: 2022-04-19 14:15:16 +0000 (Tue, 19 Apr 2022)
Log Message:
-----------
Whitespace
Modified Paths:
--------------
trunk/themes/fusionforge/templates/ratings.tmpl
trunk/themes/wikilens/templates/ratings.tmpl
Modified: trunk/themes/fusionforge/templates/ratings.tmpl
===================================================================
--- trunk/themes/fusionforge/templates/ratings.tmpl 2022-04-19 13:41:30 UTC (rev 11017)
+++ trunk/themes/fusionforge/templates/ratings.tmpl 2022-04-19 14:15:16 UTC (rev 11018)
@@ -1,5 +1,5 @@
<?php if (!$WikiTheme->DUMP_MODE) {
- $loader = new WikiPluginLoader();
- $dbi = $request->getDbh(); // Needed in PHP 8
- printXML($loader->expandPI("<"."?plugin RateIt show=top imgPrefix=BStar ?".">", $request, $dbi->_markup));
+ $loader = new WikiPluginLoader();
+ $dbi = $request->getDbh(); // Needed in PHP 8
+ printXML($loader->expandPI("<"."?plugin RateIt show=top imgPrefix=BStar ?".">", $request, $dbi->_markup));
} ?>
Modified: trunk/themes/wikilens/templates/ratings.tmpl
===================================================================
--- trunk/themes/wikilens/templates/ratings.tmpl 2022-04-19 13:41:30 UTC (rev 11017)
+++ trunk/themes/wikilens/templates/ratings.tmpl 2022-04-19 14:15:16 UTC (rev 11018)
@@ -1,5 +1,5 @@
<?php if (!$WikiTheme->DUMP_MODE) {
- $loader = new WikiPluginLoader();
- $dbi = $request->getDbh(); // Needed in PHP 8
- printXML($loader->expandPI("<"."?plugin RateIt show=top imgPrefix=BStar ?".">", $request, $dbi->_markup));
+ $loader = new WikiPluginLoader();
+ $dbi = $request->getDbh(); // Needed in PHP 8
+ printXML($loader->expandPI("<"."?plugin RateIt show=top imgPrefix=BStar ?".">", $request, $dbi->_markup));
} ?>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <var...@us...> - 2022-04-19 13:41:32
|
Revision: 11017
http://sourceforge.net/p/phpwiki/code/11017
Author: vargenau
Date: 2022-04-19 13:41:30 +0000 (Tue, 19 Apr 2022)
Log Message:
-----------
Add PhpWiki version in PhpWikiManual
Modified Paths:
--------------
trunk/pgsrc/PhpWikiManual
Modified: trunk/pgsrc/PhpWikiManual
===================================================================
--- trunk/pgsrc/PhpWikiManual 2022-03-29 17:41:10 UTC (rev 11016)
+++ trunk/pgsrc/PhpWikiManual 2022-04-19 13:41:30 UTC (rev 11017)
@@ -1,4 +1,4 @@
-Date: Mon, 28 Dec 2020 19:46:14 +0000
+Date: Tue, 19 Apr 2022 15:40:30 +0000
Mime-Version: 1.0 (Produced by PhpWiki 1.6.1)
Content-Type: application/x-phpwiki;
pagename=PhpWikiManual;
@@ -6,6 +6,8 @@
charset=UTF-8
Content-Transfer-Encoding: binary
+This is the user manual for ~PhpWiki 1.6.2.
+
<<IncludePage page="Help/PhpWiki">>
<<IncludePage page="Help/WikiWikiWeb">>
<<IncludePage page="Help/Steve Wainstead">>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <var...@us...> - 2022-03-29 17:41:12
|
Revision: 11016
http://sourceforge.net/p/phpwiki/code/11016
Author: vargenau
Date: 2022-03-29 17:41:10 +0000 (Tue, 29 Mar 2022)
Log Message:
-----------
poweredby_phpwiki_82x31.png: unused image
Removed Paths:
-------------
trunk/themes/default/images/poweredby_phpwiki_82x31.png
Deleted: trunk/themes/default/images/poweredby_phpwiki_82x31.png
===================================================================
(Binary files differ)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <var...@us...> - 2022-03-24 13:58:57
|
Revision: 11015
http://sourceforge.net/p/phpwiki/code/11015
Author: vargenau
Date: 2022-03-24 13:58:54 +0000 (Thu, 24 Mar 2022)
Log Message:
-----------
run php-cs-fixer
Modified Paths:
--------------
trunk/RPC2.php
trunk/SOAP.php
trunk/configurator.php
trunk/getimg.php
trunk/index.php
trunk/passencrypt.php
trunk/themes/Crao/themeinfo.php
trunk/themes/Hawaiian/lib/random.php
trunk/themes/Hawaiian/themeinfo.php
trunk/themes/MacOSX/buttons/index.php
trunk/themes/MacOSX/lib/RecentChanges.php
trunk/themes/MacOSX/themeinfo.php
trunk/themes/MonoBook/themeinfo.php
trunk/themes/Portland/lib/RecentChanges.php
trunk/themes/Portland/themeinfo.php
trunk/themes/Sidebar/hyperapplet.php
trunk/themes/Sidebar/themeinfo.php
trunk/themes/SpaceWiki/lib/RecentChanges.php
trunk/themes/SpaceWiki/themeinfo.php
trunk/themes/Wordpress/lib/RecentChanges.php
trunk/themes/Wordpress/themeinfo.php
trunk/themes/alphatest.php
trunk/themes/blog/jscalendar/calendar.php
trunk/themes/blog/jscalendar/test.php
trunk/themes/blog/lib/RecentChanges.php
trunk/themes/blog/themeinfo.php
trunk/themes/fusionforge/themeinfo.php
trunk/themes/shamino_com/themeinfo.php
trunk/themes/smaller/themeinfo.php
trunk/themes/wikilens/themeinfo.php
trunk/uploads/index.php
Modified: trunk/RPC2.php
===================================================================
--- trunk/RPC2.php 2022-03-24 13:49:51 UTC (rev 11014)
+++ trunk/RPC2.php 2022-03-24 13:58:54 UTC (rev 11015)
@@ -34,8 +34,9 @@
*/
// Intercept GET requests from confused users. Only POST is allowed here!
-if (empty($GLOBALS['HTTP_SERVER_VARS']))
+if (empty($GLOBALS['HTTP_SERVER_VARS'])) {
$GLOBALS['HTTP_SERVER_VARS'] =& $_SERVER;
+}
if ($_SERVER['REQUEST_METHOD'] != "POST") {
die('This is the address of the XML-RPC interface.' .
' You must use XML-RPC calls to access information here.');
@@ -42,7 +43,7 @@
}
// Constant defined to indicate to phpwiki that it is being accessed via XML-RPC
-define ("WIKI_XMLRPC", true);
+define("WIKI_XMLRPC", true);
// Start up the main code
include_once 'index.php';
Modified: trunk/SOAP.php
===================================================================
--- trunk/SOAP.php 2022-03-24 13:49:51 UTC (rev 11014)
+++ trunk/SOAP.php 2022-03-24 13:58:54 UTC (rev 11015)
@@ -40,8 +40,8 @@
* @author: Marc-Etienne Vargenau
* Rewrite with native PHP 5 SOAP
*/
-define ("WIKI_SOAP", true);
-define ("PHPWIKI_NOMAIN", true);
+define("WIKI_SOAP", true);
+define("PHPWIKI_NOMAIN", true);
require_once 'lib/prepend.php';
require_once 'lib/IniConfig.php';
@@ -57,20 +57,23 @@
} elseif ($credentials && is_string($credentials) && base64_decode($credentials, true)) {
list($username, $password) = explode(':', base64_decode($credentials));
} else {
- if (!isset($_SERVER))
+ if (!isset($_SERVER)) {
$_SERVER =& $GLOBALS['HTTP_SERVER_VARS'];
- // TODO: where in the header is the client IP
- if (!isset($username)) {
- if (isset($_SERVER['REMOTE_ADDR']))
- $username = $_SERVER['REMOTE_ADDR'];
- elseif (isset($GLOBALS['REMOTE_ADDR']))
- $username = $GLOBALS['REMOTE_ADDR'];
- else
- $username = $server->host;
+ }
+ // TODO: where in the header is the client IP
+ if (!isset($username)) {
+ if (isset($_SERVER['REMOTE_ADDR'])) {
+ $username = $_SERVER['REMOTE_ADDR'];
+ } elseif (isset($GLOBALS['REMOTE_ADDR'])) {
+ $username = $GLOBALS['REMOTE_ADDR'];
+ } else {
+ $username = $server->host;
}
+ }
}
- if (!isset($password))
+ if (!isset($password)) {
$password = '';
+ }
global $request;
$request->_user = WikiUser($username);
@@ -77,11 +80,13 @@
$request->_user->AuthCheck(array('userid' => $username, 'passwd' => $password));
if (!mayAccessPage($access, $pagename)) {
- $server->fault(401, "no permission, "
+ $server->fault(
+ 401,
+ "no permission, "
. "access=$access, "
. "pagename=$pagename, "
. "username=$username"
- );
+ );
}
$credentials = array('username' => $username, 'password' => $password);
}
@@ -91,7 +96,7 @@
//todo: check and set credentials
// requiredAuthorityForPage($action);
// require 'edit' access
- function doSavePage($pagename, $content, $credentials = false)
+ public function doSavePage($pagename, $content, $credentials = false)
{
global $server;
checkCredentials($server, $credentials, 'edit', $pagename);
@@ -116,7 +121,7 @@
}
// require 'view' access
- function getPageContent($pagename, $credentials = false)
+ public function getPageContent($pagename, $credentials = false)
{
global $server;
checkCredentials($server, $credentials, 'view', $pagename);
@@ -128,7 +133,7 @@
}
// require 'view' access
- function getPageRevision($pagename, $revision, $credentials = false)
+ public function getPageRevision($pagename, $revision, $credentials = false)
{
global $server;
checkCredentials($server, $credentials, 'view', $pagename);
@@ -140,7 +145,7 @@
}
// require 'view' access
- function getCurrentRevision($pagename, $credentials = false)
+ public function getCurrentRevision($pagename, $credentials = false)
{
global $server;
checkCredentials($server, $credentials, 'view', $pagename);
@@ -147,11 +152,11 @@
$dbi = WikiDB::open($GLOBALS['DBParams']);
$page = $dbi->getPage($pagename);
$version = $page->getVersion();
- return (double)$version;
+ return (float)$version;
}
// require 'change' or 'view' access ?
- function getPageMeta($pagename, $credentials = false)
+ public function getPageMeta($pagename, $credentials = false)
{
global $server;
checkCredentials($server, $credentials, 'view', $pagename);
@@ -161,7 +166,7 @@
}
// require 'view' access to AllPages
- function getAllPagenames($credentials = false)
+ public function getAllPagenames($credentials = false)
{
global $server;
checkCredentials($server, $credentials, 'view', _("AllPages"));
@@ -176,7 +181,7 @@
}
// require 'view' access
- function getBacklinks($pagename, $credentials = false)
+ public function getBacklinks($pagename, $credentials = false)
{
global $server;
checkCredentials($server, $credentials, 'view', $pagename);
@@ -192,7 +197,7 @@
}
// require 'view' access to TitleSearch
- function doTitleSearch($s, $credentials = false)
+ public function doTitleSearch($s, $credentials = false)
{
require_once 'lib/TextSearchQuery.php';
@@ -209,7 +214,7 @@
}
// require 'view' access to FullTextSearch
- function doFullTextSearch($s, $credentials = false)
+ public function doFullTextSearch($s, $credentials = false)
{
require_once 'lib/TextSearchQuery.php';
@@ -226,7 +231,7 @@
}
// require 'view' access to RecentChanges
- function getRecentChanges($limit = false, $since = false, $include_minor = false, $credentials = false)
+ public function getRecentChanges($limit = false, $since = false, $include_minor = false, $credentials = false)
{
global $server;
checkCredentials($server, $credentials, 'view', _("RecentChanges"));
@@ -247,7 +252,7 @@
}
// require 'view' access
- function listLinks($pagename, $credentials = false)
+ public function listLinks($pagename, $credentials = false)
{
global $server;
checkCredentials($server, $credentials, 'view', $pagename);
@@ -256,19 +261,21 @@
$linkiterator = $page->getPageLinks();
$links = array();
while ($currentpage = $linkiterator->next()) {
- if ($currentpage->exists())
+ if ($currentpage->exists()) {
$links[] = array('pagename' => $currentpage->getName());
+ }
}
return $links;
}
- function listPlugins($credentials = false)
+ public function listPlugins($credentials = false)
{
global $server;
checkCredentials($server, $credentials, 'change', _("HomePage"));
$plugin_dir = 'lib/plugin';
- if (defined('PHPWIKI_DIR'))
+ if (defined('PHPWIKI_DIR')) {
$plugin_dir = PHPWIKI_DIR . "/$plugin_dir";
+ }
$pd = new FileSet($plugin_dir, '*.php');
$plugins = $pd->getFiles();
unset($pd);
@@ -289,7 +296,7 @@
return $RetArray;
}
- function getPluginSynopsis($pluginname, $credentials = false)
+ public function getPluginSynopsis($pluginname, $credentials = false)
{
global $server;
checkCredentials($server, $credentials, 'change', "Help/" . $pluginname . "Plugin");
@@ -302,8 +309,9 @@
$plugin_args = '';
$desc = $p->getArgumentsDescription();
$desc = str_replace("<br />", ' ', $desc->asXML());
- if ($desc)
+ if ($desc) {
$plugin_args = ' ' . $desc;
+ }
$synopsis = "<<" . $pluginname . $plugin_args . ">>";
}
return $synopsis;
@@ -310,7 +318,7 @@
}
// only plugins returning pagelists will return something useful. so omit the html output
- function callPlugin($pluginname, $plugin_args, $credentials = false)
+ public function callPlugin($pluginname, $plugin_args, $credentials = false)
{
global $request;
global $server;
@@ -324,8 +332,9 @@
$pagelist = $p->run($dbi, $plugin_args, $request, $basepage);
$pages = array();
if (is_object($pagelist) and is_a($pagelist, 'PageList')) {
- foreach ($pagelist->pageNames() as $name)
+ foreach ($pagelist->pageNames() as $name) {
$pages[] = array('pagename' => $name);
+ }
}
return $pages;
}
@@ -342,7 +351,7 @@
*
* @author: Reini Urban
*/
- function listRelations($option = 1, $credentials = false)
+ public function listRelations($option = 1, $credentials = false)
{
global $server;
checkCredentials($server, $credentials, 'view', _("HomePage"));
@@ -350,14 +359,16 @@
$also_attributes = $option & 2;
$only_attributes = $option & 2 and !($option & 1);
$sorted = !($option & 4);
- $relations = $dbi->listRelations($also_attributes,
+ $relations = $dbi->listRelations(
+ $also_attributes,
$only_attributes,
- $sorted);
+ $sorted
+ );
return array_keys(array_flip($relations)); // Remove duplicates
}
// some basic semantic search
- function linkSearch($linktype, $search, $pages = "*", $relation = "*", $credentials = false)
+ public function linkSearch($linktype, $search, $pages = "*", $relation = "*", $credentials = false)
{
global $server;
checkCredentials($server, $credentials, 'view', _("HomePage"));
Modified: trunk/configurator.php
===================================================================
--- trunk/configurator.php 2022-03-24 13:49:51 UTC (rev 11014)
+++ trunk/configurator.php 2022-03-24 13:58:54 UTC (rev 11015)
@@ -57,26 +57,39 @@
*/
global $HTTP_POST_VARS;
-if (empty($_SERVER)) $_SERVER =& $GLOBALS['HTTP_SERVER_VARS'];
-if (empty($_GET)) $_GET =& $GLOBALS['HTTP_GET_VARS'];
-if (empty($_ENV)) $_ENV =& $GLOBALS['HTTP_ENV_VARS'];
-if (empty($_POST)) $_POST =& $GLOBALS['HTTP_POST_VARS'];
+if (empty($_SERVER)) {
+ $_SERVER =& $GLOBALS['HTTP_SERVER_VARS'];
+}
+if (empty($_GET)) {
+ $_GET =& $GLOBALS['HTTP_GET_VARS'];
+}
+if (empty($_ENV)) {
+ $_ENV =& $GLOBALS['HTTP_ENV_VARS'];
+}
+if (empty($_POST)) {
+ $_POST =& $GLOBALS['HTTP_POST_VARS'];
+}
-if (empty($configurator))
+if (empty($configurator)) {
$configurator = "configurator.php";
-if (!strstr($_SERVER["SCRIPT_NAME"], $configurator) and defined('DATA_PATH'))
+}
+if (!strstr($_SERVER["SCRIPT_NAME"], $configurator) and defined('DATA_PATH')) {
$configurator = DATA_PATH . "/" . $configurator;
+}
$scriptname = str_replace('configurator.php', 'index.php', $_SERVER["SCRIPT_NAME"]);
if (strstr($_SERVER["SCRIPT_NAME"], "/php")) { // cgi got this different
- if (defined('DATA_PATH'))
+ if (defined('DATA_PATH')) {
$scriptname = DATA_PATH . "/index.php";
- else
+ } else {
$scriptname = str_replace('configurator.php', 'index.php', $_SERVER["PHP_SELF"]);
+ }
}
$config_file = 'config/config.ini';
$fs_config_file = dirname(__FILE__) . '/' . $config_file;
-if (isset($_POST['create'])) header('Location: ' . $configurator . '?show=_part1&create=1#create');
+if (isset($_POST['create'])) {
+ header('Location: ' . $configurator . '?show=_part1&create=1#create');
+}
if (!function_exists('dba_handlers')) {
function dba_handlers()
@@ -89,17 +102,22 @@
if (!function_exists('_http_user')) {
function _http_user()
{
- if (!isset($_SERVER))
+ if (!isset($_SERVER)) {
$_SERVER = $GLOBALS['HTTP_SERVER_VARS'];
- if (!empty($_SERVER['PHP_AUTH_USER']))
+ }
+ if (!empty($_SERVER['PHP_AUTH_USER'])) {
return array($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']);
- if (!empty($_SERVER['REMOTE_USER']))
+ }
+ if (!empty($_SERVER['REMOTE_USER'])) {
return array($_SERVER['REMOTE_USER'], $_SERVER['PHP_AUTH_PW']);
- if (!empty($GLOBALS['HTTP_ENV_VARS']['REMOTE_USER']))
+ }
+ if (!empty($GLOBALS['HTTP_ENV_VARS']['REMOTE_USER'])) {
return array($GLOBALS['HTTP_ENV_VARS']['REMOTE_USER'],
$GLOBALS['HTTP_ENV_VARS']['PHP_AUTH_PW']);
- if (!empty($GLOBALS['REMOTE_USER']))
+ }
+ if (!empty($GLOBALS['REMOTE_USER'])) {
return array($GLOBALS['REMOTE_USER'], $GLOBALS['PHP_AUTH_PW']);
+ }
// MsWindows IIS:
if (!empty($_SERVER['HTTP_AUTHORIZATION'])) {
@@ -111,14 +129,16 @@
function _http_logout()
{
- if (!isset($_SERVER))
+ if (!isset($_SERVER)) {
$_SERVER =& $GLOBALS['HTTP_SERVER_VARS'];
+ }
// maybe we should random the realm to really force a logout. but the next login will fail.
header('WWW-Authenticate: Basic realm="' . WIKI_NAME . '"');
- if (strstr(php_sapi_name(), 'apache'))
+ if (strstr(php_sapi_name(), 'apache')) {
header('HTTP/1.0 401 Unauthorized');
- else
- header("Status: 401 Access Denied"); //IIS and CGI need that
+ } else {
+ header("Status: 401 Access Denied");
+ } //IIS and CGI need that
unset($GLOBALS['REMOTE_USER']);
unset($_SERVER['PHP_AUTH_USER']);
unset($_SERVER['PHP_AUTH_PW']);
@@ -152,8 +172,9 @@
}
// check password
if (ENCRYPTED_PASSWD) {
- if (crypt($admin_pw, ADMIN_PASSWD) != ADMIN_PASSWD)
+ if (crypt($admin_pw, ADMIN_PASSWD) != ADMIN_PASSWD) {
_http_logout();
+ }
} elseif ($admin_pw != ADMIN_PASSWD) {
_http_logout();
}
@@ -398,13 +419,14 @@
new part('_part0', $SEPARATOR . "\n", "
Part Zero: Latest Development and Tricky Options");
-if (defined('INCLUDE_PATH'))
+if (defined('INCLUDE_PATH')) {
$include_path = INCLUDE_PATH;
-else {
+} else {
if (substr(PHP_OS, 0, 3) == 'WIN') {
$include_path = dirname(__FILE__) . ';' . ini_get('include_path');
- if (strchr(ini_get('include_path'), '/'))
+ if (strchr(ini_get('include_path'), '/')) {
$include_path = strtr($include_path, '\\', '/');
+ }
} else {
$include_path = dirname(__FILE__) . ':' . ini_get('include_path');
}
@@ -439,7 +461,8 @@
'spaw' => 'spaw',
'htmlarea3' => 'htmlarea3',
'htmlarea2' => 'htmlarea2',
- ));
+ )
+ );
$properties["WYSIWYG_DEFAULT_PAGETYPE_HTML"] =
new boolean_define_commented_optional('WYSIWYG_DEFAULT_PAGETYPE_HTML');
@@ -509,12 +532,19 @@
new _define_optional('WIKI_NAME', WIKI_NAME);
$properties["Admin Username"] =
- new _define_notempty('ADMIN_USER', ADMIN_USER, "
+ new _define_notempty(
+ 'ADMIN_USER',
+ ADMIN_USER,
+ "
You must set this! Username and password of the administrator.",
- "onchange=\"validate_ereg('Sorry, ADMIN_USER cannot be empty.', '^.+$', 'ADMIN_USER', this);\"");
+ "onchange=\"validate_ereg('Sorry, ADMIN_USER cannot be empty.', '^.+$', 'ADMIN_USER', this);\""
+ );
$properties["Admin Password"] =
- new _define_password('ADMIN_PASSWD', ADMIN_PASSWD, "
+ new _define_password(
+ 'ADMIN_PASSWD',
+ ADMIN_PASSWD,
+ "
You must set this!
For heaven's sake pick a good password.
@@ -523,27 +553,32 @@
Use the \"Create Random Password\" button to create a good (random) password.
ADMIN_PASSWD is ignored on HttpAuth",
- "onchange=\"validate_ereg('Sorry, ADMIN_PASSWD must be at least 4 chars long.', '^....+$', 'ADMIN_PASSWD', this);\"");
+ "onchange=\"validate_ereg('Sorry, ADMIN_PASSWD must be at least 4 chars long.', '^....+$', 'ADMIN_PASSWD', this);\""
+ );
$properties["Encrypted Passwords"] =
- new boolean_define
- ('ENCRYPTED_PASSWD',
+ new boolean_define(
+ 'ENCRYPTED_PASSWD',
array('true' => "true. use crypt for all passwords",
- 'false' => "false. use plaintest passwords (not recommended)"));
+ 'false' => "false. use plaintest passwords (not recommended)")
+ );
$properties["MAX_PAGENAME_LENGTH"] =
new numeric_define_optional('MAX_PAGENAME_LENGTH');
$properties["Reverse DNS"] =
- new boolean_define_optional
- ('ENABLE_REVERSE_DNS',
+ new boolean_define_optional(
+ 'ENABLE_REVERSE_DNS',
array('true' => "true. perform additional reverse dns lookups",
- 'false' => "false. just record the address as given by the httpd server"));
+ 'false' => "false. just record the address as given by the httpd server")
+ );
$properties["ZIP Dump Authentication"] =
- new boolean_define_optional('ZIPDUMP_AUTH',
+ new boolean_define_optional(
+ 'ZIPDUMP_AUTH',
array('false' => "false. Everyone may download zip dumps",
- 'true' => "true. Only admin may download zip dumps"));
+ 'true' => "true. Only admin may download zip dumps")
+ );
$properties["Enable RawHtml Plugin"] =
new boolean_define_commented_optional('ENABLE_RAW_HTML');
@@ -583,18 +618,20 @@
'ACCESS_LOG_SQL',
array('0' => 'disabled',
'1' => 'read only',
- '2' => 'read + write'));
+ '2' => 'read + write')
+ );
$properties["Compress Output"] =
- new boolean_define_commented_optional
- ('COMPRESS_OUTPUT',
+ new boolean_define_commented_optional(
+ 'COMPRESS_OUTPUT',
array('' => 'undefined - GZIP compress when appropriate.',
'false' => 'Never compress output.',
- 'true' => 'Always try to compress output.'));
+ 'true' => 'Always try to compress output.')
+ );
$properties["HTTP Cache Control"] =
- new _define_selection_optional
- ('CACHE_CONTROL',
+ new _define_selection_optional(
+ 'CACHE_CONTROL',
array('LOOSE' => 'LOOSE',
'STRICT' => 'STRICT',
'NO_CACHE' => 'NO_CACHE',
@@ -635,16 +672,18 @@
and few edits by knowledgeable people who won't freak over the quirks.)</p>
</dd>
</dl>
-The default is currently LOOSE.");
+The default is currently LOOSE."
+ );
$properties["HTTP Cache Control Max Age"] =
new numeric_define_optional('CACHE_CONTROL_MAX_AGE', CACHE_CONTROL_MAX_AGE);
$properties["Markup Caching"] =
- new boolean_define_commented_optional
- ('WIKIDB_NOCACHE_MARKUP',
+ new boolean_define_commented_optional(
+ 'WIKIDB_NOCACHE_MARKUP',
array('false' => 'Enable HTML cache',
- 'true' => 'Disable HTML cache'));
+ 'true' => 'Disable HTML cache')
+ );
$properties["COOKIE_EXPIRATION_DAYS"] =
new numeric_define_optional('COOKIE_EXPIRATION_DAYS', COOKIE_EXPIRATION_DAYS);
@@ -656,10 +695,11 @@
new _define_optional('SESSION_SAVE_PATH', defined('SESSION_SAVE_PATH') ? SESSION_SAVE_PATH : ini_get('session.save_path'));
$properties["Force PHP Database Sessions"] =
- new boolean_define_commented_optional
- ('USE_DB_SESSION',
+ new boolean_define_commented_optional(
+ 'USE_DB_SESSION',
array('false' => 'Disable database sessions, use files',
- 'true' => 'Enable database sessions'));
+ 'true' => 'Enable database sessions')
+ );
///////// database selection
@@ -671,7 +711,8 @@
");
$properties["Database Type"] =
- new _define_selection("DATABASE_TYPE",
+ new _define_selection(
+ "DATABASE_TYPE",
array('dba' => "dba",
'SQL' => "SQL PEAR",
'PDO' => "PDO",
@@ -681,7 +722,8 @@
Choose SQL to use an SQL database with PEAR.
Choose PDO to use an SQL database.
flatfile is simple and slow.
-Recommended is dba or SQL: PEAR."*/);
+Recommended is dba or SQL: PEAR."*/
+ );
$properties["SQL DSN Setup"] =
new unchangeable_variable('_sqldsnstuff', "", "
@@ -708,7 +750,8 @@
// Choose dba to use one of the standard UNIX dbm libraries.
$properties["SQL Type"] =
- new _variable_selection('_dsn_sqltype',
+ new _variable_selection(
+ '_dsn_sqltype',
array('mysql' => "MySQL",
'pgsql' => "PostgreSQL",
'mssql' => "Microsoft SQL Server",
@@ -719,8 +762,10 @@
'ODBC' => "ODBC (only PDO)",
'firebird' => "Firebird (only PDO)",
'oracle' => "Oracle (only PDO)",
- ), "
-SQL DB types. The DSN hosttype.");
+ ),
+ "
+SQL DB types. The DSN hosttype."
+ );
$properties["SQL User"] =
new _variable('_dsn_sqluser', "wikiuser", "
@@ -753,9 +798,12 @@
$dsn_sqlstring = $dsn_sqltype . "://".$dsn_sqluser.":".$dsn_sqlpass."@".$dsn_sqlhostorsock."/".$dsn_sqldbname;
$properties["SQL dsn"] =
- new unchangeable_define("DATABASE_DSN",
- $dsn_sqlstring, "
-Calculated from the settings above:");
+ new unchangeable_define(
+ "DATABASE_DSN",
+ $dsn_sqlstring,
+ "
+Calculated from the settings above:"
+ );
$properties["Filename / Table name Prefix"] =
new _define_commented('DATABASE_PREFIX', DATABASE_PREFIX, "
@@ -772,10 +820,11 @@
");
$properties["DATABASE_PERSISTENT"] =
- new boolean_define_commented_optional
- ('DATABASE_PERSISTENT',
+ new boolean_define_commented_optional(
+ 'DATABASE_PERSISTENT',
array('false' => "Disabled",
- 'true' => "Enabled"));
+ 'true' => "Enabled")
+ );
$properties["DB Session table"] =
new _define_optional("DATABASE_SESSION_TABLE", DATABASE_SESSION_TABLE, "
@@ -791,15 +840,18 @@
// TODO: list the available methods
$properties["dba handler"] =
- new _define_selection('DATABASE_DBA_HANDLER',
+ new _define_selection(
+ 'DATABASE_DBA_HANDLER',
array('gdbm' => "gdbm - GNU database manager (not recommended anymore)",
'dbm' => "DBM - Redhat default.",
'db2' => "DB2 - BerkeleyDB (Sleepycat) DB2",
'db3' => "DB3 - BerkeleyDB (Sleepycat) DB3. Default on Windows but not on every Linux",
- 'db4' => "DB4 - BerkeleyDB (Sleepycat) DB4. Default."), "
+ 'db4' => "DB4 - BerkeleyDB (Sleepycat) DB4. Default."),
+ "
Use 'gdbm', 'dbm', 'db2', 'db3' or 'db4' depending on your DBA handler methods supported: <br /> "
. join(", ", dba_handlers())
- . "\n\nBetter not use other hacks such as inifile, flatfile or cdb");
+ . "\n\nBetter not use other hacks such as inifile, flatfile or cdb"
+ );
$properties["dba timeout"] =
new numeric_define("DATABASE_TIMEOUT", DATABASE_TIMEOUT, "
@@ -818,30 +870,42 @@
");
$properties["Publicly viewable"] =
- new boolean_define_optional('ALLOW_ANON_USER',
+ new boolean_define_optional(
+ 'ALLOW_ANON_USER',
array('true' => "true. Permit anonymous view. (Default)",
- 'false' => "false. Force login even on view (strictly private)"), "
-If ALLOW_ANON_USER is false, you have to login before viewing any page or doing any other action on a page.");
+ 'false' => "false. Force login even on view (strictly private)"),
+ "
+If ALLOW_ANON_USER is false, you have to login before viewing any page or doing any other action on a page."
+ );
$properties["Allow anonymous edit"] =
- new boolean_define_optional('ALLOW_ANON_EDIT',
+ new boolean_define_optional(
+ 'ALLOW_ANON_EDIT',
array('true' => "true. Permit anonymous users to edit. (Default)",
- 'false' => "false. Force login on edit (moderately locked)"), "
-If ALLOW_ANON_EDIT is false, you have to login before editing or changing any page. See below.");
+ 'false' => "false. Force login on edit (moderately locked)"),
+ "
+If ALLOW_ANON_EDIT is false, you have to login before editing or changing any page. See below."
+ );
$properties["Allow Bogo Login"] =
- new boolean_define_optional('ALLOW_BOGO_LOGIN',
+ new boolean_define_optional(
+ 'ALLOW_BOGO_LOGIN',
array('true' => "true. Users may Sign In with any WikiWord, without password. (Default)",
- 'false' => "false. Require stricter authentication."), "
+ 'false' => "false. Require stricter authentication."),
+ "
If ALLOW_BOGO_LOGIN is false, you may not login with any wikiword username and empty password.
-If true, users are allowed to create themselves with any WikiWord username. See below.");
+If true, users are allowed to create themselves with any WikiWord username. See below."
+ );
$properties["Allow User Passwords"] =
- new boolean_define_optional('ALLOW_USER_PASSWORDS',
+ new boolean_define_optional(
+ 'ALLOW_USER_PASSWORDS',
array('true' => "True user authentication with password checking. (Default)",
- 'false' => "false. Ignore authentication settings below."), "
+ 'false' => "false. Ignore authentication settings below."),
+ "
If ALLOW_USER_PASSWORDS is true, the authentication settings below define where and how to
-check against given username/passwords. For completely security disable BOGO_LOGIN and ANON_EDIT above.");
+check against given username/passwords. For completely security disable BOGO_LOGIN and ANON_EDIT above."
+ );
$properties["User Authentication Methods"] =
new array_define('USER_AUTH_ORDER', array("PersonalPage", "Db"), "
@@ -887,11 +951,13 @@
new numeric_define('PASSWORD_LENGTH_MINIMUM', PASSWORD_LENGTH_MINIMUM);
$properties["USER_AUTH_POLICY"] =
- new _define_selection('USER_AUTH_POLICY',
+ new _define_selection(
+ 'USER_AUTH_POLICY',
array('first-only' => "first-only - use only the first method in USER_AUTH_ORDER",
'old' => "old - ignore USER_AUTH_ORDER (legacy)",
'strict' => "strict - check all methods for userid + password (recommended)",
- 'stacked' => "stacked - check all methods for userid, and if found for password"), "
+ 'stacked' => "stacked - check all methods for userid, and if found for password"),
+ "
The following policies are available for user authentication:
<dl>
<dt>first-only</dt>
@@ -905,7 +971,8 @@
dont try the other methods on failure then</dd>
<dt>stacked</dt>
<dd>check the given user - password combination for all
- methods and return true on the first success.</dd></dl>");
+ methods and return true on the first success.</dd></dl>"
+ );
$properties["ENABLE_PAGEPERM"] =
new boolean_define_commented_optional('ENABLE_PAGEPERM');
@@ -919,12 +986,14 @@
Group Membership");
$properties["Group membership"] =
- new _define_selection("GROUP_METHOD",
+ new _define_selection(
+ "GROUP_METHOD",
array('WIKIPAGE' => "WIKIPAGE - List at \"CategoryGroup\". (Slowest, but easiest to maintain)",
'NONE' => "NONE - Disable group membership (Fastest)",
'DB' => "DB - SQL Database, Optionally external. See USERS/GROUPS queries",
'FILE' => "Flatfile. See AUTH_GROUP_FILE below.",
- 'LDAP' => "LDAP - See \"LDAP authentication options\" above. (Experimental)"), "
+ 'LDAP' => "LDAP - See \"LDAP authentication options\" above. (Experimental)"),
+ "
Group membership. PhpWiki supports defining permissions for a group as
well as for individual users. This defines how group membership information
is obtained. Supported values are:
@@ -939,7 +1008,8 @@
<dd>Flatfile. See AUTH_GROUP_FILE below.</dd>
<dt>LDAP</dt>
<dd>LDAP groups. See \"LDAP authentication options\" above and
- lib/WikiGroup.php. (experimental)</dd></dl>");
+ lib/WikiGroup.php. (experimental)</dd></dl>"
+ );
$properties["CATEGORY_GROUP_PAGE"] =
new _define_optional('CATEGORY_GROUP_PAGE', _("CategoryGroup"), "
@@ -985,16 +1055,18 @@
; DBAUTH_AUTH_CHECK = \"SELECT IF(passwd=PASSWORD('\$password'),1,0) AS ok FROM user WHERE userid='\$userid'\"");
$properties["Crypt Method"] =
- new _define_selection_optional
- ('DBAUTH_AUTH_CRYPT_METHOD',
+ new _define_selection_optional(
+ 'DBAUTH_AUTH_CRYPT_METHOD',
array('plain' => 'plain',
- 'crypt' => 'crypt'), "
+ 'crypt' => 'crypt'),
+ "
If you want to use Unix crypt()ed passwords, you can use DBAUTH_AUTH_CHECK
to get the password out of the database with a simple SELECT query, and
specify DBAUTH_AUTH_USER_EXISTS and DBAUTH_AUTH_CRYPT_METHOD:
; DBAUTH_AUTH_CHECK = \"SELECT passwd FROM user where userid='\$userid'\" <br />
-; DBAUTH_AUTH_CRYPT_METHOD = crypt");
+; DBAUTH_AUTH_CRYPT_METHOD = crypt"
+ );
$properties["Update the user's authentication credential"] =
new _define('DBAUTH_AUTH_UPDATE', "UPDATE user SET passwd='\$password' WHERE userid='\$userid'", "
@@ -1156,7 +1228,8 @@
Page appearance and layout");
$properties["Theme"] =
- new _define_selection_optional('THEME',
+ new _define_selection_optional(
+ 'THEME',
array('default' => "default",
'MacOSX' => "MacOSX",
'smaller' => 'smaller',
@@ -1170,7 +1243,8 @@
'Hawaiian' => "Hawaiian",
'MonoBook' => 'MonoBook [experimental]',
'blog' => 'blog [experimental]',
- ), "
+ ),
+ "
THEME
Most of the page appearance is controlled by files in the theme
@@ -1192,10 +1266,12 @@
THEME = SpaceWiki
THEME = Hawaiian
THEME = blog (Kubrick) [experimental]
-</pre>");
+</pre>"
+ );
$properties["Language"] =
- new _define_selection_optional('DEFAULT_LANGUAGE',
+ new _define_selection_optional(
+ 'DEFAULT_LANGUAGE',
array('en' => "English",
'' => "<empty> (user-specific)",
'fr' => "Français",
@@ -1205,7 +1281,8 @@
'sv' => "Svenska",
'it' => "Italiano",
'ja' => "Japanese",
- 'zh' => "Chinese"), "
+ 'zh' => "Chinese"),
+ "
Select your language/locale - default language is \"en\" for English.
Other languages available:<pre>
English \"en\" (English - HomePage)
@@ -1220,7 +1297,8 @@
</pre>
If you set DEFAULT_LANGUAGE to the empty string, your systems default language
(as determined by the applicable environment variables) will be
-used.");
+used."
+ );
$properties["Wiki Page Source"] =
new _define_optional('WIKI_PGSRC', 'pgsrc', "
@@ -1351,14 +1429,20 @@
Canonical name of the server on which this PhpWiki resides.");
$properties["Server Port"] =
- new numeric_define_commented('SERVER_PORT', $_SERVER['SERVER_PORT'], "
+ new numeric_define_commented(
+ 'SERVER_PORT',
+ $_SERVER['SERVER_PORT'],
+ "
Canonical httpd port of the server on which this PhpWiki resides.",
- "onchange=\"validate_ereg('Sorry, \'%s\' is no valid port number.', '^[0-9]+$', 'SERVER_PORT', this);\"");
+ "onchange=\"validate_ereg('Sorry, \'%s\' is no valid port number.', '^[0-9]+$', 'SERVER_PORT', this);\""
+ );
$properties["Server Protocol"] =
- new _define_selection_optional_commented('SERVER_PROTOCOL',
+ new _define_selection_optional_commented(
+ 'SERVER_PROTOCOL',
array('http' => 'http',
- 'https' => 'https'));
+ 'https' => 'https')
+ );
$properties["Script Name"] =
new _define_commented_optional('SCRIPT_NAME', $scriptname);
@@ -1370,10 +1454,12 @@
new _define_commented_optional('PHPWIKI_DIR', dirname(__FILE__));
$properties["Use PATH_INFO"] =
- new _define_selection_optional_commented('USE_PATH_INFO',
+ new _define_selection_optional_commented(
+ 'USE_PATH_INFO',
array('' => 'automatic',
'true' => 'use PATH_INFO',
- 'false' => 'do not use PATH_INFO'), "
+ 'false' => 'do not use PATH_INFO'),
+ "
PhpWiki will try to use short urls to pages, eg
http://www.example.com/index.php/HomePage
If you want to use urls like
@@ -1386,7 +1472,8 @@
Default: PhpWiki will try to divine whether use of PATH_INFO
is supported in by your webserver/PHP configuration, and will
-use PATH_INFO if it thinks that is possible.");
+use PATH_INFO if it thinks that is possible."
+ );
$properties["Virtual Path"] =
new _define_commented_optional('VIRTUAL_PATH', '/SomeWiki', "
@@ -1424,8 +1511,11 @@
new _define_optional('TEMP_DIR', $temp);
$properties["Allowed Load"] =
- new _define_commented_optional('ALLOWED_LOAD', '/tmp',
- 'List of directories from which it is allowed to load pages. Directories are separated with ":"');
+ new _define_commented_optional(
+ 'ALLOWED_LOAD',
+ '/tmp',
+ 'List of directories from which it is allowed to load pages. Directories are separated with ":"'
+ );
///////////////////
@@ -1438,9 +1528,11 @@
");
$properties["Strict Mailable Pagedumps"] =
- new boolean_define_optional('STRICT_MAILABLE_PAGEDUMPS',
+ new boolean_define_optional(
+ 'STRICT_MAILABLE_PAGEDUMPS',
array('false' => "binary",
- 'true' => "quoted-printable"));
+ 'true' => "quoted-printable")
+ );
$properties["Default local Dump Directory"] =
new _define_optional('DEFAULT_DUMP_DIR');
@@ -1488,9 +1580,9 @@
$properties["GRAPHVIZ_EXE"] =
new _define_commented_optional('GRAPHVIZ_EXE', "/usr/bin/dot");
-if (PHP_OS == "Darwin") // Mac OS X
+if (PHP_OS == "Darwin") { // Mac OS X
$ttfont = "/System/Library/Frameworks/JavaVM.framework/Versions/1.3.1/Home/lib/fonts/LucidaSansRegular.ttf";
-elseif (isWindows()) {
+} elseif (isWindows()) {
$ttfont = $_ENV['windir'] . '\Fonts\Arial.ttf';
} else {
$ttfont = 'luximr'; // This is the only what sourceforge offered.
@@ -1518,15 +1610,21 @@
");
$properties["pear Cache USECACHE"] =
- new boolean_define_optional('PLUGIN_CACHED_USECACHE',
+ new boolean_define_optional(
+ 'PLUGIN_CACHED_USECACHE',
array('true' => 'Enabled',
- 'false' => 'Disabled'), "
-Enable or disable pear caching of plugins.");
+ 'false' => 'Disabled'),
+ "
+Enable or disable pear caching of plugins."
+ );
$properties["pear Cache Database Container"] =
- new _define_selection_optional('PLUGIN_CACHED_DATABASE',
- array('file' => 'file'), "
+ new _define_selection_optional(
+ 'PLUGIN_CACHED_DATABASE',
+ array('file' => 'file'),
+ "
Curently only file is supported.
-db, trifile and imgfile might be supported, but you must hack that by yourself.");
+db, trifile and imgfile might be supported, but you must hack that by yourself."
+ );
$properties["pear Cache cache directory"] =
new _define_commented_optional('PLUGIN_CACHED_CACHE_DIR', "/tmp/cache", "
@@ -1546,9 +1644,12 @@
new numeric_define_optional('PLUGIN_CACHED_MAXARGLEN', "1000", "
max. generated url length.");
$properties["pear Cache FORCE_SYNCMAP"] =
- new boolean_define_optional('PLUGIN_CACHED_FORCE_SYNCMAP',
+ new boolean_define_optional(
+ 'PLUGIN_CACHED_FORCE_SYNCMAP',
array('true' => 'Enabled',
- 'false' => 'Disabled'), "");
+ 'false' => 'Disabled'),
+ ""
+ );
$properties["pear Cache IMGTYPES"] =
new list_define('PLUGIN_CACHED_IMGTYPES', "png|gif|gd|gd2|jpeg|wbmp|xbm|xpm", "
Handle those image types via GD handles. Check your GD supported image types.");
@@ -1572,97 +1673,106 @@
*/
class _variable
{
- var $config_item_name;
- var $default_value;
- var $description;
- var $prefix;
- var $jscheck;
- var $values;
+ public $config_item_name;
+ public $default_value;
+ public $description;
+ public $prefix;
+ public $jscheck;
+ public $values;
- function __construct($config_item_name, $default_value = '', $description = '', $jscheck = '')
+ public function __construct($config_item_name, $default_value = '', $description = '', $jscheck = '')
{
$this->config_item_name = $config_item_name;
- if (!$description)
+ if (!$description) {
$description = text_from_dist($config_item_name);
+ }
$this->description = $description;
if (defined($config_item_name)
and !preg_match("/(selection|boolean)/", get_class($this))
and !preg_match("/^(SCRIPT_NAME|VIRTUAL_PATH|TEMP_DIR)$/", $config_item_name)
- )
- $this->default_value = constant($config_item_name); // ignore given default value
- elseif ($config_item_name == $default_value)
- $this->default_value = ''; else
+ ) {
+ $this->default_value = constant($config_item_name);
+ } // ignore given default value
+ elseif ($config_item_name == $default_value) {
+ $this->default_value = '';
+ } else {
$this->default_value = $default_value;
+ }
$this->jscheck = $jscheck;
- if (preg_match("/variable/i", get_class($this)))
+ if (preg_match("/variable/i", get_class($this))) {
$this->prefix = "\$";
- elseif (preg_match("/ini_set/i", get_class($this)))
- $this->prefix = "ini_get: "; else
+ } elseif (preg_match("/ini_set/i", get_class($this))) {
+ $this->prefix = "ini_get: ";
+ } else {
$this->prefix = "";
+ }
}
- function _define($config_item_name, $default_value = '', $description = '', $jscheck = '')
+ public function _define($config_item_name, $default_value = '', $description = '', $jscheck = '')
{
_variable::__construct($config_item_name, $default_value, $description, $jscheck);
}
- function value()
+ public function value()
{
global $HTTP_POST_VARS;
- if (isset($HTTP_POST_VARS[$this->config_item_name]))
+ if (isset($HTTP_POST_VARS[$this->config_item_name])) {
return $HTTP_POST_VARS[$this->config_item_name];
- else
+ } else {
return $this->default_value;
+ }
}
- function _config_format($value)
+ public function _config_format($value)
{
return '';
}
- function get_config_item_name()
+ public function get_config_item_name()
{
return $this->config_item_name;
}
- function get_config_item_id()
+ public function get_config_item_id()
{
return str_replace('|', '-', $this->config_item_name);
}
- function get_config_item_header()
+ public function get_config_item_header()
{
if (strchr($this->config_item_name, '|')) {
list($var, $param) = explode('|', $this->config_item_name);
return "<b>" . $this->prefix . $var . "['" . $param . "']</b><br />";
- } elseif ($this->config_item_name[0] != '_')
- return "<b>" . $this->prefix . $this->config_item_name . "</b><br />"; else
+ } elseif ($this->config_item_name[0] != '_') {
+ return "<b>" . $this->prefix . $this->config_item_name . "</b><br />";
+ } else {
return '';
+ }
}
- function _get_description()
+ public function _get_description()
{
return $this->description;
}
- function _get_config_line($posted_value)
+ public function _get_config_line($posted_value)
{
return "\n" . $this->_config_format($posted_value);
}
- function get_config($posted_value)
+ public function get_config($posted_value)
{
$d = stripHtml($this->_get_description());
return str_replace("\n", "\n; ", $d) . $this->_get_config_line($posted_value) . "\n";
}
- function get_instructions($title)
+ public function get_instructions($title)
{
$i = "<h3>" . $title . "</h3>\n " . nl2p($this->_get_description()) . "\n";
return "<tr>\n<td class=\"instructions\">\n" . $i . "</td>\n";
}
- function get_html()
+ public function get_html()
{
$size = strlen($this->default_value) > 45 ? 90 : 50;
return $this->get_config_item_header() .
@@ -1672,15 +1782,14 @@
}
}
-class unchangeable_variable
- extends _variable
+class unchangeable_variable extends _variable
{
- function _config_format($value)
+ public function _config_format($value)
{
return "";
}
- function get_html()
+ public function get_html()
{
return $this->get_config_item_header() .
"<em>Not editable.</em>" .
@@ -1687,15 +1796,16 @@
"<pre>" . $this->default_value . "</pre>";
}
- function _get_config_line($posted_value)
+ public function _get_config_line($posted_value)
{
$n = "";
- if ($this->description)
+ if ($this->description) {
$n = "\n";
+ }
return "$n" . $this->default_value;
}
- function get_instructions($title)
+ public function get_instructions($title)
{
$i = "<h3>" . $title . "</h3>\n " . nl2p($this->_get_description()) . "\n";
// $i .= "<em>Not editable.</em><br />\n<pre>" . $this->default_value."</pre>";
@@ -1704,29 +1814,29 @@
}
}
-class unchangeable_define
- extends unchangeable_variable
+class unchangeable_define extends unchangeable_variable
{
- function _get_config_line($posted_value)
+ public function _get_config_line($posted_value)
{
$n = "";
- if ($this->description)
+ if ($this->description) {
$n = "\n";
- if (!$posted_value)
+ }
+ if (!$posted_value) {
$posted_value = $this->default_value;
+ }
return "$n" . $this->_config_format($posted_value);
}
- function _config_format($value)
+ public function _config_format($value)
{
return sprintf("%s = \"%s\"", $this->get_config_item_name(), $value);
}
}
-class _variable_selection
- extends _variable
+class _variable_selection extends _variable
{
- function value()
+ public function value()
{
global $HTTP_POST_VARS;
if (!empty($HTTP_POST_VARS[$this->config_item_name])) {
@@ -1742,22 +1852,24 @@
}
}
- function get_html()
+ public function get_html()
{
$output = $this->get_config_item_header();
$output .= '<select name="' . $this->get_config_item_name() . "\">\n";
/* The first option is the default */
$values = $this->default_value;
- if (defined($this->get_config_item_name()))
+ if (defined($this->get_config_item_name())) {
$this->default_value = constant($this->get_config_item_name());
- else
+ } else {
$this->default_value = null;
+ }
foreach ($values as $option => $label) {
- if (!is_null($this->default_value) && $this->default_value === $option)
+ if (!is_null($this->default_value) && $this->default_value === $option) {
$output .= " <option value=\"$option\" selected=\"selected\">$label</option>\n";
- else
+ } else {
$output .= " <option value=\"$option\">$label</option>\n";
+ }
}
$output .= "</select>\n";
return $output;
@@ -1764,26 +1876,27 @@
}
}
-class _define
- extends _variable
+class _define extends _variable
{
- function _config_format($value)
+ public function _config_format($value)
{
return sprintf("%s = \"%s\"", $this->get_config_item_name(), $value);
}
- function _get_config_line($posted_value)
+ public function _get_config_line($posted_value)
{
$n = "";
- if ($this->description)
+ if ($this->description) {
$n = "\n";
- if ($posted_value == '')
+ }
+ if ($posted_value == '') {
return "$n;" . $this->_config_format("");
- else
+ } else {
return "$n" . $this->_config_format($posted_value);
+ }
}
- function get_html()
+ public function get_html()
{
$size = strlen($this->default_value) > 45 ? 90 : 50;
return $this->get_config_item_header()
@@ -1793,20 +1906,21 @@
}
}
-class _define_commented
- extends _define
+class _define_commented extends _define
{
- function _get_config_line($posted_value)
+ public function _get_config_line($posted_value)
{
$n = "";
- if ($this->description)
+ if ($this->description) {
$n = "\n";
- if ($posted_value == $this->default_value)
+ }
+ if ($posted_value == $this->default_value) {
return "$n;" . $this->_config_format($posted_value);
- elseif ($posted_value == '')
+ } elseif ($posted_value == '') {
return "$n;" . $this->_config_format("");
- else
+ } else {
return "$n" . $this->_config_format($posted_value);
+ }
}
}
@@ -1815,130 +1929,130 @@
* IniConfig.php does the optional logic now.
* But we use _optional for config-default.ini options
*/
-class _define_commented_optional
- extends _define_commented
+class _define_commented_optional extends _define_commented
{
}
-class _define_optional
- extends _define
+class _define_optional extends _define
{
}
-class _define_notempty
- extends _define
+class _define_notempty extends _define
{
- function get_html()
+ public function get_html()
{
$s = $this->get_config_item_header()
. "<input type=\"text\" size=\"50\" name=\"" . $this->get_config_item_name()
. '" value="' . $this->default_value . '" ' . $this->jscheck . " />";
- if (empty($this->default_value))
+ if (empty($this->default_value)) {
return $s . "<p id=\"" . $this->get_config_item_id() . "\" class=\"red\">Cannot be empty.</p>";
- else
+ } else {
return $s . "<p id=\"" . $this->get_config_item_id() . "\" class=\"green\">Input accepted.</p>";
+ }
}
}
-class numeric_define
- extends _define
+class numeric_define extends _define
{
-
- function __construct($config_item_name, $default_value = '', $description = '', $jscheck = '')
+ public function __construct($config_item_name, $default_value = '', $description = '', $jscheck = '')
{
parent::__construct($config_item_name, $default_value, $description, $jscheck);
- if (!$jscheck)
+ if (!$jscheck) {
$this->jscheck = "onchange=\"validate_ereg('Sorry, \'%s\' is not an integer.', '^[-+]?[0-9]+$', '" . $this->get_config_item_name() . "', this);\"";
+ }
}
- function _config_format($value)
+ public function _config_format($value)
{
return sprintf("%s = %s", $this->get_config_item_name(), $value);
}
- function _get_config_line($posted_value)
+ public function _get_config_line($posted_value)
{
$n = "";
- if ($this->description)
+ if ($this->description) {
$n = "\n";
- if ($posted_value == '')
+ }
+ if ($posted_value == '') {
return "$n;" . $this->_config_format('0');
- else
+ } else {
return "$n" . $this->_config_format($posted_value);
+ }
}
}
-class numeric_define_optional
- extends numeric_define
+class numeric_define_optional extends numeric_define
{
}
-class numeric_define_commented
- extends numeric_define
+class numeric_define_commented extends numeric_define
{
- function _get_config_line($posted_value)
+ public function _get_config_line($posted_value)
{
$n = "";
- if ($this->description)
+ if ($this->description) {
$n = "\n";
- if ($posted_value == $this->default_value)
+ }
+ if ($posted_value == $this->default_value) {
return "$n;" . $this->_config_format($posted_value);
- elseif ($posted_value == '')
+ } elseif ($posted_value == '') {
return "$n;" . $this->_config_format('0');
- else
+ } else {
return "$n" . $this->_config_format($posted_value);
+ }
}
}
-class _define_selection
- extends _variable_selection
+class _define_selection extends _variable_selection
{
- function _config_format($value)
+ public function _config_format($value)
{
return sprintf("%s = %s", $this->get_config_item_name(), $value);
}
-
}
-class _define_selection_optional
- extends _define_selection
+class _define_selection_optional extends _define_selection
{
}
-class _define_selection_optional_commented
- extends _define_selection_optional
+class _define_selection_optional_commented extends _define_selection_optional
{
- function _get_config_line($posted_value)
+ public function _get_config_line($posted_value)
{
$n = "";
- if ($this->description)
+ if ($this->description) {
$n = "\n";
- if ($posted_value == $this->default_value)
+ }
+ if ($posted_value == $this->default_value) {
return "$n;" . $this->_config_format($posted_value);
- elseif ($posted_value == '')
+ } elseif ($posted_value == '') {
return "$n;" . $this->_config_format("");
- else
+ } else {
return "$n" . $this->_config_format($posted_value);
+ }
}
}
-class _define_password
- extends _define
+class _define_password extends _define
{
- function __construct($config_item_name, $default_value = '', $description = '', $jscheck = '')
+ public function __construct($config_item_name, $default_value = '', $description = '', $jscheck = '')
{
- if ($config_item_name == $default_value) $default_value = '';
+ if ($config_item_name == $default_value) {
+ $default_value = '';
+ }
parent::__construct($config_item_name, $default_value, $description, $jscheck);
- if (!$jscheck)
+ if (!$jscheck) {
$this->jscheck = "onchange=\"validate_ereg('Sorry, \'%s\' cannot be empty.', '^.+$', '"
. $this->get_config_item_name() . "', this);\"";
+ }
}
- function _get_config_line($posted_value)
+ public function _get_config_line($posted_value)
{
$n = "";
- if ($this->description)
+ if ($this->description) {
$n = "\n";
+ }
if ($posted_value == '') {
$p = "$n;" . $this->_config_format("");
$p .= "\n; If you used the passencrypt.php utility to encode the password";
@@ -1946,11 +2060,13 @@
$p .= "\n;ENCRYPTED_PASSWD = true";
return $p;
} else {
- $salt_length = max(CRYPT_SALT_LENGTH,
+ $salt_length = max(
+ CRYPT_SALT_LENGTH,
2 * CRYPT_STD_DES,
9 * CRYPT_EXT_DES,
12 * CRYPT_MD5,
- 16 * CRYPT_BLOWFISH);
+ 16 * CRYPT_BLOWFISH
+ );
// generate an encrypted password
$crypt_pass = crypt($posted_value, rand_ascii($salt_length));
$p = "$n" . $this->_config_format($crypt_pass);
@@ -1957,25 +2073,27 @@
return $p . "\nENCRYPTED_PASSWD = true";
}
}
-
}
-class _define_password_optional
- extends _define_password
+class _define_password_optional extends _define_password
{
-
- function __construct($config_item_name, $default_value = '', $description = '', $jscheck = '')
+ public function __construct($config_item_name, $default_value = '', $description = '', $jscheck = '')
{
- if ($config_item_name == $default_value) $default_value = '';
- if (!$jscheck) $this->jscheck = " ";
+ if ($config_item_name == $default_value) {
+ $default_value = '';
+ }
+ if (!$jscheck) {
+ $this->jscheck = " ";
+ }
parent::__construct($config_item_name, $default_value, $description, $jscheck);
}
- function _get_config_line($posted_value)
+ public function _get_config_line($posted_value)
{
$n = "";
- if ($this->description)
+ if ($this->description) {
$n = "\n";
+ }
if ($posted_value == '') {
return "$n;" . $this->_config_format("");
} else {
@@ -1983,7 +2101,7 @@
}
}
- function get_html()
+ public function get_html()
{
$s = $this->get_config_item_header();
// dont re-encrypt already encrypted passwords
@@ -1990,8 +2108,9 @@
$value = $this->value();
$encrypted = !empty($GLOBALS['properties']["Encrypted Passwords"]) and
$GLOBALS['properties']["Encrypted Passwords"]->value();
- if (empty($value))
+ if (empty($value)) {
$encrypted = false;
+ }
$s .= '<input type="' . ($encrypted ? "text" : "password") . '" name="' . $this->get_config_item_name()
. '" value="' . $value . '" ' . $this->jscheck . " />";
return $s;
@@ -1998,18 +2117,20 @@
}
}
-class _variable_password
- extends _variable
+class _variable_password extends _variable
{
- function __construct($config_item_name, $default_value = '', $description = '', $jscheck = '')
+ public function __construct($config_item_name, $default_value = '', $description = '', $jscheck = '')
{
- if ($config_item_name == $default_value) $default_value = '';
+ if ($config_item_name == $default_value) {
+ $default_value = '';
+ }
parent::__construct($config_item_name, $default_value, $description, $jscheck);
- if (!$jscheck)
+ if (!$jscheck) {
$this->jscheck = "onchange=\"validate_ereg('Sorry, \'%s\' cannot be empty.', '^.+$', '" . $this->get_config_item_name() . "', this);\"";
+ }
}
- function get_html()
+ public function get_html()
{
global $HTTP_POST_VARS, $HTTP_GET_VARS;
$s = $this->get_config_item_header();
@@ -2022,38 +2143,41 @@
$value = $this->value();
$encrypted = !empty($GLOBALS['properties']["Encrypted Passwords"]) and
$GLOBALS['properties']["Encrypted Passwords"]->value();
- if (empty($value))
+ if (empty($value)) {
$encrypted = false;
+ }
$s .= '<input type="' . ($encrypted ? "text" : "password") . '" name="' . $this->get_config_item_name()
. '" value="' . $value . '" ' . $this->jscheck . " />"
. " <input type=\"submit\" name=\"create\" value=\"Create Random Password\" />";
- if (empty($value))
+ if (empty($value)) {
$s .= "<p id=\"" . $this->get_config_item_id() . "\" class=\"red\">Cannot be empty.</p>";
- elseif (strlen($this->default_value) < 4)
+ } elseif (strlen($this->default_value) < 4) {
$s .= "<p id=\"" . $this->get_config_item_id() . "\" class=\"red\">Must be longer than 4 chars.</p>";
- else
+ } else {
$s .= "<p id=\"" . $this->get_config_item_id() . "\" class=\"green\">Input accepted.</p>";
+ }
return $s;
}
}
-class list_define
- extends _define
+class list_define extends _define
{
- function _get_config_line($posted_value)
+ public function _get_config_line($posted_value)
{
$list_values = preg_split("/[\s,]+/", $posted_value, -1, PREG_SPLIT_NO_EMPTY);
- if ($list_values)
+ if ($list_values) {
$list_values = join("|", $list_values);
+ }
return _variable::_get_config_line($list_values);
}
- function get_html()
+ public function get_html()
{
$list_values = explode("|", $this->default_value);
$rows = max(3, count($list_values) + 1);
- if ($list_values)
+ if ($list_values) {
$list_values = join("\n", $list_values);
+ }
$ta = $this->get_config_item_header();
$ta .= '<textarea cols="18" rows="' . $rows . '" name="';
$ta .= $this->get_config_item_name() . '" ' . $this->jscheck . '>';
@@ -2063,16 +2187,18 @@
}
}
-class array_variable
- extends _variable
+class array_variable extends _variable
{
- function _config_format($value)
+ public function _config_format($value)
{
- return sprintf("%s = \"%s\"", $this->get_config_item_name(),
- is_array($value) ? join(':', $value) : $value);
+ return sprintf(
+ "%s = \"%s\"",
+ $this->get_config_item_name(),
+ is_array($value) ? join(':', $value) : $value
+ );
}
- function _get_config_line($posted_value)
+ public function _get_config_line($posted_value)
{
// split the phrase by any number of commas or space characters,
// which include " ", \r, \t, \n and \f
@@ -2080,11 +2206,12 @@
if (!empty($list_values)) {
$list_values = "'" . join("', '", $list_values) . "'";
return "\n" . $this->_config_format($list_values);
- } else
+ } else {
return "\n;" . $this->_config_format('');
+ }
}
- function get_html()
+ public function get_html()
{
if (is_array($this->default_value)) {
$list_values = join("\n", $this->default_value);
@@ -2103,16 +2230,18 @@
}
}
-class array_define
- extends _define
+class array_define extends _define
{
- function _config_format($value)
+ public function _config_format($value)
{
- return sprintf("%s = \"%s\"", $this->get_config_item_name(),
- is_array($value) ? join(' : ', $value) : $value);
+ return sprintf(
+ "%s = \"%s\"",
+ $this->get_config_item_name(),
+ is_array($value) ? join(' : ', $value) : $value
+ );
}
- function _get_config_line($posted_value)
+ public function _get_config_line($posted_value)
{
// split the phrase by any number of commas or space characters,
// which include " ", \r, \t, \n and \f
@@ -2120,16 +2249,18 @@
if (!empty($list_values)) {
$list_values = join(" : ", $list_values);
return "\n" . $this->_config_format($list_values);
- } else
+ } else {
return "\n;" . $this->_config_format('');
+ }
}
- function get_html()
+ public function get_html()
{
- if (!$this->default_value)
+ if (!$this->default_value) {
$t...
[truncated message content] |
|
From: <var...@us...> - 2022-03-24 13:49:53
|
Revision: 11014
http://sourceforge.net/p/phpwiki/code/11014
Author: vargenau
Date: 2022-03-24 13:49:51 +0000 (Thu, 24 Mar 2022)
Log Message:
-----------
run php-cs-fixer
Modified Paths:
--------------
trunk/lib/DbSession/PDO.php
trunk/lib/DbSession/SQL.php
trunk/lib/DbSession/dba.php
Modified: trunk/lib/DbSession/PDO.php
===================================================================
--- trunk/lib/DbSession/PDO.php 2022-03-24 13:48:01 UTC (rev 11013)
+++ trunk/lib/DbSession/PDO.php 2022-03-24 13:49:51 UTC (rev 11014)
@@ -28,25 +28,26 @@
* @author: Reini Urban
*/
-class DbSession_PDO
- extends DbSession
+class DbSession_PDO extends DbSession
{
public $_backend_type = "PDO";
- function __construct($dbh, $table)
+ public function __construct($dbh, $table)
{
$this->_dbh = $dbh;
$this->_table = $table;
- session_set_save_handler(array(&$this, 'open'),
+ session_set_save_handler(
+ array(&$this, 'open'),
array(&$this, 'close'),
array(&$this, 'read'),
array(&$this, 'write'),
array(&$this, 'destroy'),
- array(&$this, 'gc'));
+ array(&$this, 'gc')
+ );
}
- function & _connect()
+ public function & _connect()
{
$dbh = &$this->_dbh;
global $DBParams;
@@ -56,21 +57,22 @@
return $dbh;
}
- function query($sql)
+ public function query($sql)
{
return $this->_backend->query($sql);
}
// adds surrounding quotes
- function quote($string)
+ public function quote($string)
{
return $this->_backend->quote($string);
}
- function _disconnect()
+ public function _disconnect()
{
- if (0 and $this->_dbh)
+ if (0 and $this->_dbh) {
unset($this->_dbh);
+ }
}
/**
@@ -153,7 +155,9 @@
*/
global $request;
- if (defined("WIKI_XMLRPC") or defined("WIKI_SOAP")) return false;
+ if (defined("WIKI_XMLRPC") or defined("WIKI_SOAP")) {
+ return false;
+ }
$dbh = $this->_connect();
$table = $this->_table;
@@ -219,7 +223,7 @@
// WhoIsOnline support
// TODO: ip-accesstime dynamic blocking API
- function currentSessions()
+ public function currentSessions()
{
$sessions = array();
$table = $this->_table;
@@ -232,10 +236,12 @@
$data = $row[0];
$date = $row[1];
$ip = $row[2];
- if (preg_match('|^[a-zA-Z0-9/+=]+$|', $data))
+ if (preg_match('|^[a-zA-Z0-9/+=]+$|', $data)) {
$data = base64_decode($data);
- if ($date < 908437560 or $date > 1588437560)
+ }
+ if ($date < 908437560 or $date > 1588437560) {
$date = 0;
+ }
// session_data contains the <variable name> + "|" + <packed string>
// we need just the wiki_user object (might be array as well)
$user = strstr($data, "wiki_user|");
Modified: trunk/lib/DbSession/SQL.php
===================================================================
--- trunk/lib/DbSession/SQL.php 2022-03-24 13:48:01 UTC (rev 11013)
+++ trunk/lib/DbSession/SQL.php 2022-03-24 13:49:51 UTC (rev 11014)
@@ -32,25 +32,26 @@
* Quasi-major rewrite/decruft/fix by Jeff Dairiki <da...@da...>.
*/
-class DbSession_SQL
- extends DbSession
+class DbSession_SQL extends DbSession
{
public $_backend_type = "SQL";
- function __construct($dbh, $table)
+ public function __construct($dbh, $table)
{
$this->_dbh = $dbh;
$this->_table = $table;
- session_set_save_handler(array(&$this, 'open'),
+ session_set_save_handler(
+ array(&$this, 'open'),
array(&$this, 'close'),
array(&$this, 'read'),
array(&$this, 'write'),
array(&$this, 'destroy'),
- array(&$this, 'gc'));
+ array(&$this, 'gc')
+ );
}
- function & _connect()
+ public function & _connect()
{
$dbh = &$this->_dbh;
$this->_connected = is_resource($dbh->connection);
@@ -63,21 +64,22 @@
return $dbh;
}
- function query($sql)
+ public function query($sql)
{
return $this->_dbh->query($sql);
}
// adds surrounding quotes
- function quote($string)
+ public function quote($string)
{
return $this->_dbh->quote($string);
}
- function _disconnect()
+ public function _disconnect()
{
- if (0 and $this->_connected)
+ if (0 and $this->_connected) {
$this->_dbh->disconnect();
+ }
}
/**
@@ -128,8 +130,9 @@
if (DB::isError($res) || empty($res)) {
return '';
}
- if (is_a($dbh, 'DB_pgsql'))
+ if (is_a($dbh, 'DB_pgsql')) {
$res = base64_decode($res);
+ }
if (strlen($res) > 4000) {
// trigger_error("Overlarge session data! ".strlen($res). " gt. 4000", E_USER_WARNING);
$res = preg_replace('/s:6:"_cache";O:12:"WikiDB_cache".+}$/', "", $res);
@@ -163,7 +166,9 @@
*/
global $request;
- if (defined("WIKI_XMLRPC") or defined("WIKI_SOAP")) return false;
+ if (defined("WIKI_XMLRPC") or defined("WIKI_SOAP")) {
+ return false;
+ }
$dbh = $this->_connect();
$table = $this->_table;
@@ -174,8 +179,9 @@
trigger_error("delete empty session $qid", E_USER_WARNING);
}
// postgres can't handle binary data in a TEXT field.
- if (is_a($dbh, 'DB_pgsql'))
+ if (is_a($dbh, 'DB_pgsql')) {
$sess_data = base64_encode($sess_data);
+ }
$qdata = $dbh->quote($sess_data);
$dbh->query("DELETE FROM $table WHERE sess_id=$qid");
@@ -226,22 +232,25 @@
// WhoIsOnline support
// TODO: ip-accesstime dynamic blocking API
- function currentSessions()
+ public function currentSessions()
{
$sessions = array();
$dbh = $this->_connect();
$table = $this->_table;
$res = $dbh->query("SELECT sess_data,sess_date,sess_ip FROM $table ORDER BY sess_date DESC");
- if (DB::isError($res) || empty($res))
+ if (DB::isError($res) || empty($res)) {
return $sessions;
+ }
while ($row = $res->fetchRow()) {
$data = $row['sess_data'];
$date = $row['sess_date'];
$ip = $row['sess_ip'];
- if (preg_match('|^[a-zA-Z0-9/+=]+$|', $data))
+ if (preg_match('|^[a-zA-Z0-9/+=]+$|', $data)) {
$data = base64_decode($data);
- if ($date < 908437560 or $date > 1588437560)
+ }
+ if ($date < 908437560 or $date > 1588437560) {
$date = 0;
+ }
// session_data contains the <variable name> + "|" + <packed string>
// we need just the wiki_user object (might be array as well)
$user = strstr($data, "wiki_user|");
Modified: trunk/lib/DbSession/dba.php
===================================================================
--- trunk/lib/DbSession/dba.php 2022-03-24 13:48:01 UTC (rev 11013)
+++ trunk/lib/DbSession/dba.php 2022-03-24 13:49:51 UTC (rev 11014)
@@ -33,33 +33,34 @@
* @author: Reini Urban.
*/
-class DbSession_dba
- extends DbSession
+class DbSession_dba extends DbSession
{
public $_backend_type = "dba";
- function __construct($dbh, $table)
+ public function __construct($dbh, $table)
{
$this->_dbh = $dbh;
- session_set_save_handler(array(&$this, 'open'),
+ session_set_save_handler(
+ array(&$this, 'open'),
array(&$this, 'close'),
array(&$this, 'read'),
array(&$this, 'write'),
array(&$this, 'destroy'),
- array(&$this, 'gc'));
+ array(&$this, 'gc')
+ );
}
- function quote($string)
+ public function quote($string)
{
return $string;
}
- function query($sql)
+ public function query($sql)
{
return false;
}
- function & _connect()
+ public function & _connect()
{
global $DBParams;
$dbh = &$this->_dbh;
@@ -76,7 +77,7 @@
return $dbh;
}
- function _disconnect()
+ public function _disconnect()
{
if (isset($this->_dbh)) {
$this->_dbh->close();
@@ -159,7 +160,9 @@
*/
global $request;
- if (defined("WIKI_XMLRPC") or defined("WIKI_SOAP")) return false;
+ if (defined("WIKI_XMLRPC") or defined("WIKI_SOAP")) {
+ return false;
+ }
$dbh = $this->_connect();
$time = time();
@@ -173,7 +176,7 @@
return true;
}
- function destroy($id)
+ public function destroy($id)
{
$dbh = $this->_connect();
$dbh->delete($id);
@@ -193,10 +196,11 @@
$threshold = time() - $maxlifetime;
for ($id = $dbh->firstkey(); $id !== false; $id = $nextid) {
$result = $dbh->get($id);
- list($date, ,) = explode('|', $result, 3);
+ list($date, , ) = explode('|', $result, 3);
$nextid = $dbh->nextkey();
- if ($date < $threshold)
+ if ($date < $threshold) {
$dbh->delete($id);
+ }
}
$dbh->optimize();
$this->_disconnect();
@@ -205,7 +209,7 @@
// WhoIsOnline support
// TODO: ip-accesstime dynamic blocking API
- function currentSessions()
+ public function currentSessions()
{
$sessions = array();
$dbh = $this->_connect();
@@ -212,11 +216,14 @@
for ($id = $dbh->firstkey(); $id !== false; $id = $dbh->nextkey()) {
$result = $dbh->get($id);
list($date, $ip, $packed) = explode('|', $result, 3);
- if (!$packed) continue;
+ if (!$packed) {
+ continue;
+ }
// session_data contains the <variable name> + "|" + <packed string>
// we need just the wiki_user object (might be array as well)
- if ($date < 908437560 or $date > 1588437560)
+ if ($date < 908437560 or $date > 1588437560) {
$date = 0;
+ }
$user = strstr($packed, "wiki_user|");
$sessions[] = array('wiki_user' => substr($user, 10), // from "O:" onwards
'date' => $date,
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <var...@us...> - 2022-03-24 13:48:03
|
Revision: 11013
http://sourceforge.net/p/phpwiki/code/11013
Author: vargenau
Date: 2022-03-24 13:48:01 +0000 (Thu, 24 Mar 2022)
Log Message:
-----------
run php-cs-fixer
Modified Paths:
--------------
trunk/lib/wikilens/Buddy.php
trunk/lib/wikilens/CustomPrefs.php
trunk/lib/wikilens/PageListColumns.php
trunk/lib/wikilens/RatingsDb.php
trunk/lib/wikilens/RatingsUser.php
trunk/lib/wikilens/Utils.php
Modified: trunk/lib/wikilens/Buddy.php
===================================================================
--- trunk/lib/wikilens/Buddy.php 2022-03-24 13:44:55 UTC (rev 11012)
+++ trunk/lib/wikilens/Buddy.php 2022-03-24 13:48:01 UTC (rev 11013)
@@ -36,7 +36,7 @@
// serialized string.
// If no homepage, fallback to prefs in cookie as in 1.3.3.
-require_once (dirname(__FILE__) . "/Utils.php");
+require_once(dirname(__FILE__) . "/Utils.php");
function addBuddy($user, $buddy, $dbi)
{
@@ -78,13 +78,13 @@
} else {
// from 10 random raters of this page (non-SQL)
}
-
}
$result = array();
- if (is_array($buddies_array))
+ if (is_array($buddies_array)) {
foreach ($buddies_array as $userid) {
$result[] = new RatingsUser($userid);
}
+ }
return $result;
}
Modified: trunk/lib/wikilens/CustomPrefs.php
===================================================================
--- trunk/lib/wikilens/CustomPrefs.php 2022-03-24 13:44:55 UTC (rev 11012)
+++ trunk/lib/wikilens/CustomPrefs.php 2022-03-24 13:48:01 UTC (rev 11013)
@@ -38,10 +38,13 @@
public $valid_values = array('php', 'mysuggest', 'mymovielens', 'mycluto');
public $default_value = 'php';
- function sanify($value)
+ public function sanify($value)
{
- if (!in_array($value, $this->valid_values)) return $this->default_value;
- else return $value;
+ if (!in_array($value, $this->valid_values)) {
+ return $this->default_value;
+ } else {
+ return $value;
+ }
}
}
@@ -48,8 +51,7 @@
class _UserPreference_recalgo // recommendation engine algorithm
extends _UserPreference
{
- public $valid_values = array
- (
+ public $valid_values = array(
'itemCos', // Item-based Top-N recommendation algorithm with cosine-based similarity function
'itemProb', // Item-based Top-N recommendation algorithm with probability-based similarity function.
// This algorithms tends to outperform the rest.
@@ -57,10 +59,13 @@
'bayes'); // Naïve Bayesian Classifier
public $default_value = 'itemProb';
- function sanify($value)
+ public function sanify($value)
{
- if (!in_array($value, $this->valid_values)) return $this->default_value;
- else return $value;
+ if (!in_array($value, $this->valid_values)) {
+ return $this->default_value;
+ } else {
+ return $value;
+ }
}
}
@@ -69,9 +74,7 @@
{
}
-$WikiTheme->customUserPreferences
-(array
-(
+$WikiTheme->customUserPreferences(array(
'recengine' => new _UserPreference_recengine('php'),
'recalgo' => new _UserPreference_recalgo('itemProb'),
//recnnbr: typically 15-30 for item-based, 40-80 for user-based algos
Modified: trunk/lib/wikilens/PageListColumns.php
===================================================================
--- trunk/lib/wikilens/PageListColumns.php 2022-03-24 13:44:55 UTC (rev 11012)
+++ trunk/lib/wikilens/PageListColumns.php 2022-03-24 13:48:01 UTC (rev 11013)
@@ -46,13 +46,13 @@
*/
class _PageList_Column_numbacklinks extends _PageList_Column_custom
{
- function _getValue($page_handle, $revision_handle)
+ public function _getValue($page_handle, $revision_handle)
{
$theIter = $page_handle->getBackLinks();
return $theIter->count();
}
- function _getSortableValue($page_handle, $revision_handle)
+ public function _getSortableValue($page_handle, $revision_handle)
{
return $this->_getValue($page_handle, $revision_handle);
}
@@ -60,7 +60,7 @@
class _PageList_Column_coagreement extends _PageList_Column_custom
{
- function __construct($params)
+ public function __construct($params)
{
$this->_pagelist =& $params[3];
_PageList_Column::__construct($params[0], $params[1], $params[2]);
@@ -67,7 +67,7 @@
$this->_selectedBuddies = $this->_pagelist->getOption('selectedBuddies');
}
- function _getValue($page_handle, $revision_handle)
+ public function _getValue($page_handle, $revision_handle)
{
global $request;
@@ -93,7 +93,7 @@
class _PageList_Column_minmisery extends _PageList_Column_custom
{
- function __construct($params)
+ public function __construct($params)
{
$this->_pagelist =& $params[3];
_PageList_Column::__construct($params[0], $params[1], $params[2]);
@@ -100,7 +100,7 @@
$this->_selectedBuddies = $this->_pagelist->getOption('selectedBuddies');
}
- function _getValue($page_handle, $revision_handle)
+ public function _getValue($page_handle, $revision_handle)
{
global $request, $WikiTheme;
@@ -117,7 +117,7 @@
class _PageList_Column_averagerating extends _PageList_Column_custom
{
- function __construct($params)
+ public function __construct($params)
{
$this->_pagelist =& $params[3];
_PageList_Column::__construct($params[0], $params[1], $params[2]);
@@ -124,7 +124,7 @@
$this->_selectedBuddies = $this->_pagelist->getOption('selectedBuddies');
}
- function _getValue($page_handle, $revision_handle)
+ public function _getValue($page_handle, $revision_handle)
{
global $request, $WikiTheme;
@@ -153,7 +153,7 @@
public $_user;
public $_dimension;
- function __construct($params)
+ public function __construct($params)
{
$this->_pagelist =& $params[3];
$this->_user =& $params[4]; //$this->_pagelist->getOption('user');
@@ -164,10 +164,12 @@
}
parent::__construct($params[0], $params[1], $params[2]);
$this->_dimension = $this->_pagelist->getOption('dimension');
- if (!$this->_dimension) $this->_dimension = 0;
+ if (!$this->_dimension) {
+ $this->_dimension = 0;
+ }
}
- function format($pagelist, $page_handle, $revision_handle)
+ public function format($pagelist, $page_handle, $revision_handle)
{
/**
* @var WikiRequest $request
@@ -174,8 +176,9 @@
*/
global $request;
- if (empty($this->_user))
+ if (empty($this->_user)) {
$this->_user =& RatingsUserFactory::getUser($request->_user->_userid);
+ }
assert(!empty($this->_user));
$rating = $this->_getValue($page_handle, $revision_handle);
$mean = $this->_user->mean_rating($this->_dimension);
@@ -182,8 +185,9 @@
$td = HTML::td($this->_tdattr);
$div = HTML::div();
- if ($rating != '-' && abs($rating - $mean) >= 0.75)
+ if ($rating != '-' && abs($rating - $mean) >= 0.75) {
$div->setAttr('style', 'color: #' . ($rating > $mean ? '009900' : 'ff3333'));
+ }
$div->pushContent($rating);
$td->pushContent($div);
@@ -191,7 +195,7 @@
return $td;
}
- function _getValue($page_handle, $revision_handle)
+ public function _getValue($page_handle, $revision_handle)
{
$pagename = $page_handle->getName();
@@ -202,7 +206,7 @@
return ($rating ? $rating : "-");
}
- function hasNoRatings($pages)
+ public function hasNoRatings($pages)
{
$total = 0;
$use = & $this->_user;
@@ -215,10 +219,9 @@
return true;
}
return false;
-
}
- function _getSortableValue($page_handle, $revision_handle)
+ public function _getSortableValue($page_handle, $revision_handle)
{
return $this->_getValue($page_handle, $revision_handle);
}
@@ -230,23 +233,35 @@
*/
class _PageList_Column_ratingwidget extends _PageList_Column_custom
{
- function __construct($params)
+ public function __construct($params)
{
$this->_pagelist =& $params[3];
_PageList_Column::__construct($params[0], $params[1], $params[2]);
$this->_dimension = $this->_pagelist->getOption('dimension');
- if (!$this->_dimension) $this->_dimension = 0;
+ if (!$this->_dimension) {
+ $this->_dimension = 0;
+ }
}
- function format($pagelist, $page_handle, $revision_handle)
+ public function format($pagelist, $page_handle, $revision_handle)
{
$plugin = new WikiPlugin_RateIt();
if (defined('FUSIONFORGE') && FUSIONFORGE) {
- $widget = $plugin->RatingWidgetHtml($page_handle->getName(), "",
- "BStar", $this->_dimension, "small");
+ $widget = $plugin->RatingWidgetHtml(
+ $page_handle->getName(),
+ "",
+ "BStar",
+ $this->_dimension,
+ "small"
+ );
} else {
- $widget = $plugin->RatingWidgetHtml($page_handle->getName(), "",
- "Star", $this->_dimension, "small");
+ $widget = $plugin->RatingWidgetHtml(
+ $page_handle->getName(),
+ "",
+ "Star",
+ $this->_dimension,
+ "small"
+ );
}
$td = HTML::td($widget);
$td->setAttr('nowrap', 'nowrap');
@@ -253,7 +268,7 @@
return $td;
}
- function _getValue($page_handle, $revision_handle)
+ public function _getValue($page_handle, $revision_handle)
{
global $request;
@@ -271,7 +286,7 @@
}
}
- function _getSortableValue($page_handle, $revision_handle)
+ public function _getSortableValue($page_handle, $revision_handle)
{
return $this->_getValue($page_handle, $revision_handle);
}
@@ -282,7 +297,7 @@
public $_active_ratings_user;
public $_users;
- function __construct($params)
+ public function __construct($params)
{
global $request;
$active_user = $request->getUser();
@@ -292,11 +307,13 @@
$this->_pagelist =& $params[3];
parent::__construct($params[0], $params[1], $params[2]);
$this->_dimension = $this->_pagelist->getOption('dimension');
- if (!$this->_dimension) $this->_dimension = 0;
+ if (!$this->_dimension) {
+ $this->_dimension = 0;
+ }
$this->_users = $this->_pagelist->getOption('users');
}
- function format($pagelist, $page_handle, $revision_handle)
+ public function format($pagelist, $page_handle, $revision_handle)
{
$pred = $this->_getValue($page_handle, $revision_handle);
$mean = $this->_active_ratings_user->mean_rating($this->_dimension);
@@ -303,8 +320,9 @@
$td = HTML::td($this->_tdattr);
$div = HTML::div();
- if ($pred > 0 && abs($pred - $mean) >= 0.75)
+ if ($pred > 0 && abs($pred - $mean) >= 0.75) {
$div->setAttr('style', 'color: #' . ($pred > $mean ? '009900' : 'ff3333'));
+ }
$div->pushContent($pred);
$td->pushContent($div);
@@ -312,7 +330,7 @@
return $td;
}
- function _getValue($page_handle, $revision_handle)
+ public function _getValue($page_handle, $revision_handle)
{
$pagename = $page_handle->getName();
@@ -320,7 +338,7 @@
return sprintf("%.1f", min(5, max(0, $pred)));
}
- function _getSortableValue($page_handle, $revision_handle)
+ public function _getSortableValue($page_handle, $revision_handle)
{
return $this->_getValue($page_handle, $revision_handle);
}
@@ -328,11 +346,10 @@
class _PageList_Column_top3recs extends _PageList_Column_custom
{
-
public $_active_ratings_user;
public $_users;
- function __construct($params)
+ public function __construct($params)
{
global $request;
$active_user = $request->getUser();
@@ -349,12 +366,14 @@
if (!empty($params[3])) {
$this->_pagelist =& $params[3];
$this->_dimension = $this->_pagelist->getOption('dimension');
- if (!$this->_dimension) $this->_dimension = 0;
+ if (!$this->_dimension) {
+ $this->_dimension = 0;
+ }
$this->_users = $this->_pagelist->getOption('users');
}
}
- function _getValue($page_handle, $revision_handle)
+ public function _getValue($page_handle, $revision_handle)
{
$ratings = $this->_active_ratings_user->get_ratings();
$iter = $page_handle->getLinks();
@@ -363,8 +382,11 @@
//filter out already rated
if (!$this->_active_ratings_user->get_rating($current->getName(), $this->_dimension)) {
$recs[$current->getName()] =
- $this->_active_ratings_user->knn_uu_predict($current->getName(),
- $this->_users, $this->_dimension);
+ $this->_active_ratings_user->knn_uu_predict(
+ $current->getName(),
+ $this->_users,
+ $this->_dimension
+ );
}
}
arsort($recs);
@@ -397,9 +419,7 @@
// register custom PageList type
global $WikiTheme;
-$WikiTheme->addPageListColumn
-(array
-(
+$WikiTheme->addPageListColumn(array(
'numbacklinks'
=> array('_PageList_Column_numbacklinks', 'custom:numbacklinks',
_("# things"), 'center'),
Modified: trunk/lib/wikilens/RatingsDb.php
===================================================================
--- trunk/lib/wikilens/RatingsDb.php 2022-03-24 13:44:55 UTC (rev 11012)
+++ trunk/lib/wikilens/RatingsDb.php 2022-03-24 13:48:01 UTC (rev 11013)
@@ -53,8 +53,9 @@
// For other than SQL backends. dba ratings are allowed but deprecated.
// We will probably drop this hack.
-if (!defined('RATING_STORAGE'))
+if (!defined('RATING_STORAGE')) {
define('RATING_STORAGE', $request->_dbi->_backend->isSQL() ? 'SQL' : 'WIKIPAGE');
+}
//define('RATING_STORAGE','WIKIPAGE'); // not fully supported yet
// leave undefined for internal, slow php engine.
@@ -62,20 +63,23 @@
// define('RATING_EXTERNAL',PHPWIKI_DIR . 'suggest.exe');
// Dimensions
-if (!defined('EXPLICIT_RATINGS_DIMENSION'))
+if (!defined('EXPLICIT_RATINGS_DIMENSION')) {
define('EXPLICIT_RATINGS_DIMENSION', 0);
-if (!defined('LIST_ITEMS_DIMENSION'))
+}
+if (!defined('LIST_ITEMS_DIMENSION')) {
define('LIST_ITEMS_DIMENSION', 1);
-if (!defined('LIST_OWNER_DIMENSION'))
+}
+if (!defined('LIST_OWNER_DIMENSION')) {
define('LIST_OWNER_DIMENSION', 2);
-if (!defined('LIST_TYPE_DIMENSION'))
+}
+if (!defined('LIST_TYPE_DIMENSION')) {
define('LIST_TYPE_DIMENSION', 3);
+}
//TODO: split class into SQL and metadata backends
class RatingsDb extends WikiDB
{
-
- function __construct()
+ public function __construct()
{
global $request;
$this->_dbi = &$request->_dbi;
@@ -103,7 +107,7 @@
}
// this is a singleton. It ensures there is only 1 ratingsDB.
- static function & getTheRatingsDb()
+ public static function & getTheRatingsDb()
{
static $_theRatingsDb;
@@ -115,10 +119,10 @@
}
-/// *************************************************************************************
-// FIXME
-// from Reini Urban's RateIt plugin
- function addRating($rating, $userid, $pagename, $dimension)
+ /// *************************************************************************************
+ // FIXME
+ // from Reini Urban's RateIt plugin
+ public function addRating($rating, $userid, $pagename, $dimension)
{
if (RATING_STORAGE == 'SQL') {
$page = $this->_dbi->getPage($pagename);
@@ -130,11 +134,17 @@
}
}
- function deleteRating($userid = null, $pagename = null, $dimension = null)
+ public function deleteRating($userid = null, $pagename = null, $dimension = null)
{
- if (is_null($dimension)) $dimension = $this->dimension;
- if (is_null($userid)) $userid = $this->userid;
- if (is_null($pagename)) $pagename = $this->pagename;
+ if (is_null($dimension)) {
+ $dimension = $this->dimension;
+ }
+ if (is_null($userid)) {
+ $userid = $this->userid;
+ }
+ if (is_null($pagename)) {
+ $pagename = $this->pagename;
+ }
if (RATING_STORAGE == 'SQL') {
$this->sql_delete_rating($userid, $pagename, $dimension);
} else {
@@ -142,22 +152,25 @@
}
}
- function getRating($userid = null, $pagename = null, $dimension = null)
+ public function getRating($userid = null, $pagename = null, $dimension = null)
{
if (RATING_STORAGE == 'SQL') {
$ratings_iter = $this->sql_get_rating($dimension, $userid, $pagename);
if ($rating = $ratings_iter->next() and isset($rating['ratingvalue'])) {
return $rating['ratingvalue'];
- } else
+ } else {
return false;
+ }
} else {
return $this->metadata_get_rating($userid, $pagename, $dimension);
}
}
- function getUsersRated($dimension = null, $orderby = null)
+ public function getUsersRated($dimension = null, $orderby = null)
{
- if (is_null($dimension)) $dimension = $this->dimension;
+ if (is_null($dimension)) {
+ $dimension = $this->dimension;
+ }
//if (is_null($userid)) $userid = $this->userid;
//if (is_null($pagename)) $pagename = $this->pagename;
if (RATING_STORAGE == 'SQL') {
@@ -164,8 +177,9 @@
$ratings_iter = $this->sql_get_users_rated($dimension, $orderby);
if ($rating = $ratings_iter->next() and isset($rating['ratingvalue'])) {
return $rating['ratingvalue'];
- } else
+ } else {
return false;
+ }
} else {
return $this->metadata_get_users_rated($dimension, $orderby);
}
@@ -210,15 +224,21 @@
*
* @return DB iterator with results
*/
- function get_rating($dimension = null, $rater = null, $ratee = null,
- $orderby = null, $pageinfo = "ratee")
+ public function get_rating(
+ $dimension = null,
+ $rater = null,
+ $ratee = null,
+ $orderby = null,
+ $pageinfo = "ratee"
+ )
{
if (RATING_STORAGE == 'SQL') {
$ratings_iter = $this->sql_get_rating($dimension, $rater, $pagename);
if ($rating = $ratings_iter->next() and isset($rating['ratingvalue'])) {
return $rating['ratingvalue'];
- } else
+ } else {
return false;
+ }
} else {
return $this->metadata_get_rating($rater, $pagename, $dimension);
}
@@ -227,7 +247,7 @@
/* UR: What is this for? NOT USED!
Maybe the list of users (ratees) who rated on this page.
*/
- function get_users_rated($dimension = null, $pagename = null, $orderby = null)
+ public function get_users_rated($dimension = null, $pagename = null, $orderby = null)
{
if (RATING_STORAGE == 'SQL') {
$ratings_iter = $this->sql_get_users_rated($dimension, $pagename, $orderby);
@@ -246,8 +266,13 @@
* Like get_rating(), but return a WikiDB_PageIterator
* FIXME!
*/
- function get_rating_page($dimension = null, $rater = null, $ratee = null,
- $orderby = null, $pageinfo = "ratee")
+ public function get_rating_page(
+ $dimension = null,
+ $rater = null,
+ $ratee = null,
+ $orderby = null,
+ $pageinfo = "ratee"
+ )
{
if (RATING_STORAGE == 'SQL') {
return $this->sql_get_rating($dimension, $rater, $ratee, $orderby, $pageinfo);
@@ -303,7 +328,7 @@
//function getUsersRated(){}
-//*******************************************************************************
+ //*******************************************************************************
// TODO:
// Use wikilens/RatingsUser.php for the php methods.
//
@@ -314,29 +339,38 @@
// Note that "suggest" is only free for non-profit organizations.
// I am currently writing a binary CGI mysuggest using suggest, which loads
// data from mysql.
- function getPrediction($userid = null, $pagename = null, $dimension = null)
+ public function getPrediction($userid = null, $pagename = null, $dimension = null)
{
- if (is_null($dimension)) $dimension = $this->dimension;
- if (is_null($userid)) $userid = $this->userid;
- if (is_null($pagename)) $pagename = $this->pagename;
+ if (is_null($dimension)) {
+ $dimension = $this->dimension;
+ }
+ if (is_null($userid)) {
+ $userid = $this->userid;
+ }
+ if (is_null($pagename)) {
+ $pagename = $this->pagename;
+ }
if (RATING_STORAGE == 'SQL') {
$dbh = &$this->_sqlbackend;
- if (isset($pagename))
+ if (isset($pagename)) {
$page = $dbh->_get_pageid($pagename);
- else
+ } else {
return 0;
- if (isset($userid))
+ }
+ if (isset($userid)) {
$user = $dbh->_get_pageid($userid);
- else
+ } else {
return 0;
+ }
}
if (defined('RATING_EXTERNAL') and RATING_EXTERNAL) {
// how call mysuggest.exe? as CGI or natively
//$rating = HTML::raw("<!--#include virtual=".RATING_ENGINE." -->");
$args = "-u$user -p$page -malpha"; // --top 10
- if (isset($dimension))
+ if (isset($dimension)) {
$args .= " -d$dimension";
+ }
$rating = passthru(RATING_EXTERNAL . " $args");
} else {
$rating = $this->php_prediction($userid, $pagename, $dimension);
@@ -349,7 +383,7 @@
* Only the SUGGEST_EstimateAlpha part
* Take wikilens/RatingsUser.php for the php methods.
*/
- function php_prediction($userid = null, $pagename = null, $dimension = null)
+ public function php_prediction($userid = null, $pagename = null, $dimension = null)
{
/**
* @var WikiRequest $request
@@ -356,9 +390,15 @@
*/
global $request;
- if (is_null($dimension)) $dimension = $this->dimension;
- if (is_null($userid)) $userid = $this->userid;
- if (is_null($pagename)) $pagename = $this->pagename;
+ if (is_null($dimension)) {
+ $dimension = $this->dimension;
+ }
+ if (is_null($userid)) {
+ $userid = $this->userid;
+ }
+ if (is_null($pagename)) {
+ $pagename = $this->pagename;
+ }
if (empty($this->buddies)) {
require_once 'lib/wikilens/RatingsUser.php';
require_once 'lib/wikilens/Buddy.php';
@@ -368,29 +408,45 @@
return $user->knn_uu_predict($pagename, $this->buddies, $dimension);
}
- function getNumUsers($pagename = null, $dimension = null)
+ public function getNumUsers($pagename = null, $dimension = null)
{
- if (is_null($dimension)) $dimension = $this->dimension;
- if (is_null($pagename)) $pagename = $this->pagename;
+ if (is_null($dimension)) {
+ $dimension = $this->dimension;
+ }
+ if (is_null($pagename)) {
+ $pagename = $this->pagename;
+ }
if (RATING_STORAGE == 'SQL') {
- $ratings_iter = $this->sql_get_rating($dimension, null, $pagename,
- null, "ratee");
+ $ratings_iter = $this->sql_get_rating(
+ $dimension,
+ null,
+ $pagename,
+ null,
+ "ratee"
+ );
return $ratings_iter->count();
} else {
- if (!$pagename) return 0;
+ if (!$pagename) {
+ return 0;
+ }
$page = $this->_dbi->getPage($pagename);
$data = $page->get('rating');
- if (!empty($data[$dimension]))
+ if (!empty($data[$dimension])) {
return count($data[$dimension]);
- else
+ } else {
return 0;
+ }
}
}
- function getAvg($pagename = null, $dimension = null)
+ public function getAvg($pagename = null, $dimension = null)
{
- if (is_null($dimension)) $dimension = $this->dimension;
- if (is_null($pagename)) $pagename = $this->pagename;
+ if (is_null($dimension)) {
+ $dimension = $this->dimension;
+ }
+ if (is_null($pagename)) {
+ $pagename = $this->pagename;
+ }
if (RATING_STORAGE == 'SQL') {
$dbi = &$this->_sqlbackend;
if (isset($pagename) || isset($dimension)) {
@@ -406,7 +462,9 @@
}
}
if (isset($dimension)) {
- if (isset($pagename)) $where .= " AND";
+ if (isset($pagename)) {
+ $where .= " AND";
+ }
$where .= " dimension=$dimension";
}
extract($dbi->_table_names);
@@ -420,19 +478,21 @@
$row = $iter->next();
return is_array($row) ? $row['avg'] : 0;
} else {
- if (!$pagename)
+ if (!$pagename) {
return 0;
+ }
$page = $this->_dbi->getPage($pagename);
$data = $page->get('rating');
- if (!empty($data[$dimension]))
+ if (!empty($data[$dimension])) {
// hash of userid => rating
return array_sum(array_values($data[$dimension])) / count($data[$dimension]);
- else
+ } else {
return 0;
+ }
}
}
-//*******************************************************************************
+ //*******************************************************************************
/**
* Get ratings.
@@ -474,25 +534,36 @@
*
* @return DB iterator with results
*/
- function sql_get_rating($dimension = null, $rater = null, $ratee = null,
- $orderby = null, $pageinfo = "ratee")
+ public function sql_get_rating(
+ $dimension = null,
+ $rater = null,
+ $ratee = null,
+ $orderby = null,
+ $pageinfo = "ratee"
+ )
{
- if (is_null($dimension)) $dimension = $this->dimension;
+ if (is_null($dimension)) {
+ $dimension = $this->dimension;
+ }
$result = $this->_sql_get_rating_result($dimension, $rater, $ratee, $orderby, $pageinfo);
return new $this->iter_class($this, $result);
}
- function sql_get_users_rated($dimension = null, $pagename = null, $orderby = null)
+ public function sql_get_users_rated($dimension = null, $pagename = null, $orderby = null)
{
- if (is_null($dimension)) $dimension = $this->dimension;
+ if (is_null($dimension)) {
+ $dimension = $this->dimension;
+ }
$result = $this->_sql_get_rating_result($dimension, null, $pagename, $orderby, "rater");
return new $this->iter_class($this, $result);
}
// all users who rated this page resp if null all pages.. needed?
- function metadata_get_users_rated($dimension = null, $pagename = null, $orderby = null)
+ public function metadata_get_users_rated($dimension = null, $pagename = null, $orderby = null)
{
- if (is_null($dimension)) $dimension = $this->dimension;
+ if (is_null($dimension)) {
+ $dimension = $this->dimension;
+ }
$users = array();
if (!$pagename) {
// TODO: all pages?
@@ -510,15 +581,22 @@
/**
* @return result ressource, suitable to the iterator
*/
- private function _sql_get_rating_result($dimension = null, $rater = null, $ratee = null,
- $orderby = null, $pageinfo = "ratee")
+ private function _sql_get_rating_result(
+ $dimension = null,
+ $rater = null,
+ $ratee = null,
+ $orderby = null,
+ $pageinfo = "ratee"
+ )
{
// pageinfo must be 'rater' or 'ratee'
- if (($pageinfo != "ratee") && ($pageinfo != "rater"))
+ if (($pageinfo != "ratee") && ($pageinfo != "rater")) {
return;
+ }
$dbi = &$this->_sqlbackend;
- if (is_null($dbi))
+ if (is_null($dbi)) {
return;
+ }
//$dbh = &$this->_dbi;
extract($dbi->_table_names);
$where = "WHERE r." . $pageinfo . "page = p.id";
@@ -549,12 +627,15 @@
if (isset($orderby)) {
$orderbyStr = " ORDER BY " . $orderby;
}
- if (isset($rater) or isset($ratee)) $what = '*';
+ if (isset($rater) or isset($ratee)) {
+ $what = '*';
+ }
// same as _get_users_rated_result()
else {
$what = 'DISTINCT p.pagename';
- if ($pageinfo == 'rater')
+ if ($pageinfo == 'rater') {
$what = 'DISTINCT p.pagename as userid';
+ }
}
$query = "SELECT $what"
@@ -609,8 +690,9 @@
{
$dbi = &$this->_sqlbackend;
extract($dbi->_table_names);
- if (empty($rating_tbl))
+ if (empty($rating_tbl)) {
$rating_tbl = $this->_dbi->getParam('prefix') . 'rating';
+ }
$dbi->lock();
$raterid = $dbi->_get_pageid($rater, true);
@@ -628,31 +710,36 @@
return true;
}
- function metadata_get_rating($userid, $pagename, $dimension)
+ public function metadata_get_rating($userid, $pagename, $dimension)
{
- if (!$pagename) return false;
+ if (!$pagename) {
+ return false;
+ }
$page = $this->_dbi->getPage($pagename);
$data = $page->get('rating');
- if (!empty($data[$dimension][$userid]))
+ if (!empty($data[$dimension][$userid])) {
return (float)$data[$dimension][$userid];
- else
+ } else {
return false;
+ }
}
- function metadata_set_rating($userid, $pagename, $dimension, $rating = -1)
+ public function metadata_set_rating($userid, $pagename, $dimension, $rating = -1)
{
- if (!$pagename) return;
+ if (!$pagename) {
+ return;
+ }
$page = $this->_dbi->getPage($pagename);
$data = $page->get('rating');
- if ($rating == -1)
+ if ($rating == -1) {
unset($data[$dimension][$userid]);
- else {
- if (empty($data[$dimension]))
+ } else {
+ if (empty($data[$dimension])) {
$data[$dimension] = array($userid => (float)$rating);
- else
+ } else {
$data[$dimension][$userid] = (float)$rating;
+ }
}
$page->set('rating', $data);
}
-
}
Modified: trunk/lib/wikilens/RatingsUser.php
===================================================================
--- trunk/lib/wikilens/RatingsUser.php 2022-03-24 13:44:55 UTC (rev 11012)
+++ trunk/lib/wikilens/RatingsUser.php 2022-03-24 13:48:01 UTC (rev 11013)
@@ -31,7 +31,7 @@
class RatingsUserFactory
{
- static function & getUser($userid)
+ public static function & getUser($userid)
{
//print "getUser($userid) ";
global $_ratingsUserCache;
@@ -60,7 +60,7 @@
public $_mean_ratings;
public $_pearson_sims;
- function __construct($userid)
+ public function __construct($userid)
{
$this->_userid = $userid;
$this->_ratings_loaded = false;
@@ -70,18 +70,19 @@
$this->_pearson_sims = array();
}
- function getId()
+ public function getId()
{
return $this->_userid;
}
- function & _get_rating_dbi()
+ public function & _get_rating_dbi()
{
// This is a hack, because otherwise this object doesn't know about a
// DBI at all. Perhaps all this ratings stuff should live somewhere
// else that's less of a base class.
- if (isset($this->_rdbi))
+ if (isset($this->_rdbi)) {
return $this->_rdbi;
+ }
$this->_rdbi = RatingsDb::getTheRatingsDb();
return $this->_rdbi;
}
@@ -95,7 +96,7 @@
*
* @return bool True if $user can view this user's ratings, false otherwise
*/
- function allow_view_ratings($user)
+ public function allow_view_ratings($user)
{
return true;
}
@@ -105,7 +106,7 @@
*
* @return array Assoc. array [page_name][dimension] = _UserRating object
*/
- function get_ratings()
+ public function get_ratings()
{
$this->_load_ratings();
return $this->_ratings;
@@ -116,7 +117,7 @@
*
* @return float Mean rating
*/
- function mean_rating($dimension = 0)
+ public function mean_rating($dimension = 0)
{
// use memoized result if available
if (isset($this->_mean_ratings[$dimension])) {
@@ -147,7 +148,7 @@
// ephemeral and doesn't particularly care about the ratings count or any
// other features that these methods might provide down the road)
- function has_rated($pagename, $dimension = null)
+ public function has_rated($pagename, $dimension = null)
{
// XXX: does this really want to do a full ratings load? (scalability?)
$this->_load_ratings();
@@ -163,12 +164,12 @@
return false;
}
- function get_rating($pagename, $dimension = 0)
+ public function get_rating($pagename, $dimension = 0)
{
// XXX: does this really want to do a full ratings load? (scalability?)
- if (RATING_STORAGE == 'SQL')
+ if (RATING_STORAGE == 'SQL') {
$this->_load_ratings();
- else {
+ } else {
$rdbi = $this->_get_rating_dbi();
return $rdbi->metadata_get_rating($this->getId(), $pagename, $dimension);
}
@@ -179,7 +180,7 @@
return false;
}
- function set_rating($pagename, $dimension, $rating)
+ public function set_rating($pagename, $dimension, $rating)
{
// XXX: does this really want to do a full ratings load? (scalability?)
$this->_load_ratings();
@@ -199,7 +200,7 @@
}
}
- function unset_rating($pagename, $dimension)
+ public function unset_rating($pagename, $dimension)
{
// XXX: does this really want to do a full ratings load? (scalability?)
$this->_load_ratings();
@@ -215,7 +216,7 @@
}
}
- function pearson_similarity($user, $dimension = 0)
+ public function pearson_similarity($user, $dimension = 0)
{
// use memoized result if available
if (isset($this->_pearson_sims[$user->getId()][$dimension])) {
@@ -264,11 +265,12 @@
// items that the similarity was based on
// prevent division-by-zero
- if (sqrt($sum11) == 0 || sqrt($sum12) == 0)
+ if (sqrt($sum11) == 0 || sqrt($sum12) == 0) {
$sim = array(0, $n);
- else
+ } else {
// Pearson similarity
$sim = array($sum12 / (sqrt($sum11) * sqrt($sum22)), $n);
+ }
// print "sim is " . $sim[0] . "<BR><BR>";
@@ -277,7 +279,7 @@
return $this->_pearson_sims[$user->getId()][$dimension] = $sim;
}
- function knn_uu_predict($pagename, &$neighbors, $dimension = 0)
+ public function knn_uu_predict($pagename, &$neighbors, $dimension = 0)
{
/*
print "<PRE>";
@@ -298,8 +300,9 @@
$nbor =& $neighbors[$i];
// ignore self-neighbor
- if ($this->getId() == $nbor->getId())
+ if ($this->getId() == $nbor->getId()) {
continue;
+ }
if ($nbor->has_rated($pagename, $dimension)) {
list($sim, $n_items) = $this->pearson_similarity($nbor);
@@ -307,8 +310,9 @@
// XXX: no filtering done... small-world = too few neighbors
if (1 || ($sim > 0 && abs($sim) >= 0.1)) {
// n/50 sig weighting
- if ($n_items < 50)
+ if ($n_items < 50) {
$sim *= $n_items / 50;
+ }
/*
print "neighbor is " . $nbor->getId() . "<BR>";
print "weighted sim is " . $sim . "<BR>";
@@ -330,7 +334,7 @@
return ($total_sim == 0 ? 0 : ($total / $total_sim + $my_mean));
}
- function _load_ratings($force = false)
+ public function _load_ratings($force = false)
{
if (!$this->_ratings_loaded || $force) {
// print "load " . $this->getId() . "<BR>";
@@ -352,10 +356,12 @@
}
$this->_num_ratings++;
$this->_ratings[$rating['pagename']][$rating['dimension']]
- = new _UserRating($this->_userid,
- $rating['pagename'],
- $rating['dimension'],
- $rating['ratingvalue']);
+ = new _UserRating(
+ $this->_userid,
+ $rating['pagename'],
+ $rating['dimension'],
+ $rating['ratingvalue']
+ );
}
$this->_ratings_loaded = true;
@@ -366,7 +372,7 @@
/** Represent a rating. */
class _UserRating
{
- function __construct($rater, $ratee, $dimension, $rating)
+ public function __construct($rater, $ratee, $dimension, $rating)
{
$this->rater = (string)$rater;
$this->ratee = (string)$ratee;
@@ -374,42 +380,42 @@
$this->rating = (float)$rating;
}
- function get_rater()
+ public function get_rater()
{
return $this->rater;
}
- function get_ratee()
+ public function get_ratee()
{
return $this->ratee;
}
- function get_rating()
+ public function get_rating()
{
return $this->rating;
}
- function get_dimension()
+ public function get_dimension()
{
return $this->dimension;
}
- function set_rater()
+ public function set_rater()
{
$this->rater = (string)$rater;
}
- function set_ratee()
+ public function set_ratee()
{
$this->ratee = (string)$ratee;
}
- function set_rating()
+ public function set_rating()
{
$this->rating = (float)$rating;
}
- function set_dimension()
+ public function set_dimension()
{
$this->dimension = (int)$dimension;
}
Modified: trunk/lib/wikilens/Utils.php
===================================================================
--- trunk/lib/wikilens/Utils.php 2022-03-24 13:44:55 UTC (rev 11012)
+++ trunk/lib/wikilens/Utils.php 2022-03-24 13:48:01 UTC (rev 11013)
@@ -43,8 +43,11 @@
// add new data to the appropriate line
if (preg_match('/^' . preg_quote($START_DELIM, '/') . '/', $text)) {
// need multiline modifier to match EOL correctly
- $text = preg_replace('/(^' . preg_quote($START_DELIM, '/') . '.*)$/m',
- '$1' . $DELIM . $new_data, $text);
+ $text = preg_replace(
+ '/(^' . preg_quote($START_DELIM, '/') . '.*)$/m',
+ '$1' . $DELIM . $new_data,
+ $text
+ );
} else {
// handle case where the line does not yet exist
$text .= "\n" . $START_DELIM . $new_data . "\n";
@@ -56,16 +59,20 @@
function getMembers($groupName, $dbi, $START_DELIM = false, $DELIM = ",")
{
- if (!$START_DELIM) $START_DELIM = _("Members:");
+ if (!$START_DELIM) {
+ $START_DELIM = _("Members:");
+ }
return getPageTextData($groupName, $dbi, $START_DELIM, $DELIM);
}
function getPageTextData($fromUser, $dbi, $START_DELIM, $DELIM)
{
- if (is_object($fromUser))
+ if (is_object($fromUser)) {
$fromUser = $fromUser->getId();
- if ($fromUser == "")
+ }
+ if ($fromUser == "") {
return "";
+ }
$userPage = $dbi->getPage($fromUser);
$transformed = $userPage->getCurrentRevision();
$pageArray = $transformed->getContent();
@@ -72,7 +79,7 @@
$p = -1;
for ($i = 0; $i < count($pageArray); $i++) {
if ($pageArray[$i] != "") {
- if (!((strpos($pageArray[$i], $START_DELIM)) === FALSE)) {
+ if (!((strpos($pageArray[$i], $START_DELIM)) === false)) {
$p = $i;
break;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <var...@us...> - 2022-03-24 13:44:58
|
Revision: 11012
http://sourceforge.net/p/phpwiki/code/11012
Author: vargenau
Date: 2022-03-24 13:44:55 +0000 (Thu, 24 Mar 2022)
Log Message:
-----------
run php-cs-fixer
Modified Paths:
--------------
trunk/lib/WikiUser/BogoLogin.php
trunk/lib/WikiUser/Db.php
trunk/lib/WikiUser/Facebook.php
trunk/lib/WikiUser/File.php
trunk/lib/WikiUser/Forbidden.php
trunk/lib/WikiUser/FusionForge.php
trunk/lib/WikiUser/HttpAuth.php
trunk/lib/WikiUser/HttpAuthUpper.php
trunk/lib/WikiUser/IMAP.php
trunk/lib/WikiUser/LDAP.php
trunk/lib/WikiUser/LdapUpper.php
trunk/lib/WikiUser/OpenID.php
trunk/lib/WikiUser/POP3.php
trunk/lib/WikiUser/PdoDb.php
trunk/lib/WikiUser/PearDb.php
trunk/lib/WikiUser/PersonalPage.php
trunk/lib/WikiUser/Session.php
Modified: trunk/lib/WikiUser/BogoLogin.php
===================================================================
--- trunk/lib/WikiUser/BogoLogin.php 2022-03-24 13:43:02 UTC (rev 11011)
+++ trunk/lib/WikiUser/BogoLogin.php 2022-03-24 13:44:55 UTC (rev 11012)
@@ -27,10 +27,9 @@
*/
class _BogoLoginPassUser extends _PassUser
{
-
public $_authmethod = 'BogoLogin';
- function userExists()
+ public function userExists()
{
if (isWikiWord($this->_userid)) {
$this->_level = WIKIAUTH_BOGO;
@@ -44,7 +43,7 @@
/** A BogoLoginUser requires no password at all
* But if there's one stored, we override it with the PersonalPagePassUser instead
*/
- function checkPass($submitted_password)
+ public function checkPass($submitted_password)
{
if ($this->_prefs->get('passwd')) {
if (isset($this->_prefs->_method) and $this->_prefs->_method == 'HomePage') {
Modified: trunk/lib/WikiUser/Db.php
===================================================================
--- trunk/lib/WikiUser/Db.php 2022-03-24 13:43:02 UTC (rev 11011)
+++ trunk/lib/WikiUser/Db.php 2022-03-24 13:44:55 UTC (rev 11012)
@@ -44,14 +44,15 @@
*
* Flat files auth is handled by the auth method "File".
*/
-class _DbPassUser
- extends _PassUser
+class _DbPassUser extends _PassUser
{
- public $_authselect, $_authupdate, $_authcreate;
+ public $_authselect;
+ public $_authupdate;
+ public $_authcreate;
// This can only be called from _PassUser, because the parent class
// sets the auth_dbi and pref methods, before this class is initialized.
- function __construct($UserName = '', $prefs = false)
+ public function __construct($UserName = '', $prefs = false)
{
/**
* @var WikiRequest $request
@@ -59,11 +60,13 @@
global $request;
if (!$this->_prefs) {
- if ($prefs) $this->_prefs = $prefs;
+ if ($prefs) {
+ $this->_prefs = $prefs;
+ }
}
- if (!isset($this->_prefs->_method))
+ if (!isset($this->_prefs->_method)) {
parent::__construct($UserName);
- elseif (!$this->isValidName($UserName)) {
+ } elseif (!$this->isValidName($UserName)) {
trigger_error(_("Invalid username."), E_USER_WARNING);
return false;
}
@@ -85,17 +88,22 @@
/* Since we properly quote the username, we allow most chars here.
Just " ; and ' is forbidden, max length: 48 as defined in the schema.
*/
- function isValidName($userid = false)
+ public function isValidName($userid = false)
{
- if (!$userid) $userid = $this->_userid;
- if (strcspn($userid, ";'\"") != strlen($userid)) return false;
- if (strlen($userid) > 48) return false;
+ if (!$userid) {
+ $userid = $this->_userid;
+ }
+ if (strcspn($userid, ";'\"") != strlen($userid)) {
+ return false;
+ }
+ if (strlen($userid) > 48) {
+ return false;
+ }
return true;
}
- function mayChangePass()
+ public function mayChangePass()
{
return !isset($this->_authupdate);
}
-
}
Modified: trunk/lib/WikiUser/Facebook.php
===================================================================
--- trunk/lib/WikiUser/Facebook.php 2022-03-24 13:43:02 UTC (rev 11011)
+++ trunk/lib/WikiUser/Facebook.php 2022-03-24 13:44:55 UTC (rev 11012)
@@ -29,13 +29,12 @@
// requires the openssl extension
require_once 'lib/HttpClient.php';
-class _FacebookPassUser
- extends _PassUser
+class _FacebookPassUser extends _PassUser
{
/**
* Preferences are handled in _PassUser
*/
- function checkPass($password)
+ public function checkPass($password)
{
$userid = $this->_userid;
if (!loadPhpExtension('openssl')) {
@@ -42,33 +41,52 @@
trigger_error(
sprintf(_("The PECL %s extension cannot be loaded."), "openssl")
. sprintf(_(" %s AUTH ignored."), 'Facebook'),
- E_USER_WARNING);
+ E_USER_WARNING
+ );
return $this->_tryNextUser();
}
$web = new HttpClient("www.facebook.com", 80);
- if (DEBUG & _DEBUG_LOGIN) $web->setDebug(true);
+ if (DEBUG & _DEBUG_LOGIN) {
+ $web->setDebug(true);
+ }
// collect cookies from http://www.facebook.com/login.php
$web->persist_cookies = true;
$web->cookie_host = 'www.facebook.com';
$firstlogin = $web->get("/login.php");
if (!$firstlogin) {
- if (DEBUG & (_DEBUG_LOGIN | _DEBUG_VERBOSE))
- trigger_error(sprintf(_("Facebook connect failed with %d %s"),
- $web->status, $web->errormsg),
- E_USER_WARNING);
+ if (DEBUG & (_DEBUG_LOGIN | _DEBUG_VERBOSE)) {
+ trigger_error(
+ sprintf(
+ _("Facebook connect failed with %d %s"),
+ $web->status,
+ $web->errormsg
+ ),
+ E_USER_WARNING
+ );
+ }
}
// Switch from http to https://login.facebook.com/login.php
$web->port = 443;
$web->host = 'login.facebook.com';
if (!($retval = $web->post("/login.php", array('user' => $userid, 'pass' => $password)))) {
- if (DEBUG & (_DEBUG_LOGIN | _DEBUG_VERBOSE))
- trigger_error(sprintf(_("Facebook login failed with %d %s"),
- $web->status, $web->errormsg),
- E_USER_WARNING);
+ if (DEBUG & (_DEBUG_LOGIN | _DEBUG_VERBOSE)) {
+ trigger_error(
+ sprintf(
+ _("Facebook login failed with %d %s"),
+ $web->status,
+ $web->errormsg
+ ),
+ E_USER_WARNING
+ );
+ }
}
$this->_authmethod = 'Facebook';
- if (DEBUG & _DEBUG_LOGIN) trigger_error(get_class($this) . "::checkPass => $retval",
- E_USER_WARNING);
+ if (DEBUG & _DEBUG_LOGIN) {
+ trigger_error(
+ get_class($this) . "::checkPass => $retval",
+ E_USER_WARNING
+ );
+ }
if ($retval) {
$this->_level = WIKIAUTH_USER;
} else {
@@ -78,17 +96,19 @@
}
// TODO: msearch facebook for the username
- function userExists()
+ public function userExists()
{
if (!loadPhpExtension('openssl')) {
trigger_error(
sprintf(_("The PECL %s extension cannot be loaded."), "openssl")
. sprintf(_(" %s AUTH ignored."), 'Facebook'),
- E_USER_WARNING);
+ E_USER_WARNING
+ );
return $this->_tryNextUser();
}
- if (DEBUG & _DEBUG_LOGIN)
+ if (DEBUG & _DEBUG_LOGIN) {
trigger_error(get_class($this) . "::userExists => true (dummy)", E_USER_WARNING);
+ }
return true;
}
}
Modified: trunk/lib/WikiUser/File.php
===================================================================
--- trunk/lib/WikiUser/File.php 2022-03-24 13:43:02 UTC (rev 11011)
+++ trunk/lib/WikiUser/File.php 2022-03-24 13:44:55 UTC (rev 11012)
@@ -24,8 +24,7 @@
include_once 'lib/pear/File_Passwd.php';
-class _FilePassUser
- extends _PassUser
+class _FilePassUser extends _PassUser
/**
* Check users defined in a .htaccess style file
* username:crypt\n...
@@ -33,22 +32,27 @@
* Preferences are handled in _PassUser
*/
{
- public $_file, $_may_change;
+ public $_file;
+ public $_may_change;
// This can only be called from _PassUser, because the parent class
// sets the pref methods, before this class is initialized.
- function __construct($UserName = '', $prefs = false, $file = '')
+ public function __construct($UserName = '', $prefs = false, $file = '')
{
if (!$this->_prefs and is_a($this, "_FilePassUser")) {
- if ($prefs) $this->_prefs = $prefs;
- if (!isset($this->_prefs->_method))
+ if ($prefs) {
+ $this->_prefs = $prefs;
+ }
+ if (!isset($this->_prefs->_method)) {
parent::__construct($UserName);
+ }
}
$this->_userid = $UserName;
// read the .htaccess style file.
$this->_may_change = defined('AUTH_USER_FILE_STORABLE') && AUTH_USER_FILE_STORABLE;
- if (empty($file) and defined('AUTH_USER_FILE'))
+ if (empty($file) and defined('AUTH_USER_FILE')) {
$file = AUTH_USER_FILE;
+ }
if (empty($file)) {
return;
}
@@ -57,24 +61,25 @@
}
}
- function mayChangePass()
+ public function mayChangePass()
{
return $this->_may_change;
}
- function userExists()
+ public function userExists()
{
if (!$this->isValidName()) {
return $this->_tryNextUser();
}
$this->_authmethod = 'File';
- if (isset($this->_file->users[$this->_userid]))
+ if (isset($this->_file->users[$this->_userid])) {
return true;
+ }
return $this->_tryNextUser();
}
- function checkPass($submitted_password)
+ public function checkPass($submitted_password)
{
if (!$this->isValidName()) {
trigger_error(_("Invalid username."), E_USER_WARNING);
@@ -86,8 +91,9 @@
if ($this->_file->verifyPassword($this->_userid, $submitted_password)) {
$this->_authmethod = 'File';
$this->_level = WIKIAUTH_USER;
- if ($this->isAdmin()) // member of the Administrators group
+ if ($this->isAdmin()) { // member of the Administrators group
$this->_level = WIKIAUTH_ADMIN;
+ }
return $this->_level;
}
@@ -94,14 +100,17 @@
return $this->_tryNextPass($submitted_password);
}
- function storePass($submitted_password)
+ public function storePass($submitted_password)
{
if (!$this->isValidName()) {
return false;
}
if ($this->_may_change) {
- $this->_file = new File_Passwd($this->_file->filename, true,
- $this->_file->filename . '.lock');
+ $this->_file = new File_Passwd(
+ $this->_file->filename,
+ true,
+ $this->_file->filename . '.lock'
+ );
$result = $this->_file->modUser($this->_userid, $submitted_password);
$this->_file->close();
$this->_file = new File_Passwd($this->_file->filename, false);
Modified: trunk/lib/WikiUser/Forbidden.php
===================================================================
--- trunk/lib/WikiUser/Forbidden.php 2022-03-24 13:43:02 UTC (rev 11011)
+++ trunk/lib/WikiUser/Forbidden.php 2022-03-24 13:44:55 UTC (rev 11012)
@@ -27,10 +27,9 @@
* That's why this class is empty, but must exist.
*/
-class _ForbiddenPassUser
- extends _ForbiddenUser
+class _ForbiddenPassUser extends _ForbiddenUser
{
- function dummy()
+ public function dummy()
{
return;
}
Modified: trunk/lib/WikiUser/FusionForge.php
===================================================================
--- trunk/lib/WikiUser/FusionForge.php 2022-03-24 13:43:02 UTC (rev 11011)
+++ trunk/lib/WikiUser/FusionForge.php 2022-03-24 13:44:55 UTC (rev 11012)
@@ -26,19 +26,21 @@
*
*/
-class _FusionForgePassUser
- extends _PassUser
+class _FusionForgePassUser extends _PassUser
{
-
public $_is_external = 0;
- function __construct($UserName = '', $prefs = false)
+ public function __construct($UserName = '', $prefs = false)
{
- if ($prefs) $this->_prefs = $prefs;
- if (!isset($this->_prefs->_method))
+ if ($prefs) {
+ $this->_prefs = $prefs;
+ }
+ if (!isset($this->_prefs->_method)) {
parent::__construct($UserName);
- if ($UserName)
+ }
+ if ($UserName) {
$this->_userid = $UserName;
+ }
$this->_authmethod = 'FusionForge';
// Is this double check really needed?
@@ -50,7 +52,7 @@
}
}
- function userExists()
+ public function userExists()
{
global $group_id;
@@ -96,7 +98,7 @@
return false;
}
- function checkPass($submitted_password)
+ public function checkPass($submitted_password)
{
return $this->userExists()
? ($this->isAdmin() ? WIKIAUTH_ADMIN : WIKIAUTH_USER)
@@ -103,7 +105,7 @@
: WIKIAUTH_ANON;
}
- function mayChangePass()
+ public function mayChangePass()
{
return false;
}
Modified: trunk/lib/WikiUser/HttpAuth.php
===================================================================
--- trunk/lib/WikiUser/HttpAuth.php 2022-03-24 13:43:02 UTC (rev 11011)
+++ trunk/lib/WikiUser/HttpAuth.php 2022-03-24 13:44:55 UTC (rev 11012)
@@ -35,16 +35,19 @@
* header('Authorization: Basic '.base64_encode("$userid:$passwd")."\r\n";
*/
-class _HttpAuthPassUser
- extends _PassUser
+class _HttpAuthPassUser extends _PassUser
{
- function __construct($UserName = '', $prefs = false)
+ public function __construct($UserName = '', $prefs = false)
{
- if ($prefs) $this->_prefs = $prefs;
- if (!isset($this->_prefs->_method))
+ if ($prefs) {
+ $this->_prefs = $prefs;
+ }
+ if (!isset($this->_prefs->_method)) {
parent::__construct($UserName);
- if ($UserName)
+ }
+ if ($UserName) {
$this->_userid = $UserName;
+ }
$this->_authmethod = 'HttpAuth';
// Is this double check really needed?
@@ -58,7 +61,7 @@
// FIXME! This doesn't work yet!
// Allow httpauth by other method: Admin for now only
- function _fake_auth($userid, $passwd)
+ public function _fake_auth($userid, $passwd)
{
return false;
@@ -74,39 +77,48 @@
*/
}
- function logout()
+ public function logout()
{
- if (!isset($_SERVER))
+ if (!isset($_SERVER)) {
$_SERVER =& $GLOBALS['HTTP_SERVER_VARS'];
+ }
// Maybe we should random the realm to really force a logout.
// But the next login will fail.
// TODO: On AUTH_TYPE=NTLM this will fail. Only Basic supported so far.
header('WWW-Authenticate: Basic realm="' . WIKI_NAME . '"');
- if (strstr(php_sapi_name(), 'apache'))
+ if (strstr(php_sapi_name(), 'apache')) {
header('HTTP/1.0 401 Unauthorized');
- else
- header("Status: 401 Access Denied"); //IIS and CGI need that
+ } else {
+ header("Status: 401 Access Denied");
+ } //IIS and CGI need that
unset($GLOBALS['REMOTE_USER']);
unset($_SERVER['PHP_AUTH_USER']);
unset($_SERVER['PHP_AUTH_PW']);
}
- function _http_username()
+ public function _http_username()
{
- if (!isset($_SERVER))
+ if (!isset($_SERVER)) {
$_SERVER =& $GLOBALS['HTTP_SERVER_VARS'];
- if (!empty($_SERVER['PHP_AUTH_USER']))
+ }
+ if (!empty($_SERVER['PHP_AUTH_USER'])) {
return $_SERVER['PHP_AUTH_USER'];
- if (!empty($_SERVER['REMOTE_USER']))
+ }
+ if (!empty($_SERVER['REMOTE_USER'])) {
return $_SERVER['REMOTE_USER'];
- if (!empty($GLOBALS['HTTP_ENV_VARS']['REMOTE_USER']))
+ }
+ if (!empty($GLOBALS['HTTP_ENV_VARS']['REMOTE_USER'])) {
return $GLOBALS['HTTP_ENV_VARS']['REMOTE_USER'];
- if (!empty($GLOBALS['REMOTE_USER']))
+ }
+ if (!empty($GLOBALS['REMOTE_USER'])) {
return $GLOBALS['REMOTE_USER'];
+ }
// IIS + Basic
if (!empty($_SERVER['HTTP_AUTHORIZATION'])) {
- list($userid, $passwd) = explode(':',
- base64_decode(substr($_SERVER['HTTP_AUTHORIZATION'], 6)));
+ list($userid, $passwd) = explode(
+ ':',
+ base64_decode(substr($_SERVER['HTTP_AUTHORIZATION'], 6))
+ );
return $userid;
}
return '';
@@ -113,10 +125,11 @@
}
// force http auth authorization
- function userExists()
+ public function userExists()
{
- if (!isset($_SERVER))
+ if (!isset($_SERVER)) {
$_SERVER =& $GLOBALS['HTTP_SERVER_VARS'];
+ }
$username = $this->_http_username();
if (strstr($username, "\\")
and isset($_SERVER['AUTH_TYPE'])
@@ -142,13 +155,14 @@
// we should check if he is a member of admin,
// because HttpAuth has its own logic.
$this->_level = WIKIAUTH_USER;
- if ($this->isAdmin())
+ if ($this->isAdmin()) {
$this->_level = WIKIAUTH_ADMIN;
+ }
return $this;
}
// ignore password, this is checked by the webservers http auth.
- function checkPass($submitted_password)
+ public function checkPass($submitted_password)
{
return $this->userExists()
? ($this->isAdmin() ? WIKIAUTH_ADMIN : WIKIAUTH_USER)
@@ -155,7 +169,7 @@
: WIKIAUTH_ANON;
}
- function mayChangePass()
+ public function mayChangePass()
{
return false;
}
Modified: trunk/lib/WikiUser/HttpAuthUpper.php
===================================================================
--- trunk/lib/WikiUser/HttpAuthUpper.php 2022-03-24 13:43:02 UTC (rev 11011)
+++ trunk/lib/WikiUser/HttpAuthUpper.php 2022-03-24 13:44:55 UTC (rev 11012)
@@ -36,16 +36,19 @@
* header('Authorization: Basic '.base64_encode("$userid:$passwd")."\r\n";
*/
-class _HttpAuthUpperPassUser
- extends _PassUser
+class _HttpAuthUpperPassUser extends _PassUser
{
- function __construct($UserName = '', $prefs = false)
+ public function __construct($UserName = '', $prefs = false)
{
- if ($prefs) $this->_prefs = $prefs;
- if (!isset($this->_prefs->_method))
+ if ($prefs) {
+ $this->_prefs = $prefs;
+ }
+ if (!isset($this->_prefs->_method)) {
parent::__construct($UserName);
- if ($UserName)
+ }
+ if ($UserName) {
$this->_userid = $UserName;
+ }
$this->_authmethod = 'HttpAuthUpper';
// Is this double check really needed?
@@ -59,7 +62,7 @@
// FIXME! This doesn't work yet!
// Allow httpauth by other method: Admin for now only
- function _fake_auth($userid, $passwd)
+ public function _fake_auth($userid, $passwd)
{
return false;
@@ -75,39 +78,48 @@
*/
}
- function logout()
+ public function logout()
{
- if (!isset($_SERVER))
+ if (!isset($_SERVER)) {
$_SERVER =& $GLOBALS['HTTP_SERVER_VARS'];
+ }
// Maybe we should random the realm to really force a logout.
// But the next login will fail.
// TODO: On AUTH_TYPE=NTLM this will fail. Only Basic supported so far.
header('WWW-Authenticate: Basic realm="' . WIKI_NAME . '"');
- if (strstr(php_sapi_name(), 'apache'))
+ if (strstr(php_sapi_name(), 'apache')) {
header('HTTP/1.0 401 Unauthorized');
- else
- header("Status: 401 Access Denied"); //IIS and CGI need that
+ } else {
+ header("Status: 401 Access Denied");
+ } //IIS and CGI need that
unset($GLOBALS['REMOTE_USER']);
unset($_SERVER['PHP_AUTH_USER']);
unset($_SERVER['PHP_AUTH_PW']);
}
- function _http_username()
+ public function _http_username()
{
- if (!isset($_SERVER))
+ if (!isset($_SERVER)) {
$_SERVER =& $GLOBALS['HTTP_SERVER_VARS'];
- if (!empty($_SERVER['PHP_AUTH_USER']))
+ }
+ if (!empty($_SERVER['PHP_AUTH_USER'])) {
return $_SERVER['PHP_AUTH_USER'];
- if (!empty($_SERVER['REMOTE_USER']))
+ }
+ if (!empty($_SERVER['REMOTE_USER'])) {
return $_SERVER['REMOTE_USER'];
- if (!empty($GLOBALS['HTTP_ENV_VARS']['REMOTE_USER']))
+ }
+ if (!empty($GLOBALS['HTTP_ENV_VARS']['REMOTE_USER'])) {
return $GLOBALS['HTTP_ENV_VARS']['REMOTE_USER'];
- if (!empty($GLOBALS['REMOTE_USER']))
+ }
+ if (!empty($GLOBALS['REMOTE_USER'])) {
return $GLOBALS['REMOTE_USER'];
+ }
// IIS + Basic
if (!empty($_SERVER['HTTP_AUTHORIZATION'])) {
- list($userid, $passwd) = explode(':',
- base64_decode(substr($_SERVER['HTTP_AUTHORIZATION'], 6)));
+ list($userid, $passwd) = explode(
+ ':',
+ base64_decode(substr($_SERVER['HTTP_AUTHORIZATION'], 6))
+ );
return $userid;
}
return '';
@@ -114,7 +126,7 @@
}
// special: force upcase username
- function UserName()
+ public function UserName()
{
if (!empty($this->_userid)) {
$this->_userid = strtoupper($this->_userid);
@@ -124,10 +136,11 @@
}
// force http auth authorization
- function userExists()
+ public function userExists()
{
- if (!isset($_SERVER))
+ if (!isset($_SERVER)) {
$_SERVER =& $GLOBALS['HTTP_SERVER_VARS'];
+ }
$username = strtoupper($this->_http_username());
if (strstr($username, "\\")
and isset($_SERVER['AUTH_TYPE'])
@@ -153,13 +166,14 @@
// we should check if he is a member of admin,
// because HttpAuth has its own logic.
$this->_level = WIKIAUTH_USER;
- if ($this->isAdmin())
+ if ($this->isAdmin()) {
$this->_level = WIKIAUTH_ADMIN;
+ }
return $this;
}
// ignore password, this is checked by the webservers http auth.
- function checkPass($submitted_password)
+ public function checkPass($submitted_password)
{
return $this->userExists()
? ($this->isAdmin() ? WIKIAUTH_ADMIN : WIKIAUTH_USER)
@@ -166,7 +180,7 @@
: WIKIAUTH_ANON;
}
- function mayChangePass()
+ public function mayChangePass()
{
return false;
}
Modified: trunk/lib/WikiUser/IMAP.php
===================================================================
--- trunk/lib/WikiUser/IMAP.php 2022-03-24 13:43:02 UTC (rev 11011)
+++ trunk/lib/WikiUser/IMAP.php 2022-03-24 13:44:55 UTC (rev 11012)
@@ -22,8 +22,7 @@
*
*/
-class _IMAPPassUser
- extends _PassUser
+class _IMAPPassUser extends _PassUser
/**
* Define the var IMAP_AUTH_HOST in config/config.ini (with port probably)
*
@@ -30,39 +29,53 @@
* Preferences are handled in _PassUser
*/
{
- function checkPass($submitted_password)
+ public function checkPass($submitted_password)
{
if (!$this->isValidName()) {
- if (DEBUG & _DEBUG_LOGIN) trigger_error(get_class($this) . "::checkPass => failed isValidName", E_USER_WARNING);
+ if (DEBUG & _DEBUG_LOGIN) {
+ trigger_error(get_class($this) . "::checkPass => failed isValidName", E_USER_WARNING);
+ }
trigger_error(_("Invalid username."), E_USER_WARNING);
return $this->_tryNextPass($submitted_password);
}
if (!$this->_checkPassLength($submitted_password)) {
- if (DEBUG & _DEBUG_LOGIN) trigger_error(get_class($this) . "::checkPass => failed checkPassLength", E_USER_WARNING);
+ if (DEBUG & _DEBUG_LOGIN) {
+ trigger_error(get_class($this) . "::checkPass => failed checkPassLength", E_USER_WARNING);
+ }
return WIKIAUTH_FORBIDDEN;
}
$userid = $this->_userid;
- $mbox = @imap_open("{" . IMAP_AUTH_HOST . "}",
- $userid, $submitted_password, OP_HALFOPEN);
+ $mbox = @imap_open(
+ "{" . IMAP_AUTH_HOST . "}",
+ $userid,
+ $submitted_password,
+ OP_HALFOPEN
+ );
if ($mbox) {
imap_close($mbox);
$this->_authmethod = 'IMAP';
- if (DEBUG & _DEBUG_LOGIN) trigger_error(get_class($this) . "::checkPass => ok", E_USER_WARNING);
+ if (DEBUG & _DEBUG_LOGIN) {
+ trigger_error(get_class($this) . "::checkPass => ok", E_USER_WARNING);
+ }
$this->_level = WIKIAUTH_USER;
return $this->_level;
} else {
if ($submitted_password != "") { // if LENGTH 0 is allowed
- trigger_error(_("Unable to connect to IMAP server ") . IMAP_AUTH_HOST,
- E_USER_WARNING);
+ trigger_error(
+ _("Unable to connect to IMAP server ") . IMAP_AUTH_HOST,
+ E_USER_WARNING
+ );
}
}
- if (DEBUG & _DEBUG_LOGIN) trigger_error(get_class($this) . "::checkPass => wrong", E_USER_WARNING);
+ if (DEBUG & _DEBUG_LOGIN) {
+ trigger_error(get_class($this) . "::checkPass => wrong", E_USER_WARNING);
+ }
return $this->_tryNextPass($submitted_password);
}
//CHECKME: this will not be okay for the auth policy strict
- function userExists()
+ public function userExists()
{
return true;
@@ -76,9 +89,11 @@
*/
}
- function mayChangePass()
+ public function mayChangePass()
{
- if (DEBUG & _DEBUG_LOGIN) trigger_error(get_class($this) . "::mayChangePass => false", E_USER_WARNING);
+ if (DEBUG & _DEBUG_LOGIN) {
+ trigger_error(get_class($this) . "::mayChangePass => false", E_USER_WARNING);
+ }
return false;
}
}
Modified: trunk/lib/WikiUser/LDAP.php
===================================================================
--- trunk/lib/WikiUser/LDAP.php 2022-03-24 13:43:02 UTC (rev 11011)
+++ trunk/lib/WikiUser/LDAP.php 2022-03-24 13:44:55 UTC (rev 11012)
@@ -22,8 +22,7 @@
*
*/
-class _LDAPPassUser
- extends _PassUser
+class _LDAPPassUser extends _PassUser
/**
* Define the vars LDAP_AUTH_HOST and LDAP_BASE_DN in config/config.ini
*
@@ -34,7 +33,7 @@
* ->_init()
* connect and bind to the LDAP host
*/
- function _init()
+ public function _init()
{
if ($this->_ldap = ldap_connect(LDAP_AUTH_HOST)) { // must be a valid LDAP server!
global $LDAP_SET_OPTION;
@@ -45,19 +44,27 @@
ldap_set_option($this->_ldap, $key, $value);
}
}
- if (LDAP_AUTH_USER)
- if (LDAP_AUTH_PASSWORD)
+ if (LDAP_AUTH_USER) {
+ if (LDAP_AUTH_PASSWORD) {
// Windows Active Directory Server is strict
$r = ldap_bind($this->_ldap, LDAP_AUTH_USER, LDAP_AUTH_PASSWORD);
- else
+ } else {
$r = ldap_bind($this->_ldap, LDAP_AUTH_USER);
- else
- $r = true; // anonymous bind allowed
+ }
+ } else {
+ $r = true;
+ } // anonymous bind allowed
if (!$r) {
$this->_free();
- trigger_error(sprintf(_("Unable to bind LDAP server %s using %s %s"),
- LDAP_AUTH_HOST, LDAP_AUTH_USER, LDAP_AUTH_PASSWORD),
- E_USER_WARNING);
+ trigger_error(
+ sprintf(
+ _("Unable to bind LDAP server %s using %s %s"),
+ LDAP_AUTH_HOST,
+ LDAP_AUTH_USER,
+ LDAP_AUTH_PASSWORD
+ ),
+ E_USER_WARNING
+ );
return false;
}
return $this->_ldap;
@@ -69,10 +76,14 @@
/**
* free and close the bound ressources
*/
- function _free()
+ public function _free()
{
- if (isset($this->_sr) and is_resource($this->_sr)) ldap_free_result($this->_sr);
- if (isset($this->_ldap) and is_resource($this->_ldap)) ldap_close($this->_ldap);
+ if (isset($this->_sr) and is_resource($this->_sr)) {
+ ldap_free_result($this->_sr);
+ }
+ if (isset($this->_ldap) and is_resource($this->_ldap)) {
+ ldap_close($this->_ldap);
+ }
unset($this->_sr);
unset($this->_ldap);
}
@@ -88,7 +99,8 @@
*/
private function _stringEscape($name)
{
- return strtr(utf8_encode($name),
+ return strtr(
+ utf8_encode($name),
array("*" => "\\2a",
"?" => "\\3f",
"(" => "\\28",
@@ -95,7 +107,8 @@
")" => "\\29",
"\\" => "\\5c",
'"' => '\"',
- "\0" => "\\00"));
+ "\0" => "\\00")
+ );
}
/**
@@ -102,9 +115,11 @@
* LDAP names may contain every utf-8 character. However we restrict them a bit for convenience.
* @see _stringEscape()
*/
- function isValidName($userid = false)
+ public function isValidName($userid = false)
{
- if (!$userid) $userid = $this->_userid;
+ if (!$userid) {
+ $userid = $this->_userid;
+ }
// We are more restrictive here, but must allow explitly utf-8
return preg_match("/^[\-\w_\.@ ]+$/u", $userid) and strlen($userid) < 64;
}
@@ -137,9 +152,8 @@
* @see http://www.faqs.org/rfcs/rfc4514.html LDAP String Representation of Distinguished Names
* @see http://www.faqs.org/rfcs/rfc3454.html stringprep
*/
- function checkPass($submitted_password)
+ public function checkPass($submitted_password)
{
-
$this->_authmethod = 'LDAP';
$this->_userid = trim($this->_userid);
$userid = $this->_userid;
@@ -175,8 +189,9 @@
}
$info = ldap_get_entries($ldap, $this->_sr);
if (empty($info["count"])) {
- if (DEBUG)
+ if (DEBUG) {
trigger_error(_("User not found in LDAP"), E_USER_WARNING);
+ }
$this->_free();
return $this->_tryNextPass($submitted_password);
}
@@ -209,10 +224,13 @@
}
}
}
- if (DEBUG)
- trigger_error(_("Wrong password: ") .
+ if (DEBUG) {
+ trigger_error(
+ _("Wrong password: ") .
str_repeat("*", strlen($submitted_password)),
- E_USER_WARNING);
+ E_USER_WARNING
+ );
+ }
$this->_free();
} else {
$this->_free();
@@ -223,13 +241,15 @@
}
- function userExists()
+ public function userExists()
{
$this->_userid = trim($this->_userid);
$userid = $this->_userid;
if (strstr($userid, '*')) {
- trigger_error(fmt("Invalid username “%s” for LDAP Auth", $userid),
- E_USER_WARNING);
+ trigger_error(
+ fmt("Invalid username “%s” for LDAP Auth", $userid),
+ E_USER_WARNING
+ );
return false;
}
if ($ldap = $this->_init()) {
@@ -251,9 +271,8 @@
return $this->_tryNextUser();
}
- function mayChangePass()
+ public function mayChangePass()
{
return false;
}
-
}
Modified: trunk/lib/WikiUser/LdapUpper.php
===================================================================
--- trunk/lib/WikiUser/LdapUpper.php 2022-03-24 13:43:02 UTC (rev 11011)
+++ trunk/lib/WikiUser/LdapUpper.php 2022-03-24 13:44:55 UTC (rev 11012)
@@ -29,21 +29,21 @@
* Define the vars LDAP_AUTH_HOST, LDAP_BASE_DN, LDAP_SEARCH_FILTER in config/config.ini
* Preferences are handled in _PassUser
*/
-class _LdapUpperPassUser
- extends _LDAPPassUser
+class _LdapUpperPassUser extends _LDAPPassUser
{
- function UserName()
+ public function UserName()
{
if (!empty($this->_userid)) {
$this->_userid = trim(strtoupper($this->_userid));
- if (!empty($this->_HomePagehandle) and is_object($this->_HomePagehandle))
+ if (!empty($this->_HomePagehandle) and is_object($this->_HomePagehandle)) {
$this->_HomePagehandle->_pagename = $this->_userid;
+ }
return strtoupper($this->_userid);
}
return '';
}
- function userExists()
+ public function userExists()
{
// lowercase check and uppercase visibility
$this->_userid = trim(strtoupper($this->_userid));
Modified: trunk/lib/WikiUser/OpenID.php
===================================================================
--- trunk/lib/WikiUser/OpenID.php 2022-03-24 13:43:02 UTC (rev 11011)
+++ trunk/lib/WikiUser/OpenID.php 2022-03-24 13:44:55 UTC (rev 11012)
@@ -31,8 +31,7 @@
// requires the openssl extension
require_once 'lib/HttpClient.php';
-class _OpenIDPassUser
- extends _PassUser
+class _OpenIDPassUser extends _PassUser
/**
* Preferences are handled in _PassUser
*/
@@ -50,7 +49,7 @@
* @param mixed $extensions extension object or array of extensions objects
* @return bool
*/
- function verify($params, &$identity = "", $extensions = null)
+ public function verify($params, &$identity = "", $extensions = null)
{
$version = 1.1;
$this->_setError("");
@@ -119,8 +118,14 @@
* object to perform HTTP or HTML form redirection
* @return bool
*/
- function _checkId($immediate, $id, $returnTo = null, $root = null,
- $extensions = null, $response = null)
+ public function _checkId(
+ $immediate,
+ $id,
+ $returnTo = null,
+ $root = null,
+ $extensions = null,
+ $response = null
+ )
{
$this->_setError('');
@@ -143,7 +148,8 @@
$handle,
$macFunc,
$secret,
- $expires)
+ $expires
+ )
) {
/* Use dumb mode */
unset($handle);
@@ -179,7 +185,9 @@
// See lib/WikiUser/FaceBook.php how to handle http requests
$web = new HttpClient("$server", 80);
- if (DEBUG & _DEBUG_LOGIN) $web->setDebug(true);
+ if (DEBUG & _DEBUG_LOGIN) {
+ $web->setDebug(true);
+ }
if (empty($root)) {
//$root = Zend_OpenId::selfUrl();
@@ -203,25 +211,30 @@
return true;
}
- function _setError($message)
+ public function _setError($message)
{
$this->_error = $message;
}
- function checkPass($password)
+ public function checkPass($password)
{
if (!loadPhpExtension('openssl')) {
trigger_error(
sprintf(_("The PECL %s extension cannot be loaded."), "openssl")
. sprintf(_(" %s AUTH ignored."), 'OpenID'),
- E_USER_WARNING);
+ E_USER_WARNING
+ );
return $this->_tryNextUser();
}
$retval = $this->_checkId(false, $id, $returnTo, $root, $extensions, $response);
$this->_authmethod = 'OpenID';
- if (DEBUG & _DEBUG_LOGIN) trigger_error(get_class($this) . "::checkPass => $retval",
- E_USER_WARNING);
+ if (DEBUG & _DEBUG_LOGIN) {
+ trigger_error(
+ get_class($this) . "::checkPass => $retval",
+ E_USER_WARNING
+ );
+ }
if ($retval) {
$this->_level = WIKIAUTH_USER;
} else {
@@ -231,27 +244,31 @@
}
/* do nothing. the login/redirect is done in checkPass */
- function userExists()
+ public function userExists()
{
if (!$this->isValidName($this->_userid)) {
return $this->_tryNextUser();
}
if (!loadPhpExtension('openssl')) {
- trigger_error
- (sprintf(_("The PECL %s extension cannot be loaded."), "openssl")
+ trigger_error(
+ sprintf(_("The PECL %s extension cannot be loaded."), "openssl")
. sprintf(_(" %s AUTH ignored."), 'OpenID'),
- E_USER_WARNING);
+ E_USER_WARNING
+ );
return $this->_tryNextUser();
}
- if (DEBUG & _DEBUG_LOGIN)
+ if (DEBUG & _DEBUG_LOGIN) {
trigger_error(get_class($this) . "::userExists => true (dummy)", E_USER_WARNING);
+ }
return true;
}
// no quotes and shorter than 128
- function isValidName($userid = false)
+ public function isValidName($userid = false)
{
- if (!$this->_userid) return false;
+ if (!$this->_userid) {
+ return false;
+ }
return !preg_match('/[\"\']/', $this->_userid) and strlen($this->_userid) < 128;
}
}
Modified: trunk/lib/WikiUser/POP3.php
===================================================================
--- trunk/lib/WikiUser/POP3.php 2022-03-24 13:43:02 UTC (rev 11011)
+++ trunk/lib/WikiUser/POP3.php 2022-03-24 13:44:55 UTC (rev 11012)
@@ -24,30 +24,33 @@
require_once 'lib/WikiUser/IMAP.php';
-class _POP3PassUser
- extends _IMAPPassUser
+class _POP3PassUser extends _IMAPPassUser
{
/**
* Define the var POP3_AUTH_HOST in config/config.ini
* Preferences are handled in _PassUser
*/
- function checkPass($submitted_password)
+ public function checkPass($submitted_password)
{
if (!$this->isValidName()) {
trigger_error(_("Invalid username."), E_USER_WARNING);
- if (DEBUG & _DEBUG_LOGIN) trigger_error(get_class($this) . "::checkPass => failed isValidName", E_USER_WARNING);
+ if (DEBUG & _DEBUG_LOGIN) {
+ trigger_error(get_class($this) . "::checkPass => failed isValidName", E_USER_WARNING);
+ }
return $this->_tryNextPass($submitted_password);
}
if (!$this->_checkPassLength($submitted_password)) {
- if (DEBUG & _DEBUG_LOGIN) trigger_error(get_class($this) . "::checkPass => failed checkPassLength", E_USER_WARNING);
+ if (DEBUG & _DEBUG_LOGIN) {
+ trigger_error(get_class($this) . "::checkPass => failed checkPassLength", E_USER_WARNING);
+ }
return WIKIAUTH_FORBIDDEN;
}
$userid = $this->_userid;
$pass = $submitted_password;
$host = defined('POP3_AUTH_HOST') ? POP3_AUTH_HOST : 'localhost:110';
- if (defined('POP3_AUTH_PORT'))
+ if (defined('POP3_AUTH_PORT')) {
$port = POP3_AUTH_PORT;
- elseif (strstr($host, ':')) {
+ } elseif (strstr($host, ':')) {
list(, $port) = explode(':', $host);
} else {
$port = 110;
@@ -78,11 +81,15 @@
fgets($fp, 1024);
fclose($fp);
} else {
- trigger_error(sprintf(_("Couldn't connect to %s"), "POP3_AUTH_HOST " . $host . ':' . $port),
- E_USER_WARNING);
+ trigger_error(
+ sprintf(_("Couldn't connect to %s"), "POP3_AUTH_HOST " . $host . ':' . $port),
+ E_USER_WARNING
+ );
}
$this->_authmethod = 'POP3';
- if (DEBUG & _DEBUG_LOGIN) trigger_error(get_class($this) . "::checkPass => $retval", E_USER_WARNING);
+ if (DEBUG & _DEBUG_LOGIN) {
+ trigger_error(get_class($this) . "::checkPass => $retval", E_USER_WARNING);
+ }
if ($retval) {
$this->_level = WIKIAUTH_USER;
} else {
@@ -91,9 +98,11 @@
return $this->_level;
}
- function __userExists()
+ public function __userExists()
{
- if (DEBUG & _DEBUG_LOGIN) trigger_error(get_class($this) . "::userExists => true (dummy)", E_USER_WARNING);
+ if (DEBUG & _DEBUG_LOGIN) {
+ trigger_error(get_class($this) . "::userExists => true (dummy)", E_USER_WARNING);
+ }
return true;
}
}
Modified: trunk/lib/WikiUser/PdoDb.php
===================================================================
--- trunk/lib/WikiUser/PdoDb.php 2022-03-24 13:43:02 UTC (rev 11011)
+++ trunk/lib/WikiUser/PdoDb.php 2022-03-24 13:44:55 UTC (rev 11012)
@@ -24,8 +24,7 @@
include_once 'lib/WikiUser/Db.php';
-class _PdoDbPassUser
- extends _DbPassUser
+class _PdoDbPassUser extends _DbPassUser
/**
* PDO DB methods (PHP5)
* prepare, bind, execute.
@@ -37,7 +36,7 @@
{
public $_authmethod = 'PDODb';
- function __construct($UserName = '', $prefs = false)
+ public function __construct($UserName = '', $prefs = false)
{
/**
* @var WikiRequest $request
@@ -62,7 +61,7 @@
return $this;
}
- function userExists()
+ public function userExists()
{
/**
* @var WikiRequest $request
@@ -99,17 +98,22 @@
trigger_error("SQL Error: " . $e->getMessage(), E_USER_WARNING);
return false;
}
- if ($this->_authselect->fetchColumn())
+ if ($this->_authselect->fetchColumn()) {
return true;
+ }
} else {
- if (!$dbi->getAuthParam('auth_user_exists'))
- trigger_error(fmt("%s is missing", 'DBAUTH_AUTH_USER_EXISTS'),
- E_USER_WARNING);
+ if (!$dbi->getAuthParam('auth_user_exists')) {
+ trigger_error(
+ fmt("%s is missing", 'DBAUTH_AUTH_USER_EXISTS'),
+ E_USER_WARNING
+ );
+ }
$this->_authcheck = $dbh->prepare($dbi->getAuthParam('auth_check'));
$this->_authcheck->bindParam("userid", $this->_userid, PDO::PARAM_STR, 48);
$this->_authcheck->execute();
- if ($this->_authcheck->fetchColumn())
+ if ($this->_authcheck->fetchColumn()) {
return true;
+ }
}
// User does not exist yet.
// Maybe the user is allowed to create himself. Generally not wanted in
@@ -136,13 +140,14 @@
trigger_error("SQL Error: " . $e->getMessage(), E_USER_WARNING);
return false;
}
- if ($rs)
+ if ($rs) {
return true;
+ }
}
return $this->_tryNextUser();
}
- function checkPass($submitted_password)
+ public function checkPass($submitted_password)
{
//global $DBAuthParams;
$this->getAuthDbh();
@@ -155,12 +160,19 @@
if (!$this->_checkPassLength($submitted_password)) {
return WIKIAUTH_FORBIDDEN;
}
- if (!isset($this->_authselect))
+ if (!isset($this->_authselect)) {
$this->userExists();
- if (!isset($this->_authselect))
- trigger_error(fmt("Either %s is missing or DATABASE_TYPE != “%s”",
- 'DBAUTH_AUTH_CHECK', 'SQL'),
- E_USER_WARNING);
+ }
+ if (!isset($this->_authselect)) {
+ trigger_error(
+ fmt(
+ "Either %s is missing or DATABASE_TYPE != “%s”",
+ 'DBAUTH_AUTH_CHECK',
+ 'SQL'
+ ),
+ E_USER_WARNING
+ );
+ }
//NOTE: for auth_crypt_method='crypt' defined('ENCRYPTED_PASSWD',true) must be set
if ($this->_auth_crypt_method == 'crypt') {
@@ -199,7 +211,7 @@
}
}
- function mayChangePass()
+ public function mayChangePass()
{
/**
* @var WikiRequest $request
@@ -209,7 +221,7 @@
return $request->_dbi->getAuthParam('auth_update');
}
- function storePass($submitted_password)
+ public function storePass($submitted_password)
{
/**
* @var WikiRequest $request
@@ -231,9 +243,14 @@
}
}
if (empty($this->_authupdate)) {
- trigger_error(fmt("Either %s is missing or DATABASE_TYPE != “%s”",
- 'DBAUTH_AUTH_UPDATE', 'SQL'),
- E_USER_WARNING);
+ trigger_error(
+ fmt(
+ "Either %s is missing or DATABASE_TYPE != “%s”",
+ 'DBAUTH_AUTH_UPDATE',
+ 'SQL'
+ ),
+ E_USER_WARNING
+ );
return false;
}
Modified: trunk/lib/WikiUser/PearDb.php
===================================================================
--- trunk/lib/WikiUser/PearDb.php 2022-03-24 13:43:02 UTC (rev 11011)
+++ trunk/lib/WikiUser/PearDb.php 2022-03-24 13:44:55 UTC (rev 11012)
@@ -24,8 +24,7 @@
include_once 'lib/WikiUser/Db.php';
-class _PearDbPassUser
- extends _DbPassUser
+class _PearDbPassUser extends _DbPassUser
/**
* Pear DB methods
* Now optimized not to use prepare, ...query(sprintf($sql,quote())) instead.
@@ -36,7 +35,7 @@
{
public $_authmethod = 'PearDb';
- function __construct($UserName = '', $prefs = false)
+ public function __construct($UserName = '', $prefs = false)
{
/**
* @var WikiRequest $request
@@ -61,7 +60,7 @@
return $this;
}
- function userExists()
+ public function userExists()
{
/**
* @var WikiRequest $request
@@ -80,8 +79,10 @@
$dbi =& $request->_dbi;
// Prepare the configured auth statements
if ($dbi->getAuthParam('auth_check') and empty($this->_authselect)) {
- $this->_authselect = $this->prepare($dbi->getAuthParam('auth_check'),
- array("password", "userid"));
+ $this->_authselect = $this->prepare(
+ $dbi->getAuthParam('auth_check'),
+ array("password", "userid")
+ );
}
//NOTE: for auth_crypt_method='crypt' no special auth_user_exists is needed
if (!$dbi->getAuthParam('auth_user_exists')
@@ -89,16 +90,21 @@
and $this->_authselect
) {
$rs = $dbh->query(sprintf($this->_authselect, $dbh->quote($this->_userid)));
- if ($rs->numRows())
+ if ($rs->numRows()) {
return true;
+ }
} else {
- if (!$dbi->getAuthParam('auth_user_exists'))
- trigger_error(fmt("%s is missing", 'DBAUTH_AUTH_USER_EXISTS'),
- E_USER_WARNING);
+ if (!$dbi->getAuthParam('auth_user_exists')) {
+ trigger_error(
+ fmt("%s is missing", 'DBAUTH_AUTH_USER_EXISTS'),
+ E_USER_WARNING
+ );
+ }
$this->_authcheck = $this->prepare($dbi->getAuthParam('auth_user_exists'), "userid");
$rs = $dbh->query(sprintf($this->_authcheck, $dbh->quote($this->_userid)));
- if ($rs->numRows())
+ if ($rs->numRows()) {
return true;
+ }
}
// User does not exist yet.
// Maybe the user is allowed to create himself. Generally not wanted in
@@ -105,8 +111,10 @@
// external databases, but maybe wanted for the wiki database, for performance
// reasons
if (empty($this->_authcreate) and $dbi->getAuthParam('auth_create')) {
- $this->_authcreate = $this->prepare($dbi->getAuthParam('auth_create'),
- array("password", "userid"));
+ $this->_authcreate = $this->prepare(
+ $dbi->getAuthParam('auth_create'),
+ array("password", "userid")
+ );
}
if (!empty($this->_authcreate) and
isset($GLOBALS['HTTP_POST_VARS']['auth']) and
@@ -113,15 +121,17 @@
isset($GLOBALS['HTTP_POST_VARS']['auth']['passwd'])
) {
$passwd = $GLOBALS['HTTP_POST_VARS']['auth']['passwd'];
- $dbh->simpleQuery(sprintf($this->_authcreate,
+ $dbh->simpleQuery(sprintf(
+ $this->_authcreate,
$dbh->quote($passwd),
- $dbh->quote($this->_userid)));
+ $dbh->quote($this->_userid)
+ ));
return true;
}
return $this->_tryNextUser();
}
- function checkPass($submitted_password)
+ public function checkPass($submitted_password)
{
//global $DBAuthParams;
$this->getAuthDbh();
@@ -134,12 +144,19 @@
if (!$this->_checkPassLength($submitted_password)) {
return WIKIAUTH_FORBIDDEN;
}
- if (!isset($this->_authselect))
+ if (!isset($this->_authselect)) {
$this->userExists();
- if (!isset($this->_authselect))
- trigger_error(fmt("Either %s is missing or DATABASE_TYPE != “%s”",
- 'DBAUTH_AUTH_CHECK', 'SQL'),
- E_USER_WARNING);
+ }
+ if (!isset($this->_authselect)) {
+ trigger_error(
+ fmt(
+ "Either %s is missing or DATABASE_TYPE != “%s”",
+ 'DBAUTH_AUTH_CHECK',
+ 'SQL'
+ ),
+ E_USER_WARNING
+ );
+ }
//NOTE: for auth_crypt_method='crypt' defined('ENCRYPTED_PASSWD',true) must be set
$dbh = &$this->_auth_dbi;
@@ -148,9 +165,11 @@
$result = $this->_checkPass($submitted_password, $stored_password);
} else {
// be position independent
- $okay = $dbh->getOne(sprintf($this->_authselect,
+ $okay = $dbh->getOne(sprintf(
+ $this->_authselect,
$dbh->quote($submitted_password),
- $dbh->quote($this->_userid)));
+ $dbh->quote($this->_userid)
+ ));
$result = !empty($okay);
}
@@ -165,7 +184,7 @@
}
}
- function mayChangePass()
+ public function mayChangePass()
{
/**
* @var WikiRequest $request
@@ -175,7 +194,7 @@
return $request->_dbi->getAuthParam('auth_update');
}
- function storePass($submitted_password)
+ public function storePass($submitted_password)
{
/**
* @var WikiRequest $request
@@ -189,13 +208,20 @@
$dbh = &$this->_auth_dbi;
$dbi =& $request->_dbi;
if ($dbi->getAuthParam('auth_update') and empty($this->_authupdate)) {
- $this->_authupdate = $this->prepare($dbi->getAuthParam('auth_update'),
- array("password", "userid"));
+ $this->_authupdate = $this->prepare(
+ $dbi->getAuthParam('auth_update'),
+ array("password", "userid")
+ );
}
if (empty($this->_authupdate)) {
- trigger_error(fmt("Either %s is missing or DATABASE_TYPE != “%s”",
- 'DBAUTH_AUTH_UPDATE', 'SQL'),
- E_USER_WARNING);
+ trigger_error(
+ fmt(
+ "Either %s is missing or DATABASE_TYPE != “%s”",
+ 'DBAUTH_AUTH_UPDATE',
+ 'SQL'
+ ),
+ E_USER_WARNING
+ );
return false;
}
@@ -202,8 +228,11 @@
if ($this->_auth_crypt_method == 'crypt') {
$submitted_password = crypt($submitted_password);
}
- $dbh->simpleQuery(sprintf($this->_authupdate,
- $dbh->quote($submitted_password), $dbh->quote($this->_userid)));
+ $dbh->simpleQuery(sprintf(
+ $this->_authupdate,
+ $dbh->quote($submitted_password),
+ $dbh->quote($this->_userid)
+ ));
return true;
}
}
Modified: trunk/lib/WikiUser/PersonalPage.php
===================================================================
--- trunk/lib/WikiUser/PersonalPage.php 2022-03-24 13:43:02 UTC (rev 11011)
+++ trunk/lib/WikiUser/PersonalPage.php 2022-03-24 13:44:55 UTC (rev 11012)
@@ -26,8 +26,7 @@
* This class is only to simplify the auth method dispatcher.
* It inherits almost all all methods from _PassUser.
*/
-class _PersonalPagePassUser
- extends _PassUser
+class _PersonalPagePassUser extends _PassUser
{
public $_authmethod = 'PersonalPage';
@@ -34,14 +33,16 @@
/* Very loose checking, since we properly quote the PageName.
Just trim spaces, ... See lib/stdlib.php
*/
- function isValidName($userid = false)
+ public function isValidName($userid = false)
{
- if (!$userid) $userid = $this->_userid;
+ if (!$userid) {
+ $userid = $this->_userid;
+ }
$WikiPageName = new WikiPageName($userid);
return $WikiPageName->isValid() and ($userid === $WikiPageName->name);
}
- function userExists()
+ public function userExists()
{
return $this->_HomePagehandle and $this->_HomePagehandle->exists();
}
@@ -50,7 +51,7 @@
* BUT if the user already has a homepage with an empty password
* stored, allow login but warn him to change it.
*/
- function checkPass($submitted_password)
+ public function checkPass($submitted_password)
{
if ($this->userExists()) {
$stored_password = $this->_prefs->get('passwd');
@@ -61,22 +62,26 @@
_("You stored an empty password in your “%s” page.") . "\n" .
_("Your access permissions are only for a BogoUser.") . "\n" .
_("Please set a password in UserPreferences."),
- $this->_userid), E_USER_WARNING);
+ $this->_userid
+ ), E_USER_WARNING);
$this->_level = WIKIAUTH_BOGO;
} else {
- if (!empty($submitted_password))
+ if (!empty($submitted_password)) {
trigger_error(sprintf(
_("PersonalPage login method:") . "\n" .
_("You stored an empty password in your “%s” page.") . "\n" .
_("Given password ignored.") . "\n" .
_("Please set a password in UserPreferences."),
- $this->_userid), E_USER_WARNING);
+ $this->_userid
+ ), E_USER_WARNING);
+ }
$this->_level = WIKIAUTH_USER;
}
return $this->_level;
}
- if ($this->_checkPass($submitted_password, $stored_password))
+ if ($this->_checkPass($submitted_password, $stored_password)) {
return ($this->_level = WIKIAUTH_USER);
+ }
return _PassUser::checkPass($submitted_password);
} else {
return WIKIAUTH_ANON;
Modified: trunk/lib/WikiUser/Session.php
===================================================================
--- trunk/lib/WikiUser/Session.php 2022-03-24 13:43:02 UTC (rev 11011)
+++ trunk/lib/WikiUser/Session.php 2022-03-24 13:44:55 UTC (rev 11012)
@@ -30,16 +30,18 @@
* define('AUTH_SESS_LEVEL',2);
*/
-class _SessionPassUser
- extends _PassUser
+class _SessionPassUser extends _PassUser
{
- function __construct($UserName = '', $prefs = false)
+ public function __construct($UserName = '', $prefs = false)
{
- if ($prefs) $this->_prefs = $prefs;
+ if ($prefs) {
+ $this->_prefs = $prefs;
+ }
if (!defined("AUTH_SESS_USER") or !defined("AUTH_SESS_LEVEL")) {
trigger_error(
"AUTH_SESS_USER or AUTH_SESS_LEVEL is not defined for the SessionPassUser method",
- E_USER_ERROR);
+ E_USER_ERROR
+ );
exit;
}
$sess =& $GLOBALS['HTTP_SESSION_VARS'];
@@ -59,23 +61,24 @@
} else {
$this->_userid = $sess[AUTH_SESS_USER];
}
- if (!isset($this->_prefs->_method))
+ if (!isset($this->_prefs->_method)) {
parent::__construct($this->_userid);
+ }
$this->_level = AUTH_SESS_LEVEL;
$this->_authmethod = 'Session';
}
- function userExists()
+ public function userExists()
{
return !empty($this->_userid);
}
- function checkPass($submitted_password)
+ public function checkPass($submitted_password)
{
return $this->userExists() and $this->_level > -1;
}
- function mayChangePass()
+ public function mayChangePass()
{
return false;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <var...@us...> - 2022-03-24 13:43:04
|
Revision: 11011
http://sourceforge.net/p/phpwiki/code/11011
Author: vargenau
Date: 2022-03-24 13:43:02 +0000 (Thu, 24 Mar 2022)
Log Message:
-----------
run php-cs-fixer
Modified Paths:
--------------
trunk/lib/WysiwygEdit/CKeditor.php
trunk/lib/WysiwygEdit/Wikiwyg.php
trunk/lib/WysiwygEdit/htmlarea2.php
trunk/lib/WysiwygEdit/htmlarea3.php
trunk/lib/WysiwygEdit/spaw.php
trunk/lib/WysiwygEdit/tinymce.php
Modified: trunk/lib/WysiwygEdit/CKeditor.php
===================================================================
--- trunk/lib/WysiwygEdit/CKeditor.php 2022-03-24 13:40:18 UTC (rev 11010)
+++ trunk/lib/WysiwygEdit/CKeditor.php 2022-03-24 13:43:02 UTC (rev 11011)
@@ -37,8 +37,7 @@
class WysiwygEdit_CKeditor extends WysiwygEdit
{
-
- function __construct()
+ public function __construct()
{
global $LANG;
$this->_transformer_tags = false;
@@ -53,15 +52,15 @@
oCKeditor.Config.LinkBrowserURL = oCKeditor.BasePath + 'editor/filemanager/browser/default/browser.html?Connector=connectors/php/connector.php';
oCKeditor.Config.ImageBrowserURL = oCKeditor.BasePath + 'editor/filemanager/browser/default/browser.html?Type=Image&Connector=connectors/php/connector.php';
";
- if (!empty($_REQUEST['start_debug']))
+ if (!empty($_REQUEST['start_debug'])) {
$this->_jsdefault = "\noCKeditor.Config.Debug = true;";
+ }
}
- function Head($name = 'edit[content]')
+ public function Head($name = 'edit[content]')
{
global $WikiTheme;
- $WikiTheme->addMoreHeaders
- (JavaScript('', array('src' => $this->BasePath . 'ckeditor.js',
+ $WikiTheme->addMoreHeaders(JavaScript('', array('src' => $this->BasePath . 'ckeditor.js',
'language' => 'JavaScript')));
return JavaScript("
window.onload = function()
@@ -74,13 +73,13 @@
}");
}
- function Textarea($textarea, $wikitext, $name = 'edit[content]')
+ public function Textarea($textarea, $wikitext, $name = 'edit[content]')
{
return $this->Textarea_Replace($textarea, $wikitext, $name);
}
/* either iframe or textarea */
- function Textarea_Create($textarea, $wikitext, $name = 'edit[content]')
+ public function Textarea_Create($textarea, $wikitext, $name = 'edit[content]')
{
$htmltextid = $name;
$out = HTML(
@@ -89,28 +88,35 @@
oCKeditor.Value = '" . $textarea->_content[0]->asXML() . "';"
. $this->_jsdefault . "
oCKeditor.Create();"),
- HTML::div(array("id" => $this->_wikitextid,
+ HTML::div(
+ array("id" => $this->_wikitextid,
'style' => 'display:none'),
- $wikitext),
- "\n");
+ $wikitext
+ ),
+ "\n"
+ );
return $out;
}
/* textarea only */
- function Textarea_Replace($textarea, $wikitext, $name = 'edit[content]')
+ public function Textarea_Replace($textarea, $wikitext, $name = 'edit[content]')
{
$htmltextid = $this->_htmltextid;
$textarea->SetAttr('id', $htmltextid);
- $out = HTML($textarea,
- HTML::div(array("id" => $this->_wikitextid,
+ $out = HTML(
+ $textarea,
+ HTML::div(
+ array("id" => $this->_wikitextid,
'style' => 'display:none'),
- $wikitext),
- "\n");
+ $wikitext
+ ),
+ "\n"
+ );
return $out;
}
/* via the PHP object */
- function Textarea_PHP($textarea, $wikitext, $name = 'edit[content]')
+ public function Textarea_PHP($textarea, $wikitext, $name = 'edit[content]')
{
global $LANG;
$this->FilePath = realpath(PHPWIKI_DIR . '/themes/default/CKeditor') . "/";
@@ -126,9 +132,10 @@
$this->oCKeditor->Config['DefaultLanguage'] = $LANG;
$this->oCKeditor->Create();
- return HTML::div(array("id" => $this->_wikitextid,
+ return HTML::div(
+ array("id" => $this->_wikitextid,
'style' => 'display:none'),
- $wikitext);
+ $wikitext
+ );
}
-
}
Modified: trunk/lib/WysiwygEdit/Wikiwyg.php
===================================================================
--- trunk/lib/WysiwygEdit/Wikiwyg.php 2022-03-24 13:40:18 UTC (rev 11010)
+++ trunk/lib/WysiwygEdit/Wikiwyg.php 2022-03-24 13:43:02 UTC (rev 11011)
@@ -40,8 +40,7 @@
class WysiwygEdit_Wikiwyg extends WysiwygEdit
{
-
- function __construct()
+ public function __construct()
{
$this->_transformer_tags = false;
$this->BasePath = DATA_PATH . '/themes/default/Wikiwyg';
@@ -48,12 +47,13 @@
$this->_htmltextid = "edit-content";
$this->_wikitextid = "editareawiki";
$script_url = deduce_script_name();
- if ((DEBUG & _DEBUG_REMOTE) and isset($_GET['start_debug']))
+ if ((DEBUG & _DEBUG_REMOTE) and isset($_GET['start_debug'])) {
$script_url .= ("?start_debug=" . $_GET['start_debug']);
+ }
$this->_jsdefault = "";
}
- function Head($name = 'edit[content]')
+ public function Head($name = 'edit[content]')
{
global $WikiTheme;
/**
@@ -64,14 +64,14 @@
foreach (array("Wikiwyg.js", "Wikiwyg/Toolbar.js", "Wikiwyg/Preview.js", "Wikiwyg/Wikitext.js",
"Wikiwyg/Wysiwyg.js", "Wikiwyg/Phpwiki.js", "Wikiwyg/HTML.js",
"Wikiwyg/Toolbar.js") as $js) {
- $WikiTheme->addMoreHeaders
- (JavaScript('', array('src' => $this->BasePath . '/' . $js,
+ $WikiTheme->addMoreHeaders(JavaScript('', array('src' => $this->BasePath . '/' . $js,
'language' => 'JavaScript')));
}
$doubleClickToEdit = ($request->getPref('doubleClickEdit') or ENABLE_DOUBLECLICKEDIT)
? 'true' : 'false';
if ($request->getArg('mode') && $request->getArg('mode') == 'wysiwyg') {
- return JavaScript($this->_jsdefault . "
+ return JavaScript(
+ $this->_jsdefault . "
window.onload = function() {
var wikiwyg = new Wikiwyg.Phpwiki();
var config = {
@@ -126,7 +126,7 @@
return '';
}
- function Textarea($textarea, $wikitext, $name = 'edit[content]')
+ public function Textarea($textarea, $wikitext, $name = 'edit[content]')
{
global $request;
@@ -134,11 +134,15 @@
$textarea->SetAttr('id', $htmltextid);
$iframe0 = new RawXml('<iframe id="iframe0" src="blank.htm" height="0" width="0" frameborder="0"></iframe>');
if ($request->getArg('mode') and $request->getArg('mode') == 'wysiwyg') {
- $out = HTML(HTML::div(array('class' => 'hint'),
- _("Warning")._(": ")._("This Wikiwyg editor has only Beta quality!")),
+ $out = HTML(
+ HTML::div(
+ array('class' => 'hint'),
+ _("Warning")._(": ")._("This Wikiwyg editor has only Beta quality!")
+ ),
$textarea,
$iframe0,
- "\n");
+ "\n"
+ );
} else {
$out = HTML($textarea, $iframe0, "\n");
}
@@ -153,7 +157,7 @@
* @param string $text
* @return string
*/
- function ConvertBefore($text)
+ public function ConvertBefore($text)
{
return $text;
}
@@ -165,7 +169,7 @@
* @param string $text
* @return string
*/
- function ConvertAfter($text)
+ public function ConvertAfter($text)
{
return TransformInline($text);
}
@@ -173,7 +177,7 @@
class WikiToHtml
{
- function __construct($wikitext, &$request)
+ public function __construct($wikitext, &$request)
{
$this->_wikitext = $wikitext;
$this->_request =& $request;
@@ -181,13 +185,13 @@
$this->html_content = "";
}
- function send()
+ public function send()
{
$this->convert();
echo $this->html_content;
}
- function convert()
+ public function convert()
{
require_once 'lib/BlockParser.php';
$xmlcontent = TransformText($this->_wikitext, $this->_request->getArg('pagename'));
@@ -196,7 +200,7 @@
$this->replace_inside_html();
}
- function replace_inside_html()
+ public function replace_inside_html()
{
$this->clean_links();
$this->clean_plugin_name();
@@ -210,18 +214,20 @@
// Draft function to replace RichTable
// by a html table
// Works only on one plugin for the moment
- function replace_known_plugins()
+ public function replace_known_plugins()
{
// If match a plugin
$pattern = '/\<\;\?plugin\s+RichTable(.*)\?\>\;/Umsi';
$replace_string = "replace_rich_table";
- $this->_html = preg_replace_callback($pattern,
+ $this->_html = preg_replace_callback(
+ $pattern,
$replace_string,
- $this->_html);
+ $this->_html
+ );
}
// Replace unknown plugins by keyword Wikitext { tag }
- function replace_unknown_plugins()
+ public function replace_unknown_plugins()
{
$pattern = '/(\<\;\?plugin[^?]*\?\>\;)/Usi';
$replace_string =
@@ -228,28 +234,34 @@
'<p><div style="background-color:#D3D3D3;font-size:smaller;">Wikitext {
<br> \1 <br>}</div><br></p>';
- $this->_html = preg_replace($pattern,
+ $this->_html = preg_replace(
+ $pattern,
$replace_string,
- $this->_html);
+ $this->_html
+ );
}
// Clean links to keep only <a href="link">name</a>
- function clean_links()
+ public function clean_links()
{
// Existing links
// FIXME: use VIRTUAL_PATH
$pattern = '/\<a href\=\"index.php\?pagename\=(\w+)\"([^>])*\>/Umsi';
$replace_string = '<a href="\1">';
- $this->_html = preg_replace($pattern,
+ $this->_html = preg_replace(
+ $pattern,
$replace_string,
- $this->_html);
+ $this->_html
+ );
// Non existing links
$pattern = '/\<a href\=\"index.php\?pagename\=([^"]*)(&action){1}([^>])*\>/Umsi';
$replace_string = '<a href="\1">';
- $this->_html = preg_replace($pattern,
+ $this->_html = preg_replace(
+ $pattern,
$replace_string,
- $this->_html);
+ $this->_html
+ );
// Clean underline
$pattern = '/\<u\>(.*)\<\/u\>(\<a href="(.*))[?"]{1}.*\>.*\<\/a\>/Umsi';
@@ -256,13 +268,15 @@
$replace_string =
'<span>\2" style="color:blue;">\1</a></span>';
- $this->_html = preg_replace($pattern,
+ $this->_html = preg_replace(
+ $pattern,
$replace_string,
- $this->_html);
+ $this->_html
+ );
}
// Put unknown tags in Wikitext {}
- function replace_tags()
+ public function replace_tags()
{
// Replace old table format ( non plugin )
$pattern = '/(\ {0,4}(?:\S.*)?\|\S+\s*$.*?\<\/p\>)/ms';
@@ -270,32 +284,37 @@
'<p><div style="background-color:#D3D3D3;font-size:smaller;">Wikitext {
<br> \1 <br>}</div><br></p>';
- $this->_html = preg_replace($pattern,
+ $this->_html = preg_replace(
+ $pattern,
$replace_string,
- $this->_html);
+ $this->_html
+ );
}
// Replace \n by <br> only in
// <?plugin ? > tag to keep formatting
- function clean_plugin()
+ public function clean_plugin()
{
$pattern = '/(\<\;\?plugin.*\?\>\;)/Umsei';
$replace_string = 'preg_replace("/\n/Ums","<br>","\1")';
- $this->_html = preg_replace($pattern,
+ $this->_html = preg_replace(
+ $pattern,
$replace_string,
- $this->_html);
-
+ $this->_html
+ );
}
- function clean_plugin_name()
+ public function clean_plugin_name()
{
// Remove plugin name converted in a link
$pattern = '/(\<\;\?plugin\s)\<span.*\>\<span\>\<a href=.*\>(\w+)\<\/a\><\/span\><\/span>([^?]*\?\>\;)/Umsi';
$replace_string = '\1 \2 \3';
- $this->_html = preg_replace($pattern,
+ $this->_html = preg_replace(
+ $pattern,
$replace_string,
- $this->_html);
+ $this->_html
+ );
}
}
@@ -315,24 +334,28 @@
// if the plugin contains one of the options bellow
// it won't be converted
- if (preg_match($unknown_options, $plugin))
+ if (preg_match($unknown_options, $plugin)) {
return $matched[0] . "\n";
- else {
+ } else {
//Replace unused <p...>
$pattern = '/\<p.*\>/Umsi';
$replace_string = "";
- $plugin = preg_replace($pattern,
+ $plugin = preg_replace(
+ $pattern,
$replace_string,
- $plugin);
+ $plugin
+ );
//replace unused </p> by \n
$pattern = '/\<\/p\>/Umsi';
$replace_string = "\n";
- $plugin = preg_replace($pattern,
+ $plugin = preg_replace(
+ $pattern,
$replace_string,
- $plugin);
+ $plugin
+ );
$plugin = "<?plugin RichTable " . $plugin . " ?>";
Modified: trunk/lib/WysiwygEdit/htmlarea2.php
===================================================================
--- trunk/lib/WysiwygEdit/htmlarea2.php 2022-03-24 13:40:18 UTC (rev 11010)
+++ trunk/lib/WysiwygEdit/htmlarea2.php 2022-03-24 13:43:02 UTC (rev 11011)
@@ -37,10 +37,10 @@
class WysiwygEdit_htmlarea2 extends WysiwygEdit
{
-
- function Head($name = 'edit[content]')
+ public function Head($name = 'edit[content]')
{
- return JavaScript("
+ return JavaScript(
+ "
_editor_url = \"" . DATA_PATH . "/themes/default/htmlarea2/\";
var win_ie_ver = parseFloat(navigator.appVersion.split(\"MSIE\")[1]);
if (navigator.userAgent.indexOf('Mac') >= 0) { win_ie_ver = 0; }
@@ -54,17 +54,20 @@
}
",
array('version' => 'JavaScript1.2',
- 'type' => 'text/javascript'));
+ 'type' => 'text/javascript')
+ );
}
// to be called after </textarea>
// version 2
- function Textarea($textarea, $wikitext, $name = 'edit[content]')
+ public function Textarea($textarea, $wikitext, $name = 'edit[content]')
{
$out = HTML($textarea);
- $out->pushContent(JavaScript("editor_generate('" . $name . "');",
+ $out->pushContent(JavaScript(
+ "editor_generate('" . $name . "');",
array('version' => 'JavaScript1.2',
- 'defer' => 1)));
+ 'defer' => 1)
+ ));
return $out;
}
}
Modified: trunk/lib/WysiwygEdit/htmlarea3.php
===================================================================
--- trunk/lib/WysiwygEdit/htmlarea3.php 2022-03-24 13:40:18 UTC (rev 11010)
+++ trunk/lib/WysiwygEdit/htmlarea3.php 2022-03-24 13:43:02 UTC (rev 11011)
@@ -34,8 +34,7 @@
class WysiwygEdit_htmlarea3 extends WysiwygEdit
{
-
- function Head($name = 'edit[content]')
+ public function Head($name = 'edit[content]')
{
global $WikiTheme;
$WikiTheme->addMoreAttr('body', " onload='initEditor()'");
@@ -124,7 +123,7 @@
');
}
- function Textarea($textarea, $wikitext, $name = 'edit[content]')
+ public function Textarea($textarea, $wikitext, $name = 'edit[content]')
{
$out = HTML($textarea, HTML::div(array("id" => "editareawiki", 'style' => 'display:none'), $wikitext), "\n");
//TODO: maybe some more custom links
Modified: trunk/lib/WysiwygEdit/spaw.php
===================================================================
--- trunk/lib/WysiwygEdit/spaw.php 2022-03-24 13:40:18 UTC (rev 11010)
+++ trunk/lib/WysiwygEdit/spaw.php 2022-03-24 13:43:02 UTC (rev 11011)
@@ -35,8 +35,7 @@
class WysiwygEdit_spaw extends WysiwygEdit
{
-
- function Head($name = 'edit[content]')
+ public function Head($name = 'edit[content]')
{
$basepath = DATA_PATH . '/lib/spaw/';
$spaw_root = PHPWIKI_DIR . "/lib/spaw/";
@@ -46,7 +45,7 @@
include_once($spaw_root . "spaw_control.class.php");
}
- function Textarea($textarea, $wikitext, $name = 'edit[content]')
+ public function Textarea($textarea, $wikitext, $name = 'edit[content]')
{
// global $LANG, $WikiTheme;
$id = "spaw_editor";
@@ -63,8 +62,10 @@
$this->SPAW = new SPAW_Wysiwyg($id, $textarea->_content);
$textarea->SetAttr('id', $name);
$this->SPAW->show();
- $out = HTML::div(array("id" => $id, 'style' => 'display:none'),
- $wikitext);
+ $out = HTML::div(
+ array("id" => $id, 'style' => 'display:none'),
+ $wikitext
+ );
return $out;
}
}
Modified: trunk/lib/WysiwygEdit/tinymce.php
===================================================================
--- trunk/lib/WysiwygEdit/tinymce.php 2022-03-24 13:40:18 UTC (rev 11010)
+++ trunk/lib/WysiwygEdit/tinymce.php 2022-03-24 13:43:02 UTC (rev 11011)
@@ -38,8 +38,7 @@
class WysiwygEdit_tinymce extends WysiwygEdit
{
-
- function __construct()
+ public function __construct()
{
$this->_transformer_tags = false;
$this->BasePath = DATA_PATH . '/themes/default/tiny_mce/';
@@ -47,11 +46,10 @@
$this->_wikitextid = "editareawiki";
}
- function Head($name = 'edit[content]')
+ public function Head($name = 'edit[content]')
{
global $LANG, $WikiTheme;
- $WikiTheme->addMoreHeaders
- (JavaScript('', array('src' => $this->BasePath . 'tiny_mce.js',
+ $WikiTheme->addMoreHeaders(JavaScript('', array('src' => $this->BasePath . 'tiny_mce.js',
'language' => 'JavaScript')));
return JavaScript("
tinyMCE.init({
@@ -76,12 +74,17 @@
// to be called after </textarea>
// name ignored
- function Textarea($textarea, $wikitext, $name = 'edit[content]')
+ public function Textarea($textarea, $wikitext, $name = 'edit[content]')
{
- $out = HTML($textarea,
- HTML::div(array("id" => $this->_wikitextid,
+ $out = HTML(
+ $textarea,
+ HTML::div(
+ array("id" => $this->_wikitextid,
'style' => 'display:none'),
- $wikitext), "\n");
+ $wikitext
+ ),
+ "\n"
+ );
//TODO: maybe some more custom links
return $out;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <var...@us...> - 2022-03-24 13:40:21
|
Revision: 11010
http://sourceforge.net/p/phpwiki/code/11010
Author: vargenau
Date: 2022-03-24 13:40:18 +0000 (Thu, 24 Mar 2022)
Log Message:
-----------
run php-cs-fixer
Modified Paths:
--------------
trunk/lib/WikiDB/PDO.php
trunk/lib/WikiDB/SQL.php
trunk/lib/WikiDB/backend/PDO.php
trunk/lib/WikiDB/backend/PDO_mysql.php
trunk/lib/WikiDB/backend/PDO_oci8.php
trunk/lib/WikiDB/backend/PDO_pgsql.php
trunk/lib/WikiDB/backend/PearDB.php
trunk/lib/WikiDB/backend/PearDB_ffpgsql.php
trunk/lib/WikiDB/backend/PearDB_mysqli.php
trunk/lib/WikiDB/backend/PearDB_oci8.php
trunk/lib/WikiDB/backend/PearDB_pgsql.php
trunk/lib/WikiDB/backend/dba.php
trunk/lib/WikiDB/backend/dbaBase.php
trunk/lib/WikiDB/backend/dumb/AllRevisionsIter.php
trunk/lib/WikiDB/backend/dumb/LinkSearchIter.php
trunk/lib/WikiDB/backend/dumb/MostPopularIter.php
trunk/lib/WikiDB/backend/dumb/MostRecentIter.php
trunk/lib/WikiDB/backend/dumb/TextSearchIter.php
trunk/lib/WikiDB/backend/dumb/WantedPagesIter.php
trunk/lib/WikiDB/backend/file.php
trunk/lib/WikiDB/backend/flatfile.php
trunk/lib/WikiDB/backend.php
trunk/lib/WikiDB/dba.php
trunk/lib/WikiDB/file.php
trunk/lib/WikiDB/flatfile.php
Modified: trunk/lib/WikiDB/PDO.php
===================================================================
--- trunk/lib/WikiDB/PDO.php 2022-03-24 13:32:25 UTC (rev 11009)
+++ trunk/lib/WikiDB/PDO.php 2022-03-24 13:40:18 UTC (rev 11010)
@@ -41,12 +41,13 @@
class WikiDB_PDO extends WikiDB
{
- function __construct($dbparams)
+ public function __construct($dbparams)
{
- if (is_array($dbparams['dsn']))
+ if (is_array($dbparams['dsn'])) {
$backend = $dbparams['dsn']['phptype'];
- elseif (preg_match('/^(\w+):/', $dbparams['dsn'], $m))
+ } elseif (preg_match('/^(\w+):/', $dbparams['dsn'], $m)) {
$backend = $m[1];
+ }
// Do we have a override? Currently: mysql, oci8, pgsql
if ($backend == "mysqli") {
$backend = "mysql";
@@ -124,10 +125,11 @@
$sth->bindParam($key, $val);
}
}
- if ($sth->execute())
+ if ($sth->execute()) {
$result = $sth->fetch(PDO::FETCH_BOTH);
- else
+ } else {
return false;
+ }
} catch (PDOException $e) {
trigger_error("SQL Error: " . $e->getMessage(), E_USER_WARNING);
return false;
@@ -137,10 +139,9 @@
// SQL iter: for simple select or create/update queries
// returns the generic iterator object (count, next)
- public function genericSqlIter($sql, $field_list = NULL)
+ public function genericSqlIter($sql, $field_list = null)
{
$result = $this->genericSqlQuery($sql);
return new WikiDB_backend_PDO_generic_iter($this->_backend, $result, $field_list);
}
-
}
Modified: trunk/lib/WikiDB/SQL.php
===================================================================
--- trunk/lib/WikiDB/SQL.php 2022-03-24 13:32:25 UTC (rev 11009)
+++ trunk/lib/WikiDB/SQL.php 2022-03-24 13:40:18 UTC (rev 11010)
@@ -27,17 +27,19 @@
class WikiDB_SQL extends WikiDB
{
- function __construct($dbparams)
+ public function __construct($dbparams)
{
$backend = 'PearDB';
- if (is_array($dbparams['dsn']))
+ if (is_array($dbparams['dsn'])) {
$backend = $dbparams['dsn']['phptype'];
- elseif (preg_match('/^(\w+):/', $dbparams['dsn'], $m))
+ } elseif (preg_match('/^(\w+):/', $dbparams['dsn'], $m)) {
$backend = $m[1];
+ }
if ($backend == 'postgres7') {
$backend = 'pgsql';
- if (is_string($dbparams['dsn']))
+ if (is_string($dbparams['dsn'])) {
$dbparams['dsn'] = $backend . ':' . substr($dbparams['dsn'], 10);
+ }
}
if ($backend == 'mysql') {
$backend = 'mysqli';
@@ -46,17 +48,21 @@
include_once 'lib/WikiDB/backend/PearDB_' . $backend . '.php';
$backend_class = "WikiDB_backend_PearDB_" . $backend;
$backend = new $backend_class($dbparams);
- if (DB::isError($backend->_dbh)) return;
+ if (DB::isError($backend->_dbh)) {
+ return;
+ }
parent::__construct($backend, $dbparams);
}
public static function view_dsn($dsn = false)
{
- if (!$dsn)
+ if (!$dsn) {
$dsninfo = DB::parseDSN($GLOBALS['DBParams']['dsn']);
- else
+ } else {
$dsninfo = DB::parseDSN($dsn);
- return sprintf("%s://%s:<not displayed>@%s/%s",
+ }
+ return sprintf(
+ "%s://%s:<not displayed>@%s/%s",
$dsninfo['phptype'],
$dsninfo['username'],
$dsninfo['hostspec'],
@@ -108,10 +114,11 @@
// returns the database specific resource type
public function genericSqlQuery($sql, $args = array())
{
- if ($args)
+ if ($args) {
$result = $this->_backend->_dbh->query($sql, $args);
- else
+ } else {
$result = $this->_backend->_dbh->query($sql);
+ }
if (DB::isError($result)) {
$msg = $result->getMessage();
trigger_error("SQL Error: " . DB::errorMessage($result), E_USER_WARNING);
@@ -123,10 +130,9 @@
// SQL iter: for simple select or create/update queries
// returns the generic iterator object (count, next)
- public function genericSqlIter($sql, $field_list = NULL)
+ public function genericSqlIter($sql, $field_list = null)
{
$result = $this->genericSqlQuery($sql);
return new WikiDB_backend_PearDB_generic_iter($this->_backend, $result);
}
-
}
Modified: trunk/lib/WikiDB/backend/PDO.php
===================================================================
--- trunk/lib/WikiDB/backend/PDO.php 2022-03-24 13:32:25 UTC (rev 11009)
+++ trunk/lib/WikiDB/backend/PDO.php 2022-03-24 13:40:18 UTC (rev 11010)
@@ -28,8 +28,7 @@
require_once 'lib/WikiDB/backend.php';
-class WikiDB_backend_PDO
- extends WikiDB_backend
+class WikiDB_backend_PDO extends WikiDB_backend
{
public $_dbparams;
public $_dsn;
@@ -39,7 +38,7 @@
private $_lock_count;
private $_current_lock;
- function __construct($dbparams)
+ public function __construct($dbparams)
{
$this->_dbparams = $dbparams;
if (strstr($dbparams['dsn'], "://")) { // pear DB syntax
@@ -100,7 +99,8 @@
try {
// persistent is defined as DSN option, or with a config value.
// phptype://username:password@hostspec/database?persistent=false
- $this->_dbh = new PDO($dbparams['dsn'],
+ $this->_dbh = new PDO(
+ $dbparams['dsn'],
$this->_parsedDSN['username'],
$this->_parsedDSN['password'],
array(PDO::ATTR_AUTOCOMMIT => true,
@@ -107,7 +107,8 @@
PDO::ATTR_TIMEOUT => DATABASE_TIMEOUT,
PDO::ATTR_PERSISTENT => !empty($parsed['persistent'])
or DATABASE_PERSISTENT
- ));
+ )
+ );
} catch (PDOException $e) {
echo "<br>\nCan't connect to database: " . $e->getMessage();
if (DEBUG & _DEBUG_VERBOSE or DEBUG & _DEBUG_SQL) {
@@ -161,26 +162,29 @@
$this->_lock_count = 0;
}
- function beginTransaction()
+ public function beginTransaction()
{
- if ($this->_hasTransactions)
+ if ($this->_hasTransactions) {
$this->_dbh->beginTransaction();
+ }
}
- function commit()
+ public function commit()
{
- if ($this->_hasTransactions)
+ if ($this->_hasTransactions) {
$this->_dbh->commit();
+ }
}
- function rollBack()
+ public function rollBack()
{
- if ($this->_hasTransactions)
+ if ($this->_hasTransactions) {
$this->_dbh->rollBack();
+ }
}
/* no result */
- function query($sql)
+ public function query($sql)
{
$sth = $this->_dbh->prepare($sql);
return $sth->execute();
@@ -187,27 +191,30 @@
}
/* with one result row */
- function getRow($sql)
+ public function getRow($sql)
{
$sth = $this->_dbh->prepare($sql);
- if ($sth->execute())
+ if ($sth->execute()) {
return $sth->fetch(PDO::FETCH_BOTH);
- else
+ } else {
return false;
+ }
}
/**
* Close database connection.
*/
- function close()
+ public function close()
{
if (!$this->_dbh) {
return;
}
if ($this->_lock_count) {
- trigger_error("WARNING: database still locked " .
+ trigger_error(
+ "WARNING: database still locked " .
'(lock_count = $this->_lock_count)' . "\n<br />",
- E_USER_WARNING);
+ E_USER_WARNING
+ );
}
$this->unlock(array(), 'force');
@@ -217,7 +224,7 @@
/*
* Fast test for wikipage.
*/
- function is_wiki_page($pagename)
+ public function is_wiki_page($pagename)
{
$dbh = &$this->_dbh;
extract($this->_table_names);
@@ -226,13 +233,14 @@
. " WHERE $nonempty_tbl.id=$page_tbl.id"
. " AND pagename=?");
$sth->bindParam(1, $pagename, PDO::PARAM_STR, MAX_PAGENAME_LENGTH);
- if ($sth->execute())
+ if ($sth->execute()) {
return $sth->fetchColumn();
- else
+ } else {
return false;
+ }
}
- function get_all_pagenames()
+ public function get_all_pagenames()
{
$dbh = &$this->_dbh;
extract($this->_table_names);
@@ -246,7 +254,7 @@
/*
* filter (nonempty pages) currently ignored
*/
- function numPages($filter = false, $exclude = '')
+ public function numPages($filter = false, $exclude = '')
{
$dbh = &$this->_dbh;
extract($this->_table_names);
@@ -256,7 +264,7 @@
return $sth->fetchColumn();
}
- function increaseHitCount($pagename)
+ public function increaseHitCount($pagename)
{
$dbh = &$this->_dbh;
$page_tbl = $this->_table_names['page_tbl'];
@@ -270,7 +278,7 @@
/*
* Read page information from database.
*/
- function get_pagedata($pagename)
+ public function get_pagedata($pagename)
{
$dbh = &$this->_dbh;
$page_tbl = $this->_table_names['page_tbl'];
@@ -291,7 +299,7 @@
}
}
- function update_pagedata($pagename, $newdata)
+ public function update_pagedata($pagename, $newdata)
{
$dbh = &$this->_dbh;
$page_tbl = $this->_table_names['page_tbl'];
@@ -318,12 +326,13 @@
unset($data['hits']);
foreach ($newdata as $key => $val) {
- if ($key == 'hits')
+ if ($key == 'hits') {
$hits = (int)$val;
- else if (empty($val))
+ } elseif (empty($val)) {
unset($data[$key]);
- else
+ } else {
$data[$key] = $val;
+ }
}
$sth = $dbh->prepare("UPDATE $page_tbl"
. " SET hits=?, pagedata=?"
@@ -342,7 +351,7 @@
}
}
- function get_cached_html($pagename)
+ public function get_cached_html($pagename)
{
$dbh = &$this->_dbh;
$page_tbl = $this->_table_names['page_tbl'];
@@ -352,11 +361,13 @@
return $sth->fetchColumn(0);
}
- function set_cached_html($pagename, $data)
+ public function set_cached_html($pagename, $data)
{
$dbh = &$this->_dbh;
$page_tbl = $this->_table_names['page_tbl'];
- if (empty($data)) $data = '';
+ if (empty($data)) {
+ $data = '';
+ }
$sth = $dbh->prepare("UPDATE $page_tbl"
. " SET cached_html=?"
. " WHERE pagename=?"
@@ -366,7 +377,7 @@
$sth->execute();
}
- function _get_pageid($pagename, $create_if_missing = false)
+ public function _get_pageid($pagename, $create_if_missing = false)
{
// check id_cache
global $request;
@@ -378,7 +389,9 @@
}
// attributes play this game.
- if ($pagename === '') return 0;
+ if ($pagename === '') {
+ return 0;
+ }
$dbh = &$this->_dbh;
$page_tbl = $this->_table_names['page_tbl'];
@@ -410,10 +423,11 @@
$id++;
$sth->bindParam(1, $id, PDO::PARAM_INT);
$sth->bindParam(2, $pagename, PDO::PARAM_STR, MAX_PAGENAME_LENGTH);
- if ($sth->execute())
+ if ($sth->execute()) {
$this->commit();
- else
+ } else {
$this->rollBack();
+ }
}
}
assert($id);
@@ -420,7 +434,7 @@
return $id;
}
- function get_latest_version($pagename)
+ public function get_latest_version($pagename)
{
$dbh = &$this->_dbh;
extract($this->_table_names);
@@ -434,7 +448,7 @@
return $sth->fetchColumn();
}
- function get_previous_version($pagename, $version)
+ public function get_previous_version($pagename, $version)
{
$dbh = &$this->_dbh;
extract($this->_table_names);
@@ -460,7 +474,7 @@
*
* @return array|false The version data, or false if specified version does not exist.
*/
- function get_versiondata($pagename, $version, $want_content = false)
+ public function get_versiondata($pagename, $version, $want_content = false)
{
$dbh = &$this->_dbh;
extract($this->_table_names);
@@ -495,8 +509,9 @@
private function _extract_version_data_num($row, $want_content)
{
- if (!$row)
+ if (!$row) {
return false;
+ }
//$id &= $row[0];
//$pagename &= $row[1];
@@ -514,20 +529,23 @@
return $data;
}
- function _extract_version_data_assoc($row)
+ public function _extract_version_data_assoc($row)
{
- if (!$row)
+ if (!$row) {
return false;
+ }
extract($row);
$data = empty($versiondata) ? array() : $this->_unserialize($versiondata);
$data['mtime'] = $mtime;
$data['is_minor_edit'] = !empty($minor_edit);
- if (isset($content))
+ if (isset($content)) {
$data['%content'] = $content;
- elseif ($have_content)
- $data['%content'] = true; else
+ } elseif ($have_content) {
+ $data['%content'] = true;
+ } else {
$data['%content'] = '';
+ }
if (!empty($pagedata)) {
$data['%pagedata'] = $this->_extract_page_data($pagedata, $hits);
}
@@ -537,7 +555,7 @@
/*
* Create a new revision of a page.
*/
- function set_versiondata($pagename, $version, $data)
+ public function set_versiondata($pagename, $version, $data)
{
$dbh = &$this->_dbh;
$version_tbl = $this->_table_names['version_tbl'];
@@ -593,7 +611,7 @@
/*
* Delete an old revision of a page.
*/
- function delete_versiondata($pagename, $version)
+ public function delete_versiondata($pagename, $version)
{
$dbh = &$this->_dbh;
extract($this->_table_names);
@@ -619,7 +637,7 @@
* so that get_latest_version returns id+1 and get_previous_version returns prev id
* and page->exists returns false.
*/
- function delete_page($pagename)
+ public function delete_page($pagename)
{
/**
* @var WikiRequest $request
@@ -681,7 +699,7 @@
/*
* Delete page completely from the database.
*/
- function purge_page($pagename)
+ public function purge_page($pagename)
{
$dbh = &$this->_dbh;
extract($this->_table_names);
@@ -716,7 +734,7 @@
* @param string $pagename Page name
* @param array $links List of page(names) which page links to.
*/
- function set_links($pagename, $links)
+ public function set_links($pagename, $links)
{
// Update link table.
// FIXME: optimize: mysql can do this all in one big INSERT/REPLACE.
@@ -735,10 +753,11 @@
if ($linkto === "") { // ignore attributes
continue;
}
- if (isset($link['relation']))
+ if (isset($link['relation'])) {
$relation = $this->_get_pageid($link['relation'], true);
- else
+ } else {
$relation = 0;
+ }
// avoid duplicates
if (isset($linkseen[$linkto]) and !$relation) {
continue;
@@ -783,23 +802,33 @@
* as 'linkrelation' key as pagename. See WikiDB_PageIterator::next
* if (isset($next['linkrelation']))
*/
- function get_links($pagename, $reversed = true, $include_empty = false,
- $sortby = '', $limit = '', $exclude = '',
- $want_relations = false)
+ public function get_links(
+ $pagename,
+ $reversed = true,
+ $include_empty = false,
+ $sortby = '',
+ $limit = '',
+ $exclude = '',
+ $want_relations = false
+ )
{
$dbh = &$this->_dbh;
extract($this->_table_names);
- if ($reversed)
+ if ($reversed) {
list($have, $want) = array('linkee', 'linker');
- else
+ } else {
list($have, $want) = array('linker', 'linkee');
+ }
$orderby = $this->sortby($sortby, 'db', array('pagename'));
- if ($orderby) $orderby = " ORDER BY $want." . $orderby;
- if ($exclude) // array of pagenames
+ if ($orderby) {
+ $orderby = " ORDER BY $want." . $orderby;
+ }
+ if ($exclude) { // array of pagenames
$exclude = " AND $want.pagename NOT IN " . $this->_sql_set($exclude);
- else
+ } else {
$exclude = '';
+ }
$limit = $this->_limit_sql($limit);
$sth = $dbh->prepare("SELECT $want.id AS id, $want.pagename AS pagename,"
@@ -821,15 +850,16 @@
/*
* Find if a page links to another page
*/
- function exists_link($pagename, $link, $reversed = false)
+ public function exists_link($pagename, $link, $reversed = false)
{
$dbh = &$this->_dbh;
extract($this->_table_names);
- if ($reversed)
+ if ($reversed) {
list($have, $want) = array('linkee', 'linker');
- else
+ } else {
list($have, $want) = array('linker', 'linkee');
+ }
$sth = $dbh->prepare("SELECT CASE WHEN $want.pagename THEN 1 ELSE 0 END"
. " FROM $link_tbl, $page_tbl linker, $page_tbl linkee, $nonempty_tbl"
. " WHERE linkfrom=linker.id AND linkto=linkee.id"
@@ -841,8 +871,12 @@
return $sth->fetchColumn();
}
- public function get_all_pages($include_empty = false,
- $sortby = '', $limit = '', $exclude = '')
+ public function get_all_pages(
+ $include_empty = false,
+ $sortby = '',
+ $limit = '',
+ $exclude = ''
+ )
{
$dbh = &$this->_dbh;
extract($this->_table_names);
@@ -900,8 +934,13 @@
/*
* Text search (title or full text)
*/
- public function text_search($search, $fulltext = false,
- $sortby = '', $limit = '', $exclude = '')
+ public function text_search(
+ $search,
+ $fulltext = false,
+ $sortby = '',
+ $limit = '',
+ $exclude = ''
+ )
{
$dbh = &$this->_dbh;
extract($this->_table_names);
@@ -925,8 +964,11 @@
$join_clause .= " AND $page_tbl.id=$version_tbl.id AND latestversion=version";
$fields .= ", $page_tbl.pagedata as pagedata, " . $this->version_tbl_fields;
- $field_list = array_merge($field_list, array('pagedata'),
- $this->version_tbl_field_list);
+ $field_list = array_merge(
+ $field_list,
+ array('pagedata'),
+ $this->version_tbl_field_list
+ );
$callback = new WikiMethodCb($searchobj, "_fulltext_match_clause");
} else {
$callback = new WikiMethodCb($searchobj, "_pagename_match_clause");
@@ -949,7 +991,7 @@
* This is only for already resolved wildcards:
* " WHERE $page_tbl.pagename NOT IN ".$this->_sql_set(array('page1','page2'));
*/
- function _sql_set($pagenames)
+ public function _sql_set($pagenames)
{
$s = '(';
foreach ($pagenames as $p) {
@@ -975,8 +1017,9 @@
}
$orderby = '';
if ($sortby != '-hits') {
- if ($order = $this->sortby($sortby, 'db'))
+ if ($order = $this->sortby($sortby, 'db')) {
$orderby = " ORDER BY " . $order;
+ }
} else {
$orderby = " ORDER BY hits $order";
}
@@ -1064,19 +1107,23 @@
$sth = $dbh->prepare($sql);
}
$sth->execute();
- return new WikiDB_backend_PDO_iter($this, $sth,
- array_merge($this->page_tbl_field_list, $this->version_tbl_field_list));
+ return new WikiDB_backend_PDO_iter(
+ $this,
+ $sth,
+ array_merge($this->page_tbl_field_list, $this->version_tbl_field_list)
+ );
}
/*
* Find referenced empty pages.
*/
- function wanted_pages($exclude = '', $sortby = '', $limit = '')
+ public function wanted_pages($exclude = '', $sortby = '', $limit = '')
{
$dbh = &$this->_dbh;
extract($this->_table_names);
- if ($orderby = $this->sortby($sortby, 'db', array('pagename', 'wantedfrom')))
+ if ($orderby = $this->sortby($sortby, 'db', array('pagename', 'wantedfrom'))) {
$orderby = 'ORDER BY ' . $orderby;
+ }
if ($exclude) { // array of pagenames
$exclude = " AND $page_tbl.pagename NOT IN " . $this->_sql_set($exclude);
@@ -1114,7 +1161,7 @@
* @param string $to Future page name
*/
- function rename_page($pagename, $to)
+ public function rename_page($pagename, $to)
{
$dbh = &$this->_dbh;
extract($this->_table_names);
@@ -1129,7 +1176,7 @@
return $id;
}
- function _update_recent_table($pageid = false)
+ public function _update_recent_table($pageid = false)
{
$dbh = &$this->_dbh;
extract($this->_table_names);
@@ -1163,7 +1210,7 @@
}
}
- function _update_nonempty_table($pageid = false)
+ public function _update_nonempty_table($pageid = false)
{
$dbh = &$this->_dbh;
extract($this->_table_names);
@@ -1196,8 +1243,9 @@
{
if ($this->_lock_count++ == 0) {
$this->_current_lock = $tables;
- if (!$this->_hasTransactions)
+ if (!$this->_hasTransactions) {
$this->_lock_tables($tables, $write_lock);
+ }
}
}
@@ -1229,8 +1277,9 @@
return;
}
if (--$this->_lock_count <= 0 || $force) {
- if (!$this->_hasTransactions)
+ if (!$this->_hasTransactions) {
$this->_unlock_tables();
+ }
$this->_current_lock = false;
$this->_lock_count = 0;
}
@@ -1247,7 +1296,7 @@
/*
* Serialize data
*/
- function _serialize($data)
+ public function _serialize($data)
{
if (empty($data)) {
return '';
@@ -1259,11 +1308,11 @@
/*
* Unserialize data
*/
- function _unserialize($data)
+ public function _unserialize($data)
{
if ($data === "") {
return array();
- } else if (is_string($data)) {
+ } elseif (is_string($data)) {
return unserialize($data);
} else {
return array();
@@ -1271,23 +1320,23 @@
}
/* some variables and functions for DB backend abstraction (action=upgrade) */
- function database()
+ public function database()
{
return $this->_dbh->database;
}
- function backendType()
+ public function backendType()
{
return $this->_dbh->databaseType;
}
- function connection()
+ public function connection()
{
trigger_error("PDO: connectionID unsupported", E_USER_ERROR);
return false;
}
- function listOfTables()
+ public function listOfTables()
{
trigger_error("PDO: virtual listOfTables", E_USER_ERROR);
return array();
@@ -1313,7 +1362,7 @@
BETWEEN $offset AND $last
ORDER BY $pk $asc_desc
*/
- function _limit_sql($limit = false)
+ public function _limit_sql($limit = false)
{
if ($limit) {
list($offset, $count) = $this->limit($limit);
@@ -1327,7 +1376,7 @@
return $limit;
}
- function write_accesslog(&$entry)
+ public function write_accesslog(&$entry)
{
$dbh = &$this->_dbh;
$log_tbl = $entry->_accesslog->logtable;
@@ -1355,10 +1404,9 @@
}
}
-class WikiDB_backend_PDO_generic_iter
- extends WikiDB_backend_iterator
+class WikiDB_backend_PDO_generic_iter extends WikiDB_backend_iterator
{
- function __construct($backend, $query_result, $field_list = NULL)
+ public function __construct($backend, $query_result, $field_list = null)
{
$this->_backend = &$backend;
$this->_result = $query_result;
@@ -1365,7 +1413,7 @@
//$this->_fields = $field_list;
}
- function count()
+ public function count()
{
if (!is_object($this->_result)) {
return false;
@@ -1373,7 +1421,7 @@
return $this->_result->rowCount();
}
- function next()
+ public function next()
{
$result = &$this->_result;
if (!is_object($result)) {
@@ -1382,11 +1430,11 @@
return $result->fetch(PDO::FETCH_BOTH);
}
- function reset()
+ public function reset()
{
}
- function free()
+ public function free()
{
if (isset($this->_result)) {
unset($this->_result);
@@ -1394,12 +1442,11 @@
}
}
-class WikiDB_backend_PDO_iter
- extends WikiDB_backend_PDO_generic_iter
+class WikiDB_backend_PDO_iter extends WikiDB_backend_PDO_generic_iter
{
public $_backend;
- function next()
+ public function next()
{
$result = &$this->_result;
if (!is_object($result)) {
@@ -1408,8 +1455,9 @@
$backend = &$this->_backend;
$rec = $result->fetch(PDO::FETCH_ASSOC);
- if (isset($rec['pagedata']))
+ if (isset($rec['pagedata'])) {
$rec['pagedata'] = $backend->_extract_page_data($rec['pagedata'], $rec['hits']);
+ }
if (!empty($rec['version'])) {
$rec['versiondata'] = $backend->_extract_version_data_assoc($rec);
}
@@ -1419,7 +1467,7 @@
class WikiDB_backend_PDO_search extends WikiDB_backend_search_sql
{
- function _pagename_match_clause($node)
+ public function _pagename_match_clause($node)
{
$word = $node->sql();
if ($word == '%') { // ALL shortcut
@@ -1433,7 +1481,7 @@
}
}
- function _fulltext_match_clause($node)
+ public function _fulltext_match_clause($node)
{
// force word-style %word% for fulltext search
$dbh = &$this->_dbh;
@@ -1556,7 +1604,7 @@
$proto_opts = $match[2] ? $match[2] : false;
$dsn = $match[3];
- // $dsn => protocol+hostspec/database (old format)
+ // $dsn => protocol+hostspec/database (old format)
} else {
if (strpos($dsn, '+') !== false) {
list($proto, $dsn) = explode('+', $dsn, 2);
@@ -1588,7 +1636,7 @@
// /database
if (($pos = strpos($dsn, '?')) === false) {
$parsed['database'] = $dsn;
- // /database?param1=value1¶m2=value2
+ // /database?param1=value1¶m2=value2
} else {
$parsed['database'] = substr($dsn, 0, $pos);
$dsn = substr($dsn, $pos + 1);
Modified: trunk/lib/WikiDB/backend/PDO_mysql.php
===================================================================
--- trunk/lib/WikiDB/backend/PDO_mysql.php 2022-03-24 13:32:25 UTC (rev 11009)
+++ trunk/lib/WikiDB/backend/PDO_mysql.php 2022-03-24 13:40:18 UTC (rev 11010)
@@ -27,16 +27,15 @@
*/
require_once 'lib/WikiDB/backend/PDO.php';
-class WikiDB_backend_PDO_mysql
- extends WikiDB_backend_PDO
+class WikiDB_backend_PDO_mysql extends WikiDB_backend_PDO
{
- function __construct($dbparams)
+ public function __construct($dbparams)
{
parent::__construct($dbparams);
$this->_dbh->query("SET NAMES 'utf8'");
}
- function backendType()
+ public function backendType()
{
return 'mysql';
}
@@ -46,9 +45,11 @@
*/
private function _timeout()
{
- if (empty($this->_dbparams['timeout'])) return;
+ if (empty($this->_dbparams['timeout'])) {
+ return;
+ }
$sth = $this->_dbh->prepare("SHOW processlist");
- if ($sth->execute())
+ if ($sth->execute()) {
while ($row = $sth->fetch(PDO::FETCH_ASSOC)) {
if ($row["db"] == $this->_dbh->dsn['database']
and $row["User"] == $this->_dbh->dsn['username']
@@ -59,12 +60,13 @@
$this->query("KILL $process_id");
}
}
+ }
}
/**
* Pack tables.
*/
- function optimize()
+ public function optimize()
{
$this->_timeout();
foreach ($this->_table_names as $table) {
@@ -73,7 +75,7 @@
return true;
}
- function listOfTables()
+ public function listOfTables()
{
$sth = $this->_dbh->prepare("SHOW TABLES");
$sth->execute();
@@ -88,7 +90,7 @@
* offset specific syntax within mysql
* convert from,count to SQL "LIMIT $from, $count"
*/
- function _limit_sql($limit = false)
+ public function _limit_sql($limit = false)
{
if ($limit) {
list($from, $count) = $this->limit($limit);
Modified: trunk/lib/WikiDB/backend/PDO_oci8.php
===================================================================
--- trunk/lib/WikiDB/backend/PDO_oci8.php 2022-03-24 13:32:25 UTC (rev 11009)
+++ trunk/lib/WikiDB/backend/PDO_oci8.php 2022-03-24 13:40:18 UTC (rev 11010)
@@ -27,15 +27,14 @@
*/
require_once 'lib/WikiDB/backend/PDO.php';
-class WikiDB_backend_PDO_oci8
- extends WikiDB_backend_PDO
+class WikiDB_backend_PDO_oci8 extends WikiDB_backend_PDO
{
- function backendType()
+ public function backendType()
{
return 'oci8';
}
- function optimize()
+ public function optimize()
{
// Do nothing here -- Leave that for the DBA
// Cost Based Optimizer tuning vary from version to version
@@ -64,7 +63,7 @@
}
}
- function write_accesslog(&$entry)
+ public function write_accesslog(&$entry)
{
$dbh = &$this->_dbh;
$log_tbl = $entry->_accesslog->logtable;
Modified: trunk/lib/WikiDB/backend/PDO_pgsql.php
===================================================================
--- trunk/lib/WikiDB/backend/PDO_pgsql.php 2022-03-24 13:32:25 UTC (rev 11009)
+++ trunk/lib/WikiDB/backend/PDO_pgsql.php 2022-03-24 13:40:18 UTC (rev 11010)
@@ -27,10 +27,9 @@
*/
require_once 'lib/WikiDB/backend/PDO.php';
-class WikiDB_backend_PDO_pgsql
- extends WikiDB_backend_PDO
+class WikiDB_backend_PDO_pgsql extends WikiDB_backend_PDO
{
- function backendType()
+ public function backendType()
{
return 'pgsql';
}
@@ -39,7 +38,7 @@
* offset specific syntax within pgsql
* convert from,count to SQL "LIMIT $count OFFSET $from"
*/
- function _limit_sql($limit = false)
+ public function _limit_sql($limit = false)
{
if ($limit) {
list($from, $count) = $this->limit($limit);
Modified: trunk/lib/WikiDB/backend/PearDB.php
===================================================================
--- trunk/lib/WikiDB/backend/PearDB.php 2022-03-24 13:32:25 UTC (rev 11009)
+++ trunk/lib/WikiDB/backend/PearDB.php 2022-03-24 13:40:18 UTC (rev 11010)
@@ -24,12 +24,11 @@
require_once 'lib/WikiDB/backend.php';
-class WikiDB_backend_PearDB
- extends WikiDB_backend
+class WikiDB_backend_PearDB extends WikiDB_backend
{
public $_dbh;
- function __construct($dbparams)
+ public function __construct($dbparams)
{
require_once('lib/pear/DB/common.php');
require_once('lib/pear/DB.php');
@@ -47,12 +46,18 @@
$this->_dbh = DB::connect($this->_dsn, $dboptions);
$dbh = &$this->_dbh;
if (DB::isError($dbh)) {
- trigger_error(sprintf("Can't connect to database: %s",
- $this->_pear_error_message($dbh)),
- E_USER_ERROR);
+ trigger_error(
+ sprintf(
+ "Can't connect to database: %s",
+ $this->_pear_error_message($dbh)
+ ),
+ E_USER_ERROR
+ );
}
- $dbh->setErrorHandling(PEAR_ERROR_CALLBACK,
- array($this, '_pear_error_callback'));
+ $dbh->setErrorHandling(
+ PEAR_ERROR_CALLBACK,
+ array($this, '_pear_error_callback')
+ );
$dbh->setFetchMode(DB_FETCHMODE_ASSOC);
$prefix = isset($dbparams['prefix']) ? $dbparams['prefix'] : '';
@@ -74,11 +79,10 @@
'maxversion' => "MAX(version)",
'notempty' => "<>''",
'iscontent' => "content<>''");
-
}
/* with one result row */
- function getRow($sql)
+ public function getRow($sql)
{
return $this->_dbh->getRow($sql);
}
@@ -86,15 +90,17 @@
/**
* Close database connection.
*/
- function close()
+ public function close()
{
if (!$this->_dbh) {
return;
}
if ($this->_lock_count) {
- trigger_error("WARNING: database still locked " .
+ trigger_error(
+ "WARNING: database still locked " .
'(lock_count = $this->_lock_count)' . "\n<br />",
- E_USER_WARNING);
+ E_USER_WARNING
+ );
}
$this->_dbh->setErrorHandling(PEAR_ERROR_PRINT); // prevent recursive loops.
$this->unlock('force');
@@ -109,18 +115,20 @@
/*
* Fast test for wikipage.
*/
- function is_wiki_page($pagename)
+ public function is_wiki_page($pagename)
{
$dbh = &$this->_dbh;
extract($this->_table_names);
- return $dbh->getOne(sprintf("SELECT $page_tbl.id AS id"
+ return $dbh->getOne(sprintf(
+ "SELECT $page_tbl.id AS id"
. " FROM $nonempty_tbl, $page_tbl"
. " WHERE $nonempty_tbl.id=$page_tbl.id"
. " AND pagename='%s'",
- $dbh->escapeSimple($pagename)));
+ $dbh->escapeSimple($pagename)
+ ));
}
- function get_all_pagenames()
+ public function get_all_pagenames()
{
$dbh = &$this->_dbh;
extract($this->_table_names);
@@ -132,7 +140,7 @@
/*
* filter (nonempty pages) currently ignored
*/
- function numPages($filter = false, $exclude = '')
+ public function numPages($filter = false, $exclude = '')
{
$dbh = &$this->_dbh;
extract($this->_table_names);
@@ -141,7 +149,7 @@
. " WHERE $nonempty_tbl.id=$page_tbl.id");
}
- function increaseHitCount($pagename)
+ public function increaseHitCount($pagename)
{
$dbh = &$this->_dbh;
// Hits is the only thing we can update in a fast manner.
@@ -148,22 +156,28 @@
// Note that this will fail silently if the page does not
// have a record in the page table. Since it's just the
// hit count, who cares?
- $dbh->query(sprintf("UPDATE %s SET hits=hits+1 WHERE pagename='%s'",
+ $dbh->query(sprintf(
+ "UPDATE %s SET hits=hits+1 WHERE pagename='%s'",
$this->_table_names['page_tbl'],
- $dbh->escapeSimple($pagename)));
+ $dbh->escapeSimple($pagename)
+ ));
}
/*
* Read page information from database.
*/
- function get_pagedata($pagename)
+ public function get_pagedata($pagename)
{
$dbh = &$this->_dbh;
//trigger_error("GET_PAGEDATA $pagename", E_USER_NOTICE);
- $result = $dbh->getRow(sprintf("SELECT hits,pagedata FROM %s WHERE pagename='%s'",
- $this->_table_names['page_tbl'],
- $dbh->escapeSimple($pagename)),
- DB_FETCHMODE_ASSOC);
+ $result = $dbh->getRow(
+ sprintf(
+ "SELECT hits,pagedata FROM %s WHERE pagename='%s'",
+ $this->_table_names['page_tbl'],
+ $dbh->escapeSimple($pagename)
+ ),
+ DB_FETCHMODE_ASSOC
+ );
return $result ? $this->_extract_page_data($result) : false;
}
@@ -180,7 +194,7 @@
}
}
- function update_pagedata($pagename, $newdata)
+ public function update_pagedata($pagename, $newdata)
{
$dbh = &$this->_dbh;
$page_tbl = $this->_table_names['page_tbl'];
@@ -190,8 +204,11 @@
// Note that this will fail silently if the page does not
// have a record in the page table. Since it's just the
// hit count, who cares?
- $dbh->query(sprintf("UPDATE $page_tbl SET hits=%d WHERE pagename='%s'",
- $newdata['hits'], $dbh->escapeSimple($pagename)));
+ $dbh->query(sprintf(
+ "UPDATE $page_tbl SET hits=%d WHERE pagename='%s'",
+ $newdata['hits'],
+ $dbh->escapeSimple($pagename)
+ ));
return;
}
@@ -206,39 +223,46 @@
unset($data['hits']);
foreach ($newdata as $key => $val) {
- if ($key == 'hits')
+ if ($key == 'hits') {
$hits = (int)$val;
- else if (empty($val))
+ } elseif (empty($val)) {
unset($data[$key]);
- else
+ } else {
$data[$key] = $val;
+ }
}
- $dbh->query("UPDATE $page_tbl"
+ $dbh->query(
+ "UPDATE $page_tbl"
. " SET hits=?, pagedata=?"
. " WHERE pagename=?",
- array($hits, $this->_serialize($data), $pagename));
+ array($hits, $this->_serialize($data), $pagename)
+ );
$this->unlock(array($page_tbl));
}
- function get_cached_html($pagename)
+ public function get_cached_html($pagename)
{
$dbh = &$this->_dbh;
$page_tbl = $this->_table_names['page_tbl'];
- return $dbh->GetOne(sprintf("SELECT cached_html FROM $page_tbl WHERE pagename='%s'",
- $dbh->escapeSimple($pagename)));
+ return $dbh->GetOne(sprintf(
+ "SELECT cached_html FROM $page_tbl WHERE pagename='%s'",
+ $dbh->escapeSimple($pagename)
+ ));
}
- function set_cached_html($pagename, $data)
+ public function set_cached_html($pagename, $data)
{
$dbh = &$this->_dbh;
$page_tbl = $this->_table_names['page_tbl'];
- $dbh->query("UPDATE $page_tbl"
+ $dbh->query(
+ "UPDATE $page_tbl"
. " SET cached_html=?"
. " WHERE pagename=?",
- array($data, $pagename));
+ array($data, $pagename)
+ );
}
- function _get_pageid($pagename, $create_if_missing = false)
+ public function _get_pageid($pagename, $create_if_missing = false)
{
// check id_cache
global $request;
@@ -250,16 +274,21 @@
}
// attributes play this game.
- if ($pagename === '') return 0;
+ if ($pagename === '') {
+ return 0;
+ }
$dbh = &$this->_dbh;
$page_tbl = $this->_table_names['page_tbl'];
- $query = sprintf("SELECT id FROM $page_tbl WHERE pagename='%s'",
- $dbh->escapeSimple($pagename));
+ $query = sprintf(
+ "SELECT id FROM $page_tbl WHERE pagename='%s'",
+ $dbh->escapeSimple($pagename)
+ );
- if (!$create_if_missing)
+ if (!$create_if_missing) {
return $dbh->getOne($query);
+ }
$id = $dbh->getOne($query);
if (empty($id)) {
@@ -268,34 +297,40 @@
$id = $max_id + 1;
// requires createSequence and on mysql lock the interim table ->getSequenceName
//$id = $dbh->nextId($page_tbl . "_id");
- $dbh->query(sprintf("INSERT INTO $page_tbl"
+ $dbh->query(sprintf(
+ "INSERT INTO $page_tbl"
. " (id,pagename,hits)"
. " VALUES (%d,'%s',0)",
- $id, $dbh->escapeSimple($pagename)));
+ $id,
+ $dbh->escapeSimple($pagename)
+ ));
$this->unlock(array($page_tbl));
}
return $id;
}
- function get_latest_version($pagename)
+ public function get_latest_version($pagename)
{
$dbh = &$this->_dbh;
extract($this->_table_names);
return
- (int)$dbh->getOne(sprintf("SELECT latestversion"
+ (int)$dbh->getOne(sprintf(
+ "SELECT latestversion"
. " FROM $page_tbl, $recent_tbl"
. " WHERE $page_tbl.id=$recent_tbl.id"
. " AND pagename='%s'",
- $dbh->escapeSimple($pagename)));
+ $dbh->escapeSimple($pagename)
+ ));
}
- function get_previous_version($pagename, $version)
+ public function get_previous_version($pagename, $version)
{
$dbh = &$this->_dbh;
extract($this->_table_names);
return
- (int)$dbh->getOne(sprintf("SELECT version"
+ (int)$dbh->getOne(sprintf(
+ "SELECT version"
. " FROM $version_tbl, $page_tbl"
. " WHERE $version_tbl.id=$page_tbl.id"
. " AND pagename='%s'"
@@ -305,7 +340,8 @@
. " LIMIT 1",
*/
$dbh->escapeSimple($pagename),
- $version));
+ $version
+ ));
}
/**
@@ -317,7 +353,7 @@
*
* @return array|false The version data, or false if specified version does not exist.
*/
- function get_versiondata($pagename, $version, $want_content = false)
+ public function get_versiondata($pagename, $version, $want_content = false)
{
$dbh = &$this->_dbh;
extract($this->_table_names);
@@ -337,21 +373,27 @@
. "$iscontent AS have_content";
}
- $result = $dbh->getRow(sprintf("SELECT $fields"
+ $result = $dbh->getRow(
+ sprintf(
+ "SELECT $fields"
. " FROM $page_tbl, $version_tbl"
. " WHERE $page_tbl.id=$version_tbl.id"
. " AND pagename='%s'"
. " AND version=%d",
- $dbh->escapeSimple($pagename), $version),
- DB_FETCHMODE_ASSOC);
+ $dbh->escapeSimple($pagename),
+ $version
+ ),
+ DB_FETCHMODE_ASSOC
+ );
return $this->_extract_version_data($result);
}
- function _extract_version_data($query_result)
+ public function _extract_version_data($query_result)
{
- if (!$query_result)
+ if (!$query_result) {
return false;
+ }
/* Earlier versions (<= 1.3.7) stored the version data in base64.
This could be done here or in upgrade.
@@ -365,12 +407,13 @@
$data['mtime'] = $query_result['mtime'];
$data['is_minor_edit'] = !empty($query_result['minor_edit']);
- if (isset($query_result['content']))
+ if (isset($query_result['content'])) {
$data['%content'] = $query_result['content'];
- elseif ($query_result['have_content'])
+ } elseif ($query_result['have_content']) {
$data['%content'] = true;
- else
+ } else {
$data['%content'] = '';
+ }
// FIXME: this is ugly.
if (isset($query_result['pagedata'])) {
@@ -385,7 +428,7 @@
/*
* Create a new revision of a page.
*/
- function set_versiondata($pagename, $version, $data)
+ public function set_versiondata($pagename, $version, $data)
{
$dbh = &$this->_dbh;
$version_tbl = $this->_table_names['version_tbl'];
@@ -404,15 +447,20 @@
$this->lock();
$id = $this->_get_pageid($pagename, true);
- $dbh->query(sprintf("DELETE FROM $version_tbl"
+ $dbh->query(sprintf(
+ "DELETE FROM $version_tbl"
. " WHERE id=%d AND version=%d",
- $id, $version));
+ $id,
+ $version
+ ));
// generic slow PearDB bind eh quoting.
- $dbh->query("INSERT INTO $version_tbl"
+ $dbh->query(
+ "INSERT INTO $version_tbl"
. " (id,version,mtime,minor_edit,content,versiondata)"
. " VALUES(?, ?, ?, ?, ?, ?)",
array($id, $version, $mtime, $minor_edit, $content,
- $this->_serialize($data)));
+ $this->_serialize($data))
+ );
$this->_update_recent_table($id);
$this->_update_nonempty_table($id);
@@ -423,7 +471,7 @@
/*
* Delete an old revision of a page.
*/
- function delete_versiondata($pagename, $version)
+ public function delete_versiondata($pagename, $version)
{
$dbh = &$this->_dbh;
extract($this->_table_names);
@@ -443,7 +491,7 @@
/*
* Delete page completely from the database.
*/
- function purge_page($pagename)
+ public function purge_page($pagename)
{
$dbh = &$this->_dbh;
extract($this->_table_names);
@@ -479,7 +527,7 @@
* @param string $pagename Page name
* @param array $links List of page(names) which page links to.
*/
- function set_links($pagename, $links)
+ public function set_links($pagename, $links)
{
// Update link table.
// FIXME: optimize: mysql can do this all in one big INSERT/REPLACE.
@@ -498,10 +546,11 @@
if ($linkto === "") { // ignore attributes
continue;
}
- if (isset($link['relation']))
+ if (isset($link['relation'])) {
$relation = $this->_get_pageid($link['relation'], true);
- else
+ } else {
$relation = 0;
+ }
// avoid duplicates
if (isset($linkseen[$linkto]) and !$relation) {
continue;
@@ -541,23 +590,33 @@
* as 'linkrelation' key as pagename. See WikiDB_PageIterator::next
* if (isset($next['linkrelation']))
*/
- function get_links($pagename, $reversed = true, $include_empty = false,
- $sortby = '', $limit = '', $exclude = '',
- $want_relations = false)
+ public function get_links(
+ $pagename,
+ $reversed = true,
+ $include_empty = false,
+ $sortby = '',
+ $limit = '',
+ $exclude = '',
+ $want_relations = false
+ )
{
$dbh = &$this->_dbh;
extract($this->_table_names);
- if ($reversed)
+ if ($reversed) {
list($have, $want) = array('linkee', 'linker');
- else
+ } else {
list($have, $want) = array('linker', 'linkee');
+ }
$orderby = $this->sortby($sortby, 'db', array('pagename'));
- if ($orderby) $orderby = " ORDER BY $want." . $orderby;
- if ($exclude) // array of pagenames
+ if ($orderby) {
+ $orderby = " ORDER BY $want." . $orderby;
+ }
+ if ($exclude) { // array of pagenames
$exclude = " AND $want.pagename NOT IN " . $this->_sql_set($exclude);
- else
+ } else {
$exclude = '';
+ }
$qpagename = $dbh->escapeSimple($pagename);
$sql = "SELECT $want.id AS id, $want.pagename AS pagename, "
@@ -586,15 +645,16 @@
/*
* Find if a page links to another page
*/
- function exists_link($pagename, $link, $reversed = false)
+ public function exists_link($pagename, $link, $reversed = false)
{
$dbh = &$this->_dbh;
extract($this->_table_names);
- if ($reversed)
+ if ($reversed) {
list($have, $want) = array('linkee', 'linker');
- else
+ } else {
list($have, $want) = array('linker', 'linkee');
+ }
$qpagename = $dbh->escapeSimple($pagename);
$qlink = $dbh->escapeSimple($link);
$row = $dbh->GetRow("SELECT CASE WHEN $want.pagename='$qlink' THEN 1 ELSE 0 END as result"
@@ -605,8 +665,12 @@
return $row['result'];
}
- public function get_all_pages($include_empty = false,
- $sortby = '', $limit = '', $exclude = '')
+ public function get_all_pages(
+ $include_empty = false,
+ $sortby = '',
+ $limit = '',
+ $exclude = ''
+ )
{
$dbh = &$this->_dbh;
extract($this->_table_names);
@@ -668,8 +732,13 @@
/*
* Text search (title or full text)
*/
- public function text_search($search, $fulltext = false,
- $sortby = '', $limit = '', $exclude = '')
+ public function text_search(
+ $search,
+ $fulltext = false,
+ $sortby = '',
+ $limit = '',
+ $exclude = ''
+ )
{
$dbh = &$this->_dbh;
extract($this->_table_names);
@@ -679,8 +748,9 @@
}
$searchclass = get_class($this) . "_search";
// no need to define it everywhere and then fallback. memory!
- if (!class_exists($searchclass))
+ if (!class_exists($searchclass)) {
$searchclass = "WikiDB_backend_PearDB_search";
+ }
$searchobj = new $searchclass($search, $dbh);
$table = "$nonempty_tbl, $page_tbl";
@@ -718,7 +788,7 @@
//Todo: check if the better Mysql MATCH operator is supported,
// (ranked search) and also google like expressions.
- function _sql_match_clause($word)
+ public function _sql_match_clause($word)
{
$word = preg_replace('/(?=[%_\\\\])/', "\\", $word);
$word = $this->_dbh->escapeSimple($word);
@@ -729,7 +799,7 @@
return "LOWER(pagename) LIKE '%$word%'";
}
- function _sql_casematch_clause($word)
+ public function _sql_casematch_clause($word)
{
$word = preg_replace('/(?=[%_\\\\])/', "\\", $word);
$word = $this->_dbh->escapeSimple($word);
@@ -736,7 +806,7 @@
return "pagename LIKE '%$word%'";
}
- function _fullsearch_sql_match_clause($word)
+ public function _fullsearch_sql_match_clause($word)
{
$word = preg_replace('/(?=[%_\\\\])/', "\\", $word);
$word = $this->_dbh->escapeSimple($word);
@@ -745,7 +815,7 @@
return "LOWER(pagename) LIKE '%$word%' OR content LIKE '%$word%'";
}
- function _fullsearch_sql_casematch_clause($word)
+ public function _fullsearch_sql_casematch_clause($word)
{
$word = preg_replace('/(?=[%_\\\\])/', "\\", $word);
$word = $this->_dbh->escapeSimple($word);
@@ -752,7 +822,7 @@
return "pagename LIKE '%$word%' OR content LIKE '%$word%'";
}
- function _sql_set(&$pagenames)
+ public function _sql_set(&$pagenames)
{
$s = '(';
foreach ($pagenames as $p) {
@@ -778,8 +848,9 @@
}
$orderby = '';
if ($sortby != '-hits') {
- if ($order = $this->sortby($sortby, 'db'))
+ if ($order = $this->sortby($sortby, 'db')) {
$orderby = " ORDER BY " . $order;
+ }
} else {
$orderby = " ORDER BY hits $order";
}
@@ -874,12 +945,13 @@
/*
* Find referenced empty pages.
*/
- function wanted_pages($exclude = '', $sortby = '', $limit = '')
+ public function wanted_pages($exclude = '', $sortby = '', $limit = '')
{
$dbh = &$this->_dbh;
extract($this->_table_names);
- if ($orderby = $this->sortby($sortby, 'db', array('pagename', 'wantedfrom')))
+ if ($orderby = $this->sortby($sortby, 'db', array('pagename', 'wantedfrom'))) {
$orderby = 'ORDER BY ' . $orderby;
+ }
if ($exclude) { // array of pagenames
$exclude = " AND p.pagename NOT IN " . $this->_sql_set($exclude);
@@ -909,7 +981,7 @@
* @param string $to Future page name
*/
- function rename_page($pagename, $to)
+ public function rename_page($pagename, $to)
{
$dbh = &$this->_dbh;
extract($this->_table_names);
@@ -916,8 +988,10 @@
$this->lock();
$id = $this->_get_pageid($pagename);
- $dbh->query(sprintf("UPDATE $page_tbl SET pagename='%s' WHERE id=$id",
- $dbh->escapeSimple($to)));
+ $dbh->query(sprintf(
+ "UPDATE $page_tbl SET pagename='%s' WHERE id=$id",
+ $dbh->escapeSimple($to)
+ ));
$this->unlock();
return $id;
}
@@ -932,7 +1006,7 @@
* Can be undone and is seen in RecentChanges.
*/
- function delete_page($pagename)
+ public function delete_page($pagename)
{
/**
* @var WikiRequest $request
@@ -961,7 +1035,7 @@
}
- function _update_recent_table($pageid = false)
+ public function _update_recent_table($pageid = false)
{
$dbh = &$this->_dbh;
extract($this->_table_names);
@@ -981,7 +1055,7 @@
$this->unlock();
}
- function _update_nonempty_table($pageid = false)
+ public function _update_nonempty_table($pageid = false)
{
$dbh = &$this->_dbh;
extract($this->_table_names);
@@ -1012,8 +1086,9 @@
*/
public function lock($tables = array(), $write_lock = true)
{
- if ($this->_lock_count++ == 0)
+ if ($this->_lock_count++ == 0) {
$this->_lock_tables($write_lock);
+ }
}
/*
@@ -1055,7 +1130,7 @@
/*
* Serialize data
*/
- function _serialize($data)
+ public function _serialize($data)
{
if (empty($data)) {
return '';
@@ -1067,7 +1142,7 @@
/*
* Unserialize data
*/
- function _unserialize($data)
+ public function _unserialize($data)
{
return empty($data) ? array() : unserialize($data);
}
@@ -1100,8 +1175,9 @@
*/
private function _is_false_error($error)
{
- if ($error->getCode() != DB_ERROR)
+ if ($error->getCode() != DB_ERROR) {
return false;
+ }
$query = $this->_dbh->last_query;
@@ -1128,7 +1204,7 @@
return true;
}
- function _pear_error_message($error)
+ public function _pear_error_message($error)
{
$class = get_class($this);
$message = "$class: fatal database error\n"
@@ -1136,28 +1212,31 @@
. "\t(" . $error->getDebugInfo() . ")\n";
// Prevent password from being exposed during a connection error
- $safe_dsn = preg_replace('| ( :// .*? ) : .* (?=@) |xs',
- '\\1:XXXXXXXX', $this->_dsn);
+ $safe_dsn = preg_replace(
+ '| ( :// .*? ) : .* (?=@) |xs',
+ '\\1:XXXXXXXX',
+ $this->_dsn
+ );
return str_replace($this->_dsn, $safe_dsn, $message);
}
/* some variables and functions for DB backend abstraction (action=upgrade) */
- function database()
+ public function database()
{
return $this->_dbh->dsn['database'];
}
- function backendType()
+ public function backendType()
{
return $this->_dbh->phptype;
}
- function connection()
+ public function connection()
{
return $this->_dbh->connection;
}
- function listOfTables()
+ public function listOfTables()
{
return $this->_dbh->getListOf('tables');
}
@@ -1175,10 +1254,9 @@
*
* @author: Dan Frankowski
*/
-class WikiDB_backend_PearDB_generic_iter
- extends WikiDB_backend_iterator
+class WikiDB_backend_PearDB_generic_iter extends WikiDB_backend_iterator
{
- function __construct($backend, $query_result, $field_list = NULL)
+ public function __construct($backend, $query_result, $field_list = null)
{
if (DB::isError($query_result)) {
// This shouldn't happen, I thought.
@@ -1190,7 +1268,7 @@
$this->_options = $field_list;
}
- function count()
+ public function count()
{
if (!$this->_result) {
return false;
@@ -1198,7 +1276,7 @@
return $this->_result->numRows();
}
- function next()
+ public function next()
{
if (!$this->_result) {
return false;
@@ -1213,7 +1291,7 @@
return $record;
}
- function reset()
+ public function reset()
{
if ($this->_result) {
$this->_result->MoveFirst();
@@ -1220,7 +1298,7 @@
}
}
- function free()
+ public function free()
{
if ($this->_result) {
$this->_result->free();
@@ -1228,19 +1306,19 @@
}
}
- function asArray()
+ public function asArray()
{
$result = array();
- while ($page = $this->next())
+ while ($page = $this->next()) {
$result[] = $page;
+ }
return $result;
}
}
-class WikiDB_backend_PearDB_iter
- extends WikiDB_backend_PearDB_generic_iter
+class WikiDB_backend_PearDB_iter extends WikiDB_backend_PearDB_generic_iter
{
- function next()
+ public function next()
{
$backend = &$this->_backend;
if (!$this->_result) {
Modified: trunk/lib/WikiDB/backend/PearDB_ffpgsql.php
===================================================================
--- trunk/lib/WikiDB/backend/PearDB_ffpgsql.php 2022-03-24 13:32:25 UTC (rev 11009)
+++ trunk/lib/WikiDB/backend/PearDB_ffpgsql.php 2022-03-24 13:40:18 UTC (rev 11010)
@@ -48,10 +48,9 @@
require_once 'lib/ErrorManager.php';
require_once 'lib/WikiDB/backend/PearDB_pgsql.php';
-class WikiDB_backend_PearDB_ffpgsql
- extends WikiDB_backend_PearDB_pgsql
+class WikiDB_backend_PearDB_ffpgsql extends WikiDB_backend_PearDB_pgsql
{
- function __construct($dbparams)
+ public function __construct($dbparams)
{
$dbparams['dsn'] = str_replace('ffpgsql:', 'pgsql:', $dbparams['dsn']);
parent::__construct($dbparams);
@@ -64,7 +63,7 @@
pg_set_client_encoding("iso-8859-1");
}
- function get_all_pagenames()
+ public function get_all_pagenames()
{
$dbh = &$this->_dbh;
extract($this->_table_names);
@@ -79,7 +78,7 @@
/*
* filter (nonempty pages) currently ignored
*/
- function numPages($filter = false, $exclude = '')
+ public function numPages($filter = false, $exclude = '')
{
$dbh = &$this->_dbh;
extract($this->_table_names);
@@ -94,13 +93,13 @@
/*
...
[truncated message content] |
|
From: <var...@us...> - 2022-03-24 13:32:28
|
Revision: 11009
http://sourceforge.net/p/phpwiki/code/11009
Author: vargenau
Date: 2022-03-24 13:32:25 +0000 (Thu, 24 Mar 2022)
Log Message:
-----------
run php-cs-fixer
Modified Paths:
--------------
trunk/lib/AtomParser.php
trunk/lib/BlockParser.php
trunk/lib/CachedMarkup.php
trunk/lib/Captcha.php
trunk/lib/DbSession.php
trunk/lib/DbaDatabase.php
trunk/lib/DbaPartition.php
trunk/lib/ErrorManager.php
trunk/lib/ExternalReferrer.php
trunk/lib/FileFinder.php
trunk/lib/Google.php
trunk/lib/HtmlElement.php
trunk/lib/HtmlParser.php
trunk/lib/HttpClient.php
trunk/lib/IniConfig.php
trunk/lib/InlineParser.php
trunk/lib/MailNotify.php
trunk/lib/PageList.php
trunk/lib/PagePerm.php
trunk/lib/PageType.php
trunk/lib/PhpWikiXmlParser.php
trunk/lib/Request.php
trunk/lib/RssParser.php
trunk/lib/RssWriter.php
trunk/lib/RssWriter091.php
trunk/lib/RssWriter2.php
trunk/lib/SemanticWeb.php
trunk/lib/SpamBlocklist.php
trunk/lib/Template.php
trunk/lib/TextSearchQuery.php
trunk/lib/Units.php
trunk/lib/WikiCallback.php
trunk/lib/WikiDB.php
trunk/lib/WikiGroup.php
trunk/lib/WikiPlugin.php
trunk/lib/WikiPluginCached.php
trunk/lib/WikiTheme.php
trunk/lib/WikiUser.php
trunk/lib/WysiwygEdit.php
trunk/lib/XmlElement.php
trunk/lib/XmlRpcClient.php
trunk/lib/XmlRpcServer.php
trunk/lib/config.php
trunk/lib/diff.php
trunk/lib/diff3.php
trunk/lib/difflib.php
trunk/lib/display.php
trunk/lib/editpage.php
trunk/lib/fortune.php
trunk/lib/imagecache.php
trunk/lib/install.php
trunk/lib/loadsave.php
trunk/lib/main.php
trunk/lib/mimelib.php
trunk/lib/pdf.php
trunk/lib/prepend.php
trunk/lib/purgepage.php
trunk/lib/removepage.php
trunk/lib/spam_babycart.php
trunk/lib/stdlib.php
trunk/lib/upgrade.php
Modified: trunk/lib/AtomParser.php
===================================================================
--- trunk/lib/AtomParser.php 2022-03-24 13:28:33 UTC (rev 11008)
+++ trunk/lib/AtomParser.php 2022-03-24 13:32:25 UTC (rev 11009)
@@ -30,8 +30,7 @@
*/
require_once 'lib/PhpWikiXmlParser.php';
-class AtomParser
- extends PhpWikiXmlParser
+class AtomParser extends PhpWikiXmlParser
{
// Feed
public $feed = array();
@@ -70,7 +69,7 @@
public $inside_content = false;
public $content = '';
- function tag_open($parser, $name, $attrs = '')
+ public function tag_open($parser, $name, $attrs = '')
{
global $current_tag, $current_attrs;
@@ -86,7 +85,7 @@
}
}
- function tag_close($parser, $name, $attrs = '')
+ public function tag_close($parser, $name, $attrs = '')
{
if ($name == "AUTHOR") {
$an_author = $this->trim_data(array(
@@ -167,7 +166,7 @@
}
}
- function cdata($parser, $data)
+ public function cdata($parser, $data)
{
global $current_tag, $current_attrs;
@@ -176,10 +175,11 @@
} else {
switch ($current_tag) {
case "ID":
- if ($this->inside_entry)
+ if ($this->inside_entry) {
$this->id .= $data;
- else
+ } else {
$this->feed_id .= $data;
+ }
break;
case "LINK":
$a_link = array();
@@ -198,17 +198,19 @@
case "EMAIL":
$this->email .= $data;
break;
- case "TITLE" :
- if ($this->inside_entry)
+ case "TITLE":
+ if ($this->inside_entry) {
$this->title .= $data;
- else
+ } else {
$this->feed_title .= $data;
+ }
break;
case "UPDATED":
- if ($this->inside_entry)
+ if ($this->inside_entry) {
$this->updated .= $data;
- else
+ } else {
$this->feed_updated .= $data;
+ }
break;
case "SUBTITLE":
$this->feed_subtitle .= $data;
@@ -238,12 +240,12 @@
}
}
- function trim_data($array)
+ public function trim_data($array)
{
return array_map(array("self", "trim_element"), $array);
}
- function trim_element($element)
+ public function trim_element($element)
{
if (is_array($element)) {
return $this->trim_data($element);
@@ -253,7 +255,7 @@
return false;
}
- function serialize_tag($tag_name, $attributes)
+ public function serialize_tag($tag_name, $attributes)
{
$tag = "<" . $tag_name;
foreach ($attributes as $k => $v) {
Modified: trunk/lib/BlockParser.php
===================================================================
--- trunk/lib/BlockParser.php 2022-03-24 13:28:33 UTC (rev 11008)
+++ trunk/lib/BlockParser.php 2022-03-24 13:32:25 UTC (rev 11009)
@@ -83,7 +83,7 @@
* "(...)". (Anonymous groups, like "(?:...)", as well as
* look-ahead and look-behind assertions are fine.)
*/
- function __construct($regexps)
+ public function __construct($regexps)
{
$this->_regexps = $regexps;
$this->_re = "/((" . join(")|(", $regexps) . "))/Ax";
@@ -96,10 +96,11 @@
*
* @return AnchoredRegexpSet_match|bool An AnchoredRegexpSet_match object, or false if no match.
*/
- function match($text)
+ public function match($text)
{
- if (!is_string($text))
+ if (!is_string($text)) {
return false;
+ }
if (!preg_match($this->_re, $text, $m)) {
return false;
}
@@ -129,7 +130,7 @@
*
* @return AnchoredRegexpSet_match|bool An AnchoredRegexpSet_match object, or false if no match.
*/
- function nextMatch($text, $prevMatch)
+ public function nextMatch($text, $prevMatch)
{
// Try to find match at same position.
$regexps = array_slice($this->_regexps, $prevMatch->regexp_ind + 1);
@@ -154,8 +155,7 @@
class BlockParser_Input
{
-
- function __construct($text)
+ public function __construct($text)
{
// Expand leading tabs.
// FIXME: do this better.
@@ -169,12 +169,13 @@
$this->_pos = 0;
// Strip leading blank lines.
- while ($this->_lines and !$this->_lines[0])
+ while ($this->_lines and !$this->_lines[0]) {
array_shift($this->_lines);
+ }
$this->_atSpace = false;
}
- function skipSpace()
+ public function skipSpace()
{
$nlines = count($this->_lines);
while (1) {
@@ -182,8 +183,9 @@
$this->_atSpace = false;
break;
}
- if ($this->_lines[$this->_pos] != '')
+ if ($this->_lines[$this->_pos] != '') {
break;
+ }
$this->_pos++;
$this->_atSpace = true;
}
@@ -190,7 +192,7 @@
return $this->_atSpace;
}
- function currentLine()
+ public function currentLine()
{
if ($this->_pos >= count($this->_lines)) {
return false;
@@ -198,7 +200,7 @@
return $this->_lines[$this->_pos];
}
- function nextLine()
+ public function nextLine()
{
$this->_atSpace = $this->_lines[$this->_pos++] === '';
if ($this->_pos >= count($this->_lines)) {
@@ -207,48 +209,51 @@
return $this->_lines[$this->_pos];
}
- function advance()
+ public function advance()
{
$this->_atSpace = ($this->_lines[$this->_pos] === '');
$this->_pos++;
}
- function getPos()
+ public function getPos()
{
return array($this->_pos, $this->_atSpace);
}
- function setPos($pos)
+ public function setPos($pos)
{
list($this->_pos, $this->_atSpace) = $pos;
}
- function getPrefix()
+ public function getPrefix()
{
return '';
}
- function getDepth()
+ public function getDepth()
{
return 0;
}
- function where()
+ public function where()
{
- if ($this->_pos < count($this->_lines))
+ if ($this->_pos < count($this->_lines)) {
return $this->_lines[$this->_pos];
- else
+ } else {
return "<EOF>";
+ }
}
- function _debug($tab, $msg)
+ public function _debug($tab, $msg)
{
//return ;
$where = $this->where();
$tab = str_repeat('____', $this->getDepth()) . $tab;
- PrintXML(HTML::div("$tab $msg: at: '",
+ PrintXML(HTML::div(
+ "$tab $msg: at: '",
HTML::samp($where),
- "'"));
+ "'"
+ ));
flush();
}
}
@@ -260,15 +265,15 @@
* @param string $prefix_re
* @param string $initial_prefix
*/
- function __construct(&$input, $prefix_re, $initial_prefix = '')
+ public function __construct(&$input, $prefix_re, $initial_prefix = '')
{
$this->_input = &$input;
$this->_prefix_pat = "/$prefix_re|\\s*\$/Ax";
$this->_atSpace = false;
- if (($line = $input->currentLine()) === false)
+ if (($line = $input->currentLine()) === false) {
$this->_line = false;
- elseif ($initial_prefix) {
+ } elseif ($initial_prefix) {
assert(substr($line, 0, strlen($initial_prefix)) == $initial_prefix);
$this->_line = (string)substr($line, strlen($initial_prefix));
$this->_atBlank = !ltrim($line);
@@ -275,57 +280,62 @@
} elseif (preg_match($this->_prefix_pat, $line, $m)) {
$this->_line = (string)substr($line, strlen($m[0]));
$this->_atBlank = !ltrim($line);
- } else
+ } else {
$this->_line = false;
+ }
}
- function skipSpace()
+ public function skipSpace()
{
// In contrast to the case for top-level blocks,
// for sub-blocks, there never appears to be any trailing space.
// (The last block in the sub-block should always be of class tight-bottom.)
- while ($this->_line === '')
+ while ($this->_line === '') {
$this->advance();
+ }
- if ($this->_line === false)
+ if ($this->_line === false) {
return $this->_atSpace == 'strong_space';
- else
+ } else {
return $this->_atSpace;
+ }
}
- function currentLine()
+ public function currentLine()
{
return $this->_line;
}
- function nextLine()
+ public function nextLine()
{
- if ($this->_line === '')
+ if ($this->_line === '') {
$this->_atSpace = $this->_atBlank ? 'weak_space' : 'strong_space';
- else
+ } else {
$this->_atSpace = false;
+ }
$line = $this->_input->nextLine();
if ($line !== false && preg_match($this->_prefix_pat, $line, $m)) {
$this->_line = (string)substr($line, strlen($m[0]));
$this->_atBlank = !ltrim($line);
- } else
+ } else {
$this->_line = false;
+ }
return $this->_line;
}
- function advance()
+ public function advance()
{
$this->nextLine();
}
- function getPos()
+ public function getPos()
{
return array($this->_line, $this->_atSpace, $this->_input->getPos());
}
- function setPos($pos)
+ public function setPos($pos)
{
$this->_line = $pos[0];
$this->_atSpace = $pos[1];
@@ -332,7 +342,7 @@
$this->_input->setPos($pos[2]);
}
- function getPrefix()
+ public function getPrefix()
{
assert($this->_line !== false);
$line = $this->_input->currentLine();
@@ -340,12 +350,12 @@
return substr($line, 0, strlen($line) - strlen($this->_line));
}
- function getDepth()
+ public function getDepth()
{
return $this->_input->getDepth() + 1;
}
- function where()
+ public function where()
{
return $this->_input->where();
}
@@ -353,12 +363,12 @@
class Block_HtmlElement extends HtmlElement
{
- function __construct($tag /*, ... */)
+ public function __construct($tag /*, ... */)
{
$this->_init(func_get_args());
}
- function setTightness($top, $bottom)
+ public function setTightness($top, $bottom)
{
}
}
@@ -370,7 +380,7 @@
private $_regexpset;
private $_atSpace;
- function __construct(&$input, $tag = 'div', $attr = array())
+ public function __construct(&$input, $tag = 'div', $attr = array())
{
parent::__construct($tag, $attr);
$this->initBlockTypes();
@@ -403,8 +413,7 @@
if (!is_object($_regexpset)) {
// nowiki_wikicreole must be before template_plugin
- $Block_types = array
- ('nowiki_wikicreole', 'template_plugin', 'placeholder', 'oldlists', 'list', 'dl',
+ $Block_types = array('nowiki_wikicreole', 'template_plugin', 'placeholder', 'oldlists', 'list', 'dl',
'table_dl', 'table_wikicreole', 'table_mediawiki',
'blockquote', 'heading', 'heading_wikicreole', 'hr', 'pre',
'email_blockquote', 'wikicreole_indented',
@@ -417,7 +426,7 @@
}
foreach ($Block_types as $type) {
$class = "Block_$type";
- $proto = new $class;
+ $proto = new $class();
$this->_block_types[] = $proto;
$this->_regexps[] = $proto->_re;
}
@@ -444,22 +453,26 @@
//FIXME: php5 fails to advance here!
for ($m = $re_set->match($line); $m; $m = $re_set->nextMatch($line, $m)) {
$block = clone($this->_block_types[$m->regexp_ind]);
- if (DEBUG & _DEBUG_PARSER)
+ if (DEBUG & _DEBUG_PARSER) {
$input->_debug('>', get_class($block));
+ }
if ($block->_match($input, $m)) {
//$block->_text = $line;
- if (DEBUG & _DEBUG_PARSER)
+ if (DEBUG & _DEBUG_PARSER) {
$input->_debug('<', get_class($block));
+ }
$tight_bottom = !$input->skipSpace();
$block->_setTightness($tight_top, $tight_bottom);
return $block;
}
- if (DEBUG & _DEBUG_PARSER)
+ if (DEBUG & _DEBUG_PARSER) {
$input->_debug('[', "_match failed");
+ }
}
- if ($line === false or $line === '') // allow $line === '0'
+ if ($line === false or $line === '') { // allow $line === '0'
return false;
+ }
trigger_error("Couldn't match block: '$line'");
return false;
@@ -468,7 +481,7 @@
class WikiText extends ParsedBlock
{
- function __construct($text)
+ public function __construct($text)
{
$input = new BlockParser_Input($text);
parent::__construct($input);
@@ -477,8 +490,13 @@
class SubBlock extends ParsedBlock
{
- function __construct(&$input, $indent_re, $initial_indent = false,
- $tag = 'div', $attr = array())
+ public function __construct(
+ &$input,
+ $indent_re,
+ $initial_indent = false,
+ $tag = 'div',
+ $attr = array()
+ )
{
$subinput = new BlockParser_InputSubBlock($input, $indent_re, $initial_indent);
parent::__construct($subinput, $tag, $attr);
@@ -497,8 +515,13 @@
*/
class TightSubBlock extends SubBlock
{
- function __construct(&$input, $indent_re, $initial_indent = false,
- $tag = 'div', $attr = array())
+ public function __construct(
+ &$input,
+ $indent_re,
+ $initial_indent = false,
+ $tag = 'div',
+ $attr = array()
+ )
{
parent::__construct($input, $indent_re, $initial_indent, $tag, $attr);
@@ -517,18 +540,18 @@
public $_re;
protected $_element;
- abstract function _match(&$input, $match);
+ abstract public function _match(&$input, $match);
- function _setTightness($top, $bot)
+ public function _setTightness($top, $bot)
{
}
- function merge($followingBlock)
+ public function merge($followingBlock)
{
return false;
}
- function finish()
+ public function finish()
{
return $this->_element;
}
@@ -540,22 +563,27 @@
public $_re = '\ +(?=\S)';
protected $_element;
- function _match(&$input, $m)
+ public function _match(&$input, $m)
{
$this->_depth = strlen($m->match);
$indent = sprintf("\\ {%d}", $this->_depth);
- $this->_element = new SubBlock($input, $indent, $m->match,
- 'blockquote');
+ $this->_element = new SubBlock(
+ $input,
+ $indent,
+ $m->match,
+ 'blockquote'
+ );
return true;
}
- function merge($nextBlock)
+ public function merge($nextBlock)
{
if (get_class($nextBlock) == get_class($this)) {
assert($nextBlock->_depth < $this->_depth);
$nextBlock->_element->unshiftContent($this->_element);
- if (!empty($this->_tight_top))
+ if (!empty($this->_tight_top)) {
$nextBlock->_tight_top = $this->_tight_top;
+ }
return $nextBlock;
}
return false;
@@ -574,7 +602,7 @@
public $_content = array();
public $_tag; //'ol' or 'ul'
- function _match(&$input, $m)
+ public function _match(&$input, $m)
{
// A list as the first content in a list is not allowed.
// E.g.:
@@ -595,23 +623,27 @@
return true;
}
- function _setTightness($top, $bot)
+ public function _setTightness($top, $bot)
{
$li = &$this->_content[0];
$li->setTightness($top, $bot);
}
- function merge($nextBlock)
+ public function merge($nextBlock)
{
if (is_a($nextBlock, 'Block_list') and $this->_tag == $nextBlock->_tag) {
- array_splice($this->_content, count($this->_content), 0,
- $nextBlock->_content);
+ array_splice(
+ $this->_content,
+ count($this->_content),
+ 0,
+ $nextBlock->_content
+ );
return $this;
}
return false;
}
- function finish()
+ public function finish()
{
return new Block_HtmlElement($this->_tag, false, $this->_content);
}
@@ -622,16 +654,17 @@
public $_tag = 'dl';
private $_tight_defn;
- function __construct()
+ public function __construct()
{
$this->_re = '\ {0,4}\S.*(?<!' . ESCAPE_CHAR . '):\s*$';
}
- function _match(&$input, $m)
+ public function _match(&$input, $m)
{
- if (!($p = $this->_do_match($input, $m)))
+ if (!($p = $this->_do_match($input, $m))) {
return false;
- list ($term, $defn, $loose) = $p;
+ }
+ list($term, $defn, $loose) = $p;
$this->_content[] = new Block_HtmlElement('dt', false, $term);
$this->_content[] = $defn;
@@ -639,7 +672,7 @@
return true;
}
- function _setTightness($top, $bot)
+ public function _setTightness($top, $bot)
{
$dt = &$this->_content[0];
$dd = &$this->_content[1];
@@ -648,7 +681,7 @@
$dd->setTightness($this->_tight_defn, $bot);
}
- function _do_match(&$input, $m)
+ public function _do_match(&$input, $m)
{
$pos = $input->getPos();
@@ -679,11 +712,12 @@
private $_tight_top;
private $_tight_bot;
- function __construct($term, $defn)
+ public function __construct($term, $defn)
{
parent::__construct();
- if (!is_array($defn))
+ if (!is_array($defn)) {
$defn = $defn->getContent();
+ }
$this->_next_tight_top = false; // value irrelevant - gets fixed later
$this->_ncols = $this->ComputeNcols($defn);
@@ -690,20 +724,22 @@
$this->_nrows = 0;
foreach ($defn as $item) {
- if ($this->IsASubtable($item))
+ if ($this->IsASubtable($item)) {
$this->addSubtable($item);
- else
+ } else {
$this->addToRow($item);
+ }
}
$this->flushRow();
$th = HTML::th($term);
- if ($this->_nrows > 1)
+ if ($this->_nrows > 1) {
$th->setAttr('rowspan', $this->_nrows);
+ }
$this->_setTerm($th);
}
- function setTightness($tight_top, $tight_bot)
+ public function setTightness($tight_top, $tight_bot)
{
$this->_tight_top = $tight_top;
$this->_tight_bot = $tight_bot;
@@ -713,8 +749,9 @@
{
if (empty($this->_accum)) {
$this->_accum = HTML::td();
- if ($this->_ncols > 2)
+ if ($this->_ncols > 2) {
$this->_accum->setAttr('colspan', $this->_ncols - 1);
+ }
}
$this->_accum->pushContent($item);
}
@@ -735,8 +772,9 @@
private function addSubtable($table)
{
- if (!($table_rows = $table->getContent()))
+ if (!($table_rows = $table->getContent())) {
return;
+ }
$this->flushRow($table_rows[0]->_tight_top);
@@ -750,10 +788,11 @@
private function _setTerm($th)
{
$first_row = &$this->_content[0];
- if (is_a($first_row, 'Block_table_dl_defn'))
+ if (is_a($first_row, 'Block_table_dl_defn')) {
$first_row->_setTerm($th);
- else
+ } else {
$first_row->unshiftContent($th);
+ }
}
private function ComputeNcols($defn)
@@ -781,47 +820,51 @@
return $defs[0];
}
- function ncols()
+ public function ncols()
{
return $this->_ncols;
}
- function nrows()
+ public function nrows()
{
return $this->_nrows;
}
- function & firstTR()
+ public function & firstTR()
{
$first = &$this->_content[0];
- if (is_a($first, 'Block_table_dl_defn'))
+ if (is_a($first, 'Block_table_dl_defn')) {
return $first->firstTR();
+ }
return $first;
}
- function & lastTR()
+ public function & lastTR()
{
$last = &$this->_content[$this->_nrows - 1];
- if (is_a($last, 'Block_table_dl_defn'))
+ if (is_a($last, 'Block_table_dl_defn')) {
return $last->lastTR();
+ }
return $last;
}
- function setWidth($ncols)
+ public function setWidth($ncols)
{
assert($ncols >= $this->_ncols);
- if ($ncols <= $this->_ncols)
+ if ($ncols <= $this->_ncols) {
return;
+ }
$rows = &$this->_content;
for ($i = 0; $i < count($rows); $i++) {
$row = &$rows[$i];
- if (is_a($row, 'Block_table_dl_defn'))
+ if (is_a($row, 'Block_table_dl_defn')) {
$row->setWidth($ncols - 1);
- else {
+ } else {
$n = count($row->_content);
$lastcol = &$row->_content[$n - 1];
- if (!empty($lastcol))
+ if (!empty($lastcol)) {
$lastcol->setAttr('colspan', $ncols - 1);
+ }
}
}
}
@@ -831,36 +874,39 @@
{
public $_tag = 'dl-table'; // phony.
- function __construct()
+ public function __construct()
{
$this->_re = '\ {0,4} (?:\S.*)? (?<!' . ESCAPE_CHAR . ') \| \s* $';
}
- function _match(&$input, $m)
+ public function _match(&$input, $m)
{
- if (!($p = $this->_do_match($input, $m)))
+ if (!($p = $this->_do_match($input, $m))) {
return false;
- list ($term, $defn, $loose) = $p;
+ }
+ list($term, $defn, $loose) = $p;
$this->_content[] = new Block_table_dl_defn($term, $defn);
return true;
}
- function _setTightness($top, $bot)
+ public function _setTightness($top, $bot)
{
$this->_content[0]->setTightness($top, $bot);
}
- function finish()
+ public function finish()
{
$defs = &$this->_content;
$ncols = 0;
- foreach ($defs as $defn)
+ foreach ($defs as $defn) {
$ncols = max($ncols, $defn->ncols());
+ }
- foreach ($defs as $key => $defn)
+ foreach ($defs as $key => $defn) {
$defs[$key]->setWidth($ncols);
+ }
return HTML::table(array('class' => 'wiki-dl-table'), $defs);
}
@@ -874,7 +920,7 @@
| ; .*? :
) .*? (?=\S)';
- function _match(&$input, $m)
+ public function _match(&$input, $m)
{
// FIXME:
if (!preg_match('/[*#;]*$/A', $input->getPrefix())) {
@@ -895,11 +941,15 @@
$itemtag = 'li';
} else {
$this->_tag = 'dl';
- list ($term,) = explode(':', substr($prefix, 1), 2);
+ list($term, ) = explode(':', substr($prefix, 1), 2);
$term = trim($term);
- if ($term)
- $this->_content[] = new Block_HtmlElement('dt', false,
- TransformInline($term));
+ if ($term) {
+ $this->_content[] = new Block_HtmlElement(
+ 'dt',
+ false,
+ TransformInline($term)
+ );
+ }
$itemtag = 'dd';
}
@@ -907,7 +957,7 @@
return true;
}
- function _setTightness($top, $bot)
+ public function _setTightness($top, $bot)
{
if (count($this->_content) == 1) {
$li = &$this->_content[0];
@@ -925,7 +975,7 @@
{
public $_re = '<(?:pre|verbatim|nowiki|noinclude|includeonly)>';
- function _match(&$input, $m)
+ public function _match(&$input, $m)
{
$endtag = '</' . substr($m->match, 1);
$text = array();
@@ -946,10 +996,11 @@
return true;
}
- if ($m->match == '<nowiki>')
+ if ($m->match == '<nowiki>') {
$text = join("<br>\n", $text);
- else
+ } else {
$text = join("\n", $text);
+ }
if ($m->match == '<noinclude>') {
$text = TransformText($text);
@@ -970,7 +1021,7 @@
{
public $_re = '<<<';
- function _match(&$input, $m)
+ public function _match(&$input, $m)
{
$endtag = '>>>';
$text = array();
@@ -997,7 +1048,7 @@
{
public $_re = '{{{';
- function _match(&$input, $m)
+ public function _match(&$input, $m)
{
$endtag = '}}}';
$text = array();
@@ -1031,7 +1082,7 @@
*
* should all work.
*/
- function _match(&$input, $m)
+ public function _match(&$input, $m)
{
$pos = $input->getPos();
$pi = $m->match . $m->postmatch;
@@ -1054,7 +1105,7 @@
// public $_re = '<<(?!\S)';
public $_re = '<<';
- function _match(&$input, $m)
+ public function _match(&$input, $m)
{
$pos = $input->getPos();
$pi = $m->postmatch;
@@ -1082,7 +1133,7 @@
{
public $_re = '\s*\|';
- function _match(&$input, $m)
+ public function _match(&$input, $m)
{
$pos = $input->getPos();
$pi = "|" . $m->postmatch;
@@ -1123,7 +1174,7 @@
{
public $_re = '{\|';
- function _match(&$input, $m)
+ public function _match(&$input, $m)
{
$pos = $input->getPos();
$pi = $m->postmatch;
@@ -1158,7 +1209,7 @@
{
public $_re = '{{';
- function _match(&$input, $m)
+ public function _match(&$input, $m)
{
// If we find "}}", this is an inline template.
if (strpos($m->postmatch, "}}") !== false) {
@@ -1228,10 +1279,11 @@
$pi = str_replace("?version=", "\" rev=\"", $pi);
}
- if ($vars)
+ if ($vars) {
$pi = '<' . '?plugin Template page="' . $pi . '" ' . $vars . ' ?>';
- else
+ } else {
$pi = '<' . '?plugin Template page="' . $pi . '" ?>';
+ }
$this->_element = new Cached_PluginInvocation($pi);
return true;
}
@@ -1242,7 +1294,7 @@
public $_attr = array('class' => 'mail-style-quote');
public $_re = '>\ ?';
- function _match(&$input, $m)
+ public function _match(&$input, $m)
{
//$indent = str_replace(' ', '\\ ', $m->match) . '|>$';
$indent = $this->_re;
@@ -1256,11 +1308,16 @@
public $_attr = array('style' => 'margin-left:2em');
public $_re = ':\ ?';
- function _match(&$input, $m)
+ public function _match(&$input, $m)
{
$indent = $this->_re;
- $this->_element = new SubBlock($input, $indent, $m->match,
- 'div', $this->_attr);
+ $this->_element = new SubBlock(
+ $input,
+ $indent,
+ $m->match,
+ 'div',
+ $this->_attr
+ );
return true;
}
}
@@ -1269,7 +1326,7 @@
{
public $_re = '-{4,}\s*$';
- function _match(&$input, $m)
+ public function _match(&$input, $m)
{
$input->advance();
$this->_element = new Block_HtmlElement('hr');
@@ -1281,7 +1338,7 @@
{
public $_re = '!{1,3}';
- function _match(&$input, $m)
+ public function _match(&$input, $m)
{
$tag = "h" . (5 - strlen($m->match));
$text = TransformInline(trim($m->postmatch));
@@ -1297,7 +1354,7 @@
{
public $_re = '={2,6}';
- function _match(&$input, $m)
+ public function _match(&$input, $m)
{
$tag = "h" . strlen($m->match);
// Remove spaces
@@ -1321,7 +1378,7 @@
private $_tight_bot;
private $_tight_top;
- function _match(&$input, $m)
+ public function _match(&$input, $m)
{
$this->_text = $m->match;
$input->advance();
@@ -1328,13 +1385,13 @@
return true;
}
- function _setTightness($top, $bot)
+ public function _setTightness($top, $bot)
{
$this->_tight_top = $top;
$this->_tight_bot = $bot;
}
- function merge($nextBlock)
+ public function merge($nextBlock)
{
$class = get_class($nextBlock);
if (strtolower($class) == 'block_p' and $this->_tight_bot) {
@@ -1345,7 +1402,7 @@
return false;
}
- function finish()
+ public function finish()
{
$content = TransformInline(trim($this->_text));
$p = new Block_HtmlElement('p', false, $content);
@@ -1358,7 +1415,7 @@
{
public $_re = '<(?im)(?: div|span)(?:[^>]*)?>';
- function _match(&$input, $m)
+ public function _match(&$input, $m)
{
if (substr($m->match, 1, 4) == 'span') {
$tag = 'span';
@@ -1370,25 +1427,29 @@
$pos = $input->getPos();
$pi = $content = $m->postmatch;
while (!preg_match('/^(.*)\<\/' . $tag . '\>(.*)$/i', $pi, $me)) {
- if ($pi != $content)
+ if ($pi != $content) {
$content .= "\n$pi";
+ }
if (($pi = $input->nextLine()) === false) {
$input->setPos($pos);
return false;
}
}
- if ($pi != $content)
- $content .= $me[1]; // prematch
- else
+ if ($pi != $content) {
+ $content .= $me[1];
+ } // prematch
+ else {
$content = $me[1];
+ }
$input->advance();
- if (strstr($content, "\n"))
+ if (strstr($content, "\n")) {
$content = TransformText($content);
- else
+ } else {
$content = TransformInline($content);
- if (!$argstr)
+ }
+ if (!$argstr) {
$args = false;
- else {
+ } else {
$args = array();
while (preg_match("/(\w+)=(.+)/", $argstr, $m)) {
$k = $m[1];
@@ -1401,7 +1462,9 @@
$v = $m[1];
$argstr = $m[2];
}
- if (trim($k) and trim($v)) $args[$k] = $v;
+ if (trim($k) and trim($v)) {
+ $args[$k] = $v;
+ }
}
}
$this->_element = new Block_HtmlElement($tag, $args, $content);
Modified: trunk/lib/CachedMarkup.php
===================================================================
--- trunk/lib/CachedMarkup.php 2022-03-24 13:28:33 UTC (rev 11008)
+++ trunk/lib/CachedMarkup.php 2022-03-24 13:32:25 UTC (rev 11009)
@@ -28,18 +28,19 @@
class CacheableMarkup extends XmlContent
{
- function __construct($content, $basepage)
+ public function __construct($content, $basepage)
{
$this->_basepage = $basepage;
$this->_buf = '';
$this->_content = array();
$this->_append($content);
- if ($this->_buf != '')
+ if ($this->_buf != '') {
$this->_content[] = $this->_buf;
+ }
unset($this->_buf);
}
- function pack()
+ public function pack()
{
// FusionForge hack
// This causes a strange bug when a comment containing
@@ -54,10 +55,11 @@
return gzcompress(serialize($this), 9);
}
- static function unpack($packed)
+ public static function unpack($packed)
{
- if (!$packed)
+ if (!$packed) {
return false;
+ }
// ZLIB format has a five bit checksum in its header.
// Let's check for sanity.
@@ -64,8 +66,7 @@
if (((ord($packed[0]) * 256 + ord($packed[1])) % 31 == 0)
and (substr($packed, 0, 2) == "\037\213")
or (substr($packed, 0, 2) == "x\332")
- ) // 120, 218
- {
+ ) { // 120, 218
// Looks like ZLIB.
$data = gzuncompress($packed);
return unserialize($data);
@@ -74,11 +75,14 @@
// Looks like a serialized object
return unserialize($packed);
}
- if (preg_match("/^\w+$/", $packed))
+ if (preg_match("/^\w+$/", $packed)) {
return $packed;
+ }
// happened with DebugBackendInfo problem also.
- trigger_error("Can't unpack bad cached markup. Probably php_zlib extension not loaded.",
- E_USER_WARNING);
+ trigger_error(
+ "Can't unpack bad cached markup. Probably php_zlib extension not loaded.",
+ E_USER_WARNING
+ );
return false;
}
@@ -86,14 +90,16 @@
*
* @return array of hashes { linkto=>pagename, relation=>pagename }
*/
- function getWikiPageLinks()
+ public function getWikiPageLinks()
{
$links = array();
foreach ($this->_content as $item) {
- if (!is_a($item, 'Cached_DynamicContent'))
+ if (!is_a($item, 'Cached_DynamicContent')) {
continue;
- if (!($item_links = $item->getWikiPageLinks($this->_basepage)))
+ }
+ if (!($item_links = $item->getWikiPageLinks($this->_basepage))) {
continue;
+ }
$links = array_merge($links, $item_links);
}
// array_unique has a bug with hashes!
@@ -109,12 +115,13 @@
* @return array
* Returns an array of hashes.
*/
- function getLinkInfo()
+ public function getLinkInfo()
{
$links = array();
foreach ($this->_content as $link) {
- if (!is_a($link, 'Cached_Link'))
+ if (!is_a($link, 'Cached_Link')) {
continue;
+ }
$info = $link->getLinkInfo($this->_basepage);
$links[$info->href] = $info;
}
@@ -121,11 +128,12 @@
return array_values($links);
}
- function _append($item)
+ public function _append($item)
{
if (is_array($item)) {
- foreach ($item as $subitem)
+ foreach ($item as $subitem) {
$this->_append($subitem);
+ }
} elseif (!is_object($item)) {
$this->_buf .= $this->_quote((string)$item);
} elseif (is_a($item, 'Cached_DynamicContent')) {
@@ -139,8 +147,9 @@
$this->_buf .= $item->emptyTag();
} else {
$this->_buf .= $item->startTag();
- foreach ($item->getContent() as $subitem)
+ foreach ($item->getContent() as $subitem) {
$this->_append($subitem);
+ }
$this->_buf .= "</$item->_tag>";
if (!$this->getDescription() and $item->getTag() == 'p') {
@@ -148,11 +157,13 @@
$this->_glean_description($item->asString());
}
}
- if (!$item->isInlineElement())
+ if (!$item->isInlineElement()) {
$this->_buf .= "\n";
+ }
} elseif (is_a($item, 'XmlContent')) {
- foreach ($item->getContent() as $item)
+ foreach ($item->getContent() as $item) {
$this->_append($item);
+ }
} elseif (method_exists($item, 'asXML')) {
$this->_buf .= $item->asXML();
} elseif (method_exists($item, 'asString')) {
@@ -162,7 +173,7 @@
}
}
- function _glean_description($text)
+ public function _glean_description($text)
{
static $two_sentences;
if (!$two_sentences) {
@@ -171,8 +182,9 @@
. "[.?!][\")]*\s*[\"(]*([[:upper:])]|$)";
}
- if (!isset($this->_description) and preg_match("/$two_sentences/sx", $text))
+ if (!isset($this->_description) and preg_match("/$two_sentences/sx", $text)) {
$this->_description = preg_replace("/\s*\n\s*/", " ", trim($text));
+ }
}
/**
@@ -190,12 +202,12 @@
*
* @return string
*/
- function getDescription()
+ public function getDescription()
{
return isset($this->_description) ? $this->_description : '';
}
- function asXML()
+ public function asXML()
{
$xml = '';
$basepage = $this->_basepage;
@@ -214,7 +226,7 @@
return $xml;
}
- function printXML()
+ public function printXML()
{
$basepage = $this->_basepage;
// _content might be changed from a plugin (CreateToc)
@@ -244,14 +256,14 @@
*/
abstract class Cached_DynamicContent
{
- function cache(&$cache)
+ public function cache(&$cache)
{
$cache[] = $this;
}
- abstract function expand($basepage, &$markup);
+ abstract public function expand($basepage, &$markup);
- function getWikiPageLinks($basepage)
+ public function getWikiPageLinks($basepage)
{
return array();
}
@@ -259,7 +271,7 @@
class XmlRpc_LinkInfo
{
- function __construct($page, $type, $href, $relation = '')
+ public function __construct($page, $type, $href, $relation = '')
{
$this->page = $page;
$this->type = $type;
@@ -274,7 +286,7 @@
public $_url;
public $_relation;
- function isInlineElement()
+ public function isInlineElement()
{
return true;
}
@@ -284,15 +296,17 @@
* This is here to support the XML-RPC listLinks method.
* (See http://www.ecyrd.com/JSPWiki/Wiki.jsp?page=WikiRPCInterface)
*/
- function getLinkInfo($basepage)
+ public function getLinkInfo($basepage)
{
- return new XmlRpc_LinkInfo($this->_getName($basepage),
+ return new XmlRpc_LinkInfo(
+ $this->_getName($basepage),
$this->_getType(),
$this->_getURL($basepage),
- $this->_getRelation($basepage));
+ $this->_getRelation($basepage)
+ );
}
- function _getURL($basepage)
+ public function _getURL($basepage)
{
return $this->_url;
}
@@ -307,18 +321,18 @@
public $_url;
public $_basepage;
- function isInlineElement()
+ public function isInlineElement()
{
return true;
}
- function _getURL($basepage)
+ public function _getURL($basepage)
{
return $this->_url;
}
// TODO: fix interwiki inline links in case of static dumps
- function expand($basepage, &$markup)
+ public function expand($basepage, &$markup)
{
global $WikiTheme;
$this->_basepage = $basepage;
@@ -335,13 +349,12 @@
class Cached_WikiLink extends Cached_Link
{
-
/**
* @param string $page
* @param string $label
* @param string $anchor
*/
- function __construct($page, $label = '', $anchor = '')
+ public function __construct($page, $label = '', $anchor = '')
{
$this->_page = $page;
/* ":DontStoreLink" */
@@ -349,28 +362,31 @@
$this->_page = substr($this->_page, 1);
$this->_nolink = true;
}
- if ($anchor)
+ if ($anchor) {
$this->_anchor = $anchor;
- if ($label and $label != $page)
+ }
+ if ($label and $label != $page) {
$this->_label = $label;
+ }
$this->_basepage = false;
}
- function _getType()
+ public function _getType()
{
return 'internal';
}
- function getPagename($basepage)
+ public function getPagename($basepage)
{
$page = new WikiPageName($this->_page, $basepage);
- if ($page->isValid())
+ if ($page->isValid()) {
return $page->name;
- else
+ } else {
return false;
+ }
}
- function getWikiPageLinks($basepage)
+ public function getWikiPageLinks($basepage)
{
if ($basepage == '') {
return array();
@@ -385,17 +401,17 @@
}
}
- function _getName($basepage)
+ public function _getName($basepage)
{
return $this->getPagename($basepage);
}
- function _getURL($basepage)
+ public function _getURL($basepage)
{
return WikiURL($this->getPagename($basepage));
}
- function expand($basepage, &$markup)
+ public function expand($basepage, &$markup)
{
global $WikiTheme;
$this->_basepage = $basepage;
@@ -403,14 +419,18 @@
$anchor = isset($this->_anchor) ? (string)$this->_anchor : '';
$page = new WikiPageName($this->_page, $basepage, $anchor);
if ($WikiTheme->DUMP_MODE and !empty($WikiTheme->VALID_LINKS)) {
- if (!in_array($this->_page, $WikiTheme->VALID_LINKS))
+ if (!in_array($this->_page, $WikiTheme->VALID_LINKS)) {
return HTML($label ? $label : $page->getName());
+ }
}
- if ($page->isValid()) return WikiLink($page, 'auto', $label);
- else return HTML($label);
+ if ($page->isValid()) {
+ return WikiLink($page, 'auto', $label);
+ } else {
+ return HTML($label);
+ }
}
- function asXML()
+ public function asXML()
{
global $WikiTheme;
$label = isset($this->_label) ? $this->_label : false;
@@ -418,17 +438,19 @@
//TODO: need basepage for subpages like /Remove (within CreateTOC)
$page = new WikiPageName($this->_page, $this->_basepage, $anchor);
if ($WikiTheme->DUMP_MODE and $WikiTheme->VALID_LINKS) {
- if (!in_array($this->_page, $WikiTheme->VALID_LINKS))
+ if (!in_array($this->_page, $WikiTheme->VALID_LINKS)) {
return $label ? $label : $page->getName();
+ }
}
$link = WikiLink($page, 'auto', $label);
return $link->asXML();
}
- function asString()
+ public function asString()
{
- if (isset($this->_label))
+ if (isset($this->_label)) {
return $this->_label;
+ }
return $this->_page;
}
}
@@ -435,17 +457,18 @@
class Cached_WikiLinkIfKnown extends Cached_WikiLink
{
- function __construct($moniker)
+ public function __construct($moniker)
{
$this->_page = $moniker;
}
- function expand($basepage, &$markup)
+ public function expand($basepage, &$markup)
{
global $WikiTheme;
if ($WikiTheme->DUMP_MODE and $WikiTheme->VALID_LINKS) {
- if (!in_array($this->_page, $WikiTheme->VALID_LINKS))
+ if (!in_array($this->_page, $WikiTheme->VALID_LINKS)) {
return HTML($label ? $label : $page->getName());
+ }
}
return WikiLink($this->_page, 'if_known');
}
@@ -453,18 +476,20 @@
class Cached_SpellCheck extends Cached_WikiLink
{
- function __construct($word, $suggestions)
+ public function __construct($word, $suggestions)
{
$this->_page = $word;
$this->suggestions = $suggestions;
}
- function expand($basepage, &$markup)
+ public function expand($basepage, &$markup)
{
- return HTML::a(array('class' => 'spell-wrong',
+ return HTML::a(
+ array('class' => 'spell-wrong',
'title' => 'SpellCheck: ' . join(', ', $this->suggestions),
'name' => $this->_page),
- $this->_page);
+ $this->_page
+ );
}
}
@@ -472,30 +497,32 @@
{
public $_page;
- function __construct($url, $label)
+ public function __construct($url, $label)
{
$this->_url = $url;
- if ($label)
+ if ($label) {
$this->_label = $label;
+ }
}
- function isInlineElement()
+ public function isInlineElement()
{
return true;
}
- function expand($basepage, &$markup)
+ public function expand($basepage, &$markup)
{
global $WikiTheme;
$label = isset($this->_label) ? $this->_label : false;
if ($WikiTheme->DUMP_MODE and $WikiTheme->VALID_LINKS) {
- if (!in_array($this->_page, $WikiTheme->VALID_LINKS))
+ if (!in_array($this->_page, $WikiTheme->VALID_LINKS)) {
return HTML($label ? $label : $page->getName());
+ }
}
return LinkPhpwikiURL($this->_url, $label, $basepage);
}
- function asXML()
+ public function asXML()
{
$label = isset($this->_label) ? $this->_label : false;
$link = LinkPhpwikiURL($this->_url, $label);
@@ -502,10 +529,11 @@
return $link->asXML();
}
- function asString()
+ public function asString()
{
- if (isset($this->_label))
+ if (isset($this->_label)) {
return $this->_label;
+ }
return $this->_url;
}
}
@@ -526,31 +554,37 @@
public $_attribute_base;
public $_unit;
- function __construct($url, $label = false)
+ public function __construct($url, $label = false)
{
$this->_url = $url;
- if ($label && $label != $url)
+ if ($label && $label != $url) {
$this->_label = $label;
+ }
$this->_expandurl($this->_url);
}
- function isInlineElement()
+ public function isInlineElement()
{
return true;
}
- function getPagename($basepage)
+ public function getPagename($basepage)
{
- if (!isset($this->_page)) return false;
+ if (!isset($this->_page)) {
+ return false;
+ }
$page = new WikiPageName($this->_page, $basepage);
- if ($page->isValid()) return $page->name;
- else return false;
+ if ($page->isValid()) {
+ return $page->name;
+ } else {
+ return false;
+ }
}
/* Add relation to the link table.
* attributes have the _relation, but not the _page set.
*/
- function getWikiPageLinks($basepage)
+ public function getWikiPageLinks($basepage)
{
/**
* @var WikiRequest $request
@@ -575,7 +609,7 @@
}
}
- function _expandurl($url)
+ public function _expandurl($url)
{
$m = array();
if (!preg_match('/^ ([^:]+) (:[:=]) (.+) $/x', $url, $m)) {
@@ -598,7 +632,7 @@
return $m;
}
- function _expand($url, $label = false)
+ public function _expand($url, $label = false)
{
global $WikiTheme;
$m = $this->_expandurl($url);
@@ -605,51 +639,59 @@
// do not link to the attribute value, but to the attribute
$is_attribute = ($m[2] == ':=');
if ($WikiTheme->DUMP_MODE and $WikiTheme->VALID_LINKS) {
- if (isset($this->_page) and !in_array($this->_page, $WikiTheme->VALID_LINKS))
+ if (isset($this->_page) and !in_array($this->_page, $WikiTheme->VALID_LINKS)) {
return HTML($label ? $label : ($is_attribute ? $this->_relation : $this->_page));
+ }
}
- if ($is_attribute)
+ if ($is_attribute) {
$title = isset($this->_attribute_base)
? sprintf(_("Attribute %s, base value: %s"), $this->_relation, $this->_attribute_base)
: sprintf(_("Attribute %s, value: %s"), $this->_relation, $this->_attribute);
+ }
if ($label) {
return HTML::span(
- HTML::a(array('href' => WikiURL($is_attribute ? $this->_relation : $this->_page),
+ HTML::a(
+ array('href' => WikiURL($is_attribute ? $this->_relation : $this->_page),
'class' => "wiki " . ($is_attribute ? "attribute" : "relation"),
'title' => $is_attribute
? $title
: sprintf(_("Relation %s to page %s"), $this->_relation, $this->_page)),
- $label)
+ $label
+ )
);
} elseif ($is_attribute) {
- return HTML::span
- (
- HTML::a(array('href' => WikiURL($this->_relation),
+ return HTML::span(
+ HTML::a(
+ array('href' => WikiURL($this->_relation),
'class' => "wiki attribute",
'title' => $title),
- $url)
+ $url
+ )
);
} else {
- return HTML::span
- (
- HTML::a(array('href' => WikiURL($this->_relation),
+ return HTML::span(
+ HTML::a(
+ array('href' => WikiURL($this->_relation),
'class' => "wiki relation"),
- $this->_relation),
+ $this->_relation
+ ),
HTML::span(array('class' => 'relation-symbol'), $m[2]),
- HTML::a(array('href' => WikiURL($this->_page),
+ HTML::a(
+ array('href' => WikiURL($this->_page),
'class' => "wiki"),
- $this->_page)
+ $this->_page
+ )
);
}
}
- function expand($basepage, &$markup)
+ public function expand($basepage, &$markup)
{
$label = isset($this->_label) ? $this->_label : false;
return $this->_expand($this->_url, $label);
}
- function asXML()
+ public function asXML()
{
$label = isset($this->_label) ? $this->_label : false;
$link = $this->_expand($this->_url, $label);
@@ -656,10 +698,11 @@
return $link->asXML();
}
- function asString()
+ public function asString()
{
- if (isset($this->_label))
+ if (isset($this->_label)) {
return $this->_label;
+ }
return $this->_url;
}
}
@@ -669,42 +712,44 @@
*/
class Cached_SearchHighlight extends Cached_DynamicContent
{
- function __construct($word, $engine)
+ public function __construct($word, $engine)
{
$this->_word = $word;
$this->engine = $engine;
}
- function expand($basepage, &$markup)
+ public function expand($basepage, &$markup)
{
- return HTML::span(array('class' => 'search-term',
+ return HTML::span(
+ array('class' => 'search-term',
'title' => _("Found by ") . $this->engine),
- $this->_word);
+ $this->_word
+ );
}
}
class Cached_ExternalLink extends Cached_Link
{
-
- function __construct($url, $label = false)
+ public function __construct($url, $label = false)
{
$this->_url = $url;
- if ($label && $label != $url)
+ if ($label && $label != $url) {
$this->_label = $label;
+ }
}
- function _getType()
+ public function _getType()
{
return 'external';
}
- function _getName($basepage)
+ public function _getName($basepage)
{
$label = isset($this->_label) ? $this->_label : false;
return ($label and is_string($label)) ? $label : $this->_url;
}
- function expand($basepage, &$markup)
+ public function expand($basepage, &$markup)
{
global $request;
@@ -715,16 +760,18 @@
// Ignores nofollow when the user who saved the page was authenticated.
$page = $request->getPage($basepage);
$current = $page->getCurrentRevision(false);
- if (!$current->get('author_id'))
+ if (!$current->get('author_id')) {
$link->setAttr('rel', 'nofollow');
+ }
}
return $link;
}
- function asString()
+ public function asString()
{
- if (isset($this->_label) and is_string($this->_label))
+ if (isset($this->_label) and is_string($this->_label)) {
return $this->_label;
+ }
return $this->_url;
}
}
@@ -731,17 +778,17 @@
class Cached_InterwikiLink extends Cached_ExternalLink
{
-
- function __construct($link, $label = false)
+ public function __construct($link, $label = false)
{
$this->_link = $link;
- if ($label)
+ if ($label) {
$this->_label = $label;
+ }
}
- function getPagename($basepage)
+ public function getPagename($basepage)
{
- list ($moniker, $page) = explode(":", $this->_link, 2);
+ list($moniker, $page) = explode(":", $this->_link, 2);
$page = new WikiPageName($page, $basepage);
if ($page->isValid()) {
return $page->name;
@@ -750,7 +797,7 @@
}
}
- function getWikiPageLinks($basepage)
+ public function getWikiPageLinks($basepage)
{
/**
* @var WikiRequest $request
@@ -757,9 +804,13 @@
*/
global $request;
- if ($basepage == '') return false;
+ if ($basepage == '') {
+ return false;
+ }
/* ":DontStoreLink" */
- if (substr($this->_link, 0, 1) == ':') return false;
+ if (substr($this->_link, 0, 1) == ':') {
+ return false;
+ }
/* store only links to valid pagenames */
$dbi = $request->getDbh();
if ($link = $this->getPagename($basepage) and $dbi->isWikiPage($link)) {
@@ -769,7 +820,7 @@
}
}
- function _getName($basepage)
+ public function _getName($basepage)
{
$label = isset($this->_label) ? $this->_label : false;
return ($label and is_string($label)) ? $label : $this->_link;
@@ -776,18 +827,18 @@
}
/* there may be internal interwiki links also */
- function _getType()
+ public function _getType()
{
return $this->getPagename(false) ? 'internal' : 'external';
}
- function _getURL($basepage)
+ public function _getURL($basepage)
{
$link = $this->expand($basepage, $this);
return $link->getAttr('href');
}
- function expand($basepage, &$markup)
+ public function expand($basepage, &$markup)
{
global $WikiTheme;
$intermap = getInterwikiMap();
@@ -794,16 +845,18 @@
$label = isset($this->_label) ? $this->_label : false;
//FIXME: check Upload: inlined images
if ($WikiTheme->DUMP_MODE and !empty($WikiTheme->VALID_LINKS)) {
- if (!in_array($this->_link, $WikiTheme->VALID_LINKS))
+ if (!in_array($this->_link, $WikiTheme->VALID_LINKS)) {
return HTML($label ? $label : $this->_link);
+ }
}
return $intermap->link($this->_link, $label);
}
- function asString()
+ public function asString()
{
- if (isset($this->_label))
+ if (isset($this->_label)) {
return $this->_label;
+ }
return $this->_link;
}
}
@@ -813,7 +866,7 @@
// Fixed since 1.3.8, prev. versions had no userpages in backlinks
class Cached_UserLink extends Cached_WikiLink
{
- function expand($basepage, &$markup)
+ public function expand($basepage, &$markup)
{
$label = isset($this->_label) ? $this->_label : false;
$anchor = isset($this->_anchor) ? (string)$this->_anchor : '';
@@ -833,8 +886,7 @@
*/
class Cached_PluginInvocation extends Cached_DynamicContent
{
-
- function __construct($pi)
+ public function __construct($pi)
{
$this->_pi = $pi;
$loader = $this->_getLoader();
@@ -845,12 +897,12 @@
}
}
- function isInlineElement()
+ public function isInlineElement()
{
return false;
}
- function expand($basepage, &$markup)
+ public function expand($basepage, &$markup)
{
/**
* @var WikiRequest $request
@@ -861,12 +913,12 @@
return $loader->expandPI($this->_pi, $request, $markup, $basepage);
}
- function asString()
+ public function asString()
{
return $this->_pi;
}
- function getWikiPageLinks($basepage)
+ public function getWikiPageLinks($basepage)
{
$loader = $this->_getLoader();
@@ -873,7 +925,7 @@
return $loader->getWikiPageLinks($this->_pi, $basepage);
}
- function & _getLoader()
+ public function & _getLoader()
{
static $loader = false;
Modified: trunk/lib/Captcha.php
===================================================================
--- trunk/lib/Captcha.php 2022-03-24 13:28:33 UTC (rev 11008)
+++ trunk/lib/Captcha.php 2022-03-24 13:32:25 UTC (rev 11009)
@@ -36,7 +36,7 @@
*/
public $request;
- function __construct($meta = array(), $width = 250, $height = 80)
+ public function __construct($meta = array(), $width = 250, $height = 80)
{
/**
* @var WikiRequest $request
@@ -51,7 +51,7 @@
$this->request =& $request;
}
- function captchaword()
+ public function captchaword()
{
if (!$this->request->getSessionVar('captchaword')) {
$this->request->setSessionVar('captchaword', $this->get_word());
@@ -59,22 +59,24 @@
return $this->request->getSessionVar('captchaword');
}
- function Failed()
+ public function Failed()
{
- if ($this->request->getSessionVar('captcha_ok') == true)
+ if ($this->request->getSessionVar('captcha_ok') == true) {
return false;
+ }
if (!array_key_exists('captcha_input', $this->meta)
or ($this->request->getSessionVar('captchaword')
and ($this->request->getSessionVar('captchaword') != $this->meta['captcha_input']))
- )
+ ) {
return true;
+ }
$this->request->setSessionVar('captcha_ok', true);
return false;
}
- function getFormElements()
+ public function getFormElements()
{
$el = arr...
[truncated message content] |
|
From: <var...@us...> - 2022-03-24 13:28:36
|
Revision: 11008
http://sourceforge.net/p/phpwiki/code/11008
Author: vargenau
Date: 2022-03-24 13:28:33 +0000 (Thu, 24 Mar 2022)
Log Message:
-----------
run php-cs-fixer
Modified Paths:
--------------
trunk/lib/plugin/AddComment.php
trunk/lib/plugin/AllPages.php
trunk/lib/plugin/AllUsers.php
trunk/lib/plugin/AnalyseAccessLogSql.php
trunk/lib/plugin/AppendText.php
trunk/lib/plugin/AsciiMath.php
trunk/lib/plugin/AsciiSVG.php
trunk/lib/plugin/AtomFeed.php
trunk/lib/plugin/AuthorHistory.php
trunk/lib/plugin/BackLinks.php
trunk/lib/plugin/BlogArchives.php
trunk/lib/plugin/BlogJournal.php
trunk/lib/plugin/BoxRight.php
trunk/lib/plugin/CacheTest.php
trunk/lib/plugin/Calendar.php
trunk/lib/plugin/CalendarList.php
trunk/lib/plugin/Chart.php
trunk/lib/plugin/Comment.php
trunk/lib/plugin/CreateBib.php
trunk/lib/plugin/CreatePage.php
trunk/lib/plugin/CreateToc.php
trunk/lib/plugin/CurrentTime.php
trunk/lib/plugin/DeadEndPages.php
trunk/lib/plugin/DebugAuthInfo.php
trunk/lib/plugin/DebugBackendInfo.php
trunk/lib/plugin/DebugGroupInfo.php
trunk/lib/plugin/DebugRetransform.php
trunk/lib/plugin/Diff.php
trunk/lib/plugin/DynamicIncludePage.php
trunk/lib/plugin/EditMetaData.php
trunk/lib/plugin/ExternalSearch.php
trunk/lib/plugin/FacebookLike.php
trunk/lib/plugin/FileInfo.php
trunk/lib/plugin/FoafViewer.php
trunk/lib/plugin/FullTextSearch.php
trunk/lib/plugin/FuzzyPages.php
trunk/lib/plugin/GoTo.php
trunk/lib/plugin/GoogleMaps.php
trunk/lib/plugin/GooglePlugin.php
trunk/lib/plugin/GraphViz.php
trunk/lib/plugin/HelloWorld.php
trunk/lib/plugin/HtmlConverter.php
trunk/lib/plugin/IncludePage.php
trunk/lib/plugin/IncludePages.php
trunk/lib/plugin/IncludeSiteMap.php
trunk/lib/plugin/IncludeTree.php
trunk/lib/plugin/InterWikiSearch.php
trunk/lib/plugin/JabberPresence.php
trunk/lib/plugin/LdapSearch.php
trunk/lib/plugin/LikePages.php
trunk/lib/plugin/LinkDatabase.php
trunk/lib/plugin/LinkSearch.php
trunk/lib/plugin/ListPages.php
trunk/lib/plugin/ListRelations.php
trunk/lib/plugin/ListSubpages.php
trunk/lib/plugin/MediawikiTable.php
trunk/lib/plugin/ModeratedPage.php
trunk/lib/plugin/MostPopular.php
trunk/lib/plugin/NewPagesPerUser.php
trunk/lib/plugin/NoCache.php
trunk/lib/plugin/OldStyleTable.php
trunk/lib/plugin/OrphanedPages.php
trunk/lib/plugin/PageDump.php
trunk/lib/plugin/PageGroup.php
trunk/lib/plugin/PageHistory.php
trunk/lib/plugin/PageInfo.php
trunk/lib/plugin/PageTrail.php
trunk/lib/plugin/PasswordReset.php
trunk/lib/plugin/PhotoAlbum.php
trunk/lib/plugin/PhpHighlight.php
trunk/lib/plugin/Ploticus.php
trunk/lib/plugin/PluginManager.php
trunk/lib/plugin/PopUp.php
trunk/lib/plugin/PopularNearby.php
trunk/lib/plugin/PopularTags.php
trunk/lib/plugin/PreferenceApp.php
trunk/lib/plugin/PrevNext.php
trunk/lib/plugin/Processing.php
trunk/lib/plugin/RandomPage.php
trunk/lib/plugin/RateIt.php
trunk/lib/plugin/RawHtml.php
trunk/lib/plugin/RecentChanges.php
trunk/lib/plugin/RecentComments.php
trunk/lib/plugin/RecentEdits.php
trunk/lib/plugin/RecentReferrers.php
trunk/lib/plugin/RedirectTo.php
trunk/lib/plugin/RelatedChanges.php
trunk/lib/plugin/RichTable.php
trunk/lib/plugin/RssFeed.php
trunk/lib/plugin/SearchHighlight.php
trunk/lib/plugin/SemanticRelations.php
trunk/lib/plugin/SemanticSearch.php
trunk/lib/plugin/SemanticSearchAdvanced.php
trunk/lib/plugin/SiteMap.php
trunk/lib/plugin/SpellCheck.php
trunk/lib/plugin/SqlResult.php
trunk/lib/plugin/SyncWiki.php
trunk/lib/plugin/SyntaxHighlighter.php
trunk/lib/plugin/SystemInfo.php
trunk/lib/plugin/TeX2png.php
trunk/lib/plugin/Template.php
trunk/lib/plugin/TexToPng.php
trunk/lib/plugin/TitleSearch.php
trunk/lib/plugin/Transclude.php
trunk/lib/plugin/TranslateText.php
trunk/lib/plugin/UnfoldSubpages.php
trunk/lib/plugin/UpLoad.php
trunk/lib/plugin/UriResolver.php
trunk/lib/plugin/UserPreferences.php
trunk/lib/plugin/UserRatings.php
trunk/lib/plugin/Video.php
trunk/lib/plugin/VisualWiki.php
trunk/lib/plugin/WantedPages.php
trunk/lib/plugin/WatchPage.php
trunk/lib/plugin/WhoIsOnline.php
trunk/lib/plugin/WikiAdminChown.php
trunk/lib/plugin/WikiAdminDeleteAcl.php
trunk/lib/plugin/WikiAdminPurge.php
trunk/lib/plugin/WikiAdminRemove.php
trunk/lib/plugin/WikiAdminRename.php
trunk/lib/plugin/WikiAdminSearchReplace.php
trunk/lib/plugin/WikiAdminSelect.php
trunk/lib/plugin/WikiAdminSetAcl.php
trunk/lib/plugin/WikiAdminSetAclSimple.php
trunk/lib/plugin/WikiAdminSetExternal.php
trunk/lib/plugin/WikiAdminUtils.php
trunk/lib/plugin/WikiBlog.php
trunk/lib/plugin/WikiForm.php
trunk/lib/plugin/WikiFormRich.php
trunk/lib/plugin/WikiForum.php
trunk/lib/plugin/WikiPoll.php
trunk/lib/plugin/WikiTranslation.php
trunk/lib/plugin/WikicreoleTable.php
trunk/lib/plugin/YouTube.php
trunk/lib/plugin/text2png.php
Modified: trunk/lib/plugin/AddComment.php
===================================================================
--- trunk/lib/plugin/AddComment.php 2022-03-15 14:23:50 UTC (rev 11007)
+++ trunk/lib/plugin/AddComment.php 2022-03-24 13:28:33 UTC (rev 11008)
@@ -34,10 +34,9 @@
include_once 'lib/plugin/WikiBlog.php';
-class WikiPlugin_AddComment
- extends WikiPlugin_WikiBlog
+class WikiPlugin_AddComment extends WikiPlugin_WikiBlog
{
- function getDescription()
+ public function getDescription()
{
return sprintf(_("Show and add comments for %s."), '[pagename]');
}
@@ -56,7 +55,7 @@
// jshide - boolean - quick javascript expansion of the comments
// and addcomment box
- function getDefaultArguments()
+ public function getDefaultArguments()
{
return array('pagename' => '[pagename]',
'order' => 'normal',
@@ -74,7 +73,7 @@
* @param string $basepage
* @return mixed
*/
- function run($dbi, $argstr, &$request, $basepage)
+ public function run($dbi, $argstr, &$request, $basepage)
{
$args = $this->getArgs($argstr, $request);
if (!$args['pagename']) {
@@ -128,17 +127,20 @@
a.title='" . _("Click to display all comments") . "';
}
}"));
- $html->pushContent(HTML::h4(HTML::a(array('id' => 'comment-header',
+ $html->pushContent(HTML::h4(HTML::a(
+ array('id' => 'comment-header',
'class' => 'wikiaction',
'title' => _("Click to display"),
'onclick' => "togglecomments(this)"),
- _("Comments"))));
+ _("Comments")
+ )));
} else {
$div = HTML::div(array('id' => 'comments'));
}
foreach (explode(',', $args['mode']) as $show) {
- if (!empty($seen[$show]))
+ if (!empty($seen[$show])) {
continue;
+ }
$seen[$show] = 1;
switch ($show) {
case 'show':
@@ -161,5 +163,4 @@
$html->pushContent($div);
return $html;
}
-
}
Modified: trunk/lib/plugin/AllPages.php
===================================================================
--- trunk/lib/plugin/AllPages.php 2022-03-15 14:23:50 UTC (rev 11007)
+++ trunk/lib/plugin/AllPages.php 2022-03-24 13:28:33 UTC (rev 11008)
@@ -30,18 +30,16 @@
* AllPagesCreatedByMe, AllPagesOwnedByMe, AllPagesLastAuthoredByMe
*/
-class WikiPlugin_AllPages
- extends WikiPlugin
+class WikiPlugin_AllPages extends WikiPlugin
{
- function getDescription()
+ public function getDescription()
{
return _("List all pages in this wiki.");
}
- function getDefaultArguments()
+ public function getDefaultArguments()
{
- return array_merge
- (
+ return array_merge(
PageList::supportedArgs(),
array(
'noheader' => false,
@@ -48,7 +46,8 @@
'include_empty' => false,
'info' => '',
'userpages' => false
- ));
+ )
+ );
}
// info arg allows multiple columns
@@ -63,7 +62,7 @@
* @param string $basepage
* @return mixed
*/
- function run($dbi, $argstr, &$request, $basepage)
+ public function run($dbi, $argstr, &$request, $basepage)
{
$args = $this->getArgs($argstr, $request);
@@ -101,8 +100,10 @@
}
if (isset($args['limit']) && !is_limit($args['limit'])) {
- return HTML::p(array('class' => "error"),
- _("Illegal “limit” argument: must be an integer or two integers separated by comma"));
+ return HTML::p(
+ array('class' => "error"),
+ _("Illegal “limit” argument: must be an integer or two integers separated by comma")
+ );
}
if (empty($args['sortby'])) {
@@ -120,27 +121,42 @@
} elseif (!empty($args['owner'])) {
$pages = PageList::allPagesByOwner($args['owner'], $include_empty, $args['sortby']);
$args['count'] = count($pages);
- $caption = fmt("List of pages owned by %s (%d total):",
- WikiLink($args['owner'] == '[]'
+ $caption = fmt(
+ "List of pages owned by %s (%d total):",
+ WikiLink(
+ $args['owner'] == '[]'
? $request->_user->getAuthenticatedId()
: $args['owner'],
- 'if_known'), $args['count']);
+ 'if_known'
+ ),
+ $args['count']
+ );
} elseif (!empty($args['author'])) {
$pages = PageList::allPagesByAuthor($args['author'], $include_empty, $args['sortby']);
$args['count'] = count($pages);
- $caption = fmt("List of pages last edited by %s (%d total):",
- WikiLink($args['author'] == '[]'
+ $caption = fmt(
+ "List of pages last edited by %s (%d total):",
+ WikiLink(
+ $args['author'] == '[]'
? $request->_user->getAuthenticatedId()
: $args['author'],
- 'if_known'), $args['count']);
+ 'if_known'
+ ),
+ $args['count']
+ );
} elseif (!empty($args['creator'])) {
$pages = PageList::allPagesByCreator($args['creator'], $include_empty, $args['sortby']);
$args['count'] = count($pages);
- $caption = fmt("List of pages created by %s (%d total):",
- WikiLink($args['creator'] == '[]'
+ $caption = fmt(
+ "List of pages created by %s (%d total):",
+ WikiLink(
+ $args['creator'] == '[]'
? $request->_user->getAuthenticatedId()
: $args['creator'],
- 'if_known'), $args['count']);
+ 'if_known'
+ ),
+ $args['count']
+ );
} elseif ($pages) {
$args['count'] = count($pages);
} else {
Modified: trunk/lib/plugin/AllUsers.php
===================================================================
--- trunk/lib/plugin/AllUsers.php 2022-03-15 14:23:50 UTC (rev 11007)
+++ trunk/lib/plugin/AllUsers.php 2022-03-24 13:28:33 UTC (rev 11008)
@@ -33,22 +33,21 @@
* externally authenticated users with a db users table, if auth_user_exists is defined.
*/
-class WikiPlugin_AllUsers
- extends WikiPlugin
+class WikiPlugin_AllUsers extends WikiPlugin
{
- function getDescription()
+ public function getDescription()
{
return _("List all once authenticated users.");
}
- function getDefaultArguments()
+ public function getDefaultArguments()
{
- return array_merge
- (
+ return array_merge(
PageList::supportedArgs(),
array('noheader' => false,
'include_empty' => true
- ));
+ )
+ );
}
// info arg allows multiple columns
@@ -67,13 +66,15 @@
* @param string $basepage
* @return mixed
*/
- function run($dbi, $argstr, &$request, $basepage)
+ public function run($dbi, $argstr, &$request, $basepage)
{
$args = $this->getArgs($argstr, $request);
if (isset($args['limit']) && !is_limit($args['limit'])) {
- return HTML::p(array('class' => "error"),
- _("Illegal “limit” argument: must be an integer or two integers separated by comma"));
+ return HTML::p(
+ array('class' => "error"),
+ _("Illegal “limit” argument: must be an integer or two integers separated by comma")
+ );
}
extract($args);
@@ -97,16 +98,20 @@
$args['count'] = count($allusers);
// deleted pages show up as version 0.
$pagelist = new PageList($info, $exclude, $args);
- if (!$noheader)
+ if (!$noheader) {
$pagelist->setCaption(_("Authenticated users on this wiki (%d total):"));
- if ($include_empty and empty($info))
+ }
+ if ($include_empty and empty($info)) {
$pagelist->_addColumn('version');
+ }
list($offset, $pagesize) = $pagelist->limit($args['limit']);
if (!$pagesize) {
$pagelist->addPageList($allusers);
} else {
for ($i = $offset; $i < $offset + $pagesize - 1; $i++) {
- if ($i >= $args['count']) break;
+ if ($i >= $args['count']) {
+ break;
+ }
$pagelist->addPage(trim($allusers[$i]));
}
}
Modified: trunk/lib/plugin/AnalyseAccessLogSql.php
===================================================================
--- trunk/lib/plugin/AnalyseAccessLogSql.php 2022-03-15 14:23:50 UTC (rev 11007)
+++ trunk/lib/plugin/AnalyseAccessLogSql.php 2022-03-24 13:28:33 UTC (rev 11008)
@@ -30,8 +30,7 @@
* To add a new query, see getQueryString()
*/
-class WikiPlugin_AnalyseAccessLogSql
- extends WikiPlugin
+class WikiPlugin_AnalyseAccessLogSql extends WikiPlugin
{
public $_theadrow;
public $_headerSet;
@@ -88,8 +87,9 @@
}
switch ($args['mode']) {
case 'referring_urls':
- if ($where_conditions <> '')
+ if ($where_conditions <> '') {
$where_conditions = 'WHERE ' . $where_conditions . ' ';
+ }
$query = "SELECT "
. "$Referring_URL AS Referring_URL, "
. "count(*) AS Referral_Count "
@@ -100,8 +100,9 @@
case 'external_referers':
$args['local_referrers'] = 'false';
$where_conditions = $this->getWhereConditions($args);
- if ($where_conditions <> '')
+ if ($where_conditions <> '') {
$where_conditions = 'WHERE ' . $where_conditions . ' ';
+ }
$query = "SELECT "
. "$Referring_URL AS Referring_URL, "
. "count(*) AS Referral_Count "
@@ -110,8 +111,9 @@
. "GROUP BY Referring_URL";
break;
case 'referring_domains':
- if ($where_conditions <> '')
+ if ($where_conditions <> '') {
$where_conditions = 'WHERE ' . $where_conditions . ' ';
+ }
switch ($backend_type) {
case 'mysql':
$Referring_Domain = "left(referer, if(locate('/', referer, 8) > 0,locate('/', referer, 8) -1, length(referer)))";
@@ -132,8 +134,9 @@
. "GROUP BY Referring_Domain";
break;
case 'remote_hosts':
- if ($where_conditions <> '')
+ if ($where_conditions <> '') {
$where_conditions = 'WHERE ' . $where_conditions . ' ';
+ }
$query = "SELECT "
. "remote_host AS Remote_Host, "
. "count(*) AS Access_Count "
@@ -142,8 +145,9 @@
. "GROUP BY Remote_Host";
break;
case 'users':
- if ($where_conditions <> '')
+ if ($where_conditions <> '') {
$where_conditions = 'WHERE ' . $where_conditions . ' ';
+ }
$query = "SELECT "
. "remote_user AS User, "
. "count(*) AS Access_Count "
@@ -152,8 +156,9 @@
. "GROUP BY remote_user";
break;
case 'host_users':
- if ($where_conditions <> '')
+ if ($where_conditions <> '') {
$where_conditions = 'WHERE ' . $where_conditions . ' ';
+ }
$query = "SELECT "
. "remote_host AS Remote_Host, "
. "remote_user AS User, "
@@ -253,7 +258,7 @@
);
}
- function getDefaultArguments()
+ public function getDefaultArguments()
{
return array(
'mode' => 'referring_domains',
@@ -267,7 +272,7 @@
);
}
- function getDescription()
+ public function getDescription()
{
return _("Show summary information from the access log table.");
}
@@ -279,19 +284,23 @@
* @param string $basepage
* @return mixed
*/
- function run($dbi, $argstr, &$request, $basepage)
+ public function run($dbi, $argstr, &$request, $basepage)
{
// flag that the output may not be cached - i.e. it is dynamic
$request->setArg('nocache', 1);
if (!$request->_user->isAdmin()) {
- return HTML::p(array('class' => 'error'),
- _("The requested information is available only to Administrators."));
+ return HTML::p(
+ array('class' => 'error'),
+ _("The requested information is available only to Administrators.")
+ );
}
if (!ACCESS_LOG_SQL) { // need read access
- return HTML::p(array('class' => 'error'),
- _("The ACCESS_LOG_SQL is not enabled."));
+ return HTML::p(
+ array('class' => 'error'),
+ _("The ACCESS_LOG_SQL is not enabled.")
+ );
}
// set aside a place for the table headers, see setHeaders()
@@ -303,8 +312,10 @@
$query = $this->getQueryString($args);
if ($query == '') {
- return HTML::p(array('class' => 'error'),
- sprintf(_("Unrecognised parameter 'mode=%s'"), $args['mode']));
+ return HTML::p(
+ array('class' => 'error'),
+ sprintf(_("Unrecognised parameter 'mode=%s'"), $args['mode'])
+ );
}
// get the data back.
@@ -312,10 +323,12 @@
// otherwise the headers will not be ready
$tbody = $this->getQueryResults($query, $dbi);
- return HTML::table(array('class' => 'bordered'),
+ return HTML::table(
+ array('class' => 'bordered'),
HTML::caption($this->getCaption($args)),
HTML::thead($this->_theadrow),
- $tbody);
+ $tbody
+ );
}
private function getQueryResults($query, &$dbi)
@@ -366,8 +379,9 @@
}
$since = $since * $args['count'];
if ($since > 0) {
- if ($where_conditions <> '')
+ if ($where_conditions <> '') {
$where_conditions = $where_conditions . ' AND ';
+ }
$since = time() - $since;
$where_conditions = $where_conditions . "time_stamp > $since";
}
@@ -375,8 +389,9 @@
if ($args['local_referrers'] <> 'true') {
global $request;
- if ($where_conditions <> '')
+ if ($where_conditions <> '') {
$where_conditions = $where_conditions . ' AND ';
+ }
$localhost = SERVER_URL;
$len = strlen($localhost);
$backend_type = $request->_dbi->_backend->backendType();
@@ -397,8 +412,9 @@
// The assumed contract is that there is a space at the end of the
// conditions string, so that following SQL clauses (such as GROUP BY)
// will not cause a syntax error
- if ($where_conditions <> '')
+ if ($where_conditions <> '') {
$where_conditions = $where_conditions . ' ';
+ }
return $where_conditions;
}
@@ -406,11 +422,12 @@
private function getCaption(&$args)
{
$caption = $args['caption'];
- if ($caption == '')
+ if ($caption == '') {
$caption = gettext($args['mode']);
- if ($args['period'] <> '' && $args['count'])
+ }
+ if ($args['period'] <> '' && $args['count']) {
$caption = $caption . " - " . $args['count'] . " " . gettext($args['period']);
+ }
return $caption;
}
-
}
Modified: trunk/lib/plugin/AppendText.php
===================================================================
--- trunk/lib/plugin/AppendText.php 2022-03-15 14:23:50 UTC (rev 11007)
+++ trunk/lib/plugin/AppendText.php 2022-03-24 13:28:33 UTC (rev 11008)
@@ -33,15 +33,14 @@
* Todo: multiple pages. e.g. AppendText s=~[CategoryINtime~] page=<!plugin TitleSearch intime !>
*/
-class WikiPlugin_AppendText
- extends WikiPlugin
+class WikiPlugin_AppendText extends WikiPlugin
{
- function getDescription()
+ public function getDescription()
{
return _("Append text to any page in this wiki.");
}
- function getDefaultArguments()
+ public function getDefaultArguments()
{
return array('page' => '[pagename]',
'pages' => false,
@@ -66,7 +65,7 @@
* @param string $basepage
* @return HTML|XmlContent
*/
- function run($dbi, $argstr, &$request, $basepage)
+ public function run($dbi, $argstr, &$request, $basepage)
{
$args = $this->getArgs($argstr, $request);
@@ -85,8 +84,9 @@
return $this->work($args['page'], $args, $dbi, $request);
} else {
$html = HTML();
- if ($args['page'] != $basepage)
+ if ($args['page'] != $basepage) {
$html->pushContent(_("pages argument overrides page argument. ignored."), HTML::br());
+ }
foreach ($args['pages'] as $pagename) {
$html->pushContent($this->work($pagename, $args, $dbi, $request));
}
@@ -98,9 +98,10 @@
{
if (empty($args['s'])) {
if ($request->isPost()) {
- if ($pagename != _("AppendText"))
+ if ($pagename != _("AppendText")) {
$request->redirect(WikiURL($pagename, array(), 'absurl'), false);
- return HTML();
+ }
+ return HTML();
}
return HTML();
}
@@ -109,8 +110,10 @@
$message = HTML();
if (!$page->exists()) { // We might want to create it?
- $message->pushContent(sprintf(_("Page could not be updated. %s doesn't exist!"),
- $pagename));
+ $message->pushContent(sprintf(
+ _("Page could not be updated. %s doesn't exist!"),
+ $pagename
+ ));
return $message;
}
@@ -123,17 +126,21 @@
$before = preg_quote($args['before'], "/");
// Insert before
$newtext = preg_match("/\n${before}/", $oldtext)
- ? preg_replace("/(\n${before})/",
+ ? preg_replace(
+ "/(\n${before})/",
"\n" . preg_quote($text, "/") . "\\1",
- $oldtext)
+ $oldtext
+ )
: $this->fallback($text, $oldtext, $args['before'], $message);
} elseif (!empty($args['after'])) {
// Insert after
$after = preg_quote($args['after'], "/");
$newtext = preg_match("/\n${after}/", $oldtext)
- ? preg_replace("/(\n${after})/",
+ ? preg_replace(
+ "/(\n${after})/",
"\\1\n" . preg_quote($text, "/"),
- $oldtext)
+ $oldtext
+ )
: $this->fallback($text, $oldtext, $args['after'], $message);
} else {
// Append at the end
@@ -145,8 +152,10 @@
$meta = $current->_data;
$meta['summary'] = sprintf(_("AppendText to %s"), $pagename);
if ($page->save($newtext, $current->getVersion() + 1, $meta)) {
- $message->pushContent(HTML::p(array('class' => 'feedback'),
- _("Page successfully updated.")));
+ $message->pushContent(HTML::p(
+ array('class' => 'feedback'),
+ _("Page successfully updated.")
+ ));
}
// AppendText has been called from the same page that got modified
@@ -158,7 +167,7 @@
//
$request->redirect(WikiURL($pagename, array(), 'absurl'), false);
return HTML();
- // The user asked to be redirected to the modified page
+ // The user asked to be redirected to the modified page
} elseif ($redirect) {
$request->redirect(WikiURL($pagename, array(), 'absurl'), false);
return HTML();
Modified: trunk/lib/plugin/AsciiMath.php
===================================================================
--- trunk/lib/plugin/AsciiMath.php 2022-03-15 14:23:50 UTC (rev 11007)
+++ trunk/lib/plugin/AsciiMath.php 2022-03-24 13:28:33 UTC (rev 11008)
@@ -40,22 +40,21 @@
</math>
*/
-class WikiPlugin_AsciiMath
- extends WikiPlugin
+class WikiPlugin_AsciiMath extends WikiPlugin
{
public $source;
- function getDescription()
+ public function getDescription()
{
return _("Render ASCII Math as MathML.");
}
- function getDefaultArguments()
+ public function getDefaultArguments()
{
return array();
}
- function handle_plugin_args_cruft($argstr, $args)
+ public function handle_plugin_args_cruft($argstr, $args)
{
$this->source = $argstr;
}
@@ -67,7 +66,7 @@
* @param string $basepage
* @return mixed
*/
- function run($dbi, $argstr, &$request, $basepage)
+ public function run($dbi, $argstr, &$request, $basepage)
{
$args = $this->getArgs($argstr, $request);
if (empty($this->source)) {
Modified: trunk/lib/plugin/AsciiSVG.php
===================================================================
--- trunk/lib/plugin/AsciiSVG.php 2022-03-15 14:23:50 UTC (rev 11007)
+++ trunk/lib/plugin/AsciiSVG.php 2022-03-24 13:28:33 UTC (rev 11008)
@@ -27,17 +27,16 @@
* Syntax: http://www1.chapman.edu/~jipsen/svg/asciisvgcommands.html
*/
-class WikiPlugin_AsciiSVG
- extends WikiPlugin
+class WikiPlugin_AsciiSVG extends WikiPlugin
{
public $source;
- function getDescription()
+ public function getDescription()
{
return _("Render inline ASCII SVG.");
}
- function getDefaultArguments()
+ public function getDefaultArguments()
{
return array('width' => 200,
'height' => 200,
@@ -46,7 +45,7 @@
);
}
- function handle_plugin_args_cruft($argstr, $args)
+ public function handle_plugin_args_cruft($argstr, $args)
{
$this->source = $argstr;
}
@@ -58,22 +57,24 @@
* @param string $basepage
* @return mixed
*/
- function run($dbi, $argstr, &$request, $basepage)
+ public function run($dbi, $argstr, &$request, $basepage)
{
global $WikiTheme;
$args = $this->getArgs($argstr, $request);
if (empty($this->source)) {
- return HTML::p(array('class' => "error"),
- _("Please provide SVG code to AsciiSVG plugin"));
+ return HTML::p(
+ array('class' => "error"),
+ _("Please provide SVG code to AsciiSVG plugin")
+ );
}
$html = HTML();
if (empty($WikiTheme->_asciiSVG)) {
- $js = JavaScript('', array
- ('src' => $WikiTheme->_findData('ASCIIsvg.js')));
- if (empty($WikiTheme->_headers_printed))
+ $js = JavaScript('', array('src' => $WikiTheme->_findData('ASCIIsvg.js')));
+ if (empty($WikiTheme->_headers_printed)) {
$WikiTheme->addMoreHeaders($js);
- else
+ } else {
$html->pushContent($js);
+ }
$WikiTheme->_asciiSVG = 1; // prevent duplicates
}
// extract <script>
@@ -86,11 +87,15 @@
//'src' => "d.svg",
'script' => $this->source);
// additional onmousemove argument
- if ($args['onmousemove']) $embedargs['onmousemove'] = $args['onmousemove'];
+ if ($args['onmousemove']) {
+ $embedargs['onmousemove'] = $args['onmousemove'];
+ }
// we need script='data' and not script="data"
$embed = new AsciiSVG_HTML("embed", $embedargs);
$html->pushContent($embed);
- if ($args['script']) $html->pushContent(JavaScript($args['script']));
+ if ($args['script']) {
+ $html->pushContent(JavaScript($args['script']));
+ }
return $html;
}
}
@@ -97,22 +102,24 @@
class AsciiSVG_HTML extends HtmlElement
{
- function startTag()
+ public function startTag()
{
$start = "<" . $this->_tag;
$this->_setClasses();
foreach ($this->_attr as $attr => $val) {
if (is_bool($val)) {
- if (!$val)
+ if (!$val) {
continue;
+ }
$val = $attr;
}
$qval = str_replace("\"", '"', $this->_quote((string)$val));
- if ($attr == 'script')
+ if ($attr == 'script') {
// note the ' not "
$start .= " $attr='$qval'";
- else
+ } else {
$start .= " $attr=\"$qval\"";
+ }
}
$start .= ">";
return $start;
Modified: trunk/lib/plugin/AtomFeed.php
===================================================================
--- trunk/lib/plugin/AtomFeed.php 2022-03-15 14:23:50 UTC (rev 11007)
+++ trunk/lib/plugin/AtomFeed.php 2022-03-24 13:28:33 UTC (rev 11008)
@@ -29,15 +29,14 @@
require_once 'lib/WikiPlugin.php';
require_once 'lib/AtomParser.php';
-class WikiPlugin_AtomFeed
- extends WikiPlugin
+class WikiPlugin_AtomFeed extends WikiPlugin
{
- function getDescription()
+ public function getDescription()
{
return _('Atom Aggregator Plugin.');
}
- function getDefaultArguments()
+ public function getDefaultArguments()
{
return array(
'feed' => "",
@@ -55,7 +54,7 @@
* @param string $basepage
* @return mixed
*/
- function run($dbi, $argstr, &$request, $basepage)
+ public function run($dbi, $argstr, &$request, $basepage)
{
extract($this->getArgs($argstr, $request));
Modified: trunk/lib/plugin/AuthorHistory.php
===================================================================
--- trunk/lib/plugin/AuthorHistory.php 2022-03-15 14:23:50 UTC (rev 11007)
+++ trunk/lib/plugin/AuthorHistory.php 2022-03-24 13:28:33 UTC (rev 11008)
@@ -51,17 +51,16 @@
require_once 'lib/PageList.php';
-class WikiPlugin_AuthorHistory
- extends WikiPlugin
+class WikiPlugin_AuthorHistory extends WikiPlugin
{
public $_args;
- function getDescription()
+ public function getDescription()
{
return _("List all page revisions edited by one user with diff links, or show a PageHistory-like list of a single page for only one user.");
}
- function getDefaultArguments()
+ public function getDefaultArguments()
{
global $request;
return array('exclude' => '',
@@ -85,7 +84,7 @@
* @param string $basepage
* @return mixed
*/
- function run($dbi, $argstr, &$request, $basepage)
+ public function run($dbi, $argstr, &$request, $basepage)
{
$this->_args = $this->getArgs($argstr, $request);
extract($this->_args);
@@ -123,8 +122,9 @@
if (!$author) { // user not signed in and no author specified
return HTML::p(array('class' => 'error'), _("You are not signed in and no author is specified."));
}
- if ($page && $page == 'username') //FIXME: use [username]!!!!!
+ if ($page && $page == 'username') { //FIXME: use [username]!!!!!
$page = $author;
+ }
$nbsp = HTML::raw(' ');
@@ -137,8 +137,11 @@
if (!($page == 'all')) {
$p = $dbi->getPage($page);
- $thead->pushContent(HTML::tr(HTML::th(array('class' => 'align-right'),
- _("Version")),
+ $thead->pushContent(HTML::tr(
+ HTML::th(
+ array('class' => 'align-right'),
+ _("Version")
+ ),
$includeminor ? HTML::th(_("Minor")) : "",
HTML::th(_("Author")),
HTML::th(_("Summary")),
@@ -147,22 +150,32 @@
$allrevisions_iter = $p->getAllRevisions();
while ($rev = $allrevisions_iter->next()) {
-
$isminor = $rev->get('is_minor_edit');
$authordoesmatch = $author == $rev->get('author');
if ($authordoesmatch && (!$isminor || ($includeminor && $isminor))) {
- $difflink = Button(array('action' => 'diff',
+ $difflink = Button(
+ array('action' => 'diff',
'previous' => 'minor'),
- $rev->getVersion(), $rev);
- $tr = HTML::tr(HTML::td(array('class' => 'align-right'),
- $difflink, $nbsp),
+ $rev->getVersion(),
+ $rev
+ );
+ $tr = HTML::tr(
+ HTML::td(
+ array('class' => 'align-right'),
+ $difflink,
+ $nbsp
+ ),
$includeminor ? (HTML::td($nbsp, ($isminor ? "minor" : "major"), $nbsp)) : "",
- HTML::td($nbsp, WikiLink($rev->get('author'),
- 'if_known'), $nbsp),
+ HTML::td($nbsp, WikiLink(
+ $rev->get('author'),
+ 'if_known'
+ ), $nbsp),
HTML::td($nbsp, $rev->get('summary')),
- HTML::td(array('class' => 'align-right'),
- $WikiTheme->formatDateTime($rev->get('mtime')))
+ HTML::td(
+ array('class' => 'align-right'),
+ $WikiTheme->formatDateTime($rev->get('mtime'))
+ )
);
$class = $isminor ? 'evenrow' : 'oddrow';
@@ -170,17 +183,22 @@
$tbody->pushContent($tr);
}
}
- $captext = fmt($includeminor
+ $captext = fmt(
+ $includeminor
? "History of all major and minor edits by %s to page %s."
: "History of all major edits by %s to page %s.",
- WikiLink($author, 'auto'),
- WikiLink($page, 'auto'));
+ WikiLink($author, 'auto'),
+ WikiLink($page, 'auto')
+ );
} else {
//search all pages for all edits by this author
- $thead->pushContent(HTML::tr(HTML::th(_("Page Name")),
- HTML::th(array('class' => 'align-right'),
- _("Version")),
+ $thead->pushContent(HTML::tr(
+ HTML::th(_("Page Name")),
+ HTML::th(
+ array('class' => 'align-right'),
+ _("Version")
+ ),
$includeminor ? HTML::th(_("Minor")) : "",
HTML::th(_("Summary")),
HTML::th(_("Modified"))
@@ -188,25 +206,34 @@
$allpages_iter = $dbi->getAllPages($includedeleted);
while ($p = $allpages_iter->next()) {
-
$allrevisions_iter = $p->getAllRevisions();
while ($rev = $allrevisions_iter->next()) {
$isminor = $rev->get('is_minor_edit');
$authordoesmatch = $author == $rev->get('author');
if ($authordoesmatch && (!$isminor || ($includeminor && $isminor))) {
- $difflink = Button(array('action' => 'diff',
+ $difflink = Button(
+ array('action' => 'diff',
'previous' => 'minor'),
- $rev->getVersion(), $rev);
+ $rev->getVersion(),
+ $rev
+ );
$tr = HTML::tr(
- HTML::td($nbsp,
+ HTML::td(
+ $nbsp,
($isminor ? $rev->_pagename : WikiLink($rev->_pagename, 'auto'))
),
- HTML::td(array('class' => 'align-right'),
- $difflink, $nbsp),
+ HTML::td(
+ array('class' => 'align-right'),
+ $difflink,
+ $nbsp
+ ),
$includeminor ? (HTML::td($nbsp, ($isminor ? "minor" : "major"), $nbsp)) : "",
HTML::td($nbsp, $rev->get('summary')),
- HTML::td(array('class' => 'align-right'),
- $WikiTheme->formatDateTime($rev->get('mtime')), $nbsp)
+ HTML::td(
+ array('class' => 'align-right'),
+ $WikiTheme->formatDateTime($rev->get('mtime')),
+ $nbsp
+ )
);
$class = $isminor ? 'evenrow' : 'oddrow';
@@ -216,10 +243,12 @@
}
}
- $captext = fmt($includeminor
+ $captext = fmt(
+ $includeminor
? "History of all major and minor modifications for any page edited by %s."
: "History of major modifications for any page edited by %s.",
- WikiLink($author, 'auto'));
+ WikiLink($author, 'auto')
+ );
}
$table->pushContent(HTML::caption($captext));
Modified: trunk/lib/plugin/BackLinks.php
===================================================================
--- trunk/lib/plugin/BackLinks.php 2022-03-15 14:23:50 UTC (rev 11007)
+++ trunk/lib/plugin/BackLinks.php 2022-03-24 13:28:33 UTC (rev 11008)
@@ -24,18 +24,16 @@
require_once 'lib/PageList.php';
-class WikiPlugin_BackLinks
- extends WikiPlugin
+class WikiPlugin_BackLinks extends WikiPlugin
{
- function getDescription()
+ public function getDescription()
{
return sprintf(_("List all pages which link to %s."), '[pagename]');
}
- function getDefaultArguments()
+ public function getDefaultArguments()
{
- return array_merge
- (
+ return array_merge(
PageList::supportedArgs(),
array('include_self' => false,
'noheader' => false,
@@ -42,7 +40,8 @@
'page' => '[pagename]',
'linkmore' => '', // If count>0 and limit>0 display a link with
// the number of all results, linked to the given pagename.
- ));
+ )
+ );
}
// info arg allows multiple columns
@@ -57,13 +56,15 @@
* @param string $basepage
* @return mixed
*/
- function run($dbi, $argstr, &$request, $basepage)
+ public function run($dbi, $argstr, &$request, $basepage)
{
$args = $this->getArgs($argstr, $request);
if (isset($args['limit']) && !is_limit($args['limit'])) {
- return HTML::p(array('class' => "error"),
- _("Illegal “limit” argument: must be an integer or two integers separated by comma"));
+ return HTML::p(
+ array('class' => "error"),
+ _("Illegal “limit” argument: must be an integer or two integers separated by comma")
+ );
}
extract($args);
@@ -122,15 +123,18 @@
$bi = $dp->getBackLinks(false, $sortby, 0, $exclude);
while ($b = $bi->next()) {
$name = $b->getName();
- if (isset($bl[$name]))
+ if (isset($bl[$name])) {
$bl[$name]++;
- else
+ } else {
$bl[$name] = 1;
+ }
}
}
- foreach ($bl as $b => $v)
- if ($v == $count)
+ foreach ($bl as $b => $v) {
+ if ($v == $count) {
$pagelist->addPage($b);
+ }
+ }
} else {
$p = $dbi->getPage($page);
$pagelist->addPages($p->getBackLinks(false, $sortby, 0, $exclude));
@@ -156,12 +160,16 @@
// page currently being viewed.
$pagelink = $page;
- if ($pagelist->isEmpty())
+ if ($pagelist->isEmpty()) {
return HTML::p(fmt("No other page links to %s yet.", $pagelink));
+ }
- if ($total == 1)
- $pagelist->setCaption(fmt("One page would link to %s:",
- $pagelink));
+ if ($total == 1) {
+ $pagelist->setCaption(fmt(
+ "One page would link to %s:",
+ $pagelink
+ ));
+ }
// Some future localizations will actually require
// this... (BelieveItOrNot, English-only-speakers!(:)
//
@@ -168,28 +176,38 @@
// else if ($pagelist->getTotal() == 2)
// $pagelist->setCaption(fmt("Two pages would link to %s:",
// $pagelink));
- else
- $pagelist->setCaption(fmt("%s pages would link to %s:",
- $total, $pagelink));
+ else {
+ $pagelist->setCaption(fmt(
+ "%s pages would link to %s:",
+ $total,
+ $pagelink
+ ));
+ }
} else {
if ($count) {
$tmp_pages = $pages;
$p = array_shift($tmp_pages);
$pagelink = HTML(WikiLink($p, 'auto'));
- foreach ($tmp_pages as $p)
+ foreach ($tmp_pages as $p) {
$pagelink->pushContent(" ", _("AND"), " ", WikiLink($p, 'auto'));
- } else
+ }
+ } else {
// BackLinks plugin is being displayed on a normal page.
$pagelink = WikiLink($page, 'auto');
+ }
- if ($pagelist->isEmpty())
+ if ($pagelist->isEmpty()) {
return HTML::p(fmt("No page links to %s.", $pagelink));
+ }
//trigger_error("DEBUG: " . $pagelist->getTotal());
- if ($total == 1)
- $pagelist->setCaption(fmt("One page links to %s:",
- $pagelink));
+ if ($total == 1) {
+ $pagelist->setCaption(fmt(
+ "One page links to %s:",
+ $pagelink
+ ));
+ }
// Some future localizations will actually require
// this... (BelieveItOrNot, English-only-speakers!(:)
//
@@ -196,26 +214,29 @@
// else if ($pagelist->getTotal() == 2)
// $pagelist->setCaption(fmt("Two pages link to %s:",
// $pagelink));
- else
- $pagelist->setCaption(fmt("%s pages link to %s:",
+ else {
+ $pagelist->setCaption(fmt(
+ "%s pages link to %s:",
$limit > 0 ? $total : _("Those"),
- $pagelink));
+ $pagelink
+ ));
+ }
}
}
if (!empty($args['linkmore'])
and $dbi->isWikiPage($args['linkmore'])
and $limit > 0 and $total > $limit
- )
+ ) {
$pagelist->addCaption(WikiLink($args['linkmore'], "auto", _("More...")));
+ }
return $pagelist;
}
-
}
// how many links from this backLink to other pages
class _PageList_Column_BackLinks_count extends _PageList_Column
{
- function _getValue($page_handle, $revision_handle)
+ public function _getValue($page_handle, $revision_handle)
{
$iter = $page_handle->getPageLinks();
return $iter->count();
Modified: trunk/lib/plugin/BlogArchives.php
===================================================================
--- trunk/lib/plugin/BlogArchives.php 2022-03-15 14:23:50 UTC (rev 11007)
+++ trunk/lib/plugin/BlogArchives.php 2022-03-24 13:28:33 UTC (rev 11008)
@@ -35,15 +35,14 @@
* @author: Reini Urban
*/
-class WikiPlugin_BlogArchives
- extends WikiPlugin_WikiBlog
+class WikiPlugin_BlogArchives extends WikiPlugin_WikiBlog
{
- function getDescription()
+ public function getDescription()
{
return _("List blog months links for the current or ADMIN user.");
}
- function getDefaultArguments()
+ public function getDefaultArguments()
{
return //array_merge
//(
@@ -63,11 +62,13 @@
* @param string $basepage
* @return mixed
*/
- function run($dbi, $argstr, &$request, $basepage)
+ public function run($dbi, $argstr, &$request, $basepage)
{
if (is_array($argstr)) { // can do with array also.
$args =& $argstr;
- if (!isset($args['order'])) $args['order'] = 'reverse';
+ if (!isset($args['order'])) {
+ $args['order'] = 'reverse';
+ }
} else {
$args = $this->getArgs($argstr, $request);
}
@@ -80,10 +81,12 @@
}
}
if (!$args['user'] or $args['user'] == ADMIN_USER) {
- if (BLOG_DEFAULT_EMPTY_PREFIX)
- $args['user'] = ''; // "Blogs/day" pages
- else
- $args['user'] = ADMIN_USER; // "Admin/Blogs/day" pages
+ if (BLOG_DEFAULT_EMPTY_PREFIX) {
+ $args['user'] = '';
+ } // "Blogs/day" pages
+ else {
+ $args['user'] = ADMIN_USER;
+ } // "Admin/Blogs/day" pages
}
$parent = (empty($args['user']) ? '' : $args['user'] . '/');
@@ -98,50 +101,65 @@
$html = HTML::ul();
while ($page = $pages->next()) {
$rev = $page->getCurrentRevision(false);
- if ($rev->get('pagetype') != 'wikiblog') continue;
+ if ($rev->get('pagetype') != 'wikiblog') {
+ continue;
+ }
$blog = $this->_blog($rev);
$html->pushContent(HTML::li(WikiLink($page, 'known', $rev->get('summary'))));
}
- if (!$args['noheader'])
- return HTML(HTML::h3(sprintf(_("Blog Entries for %s:"), $this->monthTitle($args['month']))),
- $html);
- else
+ if (!$args['noheader']) {
+ return HTML(
+ HTML::h3(sprintf(_("Blog Entries for %s:"), $this->monthTitle($args['month']))),
+ $html
+ );
+ } else {
return $html;
+ }
}
$blogs = $this->findBlogs($dbi, $args['user']);
if ($blogs) {
- if (!$basepage) $basepage = _("BlogArchives");
+ if (!$basepage) {
+ $basepage = _("BlogArchives");
+ }
$html = HTML::ul();
usort($blogs, array("WikiPlugin_WikiBlog", "cmp"));
- if ($args['order'] == 'reverse')
+ if ($args['order'] == 'reverse') {
$blogs = array_reverse($blogs);
+ }
// collapse pagenames by month
$months = array();
foreach ($blogs as $rev) {
$blog = $this->_blog($rev);
$mon = $blog['month'];
- if (empty($months[$mon]))
+ if (empty($months[$mon])) {
$months[$mon] =
array('title' => $this->monthTitle($mon),
'num' => 1,
'month' => $mon,
- 'link' => WikiURL($basepage,
- $this->nonDefaultArgs(array('month' => $mon))));
- else
+ 'link' => WikiURL(
+ $basepage,
+ $this->nonDefaultArgs(array('month' => $mon))
+ ));
+ } else {
$months[$mon]['num']++;
+ }
}
foreach ($months as $m) {
- $html->pushContent(HTML::li(HTML::a(array('href' => $m['link'],
+ $html->pushContent(HTML::li(HTML::a(
+ array('href' => $m['link'],
'class' => 'named-wiki'),
- $m['title'] . " (" . $m['num'] . ")")));
+ $m['title'] . " (" . $m['num'] . ")"
+ )));
}
- if (!$args['noheader'])
+ if (!$args['noheader']) {
return HTML(HTML::h3(_("Blog Archives:")), $html);
- else
+ } else {
return $html;
- } else
+ }
+ } else {
return '';
+ }
}
// box is used to display a fixed-width, narrow version with common header
@@ -151,10 +169,14 @@
* @param string $basepage
* @return $this|HtmlElement
*/
- function box($args = '', $request = null, $basepage = '')
+ public function box($args = '', $request = null, $basepage = '')
{
- if (!$request) $request =& $GLOBALS['request'];
- if (!$args or empty($args['limit'])) $args['limit'] = 10;
+ if (!$request) {
+ $request =& $GLOBALS['request'];
+ }
+ if (!$args or empty($args['limit'])) {
+ $args['limit'] = 10;
+ }
$args['noheader'] = 1;
return $this->makeBox(_("Archives"), $this->run($request->_dbi, $args, $request, $basepage));
}
Modified: trunk/lib/plugin/BlogJournal.php
===================================================================
--- trunk/lib/plugin/BlogJournal.php 2022-03-15 14:23:50 UTC (rev 11007)
+++ trunk/lib/plugin/BlogJournal.php 2022-03-24 13:28:33 UTC (rev 11008)
@@ -34,15 +34,14 @@
* @author: Reini Urban
*/
-class WikiPlugin_BlogJournal
- extends WikiPlugin_WikiBlog
+class WikiPlugin_BlogJournal extends WikiPlugin_WikiBlog
{
- function getDescription()
+ public function getDescription()
{
return _("Include latest blog entries for the current or ADMIN user.");
}
- function getDefaultArguments()
+ public function getDefaultArguments()
{
return array('count' => 7,
'user' => '',
@@ -59,11 +58,13 @@
* @param string $basepage
* @return mixed
*/
- function run($dbi, $argstr, &$request, $basepage)
+ public function run($dbi, $argstr, &$request, $basepage)
{
if (is_array($argstr)) { // can do with array also.
$args =& $argstr;
- if (!isset($args['order'])) $args['order'] = 'reverse';
+ if (!isset($args['order'])) {
+ $args['order'] = 'reverse';
+ }
} else {
$args = $this->getArgs($argstr, $request);
}
@@ -85,29 +86,40 @@
$parent = (empty($args['user']) ? '' : $args['user'] . '/');
$prefix = $base = $parent . $this->blogPrefix();
- if ($args['month'])
+ if ($args['month']) {
$prefix .= ('/' . $args['month']);
+ }
$pages = $dbi->titleSearch(new TextSearchQuery("^" . $prefix . '/', true, 'posix'));
$html = HTML();
$i = 0;
while (($page = $pages->next()) and $i < $args['count']) {
$rev = $page->getCurrentRevision(false);
- if ($rev->get('pagetype') != 'wikiblog') continue;
+ if ($rev->get('pagetype') != 'wikiblog') {
+ continue;
+ }
$i++;
$blog = $this->_blog($rev);
//$html->pushContent(HTML::h3(WikiLink($page, 'known', $rev->get('summary'))));
$html->pushContent($rev->getTransformedContent('wikiblog'));
}
- if ($args['user'] == $user->UserName() or $args['user'] == '')
- $html->pushContent(Button(array('action' => 'WikiBlog',
+ if ($args['user'] == $user->UserName() or $args['user'] == '') {
+ $html->pushContent(Button(
+ array('action' => 'WikiBlog',
'mode' => 'add'),
- _("New entry"), $base));
- if (!$i)
+ _("New entry"),
+ $base
+ ));
+ }
+ if (!$i) {
return HTML(HTML::h3(_("No Blog Entries")), $html);
- if (!$args['noheader'])
- return HTML(HTML::h3(sprintf(_("Blog Entries for %s:"), $this->monthTitle($args['month']))),
- $html);
- else
+ }
+ if (!$args['noheader']) {
+ return HTML(
+ HTML::h3(sprintf(_("Blog Entries for %s:"), $this->monthTitle($args['month']))),
+ $html
+ );
+ } else {
return $html;
+ }
}
}
Modified: trunk/lib/plugin/BoxRight.php
===================================================================
--- trunk/lib/plugin/BoxRight.php 2022-03-15 14:23:50 UTC (rev 11007)
+++ trunk/lib/plugin/BoxRight.php 2022-03-24 13:28:33 UTC (rev 11008)
@@ -26,20 +26,19 @@
* A simple plugin for <div class="boxright"> with wikimarkup
*/
-class WikiPlugin_BoxRight
- extends WikiPlugin
+class WikiPlugin_BoxRight extends WikiPlugin
{
- function getDescription()
+ public function getDescription()
{
return _("A simple plugin for <div class=boxright> with wikimarkup.");
}
- function getDefaultArguments()
+ public function getDefaultArguments()
{
return array();
}
- function managesValidators()
+ public function managesValidators()
{
// The plugin output will only change if the plugin
// invocation (page text) changes --- so the necessary
@@ -54,7 +53,7 @@
* @param string $basepage
* @return mixed
*/
- function run($dbi, $argstr, &$request, $basepage)
+ public function run($dbi, $argstr, &$request, $basepage)
{
if (!$basepage) {
return $this->error("$basepage unset?");
@@ -63,5 +62,4 @@
$page = $request->getPage($basepage);
return HTML::div(array('class' => 'boxright'), TransformText($argstr));
}
-
}
Modified: trunk/lib/plugin/CacheTest.php
===================================================================
--- trunk/lib/plugin/CacheTest.php 2022-03-15 14:23:50 UTC (rev 11007)
+++ trunk/lib/plugin/CacheTest.php 2022-03-24 13:28:33 UTC (rev 11008)
@@ -38,22 +38,21 @@
require_once 'lib/WikiPluginCached.php';
-class WikiPlugin_CacheTest
- extends WikiPluginCached
+class WikiPlugin_CacheTest extends WikiPluginCached
{
/* --------- overwrite abstract methods ---------------- */
- function getPluginType()
+ public function getPluginType()
{
return PLUGIN_CACHED_IMG_ONDEMAND;
}
- function getDescription()
+ public function getDescription()
{
return _('This is a simple example using WikiPluginCached.');
}
- function getDefaultArguments()
+ public function getDefaultArguments()
{
return array('text' => $this->getDescription(),
'font' => '3',
@@ -86,7 +85,7 @@
trigger_error('pure virtual', E_USER_ERROR);
}
- function getImageType($dbi, $argarray, $request)
+ public function getImageType($dbi, $argarray, $request)
{
extract($argarray);
if (in_array($type, array('png', 'gif', 'jpg'))) {
@@ -95,7 +94,7 @@
return 'png';
}
- function getAlt($dbi, $argarray, $request)
+ public function getAlt($dbi, $argarray, $request)
{
// ALT-text for <img> tag
extract($argarray);
@@ -102,7 +101,7 @@
return $text;
}
- function getExpire($dbi, $argarray, $request)
+ public function getExpire($dbi, $argarray, $request)
{
return '+600'; // 600 seconds life time
}
@@ -109,7 +108,7 @@
/* -------------------- extremely simple converter -------------------- */
- function produceGraphics($text, $font)
+ public function produceGraphics($text, $font)
{
// The idea (and some code) is stolen from the text2png plugin
// but I did not want to use TTF. Imagestring is quite ugly
@@ -148,17 +147,19 @@
// we could have used the simple built-in text2img function
// instead of writing our own:
- function lazy_produceGraphics($text, $font)
+ public function lazy_produceGraphics($text, $font)
{
if ($font < 1 || $font > 5) {
$text = "Fontnr. (font=\"$font\") should be in range 1-5";
$this->complain($text);
$font = 3;
-
}
- return $this->text2img($text, $font, array(0, 0, 0),
- array(255, 255, 255));
+ return $this->text2img(
+ $text,
+ $font,
+ array(0, 0, 0),
+ array(255, 255, 255)
+ );
} // lazy_produceGraphics
-
}
Modified: trunk/lib/plugin/Calendar.php
===================================================================
--- trunk/lib/plugin/Calendar.php 2022-03-15 14:23:50 UTC (rev 11007)
+++ trunk/lib/plugin/Calendar.php 2022-03-24 13:28:33 UTC (rev 11008)
@@ -22,8 +22,9 @@
*
*/
-if (!defined('SECONDS_PER_DAY'))
+if (!defined('SECONDS_PER_DAY')) {
define('SECONDS_PER_DAY', 24 * 3600);
+}
// FIXME: Still needs:
//
@@ -34,19 +35,18 @@
// pages back to the calendar page. (Subpage support might make this
// easier.)
-class WikiPlugin_Calendar
- extends WikiPlugin
+class WikiPlugin_Calendar ex...
[truncated message content] |
|
From: <var...@us...> - 2022-03-15 14:23:52
|
Revision: 11007
http://sourceforge.net/p/phpwiki/code/11007
Author: vargenau
Date: 2022-03-15 14:23:50 +0000 (Tue, 15 Mar 2022)
Log Message:
-----------
Remove gnu-fdl.png
Removed Paths:
-------------
trunk/themes/default/images/gnu-fdl.png
Deleted: trunk/themes/default/images/gnu-fdl.png
===================================================================
(Binary files differ)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <var...@us...> - 2022-03-15 12:00:33
|
Revision: 11006
http://sourceforge.net/p/phpwiki/code/11006
Author: vargenau
Date: 2022-03-15 12:00:30 +0000 (Tue, 15 Mar 2022)
Log Message:
-----------
Add SourceForge Open Source Excellence badge to footer
Modified Paths:
--------------
trunk/locale/it/pgsrc/NoteDiRilascio
trunk/pgsrc/ReleaseNotes
trunk/themes/MonoBook/commonPrint.css
trunk/themes/MonoBook/monobook.css
trunk/themes/MonoBook/templates/browse-footer.tmpl
trunk/themes/Sidebar/sidebar.css
Added Paths:
-----------
trunk/themes/default/images/oss-open-source-excellence-white.png
Modified: trunk/locale/it/pgsrc/NoteDiRilascio
===================================================================
--- trunk/locale/it/pgsrc/NoteDiRilascio 2022-02-17 19:17:24 UTC (rev 11005)
+++ trunk/locale/it/pgsrc/NoteDiRilascio 2022-03-15 12:00:30 UTC (rev 11006)
@@ -15,6 +15,9 @@
* Make WantedPages work for DATABASE_TYPE = dba and file
* Back links now work when the link is inside a table, in a template or in an included page.
+=== Misc ===
+* Add SourceForge Open Source Excellence badge to footer
+
== 1.6.1 2022-01-24 Marc-Etienne Vargenau ==
This release makes ~PhpWiki compatible with PHP 8.1.
Modified: trunk/pgsrc/ReleaseNotes
===================================================================
--- trunk/pgsrc/ReleaseNotes 2022-02-17 19:17:24 UTC (rev 11005)
+++ trunk/pgsrc/ReleaseNotes 2022-03-15 12:00:30 UTC (rev 11006)
@@ -15,6 +15,9 @@
* Make WantedPages work for DATABASE_TYPE = dba and file
* Back links now work when the link is inside a table, in a template or in an included page.
+=== Misc ===
+* Add SourceForge Open Source Excellence badge to footer
+
== 1.6.1 2022-01-24 Marc-Etienne Vargenau ==
This release makes ~PhpWiki compatible with PHP 8.1.
Modified: trunk/themes/MonoBook/commonPrint.css
===================================================================
--- trunk/themes/MonoBook/commonPrint.css 2022-02-17 19:17:24 UTC (rev 11005)
+++ trunk/themes/MonoBook/commonPrint.css 2022-03-15 12:00:30 UTC (rev 11006)
@@ -181,7 +181,7 @@
.editsection,
.toctoggle,
div#f-poweredbyico,
-div#f-copyrightico,
+div#f-opensourceexcellenceico,
ul#f-list,
div#html-validator,
li#pt-logout,
Modified: trunk/themes/MonoBook/monobook.css
===================================================================
--- trunk/themes/MonoBook/monobook.css 2022-02-17 19:17:24 UTC (rev 11005)
+++ trunk/themes/MonoBook/monobook.css 2022-03-15 12:00:30 UTC (rev 11006)
@@ -1268,7 +1268,7 @@
white-space: nowrap;
}
-#f-poweredbyico, #f-copyrightico {
+#f-poweredbyico, #f-opensourceexcellenceico {
display: table-cell;
margin: 0 8px;
padding-left: 1em;
Modified: trunk/themes/MonoBook/templates/browse-footer.tmpl
===================================================================
--- trunk/themes/MonoBook/templates/browse-footer.tmpl 2022-02-17 19:17:24 UTC (rev 11005)
+++ trunk/themes/MonoBook/templates/browse-footer.tmpl 2022-03-15 12:00:30 UTC (rev 11006)
@@ -24,5 +24,5 @@
<?php } ?>
</li>
</ul>
- <div id="f-copyrightico"><a href="http://www.gnu.org/copyleft/fdl.html"><img src="<?php echo $WikiTheme->getImageURL("gnu-fdl.png") ?>" alt="GNU Free Documentation License" /></a></div>
+ <div id="f-opensourceexcellenceico"><a href="https://sourceforge.net/projects/phpwiki/"><img src="<?php echo $WikiTheme->getImageURL("oss-open-source-excellence-white.png") ?>" alt="PhpWiki Reviews" /></a></div>
</footer>
Modified: trunk/themes/Sidebar/sidebar.css
===================================================================
--- trunk/themes/Sidebar/sidebar.css 2022-02-17 19:17:24 UTC (rev 11005)
+++ trunk/themes/Sidebar/sidebar.css 2022-03-15 12:00:30 UTC (rev 11006)
@@ -1292,7 +1292,7 @@
white-space: nowrap;
}
-#f-poweredbyico, #f-copyrightico {
+#f-poweredbyico, #f-opensourceexcellenceico {
display: table-cell;
margin: 0 8px;
padding-left: 1em;
Added: trunk/themes/default/images/oss-open-source-excellence-white.png
===================================================================
(Binary files differ)
Index: trunk/themes/default/images/oss-open-source-excellence-white.png
===================================================================
--- trunk/themes/default/images/oss-open-source-excellence-white.png 2022-02-17 19:17:24 UTC (rev 11005)
+++ trunk/themes/default/images/oss-open-source-excellence-white.png 2022-03-15 12:00:30 UTC (rev 11006)
Property changes on: trunk/themes/default/images/oss-open-source-excellence-white.png
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+image/png
\ No newline at end of property
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <var...@us...> - 2022-02-17 19:17:26
|
Revision: 11005
http://sourceforge.net/p/phpwiki/code/11005
Author: vargenau
Date: 2022-02-17 19:17:24 +0000 (Thu, 17 Feb 2022)
Log Message:
-----------
Implement function getWikiPageLinks for lib/plugin/IncludePages.php
Modified Paths:
--------------
trunk/lib/plugin/IncludePages.php
Modified: trunk/lib/plugin/IncludePages.php
===================================================================
--- trunk/lib/plugin/IncludePages.php 2022-02-16 18:24:08 UTC (rev 11004)
+++ trunk/lib/plugin/IncludePages.php 2022-02-17 19:17:24 UTC (rev 11005)
@@ -46,6 +46,38 @@
);
}
+ function getWikiPageLinks($argstr, $basepage)
+ {
+ $args = $this->getArgs($argstr);
+ if (is_string($args['exclude']) and !empty($args['exclude'])) {
+ $exclude = explodePageList($args['exclude']);
+ } elseif (is_array($args['exclude'])) {
+ $exclude = $args['exclude'];
+ } else {
+ $exclude = array();
+ }
+ if (is_string($args['pages']) and !empty($args['pages'])) {
+ $pages = explodePageList($args['pages']);
+ } elseif (is_array($args['pages'])) {
+ $pages = $args['pages'];
+ } else {
+ $pages = array();
+ }
+ $pages = array_diff($pages, $exclude);
+ $links = array();
+ global $request;
+ $dbi = $request->_dbi;
+ foreach($pages as $page) {
+ $page_handle = $dbi->getPage($page);
+ $pagelinks = $page_handle->getPageLinks();
+ while ($link_handle = $pagelinks->next()) {
+ $linkname = $link_handle->getName();
+ $links[] = array('linkto' => $linkname);
+ }
+ }
+ return $links;
+ }
+
/**
* @param WikiDB $dbi
* @param string $argstr
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <var...@us...> - 2022-02-16 18:24:29
|
Revision: 11004
http://sourceforge.net/p/phpwiki/code/11004
Author: vargenau
Date: 2022-02-16 18:24:08 +0000 (Wed, 16 Feb 2022)
Log Message:
-----------
Back links now work when the link is inside a table
Modified Paths:
--------------
trunk/lib/InlineParser.php
trunk/lib/plugin/MediawikiTable.php
trunk/lib/plugin/OldStyleTable.php
trunk/lib/plugin/RichTable.php
trunk/lib/plugin/WikicreoleTable.php
trunk/locale/it/pgsrc/NoteDiRilascio
trunk/pgsrc/Help%2FBackLinksPlugin
trunk/pgsrc/ReleaseNotes
Modified: trunk/lib/InlineParser.php
===================================================================
--- trunk/lib/InlineParser.php 2022-02-16 16:53:28 UTC (rev 11003)
+++ trunk/lib/InlineParser.php 2022-02-16 18:24:08 UTC (rev 11004)
@@ -1387,3 +1387,20 @@
}
return $trfm->parse($text);
}
+
+/**
+ * Return an array of links in given text
+ */
+function getTextLinks($text)
+{
+ $links = TransformLinks($text);
+ $links = $links->_content;
+ $wikilinks = array();
+ foreach ($links as $link) {
+ if (is_a($link, 'Cached_WikiLink')) {
+ $wikilinks[] = array('linkto' => $link->_page);
+ }
+ }
+ return $wikilinks;
+}
+
Modified: trunk/lib/plugin/MediawikiTable.php
===================================================================
--- trunk/lib/plugin/MediawikiTable.php 2022-02-16 16:53:28 UTC (rev 11003)
+++ trunk/lib/plugin/MediawikiTable.php 2022-02-16 18:24:08 UTC (rev 11004)
@@ -66,6 +66,22 @@
}
/**
+ * return links
+ *
+ * @param string $argstr The plugin argument string.
+ * @param string $basepage The pagename the plugin is invoked from.
+ * @return array List of pagenames linked to.
+ */
+ function getWikiPageLinks($argstr, $basepage)
+ {
+ return getTextLinks($argstr);
+ }
+
+ function handle_plugin_args_cruft($argstr, $args)
+ {
+ }
+
+ /**
* @param WikiDB $dbi
* @param string $argstr
* @param WikiRequest $request
Modified: trunk/lib/plugin/OldStyleTable.php
===================================================================
--- trunk/lib/plugin/OldStyleTable.php 2022-02-16 16:53:28 UTC (rev 11003)
+++ trunk/lib/plugin/OldStyleTable.php 2022-02-16 18:24:08 UTC (rev 11004)
@@ -63,6 +63,18 @@
);
}
+ /**
+ * return links
+ *
+ * @param string $argstr The plugin argument string.
+ * @param string $basepage The pagename the plugin is invoked from.
+ * @return array List of pagenames linked to.
+ */
+ function getWikiPageLinks($argstr, $basepage)
+ {
+ return getTextLinks($argstr);
+ }
+
function handle_plugin_args_cruft($argstr, $args)
{
}
Modified: trunk/lib/plugin/RichTable.php
===================================================================
--- trunk/lib/plugin/RichTable.php 2022-02-16 16:53:28 UTC (rev 11003)
+++ trunk/lib/plugin/RichTable.php 2022-02-16 18:24:08 UTC (rev 11004)
@@ -43,6 +43,22 @@
}
/**
+ * return links
+ *
+ * @param string $argstr The plugin argument string.
+ * @param string $basepage The pagename the plugin is invoked from.
+ * @return array List of pagenames linked to.
+ */
+ function getWikiPageLinks($argstr, $basepage)
+ {
+ return getTextLinks($argstr);
+ }
+
+ function handle_plugin_args_cruft($argstr, $args)
+ {
+ }
+
+ /**
* @param WikiDB $dbi
* @param string $argstr
* @param WikiRequest $request
Modified: trunk/lib/plugin/WikicreoleTable.php
===================================================================
--- trunk/lib/plugin/WikicreoleTable.php 2022-02-16 16:53:28 UTC (rev 11003)
+++ trunk/lib/plugin/WikicreoleTable.php 2022-02-16 18:24:08 UTC (rev 11004)
@@ -63,6 +63,18 @@
return array();
}
+ /**
+ * return links
+ *
+ * @param string $argstr The plugin argument string.
+ * @param string $basepage The pagename the plugin is invoked from.
+ * @return array List of pagenames linked to.
+ */
+ function getWikiPageLinks($argstr, $basepage)
+ {
+ return getTextLinks($argstr);
+ }
+
function handle_plugin_args_cruft($argstr, $args)
{
}
Modified: trunk/locale/it/pgsrc/NoteDiRilascio
===================================================================
--- trunk/locale/it/pgsrc/NoteDiRilascio 2022-02-16 16:53:28 UTC (rev 11003)
+++ trunk/locale/it/pgsrc/NoteDiRilascio 2022-02-16 18:24:08 UTC (rev 11004)
@@ -1,4 +1,4 @@
-Date: Mon, 7 Feb 2022 16:26:30 +0000
+Date: Wed, 16 Feb 2022 19:23:05 +0000
Mime-Version: 1.0 (Produced by PhpWiki 1.6.1)
Content-Type: application/x-phpwiki;
pagename=NoteDiRilascio;
@@ -13,6 +13,7 @@
=== Fixes ===
* Make renaming of pages work for DATABASE_TYPE = PDO and file.
* Make WantedPages work for DATABASE_TYPE = dba and file
+* Back links now work when the link is inside a table, in a template or in an included page.
== 1.6.1 2022-01-24 Marc-Etienne Vargenau ==
Modified: trunk/pgsrc/Help%2FBackLinksPlugin
===================================================================
--- trunk/pgsrc/Help%2FBackLinksPlugin 2022-02-16 16:53:28 UTC (rev 11003)
+++ trunk/pgsrc/Help%2FBackLinksPlugin 2022-02-16 18:24:08 UTC (rev 11004)
@@ -1,4 +1,4 @@
-Date: Thu, 9 Dec 2021 18:48:34 +0000
+Date: Wed, 16 Feb 2022 19:23:05 +0000
Mime-Version: 1.0 (Produced by PhpWiki 1.6.1)
Content-Type: application/x-phpwiki;
pagename=Help%2FBackLinksPlugin;
@@ -59,8 +59,8 @@
== Known Problems ==
-Back links will not be found if the link is inside a table, or in an included template,
-or in general if the link is in text generated by a plugin.
+Back links might not work if the link is in text generated by a plugin.
+Prior to ~PhpWiki 1.6.2, back links did not work if the link was inside a table, or in an included template,
== Author ==
* [[Help:Reini Urban|Reini Urban]]
Modified: trunk/pgsrc/ReleaseNotes
===================================================================
--- trunk/pgsrc/ReleaseNotes 2022-02-16 16:53:28 UTC (rev 11003)
+++ trunk/pgsrc/ReleaseNotes 2022-02-16 18:24:08 UTC (rev 11004)
@@ -1,4 +1,4 @@
-Date: Mon, 7 Feb 2022 16:26:30 +0000
+Date: Wed, 16 Feb 2022 19:23:05 +0000
Mime-Version: 1.0 (Produced by PhpWiki 1.6.1)
Content-Type: application/x-phpwiki;
pagename=ReleaseNotes;
@@ -13,6 +13,7 @@
=== Fixes ===
* Make renaming of pages work for DATABASE_TYPE = PDO and file.
* Make WantedPages work for DATABASE_TYPE = dba and file
+* Back links now work when the link is inside a table, in a template or in an included page.
== 1.6.1 2022-01-24 Marc-Etienne Vargenau ==
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <var...@us...> - 2022-02-16 16:53:31
|
Revision: 11003
http://sourceforge.net/p/phpwiki/code/11003
Author: vargenau
Date: 2022-02-16 16:53:28 +0000 (Wed, 16 Feb 2022)
Log Message:
-----------
Use count instead of sizeof
Modified Paths:
--------------
trunk/lib/diff3.php
trunk/lib/difflib.php
trunk/lib/mimelib.php
trunk/lib/plugin/Chart.php
trunk/lib/plugin/DebugGroupInfo.php
trunk/lib/plugin/WikicreoleTable.php
Modified: trunk/lib/diff3.php
===================================================================
--- trunk/lib/diff3.php 2022-02-15 18:23:37 UTC (rev 11002)
+++ trunk/lib/diff3.php 2022-02-16 16:53:28 UTC (rev 11003)
@@ -102,7 +102,7 @@
private function append(&$array, $lines)
{
- array_splice($array, sizeof($array), 0, $lines);
+ array_splice($array, count($array), 0, $lines);
}
public function input($lines)
Modified: trunk/lib/difflib.php
===================================================================
--- trunk/lib/difflib.php 2022-02-15 18:23:37 UTC (rev 11002)
+++ trunk/lib/difflib.php 2022-02-16 16:53:28 UTC (rev 11003)
@@ -36,12 +36,12 @@
public function norig()
{
- return $this->orig ? sizeof($this->orig) : 0;
+ return $this->orig ? count($this->orig) : 0;
}
public function nfinal()
{
- return $this->final ? sizeof($this->final) : 0;
+ return $this->final ? count($this->final) : 0;
}
}
@@ -145,8 +145,8 @@
public function diff($from_lines, $to_lines)
{
- $n_from = sizeof($from_lines);
- $n_to = sizeof($to_lines);
+ $n_from = count($from_lines);
+ $n_to = count($to_lines);
$this->xchanged = $this->ychanged = array();
$this->xv = $this->yv = array();
@@ -190,7 +190,7 @@
}
// Find the LCS.
- $this->compareseq(0, sizeof($this->xv), 0, sizeof($this->yv));
+ $this->compareseq(0, count($this->xv), 0, count($this->yv));
// Merge edits when possible
$this->shift_boundaries($from_lines, $this->xchanged, $this->ychanged);
@@ -421,9 +421,9 @@
$i = 0;
$j = 0;
- assert('sizeof($lines) == sizeof($changed)');
- $len = sizeof($lines);
- $other_len = sizeof($other_changed);
+ assert('count($lines) == count($changed)');
+ $len = count($lines);
+ $other_len = count($other_changed);
while (1) {
/*
@@ -574,7 +574,7 @@
foreach ($this->edits as $edit) {
if ($edit->orig)
- array_splice($lines, sizeof($lines), 0, $edit->orig);
+ array_splice($lines, count($lines), 0, $edit->orig);
}
return $lines;
}
@@ -593,7 +593,7 @@
foreach ($this->edits as $edit) {
if ($edit->final)
- array_splice($lines, sizeof($lines), 0, $edit->final);
+ array_splice($lines, count($lines), 0, $edit->final);
}
return $lines;
}
@@ -630,8 +630,8 @@
$mapped_from_lines, $mapped_to_lines)
{
- assert(sizeof($from_lines) == sizeof($mapped_from_lines));
- assert(sizeof($to_lines) == sizeof($mapped_to_lines));
+ assert(count($from_lines) == count($mapped_from_lines));
+ assert(count($to_lines) == count($mapped_to_lines));
parent::__construct($mapped_from_lines, $mapped_to_lines);
@@ -638,17 +638,17 @@
$xi = $yi = 0;
// Optimizing loop invariants:
// http://phplens.com/lens/php-book/optimizing-debugging-php.php
- for ($i = 0, $max = sizeof($this->edits); $i < $max; $i++) {
+ for ($i = 0, $max = count($this->edits); $i < $max; $i++) {
$orig = &$this->edits[$i]->orig;
if (is_array($orig)) {
- $orig = array_slice($from_lines, $xi, sizeof($orig));
- $xi += sizeof($orig);
+ $orig = array_slice($from_lines, $xi, count($orig));
+ $xi += count($orig);
}
$final = &$this->edits[$i]->final;
if (is_array($final)) {
- $final = array_slice($to_lines, $yi, sizeof($final));
- $yi += sizeof($final);
+ $final = array_slice($to_lines, $yi, count($final));
+ $yi += count($final);
}
}
}
@@ -702,7 +702,7 @@
foreach ($diff->edits as $edit) {
if ($edit->type == 'copy') {
if (is_array($block)) {
- if (sizeof($edit->orig) <= $nlead + $ntrail) {
+ if (count($edit->orig) <= $nlead + $ntrail) {
$block[] = $edit;
} else {
if ($ntrail) {
@@ -718,9 +718,9 @@
$context = $edit->orig;
} else {
if (!is_array($block)) {
- $context = array_slice($context, max(0, sizeof($context) - $nlead));
- $x0 = $xi - sizeof($context);
- $y0 = $yi - sizeof($context);
+ $context = array_slice($context, max(0, count($context) - $nlead));
+ $x0 = $xi - count($context);
+ $y0 = $yi - count($context);
$block = array();
if ($context)
$block[] = new DiffOp_Copy($context);
@@ -729,9 +729,9 @@
}
if ($edit->orig)
- $xi += sizeof($edit->orig);
+ $xi += count($edit->orig);
if ($edit->final)
- $yi += sizeof($edit->final);
+ $yi += count($edit->final);
}
if (is_array($block))
Modified: trunk/lib/mimelib.php
===================================================================
--- trunk/lib/mimelib.php 2022-02-15 18:23:37 UTC (rev 11002)
+++ trunk/lib/mimelib.php 2022-02-16 16:53:28 UTC (rev 11003)
@@ -282,7 +282,7 @@
$m[1], rawurldecode($reference));
}
- if (sizeof($footnotes) > 0) {
+ if (count($footnotes) > 0) {
ksort($footnotes);
return "-----\n"
. "!" . _("References") . "\n"
Modified: trunk/lib/plugin/Chart.php
===================================================================
--- trunk/lib/plugin/Chart.php 2022-02-15 18:23:37 UTC (rev 11002)
+++ trunk/lib/plugin/Chart.php 2022-02-16 16:53:28 UTC (rev 11003)
@@ -101,7 +101,7 @@
// y_min = 0 or smallest element in data if negative
// y_max = biggest element in data
- $x_max = sizeof($values) + 1;
+ $x_max = count($values) + 1;
$y_min = min($values);
if ($y_min > 0) {
$y_min = 0;
Modified: trunk/lib/plugin/DebugGroupInfo.php
===================================================================
--- trunk/lib/plugin/DebugGroupInfo.php 2022-02-15 18:23:37 UTC (rev 11002)
+++ trunk/lib/plugin/DebugGroupInfo.php 2022-02-16 16:53:28 UTC (rev 11003)
@@ -59,7 +59,7 @@
foreach ($allGroups as $g) {
$members = $group->getMembersOf($g);
$output->pushContent(HTML::h2($g . " - members: " .
- sizeof($members) . " - isMember: " . ($group->isMember($g) ? "yes" : "no")
+ count($members) . " - isMember: " . ($group->isMember($g) ? "yes" : "no")
));
$list = HTML::ul();
foreach ($members as $m) {
Modified: trunk/lib/plugin/WikicreoleTable.php
===================================================================
--- trunk/lib/plugin/WikicreoleTable.php 2022-02-15 18:23:37 UTC (rev 11002)
+++ trunk/lib/plugin/WikicreoleTable.php 2022-02-16 16:53:28 UTC (rev 11003)
@@ -96,7 +96,7 @@
}
}
- $nb_rows = sizeof($table);
+ $nb_rows = count($table);
// If table is empty, do not generate table markup
if ($nb_rows == 0) {
return HTML::raw('');
@@ -105,7 +105,7 @@
// Number of columns is the number of cells in the longer row
$nb_cols = 0;
for ($i = 0; $i < $nb_rows; $i++) {
- $nb_cols = max($nb_cols, sizeof($table[$i]));
+ $nb_cols = max($nb_cols, count($table[$i]));
}
for ($i = 0; $i < $nb_rows; $i++) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <var...@us...> - 2022-02-15 18:23:38
|
Revision: 11002
http://sourceforge.net/p/phpwiki/code/11002
Author: vargenau
Date: 2022-02-15 18:23:37 +0000 (Tue, 15 Feb 2022)
Log Message:
-----------
lib/plugin/Calendar.php & lib/plugin/CalendarList.php: fix getWikiPageLinks function (patch by Christof Meerwald)
Modified Paths:
--------------
trunk/lib/plugin/Calendar.php
trunk/lib/plugin/CalendarList.php
Modified: trunk/lib/plugin/Calendar.php
===================================================================
--- trunk/lib/plugin/Calendar.php 2022-02-15 16:58:07 UTC (rev 11001)
+++ trunk/lib/plugin/Calendar.php 2022-02-15 18:23:37 UTC (rev 11002)
@@ -148,12 +148,12 @@
$mday = HTML::strong($mday);
$td->setAttr('class', 'cal-today');
} elseif ($dbi->isWikiPage($page_for_date)) {
- $this->_links[] = $page_for_date;
+ $this->_links[] = array('linkto' => $page_for_date);
$td->setAttr('class', 'cal-day');
}
if ($dbi->isWikiPage($page_for_date)) {
- $this->_links[] = $page_for_date;
+ $this->_links[] = array('linkto' => $page_for_date);
$date = HTML::a(array('class' => 'cal-day',
'href' => WikiURL($page_for_date),
'title' => $page_for_date),
Modified: trunk/lib/plugin/CalendarList.php
===================================================================
--- trunk/lib/plugin/CalendarList.php 2022-02-15 16:58:07 UTC (rev 11001)
+++ trunk/lib/plugin/CalendarList.php 2022-02-15 18:23:37 UTC (rev 11002)
@@ -140,7 +140,7 @@
array('action' => 'edit')),
'title' => sprintf(_("Edit %s"), $page_for_date)),
$date_string);
- $this->_links[] = $page_for_date;
+ $this->_links[] = array('linkto' => $page_for_date);
$a = array(HTML::dt($link), HTML::dd($content));
} else {
$a = array();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <var...@us...> - 2022-02-15 16:58:08
|
Revision: 11001
http://sourceforge.net/p/phpwiki/code/11001
Author: vargenau
Date: 2022-02-15 16:58:07 +0000 (Tue, 15 Feb 2022)
Log Message:
-----------
lib/plugin/Template.php: simplify getWikiPageLinks
Modified Paths:
--------------
trunk/lib/plugin/Template.php
Modified: trunk/lib/plugin/Template.php
===================================================================
--- trunk/lib/plugin/Template.php 2022-02-15 16:55:31 UTC (rev 11000)
+++ trunk/lib/plugin/Template.php 2022-02-15 16:58:07 UTC (rev 11001)
@@ -84,23 +84,25 @@
return $name != 'action';
}
- // TODO: check if page can really be pulled from the args, or if it is just the basepage.
function getWikiPageLinks($argstr, $basepage)
{
$args = $this->getArgs($argstr);
$page = isset($args['page']) ? $args['page'] : '';
- if ($page) {
- global $request;
- $dbi = $request->_dbi;
- $page_handle = $dbi->getPage($page);
- $links = $page_handle->getPageLinks();
- $alllinks = array();
- while ($link_handle = $links->next()) {
- $linkname = $link_handle->getName();
- $alllinks[] = array('linkto' => $linkname);
- }
- $page = new WikiPageName($page, $basepage);
+
+ if (!$page) {
+ return array();
}
+
+ global $request;
+ $dbi = $request->_dbi;
+ $page_handle = $dbi->getPage($page);
+ $links = $page_handle->getPageLinks();
+ $alllinks = array();
+ while ($link_handle = $links->next()) {
+ $linkname = $link_handle->getName();
+ $alllinks[] = array('linkto' => $linkname);
+ }
+ $page = new WikiPageName($page, $basepage);
if (!$page or !$page->name) {
return array();
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|