|
From: <luc...@us...> - 2014-02-28 21:30:02
|
Revision: 12336
http://sourceforge.net/p/xoops/svn/12336
Author: luciorota
Date: 2014-02-28 21:29:57 +0000 (Fri, 28 Feb 2014)
Log Message:
-----------
code standardization (in progress), templatization (in progress), improved html2text function
Modified Paths:
--------------
XoopsModules/xnewsletter/branches/luciorota/xNewsletter/admin/import.php
XoopsModules/xnewsletter/branches/luciorota/xNewsletter/admin/letter.php
XoopsModules/xnewsletter/branches/luciorota/xNewsletter/class/xNewsletter_import.php
XoopsModules/xnewsletter/branches/luciorota/xNewsletter/class/xNewsletter_subscr.php
XoopsModules/xnewsletter/branches/luciorota/xNewsletter/docs/changelog.txt
XoopsModules/xnewsletter/branches/luciorota/xNewsletter/header.php
XoopsModules/xnewsletter/branches/luciorota/xNewsletter/include/functions.php
XoopsModules/xnewsletter/branches/luciorota/xNewsletter/include/task.inc.php
XoopsModules/xnewsletter/branches/luciorota/xNewsletter/index.php
XoopsModules/xnewsletter/branches/luciorota/xNewsletter/letter.php
XoopsModules/xnewsletter/branches/luciorota/xNewsletter/plugins/csv.php
XoopsModules/xnewsletter/branches/luciorota/xNewsletter/plugins/evennews.php
XoopsModules/xnewsletter/branches/luciorota/xNewsletter/plugins/rmbulletin.php
XoopsModules/xnewsletter/branches/luciorota/xNewsletter/plugins/smartpartner.php
XoopsModules/xnewsletter/branches/luciorota/xNewsletter/plugins/subscribers.php
XoopsModules/xnewsletter/branches/luciorota/xNewsletter/plugins/weblinks.php
XoopsModules/xnewsletter/branches/luciorota/xNewsletter/plugins/xoopsuser.php
XoopsModules/xnewsletter/branches/luciorota/xNewsletter/print.php
XoopsModules/xnewsletter/branches/luciorota/xNewsletter/sendletter.php
XoopsModules/xnewsletter/branches/luciorota/xNewsletter/subscription.php
XoopsModules/xnewsletter/branches/luciorota/xNewsletter/templates/xnewsletter_protocol.html
XoopsModules/xnewsletter/branches/luciorota/xNewsletter/templates/xnewsletter_subscription_list_subscriptions.html
XoopsModules/xnewsletter/branches/luciorota/xNewsletter/templates/xnewsletter_subscription_result.html
XoopsModules/xnewsletter/branches/luciorota/xNewsletter/xoops_version.php
Added Paths:
-----------
XoopsModules/xnewsletter/branches/luciorota/xNewsletter/include/html2text/
XoopsModules/xnewsletter/branches/luciorota/xNewsletter/include/html2text/epl-v10.html
XoopsModules/xnewsletter/branches/luciorota/xNewsletter/include/html2text/html2text.php
Modified: XoopsModules/xnewsletter/branches/luciorota/xNewsletter/admin/import.php
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xNewsletter/admin/import.php 2014-02-28 10:31:35 UTC (rev 12335)
+++ XoopsModules/xnewsletter/branches/luciorota/xNewsletter/admin/import.php 2014-02-28 21:29:57 UTC (rev 12336)
@@ -424,7 +424,7 @@
default:
//show basic search form
$objImport =& $importHandler->create();
- $form = $objImport->getFormSearch($plugin, $action_after_read, $limitcheck);
+ $form = $objImport->getSearchForm($plugin, $action_after_read, $limitcheck);
$form->display();
break;
}
Modified: XoopsModules/xnewsletter/branches/luciorota/xNewsletter/admin/letter.php
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xNewsletter/admin/letter.php 2014-02-28 10:31:35 UTC (rev 12335)
+++ XoopsModules/xnewsletter/branches/luciorota/xNewsletter/admin/letter.php 2014-02-28 21:29:57 UTC (rev 12336)
@@ -106,10 +106,11 @@
$tpl->assign('sex', _AM_XNEWSLETTER_SUBSCR_SEX_MALE);
$tpl->assign('firstname', _AM_XNEWSLETTER_SUBSCR_FIRSTNAME);
$tpl->assign('lastname', _AM_XNEWSLETTER_SUBSCR_LASTNAME);
+ $tpl->assign('title', $letterObj->getVar('letter_title', 'n')); // new from v1.3
$tpl->assign('content', $obj_letter->getVar("letter_content", "n"));
- $tpl->assign('unsubscribe_url', XOOPS_URL . '/modules/xNewsletter/');
+ $tpl->assign('unsubscribe_url', XOOPS_URL . '/modules/xNewsletter/'); // new from v1.3
//$tpl->assign('catsubscr_id', "0");
- $tpl->assign('subscr_email', "");
+ $tpl->assign('subscr_email', '');
echo "<h2>".$obj_letter->getVar("letter_title")."</h2>";
echo "<div style='clear:both'><div style='padding:10px;border:1px solid black'>";
Modified: XoopsModules/xnewsletter/branches/luciorota/xNewsletter/class/xNewsletter_import.php
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xNewsletter/class/xNewsletter_import.php 2014-02-28 10:31:35 UTC (rev 12335)
+++ XoopsModules/xnewsletter/branches/luciorota/xNewsletter/class/xNewsletter_import.php 2014-02-28 21:29:57 UTC (rev 12336)
@@ -46,7 +46,7 @@
$this->initVar("import_status", XOBJ_DTYPE_INT, null, false, 1);
}
- public function getFormSearch($plugin, $action_after_read = 1, $limitcheck = 0, $action = false)
+ public function getSearchForm($plugin, $action_after_read = 1, $limitcheck = 0, $action = false)
{
global $xoopsDB, $xoopsModuleConfig;
Modified: XoopsModules/xnewsletter/branches/luciorota/xNewsletter/class/xNewsletter_subscr.php
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xNewsletter/class/xNewsletter_subscr.php 2014-02-28 10:31:35 UTC (rev 12335)
+++ XoopsModules/xnewsletter/branches/luciorota/xNewsletter/class/xNewsletter_subscr.php 2014-02-28 21:29:57 UTC (rev 12336)
@@ -49,7 +49,7 @@
$this->initVar("subscr_actoptions", XOBJ_DTYPE_TXTBOX, null, false, 500);
}
- public function getFormSearch($action = false)
+ public function getSearchForm($action = false)
{
global $xoopsDB, $xoopsModuleConfig;
Modified: XoopsModules/xnewsletter/branches/luciorota/xNewsletter/docs/changelog.txt
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xNewsletter/docs/changelog.txt 2014-02-28 10:31:35 UTC (rev 12335)
+++ XoopsModules/xnewsletter/branches/luciorota/xNewsletter/docs/changelog.txt 2014-02-28 21:29:57 UTC (rev 12336)
@@ -1,3 +1,9 @@
+Version 1.3
+--------------
+ - templatize user side (luciorota)
+ - standardize code (luciorota)
+ - added html2txt function for non-HTML mail clients (luciorota)
+
Version 1.2
--------------
- standardize code (luciorota)
Modified: XoopsModules/xnewsletter/branches/luciorota/xNewsletter/header.php
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xNewsletter/header.php 2014-02-28 10:31:35 UTC (rev 12335)
+++ XoopsModules/xnewsletter/branches/luciorota/xNewsletter/header.php 2014-02-28 21:29:57 UTC (rev 12336)
@@ -31,6 +31,7 @@
global $xoopsConfig, $xoopsModule, $xoopsModuleConfig;
include_once XOOPS_ROOT_PATH . "/class/pagenav.php";
+include_once XOOPS_ROOT_PATH . '/include/functions.php';
include_once XOOPS_ROOT_PATH . "/modules/{$xoopsModule->getVar('dirname')}/include/config.php";
include_once XNEWSLETTER_PATH . "/include/functions.php";
@@ -49,14 +50,14 @@
}
// Get the module instances
-$accountsHandler =& xoops_getModuleHandler('xNewsletter_accounts', XNEWSLETTER_DIRNAME);
-$catHandler =& xoops_getModuleHandler('xNewsletter_cat', XNEWSLETTER_DIRNAME);
-$subscrHandler =& xoops_getModuleHandler('xNewsletter_subscr', XNEWSLETTER_DIRNAME);
-$catsubscrHandler =& xoops_getModuleHandler('xNewsletter_catsubscr', XNEWSLETTER_DIRNAME);
-$letterHandler =& xoops_getModuleHandler('xNewsletter_letter', XNEWSLETTER_DIRNAME);
-$attachmentHandler =& xoops_getModuleHandler('xNewsletter_attachment', XNEWSLETTER_DIRNAME);
-$protocolHandler =& xoops_getModuleHandler('xNewsletter_protocol', XNEWSLETTER_DIRNAME);
-$mailinglistHandler =& xoops_getModuleHandler('xNewsletter_mailinglist', XNEWSLETTER_DIRNAME);
+$accountsHandler = xoops_getModuleHandler('xNewsletter_accounts', XNEWSLETTER_DIRNAME);
+$catHandler = xoops_getModuleHandler('xNewsletter_cat', XNEWSLETTER_DIRNAME);
+$subscrHandler = xoops_getModuleHandler('xNewsletter_subscr', XNEWSLETTER_DIRNAME);
+$catsubscrHandler = xoops_getModuleHandler('xNewsletter_catsubscr', XNEWSLETTER_DIRNAME);
+$letterHandler = xoops_getModuleHandler('xNewsletter_letter', XNEWSLETTER_DIRNAME);
+$attachmentHandler = xoops_getModuleHandler('xNewsletter_attachment', XNEWSLETTER_DIRNAME);
+$protocolHandler = xoops_getModuleHandler('xNewsletter_protocol', XNEWSLETTER_DIRNAME);
+$mailinglistHandler = xoops_getModuleHandler('xNewsletter_mailinglist', XNEWSLETTER_DIRNAME);
xoops_loadLanguage('modinfo', XNEWSLETTER_DIRNAME);
Modified: XoopsModules/xnewsletter/branches/luciorota/xNewsletter/include/functions.php
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xNewsletter/include/functions.php 2014-02-28 10:31:35 UTC (rev 12335)
+++ XoopsModules/xnewsletter/branches/luciorota/xNewsletter/include/functions.php 2014-02-28 21:29:57 UTC (rev 12336)
@@ -25,10 +25,13 @@
* Version : 1 Mon 2012/11/05 14:31:32 : Exp $
* ****************************************************************************
*/
+if (!defined("XOOPS_ROOT_PATH")) {
+ die("XOOPS root path not defined");
+}
+include_once dirname(__FILE__) . '/common.php';
-/***************Blocks***************/
function xNewsletter_block_addCatSelect($cats) {
if(is_array($cats)) {
$cat_sql = "(" . current($cats);
@@ -78,6 +81,8 @@
return $xnewsletter_isAdmin;
}
+
+
function xNewsletter_checkEmail($email, $antispam = false) {
include_once XOOPS_ROOT_PATH . '/include/functions.php';
return checkEmail($email, $antispam);
@@ -85,6 +90,13 @@
+function xNewsletter_html2text($html) {
+ include_once XNEWSLETTER_ROOT_PATH . '/include/html2text/html2text.php';
+ return convert_html_to_text($html);
+}
+
+
+
function xNewsletter_CleanVars(&$global, $key, $default = '', $type = 'int', $notset=false) {
include_once XOOPS_ROOT_PATH . '/include/functions.php';
switch ( $type ) {
Added: XoopsModules/xnewsletter/branches/luciorota/xNewsletter/include/html2text/epl-v10.html
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xNewsletter/include/html2text/epl-v10.html (rev 0)
+++ XoopsModules/xnewsletter/branches/luciorota/xNewsletter/include/html2text/epl-v10.html 2014-02-28 21:29:57 UTC (rev 12336)
@@ -0,0 +1,259 @@
+<!--?xml version="1.0" encoding="ISO-8859-1" ?-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"><head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Eclipse Public License - Version 1.0</title>
+<style type="text/css">
+ body {
+ size: 8.5in 11.0in;
+ margin: 0.25in 0.5in 0.25in 0.5in;
+ tab-interval: 0.5in;
+ }
+ p {
+ margin-left: auto;
+ margin-top: 0.5em;
+ margin-bottom: 0.5em;
+ }
+ p.list {
+ margin-left: 0.5in;
+ margin-top: 0.05em;
+ margin-bottom: 0.05em;
+ }
+ </style>
+
+</head>
+
+<body lang="EN-US">
+
+<h2>Eclipse Public License - v 1.0</h2>
+
+<p>THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE
+PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR
+DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS
+AGREEMENT.</p>
+
+<p><b>1. DEFINITIONS</b></p>
+
+<p>"Contribution" means:</p>
+
+<p class="list">a) in the case of the initial Contributor, the initial
+code and documentation distributed under this Agreement, and</p>
+<p class="list">b) in the case of each subsequent Contributor:</p>
+<p class="list">i) changes to the Program, and</p>
+<p class="list">ii) additions to the Program;</p>
+<p class="list">where such changes and/or additions to the Program
+originate from and are distributed by that particular Contributor. A
+Contribution 'originates' from a Contributor if it was added to the
+Program by such Contributor itself or anyone acting on such
+Contributor's behalf. Contributions do not include additions to the
+Program which: (i) are separate modules of software distributed in
+conjunction with the Program under their own license agreement, and (ii)
+are not derivative works of the Program.</p>
+
+<p>"Contributor" means any person or entity that distributes
+the Program.</p>
+
+<p>"Licensed Patents" mean patent claims licensable by a
+Contributor which are necessarily infringed by the use or sale of its
+Contribution alone or when combined with the Program.</p>
+
+<p>"Program" means the Contributions distributed in accordance
+with this Agreement.</p>
+
+<p>"Recipient" means anyone who receives the Program under
+this Agreement, including all Contributors.</p>
+
+<p><b>2. GRANT OF RIGHTS</b></p>
+
+<p class="list">a) Subject to the terms of this Agreement, each
+Contributor hereby grants Recipient a non-exclusive, worldwide,
+royalty-free copyright license to reproduce, prepare derivative works
+of, publicly display, publicly perform, distribute and sublicense the
+Contribution of such Contributor, if any, and such derivative works, in
+source code and object code form.</p>
+
+<p class="list">b) Subject to the terms of this Agreement, each
+Contributor hereby grants Recipient a non-exclusive, worldwide,
+royalty-free patent license under Licensed Patents to make, use, sell,
+offer to sell, import and otherwise transfer the Contribution of such
+Contributor, if any, in source code and object code form. This patent
+license shall apply to the combination of the Contribution and the
+Program if, at the time the Contribution is added by the Contributor,
+such addition of the Contribution causes such combination to be covered
+by the Licensed Patents. The patent license shall not apply to any other
+combinations which include the Contribution. No hardware per se is
+licensed hereunder.</p>
+
+<p class="list">c) Recipient understands that although each Contributor
+grants the licenses to its Contributions set forth herein, no assurances
+are provided by any Contributor that the Program does not infringe the
+patent or other intellectual property rights of any other entity. Each
+Contributor disclaims any liability to Recipient for claims brought by
+any other entity based on infringement of intellectual property rights
+or otherwise. As a condition to exercising the rights and licenses
+granted hereunder, each Recipient hereby assumes sole responsibility to
+secure any other intellectual property rights needed, if any. For
+example, if a third party patent license is required to allow Recipient
+to distribute the Program, it is Recipient's responsibility to acquire
+that license before distributing the Program.</p>
+
+<p class="list">d) Each Contributor represents that to its knowledge it
+has sufficient copyright rights in its Contribution, if any, to grant
+the copyright license set forth in this Agreement.</p>
+
+<p><b>3. REQUIREMENTS</b></p>
+
+<p>A Contributor may choose to distribute the Program in object code
+form under its own license agreement, provided that:</p>
+
+<p class="list">a) it complies with the terms and conditions of this
+Agreement; and</p>
+
+<p class="list">b) its license agreement:</p>
+
+<p class="list">i) effectively disclaims on behalf of all Contributors
+all warranties and conditions, express and implied, including warranties
+or conditions of title and non-infringement, and implied warranties or
+conditions of merchantability and fitness for a particular purpose;</p>
+
+<p class="list">ii) effectively excludes on behalf of all Contributors
+all liability for damages, including direct, indirect, special,
+incidental and consequential damages, such as lost profits;</p>
+
+<p class="list">iii) states that any provisions which differ from this
+Agreement are offered by that Contributor alone and not by any other
+party; and</p>
+
+<p class="list">iv) states that source code for the Program is available
+from such Contributor, and informs licensees how to obtain it in a
+reasonable manner on or through a medium customarily used for software
+exchange.</p>
+
+<p>When the Program is made available in source code form:</p>
+
+<p class="list">a) it must be made available under this Agreement; and</p>
+
+<p class="list">b) a copy of this Agreement must be included with each
+copy of the Program.</p>
+
+<p>Contributors may not remove or alter any copyright notices contained
+within the Program.</p>
+
+<p>Each Contributor must identify itself as the originator of its
+Contribution, if any, in a manner that reasonably allows subsequent
+Recipients to identify the originator of the Contribution.</p>
+
+<p><b>4. COMMERCIAL DISTRIBUTION</b></p>
+
+<p>Commercial distributors of software may accept certain
+responsibilities with respect to end users, business partners and the
+like. While this license is intended to facilitate the commercial use of
+the Program, the Contributor who includes the Program in a commercial
+product offering should do so in a manner which does not create
+potential liability for other Contributors. Therefore, if a Contributor
+includes the Program in a commercial product offering, such Contributor
+("Commercial Contributor") hereby agrees to defend and
+indemnify every other Contributor ("Indemnified Contributor")
+against any losses, damages and costs (collectively "Losses")
+arising from claims, lawsuits and other legal actions brought by a third
+party against the Indemnified Contributor to the extent caused by the
+acts or omissions of such Commercial Contributor in connection with its
+distribution of the Program in a commercial product offering. The
+obligations in this section do not apply to any claims or Losses
+relating to any actual or alleged intellectual property infringement. In
+order to qualify, an Indemnified Contributor must: a) promptly notify
+the Commercial Contributor in writing of such claim, and b) allow the
+Commercial Contributor to control, and cooperate with the Commercial
+Contributor in, the defense and any related settlement negotiations. The
+Indemnified Contributor may participate in any such claim at its own
+expense.</p>
+
+<p>For example, a Contributor might include the Program in a commercial
+product offering, Product X. That Contributor is then a Commercial
+Contributor. If that Commercial Contributor then makes performance
+claims, or offers warranties related to Product X, those performance
+claims and warranties are such Commercial Contributor's responsibility
+alone. Under this section, the Commercial Contributor would have to
+defend claims against the other Contributors related to those
+performance claims and warranties, and if a court requires any other
+Contributor to pay any damages as a result, the Commercial Contributor
+must pay those damages.</p>
+
+<p><b>5. NO WARRANTY</b></p>
+
+<p>EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS
+PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
+OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION,
+ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY
+OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely
+responsible for determining the appropriateness of using and
+distributing the Program and assumes all risks associated with its
+exercise of rights under this Agreement , including but not limited to
+the risks and costs of program errors, compliance with applicable laws,
+damage to or loss of data, programs or equipment, and unavailability or
+interruption of operations.</p>
+
+<p><b>6. DISCLAIMER OF LIABILITY</b></p>
+
+<p>EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT
+NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING
+WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF
+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR
+DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
+HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.</p>
+
+<p><b>7. GENERAL</b></p>
+
+<p>If any provision of this Agreement is invalid or unenforceable under
+applicable law, it shall not affect the validity or enforceability of
+the remainder of the terms of this Agreement, and without further action
+by the parties hereto, such provision shall be reformed to the minimum
+extent necessary to make such provision valid and enforceable.</p>
+
+<p>If Recipient institutes patent litigation against any entity
+(including a cross-claim or counterclaim in a lawsuit) alleging that the
+Program itself (excluding combinations of the Program with other
+software or hardware) infringes such Recipient's patent(s), then such
+Recipient's rights granted under Section 2(b) shall terminate as of the
+date such litigation is filed.</p>
+
+<p>All Recipient's rights under this Agreement shall terminate if it
+fails to comply with any of the material terms or conditions of this
+Agreement and does not cure such failure in a reasonable period of time
+after becoming aware of such noncompliance. If all Recipient's rights
+under this Agreement terminate, Recipient agrees to cease use and
+distribution of the Program as soon as reasonably practicable. However,
+Recipient's obligations under this Agreement and any licenses granted by
+Recipient relating to the Program shall continue and survive.</p>
+
+<p>Everyone is permitted to copy and distribute copies of this
+Agreement, but in order to avoid inconsistency the Agreement is
+copyrighted and may only be modified in the following manner. The
+Agreement Steward reserves the right to publish new versions (including
+revisions) of this Agreement from time to time. No one other than the
+Agreement Steward has the right to modify this Agreement. The Eclipse
+Foundation is the initial Agreement Steward. The Eclipse Foundation may
+assign the responsibility to serve as the Agreement Steward to a
+suitable separate entity. Each new version of the Agreement will be
+given a distinguishing version number. The Program (including
+Contributions) may always be distributed subject to the version of the
+Agreement under which it was received. In addition, after a new version
+of the Agreement is published, Contributor may elect to distribute the
+Program (including its Contributions) under the new version. Except as
+expressly stated in Sections 2(a) and 2(b) above, Recipient receives no
+rights or licenses to the intellectual property of any Contributor under
+this Agreement, whether expressly, by implication, estoppel or
+otherwise. All rights in the Program not expressly granted under this
+Agreement are reserved.</p>
+
+<p>This Agreement is governed by the laws of the State of New York and
+the intellectual property laws of the United States of America. No party
+to this Agreement will bring a legal action under this Agreement more
+than one year after the cause of action arose. Each party waives its
+rights to a jury trial in any resulting litigation.</p>
+
+
+
+</body></html>
\ No newline at end of file
Added: XoopsModules/xnewsletter/branches/luciorota/xNewsletter/include/html2text/html2text.php
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xNewsletter/include/html2text/html2text.php (rev 0)
+++ XoopsModules/xnewsletter/branches/luciorota/xNewsletter/include/html2text/html2text.php 2014-02-28 21:29:57 UTC (rev 12336)
@@ -0,0 +1,225 @@
+<?php
+/******************************************************************************
+ * Copyright (c) 2010 Jevon Wright and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Jevon Wright - initial API and implementation
+ ****************************************************************************/
+
+/**
+ * Tries to convert the given HTML into a plain text format - best suited for
+ * e-mail display, etc.
+ *
+ * <p>In particular, it tries to maintain the following features:
+ * <ul>
+ * <li>Links are maintained, with the 'href' copied over
+ * <li>Information in the <head> is lost
+ * </ul>
+ *
+ * @param html the input HTML
+ * @return the HTML converted, as best as possible, to text
+ */
+function convert_html_to_text($html) {
+ $html = fix_newlines($html);
+
+ $doc = new DOMDocument();
+ if (!$doc->loadHTML($html))
+ throw new Html2TextException("Could not load HTML - badly formed?", $html);
+
+ $output = iterate_over_node($doc);
+
+ // remove leading and trailing spaces on each line
+ $output = preg_replace("/[ \t]*\n[ \t]*/im", "\n", $output);
+
+ // remove leading and trailing whitespace
+ $output = trim($output);
+
+ return $output;
+}
+
+/**
+ * Unify newlines; in particular, \r\n becomes \n, and
+ * then \r becomes \n. This means that all newlines (Unix, Windows, Mac)
+ * all become \ns.
+ *
+ * @param text text with any number of \r, \r\n and \n combinations
+ * @return the fixed text
+ */
+function fix_newlines($text) {
+ // replace \r\n to \n
+ $text = str_replace("\r\n", "\n", $text);
+ // remove \rs
+ $text = str_replace("\r", "\n", $text);
+
+ return $text;
+}
+
+function next_child_name($node) {
+ // get the next child
+ $nextNode = $node->nextSibling;
+ while ($nextNode != null) {
+ if ($nextNode instanceof DOMElement) {
+ break;
+ }
+ $nextNode = $nextNode->nextSibling;
+ }
+ $nextName = null;
+ if ($nextNode instanceof DOMElement && $nextNode != null) {
+ $nextName = strtolower($nextNode->nodeName);
+ }
+
+ return $nextName;
+}
+function prev_child_name($node) {
+ // get the previous child
+ $nextNode = $node->previousSibling;
+ while ($nextNode != null) {
+ if ($nextNode instanceof DOMElement) {
+ break;
+ }
+ $nextNode = $nextNode->previousSibling;
+ }
+ $nextName = null;
+ if ($nextNode instanceof DOMElement && $nextNode != null) {
+ $nextName = strtolower($nextNode->nodeName);
+ }
+
+ return $nextName;
+}
+
+function iterate_over_node($node) {
+ if ($node instanceof DOMText) {
+ return preg_replace("/\\s+/im", " ", $node->wholeText);
+ }
+ if ($node instanceof DOMDocumentType) {
+ // ignore
+ return "";
+ }
+
+ $nextName = next_child_name($node);
+ $prevName = prev_child_name($node);
+
+ $name = strtolower($node->nodeName);
+
+ // start whitespace
+ switch ($name) {
+ case "hr":
+ return "------\n";
+
+ case "style":
+ case "head":
+ case "title":
+ case "meta":
+ case "script":
+ // ignore these tags
+ return "";
+
+ case "h1":
+ case "h2":
+ case "h3":
+ case "h4":
+ case "h5":
+ case "h6":
+ // add two newlines
+ $output = "\n";
+ break;
+
+ case "p":
+ case "div":
+ // add one line
+ $output = "\n";
+ break;
+
+ default:
+ // print out contents of unknown tags
+ $output = "";
+ break;
+ }
+
+ // debug
+ //$output .= "[$name,$nextName]";
+
+ for ($i = 0; $i < $node->childNodes->length; $i++) {
+ $n = $node->childNodes->item($i);
+
+ $text = iterate_over_node($n);
+
+ $output .= $text;
+ }
+
+ // end whitespace
+ switch ($name) {
+ case "style":
+ case "head":
+ case "title":
+ case "meta":
+ case "script":
+ // ignore these tags
+ return "";
+
+ case "h1":
+ case "h2":
+ case "h3":
+ case "h4":
+ case "h5":
+ case "h6":
+ $output .= "\n";
+ break;
+
+ case "p":
+ case "br":
+ // add one line
+ if ($nextName != "div")
+ $output .= "\n";
+ break;
+
+ case "div":
+ // add one line only if the next child isn't a div
+ if ($nextName != "div" && $nextName != null)
+ $output .= "\n";
+ break;
+
+ case "a":
+ // links are returned in [text](link) format
+ $href = $node->getAttribute("href");
+ if ($href == null) {
+ // it doesn't link anywhere
+ if ($node->getAttribute("name") != null) {
+ $output = "[$output]";
+ }
+ } else {
+ if ($href == $output) {
+ // link to the same address: just use link
+ $output;
+ } else {
+ // replace it
+ $output = "[$output]($href)";
+ }
+ }
+
+ // does the next node require additional whitespace?
+ switch ($nextName) {
+ case "h1": case "h2": case "h3": case "h4": case "h5": case "h6":
+ $output .= "\n";
+ break;
+ }
+
+ default:
+ // do nothing
+ }
+
+ return $output;
+}
+
+class Html2TextException extends Exception {
+ var $more_info;
+
+ public function __construct($message = "", $more_info = "") {
+ parent::__construct($message);
+ $this->more_info = $more_info;
+ }
+}
Modified: XoopsModules/xnewsletter/branches/luciorota/xNewsletter/include/task.inc.php
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xNewsletter/include/task.inc.php 2014-02-28 10:31:35 UTC (rev 12335)
+++ XoopsModules/xnewsletter/branches/luciorota/xNewsletter/include/task.inc.php 2014-02-28 21:29:57 UTC (rev 12336)
@@ -37,38 +37,38 @@
//check data before creating task list
if ($letter_id == 0) {
- redirect_header("letter.php", 3, _AM_XNEWSLETTER_SEND_ERROR_NO_LETTERID);
+ redirect_header('letter.php', 3, _AM_XNEWSLETTER_SEND_ERROR_NO_LETTERID);
}
- $obj_letter =& $letterHandler->get($letter_id);
- if (count($obj_letter)==0) {
- redirect_header("letter.php", 3, _AM_XNEWSLETTER_SEND_ERROR_NO_LETTERID);
+ $letterObj = $letterHandler->get($letter_id);
+ if (count($letterObj) == 0) {
+ redirect_header('letter.php', 3, _AM_XNEWSLETTER_SEND_ERROR_NO_LETTERID);
}
//read categories
- $letter_cats = $obj_letter->getVar("letter_cats");
- if ( $letter_cats == "") {
+ $letter_cats = $letterObj->getVar('letter_cats');
+ if ( $letter_cats == '') {
//no cats
- redirect_header("letter.php", 3, _MA_XNEWSLETTER_LETTER_NONEAVAIL);
+ redirect_header('letter.php', 3, _MA_XNEWSLETTER_LETTER_NONEAVAIL);
}
- if ($op=="send_test") {
+ if ($op == 'send_test') {
//check for valid email for testing
- $letter_email_test = $obj_letter->getVar("letter_email_test");
- if ($letter_email_test == "")
- redirect_header("letter.php", 3, _AM_XNEWSLETTER_SEND_ERROR_NO_EMAIL);
+ $letter_email_test = $letterObj->getVar('letter_email_test');
+ if ($letter_email_test == '')
+ redirect_header('letter.php', 3, _AM_XNEWSLETTER_SEND_ERROR_NO_EMAIL);
}
//get emails of subscribers
$recipients = array();
- if ($op == "send_test") {
+ if ($op == 'send_test') {
$recipients[] = 0;
} else {
//read all subscribers
$sql = "SELECT subscr_id, subscr_actkey ";
- $sql .= " FROM {$xoopsDB->prefix("mod_xnewsletter_subscr")} INNER JOIN {$xoopsDB->prefix("mod_xnewsletter_catsubscr")} ON subscr_id = catsubscr_subscrid ";
+ $sql .= " FROM {$xoopsDB->prefix('mod_xnewsletter_subscr')} INNER JOIN {$xoopsDB->prefix('mod_xnewsletter_catsubscr')} ON subscr_id = catsubscr_subscrid ";
$sql .= " WHERE subscr_activated=1 AND (((catsubscr_catid) In (";
- $sql .= str_replace("|", ",", $letter_cats);
+ $sql .= str_replace('|', ',', $letter_cats);
$sql .= "))) GROUP BY subscr_id;";
$subscribers = $xoopsDB->query($sql) or die();
@@ -77,28 +77,28 @@
$subscr_id = $subscriber["subscr_id"];
if ($op == 'resend_letter') {
//read subscribers, where send failed
- $protocol_crit = new CriteriaCompo();
- $protocol_crit->add(new Criteria("protocol_letter_id", $letter_id));
- $protocol_crit->add(new Criteria("protocol_subscriber_id", $subscr_id));
- $protocol_crit->add(new Criteria("protocol_success", 1));
- $protocol_numrows = $protocolHandler->getCount($protocol_crit);
- if ($protocol_numrows > 0) $subscr_id = 0; //letter already successfully sent
+ $protocol_criteria = new CriteriaCompo();
+ $protocol_criteria->add(new Criteria('protocol_letter_id', $letter_id));
+ $protocol_criteria->add(new Criteria('protocol_subscriber_id', $subscr_id));
+ $protocol_criteria->add(new Criteria('protocol_success', 1));
+ $protocolCount = $protocolHandler->getCount($protocol_criteria);
+ if ($protocolCount > 0) $subscr_id = 0; //letter already successfully sent
}
if ($subscr_id > 0) {
- if ($subscriber["subscr_actkey"] == "") {
+ if ($subscriber['subscr_actkey'] == '') {
$u = $subscrHandler->get($subscr_id);
- $subscriber["subscr_actkey"] = xoops_makepass();
- $u->setVar("subscr_actkey", $subscriber["subscr_actkey"] );
+ $subscriber['subscr_actkey'] = xoops_makepass();
+ $u->setVar('subscr_actkey', $subscriber['subscr_actkey']);
$subscrHandler->insert($u);
unset($u);
}
- $recipients[] = $subscriber["subscr_id"];
+ $recipients[] = $subscriber['subscr_id'];
}
}
}
if (count($recipients) == 0) {
- redirect_header("letter.php", 3, _AM_XNEWSLETTER_SEND_ERROR_NO_SUBSCR);
+ redirect_header('letter.php', 3, _AM_XNEWSLETTER_SEND_ERROR_NO_SUBSCR);
} else {
//creating task list
$counter = 0;
@@ -112,18 +112,24 @@
}
}
$counter++;
- //create task list item
- $sql = "INSERT INTO `".$xoopsDB->prefix('mod_xnewsletter_task')."` (`task_letter_id`, `task_subscr_id`, `task_starttime`, `task_submitter`, `task_created` ) VALUES ($letter_id, ".$subscriber_id.", $task_starttime, ".$submitter.",".time().")";
+ // create task list item
+ $sql = "INSERT INTO `{$xoopsDB->prefix('mod_xnewsletter_task')}`";
+ $sql .= " (`task_letter_id`, `task_subscr_id`, `task_starttime`, `task_submitter`, `task_created` )";
+ $sql .= " VALUES ({$letter_id}, {$subscriber_id}, {$task_starttime}, {$submitter}, " . time() . ")";
if (!$xoopsDB->queryF($sql)) {
- $obj_protocol =& $protocolHandler->create();
- $obj_protocol->setVar("protocol_letter_id", $letter_id);
- $obj_protocol->setVar("protocol_subscriber_id", $subscriber_id);
- $obj_protocol->setVar("protocol_status", _AM_XNEWSLETTER_TASK_ERROR_CREATE);
- $obj_protocol->setVar("protocol_success", "0");
- $obj_protocol->setVar("protocol_submitter", $submitter);
- $obj_protocol->setVar("protocol_created", time());
- $protocolHandler->insert($obj_protocol);
- unset($obj_protocol);
+ $protocolObj = $protocolHandler->create();
+ $protocolObj->setVar('protocol_letter_id', $letter_id);
+ $protocolObj->setVar('protocol_subscriber_id', $subscriber_id);
+ $protocolObj->setVar('protocol_status', _AM_XNEWSLETTER_TASK_ERROR_CREATE);
+ $protocolObj->setVar('protocol_success', 0);
+ $protocolObj->setVar('protocol_submitter', $submitter);
+ $protocolObj->setVar('protocol_created', time());
+ if ($protocolHandler->insert($protocolObj)) {
+ // create protocol is ok
+ } else {
+ echo $protocolObj->getHtmlErrors();
+ }
+ unset($protocolObj);
}
}
}
@@ -140,7 +146,7 @@
global $XoopsTpl, $xoopsDB, $xoopsUser, $letterHandler, $accountsHandler, $subscrHandler, $attachmentHandler, $xoopsModuleConfig;
- $protocolHandler =& xoops_getModuleHandler("xNewsletter_protocol", "xNewsletter");
+ $protocolHandler = xoops_getModuleHandler("xNewsletter_protocol", "xNewsletter");
if (!isset($xoopsTpl) || !is_object($xoopsTpl)) {
include_once(XOOPS_ROOT_PATH . "/class/template.php");
@@ -155,8 +161,9 @@
//get letters ready to send groups by letter_id
$sql = "SELECT `task_letter_id` FROM {$xoopsDB->prefix('mod_xnewsletter_task')}";
- if ($letter_id > 0)
+ if ($letter_id > 0) {
$sql .= " WHERE (`task_letter_id`={$letter_id})";
+ }
$sql .= " GROUP BY `task_letter_id`";
if (!$task_letters = $xoopsDB->query($sql)) {
return _AM_XNEWSLETTER_SEND_ERROR_NO_LETTERID;
@@ -164,44 +171,45 @@
while ($task_letter = $xoopsDB->fetchArray($task_letters)) {
$letter_id = $task_letter["task_letter_id"];
- $obj_letter =& $letterHandler->get($letter_id);
- if (count($obj_letter) == 0) {
+ $letterObj =& $letterHandler->get($letter_id);
+ if (count($letterObj) == 0) {
return _AM_XNEWSLETTER_SEND_ERROR_NO_LETTERID;
}
- //read categories
- $letter_cats = $obj_letter->getVar("letter_cats");
- if ( $letter_cats == "") {
+ // read categories
+ $letter_cats = $letterObj->getVar('letter_cats');
+ if ( $letter_cats == '') {
//no cats
return _MA_XNEWSLETTER_LETTER_NONEAVAIL;
}
- //read data of account
- $letter_account = $obj_letter->getVar("letter_account");
- if ($letter_account == "" && $letter_account == 0)
+ // read data of account
+ $letter_account = $letterObj->getVar('letter_account');
+ if ($letter_account == '' && $letter_account == 0) {
return _MA_XNEWSLETTER_ACCOUNTS_NONEAVAIL;
- $obj_account = $accountsHandler->get($letter_account);
- $account_type = $obj_account->getVar("accounts_type");
- $account_yourname = $obj_account->getVar("accounts_yourname");
- $account_yourmail = $obj_account->getVar("accounts_yourmail");
- $account_username = $obj_account->getVar("accounts_username");
- $account_password = $obj_account->getVar("accounts_password");
- $account_server_out = $obj_account->getVar("accounts_server_out");
- $account_port_out = $obj_account->getVar("accounts_port_out");
- $account_securetype_out = $obj_account->getVar("accounts_securetype_out");
+ }
+ $accountObj = $accountsHandler->get($letter_account);
+ $account_type = $accountObj->getVar('accounts_type');
+ $account_yourname = $accountObj->getVar('accounts_yourname');
+ $account_yourmail = $accountObj->getVar('accounts_yourmail');
+ $account_username = $accountObj->getVar('accounts_username');
+ $account_password = $accountObj->getVar('accounts_password');
+ $account_server_out = $accountObj->getVar('accounts_server_out');
+ $account_port_out = $accountObj->getVar('accounts_port_out');
+ $account_securetype_out = $accountObj->getVar('accounts_securetype_out');
- //create basic mail body
- $letter_title = $obj_letter->getVar("letter_title");
- $letter_content = $obj_letter->getVar("letter_content", "n");
+ // create basic mail body
+ $letter_title = $letterObj->getVar('letter_title');
+ $letter_content = $letterObj->getVar('letter_content', 'n');
$tpl = new XoopsTpl();
$tpl->assign('content', $letter_content);
- $tpl->assign('title', $letter_title);
+ $tpl->assign('title', $letter_title); // new from v1.3
// read template
- $letter_template = $obj_letter->getVar("letter_template");
+ $letter_template = $letterObj->getVar('letter_template');
- //get emails of subscribers
+ // get emails of subscribers
$recipients = array();
$sql_tasklist = "SELECT `task_id`, `task_subscr_id` FROM {$xoopsDB->prefix('mod_xnewsletter_task')}";
$sql_tasklist .= " WHERE ((`task_letter_id`= {$letter_id}) AND (`task_starttime` < " . time() . "))";
@@ -210,19 +218,19 @@
}
$recipients = array();
while ($task_letter = $xoopsDB->fetchArray($task_letters)) {
- $subscr_id = $task_letter["task_subscr_id"];
- $task_id = $task_letter["task_id"];
- if ($subscr_id==0) {
- $recipients[] = array(
- "task_id" => $task_id,
- "address" => $obj_letter->getVar("letter_email_test"),
- "firstname" => "John",
- "lastname" => "Doe",
- "subscr_sex" => "Mr.",
- "subscriber_id" => "0",
- "catsubscr_id" => "0",
- "subscriber_actkey" => "Test"
- );
+ $subscr_id = $task_letter['task_subscr_id'];
+ $task_id = $task_letter['task_id'];
+ if ($subscr_id == 0) {
+ $recipients[] = array(
+ 'task_id' => $task_id,
+ 'address' => $letterObj->getVar('letter_email_test'),
+ 'firstname' => 'John',
+ 'lastname' => 'Doe',
+ 'subscr_sex' => 'Mr.',
+ 'subscriber_id' => '0',
+ 'catsubscr_id' => '0',
+ 'subscriber_actkey' => 'Test'
+ );
} else {
$sql_subscr = "SELECT * FROM {$xoopsDB->prefix('mod_xnewsletter_subscr')}";
$sql_subscr .= " WHERE `subscr_id`= {$subscr_id}";
@@ -232,13 +240,13 @@
$subscriber = $xoopsDB->fetchArray($task_subscrs);
$recipients[] = array(
- "task_id" => $task_id,
- "address" => $subscriber["subscr_email"],
- "firstname" => $subscriber["subscr_firstname"],
- "lastname" => $subscriber["subscr_lastname"],
- "subscr_sex" => $subscriber["subscr_sex"],
- "subscriber_id" => $subscriber["subscr_id"],
- "subscriber_actkey" => $subscriber["subscr_actkey"]
+ 'task_id' => $task_id,
+ 'address' => $subscriber['subscr_email'],
+ 'firstname' => $subscriber['subscr_firstname'],
+ 'lastname' => $subscriber['subscr_lastname'],
+ 'subscr_sex' => $subscriber['subscr_sex'],
+ 'subscriber_id' => $subscriber['subscr_id'],
+ 'subscriber_actkey' => $subscriber['subscr_actkey']
);
}
if ($xn_send_in_packages > 0 && count($recipients) == $xn_send_in_packages)
@@ -250,21 +258,21 @@
}
//read attachments
- $attachment_crit = new CriteriaCompo();
- $attachment_crit->add(new Criteria("attachment_letter_id", $letter_id));
- $attachment_crit->setSort("attachment_id");
- $attachment_crit->setOrder("ASC");
- $att_numrows= $attachmentHandler->getCount($attachment_crit);
- if ($att_numrows > 0) {
- $attachment_arr = $attachmentHandler->getall($attachment_crit);
- foreach (array_keys($attachment_arr) as $attid) {
- $uploaddir = XOOPS_UPLOAD_PATH.$xoopsModuleConfig['xn_attachment_path'];
- if (substr($uploaddir, -1)!="/") {
+ $attachment_criteria = new CriteriaCompo();
+ $attachment_criteria->add(new Criteria('attachment_letter_id', $letter_id));
+ $attachment_criteria->setSort('attachment_id');
+ $attachment_criteria->setOrder('ASC');
+ $attachmentCount = $attachmentHandler->getCount($attachment_criteria);
+ if ($attachmentCount > 0) {
+ $attachmentObjs = $attachmentHandler->getall($attachment_criteria);
+ foreach ($attachmentObjs as $attachment_id => $attachmentObj) {
+ $uploaddir = XOOPS_UPLOAD_PATH . $xoopsModuleConfig['xn_attachment_path'];
+ if (substr($uploaddir, -1) != "/") {
//check, whether path seperator is existing
$uploaddir .= "/";
}
$uploaddir .= $letter_id . "/";
- $attachments[] = $uploaddir . $attachment_arr[$attid]->getVar("attachment_name");
+ $attachments[] = $uploaddir . $attachmentObj->getVar("attachment_name");
}
} else {
$attachments = array();
@@ -302,7 +310,7 @@
$mail->Host = $account_server_out; //sometimes necessary to repeat
}
- if ($account_securetype_out !="") {
+ if ($account_securetype_out != '') {
$mail->SMTPAuth = true;
$mail->SMTPSecure = $account_securetype_out; // sets the prefix to the server
}
@@ -312,27 +320,24 @@
$mail->Subject = $letter_title;
foreach ($recipients as $recipient) {
- $subscriber_id = $recipient["subscriber_id"];
+ $subscriber_id = $recipient['subscriber_id'];
- $tpl->assign('sex', $recipient["subscr_sex"]);
- $tpl->assign('firstname', $recipient["firstname"]);
- $tpl->assign('lastname', $recipient["lastname"]);
- $tpl->assign('subscr_email', $recipient["address"]);
+ $tpl->assign('sex', $recipient['subscr_sex']);
+ $tpl->assign('firstname', $recipient['firstname']);
+ $tpl->assign('lastname', $recipient['lastname']);
+ $tpl->assign('subscr_email', $recipient['address']);
+ $activationKey = base64_encode(XOOPS_URL . "||{$subscriber_id}||{$recipient['subscriber_actkey']}||{$recipient['address']}");
+ $tpl->assign('unsubscribe_link', XOOPS_URL . "/modules/xNewsletter/subscription.php?op=unsub&email={$recipient['address']}&actkey={$activationKey}");
- $code = XOOPS_URL . "||" . $subscriber_id . "||" . $recipient["subscriber_actkey"] . "||" . $recipient["address"];
- $code = base64_encode($code);
- $link = XOOPS_URL . "/modules/xNewsletter/subscription.php?op=unsub&email=" . $recipient["address"] . "&actkey=" . $code;
- $tpl->assign('unsubscribe_link', $link);
+ $htmlBody = $tpl->fetch($template_path . $letter_template . '.html');
+ //$textBody = _AM_XNEWSLETTER_LETTER_EMAIL_ALTBODY;
+ //$textBody = strip_tags($htmlBody . "\n" . $link);
+ $textBody = xNewsletter_html2text($htmlBody); // new from v1.3
- $body = $tpl->fetch($template_path . $letter_template . '.html');
+ $mail->AddAddress($recipient['address'], $recipient['firstname'] . " " . $recipient['lastname']);
+ $mail->MsgHTML($htmlBody); // $mail->Body = $htmlBody;
+ $mail->AltBody = $textBody;
- $mail->AddAddress($recipient["address"], $recipient["firstname"] . " " . $recipient["lastname"]);
-
- //$mail->AltBody = _AM_XNEWSLETTER_LETTER_EMAIL_ALTBODY;
-
- $mail->MsgHTML($body);
- $mail->AltBody = strip_tags($body . "\n" . $link);
-
foreach ($attachments as $attachment) {
if (file_exists($attachment)) {
$mail->AddAttachment($attachment);
@@ -361,24 +366,23 @@
$mail->ClearAddresses();
//delete item in table task
- $sql_del = "DELETE FROM {$xoopsDB->prefix('mod_xnewsletter_task')}";
- $sql_del .= " WHERE `task_id`= {$recipient["task_id"]}";
- $result = $xoopsDB->queryF($sql_del);
+ $sql_delete = "DELETE FROM {$xoopsDB->prefix('mod_xnewsletter_task')}";
+ $sql_delete .= " WHERE `task_id`= {$recipient["task_id"]}";
+ $result = $xoopsDB->queryF($sql_delete);
- $obj_protocol =& $protocolHandler->create();
- $obj_protocol->setVar("protocol_letter_id", $letter_id);
- $obj_protocol->setVar("protocol_subscriber_id", $subscriber_id);
- $obj_protocol->setVar("protocol_status", $protocol_status);
- $obj_protocol->setVar("protocol_success", $protocol_success);
- $obj_protocol->setVar("protocol_submitter", $senderuid);
- $obj_protocol->setVar("protocol_created", time());
-
- if ($protocolHandler->insert($obj_protocol)) {
- //create protocol is ok
+ $protocolObj = $protocolHandler->create();
+ $protocolObj->setVar('protocol_letter_id', $letter_id);
+ $protocolObj->setVar('protocol_subscriber_id', $subscriber_id);
+ $protocolObj->setVar('protocol_status', $protocol_status);
+ $protocolObj->setVar('protocol_success', $protocol_success);
+ $protocolObj->setVar('protocol_submitter', $senderuid);
+ $protocolObj->setVar('protocol_created', time());
+ if ($protocolHandler->insert($protocolObj)) {
+ // create protocol is ok
} else {
- echo $obj_protocol->getHtmlErrors();
+ echo $protocolObj->getHtmlErrors();
}
- unset($obj_protocol);
+ unset($protocolObj);
}
unset($mail);
@@ -409,20 +413,19 @@
$protocol_status = '';
}
}
- $obj_protocol =& $protocolHandler->create();
- $obj_protocol->setVar("protocol_letter_id", $letter_id);
- $obj_protocol->setVar("protocol_subscriber_id", "0");
- $obj_protocol->setVar("protocol_status", $protocol_status);
- $obj_protocol->setVar("protocol_success", $protocol_success);
- $obj_protocol->setVar("protocol_submitter", $senderuid);
- $obj_protocol->setVar("protocol_created", time());
-
- if ($protocolHandler->insert($obj_protocol)) {
- //create protocol is ok
+ $protocolObj = $protocolHandler->create();
+ $protocolObj->setVar('protocol_letter_id', $letter_id);
+ $protocolObj->setVar('protocol_subscriber_id', 0);
+ $protocolObj->setVar('protocol_status', $protocol_status);
+ $protocolObj->setVar('protocol_success', $protocol_success);
+ $protocolObj->setVar('protocol_submitter', $senderuid);
+ $protocolObj->setVar('protocol_created', time());
+ if ($protocolHandler->insert($protocolObj)) {
+ // create protocol is ok
} else {
- echo $obj_protocol->getHtmlErrors();
+ echo $protocolObj->getHtmlErrors();
}
- unset($obj_protocol);
+ unset($protocolObj);
return $protocol_status;
}
Modified: XoopsModules/xnewsletter/branches/luciorota/xNewsletter/index.php
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xNewsletter/index.php 2014-02-28 10:31:35 UTC (rev 12335)
+++ XoopsModules/xnewsletter/branches/luciorota/xNewsletter/index.php 2014-02-28 21:29:57 UTC (rev 12336)
@@ -87,10 +87,11 @@
$xoopsTpl->assign('sex', _AM_XNEWSLETTER_SUBSCR_SEX_MALE);
$xoopsTpl->assign('firstname', _AM_XNEWSLETTER_SUBSCR_FIRSTNAME);
$xoopsTpl->assign('lastname', _AM_XNEWSLETTER_SUBSCR_LASTNAME);
- $xoopsTpl->assign('title', $letterObj->getVar('letter_title', 'n'));
+ $xoopsTpl->assign('title', $letterObj->getVar('letter_title', 'n')); // new from v1.3
$xoopsTpl->assign('content', $letterObj->getVar('letter_content', 'n'));
$xoopsTpl->assign('unsubscribe_url', XOOPS_URL . '/modules/xNewsletter/');
$xoopsTpl->assign('catsubscr_id', '0');
+ $xoopsTpl->assign('subscr_email', '');
$letter_array = $letterObj->toArray();
$letter_array['letter_content_templated'] = $xoopsTpl->fetch($letterTemplate);
Modified: XoopsModules/xnewsletter/branches/luciorota/xNewsletter/letter.php
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xNewsletter/letter.php 2014-02-28 10:31:35 UTC (rev 12335)
+++ XoopsModules/xnewsletter/branches/luciorota/xNewsletter/letter.php 2014-02-28 21:29:57 UTC (rev 12336)
@@ -234,7 +234,7 @@
$xoopsTpl->assign('sex', _AM_XNEWSLETTER_SUBSCR_SEX_MALE);
$xoopsTpl->assign('firstname', _AM_XNEWSLETTER_SUBSCR_FIRSTNAME);
$xoopsTpl->assign('lastname', _AM_XNEWSLETTER_SUBSCR_LASTNAME);
- $xoopsTpl->assign('title', $letterObj->getVar('letter_title', 'n'));
+ $xoopsTpl->assign('title', $letterObj->getVar('letter_title', 'n')); // new from v1.3
$xoopsTpl->assign('content', $letterObj->getVar('letter_content', 'n'));
$xoopsTpl->assign('unsubscribe_url', XOOPS_URL . '/modules/xNewsletter/');
$xoopsTpl->assign('catsubscr_id', '0');
Modified: XoopsModules/xnewsletter/branches/luciorota/xNewsletter/plugins/csv.php
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xNewsletter/plugins/csv.php 2014-02-28 10:31:35 UTC (rev 12335)
+++ XoopsModules/xnewsletter/branches/luciorota/xNewsletter/plugins/csv.php 2014-02-28 21:29:57 UTC (rev 12336)
@@ -83,7 +83,6 @@
echo $importObj->getHtmlErrors();
exit();
}
- unset($importObj);
// $sql = "INSERT INTO {$table_import} (import_email, import_sex, import_firstname, import_lastname, import_cat_id, import_subscr_id, import_catsubscr_id, import_status)";
// $sql .= " VALUES ('$email', '$sex', '$firstname', '$lastname', $currcatid, $subscr_id, $catsubscr_id, $import_status)";
// $result_insert = $xoopsDB->query($sql) or die ("MySQL-Error: " . mysql_error());
Modified: XoopsModules/xnewsletter/branches/luciorota/xNewsletter/plugins/evennews.php
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xNewsletter/plugins/evennews.php 2014-02-28 10:31:35 UTC (rev 12335)
+++ XoopsModules/xnewsletter/branches/luciorota/xNewsletter/plugins/evennews.php 2014-02-28 21:29:57 UTC (rev 12336)
@@ -83,7 +83,6 @@
echo $importObj->getHtmlErrors();
exit();
}
- unset($importObj);
// $sql = "INSERT INTO {$table_import} (import_email, import_sex, import_firstname, import_lastname, import_cat_id, import_subscr_id, import_catsubscr_id, import_status)";
// $sql .= " VALUES ('$email', '$sex', '$firstname', '$lastname', $currcatid, $subscr_id, $catsubscr_id, $import_status)";
// $result_insert = $xoopsDB->query($sql) or die ("MySQL-Error: " . mysql_error());
Modified: XoopsModules/xnewsletter/branches/luciorota/xNewsletter/plugins/rmbulletin.php
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xNewsletter/plugins/rmbulletin.php 2014-02-28 10:31:35 UTC (rev 12335)
+++ XoopsModules/xnewsletter/branches/luciorota/xNewsletter/plugins/rmbulletin.php 2014-02-28 21:29:57 UTC (rev 12336)
@@ -82,7 +82,6 @@
echo $importObj->getHtmlErrors();
exit();
}
- unset($importObj);
// $sql = "INSERT INTO {$table_import} (import_email, import_sex, import_firstname, import_lastname, import_cat_id, import_subscr_id, import_catsubscr_id, import_status)";
// $sql .= " VALUES ('$email', '$sex', '$firstname', '$lastname', $currcatid, $subscr_id, $catsubscr_id, $import_status)";
// $result_insert = $xoopsDB->query($sql) or die ("MySQL-Error: " . mysql_error());
Modified: XoopsModules/xnewsletter/branches/luciorota/xNewsletter/plugins/smartpartner.php
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xNewsletter/plugins/smartpartner.php 2014-02-28 10:31:35 UTC (rev 12335)
+++ XoopsModules/xnewsletter/branches/luciorota/xNewsletter/plugins/smartpartner.php 2014-02-28 21:29:57 UTC (rev 12336)
@@ -83,7 +83,6 @@
echo $importObj->getHtmlErrors();
exit();
}
- unset($importObj);
// $sql = "INSERT INTO {$table_import} (import_email, import_sex, import_firstname, import_lastname, import_cat_id, import_subscr_id, import_catsubscr_id, import_status)";
// $sql .= " VALUES ('$email', '$sex', '$firstname', '$lastname', $currcatid, $subscr_id, $catsubscr_id, $import_status)";
// $result_insert = $xoopsDB->query($sql) or die ("MySQL-Error: " . mysql_error());
Modified: XoopsModules/xnewsletter/branches/luciorota/xNewsletter/plugins/subscribers.php
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xNewsletter/plugins/subscribers.php 2014-02-28 10:31:35 UTC (rev 12335)
+++ XoopsModules/xnewsletter/branches/luciorota/xNewsletter/plugins/subscribers.php 2014-02-28 21:29:57 UTC (rev 12336)
@@ -83,7 +83,6 @@
echo $importObj->getHtmlErrors();
exit();
}
- unset($importObj);
// $sql = "INSERT INTO {$table_import} (import_email, import_sex, import_firstname, import_lastname, import_cat_id, import_subscr_id, import_catsubscr_id, import_status)";
// $sql .= " VALUES ('$email', '$sex', '$firstname', '$lastname', $currcatid, $subscr_id, $catsubscr_id, $import_status)";
// $result_insert = $xoopsDB->query($sql) or die ("MySQL-Error: " . mysql_error());
Modified: XoopsModules/xnewsletter/branches/luciorota/xNewsletter/plugins/weblinks.php
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xNewsletter/plugins/weblinks.php 2014-02-28 10:31:35 UTC (rev 12335)
+++ XoopsModules/xnewsletter/branches/luciorota/xNewsletter/plugins/weblinks.php 2014-02-28 21:29:57 UTC (rev 12336)
@@ -82,7 +82,6 @@
echo $importObj->getHtmlErrors();
exit();
}
- unset($importObj);
// $sql = "INSERT INTO {$table_import} (import_email, import_sex, import_firstname, import_lastname, import_cat_id, import_subscr_id, import_catsubscr_id, import_status)";
// $sql .= " VALUES ('$email', '$sex', '$firstname', '$lastname', $currcatid, $subscr_id, $catsubscr_id, $import_status)";
// $result_insert = $xoopsDB->query($sql) or die ("MySQL-Error: " . mysql_error());
Modified: XoopsModules/xnewsletter/branches/luciorota/xNewsletter/plugins/xoopsuser.php
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xNewsletter/plugins/xoopsuser.php 2014-02-28 10:31:35 UTC (rev 12335)
+++ XoopsModules/xnewsletter/branches/luciorota/xNewsletter/plugins/xoopsuser.php 2014-02-28 21:29:57 UTC (rev 12336)
@@ -86,7 +8...
[truncated message content] |