From 6a0f60e1b285f10df073f714a54f2b7110ec2937 Mon Sep 17 00:00:00 2001 From: rurban Date: Mon, 14 Jun 2004 11:31:39 +0000 Subject: [PATCH] renamed global $Theme to $WikiTheme (gforge nameclash) inherit PageList default options from PageList default sortby=pagename use options in PageList_Selectable (limit, sortby, ...) added action revert, with button at action=diff added option regex to WikiAdminSearchReplace git-svn-id: svn://svn.code.sf.net/p/phpwiki/code/trunk@3683 96ab9672-09ca-45d6-a79d-3d69d39ca109 --- lib/FileFinder.php | 14 +++-- lib/InlineParser.php | 6 +- lib/PageList.php | 25 ++++---- lib/PagePerm.php | 14 +++-- lib/Template.php | 11 ++-- lib/Theme.php | 33 ++++++----- lib/WikiUser.php | 11 +++- lib/WikiUserNew.php | 13 +++-- lib/diff.php | 33 +++++++---- lib/display.php | 9 ++- lib/editpage.php | 43 ++++++++------ lib/loadsave.php | 84 ++++++++++++++++++++------- lib/main.php | 27 +++++++-- lib/pdf.php | 7 ++- lib/plugin/AllPages.php | 29 +++++---- lib/plugin/AuthorHistory.php | 19 ++++-- lib/plugin/Diff.php | 15 +++-- lib/plugin/FrameInclude.php | 9 ++- lib/plugin/OldStyleTable.php | 9 ++- lib/plugin/PageDump.php | 11 ++-- lib/plugin/PageGroup.php | 22 ++++--- lib/plugin/PageHistory.php | 11 ++-- lib/plugin/PrevNext.php | 15 +++-- lib/plugin/RateIt.php | 45 +++++++------- lib/plugin/RecentChanges.php | 61 ++++++++++--------- lib/plugin/RichTable.php | 10 +++- lib/plugin/SyntaxHighlighter.php | 9 ++- lib/plugin/SystemInfo.php | 14 +++-- lib/plugin/Transclude.php | 9 ++- lib/plugin/UpLoad.php | 10 +++- lib/plugin/WhoIsOnline.php | 17 ++++-- lib/plugin/WikiAdminChmod.php | 34 +++++------ lib/plugin/WikiAdminChown.php | 34 +++++------ lib/plugin/WikiAdminRemove.php | 29 ++++----- lib/plugin/WikiAdminRename.php | 26 ++++----- lib/plugin/WikiAdminSearchReplace.php | 80 +++++++++++++++---------- lib/plugin/WikiAdminSelect.php | 30 ++++++---- lib/plugin/WikiAdminSetAcl.php | 24 ++++---- lib/plugin/WikiForum.php | 14 +++-- lib/plugin/WikiPoll.php | 15 +++-- lib/plugin/_WikiTranslation.php | 26 +++++++-- lib/removepage.php | 6 +- lib/stdlib.php | 25 +++++--- 43 files changed, 604 insertions(+), 384 deletions(-) diff --git a/lib/FileFinder.php b/lib/FileFinder.php index 712e2e810..3f6aa5bf8 100644 --- a/lib/FileFinder.php +++ b/lib/FileFinder.php @@ -1,4 +1,4 @@ -_pathsep = $this->_get_syspath_separator(); $include_path = $this->_get_include_path(); $path = array(); $lang = $this->_get_lang(); assert(!empty($lang)); - assert(!empty($Theme)); + assert(!empty($WikiTheme)); $langs = $this->locale_versions($lang); foreach ($langs as $lang) { if ($lang == 'C') $lang = 'en'; foreach ($include_path as $dir) { - $path[] = $this->slashifyPath($Theme->file("buttons/$lang")); + $path[] = $this->slashifyPath($WikiTheme->file("buttons/$lang")); } } @@ -555,6 +555,12 @@ function isCygwin() { } // $Log: not supported by cvs2svn $ +// Revision 1.21 2004/06/02 18:01:45 rurban +// init global FileFinder to add proper include paths at startup +// adds PHPWIKI_DIR if started from another dir, lib/pear also +// fix slashify for Windows +// fix USER_AUTH_POLICY=old, use only USER_AUTH_ORDER methods (besides HttpAuth) +// // Revision 1.20 2004/05/27 17:49:05 rurban // renamed DB_Session to DbSession (in CVS also) // added WikiDB->getParam and WikiDB->getAuthParam method to get rid of globals diff --git a/lib/InlineParser.php b/lib/InlineParser.php index c051c47fe..11b291e99 100644 --- a/lib/InlineParser.php +++ b/lib/InlineParser.php @@ -1,5 +1,5 @@ * Copyright (C) 2004 Reini Urban * @@ -346,8 +346,8 @@ function LinkBracketLink($bracketlink) { $imgurl = $imgurl->getAttr('href'); } elseif (! preg_match("#^(" . ALLOWED_PROTOCOLS . "):#", $imgurl)) { // local theme linkname like 'images/next.gif'. - global $Theme; - $imgurl = $Theme->getImageURL($imgurl); + global $WikiTheme; + $imgurl = $WikiTheme->getImageURL($imgurl); } $label = LinkImage($imgurl, $link); } diff --git a/lib/PageList.php b/lib/PageList.php index 173443619..86dff3ac0 100644 --- a/lib/PageList.php +++ b/lib/PageList.php @@ -1,4 +1,4 @@ -_field,PageList::sortable_columns())) { // multiple comma-delimited sortby args: "+hits,+pagename" $src = false; - $noimg_src = $Theme->getButtonURL('no_order'); + $noimg_src = $WikiTheme->getButtonURL('no_order'); if ($noimg_src) $noimg = HTML::img(array('src' => $noimg_src, 'width' => '7', @@ -123,7 +123,7 @@ class _PageList_Column_base { $sortby = PageList::sortby($request->getArg('sortby'),'flip_order'); $request->setArg('sortby',$sortby); $desc = (substr($sortby,0,1) == '-'); // asc or desc? (+pagename, -pagename) - $src = $Theme->getButtonURL($desc ? 'asc_order' : 'desc_order'); + $src = $WikiTheme->getButtonURL($desc ? 'asc_order' : 'desc_order'); } else { $sortby = PageList::sortby($this->_field,'init'); } @@ -255,8 +255,8 @@ class _PageList_Column_checkbox extends _PageList_Column { class _PageList_Column_time extends _PageList_Column { function _PageList_Column_time ($field, $default_heading) { $this->_PageList_Column($field, $default_heading, 'right'); - global $Theme; - $this->Theme = &$Theme; + global $WikiTheme; + $this->Theme = &$WikiTheme; } function _getValue ($page_handle, &$revision_handle) { @@ -465,13 +465,13 @@ class PageList { 'creator' => false, // current user by [] // for the sort buttons in - 'sortby' => '', // same as for WikiDB::getAllPages + 'sortby' => 'pagename', // same as for WikiDB::getAllPages //PageList pager options: // These options may also be given to _generate(List|Table) later // But limit and offset might help the query WikiDB::getAllPages() 'cols' => 1, // side-by-side display of list (1-3) - 'limit' => 50, // number of rows + 'limit' => 0, // number of rows (pagesize) 'paging' => 'auto', // 'auto' normal paging mode // // 'smart' drop 'info' columns and enhance rows // // when the list becomes large @@ -988,7 +988,7 @@ function flipAll(formObj) { class PageList_Selectable extends PageList { - function PageList_Selectable ($columns=false, $exclude=false) { + function PageList_Selectable ($columns=false, $exclude=false, $options = false) { if ($columns) { if (!is_array($columns)) $columns = explode(',', $columns); @@ -997,7 +997,7 @@ extends PageList { } else { $columns = array('checkbox','pagename'); } - PageList::PageList($columns,$exclude); + PageList::PageList($columns, $exclude, $options); } function addPageList ($array) { @@ -1010,11 +1010,12 @@ extends PageList { function addPageSelected ($pagename) { $this->_selected[$pagename] = 1; } - //Todo: - //insert javascript when clicked on Selected Select/Deselect all } // $Log: not supported by cvs2svn $ +// Revision 1.87 2004/06/13 16:02:12 rurban +// empty list of pages if user=[] and not authenticated. +// // Revision 1.86 2004/06/13 15:51:37 rurban // Support pagelist filter for current author,owner,creator by [] // diff --git a/lib/PagePerm.php b/lib/PagePerm.php index 5dca490dc..d302f92ba 100644 --- a/lib/PagePerm.php +++ b/lib/PagePerm.php @@ -1,5 +1,5 @@ _group)) { $this->_group =& WikiGroup::getGroup($GLOBALS['request']); } @@ -542,8 +543,8 @@ class PagePermission { $allGroups[] = $group; } //array_unique(array_merge($this->_group->getAllGroupsIn(), - $deletesrc = $Theme->_findData('images/delete.png'); - $addsrc = $Theme->_findData('images/add.png'); + $deletesrc = $WikiTheme->_findData('images/delete.png'); + $addsrc = $WikiTheme->_findData('images/add.png'); $nbsp = HTML::raw(' '); foreach ($this->perm as $access => $groups) { //$permlist = HTML::table(array('class' => 'cal','valign' => 'top')); @@ -698,6 +699,9 @@ class PagePermission { } // $Log: not supported by cvs2svn $ +// Revision 1.25 2004/06/08 13:51:57 rurban +// some comments only +// // Revision 1.24 2004/06/08 10:54:46 rurban // better acl dump representation, read back acl and owner // @@ -774,7 +778,7 @@ class PagePermission { // Revision 1.7 2004/02/28 22:25:07 rurban // First PagePerm implementation: // -// $Theme->setAnonEditUnknownLinks(false); +// $WikiTheme->setAnonEditUnknownLinks(false); // // Layout improvement with dangling links for mostly closed wiki's: // If false, only users with edit permissions will be presented the diff --git a/lib/Template.php b/lib/Template.php index a96ea5978..c95f2e943 100644 --- a/lib/Template.php +++ b/lib/Template.php @@ -1,5 +1,5 @@ _request = &$request; $this->_name = $name; $GLOBALS['TemplatesProcessed'][$name] = 1; $this->_basepage = $request->getArg('pagename'); - $file = $Theme->findTemplate($name); + $file = $WikiTheme->findTemplate($name); if (!$file) { trigger_error("no template for $name found", E_USER_WARNING); return; @@ -122,7 +122,7 @@ class Template if (!isset($page)) $page = &$request->getPage(); - global $Theme, $RCS_IDS, $charset; + global $WikiTheme, $RCS_IDS, $charset; //$this->_dump_template(); @@ -255,6 +255,9 @@ function GeneratePageasXML($content, $title, $page_revision = false, $args = fal } // $Log: not supported by cvs2svn $ +// Revision 1.59 2004/05/18 16:23:39 rurban +// rename split_pagename to SplitPagename +// // Revision 1.58 2004/05/15 19:48:33 rurban // fix some too loose PagePerms for signed, but not authenticated users // (admin, owner, creator) diff --git a/lib/Theme.php b/lib/Theme.php index bb5bad45b..3bc0ce97a 100644 --- a/lib/Theme.php +++ b/lib/Theme.php @@ -1,4 +1,4 @@ -makeLinkButton($page_or_rev, $label); + return $WikiTheme->makeLinkButton($page_or_rev, $label); } $version = false; @@ -86,7 +86,7 @@ function WikiLink ($page_or_rev, $type = 'known', $label = false) { } if (!is_string($wikipage) and !$wikipage->isValid('strict')) - return $Theme->linkBadWikiWord($wikipage, $label); + return $WikiTheme->linkBadWikiWord($wikipage, $label); if ($type == 'auto' or $type == 'if_known') { if (isset($page)) { @@ -120,21 +120,21 @@ function WikiLink ($page_or_rev, $type = 'known', $label = false) { foreach ($parts as $part) { $path[] = $part; $parent = join(SUBPAGE_SEPARATOR, $path); - if ($Theme->_autosplitWikiWords) + if ($WikiTheme->_autosplitWikiWords) $part = " " . $part; if ($part) - $link->pushContent($Theme->linkExistingWikiWord($parent, $sep . $part)); - $sep = $Theme->_autosplitWikiWords ? ' ' . SUBPAGE_SEPARATOR : SUBPAGE_SEPARATOR; + $link->pushContent($WikiTheme->linkExistingWikiWord($parent, $sep . $part)); + $sep = $WikiTheme->_autosplitWikiWords ? ' ' . SUBPAGE_SEPARATOR : SUBPAGE_SEPARATOR; } if ($exists) - $link->pushContent($Theme->linkExistingWikiWord($wikipage, $sep . $last_part, $version)); + $link->pushContent($WikiTheme->linkExistingWikiWord($wikipage, $sep . $last_part, $version)); else - $link->pushContent($Theme->linkUnknownWikiWord($wikipage, $sep . $last_part)); + $link->pushContent($WikiTheme->linkUnknownWikiWord($wikipage, $sep . $last_part)); return $link; } if ($exists) { - return $Theme->linkExistingWikiWord($wikipage, $label, $version); + return $WikiTheme->linkExistingWikiWord($wikipage, $label, $version); } elseif ($type == 'if_known') { if (!$label && isa($wikipage, 'WikiPageName')) @@ -142,7 +142,7 @@ function WikiLink ($page_or_rev, $type = 'known', $label = false) { return HTML($label ? $label : $pagename); } else { - return $Theme->linkUnknownWikiWord($wikipage, $label); + return $WikiTheme->linkUnknownWikiWord($wikipage, $label); } } @@ -178,12 +178,12 @@ function WikiLink ($page_or_rev, $type = 'known', $label = false) { * ($Page_or_rev is ignored for submit buttons.) */ function Button ($action, $label = false, $page_or_rev = false) { - global $Theme; + global $WikiTheme; if (!is_array($action) && preg_match('/submit:(.*)/A', $action, $m)) - return $Theme->makeSubmitButton($label, $m[1], $class = $page_or_rev); + return $WikiTheme->makeSubmitButton($label, $m[1], $class = $page_or_rev); else - return $Theme->makeActionButton($action, $label, $page_or_rev); + return $WikiTheme->makeActionButton($action, $label, $page_or_rev); } @@ -1151,7 +1151,7 @@ class Button extends HtmlElement { $this->setAttr('class', $class); if ($request->getArg('frame')) $this->setAttr('target', '_top'); - $this->pushContent($GLOBALS['Theme']->maybeSplitWikiWord($text)); + $this->pushContent($GLOBALS['WikiTheme']->maybeSplitWikiWord($text)); } }; @@ -1363,6 +1363,9 @@ function listAvailableLanguages() { } // $Log: not supported by cvs2svn $ +// Revision 1.104 2004/06/11 09:07:30 rurban +// support theme-specific LinkIconAttr: front or after or none +// // Revision 1.103 2004/06/07 22:44:14 rurban // added simplified chown, setacl actions // diff --git a/lib/WikiUser.php b/lib/WikiUser.php index fbb45cebd..4782fd72f 100644 --- a/lib/WikiUser.php +++ b/lib/WikiUser.php @@ -1,5 +1,5 @@ _themefile($newvalue)); - if (empty($Theme)) + if (empty($WikiTheme)) include_once($this->_themefile(THEME)); } @@ -739,6 +739,11 @@ class UserPreferences { } // $Log: not supported by cvs2svn $ +// Revision 1.58 2004/06/04 20:32:53 rurban +// Several locale related improvements suggested by Pierrick Meignen +// LDAP fix by John Cole +// reanable admin check without ENABLE_PAGEPERM in the admin plugins +// // Revision 1.57 2004/06/04 12:40:21 rurban // Restrict valid usernames to prevent from attacks against external auth or compromise // possible holes. diff --git a/lib/WikiUserNew.php b/lib/WikiUserNew.php index 007ece0aa..1d015f471 100644 --- a/lib/WikiUserNew.php +++ b/lib/WikiUserNew.php @@ -1,5 +1,5 @@ _init ) $GLOBALS['request']->setValidators(array('%mtime' => false)); if ($newvalue) include_once($this->_themefile($newvalue)); - if (empty($Theme)) + if (empty($WikiTheme)) include_once($this->_themefile(THEME)); } @@ -2989,6 +2989,9 @@ extends UserPreferences // $Log: not supported by cvs2svn $ +// Revision 1.91 2004/06/08 14:57:43 rurban +// stupid ldap bug detected by John Cole +// // Revision 1.90 2004/06/08 09:31:15 rurban // fixed typo detected by lucidcarbon (line 1663 assertion) // @@ -3262,7 +3265,7 @@ extends UserPreferences // Revision 1.25 2004/02/28 22:25:07 rurban // First PagePerm implementation: // -// $Theme->setAnonEditUnknownLinks(false); +// $WikiTheme->setAnonEditUnknownLinks(false); // // Layout improvement with dangling links for mostly closed wiki's: // If false, only users with edit permissions will be presented the diff --git a/lib/diff.php b/lib/diff.php index 77bf70479..5246c4f1f 100644 --- a/lib/diff.php +++ b/lib/diff.php @@ -1,5 +1,5 @@ 'right'), $label)); if ($rev) { @@ -248,14 +248,22 @@ function PageInfoRow ($label, $rev, &$request) $iswikipage = (isWikiWord($author) && $dbi->isWikiPage($author)); $authorlink = $iswikipage ? WikiLink($author) : $author; - - $linked_version = WikiLink($rev, 'existing', $rev->getVersion()); + $version = $rev->getVersion(); + $linked_version = WikiLink($rev, 'existing', $version); + if ($is_current) + $revertbutton = HTML(); + else + $revertbutton = $WikiTheme->makeActionButton(array('action' => 'revert', + 'version' => $version), + false, $rev); $row->pushContent(HTML::td(fmt("version %s", $linked_version)), - HTML::td($Theme->getLastModifiedMessage($rev, - false)), - HTML::td(fmt("by %s", $authorlink))); + HTML::td($WikiTheme->getLastModifiedMessage($rev, + false)), + HTML::td(fmt("by %s", $authorlink)), + HTML::td($revertbutton) + ); } else { - $row->pushContent(HTML::td(array('colspan' => '3'), _("None"))); + $row->pushContent(HTML::td(array('colspan' => '4'), _("None"))); } return $row; } @@ -358,9 +366,9 @@ function showDiff (&$request) { $old = false; $html->pushContent(HTML::Table(PageInfoRow(_("Newer page:"), $new, - $request), + $request, empty($version)), PageInfoRow(_("Older page:"), $old, - $request))); + $request, false))); if ($new && $old) { $diff = new Diff($old->getContent(), $new->getContent()); @@ -385,6 +393,9 @@ function showDiff (&$request) { } // $Log: not supported by cvs2svn $ +// Revision 1.47 2004/06/08 13:51:57 rurban +// some comments only +// // Revision 1.46 2004/05/01 15:59:29 rurban // nothing changed // diff --git a/lib/display.php b/lib/display.php index 0eb0b729a..336b295b1 100644 --- a/lib/display.php +++ b/lib/display.php @@ -1,6 +1,6 @@ getArg('pagename'); $version = $request->getArg('version'); @@ -52,7 +52,7 @@ function actionPage(&$request, $action) { // $splitname = SplitPagename($pagename); $pagetitle = HTML(fmt("%s: %s", $actionpage->getName(), - $Theme->linkExistingWikiWord($pagename, false, $version))); + $WikiTheme->linkExistingWikiWord($pagename, false, $version))); $validators = new HTTP_ValidatorSet(array('pageversion' => $revision->getVersion(), '%mtime' => $revision->get('mtime'))); @@ -154,6 +154,9 @@ function displayPage(&$request, $template=false) { flush(); } // $Log: not supported by cvs2svn $ +// Revision 1.51 2004/05/18 16:23:39 rurban +// rename split_pagename to SplitPagename +// // Revision 1.50 2004/05/04 22:34:25 rurban // more pdf support // diff --git a/lib/editpage.php b/lib/editpage.php index 65fefcc5f..2a472480b 100644 --- a/lib/editpage.php +++ b/lib/editpage.php @@ -1,5 +1,5 @@ getImageURL("ed_undo.gif"); - $undo_d_btn = $GLOBALS['Theme']->getImageURL("ed_undo_d.gif"); + $undo_btn = $WikiTheme->getImageURL("ed_undo.gif"); + $undo_d_btn = $WikiTheme->getImageURL("ed_undo_d.gif"); // JS_SEARCHREPLACE from walterzorn.de - $GLOBALS['Theme']->addMoreHeaders(Javascript(" + $WikiTheme->addMoreHeaders(Javascript(" var f, sr_undo, replacewin, undo_buffer=new Array(), undo_buffer_index=0; function define_f() { @@ -209,12 +210,12 @@ function speich() { undo_enable(true); } ")); - $GLOBALS['Theme']->addMoreAttr('body'," onload='define_f()'"); + $WikiTheme->addMoreAttr('body'," onload='define_f()'"); } else { - $GLOBALS['Theme']->addMoreAttr('body',"document.getElementById('edit[content]').editarea.focus()"); + $WikiTheme->addMoreAttr('body',"document.getElementById('edit[content]').editarea.focus()"); } if (defined('ENABLE_EDIT_TOOLBAR') and ENABLE_EDIT_TOOLBAR) { - $GLOBALS['Theme']->addMoreHeaders(JavaScript('',array('src'=>$GLOBALS['Theme']->_findData("toolbar.js")))); + $WikiTheme->addMoreHeaders(JavaScript('',array('src' => $WikiTheme->_findData("toolbar.js")))); $tokens['EDIT_TOOLBAR'] = $this->toolbar(); } else { $tokens['EDIT_TOOLBAR'] = ''; @@ -224,7 +225,7 @@ function speich() { } function toolbar () { - global $Theme; + global $WikiTheme; $toolarray = array( array( "image"=>"ed_format_bold.gif", @@ -275,15 +276,15 @@ function speich() { ); $toolbar = "document.writeln(\"
\");\n"; - $btn = new SubmitImageButton(_("Save"), "edit[save]", 'toolbar', $Theme->getImageURL("ed_save.gif")); + $btn = new SubmitImageButton(_("Save"), "edit[save]", 'toolbar', $WikiTheme->getImageURL("ed_save.gif")); $btn->addTooltip(_("Save")); $toolbar.='document.writeln("'.addslashes($btn->asXml()).'");'."\n"; - $btn = new SubmitImageButton(_("Preview"), "edit[preview]", 'toolbar', $Theme->getImageURL("ed_preview.gif")); + $btn = new SubmitImageButton(_("Preview"), "edit[preview]", 'toolbar', $WikiTheme->getImageURL("ed_preview.gif")); $btn->addTooltip(_("Preview")); $toolbar.='document.writeln("'.addslashes($btn->asXml()).'");'."\n"; foreach ($toolarray as $tool) { - $image = $Theme->getImageURL($tool["image"]); + $image = $WikiTheme->getImageURL($tool["image"]); $open = $tool["open"]; $close = $tool["close"]; $sample = addslashes( $tool["sample"] ); @@ -296,10 +297,9 @@ function speich() { } $toolbar.="addInfobox('" . addslashes( _("Click a button to get an example text") ) . "');\n"; if (defined('JS_SEARCHREPLACE') and JS_SEARCHREPLACE) { - //$undo_btn = $GLOBALS['Theme']->getImageURL("ed_undo.gif"); - $undo_d_btn = $GLOBALS['Theme']->getImageURL("ed_undo_d.gif"); - //$redo_btn = $Theme->getImageURL("ed_redo.gif"); - $sr_btn = $Theme->getImageURL("ed_replace.gif"); + $undo_d_btn = $WikiTheme->getImageURL("ed_undo_d.gif"); + //$redo_btn = $WikiTheme->getImageURL("ed_redo.gif"); + $sr_btn = $WikiTheme->getImageURL("ed_replace.gif"); $sr_js = '' // . '' . ''; @@ -314,7 +314,7 @@ function speich() { } function output ($template, $title_fs) { - global $Theme; + global $WikiTheme; $selected = &$this->selected; $current = &$this->current; @@ -330,7 +330,7 @@ function speich() { $title = new FormattedText ($title_fs, $pagelink); if ($template == 'editpage' and USE_HTMLAREA) { - $Theme->addMoreHeaders(Edit_HtmlArea_Head()); + $WikiTheme->addMoreHeaders(Edit_HtmlArea_Head()); //$tokens['PAGE_SOURCE'] = Edit_HtmlArea_ConvertBefore($this->_content); } $template = Template($template, $this->tokens); @@ -416,8 +416,8 @@ function speich() { $warnings = $dbi->GenericWarnings(); $dbi->touch(); - global $Theme; - if (empty($warnings) && ! $Theme->getImageURL('signature')) { + global $WikiTheme; + if (empty($warnings) && ! $WikiTheme->getImageURL('signature')) { // Do redirect to browse page if no signature has // been defined. In this case, the user will most // likely not see the rest of the HTML we generate @@ -762,6 +762,11 @@ extends PageEditor /** $Log: not supported by cvs2svn $ + Revision 1.71 2004/06/03 18:06:29 rurban + fix file locking issues (only needed on write) + fixed immediate LANG and THEME in-session updates if not stored in prefs + advanced editpage toolbars (search & replace broken) + Revision 1.70 2004/06/02 20:47:47 rurban dont use the wikiaction class diff --git a/lib/loadsave.php b/lib/loadsave.php index d891af91d..f000babe1 100644 --- a/lib/loadsave.php +++ b/lib/loadsave.php @@ -1,5 +1,5 @@ getDbh(); $pages = $dbi->getAllPages(); - global $Theme; + global $WikiTheme; if (defined('HTML_DUMP_SUFFIX')) - $Theme->HTML_DUMP_SUFFIX = HTML_DUMP_SUFFIX; - $Theme->DUMP_MODE = 'HTML'; + $WikiTheme->HTML_DUMP_SUFFIX = HTML_DUMP_SUFFIX; + $WikiTheme->DUMP_MODE = 'HTML'; while ($page = $pages->next()) { if (! $request->getArg('start_debug')) @@ -286,7 +286,7 @@ function DumpHtmlToDir (&$request) $pagename = $page->getName(); $request->setArg('pagename',$pagename); // Template::_basepage fix - $filename = FilenameForPage($pagename) . $Theme->HTML_DUMP_SUFFIX; + $filename = FilenameForPage($pagename) . $WikiTheme->HTML_DUMP_SUFFIX; $msg = HTML(HTML::br(), $pagename, ' ... '); @@ -322,12 +322,12 @@ function DumpHtmlToDir (&$request) fclose($fd); } - if (is_array($Theme->dumped_images)) { + if (is_array($WikiTheme->dumped_images)) { @mkdir("$directory/images"); - foreach ($Theme->dumped_images as $img_file) { - if (($from = $Theme->_findFile($img_file)) and basename($from)) { + foreach ($WikiTheme->dumped_images as $img_file) { + if (($from = $WikiTheme->_findFile($img_file)) and basename($from)) { $target = "$directory/images/".basename($img_file); - if (copy($Theme->_path . $from, $target)) { + if (copy($WikiTheme->_path . $from, $target)) { $msg = HTML(HTML::br(), HTML($from), HTML::small(fmt("... copied to %s", $target))); PrintXML($msg); } @@ -337,11 +337,11 @@ function DumpHtmlToDir (&$request) } } } - if (is_array($Theme->dumped_css)) { - foreach ($Theme->dumped_css as $css_file) { - if (($from = $Theme->_findFile(basename($css_file))) and basename($from)) { + if (is_array($WikiTheme->dumped_css)) { + foreach ($WikiTheme->dumped_css as $css_file) { + if (($from = $WikiTheme->_findFile(basename($css_file))) and basename($from)) { $target = "$directory/" . basename($css_file); - if (copy($Theme->_path . $from, $target)) { + if (copy($WikiTheme->_path . $from, $target)) { $msg = HTML(HTML::br(), HTML($from), HTML::small(fmt("... copied to %s", $target))); PrintXML($msg); } @@ -351,8 +351,8 @@ function DumpHtmlToDir (&$request) } } } - $Theme->HTML_DUMP_SUFFIX = ''; - $Theme->DUMP_MODE = false; + $WikiTheme->HTML_DUMP_SUFFIX = ''; + $WikiTheme->DUMP_MODE = false; $request->setArg('pagename',$thispage); // Template::_basepage fix EndLoadDump($request); @@ -375,9 +375,9 @@ function MakeWikiZipHtml (&$request) $dbi = $request->getDbh(); $pages = $dbi->getAllPages(); - global $Theme; + global $WikiTheme; if (defined('HTML_DUMP_SUFFIX')) - $Theme->HTML_DUMP_SUFFIX = HTML_DUMP_SUFFIX; + $WikiTheme->HTML_DUMP_SUFFIX = HTML_DUMP_SUFFIX; /* ignore fatals in plugins */ global $ErrorManager; @@ -398,7 +398,7 @@ function MakeWikiZipHtml (&$request) $pagename = $page->getName(); $request->setArg('pagename',$pagename); // Template::_basepage fix - $filename = FilenameForPage($pagename) . $Theme->HTML_DUMP_SUFFIX; + $filename = FilenameForPage($pagename) . $WikiTheme->HTML_DUMP_SUFFIX; $revision = $page->getCurrentRevision(); $transformedContent = $revision->getTransformedContent(); @@ -414,7 +414,7 @@ function MakeWikiZipHtml (&$request) // FIXME: Deal with images here. $zip->finish(); $ErrorManager->popErrorHandler(); - $Theme->$HTML_DUMP_SUFFIX = ''; + $WikiTheme->$HTML_DUMP_SUFFIX = ''; } @@ -539,7 +539,7 @@ function SavePage (&$request, $pageinfo, $source, $filename) $f = str_replace(sprintf(_("plain file %s"), ''), '', $f); //check if uploaded file? they pass just the content, but the file is gone if (@stat($f)) { - global $Theme; + global $WikiTheme; $meb = Button(array('action' => 'loadfile', 'merge'=> true, 'source'=> $f), @@ -565,6 +565,43 @@ function SavePage (&$request, $pageinfo, $source, $filename) flush(); } +// action=revert (by diff) +function RevertPage (&$request) +{ + $mesg = HTML::dd(); + $pagename = $request->getArg('pagename'); + $version = $request->getArg('version'); + if (!$version) { + PrintXML(HTML::dt(fmt("Revert")," ",WikiLink($pagename)), + HTML::dd(_("missing required version argument"))); + return; + } + $dbi = $request->getDbh(); + $page = $dbi->getPage($pagename); + $current = $page->getCurrentRevision(); + if ($current->getVersion() == 0) { + $mesg->pushContent(' ', _("no page content")); + PrintXML(HTML::dt(fmt("Revert")," ",WikiLink($pagename)), + $mesg); + return; + } + if ($current->getVersion() == $version) { + $mesg->pushContent(' ', _("same version page")); + return; + } + $rev = $page->getRevision($version); + $content = $rev->getPackedContent(); + $versiondata = $rev->_data; + $versiondata['summary'] = sprintf(_("revert to version %d"), $version); + $new = $page->save($content, $current->getVersion() + 1, $versiondata); + $dbi->touch(); + $mesg->pushContent(' ', fmt("- version %d saved to database as version %d", + $version, $new->getVersion())); + PrintXML(HTML::dt(fmt("Revert")," ",WikiLink($pagename)), + $mesg); + flush(); +} + function _tryinsertInterWikiMap($content) { $goback = false; if (strpos($content, "")) { @@ -950,6 +987,13 @@ function LoadPostFile (&$request) /** $Log: not supported by cvs2svn $ + Revision 1.106 2004/06/13 13:54:25 rurban + Catch fatals on the four dump calls (as file and zip, as html and mimified) + FoafViewer: Check against external requirements, instead of fatal. + Change output for xhtmldumps: using file:// urls to the local fs. + Catch SOAP fatal by checking for GOOGLE_LICENSE_KEY + Import GOOGLE_LICENSE_KEY and FORTUNE_DIR from config.ini. + Revision 1.105 2004/06/08 19:48:16 rurban fixed foreign setup: no ugly skipped msg for the GenericPages, load english actionpages if translated not found diff --git a/lib/main.php b/lib/main.php index bc7a4d07c..d4f6c8bb3 100644 --- a/lib/main.php +++ b/lib/main.php @@ -1,5 +1,5 @@ version = phpwiki_version(); } function initializeTheme () { - global $Theme; + global $WikiTheme; // Load theme $user_theme = $this->getPref('theme'); @@ -115,13 +115,13 @@ $this->version = phpwiki_version(); { include_once("themes/" . THEME . "/themeinfo.php"); } - if (empty($Theme) and isset($user_theme)) + if (empty($WikiTheme) and isset($user_theme)) include_once("themes/$user_theme/themeinfo.php"); - if (empty($Theme) and defined('THEME')) + if (empty($WikiTheme) and defined('THEME')) include_once("themes/" . THEME . "/themeinfo.php"); - if (empty($Theme)) + if (empty($WikiTheme)) include_once("themes/default/themeinfo.php"); - assert(!empty($Theme)); + assert(!empty($WikiTheme)); } // This really maybe should be part of the constructor, but since it @@ -378,6 +378,7 @@ $this->version = phpwiki_version(); 'dumphtml' => _("dump html pages"), 'dumpserial' => _("dump serial pages"), 'edit' => _("edit this page"), + 'revert' => _("revert to a previous version of this page"), 'create' => _("create this page"), 'loadfile' => _("load files into this wiki"), 'lock' => _("lock this page"), @@ -406,6 +407,7 @@ $this->version = phpwiki_version(); 'dumphtml' => _("Dumping html pages"), 'dumpserial' => _("Dumping serial pages"), 'edit' => _("Editing pages"), + 'revert' => _("Reverting to a previous version of pages"), 'create' => _("Creating pages"), 'loadfile' => _("Loading files"), 'lock' => _("Locking pages"), @@ -469,6 +471,7 @@ $this->version = phpwiki_version(); return WIKIAUTH_ANON; case 'edit': + case 'revert': case 'soap': if (defined('REQUIRE_SIGNIN_BEFORE_EDIT') && REQUIRE_SIGNIN_BEFORE_EDIT) return WIKIAUTH_BOGO; @@ -879,6 +882,11 @@ $this->version = phpwiki_version(); $xmlrpc->service(); } + function action_revert () { + include_once "lib/loadsave.php"; + RevertPage($this); + } + function action_zip () { include_once("lib/loadsave.php"); MakeWikiZip($this); @@ -1041,6 +1049,13 @@ main(); // $Log: not supported by cvs2svn $ +// Revision 1.164 2004/06/13 13:54:25 rurban +// Catch fatals on the four dump calls (as file and zip, as html and mimified) +// FoafViewer: Check against external requirements, instead of fatal. +// Change output for xhtmldumps: using file:// urls to the local fs. +// Catch SOAP fatal by checking for GOOGLE_LICENSE_KEY +// Import GOOGLE_LICENSE_KEY and FORTUNE_DIR from config.ini. +// // Revision 1.163 2004/06/13 11:35:32 rurban // check for create action on action=edit not to fool PagePerm checks // diff --git a/lib/pdf.php b/lib/pdf.php index b59d43ba2..822be9007 100644 --- a/lib/pdf.php +++ b/lib/pdf.php @@ -1,5 +1,5 @@ SetFont('Arial','',9); //URL - space from side - space from top - width if (!DEBUG) { - $imgurl = $GLOBALS['Theme']->_findFile("images/logo.png"); // header and wikilogo + $imgurl = $GLOBALS['WikiTheme']->_findFile("images/logo.png"); // header and wikilogo if ($imgurl) $this->Image($imgurl,3,3); } @@ -136,6 +136,9 @@ function ConvertAndDisplayPdf (&$request) { } // $Log: not supported by cvs2svn $ +// Revision 1.3 2004/05/15 19:49:09 rurban +// moved action_pdf to lib/pdf.php +// // Local Variables: // mode: php diff --git a/lib/plugin/AllPages.php b/lib/plugin/AllPages.php index eb498c6ef..286ebebda 100644 --- a/lib/plugin/AllPages.php +++ b/lib/plugin/AllPages.php @@ -1,5 +1,5 @@ false, - 'include_empty' => false, - /* select pages by meta-data: */ - 'author' => false, // current user with '[]' - 'owner' => false, // current user with '[]' - 'creator' => false, // current user with '[]' - 'exclude' => '', - 'info' => '', - 'sortby' => 'pagename', // +mtime,-pagename - 'limit' => 0, - 'paging' => 'auto', - 'debug' => false - ); + return array_merge + ( + PageList::supportedArgs(), + array( + 'noheader' => false, + 'include_empty' => false, + 'info' => '', + 'debug' => false + )); } // info arg allows multiple columns // info=mtime,hits,summary,version,author,locked,minor,markup or all @@ -118,6 +114,9 @@ extends WikiPlugin }; // $Log: not supported by cvs2svn $ +// Revision 1.24 2004/06/13 16:02:12 rurban +// empty list of pages if user=[] and not authenticated. +// // Revision 1.23 2004/06/13 15:51:37 rurban // Support pagelist filter for current author,owner,creator by [] // diff --git a/lib/plugin/AuthorHistory.php b/lib/plugin/AuthorHistory.php index d5fe816f4..15560ba58 100644 --- a/lib/plugin/AuthorHistory.php +++ b/lib/plugin/AuthorHistory.php @@ -1,5 +1,5 @@ getPage($page); @@ -144,7 +144,7 @@ extends WikiPlugin 'if_known'), $nbsp), HTML::td($nbsp, $rev->get('summary')), HTML::td(array('align'=> 'right'), - $Theme->formatdatetime($rev->get('mtime'))) + $WikiTheme->formatdatetime($rev->get('mtime'))) ); $class = $isminor ? 'evenrow' : 'oddrow'; @@ -201,7 +201,7 @@ extends WikiPlugin $includeminor ? (HTML::td($nbsp, ($isminor ? "minor" : "major"), $nbsp)) : "", HTML::td($nbsp, $rev->get('summary')), HTML::td(array('align'=> 'right'), - $Theme->formatdatetime($rev->get('mtime')), $nbsp) + $WikiTheme->formatdatetime($rev->get('mtime')), $nbsp) ); $class = $isminor ? 'evenrow' : 'oddrow'; @@ -246,6 +246,15 @@ extends WikiPlugin }; // $Log: not supported by cvs2svn $ +// Revision 1.5 2004/02/28 21:14:08 rurban +// generally more PHPDOC docs +// see http://xarch.tu-graz.ac.at/home/rurban/phpwiki/xref/ +// fxied WikiUserNew pref handling: empty theme not stored, save only +// changed prefs, sql prefs improved, fixed password update, +// removed REPLACE sql (dangerous) +// moved gettext init after the locale was guessed +// + some minor changes +// // Revision 1.4 2004/02/17 12:11:36 rurban // added missing 4th basepage arg at plugin->run() to almost all plugins. This caused no harm so far, because it was silently dropped on normal usage. However on plugin internal ->run invocations it failed. (InterWikiSearch, IncludeSiteMap, ...) // diff --git a/lib/plugin/Diff.php b/lib/plugin/Diff.php index db051e192..184da7113 100644 --- a/lib/plugin/Diff.php +++ b/lib/plugin/Diff.php @@ -1,5 +1,5 @@ 'right'), $label)); if ($rev) { @@ -70,7 +70,7 @@ extends WikiPlugin { $linked_version = WikiLink($rev, 'existing', $rev->getVersion()); $row->pushContent(HTML::td(fmt("version %s", $linked_version)), - HTML::td($Theme->getLastModifiedMessage($rev, + HTML::td($WikiTheme->getLastModifiedMessage($rev, false)), HTML::td(fmt("by %s", $authorlink))); } else { @@ -422,6 +422,13 @@ class TableUnifiedDiffFormatter extends HtmlUnifiedDiffFormatter } // $Log: not supported by cvs2svn $ +// Revision 1.1 2004/02/26 23:02:17 rurban +// lib/diff.php converted to a plugin by electrawn, +// plugin cleaned up by rurban, +// code by dairiki +// +// Would make sense to see arbitrary diff's between any files or revisions. +// // // For emacs users diff --git a/lib/plugin/FrameInclude.php b/lib/plugin/FrameInclude.php index 66f5c37d0..7c617face 100644 --- a/lib/plugin/FrameInclude.php +++ b/lib/plugin/FrameInclude.php @@ -1,5 +1,5 @@ getArgs($argstr, $request)); extract($args); @@ -149,6 +149,9 @@ extends WikiPlugin }; // $Log: not supported by cvs2svn $ +// Revision 1.9 2004/02/17 12:11:36 rurban +// added missing 4th basepage arg at plugin->run() to almost all plugins. This caused no harm so far, because it was silently dropped on normal usage. However on plugin internal ->run invocations it failed. (InterWikiSearch, IncludeSiteMap, ...) +// // Revision 1.8 2003/02/26 22:32:06 dairiki // Wups. Delete disused cruft. // diff --git a/lib/plugin/OldStyleTable.php b/lib/plugin/OldStyleTable.php index ca22c171c..9f0981556 100644 --- a/lib/plugin/OldStyleTable.php +++ b/lib/plugin/OldStyleTable.php @@ -1,5 +1,5 @@ getArgs($argstr, $request); @@ -148,6 +148,9 @@ extends WikiPlugin }; // $Log: not supported by cvs2svn $ +// Revision 1.9 2004/02/17 12:11:36 rurban +// added missing 4th basepage arg at plugin->run() to almost all plugins. This caused no harm so far, because it was silently dropped on normal usage. However on plugin internal ->run invocations it failed. (InterWikiSearch, IncludeSiteMap, ...) +// // Revision 1.8 2004/01/24 23:37:08 rurban // Support more options: caption (seperate tag), border, summary, cellpadding, // cellspacing diff --git a/lib/plugin/PageDump.php b/lib/plugin/PageDump.php index 4055628d9..e003ccc8c 100644 --- a/lib/plugin/PageDump.php +++ b/lib/plugin/PageDump.php @@ -1,5 +1,5 @@ getButtonSeparator()) + global $WikiTheme; + if (!$Sep = $WikiTheme->getButtonSeparator()) $Sep = " "; return HTML($h2, HTML::em($desc), @@ -255,6 +255,9 @@ _("PhpWiki developers should manually inspect the downloaded file for nested mar }; // $Log: not supported by cvs2svn $ +// Revision 1.10 2004/06/07 22:28:05 rurban +// add acl field to mimified dump +// // Revision 1.9 2004/06/07 19:50:41 rurban // add owner field to mimified dump // diff --git a/lib/plugin/PageGroup.php b/lib/plugin/PageGroup.php index c17af0c79..430830ae1 100644 --- a/lib/plugin/PageGroup.php +++ b/lib/plugin/PageGroup.php @@ -1,5 +1,5 @@ _("Last") ); - global $Theme; - $sep = $Theme->getButtonSeparator(); + global $WikiTheme; + $sep = $WikiTheme->getButtonSeparator(); if (!$sep) $sep = " | "; // force some kind of separator // default label if (!$label) - $label = $Theme->makeLinkButton($parent); + $label = $WikiTheme->makeLinkButton($parent); // This is where the list extraction occurs from the named // $section on the $parent page. @@ -164,7 +164,7 @@ extends WikiPlugin } // mind the French : punctuation $text = fmt("%s: %s", $directions[$go_item], - $Theme->makeLinkButton($linkpage)); + $WikiTheme->makeLinkButton($linkpage)); $links->pushcontent($text); $links->pushcontent($sep); // this works because // there are only 2 go @@ -175,7 +175,7 @@ extends WikiPlugin } else { $linkpage = $c[$thispage - 1]; $text = fmt("%s: %s", $directions[$go_item], - $Theme->makeLinkButton($linkpage)); + $WikiTheme->makeLinkButton($linkpage)); $links->pushcontent($text); $links->pushcontent($sep); //this works //because there are @@ -191,14 +191,14 @@ extends WikiPlugin $linkpage = $c[$thispage + 1]; } $text = fmt("%s: %s", $directions[$go_item], - $Theme->makeLinkButton($linkpage)); + $WikiTheme->makeLinkButton($linkpage)); } else { if ($thispage == $lastindex) { // skip it } else { $linkpage = $c[$thispage + 1]; $text = fmt("%s: %s", $directions[$go_item], - $Theme->makeLinkButton($linkpage)); + $WikiTheme->makeLinkButton($linkpage)); } } $links->pushcontent($text); @@ -210,6 +210,10 @@ extends WikiPlugin }; // $Log: not supported by cvs2svn $ +// Revision 1.7 2004/05/03 15:53:20 rurban +// Support [] links, but no [name|page] links yet +// Support subpages +// // Revision 1.6 2004/02/17 12:11:36 rurban // added missing 4th basepage arg at plugin->run() to almost all plugins. This caused no harm so far, because it was silently dropped on normal usage. However on plugin internal ->run invocations it failed. (InterWikiSearch, IncludeSiteMap, ...) // diff --git a/lib/plugin/PageHistory.php b/lib/plugin/PageHistory.php index e73d1bb6a..5407fc487 100644 --- a/lib/plugin/PageHistory.php +++ b/lib/plugin/PageHistory.php @@ -1,5 +1,5 @@ getFormatter('PageHistory', $format); + $fmt_class = $WikiTheme->getFormatter('PageHistory', $format); if (!$fmt_class) { if ($format == 'rss') $fmt_class = '_PageHistory_RssFormatter'; @@ -319,6 +319,9 @@ extends WikiPlugin_RecentChanges }; // $Log: not supported by cvs2svn $ +// Revision 1.29 2004/05/18 16:23:40 rurban +// rename split_pagename to SplitPagename +// // Revision 1.28 2004/02/17 12:11:36 rurban // added missing 4th basepage arg at plugin->run() to almost all plugins. This caused no harm so far, because it was silently dropped on normal usage. However on plugin internal ->run invocations it failed. (InterWikiSearch, IncludeSiteMap, ...) // diff --git a/lib/plugin/PrevNext.php b/lib/plugin/PrevNext.php index 98c774c81..f5a190d4f 100644 --- a/lib/plugin/PrevNext.php +++ b/lib/plugin/PrevNext.php @@ -1,5 +1,5 @@ getButtonSeparator(); + global $WikiTheme; + $sep = $WikiTheme->getButtonSeparator(); $links = HTML(); if ($style == 'text') { if (!$sep) @@ -94,14 +94,14 @@ extends WikiPlugin $url = $args[$dir]; if ($style == 'button') { // localized version: _("Previous").gif - if ($imgurl = $Theme->getButtonURL($label)) { + if ($imgurl = $WikiTheme->getButtonURL($label)) { if ($last_is_text) $links->pushContent($sep); $links->pushcontent(new ImageButton($label, $url, false, $imgurl)); $last_is_text = false; // generic version: prev.gif - } elseif ($imgurl = $Theme->getButtonURL($dir)) { + } elseif ($imgurl = $WikiTheme->getButtonURL($dir)) { if ($last_is_text) $links->pushContent($sep); $links->pushContent(new ImageButton($label, $url, @@ -129,6 +129,9 @@ extends WikiPlugin } // $Log: not supported by cvs2svn $ +// Revision 1.3 2004/02/17 12:11:36 rurban +// added missing 4th basepage arg at plugin->run() to almost all plugins. This caused no harm so far, because it was silently dropped on normal usage. However on plugin internal ->run invocations it failed. (InterWikiSearch, IncludeSiteMap, ...) +// // Revision 1.2 2003/01/18 22:01:43 carstenklapp // Code cleanup: // Reformatting & tabs to spaces; diff --git a/lib/plugin/RateIt.php b/lib/plugin/RateIt.php index 3d1c1e0a8..9c4f95186 100644 --- a/lib/plugin/RateIt.php +++ b/lib/plugin/RateIt.php @@ -1,5 +1,5 @@ _findData("images/RateItNk0.png"),0,-7); + global $WikiTheme; + $img = substr($WikiTheme->_findData("images/RateItNk0.png"),0,-7); $urlprefix = WikiURL("",0,1); $js = " function displayRating(imgPrefix, ratingvalue, pred) { @@ -167,8 +167,8 @@ function deleteRating(actionImg, page, dimension) { } function actionImgPath() { - global $Theme; - return $Theme->_findFile("images/RateItAction.png"); + global $WikiTheme; + return $WikiTheme->_findFile("images/RateItAction.png"); } /** @@ -192,14 +192,14 @@ function deleteRating(actionImg, page, dimension) { } function head() { // early side-effects (before body) - global $Theme; - $Theme->addMoreHeaders($this->RatingWidgetJavascript()); + global $WikiTheme; + $WikiTheme->addMoreHeaders($this->RatingWidgetJavascript()); } // todo: only for signed users // todo: set rating dbi for external rating database function run($dbi, $argstr, $request, $basepage) { - global $Theme; + global $WikiTheme; $this->_request = & $request; $this->_dbi = & $dbi; $user = & $request->getUser(); @@ -238,8 +238,8 @@ function deleteRating(actionImg, page, dimension) { if ($args['mode'] === 'add') { if (!$user->isSignedIn()) return $this->error(_("You must sign in")); - global $Theme; - $actionImg = $Theme->_path . $this->actionImgPath(); + global $WikiTheme; + $actionImg = $WikiTheme->_path . $this->actionImgPath(); $this->addRating($request->getArg('rating')); ob_end_clean(); // discard any previous output // delete the cache @@ -256,8 +256,8 @@ function deleteRating(actionImg, page, dimension) { } elseif ($args['mode'] === 'delete') { if (!$user->isSignedIn()) return $this->error(_("You must sign in")); - global $Theme; - $actionImg = $Theme->_path . $this->actionImgPath(); + global $WikiTheme; + $actionImg = $WikiTheme->_path . $this->actionImgPath(); $this->deleteRating(); ob_end_clean(); // discard any previous output // delete the cache @@ -273,7 +273,7 @@ function deleteRating(actionImg, page, dimension) { exit(); } elseif (! $args['show'] ) { // we must use the head method instead, because is already printed. - // $Theme->addMoreHeaders($this->RatingWidgetJavascript()); + // $WikiTheme->addMoreHeaders($this->RatingWidgetJavascript()); // or we change the header in the ob_buffer. //Todo: add a validator based on the users last rating mtime @@ -684,7 +684,7 @@ function deleteRating(actionImg, page, dimension) { * And only the widget, but no value (for buddies) also. */ function RatingWidgetHtml($args) { - global $Theme, $request; + global $WikiTheme, $request; extract($args); if (!$request->_user->isSignedIn()) return; $imgPrefix = $pagename . $imgPrefix; @@ -700,8 +700,8 @@ function deleteRating(actionImg, page, dimension) { $html = HTML::span(array("id" => $id)); for ($i=0; $i < 2; $i++) { - $nk[$i] = $Theme->_findData("images/RateItNk$i.png"); - $none[$i] = $Theme->_findData("images/RateItRk$i.png"); + $nk[$i] = $WikiTheme->_findData("images/RateItNk$i.png"); + $none[$i] = $WikiTheme->_findData("images/RateItRk$i.png"); } if (!$small) { $html->pushContent(Button(_("RateIt"),_("RateIt"), $pagename)); @@ -734,21 +734,21 @@ function deleteRating(actionImg, page, dimension) { $a0 = HTML::a(array('href' => 'javascript:click(\'' . $reActionImgName . '\',\'' . $rePagename . '\',\'' . $version . '\',\'' . $reImgPrefix . '\',\'' . $dimension . '\',\'X\')')); if ($rating) { $msg = _("Cancel rating"); - $a0->pushContent(HTML::img(array('src' => $Theme->getImageUrl("RateItCancel"), + $a0->pushContent(HTML::img(array('src' => $WikiTheme->getImageUrl("RateItCancel"), 'name'=> $imgPrefix.'Cancel', 'alt' => $msg))); $a0->addToolTip($msg); $html->pushContent($a0); } elseif ($pred) { $msg = _("No opinion"); - $html->pushContent(HTML::img(array('src' => $Theme->getImageUrl("RateItCancelN"), + $html->pushContent(HTML::img(array('src' => $WikiTheme->getImageUrl("RateItCancelN"), 'name'=> $imgPrefix.'Cancel', 'alt' => $msg))); //$a0->addToolTip($msg); //$html->pushContent($a0); } $img_attr = array(); - $img_attr['src'] = $Theme->_findData("images/RateItAction.png"); + $img_attr['src'] = $WikiTheme->_findData("images/RateItAction.png"); $img_attr['name'] = $actionImgName; //$img_attr['class'] = 'k' . $i; $img_attr['border'] = 0; @@ -767,6 +767,11 @@ function deleteRating(actionImg, page, dimension) { // $Log: not supported by cvs2svn $ +// Revision 1.8 2004/06/01 15:28:01 rurban +// AdminUser only ADMIN_USER not member of Administrators +// some RateIt improvements by dfrankow +// edit_toolbar buttons +// // Revision _1.2 2004/04/29 17:55:03 dfrankow // Check in escape() changes to protect against leading spaces in pagename. // This is untested with Reini's _("RateIt") additions to this plugin. diff --git a/lib/plugin/RecentChanges.php b/lib/plugin/RecentChanges.php index 8e1beb2a4..34cec34e6 100644 --- a/lib/plugin/RecentChanges.php +++ b/lib/plugin/RecentChanges.php @@ -1,5 +1,5 @@ getDay($rev->get('mtime')); + global $WikiTheme; + return $WikiTheme->getDay($rev->get('mtime')); } function time ($rev) { - global $Theme; - return $Theme->formatTime($rev->get('mtime')); + global $WikiTheme; + return $WikiTheme->formatTime($rev->get('mtime')); } function diffURL ($rev) { @@ -124,13 +124,13 @@ class _RecentChanges_HtmlFormatter extends _RecentChanges_Formatter { function diffLink ($rev) { - global $Theme; - return $Theme->makeButton(_("(diff)"), $this->diffURL($rev), 'wiki-rc-action'); + global $WikiTheme; + return $WikiTheme->makeButton(_("(diff)"), $this->diffURL($rev), 'wiki-rc-action'); } function historyLink ($rev) { - global $Theme; - return $Theme->makeButton(_("(hist)"), $this->historyURL($rev), 'wiki-rc-action'); + global $WikiTheme; + return $WikiTheme->makeButton(_("(hist)"), $this->historyURL($rev), 'wiki-rc-action'); } function pageLink ($rev, $link_text=false) { @@ -138,7 +138,7 @@ extends _RecentChanges_Formatter return WikiLink($rev,'auto',$link_text); /* $page = $rev->getPage(); - global $Theme; + global $WikiTheme; if ($this->include_versions_in_URLs()) { $version = $rev->getVersion(); if ($rev->isCurrent()) @@ -151,9 +151,9 @@ extends _RecentChanges_Formatter $exists = !$cur->hasDefaultContents(); } if ($exists) - return $Theme->linkExistingWikiWord($page->getName(), $link_text, $version); + return $WikiTheme->linkExistingWikiWord($page->getName(), $link_text, $version); else - return $Theme->linkUnknownWikiWord($page->getName(), $link_text); + return $WikiTheme->linkUnknownWikiWord($page->getName(), $link_text); */ } @@ -175,10 +175,10 @@ extends _RecentChanges_Formatter } function rss_icon () { - global $request, $Theme; + global $request, $WikiTheme; $rss_url = $request->getURLtoSelf(array('format' => 'rss')); - return HTML::small(array('style' => 'font-weight:normal;vertical-align:middle;'), $Theme->makeButton("RSS", $rss_url, 'rssicon')); + return HTML::small(array('style' => 'font-weight:normal;vertical-align:middle;'), $WikiTheme->makeButton("RSS", $rss_url, 'rssicon')); } function description () { @@ -284,8 +284,8 @@ extends _RecentChanges_Formatter ."}\n"; $jsf = JavaScript($addsidebarjsfunc); - global $Theme; - $sidebar_button = $Theme->makeButton("sidebar", 'javascript:addPanel();', 'sidebaricon'); + global $WikiTheme; + $sidebar_button = $WikiTheme->makeButton("sidebar", 'javascript:addPanel();', 'sidebaricon'); $addsidebarjsclick = asXML(HTML::small(array('style' => 'font-weight:normal;vertical-align:middle;'), $sidebar_button)); $jsc = JavaScript("if ((typeof window.sidebar == 'object') &&\n" ." (typeof window.sidebar.addPanel == 'function'))\n" @@ -380,8 +380,8 @@ extends _RecentChanges_HtmlFormatter } function logo () { //logo click opens the HomePage in the main browser frame - global $Theme; - $img = HTML::img(array('src' => $Theme->getImageURL('logo'), + global $WikiTheme; + $img = HTML::img(array('src' => $WikiTheme->getImageURL('logo'), 'border' => 0, 'align' => 'right', 'style' => 'height:2.5ex' @@ -452,8 +452,8 @@ extends _RecentChanges_HtmlFormatter extract($this->_args); $title = WIKI_NAME . $show_minor ? _("RecentEdits") : _("RecentChanges"); printf("" . $title . "\n"); - global $Theme; - $css = $Theme->getCSS(); + global $WikiTheme; + $css = $WikiTheme->getCSS(); $css->PrintXML(); printf("\n"); @@ -558,9 +558,9 @@ extends _RecentChanges_Formatter } function image_properties () { - global $Theme; + global $WikiTheme; - $img_url = AbsoluteURL($Theme->getImageURL('logo')); + $img_url = AbsoluteURL($WikiTheme->getImageURL('logo')); if (!$img_url) return false; @@ -658,7 +658,7 @@ extends WikiPlugin function getVersion() { return preg_replace("/[Revision: $]/", '', - "\$Revision: 1.97 $"); + "\$Revision: 1.98 $"); } function managesValidators() { @@ -741,10 +741,10 @@ extends WikiPlugin } function format ($changes, $args) { - global $Theme; + global $WikiTheme; $format = $args['format']; - $fmt_class = $Theme->getFormatter('RecentChanges', $format); + $fmt_class = $WikiTheme->getFormatter('RecentChanges', $format); if (!$fmt_class) { if ($format == 'rss') $fmt_class = '_RecentChanges_RssFormatter'; @@ -813,8 +813,8 @@ class DayButtonBar extends HtmlElement { $this->pushContent($caption, ' '); - global $Theme; - $sep = $Theme->getButtonSeparator(); + global $WikiTheme; + $sep = $WikiTheme->getButtonSeparator(); $n = 0; foreach (explode(",", $daylist) as $days) { @@ -825,7 +825,7 @@ class DayButtonBar extends HtmlElement { } function _makeDayButton ($days) { - global $Theme, $request; + global $WikiTheme, $request; if ($days == 1) $label = _("1 day"); @@ -836,11 +836,14 @@ class DayButtonBar extends HtmlElement { $url = $request->getURLtoSelf(array('action' => $request->getArg('action'), 'days' => $days)); - return $Theme->makeButton($label, $url, 'wiki-rc-action'); + return $WikiTheme->makeButton($label, $url, 'wiki-rc-action'); } } // $Log: not supported by cvs2svn $ +// Revision 1.97 2004/06/03 18:58:27 rurban +// days links requires action=RelatedChanges arg +// // Revision 1.96 2004/05/18 16:23:40 rurban // rename split_pagename to SplitPagename // diff --git a/lib/plugin/RichTable.php b/lib/plugin/RichTable.php index 0605b3ee7..a79836361 100644 --- a/lib/plugin/RichTable.php +++ b/lib/plugin/RichTable.php @@ -1,5 +1,5 @@ setAttr('class','tightenable top bottom'); $html->pushContent($pre); - $css = $GLOBALS['Theme']->_CSSlink('',empty($color) ? 'highlight.css' : "uploads/highlight-$color.css",''); + $css = $GLOBALS['WikiTheme']->_CSSlink('',empty($color) ? 'highlight.css' : "uploads/highlight-$color.css",''); return HTML($css,$html); } else { return $this->error(fmt("empty source")); @@ -180,6 +180,9 @@ extends WikiPlugin }; // $Log: not supported by cvs2svn $ +// Revision 1.4 2004/05/18 14:49:52 rurban +// Simplified strings for easier translation +// // Revision 1.3 2004/05/14 17:33:12 rurban // new plugin RecentChanges // diff --git a/lib/plugin/SystemInfo.php b/lib/plugin/SystemInfo.php index 655e5c926..a5313cc15 100644 --- a/lib/plugin/SystemInfo.php +++ b/lib/plugin/SystemInfo.php @@ -1,5 +1,5 @@ _name) - . ((THEME != $Theme->_name) + . sprintf(_("Current theme: '%s'"), $WikiTheme->_name) + . ((THEME != $WikiTheme->_name) ? ". " . sprintf(_("Default theme: '%s'"), THEME) : ''); } @@ -478,6 +478,10 @@ function stddev(&$hits, $total = false) { } // $Log: not supported by cvs2svn $ +// Revision 1.17 2004/05/08 14:06:13 rurban +// new support for inlined image attributes: [image.jpg size=50x30 align=right] +// minor stability and portability fixes +// // Revision 1.16 2004/05/06 20:30:47 rurban // revert and removed some comments // diff --git a/lib/plugin/Transclude.php b/lib/plugin/Transclude.php index 8fd5804da..bcc3080e2 100644 --- a/lib/plugin/Transclude.php +++ b/lib/plugin/Transclude.php @@ -1,5 +1,5 @@ getArgs($argstr, $request)); extract($args); @@ -149,6 +149,9 @@ extends WikiPlugin }; // $Log: not supported by cvs2svn $ +// Revision 1.8 2004/02/17 12:11:36 rurban +// added missing 4th basepage arg at plugin->run() to almost all plugins. This caused no harm so far, because it was silently dropped on normal usage. However on plugin internal ->run invocations it failed. (InterWikiSearch, IncludeSiteMap, ...) +// // Revision 1.7 2003/02/27 22:47:27 dairiki // New functions in HtmlElement: // diff --git a/lib/plugin/UpLoad.php b/lib/plugin/UpLoad.php index b9bb8b785..04fe17331 100644 --- a/lib/plugin/UpLoad.php +++ b/lib/plugin/UpLoad.php @@ -1,5 +1,5 @@ _user; if (!is_writable($upload_log)) { $message->pushContent(_("Error: the upload log is not writable")); @@ -219,7 +219,7 @@ ws[cfh]"); "\n" . "$userfile_name" . "$file_size kB" - . "  " . $Theme->formatDate(time()) . "" + . "  " . $WikiTheme->formatDate(time()) . "" . "  " . $user->getId() . ""); fclose($log_handle); } @@ -229,6 +229,10 @@ ws[cfh]"); } // $Log: not supported by cvs2svn $ +// Revision 1.12 2004/06/13 11:34:22 rurban +// fixed bug #969532 (space in uploaded filenames) +// improved upload error messages +// // Revision 1.11 2004/06/11 09:07:30 rurban // support theme-specific LinkIconAttr: front or after or none // diff --git a/lib/plugin/WhoIsOnline.php b/lib/plugin/WhoIsOnline.php index 058061378..df6a7c51d 100644 --- a/lib/plugin/WhoIsOnline.php +++ b/lib/plugin/WhoIsOnline.php @@ -1,5 +1,5 @@ setArg('nocache',1); $args = $this->getArgs($argstr, $request); // use the "online.tmpl" template // todo: check which arguments are really needed in the template. $stats = $this->getStats($dbi,$request,$args['mode']); - if ($src = $Theme->getImageURL("whosonline")) + if ($src = $WikiTheme->getImageURL("whosonline")) $img = HTML::img(array('src' => $src, 'alt' => $this->getName(), 'border' => 0)); @@ -194,6 +194,15 @@ extends WikiPlugin }; // $Log: not supported by cvs2svn $ +// Revision 1.7 2004/05/27 17:49:06 rurban +// renamed DB_Session to DbSession (in CVS also) +// added WikiDB->getParam and WikiDB->getAuthParam method to get rid of globals +// remove leading slash in error message +// added force_unlock parameter to File_Passwd (no return on stale locks) +// fixed adodb session AffectedRows +// added FileFinder helpers to unify local filenames and DATA_PATH names +// editpage.php: new edit toolbar javascript on ENABLE_EDIT_TOOLBAR +// // Revision 1.6 2004/05/02 15:10:08 rurban // new finally reliable way to detect if /index.php is called directly // and if to include lib/main.php diff --git a/lib/plugin/WikiAdminChmod.php b/lib/plugin/WikiAdminChmod.php index 6c34dd50d..27cec3ce7 100644 --- a/lib/plugin/WikiAdminChmod.php +++ b/lib/plugin/WikiAdminChmod.php @@ -1,5 +1,5 @@ false, - 'perm' => false, - /* select pages by meta-data: */ - 'author' => false, - 'owner' => false, - 'creator' => false, - /* Pages to exclude in listing */ - 'exclude' => '', - /* Columns to include in listing */ - 'info' => 'pagename,perm,mtime,author', - /* How to sort */ - 'sortby' => 'pagename', - 'limit' => 0, - ); + return array_merge + ( + PageList::supportedArgs(), + array( + 's' => false, + 'perm' => false, + /* Columns to include in listing */ + 'info' => 'pagename,perm,mtime,author', + )); } // todo: change permstring to some kind of default ACL hash. @@ -149,7 +143,7 @@ extends WikiPlugin_WikiAdminSelect if ($next_action == 'verify') { $args['info'] = "checkbox,pagename,perm,author,mtime"; } - $pagelist = new PageList_Selectable($args['info'], $exclude); + $pagelist = new PageList_Selectable($args['info'], $exclude, $args); $pagelist->addPageList($pages); $header = HTML::p(); @@ -207,6 +201,10 @@ extends WikiPlugin_WikiAdminSelect } // $Log: not supported by cvs2svn $ +// Revision 1.9 2004/06/13 15:33:20 rurban +// new support for arguments owner, author, creator in most relevant +// PageList plugins. in WikiAdmin* via preSelectS() +// // Revision 1.8 2004/06/04 20:32:54 rurban // Several locale related improvements suggested by Pierrick Meignen // LDAP fix by John Cole diff --git a/lib/plugin/WikiAdminChown.php b/lib/plugin/WikiAdminChown.php index 1cb4e3189..53207b0fb 100644 --- a/lib/plugin/WikiAdminChown.php +++ b/lib/plugin/WikiAdminChown.php @@ -1,5 +1,5 @@ false, - 'user' => false, - /* select pages by meta-data: */ - 'author' => false, - 'owner' => false, - 'creator' => false, - /* Pages to exclude in listing */ - 'exclude' => '', - /* Columns to include in listing */ - 'info' => 'pagename,owner,mtime', - /* How to sort */ - 'sortby' => 'pagename', - 'limit' => 0, - ); + return array_merge + ( + PageList::supportedArgs(), + array( + 's' => false, + 'user' => false, + /* Columns to include in listing */ + 'info' => 'pagename,owner,mtime', + )); } function chownPages(&$dbi, &$request, $pages, $newowner) { @@ -150,7 +144,7 @@ extends WikiPlugin_WikiAdminSelect $args['info'] = "checkbox,pagename,owner,mtime"; } */ - $pagelist = new PageList_Selectable($args['info'], $exclude); + $pagelist = new PageList_Selectable($args['info'], $exclude, $args); $pagelist->addPageList($pages); $header = HTML::p(); @@ -195,6 +189,10 @@ extends WikiPlugin_WikiAdminSelect } // $Log: not supported by cvs2svn $ +// Revision 1.4 2004/06/13 15:33:20 rurban +// new support for arguments owner, author, creator in most relevant +// PageList plugins. in WikiAdmin* via preSelectS() +// // Revision 1.3 2004/06/08 10:05:11 rurban // simplified admin action shortcuts // diff --git a/lib/plugin/WikiAdminRemove.php b/lib/plugin/WikiAdminRemove.php index 1585db3b5..c77b64960 100644 --- a/lib/plugin/WikiAdminRemove.php +++ b/lib/plugin/WikiAdminRemove.php @@ -1,5 +1,5 @@ false, - /* select pages by meta-data: */ - 'author' => false, - 'owner' => false, - 'creator' => false, + return array_merge + ( + PageList::supportedArgs(), + array( + 's' => false, /* * Show only pages which have been 'deleted' this * long (in days). (negative or non-numeric @@ -72,17 +71,9 @@ extends WikiPlugin_WikiAdminSelect * FIXME: could use a better name. */ 'max_age' => 31, - - /* Pages or regex to exclude */ - 'exclude' => '', - /* Columns to include in listing */ 'info' => 'most', - - /* How to sort */ - 'sortby' => 'pagename', - 'limit' => 0 - ); + )); } function collectPages(&$list, &$dbi, $sortby, $limit=0) { @@ -249,6 +240,10 @@ class _PageList_Column_remove extends _PageList_Column { // $Log: not supported by cvs2svn $ +// Revision 1.25 2004/06/13 15:33:20 rurban +// new support for arguments owner, author, creator in most relevant +// PageList plugins. in WikiAdmin* via preSelectS() +// // Revision 1.24 2004/06/08 10:05:11 rurban // simplified admin action shortcuts // diff --git a/lib/plugin/WikiAdminRename.php b/lib/plugin/WikiAdminRename.php index 35d08d890..0cdb7a476 100644 --- a/lib/plugin/WikiAdminRename.php +++ b/lib/plugin/WikiAdminRename.php @@ -1,5 +1,5 @@ false, - /* select pages by meta-data: */ - 'author' => false, - 'owner' => false, - 'creator' => false, - /* Pages to exclude in listing */ - 'exclude' => '', /* Columns to include in listing */ 'info' => 'pagename,mtime', - /* How to sort */ - 'sortby' => 'pagename', - 'limit' => 0, - 'updatelinks' => 0 // not yet working - ); + 'updatelinks' => 0 + )); } //TODO: regex and case-inexact option @@ -257,6 +251,10 @@ class _PageList_Column_renamed_pagename extends _PageList_Column { }; // $Log: not supported by cvs2svn $ +// Revision 1.18 2004/06/13 15:33:20 rurban +// new support for arguments owner, author, creator in most relevant +// PageList plugins. in WikiAdmin* via preSelectS() +// // Revision 1.17 2004/06/08 10:05:12 rurban // simplified admin action shortcuts // diff --git a/lib/plugin/WikiAdminSearchReplace.php b/lib/plugin/WikiAdminSearchReplace.php index e790a62ac..57cfe5443 100644 --- a/lib/plugin/WikiAdminSearchReplace.php +++ b/lib/plugin/WikiAdminSearchReplace.php @@ -1,5 +1,5 @@ false, - /* select pages by meta-data: */ - 'author' => false, - 'owner' => false, - 'creator' => false, - /* Pages to exclude */ - 'exclude' => '.', - /* Columns to include in listing */ - 'info' => 'some', - /* How to sort */ - 'sortby' => 'pagename', - 'limit' => 0, - ); + return array_merge + ( + PageList::supportedArgs(), + array( + 's' => false, + /* Columns to include in listing */ + 'info' => 'some', + )); } - function replaceHelper(&$dbi, $pagename, $from, $to, $caseexact = true) { + function replaceHelper(&$dbi, $pagename, $from, $to, $caseexact = true, $regex = false) { $page = $dbi->getPage($pagename); if ($page->exists()) {// don't replace default contents $current = $page->getCurrentRevision(); $version = $current->getVersion(); $text = $current->getPackedContent(); - if ($caseexact) { - $newtext = str_replace($from, $to, $text); + if ($regex) { + $newtext = preg_replace("/".$from."/".($caseexact?'':'i'), $to, $text); } else { - //not all PHP have this enabled. use a workaround - if (function_exists('str_ireplace')) - $newtext = str_ireplace($from, $to, $text); - else { // see eof - $newtext = stri_replace($from, $to, $text); + if ($caseexact) { + $newtext = str_replace($from, $to, $text); + } else { + //not all PHP have this enabled. use a workaround + if (function_exists('str_ireplace')) + $newtext = str_ireplace($from, $to, $text); + else { // see eof + $newtext = stri_replace($from, $to, $text); + } } } if ($text != $newtext) { @@ -94,14 +92,16 @@ extends WikiPlugin_WikiAdminSelect $count = 0; $post_args = $request->getArg('admin_replace'); $caseexact = !empty($post_args['caseexact']); + $regex = !empty($post_args['regex']); foreach ($pages as $pagename) { if (!mayAccessPage('edit',$pagename)) { $ul->pushContent(HTML::li(fmt("Access denied to change page '%s'.",$pagename))); - } elseif (($result = $this->replaceHelper(&$dbi,$pagename,$from,$to,$caseexact))) { + } elseif (($result = $this->replaceHelper(&$dbi, $pagename, $from, $to, $caseexact, $regex))) { $ul->pushContent(HTML::li(fmt("Replaced '%s' with '%s' in page '%s'.", $from, $to, WikiLink($pagename)))); $count++; } else { - $ul->pushContent(HTML::li(fmt("Search string '%s' not found in content of page '%s'.", $from, WikiLink($pagename)))); + $ul->pushContent(HTML::li(fmt("Search string '%s' not found in content of page '%s'.", + $from, WikiLink($pagename)))); } } if ($count) { @@ -164,9 +164,13 @@ extends WikiPlugin_WikiAdminSelect $args['info'] = "checkbox,pagename,hi_content"; } $pagelist = new PageList_Selectable($args['info'], $exclude, - array('types' => array( - 'hi_content' // with highlighted search for SearchReplace - => new _PageList_Column_content('rev:hi_content', _("Content"))))); + array_merge + ( + $args, + array('types' => array + ( + 'hi_content' // with highlighted search for SearchReplace + => new _PageList_Column_content('rev:hi_content', _("Content")))))); $pagelist->addPageList($pages); @@ -206,19 +210,29 @@ extends WikiPlugin_WikiAdminSelect } function replaceForm(&$header, $post_args) { + $header->pushContent(HTML::div(array('class'=>'hint'), + _("Replace all occurences of the given string in the content of all pages.")), + HTML::br()); $header->pushContent(_("Replace: ")); $header->pushContent(HTML::input(array('name' => 'admin_replace[from]', 'value' => $post_args['from']))); $header->pushContent(' '._("by").': '); $header->pushContent(HTML::input(array('name' => 'admin_replace[to]', 'value' => $post_args['to']))); - $header->pushContent(' '._("(no regex) Case-exact: ")); $checkbox = HTML::input(array('type' => 'checkbox', 'name' => 'admin_replace[caseexact]', 'value' => 1)); if (!empty($post_args['caseexact'])) $checkbox->setAttr('checked','checked'); - $header->pushContent($checkbox); + $header->pushContent(HTML::br(),$checkbox," ",_("case-exact")); + $checkbox_re = HTML::input(array('type' => 'checkbox', + 'name' => 'admin_replace[regex]', + //'disabled' => 'disabled', + 'value' => 1)); + if (!empty($post_args['regex'])) + $checkbox_re->setAttr('checked','checked'); + $header->pushContent(HTML::br(),HTML::span(//array('style'=>'color: #aaa'), + $checkbox_re," ",_("regex"))); $header->pushContent(HTML::br()); return $header; } @@ -252,6 +266,10 @@ function stri_replace($find,$replace,$string) { } // $Log: not supported by cvs2svn $ +// Revision 1.14 2004/06/13 15:33:20 rurban +// new support for arguments owner, author, creator in most relevant +// PageList plugins. in WikiAdmin* via preSelectS() +// // Revision 1.13 2004/06/13 14:30:26 rurban // security fix: check permissions in SearchReplace // diff --git a/lib/plugin/WikiAdminSelect.php b/lib/plugin/WikiAdminSelect.php index f21e900c0..9d2844d77 100644 --- a/lib/plugin/WikiAdminSelect.php +++ b/lib/plugin/WikiAdminSelect.php @@ -1,5 +1,5 @@ * Author: Reini Urban * + * This is the base class for most WikiAdmin* classes, using + * collectPages() and preSelectS(). * "list" PagePermissions supported implicitly by PageList. - * Just a framework, nothing more. */ -// maybe display more attributes with this class... require_once('lib/PageList.php'); class WikiPlugin_WikiAdminSelect @@ -46,7 +46,7 @@ extends WikiPlugin function getVersion() { return preg_replace("/[Revision: $]/", '', - "\$Revision: 1.16 $"); + "\$Revision: 1.17 $"); } function getDefaultArguments() { @@ -64,6 +64,10 @@ extends WikiPlugin 'debug' => false); } + /** + * Default collector for all WikiAdmin* plugins. + * preSelectS() is similar, but fills $this->_list + */ function collectPages(&$list, &$dbi, $sortby, $limit=0) { $allPages = $dbi->getAllPages(0,$sortby,$limit); while ($pagehandle = $allPages->next()) { @@ -75,9 +79,11 @@ extends WikiPlugin } /** - * Preselect a list of pagenames by: - * s: comma-seperated list of pagename wildcards - * author, owner, creator + * Preselect a list of pagenames by the supporting the follwing args: + * 's': comma-seperated list of pagename wildcards + * 'author', 'owner', 'creator': from WikiDB_Page + * 'only: forgot what the diffrrence to 's' was. + * Sets $this->_list, which is picked up by collectPages() and is a default for p[] */ function preSelectS (&$args, &$request) { // override plugin argument by GET: probably not needed if s||="" is used @@ -95,7 +101,7 @@ extends WikiPlugin $sl = explodePageList(empty($args['only']) ? $args['s'] : $args['only']); } $this->_list = array(); - if ($sl) { + if (!empty($sl)) { $request->setArg('verify', 1); if (!empty($args['exclude'])) $exclude = explodePageList($args['exclude']); @@ -212,7 +218,7 @@ extends WikiPlugin 'wikiadmin'), Button('submit:cancel', _("Cancel"), 'button')); } else { - global $Theme; + global $WikiTheme; $form->pushContent(HTML::input(array('type' => 'hidden', 'name' => 'action', 'value' => 'WikiAdminSelect')) @@ -228,7 +234,7 @@ extends WikiPlugin $s = preg_replace('/^WikiAdmin/','', $f); if (!in_array($s,array("Select","Utils"))) { // disable Select and Utils $form->pushContent(Button("submit:wikiadmin[$f]", _($s), "wikiadmin")); - $form->pushContent($Theme->getButtonSeparator()); + $form->pushContent($WikiTheme->getButtonSeparator()); } } $form->pushContent(Button('submit:cancel', _("Cancel"), 'button')); @@ -242,6 +248,10 @@ extends WikiPlugin } // $Log: not supported by cvs2svn $ +// Revision 1.16 2004/06/13 15:33:20 rurban +// new support for arguments owner, author, creator in most relevant +// PageList plugins. in WikiAdmin* via preSelectS() +// // Revision 1.15 2004/06/01 15:28:01 rurban // AdminUser only ADMIN_USER not member of Administrators // some RateIt improvements by dfrankow diff --git a/lib/plugin/WikiAdminSetAcl.php b/lib/plugin/WikiAdminSetAcl.php index 98da0564c..d8cf7cbb7 100644 --- a/lib/plugin/WikiAdminSetAcl.php +++ b/lib/plugin/WikiAdminSetAcl.php @@ -1,5 +1,5 @@ "[]", // list of pages 's' => false, /* select by pagename */ - /* select pages by meta-data: */ - 'author' => false, - 'owner' => false, - 'creator' => false, - /* Pages to exclude in listing */ - 'exclude' => '', /* Columns to include in listing */ 'info' => 'pagename,perm,mtime,owner,author', - /* How to sort */ - 'sortby' => 'pagename', - 'limit' => 0, - ); + )); } function setaclPages(&$request, $pages, $acl) { @@ -300,6 +294,10 @@ class _PageList_Column_perm extends _PageList_Column { }; // $Log: not supported by cvs2svn $ +// Revision 1.17 2004/06/13 15:33:20 rurban +// new support for arguments owner, author, creator in most relevant +// PageList plugins. in WikiAdmin* via preSelectS() +// // Revision 1.16 2004/06/08 13:50:43 rurban // show getfacl and acl line // diff --git a/lib/plugin/WikiForum.php b/lib/plugin/WikiForum.php index 41c214b66..c7b6a59af 100644 --- a/lib/plugin/WikiForum.php +++ b/lib/plugin/WikiForum.php @@ -1,5 +1,5 @@ getDbh(); $topics = $this->findBlogs($dbi, $args['pagename'], 'wikiforum'); @@ -127,7 +127,7 @@ extends WikiPlugin_WikiBlog // format as list, not as wikiforum content $page = new WikiPageName($rev,$args['pagename']); $row = HTML::tr(HTML::td(WikiLink($page,'if_known',$rev->get('summary'))), - HTML::td($Theme->formatDateTime($meta['ctime'])), + HTML::td($WikiTheme->formatDateTime($meta['ctime'])), HTML::td(WikiLink($meta['creator'],'if_known'))); $html->pushContent($row); } @@ -136,6 +136,12 @@ extends WikiPlugin_WikiBlog }; // $Log: not supported by cvs2svn $ +// Revision 1.2 2004/04/19 18:27:46 rurban +// Prevent from some PHP5 warnings (ref args, no :: object init) +// php5 runs now through, just one wrong XmlElement object init missing +// Removed unneccesary UpgradeUser lines +// Changed WikiLink to omit version if current (RecentChanges) +// // Revision 1.1 2004/04/18 05:43:12 rurban // . // diff --git a/lib/plugin/WikiPoll.php b/lib/plugin/WikiPoll.php index ef8935bfa..e745a8430 100644 --- a/lib/plugin/WikiPoll.php +++ b/lib/plugin/WikiPoll.php @@ -1,5 +1,5 @@ $Theme->getImageUrl('leftbar'), + global $WikiTheme; + return HTML(HTML::img(array('src' => $WikiTheme->getImageUrl('leftbar'), 'alt' => '<')), - HTML::img(array('src' => $Theme->getImageUrl('mainbar'), + HTML::img(array('src' => $WikiTheme->getImageUrl('mainbar'), 'alt' => '-', 'width' => sprintf("%02d",$percent), 'height' => 14)), - HTML::img(array('src' => $Theme->getImageUrl('rightbar'), + HTML::img(array('src' => $WikiTheme->getImageUrl('rightbar'), 'alt' => '>'))); } @@ -330,6 +330,9 @@ extends WikiPlugin }; // $Log: not supported by cvs2svn $ +// Revision 1.7 2004/05/01 15:59:29 rurban +// more php-4.0.6 compatibility: superglobals +// // Revision 1.6 2004/03/01 18:08:53 rurban // oops, checked in the debug version. revert to IP check on // diff --git a/lib/plugin/_WikiTranslation.php b/lib/plugin/_WikiTranslation.php index 7da725577..628fedf74 100644 --- a/lib/plugin/_WikiTranslation.php +++ b/lib/plugin/_WikiTranslation.php @@ -1,5 +1,5 @@ _plugin->translate($text, 'en', $this->_from_lang)) )) { - global $Theme; - $link = $Theme->linkUnknownWikiWord($trans); + global $WikiTheme; + $link = $WikiTheme->linkUnknownWikiWord($trans); if (!($this->_noT or $this->_nolinks) and $this->dbi->isWikiPage($trans)) { $url = WikiURL($trans, array('action' => 'TranslateText','lang' => $this->_field)); - $button = $Theme->makeButton('T', $url); + $button = $WikiTheme->makeButton('T', $url); $button->addTooltip(sprintf(_("Define the translation for %s in %s"), $trans, $this->_field)); $link = HTML::span($button); $link->setAttr('class', 'wikiunknown'); - $text = HTML::span($Theme->maybeSplitWikiWord($trans)); + $text = HTML::span($WikiTheme->maybeSplitWikiWord($trans)); $text->setAttr('style', 'text-decoration:line-through'); $link->pushContent($text); return $link; @@ -395,6 +403,12 @@ class _PageList_Column_custom extends _PageList_Column { } // $Log: not supported by cvs2svn $ +// Revision 1.10 2004/05/03 21:57:47 rurban +// locale updates: we previously lost some words because of wrong strings in +// PhotoAlbum, german rewording. +// fixed $_SESSION registering (lost session vars, esp. prefs) +// fixed ending slash in listAvailableLanguages/Themes +// // Revision 1.9 2004/05/03 20:44:58 rurban // fixed gettext strings // new SqlResult plugin diff --git a/lib/removepage.php b/lib/removepage.php index 113c19b41..ff834887d 100644 --- a/lib/removepage.php +++ b/lib/removepage.php @@ -1,9 +1,9 @@ getPage(); $pagelink = WikiLink($page); @@ -31,7 +31,7 @@ function RemovePage (&$request) { HTML::div(array('class' => 'toolbar'), $removeB, - $Theme->getButtonSeparator(), + $WikiTheme->getButtonSeparator(), $cancelB))); } elseif ($request->getArg('currentversion') != $version) { diff --git a/lib/stdlib.php b/lib/stdlib.php index d40514a1a..d3c1a7b84 100644 --- a/lib/stdlib.php +++ b/lib/stdlib.php @@ -1,4 +1,4 @@ -getLinkIconURL($proto); + $src = $WikiTheme->getLinkIconURL($proto); if ($src) return HTML::img(array('src' => $src, 'alt' => "", 'class' => 'linkicon', 'border' => 0)); else @@ -205,13 +205,13 @@ function IconForLink($protocol_or_url) { * @return XmlContent. */ function PossiblyGlueIconToText($proto_or_url, $text) { - global $request, $Theme; + global $request, $WikiTheme; if ($request->getPref('noLinkIcons')) return $text; $icon = IconForLink($proto_or_url); if (!$icon) return $text; - if ($where = $Theme->getLinkIconAttr()) { + if ($where = $WikiTheme->getLinkIconAttr()) { if ($where == 'no') return $text; if ($where != 'after') $where = 'front'; } else { @@ -450,8 +450,8 @@ function LinkPhpwikiURL($url, $text = '', $basepage) { $wikipage = new WikiPageName($pagename); if (!$wikipage->isValid()) { - global $Theme; - return $Theme->linkBadWikiWord($wikipage, $url); + global $WikiTheme; + return $WikiTheme->linkBadWikiWord($wikipage, $url); } return HTML::a(array('href' => WikiURL($pagename, $args), @@ -1452,10 +1452,10 @@ class Alert { if (!$buttons) $buttons = array(_("Okay") => $request->getURLtoSelf()); - global $Theme; + global $WikiTheme; foreach ($buttons as $label => $url) print "$label $url\n"; - $out[] = $Theme->makeButton($label, $url, 'wikiaction'); + $out[] = $WikiTheme->makeButton($label, $url, 'wikiaction'); return new XmlContent($out); } } @@ -1594,6 +1594,13 @@ function url_get_contents( $uri ) { // $Log: not supported by cvs2svn $ +// Revision 1.186 2004/06/13 13:54:25 rurban +// Catch fatals on the four dump calls (as file and zip, as html and mimified) +// FoafViewer: Check against external requirements, instead of fatal. +// Change output for xhtmldumps: using file:// urls to the local fs. +// Catch SOAP fatal by checking for GOOGLE_LICENSE_KEY +// Import GOOGLE_LICENSE_KEY and FORTUNE_DIR from config.ini. +// // Revision 1.185 2004/06/11 09:07:30 rurban // support theme-specific LinkIconAttr: front or after or none // -- 2.45.0