From 09f8ff14d3ad97eadb95edaf3b9f5b86d493ca07 Mon Sep 17 00:00:00 2001 From: rurban Date: Thu, 8 Apr 2004 01:22:54 +0000 Subject: [PATCH] fixed PageChange Notification git-svn-id: svn://svn.code.sf.net/p/phpwiki/code/trunk@3249 96ab9672-09ca-45d6-a79d-3d69d39ca109 --- index.php | 14 ++++-- lib/WikiDB.php | 67 +++++++++++++++++++------- lib/difflib.php | 7 ++- lib/pear/File_Passwd.php | 4 +- pgsrc/ReleaseNotes | 53 +++++++++++++------- themes/default/templates/editpage.tmpl | 3 +- themes/wikilens/themeinfo.php | 14 ++++-- 7 files changed, 112 insertions(+), 50 deletions(-) diff --git a/index.php b/index.php index 01217db1e..f0ee92b2a 100644 --- a/index.php +++ b/index.php @@ -66,14 +66,15 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // processing timer, and possibly other debugging messages at the // bottom of each page. if (!defined('DEBUG')) define ('DEBUG', 0); -define('ENABLE_USER_NEW',true); // this will disappear with 1.4.0 +define('ENABLE_USER_NEW',true); // this will disappear with 1.4.0 +//define('JS_SEARCHREPLACE',true); // experimental ///////////////////////////////////////////////////////////////////// // Part Null: Don't touch this! define ('PHPWIKI_VERSION', '1.3.8'); require "lib/prepend.php"; -rcs_id('$Id: index.php,v 1.132 2004-04-01 15:57:10 rurban Exp $'); +rcs_id('$Id: index.php,v 1.133 2004-04-08 01:22:53 rurban Exp $'); ///////////////////////////////////////////////////////////////////// // @@ -321,8 +322,8 @@ $DBParams = array( // PHP Session settings: // -// Only for $DBParams['dbtype'] => 'SQL'. See schemas/mysql.sql or -// schemas/psql.sql. +// Tested for dbtype: 'SQL', 'ADODB' and 'dba'. See schemas/mysql.sql, +// schemas/sqlite.sql or schemas/psql.sql. // $DBParams['db_session_table'] must be defined. if (!defined('USE_DB_SESSION') and $DBParams['dbtype'] == 'SQL' and @@ -942,6 +943,11 @@ if (defined('VIRTUAL_PATH') and defined('USE_PATH_INFO')) { //include "lib/main.php"; // $Log: not supported by cvs2svn $ +// Revision 1.132 2004/04/01 15:57:10 rurban +// simplified Sidebar theme: table, not absolute css positioning +// added the new box methods. +// remaining problems: large left margin, how to override _autosplitWikiWords in Template only +// // Revision 1.131 2004/03/14 16:24:35 rurban // authenti(fi)cation spelling // diff --git a/lib/WikiDB.php b/lib/WikiDB.php index f47c8de4d..13a2c8e3f 100644 --- a/lib/WikiDB.php +++ b/lib/WikiDB.php @@ -1,5 +1,5 @@ get('notify'); + $notify = $this->_wikidb->get('notify'); + $emails = array(); if (!empty($notify) and is_array($notify)) { foreach ($notify as $page => $users) { - if (ereg($page,$this->_pagename)) { - $emails = array(); + if (glob_match($page,$this->_pagename)) { foreach ($users as $userid => $user) { if (!empty($user['verified']) and !empty($user['email'])) $emails[] = $user['email']; - elseif (DEBUG and !empty($user['email'])) { + elseif (!empty($user['email'])) { global $request; //do a dynamic emailVerified check update $u = $request->getUser(); @@ -792,23 +792,54 @@ class WikiDB_Page } } // do no verification - if (DEBUG and !in_array($user['email'],$emails)) - $emails[] = $user['email']; + if (DEBUG) { + if (!in_array($user['email'],$emails)) + $emails[] = $user['email']; + } } } - if (!empty($emails)) { - $subject = sprintf(_("PageChange Notification %s"),$page); - $diff = WikiUrl($this->_pagename, array('action'=>'diff',true)); - $emails = join(',',$emails); - if (mail($emails,"[".WIKI_NAME."] ".$subject,$subject."\n".$diff)) - trigger_error(sprintf(_("PageChange Notification of %s sent to %s"), - $this->_pagename, $emails), E_USER_NOTICE); - else - trigger_error(sprintf(_("PageChange Notification Error: Couldn't send %s to %s"), - $this->_pagename, $emails), E_USER_WARNING); - } } } + if (!empty($emails)) { + $emails = array_unique($emails); + $subject = sprintf(_("PageChange Notification %s"),$this->_pagename); + $previous = $backend->get_previous_version($this->_pagename, $version); + if ($previous) { + $difflink = WikiUrl($this->_pagename,array('action'=>'diff'),true); + $cache = &$this->_wikidb->_cache; + $this_content = explode("\n", $wikitext); + $prevdata = $cache->get_versiondata($this->_pagename, $previous, true); + if (empty($prevdata['%content'])) + $prevdata = $backend->get_versiondata($this->_pagename, $previous, true); + $other_content = explode("\n", $prevdata['%content']); + + include_once("lib/diff.php"); + $diff2 = new Diff($other_content, $this_content); + $context_lines = max(4, count($other_content) + 1, + count($this_content) + 1); + $fmt = new UnifiedDiffFormatter($context_lines); + $content = $this->_pagename . " " . $previous . " " . Iso8601DateTime($prevdata['mtime']) . "\n"; + $content .= $this->_pagename . " " . $version . " " . Iso8601DateTime($meta['mtime']) . "\n"; + $content .= $fmt->format($diff2); + + } else { + $difflink = WikiUrl($this->_pagename,array(),true); + $content = $this->_pagename . " " . $version . " " . Iso8601DateTime($meta['mtime']) . "\n"; + $content .= _("New Page"); + } + $editedby = sprintf(_("Edited by: %s"),$meta['author']); + $emails = join(',',$emails); + if (mail($emails,"[".WIKI_NAME."] ".$subject, + $subject."\n". + $editedby."\n". + $difflink."\n\n". + $content)) + trigger_error(sprintf(_("PageChange Notification of %s sent to %s"), + $this->_pagename, $emails), E_USER_NOTICE); + else + trigger_error(sprintf(_("PageChange Notification Error: Couldn't send %s to %s"), + $this->_pagename, $emails), E_USER_WARNING); + } } } diff --git a/lib/difflib.php b/lib/difflib.php index 33fde060f..903e58fb0 100644 --- a/lib/difflib.php +++ b/lib/difflib.php @@ -1,5 +1,5 @@ | // +----------------------------------------------------------------------+ // -// $Id: File_Passwd.php,v 1.4 2004-04-07 23:13:19 rurban Exp $ +// $Id: File_Passwd.php,v 1.5 2004-04-08 01:22:53 rurban Exp $ // // Manipulate standard UNIX passwd,.htpasswd and CVS pserver passwd files @@ -222,7 +222,7 @@ class File_Passwd { function close() { if($this->locked) { foreach($this->users as $user => $pass) { - if($this->cvs[$user]) { + if (isset($this->cvs[$user])) { fputs($this->fplock, "$user:$pass:" . $this->cvs[$user] . "\n"); } else { fputs($this->fplock, "$user:$pass\n"); diff --git a/pgsrc/ReleaseNotes b/pgsrc/ReleaseNotes index 749ea0d97..5834552b0 100644 --- a/pgsrc/ReleaseNotes +++ b/pgsrc/ReleaseNotes @@ -1,36 +1,53 @@ Date: Sun, 27 Jan 2002 17:28:55 -0500 Mime-Version: 1.0 (Produced by PhpWiki 1.3.2-jeffs-hacks) -X-Rcs-Id: $Id: ReleaseNotes,v 1.17 2004-04-01 15:57:20 rurban Exp $ +X-Rcs-Id: $Id: ReleaseNotes,v 1.18 2004-04-08 01:22:54 rurban Exp $ Content-Type: application/x-phpwiki; pagename=ReleaseNotes; - pgsrc_version="2 $Revision: 1.17 $"; + pgsrc_version="2 $Revision: 1.18 $"; flags=PAGE_LOCKED; markup=2; charset=iso-8859-1 Content-Transfer-Encoding: binary -1.3.8 Jan-Mar 2004, Reini Urban: +1.3.8 Jan-Apr 2004, Reini Urban: + +External pluggable authentification, DB prefs and sessions, +some more fixes, docs, themes and plugins. * new WikiUserNew class (after a kick in the ass by Carsten Klapp), - (recursive) with new Preferences (finally from DB), and - improved DB_Session (+ ADODB support) +* new Preferences (finally from DB, no cookies anymore) +* improved DB_Session (with added ADODB + dba support) * enabled WikiGroup (Joby Walker and Reini Urban) -* individual PagePermissions (enabled, but not yet enforced) -* fixed WikiAdminSelect, WikiAdminRemove +* new individual PagePermissions (enabled, but not yet enforced) * new WikiAdminRename, WikiAdminSearchReplace, WikiAdminSetAcl -* several other new plugins: UpLoad, IncludeSiteMap, WikiPoll, WhoIsOnline, - RichTable, CreateToc, AddComment, _WikiTranslation => TranslateText, - CreatePage, -* pear DB update -* InterWiki image buttons -* fixed XHTML dumps (css, images, unlinked pages, \r\r\n issue) -* PageList: enhanced sortby + limit support, sortable gridbuttons enforced +* several other new plugins: WikiPoll, WhoIsOnline, CreateToc, AddComment, + _WikiTranslation => TranslateText, NoCache, + UpLoad (by NathanGass, qubit and Reini Urban), + IncludeSiteMap (by cuthbertcat and Reini Urban), + RichTable (by Sameer D. Sahasrabuddhe), + CreatePage and RateIt (by Dan Frankowski) +* added InterWiki image button support +* added Japanese language support (by Tadashi Jokagi) +* added sqlite support (thanks to Matthew Palmer) +* added theme and plugin-specific PageList column types and theme-specific UserPreferences +* added EmailVerification and PageChangeNotification (experimental) +* added new sess_ip column (DB_Session) for ip-based robot throttling + +* Pear DB update, minor performance improvement for PearDB +* PageList: enhanced sortby + limit support, sortable gridbuttons enforced, cleanup. +* minor theme/default overhaul, new theme/smaller, new experimental theme/wikilens +* updated theme/Sidebar: box methods, fast jscalendar and easier to customize +* more OldStyleTable arguments, PhotoAlbum local fs support +* preliminary action=upgrade (To import new pgsrc pages only yet. not for DB) * preliminary SOAP support -* minor theme/default overhaul and new theme/smaller -* Japanese language support added by Tadashi Jokagi +* experimental javascript Search&Replace edit buttons. + +* fixed WikiAdminSelect, WikiAdminRemove +* fixed and improved XHTML dumps (css, images, unlinked pages, \r\r\n issue) +* fixed ADODB limit problem, fixed dba on Windows PHP 4.3.x +* fixed BlockParser problem with "0" as text * fixed UnfoldSubpages sortby -* more OldStyleTable arguments, PhotoAlbum local fs support -* preliminary action=upgrade +* fixes for PHP5 compatibility started 1.3.4 until 1.3.7, 2002-2003 Jeff, Carsten and Steve Wainstead: diff --git a/themes/default/templates/editpage.tmpl b/themes/default/templates/editpage.tmpl index 111e1f94b..635675a31 100644 --- a/themes/default/templates/editpage.tmpl +++ b/themes/default/templates/editpage.tmpl @@ -1,5 +1,5 @@ - + 'text', 'size' => 3, @@ -55,6 +55,7 @@ $s = $Theme->getButtonSeparator();
+ '; ?>
diff --git a/themes/wikilens/themeinfo.php b/themes/wikilens/themeinfo.php index 097a7f268..1d3cd2add 100644 --- a/themes/wikilens/themeinfo.php +++ b/themes/wikilens/themeinfo.php @@ -1,5 +1,5 @@ customUserPreferences(array( - 'recengine' => new _UserPreference_recengine(), - 'recalgo' => new _UserPreference_recalgo(), + 'recengine' => new _UserPreference_recengine('php'), + 'recalgo' => new _UserPreference_recalgo('itemProb'), //recnnbr: typically 15-30 for item-based, 40-80 for user-based algos 'recnnbr' => new _UserPreference_recnnbr(10,14,80), )); +require_once('lib/PageList.php'); + /** * Custom PageList classes * Rationale: Certain themes should be able to extend the predefined list @@ -145,12 +147,14 @@ class _PageList_Column_rating extends _PageList_Column { $args = "pagename=".$page_handle->_pagename; $args .= " small=1"; $args .= " imgPrefix=".$prefix++; - return $loader->expandPi('<'."?plugin RateIt $args ?".'>',$GLOBALS['request'],$page_handle); + return $loader->expandPi('<'."?plugin RateIt $args ?".'>', + $GLOBALS['request'], $page_handle); } }; // register custom PageList type -$Theme->addPageListColumn(array('rating' => new _PageList_Column_rating('rating', _("Rate")))); +$Theme->addPageListColumn(array('rating' => + new _PageList_Column_rating('rating', _("Rate")))); // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- 2.45.0