From 5c54f9d2a9386a4a2dc8b7011a829adceed9e552 Mon Sep 17 00:00:00 2001 From: rurban Date: Thu, 29 Apr 2004 19:39:44 +0000 Subject: [PATCH] special support for formatted plugins (one-liners) like iter->asArray() helper for PopularNearby db_session for older php's (no &func() allowed) git-svn-id: svn://svn.code.sf.net/p/phpwiki/code/trunk@3390 96ab9672-09ca-45d6-a79d-3d69d39ca109 --- lib/BlockParser.php | 13 +++++++------ lib/DbaDatabase.php | 4 ++-- lib/InlineParser.php | 23 ++++++++++++++++++----- lib/Request.php | 7 +++++-- lib/WikiDB.php | 43 ++++++++++++++----------------------------- lib/main.php | 9 ++++++--- 6 files changed, 52 insertions(+), 47 deletions(-) diff --git a/lib/BlockParser.php b/lib/BlockParser.php index 1458f3d65..15c82e45e 100644 --- a/lib/BlockParser.php +++ b/lib/BlockParser.php @@ -1,4 +1,4 @@ - * * This file is part of PhpWiki. @@ -820,11 +820,9 @@ class Block_oldlists extends Block_list $li->setTightness($top, $bot); } else { - // this is where php5 breaks - if (0 and DEBUG and check_php_version(5)) { - if (function_exists("xdebug_get_function_stack")) { - var_dump (xdebug_get_function_stack()); - } elseif (count($this->_content) != 2) { + // This is where php5 broke + if (DEBUG and check_php_version(5)) { + if (count($this->_content) != 2) { echo "
";
                     /*
                     $class = new Reflection_Class('XmlElement');
@@ -857,6 +855,9 @@ class Block_oldlists extends Block_list
                         echo "_properties: "; var_dump ($c->_properties);
                     }
                     debug_print_backtrace();
+                    if (function_exists("xdebug_get_function_stack")) {
+                        var_dump (xdebug_get_function_stack());
+                    }
                     echo "
"; } } diff --git a/lib/DbaDatabase.php b/lib/DbaDatabase.php index 85c44f7ef..1415ec9de 100644 --- a/lib/DbaDatabase.php +++ b/lib/DbaDatabase.php @@ -1,4 +1,4 @@ - * * This file is part of PhpWiki. @@ -204,7 +204,7 @@ class SimpleMarkup /** * A balanced markup rule. * - * These are defined by a start regexp, and and end regexp. + * These are defined by a start regexp, and an end regexp. */ class BalancedMarkup { @@ -494,8 +494,6 @@ class Markup_html_emphasis extends BalancedMarkup em|strong| cite|code|dfn|kbd|samp|var| sup|sub )>"; - //rurban: abbr|acronym need an optional title tag. - //sf.net bug #728595 function getEndRegexp ($match) { return "<\\/" . substr($match, 1); @@ -535,6 +533,21 @@ class Markup_html_abbr extends BalancedMarkup } } +// Special version for single-line plugins formatting, +// like: '< ? plugin PopularNearby ? >' +class Markup_plugin extends SimpleMarkup +{ + var $_match_regexp = '<\?plugin(?:-form)?\s.+?\?>'; + + function markup ($match) { + return new Cached_PluginInvocation($match); + } +} + + +// TODO: "..." => "…" browser specific display (not cached?) +// TODO: "--" => "&emdash;" browser specific display (not cached?) + // FIXME: Do away with magic phpwiki forms. (Maybe phpwiki: links too?) // FIXME: Do away with plugin-links. They seem not to be used. //Plugin link @@ -550,7 +563,7 @@ class InlineTransformer $markup_types = array('escape', 'bracketlink', 'url', 'interwiki', 'wikiword', 'linebreak', 'old_emphasis', 'nestled_emphasis', - 'html_emphasis', 'html_abbr'); + 'html_emphasis', 'html_abbr', 'plugin'); foreach ($markup_types as $mtype) { $class = "Markup_$mtype"; diff --git a/lib/Request.php b/lib/Request.php index 973bf5ce4..5e01ce838 100644 --- a/lib/Request.php +++ b/lib/Request.php @@ -1,5 +1,5 @@ getCurrentRevision(); $meta = $current->_data; $version = $current->getVersion(); - $meta['summary'] = sprintf(_("renamed from %s"),$from); + $meta['summary'] = _("removed"); $page->save($current->getPackedContent(), $version + 1, $meta); */ } @@ -354,33 +354,6 @@ class WikiDB { return new WikiDB_PageRevisionIterator($this, $result); } - /** - * Blog search. (experimental) - * - * Search for blog entries related to a certain page. - * - * FIXME: with pagetype support and perhaps a RegexpSearchQuery - * we can make sure we are returning *ONLY* blog pages to the - * main routine. Currently, we just use titleSearch which requires - * some further checking in lib/plugin/WikiBlog.php (BAD). - * - * @access public - * - * @param string $order 'normal' (chronological) or 'reverse' - * @param string $page Find blog entries related to this page. - * @return WikiDB_PageIterator A WikiDB_PageIterator containing the relevant pages. - */ - // Deleting until such time as this is properly implemented... - // (As long as it's just a title search, just use titleSearch.) - //function blogSearch($page, $order) { - // //FIXME: implement ordering - // - // require_once('lib/TextSearchQuery.php'); - // $query = new TextSearchQuery ($page . SUBPAGE_SEPARATOR); - // - // return $this->titleSearch($query); - //} - /** * Call the appropriate backend method. * @@ -1484,6 +1457,15 @@ class WikiDB_PageIterator $this->_pages->free(); } + + function asArray() { + $result = array(); + while ($page = $this->next()) + $result[] = $page; + $this->free(); + return $result; + } + // Not yet used and problematic. Order should be set in the query, not afterwards. // See PageList::sortby function setSortby ($arg = false) { @@ -1715,6 +1697,9 @@ class WikiDB_cache }; // $Log: not supported by cvs2svn $ +// Revision 1.46 2004/04/26 20:44:34 rurban +// locking table specific for better databases +// // Revision 1.45 2004/04/20 00:06:03 rurban // themable paging support // diff --git a/lib/main.php b/lib/main.php index 50bd5e565..1ff4aaeb9 100644 --- a/lib/main.php +++ b/lib/main.php @@ -1,5 +1,5 @@ _dbsession = & new DB_Session($this->getDbh(), - $prefix . $GLOBALS['DBParams']['db_session_table']); + $dbi = $this->getDbh(); + $this->_dbsession = & new DB_Session($dbi,$prefix . $GLOBALS['DBParams']['db_session_table']); } // Fixme: Does pear reset the error mask to 1? We have to find the culprit $x = error_reporting(); @@ -885,6 +885,9 @@ main(); // $Log: not supported by cvs2svn $ +// Revision 1.136 2004/04/29 17:18:19 zorloc +// Fixes permission failure issues. With PagePermissions and Disabled Actions when user did not have permission WIKIAUTH_FORBIDDEN was returned. In WikiUser this was ok because WIKIAUTH_FORBIDDEN had a value of 11 -- thus no user could perform that action. But WikiUserNew has a WIKIAUTH_FORBIDDEN value of -1 -- thus a user without sufficent permission to do anything. The solution is a new high value permission level (WIKIAUTH_UNOBTAINABLE) to be the default level for access failure. +// // Revision 1.135 2004/04/26 12:15:01 rurban // check default config values // -- 2.45.0