From: <var...@us...> - 2010-03-04 10:48:15
|
Revision: 7302 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=7302&view=rev Author: vargenau Date: 2010-03-04 10:48:07 +0000 (Thu, 04 Mar 2010) Log Message: ----------- Replace tabs by spaces; remove EOL spaces 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/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/CreateBib.php trunk/lib/plugin/CreatePage.php trunk/lib/plugin/CreateToc.php trunk/lib/plugin/Diff.php trunk/lib/plugin/DynamicIncludePage.php trunk/lib/plugin/EditMetaData.php trunk/lib/plugin/ExternalSearch.php trunk/lib/plugin/FileInfo.php trunk/lib/plugin/FoafViewer.php trunk/lib/plugin/FrameInclude.php trunk/lib/plugin/FullTextSearch.php trunk/lib/plugin/GoTo.php trunk/lib/plugin/GoogleMaps.php trunk/lib/plugin/GooglePlugin.php trunk/lib/plugin/GraphViz.php trunk/lib/plugin/HtmlConverter.php trunk/lib/plugin/Imdb.php trunk/lib/plugin/IncludePage.php trunk/lib/plugin/IncludePages.php trunk/lib/plugin/IncludeSiteMap.php trunk/lib/plugin/InterWikiSearch.php trunk/lib/plugin/JabberPresence.php trunk/lib/plugin/LdapSearch.php trunk/lib/plugin/LinkDatabase.php trunk/lib/plugin/LinkSearch.php trunk/lib/plugin/ListPages.php trunk/lib/plugin/ListRelations.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/PhpWeather.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/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/RecentChangesCached.php trunk/lib/plugin/RecentComments.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/VisualWiki.php trunk/lib/plugin/WantedPages.php trunk/lib/plugin/WatchPage.php trunk/lib/plugin/WhoIsOnline.php trunk/lib/plugin/WikiAdminChmod.php trunk/lib/plugin/WikiAdminChown.php trunk/lib/plugin/WikiAdminMarkup.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/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/WikicreoleTable.php trunk/lib/plugin/YouTube.php trunk/lib/plugin/_AuthInfo.php trunk/lib/plugin/_BackendInfo.php trunk/lib/plugin/_GroupInfo.php trunk/lib/plugin/_Retransform.php trunk/lib/plugin/_WikiTranslation.php trunk/lib/plugin/text2png.php Modified: trunk/lib/plugin/AddComment.php =================================================================== --- trunk/lib/plugin/AddComment.php 2010-03-04 10:30:39 UTC (rev 7301) +++ trunk/lib/plugin/AddComment.php 2010-03-04 10:48:07 UTC (rev 7302) @@ -2,7 +2,7 @@ rcs_id('$Id$'); /* * Copyright (C) 2004 $ThePhpWikiProgrammingTeam - * + * * This file is part of PhpWiki. * * PhpWiki is free software; you can redistribute it and/or modify @@ -59,7 +59,7 @@ // 'add' - only show entry box for new comment // 'show,add' - show old comments, then entry box // 'add,show' - show entry box followed by list of comments - // jshide - boolean - quick javascript expansion of the comments + // jshide - boolean - quick javascript expansion of the comments // and addcomment box function getDefaultArguments() { @@ -80,7 +80,7 @@ // Get our form args. $comment = $request->getArg("comment"); $request->setArg('comment', false); - + if ($request->isPost() and !empty($comment['addcomment'])) { $this->add($request, $comment, 'comment'); // noreturn } @@ -125,12 +125,12 @@ $div->pushContent($show); break; case 'add': - global $WikiTheme; - if (!$WikiTheme->DUMP_MODE) { - $add = $this->showForm($request, $args, 'addcomment'); - //if ($args['jshide']) $add->setAttr('style','display:none;'); - $div->pushContent($add); - } + global $WikiTheme; + if (!$WikiTheme->DUMP_MODE) { + $add = $this->showForm($request, $args, 'addcomment'); + //if ($args['jshide']) $add->setAttr('style','display:none;'); + $div->pushContent($add); + } break; default: return $this->error(sprintf("Bad mode ('%s')", $show)); @@ -139,7 +139,7 @@ $html->pushContent($div); return $html; } - + }; // For emacs users Modified: trunk/lib/plugin/AllPages.php =================================================================== --- trunk/lib/plugin/AllPages.php 2010-03-04 10:30:39 UTC (rev 7301) +++ trunk/lib/plugin/AllPages.php 2010-03-04 10:48:07 UTC (rev 7302) @@ -56,7 +56,7 @@ 'userpages' => false )); } - + // info arg allows multiple columns // info=mtime,hits,summary,version,author,locked,minor,markup or all // exclude arg allows multiple pagenames exclude=HomePage,RecentChanges @@ -72,53 +72,53 @@ $timer = new DebugTimer; } $caption = _("All pages in this wiki ({total} total):"); - + if ( !empty($args['userpages']) ) { $pages = PageList::allUserPages($args['include_empty'], $args['sortby'], '' - ); - $caption = _("List of user-created pages ({total} total):"); - $args['count'] = $request->getArg('count'); + ); + $caption = _("List of user-created pages ({total} total):"); + $args['count'] = $request->getArg('count'); } elseif ( !empty($args['owner']) ) { $pages = PageList::allPagesByOwner($args['owner'], $args['include_empty'], $args['sortby'], '' - ); - $caption = fmt("List of pages owned by [%s] ({total} total):", - WikiLink($args['owner'] == '[]' - ? $request->_user->getAuthenticatedId() - : $args['owner'], - 'if_known')); - $args['count'] = $request->getArg('count'); - $pages->_options['count'] = $args['count']; + ); + $caption = fmt("List of pages owned by [%s] ({total} total):", + WikiLink($args['owner'] == '[]' + ? $request->_user->getAuthenticatedId() + : $args['owner'], + 'if_known')); + $args['count'] = $request->getArg('count'); + $pages->_options['count'] = $args['count']; } elseif ( !empty($args['author']) ) { $pages = PageList::allPagesByAuthor($args['author'], $args['include_empty'], - $args['sortby'], '' - ); - $caption = fmt("List of pages last edited by [%s] ({total} total):", - WikiLink($args['author'] == '[]' - ? $request->_user->getAuthenticatedId() - : $args['author'], - 'if_known')); - $args['count'] = $request->getArg('count'); - $pages->_options['count'] = $args['count']; + $args['sortby'], '' + ); + $caption = fmt("List of pages last edited by [%s] ({total} total):", + WikiLink($args['author'] == '[]' + ? $request->_user->getAuthenticatedId() + : $args['author'], + 'if_known')); + $args['count'] = $request->getArg('count'); + $pages->_options['count'] = $args['count']; } elseif ( !empty($args['creator']) ) { $pages = PageList::allPagesByCreator($args['creator'], $args['include_empty'], $args['sortby'], '' - ); - $caption = fmt("List of pages created by [%s] ({total} total):", - WikiLink($args['creator'] == '[]' - ? $request->_user->getAuthenticatedId() - : $args['creator'], - 'if_known')); - $args['count'] = $request->getArg('count'); - $pages->_options['count'] = $args['count']; + ); + $caption = fmt("List of pages created by [%s] ({total} total):", + WikiLink($args['creator'] == '[]' + ? $request->_user->getAuthenticatedId() + : $args['creator'], + 'if_known')); + $args['count'] = $request->getArg('count'); + $pages->_options['count'] = $args['count']; //} elseif ($pages) { // $args['count'] = count($pages); } else { - if (! $request->getArg('count')) + if (! $request->getArg('count')) $args['count'] = $dbi->numPages($args['include_empty'], $args['exclude']); - else - $args['count'] = $request->getArg('count'); + else + $args['count'] = $request->getArg('count'); } if (empty($args['count']) and !empty($pages)) $args['count'] = count($pages); @@ -132,7 +132,7 @@ if ($pages !== false) $pagelist->addPageList($pages); else - $pagelist->addPages( $dbi->getAllPages($args['include_empty'], $args['sortby'], + $pagelist->addPages( $dbi->getAllPages($args['include_empty'], $args['sortby'], $args['limit']) ); if (defined('DEBUG') && DEBUG && $args['debug']) { return HTML($pagelist, Modified: trunk/lib/plugin/AllUsers.php =================================================================== --- trunk/lib/plugin/AllUsers.php 2010-03-04 10:30:39 UTC (rev 7301) +++ trunk/lib/plugin/AllUsers.php 2010-03-04 10:48:07 UTC (rev 7302) @@ -25,9 +25,9 @@ /** * Based on AllPages and WikiGroup. * - * We list all users, - * either homepage users (prefs stored in a page), - * users with db prefs and + * We list all users, + * either homepage users (prefs stored in a page), + * users with db prefs and * externally authenticated users with a db users table, if auth_user_exists is defined. */ class WikiPlugin_AllUsers Modified: trunk/lib/plugin/AnalyseAccessLogSql.php =================================================================== --- trunk/lib/plugin/AnalyseAccessLogSql.php 2010-03-04 10:30:39 UTC (rev 7301) +++ trunk/lib/plugin/AnalyseAccessLogSql.php 2010-03-04 10:48:07 UTC (rev 7302) @@ -66,12 +66,12 @@ $query = ''; $backend_type = $request->_dbi->_backend->backendType(); switch ($backend_type) { - case 'mysql': + case 'mysql': $Referring_URL = "left(referer,length(referer)-instr(reverse(referer),'?'))"; break; - case 'pgsql': - case 'postgres7': + case 'pgsql': + case 'postgres7': $Referring_URL = "substr(referer,0,position('?' in referer))"; break; - default: + default: $Referring_URL = "referer"; } switch ($args['mode']) { @@ -101,12 +101,12 @@ if ($where_conditions<>'') $where_conditions = 'WHERE '.$where_conditions.' '; switch ($backend_type) { - case 'mysql': + case 'mysql': $Referring_Domain = "left(referer, if(locate('/', referer, 8) > 0,locate('/', referer, 8) -1, length(referer)))"; break; - case 'pgsql': - case 'postgres7': + case 'pgsql': + case 'postgres7': $Referring_Domain = "substr(referer,0,8) || regexp_replace(substr(referer,8), '/.*', '')"; break; - default: + default: $Referring_Domain = "referer"; break; } $query = "SELECT " @@ -183,13 +183,13 @@ // If PHPSESSID appears in the URI, just display the URI to the left of this $sessname = session_name(); switch ($backend_type) { - case 'mysql': + case 'mysql': $Request_URI = "IF(instr(request_uri, '$sessname')=0, request_uri,left(request_uri, instr(request_uri, '$sessname')-2))"; break; - case 'pgsql': - case 'postgres7': + case 'pgsql': + case 'postgres7': $Request_URI = "regexp_replace(request_uri, '$sessname.*', '')"; break; - default: + default: $Request_URI = 'request_uri'; break; } $now = time(); @@ -239,7 +239,7 @@ return array( 'mode' => 'referring_domains', // referring_domains, referring_urls, remote_hosts, users, host_users, search_bots, search_bots_hits - 'caption' => '', + 'caption' => '', // blank means use the mode as the caption/title for the output 'local_referrers' => 'true', // only show external referring sites 'period' => '', // the type of period to report: @@ -356,19 +356,19 @@ $len = strlen($localhost); $backend_type = $request->_dbi->_backend->backendType(); switch ($backend_type) { - case 'mysql': + case 'mysql': $ref_localhost = "left(referer,$len)<>'$localhost'"; break; - case 'pgsql': - case 'postgres7': + case 'pgsql': + case 'postgres7': $ref_localhost = "substr(referer,0,$len)<>'$localhost'"; break; - default: + default: $ref_localhost = ""; } $where_conditions = $where_conditions.$ref_localhost; } // 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) + // conditions string, so that following SQL clauses (such as GROUP BY) // will not cause a syntax error if ($where_conditions<>'') $where_conditions = $where_conditions.' '; Modified: trunk/lib/plugin/AppendText.php =================================================================== --- trunk/lib/plugin/AppendText.php 2010-03-04 10:30:39 UTC (rev 7301) +++ trunk/lib/plugin/AppendText.php 2010-03-04 10:48:07 UTC (rev 7302) @@ -28,7 +28,7 @@ * See http://sourceforge.net/mailarchive/message.php?msg_id=10141823 * why not to use "text" as parameter. Nasty mozilla bug with mult. radio rows. * - * Todo: multiple pages. e.g. AppendText s=~[CategoryINtime~] page=<!plugin TitleSearch intime !> + * Todo: multiple pages. e.g. AppendText s=~[CategoryINtime~] page=<!plugin TitleSearch intime !> */ class WikiPlugin_AppendText extends WikiPlugin @@ -48,7 +48,7 @@ function getDefaultArguments() { return array('page' => '[pagename]', - 'pages' => false, + 'pages' => false, 's' => '', // Text to append. 'before' => '', // Add before (ignores after if defined) 'after' => '', // Add after line beginning with this @@ -65,17 +65,17 @@ function run($dbi, $argstr, &$request, $basepage) { $args = $this->getArgs($argstr, $request); - if (!$args['pages'] or !$request->isPost()) { - return $this->_work($args['page'], $args, $dbi, $request); - } else { - $html = HTML(); - 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)); - } - return $html; - } + if (!$args['pages'] or !$request->isPost()) { + return $this->_work($args['page'], $args, $dbi, $request); + } else { + $html = HTML(); + 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)); + } + return $html; + } } function _work($pagename, $args, $dbi, &$request) { @@ -95,7 +95,7 @@ $pagename)); return $message; } - + $current = $page->getCurrentRevision(); $oldtext = $current->getPackedContent(); $text = $args['s']; @@ -104,15 +104,15 @@ if (!empty($args['before'])) { $before = preg_quote($args['before'], "/"); // Insert before - $newtext = preg_match("/\n${before}/", $oldtext) + $newtext = preg_match("/\n${before}/", $oldtext) ? 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) + $newtext = preg_match("/\n${after}/", $oldtext) ? preg_replace("/(\n${after})/", "\\1\n" . preg_quote($text, "/"), $oldtext) @@ -129,19 +129,19 @@ if ($page->save($newtext, $current->getVersion() + 1, $meta)) { $message->pushContent(_("Page successfully updated."), HTML::br()); } - + // AppendText has been called from the same page that got modified // so we directly show the page. if ( $request->getArg($pagename) == $pagename ) { - // TODO: Just invalidate the cache, if AppendText didn't + // TODO: Just invalidate the cache, if AppendText didn't // change anything before. - // + // return $request->redirect(WikiURL($pagename, false, 'absurl'), false); // The user asked to be redirected to the modified page } elseif ($args['redirect']) { return $request->redirect(WikiURL($pagename, false, 'absurl'), false); - + } else { $link = HTML::em(WikiLink($pagename)); $message->pushContent(HTML::Raw(sprintf(_("Go to %s."), $link->asXml()))); Modified: trunk/lib/plugin/AsciiMath.php =================================================================== --- trunk/lib/plugin/AsciiMath.php 2010-03-04 10:30:39 UTC (rev 7301) +++ trunk/lib/plugin/AsciiMath.php 2010-03-04 10:48:07 UTC (rev 7302) @@ -27,19 +27,19 @@ require_once("lib/ASCIIMathPHP/ASCIIMathPHP.class.php"); } -/** +/** * Render ASCII math as MathML * Requires ENABLE_XHTML_XML = true * See http://www.jcphysics.com/ASCIIMath/ * Syntax: http://www1.chapman.edu/~jipsen/mathml/asciimathsyntax.xml * Example: "int_-1^1 sqrt(1-x^2)dx = pi/2" * => <math xmlns="http://www.w3.org/1998/Math/MathML"> - <mrow><msubsup><mo>∫</mo><mn>-1</mn><mn>1</mn></msubsup></mrow> - <msqrt><mrow><mn>1</mn><mo>-</mo><msup><mi>x</mi><mn>2</mn></msup></mrow></msqrt> - <mi>d</mi> - <mi>x</mi> - <mo>=</mo> - <mfrac><mi>π</mi><mo>2</mo></mfrac> + <mrow><msubsup><mo>∫</mo><mn>-1</mn><mn>1</mn></msubsup></mrow> + <msqrt><mrow><mn>1</mn><mo>-</mo><msup><mi>x</mi><mn>2</mn></msup></mrow></msqrt> + <mi>d</mi> + <mi>x</mi> + <mo>=</mo> + <mfrac><mi>π</mi><mo>2</mo></mfrac> </math> */ class WikiPlugin_AsciiMath Modified: trunk/lib/plugin/AsciiSVG.php =================================================================== --- trunk/lib/plugin/AsciiSVG.php 2010-03-04 10:30:39 UTC (rev 7301) +++ trunk/lib/plugin/AsciiSVG.php 2010-03-04 10:48:07 UTC (rev 7302) @@ -44,8 +44,8 @@ function getDefaultArguments() { return array('width' => 200, 'height' => 200, - 'script' => false, // one line script. not very likely - 'onmousemove' => false + 'script' => false, // one line script. not very likely + 'onmousemove' => false ); } function handle_plugin_args_cruft(&$argstr, &$args) { @@ -67,21 +67,21 @@ $html->pushContent($js); $WikiTheme->_asciiSVG = 1; // prevent duplicates } - // extract <script> - if (preg_match("/^(.*)<script>(.*)<\/script>/ism", $this->source, $m)) { - $this->source = $m[1]; - $args['script'] = $m[2]; - } - $embedargs = array('width' => $args['width'], - 'height' => $args['height'], - //'src' => "d.svg", - 'script' => $this->source); - // additional onmousemove argument - if ($args['onmousemove']) $embedargs['onmousemove'] = $args['onmousemove']; + // extract <script> + if (preg_match("/^(.*)<script>(.*)<\/script>/ism", $this->source, $m)) { + $this->source = $m[1]; + $args['script'] = $m[2]; + } + $embedargs = array('width' => $args['width'], + 'height' => $args['height'], + //'src' => "d.svg", + 'script' => $this->source); + // additional onmousemove argument + 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; } }; @@ -89,7 +89,7 @@ class AsciiSVG_HTML extends HtmlElement { function startTag() { $start = "<" . $this->_tag; - $this->_setClasses(); + $this->_setClasses(); foreach ($this->_attr as $attr => $val) { if (is_bool($val)) { if (!$val) @@ -98,7 +98,7 @@ } $qval = str_replace("\"", '"', $this->_quote((string)$val)); if ($attr == 'script') - // note the ' not " + // note the ' not " $start .= " $attr='$qval'"; else $start .= " $attr=\"$qval\""; Modified: trunk/lib/plugin/BackLinks.php =================================================================== --- trunk/lib/plugin/BackLinks.php 2010-03-04 10:30:39 UTC (rev 7301) +++ trunk/lib/plugin/BackLinks.php 2010-03-04 10:48:07 UTC (rev 7302) @@ -30,16 +30,16 @@ function getName() { return _("BackLinks"); } - + function getDescription() { return sprintf(_("List all pages which link to %s."), '[pagename]'); } - + function getVersion() { return preg_replace("/[Revision: $]/", '', "\$Revision$"); } - + function getDefaultArguments() { return array_merge ( @@ -47,8 +47,8 @@ array('include_self' => false, 'noheader' => false, 'page' => '[pagename]', - 'linkmore' => '', // If count>0 and limit>0 display a link with - // the number of all results, linked to the given pagename. + 'linkmore' => '', // If count>0 and limit>0 display a link with + // the number of all results, linked to the given pagename. )); } @@ -70,39 +70,39 @@ if ($info) { $info = explode(",", $info); if (in_array('count',$info)) - $args['types']['count'] = + $args['types']['count'] = new _PageList_Column_BackLinks_count('count', _("#"), 'center'); } - if (!empty($limit)) - $args['limit'] = $limit; + if (!empty($limit)) + $args['limit'] = $limit; $args['dosort'] = !empty($args['sortby']); // override DB sort (??) $pagelist = new PageList($info, $exclude, $args); // support logical AND: page1,page2 - $pages = explodePageList($page); - $count = count($pages); - if (count($pages) > 1) { - // AND: the intersection of all these pages - $bl = array(); - foreach ($pages as $p) { - $dp = $dbi->getPage($p); - $bi = $dp->getBackLinks(false, $sortby, 0, $exclude); - while ($b = $bi->next()) { - $name = $b->getName(); - if (isset($bl[$name])) - $bl[$name]++; - else - $bl[$name] = 1; - } - } - foreach ($bl as $b => $v) - if ($v == $count) - $pagelist->addPage($b); - } else { - $p = $dbi->getPage($page); - $pagelist->addPages($p->getBackLinks(false, $sortby, 0, $exclude)); - } - $total = $pagelist->getTotal(); + $pages = explodePageList($page); + $count = count($pages); + if (count($pages) > 1) { + // AND: the intersection of all these pages + $bl = array(); + foreach ($pages as $p) { + $dp = $dbi->getPage($p); + $bi = $dp->getBackLinks(false, $sortby, 0, $exclude); + while ($b = $bi->next()) { + $name = $b->getName(); + if (isset($bl[$name])) + $bl[$name]++; + else + $bl[$name] = 1; + } + } + foreach ($bl as $b => $v) + if ($v == $count) + $pagelist->addPage($b); + } else { + $p = $dbi->getPage($page); + $pagelist->addPages($p->getBackLinks(false, $sortby, 0, $exclude)); + } + $total = $pagelist->getTotal(); // Localization note: In English, the differences between the // various phrases spit out here may seem subtle or negligible @@ -112,8 +112,8 @@ // distinction as it does with English in this case. :) if (!$noheader) { if ($page == $request->getArg('pagename') - and !$dbi->isWikiPage($page)) - { + and !$dbi->isWikiPage($page)) + { // BackLinks plugin is more than likely being called // upon for an empty page on said page, while either // 'browse'ing, 'create'ing or 'edit'ing. @@ -122,10 +122,10 @@ // the Un~WikiLink~ified (plain) name of the uncreated // page currently being viewed. $pagelink = $page; - + 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)); @@ -140,21 +140,21 @@ $total, $pagelink)); } else { - if ($count) { - $tmp_pages = $pages; - $p = array_shift($tmp_pages); - $pagelink = HTML(WikiLink($p, 'auto')); - foreach ($tmp_pages as $p) - $pagelink->pushContent(" ",_("AND")," ",WikiLink($p, 'auto')); - } else - // BackLinks plugin is being displayed on a normal page. + if ($count) { + $tmp_pages = $pages; + $p = array_shift($tmp_pages); + $pagelink = HTML(WikiLink($p, 'auto')); + foreach ($tmp_pages as $p) + $pagelink->pushContent(" ",_("AND")," ",WikiLink($p, 'auto')); + } else + // BackLinks plugin is being displayed on a normal page. $pagelink = WikiLink($page, 'auto'); - + 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)); @@ -166,18 +166,18 @@ // $pagelink)); else $pagelist->setCaption(fmt("%s pages link to %s:", - $limit > 0 ? $total : _("Those"), - $pagelink)); + $limit > 0 ? $total : _("Those"), + $pagelink)); } } - if (!empty($args['linkmore']) - and $dbi->isWikiPage($args['linkmore']) - and $limit > 0 and $total > $limit - ) - $pagelist->addCaption(WikiLink($args['linkmore'], "auto", _("More..."))); + 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 Modified: trunk/lib/plugin/BlogArchives.php =================================================================== --- trunk/lib/plugin/BlogArchives.php 2010-03-04 10:30:39 UTC (rev 7301) +++ trunk/lib/plugin/BlogArchives.php 2010-03-04 10:48:07 UTC (rev 7302) @@ -2,7 +2,7 @@ rcs_id('$Id$'); /* * Copyright (C) 2004 $ThePhpWikiProgrammingTeam - * + * * This file is part of PhpWiki. * * PhpWiki is free software; you can redistribute it and/or modify @@ -23,7 +23,7 @@ require_once('lib/plugin/WikiBlog.php'); /** - * BlogArchives - List monthly links for the current users blog if signed, + * BlogArchives - List monthly links for the current users blog if signed, * or the ADMIN_USER's Blog if not. * On month=... list the blog titles per month. * @@ -51,7 +51,7 @@ function getDefaultArguments() { return //array_merge //( - //PageList::supportedArgs(), + //PageList::supportedArgs(), array('user' => '', 'order' => 'reverse', // latest first 'info' => 'month,numpages', // ignored @@ -77,9 +77,9 @@ } if (!$args['user'] or $args['user'] == ADMIN_USER) { if (BLOG_DEFAULT_EMPTY_PREFIX) - $args['user'] = ''; // "Blogs/day" pages + $args['user'] = ''; // "Blogs/day" pages else - $args['user'] = ADMIN_USER; // "Admin/Blogs/day" pages + $args['user'] = ADMIN_USER; // "Admin/Blogs/day" pages } $parent = (empty($args['user']) ? '' : $args['user'] . SUBPAGE_SEPARATOR); @@ -87,15 +87,15 @@ //$pagelist = new PageList($args['info'], $args['exclude'], $args); //if (!is_array('pagename'), explode(',', $info)) // unset($pagelist->_columns['pagename']); - + $sp = HTML::Raw('· '); if (!empty($args['month'])) { $prefix = $parent . $this->_blogPrefix('wikiblog') . SUBPAGE_SEPARATOR . $args['month']; $pages = $dbi->titleSearch(new TextSearchQuery("^".$prefix, true, 'posix')); $html = HTML::ul(); while ($page = $pages->next()) { - $rev = $page->getCurrentRevision(false); - if ($rev->get('pagetype') != 'wikiblog') continue; + $rev = $page->getCurrentRevision(false); + if ($rev->get('pagetype') != 'wikiblog') continue; $blog = $this->_blog($rev); $html->pushContent(HTML::li(WikiLink($page, 'known', $rev->get('summary')))); } @@ -117,13 +117,13 @@ $months = array(); foreach ($blogs as $rev) { $blog = $this->_blog($rev); - $mon = $blog['month']; + $mon = $blog['month']; if (empty($months[$mon])) - $months[$mon] = + $months[$mon] = array('title' => $this->_monthTitle($mon), 'num' => 1, 'month' => $mon, - 'link' => WikiURL($basepage, + 'link' => WikiURL($basepage, $this->_nonDefaultArgs(array('month' => $mon)))); else $months[$mon]['num']++; @@ -137,7 +137,7 @@ return HTML(HTML::h3(_("Blog Archives:")), $html); else return $html; - } else + } else return ''; } Modified: trunk/lib/plugin/BlogJournal.php =================================================================== --- trunk/lib/plugin/BlogJournal.php 2010-03-04 10:30:39 UTC (rev 7301) +++ trunk/lib/plugin/BlogJournal.php 2010-03-04 10:48:07 UTC (rev 7302) @@ -2,7 +2,7 @@ rcs_id('$Id$'); /* * Copyright (C) 2005 $ThePhpWikiProgrammingTeam - * + * * This file is part of PhpWiki. * * PhpWiki is free software; you can redistribute it and/or modify @@ -23,10 +23,10 @@ require_once('lib/plugin/WikiBlog.php'); /** - * BlogJournal - Include the latest blog entries for the current users blog if signed, + * BlogJournal - Include the latest blog entries for the current users blog if signed, * or the ADMIN_USER's Blog if not. * UnfoldSubpages for blogs. - * Rui called this plugin "JournalLast", but this was written completely independent, + * Rui called this plugin "JournalLast", but this was written completely independent, * without having seen the src. * * @author: Reini Urban @@ -73,9 +73,9 @@ } if (!$args['user'] or $args['user'] == ADMIN_USER) { if (BLOG_DEFAULT_EMPTY_PREFIX) { - $args['user'] = ''; // "Blogs/day" pages + $args['user'] = ''; // "Blogs/day" pages } else { - $args['user'] = ADMIN_USER; // "Admin/Blogs/day" pages + $args['user'] = ADMIN_USER; // "Admin/Blogs/day" pages } } $parent = (empty($args['user']) ? '' : $args['user'] . SUBPAGE_SEPARATOR); @@ -96,8 +96,8 @@ } if ($args['user'] == $user->UserName() or $args['user'] == '') $html->pushContent(Button(array('action'=>'WikiBlog', - 'mode'=>'add'), - _("New entry"), $base)); + 'mode'=>'add'), + _("New entry"), $base)); if (!$i) return HTML(HTML::h3(_("No Blog Entries")), $html); if (!$args['noheader']) Modified: trunk/lib/plugin/BoxRight.php =================================================================== --- trunk/lib/plugin/BoxRight.php 2010-03-04 10:30:39 UTC (rev 7301) +++ trunk/lib/plugin/BoxRight.php 2010-03-04 10:48:07 UTC (rev 7302) @@ -49,13 +49,13 @@ // validators have already been handled by displayPage. return true; } - + function run($dbi, $argstr, &$request, $basepage) { if (!$basepage) { return $this->error("$basepage unset?"); } include_once("lib/BlockParser.php"); - $page = $request->getPage($basepage); + $page = $request->getPage($basepage); return HTML::div(array('class'=>'boxright'), TransformText($argstr)); } Modified: trunk/lib/plugin/CacheTest.php =================================================================== --- trunk/lib/plugin/CacheTest.php 2010-03-04 10:30:39 UTC (rev 7301) +++ trunk/lib/plugin/CacheTest.php 2010-03-04 10:48:07 UTC (rev 7302) @@ -2,7 +2,7 @@ rcs_id('$Id$'); /* * Copyright (C) 2002 Johannes Große - * + * * This file is part of PhpWiki. * * PhpWiki is free software; you can redistribute it and/or modify Modified: trunk/lib/plugin/Calendar.php =================================================================== --- trunk/lib/plugin/Calendar.php 2010-03-04 10:30:39 UTC (rev 7301) +++ trunk/lib/plugin/Calendar.php 2010-03-04 10:48:07 UTC (rev 7302) @@ -59,21 +59,21 @@ 'month_format' => '%B %Y', 'wday_format' => '%a', 'start_wday' => '1', // start now with Monday - 'display_weeknum' => 0); + 'display_weeknum' => 0); } /** - * return links (static only as of action=edit) + * return links (static only as of action=edit) * * @param string $argstr The plugin argument string. * @param string $basepage The pagename the plugin is invoked from. * @return array List of pagenames linked to (or false). */ function getWikiPageLinks ($argstr, $basepage) { - if (isset($this->_links)) + if (isset($this->_links)) return $this->_links; else { - global $request; + global $request; $this->run($request->_dbi, $argstr, $request, $basepage); return $this->_links; } @@ -126,7 +126,7 @@ $fs = $this->args['wday_format']; $row = HTML::tr(); $row->setattr('class', 'cal-dayname'); - if ($this->args['display_weeknum']) + if ($this->args['display_weeknum']) $row->pushContent(HTML::td(array('class' => 'cal-dayname', 'align' => 'center'), _("Wk"))); @@ -197,7 +197,7 @@ 1, // mday (1-31) $args['year']); - $colnum = $args['display_weeknum'] ? 8 : 7; + $colnum = $args['display_weeknum'] ? 8 : 7; $cal = HTML::table(array('cellspacing' => 0, 'cellpadding' => 2, 'class' => 'cal'), @@ -216,9 +216,9 @@ $tbody = HTML::tbody(); $row = HTML::tr(); - if ($args['display_weeknum']) + if ($args['display_weeknum']) $row->pushContent(HTML::td(array('class' => 'cal-weeknum'), - ((int)strftime("%U", $time))+1)); // %U problem. starts with 0 + ((int)strftime("%U", $time))+1)); // %U problem. starts with 0 $col = (7 + $t['tm_wday'] - $args['start_wday']) % 7; if ($col > 0) $row->pushContent(HTML::td(array('colspan' => $col))); @@ -235,9 +235,9 @@ $time += SECONDS_PER_DAY; $t = localtime($time, 1); $done = $t['tm_mday'] == 1; - if (!$col and !$done and $args['display_weeknum']) - $row->pushContent(HTML::td(array('class' => 'cal-weeknum'), - ((int)strftime("%U", $time))+1)); // starts with 0 + if (!$col and !$done and $args['display_weeknum']) + $row->pushContent(HTML::td(array('class' => 'cal-weeknum'), + ((int)strftime("%U", $time))+1)); // starts with 0 } if ($row->getContent()) { Modified: trunk/lib/plugin/CalendarList.php =================================================================== --- trunk/lib/plugin/CalendarList.php 2010-03-04 10:30:39 UTC (rev 7301) +++ trunk/lib/plugin/CalendarList.php 2010-03-04 10:48:07 UTC (rev 7302) @@ -22,19 +22,19 @@ */ // if not defined in config.ini -if (!defined('PLUGIN_CALENDARLIST_ORDER')) - define('PLUGIN_CALENDARLIST_ORDER', 'normal'); +if (!defined('PLUGIN_CALENDARLIST_ORDER')) + define('PLUGIN_CALENDARLIST_ORDER', 'normal'); if (!defined('PLUGIN_CALENDARLIST_NEXT_N_DAYS')) define('PLUGIN_CALENDARLIST_NEXT_N_DAYS',''); -if (!defined('PLUGIN_CALENDARLIST_NEXT_N')) - define('PLUGIN_CALENDARLIST_NEXT_N', ''); +if (!defined('PLUGIN_CALENDARLIST_NEXT_N')) + define('PLUGIN_CALENDARLIST_NEXT_N', ''); if (!defined('PLUGIN_CALENDARLIST_LAST_N_DAYS')) define('PLUGIN_CALENDARLIST_LAST_N_DAYS',''); -if (!defined('PLUGIN_CALENDARLIST_LAST_N')) - define('PLUGIN_CALENDARLIST_LAST_N', ''); +if (!defined('PLUGIN_CALENDARLIST_LAST_N')) + define('PLUGIN_CALENDARLIST_LAST_N', ''); /** - * This is a list of calendar appointments. + * This is a list of calendar appointments. * Same arguments as Calendar, so no one is confused * Uses <dl><dd>DATE<dt>page contents... * Derived from Calendar.php by Martin Norbäck <ma...@sa...> @@ -66,16 +66,16 @@ function getDefaultArguments() { return array('prefix' => '[pagename]', 'date_format' => '%Y-%m-%d', - 'order' => PLUGIN_CALENDARLIST_ORDER, // normal or reverse (report sequence) + 'order' => PLUGIN_CALENDARLIST_ORDER, // normal or reverse (report sequence) 'year' => '', 'month' => '', 'month_offset' => 0, //support ranges: next n days/events - 'next_n_days' => PLUGIN_CALENDARLIST_NEXT_N_DAYS, // one or the other, not both - 'next_n' => PLUGIN_CALENDARLIST_NEXT_N, + 'next_n_days' => PLUGIN_CALENDARLIST_NEXT_N_DAYS, // one or the other, not both + 'next_n' => PLUGIN_CALENDARLIST_NEXT_N, // last n days/entries: - 'last_n_days' => PLUGIN_CALENDARLIST_LAST_N_DAYS, // one or the other, not both - 'last_n' => PLUGIN_CALENDARLIST_LAST_N, + 'last_n_days' => PLUGIN_CALENDARLIST_LAST_N_DAYS, // one or the other, not both + 'last_n' => PLUGIN_CALENDARLIST_LAST_N, 'month_format' => '%B %Y', 'wday_format' => '%a', @@ -83,40 +83,40 @@ } /** - * return links (static only as of action=edit) + * return links (static only as of action=edit) * * @param string $argstr The plugin argument string. * @param string $basepage The pagename the plugin is invoked from. * @return array List of pagenames linked to (or false). */ function getWikiPageLinks ($argstr, $basepage) { - if (isset($this->_links)) + if (isset($this->_links)) return $this->_links; else { - global $request; + global $request; $this->run($request->_dbi, $argstr, $request, $basepage); return $this->_links; } } function _count_events($dbi, $n = 7, $direction = 1) { - // This is used by the last_n/next_n options to determine the date that - // accounts for the number of N events in the past/future. - // RETURNS: date of N-th event or the last item found - $args = &$this->args; // gather the args array - $timeTMP = time(); // start with today's date - $t = $timeTMP; // init the control date variable to now - - for ($i=0; $i<=180; $i++) { // loop thru 180 days, past or future + // This is used by the last_n/next_n options to determine the date that + // accounts for the number of N events in the past/future. + // RETURNS: date of N-th event or the last item found + $args = &$this->args; // gather the args array + $timeTMP = time(); // start with today's date + $t = $timeTMP; // init the control date variable to now + + for ($i=0; $i<=180; $i++) { // loop thru 180 days, past or future $date_string = strftime($args['date_format'], $t); $page_for_date = $args['prefix'] . SUBPAGE_SEPARATOR . $date_string; if ($dbi->isWikiPage($page_for_date)) { // if this date has any comments/events - $timeTMP = $t; // capture the date of this event for return - if ($n-- <= 0) break; // if we reached the limit, return the date + $timeTMP = $t; // capture the date of this event for return + if ($n-- <= 0) break; // if we reached the limit, return the date } - $t += 24 * 3600 * $direction; // advance one day back or forward + $t += 24 * 3600 * $direction; // advance one day back or forward } - + // return the date of the N-th or last, most past/future event in the range return $timeTMP; } @@ -168,7 +168,7 @@ } $base = mktime(0, 0, 0, // h, m, s $args['month'], // month 1-12 - $args['mday'], + $args['mday'], $args['year']); // must have base 1900 // *************************************************** @@ -223,7 +223,7 @@ for ($i = $start; ($step > 0) ? $i < $end : $i > $end; $i += $step) { $cal->pushContent($this->_date($dbi, $i)); } - // end of Plugin CalendarList display logic + // end of Plugin CalendarList display logic // *************************************************** return $cal; Modified: trunk/lib/plugin/Chart.php =================================================================== --- trunk/lib/plugin/Chart.php 2010-03-04 10:30:39 UTC (rev 7301) +++ trunk/lib/plugin/Chart.php 2010-03-04 10:48:07 UTC (rev 7302) @@ -62,12 +62,12 @@ function getDefaultArguments() { return array('width' => 200, 'height' => 200, - 'type' => 'line', // or 'area', 'bar', 'pie' + 'type' => 'line', // or 'area', 'bar', 'pie' // 'xlabel' => 'x', // TODO // 'ylabel' => 'y', // TODO - 'color' => 'green', - // 'legend' => false, // TODO - 'data' => false // mandatory + 'color' => 'green', + // 'legend' => false, // TODO + 'data' => false // mandatory ); } function handle_plugin_args_cruft(&$argstr, &$args) { @@ -140,9 +140,9 @@ } } - $embedargs = array('width' => $args['width'], - 'height' => $args['height'], - 'script' => $source); + $embedargs = array('width' => $args['width'], + 'height' => $args['height'], + 'script' => $source); $embed = new SVG_HTML("embed", $embedargs); $html->pushContent($embed); return $html; Modified: trunk/lib/plugin/CreateBib.php =================================================================== --- trunk/lib/plugin/CreateBib.php 2010-03-04 10:30:39 UTC (rev 7301) +++ trunk/lib/plugin/CreateBib.php 2010-03-04 10:48:07 UTC (rev 7302) @@ -23,9 +23,9 @@ /** * CreateBib: Automatically create a BibTex file from page * - * Usage: + * Usage: * <?plugin CreateBib pagename||=whatever ?> - * + * * @author: Lea Viljanen */ @@ -52,18 +52,18 @@ function preg_quote ($heading) { return str_replace(array("/",".","?","*"), - array('\/','\.','\?','\*'), $heading); + array('\/','\.','\?','\*'), $heading); } - + // Have to include the $starttag and $endtag to the regexps... - function extractBibTeX (&$content, $starttag, $endtag) + function extractBibTeX (&$content, $starttag, $endtag) { $bib = array(); $start = false; $stop = false; - for ($i=0; $i<count($content); $i++) + for ($i=0; $i<count($content); $i++) { // $starttag shows when to start if (preg_match('/^@/',$content[$i],$match)) { @@ -87,7 +87,7 @@ $articles = array(); for ($i=0; $i<count($content); $i++) { // Should match "* [WikiPageName] whatever" - //if (preg_match('/^\s*\*\s+(\[.+\])/',$content[$i],$match)) + //if (preg_match('/^\s*\*\s+(\[.+\])/',$content[$i],$match)) if (preg_match('/^\s*\*\s+\[(.+)\]/',$content[$i],$match)) { $articles[] = $match[1]; @@ -95,8 +95,8 @@ } return $articles; } - + function dumpFile(&$thispage, $filename) { include_once("lib/loadsave.php"); $mailified = MailifyPage($thispage); @@ -126,14 +126,14 @@ $current = $page->getCurrentRevision(); $content = $current->getContent(); - // Prepare the button to trigger dumping - $dump_url = $request->getURLtoSelf(array("file" => "tube.bib")); + // Prepare the button to trigger dumping + $dump_url = $request->getURLtoSelf(array("file" => "tube.bib")); global $WikiTheme; - $dump_button = $WikiTheme->makeButton("To File", - $dump_url , 'foo'); + $dump_button = $WikiTheme->makeButton("To File", + $dump_url , 'foo'); $html = HTML::div(array('class' => 'bib','align' => 'left')); - $html->pushContent($dump_button, ' '); + $html->pushContent($dump_button, ' '); $list = HTML::pre(array('id'=>'biblist', 'class' => 'bib')); // Let's find the subpages @@ -162,7 +162,7 @@ $c = $p->getCurrentRevision(); $pagedata = $c->getContent(); $this->dumpFile($pagedata, $request->getArg('file')); - } + } return $html; } Modified: trunk/lib/plugin/CreatePage.php =================================================================== --- trunk/lib/plugin/CreatePage.php 2010-03-04 10:30:39 UTC (rev 7301) +++ trunk/lib/plugin/CreatePage.php 2010-03-04 10:48:07 UTC (rev 7302) @@ -21,12 +21,12 @@ */ /** - * This allows you to create a page getting the new pagename from a - * forms-based interface, and optionally with the initial content from - * some template, plus expansion of some variables via %%variable%% statements + * This allows you to create a page getting the new pagename from a + * forms-based interface, and optionally with the initial content from + * some template, plus expansion of some variables via %%variable%% statements * in the template. * - * Put <?plugin-form CreatePage ?> at some page, browse this page, + * Put <?plugin-form CreatePage ?> at some page, browse this page, * enter the name of the page to create, then click the button. * * Usage: <?plugin-form CreatePage template=SomeTemplatePage vars="year=2004&name=None" ?> @@ -69,45 +69,45 @@ $s = trim($s); if (!$s) { return $this->error(_("Cannot create page with empty name!")); - } - // TODO: javascript warning if "/" or SUBPAGE_SEPARATOR in s - if ($verify) { - $head = _("CreatePage failed"); - if ($dbi->isWikiPage($verify)) { - $msg = _("Do you really want to create the page '%s'?"); - } else { - $msg = _("Do you really want to create the page '%s'?"); - } - if (isSubPage($s)) { - $main = subPageSlice(0); - if (!$dbi->isWikiPage(subPageSlice(0))) { - $msg .= "\n" . _("The new page you want to create will be a subpage.") - . "\n" . _("Subpages cannot be created unless the parent page exists."); - return alert($head, $msg); - } else { - $msg .= "\n" . _("The new page you want to create will be a subpage."); - } - } - if (strpos($s, " \/")) { - $msg .= "\n" . _("Subpages with ending space are not allowed as directory name on Windows."); - return alert($head, $msg); - } - } + } + // TODO: javascript warning if "/" or SUBPAGE_SEPARATOR in s + if ($verify) { + $head = _("CreatePage failed"); + if ($dbi->isWikiPage($verify)) { + $msg = _("Do you really want to create the page '%s'?"); + } else { + $msg = _("Do you really want to create the page '%s'?"); + } + if (isSubPage($s)) { + $main = subPageSlice(0); + if (!$dbi->isWikiPage(subPageSlice(0))) { + $msg .= "\n" . _("The new page you want to create will be a subpage.") + . "\n" . _("Subpages cannot be created unless the parent page exists."); + return alert($head, $msg); + } else { + $msg .= "\n" . _("The new page you want to create will be a subpage."); + } + } + if (strpos($s, " \/")) { + $msg .= "\n" . _("Subpages with ending space are not allowed as directory name on Windows."); + return alert($head, $msg); + } + } $param = array('action' => 'edit'); if ($template and $dbi->isWikiPage($template)) { $param['template'] = $template; - } elseif (!empty($initial_content)) { + } elseif (!empty($initial_content)) { // Warning! Potential URI overflow here on the GET redirect. Better use template. $param['initial_content'] = $initial_content; } - // If the initial_content is too large, pre-save the content in the page + // If the initial_content is too large, pre-save the content in the page // and redirect without that argument. // URI length limit: // http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.2.1 $url = WikiURL($s, $param, 'absurl'); // FIXME: expand vars in templates here. - if (strlen($url) > 255 + if (strlen($url) > 255 or ($param['template']) or preg_match('/%%\w+%%/', $initial_content)) // need variable expansion { @@ -116,7 +116,7 @@ $page = $dbi->getPage($s); $current = $page->getCurrentRevision(); $version = $current->getVersion(); - // overwrite empty (deleted) pages + // overwrite empty (deleted) pages if ($version and !$current->hasDefaultContents() and !$overwrite) { return $this->error(fmt("%s already exists", WikiLink($s))); } else { @@ -129,15 +129,15 @@ $initial_content = $currenttmpl->getPackedContent(); $meta['markup'] = $currenttmpl->_data['markup']; - if (preg_match('/<noinclude>.+<\/noinclude>/s', $initial_content)) { - $initial_content = preg_replace("/<noinclude>.+?<\/noinclude>/s", "", - $initial_content); - } + if (preg_match('/<noinclude>.+<\/noinclude>/s', $initial_content)) { + $initial_content = preg_replace("/<noinclude>.+?<\/noinclude>/s", "", + $initial_content); + } } $meta['summary'] = _("Created by CreatePage"); - $content = $this->doVariableExpansion($initial_content, $vars, $s, $request); + $content = $this->doVariableExpansion($initial_content, $vars, $s, $request); - if ($content !== $initial_content) { + if ($content !== $initial_content) { // need to destroy the template so that editpage doesn't overwrite it. unset($param['template']); $url = WikiURL($s, $param, 'absurl'); Modified: trunk/lib/plugin/CreateToc.php =================================================================== --- trunk/lib/plugin/CreateToc.php 2010-03-04 10:30:39 UTC (rev 7301) +++ trunk/lib/plugin/CreateToc.php 2010-03-04 10:48:07 UTC (rev 7302) @@ -130,7 +130,7 @@ function preg_quote ($heading) { return str_replace(array("/",".","?","*"), - array('\/','\.','\?','\*'), $heading); + array('\/','\.','\?','\*'), $heading); } // Get HTML header corresponding to current level (level is set of ! or =) @@ -173,55 +173,55 @@ $level, &$hstart, &$hend, $basepage=false) { $hstart = 0; $hend = 0; - $h = $this->_getHeader($level); + $h = $this->_getHeader($level); $qheading = $this->_quote($heading); - for ($j=$start_index; $j < count($content); $j++) { + for ($j=$start_index; $j < count($content); $j++) { if (is_string($content[$j])) { - if (preg_match("/<$h>$qheading<\/$h>/", - $content[$j])) - return $j; + if (preg_match("/<$h>$qheading<\/$h>/", + $content[$j])) + return $j; } elseif (isa($content[$j], 'cached_link')) { - if (method_exists($content[$j],'asXML')) { - $content[$j]->_basepage = $basepage; - $content[$j] = $content[$j]->asXML(); - } else - $content[$j] = $content[$j]->asString(); - // shortcut for single wikiword or link headers - if ($content[$j] == $heading - and substr($content[$j-1],-4,4) == "<$h>" - and substr($content[$j+1],0,5) == "</$h>") - { - $hstart = $j-1; - $hend = $j+1; - retur... [truncated message content] |