From: <var...@us...> - 2009-02-27 13:10:11
|
Revision: 6598 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=6598&view=rev Author: vargenau Date: 2009-02-27 12:54:19 +0000 (Fri, 27 Feb 2009) Log Message: ----------- Disable verification of emails for corporate env. Modified Paths: -------------- trunk/lib/MailNotify.php Modified: trunk/lib/MailNotify.php =================================================================== --- trunk/lib/MailNotify.php 2009-02-27 12:35:03 UTC (rev 6597) +++ trunk/lib/MailNotify.php 2009-02-27 12:54:19 UTC (rev 6598) @@ -1,5 +1,23 @@ -<?php //-*-php-*- -rcs_id('$Id$'); +<?php rcs_id('$Id$'); + * Copyright (C) 2006-2007 Reini Urban + * Copyright (C) 2009 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 + */ /** * Handle the pagelist pref[notifyPages] logic for users @@ -47,6 +65,12 @@ function userEmail($userid, $doverify = true) { global $request; + + // Disable verification of emails for corporate env. + if (defined('GFORGE') and GFORGE) { + $doverify = false; + } + $u = $request->getUser(); if ($u->UserName() == $userid) { // lucky: current user $prefs = $u->getPreferences(); @@ -380,41 +404,6 @@ } } - -// $Log: not supported by cvs2svn $ -// Revision 1.10 2007/05/01 16:14:21 rurban -// fix cache -// -// Revision 1.9 2007/03/10 18:22:51 rurban -// Patch 1677950 by Erwann Penet -// -// Revision 1.8 2007/01/25 07:41:54 rurban -// Add wikimail.log default on unix -// -// Revision 1.7 2007/01/20 11:25:38 rurban -// Fix onDeletePage warning and content -// -// Revision 1.6 2007/01/09 12:34:55 rurban -// Fix typo (syntax error) -// -// Revision 1.5 2007/01/07 18:42:58 rurban -// Add MAILER_LOG logfile -// -// Revision 1.4 2007/01/04 16:47:49 rurban -// improve text -// -// Revision 1.3 2006/12/24 13:35:43 rurban -// added experimental EMailConfirm auth. (not yet tested) -// requires actionpage ConfirmEmail -// TBD: purge expired cookies -// -// Revision 1.2 2006/12/23 11:50:45 rurban -// added missing result init -// -// Revision 1.1 2006/12/22 17:59:55 rurban -// Move mailer functions into seperate MailNotify.php -// - // Local Variables: // mode: php // tab-width: 8 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2009-03-01 19:19:44
|
Revision: 6616 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=6616&view=rev Author: vargenau Date: 2009-03-01 19:19:41 +0000 (Sun, 01 Mar 2009) Log Message: ----------- Fix comment syntax Modified Paths: -------------- trunk/lib/MailNotify.php Modified: trunk/lib/MailNotify.php =================================================================== --- trunk/lib/MailNotify.php 2009-03-01 18:54:26 UTC (rev 6615) +++ trunk/lib/MailNotify.php 2009-03-01 19:19:41 UTC (rev 6616) @@ -1,5 +1,6 @@ -<?php rcs_id('$Id$'); - * Copyright (C) 2006-2007 Reini Urban +<?php +rcs_id('$Id$'); +/* Copyright (C) 2006-2007 Reini Urban * Copyright (C) 2009 Marc-Etienne Vargenau, Alcatel-Lucent * * This file is part of PhpWiki. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2009-06-03 11:47:46
|
Revision: 6847 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=6847&view=rev Author: vargenau Date: 2009-06-03 11:47:39 +0000 (Wed, 03 Jun 2009) Log Message: ----------- Gforge stores fully qualified e-mail address Modified Paths: -------------- trunk/lib/MailNotify.php Modified: trunk/lib/MailNotify.php =================================================================== --- trunk/lib/MailNotify.php 2009-06-02 16:50:19 UTC (rev 6846) +++ trunk/lib/MailNotify.php 2009-06-03 11:47:39 UTC (rev 6847) @@ -1,4 +1,4 @@ -<?php +<?php rcs_id('$Id$'); /* Copyright (C) 2006-2007 Reini Urban * Copyright (C) 2009 Marc-Etienne Vargenau, Alcatel-Lucent @@ -61,7 +61,11 @@ function fromId() { global $request; - return $request->_user->getId() . '@' . $request->get('REMOTE_HOST'); + if (defined('GFORGE') and GFORGE) { + return $request->_user->getId(); + } else { + return $request->_user->getId() . '@' . $request->get('REMOTE_HOST'); + } } function userEmail($userid, $doverify = true) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2009-06-03 11:59:15
|
Revision: 6848 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=6848&view=rev Author: vargenau Date: 2009-06-03 11:59:14 +0000 (Wed, 03 Jun 2009) Log Message: ----------- Include page content in notification e-mail for page creation Modified Paths: -------------- trunk/lib/MailNotify.php Modified: trunk/lib/MailNotify.php =================================================================== --- trunk/lib/MailNotify.php 2009-06-03 11:47:39 UTC (rev 6847) +++ trunk/lib/MailNotify.php 2009-06-03 11:59:14 UTC (rev 6848) @@ -238,6 +238,8 @@ $content = $this->pagename . " " . $version . " " . Iso8601DateTime($meta['mtime']) . "\n"; $content .= _("New page"); + $content .= "\n\n"; + $content .= $wikitext; } $editedby = sprintf(_("Edited by: %s"), $this->from); //$editedby = sprintf(_("Edited by: %s"), $meta['author']); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2009-06-04 16:49:57
|
Revision: 6897 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=6897&view=rev Author: vargenau Date: 2009-06-04 16:49:55 +0000 (Thu, 04 Jun 2009) Log Message: ----------- Do not send if modification is from Gforge admin Modified Paths: -------------- trunk/lib/MailNotify.php Modified: trunk/lib/MailNotify.php =================================================================== --- trunk/lib/MailNotify.php 2009-06-04 16:44:46 UTC (rev 6896) +++ trunk/lib/MailNotify.php 2009-06-04 16:49:55 UTC (rev 6897) @@ -155,6 +155,12 @@ $silent = true; $emails = $this->emails; $from = $this->from; + // Do not send if modification is from Gforge admin + if (defined('GFORGE') and GFORGE) { + if ($from == ADMIN_USER) { + return; + } + } if (!$notice) $notice = _("PageChange Notification of %s"); $ok = mail(($to = array_shift($emails)), "[".WIKI_NAME."] ".$subject, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2009-06-10 12:54:50
|
Revision: 6909 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=6909&view=rev Author: vargenau Date: 2009-06-10 12:51:48 +0000 (Wed, 10 Jun 2009) Log Message: ----------- More mail headers Modified Paths: -------------- trunk/lib/MailNotify.php Modified: trunk/lib/MailNotify.php =================================================================== --- trunk/lib/MailNotify.php 2009-06-09 18:18:27 UTC (rev 6908) +++ trunk/lib/MailNotify.php 2009-06-10 12:51:48 UTC (rev 6909) @@ -192,10 +192,16 @@ } } if (!$notice) $notice = _("PageChange Notification of %s"); + $headers = "From: $from\r\n" . + "Bcc: ".join(',', $emails)."\r\n" . + "MIME-Version: 1.0\r\n" . + "Content-Type: text/plain; charset=".CHARSET."; format=flowed\r\n" . + "Content-Transfer-Encoding: 8bit"; + $ok = mail(($to = array_shift($emails)), "[".WIKI_NAME."] ".$subject, $subject."\n".$content, - "From: $from\r\nBcc: ".join(',', $emails) + $headers ); if (MAILER_LOG and is_writable(MAILER_LOG)) { $f = fopen(MAILER_LOG, "a"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2009-08-04 12:55:05
|
Revision: 7052 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=7052&view=rev Author: vargenau Date: 2009-08-04 12:54:57 +0000 (Tue, 04 Aug 2009) Log Message: ----------- Be silent by default Modified Paths: -------------- trunk/lib/MailNotify.php Modified: trunk/lib/MailNotify.php =================================================================== --- trunk/lib/MailNotify.php 2009-07-31 20:12:11 UTC (rev 7051) +++ trunk/lib/MailNotify.php 2009-08-04 12:54:57 UTC (rev 7052) @@ -176,13 +176,11 @@ return array($this->emails, $this->userids); } - function sendMail($subject, $content, + function sendMail($subject, + $content, $notice = false, - $silent = 0) + $silent = true) { - global $request; - if (!DEBUG and $silent === 0) - $silent = true; $emails = $this->emails; $from = $this->from; // Do not send if modification is from Gforge admin This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2009-09-16 09:12:08
|
Revision: 7127 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=7127&view=rev Author: vargenau Date: 2009-09-16 09:12:00 +0000 (Wed, 16 Sep 2009) Log Message: ----------- No need to send empty page content; improved subject Modified Paths: -------------- trunk/lib/MailNotify.php Modified: trunk/lib/MailNotify.php =================================================================== --- trunk/lib/MailNotify.php 2009-09-16 09:04:10 UTC (rev 7126) +++ trunk/lib/MailNotify.php 2009-09-16 09:12:00 UTC (rev 7127) @@ -343,26 +343,11 @@ //TODO: deferr it (quite a massive load if you remove some pages). $this->getPageChangeEmails($notify); if (!empty($this->emails)) { - $editedby = sprintf(_("Removed by: %s"), $this->from); // Todo: host_id - //$emails = join(',', $this->emails); - $subject = sprintf(_("Page removed %s"), $pagename); - $page = $wikidb->getPage($pagename); - $rev = $page->getCurrentRevision(true); - $content = $rev->getPackedContent(); - $result = $this->sendMail($subject, - $editedby."\n"."Deleted $pagename"."\n\n".$content); + $subject = sprintf(_("User %s removed page %s"), $this->from, $pagename); + $result = $this->sendMail($subject, $subject."\n\n"); } } } - //How to create a RecentChanges entry with explaining summary? Dynamically - /* - $page = $this->getPage($pagename); - $current = $page->getCurrentRevision(); - $meta = $current->_data; - $version = $current->getVersion(); - $meta['summary'] = _("removed"); - $page->save($current->getPackedContent(), $version + 1, $meta); - */ return $result; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ru...@us...> - 2009-09-16 12:54:46
|
Revision: 7128 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=7128&view=rev Author: rurban Date: 2009-09-16 12:54:07 +0000 (Wed, 16 Sep 2009) Log Message: ----------- always prefix mails with [WIKI_NAME] Modified Paths: -------------- trunk/lib/MailNotify.php Modified: trunk/lib/MailNotify.php =================================================================== --- trunk/lib/MailNotify.php 2009-09-16 09:12:00 UTC (rev 7127) +++ trunk/lib/MailNotify.php 2009-09-16 12:54:07 UTC (rev 7128) @@ -1,6 +1,6 @@ <?php rcs_id('$Id$'); -/* Copyright (C) 2006-2007 Reini Urban +/* Copyright (C) 2006-2007,2009 Reini Urban * Copyright (C) 2009 Marc-Etienne Vargenau, Alcatel-Lucent * * This file is part of PhpWiki. @@ -181,10 +181,8 @@ $notice = false, $silent = true) { - if (defined('GFORGE') and GFORGE) { - // Add WIKI_NAME to Subject - $subject = "[".WIKI_NAME."] ".$subject; - } + // Add WIKI_NAME to Subject + $subject = "[".WIKI_NAME."] ".$subject; // Encode $subject if needed $encoded_subject = $this->subject_encode($subject); $emails = $this->emails; @@ -213,7 +211,8 @@ if (!$ok) { global $ErrorManager; // get last error message - $last_err = $ErrorManager->_postponed_errors[count($ErrorHandler->_postponed_errors)-1]; + $last_err = + $ErrorManager->_postponed_errors[count($ErrorHandler->_postponed_errors)-1]; fwrite($f, "\nX-MailFailure: " . $last_err); } fwrite($f, "\nDate: " . CTime()); @@ -304,7 +303,6 @@ array($this->pagename, $to, $meta, $this->emails, $this->userids); } else { $pagename = $this->pagename; - //$editedby = sprintf(_("Edited by: %s"), $meta['author']) . ' ' . $meta['author_id']; $editedby = sprintf(_("Edited by: %s"), $this->from); $subject = sprintf(_("Page rename %s to %s"), $pagename, $to); $link = WikiURL($to, true); @@ -379,7 +377,7 @@ while(!empty($data[$id])) { // id collision $id = rand_ascii_readable(16); } - $subject = WIKI_NAME . " " . _("e-mail address confirmation"); + $subject = _("E-Mail address confirmation"); $ip = $request->get('REMOTE_HOST'); $expire_date = time() + 7*86400; $content = fmt("Someone, probably you from IP address %s, has registered an This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2009-09-16 14:45:43
|
Revision: 7134 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=7134&view=rev Author: vargenau Date: 2009-09-16 14:45:35 +0000 (Wed, 16 Sep 2009) Log Message: ----------- Removed comment; whitespace Modified Paths: -------------- trunk/lib/MailNotify.php Modified: trunk/lib/MailNotify.php =================================================================== --- trunk/lib/MailNotify.php 2009-09-16 14:15:11 UTC (rev 7133) +++ trunk/lib/MailNotify.php 2009-09-16 14:45:35 UTC (rev 7134) @@ -287,7 +287,6 @@ $content .= $wikitext; } $editedby = sprintf(_("Edited by: %s"), $this->from); - //$editedby = sprintf(_("Edited by: %s"), $meta['author']); $this->sendMail($subject, $editedby."\n".$difflink."\n\n".$content); } @@ -334,19 +333,19 @@ function onDeletePage (&$wikidb, $pagename) { $result = true; - /* Generate notification emails? */ - if (! $wikidb->isWikiPage($pagename) and !isa($GLOBALS['request'],'MockRequest')) { - $notify = $wikidb->get('notify'); - if (!empty($notify) and is_array($notify)) { - //TODO: deferr it (quite a massive load if you remove some pages). - $this->getPageChangeEmails($notify); - if (!empty($this->emails)) { + /* Generate notification emails? */ + if (! $wikidb->isWikiPage($pagename) and !isa($GLOBALS['request'],'MockRequest')) { + $notify = $wikidb->get('notify'); + if (!empty($notify) and is_array($notify)) { + //TODO: deferr it (quite a massive load if you remove some pages). + $this->getPageChangeEmails($notify); + if (!empty($this->emails)) { $subject = sprintf(_("User %s removed page %s"), $this->from, $pagename); $result = $this->sendMail($subject, $subject."\n\n"); - } - } - } - return $result; + } + } + } + return $result; } function onRenamePage (&$wikidb, $oldpage, $new_pagename) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2009-09-17 14:13:07
|
Revision: 7143 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=7143&view=rev Author: vargenau Date: 2009-09-17 14:12:58 +0000 (Thu, 17 Sep 2009) Log Message: ----------- Encoding header was missing in mail subject Modified Paths: -------------- trunk/lib/MailNotify.php Modified: trunk/lib/MailNotify.php =================================================================== --- trunk/lib/MailNotify.php 2009-09-17 10:50:20 UTC (rev 7142) +++ trunk/lib/MailNotify.php 2009-09-17 14:12:58 UTC (rev 7143) @@ -450,11 +450,11 @@ // Let us try quoted printable first if (function_exists('quoted_printable_encode')) { // PHP 5.3 - return quoted_printable_encode($subject); + return "=?UTF-8?Q?".quoted_printable_encode($subject)."?="; } // If not, encode in base64 (less human-readable) - return base64_encode($subject); + return "=?UTF-8?B?".base64_encode($subject)."?="; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2010-01-22 14:59:37
|
Revision: 7289 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=7289&view=rev Author: vargenau Date: 2010-01-22 14:59:22 +0000 (Fri, 22 Jan 2010) Log Message: ----------- Add summary in e-mail notification Modified Paths: -------------- trunk/lib/MailNotify.php Modified: trunk/lib/MailNotify.php =================================================================== --- trunk/lib/MailNotify.php 2010-01-22 14:54:05 UTC (rev 7288) +++ trunk/lib/MailNotify.php 2010-01-22 14:59:22 UTC (rev 7289) @@ -287,8 +287,9 @@ $content .= $wikitext; } $editedby = sprintf(_("Edited by: %s"), $this->from); + $summary = sprintf(_("Summary: %s"), $meta['summary']); $this->sendMail($subject, - $editedby."\n".$difflink."\n\n".$content); + $editedby."\n".$summary."\n".$difflink."\n\n".$content); } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2010-06-23 15:09:19
|
Revision: 7561 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=7561&view=rev Author: vargenau Date: 2010-06-23 15:09:13 +0000 (Wed, 23 Jun 2010) Log Message: ----------- Remove unused functions sendEmailConfirmation checkEmailConfirmation Modified Paths: -------------- trunk/lib/MailNotify.php Modified: trunk/lib/MailNotify.php =================================================================== --- trunk/lib/MailNotify.php 2010-06-23 14:43:29 UTC (rev 7560) +++ trunk/lib/MailNotify.php 2010-06-23 15:09:13 UTC (rev 7561) @@ -364,79 +364,6 @@ } } - /** - * Send mail to user and store the cookie in the db - * wikiurl?action=ConfirmEmail&id=bla - */ - function sendEmailConfirmation ($email, $userid) { - $id = rand_ascii_readable(16); - $wikidb = $GLOBALS['request']->getDbh(); - $data = $wikidb->get('ConfirmEmail'); - while(!empty($data[$id])) { // id collision - $id = rand_ascii_readable(16); - } - $subject = _("E-Mail address confirmation"); - $ip = $request->get('REMOTE_HOST'); - $expire_date = time() + 7*86400; - $content = fmt("Someone, probably you from IP address %s, has registered an -account \"%s\" with this e-mail address on %s. - -To confirm that this account really does belong to you and activate -e-mail features on %s, open this link in your browser: - -%s - -If this is *not* you, don't follow the link. This confirmation code -will expire at %s.", - $ip, $userid, WIKI_NAME, WIKI_NAME, - WikiURL(HOME_PAGE, array('action' => 'ConfirmEmail', - 'id' => $id), - true), - CTime($expire_date)); - $this->sendMail($subject, $content, "", true); - $data[$id] = array('email' => $email, - 'userid' => $userid, - 'expire' => $expire_date); - $wikidb->set('ConfirmEmail', $data); - return ''; - } - - function checkEmailConfirmation () { - global $request; - $wikidb = $request->getDbh(); - $data = $wikidb->get('ConfirmEmail'); - $id = $request->getArg('id'); - if (empty($data[$id])) { // id not found - return HTML(HTML::h1("Confirm E-mail address"), - HTML::h1("Sorry! Wrong URL")); - } - // upgrade the user - $userid = $data['userid']; - $email = $data['email']; - $u = $request->getUser(); - if ($u->UserName() == $userid) { // lucky: current user (session) - $prefs = $u->getPreferences(); - $request->_user->_level = WIKIAUTH_USER; - $request->_prefs->set('emailVerified', true); - } else { // not current user - if (ENABLE_USER_NEW) { - $u = WikiUser($userid); - $u->getPreferences(); - $prefs = &$u->_prefs; - } else { - $u = new WikiUser($request, $userid); - $prefs = $u->getPreferences(); - } - $u->_level = WIKIAUTH_USER; - $request->setUser($u); - $request->_prefs->set('emailVerified', true); - } - unset($data[$id]); - $wikidb->set('ConfirmEmail', $data); - return HTML(HTML::h1("Confirm E-mail address"), - HTML::p("Your e-mail address has now been confirmed.")); - } - function subject_encode ($subject) { // We need to encode the subject if it contains non-ASCII characters // The page name may contain non-ASCII characters, as well as This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2011-05-04 10:23:56
|
Revision: 8064 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=8064&view=rev Author: vargenau Date: 2011-05-04 10:23:50 +0000 (Wed, 04 May 2011) Log Message: ----------- ErrorHandler->_postponed_errors --> ErrorManager->_postponed_errors Modified Paths: -------------- trunk/lib/MailNotify.php Modified: trunk/lib/MailNotify.php =================================================================== --- trunk/lib/MailNotify.php 2011-05-04 10:22:51 UTC (rev 8063) +++ trunk/lib/MailNotify.php 2011-05-04 10:23:50 UTC (rev 8064) @@ -204,14 +204,15 @@ $headers ); if (MAILER_LOG and is_writable(MAILER_LOG)) { + global $ErrorManager; + $f = fopen(MAILER_LOG, "a"); fwrite($f, "\n\nX-MailSentOK: " . $ok ? 'OK' : 'FAILED'); - if (!$ok) { - global $ErrorManager; - // get last error message - $last_err = - $ErrorManager->_postponed_errors[count($ErrorHandler->_postponed_errors)-1]; - fwrite($f, "\nX-MailFailure: " . $last_err); + + if (!$ok && isset($ErrorManager->_postponed_errors[count($ErrorManager->_postponed_errors)-1])) { + // get last error message + $last_err = $ErrorManager->_postponed_errors[count($ErrorManager->_postponed_errors)-1]; + fwrite($f, "\nX-MailFailure: " . $last_err); } fwrite($f, "\nDate: " . CTime()); fwrite($f, "\nSubject: $encoded_subject"); @@ -246,7 +247,7 @@ global $request; - if (@is_array($request->_deferredPageChangeNotification)) { + if (isset($request->_deferredPageChangeNotification)) { // collapse multiple changes (loaddir) into one email $request->_deferredPageChangeNotification[] = array($this->pagename, $this->emails, $this->userids); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2011-11-02 14:32:55
|
Revision: 8171 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=8171&view=rev Author: vargenau Date: 2011-11-02 14:32:49 +0000 (Wed, 02 Nov 2011) Log Message: ----------- Convert error object to string Modified Paths: -------------- trunk/lib/MailNotify.php Modified: trunk/lib/MailNotify.php =================================================================== --- trunk/lib/MailNotify.php 2011-11-02 13:08:16 UTC (rev 8170) +++ trunk/lib/MailNotify.php 2011-11-02 14:32:49 UTC (rev 8171) @@ -212,7 +212,11 @@ if (!$ok && isset($ErrorManager->_postponed_errors[count($ErrorManager->_postponed_errors)-1])) { // get last error message $last_err = $ErrorManager->_postponed_errors[count($ErrorManager->_postponed_errors)-1]; - fwrite($f, "\nX-MailFailure: " . $last_err); + fwrite($f, "\nX-MailFailure: " . + "errno: " . $last_err->errno . ", " . + "errstr: " . $last_err->errstr . ", " . + "errfile: " . $last_err->errfile . ", " . + "errline: " . $last_err->errline); } fwrite($f, "\nDate: " . CTime()); fwrite($f, "\nSubject: $encoded_subject"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2012-01-03 14:09:29
|
Revision: 8222 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=8222&view=rev Author: vargenau Date: 2012-01-03 14:09:23 +0000 (Tue, 03 Jan 2012) Log Message: ----------- Add braces Modified Paths: -------------- trunk/lib/MailNotify.php Modified: trunk/lib/MailNotify.php =================================================================== --- trunk/lib/MailNotify.php 2012-01-03 13:46:55 UTC (rev 8221) +++ trunk/lib/MailNotify.php 2012-01-03 14:09:23 UTC (rev 8222) @@ -42,16 +42,18 @@ * @author Reini Urban */ -if (!defined("MAILER_LOG")) - if (isWindows()) +if (!defined("MAILER_LOG")) { + if (isWindows()) { define("MAILER_LOG", 'c:/wikimail.log'); - else + } else { define("MAILER_LOG", '/var/log/wikimail.log'); + } +} class MailNotify { function MailNotify($pagename) { - $this->pagename = $pagename; /* which page */ + $this->pagename = $pagename; /* which page */ $this->emails = array(); /* to which addresses */ $this->userids = array(); /* corresponding array of displayed names, don't display the email addresses */ @@ -81,8 +83,9 @@ $prefs = $u->getPreferences(); $email = $prefs->get('email'); // do a dynamic emailVerified check update - if ($doverify and !$request->_prefs->get('emailVerified')) + if ($doverify and !$request->_prefs->get('emailVerified')) { $email = ''; + } } else { // not current user if (ENABLE_USER_NEW) { $u = WikiUser($userid); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2012-01-03 14:13:13
|
Revision: 8223 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=8223&view=rev Author: vargenau Date: 2012-01-03 14:13:07 +0000 (Tue, 03 Jan 2012) Log Message: ----------- Add braces Modified Paths: -------------- trunk/lib/MailNotify.php Modified: trunk/lib/MailNotify.php =================================================================== --- trunk/lib/MailNotify.php 2012-01-03 14:09:23 UTC (rev 8222) +++ trunk/lib/MailNotify.php 2012-01-03 14:13:07 UTC (rev 8223) @@ -263,7 +263,9 @@ $backend = &$request->_dbi->_backend; $subject = _("Page change").' '.($this->pagename); $previous = $backend->get_previous_version($this->pagename, $version); - if (!isset($meta['mtime'])) $meta['mtime'] = time(); + if (!isset($meta['mtime'])) { + $meta['mtime'] = time(); + } if ($previous) { $difflink = WikiURL($this->pagename, array('action'=>'diff'), true); $cache = &$request->_dbi->_cache; @@ -322,13 +324,13 @@ */ function onChangePage (&$wikidb, &$wikitext, $version, &$meta) { $result = true; - if (!isa($GLOBALS['request'],'MockRequest')) { - $notify = $wikidb->get('notify'); + if (!isa($GLOBALS['request'],'MockRequest')) { + $notify = $wikidb->get('notify'); /* Generate notification emails? */ - if (!empty($notify) and is_array($notify)) { + if (!empty($notify) and is_array($notify)) { if (empty($this->pagename)) $this->pagename = $meta['pagename']; - // TODO: Should be used for ModeratePage and RSS2 Cloud xml-rpc also. + // TODO: Should be used for ModeratePage and RSS2 Cloud xml-rpc also. $this->getPageChangeEmails($notify); if (!empty($this->emails)) { $result = $this->sendPageChangeNotification($wikitext, $version, $meta); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2012-01-03 14:23:35
|
Revision: 8224 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=8224&view=rev Author: vargenau Date: 2012-01-03 14:23:29 +0000 (Tue, 03 Jan 2012) Log Message: ----------- Avoid warning due to mass rename not yet supported; "Edited by:" --> "Renamed by:" Modified Paths: -------------- trunk/lib/MailNotify.php Modified: trunk/lib/MailNotify.php =================================================================== --- trunk/lib/MailNotify.php 2012-01-03 14:13:07 UTC (rev 8223) +++ trunk/lib/MailNotify.php 2012-01-03 14:23:29 UTC (rev 8224) @@ -301,22 +301,15 @@ } /** - * Support mass rename / remove (not yet tested) + * Support mass rename / remove (TBD) */ function sendPageRenameNotification ($to, &$meta) { - global $request; - - if (@is_array($request->_deferredPageRenameNotification)) { - $request->_deferredPageRenameNotification[] = - array($this->pagename, $to, $meta, $this->emails, $this->userids); - } else { - $pagename = $this->pagename; - $editedby = sprintf(_("Edited by: %s"), $this->from); - $subject = sprintf(_("Page rename %s to %s"), $pagename, $to); - $link = WikiURL($to, true); - $this->sendMail($subject, - $editedby."\n".$link."\n\n"."Renamed $pagename to $to"); - } + $pagename = $this->pagename; + $editedby = sprintf(_("Renamed by: %s"), $this->fromId()); + $subject = sprintf(_("Page rename %s to %s"), $pagename, $to); + $link = WikiURL($to, true); + $this->sendMail($subject, + $editedby."\n".$link."\n\n"."Renamed $pagename to $to"); } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2012-01-27 17:31:38
|
Revision: 8235 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=8235&view=rev Author: vargenau Date: 2012-01-27 17:31:31 +0000 (Fri, 27 Jan 2012) Log Message: ----------- Whitespace only Modified Paths: -------------- trunk/lib/MailNotify.php Modified: trunk/lib/MailNotify.php =================================================================== --- trunk/lib/MailNotify.php 2012-01-23 15:57:15 UTC (rev 8234) +++ trunk/lib/MailNotify.php 2012-01-27 17:31:31 UTC (rev 8235) @@ -206,29 +206,29 @@ $subject."\n".$content, $headers ); - if (MAILER_LOG and is_writable(MAILER_LOG)) { - global $ErrorManager; + if (MAILER_LOG and is_writable(MAILER_LOG)) { + global $ErrorManager; - $f = fopen(MAILER_LOG, "a"); - fwrite($f, "\n\nX-MailSentOK: " . $ok ? 'OK' : 'FAILED'); + $f = fopen(MAILER_LOG, "a"); + fwrite($f, "\n\nX-MailSentOK: " . $ok ? 'OK' : 'FAILED'); - if (!$ok && isset($ErrorManager->_postponed_errors[count($ErrorManager->_postponed_errors)-1])) { - // get last error message - $last_err = $ErrorManager->_postponed_errors[count($ErrorManager->_postponed_errors)-1]; - fwrite($f, "\nX-MailFailure: " . - "errno: " . $last_err->errno . ", " . - "errstr: " . $last_err->errstr . ", " . - "errfile: " . $last_err->errfile . ", " . - "errline: " . $last_err->errline); + if (!$ok && isset($ErrorManager->_postponed_errors[count($ErrorManager->_postponed_errors)-1])) { + // get last error message + $last_err = $ErrorManager->_postponed_errors[count($ErrorManager->_postponed_errors)-1]; + fwrite($f, "\nX-MailFailure: " . + "errno: " . $last_err->errno . ", " . + "errstr: " . $last_err->errstr . ", " . + "errfile: " . $last_err->errfile . ", " . + "errline: " . $last_err->errline); + } + fwrite($f, "\nDate: " . CTime()); + fwrite($f, "\nSubject: $encoded_subject"); + fwrite($f, "\nFrom: $from"); + fwrite($f, "\nTo: $to"); + fwrite($f, "\nBcc: ".join(',', $emails)); + fwrite($f, "\n\n". $content); + fclose($f); } - fwrite($f, "\nDate: " . CTime()); - fwrite($f, "\nSubject: $encoded_subject"); - fwrite($f, "\nFrom: $from"); - fwrite($f, "\nTo: $to"); - fwrite($f, "\nBcc: ".join(',', $emails)); - fwrite($f, "\n\n". $content); - fclose($f); - } if ($ok) { if (!$silent) trigger_error(sprintf($notice, $this->pagename) @@ -271,8 +271,9 @@ $cache = &$request->_dbi->_cache; $this_content = explode("\n", $wikitext); $prevdata = $cache->get_versiondata($this->pagename, $previous, true); - if (empty($prevdata['%content'])) + if (empty($prevdata['%content'])) { $prevdata = $backend->get_versiondata($this->pagename, $previous, true); + } $other_content = explode("\n", $prevdata['%content']); include_once("lib/difflib.php"); @@ -328,10 +329,10 @@ if (!empty($this->emails)) { $result = $this->sendPageChangeNotification($wikitext, $version, $meta); } + } } + return $result; } - return $result; - } function onDeletePage (&$wikidb, $pagename) { $result = true; @@ -352,20 +353,20 @@ function onRenamePage (&$wikidb, $oldpage, $new_pagename) { $result = true; - if (!isa($GLOBALS['request'], 'MockRequest')) { - $notify = $wikidb->get('notify'); - if (!empty($notify) and is_array($notify)) { - $this->getPageChangeEmails($notify); - if (!empty($this->emails)) { - $newpage = $wikidb->getPage($new_pagename); - $current = $newpage->getCurrentRevision(); - $meta = $current->_data; + if (!isa($GLOBALS['request'], 'MockRequest')) { + $notify = $wikidb->get('notify'); + if (!empty($notify) and is_array($notify)) { + $this->getPageChangeEmails($notify); + if (!empty($this->emails)) { + $newpage = $wikidb->getPage($new_pagename); + $current = $newpage->getCurrentRevision(); + $meta = $current->_data; $this->pagename = $oldpage; - $result = $this->sendPageRenameNotification($new_pagename, $meta); + $result = $this->sendPageRenameNotification($new_pagename, $meta); + } + } } - } } - } /** * Send mail to user and store the cookie in the db This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2012-01-27 17:46:00
|
Revision: 8236 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=8236&view=rev Author: vargenau Date: 2012-01-27 17:45:54 +0000 (Fri, 27 Jan 2012) Log Message: ----------- Improve messages Modified Paths: -------------- trunk/lib/MailNotify.php Modified: trunk/lib/MailNotify.php =================================================================== --- trunk/lib/MailNotify.php 2012-01-27 17:31:31 UTC (rev 8235) +++ trunk/lib/MailNotify.php 2012-01-27 17:45:54 UTC (rev 8236) @@ -70,6 +70,11 @@ } } + function fromEmail() { + global $request; + return $this->userEmail($request->_user->getId(), false); + } + function userEmail($userid, $doverify = true) { global $request; @@ -189,12 +194,14 @@ // Encode $subject if needed $encoded_subject = $this->subject_encode($subject); $emails = $this->emails; - $from = $this->from; // Do not send if modification is from FusionForge admin - if (FUSIONFORGE and $from == ADMIN_USER) { + if (FUSIONFORGE and ($this->fromId() == ADMIN_USER)) { return; } - if (!$notice) $notice = _("PageChange Notification of %s"); + if (!$notice) { + $notice = _("PageChange Notification of %s"); + } + $from = $this->fromEmail(); $headers = "From: $from\r\n" . "Bcc: ".join(',', $emails)."\r\n" . "MIME-Version: 1.0\r\n" . @@ -261,12 +268,13 @@ return; } $backend = &$request->_dbi->_backend; - $subject = _("Page change").' '.($this->pagename); $previous = $backend->get_previous_version($this->pagename, $version); if (!isset($meta['mtime'])) { $meta['mtime'] = time(); } if ($previous) { + // Page existed, and was modified + $subject = _("Page change").' '.($this->pagename); $difflink = WikiURL($this->pagename, array('action'=>'diff'), true); $cache = &$request->_dbi->_cache; $this_content = explode("\n", $wikitext); @@ -286,16 +294,18 @@ $content .= $this->pagename . " " . $version . " " . Iso8601DateTime($meta['mtime']) . "\n"; $content .= $fmt->format($diff2); - + $editedby = sprintf(_("Edited by: %s"), $this->fromId()); } else { + // Page did not exist, and was created + $subject = _("Page creation").' '.($this->pagename); $difflink = WikiURL($this->pagename,array(),true); $content = $this->pagename . " " . $version . " " . Iso8601DateTime($meta['mtime']) . "\n"; $content .= _("New page"); $content .= "\n\n"; $content .= $wikitext; + $editedby = sprintf(_("Created by: %s"), $this->fromId()); } - $editedby = sprintf(_("Edited by: %s"), $this->from); $summary = sprintf(_("Summary: %s"), $meta['summary']); $this->sendMail($subject, $editedby."\n".$summary."\n".$difflink."\n\n".$content); @@ -343,7 +353,7 @@ //TODO: deferr it (quite a massive load if you remove some pages). $this->getPageChangeEmails($notify); if (!empty($this->emails)) { - $subject = sprintf(_("User %s removed page %s"), $this->from, $pagename); + $subject = sprintf(_("User %s removed page %s"), $this->fromId(), $pagename); $result = $this->sendMail($subject, $subject."\n\n"); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2012-10-11 07:28:28
|
Revision: 8407 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=8407&view=rev Author: vargenau Date: 2012-10-11 07:28:17 +0000 (Thu, 11 Oct 2012) Log Message: ----------- quoted_printable_encode inserts "\r\n" if line is too long, use "\n" only Modified Paths: -------------- trunk/lib/MailNotify.php Modified: trunk/lib/MailNotify.php =================================================================== --- trunk/lib/MailNotify.php 2012-10-10 16:51:57 UTC (rev 8406) +++ trunk/lib/MailNotify.php 2012-10-11 07:28:17 UTC (rev 8407) @@ -479,7 +479,8 @@ // Let us try quoted printable first if (function_exists('quoted_printable_encode')) { // PHP 5.3 - return "=?UTF-8?Q?" . quoted_printable_encode($subject) . "?="; + // quoted_printable_encode inserts "\r\n" if line is too long, use "\n" only + return "=?UTF-8?Q?" . str_replace("\r\n", "\n", quoted_printable_encode($subject)) . "?="; } // If not, encode in base64 (less human-readable) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2012-12-05 18:09:44
|
Revision: 8605 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=8605&view=rev Author: vargenau Date: 2012-12-05 18:09:33 +0000 (Wed, 05 Dec 2012) Log Message: ----------- Consistent returns Modified Paths: -------------- trunk/lib/MailNotify.php Modified: trunk/lib/MailNotify.php =================================================================== --- trunk/lib/MailNotify.php 2012-12-05 15:36:45 UTC (rev 8604) +++ trunk/lib/MailNotify.php 2012-12-05 18:09:33 UTC (rev 8605) @@ -126,8 +126,6 @@ $userids = array(); foreach ($notify as $page => $users) { if (glob_match($page, $this->pagename)) { - - global $request; $curuser = $request->getUser(); $curusername = $curuser->UserName(); $curuserprefs = $curuser->getPreferences(); @@ -204,7 +202,7 @@ $emails = $this->emails; // Do not send if modification is from FusionForge admin if (FUSIONFORGE and ($this->fromId() == ADMIN_USER)) { - return; + return true; } if (!$notice) { $notice = _("PageChange Notification of %s"); @@ -338,7 +336,6 @@ */ function onChangePage(&$wikidb, &$wikitext, $version, &$meta) { - $result = true; if (!isa($GLOBALS['request'], 'MockRequest')) { $notify = $wikidb->get('notify'); /* Generate notification emails? */ @@ -348,11 +345,10 @@ // TODO: Should be used for ModeratePage and RSS2 Cloud xml-rpc also. $this->getPageChangeEmails($notify); if (!empty($this->emails)) { - $result = $this->sendPageChangeNotification($wikitext, $version, $meta); + $this->sendPageChangeNotification($wikitext, $version, $meta); } } } - return $result; } function onDeletePage(&$wikidb, $pagename) @@ -375,7 +371,6 @@ function onRenamePage(&$wikidb, $oldpage, $new_pagename) { - $result = true; if (!isa($GLOBALS['request'], 'MockRequest')) { $notify = $wikidb->get('notify'); if (!empty($notify) and is_array($notify)) { @@ -385,7 +380,7 @@ $current = $newpage->getCurrentRevision(); $meta = $current->_data; $this->pagename = $oldpage; - $result = $this->sendPageRenameNotification($new_pagename, $meta); + $this->sendPageRenameNotification($new_pagename, $meta); } } } @@ -397,8 +392,9 @@ */ function sendEmailConfirmation($email, $userid) { + global $request; $id = rand_ascii_readable(16); - $wikidb = $GLOBALS['request']->getDbh(); + $wikidb = $request->getDbh(); $data = $wikidb->get('ConfirmEmail'); while (!empty($data[$id])) { // id collision $id = rand_ascii_readable(16); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2012-12-05 18:19:22
|
Revision: 8606 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=8606&view=rev Author: vargenau Date: 2012-12-05 18:19:12 +0000 (Wed, 05 Dec 2012) Log Message: ----------- Remove unused Modified Paths: -------------- trunk/lib/MailNotify.php Modified: trunk/lib/MailNotify.php =================================================================== --- trunk/lib/MailNotify.php 2012-12-05 18:09:33 UTC (rev 8605) +++ trunk/lib/MailNotify.php 2012-12-05 18:19:12 UTC (rev 8606) @@ -127,7 +127,6 @@ foreach ($notify as $page => $users) { if (glob_match($page, $this->pagename)) { $curuser = $request->getUser(); - $curusername = $curuser->UserName(); $curuserprefs = $curuser->getPreferences(); $curuserprefsemail = $curuserprefs->get('email'); $ownModifications = $curuserprefs->get('ownModifications'); @@ -174,13 +173,6 @@ $userids[] = $userid; } } - // ignore verification - /* - if (DEBUG) { - if (!in_array($user['email'], $emails)) - $emails[] = $user['email']; - } - */ } } } @@ -321,7 +313,7 @@ /** * Support mass rename / remove (TBD) */ - function sendPageRenameNotification($to, &$meta) + function sendPageRenameNotification($to) { $pagename = $this->pagename; $editedby = sprintf(_("Renamed by: %s"), $this->fromId()); @@ -376,11 +368,8 @@ if (!empty($notify) and is_array($notify)) { $this->getPageChangeEmails($notify); if (!empty($this->emails)) { - $newpage = $wikidb->getPage($new_pagename); - $current = $newpage->getCurrentRevision(); - $meta = $current->_data; $this->pagename = $oldpage; - $this->sendPageRenameNotification($new_pagename, $meta); + $this->sendPageRenameNotification($new_pagename); } } } @@ -437,20 +426,16 @@ } // upgrade the user $userid = $data['userid']; - $email = $data['email']; $u = $request->getUser(); if ($u->UserName() == $userid) { // lucky: current user (session) - $prefs = $u->getPreferences(); $request->_user->_level = WIKIAUTH_USER; $request->_prefs->set('emailVerified', true); } else { // not current user if (ENABLE_USER_NEW) { $u = WikiUser($userid); $u->getPreferences(); - $prefs = &$u->_prefs; } else { $u = new WikiUser($request, $userid); - $prefs = $u->getPreferences(); } $u->_level = WIKIAUTH_USER; $request->setUser($u); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2014-10-03 15:19:10
|
Revision: 9181 http://sourceforge.net/p/phpwiki/code/9181 Author: vargenau Date: 2014-10-03 15:19:03 +0000 (Fri, 03 Oct 2014) Log Message: ----------- function quoted_printable_encode exists in PHP 5.3 Modified Paths: -------------- trunk/lib/MailNotify.php Modified: trunk/lib/MailNotify.php =================================================================== --- trunk/lib/MailNotify.php 2014-10-03 14:57:26 UTC (rev 9180) +++ trunk/lib/MailNotify.php 2014-10-03 15:19:03 UTC (rev 9181) @@ -449,14 +449,8 @@ return $subject; } - // Let us try quoted printable first - if (function_exists('quoted_printable_encode')) { // PHP 5.3 - // quoted_printable_encode inserts "\r\n" if line is too long, use "\n" only - return "=?UTF-8?Q?" . str_replace("\r\n", "\n", quoted_printable_encode($subject)) . "?="; - } - - // If not, encode in base64 (less human-readable) - return "=?UTF-8?B?" . base64_encode($subject) . "?="; + // quoted_printable_encode inserts "\r\n" if line is too long, use "\n" only + return "=?UTF-8?Q?" . str_replace("\r\n", "\n", quoted_printable_encode($subject)) . "?="; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |