From 5f61e34447dce6ca9fc69420090dd5d1013a4ab5 Mon Sep 17 00:00:00 2001 From: vargenau Date: Wed, 11 Aug 2010 13:00:46 +0000 Subject: [PATCH] Harmonize header git-svn-id: svn://svn.code.sf.net/p/phpwiki/code/trunk@7641 96ab9672-09ca-45d6-a79d-3d69d39ca109 --- lib/DbSession/ADODB.php | 64 ++++----- lib/HtmlParser.php | 34 ++--- lib/PageType.php | 82 ++++++------ lib/RssParser.php | 30 ++--- lib/SemanticWeb.php | 36 +++--- lib/WikiDB/backend/ADODB.php | 91 +++++++------ lib/WikiDB/backend/PDO.php | 80 ++++++------ lib/WikiDB/backend/PDO_mysql.php | 38 +++--- lib/WikiDB/backend/PDO_oci8.php | 40 +++--- lib/WikiDB/backend/PDO_pgsql.php | 38 +++--- lib/WikiDB/backend/dumb/LinkSearchIter.php | 34 ++--- lib/WikiDB/backend/file.php | 60 ++++----- lib/WikiDB/backend/flatfile.php | 46 +++---- lib/WikiDB/file.php | 36 +++--- lib/WikiDB/flatfile.php | 39 +++--- lib/XmlParser.php | 32 ++--- lib/install.php | 34 ++--- lib/loadsave.php | 38 +++--- lib/wikilens/PageListColumns.php | 144 ++++++++++----------- lib/wikilens/Utils.php | 50 +++---- 20 files changed, 521 insertions(+), 525 deletions(-) diff --git a/lib/DbSession/ADODB.php b/lib/DbSession/ADODB.php index 8a8851a19..b1497e4b8 100644 --- a/lib/DbSession/ADODB.php +++ b/lib/DbSession/ADODB.php @@ -1,25 +1,25 @@ _connectionID)) { if (!$parsed) $parsed = parseDSN($request->_dbi->getParam('dsn')); $this->_dbh =& ADONewConnection($parsed['phptype']); // Probably only MySql works just now - $this->_dbh->Connect($parsed['hostspec'],$parsed['username'], + $this->_dbh->Connect($parsed['hostspec'],$parsed['username'], $parsed['password'], $parsed['database']); - $dbh = &$this->_dbh; + $dbh = &$this->_dbh; } return $dbh; } - + function query($sql) { return $this->_dbh->Execute($sql); } @@ -78,7 +78,7 @@ extends DbSession * Actually this function is a fake for session_set_save_handle. * @param string $save_path a path to stored files * @param string $session_name a name of the concrete file - * @return boolean true just a variable to notify PHP that everything + * @return boolean true just a variable to notify PHP that everything * is good. * @access private */ @@ -92,7 +92,7 @@ extends DbSession * * This function is called just after write call. * - * @return boolean true just a variable to notify PHP that everything + * @return boolean true just a variable to notify PHP that everything * is good. * @access private */ @@ -129,11 +129,11 @@ extends DbSession } return $res; } - + /** * Saves the session data into DB. * - * Just a comment: The "write" handler is not + * Just a comment: The "write" handler is not * executed until after the output stream is closed. Thus, * output from debugging statements in the "write" handler * will never be seen in the browser. If debugging output @@ -147,8 +147,8 @@ extends DbSession * @access private */ function write ($id, $sess_data) { - if (defined("WIKI_XMLRPC") or defined("WIKI_SOAP")) return; - + if (defined("WIKI_XMLRPC") or defined("WIKI_SOAP")) return; + $dbh = $this->_connect(); $table = $this->_table; $qid = $dbh->qstr($id); @@ -181,7 +181,7 @@ extends DbSession } } $result = ! $rs->EOF; - if ($result) $rs->free(); + if ($result) $rs->free(); $this->_disconnect(); return $result; } @@ -192,7 +192,7 @@ extends DbSession * Removes a session from the table. * * @param string $id - * @return boolean true + * @return boolean true * @access private */ function destroy ($id) { @@ -203,7 +203,7 @@ extends DbSession $dbh->Execute("DELETE FROM $table WHERE sess_id=$qid"); $this->_disconnect(); - return true; + return true; } /** @@ -224,7 +224,7 @@ extends DbSession return true; } - // WhoIsOnline support. + // WhoIsOnline support. // TODO: ip-accesstime dynamic blocking API function currentSessions() { $sessions = array(); diff --git a/lib/HtmlParser.php b/lib/HtmlParser.php index d631513f5..da597698d 100644 --- a/lib/HtmlParser.php +++ b/lib/HtmlParser.php @@ -6,23 +6,23 @@ */ /* - Copyright (C) 2004 Reini Urban - - This file is part of PhpWiki. - - PhpWiki is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - PhpWiki is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with PhpWiki; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Copyright (C) 2004 Reini Urban + * + * This file is part of PhpWiki. + * + * PhpWiki is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * PhpWiki is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with PhpWiki; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /** diff --git a/lib/PageType.php b/lib/PageType.php index 0e48e84a9..ffec92211 100644 --- a/lib/PageType.php +++ b/lib/PageType.php @@ -1,23 +1,23 @@ _getMapFromWikiText($pagetext); @@ -171,7 +171,7 @@ class PageType_interwikimap extends PageType function link ($link, $linktext = false) { global $WikiTheme; list ($moniker, $page) = explode (":", $link, 2); - + if (!isset($this->_map[$moniker])) { return HTML::span(array('class' => 'bad-interwiki'), $linktext ? $linktext : $link); @@ -198,7 +198,7 @@ class PageType_interwikimap extends PageType $link_prefix = NormalizeWebFileName(substr($url, strlen($wikiroot))); } } - + // Urlencode page only if it's a query arg. // FIXME: this is a somewhat broken heuristic. if ($moniker == 'Upload') { @@ -223,7 +223,7 @@ class PageType_interwikimap extends PageType $link->pushContent(PossiblyGlueIconToText('interwiki', $linktext)); $link->setAttr('class', 'named-interwiki'); } - + return $link; } @@ -240,13 +240,13 @@ class PageType_interwikimap extends PageType // Add virtual monikers: "Upload:" "Talk:" "User:", ":" // and expand special variables %u, %b, %d - // Upload: Should be expanded later to user-specific upload dirs. + // Upload: Should be expanded later to user-specific upload dirs. // In the Upload plugin, not here: Upload:ReiniUrban/uploaded-file.png if (empty($map['Upload'])) { $map['Upload'] = getUploadDataPath(); } // User:ReiniUrban => ReiniUrban or Users/ReiniUrban - // Can be easily overriden by a customized InterWikiMap: + // Can be easily overriden by a customized InterWikiMap: // User Users/%s if (empty($map["User"])) { $map["User"] = "%s"; @@ -270,15 +270,15 @@ class PageType_interwikimap extends PageType // %s is expanded later to the pagename if (strstr($map[$special], '%u')) $map[$special] = str_replace($map[$special], - '%u', + '%u', $GLOBALS['request']->_user->_userid); if (strstr($map[$special], '%b')) $map[$special] = str_replace($map[$special], - '%b', + '%b', PHPWIKI_BASE_URL); if (strstr($map[$special], '%d')) $map[$special] = str_replace($map[$special], - '%d', + '%d', // such as 2003-01-11T14:03:02+00:00 Iso8601DateTime()); } @@ -295,7 +295,7 @@ class PageType_interwikimap extends PageType function _getMapFromFile ($filename) { if (defined('WARN_NONPUBLIC_INTERWIKIMAP') and WARN_NONPUBLIC_INTERWIKIMAP) { - $error_html = sprintf(_("Loading InterWikiMap from external file %s."), + $error_html = sprintf(_("Loading InterWikiMap from external file %s."), $filename); trigger_error( $error_html, E_USER_NOTICE ); } @@ -313,7 +313,7 @@ class PageType_interwikimap extends PageType function _getRegexp () { if (!$this->_map) return '(?:(?!a)a)'; // Never matches. - + foreach (array_keys($this->_map) as $moniker) $qkeys[] = preg_quote($moniker, '/'); return "(?:" . join("|", $qkeys) . ")"; @@ -335,7 +335,7 @@ class PageFormatter { if (!empty($meta['markup'])) $this->_markup = $meta['markup']; else - $this->_markup = 2; // dump used old-markup as empty. + $this->_markup = 2; // dump used old-markup as empty. // FIXME: To be able to restore old plain-backups we should keep markup 1 as default. // New policy: default = new markup (old crashes quite often) } @@ -355,7 +355,7 @@ class PageFormatter { } } -class PageFormatter_wikitext extends PageFormatter +class PageFormatter_wikitext extends PageFormatter { function format(&$text) { return HTML::div(array('class' => 'wikitext'), @@ -379,12 +379,12 @@ class PageFormatter_interwikimap extends PageFormatter function _getFooter($text) { return preg_replace('@.*?(|\Z)@s', '', $text, 1); } - + function _getMap($pagetext) { $map = getInterwikiMap($pagetext, 'force'); return $map->_map; } - + function _formatMap($pagetext) { $map = $this->_getMap($pagetext); if (!$map) @@ -392,14 +392,14 @@ class PageFormatter_interwikimap extends PageFormatter $mon_attr = array('class' => 'interwiki-moniker'); $url_attr = array('class' => 'interwiki-url'); - + $thead = HTML::thead(HTML::tr(HTML::th($mon_attr, _("Moniker")), HTML::th($url_attr, _("InterWiki Address")))); foreach ($map as $moniker => $interurl) { $rows[] = HTML::tr(HTML::td($mon_attr, new Cached_WikiLinkIfKnown($moniker)), HTML::td($url_attr, HTML::tt($interurl))); } - + return HTML::table(array('class' => 'interwiki-map'), $thead, HTML::tbody(false, $rows)); @@ -422,7 +422,7 @@ class FakePageRevision { class PageFormatter_attach extends PageFormatter { var $type, $prefix; - + // Display templated contents for wikiblog, comment and wikiforum function format($text) { if (empty($this->type)) @@ -439,7 +439,7 @@ class PageFormatter_attach extends PageFormatter $meta = $this->_meta[$this->type]; foreach(array('ctime', 'creator', 'creator_id') as $key) $tokens[$this->prefix . "_" . strtoupper($key)] = $meta[$key]; - + return new Template($this->type, $request, $tokens); } } @@ -454,12 +454,12 @@ class PageFormatter_wikiforum extends PageFormatter_attach { var $type = 'wikiforum', $prefix = "FORUM"; } -/** wikiabuse for htmlarea editing. not yet used. +/** wikiabuse for htmlarea editing. not yet used. * * Warning! Once a page is edited with a htmlarea like control it is * stored in HTML and cannot be converted back to WikiText as long as - * we have no HTML => WikiText or any other interim format (WikiExchangeFormat e.g. XML) - * converter. See lib/HtmlParser.php for ongoing work on that. + * we have no HTML => WikiText or any other interim format (WikiExchangeFormat e.g. XML) + * converter. See lib/HtmlParser.php for ongoing work on that. * So it has a viral effect and certain plugins will not work anymore. * But a lot of wikiusers seem to like it. */ @@ -497,7 +497,7 @@ class PageFormatter_pdf extends PageFormatter // We can make use of several pdf extensions. This one - fpdf // - is pure php and very easy, but looks quite ugly and has a - // terrible interface, as terrible as most of the othes. + // terrible interface, as terrible as most of the othes. // The closest to HTML is htmldoc which needs an external cgi // binary. // We use a custom HTML->PDF class converter from PHPWebthings diff --git a/lib/RssParser.php b/lib/RssParser.php index ee02e1a2d..8e3723bad 100644 --- a/lib/RssParser.php +++ b/lib/RssParser.php @@ -12,21 +12,21 @@ */ /* - This file is part of PhpWiki. - - PhpWiki is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - PhpWiki is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with PhpWiki; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * This file is part of PhpWiki. + * + * PhpWiki is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * PhpWiki is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with PhpWiki; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /** diff --git a/lib/SemanticWeb.php b/lib/SemanticWeb.php index 6a0222dfb..a4199c360 100644 --- a/lib/SemanticWeb.php +++ b/lib/SemanticWeb.php @@ -84,23 +84,23 @@ */ /*============================================================================*/ /* - Copyright 2004,2007 Reini Urban - - This file is part of PhpWiki. - - PhpWiki is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - PhpWiki is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with PhpWiki; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Copyright 2004,2007 Reini Urban + * + * This file is part of PhpWiki. + * + * PhpWiki is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * PhpWiki is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with PhpWiki; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ require_once('lib/RssWriter.php'); @@ -403,5 +403,5 @@ class ReasonerBackend_KM extends ReasonerBackend { // c-basic-offset: 4 // c-hanging-comment-ender-p: nil // indent-tabs-mode: nil -// End: +// End: ?> diff --git a/lib/WikiDB/backend/ADODB.php b/lib/WikiDB/backend/ADODB.php index 8e1c75ff6..598d7a1ea 100644 --- a/lib/WikiDB/backend/ADODB.php +++ b/lib/WikiDB/backend/ADODB.php @@ -2,25 +2,24 @@ // rcs_id('$Id$'); /* - Copyright 2002,2004,2005,2006 $ThePhpWikiProgrammingTeam - - This file is part of PhpWiki. - - PhpWiki is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - PhpWiki is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with PhpWiki; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ + * Copyright 2002,2004,2005,2006 $ThePhpWikiProgrammingTeam + * + * This file is part of PhpWiki. + * + * PhpWiki is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * PhpWiki is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with PhpWiki; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ /** * Based on PearDB.php. @@ -162,7 +161,7 @@ extends WikiDB_backend $dbh->qstr($pagename))); return $row ? $row[0] : false; } - + function get_all_pagenames() { $dbh = &$this->_dbh; extract($this->_table_names); @@ -230,13 +229,13 @@ extends WikiDB_backend $where = sprintf("pagename=%s", $dbh->qstr($pagename)); $dbh->BeginTrans( ); $dbh->RowLock($page_tbl,$where); - + $data = $this->get_pagedata($pagename); if (!$data) { $data = array(); $this->_get_pageid($pagename, true); // Creates page record } - + $hits = (empty($data['hits'])) ? 0 : (int)$data['hits']; unset($data['hits']); @@ -353,7 +352,7 @@ extends WikiDB_backend 1); return $rs->fields ? (int)$rs->fields[0] : false; } - + /** * Get version data. * @@ -366,10 +365,10 @@ extends WikiDB_backend $dbh = &$this->_dbh; extract($this->_table_names); extract($this->_expressions); - + assert(is_string($pagename) and $pagename != ''); assert($version > 0); - + // FIXME: optimization: sometimes don't get page data? if ($want_content) { $fields = $this->page_tbl_fields . ", $page_tbl.pagedata AS pagedata" @@ -437,10 +436,10 @@ extends WikiDB_backend function set_versiondata($pagename, $version, $data) { $dbh = &$this->_dbh; $version_tbl = $this->_table_names['version_tbl']; - + $minor_edit = (int) !empty($data['is_minor_edit']); unset($data['is_minor_edit']); - + $mtime = (int)$data['mtime']; unset($data['mtime']); assert(!empty($mtime)); @@ -448,7 +447,7 @@ extends WikiDB_backend @$content = (string) $data['%content']; unset($data['%content']); unset($data['%pagedata']); - + $this->lock(array('page','recent','version','nonempty')); $dbh->BeginTrans( ); $dbh->CommitLock($version_tbl); @@ -468,7 +467,7 @@ extends WikiDB_backend else $dbh->RollbackTrans( ); $this->unlock(array('page','recent','version','nonempty')); } - + /** * Delete an old revision of a page. */ @@ -542,7 +541,7 @@ extends WikiDB_backend function purge_page($pagename) { $dbh = &$this->_dbh; extract($this->_table_names); - + $this->lock(array('version','recent','nonempty','page','link')); if ( ($id = $this->_get_pageid($pagename, false)) ) { $dbh->Execute("DELETE FROM $nonempty_tbl WHERE id=$id"); @@ -615,7 +614,7 @@ extends WikiDB_backend if ($relation) { $dbh->Execute("INSERT INTO $link_tbl (linkfrom, linkto, relation)" . " VALUES ($pageid, $linkid, $relation)"); - } else { + } else { $dbh->Execute("INSERT INTO $link_tbl (linkfrom, linkto)" . " VALUES ($pageid, $linkid)"); } @@ -702,7 +701,7 @@ extends WikiDB_backend if ($relation) { $dbh->Execute("INSERT INTO $link_tbl (linkfrom, linkto, relation)" . " VALUES ($pageid, $linkid, $relation)"); - } else { + } else { $dbh->Execute("INSERT INTO $link_tbl (linkfrom, linkto)" . " VALUES ($pageid, $linkid)"); } @@ -736,7 +735,7 @@ extends WikiDB_backend $this->unlock(array('link')); return true; } - + /** * Find pages which link to or are linked from a page. * @@ -785,7 +784,7 @@ extends WikiDB_backend echo "SELECT linkee.id AS id, linkee.pagename AS pagename, related.pagename as linkrelation FROM link, page linkee, page linker JOIN page related ON (link.relation=related.id) WHERE linkfrom=linker.id AND linkto=linkee.id AND linker.pagename='SanDiego'" | mysql phpwiki id pagename linkrelation 2268 California located_in -*/ +*/ if ($limit) { // extract from,count from limit list($offset,$count) = $this->limit($limit); @@ -883,7 +882,7 @@ id pagename linkrelation //$dbh->SetFetchMode(ADODB_FETCH_NUM); return new WikiDB_backend_ADODB_iter($this, $result, $this->page_tbl_field_list); } - + /** * Title and fulltext search. */ @@ -894,13 +893,13 @@ id pagename linkrelation extract($this->_table_names); $orderby = $this->sortby($sortby, 'db'); if ($orderby) $orderby = ' ORDER BY ' . $orderby; - + $table = "$nonempty_tbl, $page_tbl"; $join_clause = "$nonempty_tbl.id=$page_tbl.id"; $fields = $this->page_tbl_fields; $field_list = $this->page_tbl_field_list; $searchobj = new WikiDB_backend_ADODB_search($search, $dbh); - + if ($fullsearch) { $table .= ", $recent_tbl"; $join_clause .= " AND $page_tbl.id=$recent_tbl.id"; @@ -915,7 +914,7 @@ id pagename linkrelation } else { $callback = new WikiMethodCb($searchobj, "_pagename_match_clause"); } - + $search_clause = $search->makeSqlClauseObj($callback); $sql = "SELECT $fields FROM $table" . " WHERE $join_clause" @@ -1000,7 +999,7 @@ id pagename linkrelation $pick = array(); if ($since) $pick[] = "mtime >= $since"; - + if ($include_all_revisions) { // Include all revisions of each page. $table = "$page_tbl, $version_tbl"; @@ -1020,7 +1019,7 @@ id pagename linkrelation $join_clause = "$page_tbl.id=$recent_tbl.id"; $table .= ", $version_tbl"; $join_clause .= " AND $version_tbl.id=$page_tbl.id"; - + if ($exclude_major_revisions) { // Include only most recent minor revision $pick[] = 'version=latestminor'; @@ -1068,7 +1067,7 @@ id pagename linkrelation extract($this->_table_names); if ($orderby = $this->sortby($sortby, 'db', array('pagename','wantedfrom'))) $orderby = 'ORDER BY ' . $orderby; - + if ($exclude_from) // array of pagenames $exclude_from = " AND pp.pagename NOT IN ".$this->_sql_set($exclude_from); if ($exclude) // array of pagenames @@ -1107,7 +1106,7 @@ id pagename linkrelation function rename_page($pagename, $to) { $dbh = &$this->_dbh; extract($this->_table_names); - + $this->lock(array('page','version','recent','nonempty','link')); if ( ($id = $this->_get_pageid($pagename, false)) ) { if ($new = $this->_get_pageid($to, false)) { @@ -1204,7 +1203,7 @@ id pagename linkrelation function _lock_tables($tables, $write_lock) { return $this->_current_lock; } - + /** * Release a write lock on the tables in the SQL database. * @@ -1269,7 +1268,7 @@ id pagename linkrelation function listOfTables() { return $this->_dbh->MetaTables(); } - + // other database needs another connection and other privileges. function listOfFields($database, $table) { $field_list = array(); @@ -1315,7 +1314,7 @@ extends WikiDB_backend_iterator $this->_fields = $field_list; } - + function count() { if (!$this->_result) { return false; @@ -1568,5 +1567,5 @@ class WikiDB_backend_ADODB_search extends WikiDB_backend_search_sql // c-basic-offset: 4 // c-hanging-comment-ender-p: nil // indent-tabs-mode: nil -// End: +// End: ?> diff --git a/lib/WikiDB/backend/PDO.php b/lib/WikiDB/backend/PDO.php index 8dad7a2d1..86e67199d 100644 --- a/lib/WikiDB/backend/PDO.php +++ b/lib/WikiDB/backend/PDO.php @@ -2,24 +2,24 @@ // rcs_id('$Id$'); /* - Copyright 2005 $ThePhpWikiProgrammingTeam - - This file is part of PhpWiki. - - PhpWiki is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - PhpWiki is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with PhpWiki; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ + * Copyright 2005 $ThePhpWikiProgrammingTeam + * + * This file is part of PhpWiki. + * + * PhpWiki is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * PhpWiki is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with PhpWiki; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ /** * @author: Reini Urban @@ -220,7 +220,7 @@ extends WikiDB_backend else return false; } - + function get_all_pagenames() { $dbh = &$this->_dbh; extract($this->_table_names); @@ -292,7 +292,7 @@ extends WikiDB_backend $data = array(); $this->_get_pageid($pagename, true); // Creates page record } - + $hits = (empty($data['hits'])) ? 0 : (int)$data['hits']; unset($data['hits']); @@ -354,7 +354,7 @@ extends WikiDB_backend // attributes play this game. if ($pagename === '') return 0; - + $dbh = &$this->_dbh; $page_tbl = $this->_table_names['page_tbl']; $sth = $dbh->prepare("SELECT id FROM $page_tbl WHERE pagename=? LIMIT 1"); @@ -422,7 +422,7 @@ extends WikiDB_backend $sth->execute(); return $sth->fetchSingle(); } - + /** * Get version data. * @@ -435,10 +435,10 @@ extends WikiDB_backend $dbh = &$this->_dbh; extract($this->_table_names); extract($this->_expressions); - + assert(is_string($pagename) and $pagename != ''); assert($version > 0); - + // FIXME: optimization: sometimes don't get page data? if ($want_content) { $fields = $this->page_tbl_fields . ", $page_tbl.pagedata AS pagedata" @@ -508,10 +508,10 @@ extends WikiDB_backend function set_versiondata($pagename, $version, $data) { $dbh = &$this->_dbh; $version_tbl = $this->_table_names['version_tbl']; - + $minor_edit = (int) !empty($data['is_minor_edit']); unset($data['is_minor_edit']); - + $mtime = (int)$data['mtime']; unset($data['mtime']); assert(!empty($mtime)); @@ -519,7 +519,7 @@ extends WikiDB_backend @$content = (string) $data['%content']; unset($data['%content']); unset($data['%pagedata']); - + $this->lock(array('page','recent','version','nonempty')); $this->beginTransaction(); $id = $this->_get_pageid($pagename, true); @@ -559,7 +559,7 @@ extends WikiDB_backend else $this->rollBack( ); $this->unlock(array('page','recent','version','nonempty')); } - + /** * Delete an old revision of a page. */ @@ -638,7 +638,7 @@ extends WikiDB_backend function purge_page($pagename) { $dbh = &$this->_dbh; extract($this->_table_names); - + $this->lock(array('version','recent','nonempty','page','link')); if ( ($id = $this->_get_pageid($pagename, false)) ) { $dbh->query("DELETE FROM $version_tbl WHERE id=$id"); @@ -716,7 +716,7 @@ extends WikiDB_backend $this->unlock(array('link')); return true; } - + /** * Find pages which link to or are linked from a page. * @@ -832,7 +832,7 @@ extends WikiDB_backend $result = $sth->fetch(PDO_FETCH_BOTH); return new WikiDB_backend_PDO_iter($this, $result, $this->page_tbl_field_list); } - + /** * Title search. */ @@ -848,7 +848,7 @@ extends WikiDB_backend $fields = $this->page_tbl_fields; $field_list = $this->page_tbl_field_list; $searchobj = new WikiDB_backend_PDO_search($search, $dbh); - + if ($fullsearch) { $table .= ", $recent_tbl"; $join_clause .= " AND $page_tbl.id=$recent_tbl.id"; @@ -862,7 +862,7 @@ extends WikiDB_backend } else { $callback = new WikiMethodCb($searchobj, "_pagename_match_clause"); } - + $search_clause = $search->makeSqlClauseObj($callback); $sth = $dbh->prepare("SELECT $fields FROM $table" . " WHERE $join_clause" @@ -942,7 +942,7 @@ extends WikiDB_backend $pick = array(); if ($since) $pick[] = "mtime >= $since"; - + if ($include_all_revisions) { // Include all revisions of each page. $table = "$page_tbl, $version_tbl"; @@ -962,7 +962,7 @@ extends WikiDB_backend $join_clause = "$page_tbl.id=$recent_tbl.id"; $table .= ", $version_tbl"; $join_clause .= " AND $version_tbl.id=$page_tbl.id"; - + if ($exclude_major_revisions) { // Include only most recent minor revision $pick[] = 'version=latestminor'; @@ -1008,7 +1008,7 @@ extends WikiDB_backend extract($this->_table_names); if ($orderby = $this->sortby($sortby, 'db', array('pagename','wantedfrom'))) $orderby = 'ORDER BY ' . $orderby; - + if ($exclude_from) // array of pagenames $exclude_from = " AND linked.pagename NOT IN ".$this->_sql_set($exclude_from); if ($exclude) // array of pagenames @@ -1047,7 +1047,7 @@ extends WikiDB_backend function rename_page($pagename, $to) { $dbh = &$this->_dbh; extract($this->_table_names); - + $this->lock(array('page','version','recent','nonempty','link')); if ( ($id = $this->_get_pageid($pagename, false)) ) { if ($new = $this->_get_pageid($to, false)) { @@ -1153,7 +1153,7 @@ extends WikiDB_backend } $this->_dbh->query("LOCK TABLES " . join(",", $locks)); } - + /** * Release a write lock on the tables in the SQL database. * @@ -1286,7 +1286,7 @@ extends WikiDB_backend_iterator $this->_result = $query_result; //$this->_fields = $field_list; } - + function count() { if (!is_object($this->_result)) { return false; @@ -1497,5 +1497,5 @@ class WikiDB_backend_PDO_search extends WikiDB_backend_search_sql {} // c-basic-offset: 4 // c-hanging-comment-ender-p: nil // indent-tabs-mode: nil -// End: +// End: ?> diff --git a/lib/WikiDB/backend/PDO_mysql.php b/lib/WikiDB/backend/PDO_mysql.php index fa3d711fb..c0d3767be 100644 --- a/lib/WikiDB/backend/PDO_mysql.php +++ b/lib/WikiDB/backend/PDO_mysql.php @@ -2,24 +2,24 @@ // rcs_id('$Id$'); /* - Copyright 2005 $ThePhpWikiProgrammingTeam - - This file is part of PhpWiki. - - PhpWiki is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - PhpWiki is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with PhpWiki; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ + * Copyright 2005 $ThePhpWikiProgrammingTeam + * + * This file is part of PhpWiki. + * + * PhpWiki is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * PhpWiki is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with PhpWiki; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ /** * @author: Reini Urban @@ -156,5 +156,5 @@ extends WikiDB_backend_PDO // c-basic-offset: 4 // c-hanging-comment-ender-p: nil // indent-tabs-mode: nil -// End: +// End: ?> diff --git a/lib/WikiDB/backend/PDO_oci8.php b/lib/WikiDB/backend/PDO_oci8.php index 60120a92a..b452b626c 100644 --- a/lib/WikiDB/backend/PDO_oci8.php +++ b/lib/WikiDB/backend/PDO_oci8.php @@ -2,24 +2,24 @@ // rcs_id('$Id$'); /* - Copyright 2007 $ThePhpWikiProgrammingTeam - - This file is part of PhpWiki. - - PhpWiki is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - PhpWiki is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with PhpWiki; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ + * Copyright 2007 $ThePhpWikiProgrammingTeam + * + * This file is part of PhpWiki. + * + * PhpWiki is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * PhpWiki is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with PhpWiki; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ /** * @author: Reini Urban @@ -41,7 +41,7 @@ extends WikiDB_backend_PDO */ function _lock_tables($write_lock=true) { $dbh = &$this->_dbh; - + // Not sure if we really need to lock tables here, the Oracle row // locking mechanism should be more than enough // For the time being, lets stay on the safe side and lock... @@ -93,5 +93,5 @@ extends WikiDB_backend_PDO // c-basic-offset: 4 // c-hanging-comment-ender-p: nil // indent-tabs-mode: nil -// End: +// End: ?> diff --git a/lib/WikiDB/backend/PDO_pgsql.php b/lib/WikiDB/backend/PDO_pgsql.php index ea47bc8f2..c53b6739a 100644 --- a/lib/WikiDB/backend/PDO_pgsql.php +++ b/lib/WikiDB/backend/PDO_pgsql.php @@ -2,24 +2,24 @@ // rcs_id('$Id$'); /* - Copyright 2005 $ThePhpWikiProgrammingTeam - - This file is part of PhpWiki. - - PhpWiki is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - PhpWiki is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with PhpWiki; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ + * Copyright 2005 $ThePhpWikiProgrammingTeam + * + * This file is part of PhpWiki. + * + * PhpWiki is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * PhpWiki is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with PhpWiki; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ /** * @author: Reini Urban @@ -56,5 +56,5 @@ extends WikiDB_backend_PDO // c-basic-offset: 4 // c-hanging-comment-ender-p: nil // indent-tabs-mode: nil -// End: +// End: ?> diff --git a/lib/WikiDB/backend/dumb/LinkSearchIter.php b/lib/WikiDB/backend/dumb/LinkSearchIter.php index 8bc1ce093..c8d16b2ac 100644 --- a/lib/WikiDB/backend/dumb/LinkSearchIter.php +++ b/lib/WikiDB/backend/dumb/LinkSearchIter.php @@ -1,23 +1,23 @@ _savePageData($pagename, $newdata); // create a new pagedata-file return; } - + foreach ($newdata as $key => $val) { if (empty($val)) unset($data[$key]); @@ -320,7 +320,7 @@ extends WikiDB_backend } $this->_savePageData($pagename, $data); // write new pagedata-file } - + /** * Get the current version number for a page. @@ -332,7 +332,7 @@ extends WikiDB_backend function get_latest_version($pagename) { return $this->_getLatestVersion($pagename); } - + /** * Get preceding version number. * @@ -350,7 +350,7 @@ extends WikiDB_backend } return $prev; } - + /** * Get revision meta-data and content. * @@ -426,7 +426,7 @@ extends WikiDB_backend // remove page from latest_version... $this->_setLatestVersion($pagename, 0); } - + /** * Delete an old revision of a page. * @@ -453,7 +453,7 @@ extends WikiDB_backend } } $this->_removePage('ver_data', $pagename, $version); - } + } /** * Create a new page revision. @@ -497,7 +497,7 @@ extends WikiDB_backend } $this->set_versiondata($pagename, $version, $data); } - + /** * Set links for page. * @@ -508,7 +508,7 @@ extends WikiDB_backend function set_links($pagename, $links) { $this->_savePageLinks($pagename, $links); } - + /** * Find pages which link to or are linked from a page. * @@ -552,7 +552,7 @@ extends WikiDB_backend return new WikiDB_backend_dumb_AllRevisionsIter($this, $pagename); } */ - + /** * Get all pages in the database. * @@ -678,7 +678,7 @@ extends WikiDB_backend $search = strtolower(trim($search)); if (!$search) return array(array(),array()); - + $words = preg_split('/\s+/', $search); $exclude = array(); foreach ($words as $key => $word) { @@ -690,7 +690,7 @@ extends WikiDB_backend } return array($words, $exclude); } - + }; class WikiDB_backend_file_iter extends WikiDB_backend_iterator @@ -703,7 +703,7 @@ class WikiDB_backend_file_iter extends WikiDB_backend_iterator if (count($this->_result) > 0) reset($this->_result); } - + function next() { if (!$this->_result) return false; @@ -714,7 +714,7 @@ class WikiDB_backend_file_iter extends WikiDB_backend_iterator if ($e == false) { return false; } - + $pn = $e[1]; if (is_array($pn) and isset($pn['linkto'])) { // support relation link iterator $pn = $pn['linkto']; diff --git a/lib/WikiDB/backend/flatfile.php b/lib/WikiDB/backend/flatfile.php index d68af19c6..220f67b9c 100644 --- a/lib/WikiDB/backend/flatfile.php +++ b/lib/WikiDB/backend/flatfile.php @@ -2,23 +2,23 @@ // rcs_id('$Id$'); /** - Copyright 1999,2005,2006 $ThePhpWikiProgrammingTeam - - This file is part of PhpWiki. - - PhpWiki is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - PhpWiki is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with PhpWiki; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Copyright 1999,2005,2006 $ThePhpWikiProgrammingTeam + * + * This file is part of PhpWiki. + * + * PhpWiki is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * PhpWiki is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with PhpWiki; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /** @@ -51,7 +51,7 @@ extends WikiDB_backend_file return $this->_dir_names[$type].'/'.FilenameForPage($pagename); else return $this->_dir_names[$type].'/'.FilenameForPage($pagename).'--'.$version; -*/ +*/ } // Load/Save Page-Data @@ -62,7 +62,7 @@ extends WikiDB_backend_file } } //$pd = $this->_loadPage('page_data', $pagename, 0); - + $filename = $this->_pagename2filename('page_data', $pagename, 0); if (!file_exists($filename)) return NULL; if (!filesize($filename)) return array(); @@ -85,7 +85,7 @@ extends WikiDB_backend_file } fclose($fd); } - + if ($pd != NULL) $this->_page_data = $pd; if ($this->_page_data != NULL) { @@ -95,7 +95,7 @@ extends WikiDB_backend_file } return array(); // no values found } - + /** Store latest version as full page_data flatfile, * earlier versions as file backend ver_data. * _cached_html will not be stored. @@ -114,7 +114,7 @@ extends WikiDB_backend_file $this->_savePage('ver_data', $pagename, $version, $data); } } - + // This is different to file and not yet finished. // TODO: fields not being saved as page_data should be saved to ver_data // Store as full page_data flatfile @@ -176,7 +176,7 @@ extends WikiDB_backend_file $pagedata .= sprintf("Mime-Version: 1.0 (Produced by PhpWiki %s)\r\n", PHPWIKI_VERSION); $pagedata .= MimeifyPageRevision($page, $current); - + if ($fd = fopen($filename, 'a+b')) { $locked = flock($fd, 2); // Exclusive blocking lock if (!$locked) { diff --git a/lib/WikiDB/file.php b/lib/WikiDB/file.php index f6e50845e..6a5e412ed 100644 --- a/lib/WikiDB/file.php +++ b/lib/WikiDB/file.php @@ -3,23 +3,23 @@ // rcs_id( '$Id$' ); /** - Copyright 1999, 2000, 2001, 2002, 2003 $ThePhpWikiProgrammingTeam - - This file is part of PhpWiki. - - PhpWiki is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - PhpWiki is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with PhpWiki; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Copyright 1999, 2000, 2001, 2002, 2003 $ThePhpWikiProgrammingTeam + * + * This file is part of PhpWiki. + * + * PhpWiki is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * PhpWiki is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with PhpWiki; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ @@ -55,6 +55,6 @@ class WikiDB_file extends WikiDB // c-basic-offset: 4 // c-hanging-comment-ender-p: nil // indent-tabs-mode: nil -// End: +// End: ?> diff --git a/lib/WikiDB/flatfile.php b/lib/WikiDB/flatfile.php index f605eddcd..c5936e3c5 100644 --- a/lib/WikiDB/flatfile.php +++ b/lib/WikiDB/flatfile.php @@ -1,28 +1,26 @@ diff --git a/lib/XmlParser.php b/lib/XmlParser.php index 82a7a546a..4ed84a813 100644 --- a/lib/XmlParser.php +++ b/lib/XmlParser.php @@ -21,21 +21,21 @@ */ /* - This file is part of PhpWiki. - - PhpWiki is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - PhpWiki is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with PhpWiki; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * This file is part of PhpWiki. + * + * PhpWiki is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * PhpWiki is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with PhpWiki; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /** @@ -79,7 +79,7 @@ class XmlParser { if (!empty($this->_parser)) xml_parser_free($this->_parser); unset($this->_parser); - + if (isset($xml_parser_root)) { $xml_parser_root->_destruct(); unset($xml_parser_root); // nested parsing forbidden! diff --git a/lib/install.php b/lib/install.php index 9bd069a3d..44a946791 100644 --- a/lib/install.php +++ b/lib/install.php @@ -2,23 +2,23 @@ // rcs_id('$Id$'); /* - Copyright 2004 $ThePhpWikiProgrammingTeam - - This file is part of PhpWiki. - - PhpWiki is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - PhpWiki is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with PhpWiki; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Copyright 2004 $ThePhpWikiProgrammingTeam + * + * This file is part of PhpWiki. + * + * PhpWiki is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * PhpWiki is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with PhpWiki; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /** diff --git a/lib/loadsave.php b/lib/loadsave.php index 4243facdb..6c314e4b8 100644 --- a/lib/loadsave.php +++ b/lib/loadsave.php @@ -2,24 +2,24 @@ // rcs_id('$Id$'); /* - Copyright 1999,2000,2001,2002,2004,2005,2006,2007 $ThePhpWikiProgrammingTeam - Copyright 2008-2010 Marc-Etienne Vargenau, Alcatel-Lucent - - This file is part of PhpWiki. - - PhpWiki is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - PhpWiki is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with PhpWiki; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Copyright 1999,2000,2001,2002,2004,2005,2006,2007 $ThePhpWikiProgrammingTeam + * Copyright 2008-2010 Marc-Etienne Vargenau, Alcatel-Lucent + * + * This file is part of PhpWiki. + * + * PhpWiki is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * PhpWiki is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with PhpWiki; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ require_once("lib/ziplib.php"); @@ -659,7 +659,7 @@ function _DumpHtmlToDir ($target, $page_iter, $exclude = false) $DUMP_MODE = $WikiTheme->DUMP_MODE; $data = GeneratePageasXML(new Template('browse', $request, $args), $pagename, $current, $args); - $WikiTheme->DUMP_MODE = $DUMP_MODE; + $WikiTheme->DUMP_MODE = $DUMP_MODE; if (preg_match_all("/getBackLinks(); return $theIter->count(); } - + function _getSortableValue ($page_handle, &$revision_handle) { return $this->_getValue($page_handle, $revision_handle); } }; -class _PageList_Column_coagreement extends _PageList_Column_custom +class _PageList_Column_coagreement extends _PageList_Column_custom { function _PageList_Column_coagreement ($params) { $this->_pagelist =& $params[3]; @@ -62,7 +62,7 @@ class _PageList_Column_coagreement extends _PageList_Column_custom $this->_selectedBuddies = $this->_pagelist->getOption('selectedBuddies'); } - function _getValue ($page_handle, &$revision_handle) + function _getValue ($page_handle, &$revision_handle) { global $request; @@ -70,23 +70,23 @@ class _PageList_Column_coagreement extends _PageList_Column_custom $active_user = $request->getUser(); $active_userId = $active_user->getId(); - $dbi = $request->getDbh(); + $dbi = $request->getDbh(); $p = CoAgreement($dbi, $pagename, $this->_selectedBuddies, $active_userId); if($p == 1){ $p = "yes"; } elseif($p == 0){ $p = "unsure"; } elseif($p == -1){ - $p = "no"; + $p = "no"; } else { - $p = "error"; - } + $p = "error"; + } //FIXME: $WikiTheme->getImageURL() return HTML::img(array('src' => $WikiTheme->getImageURL($p))); } } -class _PageList_Column_minmisery extends _PageList_Column_custom +class _PageList_Column_minmisery extends _PageList_Column_custom { function _PageList_Column_minmisery ($params) { $this->_pagelist =& $params[3]; @@ -94,7 +94,7 @@ class _PageList_Column_minmisery extends _PageList_Column_custom $this->_selectedBuddies = $this->_pagelist->getOption('selectedBuddies'); } - function _getValue ($page_handle, &$revision_handle) + function _getValue ($page_handle, &$revision_handle) { global $request, $WikiTheme; @@ -102,7 +102,7 @@ class _PageList_Column_minmisery extends _PageList_Column_custom $active_user = $request->getUser(); $active_userId = $active_user->getId(); - $dbi = $request->getDbh(); + $dbi = $request->getDbh(); $p = MinMisery($dbi, $pagename, $this->_selectedBuddies, $active_userId); $imgFix = floor($p * 2) / 2; return HTML::img(array('src' => $WikiTheme->getImageURL("Rateit" . $imgFix))); @@ -111,14 +111,14 @@ class _PageList_Column_minmisery extends _PageList_Column_custom class _PageList_Column_averagerating extends _PageList_Column_custom { - function _PageList_Column_averagerating ($params) + function _PageList_Column_averagerating ($params) { $this->_pagelist =& $params[3]; $this->_PageList_Column($params[0], $params[1], $params[2]); $this->_selectedBuddies = $this->_pagelist->getOption('selectedBuddies'); } - function _getValue ($page_handle, &$revision_handle) + function _getValue ($page_handle, &$revision_handle) { global $request, $WikiTheme; @@ -126,9 +126,9 @@ class _PageList_Column_averagerating extends _PageList_Column_custom $active_user = $request->getUser(); $active_userId = $active_user->getId(); - $dbi = $request->getDbh(); + $dbi = $request->getDbh(); $p = round(AverageRating($dbi, $pagename, $this->_selectedBuddies, $active_userId), 2); - + $imgFix = floor($p * 2) / 2; $html = HTML(); $html->pushContent(HTML::img(array('src' => $WikiTheme->getImageURL("Rateit" . $imgFix)))); @@ -136,7 +136,7 @@ class _PageList_Column_averagerating extends _PageList_Column_custom return $html; } }; - + /** * Show the value of a rating as a digit (or "-" if no value), given the * user who is the rater. @@ -154,7 +154,7 @@ class _PageList_Column_ratingvalue extends _PageList_Column { if (!$this->_dimension) $this->_dimension = 0; } - function format ($pagelist, $page_handle, &$revision_handle) + function format ($pagelist, $page_handle, &$revision_handle) { if (empty($this->_user)) $this->_user =& RatingsUserFactory::getUser($GLOBALS['request']->_user->_userid); @@ -173,7 +173,7 @@ class _PageList_Column_ratingvalue extends _PageList_Column { return $td; } - function _getValue ($page_handle, &$revision_handle) + function _getValue ($page_handle, &$revision_handle) { $pagename = $page_handle->getName(); @@ -183,9 +183,9 @@ class _PageList_Column_ratingvalue extends _PageList_Column { // a dash (or *something*) arguably looks better than a big blank space return ($rating ? $rating : "-"); } - + function hasNoRatings($pages) - { + { $total = 0; $use = & $this->_user; foreach ($pages as $page) { @@ -196,10 +196,10 @@ class _PageList_Column_ratingvalue extends _PageList_Column { if ($total == 0) { return true; } - return false; - + return false; + } - + function _getSortableValue ($page_handle, &$revision_handle) { return $this->_getValue($page_handle, $revision_handle); } @@ -209,7 +209,7 @@ class _PageList_Column_ratingvalue extends _PageList_Column { * Ratings widget for the logged-in user and the given page * This uses the column name "rating". */ -class _PageList_Column_ratingwidget extends _PageList_Column_custom +class _PageList_Column_ratingwidget extends _PageList_Column_custom { function _PageList_Column_ratingwidget ($params) { $this->_pagelist =& $params[3]; @@ -220,42 +220,42 @@ class _PageList_Column_ratingwidget extends _PageList_Column_custom function format ($pagelist, $page_handle, &$revision_handle) { $plugin = new WikiPlugin_RateIt(); - $widget = $plugin->RatingWidgetHtml($page_handle->getName(), "", + $widget = $plugin->RatingWidgetHtml($page_handle->getName(), "", "Star", $this->_dimension, "small"); $td = HTML::td($widget); $td->setAttr('nowrap', 'nowrap'); return $td; } - function _getValue ($page_handle, &$revision_handle) + function _getValue ($page_handle, &$revision_handle) { global $request; $pagename = $page_handle->getName(); $active_user = $request->getUser(); $active_userid = $active_user->_userid; - + $tu = & RatingsUserFactory::getUser($active_userid); return $tu->get_rating($pagename, $this->_dimension); } - + function _getSortableValue ($page_handle, &$revision_handle) { return $this->_getValue($page_handle, $revision_handle); } }; -class _PageList_Column_prediction extends _PageList_Column +class _PageList_Column_prediction extends _PageList_Column { var $_active_ratings_user; var $_users; - function _PageList_Column_prediction ($params) + function _PageList_Column_prediction ($params) { global $request; $active_user = $request->getUser(); // This needs to be a reference so things aren't recomputed for this user $this->_active_ratings_user =& RatingsUserFactory::getUser($active_user->getId()); - + $this->_pagelist =& $params[3]; $this->_PageList_Column($params[0], $params[1], $params[2]); $this->_dimension = $this->_pagelist->getOption('dimension');; @@ -278,7 +278,7 @@ class _PageList_Column_prediction extends _PageList_Column return $td; } - function _getValue ($page_handle, &$revision_handle) + function _getValue ($page_handle, &$revision_handle) { $pagename = $page_handle->getName(); @@ -286,7 +286,7 @@ class _PageList_Column_prediction extends _PageList_Column $pred = $this->_active_ratings_user->knn_uu_predict($pagename, $this->_users, $this->_dimension); return sprintf("%.1f", min(5, max(0, $pred))); } - + function _getSortableValue ($page_handle, &$revision_handle) { return $this->_getValue($page_handle, $revision_handle); } @@ -294,7 +294,7 @@ class _PageList_Column_prediction extends _PageList_Column class _PageList_Column_top3recs extends _PageList_Column_custom { - + var $_active_ratings_user; var $_users; @@ -310,7 +310,7 @@ class _PageList_Column_top3recs extends _PageList_Column_custom // the memoization in pearson_similarity and mean_rating to work $this->_active_ratings_user = new RatingsUser($active_user->getId()); $this->_PageList_Column($params[0], $params[1], $params[2]); - + if (!empty($params[3])) { $this->_pagelist =& $params[3]; $this->_dimension = $this->_pagelist->getOption('dimension'); @@ -319,7 +319,7 @@ class _PageList_Column_top3recs extends _PageList_Column_custom } } - function _getValue ($page_handle, &$revision_handle) + function _getValue ($page_handle, &$revision_handle) { $ratings = $this->_active_ratings_user->get_ratings(); $iter = $page_handle->getLinks(); @@ -327,8 +327,8 @@ class _PageList_Column_top3recs extends _PageList_Column_custom while($current = $iter->next()) { //filter out already rated if (!$this->_active_ratings_user->get_rating($current->getName(), $this->_dimension)) { - $recs[$current->getName()] = - $this->_active_ratings_user->knn_uu_predict($current->getName(), + $recs[$current->getName()] = + $this->_active_ratings_user->knn_uu_predict($current->getName(), $this->_users, $this->_dimension); } } @@ -343,20 +343,20 @@ class _PageList_Column_top3recs extends _PageList_Column_custom } $html = HTML(); while ((list($key, $val) = each($recs)) && $counter < $numToShow) { - if ($val < 3){ + if ($val < 3){ break; } if ($counter > 0){ $html->pushContent(" , "); } $html->pushContent(WikiLink($key)); - + $counter++; } if (count($recs) == 0 || $counter == 0){ $html->pushContent(_("None")); } - + //return $top3list; return $html; } @@ -367,29 +367,29 @@ global $WikiTheme; $WikiTheme->addPageListColumn (array ( - 'numbacklinks' - => array('_PageList_Column_numbacklinks','custom:numbacklinks', + 'numbacklinks' + => array('_PageList_Column_numbacklinks','custom:numbacklinks', _("# things"), 'center'), - 'rating' - => array('_PageList_Column_ratingwidget','custom:rating', + 'rating' + => array('_PageList_Column_ratingwidget','custom:rating', _("Rate"), false), 'ratingvalue' - => array('_PageList_Column_ratingvalue','custom:ratingvalue', + => array('_PageList_Column_ratingvalue','custom:ratingvalue', _("Rating"), 'center'), - 'coagreement' - => array('_PageList_Column_coagreement','custom:coagreement', + 'coagreement' + => array('_PageList_Column_coagreement','custom:coagreement', _("Go?"), 'center'), - 'minmisery' - => array('_PageList_Column_minmisery','custom:minmisery', + 'minmisery' + => array('_PageList_Column_minmisery','custom:minmisery', _("MinMisery"), 'center'), - 'averagerating' - => array('_PageList_Column_averagerating','custom:averagerating', + 'averagerating' + => array('_PageList_Column_averagerating','custom:averagerating', _("Avg. Rating"), 'left'), 'top3recs' - => array('_PageList_Column_top3recs','custom:top3recs', + => array('_PageList_Column_top3recs','custom:top3recs', _("Top Recommendations"), 'left'), /*'prediction' - => array('_PageList_Column_prediction','custom:prediction', + => array('_PageList_Column_prediction','custom:prediction', _("Prediction"), false),*/ )); diff --git a/lib/wikilens/Utils.php b/lib/wikilens/Utils.php index 4cd5483a0..315b8078d 100644 --- a/lib/wikilens/Utils.php +++ b/lib/wikilens/Utils.php @@ -1,23 +1,23 @@ _HomePagehandle; $transpagename = $homepage->getName(); @@ -44,7 +44,7 @@ function addPageTextData($user, $dbi, $new_data, $START_DELIM, $DELIM) { // add new data to the appropriate line if(preg_match('/^' . preg_quote($START_DELIM) . '/', $text)) { // need multiline modifier to match EOL correctly - $text = preg_replace('/(^' . preg_quote($START_DELIM) . '.*)$/m', + $text = preg_replace('/(^' . preg_quote($START_DELIM) . '.*)$/m', '$1' . $DELIM . $new_data, $text); } else { // handle case where the line does not yet exist @@ -54,10 +54,10 @@ function addPageTextData($user, $dbi, $new_data, $START_DELIM, $DELIM) { // advance version counter, save $page->save($text, $version + 1, $meta); } - + function getMembers($groupName, $dbi, $START_DELIM = false, $DELIM = ",") { - if (!$START_DELIM) $START_DELIM = _("Members:"); - return getPageTextData($groupName, $dbi, $START_DELIM, $DELIM); + if (!$START_DELIM) $START_DELIM = _("Members:"); + return getPageTextData($groupName, $dbi, $START_DELIM, $DELIM); } function getPageTextData($fromUser, $dbi, $START_DELIM, $DELIM) { @@ -74,16 +74,16 @@ function getPageTextData($fromUser, $dbi, $START_DELIM, $DELIM) { if(!((strpos($pageArray[$i], $START_DELIM)) === FALSE)){ $p = $i; break; - } + } } } $retArray = array(); if ($p >= 0){ $singles = $pageArray[$p]; $singles = substr($singles, strpos($singles, $START_DELIM) + strlen($START_DELIM)); - + $retArray = explode($DELIM, $singles); - } + } for ($i = 0; $i < count($retArray); $i++) { $retArray[$i] = trim($retArray[$i]); } -- 2.45.0