From 55a3633d13ba67adadf22c54a7357359f6145425 Mon Sep 17 00:00:00 2001 From: rurban Date: Fri, 12 Mar 2004 20:59:31 +0000 Subject: [PATCH] important cookie fix by Konstantin Zadorozhny new editpage feature: JS_SEARCHREPLACE git-svn-id: svn://svn.code.sf.net/p/phpwiki/code/trunk@3149 96ab9672-09ca-45d6-a79d-3d69d39ca109 --- lib/Request.php | 11 ++++-- lib/WikiUserNew.php | 12 ++++-- lib/editpage.php | 83 ++++++++++++++++++++++++++++++++++++++- lib/plugin/AddComment.php | 12 ++++-- lib/plugin/WikiBlog.php | 14 +++++-- 5 files changed, 117 insertions(+), 15 deletions(-) diff --git a/lib/Request.php b/lib/Request.php index cb1fb5486..051facaeb 100644 --- a/lib/Request.php +++ b/lib/Request.php @@ -1,5 +1,5 @@ page and ->action in session for WhoIsOnline +// better WhoIsOnline icon +// fixed WhoIsOnline warnings +// // Revision 1.41 2004/02/27 01:25:14 rurban // Workarounds for upload handling // diff --git a/lib/WikiUserNew.php b/lib/WikiUserNew.php index 31bf7eb8a..07e08cf8d 100644 --- a/lib/WikiUserNew.php +++ b/lib/WikiUserNew.php @@ -1,5 +1,5 @@ _prefs->isChanged($prefs); if ($updated) { if ($id_only) { - setcookie(WIKI_NAME, serialize(array('userid' => $prefs->get('userid'))), - COOKIE_EXPIRATION_DAYS, COOKIE_DOMAIN); + $request->setCookieVar(WIKI_NAME, serialize(array('userid' => $prefs->get('userid'))), + COOKIE_EXPIRATION_DAYS, COOKIE_DOMAIN); } } $packed = $prefs->store(); @@ -2194,6 +2195,7 @@ class UserPreferences function unpack($packed) { if (!$packed) return false; + //$packed = base64_decode($packed); if (substr($packed, 0, 2) == "O:") { // Looks like a serialized object return unserialize($packed); @@ -2272,6 +2274,10 @@ extends UserPreferences // $Log: not supported by cvs2svn $ +// Revision 1.29 2004/03/11 13:30:47 rurban +// fixed File Auth for user and group +// missing only getMembersOf(Authenticated Users),getMembersOf(Every),getMembersOf(Signed Users) +// // Revision 1.28 2004/03/08 18:17:09 rurban // added more WikiGroup::getMembersOf methods, esp. for special groups // fixed $LDAP_SET_OPTIONS diff --git a/lib/editpage.php b/lib/editpage.php index ac5d26b02..87a1bbbfc 100644 --- a/lib/editpage.php +++ b/lib/editpage.php @@ -1,10 +1,11 @@ getFormElements()); + if (defined('JS_SEARCHREPLACE') and JS_SEARCHREPLACE) { + $tokens['JS_SEARCHREPLACE'] = 1; + $GLOBALS['Theme']->addMoreHeaders(Javascript(" +var wart=0, d, f, x='', replacewin, pretxt=new Array(), pretxt_anzahl=0; +var fag='', fr='', spn=''; + +function define_f() { + f=document.getElementById('editpage'); + f.editarea=document.getElementById('edit[content]'); + if(f.rck.style) f.rck.style.color='#ececec'; +} + +function replace() { + replacewin=window.open('','','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,height=90,width=450'); + replacewin.window.document.write('"._("Search & Replace")."
'+fag+'"._("Search").":
'+fag+' "._("Replace with").":
   
'); + replacewin.window.document.close(); +} + +function do_replace() { + var txt=pretxt[pretxt_anzahl]=f.editarea.value, ein=new RegExp(replacewin.document.forms[0].ein.value,'g'), aus=replacewin.document.forms[0].aus.value; + if(ein==''||ein==null) { + replacewin.window.document.forms[0].ein.focus(); + return; + } + var z_repl=txt.match(ein)? txt.match(ein).length : 0; + txt=txt.replace(ein,aus); + ein=ein.toString().substring(1,ein.toString().length-2); + result(z_repl, 'Substring \"'+ein+'\" found '+z_repl+' times. Replace with \"'+aus+'\"?', txt, 'String \"'+ein+'\" not found.'); + replacewin.window.focus(); + replacewin.window.document.forms[0].ein.focus(); +} +function result(zahl,frage,txt,alert_txt) { + if(wart!=0&&wart.window) { + wart.window.close(); + wart=0; + } + if(zahl>0) { + if(window.confirm(frage)==true) { + f.editarea.value=txt; + pretxt_anzahl++; + if(f.rck.style) f.rck.style.color='#000000'; + f.rck.value='"._("Undo")."'; + } + } else alert(alert_txt); +} +function rueck() { + if(pretxt_anzahl==0) return; + else if(pretxt_anzahl>0) { + f.editarea.value=pretxt[pretxt_anzahl-1]; + pretxt[pretxt_anzahl]=null; + pretxt_anzahl--; + if(pretxt_anzahl==0) { + alert('Operation undone.'); + if(f.rck.style) f.rck.style.color='#ececec'; + f.rck.value='("._("Undo").")'; + if(f.rck.blur) f.rck.blur(); + } + } +} +function speich() { + pretxt[pretxt_anzahl]=f.editarea.value; + pretxt_anzahl++; + if(f.rck.style) f.rck.style.color='#000000'; + f.rck.value='"._("Undo")."'; +} +")); + $GLOBALS['Theme']->addMoreAttr('body'," onload='define_f()'"); + } + return $this->output('editpage', _("Edit: %s")); } @@ -542,6 +612,15 @@ extends PageEditor /** $Log: not supported by cvs2svn $ + Revision 1.60 2004/02/15 21:34:37 rurban + PageList enhanced and improved. + fixed new WikiAdmin... plugins + editpage, Theme with exp. htmlarea framework + (htmlarea yet committed, this is really questionable) + WikiUser... code with better session handling for prefs + enhanced UserPreferences (again) + RecentChanges for show_deleted: how should pages be deleted then? + Revision 1.59 2003/12/07 20:35:26 carstenklapp Bugfix: Concurrent updates broken since after 1.3.4 release: Fatal error: Call to undefined function: gettransformedcontent() in diff --git a/lib/plugin/AddComment.php b/lib/plugin/AddComment.php index 5a97ef3ca..3d115a603 100644 --- a/lib/plugin/AddComment.php +++ b/lib/plugin/AddComment.php @@ -1,5 +1,5 @@ '[pagename]', @@ -107,6 +108,11 @@ extends WikiPlugin_WikiBlog }; // $Log: not supported by cvs2svn $ +// Revision 1.1 2004/03/12 17:32:41 rurban +// new base class PageType_attach as base class for WikiBlog, Comment, and WikiForum. +// new plugin AddComment, which is a WikiBlog with different pagetype and template, +// based on WikiBlog. WikiForum comes later. +// // // For emacs users diff --git a/lib/plugin/WikiBlog.php b/lib/plugin/WikiBlog.php index cfb0a094e..e5fae3cca 100644 --- a/lib/plugin/WikiBlog.php +++ b/lib/plugin/WikiBlog.php @@ -1,5 +1,5 @@