|
From: <luc...@us...> - 2014-09-05 20:17:59
|
Revision: 12775
http://sourceforge.net/p/xoops/svn/12775
Author: luciorota
Date: 2014-09-05 20:17:53 +0000 (Fri, 05 Sep 2014)
Log Message:
-----------
standardize: use include_once dirname(__FILE__)
Modified Paths:
--------------
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/about.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/accounts.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/attachment.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/bmh.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/bmh_callback_database.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/cat.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/catsubscr.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/import.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/index.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/letter.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/mailinglist.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/maintenance.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/protocol.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/sendletter.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/subscr.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/task.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/template.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/attachment.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/accounts.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/attachment.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/bmh.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/breadcrumb.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/cat.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/catsubscr.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/class.xnewslettermailer.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/import.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/letter.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/mailinglist.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/protocol.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/session.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/subscr.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/template.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/cron.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/header.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/functions.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/phpmailer/PHPMailerAutoload.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/index.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/language/english/admin.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/letter.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/print.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/protocol.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/sendletter.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/subscription.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/xoops_version.php
Modified: XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/about.php
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/about.php 2014-09-03 23:15:49 UTC (rev 12774)
+++ XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/about.php 2014-09-05 20:17:53 UTC (rev 12775)
@@ -26,11 +26,11 @@
* ****************************************************************************
*/
-include "admin_header.php";
+include_once dirname(__FILE__) . '/admin_header.php';
xoops_cp_header();
//global $indexAdmin;
-echo $indexAdmin->addNavigation("about.php");
+echo $indexAdmin->addNavigation('about.php');
echo $indexAdmin->renderAbout('9P3B3FXKF868J', false);
-include "admin_footer.php";
+include_once dirname(__FILE__) . '/admin_footer.php';
Modified: XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/accounts.php
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/accounts.php 2014-09-03 23:15:49 UTC (rev 12774)
+++ XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/accounts.php 2014-09-05 20:17:53 UTC (rev 12775)
@@ -27,7 +27,7 @@
*/
$currentFile = basename(__FILE__);
-include 'admin_header.php';
+include_once dirname(__FILE__) . '/admin_header.php';
xoops_cp_header();
// We recovered the value of the argument op in the URL$
@@ -39,7 +39,7 @@
if ($post == '' && $op == 'save_accounts' && $save_and_check =='none') $op = "edit_account";
switch ($op) {
- case 'check_accoun':
+ case 'check_account':
echo $indexAdmin->addNavigation($currentFile);
$indexAdmin->addItemButton(_AM_XNEWSLETTER_ACCOUNTSLIST, '?op=list', 'list');
echo $indexAdmin->renderButton();
@@ -204,7 +204,7 @@
$accountsCriteria->setLimit($limit);
$accountsObjs = $xnewsletter->getHandler('accounts')->getAll($accountsCriteria);
if ($accountsCount > $limit) {
- include_once XOOPS_ROOT_PATH . "/class/pagenav.php";
+ include_once XOOPS_ROOT_PATH . '/class/pagenav.php';
$pagenav = new XoopsPageNav($accountsCount, $limit, $start, 'start', 'op=list');
$pagenav = $pagenav->renderNav(4);
} else {
@@ -246,7 +246,7 @@
echo "<td>";
echo " <a href='?op=edit_account&accounts_id={$accounts_id}'><img src=" . XNEWSLETTER_ICONS_URL . "/xn_edit.png alt='" . _EDIT . "' title='"._EDIT . "' /></a>";
echo " <a href='?op=delete_account&accounts_id={$accounts_id}'><img src=" . XNEWSLETTER_ICONS_URL . "/xn_delete.png alt='" . _DELETE . "' title='" . _DELETE . "' /></a>";
- if ($accountsObj->getVar("accounts_type") != _XNEWSLETTER_ACCOUNTS_TYPE_VAL_PHP_MAIL && $accountsObj->getVar("accounts_type") != _XNEWSLETTER_ACCOUNTS_TYPE_VAL_PHP_SENDMAIL) {
+ if ($accountsObj->getVar("accounts_type") != _XNEWSLETTER_ACCOUNTS_TYPE_VAL_PHP_MAIL && $accountsObj->getVar('accounts_type') != _XNEWSLETTER_ACCOUNTS_TYPE_VAL_PHP_SENDMAIL) {
echo " <a href='?op=check_account&accounts_id={$accounts_id}'><img src=" . XNEWSLETTER_ICONS_URL . "/xn_check.png alt='" . _AM_XNEWSLETTER_ACCOUNTS_TYPE_CHECK . "' title='" . _AM_XNEWSLETTER_ACCOUNTS_TYPE_CHECK . "' /></a>";
}
echo "</td>";
@@ -284,24 +284,24 @@
$count_accounts_default = $xnewsletter->getHandler('accounts')->getCount($accountsCriteria);
if ($count_accounts_default > 0) {
if ($accountObj->getVar('accounts_default') == 1) {
- global $xoopsDB;
- $verif_accounts_default = '1';
+ $verif_accounts_default = 1;
//reset old accounts_default
- $sql = "UPDATE `{$xoopsDB->prefix("xnewsletter_accounts")}` SET `accounts_default` = '0'";
- if(!$result = $xoopsDB->query($sql)) die ("MySQL-Error: " . mysql_error());
+ if(!$xnewsletter->getHandler('accounts')->updateAll('accounts_default', 0, null, false)) {
+ exit('MySQL-Error: ' . mysql_error());
+ }
} else {
- $verif_accounts_default = '0';
+ $verif_accounts_default = 0;
}
} else {
- $verif_accounts_default = '1';
+ $verif_accounts_default = 1;
}
$accountObj->setVar('accounts_default', $verif_accounts_default);
if ($accountObj->getVar('accounts_yourmail') != '' && $accountObj->getVar('accounts_yourmail') != _AM_XNEWSLETTER_ACCOUNTS_TYPE_YOUREMAIL ) {
if ($xnewsletter->getHandler('accounts')->insert($accountObj)) {
if ($save_and_check == 'none') {
- redirect_header("?op=list", 3, _AM_XNEWSLETTER_FORMOK);
+ redirect_header('?op=list', 3, _AM_XNEWSLETTER_FORMOK);
} else {
- redirect_header("?op=check_account&accounts_id={$accountObj->getVar("accounts_id")}", 3, _AM_XNEWSLETTER_FORMOK);
+ redirect_header("?op=check_account&accounts_id={$accountObj->getVar('accounts_id')}", 3, _AM_XNEWSLETTER_FORMOK);
}
}
} else {
@@ -343,4 +343,4 @@
}
break;
}
-include 'admin_footer.php';
+include_once dirname(__FILE__) . '/admin_footer.php';
Modified: XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/attachment.php
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/attachment.php 2014-09-03 23:15:49 UTC (rev 12774)
+++ XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/attachment.php 2014-09-05 20:17:53 UTC (rev 12775)
@@ -27,7 +27,7 @@
*/
$currentFile = basename(__FILE__);
-include 'admin_header.php';
+include_once dirname(__FILE__) . '/admin_header.php';
xoops_cp_header();
// We recovered the value of the argument op in the URL$
@@ -50,7 +50,7 @@
$attachmentCriteria->setLimit($limit);
$attachmentObjs = $xnewsletter->getHandler('attachment')->getObjects($attachmentCriteria, true);
if ($attachmentCount > $limit) {
- include_once XOOPS_ROOT_PATH . "/class/pagenav.php";
+ include_once XOOPS_ROOT_PATH . '/class/pagenav.php';
$pagenav = new XoopsPageNav($attachmentCount, $limit, $start, 'start', 'op=list');
$pagenav = $pagenav->renderNav(4);
} else {
@@ -141,4 +141,4 @@
break;
}
-include 'admin_footer.php';
+include_once dirname(__FILE__) . '/admin_footer.php';
Modified: XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/bmh.php
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/bmh.php 2014-09-03 23:15:49 UTC (rev 12774)
+++ XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/bmh.php 2014-09-05 20:17:53 UTC (rev 12775)
@@ -27,36 +27,36 @@
*/
$currentFile = basename(__FILE__);
-include "admin_header.php";
+include_once dirname(__FILE__) . '/admin_header.php';
xoops_cp_header();
// We recovered the value of the argument op in the URL$
-$op = xnewsletterRequest::getString('op', 'list');
-$bmh_id = xnewsletterRequest::getInt('bmh_id', 0);
-$bmh_measure = xnewsletterRequest::getInt('bmh_measure', 0);
-$filter = xnewsletterRequest::getInt('bmh_measure_filter', _XNEWSLETTER_BMH_MEASURE_VAL_ALL);
+$op = xnewsletterRequest::getString('op', 'list');
+$bmh_id = xnewsletterRequest::getInt('bmh_id', 0);
+$bmh_measure = xnewsletterRequest::getInt('bmh_measure', 0);
+$filter = xnewsletterRequest::getInt('bmh_measure_filter', _XNEWSLETTER_BMH_MEASURE_VAL_ALL);
switch ($op) {
- case "bmh_delsubscr":
+ case 'bmh_delsubscr':
if (xnewsletterRequest::getBool('ok', false, 'POST') == true) {
$count_err = 0;
$bmhObj = $xnewsletter->getHandler('bmh')->get($bmh_id);
- $bmh_email = $bmhObj->getVar("bmh_email");
+ $bmh_email = $bmhObj->getVar('bmh_email');
- $sql = "SELECT subscr_id FROM " . $xoopsDB->prefix("xnewsletter_subscr") . " WHERE (";
- $sql .= "subscr_email='" . $bmh_email . "'";
- $sql .= ") LIMIT 1;";
+ $sql = "SELECT subscr_id FROM {$xoopsDB->prefix("xnewsletter_subscr")}";
+ $sql .= " WHERE (subscr_email='{$bmh_email}')";
+ $sql .= " LIMIT 1;";
if ( $user = $xoopsDB->query($sql) ) {
$row_user = $xoopsDB->fetchRow($user);
- $subscr_id = intval($row_user[0]);
+ $subscr_id = (int) $row_user[0];
}
if ($subscr_id == 0) {
//set bmh_measure for all entries in bmh with this email
- $sql_upd_measure = "UPDATE " . $xoopsDB->prefix("xnewsletter_bmh") . " SET `bmh_measure` = '" . _XNEWSLETTER_BMH_MEASURE_VAL_NOTHING . "'";
- $sql_upd_measure .=" WHERE ((`" . $xoopsDB->prefix("xnewsletter_bmh") . "`.`bmh_email` ='" . $bmh_email . "') AND (`" . $xoopsDB->prefix("xnewsletter_bmh") . "`.`bmh_measure` ='0'))";
+ $sql_upd_measure = "UPDATE {$xoopsDB->prefix('xnewsletter_bmh')} SET `bmh_measure` = '" . _XNEWSLETTER_BMH_MEASURE_VAL_NOTHING . "'";
+ $sql_upd_measure .=" WHERE ((`{$xoopsDB->prefix('xnewsletter_bmh')}`.`bmh_email` ='{$bmh_email}') AND (`{$xoopsDB->prefix('xnewsletter_bmh')}`.`bmh_measure` ='0'))";
$xoopsDB->query($sql_upd_measure);
- redirect_header("?op=list", 3, _AM_XNEWSLETTER_BMH_ERROR_NO_SUBSCRID);
+ redirect_header('?op=list', 3, _AM_XNEWSLETTER_BMH_ERROR_NO_SUBSCRID);
}
$subscrObj = $xnewsletter->getHandler('subscr')->get($subscr_id);
@@ -73,14 +73,14 @@
if ($catsubscrsCount > 0) {
$catsubscrObjs = $xnewsletter->getHandler('catsubscr')->getAll($catsubscrCriteria);
foreach ($catsubscrObjs as $catsubscr_id => $catsubscrObj) {
- $catsubscrObj = $xnewsletter->getHandler('catsubscr')->get($catsubscrObj->getVar("catsubscr_id"));
- $catObj = $xnewsletter->getHandler('cat')->get($catsubscrObj->getVar("catsubscr_catid"));
- $cat_mailinglist = $catObj->getVar("cat_mailinglist");
+ $catsubscrObj = $xnewsletter->getHandler('catsubscr')->get($catsubscrObj->getVar('catsubscr_id'));
+ $catObj = $xnewsletter->getHandler('cat')->get($catsubscrObj->getVar('catsubscr_catid'));
+ $cat_mailinglist = $catObj->getVar('cat_mailinglist');
if ($xnewsletter->getHandler('catsubscr')->delete($catsubscrObj, true)) {
//handle mailinglists
if ($cat_mailinglist > 0) {
- require_once( XOOPS_ROOT_PATH . "/modules/xnewsletter/include/mailinglist.php" );
+ require_once XOOPS_ROOT_PATH . '/modules/xnewsletter/include/mailinglist.php';
subscribingMLHandler(0, $subscr_id, $cat_mailinglist);
}
} else {
@@ -96,48 +96,45 @@
echo $actionprot_err;
}
} else {
- xoops_confirm(array("ok" => true, "bmh_id" => $bmh_id, "op" => "bmh_delsubscr", "filter" => $filter), $currentFile, sprintf(_AM_XNEWSLETTER_BMH_MEASURE_DELETE_SURE));
+ xoops_confirm(array('ok' => true, 'bmh_id' => $bmh_id, 'op' => 'bmh_delsubscr', 'filter' => $filter), $currentFile, sprintf(_AM_XNEWSLETTER_BMH_MEASURE_DELETE_SURE));
}
break;
- case "handle_bmh":
+ case 'handle_bmh':
if ($bmh_id == 0) redirect_header($currentFile, 3, _AM_XNEWSLETTER_ERROR_NO_VALID_ID);
if ($bmh_measure == 0) redirect_header($currentFile, 3, _AM_XNEWSLETTER_ERROR_NO_VALID_ID);
$bmhObj = $xnewsletter->getHandler('bmh')->get($bmh_id);
- if ($bmhObj->getVar("bmh_measure") == _XNEWSLETTER_BMH_MEASURE_VAL_DELETE ) {
+ if ($bmhObj->getVar('bmh_measure') == _XNEWSLETTER_BMH_MEASURE_VAL_DELETE ) {
redirect_header("?op=list&filter={$filter}'", 3, _AM_XNEWSLETTER_BMH_MEASURE_ALREADY_DELETED);
}
$bmh_email = $bmhObj->getVar("bmh_email");
if ($bmh_measure == _XNEWSLETTER_BMH_MEASURE_VAL_QUIT) {
- $sql = "UPDATE `" . $xoopsDB->prefix("xnewsletter_subscr")."` INNER JOIN `";
- $sql .= $xoopsDB->prefix("xnewsletter_catsubscr") . "` ON `subscr_id` = `catsubscr_subscrid` ";
- $sql .= "SET `catsubscr_quited` = " . time();
- $sql .= " WHERE (((`subscr_email`)='" . $bmh_email . "'))";
- if(!$result = $xoopsDB->queryF($sql)) die ("MySQL-Error: " . mysql_error());
+ $sql = "UPDATE `{$xoopsDB->prefix('xnewsletter_subscr')}` INNER JOIN `{$xoopsDB->prefix('xnewsletter_catsubscr')}` ON `subscr_id` = `catsubscr_subscrid`";
+ $sql .= " SET `catsubscr_quited` = " . time();
+ $sql .= " WHERE (((`subscr_email`)='{$bmh_email}'))";
+ if(!$result = $xoopsDB->queryF($sql)) die ('MySQL-Error: ' . mysql_error());
}
//set bmh_measure for all entries in bmh with this email
- $sql_upd = "UPDATE " . $xoopsDB->prefix("xnewsletter_bmh") . " SET ";
- $sql_upd .="`bmh_measure` = '" . $bmh_measure . "'";
- $sql_upd .=", `bmh_submitter` = '" . $xoopsUser->uid() . "'";
- $sql_upd .=", `bmh_created` = '" . time() . "'";
- $sql_upd .=" WHERE ((`" . $xoopsDB->prefix("xnewsletter_bmh") . "`.`bmh_email` ='" . $bmh_email . "') AND (`" . $xoopsDB->prefix("xnewsletter_bmh") . "`.`bmh_measure` ='0'))";
- if(!$result = $xoopsDB->queryF($sql_upd)) die ("MySQL-Error: " . mysql_error());
+ $sql_upd = "UPDATE {$xoopsDB->prefix('xnewsletter_bmh')}";
+ $sql_upd .= " SET `bmh_measure` = '{$bmh_measure}', `bmh_submitter` = '{$xoopsUser->uid()}', `bmh_created` = '" . time() . "'";
+ $sql_upd .= " WHERE ((`{$xoopsDB->prefix('xnewsletter_bmh')}`.`bmh_email` ='{$bmh_email}') AND (`{$xoopsDB->prefix('xnewsletter_bmh')}`.`bmh_measure` ='0'))";
+ if(!$result = $xoopsDB->queryF($sql_upd)) die ('MySQL-Error: ' . mysql_error());
redirect_header("?op=list&filter={$filter}", 3, _AM_XNEWSLETTER_FORMOK);
echo $bmhObj->getHtmlErrors();
break;
- case "run_bmh":
+ case 'run_bmh':
require_once('bmh_callback_database.php');
require_once(XOOPS_ROOT_PATH . '/modules/xnewsletter/include/phpmailer_bmh/class.phpmailer-bmh.php');
$accountCriteria = new CriteriaCompo();
- $accountCriteria->add(new Criteria("accounts_use_bmh", "1"));
+ $accountCriteria->add(new Criteria('accounts_use_bmh', '1'));
$accountsCount = $xnewsletter->getHandler('accounts')->getCount($accountCriteria);
if ($accountsCount > 0) {
@@ -159,30 +156,30 @@
//$bmh->processMailbox();
// for remote mailbox
- $bmh->mailhost = $accountObj->getVar("accounts_server_in"); // your mail server
- $bmh->mailbox_username = $accountObj->getVar("accounts_username"); // your mailbox username
- $bmh->mailbox_password = $accountObj->getVar("accounts_password"); // your mailbox password
- $bmh->port = $accountObj->getVar("accounts_port_in"); // the port to access your mailbox, default is 143
- if ($accountObj->getVar("accounts_type") == _XNEWSLETTER_ACCOUNTS_TYPE_VAL_POP3) {
- $bmh->service = 'pop3'; // the service to use (imap or pop3), default is 'imap'
+ $bmh->mailhost = $accountObj->getVar('accounts_server_in'); // your mail server
+ $bmh->mailbox_username = $accountObj->getVar('accounts_username'); // your mailbox username
+ $bmh->mailbox_password = $accountObj->getVar('accounts_password'); // your mailbox password
+ $bmh->port = $accountObj->getVar('accounts_port_in'); // the port to access your mailbox, default is 143
+ if ($accountObj->getVar('accounts_type') == _XNEWSLETTER_ACCOUNTS_TYPE_VAL_POP3) {
+ $bmh->service = 'pop3'; // the service to use (imap or pop3), default is 'imap'
} else {
- $bmh->service = 'imap'; // the service to use (imap or pop3), default is 'imap'
+ $bmh->service = 'imap'; // the service to use (imap or pop3), default is 'imap'
}
- $bmh->service_option = $accountObj->getVar("accounts_securetype_in"); // the service options (none, tls, notls, ssl, etc.), default is 'notls'
- $bmh->boxname = $accountObj->getVar("accounts_inbox"); // the mailbox to access, default is 'INBOX'
- $verif_movehard = $accountObj->getVar("accounts_movehard") == '1' ? true : false;
+ $bmh->service_option = $accountObj->getVar('accounts_securetype_in'); // the service options (none, tls, notls, ssl, etc.), default is 'notls'
+ $bmh->boxname = $accountObj->getVar('accounts_inbox'); // the mailbox to access, default is 'INBOX'
+ $verif_movehard = $accountObj->getVar('accounts_movehard') == '1' ? true : false;
$bmh->moveHard = $verif_movehard; // default is false
- $bmh->hardMailbox = $accountObj->getVar("accounts_hardbox"); // default is 'INBOX.hard' - NOTE: must start with 'INBOX.'
- $verif_movesoft = $accountObj->getVar("accounts_movesoft") == '1' ? true : false;
+ $bmh->hardMailbox = $accountObj->getVar('accounts_hardbox'); // default is 'INBOX.hard' - NOTE: must start with 'INBOX.'
+ $verif_movesoft = $accountObj->getVar('accounts_movesoft') == '1' ? true : false;
$bmh->moveSoft = $verif_movesoft; // default is false
- $bmh->softMailbox = $accountObj->getVar("accounts_softbox"); // default is 'INBOX.soft' - NOTE: must start with 'INBOX.'
+ $bmh->softMailbox = $accountObj->getVar('accounts_softbox'); // default is 'INBOX.soft' - NOTE: must start with 'INBOX.'
//$bmh->deleteMsgDate = '2009-01-05'; // format must be as 'yyyy-mm-dd'
// rest used regardless what type of connection it is
$bmh->openMailbox();
$bmh->processMailbox();
- $result_bmh .= str_replace("%b", $accountObj->getVar("accounts_yourmail"), _AM_XNEWSLETTER_BMH_RSLT);
+ $result_bmh .= str_replace("%b", $accountObj->getVar('accounts_yourmail'), _AM_XNEWSLETTER_BMH_RSLT);
$result_bmh = str_replace("%r", $bmh->result_total, $result_bmh);
$result_bmh = str_replace("%a", $bmh->result_processed, $result_bmh);
$result_bmh = str_replace("%n", $bmh->result_unprocessed, $result_bmh);
@@ -195,7 +192,7 @@
}
break;
- case "list":
+ case 'list':
default:
echo $indexAdmin->addNavigation('bmh.php');
$indexAdmin->addItemButton(_AM_XNEWSLETTER_RUNBMH, '?op=run_bmh', 'add');
@@ -210,16 +207,16 @@
$limit = $xnewsletter->getConfig('adminperpage');
$bhmCriteria = new CriteriaCompo();
- if ($filter > -1) $criteria->add(new Criteria("bmh_measure", $filter));
- $bhmCriteria->setSort("bmh_id");
- $bhmCriteria->setOrder("DESC");
+ if ($filter > -1) $criteria->add(new Criteria('bmh_measure', $filter));
+ $bhmCriteria->setSort('bmh_id');
+ $bhmCriteria->setOrder('DESC');
$bhmCount = $xnewsletter->getHandler('bmh')->getCount($bhmCriteria);
$start = xnewsletterRequest::getInt('start', 0);
$bhmCriteria->setStart($start);
$bhmCriteria->setLimit($limit);
$bhmObjs = $xnewsletter->getHandler('bmh')->getAll($bhmCriteria);
if ($bhmCount > $limit) {
- include_once XOOPS_ROOT_PATH . "/class/pagenav.php";
+ include_once XOOPS_ROOT_PATH . '/class/pagenav.php';
$pagenav = new XoopsPageNav($bhmCount, $limit, $start, 'start', 'op=list');
$pagenav = $pagenav->renderNav(4);
} else {
@@ -230,55 +227,55 @@
echo "<table class='outer width100' cellspacing='1'><tr class='odd'><td>";
echo "<form id='form_filter' enctype='multipart/form-data' method='post' action='{$currentFile}' name='form_filter'>";
- $checked = ($filter == -1) ? "checked='checked'" : "";
- echo "<input id='bmh_measure_all' type='radio' $checked value='-1' title='"._AM_XNEWSLETTER_BMH_MEASURE."' name='bmh_measure_filter' onclick='submit()' />
- <label for='bmh_measure_all' name='bmh_measure_all'>"._AM_XNEWSLETTER_BMH_MEASURE_ALL."</label>";
+ $checked = ($filter == -1) ? "checked='checked'" : '';
+ echo "<input id='bmh_measure_all' type='radio' {$checked} value='-1' title='" . _AM_XNEWSLETTER_BMH_MEASURE . "' name='bmh_measure_filter' onclick='submit()' />
+ <label for='bmh_measure_all' name='bmh_measure_all'>" . _AM_XNEWSLETTER_BMH_MEASURE_ALL . "</label>";
$checked = ($filter == _XNEWSLETTER_BMH_MEASURE_VAL_PENDING) ? "checked='checked'" : "";
- echo "<input id='bmh_measure0' type='radio' $checked value='"._XNEWSLETTER_BMH_MEASURE_VAL_PENDING."' title='"._AM_XNEWSLETTER_BMH_MEASURE."' name='bmh_measure_filter' onclick='submit()' />
- <label for='bmh_measure0' name='bmh_measure0'>"._AM_XNEWSLETTER_BMH_MEASURE_PENDING."</label>";
+ echo "<input id='bmh_measure0' type='radio' {$checked} value='" . _XNEWSLETTER_BMH_MEASURE_VAL_PENDING . "' title='" . _AM_XNEWSLETTER_BMH_MEASURE . "' name='bmh_measure_filter' onclick='submit()' />
+ <label for='bmh_measure0' name='bmh_measure0'>" . _AM_XNEWSLETTER_BMH_MEASURE_PENDING . "</label>";
$checked = ($filter == _XNEWSLETTER_BMH_MEASURE_VAL_NOTHING) ? "checked='checked'" : "";
- echo "<input id='bmh_measure1' type='radio' $checked value='"._XNEWSLETTER_BMH_MEASURE_VAL_NOTHING."' title='"._AM_XNEWSLETTER_BMH_MEASURE."' name='bmh_measure_filter' onclick='submit()' />
- <label for='bmh_measure1' name='bmh_measure1'>"._AM_XNEWSLETTER_BMH_MEASURE_NOTHING."</label>";
+ echo "<input id='bmh_measure1' type='radio' {$checked} value='" . _XNEWSLETTER_BMH_MEASURE_VAL_NOTHING . "' title='" . _AM_XNEWSLETTER_BMH_MEASURE . "' name='bmh_measure_filter' onclick='submit()' />
+ <label for='bmh_measure1' name='bmh_measure1'>" . _AM_XNEWSLETTER_BMH_MEASURE_NOTHING . "</label>";
$checked = ($filter == _XNEWSLETTER_BMH_MEASURE_VAL_QUIT) ? "checked='checked'" : "";
- echo "<input id='bmh_measure2' type='radio' $checked value='"._XNEWSLETTER_BMH_MEASURE_VAL_QUIT."' title='"._AM_XNEWSLETTER_BMH_MEASURE."' name='bmh_measure_filter' onclick='submit()'>
- <label for='bmh_measure2' name='bmh_measure2'>"._AM_XNEWSLETTER_BMH_MEASURE_QUITED."</label>";
+ echo "<input id='bmh_measure2' type='radio' {$checked} value='" . _XNEWSLETTER_BMH_MEASURE_VAL_QUIT . "' title='" . _AM_XNEWSLETTER_BMH_MEASURE . "' name='bmh_measure_filter' onclick='submit()'>
+ <label for='bmh_measure2' name='bmh_measure2'>" . _AM_XNEWSLETTER_BMH_MEASURE_QUITED . "</label>";
$checked = ($filter == _XNEWSLETTER_BMH_MEASURE_VAL_DELETE) ? "checked='checked'" : "";
- echo "<input id='bmh_measure3' type='radio' $checked value='"._XNEWSLETTER_BMH_MEASURE_VAL_DELETE."' title='"._AM_XNEWSLETTER_BMH_MEASURE."' name='bmh_measure_filter' onclick='submit()' />
- <label for='bmh_measure3' name='bmh_measure3'>"._AM_XNEWSLETTER_BMH_MEASURE_DELETED."</label>";
+ echo "<input id='bmh_measure3' type='radio' {$checked} value='" . _XNEWSLETTER_BMH_MEASURE_VAL_DELETE . "' title='" . _AM_XNEWSLETTER_BMH_MEASURE . "' name='bmh_measure_filter' onclick='submit()' />
+ <label for='bmh_measure3' name='bmh_measure3'>" . _AM_XNEWSLETTER_BMH_MEASURE_DELETED . "</label>";
echo "</form>";
echo "</td></tr></table>";
// View Table
echo "<table class='outer width100' cellspacing='1'>
<tr>
- <th class='center width2'>" . _AM_XNEWSLETTER_BMH_ID . "</th>
- <th class='center'>" . _AM_XNEWSLETTER_BMH_RULE_NO . "</th>
- <th class='center'>" . _AM_XNEWSLETTER_BMH_RULE_CAT . "</th>
- <th class='center'>" . _AM_XNEWSLETTER_BMH_BOUNCETYPE . "</th>
- <th class='center'>" . _AM_XNEWSLETTER_BMH_REMOVE . "</th>
- <th class='center'>" . _AM_XNEWSLETTER_BMH_EMAIL . "</th>
- <th class='center'>" . _AM_XNEWSLETTER_BMH_MEASURE . "</th>
- <th class='center'>" . _AM_XNEWSLETTER_BMH_CREATED . "</th>
- <th class='center'>" . _AM_XNEWSLETTER_FORMACTION . "</th>
+ <th>" . _AM_XNEWSLETTER_BMH_ID . "</th>
+ <th>" . _AM_XNEWSLETTER_BMH_RULE_NO . "</th>
+ <th>" . _AM_XNEWSLETTER_BMH_RULE_CAT . "</th>
+ <th>" . _AM_XNEWSLETTER_BMH_BOUNCETYPE . "</th>
+ <th>" . _AM_XNEWSLETTER_BMH_REMOVE . "</th>
+ <th>" . _AM_XNEWSLETTER_BMH_EMAIL . "</th>
+ <th>" . _AM_XNEWSLETTER_BMH_MEASURE . "</th>
+ <th>" . _AM_XNEWSLETTER_BMH_CREATED . "</th>
+ <th>" . _AM_XNEWSLETTER_FORMACTION . "</th>
</tr>";
if ($bhmCount > 0) {
- $class = "odd";
+ $class = 'odd';
foreach ($bhmObjs as $bhm_id => $bhmObj) {
- echo "<tr class='".$class."'>";
- $class = ($class == "even") ? "odd" : "even";
- echo "<td class='center'>" . $bhm_id . "</td>";
- echo "<td class='center'>" . $bhmObj->getVar("bmh_rule_no")."</td>";
- echo "<td class='center'>" . $bhmObj->getVar("bmh_rule_cat")."</td>";
- echo "<td class='center'>" . $bhmObj->getVar("bmh_bouncetype")."</td>";
+ echo "<tr class='{$class}'>";
+ $class = ($class == 'even') ? 'odd' : 'even';
+ echo "<td>" . $bhm_id . "</td>";
+ echo "<td>" . $bhmObj->getVar(...
[truncated message content] |
|
From: <luc...@us...> - 2014-09-16 20:36:10
|
Revision: 12783
http://sourceforge.net/p/xoops/svn/12783
Author: luciorota
Date: 2014-09-16 20:35:59 +0000 (Tue, 16 Sep 2014)
Log Message:
-----------
standardize code
fixed bug in module update procedure
Modified Paths:
--------------
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/letter.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/attachment.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/bmh.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/cat.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/catsubscr.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/import.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/letter.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/mailinglist.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/protocol.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/subscr.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/task.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/template.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/docs/changelog.txt
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/docs/install.txt
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/constants.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/functions.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/onupdate.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/task.inc.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/language/english/admin.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/letter.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/sql/mysql.sql
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/xoops_version.php
Added Paths:
-----------
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/docs/update.txt
Modified: XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/letter.php
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/letter.php 2014-09-16 20:31:50 UTC (rev 12782)
+++ XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/letter.php 2014-09-16 20:35:59 UTC (rev 12783)
@@ -221,6 +221,7 @@
$protocolObjs = $xnewsletter->getHandler('protocol')->getAll($protocolCriteria);
$protocol_status = '';
$protocol_letter_id = 0;
+// why foreach?
foreach ($protocolObjs as $protocolObj) {
$protocol_status .= $protocolObj->getVar('protocol_status');
$protocol_letter_id = $protocolObj->getVar('protocol_letter_id');
@@ -396,7 +397,9 @@
$redirectUrl = '?op=list_letters';
break;
}
- $protocolObj->setVar('protocol_status', _AM_XNEWSLETTER_LETTER_ACTION_SAVED);
+ $protocolObj->setVar('protocol_status', _AM_XNEWSLETTER_LETTER_ACTION_SAVED); // old style
+ $protocolObj->setVar('protocol_status_str_id', _XNEWSLETTER_PROTOCOL_STATUS_SAVED); // new from v1.3
+ $protocolObj->setVar('protocol_status_vars', array()); // new from v1.3
$protocolObj->setVar('protocol_submitter', $xoopsUser->uid());
$protocolObj->setVar('protocol_created', time());
//
Modified: XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/attachment.php
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/attachment.php 2014-09-16 20:31:50 UTC (rev 12782)
+++ XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/attachment.php 2014-09-16 20:35:59 UTC (rev 12783)
@@ -83,7 +83,7 @@
$mode_select = new XoopsFormRadio(_AM_XNEWSLETTER_ATTACHMENT_MODE, 'attachment_mode', $this->getVar('attachment_mode'));
$mode_select->addOption(_XNEWSLETTER_ATTACHMENTS_MODE_ASATTACHMENT, _AM_XNEWSLETTER_ATTACHMENT_MODE_ASATTACHMENT);
$mode_select->addOption(_XNEWSLETTER_ATTACHMENTS_MODE_ASLINK, _AM_XNEWSLETTER_ATTACHMENT_MODE_ASLINK);
- //$mode_select->addOption(_XNEWSLETTER_ATTACHMENTS_MODE_AUTO, _AM_XNEWSLETTER_ATTACHMENT_MODE_AUTO); // IN PROGRESS
+ //$mode_select->addOption(_XNEWSLETTER_ATTACHMENTS_MODE_AUTO, _AM_XNEWSLETTER_ATTACHMENT_MODE_AUTO); // for future features
$form->addElement($mode_select);
$form->addElement(new XoopsFormLabel(_AM_XNEWSLETTER_ATTACHMENT_SUBMITTER, $GLOBALS['xoopsUser']->uname()));
Modified: XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/bmh.php
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/bmh.php 2014-09-16 20:31:50 UTC (rev 12782)
+++ XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/bmh.php 2014-09-16 20:35:59 UTC (rev 12783)
@@ -43,17 +43,17 @@
public function __construct()
{
$this->xnewsletter = xnewsletterxnewsletter::getInstance();
- $this->db = XoopsDatabaseFactory::getDatabaseConnection();
- $this->initVar("bmh_id", XOBJ_DTYPE_INT, null, false);
- $this->initVar("bmh_rule_no", XOBJ_DTYPE_TXTBOX, null, false, 10);
- $this->initVar("bmh_rule_cat", XOBJ_DTYPE_TXTBOX, null, false, 50);
- $this->initVar("bmh_bouncetype", XOBJ_DTYPE_TXTBOX, null, false, 50);
- $this->initVar("bmh_remove", XOBJ_DTYPE_TXTBOX, null, false, 50);
- $this->initVar("bmh_email", XOBJ_DTYPE_TXTBOX, null, false, 100);
- $this->initVar("bmh_subject", XOBJ_DTYPE_TXTBOX, null, false, 100);
- $this->initVar("bmh_measure", XOBJ_DTYPE_INT, null, false);
- $this->initVar("bmh_submitter", XOBJ_DTYPE_INT, null, false);
- $this->initVar("bmh_created", XOBJ_DTYPE_INT, time(), false);
+ $this->db = XoopsDatabaseFactory::getDatabaseConnection();
+ $this->initVar('bmh_id', XOBJ_DTYPE_INT, null, false);
+ $this->initVar('bmh_rule_no', XOBJ_DTYPE_TXTBOX, null, false, 10);
+ $this->initVar('bmh_rule_cat', XOBJ_DTYPE_TXTBOX, null, false, 50);
+ $this->initVar('bmh_bouncetype', XOBJ_DTYPE_TXTBOX, null, false, 50);
+ $this->initVar('bmh_remove', XOBJ_DTYPE_TXTBOX, null, false, 50);
+ $this->initVar('bmh_email', XOBJ_DTYPE_TXTBOX, null, false, 100);
+ $this->initVar('bmh_subject', XOBJ_DTYPE_TXTBOX, null, false, 100);
+ $this->initVar('bmh_measure', XOBJ_DTYPE_INT, null, false);
+ $this->initVar('bmh_submitter', XOBJ_DTYPE_INT, null, false);
+ $this->initVar('bmh_created', XOBJ_DTYPE_INT, time(), false);
}
/**
Modified: XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/cat.php
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/cat.php 2014-09-16 20:31:50 UTC (rev 12782)
+++ XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/cat.php 2014-09-16 20:35:59 UTC (rev 12783)
@@ -48,12 +48,12 @@
{
$this->xnewsletter = xnewsletterxnewsletter::getInstance();
$this->db = XoopsDatabaseFactory::getDatabaseConnection();
- $this->initVar("cat_id", XOBJ_DTYPE_INT, null, false);
- $this->initVar("cat_name", XOBJ_DTYPE_TXTBOX, '', false, 100);
- $this->initVar("cat_info", XOBJ_DTYPE_TXTAREA, '', false);
- $this->initVar("cat_mailinglist", XOBJ_DTYPE_INT, 0, false);
- $this->initVar("cat_submitter", XOBJ_DTYPE_INT, null, false);
- $this->initVar("cat_created", XOBJ_DTYPE_INT, time(), false);
+ $this->initVar('cat_id', XOBJ_DTYPE_INT, null, false);
+ $this->initVar('cat_name', XOBJ_DTYPE_TXTBOX, '', false, 100);
+ $this->initVar('cat_info', XOBJ_DTYPE_TXTAREA, '', false);
+ $this->initVar('cat_mailinglist', XOBJ_DTYPE_INT, 0, false);
+ $this->initVar('cat_submitter', XOBJ_DTYPE_INT, null, false);
+ $this->initVar('cat_created', XOBJ_DTYPE_INT, time(), false);
$this->initVar('dohtml', XOBJ_DTYPE_INT, false); // boolean
$this->initVar('dosmiley', XOBJ_DTYPE_INT, true); // boolean
$this->initVar('doxcode', XOBJ_DTYPE_INT, true); // boolean
Modified: XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/catsubscr.php
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/catsubscr.php 2014-09-16 20:31:50 UTC (rev 12782)
+++ XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/catsubscr.php 2014-09-16 20:35:59 UTC (rev 12783)
@@ -43,7 +43,7 @@
public function __construct()
{
$this->xnewsletter = xnewsletterxnewsletter::getInstance();
- $this->db = XoopsDatabaseFactory::getDatabaseConnection();
+ $this->db = XoopsDatabaseFactory::getDatabaseConnection();
$this->initVar('catsubscr_id', XOBJ_DTYPE_INT, null, false);
$this->initVar('catsubscr_catid', XOBJ_DTYPE_INT, null, false);
$this->initVar('catsubscr_subscrid', XOBJ_DTYPE_INT, null, false);
Modified: XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/import.php
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/import.php 2014-09-16 20:31:50 UTC (rev 12782)
+++ XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/import.php 2014-09-16 20:35:59 UTC (rev 12783)
@@ -43,16 +43,16 @@
public function __construct()
{
$this->xnewsletter = xnewsletterxnewsletter::getInstance();
- $this->db = XoopsDatabaseFactory::getDatabaseConnection();
- $this->initVar("import_id", XOBJ_DTYPE_INT, null, false);
- $this->initVar("import_email", XOBJ_DTYPE_TXTBOX, null, false, 100);
- $this->initVar("import_firstname", XOBJ_DTYPE_TXTBOX, null, false, 100);
- $this->initVar("import_lastname", XOBJ_DTYPE_TXTBOX, null, false, 100);
- $this->initVar("import_sex", XOBJ_DTYPE_TXTBOX, null, false, 100);
- $this->initVar("import_cat_id", XOBJ_DTYPE_INT, null, false);
- $this->initVar("import_subscr_id", XOBJ_DTYPE_INT, null, false);
- $this->initVar("import_catsubscr_id", XOBJ_DTYPE_INT, null, false);
- $this->initVar("import_status", XOBJ_DTYPE_INT, false, false); // boolean
+ $this->db = XoopsDatabaseFactory::getDatabaseConnection();
+ $this->initVar('import_id', XOBJ_DTYPE_INT, null, false);
+ $this->initVar('import_email', XOBJ_DTYPE_TXTBOX, null, false, 100);
+ $this->initVar('import_firstname', XOBJ_DTYPE_TXTBOX, null, false, 100);
+ $this->initVar('import_lastname', XOBJ_DTYPE_TXTBOX, null, false, 100);
+ $this->initVar('import_sex', XOBJ_DTYPE_TXTBOX, null, false, 100);
+ $this->initVar('import_cat_id', XOBJ_DTYPE_INT, null, false);
+ $this->initVar('import_subscr_id', XOBJ_DTYPE_INT, null, false);
+ $this->initVar('import_catsubscr_id', XOBJ_DTYPE_INT, null, false);
+ $this->initVar('import_status', XOBJ_DTYPE_INT, false, false); // boolean
}
/**
Modified: XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/letter.php
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/letter.php 2014-09-16 20:31:50 UTC (rev 12782)
+++ XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/letter.php 2014-09-16 20:35:59 UTC (rev 12783)
@@ -44,18 +44,18 @@
{
$this->xnewsletter = xnewsletterxnewsletter::getInstance();
$this->db = XoopsDatabaseFactory::getDatabaseConnection();
- $this->initVar("letter_id", XOBJ_DTYPE_INT, null, false);
- $this->initVar("letter_title", XOBJ_DTYPE_TXTBOX, null, true, 100);
- $this->initVar("letter_content", XOBJ_DTYPE_TXTAREA, null, true);
- $this->initVar("letter_template", XOBJ_DTYPE_TXTBOX, null, false, 100);
- $this->initVar("letter_cats", XOBJ_DTYPE_TXTBOX, null, false, 100); // IN PROGRESS: AN ARRAY SHOULD BE BETTER
- $this->initVar("letter_attachment", XOBJ_DTYPE_TXTBOX, null, false, 200);
- $this->initVar("letter_account", XOBJ_DTYPE_INT, null, false);
- $this->initVar("letter_email_test", XOBJ_DTYPE_TXTBOX, null, false, 100);
- $this->initVar("letter_submitter", XOBJ_DTYPE_INT, null, false);
- $this->initVar("letter_created", XOBJ_DTYPE_INT, time(), false); // timestamp
- $this->initVar("letter_sender", XOBJ_DTYPE_INT, null, false);
- $this->initVar("letter_sent", XOBJ_DTYPE_INT, false, false); // timestamp or false
+ $this->initVar('letter_id', XOBJ_DTYPE_INT, null, false);
+ $this->initVar('letter_title', XOBJ_DTYPE_TXTBOX, null, true, 100);
+ $this->initVar('letter_content', XOBJ_DTYPE_TXTAREA, null, true);
+ $this->initVar('letter_template', XOBJ_DTYPE_TXTBOX, null, false, 100);
+ $this->initVar('letter_cats', XOBJ_DTYPE_TXTBOX, null, false, 100); // IN PROGRESS: AN ARRAY SHOULD BE BETTER
+ $this->initVar('letter_attachment', XOBJ_DTYPE_TXTBOX, null, false, 200);
+ $this->initVar('letter_account', XOBJ_DTYPE_INT, null, false);
+ $this->initVar('letter_email_test', XOBJ_DTYPE_TXTBOX, null, false, 100);
+ $this->initVar('letter_submitter', XOBJ_DTYPE_INT, null, false);
+ $this->initVar('letter_created', XOBJ_DTYPE_INT, time(), false); // timestamp
+ $this->initVar('letter_sender', XOBJ_DTYPE_INT, null, false);
+ $this->initVar('letter_sent', XOBJ_DTYPE_INT, false, false); // timestamp or false
}
/**
@@ -166,7 +166,7 @@
$mode_select = new XoopsFormRadio(_AM_XNEWSLETTER_ATTACHMENT_MODE, "existing_attachments_mode[{$attachment_id}]", $attachmentObj->getVar("attachment_mode"), ' ');
$mode_select->addOption(_XNEWSLETTER_ATTACHMENTS_MODE_ASATTACHMENT, _AM_XNEWSLETTER_ATTACHMENT_MODE_ASATTACHMENT);
$mode_select->addOption(_XNEWSLETTER_ATTACHMENTS_MODE_ASLINK, _AM_XNEWSLETTER_ATTACHMENT_MODE_ASLINK);
- //$mode_select->addOption(_XNEWSLETTER_ATTACHMENTS_MODE_AUTO, _AM_XNEWSLETTER_ATTACHMENT_MODE_AUTO); // IN PROGRESS
+ //$mode_select->addOption(_XNEWSLETTER_ATTACHMENTS_MODE_AUTO, _AM_XNEWSLETTER_ATTACHMENT_MODE_AUTO); // for future features
$delete_attachment_tray->addElement($mode_select);
$delete_attachment_tray->addElement(new XoopsFormLabel('', $attachmentObj->getVar('attachment_name')));
$delete_button = new XoopsFormButton('', "delete_attachment_{$i}", _DELETE, 'submit');
@@ -183,7 +183,7 @@
$mode_select = new XoopsFormRadio(_AM_XNEWSLETTER_ATTACHMENT_MODE, "new_attachments_mode[{$j}]", _XNEWSLETTER_ATTACHMENTS_MODE_ASATTACHMENT, ' ');
$mode_select->addOption(_XNEWSLETTER_ATTACHMENTS_MODE_ASATTACHMENT, _AM_XNEWSLETTER_ATTACHMENT_MODE_ASATTACHMENT);
$mode_select->addOption(_XNEWSLETTER_ATTACHMENTS_MODE_ASLINK, _AM_XNEWSLETTER_ATTACHMENT_MODE_ASLINK);
- //$mode_select->addOption(_XNEWSLETTER_ATTACHMENTS_MODE_AUTO, _AM_XNEWSLETTER_ATTACHMENT_MODE_AUTO); // IN PROGRESS
+ //$mode_select->addOption(_XNEWSLETTER_ATTACHMENTS_MODE_AUTO, _AM_XNEWSLETTER_ATTACHMENT_MODE_AUTO); // for future features
$add_attachment_tray->addElement($mode_select);
$add_attachment_tray->addElement(new XoopsFormFile('', "new_attachment_index={$j}", $this->xnewsletter->getConfig('xn_maxsize')));
$attachment_tray->addElement($add_attachment_tray);
Modified: XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/mailinglist.php
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/mailinglist.php 2014-09-16 20:31:50 UTC (rev 12782)
+++ XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/mailinglist.php 2014-09-16 20:35:59 UTC (rev 12783)
@@ -43,15 +43,15 @@
public function __construct()
{
$this->xnewsletter = xnewsletterxnewsletter::getInstance();
- $this->db = XoopsDatabaseFactory::getDatabaseConnection();
- $this->initVar("mailinglist_id", XOBJ_DTYPE_INT, null, fals);
- $this->initVar("mailinglist_name", XOBJ_DTYPE_TXTBOX, null, false, 100);
- $this->initVar("mailinglist_email", XOBJ_DTYPE_TXTBOX, null, false, 100);
- $this->initVar("mailinglist_listname", XOBJ_DTYPE_TXTBOX, null, false, 100);
- $this->initVar("mailinglist_subscribe", XOBJ_DTYPE_TXTBOX, null, false, 100);
- $this->initVar("mailinglist_unsubscribe", XOBJ_DTYPE_TXTBOX, null, false, 100);
- $this->initVar("mailinglist_submitter", XOBJ_DTYPE_INT, null, false);
- $this->initVar("mailinglist_created", XOBJ_DTYPE_INT, time(), false);
+ $this->db = XoopsDatabaseFactory::getDatabaseConnection();
+ $this->initVar('mailinglist_id', XOBJ_DTYPE_INT, null, fals);
+ $this->initVar('mailinglist_name', XOBJ_DTYPE_TXTBOX, null, false, 100);
+ $this->initVar('mailinglist_email', XOBJ_DTYPE_TXTBOX, null, false, 100);
+ $this->initVar('mailinglist_listname', XOBJ_DTYPE_TXTBOX, null, false, 100);
+ $this->initVar('mailinglist_subscribe', XOBJ_DTYPE_TXTBOX, null, false, 100);
+ $this->initVar('mailinglist_unsubscribe', XOBJ_DTYPE_TXTBOX, null, false, 100);
+ $this->initVar('mailinglist_submitter', XOBJ_DTYPE_INT, null, false);
+ $this->initVar('mailinglist_created', XOBJ_DTYPE_INT, time(), false);
}
/**
Modified: XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/protocol.php
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/protocol.php 2014-09-16 20:31:50 UTC (rev 12782)
+++ XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/protocol.php 2014-09-16 20:35:59 UTC (rev 12783)
@@ -36,6 +36,14 @@
{
public $xnewsletter = null;
+ public $protocol_status_strs = array(
+ _XNEWSLETTER_PROTOCOL_STATUS_SAVED => _AM_XNEWSLETTER_PROTOCOL_STATUS_SAVED,
+ _XNEWSLETTER_PROTOCOL_STATUS_ERROR_CREATE_TASK => _AM_XNEWSLETTER_PROTOCOL_STATUS_ERROR_CREATE_TASK,
+ _XNEWSLETTER_PROTOCOL_STATUS_OK_SEND_TEST => _AM_XNEWSLETTER_PROTOCOL_STATUS_OK_SEND_TEST,
+ _XNEWSLETTER_PROTOCOL_STATUS_OK_SEND => _AM_XNEWSLETTER_PROTOCOL_STATUS_OK_SEND,
+ _XNEWSLETTER_PROTOCOL_STATUS_ERROR_SEND => _AM_XNEWSLETTER_PROTOCOL_STATUS_ERROR_SEND
+// INPROGRESS
+ );
//Constructor
/**
*
@@ -43,14 +51,16 @@
public function __construct()
{
$this->xnewsletter = xnewsletterxnewsletter::getInstance();
- $this->db = XoopsDatabaseFactory::getDatabaseConnection();
- $this->initVar("protocol_id", XOBJ_DTYPE_INT, null, false);
- $this->initVar("protocol_letter_id", XOBJ_DTYPE_INT, null, false);
- $this->initVar("protocol_subscriber_id", XOBJ_DTYPE_INT, null, false);
- $this->initVar("protocol_status", XOBJ_DTYPE_TXTBOX, '', false, 200);
- $this->initVar("protocol_success", XOBJ_DTYPE_OTHER, null, false); // boolean
- $this->initVar("protocol_submitter", XOBJ_DTYPE_INT, null, false);
- $this->initVar("protocol_created", XOBJ_DTYPE_INT, null, false);
+ $this->db = XoopsDatabaseFactory::getDatabaseConnection();
+ $this->initVar('protocol_id', XOBJ_DTYPE_INT, null, false);
+ $this->initVar('protocol_letter_id', XOBJ_DTYPE_INT, null, false);
+ $this->initVar('protocol_subscriber_id', XOBJ_DTYPE_INT, null, false);
+ $this->initVar('protocol_status', XOBJ_DTYPE_TXTBOX, '', false, 200); // old style
+ $this->initVar('protocol_success', XOBJ_DTYPE_OTHER, null, false); // boolean
+ $this->initVar('protocol_submitter', XOBJ_DTYPE_INT, null, false);
+ $this->initVar('protocol_created', XOBJ_DTYPE_INT, null, false);
+ $this->initVar('protocol_status_str_id', XOBJ_DTYPE_TXTBOX, '', false); // new from v1.3
+ $this->initVar('protocol_status_vars', XOBJ_DTYPE_ARRAY, array(), false); // new from v1.3
}
/**
Modified: XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/subscr.php
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/subscr.php 2014-09-16 20:31:50 UTC (rev 12782)
+++ XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/subscr.php 2014-09-16 20:35:59 UTC (rev 12783)
@@ -43,19 +43,19 @@
public function __construct()
{
$this->xnewsletter = xnewsletterxnewsletter::getInstance();
- $this->db = XoopsDatabaseFactory::getDatabaseConnection();
- $this->initVar("subscr_id", XOBJ_DTYPE_INT, null, false);
- $this->initVar("subscr_email", XOBJ_DTYPE_TXTBOX, '', false, 100);
- $this->initVar("subscr_firstname", XOBJ_DTYPE_TXTBOX, '', true, 100);
- $this->initVar("subscr_lastname", XOBJ_DTYPE_TXTBOX, '', false, 100);
- $this->initVar("subscr_uid", XOBJ_DTYPE_INT, null, false);
- $this->initVar("subscr_sex", XOBJ_DTYPE_TXTBOX, '', false, 100);
- $this->initVar("subscr_submitter", XOBJ_DTYPE_INT, null, false);
- $this->initVar("subscr_created", XOBJ_DTYPE_INT, time(), false);
- $this->initVar("subscr_actkey", XOBJ_DTYPE_TXTBOX, '', false, 255);
- $this->initVar("subscr_ip", XOBJ_DTYPE_TXTBOX, xoops_getenv('REMOTE_ADDR'), false, 32);
- $this->initVar("subscr_activated", XOBJ_DTYPE_INT, 0, false); // IN PROGRESS: should be false or timestamp
- $this->initVar("subscr_actoptions", XOBJ_DTYPE_ARRAY, array(), false);
+ $this->db = XoopsDatabaseFactory::getDatabaseConnection();
+ $this->initVar('subscr_id', XOBJ_DTYPE_INT, null, false);
+ $this->initVar('subscr_email', XOBJ_DTYPE_TXTBOX, '', false, 100);
+ $this->initVar('subscr_firstname', XOBJ_DTYPE_TXTBOX, '', true, 100);
+ $this->initVar('subscr_lastname', XOBJ_DTYPE_TXTBOX, '', false, 100);
+ $this->initVar('subscr_uid', XOBJ_DTYPE_INT, null, false);
+ $this->initVar('subscr_sex', XOBJ_DTYPE_TXTBOX, '', false, 100);
+ $this->initVar('subscr_submitter', XOBJ_DTYPE_INT, null, false);
+ $this->initVar('subscr_created', XOBJ_DTYPE_INT, time(), false);
+ $this->initVar('subscr_actkey', XOBJ_DTYPE_TXTBOX, '', false, 255);
+ $this->initVar('subscr_ip', XOBJ_DTYPE_TXTBOX, xoops_getenv('REMOTE_ADDR'), false, 32);
+ $this->initVar('subscr_activated', XOBJ_DTYPE_INT, 0, false); // IN PROGRESS: should be false or timestamp
+ $this->initVar('subscr_actoptions', XOBJ_DTYPE_ARRAY, array(), false);
}
/**
Modified: XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/task.php
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/task.php 2014-09-16 20:31:50 UTC (rev 12782)
+++ XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/task.php 2014-09-16 20:35:59 UTC (rev 12783)
@@ -37,14 +37,14 @@
public function __construct()
{
$this->xnewsletter = xnewsletterxnewsletter::getInstance();
- $this->db = XoopsDatabaseFactory::getDatabaseConnection();
+ $this->db = XoopsDatabaseFactory::getDatabaseConnection();
$this->XoopsObject();
- $this->initVar("task_id", XOBJ_DTYPE_INT, null, false);
- $this->initVar("task_letter_id", XOBJ_DTYPE_INT, null, false);
- $this->initVar("task_subscr_id", XOBJ_DTYPE_INT, null, false);
- $this->initVar("task_starttime", XOBJ_DTYPE_INT, null, false);
- $this->initVar("task_submitter", XOBJ_DTYPE_INT, null, false);
- $this->initVar("task_created", XOBJ_DTYPE_INT, time(), false);
+ $this->initVar('task_id', XOBJ_DTYPE_INT, null, false);
+ $this->initVar('task_letter_id', XOBJ_DTYPE_INT, null, false);
+ $this->initVar('task_subscr_id', XOBJ_DTYPE_INT, null, false);
+ $this->initVar('task_starttime', XOBJ_DTYPE_INT, null, false);
+ $this->initVar('task_submitter', XOBJ_DTYPE_INT, null, false);
+ $this->initVar('task_created', XOBJ_DTYPE_INT, time(), false);
}
/**
Modified: XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/template.php
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/template.php 2014-09-16 20:31:50 UTC (rev 12782)
+++ XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/template.php 2014-09-16 20:35:59 UTC (rev 12783)
@@ -43,13 +43,13 @@
public function __construct()
{
$this->xnewsletter = xnewsletterxnewsletter::getInstance();
- $this->db = XoopsDatabaseFactory::getDatabaseConnection();
- $this->initVar("template_id", XOBJ_DTYPE_INT, null, false);
- $this->initVar("template_title", XOBJ_DTYPE_TXTBOX, '', true, 100);
- $this->initVar("template_description", XOBJ_DTYPE_TXTAREA, '', false);
- $this->initVar("template_content", XOBJ_DTYPE_TXTAREA, '', true);
- $this->initVar("template_submitter", XOBJ_DTYPE_INT, null, false);
- $this->initVar("template_created", XOBJ_DTYPE_INT, time(), false);
+ $this->db = XoopsDatabaseFactory::getDatabaseConnection();
+ $this->initVar('template_id', XOBJ_DTYPE_INT, null, false);
+ $this->initVar('template_title', XOBJ_DTYPE_TXTBOX, '', true, 100);
+ $this->initVar('template_description', XOBJ_DTYPE_TXTAREA, '', false);
+ $this->initVar('template_content', XOBJ_DTYPE_TXTAREA, '', true);
+ $this->initVar('template_submitter', XOBJ_DTYPE_INT, null, false);
+ $this->initVar('template_created', XOBJ_DTYPE_INT, time(), false);
}
/**
Modified: XoopsModules/xnewsletter/branches/luciorota/xnewsletter/docs/changelog.txt
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xnewsletter/docs/changelog.txt 2014-09-16 20:31:50 UTC (rev 12782)
+++ XoopsModules/xnewsletter/branches/luciorota/xnewsletter/docs/changelog.txt 2014-09-16 20:35:59 UTC (rev 12783)
@@ -2,6 +2,7 @@
-------------------------------
- standardize code (mamba,luciorota)
- import procedure: check if limit options are compatible with php.ini 'max_input_vars' setting (luciorota)
+ - update procedure: rename module's directory name to lowercase (luciorota)
- templatize user side (luciorota)
- added: send attachment as email attachment or as link (luciorota)
- added: possibility to choose the maximum number of attachments (luciorota)
Modified: XoopsModules/xnewsletter/branches/luciorota/xnewsletter/docs/install.txt
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xnewsletter/docs/install.txt 2014-09-16 20:31:50 UTC (rev 12782)
+++ XoopsModules/xnewsletter/branches/luciorota/xnewsletter/docs/install.txt 2014-09-16 20:35:59 UTC (rev 12783)
@@ -1,3 +1,4 @@
Read Me First
=============
-Install this module usually in /modules
\ No newline at end of file
+1. Copy this module in /modules directory
+2. Install this module as usually
Added: XoopsModules/xnewsletter/branches/luciorota/xnewsletter/docs/update.txt
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xnewsletter/docs/update.txt (rev 0)
+++ XoopsModules/xnewsletter/branches/luciorota/xnewsletter/docs/update.txt 2014-09-16 20:35:59 UTC (rev 12783)
@@ -0,0 +1,5 @@
+Read Me First
+=============
+1. Delete old /modules/xNewsletter directory
+2. Copy this module in /modules directory
+3. Update this module
Modified: XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/constants.php
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/constants.php 2014-09-16 20:31:50 UTC (rev 12782)
+++ XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/constants.php 2014-09-16 20:35:59 UTC (rev 12783)
@@ -19,38 +19,46 @@
* @version svn:$id$
*/
// constants for accounts
-define("_XNEWSLETTER_ACCOUNTS_TYPE_VAL_PHP_MAIL", 1);
-define("_XNEWSLETTER_ACCOUNTS_TYPE_VAL_PHP_SENDMAIL", 2);
-define("_XNEWSLETTER_ACCOUNTS_TYPE_VAL_POP3", 3);
-define("_XNEWSLETTER_ACCOUNTS_TYPE_VAL_SMTP", 4);
-define("_XNEWSLETTER_ACCOUNTS_TYPE_VAL_GMAIL", 5);
+define('_XNEWSLETTER_ACCOUNTS_TYPE_VAL_PHP_MAIL', 1);
+define('_XNEWSLETTER_ACCOUNTS_TYPE_VAL_PHP_SENDMAIL', 2);
+define('_XNEWSLETTER_ACCOUNTS_TYPE_VAL_POP3', 3);
+define('_XNEWSLETTER_ACCOUNTS_TYPE_VAL_SMTP', 4);
+define('_XNEWSLETTER_ACCOUNTS_TYPE_VAL_GMAIL', 5);
-define("_XNEWSLETTER_ACCOUNTS_TYPE_INBOX", "INBOX");
-define("_XNEWSLETTER_ACCOUNTS_TYPE_HARDBOX", "INBOX.hard");
-define("_XNEWSLETTER_ACCOUNTS_TYPE_SOFTBOX", "INBOX.soft");
+define('_XNEWSLETTER_ACCOUNTS_TYPE_INBOX', 'INBOX');
+define('_XNEWSLETTER_ACCOUNTS_TYPE_HARDBOX', 'INBOX.hard');
+define('_XNEWSLETTER_ACCOUNTS_TYPE_SOFTBOX', 'INBOX.soft');
// constants for attachments
-define("_XNEWSLETTER_ATTACHMENTS_MODE_ASATTACHMENT", 0);
-define("_XNEWSLETTER_ATTACHMENTS_MODE_ASLINK", 1);
-define("_XNEWSLETTER_ATTACHMENTS_MODE_AUTO", 2); // IN PROGRESS
+define('_XNEWSLETTER_ATTACHMENTS_MODE_ASATTACHMENT', 0);
+define('_XNEWSLETTER_ATTACHMENTS_MODE_ASLINK', 1);
+define('_XNEWSLETTER_ATTACHMENTS_MODE_AUTO', 2); // for future features
// constants for actions letter
-define("_XNEWSLETTER_LETTER_ACTION_VAL_NO", 0);
-define("_XNEWSLETTER_LETTER_ACTION_VAL_PREVIEW", 1);
-define("_XNEWSLETTER_LETTER_ACTION_VAL_SEND", 2);
-define("_XNEWSLETTER_LETTER_ACTION_VAL_SENDTEST", 3);
+define('_XNEWSLETTER_LETTER_ACTION_VAL_NO', 0);
+define('_XNEWSLETTER...
[truncated message content] |
|
From: <luc...@us...> - 2014-09-18 21:15:46
|
Revision: 12793
http://sourceforge.net/p/xoops/svn/12793
Author: luciorota
Date: 2014-09-18 21:15:31 +0000 (Thu, 18 Sep 2014)
Log Message:
-----------
WIN to UNIX file format
use $GLOBALS[...] instead of global $...
improve protocol system (in progress)
Modified Paths:
--------------
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/admin_header.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/bmh.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/bmh_callback_database.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/cat.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/import.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/index.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/letter.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/maintenance.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/menu.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/protocol.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/blocks/blocks_catsubscr.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/blocks/blocks_letter.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/blocks/blocks_subscrinfo.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/accounts.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/attachment.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/bmh.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/cat.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/catsubscr.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/import.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/letter.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/mailinglist.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/protocol.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/subscr.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/task.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/template.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/cron.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/constants.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/functions.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/mailinglist.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/onupdate.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/search.inc.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/task.inc.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/language/english/admin.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/sendletter.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/sql/mysql.sql
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/subscription.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/xoops_version.php
Modified: XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/admin_header.php
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/admin_header.php 2014-09-18 06:40:13 UTC (rev 12792)
+++ XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/admin_header.php 2014-09-18 21:15:31 UTC (rev 12793)
@@ -31,7 +31,7 @@
include_once dirname(__DIR__) . '/include/common.php';
// Include xoops admin header
-include_once XOOPS_ROOT_PATH . "/include/cp_functions.php";
+include_once XOOPS_ROOT_PATH . '/include/cp_functions.php';
$pathIcon16 = XOOPS_URL . '/' . $xnewsletter->getModule()->getInfo('icons16');
$pathIcon32 = XOOPS_URL . '/' . $xnewsletter->getModule()->getInfo('icons32');
@@ -58,18 +58,18 @@
$myts = MyTextSanitizer::getInstance();
-if ($xoopsUser) {
+if ($GLOBALS['xoopsUser']) {
$moduleperm_handler =& xoops_gethandler('groupperm');
- if (!$moduleperm_handler->checkRight('module_admin', $xnewsletter->getModule()->mid(), $xoopsUser->getGroups())) {
+ if (!$moduleperm_handler->checkRight('module_admin', $xnewsletter->getModule()->mid(), $GLOBALS['xoopsUser']->getGroups())) {
redirect_header(XOOPS_URL, 1, _NOPERM);
exit();
}
} else {
- redirect_header(XOOPS_URL . "/user.php", 1, _NOPERM);
+ redirect_header(XOOPS_URL . '/user.php', 1, _NOPERM);
exit();
}
if (!isset($xoopsTpl) || !is_object($xoopsTpl)) {
- include_once(XOOPS_ROOT_PATH . "/class/template.php");
+ include_once(XOOPS_ROOT_PATH . '/class/template.php');
$xoopsTpl = new XoopsTpl();
}
Modified: XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/bmh.php
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/bmh.php 2014-09-18 06:40:13 UTC (rev 12792)
+++ XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/bmh.php 2014-09-18 21:15:31 UTC (rev 12793)
@@ -45,18 +45,18 @@
$bmhObj = $xnewsletter->getHandler('bmh')->get($bmh_id);
$bmh_email = $bmhObj->getVar('bmh_email');
- $sql = "SELECT subscr_id FROM {$xoopsDB->prefix("xnewsletter_subscr")}";
+ $sql = "SELECT subscr_id FROM {$GLOBALS['xoopsDB']->prefix("xnewsletter_subscr")}";
$sql .= " WHERE (subscr_email='{$bmh_email}')";
$sql .= " LIMIT 1;";
- if ($user = $xoopsDB->query($sql)) {
- $row_user = $xoopsDB->fetchRow($user);
+ if ($user = $GLOBALS['xoopsDB']->query($sql)) {
+ $row_user = $GLOBALS['xoopsDB']->fetchRow($user);
$subscr_id = (int)$row_user[0];
}
if ($subscr_id == 0) {
//set bmh_measure for all entries in bmh with this email
- $sql_upd_measure = "UPDATE {$xoopsDB->prefix('xnewsletter_bmh')} SET `bmh_measure` = '" . _XNEWSLETTER_BMH_MEASURE_VAL_NOTHING . "'";
- $sql_upd_measure .= " WHERE ((`{$xoopsDB->prefix('xnewsletter_bmh')}`.`bmh_email` ='{$bmh_email}') AND (`{$xoopsDB->prefix('xnewsletter_bmh')}`.`bmh_measure` ='0'))";
- $xoopsDB->query($sql_upd_measure);
+ $sql_upd_measure = "UPDATE {$GLOBALS['xoopsDB']->prefix('xnewsletter_bmh')} SET `bmh_measure` = '" . _XNEWSLETTER_BMH_MEASURE_VAL_NOTHING . "'";
+ $sql_upd_measure .= " WHERE ((`{$GLOBALS['xoopsDB']->prefix('xnewsletter_bmh')}`.`bmh_email` ='{$bmh_email}') AND (`{$GLOBALS['xoopsDB']->prefix('xnewsletter_bmh')}`.`bmh_measure` ='0'))";
+ $GLOBALS['xoopsDB']->query($sql_upd_measure);
redirect_header('?op=list', 3, _AM_XNEWSLETTER_BMH_ERROR_NO_SUBSCRID);
}
$subscrObj = $xnewsletter->getHandler('subscr')->get($subscr_id);
@@ -118,18 +118,18 @@
$bmh_email = $bmhObj->getVar("bmh_email");
if ($bmh_measure == _XNEWSLETTER_BMH_MEASURE_VAL_QUIT) {
- $sql = "UPDATE `{$xoopsDB->prefix('xnewsletter_subscr')}` INNER JOIN `{$xoopsDB->prefix('xnewsletter_catsubscr')}` ON `subscr_id` = `catsubscr_subscrid`";
+ $sql = "UPDATE `{$GLOBALS['xoopsDB']->prefix('xnewsletter_subscr')}` INNER JOIN `{$GLOBALS['xoopsDB']->prefix('xnewsletter_catsubscr')}` ON `subscr_id` = `catsubscr_subscrid`";
$sql .= " SET `catsubscr_quited` = " . time();
$sql .= " WHERE (((`subscr_email`)='{$bmh_email}'))";
- if (!$result = $xoopsDB->queryF($sql)) {
+ if (!$result = $GLOBALS['xoopsDB']->queryF($sql)) {
die ('MySQL-Error: ' . mysql_error());
}
}
//set bmh_measure for all entries in bmh with this email
- $sql_upd = "UPDATE {$xoopsDB->prefix('xnewsletter_bmh')}";
- $sql_upd .= " SET `bmh_measure` = '{$bmh_measure}', `bmh_submitter` = '{$xoopsUser->uid()}', `bmh_created` = '" . time() . "'";
- $sql_upd .= " WHERE ((`{$xoopsDB->prefix('xnewsletter_bmh')}`.`bmh_email` ='{$bmh_email}') AND (`{$xoopsDB->prefix('xnewsletter_bmh')}`.`bmh_measure` ='0'))";
- if (!$result = $xoopsDB->queryF($sql_upd)) {
+ $sql_upd = "UPDATE {$GLOBALS['xoopsDB']->prefix('xnewsletter_bmh')}";
+ $sql_upd .= " SET `bmh_measure` = '{$bmh_measure}', `bmh_submitter` = '{$GLOBALS['xoopsUser']->uid()}', `bmh_created` = '" . time() . "'";
+ $sql_upd .= " WHERE ((`{$GLOBALS['xoopsDB']->prefix('xnewsletter_bmh')}`.`bmh_email` ='{$bmh_email}') AND (`{$GLOBALS['xoopsDB']->prefix('xnewsletter_bmh')}`.`bmh_measure` ='0'))";
+ if (!$result = $GLOBALS['xoopsDB']->queryF($sql_upd)) {
die ('MySQL-Error: ' . mysql_error());
}
@@ -319,7 +319,7 @@
case 'save_bmh':
if (!$GLOBALS['xoopsSecurity']->check()) {
- redirect_header($currentFile, 3, implode(',', $GLOBALS["xoopsSecurity"]->getErrors()));
+ redirect_header($currentFile, 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors()));
}
$bmhObj = $xnewsletter->getHandler('bmh')->get($bmh_id);
Modified: XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/bmh_callback_database.php
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/bmh_callback_database.php 2014-09-18 06:40:13 UTC (rev 12792)
+++ XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/bmh_callback_database.php 2014-09-18 21:15:31 UTC (rev 12793)
@@ -35,7 +35,6 @@
*/
function callbackAction($msgnum, $bounce_type, $email, $subject, $xheader, $remove, $rule_no = false, $rule_cat = false, $totalFetched = 0)
{
- global $xoopsUser;
$xnewsletter = XnewsletterXnewsletter::getInstance();
if ($rule_no != '0000') {
@@ -48,7 +47,7 @@
$bmhObj->setVar('bmh_email', $email);
$bmhObj->setVar('bmh_subject', $subject);
$bmhObj->setVar('bmh_measure', '0');
- $bmhObj->setVar('bmh_submitter', $xoopsUser->uid());
+ $bmhObj->setVar('bmh_submitter', $GLOBALS['xoopsUser']->uid());
$bmhObj->setVar('bmh_created', time());
//
if (!$xnewsletter->getHandler('bmh')->insert($bmhObj)) {
Modified: XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/cat.php
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/cat.php 2014-09-18 06:40:13 UTC (rev 12792)
+++ XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/cat.php 2014-09-18 21:15:31 UTC (rev 12793)
@@ -160,7 +160,7 @@
$catObj->setVar('cat_name', xnewsletterRequest::getString('cat_name', ''));
$catObj->setVar('cat_info', $_REQUEST['cat_info']);
$catObj->setVar('cat_mailinglist', xnewsletterRequest::getInt('cat_mailinglist', 0));
- $catObj->setVar('cat_submitter', $xoopsUser->uid());
+ $catObj->setVar('cat_submitter', $GLOBALS['xoopsUser']->uid());
$catObj->setVar('cat_created', time());
$catObj->setVar('dohtml', isset($_REQUEST['dohtml']));
$catObj->setVar('dosmiley', isset($_REQUEST['dosmiley']));
Modified: XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/import.php
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/import.php 2014-09-18 06:40:13 UTC (rev 12792)
+++ XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/import.php 2014-09-18 21:15:31 UTC (rev 12793)
@@ -220,17 +220,17 @@
if ($cat_id > 0) {
if ($subscr_id == 0) {
//update sex, firstname, lastname
- $sql = "UPDATE {$xoopsDB->prefix('xnewsletter_import')}";
+ $sql = "UPDATE {$GLOBALS['xoopsDB']->prefix('xnewsletter_import')}";
$sql .= " SET `import_sex`='{$subscr_sex}', `import_firstname`='{$subscr_firstname}', `import_lastname`='{$subscr_lastname}'";
$sql .= " WHERE `import_id`={$import_id}";
- $result = $xoopsDB->queryF($sql);
+ $result = $GLOBALS['xoopsDB']->queryF($sql);
}
}
//update cat_id and import_status
- $sql = "UPDATE {$xoopsDB->prefix('xnewsletter_import')}";
+ $sql = "UPDATE {$GLOBALS['xoopsDB']->prefix('xnewsletter_import')}";
$sql .= " SET `import_cat_id`='{$cat_id}', `import_status`=1";
$sql .= " WHERE `import_id`={$import_id}";
- $result = $xoopsDB->queryF($sql);
+ $result = $GLOBALS['xoopsDB']->queryF($sql);
}
redirect_header("?op=exec_import_final&check_import=1&limitcheck={$limitcheck}", 0, '');
@@ -242,8 +242,8 @@
$indexAdmin->addItemButton(_AM_XNEWSLETTER_IMPORT_PLUGINS_AVAIL, $currentFile, 'list');
echo $indexAdmin->renderButton();
//
- $ip = xoops_getenv("REMOTE_ADDR");
- $submitter = $xoopsUser->uid();
+ $ip = xoops_getenv('REMOTE_ADDR');
+ $submitter = $GLOBALS['xoopsUser']->uid();
$importCriteria = new CriteriaCompo();
$importCriteria->add(new Criteria('import_status', true));
@@ -251,11 +251,11 @@
$numrows_act = $xnewsletter->getHandler('import')->getCount($importCriteria);
if ($numrows_act > 0) {
$sql = "SELECT *";
- $sql .= " FROM {$xoopsDB->prefix('xnewsletter_import')}";
+ $sql .= " FROM {$GLOBALS['xoopsDB']->prefix('xnewsletter_import')}";
$sql .= " WHERE ((import_status)=1)";
$sql .= " ORDER BY `import_id` ASC";
$counter = 0;
- if (!$users_import = $xoopsDB->queryF($sql)) {
+ if (!$users_import = $GLOBALS['xoopsDB']->queryF($sql)) {
die ('MySQL-Error: ' . mysql_error());
}
while ($user_import = mysql_fetch_assoc($users_import)) {
@@ -267,18 +267,20 @@
$cat_id = $user_import['import_cat_id'];
$subscr_id = $user_import['import_subscr_id'];
$catsubscr_id = $user_import['import_catsubscr_id'];
- $subscribe = 0;
+ $subscribe = false;
if ($cat_id == 0) {
- createProtocol(str_replace("%e", $subscr_email, _AM_XNEWSLETTER_IMPORT_RESULT_SKIP), true, $submitter);
+// IN PROGRESS
+ $status = str_replace("%e", $subscr_email, _AM_XNEWSLETTER_IMPORT_RESULT_SKIP);
+ $xnewsletter->getHandler('protocol')->protocol(0, 0, $status, _XNEWSLETTER_PROTOCOL_STATUS_SKIP_IMPORT, array('%subscr_email' => $subscr_email), true);
} else {
//register email
if ($subscr_id == 0) {
$subscr_uid = 0;
- $sql = "SELECT `uid`";
- $sql .= " FROM {$xoopsDB->prefix('users')}";
+ $sql = "SELECT `uid`";
+ $sql .= " FROM {$GLOBALS['xoopsDB']->prefix('users')}";
$sql .= " WHERE (`email`='{$subscr_email}') LIMIT 1";
- if ($user = $xoopsDB->queryF($sql)) {
+ if ($user = $GLOBALS['xoopsDB']->queryF($sql)) {
$row_user = mysql_fetch_array($user);
$subscr_uid = $row_user[0];
}
@@ -286,37 +288,41 @@
unset($user);
$sql = "INSERT";
- $sql .= " INTO `{$xoopsDB->prefix('xnewsletter_subscr')}`";
+ $sql .= " INTO `{$GLOBALS['xoopsDB']->prefix('xnewsletter_subscr')}`";
$sql .= " (`subscr_email`, `subscr_firstname`, `subscr_lastname`, `subscr_uid`, `subscr_sex`, `subscr_submitter`, `subscr_created`, `subscr_ip`, `subscr_activated`, `subscr_actoptions`)";
- $sql .= " VALUES ('{$subscr_email}', '{$subscr_firstname}', '{$subscr_lastname}', " . intval($subscr_uid) . ", '{$subscr_sex}', {$submitter}, " . time() . ",'{$ip}', 1, '')";
- if (!$xoopsDB->queryF($sql)) {
- createProtocol(str_replace("%e", $subscr_email, _AM_XNEWSLETTER_IMPORT_RESULT_FAILED), false, $submitter);
+ $sql .= " VALUES ('{$subscr_email}', '{$subscr_firstname}', '{$subscr_lastname}', " . (int) $subscr_uid . ", '{$subscr_sex}', {$submitter}, " . time() . ",'{$ip}', 1, '')";
+ if (!$GLOBALS['xoopsDB']->queryF($sql)) {
+// IN PROGRESS
+ $status = str_replace("%e", $subscr_email, _AM_XNEWSLETTER_IMPORT_RESULT_FAILED);
+ $xnewsletter->getHandler('protocol')->protocol(0, 0, $status, _XNEWSLETTER_PROTOCOL_STATUS_ERROR_IMPORT, array('%subscr_email' => $subscr_email), false);
} else {
//register email successful
$resulttext = $subscr_email . ': ' . _AM_XNEWSLETTER_IMPORT_RESULT_REG_OK . ' | ';
- $subscr_id = $xoopsDB->getInsertId();
- $subscribe = 1;
+ $subscr_id = $GLOBALS['xoopsDB']->getInsertId();
+ $subscribe = true;
}
} else {
//email already registered
$resulttext = $subscr_email . ': ' . _AM_XNEWSLETTER_IMPORT_EMAIL_EXIST . ' | ';
- $subscribe = 1;
+ $subscribe = true;
}
- if ($subscribe == 1) {
+ if ($subscribe) {
if ($catsubscr_id == 0) {
//add subscription of this email
$sql = "INSERT";
- $sql .= " INTO `{$xoopsDB->prefix('xnewsletter_catsubscr')}`";
+ $sql .= " INTO `{$GLOBALS['xoopsDB']->prefix('xnewsletter_catsubscr')}`";
$sql .= " (`catsubscr_catid`, `catsubscr_subscrid`, `catsubscr_submitter`, `catsubscr_created`)";
$sql .= " VALUES ({$cat_id}, {$subscr_id}, {$submitter}," . time() . ")";
- if ($xoopsDB->queryF($sql)) {
- createProtocol($resulttext . _AM_XNEWSLETTER_IMPORT_RESULT_SUBSCR_OK, true, $submitter);
+ if ($GLOBALS['xoopsDB']->queryF($sql)) {
+// IN PROGRESS
+ $status = $resulttext . _AM_XNEWSLETTER_IMPORT_RESULT_SUBSCR_OK;
+ $xnewsletter->getHandler('protocol')->protocol(0, 0, $status, _XNEWSLETTER_PROTOCOL_STATUS_OK_IMPORT, array('%result_text' => $resulttext), true);
//handle mailinglists
$cat_mailinglist = 0;
- $sql = "SELECT `cat_mailinglist`";
- $sql .= " FROM {$xoopsDB->prefix("xnewsletter_cat")}";
+ $sql = "SELECT `cat_mailinglist`";
+ $sql .= " FROM {$GLOBALS['xoopsDB']->prefix("xnewsletter_cat")}";
$sql .= " WHERE (`cat_id`={$cat_id}) LIMIT 1";
- if ($cat_mls = $xoopsDB->queryF($sql)) {
+ if ($cat_mls = $GLOBALS['xoopsDB']->queryF($sql)) {
$cat_ml = mysql_fetch_array($cat_mls);
$cat_mailinglist = $cat_ml[0];
}
@@ -328,17 +334,23 @@
subscribingMLHandler(1, $subscr_id, $cat_mailinglist);
}
} else {
- createProtocol(str_replace("%e", $subscr_email, _AM_XNEWSLETTER_IMPORT_RESULT_FAILED), false, $submitter);
+// IN PROGRESS
+ $status = str_replace("%e", $subscr_email, _AM_XNEWSLETTER_IMPORT_RESULT_FAILED);
+ $xnewsletter->getHandler('protocol')->protocol(0, 0, $status, _XNEWSLETTER_PROTOCOL_STATUS_ERROR_IMPORT, array('%subscr_email' => $subscr_email), false);
+
}
} else {
- createProtocol($resulttext . _AM_XNEWSLETTER_IMPORT_CATSUBSCR_EXIST, true, $submitter);
+// IN PROGRESS
+ $status = $resulttext . _AM_XNEWSLETTER_IMPORT_CATSUBSCR_EXIST;
+ $xnewsletter->getHandler('protocol')->protocol(0, 0, $status, _XNEWSLETTER_PROTOCOL_STATUS_EXIST_IMPORT, array('%result_text' => $resulttext), false);
+
}
}
}
$sql_del = "DELETE";
- $sql_del .= " FROM {$xoopsDB->prefix('xnewsletter_import')}";
+ $sql_del .= " FROM {$GLOBALS['xoopsDB']->prefix('xnewsletter_import')}";
$sql_del .= " WHERE `import_id`={$import_id}";
- $result = $xoopsDB->queryF($sql_del);
+ $result = $GLOBALS['xoopsDB']->queryF($sql_del);
}
echo "<div style='margin-top:20px;margin-bottom:20px;color:#ff0000;font-weight:bold;font-size:14px'>";
@@ -357,8 +369,8 @@
$form_continue .= '<input id="op" type="hidden" value="show_formcheck" name="op">';
} else {
// set import_status = 1 for next package
- $sql_update = "UPDATE " . $xoopsDB->prefix("xnewsletter_import") . " SET `import_status`=1 ORDER BY import_id LIMIT " . $limitcheck;
- $xoopsDB->queryF($sql_update);
+ $sql_update = "UPDATE " . $GLOBALS['xoopsDB']->prefix("xnewsletter_import") . " SET `import_status`=1 ORDER BY import_id LIMIT " . $limitcheck;
+ $GLOBALS['xoopsDB']->queryF($sql_update);
//execute import for the next package
$form_continue .= '<input id="op" type="hidden" value="exec_import_final" name="op">';
}
@@ -394,8 +406,8 @@
}
//delete all existing data
- $sql = "TRUNCATE TABLE " . $xoopsDB->prefix('xnewsletter_import');
- $result = $xoopsDB->queryF($sql);
+ $sql = "TRUNCATE TABLE " . $GLOBALS['xoopsDB']->prefix('xnewsletter_import');
+ $result = $GLOBALS['xoopsDB']->queryF($sql);
//import data into xnewsletter_import with plugin
if ($plugin == 'csv') {
@@ -459,19 +471,3 @@
break;
}
include_once __DIR__ . '/admin_footer.php';
-
-/**
- * @param $prot_text
- * @param $success
- * @param $submitter
- */
-function createProtocol($prot_text, $success, $submitter)
-{
- global $xoopsDB;
- $sql = "INSERT INTO `{$xoopsDB->prefix('xnewsletter_protocol')}`";
- $sql .= " (`protocol_letter_id`, `protocol_subscriber_id`, `protocol_status`, `protocol_success`, `protocol_submitter`, `protocol_created`)";
- $sql .= " VALUES (0,0,'{$prot_text}', {$success}, {$submitter}, " . time() . ")";
- if (!$xoopsDB->queryF($sql)) {
- die ('MySQL-Error: ' . mysql_error());
- }
-}
Modified: XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/index.php
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/index.php 2014-09-18 06:40:13 UTC (rev 12792)
+++ XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/index.php 2014-09-18 21:15:31 UTC (rev 12793)
@@ -31,7 +31,7 @@
include_once __DIR__ . '/admin_header.php';
xoops_cp_header();
-// count "total"
+// count 'total'
$catCount = $xnewsletter->getHandler('cat')->getCount();
$accountsCount = $xnewsletter->getHandler('accounts')->getCount();
$subscrCount = $xnewsletter->getHandler('subscr')->getCount();
Modified: XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/letter.php
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/letter.php 2014-09-18 06:40:13 UTC (rev 12792)
+++ XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/letter.php 2014-09-18 21:15:31 UTC (rev 12793)
@@ -38,8 +38,6 @@
switch ($op) {
case 'show_preview':
case 'show_letter_preview':
- global $XoopsTpl;
-
echo $indexAdmin->addNavigation($currentFile);
$indexAdmin->addItemButton(_AM_XNEWSLETTER_LETTERLIST, '?op=list', 'list');
echo $indexAdmin->renderButton();
@@ -225,9 +223,11 @@
$protocolCriteria->setOrder('DESC');
$protocolCriteria->setLimit(1);
$protocolObjs = $xnewsletter->getHandler('protocol')->getAll($protocolCriteria);
+// IN PROGRESS
$protocol_status = '';
$protocol_letter_id = 0;
foreach ($protocolObjs as $protocolObj) {
+// IN PROGRESS
$protocol_status .= $protocolObj->getVar('protocol_status');
$protocol_letter_id = $protocolObj->getVar('protocol_letter_id');
}
@@ -382,7 +382,7 @@
$attachmentObj->setVar('attachment_letter_id', $letter_id);
$attachmentObj->setVar('attachment_name', $file['name']);
$attachmentObj->setVar('attachment_type', $file['type']);
- $attachmentObj->setVar('attachment_submitter', $xoopsUser->uid());
+ $attachmentObj->setVar('attachment_submitter', $GLOBALS['xoopsUser']->uid());
$attachmentObj->setVar('attachment_created', time());
$attachmentObj->setVar('attachment_size', $file['size']);
$attachmentObj->setVar('attachment_mode', $file['mode']);
@@ -412,7 +412,7 @@
$protocolObj->setVar('protocol_status', _AM_XNEWSLETTER_LETTER_ACTION_SAVED); // old style
$protocolObj->setVar('protocol_status_str_id', _XNEWSLETTER_PROTOCOL_STATUS_SAVED); // new from v1.3
$protocolObj->setVar('protocol_status_vars', array()); // new from v1.3
- $protocolObj->setVar('protocol_submitter', $xoopsUser->uid());
+ $protocolObj->setVar('protocol_submitter', $GLOBALS['xoopsUser']->uid());
$protocolObj->setVar('protocol_created', time());
//
if ($xnewsletter->getHandler('protocol')->insert($protocolObj)) {
@@ -450,9 +450,9 @@
if ($xnewsletter->getHandler('letter')->delete($letterObj)) {
//delete protocols
$sql = "DELETE";
- $sql .= " FROM `{$xoopsDB->prefix('xnewsletter_protocol')}`";
+ $sql .= " FROM `{$GLOBALS['xoopsDB']->prefix('xnewsletter_protocol')}`";
$sql .= " WHERE `protocol_letter_id`={$letter_id}";
- if (!$result = $xoopsDB->query($sql)) {
+ if (!$result = $GLOBALS['xoopsDB']->query($sql)) {
die('MySQL-Error: ' . mysql_error());
}
// delete attachments
Modified: XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/maintenance.php
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/maintenance.php 2014-09-18 06:40:13 UTC (rev 12792)
+++ XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/maintenance.php 2014-09-18 21:15:31 UTC (rev 12793)
@@ -150,15 +150,17 @@
case 'del_import':
if (xnewsletterRequest::getBool('ok', false, 'POST') == true) {
- $result = $xoopsDB->queryF("TRUNCATE TABLE `{$xoopsDB->prefix('xnewsletter_import')}`");
- $result = $xoopsDB->queryF("REPAIR TABLE `{$xoopsDB->prefix('xnewsletter_import')}`");
- $result = $xoopsDB->queryF("OPTIMIZE TABLE `{$xoopsDB->prefix('xnewsletter_import')}`");
- $result = $xoopsDB->queryF("ALTER TABLE `{$xoopsDB->prefix('xnewsletter_import')}` AUTO_INCREMENT =1");
+ $result = $GLOBALS['xoopsDB']->queryF("TRUNCATE TABLE `{$GLOBALS['xoopsDB']->prefix('xnewsletter_import')}`");
+ $result = $GLOBALS['xoopsDB']->queryF("REPAIR TABLE `{$GLOBALS['xoopsDB']->prefix('xnewsletter_import')}`");
+ $result = $GLOBALS['xoopsDB']->queryF("OPTIMIZE TABLE `{$GLOBALS['xoopsDB']->prefix('xnewsletter_import')}`");
+ $result = $GLOBALS['xoopsDB']->queryF("ALTER TABLE `{$GLOBALS['xoopsDB']->prefix('xnewsletter_import')}` AUTO_INCREMENT =1");
//
$protocolObj = $xnewsletter->getHandler('protocol')->create();
$protocolObj->setVar('protocol_letter_id', 0);
$protocolObj->setVar('protocol_subscriber_id', 0);
- $protocolObj->setVar('protocol_status', '[' . _MI_XNEWSLETTER_ADMENU11 . ' import] ' . _AM_XNEWSLETTER_MAINTENANCE_DELETE_IMPORT_OK);
+// IN PROGRESS
+ $status = '[' . _MI_XNEWSLETTER_ADMENU11 . ' import] ' . _AM_XNEWSLETTER_MAINTENANCE_DELETE_IMPORT_OK;
+ $protocolObj->setVar('protocol_status', $status);
$protocolObj->setVar('protocol_success', true);
...
[truncated message content] |
|
From: <luc...@us...> - 2014-09-22 20:06:23
|
Revision: 12798
http://sourceforge.net/p/xoops/svn/12798
Author: luciorota
Date: 2014-09-22 20:06:12 +0000 (Mon, 22 Sep 2014)
Log Message:
-----------
convert to Unix file format 'cause this is the standard for Xoops files
standardize var names
minor bug fixes
add method to protocol handler to create a protocol using only 1 line of code (IN PROGRESS)
fixed db bug
Modified Paths:
--------------
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/admin_header.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/bmh.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/catsubscr.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/import.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/letter.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/protocol.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/import.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/protocol.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/subscr.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/cron.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/header.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/common.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/functions.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/mailinglist.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/oninstall.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/onupdate.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/phpmailer_bmh/class.phpmailer-bmh.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/task.inc.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/letter.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/plugins/csv.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/plugins/xoopsuser.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/print.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/subscription.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/templates/xnewsletter_letter_print.tpl
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/xoops_version.php
Modified: XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/admin_header.php
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/admin_header.php 2014-09-22 19:57:08 UTC (rev 12797)
+++ XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/admin_header.php 2014-09-22 20:06:12 UTC (rev 12798)
@@ -70,6 +70,6 @@
}
if (!isset($xoopsTpl) || !is_object($xoopsTpl)) {
- include_once(XOOPS_ROOT_PATH . '/class/template.php');
+ include_once XOOPS_ROOT_PATH . '/class/template.php';
$xoopsTpl = new XoopsTpl();
}
Modified: XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/bmh.php
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/bmh.php 2014-09-22 19:57:08 UTC (rev 12797)
+++ XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/bmh.php 2014-09-22 20:06:12 UTC (rev 12798)
@@ -139,8 +139,8 @@
break;
case 'run_bmh':
- require_once('bmh_callback_database.php');
- require_once(XOOPS_ROOT_PATH . '/modules/xnewsletter/include/phpmailer_bmh/class.phpmailer-bmh.php');
+ require_once 'bmh_callback_database.php' ;
+ require_once XOOPS_ROOT_PATH . '/modules/xnewsletter/include/phpmailer_bmh/class.phpmailer-bmh.php';
$accountCriteria = new CriteriaCompo();
$accountCriteria->add(new Criteria('accounts_use_bmh', '1'));
Modified: XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/catsubscr.php
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/catsubscr.php 2014-09-22 19:57:08 UTC (rev 12797)
+++ XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/catsubscr.php 2014-09-22 20:06:12 UTC (rev 12798)
@@ -232,7 +232,7 @@
$subscr_id = $_REQUEST['subscr_id'];
$catsubscrObj_cat = $xnewsletter->getHandler('cat')->get($_REQUEST['cat_id']);
if ($catsubscrObj_cat->getVar('cat_mailinglist') > 0) {
- require_once(XOOPS_ROOT_PATH . "/modules/xnewsletter/include/mailinglist.php");
+ require_once XOOPS_ROOT_PATH . '/modules/xnewsletter/include/mailinglist.php';
subscribingMLHandler(0, $subscr_id, $catsubscrObj_cat->getVar('cat_mailinglist'));
}
redirect_header('catsubscr.php', 3, _AM_XNEWSLETTER_FORMDELOK);
Modified: XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/import.php
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/import.php 2014-09-22 19:57:08 UTC (rev 12797)
+++ XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/import.php 2014-09-22 20:06:12 UTC (rev 12798)
@@ -60,9 +60,9 @@
$importObjs = $xnewsletter->getHandler('import')->getAll($importCriteria);
if ($importsCount > 0) {
- include_once(XOOPS_ROOT_PATH . "/class/xoopsformloader.php");
+ include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
- $action = $_SERVER["REQUEST_URI"];
+ $action = $_SERVER['REQUEST_URI'];
$unique_id = uniqid(mt_rand());
$form = "<br/>";
$form .= "<form name=\"form_import_{$unique_id}\" id=\"form_import_{$unique_id}\" action=\"{$currentFile}\" method=\"post\" enctype=\"multipart/form-data\">";
@@ -330,7 +330,7 @@
unset($cat_mls);
if ($cat_mailinglist > 0) {
- require_once(XOOPS_ROOT_PATH . "/modules/xnewsletter/include/mailinglist.php");
+ require_once XOOPS_ROOT_PATH . '/modules/xnewsletter/include/mailinglist.php';
subscribingMLHandler(1, $subscr_id, $cat_mailinglist);
}
} else {
@@ -396,7 +396,7 @@
echo str_replace("%p", $plugin, _AM_XNEWSLETTER_IMPORT_ERROR_NO_PLUGIN);
break;
}
- require_once($pluginFile);
+ require_once $pluginFile;
$function = 'xnewsletter_plugin_getdata_' . $plugin;
if (!function_exists($function)) {
@@ -450,7 +450,7 @@
echo str_replace("%p", $plugin, _AM_XNEWSLETTER_IMPORT_ERROR_NO_PLUGIN);
break;
}
- require_once($pluginFile);
+ require_once $pluginFile;
$function = "xnewsletter_plugin_getform_{$plugin}";
if (!function_exists($function)) {
Modified: XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/letter.php
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/letter.php 2014-09-22 19:57:08 UTC (rev 12797)
+++ XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/letter.php 2014-09-22 20:06:12 UTC (rev 12798)
@@ -346,7 +346,7 @@
}
// upload attachments
$uploadedFiles = array();
- include_once XOOPS_ROOT_PATH . "/class/uploader.php";
+ include_once XOOPS_ROOT_PATH . '/class/uploader.php';
$uploaddir = XOOPS_UPLOAD_PATH . $xnewsletter->getConfig('xn_attachment_path') . $letter_id . '/';
// check upload_dir
if (!is_dir($uploaddir)) {
@@ -389,11 +389,6 @@
//
$xnewsletter->getHandler('attachment')->insert($attachmentObj);
}
- // create item in protocol
- $protocolObj = $xnewsletter->getHandler('protocol')->create();
- $protocolObj->setVar('protocol_letter_id', $letter_id);
- $protocolObj->setVar('protocol_subscriber_id', 0);
- $protocolObj->setVar('protocol_success', true);
$action = xnewsletterRequest::getInt('letter_action', _XNEWSLETTER_LETTER_ACTION_VAL_NO);
switch ($action) {
case _XNEWSLETTER_LETTER_ACTION_VAL_PREVIEW:
@@ -409,6 +404,13 @@
$redirectUrl = '?op=list_letters';
break;
}
+ // create item in protocol
+ $xnewsletter->getHandler('protocol')->protocol($letter_id, 0, _AM_XNEWSLETTER_LETTER_ACTION_SAVED, _XNEWSLETTER_PROTOCOL_STATUS_SAVED, array(), true);
+/*
+ $protocolObj = $xnewsletter->getHandler('protocol')->create();
+ $protocolObj->setVar('protocol_letter_id', $letter_id);
+ $protocolObj->setVar('protocol_subscriber_id', 0);
+ $protocolObj->setVar('protocol_success', true);
$protocolObj->setVar('protocol_status', _AM_XNEWSLETTER_LETTER_ACTION_SAVED); // old style
$protocolObj->setVar('protocol_status_str_id', _XNEWSLETTER_PROTOCOL_STATUS_SAVED); // new from v1.3
$protocolObj->setVar('protocol_status_vars', array()); // new from v1.3
@@ -421,6 +423,8 @@
} else {
echo 'Error create protocol: ' . $protocolObj->getHtmlErrors();
}
+*/
+ redirect_header($redirectUrl, 3, _AM_XNEWSLETTER_FORMOK);
} else {
echo 'Error create letter: ' . $letterObj->getHtmlErrors();
}
Modified: XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/protocol.php
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/protocol.php 2014-09-22 19:57:08 UTC (rev 12797)
+++ XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/protocol.php 2014-09-22 20:06:12 UTC (rev 12798)
@@ -103,15 +103,10 @@
// IN PROGRESS
$protocol_status .= "...";
}
- echo "
- <td>
- <a href='?op=list_letter&letter_id=0'>" . $protocol_status . "</a>
- </td>
- <td>{$protocol_created_formatted}</td>
- <td class='center'>
- <a href='?op=list_letter&letter_id=0'><img src=" . XNEWSLETTER_ICONS_URL . "/xn_details.png alt='" . _AM_XNEWSLETTER_DETAILS . "' title='" . _AM_XNEWSLETTER_DETAILS . "' /></a>
- </td>
- </tr>";
+ echo "<td><a href='?op=list_letter&letter_id=0'>{$protocol_status}</a></td>";
+ echo "<td>{$protocol_created_formatted}</td>";
+ echo "<td class='center'><a href='?op=list_letter&letter_id=0'><img src=" . XNEWSLETTER_ICONS_URL . "/xn_details.png alt='" . _AM_XNEWSLETTER_DETAILS . "' title='" . _AM_XNEWSLETTER_DETAILS . "' /></a></td>";
+ echo "</tr>";
foreach (array_keys($letterObjs) as $i) {
$protocolCriteria = new CriteriaCompo();
@@ -145,16 +140,10 @@
if ($protocolCount > 2) {
$protocol_status .= "...";
}
- echo "
- <td class='center'>
- <a href='?op=list_letter&letter_id=" . $i . "'>" . $protocol_status . "</a>
- </td>
- <td class='center'>" . $protocol_created . "</td>
- <td class='center'>
- <a href='?op=list_letter&letter_id=" . $i . "'><img src=" . XNEWSLETTER_ICONS_URL . "/xn_details.png alt='" . _AM_XNEWSLETTER_DETAILS . "' title='"
- . _AM_XNEWSLETTER_DETAILS . "' /></a>
- </td>
- </tr>";
+ echo "<td class='center'><a href='?op=list_letter&letter_id={$i}'>{$protocol_status}</a></td>";
+ echo "<td class='center'>{$protocol_created}</td>";
+ echo "<td class='center'><a href='?op=list_letter&letter_id={$i}'><img src=" . XNEWSLETTER_ICONS_URL . "/xn_details.png alt='" . _AM_XNEWSLETTER_DETAILS . "' title='" . _AM_XNEWSLETTER_DETAILS . "' /></a></td>";
+ echo "</tr>";
}
}
}
@@ -224,11 +213,7 @@
echo "<td>" . $success . "</td>";
echo "<td>" . XoopsUser::getUnameFromId($protocolObj->getVar('protocol_submitter'), 'S') . "</td>";
echo "<td>" . formatTimeStamp($protocolObj->getVar('protocol_created'), 'L') . "</td>";
-
- echo "
- <td>
- <a href='?op=delete_protocol&protocol_id=" . $protocol_id . "'><img src=" . XNEWSLETTER_ICONS_URL . "/xn_delete.png alt='" . _DELETE . "' title='" . _DELETE . "' /></a>
- </td>";
+ echo "<td><a href='?op=delete_protocol&protocol_id={$protocol_id}'><img src=" . XNEWSLETTER_ICONS_URL . "/xn_delete.png alt='" . _DELETE . "' title='" . _DELETE . "' /></a></td>";
echo "</tr>";
}
}
@@ -238,54 +223,6 @@
echo "<br />";
break;
- case 'new_protocol':
- echo $protocolAdmin->addNavigation($currentFile);
- $protocolAdmin->addItemButton(_AM_XNEWSLETTER_PROTOCOLLIST, '?op=list', 'list');
- echo $protocolAdmin->renderButton();
- //
- $protocolObj = $xnewsletter->getHandler('protocol')->create();
- $form = $protocolObj->getForm();
- $form->display();
- break;
-
- case 'save_protocol':
- if (!$GLOBALS['xoopsSecurity']->check()) {
- redirect_header($currentFile, 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors()));
- }
- if (isset($_REQUEST['protocol_id'])) {
- $protocolObj = $xnewsletter->getHandler('protocol')->get($_REQUEST['protocol_id']);
- } else {
- $protocolObj = $xnewsletter->getHandler('protocol')->create();
- }
-
- $protocolObj->setVar('protocol_letter_id', $_REQUEST['protocol_letter_id']);
- $protocolObj->setVar('protocol_subscriber_id', $_REQUEST['protocol_subscriber_id']);
-// IN PROGRESS
- $protocolObj->setVar('protocol_status', $_REQUEST['protocol_status']);
- $protocolObj->setVar('protocol_success', $_REQUEST['protocol_success']);
- $protocolObj->setVar('protocol_submitter', $_REQUEST['protocol_submitter']);
- $protocolObj->setVar('protocol_created', strtotime($_REQUEST['protocol_created']));
-
- if ($xnewsletter->getHandler('protocol')->insert($protocolObj)) {
- redirect_header('?op=list', 3, _AM_XNEWSLETTER_FORMOK);
- }
-
- echo $protocolObj->getHtmlErrors();
- $form = $protocolObj->getForm();
- $form->display();
- break;
-
- case 'edit_protocol':
- echo $protocolAdmin->addNavigation($currentFile);
- $protocolAdmin->addItemButton(_AM_XNEWSLETTER_NEWPROTOCOL, '?op=new_protocol', 'add');
- $protocolAdmin->addItemButton(_AM_XNEWSLETTER_PROTOCOLLIST, '?op=list', 'list');
- echo $protocolAdmin->renderButton();
- //
- $protocolObj = $xnewsletter->getHandler('protocol')->get($_REQUEST['protocol_id']);
- $form = $protocolObj->getForm();
- $form->display();
- break;
-
case 'delete_protocol':
$protocolObj = $xnewsletter->getHandler('protocol')->get($_REQUEST['protocol_id']);
if (xnewsletterRequest::getBool('ok', false, 'POST') == true) {
Modified: XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/import.php
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/import.php 2014-09-22 19:57:08 UTC (rev 12797)
+++ XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/import.php 2014-09-22 20:06:12 UTC (rev 12798)
@@ -92,7 +92,7 @@
$pluginName = str_replace('.php', '', $file);
$pluginFile = XNEWSLETTER_ROOT_PATH . '/plugins/' . $pluginName . '.php';
if (file_exists($pluginFile)) {
- require_once($pluginFile);
+ require_once $pluginFile;
$function = 'xnewsletter_plugin_getinfo_' . $pluginName;
$arrPlugin = $function();
$show_plugin = $this->tableExists($arrPlugin['tables'][0]);
Modified: XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/protocol.php
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/protocol.php 2014-09-22 19:57:08 UTC (rev 12797)
+++ XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/protocol.php 2014-09-22 20:06:12 UTC (rev 12798)
@@ -78,52 +78,6 @@
{
return xnewsletter_sprintf($this->protocol_status_strs[$this->getVar('protocol_status_str_id')], $this->getVar('protocol_status_vars'));
}
-
- /**
- * @param bool $action
- *
- * @return XoopsThemeForm
- */
- public function getForm($action = false)
- {
- if ($action === false) {
- $action = $_SERVER["REQUEST_URI"];
- }
-
- $title = $this->isNew() ? sprintf(_AM_XNEWSLETTER_PROTOCOL_ADD) : sprintf(_AM_XNEWSLETTER_PROTOCOL_EDIT);
-
- include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
- $form = new XoopsThemeForm($title, 'form', $action, 'post', true);
- $form->setExtra('enctype="multipart/form-data"');
-
- $letterCriteria = new CriteriaCompo();
- $letterCriteria->setSort('letter_id');
- $letterCriteria->setOrder('DESC');
- $letter_select = new XoopsFormSelect(_AM_XNEWSLETTER_PROTOCOL_LETTER_ID, 'protocol_letter_id', $this->getVar('protocol_letter_id'));
- $letter_select->addOptionArray($this->xnewsletter->getHandler('letter')->getList($letterCriteria));
- $form->addElement($letter_select, true);
-
- $subscrCriteria = new CriteriaCompo();
- $subscrCriteria->setSort('subscr_id');
- $subscrCriteria->setOrder('ASC');
- $subscr_select = new XoopsFormSelect(_AM_XNEWSLETTER_PROTOCOL_SUBSCRIBER_ID, "protocol_subscriber_id", $this->getVar("protocol_subscriber_id"));
- $subscr_select->addOptionArray($this->xnewsletter->getHandler('subscr')->getList($subscrCriteria));
- $form->addElement($subscr_select, true);
-
-// IN PROGRESS
- $form->addElement(new XoopsFormText(_AM_XNEWSLETTER_PROTOCOL_STATUS, "protocol_status", 50, 200, $this->getVar("protocol_status")), false);
-
- $form->addElement(new XoopsFormText(_AM_XNEWSLETTER_PROTOCOL_SUCCESS, "protocol_success", 50, 255, $this->getVar("protocol_success")), false);
-
- $form->addElement(new XoopsFormSelectUser(_AM_XNEWSLETTER_PROTOCOL_SUBMITTER, "protocol_submitter", false, $this->getVar("protocol_submitter"), 1, false), true);
-
- $form->addElement(new XoopsFormTextDateSelect(_AM_XNEWSLETTER_PROTOCOL_CREATED, "protocol_created", "", $this->getVar("protocol_created")));
-
- $form->addElement(new XoopsFormHidden("op", "save_protocol"));
- $form->addElement(new XoopsFormButton("", "submit", _SUBMIT, "submit"));
-
- return $form;
- }
}
/**
Modified: XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/subscr.php
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/subscr.php 2014-09-22 19:57:08 UTC (rev 12797)
+++ XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/subscr.php 2014-09-22 20:06:12 UTC (rev 12798)
@@ -321,7 +321,7 @@
if ($this->xnewsletter->getHandler('catsubscr')->delete($catsubscrObj, $force)) {
// handle mailinglists
if ($cat_mailinglist != 0) {
- require_once(XOOPS_ROOT_PATH . '/modules/xnewsletter/include/mailinglist.php');
+ require_once XOOPS_ROOT_PATH . '/modules/xnewsletter/include/mailinglist.php';
subscribingMLHandler(0, $subscr_id, $cat_mailinglist);
}
} else {
Modified: XoopsModules/xnewsletter/branches/luciorota/xnewsletter/cron.php
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xnewsletter/cron.php 2014-09-22 19:57:08 UTC (rev 12797)
+++ XoopsModules/xnewsletter/branches/luciorota/xnewsletter/cron.php 2014-09-22 20:06:12 UTC (rev 12798)
@@ -32,11 +32,13 @@
echo '<br/>start cron job<br/>';
-require_once XOOPS_ROOT_PATH . '/modules/xnewsletter/include/task.inc.php';
+include_once XOOPS_ROOT_PATH . '/modules/xnewsletter/include/task.inc.php';
// execute all pending tasks
$result_exec = xnewsletter_executeTasks($xnewsletter->getConfig('xn_send_in_packages'), 0);
if ($result_exec != '') {
+ $newsletter->getHandler('protocol')->protocol(0, 0, 'Cron: ' . $result_exec, _XNEWSLETTER_PROTOCOL_STATUS_CRON, array('%result_exec' => $result_exec), true);
+/*
// you can enable the block for creating protocol for cron
$protocolObj = $xnewsletter->getHandler('protocol')->create();
$protocolObj->setVar('protocol_letter_id', 0);
@@ -54,5 +56,6 @@
} else {
echo $protocolObj->getHtmlErrors();
}
+*/
}
echo "<br/>result cron: {$result_exec}";
Modified: XoopsModules/xnewsletter/branches/luciorota/xnewsletter/header.php
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xnewsletter/header.php 2014-09-22 19:57:08 UTC (rev 12797)
+++ XoopsModules/xnewsletter/branches/luciorota/xnewsletter/header.php 2014-09-22 20:06:12 UTC (rev 12798)
@@ -33,8 +33,6 @@
include_once XOOPS_ROOT_PATH . '/class/pagenav.php';
include_once XOOPS_ROOT_PATH . '/include/functions.php';
-global $xoopsConfig;
-
//Load languages
xoops_loadLanguage('admin', $xnewsletter->getModule()->dirname());
xoops_loadLanguage('modinfo', $xnewsletter->getModule()->dirname());
Modified: XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/common.php
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/common.php 2014-09-22 19:57:08 UTC (rev 12797)
+++ XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/common.php 2014-09-22 20:06:12 UTC (rev 12798)
@@ -58,6 +58,6 @@
// Load Xoops handlers
$module_handler = xoops_gethandler('module');
$member_handler = xoops_gethandler('member');
-$notification_handler = &xoops_gethandler('notification');
+$notification_handler = xoops_gethandler('notification');
$gperm_handler = xoops_gethandler('groupperm');
$config_handler = xoops_gethandler('config');
Modified: XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/functions.php
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/functions.php 2014-09-22 19:57:08 UTC (rev 12797)
+++ XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/functions.php 2014-09-22 20:06:12 UTC (rev 12798)
@@ -455,15 +455,13 @@
*/
function xnewsletter_emailSize($letter_id = 0)
{
- require_once XNEWSLETTER_ROOT_PATH . '/class/class.xnewslettermailer.php';
+ include_once XNEWSLETTER_ROOT_PATH . '/class/class.xnewslettermailer.php';
- global $xoopsTpl;
$xnewsletter = XnewsletterXnewsletter::getInstance();
- if (!isset($xoopsTpl) || !is_object($xoopsTpl)) {
- include_once(XOOPS_ROOT_PATH . "/class/template.php");
- $xoopsTpl = new XoopsTpl();
- }
+ include_once XOOPS_ROOT_PATH . '/class/template.php';
+ $xoopsTpl = new XoopsTpl();
+
// get template path
$template_path = XNEWSLETTER_ROOT_PATH . '/language/' . $GLOBALS['xoopsConfig']['language'] . '/templates/';
if (!is_dir($template_path)) {
Modified: XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/mailinglist.php
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/mailinglist.php 2014-09-22 19:57:08 UTC (rev 12797)
+++ XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/mailinglist.php 2014-09-22 20:06:12 UTC (rev 12798)
@@ -38,7 +38,6 @@
*/
function subscribingMLHandler($type, $subscr_id, $mailinglist_id)
{
- global $xoopsConfig;
$xnewsletter = XnewsletterXnewsletter::getInstance();
$subscrObj = $xnewsletter->getHandler('subscr')->get($subscr_id);
@@ -59,9 +58,9 @@
echo "<br />action_code: {$action_code}";
echo "<br />";
*/
- require_once(XOOPS_ROOT_PATH . "/class/mail/phpmailer/class.phpmailer.php");
- require_once(XOOPS_ROOT_PATH . "/class/mail/phpmailer/class.pop3.php");
- require_once(XOOPS_ROOT_PATH . "/class/mail/phpmailer/class.smtp.php");
+ require_once XOOPS_ROOT_PATH . '/class/mail/phpmailer/class.phpmailer.php';
+ require_once XOOPS_ROOT_PATH . '/class/mail/phpmailer/class.pop3.php';
+ require_once XOOPS_ROOT_PATH . '/class/mail/phpmailer/class.smtp.php';
//get emails of subscribers
$recipients = array();
@@ -89,11 +88,11 @@
$xoopsMailer->setHTML(false);
//$xoopsMailer->setTemplate('activate.tpl');
$xoopsMailer->setToEmails($recipient["address"]);
- if (isset($xoopsConfig['adminmail'])) {
- $xoopsMailer->setFromEmail($xoopsConfig['adminmail']);
+ if (isset($GLOBALS['xoopsConfig']['adminmail'])) {
+ $xoopsMailer->setFromEmail($GLOBALS['xoopsConfig']['adminmail']);
}
- if (isset($xoopsConfig['sitename'])) {
- $xoopsMailer->setFromName($xoopsConfig['sitename']);
+ if (isset($GLOBALS['xoopsConfig']['sitename'])) {
+ $xoopsMailer->setFromName($GLOBALS['xoopsConfig']['sitename']);
}
//$xoopsMailer->setSubject($subject);
$xoopsMailer->setBody($action_code);
Modified: XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/oninstall.php
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/oninstall.php 2014-09-22 19:57:08 UTC (rev 12797)
+++ XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/oninstall.php 2014-09-22 20:06:12 UTC (rev 12798)
@@ -28,8 +28,8 @@
*/
defined('XOOPS_ROOT_PATH') || die('XOOPS root path not defined');
-include_once(XOOPS_ROOT_PATH . "/modules/xnewsletter/include/common.php");
-@include_once(XOOPS_ROOT_PATH . "/modules/xnewsletter/language/" . $xoopsConfig['language'] . "/admin.php");
+include_once XOOPS_ROOT_PATH . '/modules/xnewsletter/include/common.php';
+@include_once XOOPS_ROOT_PATH . '/modules/xnewsletter/language/' . $GLOBALS['xoopsConfig']['language'] . '/admin.php';
define('INDEX_FILE_PATH', XOOPS_UPLOAD_PATH . "/index.html");
define('BLANK_FILE_PATH', XOOPS_UPLOAD_PATH . "/blank.gif");
Modified: XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/onupdate.php
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/onupdate.php 2014-09-22 19:57:08 UTC (rev 12797)
+++ XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/onupdate.php 2014-09-22 20:06:12 UTC (rev 12798)
@@ -27,23 +27,23 @@
* ****************************************************************************
*
* @param $xoopsModule
- * @param null $oldversion
+ * @param null $previousVersion
*
* @return bool
*/
-function xoops_module_update_xnewsletter(&$xoopsModule, $oldversion = null)
+function xoops_module_update_xnewsletter(&$xoopsModule, $previousVersion = null)
{
- if ($oldversion == 100) {
+ if ($previousVersion == 100) {
xoops_module_update_xnewsletter_101();
}
- if ($oldversion < 103) {
+ if ($previousVersion < 103) {
xoops_module_update_xnewsletter_103();
}
- if ($oldversion < 104) {
+ if ($previousVersion < 104) {
xoops_module_update_xnewsletter_104();
}
- if ($oldversion < 130) {
+ if ($previousVersion < 130) {
xoops_module_update_xnewsletter_130();
}
@@ -60,7 +60,7 @@
$dirname = basename(dirname(__DIR__));
rename($path, strtolower($dirname));
// update module dirname field in database to lowercase
- $sql = "UPDATE `{$GLOBALS['xoopsDB']->prefix("modules")}` SET `dirname` = '" . strtolower($dirname) . "'";
+ $sql = "UPDATE `{$GLOBALS['xoopsDB']->prefix('modules')}` SET `dirname` = '" . strtolower($dirname) . "'";
$sql .= " WHERE LOWER(`dirname`) = '" . strtolower($dirname) . "';";
if (!$GLOBALS['xoopsDB']->queryF($sql)) {
echo '<br />' . _MI_XNEWSLETTER_UPGRADEFAILED . ": UPDATE 'modules' SET `dirname` = '" . strtolower($dirname) . "'";
Modified: XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/phpmailer_bmh/class.phpmailer-bmh.php
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/phpmailer_bmh/class.phpmailer-bmh.php 2014-09-22 19:57:08 UTC (rev 12797)
+++ XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/phpmailer_bmh/class.phpmailer-bmh.php 2014-09-22 20:06:12 UTC (rev 12798)
@@ -45,7 +45,7 @@
*/
include_once dirname(dirname(dirname(dirname(__DIR__)))) . '/mainfile.php';
-require_once(XOOPS_ROOT_PATH . '/modules/xnewsletter/include/phpmailer_bmh/phpmailer-bmh_rules.php');
+require_once XOOPS_ROOT_PATH . '/modules/xnewsletter/include/phpmailer_bmh/phpmailer-bmh_rules.php' ;
define('VERBOSE_QUIET', 0); // means no output at all
define('VERBOSE_SIMPLE', 1); // means only output simple report
Modified: XoopsModules/xnewsletter/branches/luciorota/xnewsletter/in...
[truncated message content] |
|
From: <luc...@us...> - 2014-10-06 19:43:15
|
Revision: 12812
http://sourceforge.net/p/xoops/svn/12812
Author: luciorota
Date: 2014-10-06 19:43:10 +0000 (Mon, 06 Oct 2014)
Log Message:
-----------
fixed bug when updating from xNewsletter to xnewsletter on linux/unix servers
fixed bug in subscr form (goffy)
Modified Paths:
--------------
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/subscr.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/task.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/docs/update.txt
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/onupdate.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/language/english/admin.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/xoops_version.php
Modified: XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/subscr.php
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/subscr.php 2014-10-05 03:14:05 UTC (rev 12811)
+++ XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/subscr.php 2014-10-06 19:43:10 UTC (rev 12812)
@@ -110,24 +110,22 @@
if ($action === false) {
$action = $_SERVER['REQUEST_URI'];
}
-
include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
+ //
$title = $this->isNew() ? sprintf(_MA_XNEWSLETTER_SUBSCRIPTION_ADD) : sprintf(_MA_XNEWSLETTER_SUBSCRIPTION_EDIT);
$form = new XoopsThemeForm($title, 'form', $action, 'post', true);
$form->setExtra('enctype="multipart/form-data"');
-
+ //
$form->addElement(new XoopsFormLabel("<span style='text-decoration:underline'>" . _MA_XNEWSLETTER_SUBSCRIPTION_INFO_PERS . "</span>", ''));
$subscr_id = $this->isNew() ? 0 : $this->getVar('subscr_id');
-
- // subscr_email
+ // subscr: subscr_email
if ($subscr_id > 0 || $this->getVar('subscr_email') != '') {
$form->addElement(new XoopsFormLabel(_AM_XNEWSLETTER_SUBSCR_EMAIL, $this->getVar('subscr_email')));
$form->addElement(new XoopsFormHidden('subscr_email', $this->getVar('subscr_email')));
} else {
$form->addElement(new XoopsFormText(_AM_XNEWSLETTER_SUBSCR_EMAIL, 'subscr_email', 50, 255, $this->getVar('subscr_email')), true);
}
-
- // subscr_sex
+ // subscr: subscr_sex
if ($this->xnewsletter->getConfig('xn_use_salutation') == 1) {
$select_subscr_sex = new XoopsFormSelect(_AM_XNEWSLETTER_SUBSCR_SEX, 'subscr_sex', $this->getVar('subscr_sex'));
$select_subscr_sex->addOption(_AM_XNEWSLETTER_SUBSCR_SEX_EMPTY, _AM_XNEWSLETTER_SUBSCR_SEX_EMPTY);
@@ -137,15 +135,12 @@
$select_subscr_sex->addOption(_AM_XNEWSLETTER_SUBSCR_SEX_FAMILY, _AM_XNEWSLETTER_SUBSCR_SEX_FAMILY);
$form->addElement($select_subscr_sex);
}
-
- // subscr_firstname
- $form->addElement(new XoopsFormText(_AM_XNEWSLETTER_SUBSCR_FIRSTNAME, 'subscr_firstname', 50, 255, $this->getVar('subscr_firstname')), true);
-
- // subscr_lastname
+ // subscr: subscr_firstname
+ $form->addElement(new XoopsFormText(_AM_XNEWSLETTER_SUBSCR_FIRSTNAME, 'subscr_firstname', 50, 255, $this->getVar('subscr_firstname')), false);
+ // subscr: subscr_lastname
$form->addElement(new XoopsFormText(_AM_XNEWSLETTER_SUBSCR_LASTNAME, 'subscr_lastname', 50, 255, $this->getVar('subscr_lastname')), false);
-
+ //
$form->addElement(new XoopsFormLabel('<br/><br/>', ''));
-
// get newsletters available for current user
$opt_cat = array();
$opt_tray = new XoopsFormElementTray("<span style='text-decoration:underline'>" . _MA_XNEWSLETTER_SUBSCRIPTION_CATS_AVAIL . "</span>", "<br />");
@@ -153,7 +148,6 @@
$gperm_handler = xoops_gethandler('groupperm');
$uid = (is_object($GLOBALS['xoopsUser']) && isset($GLOBALS['xoopsUser'])) ? $GLOBALS['xoopsUser']->uid() : 0;
$groups = is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getGroups() : array(0 => XOOPS_GROUP_ANONYMOUS);
-
// cats[], existing_catsubcr_id_{$cat_id}, existing_catsubscr_quited_{$cat_id}
$catCriteria = new CriteriaCompo();
$catCriteria->setSort('cat_id');
@@ -198,10 +192,8 @@
}
$cat_checkbox->setValue($values);
$form->addElement($cat_checkbox);
-
// op
$form->addElement(new XoopsFormHidden('op', 'save_subscription'));
-
// button
$button_tray = new XoopsFormElementTray('', '');
$button_tray->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit'));
@@ -211,7 +203,7 @@
$button_cancel->setExtra('onclick="history.go(-1)"');
$button_tray->addElement($button_cancel);
$form->addElement($button_tray);
-
+ //
return $form;
}
@@ -228,13 +220,12 @@
if ($action === false) {
$action = $_SERVER["REQUEST_URI"];
}
-
+ include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
+ //
$title = $this->isNew() ? sprintf(_AM_XNEWSLETTER_SUBSCR_ADD) : sprintf(_AM_XNEWSLETTER_SUBSCR_EDIT);
-
- include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
$form = new XoopsThemeForm($title, 'form', $action, 'post', true);
$form->setExtra('enctype="multipart/form-data"');
-
+ // subscr: subscr_sex
$form->addElement(new XoopsFormText(_AM_XNEWSLETTER_SUBSCR_EMAIL, 'subscr_email', 50, 255, $this->getVar('subscr_email')), true);
$select_subscr_sex = new XoopsFormSelect(_AM_XNEWSLETTER_SUBSCR_SEX, 'subscr_sex', $this->getVar('subscr_sex'));
$select_subscr_sex->addOption(_AM_XNEWSLETTER_SUBSCR_SEX_EMPTY, _AM_XNEWSLETTER_SUBSCR_SEX_EMPTY);
@@ -243,15 +234,17 @@
$select_subscr_sex->addOption(_AM_XNEWSLETTER_SUBSCR_SEX_COMP, _AM_XNEWSLETTER_SUBSCR_SEX_COMP);
$select_subscr_sex->addOption(_AM_XNEWSLETTER_SUBSCR_SEX_FAMILY, _AM_XNEWSLETTER_SUBSCR_SEX_FAMILY);
$form->addElement($select_subscr_sex);
+ // subscr: subscr_firstname
$form->addElement(new XoopsFormText(_AM_XNEWSLETTER_SUBSCR_FIRSTNAME, 'subscr_firstname', 50, 255, $this->getVar('subscr_firstname')), false);
+ // subscr: subscr_lastname
$form->addElement(new XoopsFormText(_AM_XNEWSLETTER_SUBSCR_LASTNAME, 'subscr_lastname', 50, 255, $this->getVar('subscr_lastname')), false);
-
+ // subscr: subscr_uid
$form->addElement(new XoopsFormSelectUser(_AM_XNEWSLETTER_SUBSCR_UID, 'subscr_uid', true, $this->getVar('subscr_uid'), 1, false), false);
-
+ // subscr: subscr_submitter
$form->addElement(new XoopsFormHidden('subscr_submitter', $GLOBALS['xoopsUser']->uid()));
$form->addElement(new XoopsFormLabel(_AM_XNEWSLETTER_SUBSCR_SUBMITTER, $GLOBALS['xoopsUser']->uname()));
//$form->addElement(new XoopsFormSelectUser(_AM_XNEWSLETTER_SUBSCR_SUBMITTER, 'subscr_submitter', false, $this->getVar('subscr_submitter'), 1, false), true);
-
+ //
if ($this->getVar('subscr_id') > 0) {
$form->addElement(
new XoopsFormLabel(
@@ -271,7 +264,7 @@
$form->addElement(new XoopsFormHidden('subscr_actkey', ''));
$form->addElement(new XoopsFormHidden('op', 'save_subscr'));
$form->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit'));
-
+ //
return $form;
}
}
Modified: XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/task.php
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/task.php 2014-10-05 03:14:05 UTC (rev 12811)
+++ XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/task.php 2014-10-06 19:43:10 UTC (rev 12812)
@@ -1,4 +1,4 @@
-<?php
+ <?php
/*
You may not change or alter any portion of this comment or credits
of supporting developers from this source code or any supporting source code
Modified: XoopsModules/xnewsletter/branches/luciorota/xnewsletter/docs/update.txt
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xnewsletter/docs/update.txt 2014-10-05 03:14:05 UTC (rev 12811)
+++ XoopsModules/xnewsletter/branches/luciorota/xnewsletter/docs/update.txt 2014-10-06 19:43:10 UTC (rev 12812)
@@ -1,5 +1,11 @@
-Read Me First
-=============
-1. Delete old /modules/xNewsletter directory
-2. Copy this module in /modules directory
-3. Update this module
+Read Me First in case of module update
+======================================
+If installed xNewsletter module dirname is like xNewsletter, follow these steps;
+
+1. Rename old /modules/xNewsletter directory to /modules/xNewsletter.bak
+2. Copy new module in /modules directory
+3. Rename new module to /modules/xNewsletter
+4. Update module: update procedure will convert directory name to lowercase, and modules database record too
+5. An error sould occour in some systems: this is not a problem, this is because now module admin is in /modules/xnewsletter/admin/index.php ...
+6. Check if anything runs well
+7. Remove backup dir /modules/xNewsletter.bak
Modified: XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/onupdate.php
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/onupdate.php 2014-10-05 03:14:05 UTC (rev 12811)
+++ XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/onupdate.php 2014-10-06 19:43:10 UTC (rev 12812)
@@ -46,6 +46,7 @@
if ($previousVersion < 130) {
xoops_module_update_xnewsletter_130();
}
+ xoops_module_update_xnewsletter_dirtolowercase();
return true;
}
@@ -53,19 +54,44 @@
/**
* @return bool
*/
-function xoops_module_update_xnewsletter_130()
+function xoops_module_update_xnewsletter_dirtolowercase()
{
// change module dirname to lowercase
- $path = dirname(__DIR__);
- $dirname = basename(dirname(__DIR__));
- rename($path, strtolower($dirname));
- // update module dirname field in database to lowercase
- $sql = "UPDATE `{$GLOBALS['xoopsDB']->prefix('modules')}` SET `dirname` = '" . strtolower($dirname) . "'";
- $sql .= " WHERE LOWER(`dirname`) = '" . strtolower($dirname) . "';";
- if (!$GLOBALS['xoopsDB']->queryF($sql)) {
- echo '<br />' . _MI_XNEWSLETTER_UPGRADEFAILED . ": UPDATE 'modules' SET `dirname` = '" . strtolower($dirname) . "'";
+ $modulePath = dirname(__DIR__);
+ $moduleDirname = basename(dirname(__DIR__));
+ if ($moduleDirname != strtolower($moduleDirname)) {
+ if (!xnewsletter_copyDir($modulePath, XOOPS_ROOT_PATH . '/modules/' . strtolower($moduleDirname) . '.tmp')) {
+ return false;
+ }
+ if (!xnewsletter_delDir($modulePath)) {
+ return false;
+ }
+ if (!xnewsletter_copyDir(XOOPS_ROOT_PATH . '/modules/' . strtolower($moduleDirname) . '.tmp', XOOPS_ROOT_PATH . '/modules/' . strtolower($moduleDirname))) {
+ return false;
+ }
+ if (!xnewsletter_delDir(XOOPS_ROOT_PATH . '/modules/' . strtolower($moduleDirname) . '.tmp')) {
+ return false;
+ }
+ // update module dirname field in database to lowercase
+ $sql = "UPDATE `{$GLOBALS['xoopsDB']->prefix('modules')}` SET `dirname` = '" . strtolower($moduleDirname) . "'";
+ $sql .= " WHERE LOWER(`dirname`) = '" . strtolower($moduleDirname) . "';";
+ if (!$GLOBALS['xoopsDB']->queryF($sql)) {
+ echo '<br />' . _MI_XNEWSLETTER_UPGRADEFAILED . ": UPDATE 'modules' SET `dirname` = '" . strtolower($moduleDirname) . "'";
+ return false;
+ }
+ } else {
+ // NOP
}
+ return true;
+}
+/**
+ * @return bool
+ */
+function xoops_module_update_xnewsletter_130()
+{
+ $moduleDirname = basename(dirname(__DIR__));
+
// reverse 'mod_' prefix on tables
xoops_module_update_xnewsletter_rename_mod_table('xnewsletter_accounts');
xoops_module_update_xnewsletter_rename_mod_table('xnewsletter_attachment');
@@ -136,8 +162,8 @@
// delete old html template files
- $templateDirectory = XOOPS_ROOT_PATH . "/modules/" . $dirname . "/templates/";
- $template_list = array_diff(scandir($templateDirectory), array('..', '.'));
+ $templateDirectory = XOOPS_ROOT_PATH . "/modules/" . $moduleDirname . "/templates/";
+ $template_list = array_diff(@scandir($templateDirectory), array('..', '.'));
foreach ($template_list as $k => $v) {
$fileinfo = new SplFileInfo($templateDirectory . $v);
if ($fileinfo->getExtension() == 'html' && $fileinfo->getFilename() != 'index.html') {
@@ -148,17 +174,17 @@
xoops_load('xoopsfile');
//delete /images directory
- $imagesDirectory = XOOPS_ROOT_PATH . "/modules/" . $dirname . "/images/";
+ $imagesDirectory = XOOPS_ROOT_PATH . "/modules/" . $moduleDirname . "/images/";
$folderHandler = XoopsFile::getHandler("folder", $imagesDirectory);
$folderHandler->delete($imagesDirectory);
//delete /templates/style.css file
- $cssFile = XOOPS_ROOT_PATH . "/modules/" . $dirname . "/templates/style.css";
+ $cssFile = XOOPS_ROOT_PATH . "/modules/" . $moduleDirname . "/templates/style.css";
$folderHandler = XoopsFile::getHandler("file", $cssFile);
$folderHandler->delete($cssFile);
//delete .html entries from the tpl table
- $sql = "DELETE FROM " . $GLOBALS['xoopsDB']->prefix("tplfile") . " WHERE LOWER(`tpl_module`) = '" . strtolower($dirname) . "' AND `tpl_file` LIKE '%.html%'";
+ $sql = "DELETE FROM " . $GLOBALS['xoopsDB']->prefix("tplfile") . " WHERE LOWER(`tpl_module`) = '" . strtolower($moduleDirname) . "' AND `tpl_file` LIKE '%.html%'";
$GLOBALS['xoopsDB']->queryF($sql);
return true;
@@ -303,3 +329,66 @@
return ($GLOBALS['xoopsDB']->getRowsNum($result) > 0);
}
+
+/**
+ * Copy a directory and its contents
+ *
+ * @param string $source is the original directory
+ * @param string $destination is the destination directory
+ *
+ * @return bool Returns true on success or false on failure
+ *
+ */
+function xnewsletter_copyDir($source, $destination)
+{
+ if (!$dirHandler = opendir($source)) {
+ return false;
+ }
+ @mkdir($destination);
+ while (false !== ($file = readdir($dirHandler))) {
+ if (($file != '.') && ($file != '..')) {
+ if (is_dir("{$source}/{$file}")) {
+ if (!xnewsletter_copyDir("{$source}/{$file}", "{$destination}/{$file}")) {
+ return false;
+ }
+ } else {
+ if (!copy("{$source}/{$file}", "{$destination}/{$file}")) {
+ return false;
+ }
+ }
+ }
+ }
+ closedir($dirHandler);
+ return true;
+}
+
+/**
+ * Delete a empty/not empty directory
+ *
+ * @param string $dir path to the directory to delete
+ * @param bool $if_not_empty if false it delete directory only if false
+ *
+ * @return bool Returns true on success or false on failure
+ */
+function xnewsletter_delDir($dir, $if_not_empty = true)
+{
+ if (!file_exists($dir)) {
+ return true;
+ }
+ if ($if_not_empty == true) {
+ if (!is_dir($dir)) {
+ return unlink($dir);
+ }
+ foreach (scandir($dir) as $item) {
+ if ($item == '.' || $item == '..') {
+ continue;
+ }
+ if (!xnewsletter_delDir("{$dir}/{$item}")) {
+ return false;
+ }
+ }
+ } else {
+ // NOP
+ }
+ return rmdir($dir);
+}
\ No newline at end of file
Modified: XoopsModules/xnewsletter/branches/luciorota/xnewsletter/language/english/admin.php
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xnewsletter/language/english/admin.php 2014-10-05 03:14:05 UTC (rev 12811)
+++ XoopsModules/xnewsletter/branches/luciorota/xnewsletter/language/english/admin.php 2014-10-06 19:43:10 UTC (rev 12812)
@@ -473,12 +473,12 @@
define('_AM_XNEWSLETTER_FORMACTIVATEOK', "Activated successfully");
define('_AM_XNEWSLETTER_FORMUNACTIVATEOK', "Unactivated successfully");
//
+define('_AM_XNEWSLETTER_PROTOCOL_STATUS_EMPTY','');
define('_AM_XNEWSLETTER_PROTOCOL_STATUS_SAVED', 'Saved');
define('_AM_XNEWSLETTER_PROTOCOL_STATUS_ERROR_CREATE_TASK', 'Error creating item in task list');
define('_AM_XNEWSLETTER_PROTOCOL_STATUS_OK_SEND_TEST', 'Newsletter sent for test (%recipient)');
define('_AM_XNEWSLETTER_PROTOCOL_STATUS_OK_SEND', 'Newsletter sent');
define('_AM_XNEWSLETTER_PROTOCOL_STATUS_ERROR_SEND', 'Newsletter send failed -> %error');
-define('_AM_XNEWSLETTER_PROTOCOL_STATUS_ERROR_SEND','Newsletter send failed -> %error');
define('_AM_XNEWSLETTER_PROTOCOL_STATUS_ERROR_PHPMAILER',"Error phpmailer -> %error");
define('_AM_XNEWSLETTER_PROTOCOL_STATUS_ERROR_SEND_COUNT',"Error sending newsletter: %error_count of %total_count newsletters not sent");
define('_AM_XNEWSLETTER_PROTOCOL_STATUS_OK_SEND_COUNT',"Sending %total_count newsletter(s) successfully");
Modified: XoopsModules/xnewsletter/branches/luciorota/xnewsletter/xoops_version.php
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xnewsletter/xoops_version.php 2014-10-05 03:14:05 UTC (rev 12811)
+++ XoopsModules/xnewsletter/branches/luciorota/xnewsletter/xoops_version.php 2014-10-06 19:43:10 UTC (rev 12812)
@@ -51,7 +51,7 @@
//About
$modversion['module_status'] = 'Beta 1';
-$modversion['release_date'] = '2014/09/22';
+$modversion['release_date'] = '2014/10/02';
//$modversion['release'] = "1.3";
$modversion['demo_site_url'] = '';
$modversion['demo_site_name'] = '';
@@ -129,7 +129,7 @@
$member_handler = xoops_gethandler('member');
$uid = (is_object($GLOBALS['xoopsUser']) && isset($GLOBALS['xoopsUser'])) ? $GLOBALS['xoopsUser']->uid() : 0;
$groups = is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getGroups() : array(0 => XOOPS_GROUP_ANONYMOUS);
-$xoopsModule = $module_handler->getByDirname('xnewsletter');
+$xoopsModule = $module_handler->getByDirname($mydirname);
$showRead = false;
$showEdit = false;
@@ -137,7 +137,7 @@
$showList = false;
if (is_object($xoopsModule)) {
- $catHandler = xoops_getModuleHandler('cat', 'xnewsletter');
+ $catHandler = xoops_getModuleHandler('cat', $mydirname);
$catCriteria = new CriteriaCompo();
$catCriteria->setSort('cat_id');
$catCriteria->setOrder('ASC');
|
|
From: <luc...@us...> - 2014-12-02 21:23:40
|
Revision: 12883
http://sourceforge.net/p/xoops/svn/12883
Author: luciorota
Date: 2014-12-02 21:23:27 +0000 (Tue, 02 Dec 2014)
Log Message:
-----------
! fixed some database fields length
+ support multiple test emails
* templatize some admin side page
+ use DateTime object instead of strtotime() function
+ added xnewsletter_randomLipsum() function (in_progress)
Modified Paths:
--------------
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/attachment.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/letter.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/maintenance.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/subscr.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/template.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/import.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/letter.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/subscr.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/template.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/docs/changelog.txt
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/functions.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/task.inc.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/language/english/admin.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/language/english/common.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/sql/mysql.sql
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/xoops_version.php
Added Paths:
-----------
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/templates/admin/xnewsletter_admin_attachments_list.tpl
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/templates/admin/xnewsletter_admin_letters_list.tpl
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/templates/admin/xnewsletter_admin_subscrs_list.tpl
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/templates/admin/xnewsletter_admin_templates_list.tpl
Modified: XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/attachment.php
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/attachment.php 2014-12-02 21:16:19 UTC (rev 12882)
+++ XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/attachment.php 2014-12-02 21:23:27 UTC (rev 12883)
@@ -37,64 +37,50 @@
switch ($op) {
case 'list':
+ case 'list_attachments':
default:
echo $indexAdmin->addNavigation($currentFile);
echo $indexAdmin->renderButton();
//
- $limit = $xnewsletter->getConfig('adminperpage');
- $attachmentCriteria = new CriteriaCompo();
- $attachmentCriteria->setSort('attachment_letter_id DESC, attachment_id');
- $attachmentCriteria->setOrder('DESC');
$attachmentCount = $xnewsletter->getHandler('attachment')->getCount();
- $start = xnewsletterRequest::getInt('start', 0);
- $attachmentCriteria->setStart($start);
- $attachmentCriteria->setLimit($limit);
- $attachmentObjs = $xnewsletter->getHandler('attachment')->getObjects($attachmentCriteria, true);
- if ($attachmentCount > $limit) {
- include_once XOOPS_ROOT_PATH . '/class/pagenav.php';
- $pagenav = new XoopsPageNav($attachmentCount, $limit, $start, 'start', 'op=list');
- $pagenav = $pagenav->renderNav(4);
- } else {
- $pagenav = '';
- }
- // output table
- echo "<table class='outer' cellspacing='1'>";
- echo "<tr>";
- echo " <th>" . _AM_XNEWSLETTER_ATTACHMENT_ID . "</th>";
- echo " <th>" . _AM_XNEWSLETTER_ATTACHMENT_LETTER_ID . "</th>";
- echo " <th>" . _AM_XNEWSLETTER_ATTACHMENT_NAME . "</th>";
- echo " <th>" . _AM_XNEWSLETTER_ATTACHMENT_SIZE . "<br />" . _AM_XNEWSLETTER_ATTACHMENT_TYPE . "</th>";
- echo " <th>" . _AM_XNEWSLETTER_ATTACHMENT_SUBMITTER . "</th>";
- echo " <th>" . _AM_XNEWSLETTER_ATTACHMENT_CREATED . "</th>";
- echo " <th>" . _AM_XNEWSLETTER_FORMACTION . "</th>";
- echo "</tr>";
if ($attachmentCount > 0) {
- $class = 'odd';
- foreach ($attachmentObjs as $attachment_id => $attachmentObj) {
- $letterObj = $xnewsletter->getHandler('letter')->get($attachmentObj->getVar('attachment_letter_id'));
- echo "<tr class='{$class}'>";
- $class = ($class == 'even') ? 'odd' : 'even';
- echo "<td class='center'>{$attachment_id}</td>";
- echo "<td>" . $letterObj->getVar('letter_title') . "</td>";
- echo "<td>" . $attachmentObj->getVar('attachment_name') . "</td>";
- echo "<td>";
- echo "<span title='" . $attachmentObj->getVar('attachment_size') . " B'>" . xnewsletter_bytesToSize1024($attachmentObj->getVar('attachment_size')) . "</span>";
- echo "<br />";
- echo $attachmentObj->getVar('attachment_type');
- echo "</td>";
- echo "<td>" . XoopsUser::getUnameFromId($attachmentObj->getVar('attachment_submitter'), 'S') . "</td>";
- echo "<td>" . formatTimeStamp($attachmentObj->getVar('attachment_created'), 'S') . "</td>";
- echo "<td class='center'>";
- echo " <a href='?op=edit_attachment&attachment_id={$attachment_id}'><img src=" . XNEWSLETTER_ICONS_URL . "/xn_edit.png alt='" . _EDIT . "' title='" . _EDIT . "' /></a>";
- echo " ";
- echo " <a href='?op=delete_attachment&attachment_id={$attachment_id}'><img src=" . XNEWSLETTER_ICONS_URL . "/xn_delete.png alt='" . _DELETE . "' title='" . _DELETE . "' /></a>";
- echo "</td>";
+ $attachmentCriteria = new CriteriaCompo();
+ //
+ $attachmentCriteria->setSort('attachment_letter_id DESC, attachment_id');
+ $attachmentCriteria->setOrder('DESC');
+ //
+ $start = xnewsletterRequest::getInt('start', 0);
+ $limit = $xnewsletter->getConfig('adminperpage');
+ $attachmentCriteria->setStart($start);
+ $attachmentCriteria->setLimit($limit);
+ //
+ if ($attachmentCount > $limit) {
+ include_once XOOPS_ROOT_PATH . '/class/pagenav.php';
+ $pagenav = new XoopsPageNav($attachmentCount, $limit, $start, 'start', 'op=list');
+ $pagenav = $pagenav->renderNav(4);
+ } else {
+ $pagenav = '';
}
+ $GLOBALS['xoopsTpl']->assign('attachments_pagenav', $pagenav);
+ //
+ $attachmentObjs = $xnewsletter->getHandler('attachment')->getObjects($attachmentCriteria, true);
+ $attachments = $xnewsletter->getHandler('attachment')->getObjects($attachmentCriteria, true, false); // as array
+ foreach ($attachments as $attachment_id => $attachment) {
+ $letterObj = $xnewsletter->getHandler('letter')->get($attachment['attachment_letter_id']);
+ $attachment['attachment_letter_title'] = $letterObj->getVar('letter_title');
+// IN PROGRESS
+// IN PROGRESS
+// IN PROGRESS
+ $attachment['attachment_submitter_uname'] = XoopsUser::getUnameFromId($attachment['attachment_submitter'], 'S');
+ $attachment['attachment_created_formatted'] = formatTimestamp($template['attachment_created'], $xnewsletter->getConfig('dateformat'));
+ $GLOBALS['xoopsTpl']->append('attachments', $attachment);
+ }
+ //
+ $GLOBALS['xoopsTpl']->display("db:{$xnewsletter->getModule()->dirname()}_admin_attachments_list.tpl");
+ } else {
+ echo _CO_XNEWSLETTER_WARNING_NOATTACHMENTS;
}
- echo "</table>";
- echo "<br />";
- echo "<div>" . $pagenav . "</div>";
- echo "<br />";
+ include_once __DIR__ . '/admin_footer.php';
break;
case 'edit_attachment':
@@ -105,6 +91,7 @@
$attachmentObj = $xnewsletter->getHandler('attachment')->get($attachment_id);
$form = $attachmentObj->getForm();
$form->display();
+ include_once __DIR__ . '/admin_footer.php';
break;
case 'save_attachment':
@@ -123,6 +110,7 @@
$form = $attachmentObj->getForm();
$form->display();
}
+ include_once __DIR__ . '/admin_footer.php';
break;
case 'delete_attachment':
@@ -143,7 +131,6 @@
sprintf(_AM_XNEWSLETTER_FORMSUREDEL, $attachmentObj->getVar('attachment_letter_id'))
);
}
+ include_once __DIR__ . '/admin_footer.php';
break;
}
-
-include_once __DIR__ . '/admin_footer.php';
Modified: XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/letter.php
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/letter.php 2014-12-02 21:16:19 UTC (rev 12882)
+++ XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/letter.php 2014-12-02 21:23:27 UTC (rev 12883)
@@ -29,7 +29,6 @@
$currentFile = basename(__FILE__);
include_once __DIR__ . '/admin_header.php';
-xoops_cp_header();
// We recovered the value of the argument op in the URL$
$op = xnewsletterRequest::getString('op', 'list');
@@ -38,13 +37,16 @@
switch ($op) {
case 'show_preview':
case 'show_letter_preview':
+ // render start here
+ xoops_cp_header();
+ // render submenu
echo $indexAdmin->addNavigation($currentFile);
$indexAdmin->addItemButton(_AM_XNEWSLETTER_LETTERLIST, '?op=list', 'list');
echo $indexAdmin->renderButton();
//
+ $letterObj = $xnewsletter->getHandler('letter')->get($letter_id);
+ //
$letterTpl = new XoopsTpl();
-
- $letterObj = $xnewsletter->getHandler('letter')->get($letter_id);
// subscr data
$letterTpl->assign('sex', _AM_XNEWSLETTER_SUBSCR_SEX_PREVIEW);
$letterTpl->assign('salutation', _AM_XNEWSLETTER_SUBSCR_SEX_PREVIEW); // new from v1.3
@@ -97,124 +99,109 @@
echo nl2br(utf8_encode($textBody));
echo "</div>";
echo "</div>";
+ include_once __DIR__ . '/admin_footer.php';
break;
+ case 'list':
case 'list_letters':
default:
+ // render start here
+ xoops_cp_header();
+ // render submenu
echo $indexAdmin->addNavigation($currentFile);
$indexAdmin->addItemButton(_AM_XNEWSLETTER_NEWLETTER, '?op=new_letter', 'add');
echo $indexAdmin->renderButton();
//
- $limit = $xnewsletter->getConfig('adminperpage');
$letterCriteria = new CriteriaCompo();
$letterCriteria->setSort('letter_id');
$letterCriteria->setOrder('DESC');
$letterCount = $xnewsletter->getHandler('letter')->getCount();
- $start = xnewsletterRequest::getInt('start', 0);
- $letterCriteria->setStart($start);
- $letterCriteria->setLimit($limit);
- $letterObjs = $xnewsletter->getHandler('letter')->getObjects($letterCriteria, true);
-
- // pagenav
- include_once XOOPS_ROOT_PATH . '/class/pagenav.php';
- $pagenav = new XoopsPageNav($letterCount, $limit, $start, 'start', 'op=list');
- $pagenav = $pagenav->renderNav();
-
- // View Table
- echo "<table class='outer' cellspacing='1'>
- <tr>
- <th>" . _AM_XNEWSLETTER_LETTER_ID . "</th>
- <th>" . _AM_XNEWSLETTER_LETTER_TITLE . "</th>
- <th>" . _AM_XNEWSLETTER_LETTER_CATS . "</th>
- <th style='white-space: nowrap'>" . _AM_XNEWSLETTER_LETTER_SUBMITTER . "<br />" . _AM_XNEWSLETTER_LETTER_CREATED . "</th>
- <th style='white-space: nowrap'>" . _AM_XNEWSLETTER_LETTER_SENDER . "<br />" . _AM_XNEWSLETTER_LETTER_SENT . "</th>
- <th>" . _AM_XNEWSLETTER_LETTER_TEMPLATE . "</th>
- <th>" . _AM_XNEWSLETTER_LETTER_ATTACHMENT . "<br />" . _AM_XNEWSLETTER_LETTER_SIZE . "</th>
- <th>" . _AM_XNEWSLETTER_LETTER_ACCOUNT . "</th>
- <th>" . _AM_XNEWSLETTER_LETTER_EMAIL_TEST . "</th>
- <th>" . _AM_XNEWSLETTER_PROTOCOL_LAST_STATUS . "</th>
- <th>" . _AM_XNEWSLETTER_FORMACTION . "</th>
- </tr>";
if ($letterCount > 0) {
- $class = 'odd';
+ $limit = $xnewsletter->getConfig('adminperpage');
+ $start = xnewsletterRequest::getInt('start', 0);
+ $letterCriteria->setStart($start);
+ $letterCriteria->setLimit($limit);
+ //
+ $letterObjs = $xnewsletter->getHandler('letter')->getObjects($letterCriteria, true);
+ $letters = $xnewsletter->getHandler('letter')->getObjects($letterCriteria, true, false); // as array
+ // pagenav
+ if ($letterCount > $limit) {
+ include_once XOOPS_ROOT_PATH . '/class/pagenav.php';
+ $pagenav = new XoopsPageNav($letterCount, $limit, $start, 'start', 'op=list');
+ $pagenav = $pagenav->renderNav();
+ } else {
+ $pagenav = '';
+ }
+ $GLOBALS['xoopsTpl']->assign('letters_pagenav', $pagenav);
+ // fill letters array
foreach ($letterObjs as $letter_id => $letterObj) {
- echo "<tr class='{$class}'>";
- $class = ($class == 'even') ? 'odd' : 'even';
-
- echo "<td>{$letter_id}</td>";
-
- echo "<td>{$letterObj->getVar('letter_title')}</td>";
-
- echo "<td style='white-space: nowrap'>";
- $letter_cat_ids = explode('|', $letterObj->getVar('letter_cats'));
+ $letter = $letterObj->toArray();
+ //
+ $letter_cat_ids = explode('|', $letter['letter_cats']);
+ unset($letter['letter_cats']);
foreach ($letter_cat_ids as $letter_cat_id) {
$catObj = $xnewsletter->getHandler('cat')->get($letter_cat_id);
- if (is_object($catObj)) {
- echo $catObj->getVar('cat_name') . " <a href='cat.php?op=edit_cat&cat_id={$catObj->getVar('cat_id')}'><img src=" . XNEWSLETTER_ICONS_URL . "/xn_edit.png alt='" . _EDIT
- . "' title='" . _EDIT . "' style='padding:1px' /></a>";
- } else {
- $letter_cats .= 'Invalid cat_name';
- }
- echo "<br />";
+ $cat = $catObj->toArray();
+ $letter['letter_cats']['letter_cat_id'] = $cat;
}
- echo "</td>";
-
- echo "<td>" . XoopsUser::getUnameFromId($letterObj->getVar('letter_submitter'), 's') . "<br />" . formatTimeStamp($letterObj->getVar('letter_created'), 's') . "</td>";
-
- echo "<td>";
- if ($letterObj->getVar('letter_sender') != 0) {
- echo XoopsUser::getUnameFromId($letterObj->getVar('letter_sender'), 's');
- }
- echo "<br />";
- if ($letterObj->getVar('letter_sent') != false) {
- echo formatTimeStamp($letterObj->getVar('letter_sent'), 's');
- }
- echo "</td>";
-
- echo "<td>";
- preg_match('/db:([0-9]*)/', $letterObj->getVar('letter_template'), $matches);
+ //
+ $letter['letter_submitter_uname'] = XoopsUser::getUnameFromId($letter['letter_submitter'], 's');
+ $letter['letter_created_formatted'] = formatTimeStamp($letter['letter_created'], 's');
+ //
+ $letter['letter_sender_uname'] = ($letter['letter_sender'] != 0) ? XoopsUser::getUnameFromId($letter['letter_sender'], 's') : '';
+ $letter['letter_sent_formatted'] = ($letter['letter_sent'] != false) ? formatTimeStamp($letter['letter_sent'], 's') : '';
+ //
+ preg_match('/db:([0-9]*)/', $letter['letter_template'], $matches);
if (isset($matches[1]) && ($templateObj = $xnewsletter->getHandler('template')->get((int)$matches[1]))) {
- echo "db:" . $templateObj->getVar('template_title');
- echo " <a href='template.php?op=edit_template&template_id={$templateObj->getVar('template_id')}'><img src=" . XNEWSLETTER_ICONS_URL . "/xn_edit.png alt='" . _EDIT . "' title='"
- . _EDIT . "' style='padding:1px' /></a>";
+ $template = $templateObj->toArray();
+ $template['template_submitter_uname'] = XoopsUser::getUnameFromId($template['template_submitter'], 's');
+ $template['template_created_formatted'] = formatTimeStamp($template['template_created'], 's');
} else {
- echo "file:" . $letterObj->getVar('letter_template');
+ $template_path = XOOPS_ROOT_PATH . '/modules/xnewsletter/language/' . $GLOBALS['xoopsConfig']['language'] . '/templates/';
+ if (!is_dir($template_path)) {
+ $template_path = XOOPS_ROOT_PATH . '/modules/xnewsletter/language/english/templates/';
+ }
+ $templateFile = $template_path . $letter['letter_template'] . '.tpl';
+ $template = array(
+ 'template_id' => null,
+ 'template_title' => $letter['letter_template'],
+ 'template_description' => '',
+ 'template_content' => file_get_contents($templateFile),
+ 'template_submitter' => null,
+ 'template_submitter_uname' => '',
+ 'template_created' => filemtime($templateFile),
+ 'template_created_formatted' => formatTimeStamp(filemtime($templateFile), 's')
+ );
}
- echo "</td>";
-
+ unset($letter['letter_template']);
+ $letter['letter_template'] = $template;
+ //
$attachmentCriteria = new CriteriaCompo();
$attachmentCriteria->add(new Criteria('attachment_letter_id', $letter_id));
$attachmentCount = $xnewsletter->getHandler('attachment')->getCount($attachmentCriteria);
$attachmentObjs = $xnewsletter->getHandler('attachment')->getObjects($attachmentCriteria, true);
- echo "<td style='white-space: nowrap'>";
- //echo "({$attachmentCount})";
$attachmentsSize = 0;
- if ($attachmentCount > 0) {
- $attachmentsSize = 0;
- echo "<ul>";
- foreach ($attachmentObjs as $attachment_id => $attachmentObj) {
- $attachmentsSize = $attachmentsSize + $attachmentObj->getVar('attachment_size');
- $size = xnewsletter_bytesToSize1024($attachmentObj->getVar('attachment_size'));
- echo "<li><span title='" . $attachmentObj->getVar('attachment_type') . " " . $size . "'>{$attachmentObj->getVar('attachment_name')}</span></li>";
- }
- echo "</ul>";
- echo _AM_XNEWSLETTER_LETTER_ATTACHMENT_TOTALSIZE . ": <span title='" . $attachmentsSize . " Bytes'>" . xnewsletter_bytesToSize1024($attachmentsSize) . "</span>";
- echo "<br />";
+ foreach ($attachmentObjs as $attachment_id => $attachmentObj) {
+ $attachment = $attachmentObj->toArray();
+ $attachmentsSize = $attachmentsSize + $attachment['attachment_size'];
+ $attachment['attachment_size1024'] = xnewsletter_bytesToSize1024($attachment['attachment_size']);
+ $letter['letter_attachments'][$attachment_id] = $attachment;
}
+ $letter['letter_attachments_size'] = $attachmentsSize;
+ $letter['letter_attachments_size1024'] = xnewsletter_bytesToSize1024($attachmentsSize);
+ //
$emailSize = xnewsletter_emailSize($letter_id);
- echo _AM_XNEWSLETTER_LETTER_EMAIL_SIZE . ": <span title='" . $emailSize . " Bytes (" . _AM_XNEWSLETTER_LETTER_EMAIL_SIZE_DESC . ")'>" . xnewsletter_bytesToSize1024($emailSize)
- . "</span>";
- echo "</td>";
-
+ $letter['letter_size'] = $emailSize;
+ $letter['letter_size1024'] = xnewsletter_bytesToSize1024($emailSize);
+ //
$accountCriteria = new CriteriaCompo();
$accountCriteria->setSort('accounts_id');
$accountCriteria->setOrder('ASC');
- $accountObj = $xnewsletter->getHandler('accounts')->get($letterObj->getVar('letter_account'));
- $letter_account = ($accountObj) ? $accountObj->getVar('accounts_name') : _NONE;
- echo "<td>{$letter_account}</td>";
-
- echo "<td>{$letterObj->getVar('letter_email_test')} </td>";
-
+ $accountObj = $xnewsletter->getHandler('accounts')->get($letter['letter_account']);
+ $account = $accountObj->toArray();
+ unset($letter['letter_account']);
+ $letter['letter_account'] = $account;
+ //
// take last item protocol_subscriber_id=0 from table protocol as actual status
$protocolCriteria = new CriteriaCompo();
$protocolCriteria->add(new Criteria('protocol_letter_id', $letter_id));
@@ -222,46 +209,26 @@
$protocolCriteria->setSort('protocol_id');
$protocolCriteria->setOrder('DESC');
$protocolCriteria->setLimit(1);
- $protocolObjs = $xnewsletter->getHandler('protocol')->getAll($protocolCriteria);
-// IN PROGRESS
- $protocol_status = '';
- $protocol_letter_id = 0;
- foreach ($protocolObjs as $protocolObj) {
-// IN PROGRESS
- $protocol_status .= $protocolObj->getVar('protocol_status');
- $protocol_letter_id = $protocolObj->getVar('protocol_letter_id');
+ $protocolObjs = $xnewsletter->getHandler('protocol')->getAll($protocolCriteria);
+ foreach ($protocolObjs as $protocol_id => $protocolObj) {
+ $protocol = $protocolObj->toArray();
+ $letter['letter_protocols'][$protocol_id] = $protocol;
}
- echo "<td class='center'><a href=' protocol.php?op=list_letter&letter_id={$protocol_letter_id}'>{$protocol_status}</a></td>";
-
- echo "<td class='center'>";
- echo " <a href='?op=edit_letter&letter_id={$letter_id}'><img src='" . XNEWSLETTER_ICONS_URL . "/xn_edit.png' alt='" . _EDIT . "' title='" . _EDIT . "' style='padding:1px' /></a>";
- echo " <a href='?op=clone_letter&letter_id={$letter_id}'><img src='" . XNEWSLETTER_ICONS_URL . "/xn_clone.png' alt='" . _CLONE . "' title='" . _CLONE
- . "' style='padding:1px' /></a>";
- echo " <a href='?op=delete_letter&letter_id={$letter_id}'><img src='" . XNEWSLETTER_ICONS_URL . "/xn_delete.png' alt='" . _DELETE . "' title='" . _DELETE
- . "' style='padding:1px' /></a>";
- echo " <br />";
- echo " <a href='sendletter.php?op=send_test&letter_id={$letter_id}'><img src='" . XNEWSLETTER_ICONS_URL . "/xn_sendtest.png' alt='" . _AM_XNEWSLETTER_LETTER_ACTION_SENDTEST
- . "' title='" . _AM_XNEWSLETTER_LETTER_ACTION_SENDTEST . "' style='padding:1px' /></a>";
- echo " <a href='sendletter.php?op=send_letter&letter_id={$letter_id}'><img src='" . XNEWSLETTER_ICONS_URL . "/xn_send.png' alt='" . _AM_XNEWSLETTER_LETTER_ACTION_SEND . "' title='"
- . _AM_XNEWSLETTER_LETTER_ACTION_SEND . "' style='padding:1px' /></a>";
- echo " <a href='sendletter.php?op=resend_letter&letter_id={$letter_id}'><img src='" . XNEWSLETTER_ICONS_URL . "/xn_resend.png' alt='" . _AM_XNEWSLETTER_LETTER_ACTION_RESEND
- . "' title='" . _AM_XNEWSLETTER_LETTER_ACTION_RESEND . "' style='padding:1px' /></a>";
- echo " <br />";
- echo " <a href='?op=show_preview&letter_id={$letter_id}'><img src='" . XNEWSLETTER_ICONS_URL . "/xn_preview.png' alt='" . _AM_XNEWSLETTER_LETTER_ACTION_PREVIEW . "' title='"
- . _AM_XNEWSLETTER_LETTER_ACTION_PREVIEW . "' style='padding:1px' /></a>";
- echo " <a href='" . XNEWSLETTER_URL . "/print.php?letter_id={$letter_id}' target='_BLANK' ><img src='" . XNEWSLETTER_ICONS_URL . "/printer.png' alt='"
- . _AM_XNEWSLETTER_LETTER_ACTION_PRINT . "' title='" . _AM_XNEWSLETTER_LETTER_ACTION_PRINT . "' style='padding:1px' /></a>";
- echo "</td>";
- echo "</tr>";
+ //
+ $GLOBALS['xoopsTpl']->append('letters', $letter);
}
+ //
+ $GLOBALS['xoopsTpl']->display("db:{$xnewsletter->getModule()->dirname()}_admin_letters_list.tpl");
+ } else {
+ echo _CO_XNEWSLETTER_WARNING_NOLETTERS;
}
- echo "</table>";
- echo "<br />";
- echo "<div>{$pagenav}</div>";
- echo "<br />";
+ include_once __DIR__ . '/admin_footer.php';
break;
case 'new_letter':
+ // render start here
+ xoops_cp_header();
+ // render submenu
echo $indexAdmin->addNavigation($currentFile);
$indexAdmin->addItemButton(_AM_XNEWSLETTER_LETTERLIST, '?op=list', 'list');
echo $indexAdmin->renderButton();
@@ -269,9 +236,13 @@
$letterObj = $xnewsletter->getHandler('letter')->create();
$form = $letterObj->getForm(false, true);
$form->display();
+ include_once __DIR__ . '/admin_footer.php';
break;
case 'edit_letter':
+ // render start here
+ xoops_cp_header();
+ // render submenu
echo $indexAdmin->addNavigation($currentFile);
$indexAdmin->addItemButton(_AM_XNEWSLETTER_NEWLETTER, '?op=new_letter', 'add');
$indexAdmin->addItemButton(_AM_XNEWSLETTER_LETTERLIST, '?op=list', 'list');
@@ -280,9 +251,13 @@
$letterObj = $xnewsletter->getHandler('letter')->get($letter_id);
$form = $letterObj->getForm(false, true);
$form->display();
+ include_once __DIR__ . '/admin_footer.php';
break;
case 'delete_attachment':
+ // render start here
+ xoops_cp_header();
+ // render submenu
echo $indexAdmin->addNavigation($currentFile);
$indexAdmin->addItemButton(_AM_XNEWSLETTER_NEWLETTER, '?op=new_letter', 'add');
$indexAdmin->addItemButton(_AM_XNEWSLETTER_LETTERLIST, '?op=list', 'list');
@@ -319,6 +294,7 @@
} else {
echo $attachmentObj->getHtmlErrors();
}
+ include_once __DIR__ . '/admin_footer.php';
break;
case 'save_letter':
@@ -432,6 +408,9 @@
case 'clone_letter':
case 'copy_letter':
+ // render start here
+ xoops_cp_header();
+ // render submenu
echo $indexAdmin->addNavigation($currentFile);
$indexAdmin->addItemButton(_AM_XNEWSLETTER_NEWLETTER, '?op=new_letter', 'add');
$indexAdmin->addItemButton(_AM_XNEWSLETTER_LETTERLIST, '?op=list', 'list');
@@ -443,6 +422,7 @@
$letterObj->setVar('letter_title', sprintf(_AM_XNEWSLETTER_LETTER_CLONED, $letterObj->getVar('letter_title')));
$form = $letterObj->getForm($currentFile, true);
$form->display();
+ include_once __DIR__ . '/admin_footer.php';
break;
case 'delete_letter':
@@ -467,8 +447,15 @@
echo $letterObj->getHtmlErrors();
}
} else {
- xoops_confirm(array('ok' => true, 'letter_id' => $letter_id, 'op' => 'delete_letter'), $_SERVER['REQUEST_URI'], sprintf(_AM_XNEWSLETTER_FORMSUREDEL, $letterObj->getVar('letter_title')));
+ // render start here
+ xoops_cp_header();
+ // render confirm form
+ xoops_confirm(
+ array('ok' => true, 'letter_id' => $letter_id, 'op' => 'delete_letter'),
+ $_SERVER['REQUEST_URI'],
+ sprintf(_AM_XNEWSLETTER_FORMSUREDEL, $letterObj->getVar('letter_title'))
+ );
+ include_once __DIR__ . '/admin_footer.php';
}
break;
}
-include_once __DIR__ . '/admin_footer.php';
Modified: XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/maintenance.php
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/maintenance.php 2014-12-02 21:16:19 UTC (rev 12882)
+++ XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/maintenance.php 2014-12-02 21:23:27 UTC (rev 12883)
@@ -175,7 +175,10 @@
break;
case 'del_oldsubscr':
- $time = strtotime($_POST['del_date']);
+ $dateTimeObj = DateTime::createFromFormat(_SHORTDATESTRING, $_POST['del_date']);
+ $dateTimeObj->setTime(0, 0, 0);
+ $time = $dateTimeObj->getTimestamp();
+ unset($dateTimeObj);
if ($time >= time() || $time == 0) {
$subscrCount = -1; // for error
} else {
Modified: XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/subscr.php
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/subscr.php 2014-12-02 21:16:19 U...
[truncated message content] |
|
From: <luc...@us...> - 2014-12-13 13:16:32
|
Revision: 12902
http://sourceforge.net/p/xoops/svn/12902
Author: luciorota
Date: 2014-12-13 13:16:18 +0000 (Sat, 13 Dec 2014)
Log Message:
-----------
fixed huge amount of small bugs
standardize code
templatize admin side
improved admin size options
Modified Paths:
--------------
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/attachment.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/cat.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/import.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/index.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/letter.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/menu.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/protocol.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/sendletter.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/subscr.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/task.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/template.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/accounts.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/attachment.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/cat.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/catsubscr.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/import.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/letter.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/mailinglist.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/subscr.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/template.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/cron.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/docs/changelog.txt
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/constants.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/functions.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/language/english/admin.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/language/english/common.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/templates/admin/xnewsletter_admin_attachments_list.tpl
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/templates/admin/xnewsletter_admin_letters_list.tpl
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/templates/admin/xnewsletter_admin_subscrs_list.tpl
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/templates/admin/xnewsletter_admin_templates_list.tpl
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/templates/xNewsletter_letter_preview.tpl
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/xoops_version.php
Added Paths:
-----------
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/assets/images/module_logo.png
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/functions.task.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/onuninstall.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/templates/admin/xnewsletter_admin_cats_list.tpl
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/templates/admin/xnewsletter_admin_protocols_list.tpl
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/templates/admin/xnewsletter_admin_tasks_list.tpl
Removed Paths:
-------------
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/task.inc.php
Modified: XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/attachment.php
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/attachment.php 2014-12-11 16:21:06 UTC (rev 12901)
+++ XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/attachment.php 2014-12-13 13:16:18 UTC (rev 12902)
@@ -43,6 +43,7 @@
echo $indexAdmin->renderButton();
//
$attachmentCount = $xnewsletter->getHandler('attachment')->getCount();
+ $GLOBALS['xoopsTpl']->assign('attachmentCount', $attachmentCount);
if ($attachmentCount > 0) {
$attachmentCriteria = new CriteriaCompo();
//
Modified: XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/cat.php
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/cat.php 2014-12-11 16:21:06 UTC (rev 12901)
+++ XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/cat.php 2014-12-13 13:16:18 UTC (rev 12902)
@@ -37,109 +37,90 @@
switch ($op) {
case 'list':
+ case 'list_cats':
default:
echo $indexAdmin->addNavigation($currentFile);
$indexAdmin->addItemButton(_AM_XNEWSLETTER_NEWCAT, '?op=new_cat', 'add');
echo $indexAdmin->renderButton();
//
- $start = xnewsletterRequest::getInt('start', 0);
- $limit = $xnewsletter->getConfig('adminperpage');
- $catsCount = $xnewsletter->getHandler('cat')->getCount();
- $catCriteria = new CriteriaCompo();
- $catCriteria->setSort('cat_id ASC, cat_name');
- $catCriteria->setOrder('ASC');
- $catCriteria->setStart($start);
- $catCriteria->setLimit($limit);
- $catObjs = $xnewsletter->getHandler('cat')->getAll($catCriteria);
- if ($catsCount > $limit) {
- include_once XOOPS_ROOT_PATH . '/class/pagenav.php';
- $pagenav = new XoopsPageNav($catsCount, $limit, $start, 'start', 'op=list');
- $pagenav = $pagenav->renderNav(4);
- } else {
- $pagenav = '';
- }
-
- // View Table
- echo "<table class='outer width100' cellspacing='1'>";
- echo "<tr>";
- echo " <th>" . _AM_XNEWSLETTER_CAT_ID . "</th>";
- echo " <th>" . _AM_XNEWSLETTER_CAT_NAME . "</th>";
- echo " <th>" . _AM_XNEWSLETTER_CAT_INFO . "</th>";
- echo " <th>" . _AM_XNEWSLETTER_CAT_GPERMS_ADMIN . "</th>";
- echo " <th>" . _AM_XNEWSLETTER_CAT_GPERMS_CREATE . "</th>";
- echo " <th>" . _AM_XNEWSLETTER_CAT_GPERMS_LIST . "</th>";
- echo " <th>" . _AM_XNEWSLETTER_CAT_GPERMS_READ . "</th>";
- if ($xnewsletter->getConfig('xn_use_mailinglist') == true) {
- echo " <th>" . _AM_XNEWSLETTER_CAT_MAILINGLIST . "</th>";
- }
- echo " <th>" . _AM_XNEWSLETTER_FORMACTION . "</th>";
- echo "</tr>";
-
- if (count($catObjs) > 0) {
- $class = 'odd';
+ $catCount = $xnewsletter->getHandler('cat')->getCount();
+ $GLOBALS['xoopsTpl']->assign('catCount', $catCount);
+ if ($catCount > 0) {
+ $catCriteria = new CriteriaCompo();
+ //
+ $catCriteria->setSort('cat_id ASC, cat_name');
+ $catCriteria->setOrder('ASC');
+ //
+ $start = xnewsletterRequest::getInt('start', 0);
+ $limit = $xnewsletter->getConfig('adminperpage');
+ $catCriteria->setStart($start);
+ $catCriteria->setLimit($limit);
+ //
+ if ($catCount > $limit) {
+ include_once XOOPS_ROOT_PATH . '/class/pagenav.php';
+ $pagenav = new XoopsPageNav($catCount, $limit, $start, 'start', 'op=list');
+ $pagenav = $pagenav->renderNav(4);
+ } else {
+ $pagenav = '';
+ }
+ $GLOBALS['xoopsTpl']->assign('cats_pagenav', $pagenav);
+ //
+ $catObjs = $xnewsletter->getHandler('cat')->getAll($catCriteria);
+ $cats = $xnewsletter->getHandler('cat')->getObjects($catCriteria, true, false); // as array
$groupNames = $member_handler->getGroupList();
$gperm_handler = xoops_gethandler('groupperm');
- foreach ($catObjs as $cat_id => $catObj) {
- echo "<tr class='{$class}'>";
- $class = ($class == 'even') ? 'odd' : 'even';
- echo "<td>{$cat_id}</td>";
- echo "<td>{$catObj->getVar("cat_name")}</td>";
- echo "<td>{$catObj->getVar("cat_info")} </td>";
+ foreach ($cats as $cat_id => $cat) {
// cat_gperms_admin
$cat_gperms_admin_groupids = $gperm_handler->getGroupIds('newsletter_admin_cat', $cat_id, $xnewsletter->getModule()->mid());
sort($cat_gperms_admin_groupids);
- $cat_gperms_admin = '';
+ $cat_gperms_admin = array();
foreach ($cat_gperms_admin_groupids as $groupid) {
- $cat_gperms_admin .= $groupNames[$groupid] . ' | ';
+ $cat_gperms_admin[$groupid] = array(
+ 'group_id' => $groupid,
+ 'group_name' => $groupNames[$groupid]);
}
- $cat_gperms_admin = substr($cat_gperms_admin, 0, -3);
- echo "<td>" . $cat_gperms_admin . "</td>";
-
+ $cat['cat_gperms_admin_groups'] = $cat_gperms_admin;
// cat_gperms_create
$cat_gperms_create_groupids = $gperm_handler->getGroupIds('newsletter_create_cat', $cat_id, $xnewsletter->getModule()->mid());
sort($cat_gperms_create_groupids);
- $cat_gperms_create = '';
+ $cat_gperms_create = array();
foreach ($cat_gperms_create_groupids as $groupid) {
- $cat_gperms_create .= $groupNames[$groupid] . " | ";
+ $cat_gperms_create[$groupid] = array(
+ 'group_id' => $groupid,
+ 'group_name' => $groupNames[$groupid]);
}
- $cat_gperms_create = substr($cat_gperms_create, 0, -3);
- echo "<td>" . $cat_gperms_create . "</td>";
-
+ $cat['cat_gperms_create_groups'] = $cat_gperms_create;
// cat_gperms_list
$cat_gperms_list_groupids = $gperm_handler->getGroupIds('newsletter_list_cat', $cat_id, $xnewsletter->getModule()->mid());
sort($cat_gperms_list_groupids);
- $cat_gperms_list = '';
+ $cat_gperms_list = array();
foreach ($cat_gperms_list_groupids as $groupid) {
- $cat_gperms_list .= $groupNames[$groupid] . " | ";
+ $cat_gperms_list[$groupid] = array(
+ 'group_id' => $groupid,
+ 'group_name' => $groupNames[$groupid]);
}
- $cat_gperms_list = substr($cat_gperms_list, 0, -3);
- echo "<td>" . $cat_gperms_list . "</td>";
-
+ $cat['cat_gperms_list_groups'] = $cat_gperms_list;
// cat_gperms_read
$cat_gperms_read_groupids = $gperm_handler->getGroupIds('newsletter_read_cat', $cat_id, $xnewsletter->getModule()->mid());
sort($cat_gperms_read_groupids);
- $cat_gperms_read = '';
+ $cat_gperms_read = array();
foreach ($cat_gperms_read_groupids as $groupid) {
- $cat_gperms_read .= $groupNames[$groupid] . " | ";
+ $cat_gperms_read[$groupid] = array(
+ 'group_id' => $groupid,
+ 'group_name' => $groupNames[$groupid]);
}
- $cat_gperms_read = substr($cat_gperms_read, 0, -3);
- echo "<td>" . $cat_gperms_read . "</td>";
-
- if ($xnewsletter->getConfig('xn_use_mailinglist') == true) {
- echo "<td>" . $catObj->getVar("cat_mailinglist") . "</td>";
- }
- echo "<td class='center' nowrap='nowrap'>";
- echo "<a href='?op=edit_cat&cat_id={$cat_id}'><img src=" . XNEWSLETTER_ICONS_URL . "/xn_edit.png alt='" . _EDIT . "' title='" . _EDIT . "' /></a>";
- echo " ";
- echo "<a href='?op=delete_cat&cat_id={$cat_id}'><img src=" . XNEWSLETTER_ICONS_URL . "/xn_delete.png alt='" . _DELETE . "' title='" . _DELETE . "' /></a>";
- echo "</td>";
- echo "</tr>";
+ $cat['cat_gperms_read_groups'] = $cat_gperms_read;
+ //
+ $GLOBALS['xoopsTpl']->append('cats', $cat);
}
+ // config
+ $GLOBALS['xoopsTpl']->assign('xn_use_mailinglist', $xnewsletter->getConfig('xn_use_mailinglist'));
+ //
+ $GLOBALS['xoopsTpl']->display("db:{$xnewsletter->getModule()->dirname()}_admin_cats_list.tpl");
+ } else {
+ echo _CO_XNEWSLETTER_WARNING_NOCATS;
}
- echo "</table>";
- echo "<br />";
- echo "<div>" . $pagenav . "</div>";
- echo "<br />";
+ include_once __DIR__ . '/admin_footer.php';
break;
case 'new_cat':
@@ -150,6 +131,7 @@
$catObj = $xnewsletter->getHandler('cat')->create();
$form = $catObj->getForm();
$form->display();
+ include_once __DIR__ . '/admin_footer.php';
break;
case 'save_cat':
@@ -206,6 +188,7 @@
echo $catObj->getHtmlErrors();
$form = $catObj->getForm();
$form->display();
+ include_once __DIR__ . '/admin_footer.php';
break;
case 'edit_cat':
@@ -217,6 +200,7 @@
$catObj = $xnewsletter->getHandler('cat')->get($cat_id);
$form = $catObj->getForm();
$form->display();
+ include_once __DIR__ . '/admin_footer.php';
break;
case 'delete_cat':
@@ -233,6 +217,6 @@
} else {
xoops_confirm(array('ok' => true, 'cat_id' => $cat_id, 'op' => 'delete_cat'), $_SERVER['REQUEST_URI'], sprintf(_AM_XNEWSLETTER_FORMSUREDEL, $catObj->getVar('cat_name')));
}
+ include_once __DIR__ . '/admin_footer.php';
break;
}
-include_once __DIR__ . '/admin_footer.php';
Modified: XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/import.php
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/import.php 2014-12-11 16:21:06 UTC (rev 12901)
+++ XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/import.php 2014-12-13 13:16:18 UTC (rev 12902)
@@ -34,57 +34,54 @@
define('XNEWSLETTER_BASIC_LIMIT_IMPORT_CHECKED', 100);
define('XNEWSLETTER_BASIC_LIMIT_IMPORT_AT_ONCE', 10);
-$op = xnewsletterRequest::getString('op', 'default');
-$plugin = xnewsletterRequest::getString('plugin', 'csv');
-$cat_id = xnewsletterRequest::getInt('cat_id', 0, 'int');
-$action_after_read = xnewsletterRequest::getInt('action_after_read', 1);
-$start = xnewsletterRequest::getInt('start', 0);
-$limitcheck = xnewsletterRequest::getInt('limitcheck', XNEWSLETTER_BASIC_LIMIT_IMPORT_CHECKED);
+$plugin = xnewsletterRequest::getString('plugin', 'csv');
+$cat_id = xnewsletterRequest::getInt('cat_id', 0, 'int');
+$start = xnewsletterRequest::getInt('start', 0);
+$checkSubscrsAfterRead = xnewsletterRequest::getBool('checkSubscrsAfterRead', true);
+$checkLimit = xnewsletterRequest::getInt('checkLimit', XNEWSLETTER_BASIC_LIMIT_IMPORT_CHECKED);
$skipcatsubscrexist = xnewsletterRequest::getInt('skipcatsubscrexist', 1);
-$check_import = xnewsletterRequest::getInt('check_import', 0);
+$checkImport = xnewsletterRequest::getInt('checkImport', 0);
echo $indexAdmin->addNavigation($currentFile);
+$op = xnewsletterRequest::getString('op', 'default');
switch ($op) {
case 'show_formcheck':
$indexAdmin->addItemButton(_AM_XNEWSLETTER_IMPORT_PLUGINS_AVAIL, $currentFile, 'list');
echo $indexAdmin->renderButton();
//
- $importCriteria = new CriteriaCompo();
- $importCriteria->setSort("import_id");
- $importCriteria->setOrder("ASC");
- $importsCount = $xnewsletter->getHandler('import')->getCount($importCriteria);
-
- $importCriteria->setStart($start);
- $importCriteria->setLimit($limitcheck);
- $importObjs = $xnewsletter->getHandler('import')->getAll($importCriteria);
-
- if ($importsCount > 0) {
+ $importCount = $xnewsletter->getHandler('import')->getCount();
+ if ($importCount > 0) {
+ $importCriteria = new CriteriaCompo();
+ $importCriteria->setSort("import_id");
+ $importCriteria->setOrder("ASC");
+ $importCriteria->setStart($start);
+ $importCriteria->setLimit($checkLimit);
+ $importObjs = $xnewsletter->getHandler('import')->getAll($importCriteria);
+ //
include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
-
- $action = $_SERVER['REQUEST_URI'];
+ $action = $_SERVER['REQUEST_URI'];
$unique_id = uniqid(mt_rand());
$form = "<br/>";
- $form .= "<form name=\"form_import_{$unique_id}\" id=\"form_import_{$unique_id}\" action=\"{$currentFile}\" method=\"post\" enctype=\"multipart/form-data\">";
+ $form .= "<form name='form_import_{$unique_id}' id='form_import_{$unique_id}' action='{$currentFile}' method='post' enctype='multipart/form-data'>";
$showlimit = str_replace("%s", $start + 1, _AM_XNEWSLETTER_IMPORT_SHOW);
- if ($limitcheck < $importsCount) {
- $showlimit = str_replace("%l", $limitcheck, $showlimit);
+ if ($checkLimit < $importCount) {
+ $showlimit = str_replace("%l", $checkLimit, $showlimit);
} else {
- $showlimit = str_replace("%l", $importsCount, $showlimit);
+ $showlimit = str_replace("%l", $importCount, $showlimit);
}
- $showlimit = str_replace("%n", $importsCount, $showlimit);
+ $showlimit = str_replace("%n", $importCount, $showlimit);
- $form
- .= "
+ $form .= "
+ <h3>" . _AM_XNEWSLETTER_IMPORT_AFTER_READ . "</h3>
<table width='100%' cellspacing='1' class='outer'>
<tr>
<td align='left' colspan='8'>" . $showlimit . "</td>
</tr>";
$class = "odd";
- $form
- .= "
+ $form .= "
<tr>
<th> </th>
<th>" . _AM_XNEWSLETTER_SUBSCR_EMAIL . "</th>
@@ -107,101 +104,86 @@
foreach ($importObjs as $i => $importObj) {
++$counter;
- $form .= "<tr class='{$class}'>";
+ $form .= "<tr class='{$class}' >";
$class = ($class == 'even') ? 'odd' : 'even';
+ // import_id
$form .= "<td>" . $counter;
- $form .= "<input type='hidden' name='import_id_{$counter}' title='import_id_{$counter}' id='import_id_{$counter}' value='" . $importObj->getVar('import_id') . "' />";
+ $form .= "<input type='hidden' name='import_id_{$counter}' title='import_id_{$counter}' id='import_id_{$counter}' value='{$importObj->getVar('import_id')}' />";
$form .= "</td>";
+ // import_email
+ $email_text = new XoopsFormText(_AM_XNEWSLETTER_SUBSCR_EMAIL, "email_{$counter}", 25, 255, $importObj->getVar('import_email'));
+ $email_text->setExtra('disabled=disabled');
$form .= "<td>";
- $form .= "<input type='text' disabled=disabled name='email_{$counter}' title='" . _AM_XNEWSLETTER_SUBSCR_EMAIL . "' id='email_{$counter}' value='" . $importObj->getVar('import_email')
- . "' />";
+ $form .= $email_text->render();
+ unset($email_text);
$form .= "</td>";
-
+ // import_sex
+ $sex_select = new XoopsFormSelect(_AM_XNEWSLETTER_SUBSCR_SEX, "sex_{$counter}", $importObj->getVar('import_sex'), 1, false);
+ $sex_options = array(
+ _AM_XNEWSLETTER_SUBSCR_SEX_EMPTY => _AM_XNEWSLETTER_SUBSCR_SEX_EMPTY,
+ _AM_XNEWSLETTER_SUBSCR_SEX_FEMALE => _AM_XNEWSLETTER_SUBSCR_SEX_FEMALE,
+ _AM_XNEWSLETTER_SUBSCR_SEX_MALE => _AM_XNEWSLETTER_SUBSCR_SEX_MALE,
+ _AM_XNEWSLETTER_SUBSCR_SEX_COMP => _AM_XNEWSLETTER_SUBSCR_SEX_COMP,
+ _AM_XNEWSLETTER_SUBSCR_SEX_FAMILY => _AM_XNEWSLETTER_SUBSCR_SEX_FAMILY
+ );
+ $sex_select->addOptionArray($sex_options);
$form .= "<td>";
- $sex = $importObj->getVar('import_sex');
- $form .= "<select size='1' name='sex_{$counter}' id='sex_{$counter}' title='" . _AM_XNEWSLETTER_SUBSCR_SEX . "' ";
- $form .= "value='" . $sex . "'>";
- $form .= "<option value=''";
- if ($sex == _AM_XNEWSLETTER_SUBSCR_SEX_EMPTY) {
- $form .= " selected='selected'";
- }
- $form .= ">" . _AM_XNEWSLETTER_SUBSCR_SEX_EMPTY . "</option>";
- $form .= "<option value='" . _AM_XNEWSLETTER_SUBSCR_SEX_FEMALE . "'";
- if ($sex == _AM_XNEWSLETTER_SUBSCR_SEX_FEMALE) {
- $form .= " selected='selected'";
- }
- $form .= ">" . _AM_XNEWSLETTER_SUBSCR_SEX_FEMALE . "</option>";
- $form .= "<option value='" . _AM_XNEWSLETTER_SUBSCR_SEX_MALE . "'";
- if ($sex == _AM_XNEWSLETTER_SUBSCR_SEX_MALE) {
- $form .= " selected='selected'";
- }
- $form .= ">" . _AM_XNEWSLETTER_SUBSCR_SEX_MALE . "</option>";
- $form .= "<option value='" . _AM_XNEWSLETTER_SUBSCR_SEX_COMP . "'";
- if ($sex == _AM_XNEWSLETTER_SUBSCR_SEX_COMP) {
- $form .= " selected='selected'";
- }
- $form .= ">" . _AM_XNEWSLETTER_SUBSCR_SEX_COMP . "</option>";
- $form .= "<option value='" . _AM_XNEWSLETTER_SUBSCR_SEX_FAMILY . "'";
- if ($sex == _AM_XNEWSLETTER_SUBSCR_SEX_FAMILY) {
- $form .= " selected='selected'";
- }
- $form .= ">" . _AM_XNEWSLETTER_SUBSCR_SEX_FAMILY . "</option>";
- $form .= "</select>\n";
+ $form .= $sex_select->render();
+ unset($sex_select);
$form .= "</td>";
-
+ // import_firstname
+ $firstname_text = new XoopsFormText(_AM_XNEWSLETTER_SUBSCR_FIRSTNAME, "firstname_{$counter}", 25, 255, $importObj->getVar('import_firstname'));
$form .= "<td>";
- $form .= "<input type='text' name='firstname_{$counter}' title='" . _AM_XNEWSLETTER_SUBSCR_FIRSTNAME . "' id='firstname_{$counter}' value='" . $importObj->getVar("import_firstname")
- . "' />";
+ $form .= $firstname_text->render();
+ unset($firstname_text);
$form .= "</td>";
+ // import_lastname
+ $lastname_text = new XoopsFormText(_AM_XNEWSLETTER_SUBSCR_LASTNAME, "lastname_{$counter}", 25, 255, $importObj->getVar('import_lastname'));
$form .= "<td>";
- $form .= "<input type='text' name='lastname_{$counter}' title='" . _AM_XNEWSLETTER_SUBSCR_LASTNAME . "' id='lastname_{$counter}' value='" . $importObj->getVar("import_lastname")
- . "' />";
+ $form .= $lastname_text->render();
+ unset($lastname_text);
$form .= "</td>";
+ // import_subscr_id
$form .= "<td>";
- $subscr_id = $importObj->getVar("import_subscr_id");
- $form .= "<input type='hidden' name='subscr_id_{$counter}' title='subscr_id' id='subscr_id_{$counter}' value='" . $subscr_id . "' />";
+ $subscr_id = $importObj->getVar('import_subscr_id');
+ $form .= "<input type='hidden' name='subscr_id_{$counter}' title='subscr_id' id='subscr_id_{$counter}' value='{$subscr_id}' />";
if ($subscr_id > 0) {
$form .= "<img src='" . XNEWSLETTER_ICONS_URL . "/xn_ok.png' alt='" . _AM_XNEWSLETTER_IMPORT_EMAIL_EXIST . "' title='" . _AM_XNEWSLETTER_IMPORT_EMAIL_EXIST . "' />";
}
- $form .= "</td>";
+ $form .= " </td>";
+ // import_catsubscr_id
$form .= "<td>";
- $catsubscr_id = $importObj->getVar("import_catsubscr_id");
- $form .= "<input type='hidden' name='catsubscr_id_{$counter}' title='catsubscr_id' id='catsubscr_id_{$counter}' value='" . $catsubscr_id . "' />";
+ $catsubscr_id = $importObj->getVar('import_catsubscr_id');
+ $form .= "<input type='hidden' name='catsubscr_id_{$counter}' title='catsubscr_id' id='catsubscr_id_{$counter}' value='{$catsubscr_id}' />";
if ($catsubscr_id > 0) {
$form .= "<img src='" . XNEWSLETTER_ICONS_URL . "/xn_ok.png' alt='" . _AM_XNEWSLETTER_IMPORT_CATSUBSCR_EXIST . "' title='" . _AM_XNEWSLETTER_IMPORT_CATSUBSCR_EXIST . "' />";
}
- $form .= "</td>";
- $form .= "</td>";
- $form .= "<td>";
- $curr_cat_id = $importObj->getVar("import_cat_id");
- $form .= "<select size='1' name='cat_id_{$counter}' id=\"cat_id_{$counter}' title='cat' ";
- $form .= "value='" . $curr_cat_id . "'>";
- $cat_select = "<option value='0'";
- $cat_select .= ">" . _AM_XNEWSLETTER_IMPORT_NOIMPORT . "</option>";
+ $form .= " </td>";
+ // import_cat_id
+ $cat_id_select = new XoopsFormSelect(_AM_XNEWSLETTER_CAT_NAME, "cat_id_{$counter}", $importObj->getVar('import_cat_id'), 1, false);
+ $cat_id_select->addOption('0', _AM_XNEWSLETTER_IMPORT_NOIMPORT);
foreach ($catObjs as $cat_id => $catObj) {
- $cat_select .= "<option value='" . $cat_id . "'";
- if ($curr_cat_id == $j) {
- $cat_select .= " selected='selected'";
- }
- $cat_select .= ">" . $catObj->getVar("cat_name") . "</option>";
+ $cat_id_select->addOption($cat_id, $catObj->getVar('cat_name'));
}
+ $form .= "<td>";
+ $form .= $cat_id_select->render();
+ unset($cat_id_select);
+ $form .= "</td>";
- $form .= $cat_select;
- $form .= "</select>\n";
-
- $form .= "</td>";
$form .= "</tr>";
}
$form .= "<tr class='{$class}'>";
$class = ($class == 'even') ? 'odd' : 'even';
$form .= "<td colspan='8'>";
$form .= "<input type='hidden' name='counter' title='counter' id='counter' value='{$counter}' />";
- $form .= "<input type='hidden' name='limitcheck' title='limitcheck' id='limitcheck' value='" . $limitcheck . "' />";
+ $form .= "<input type='hidden' name='checkLimit' title='checkLimit' id='checkLimit' value='" . $checkLimit . "' />";
$form .= "<input type='hidden' name='op' title='op' id='op' value='apply_import_form' />";
$form .= "<input type='submit' class='formButton' name='submit' id='submit' value='" . _AM_XNEWSLETTER_IMPORT_EXEC . "' title='" . _AM_XNEWSLETTER_IMPORT_EXEC . "' />";
- $form .= "</td></tr>";
+ $form .= "</td>";
+ $form .= "</tr>";
- $form .= "</table></form>";
+ $form .= "</table>";
+ $form .= "</form>";
echo $form;
}
break;
@@ -209,50 +191,47 @@
case 'apply_import_form':
//update xnewsletter with settings form_import
$counter = xnewsletterRequest::getInt('counter', 0);
-
for ($i = 1; $i < ($counter + 1); ++$i) {
$import_id = xnewsletterRequest::getString("import_id_{$i}", 'default');
$subscr_firstname = xnewsletterRequest::getString("firstname_{$i}", '');
$subscr_lastname = xnewsletterRequest::getString("lastname_{$i}", '');
$subscr_sex = xnewsletterRequest::getString("sex_{$i}", '');
$cat_id = xnewsletterRequest::getInt("cat_id_{$i}", 0);
-
if ($cat_id > 0) {
if ($subscr_id == 0) {
//update sex, firstname, lastname
$sql = "UPDATE {$GLOBALS['xoopsDB']->prefix('xnewsletter_import')}";
- $sql .= " SET `import_sex`='{$subscr_sex}', `import_firstname`='{$subscr_firstname}', `import_lastname`='{$subscr_lastname}'";
+ $sql .= " SET `import_sex` = '{$subscr_sex}', `import_firstname` = '{$subscr_firstname}', `import_lastname` = '{$subscr_lastname}'";
$sql .= " WHERE `import_id`={$import_id}";
$result = $GLOBALS['xoopsDB']->queryF($sql);
}
}
//update cat_id and...
[truncated message content] |
|
From: <luc...@us...> - 2014-12-13 17:45:21
|
Revision: 12904
http://sourceforge.net/p/xoops/svn/12904
Author: luciorota
Date: 2014-12-13 17:45:11 +0000 (Sat, 13 Dec 2014)
Log Message:
-----------
administrator can run the cron.php script from administrative tasks page
update help files adding new features
Modified Paths:
--------------
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/task.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/cron.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/language/english/admin.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/language/english/help/help.html
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/language/english/modinfo.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/xoops_version.php
Added Paths:
-----------
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/language/english/help/help3.html
Modified: XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/task.php
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/task.php 2014-12-13 15:49:41 UTC (rev 12903)
+++ XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/task.php 2014-12-13 17:45:11 UTC (rev 12904)
@@ -46,8 +46,10 @@
$taskAdmin->addItemButton(_AM_XNEWSLETTER_TASK_SHOW_ALL, '?op=list_tasks', 'view_detailed');
}
$taskCount = $xnewsletter->getHandler('task')->getCount();
- if ($taskCount) {
+ if ($taskCount > 0) {
+ $taskAdmin->addItemButton(_AM_XNEWSLETTER_TASK_RUN_CRON_NOW, '?op=run_cron_now', 'exec');
$taskAdmin->addItemButton(_AM_XNEWSLETTER_TASK_DELETE_ALL, '?op=delete_tasks', 'delete');
+
}
echo $taskAdmin->renderButton();
//
@@ -255,7 +257,7 @@
xoops_cp_header();
// render confirm form
xoops_confirm(
- array('ok' => true, 'task_id' => $task_id, 'op' => 'delete_task'),
+ array('ok' => true, 'op' => 'delete_task', 'task_id' => $task_id),
$_SERVER['REQUEST_URI'],
sprintf(_AM_XNEWSLETTER_FORMSUREDEL, $taskObj->getVar('task'))
);
@@ -306,4 +308,31 @@
include_once __DIR__ . '/admin_footer.php';
}
break;
+
+ case 'run_cron_now':
+ if (xnewsletterRequest::getBool('ok', false, 'POST') == true) {
+ if (!$GLOBALS['xoopsSecurity']->check()) {
+ redirect_header($currentFile, 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors()));
+ }
+ // render start here
+ xoops_cp_header();
+ include_once XOOPS_ROOT_PATH . '/modules/xnewsletter/include/functions.task.php';
+ // execute all pending tasks
+ $result_exec = xnewsletter_executeTasks($xnewsletter->getConfig('xn_send_in_packages'), 0);
+ if ($result_exec != '') {
+ $newsletter->getHandler('protocol')->protocol(0, 0, 'Cron: ' . $result_exec, _XNEWSLETTER_PROTOCOL_STATUS_CRON, array('%result_exec' => $result_exec), true);
+ }
+ redirect_header($currentFile, 3, "result cron: {$result_exec}");
+ } else {
+ // render start here
+ xoops_cp_header();
+ // render confirm form
+ xoops_confirm(
+ array('ok' => true, $task_id, 'op' => 'run_cron_now'),
+ $_SERVER['REQUEST_URI'],
+ _AM_XNEWSLETTER_FORMSURERUNCRONNOW
+ );
+ include_once __DIR__ . '/admin_footer.php';
+ }
+ break;
}
Modified: XoopsModules/xnewsletter/branches/luciorota/xnewsletter/cron.php
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xnewsletter/cron.php 2014-12-13 15:49:41 UTC (rev 12903)
+++ XoopsModules/xnewsletter/branches/luciorota/xnewsletter/cron.php 2014-12-13 17:45:11 UTC (rev 12904)
@@ -38,24 +38,5 @@
if ($result_exec != '') {
$newsletter->getHandler('protocol')->protocol(0, 0, 'Cron: ' . $result_exec, _XNEWSLETTER_PROTOCOL_STATUS_CRON, array('%result_exec' => $result_exec), true);
-/*
- // you can enable the block for creating protocol for cron
- $protocolObj = $xnewsletter->getHandler('protocol')->create();
- $protocolObj->setVar('protocol_letter_id', 0);
- $protocolObj->setVar('protocol_subscriber_id', 0);
- $protocolObj->setVar('protocol_status', 'Cron: ' . $result_exec); // old style
- $protocolObj->setVar('protocol_status_str_id', _XNEWSLETTER_PROTOCOL_STATUS_CRON); // new from v1.3
- $protocolObj->setVar('protocol_status_vars', array('%result_exec' => $result_exec)); // new from v1.3
- $protocolObj->setVar('protocol_success', true);
- $protocolObj->setVar('protocol_submitter', 0);
- $protocolObj->setVar('protocol_created', time());
-
- if ($xnewsletter->getHandler('protocol')->insert($protocolObj)) {
- // create protocol is ok
- // NOP
- } else {
- echo $protocolObj->getHtmlErrors();
- }
-*/
}
echo "<br/>result cron: {$result_exec}";
Modified: XoopsModules/xnewsletter/branches/luciorota/xnewsletter/language/english/admin.php
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xnewsletter/language/english/admin.php 2014-12-13 15:49:41 UTC (rev 12903)
+++ XoopsModules/xnewsletter/branches/luciorota/xnewsletter/language/english/admin.php 2014-12-13 17:45:11 UTC (rev 12904)
@@ -405,15 +405,15 @@
<br /><br />
Available smarty-vars are:
<ul>
- <li><{$salutation}> or <{$sex}>: the subscriber Salutation field</li>
- <li><{$firstname}>: the subscriber First name field</li>
- <li><{$lastname}>: the subscriber Last name field</li>
- <li><{$email}> or <{$subscr_email}>: the subscriber Email field</li>
+ <li><{$salutation}> or <{$sex}>: the subscriber "Salutation" (subscr_sex) field</li>
+ <li><{$firstname}>: the subscriber "First name" (subscr_firstname) field</li>
+ <li><{$lastname}>: the subscriber "Last name" (subscr_lastname) field</li>
+ <li><{$email}> or <{$subscr_email}>: the subscriber "Email" (subscr_email) field</li>
</ul>
<ul>
- <li><{$letter_id}>: the newsletter id</li>
- <li><{$title}>: the newsletter Title field</li>
- <li><{$content}>: the newsletter Content field</li>
+ <li><{$letter_id}>: the newsletter "id" (letter_id) field</li>
+ <li><{$title}>: the newsletter "Title" (letter_title) field</li>
+ <li><{$content}>: the newsletter "Content" (letter_content) field</li>
<li><{$attachments}>: attachments array
<br />
<span style="font-size:0.9em">
@@ -512,7 +512,10 @@
define('_AM_XNEWSLETTER_TASK_ACTIONS_EXECUTE', "Execute now");
define('_AM_XNEWSLETTER_TASK_SHOW_ALL', "Show all");
define('_AM_XNEWSLETTER_TASK_DELETE_ALL', "Delete all tasks");
+define('_AM_XNEWSLETTER_TASK_RUN_CRON_NOW', "Execute now "cron.php"");
+define('_AM_XNEWSLETTER_FORMSURERUNCRONNOW', "Are you sure you want to execute: <span class='bold red'>"cron.php"</span>");
+
//Buttons
define('_AM_XNEWSLETTER_NEWTEMPLATE', "Add New Template");
define('_AM_XNEWSLETTER_TEMPLATELIST', "List Template");
Modified: XoopsModules/xnewsletter/branches/luciorota/xnewsletter/language/english/help/help.html
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xnewsletter/language/english/help/help.html 2014-12-13 15:49:41 UTC (rev 12903)
+++ XoopsModules/xnewsletter/branches/luciorota/xnewsletter/language/english/help/help.html 2014-12-13 17:45:11 UTC (rev 12904)
@@ -44,196 +44,14 @@
- Newsletter are based on templates<br />
- Detailed handling of permissions for groups and newsletter (subscribe, write, send)<br />
- Send: send test mail, resend to all subscribers or only to subscribers, where sending failed<br />
- - Sending newsletters to unlimited number of recipients or in packages with certain number of recipients by using cronjob<br />
+ - Sending newsletters to unlimited number of recipients or in packages with certain number of recipients by using <a href="http://en.wikipedia.org/wiki/Cron">cronjob</a><br />
- Bounced email handler for handling Bounced emails in case of invalid e-mail-addresses<br />
- - Optionally synchronisation with mailing lists (e.g. majordomo)<br />
+ - Optionally synchronisation with mailing lists (e.g. <a href="http://en.wikipedia.org/wiki/Majordomo_%28software%29">majordomo</a>)<br />
- Maintenance function included<br />
- Creating protocol for the important steps<br />
<br />
</p>
- <h4 class="odd">Install/uninstall</h4>
- <p class="even">
- No special measures necessary, follow the standard installation process - extract the /xnewsletter folder into the
- ../modules directory. Install the module through Admin -> Modules. If you need detailed
- instructions on how to install a module, please see the <a href="http://goo.gl/adT2i">XOOPS Operations
- Manual</a>.<br /><br /></p>
- <h4 class="odd">Tutorial</h4>
- <!-- -----Help Content ---------- -->
-
-
-
<h5 class="odd">Basic information</h5>
- <p class="even">The module is based on PHPMailer and PHPMailer-BMH
+ <p class="even">The module is based on <a href="https://github.com/PHPMailer/PHPMailer">PHPMailer</a> and <a href="http://phpmailer.worxware.com/index.php?pg=bmh">PHPMailer-BMH</a>.
<br /><br /></p>
-
- <h5 class="odd">(Un) subscriptions to newsletters</h5>
- <p class="even">
- You can define for each newsletter and for each group, whether for (un) subscription or change a confirmation email with activation key is necessary or not (use double-option).<br />
- <br /><br /></p>
-
- <h5 class="odd">Accounts</h5>
- <p class="even">
- You can use one or more email-account; sending with php mail, php sendmail, smtp is possible.<br />
- There is a feature for testing pop3 and imap accounts.<br />
- <br />
- Pay attention: functions like testing account, sending emails, start Bounced email handler,... work not with local server (you get white page without any error).<br />
- <br /><br /></p>
-
- <h5 class="odd">Newsletter categories</h5>
- <p class="even">
- You can handle one or more newsletter categories.<br />
- It is possible to set permissions "read", "create", "admin" and "list subscribers" for each newsletter cat.<br />
- <br /><br /></p>
-
- <h5 class="odd">Create a newsletter</h5>
- <p class="even">
- The newsletter can be created with each text editor which is installed in current xoops core (e.g. TinyMCE). <br />
- For each newsletter you can use different templates (see also 'Newsletter templates').<br />
- You can define one or more newsletter categories for your newsletter.<br />
- You can add 5 files maximum as attachment to each newsletter.<br /><br />
- Optionally you can also copy an older newsletter and edit or send it as a new one.<br /><br />
- The type of text editor, allows mime-types and size of mail attachments can be set in module preferences.<br />
- <br /><br /></p>
-
- <h5 class="odd">Newsletter templates</h5>
- <p class="even">
- The newsletters are template based.<br />
- The templates are stored as files in language/{yourlanguage}/templates or stored in database.<br />
- To create a new template you can:
- <ol>
- <li>make a new template html-file in in language/{yourlanguage}/templates folder and to put in the smarty-vars;</li>
- <li>from admin side create a new template item and to put in the smarty-vars.</li>
- </ol>
- <br />
- This module uses the Xoops <a href="http://www.smarty.net/">Smarty template engine</a> to render the email letter.<br /><br />
- Available smarty-vars are:
- <ul>
- <li><{$salutation}> or <{$sex}>: the subscriber Salutation field</li>
- <li><{$firstname}>: the subscriber First name field</li>
- <li><{$lastname}>: the subscriber Last name field</li>
- <li><{$email}> or <{$subscr_email}>: the subscriber Email field</li>
- </ul>
- <ul>
- <li><{$title}>: the newsletter Title field</li>
- <li><{$content}>: the newsletter Content field</li>
- </ul>
- <ul>
- <li><{$date}>: the sending date as timestamp integer <br /><span style="font-size:0.9em">(e.g.: <{$date|date_format:"%Y/%m/%d"}> will output the date formatted as 2001/01/04)</span></li>
- <li><{$unsubscribe_url}>: the unsubscribe url</li>
- </ul>
- <ul>
- <ul>
- <li><{$xoops_url}>: the site main url (e.g. http://localhost/)</li>
- <li><{$xoops_langcode}>: the site langcode (e.g. en)</li>
- <li><{$xoops_charset}>: the site cherset (e.g. UTF-8)</li>
- </ul>
- <br /><br /></p>
-
- <h5 class="odd">Sending newsletter</h5>
- <p class="even">
- You can show a preview of a newsletter before sending.<br />
- You can send the newsletter for testing to a defined email-address.<br />
- The newsletters will be sent subscriber by subscriber.<br />
- For each sending action a protocol will be created.<br />
- If one or more send failed, you can see it in the protocol.<br />
- You can restart sending procedure. You can send it again to all subscribers or send it only to the subscribers, where sending procedure failed).<br />
- <br />
- You can send all emails immediately or limit emails send in one package.<br />
- The number of emails and the minutes until next sending can be defined in module preferences (e.g. 200 emails all 60 minutes).<br />
- The first package will be sent immediately. To start the next sending procedure you need an external cronjob, which is calling "../modules/xnewsletter/cron.php". Xoops cannot do this with current version (2.5.5).<br />
- <br />
- Pay attention: functions like testing account, sending emails, start Bounced email handler,... work not with local server (you get white page).<br />
- <br /><br /></p>
-
- <h5 class="odd">Task list</h5>
- <p class="even">
- If you limit emails send in one package, you can see all newsletters waiting for next cronjob and the time, when cronjob can send the newsletter.<br />
- If you do not use this option, this list must always be empty.<br />
- Normally the tab "Task list" is hidden, if this option is disabled.<br />
- <br /><br /></p>
-
- <h5 class="odd">Handle mailing lists</h5>
- <p class="even">
- If you have an existing mailing list, you can synchronize the (un) subscriptions of one newsletter category with one mailing list.<br />
- I use majordomo beside this newsletter module because then I can also send an email from my email-client to the newsletter recipients.<br />
- One of the disadvantages of mailing lists is, that, if one person is registered in two or more mailing lists and you send a one newsletter to all mailing lists, this person gets the same newsletter more than one time. With xNewsletter he gets only one newsletter.<br />
- <br />
- <br />Normally the tab "Mailing list" is hidden, if this option is disabled.<br />
- <br />
- <b>xNewsletter cannot create mailing lists</b>.
- <br /><br /></p>
-
- <h5 class="odd">Bounced email handler (BMH)</h5>
- <p class="even">
- If you send newsletters, there will always be some emails not delivered to recipient (Bounced email), because email is no more valid, mailbox is full, and so on.<br />
- To handle this event and to react on this, you can use BMH.<br />
- You can activate BMH for each account.<br />
- Mails, which are detected as Bounced emails by BMH, can be deleted or moved in a special folder, you have to define.<br />
- Possible actions for Bounced emails:<br />
- -- no action (only store)<br />
- -- quit temporary the subscriptions of this email-address<br />
- -- delete the subscriptions of this email-address<br />
- <br />
- <br />
- <h6 class="odd">Types of Bounced emails</h6>
- <span style="text-decoration: underline;">bounce type hard:</span>
- This means that there is a permanent error when sending a mail, e.g. unknown recipient, unknown domain, and so on.<br />
- This mails will be deleted after detection, so it is recommended using the move hard option (the email will be only moved in this folder, you can check this mail later, if you want).<br />
- <br />
- <span style="text-decoration: underline;">bounce type soft:</span><br />
- This means that there is a temporary problem with sending a mail, e.g. mailbox full, server not available, and so on.<br />
- This mails will not be deleted after detection, but it is recommended using the move soft option in order to keep your basic in box clean.<br />
- <br />
- Pay attention: functions like testing account, sending emails, start Bounced email handler,... work not with local server (you get white page).<br />
- <br /><br /></p>
-
- <h5 class="odd">Maintenance</h5>
- <p class="even">
- This module has a maintain function, which can repair several faults in the data.<br />
- <br /><br /></p>
-
- <h5 class="odd">Import</h5>
- <p class="even">
- You can import data with various plug-ins:
- <ul>
- <li>csv</li>
- <li>module rmbulletin</li>
- <li>module smartpartner</li>
- <li>module weblinks</li>
- <li>module evennews</li>
- <li>module subscribers</li>
- <li>users from xoops users</li>
- </ul>
- The import tool works in this way:<br />
- - Adding email to the list of subscribers<br />
- - Subscribe this email to one newsletter cat<br />
- Before you run import tool therefore, please create first minimum one newsletter cat, otherwise the email cannot be subscribed to a cat and the import fails.<br />
- You have the possibility<br />
- - to import the E-Mail-Addresses without any check (recommended for big import data sets) or<br />
- - after reading data you can decide for each email<br />
- -- whether you want to make a subscription or not<br />
- -- to which newsletter you want to make the subscription<br />
- If an email is already registered, import of this email should be skipped (default action, do not touch existing registrations).
- <br />
- Sample files (sample1col.csv, sample4col.csv) for csv-import you can find in ../xnewsletter/plugins/
- <br /><br />
- <b>Attention:</b>In case of registrations/subscription with this import tool there will not be sent an email notification to the email owner.<br />
- <br /><br />
- <b>Importation of big email lists:</b><br />
- To avoid cache overflow during importation, there are two limits:<br />
- - first limit: only 100000 lines (e.g. of a csv-file) can be stored in temporary import table<br />
- - second limit: you can finally import data from temporary import table in packages of max. 25000<br />
- <br />
- For import of more than 100k emails following procedure can be done:<br />
- - run first import email 1 to 100000
- - import finally emails in packages of 25k
- - run second import emails 100001 to 200000 (select option "skip existing subscriptions")
- - import finally in packages of 25k
- and so on.<br />
- If file size is not too big to upload, you can repeat as often you want.<br />
- <br /><br />
- If you get somewhere a white page, it is no problem because if option "skip existing subscriptions" is selected the import procedure restart at the first not imported email-address.<br />
- Reduce number of importing emails or package size and try again.<br />
- <br /><br /></p>
-
</div>
Added: XoopsModules/xnewsletter/branches/luciorota/xnewsletter/language/english/help/help3.html
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xnewsletter/language/english/help/help3.html (rev 0)
+++ XoopsModules/xnewsletter/branches/luciorota/xnewsletter/language/english/help/help3.html 2014-12-13 17:45:11 UTC (rev 12904)
@@ -0,0 +1,232 @@
+<?php
+/**
+ * ****************************************************************************
+ * - A Project by Developers TEAM For Xoops - ( http://www.xoops.org )
+ * ****************************************************************************
+ * XNEWSLETTER - MODULE FOR XOOPS
+ * Copyright (c) 2007 - 2012
+ * goffy ( )
+ *
+ * You may not change or alter any portion of this comment or credits
+ * of supporting developers from this source code or any supporting
+ * source code which is considered copyrighted (c) material of the
+ * original comment or credit authors.
+ *
+ * This program 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.
+ * ---------------------------------------------------------------------------
+ * @copyright goffy ( )
+ * @license gpl 2.0
+ * @package xnewsletter
+ * @author goffy ( )
+ *
+ * Version : 1 Mon 2012/11/05 14:31:32 : Exp $
+ * ****************************************************************************
+ */
+
+<div id="help-template" class="outer">
+ <h1 class="head">Help:
+ <a class="ui-corner-all tooltip" href="<{$xoops_url}>/modules/xnewsletter/admin/index.php"
+ title="Back to the administration of xNewsletter"> xNewsletter <img src="<{xoAdminIcons home.png}>"
+ alt="Back to the Administration of xNewsletter"/>
+ </a></h1>
+ <!-- -----Help Content ---------- -->
+ <h4 class="odd">Tutorial</h4>
+ <h5 class="odd">(Un) subscriptions to newsletters</h5>
+ <p class="even">
+ You can define for each newsletter and for each group, whether for (un) subscription or change a confirmation email with activation key is necessary or not (use double-option).<br />
+ <br /><br /></p>
+
+ <h5 class="odd">Accounts</h5>
+ <p class="even">
+ You can use one or more email-account; sending with php mail, php sendmail, smtp is possible.<br />
+ There is a feature for testing pop3 and imap accounts.<br />
+ <br />
+ Pay attention: functions like testing account, sending emails, start Bounced email handler,... work not with local server (you get white page without any error).<br />
+ <br /><br /></p>
+
+ <h5 class="odd">Newsletter categories</h5>
+ <p class="even">
+ You can handle one or more newsletter categories.<br />
+ It is possible to set permissions "read", "create", "admin" and "list subscribers" for each newsletter cat.<br />
+ <br /><br /></p>
+
+ <h5 class="odd">Create a newsletter</h5>
+ <p class="even">
+ The newsletter can be created with each text editor which is installed in current xoops core (e.g. TinyMCE). <br />
+ For each newsletter you can use different templates (see also 'Newsletter templates').<br />
+ You can define one or more newsletter categories for your newsletter.<br />
+ You can add files (as attachment or as link) to each newsletter (max number, size and type of attachments can be set in module preferences).<br /><br />
+ Optionally you can also copy an older newsletter and edit or send it as a new one.
+ <br /><br /></p>
+
+ <h5 class="odd">Newsletter templates</h5>
+ <p class="even">
+ The newsletters are template based.<br />
+ The templates are stored as files in language/{yourlanguage}/templates or stored in database.<br />
+ To create a new template you can:
+ <ol>
+ <li>make a new template html-file in in language/{yourlanguage}/templates folder and to put in the smarty-vars;</li>
+ <li>from admin side create a new template item and to put in the smarty-vars.</li>
+ </ol>
+ <br />
+ This module uses the Xoops <a href="http://www.smarty.net/">Smarty template engine</a> to render the email letter.<br /><br />
+ Available smarty-vars are:
+ <ul>
+ <li><{$salutation}> or <{$sex}>: the subscriber "Salutation" (subscr_sex) field</li>
+ <li><{$firstname}>: the subscriber "First name" (subscr_firstname) field</li>
+ <li><{$lastname}>: the subscriber "Last name" (subscr_lastname) field</li>
+ <li><{$email}> or <{$subscr_email}>: the subscriber "Email" (subscr_email) field</li>
+ </ul>
+ <ul>
+ <li><{$letter_id}>: the newsletter "id" (letter_id) field</li>
+ <li><{$title}>: the newsletter "Title" (letter_title) field</li>
+ <li><{$content}>: the newsletter "Content" (letter_content) field</li>
+ <li><{$attachments}>: attachments array
+ <br />
+ <span style="font-size:0.9em">
+ e.g.:
+ <br>
+ <ul>
+ <br>
+ <{foreach item="attachment" from=$attachments}>
+ <br>
+ <li><a href="<{$attachment.attachment_url}>"><{$attachment.attachment_name}></a></li>
+ <br>
+ <{/foreach}>
+ <br>
+ </ul>
+ <br>
+ will output the linked attachments list
+ </span>
+ </li>
+ </ul>
+ <ul>
+ <li><{$date}>: the sending date as timestamp integer
+ <br />
+ <span style="font-size:0.9em">
+ e.g.:
+ <br>
+ <{$date|date_format:"%Y/%m/%d"}> will output the date formatted as php fuction date('Y/m/d', $date)
+ </span>
+ </li>
+ <li><{$unsubscribe_url}>: the unsubscribe url</li>
+ </ul>
+ <ul>
+ <li><{$xoops_url}>: the site main url (e.g. http://localhost/)</li>
+ <li><{$xoops_langcode}>: the site langcode (e.g. en)</li>
+ <li><{$xoops_charset}>: the site cherset (e.g. UTF-8)</li>
+ </ul>
+ <br /><br /></p>
+
+ <h5 class="odd">Sending newsletter</h5>
+ <p class="even">
+ You can show a preview of a newsletter before sending.<br />
+ You can send the newsletter for testing to a defined email-address.<br />
+ The newsletters will be sent subscriber by subscriber.<br />
+ For each sending action a protocol will be created.<br />
+ If one or more send failed, you can see it in the protocol.<br />
+ You can restart sending procedure. You can send it again to all subscribers or send it only to the subscribers, where sending procedure failed).<br />
+ <br />
+ You can send all emails immediately or limit emails send in one package.<br />
+ The number of emails and the minutes until next sending can be defined in module preferences (e.g. 200 emails all 60 minutes).<br />
+ The first package will be sent immediately. To start the next sending procedure you need an external cronjob, which is calling "../modules/xnewsletter/cron.php". Xoops cannot do this.
+ Is also possible to call "../modules/xnewsletter/cron.php" from administrative Tasks page.<br />
+ <br />
+ Pay attention: functions like testing account, sending emails, start Bounced email handler,... work not with local server (you get white page).<br />
+ <br /><br /></p>
+
+ <h5 class="odd">Task list</h5>
+ <p class="even">
+ If you limit emails send in one package, you can see all newsletters waiting for next cronjob and the time, when cronjob can send the newsletter.<br />
+ If you do not use this option, this list must always be empty.<br />
+ Normally the tab "Task list" is hidden, if this option is disabled.<br />
+ <br /><br /></p>
+
+ <h5 class="odd">Handle mailing lists</h5>
+ <p class="even">
+ If you have an existing mailing list, you can synchronize the (un) subscriptions of one newsletter category with one mailing list.<br />
+ I use majordomo beside this newsletter module because then I can also send an email from my email-client to the newsletter recipients.<br />
+ One of the disadvantages of mailing lists is, that, if one person is registered in two or more mailing lists and you send a one newsletter to all mailing lists, this person gets the same newsletter more than one time. With xNewsletter he gets only one newsletter.<br />
+ <br />
+ <br />Normally the tab "Mailing list" is hidden, if this option is disabled.<br />
+ <br />
+ <b>xNewsletter cannot create mailing lists</b>.
+ <br /><br /></p>
+
+ <h5 class="odd">Bounced email handler (BMH)</h5>
+ <p class="even">
+ If you send newsletters, there will always be some emails not delivered to recipient (Bounced email), because email is no more valid, mailbox is full, and so on.<br />
+ To handle this event and to react on this, you can use BMH.<br />
+ You can activate BMH for each account.<br />
+ Mails, which are detected as Bounced emails by BMH, can be deleted or moved in a special folder, you have to define.<br />
+ Possible actions for Bounced emails:<br />
+ -- no action (only store)<br />
+ -- quit temporary the subscriptions of this email-address<br />
+ -- delete the subscriptions of this email-address<br />
+ <br />
+ <br />
+ <h6 class="odd">Types of Bounced emails</h6>
+ <span style="text-decoration: underline;">bounce type hard:</span>
+ This means that there is a permanent error when sending a mail, e.g. unknown recipient, unknown domain, and so on.<br />
+ This mails will be deleted after detection, so it is recommended using the move hard option (the email will be only moved in this folder, you can check this mail later, if you want).<br />
+ <br />
+ <span style="text-decoration: underline;">bounce type soft:</span><br />
+ This means that there is a temporary problem with sending a mail, e.g. mailbox full, server not available, and so on.<br />
+ This mails will no...
[truncated message content] |
|
From: <luc...@us...> - 2014-12-16 22:28:21
|
Revision: 12907
http://sourceforge.net/p/xoops/svn/12907
Author: luciorota
Date: 2014-12-16 22:28:16 +0000 (Tue, 16 Dec 2014)
Log Message:
-----------
min req xoops 2.5.7.1
use XoopsRequest class
Modified Paths:
--------------
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/accounts.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/attachment.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/bmh.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/cat.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/catsubscr.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/import.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/letter.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/mailinglist.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/maintenance.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/menu.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/protocol.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/sendletter.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/subscr.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/task.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/template.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/attachment.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/session.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/cron.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/common.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/functions.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/functions.task.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/index.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/language/english/admin.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/language/english/modinfo.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/letter.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/print.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/protocol.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/sendletter.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/subscription.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/templates/admin/xnewsletter_admin_attachments_list.tpl
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/templates/admin/xnewsletter_admin_letters_list.tpl
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/templates/admin/xnewsletter_admin_protocols_list.tpl
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/templates/admin/xnewsletter_admin_tasks_list.tpl
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/templates/xnewsletter_empty.tpl
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/xoops_version.php
Removed Paths:
-------------
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/breadcrumb.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/request.php
Modified: XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/accounts.php
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/accounts.php 2014-12-14 11:04:17 UTC (rev 12906)
+++ XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/accounts.php 2014-12-16 22:28:16 UTC (rev 12907)
@@ -29,13 +29,13 @@
$currentFile = basename(__FILE__);
include_once __DIR__ . '/admin_header.php';
-xoops_cp_header();
// We recovered the value of the argument op in the URL$
-$op = xnewsletterRequest::getString('op', 'list');
-$save_and_check = xnewsletterRequest::getString('save_and_check', 'none');
-$accounts_id = xnewsletterRequest::getInt('accounts_id', 0);
-$post = xnewsletterRequest::getString('post', '');
+$op = XoopsRequest::getString('op', 'list');
+$accounts_id = XoopsRequest::getInt('accounts_id', 0);
+$save_and_check = XoopsRequest::getString('save_and_check', 'none');
+$accounts_id = XoopsRequest::getInt('accounts_id', 0);
+$post = XoopsRequest::getString('post', '');
if ($post == '' && $op == 'save_accounts' && $save_and_check == 'none') {
$op = "edit_account";
@@ -43,6 +43,9 @@
switch ($op) {
case 'check_account':
+ // render start here
+ xoops_cp_header();
+ // render submenu
echo $indexAdmin->addNavigation($currentFile);
$indexAdmin->addItemButton(_AM_XNEWSLETTER_ACCOUNTSLIST, '?op=list', 'list');
echo $indexAdmin->renderButton();
@@ -54,7 +57,7 @@
}
$mailhost = $accountObj->getVar('accounts_server_in');
- $port = $accountObj->getVar('accounts_port_in');
+ $port = $accountObj->getVar('accounts_port_in');
switch ($accountObj->getVar('accounts_type')) {
case _XNEWSLETTER_ACCOUNTS_TYPE_VAL_POP3:
$service = 'pop3';
@@ -92,8 +95,7 @@
echo " <th>" . _AM_XNEWSLETTER_ACCOUNTS_CHECK . "</th>";
echo " <th>" . _AM_XNEWSLETTER_ACCOUNTS_CHECK_INFO . "</th>";
echo "</tr>";
-
- $mbox = @imap_open("{" . $command . "}", $accounts_username, $accounts_password); // or die ("can't connect: " . imap_last_error());
+ $mbox = @imap_open('{' . $command . '}', $accounts_username, $accounts_password); // or die ("can't connect: " . imap_last_error());
if ($mbox === false) {
echo "<tr>";
echo "<td>" . XNEWSLETTER_IMG_FAILED . "</td>";
@@ -107,7 +109,7 @@
echo "<td></td>";
echo "</tr>";
- $folders = imap_listmailbox($mbox, "{" . $command . "}", "*");
+ $folders = imap_listmailbox($mbox, '{' . $command . '}', '*');
if ($folders == false) {
echo "<tr>";
echo "<td>" . XNEWSLETTER_IMG_FAILED . "</td>";
@@ -125,17 +127,17 @@
$foldercreated = 0;
while (list($key, $val) = each($folders)) {
echo "($key) ";
- echo imap_utf7_decode(str_replace("{" . $command . "}", '', $val)) . "<br>\n";
- if ("{" . $command . "}" . $accounts_inbox == $val) {
+ echo imap_utf7_decode(str_replace('{' . $command . '}', '', $val)) . "<br>\n";
+ if ('{' . $command . '}' . $accounts_inbox == $val) {
$accounts_inbox_ok = true;
}
- if ("{" . $command . "}" . $accounts_hardbox == $val) {
+ if ('{' . $command . '}' . $accounts_hardbox == $val) {
$accounts_hardbox_ok = true;
} else {
@imap_createmailbox($mbox, imap_utf7_encode('{' . $command . '}' . $accounts_hardbox));
$foldercreated = 1;
}
- if ("{" . $command . "}" . $accounts_softbox == $val) {
+ if ('{' . $command . '}' . $accounts_softbox == $val) {
$accounts_softbox_ok = true;
} else {
@imap_createmailbox($mbox, imap_utf7_encode('{' . $command . '}' . $accounts_softbox));
@@ -143,12 +145,12 @@
}
}
if ($foldercreated == 1) {
- $folders_recheck = imap_listmailbox($mbox, "{" . $command . "}", "*");
+ $folders_recheck = imap_listmailbox($mbox, '{' . $command . '}', '*');
while (list($key, $val) = each($folders_recheck)) {
- if ("{" . $command . "}" . $accounts_hardbox == $val) {
+ if ('{' . $command . '}' . $accounts_hardbox == $val) {
$accounts_hardbox_ok = true;
}
- if ("{" . $command . "}" . $accounts_softbox == $val) {
+ if ('{' . $command . '}' . $accounts_softbox == $val) {
$accounts_softbox_ok = true;
}
}
@@ -203,18 +205,23 @@
case 'list':
case 'list_accounts':
default:
+ // render start here
+ xoops_cp_header();
+ // render submenu
echo $indexAdmin->addNavigation($currentFile);
$indexAdmin->addItemButton(_AM_XNEWSLETTER_NEWACCOUNTS, '?op=new_account', 'add');
echo $indexAdmin->renderButton();
//
- $limit = $xnewsletter->getConfig('adminperpage');
$accountsCriteria = new CriteriaCompo();
- $accountsCriteria->setSort("accounts_id ASC, accounts_type");
- $accountsCriteria->setOrder("ASC");
+ $accountsCriteria->setSort('accounts_id ASC, accounts_type');
+ $accountsCriteria->setOrder('ASC');
$accountsCount = $xnewsletter->getHandler('accounts')->getCount();
- $start = xnewsletterRequest::getInt('start', 0);
+ //
+ $start = XoopsRequest::getInt('start', 0);
+ $limit = $xnewsletter->getConfig('adminperpage');
$accountsCriteria->setStart($start);
$accountsCriteria->setLimit($limit);
+ //
$accountsObjs = $xnewsletter->getHandler('accounts')->getAll($accountsCriteria);
if ($accountsCount > $limit) {
include_once XOOPS_ROOT_PATH . '/class/pagenav.php';
@@ -223,7 +230,6 @@
} else {
$pagenav = '';
}
-
// View Table
echo "<table class='outer width100' cellspacing='1'>";
echo "<tr>";
@@ -235,7 +241,6 @@
echo " <th>" . _AM_XNEWSLETTER_ACCOUNTS_DEFAULT . "</th>";
echo " <th>" . _AM_XNEWSLETTER_FORMACTION . "</th>";
echo "</tr>";
-
if ($accountsCount > 0) {
$class = 'odd';
foreach ($accountsObjs as $accounts_id => $accountsObj) {
@@ -255,7 +260,6 @@
echo "<td>{$accountsObj->getVar('accounts_yourmail')}</td>";
$verif_accounts_default = ($accountsObj->getVar('accounts_default') == 1) ? _YES : _NO;
echo "<td class='center'>{$verif_accounts_default}</td>";
-
echo "<td class='center'>";
echo " <a href='?op=edit_account&accounts_id={$accounts_id}'><img src=" . XNEWSLETTER_ICONS_URL . "/xn_edit.png alt='" . _EDIT . "' title='" . _EDIT . "' /></a>";
echo " <a href='?op=delete_account&accounts_id={$accounts_id}'><img src=" . XNEWSLETTER_ICONS_URL . "/xn_delete.png alt='" . _DELETE . "' title='" . _DELETE . "' /></a>";
@@ -271,28 +275,41 @@
echo "<br />";
echo "<div>{$pagenav}</div>";
echo "<br />";
+ include_once __DIR__ . '/admin_footer.php';
break;
case 'new_account':
+ case 'edit_account':
+ // render start here
+ xoops_cp_header();
+ // render submenu
echo $indexAdmin->addNavigation($currentFile);
$indexAdmin->addItemButton(_AM_XNEWSLETTER_ACCOUNTSLIST, '?op=list', 'list');
echo $indexAdmin->renderButton();
//
- $accountObj = $xnewsletter->getHandler('accounts')->create();
- $accountObj = xnewsletter_setPost($accountObj, $_POST);
- $form = $accountObj->getForm();
+ if ($accounts_id == 0) {
+ $accountObj = $xnewsletter->getHandler('accounts')->create();
+ $accountObj = xnewsletter_setPost($accountObj, $_POST);
+ } else {
+ $accountObj = $xnewsletter->getHandler('accounts')->get($accounts_id);
+ if (!empty($_POST)) {
+ xnewsletter_setPost($accountObj, $_POST);
+ }
+ }
+ //
+ $form = $accountObj->getForm();
$form->display();
+ include_once __DIR__ . '/admin_footer.php';
break;
case 'save_accounts':
if (!$GLOBALS['xoopsSecurity']->check()) {
redirect_header($currentFile, 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors()));
}
-
- $accountObj = $xnewsletter->getHandler('accounts')->get($accounts_id);
+ $accountObj = $xnewsletter->getHandler('accounts')->get($accounts_id);
$_POST['accounts_id'] = $accounts_id;
- $accountObj = xnewsletter_setPost($accountObj, $_POST);
-
+ $accountObj = xnewsletter_setPost($accountObj, $_POST);
+ //
$accountsCriteria = new CriteriaCompo();
$accountsCriteria->add(new Criteria('accounts_default', 1));
$count_accounts_default = $xnewsletter->getHandler('accounts')->getCount($accountsCriteria);
@@ -321,29 +338,22 @@
} else {
$accountObj->setErrors(_MA_XNEWSLETTER_SUBSCRIPTION_ERROR_NOEMAIL);
}
-
- echo $accountObj->getHtmlErrors();
- $form = $accountObj->getForm();
- $form->display();
- break;
-
- case 'edit_account':
+ // render start here
+ xoops_cp_header();
+ // render submenu
echo $indexAdmin->addNavigation($currentFile);
- $indexAdmin->addItemButton(_AM_XNEWSLETTER_NEWACCOUNTS, '?op=new_account', 'add');
$indexAdmin->addItemButton(_AM_XNEWSLETTER_ACCOUNTSLIST, '?op=list', 'list');
echo $indexAdmin->renderButton();
//
- $accountObj = $xnewsletter->getHandler('accounts')->get($accounts_id);
- if (!empty($_POST)) {
- xnewsletter_setPost($accountObj, $_POST);
- }
+ echo $accountObj->getHtmlErrors();
$form = $accountObj->getForm();
$form->display();
+ include_once __DIR__ . '/admin_footer.php';
break;
case 'delete_account':
$accountObj = $xnewsletter->getHandler('accounts')->get($accounts_id);
- if (xnewsletterRequest::getBool('ok', false, 'POST') == true) {
+ if (XoopsRequest::getBool('ok', false, 'POST') == true) {
if (!$GLOBALS['xoopsSecurity']->check()) {
redirect_header($currentFile, 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors()));
}
@@ -353,8 +363,15 @@
echo $accountObj->getHtmlErrors();
}
} else {
- xoops_confirm(array('ok' => true, 'accounts_id' => $accounts_id, 'op' => 'delete_account'), $currentFile, sprintf(_AM_XNEWSLETTER_FORMSUREDEL, $accountObj->getVar('accounts_name')));
+ // render start here
+ xoops_cp_header();
+ // render submenu
+ xoops_confirm(
+ array('ok' => true, 'accounts_id' => $accounts_id, 'op' => 'delete_account'),
+ $currentFile,
+ sprintf(_AM_XNEWSLETTER_FORMSUREDEL, $accountObj->getVar('accounts_name'))
+ );
+ include_once __DIR__ . '/admin_footer.php';
}
break;
}
-include_once __DIR__ . '/admin_footer.php';
Modified: XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/attachment.php
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/attachment.php 2014-12-14 11:04:17 UTC (rev 12906)
+++ XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/attachment.php 2014-12-16 22:28:16 UTC (rev 12907)
@@ -32,8 +32,8 @@
xoops_cp_header();
// We recovered the value of the argument op in the URL$
-$op = xnewsletterRequest::getString('op', 'list');
-$attachment_id = xnewsletterRequest::getInt('attachment_id', 0);
+$op = XoopsRequest::getString('op', 'list');
+$attachment_id = XoopsRequest::getInt('attachment_id', 0);
switch ($op) {
case 'list':
@@ -50,7 +50,7 @@
$attachmentCriteria->setSort('attachment_letter_id DESC, attachment_id');
$attachmentCriteria->setOrder('DESC');
//
- $start = xnewsletterRequest::getInt('start', 0);
+ $start = XoopsRequest::getInt('start', 0);
$limit = $xnewsletter->getConfig('adminperpage');
$attachmentCriteria->setStart($start);
$attachmentCriteria->setLimit($limit);
@@ -66,14 +66,13 @@
//
$attachmentObjs = $xnewsletter->getHandler('attachment')->getObjects($attachmentCriteria, true);
$attachments = $xnewsletter->getHandler('attachment')->getObjects($attachmentCriteria, true, false); // as array
+ $GLOBALS['xoopsTpl']->assign('attachments', array());
foreach ($attachments as $attachment_id => $attachment) {
$letterObj = $xnewsletter->getHandler('letter')->get($attachment['attachment_letter_id']);
$attachment['attachment_letter_title'] = $letterObj->getVar('letter_title');
-// IN PROGRESS
-// IN PROGRESS
-// IN PROGRESS
+ $attachment['attachment_size1024'] = xnewsletter_bytesToSize1024($attachment['attachment_size']);
$attachment['attachment_submitter_uname'] = XoopsUser::getUnameFromId($attachment['attachment_submitter'], 'S');
- $attachment['attachment_created_formatted'] = formatTimestamp($template['attachment_created'], $xnewsletter->getConfig('dateformat'));
+ $attachment['attachment_created_formatted'] = formatTimestamp($attachment['attachment_created'], $xnewsletter->getConfig('dateformat'));
$GLOBALS['xoopsTpl']->append('attachments', $attachment);
}
//
@@ -101,7 +100,7 @@
}
//
$attachmentObj = $xnewsletter->getHandler('attachment')->get($attachment_id);
- $attachmentObj->setVar('attachment_mode', xnewsletterRequest::getInt('attachment_mode', _XNEWSLETTER_ATTACHMENTS_MODE_ASATTACHMENT));
+ $attachmentObj->setVar('attachment_mode', XoopsRequest::getInt('attachment_mode', _XNEWSLETTER_ATTACHMENTS_MODE_ASATTACHMENT));
//
if ($xnewsletter->getHandler('attachment')->insert($attachmentObj)) {
redirect_header('?op=list', 3, _AM_XNEWSLETTER_FORMOK);
@@ -116,7 +115,7 @@
case 'delete_attachment':
$attachmentObj = $xnewsletter->getHandler('attachment')->get($attachment_id);
- if (xnewsletterRequest::getBool('ok', false, 'POST') == true) {
+ if (XoopsRequest::getBool('ok', false, 'POST') == true) {
if (!$GLOBALS['xoopsSecurity']->check()) {
redirect_header($currentFile, 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors()));
}
Modified: XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/bmh.php
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/bmh.php 2014-12-14 11:04:17 UTC (rev 12906)
+++ XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/bmh.php 2014-12-16 22:28:16 UTC (rev 12907)
@@ -32,14 +32,14 @@
xoops_cp_header();
// We recovered the value of the argument op in the URL$
-$op = xnewsletterRequest::getString('op', 'list');
-$bmh_id = xnewsletterRequest::getInt('bmh_id', 0);
-$bmh_measure = xnewsletterRequest::getInt('bmh_measure', 0);
-$filter = xnewsletterRequest::getInt('bmh_measure_filter', _XNEWSLETTER_BMH_MEASURE_VAL_ALL);
+$op = XoopsRequest::getString('op', 'list');
+$bmh_id = XoopsRequest::getInt('bmh_id', 0);
+$bmh_measure = XoopsRequest::getInt('bmh_measure', 0);
+$filter = XoopsRequest::getInt('bmh_measure_filter', _XNEWSLETTER_BMH_MEASURE_VAL_ALL);
switch ($op) {
case 'bmh_delsubscr':
- if (xnewsletterRequest::getBool('ok', false, 'POST') == true) {
+ if (XoopsRequest::getBool('ok', false, 'POST') == true) {
$count_err = 0;
$bmhObj = $xnewsletter->getHandler('bmh')->get($bmh_id);
@@ -223,7 +223,7 @@
$bhmCriteria->setSort('bmh_id');
$bhmCriteria->setOrder('DESC');
$bhmCount = $xnewsletter->getHandler('bmh')->getCount($bhmCriteria);
- $start = xnewsletterRequest::getInt('start', 0);
+ $start = XoopsRequest::getInt('start', 0);
$bhmCriteria->setStart($start);
$bhmCriteria->setLimit($limit);
$bhmObjs = $xnewsletter->getHandler('bmh')->getAll($bhmCriteria);
@@ -323,18 +323,18 @@
}
$bmhObj = $xnewsletter->getHandler('bmh')->get($bmh_id);
- $bmhObj->setVar('bmh_rule_no', xnewsletterRequest::getString('bmh_rule_no', ''));
- $bmhObj->setVar('bmh_rule_cat', xnewsletterRequest::getString('bmh_rule_cat', ''));
- $bmhObj->setVar('bmh_bouncetype', xnewsletterRequest::getString('bmh_bouncetype', ''));
- $bmhObj->setVar('bmh_remove', xnewsletterRequest::getString('bmh_remove', ''));
- $bmh_email = xnewsletterRequest::getString('bmh_email', '');
+ $bmhObj->setVar('bmh_rule_no', XoopsRequest::getString('bmh_rule_no', ''));
+ $bmhObj->setVar('bmh_rule_cat', XoopsRequest::getString('bmh_rule_cat', ''));
+ $bmhObj->setVar('bmh_bouncetype', XoopsRequest::getString('bmh_bouncetype', ''));
+ $bmhObj->setVar('bmh_remove', XoopsRequest::getString('bmh_remove', ''));
+ $bmh_email = XoopsRequest::getString('bmh_email', '');
$bmh_email = filter_var($bmh_email, FILTER_SANITIZE_EMAIL);
$bmh_email = xnewsletter_checkEmail($bmh_email);
$bmhObj->setVar('bmh_email', $bmh_email);
- $bmhObj->setVar('bmh_subject', xnewsletterRequest::getString('bmh_subject', ''));
- $bmhObj->setVar('bmh_measure', xnewsletterRequest::getInt('bmh_measure', 0));
- $bmhObj->setVar('bmh_submitter', xnewsletterRequest::getInt('bmh_submitter', 0));
- $bmhObj->setVar('bmh_created', xnewsletterRequest::getInt('bmh_created', 0));
+ $bmhObj->setVar('bmh_subject', XoopsRequest::getString('bmh_subject', ''));
+ $bmhObj->setVar('bmh_measure', XoopsRequest::getInt('bmh_measure', 0));
+ $bmhObj->setVar('bmh_submitter', XoopsRequest::getInt('bmh_submitter', 0));
+ $bmhObj->setVar('bmh_created', XoopsRequest::getInt('bmh_created', 0));
if ($xnewsletter->getHandler('bmh')->insert($bmhObj)) {
redirect_header('?op=list', 3, _AM_XNEWSLETTER_FORMOK);
@@ -356,7 +356,7 @@
case 'delete_bmh':
$bmhObj = $xnewsletter->getHandler('bmh')->get($bmh_id);
- if (xnewsletterRequest::getBool('ok', false, 'POST') == true) {
+ if (XoopsRequest::getBool('ok', false, 'POST') == true) {
if (!$GLOBALS['xoopsSecurity']->check()) {
redirect_header($currentFile, 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors()));
}
Modified: XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/cat.php
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/cat.php 2014-12-14 11:04:17 UTC (rev 12906)
+++ XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/cat.php 2014-12-16 22:28:16 UTC (rev 12907)
@@ -32,8 +32,8 @@
xoops_cp_header();
// We recovered the value of the argument op in the URL$
-$op = xnewsletterRequest::getString('op', 'list');
-$cat_id = xnewsletterRequest::getInt('cat_id', 0);
+$op = XoopsRequest::getString('op', 'list');
+$cat_id = XoopsRequest::getInt('cat_id', 0);
switch ($op) {
case 'list':
@@ -51,7 +51,7 @@
$catCriteria->setSort('cat_id ASC, cat_name');
$catCriteria->setOrder('ASC');
//
- $start = xnewsletterRequest::getInt('start', 0);
+ $start = XoopsRequest::getInt('start', 0);
$limit = $xnewsletter->getConfig('adminperpage');
$catCriteria->setStart($start);
$catCriteria->setLimit($limit);
@@ -139,9 +139,9 @@
redirect_header($currentFile, 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors()));
}
$catObj = $xnewsletter->getHandler('cat')->get($cat_id);
- $catObj->setVar('cat_name', xnewsletterRequest::getString('cat_name', ''));
+ $catObj->setVar('cat_name', XoopsRequest::getString('cat_name', ''));
$catObj->setVar('cat_info', $_REQUEST['cat_info']);
- $catObj->setVar('cat_mailinglist', xnewsletterRequest::getInt('cat_mailinglist', 0));
+ $catObj->setVar('cat_mailinglist', XoopsRequest::getInt('cat_mailinglist', 0));
$catObj->setVar('cat_submitter', $GLOBALS['xoopsUser']->uid());
$catObj->setVar('cat_created', time());
$catObj->setVar('dohtml', isset($_REQUEST['dohtml']));
@@ -156,28 +156,28 @@
// Form cat_gperms_read
$gperm_handler->deleteByModule($xnewsletter->getModule()->mid(), 'newsletter_read_cat', $cat_id);
$gperm_handler->addRight('newsletter_read_cat', $cat_id, XOOPS_GROUP_ADMIN, $xnewsletter->getModule()->mid());
- $cat_gperms_read_groupids = xnewsletterRequest::getArray('cat_gperms_read', array());
+ $cat_gperms_read_groupids = XoopsRequest::getArray('cat_gperms_read', array());
foreach ($cat_gperms_read_groupids as $groupid) {
$gperm_handler->addRight('newsletter_read_cat', $cat_id, $groupid, $xnewsletter->getModule()->mid());
}
// Form cat_gperms_admin
$gperm_handler->deleteByModule($xnewsletter->getModule()->mid(), 'newsletter_admin_cat', $cat_id);
$gperm_handler->addRight('newsletter_admin_cat', $cat_id, XOOPS_GROUP_ADMIN, $xnewsletter->getModule()->mid());
- $cat_gperms_admin_groupids = xnewsletterRequest::getArray('cat_gperms_admin', array());
+ $cat_gperms_admin_groupids = XoopsRequest::getArray('cat_gperms_admin', array());
foreach ($cat_gperms_admin_groupids as $groupid) {
$gperm_handler->addRight('newsletter_admin_cat', $cat_id, $groupid, $xnewsletter->getModule()->mid());
}
// Form cat_gperms_create
$gperm_handler->deleteByModule($xnewsletter->getModule()->mid(), 'newsletter_create_cat', $cat_id);
$gperm_handler->addRight('newsletter_create_cat', $cat_id, XOOPS_GROUP_ADMIN, $xnewsletter->getModule()->mid());
- $cat_gperms_create_groupids = xnewsletterRequest::getArray('cat_gperms_create', array());
+ $cat_gperms_create_groupids = XoopsRequest::getArray('cat_gperms_create', array());
foreach ($cat_gperms_create_groupids as $groupid) {
$gperm_handler->addRight('newsletter_create_cat', $cat_id, $groupid, $xnewsletter->getModule()->mid());
}
// Form cat_gperms_list
$gperm_handler->deleteByModule($xnewsletter->getModule()->mid(), 'newsletter_list_cat', $cat_id);
$gperm_handler->addRight('newsletter_list_cat', $cat_id, XOOPS_GROUP_ADMIN, $xnewsletter->getModule()->mid());
- $cat_gperms_list_groupids = xnewsletterRequest::getArray('cat_gperms_list', array());
+ $cat_gperms_list_groupids = XoopsRequest::getArray('cat_gperms_list', array());
foreach ($cat_gperms_list_groupids as $groupid) {
$gperm_handler->addRight('newsletter_list_cat', $cat_id, $groupid, $xnewsletter->getModule()->mid());
}
@@ -205,7 +205,7 @@
case 'delete_cat':
$catObj = $xnewsletter->getHandler('cat')->get($_REQUEST['cat_id']);
- if (xnewsletterRequest::getBool('ok', false, 'POST') == true) {
+ if (XoopsRequest::getBool('ok', false, 'POST') == true) {
if (!$GLOBALS['xoopsSecurity']->check()) {
redirect_header($currentFile, 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors()));
}
Modified: XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/catsubscr.php
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/catsubscr.php 2014-12-14 11:04:17 UTC (rev 12906)
+++ XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/catsubscr.php 2014-12-16 22:28:16 UTC (rev 12907)
@@ -32,7 +32,7 @@
xoops_cp_header();
// We recovered the value of the argument op in the URL$
-$op = xnewsletterRequest::getString('op', 'list');
+$op = XoopsRequest::getString('op', 'list');
switch ($op) {
case 'list':
@@ -46,7 +46,7 @@
$catCriteria->setSort('cat_id ASC, cat_name');
$catCriteria->setOrder('ASC');
$catCount = $xnewsletter->getHandler('cat')->getCount();
- $start = xnewsletterRequest::getInt('start', 0);
+ $start = XoopsRequest::getInt('start', 0);
$catCriteria->setStart($start);
$catCriteria->setLimit($limit);
$catObjs = $xnewsletter->getHandler('cat')->getAll($catCriteria);
@@ -88,7 +88,7 @@
break;
case 'list_cat':
- $cat_id = xnewsletterRequest::getInt('cat_id', 0);
+ $cat_id = XoopsRequest::getInt('cat_id', 0);
echo $indexAdmin->addNavigation($currentFile);
$indexAdmin->addItemButton(_AM_XNEWSLETTER_CATLIST, '?op=list', 'list');
@@ -101,7 +101,7 @@
$catsubscrCriteria->setSort('catsubscr_id ASC, catsubscr_catid');
$catsubscrCriteria->setOrder('ASC');
$catCount = $xnewsletter->getHandler('catsubscr')->getCount($catsubscrCriteria);
- $start = xnewsletterRequest::getInt('start', 0);
+ $start = XoopsRequest::getInt('start', 0);
$catsubscrCriteria->setStart($start);
$catsubscrCriteria->setLimit($limit);
$catsubscrObjs = $xnewsletter->getHandler('catsubscr')->getAll($catsubscrCriteria);
@@ -184,7 +184,7 @@
$catsubscrObj->setVar('catsubscr_catid', $_REQUEST['catsubscr_catid']);
$catsubscr_subscrid = $_REQUEST['catsubscr_subscrid'];
$catsubscrObj->setVar('catsubscr_subscrid', $catsubscr_subscrid);
- $catsubscr_quit_now = xnewsletterRequest::getInt('catsubscr_quit_now', _XNEWSLETTER_CATSUBSCR_QUIT_NO_VAL_NONE);...
[truncated message content] |
|
From: <luc...@us...> - 2014-12-19 22:36:35
|
Revision: 12910
http://sourceforge.net/p/xoops/svn/12910
Author: luciorota
Date: 2014-12-19 22:36:32 +0000 (Fri, 19 Dec 2014)
Log Message:
-----------
improved subscr filter in admin side
Modified Paths:
--------------
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/subscr.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/templates/admin/xnewsletter_admin_subscrs_list.tpl
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/xoops_version.php
Modified: XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/subscr.php
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/subscr.php 2014-12-19 20:01:08 UTC (rev 12909)
+++ XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/subscr.php 2014-12-19 22:36:32 UTC (rev 12910)
@@ -102,34 +102,46 @@
$GLOBALS['xoopsTpl']->assign('subsrCount', $subsrCount);
if ($subsrCount > 0) {
$subscrCriteria = new CriteriaCompo();
- // get filtered subscrs criteria
// get filter parameters
- $filter_subscr = XoopsRequest::getString('filter_subscr', '=');
+ $filter_subscr_criteria = XoopsRequest::getString('filter_subscr_criteria', '=');
$filter_subscr_firstname = XoopsRequest::getString('filter_subscr_firstname', '');
$filter_subscr_lastname = XoopsRequest::getString('filter_subscr_lastname', '');
$filter_subscr_email = XoopsRequest::getString('filter_subscr_email', '');
- if ($filter_subscr == 'LIKE' && !$filter_subscr_firstname == '') {
- $filter_subscr_firstname = "%{$filter_subscr_firstname}%";
- }
- if ($filter_subscr == 'LIKE' && !$filter_subscr_lastname == '') {
- $filter_subscr_lastname = "%{$filter_subscr_lastname}%";
- }
- if ($filter_subscr == 'LIKE' && !$filter_subscr_email == '') {
- $filter_subscr_email = "%{$filter_subscr_email}%";
- }
- if ($filter_subscr_firstname == '' && $filter_subscr_lastname == '' && $filter_subscr_email == '') {
- $op = 'list_subscrs';
- }
if ($apply_filter == true) {
+ switch ($filter_subscr_criteria) {
+ case 'CONTAINS':
+ $pre = '%';
+ $post = '%';
+ $function = 'LIKE';
+ break;
+ case 'MATCHES':
+ $pre = '';
+ $post = '';
+ $function = '=';
+ break;
+ case 'STARTSWITH':
+ $pre = '';
+ $post = '%';
+ $function = 'LIKE';
+ break;
+ case 'ENDSWITH':
+ $pre = '%';
+ $post = '';
+ $function = 'LIKE';
+ break;
+ }
+ if ($filter_subscr_firstname == '' && $filter_subscr_lastname == '' && $filter_subscr_email == '') {
+ $op = 'list_subscrs';
+ }
// apply filter
if ($filter_subscr_firstname != '') {
- $subscrCriteria->add(new Criteria('subscr_firstname', $filter_subscr_firstname, $filter_subscr));
+ $subscrCriteria->add(new Criteria('subscr_firstname', $pre . $filter_subscr_firstname . $post, $function));
}
if ($filter_subscr_lastname != '') {
- $subscrCriteria->add(new Criteria('subscr_lastname', $filter_subscr_lastname, $filter_subscr));
+ $subscrCriteria->add(new Criteria('subscr_lastname', $pre . $filter_subscr_lastname . $post, $function));
}
if ($filter_subscr_email != '') {
- $subscrCriteria->add(new Criteria('subscr_email', $filter_subscr_email, $filter_subscr));
+ $subscrCriteria->add(new Criteria('subscr_email', $pre . $filter_subscr_email . $post, $function));
}
}
$GLOBALS['xoopsTpl']->assign('apply_filter', $apply_filter);
@@ -149,7 +161,7 @@
if ($subsrFilterCount > $limit) {
include_once XOOPS_ROOT_PATH . '/class/pagenav.php';
$linklist = "op={$op}";
- $linklist .= "&filter_subscr={$filter_subscr}";
+ $linklist .= "&filter_subscr_criteria={$filter_subscr_criteria}";
$linklist .= "&filter_subscr_firstname={$filter_subscr_firstname}";
$linklist .= "&filter_subscr_lastname={$filter_subscr_lastname}";
$linklist .= "&filter_subscr_email={$filter_subscr_email}";
@@ -160,13 +172,14 @@
}
$GLOBALS['xoopsTpl']->assign('subscrs_pagenav', $pagenav);
//
- if ($filter_subscr == 'LIKE') {
- //clean up var for refill form
- $filter_subscr_firstname = str_replace('%', '', $filter_subscr_firstname);
- $filter_subscr_lastname = str_replace('%', '', $filter_subscr_lastname);
- $filter_subscr_email = str_replace('%', '', $filter_subscr_email);
- }
- $GLOBALS['xoopsTpl']->assign('filter_subscr', $filter_subscr);
+ $filter_subscr_criteria_select = new XoopsFormSelect(_AM_XNEWSLETTER_LETTER_TITLE, 'filter_subscr_criteria', $filter_subscr_criteria, 1, false);
+ $filter_subscr_criteria_select->addOption('CONTAINS', _CONTAINS);
+ $filter_subscr_criteria_select->addOption('MATCHES', _MATCHES);
+ $filter_subscr_criteria_select->addOption('STARTSWITH', _STARTSWITH);
+ $filter_subscr_criteria_select->addOption('ENDSWITH', _ENDSWITH);
+ $GLOBALS['xoopsTpl']->assign('filter_subscr_criteria_select', $filter_subscr_criteria_select->render());
+ //
+ $GLOBALS['xoopsTpl']->assign('filter_subscr_criteria', $filter_subscr_criteria);
$GLOBALS['xoopsTpl']->assign('filter_subscr_firstname', $filter_subscr_firstname);
$GLOBALS['xoopsTpl']->assign('filter_subscr_lastname', $filter_subscr_lastname);
$GLOBALS['xoopsTpl']->assign('filter_subscr_email', $filter_subscr_email);
Modified: XoopsModules/xnewsletter/branches/luciorota/xnewsletter/templates/admin/xnewsletter_admin_subscrs_list.tpl
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xnewsletter/templates/admin/xnewsletter_admin_subscrs_list.tpl 2014-12-19 20:01:08 UTC (rev 12909)
+++ XoopsModules/xnewsletter/branches/luciorota/xnewsletter/templates/admin/xnewsletter_admin_subscrs_list.tpl 2014-12-19 22:36:32 UTC (rev 12910)
@@ -20,37 +20,38 @@
}
</script>
+<table class='outer width100' cellspacing='1'>
+ <tr class='odd'>
+ <td>
+ <form id='form_filter' enctype='multipart/form-data' method='post' action='' name='form_filter'>
+ <{$smarty.const._AM_XNEWSLETTER_SUBSCR_FIRSTNAME}>
+ <input type='text' id='filter_subscr_firstname' maxlength='50' size='15' title='' name='filter_subscr_firstname' value='<{$filter_subscr_firstname}>'>
+
+ <{$smarty.const._AM_XNEWSLETTER_SUBSCR_LASTNAME}>
+ <input type='text' id='filter_subscr_lastname' maxlength='50' size='15' title='' name='filter_subscr_lastname' value='<{$filter_subscr_lastname}>'>
+
+ <{$smarty.const._AM_XNEWSLETTER_SUBSCR_EMAIL}>
+ <input type='text' id='filter_subscr_email' maxlength='255' size='40' title='' name='filter_subscr_email' value='<{$filter_subscr_email}>'>
+ <{$smarty.const._SEARCH}>
+ <{$filter_subscr_criteria_select}>
+<!--
+ <select id='filter_subscr' title='<{$smarty.const._SEARCH}>' name='filter_subscr' size='1'>
+ <option value='=' <{if ($filter_subscr == "=")}> selected='selected'<{/if}>><{$smarty.const._AM_XNEWSLETTER_SEARCH_EQUAL}></option>
+ <option value='LIKE' <{if ($filter_subscr == "LIKE")}> selected='selected'<{/if}>><{$smarty.const._AM_XNEWSLETTER_SEARCH_CONTAINS}></option>
+ </select>
+-->
+ <input type='submit' id='filter_submit' class='formButton' title='<{$smarty.const._SEARCH}>' value='<{$smarty.const._SEARCH}>' name='filter_submit'>
+ <input type='hidden' id='op' name='op' value='list_subscrs' >
+ <input type='hidden' id='filter_op' name='apply_filter' value='1' >
+ </form>
+ </td>
+ </tr>
+</table>
+
<table class='outer' cellspacing='1'>
<tr>
<td align='left' colspan='9'><{$smarty.const._AM_XNEWSLETTER_THEREARE_SUBSCR|replace:'%s':$subsrCount}></td>
</tr>
-<form id='form_filter' enctype='multipart/form-data' method='post' action='' name='form_filter'>
- <tr>
- <td class='center'> </td>
- <td colspan='2'><{$smarty.const._SEARCH}>:
- <select id='filter_subscr' title='<{$smarty.const._SEARCH}>' name='filter_subscr' size='1'>
- <option value='=' <{if ($filter_subscr == "=")}> selected='selected'<{/if}>><{$smarty.const._AM_XNEWSLETTER_SEARCH_EQUAL}></option>
- <option value='LIKE' <{if ($filter_subscr == "LIKE")}> selected='selected'<{/if}>><{$smarty.const._AM_XNEWSLETTER_SEARCH_CONTAINS}></option>
- </select>
- </td>
- <td>
- <input id='filter_subscr_firstname' type='text' value='<{$filter_subscr_firstname}>' maxlength='50' size='15' title='' name='filter_subscr_firstname'>
- </td>
- <td>
- <input id='filter_subscr_lastname' type='text' value='<{$filter_subscr_lastname}>' maxlength='50' size='15' title='' name='filter_subscr_lastname'>
- </td>
- <td>
- <input id='filter_subscr_email' type='text' value='<{$filter_subscr_email}>' maxlength='255' size='40' title='' name='filter_subscr_email'>
- </td>
- <td> </td>
- <td> </td>
- <td class='center'>
- <input id='filter_submit' class='formButton' type='submit' title='<{$smarty.const._SEARCH}>' value='<{$smarty.const._SEARCH}>' name='filter_submit'>
- </td>
-</tr>
-<input type='hidden' id='op' name='op' value='list_subscrs' >
-<input type='hidden' id='filter_op' name='apply_filter' value='1' >
-</form>
<form id='form_action' onsubmit='return check(this);' enctype='multipart/form-data' method='post' action='' name='form_action'>
<tr>
<th class='center'><input type='checkbox' name='togglers[]' title='<{$smarty.const._ALL}>' onClick='toggle(this);'></th>
Modified: XoopsModules/xnewsletter/branches/luciorota/xnewsletter/xoops_version.php
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xnewsletter/xoops_version.php 2014-12-19 20:01:08 UTC (rev 12909)
+++ XoopsModules/xnewsletter/branches/luciorota/xnewsletter/xoops_version.php 2014-12-19 22:36:32 UTC (rev 12910)
@@ -49,7 +49,7 @@
// About
$modversion['module_status'] = 'Beta 1';
-$modversion['release_date'] = '2014/12/16';
+$modversion['release_date'] = '2014/12/19';
$modversion['module_website_url'] = 'wedega.com';
$modversion['module_website_name'] = 'Webdesign Gabor';
$modversion['min_php'] = '5.3.7';
|
|
From: <luc...@us...> - 2014-12-22 22:35:20
|
Revision: 12918
http://sourceforge.net/p/xoops/svn/12918
Author: luciorota
Date: 2014-12-22 22:34:34 +0000 (Mon, 22 Dec 2014)
Log Message:
-----------
use xoops_load
Modified Paths:
--------------
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/accounts.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/attachment.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/bmh.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/cat.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/catsubscr.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/letter.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/mailinglist.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/protocol.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/subscr.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/task.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/template.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/header.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/xoops_version.php
Modified: XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/accounts.php
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/accounts.php 2014-12-22 22:05:24 UTC (rev 12917)
+++ XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/accounts.php 2014-12-22 22:34:34 UTC (rev 12918)
@@ -224,7 +224,7 @@
//
$accountsObjs = $xnewsletter->getHandler('accounts')->getAll($accountsCriteria);
if ($accountsCount > $limit) {
- include_once XOOPS_ROOT_PATH . '/class/pagenav.php';
+ xoops_load('xoopspagenav');
$pagenav = new XoopsPageNav($accountsCount, $limit, $start, 'start', 'op=list');
$pagenav = $pagenav->renderNav(4);
} else {
Modified: XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/attachment.php
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/attachment.php 2014-12-22 22:05:24 UTC (rev 12917)
+++ XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/attachment.php 2014-12-22 22:34:34 UTC (rev 12918)
@@ -56,7 +56,7 @@
$attachmentCriteria->setLimit($limit);
//
if ($attachmentCount > $limit) {
- include_once XOOPS_ROOT_PATH . '/class/pagenav.php';
+ xoops_load('xoopspagenav');
$pagenav = new XoopsPageNav($attachmentCount, $limit, $start, 'start', 'op=list');
$pagenav = $pagenav->renderNav(4);
} else {
Modified: XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/bmh.php
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/bmh.php 2014-12-22 22:05:24 UTC (rev 12917)
+++ XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/bmh.php 2014-12-22 22:34:34 UTC (rev 12918)
@@ -228,7 +228,7 @@
$bhmCriteria->setLimit($limit);
$bhmObjs = $xnewsletter->getHandler('bmh')->getAll($bhmCriteria);
if ($bhmCount > $limit) {
- include_once XOOPS_ROOT_PATH . '/class/pagenav.php';
+ xoops_load('xoopspagenav');
$pagenav = new XoopsPageNav($bhmCount, $limit, $start, 'start', 'op=list');
$pagenav = $pagenav->renderNav(4);
} else {
Modified: XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/cat.php
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/cat.php 2014-12-22 22:05:24 UTC (rev 12917)
+++ XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/cat.php 2014-12-22 22:34:34 UTC (rev 12918)
@@ -57,7 +57,7 @@
$catCriteria->setLimit($limit);
//
if ($catCount > $limit) {
- include_once XOOPS_ROOT_PATH . '/class/pagenav.php';
+ xoops_load('xoopspagenav');
$pagenav = new XoopsPageNav($catCount, $limit, $start, 'start', 'op=list');
$pagenav = $pagenav->renderNav(4);
} else {
Modified: XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/catsubscr.php
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/catsubscr.php 2014-12-22 22:05:24 UTC (rev 12917)
+++ XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/catsubscr.php 2014-12-22 22:34:34 UTC (rev 12918)
@@ -51,7 +51,7 @@
$catCriteria->setLimit($limit);
$catObjs = $xnewsletter->getHandler('cat')->getAll($catCriteria);
if ($catCount > $limit) {
- include_once XOOPS_ROOT_PATH . '/class/pagenav.php';
+ xoops_load('xoopspagenav');
$pagenav = new XoopsPageNav($catCount, $limit, $start, 'start', 'op=list');
$pagenav = $pagenav->renderNav(4);
} else {
Modified: XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/letter.php
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/letter.php 2014-12-22 22:05:24 UTC (rev 12917)
+++ XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/letter.php 2014-12-22 22:34:34 UTC (rev 12918)
@@ -129,7 +129,7 @@
$letters = $xnewsletter->getHandler('letter')->getObjects($letterCriteria, true, false); // as array
// pagenav
if ($letterCount > $limit) {
- include_once XOOPS_ROOT_PATH . '/class/pagenav.php';
+ xoops_load('xoopspagenav');
$pagenav = new XoopsPageNav($letterCount, $limit, $start, 'start', 'op=list');
$pagenav = $pagenav->renderNav();
} else {
Modified: XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/mailinglist.php
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/mailinglist.php 2014-12-22 22:05:24 UTC (rev 12917)
+++ XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/mailinglist.php 2014-12-22 22:34:34 UTC (rev 12918)
@@ -50,7 +50,7 @@
$mailinglistCriteria->setLimit($limit);
$mailinglistObjs = $xnewsletter->getHandler('mailinglist')->getAll($mailinglistCriteria);
if ($mailinglistCount > $limit) {
- include_once XOOPS_ROOT_PATH . '/class/pagenav.php';
+ xoops_load('xoopspagenav');
$pagenav = new XoopsPageNav($mailinglistCount, $limit, $start, 'start', 'op=list');
$pagenav = $pagenav->renderNav(4);
} else {
Modified: XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/protocol.php
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/protocol.php 2014-12-22 22:05:24 UTC (rev 12917)
+++ XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/protocol.php 2014-12-22 22:34:34 UTC (rev 12918)
@@ -115,7 +115,7 @@
$letters = $xnewsletter->getHandler('letter')->getObjects($letterCriteria, true, false);
//
if ($protocolFilterCount > $limit) {
- include_once XOOPS_ROOT_PATH . '/class/pagenav.php';
+ xoops_load('xoopspagenav');
$linklist = "op={$op}";
foreach ($filter_protocol_letter_ids as $filter_protocol_letter_id) {
$linklist .= "&filter_protocol_letter_ids[]={$filter_protocol_letter_id}";
Modified: XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/subscr.php
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/subscr.php 2014-12-22 22:05:24 UTC (rev 12917)
+++ XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/subscr.php 2014-12-22 22:34:34 UTC (rev 12918)
@@ -159,7 +159,7 @@
$subscrObjs = $xnewsletter->getHandler('subscr')->getAll($subscrCriteria);
$subscrs = $xnewsletter->getHandler('subscr')->getObjects($subscrCriteria, true, false); // as array
if ($subsrFilterCount > $limit) {
- include_once XOOPS_ROOT_PATH . '/class/pagenav.php';
+ xoops_load('xoopspagenav');
$linklist = "op={$op}";
$linklist .= "&filter_subscr_criteria={$filter_subscr_criteria}";
$linklist .= "&filter_subscr_firstname={$filter_subscr_firstname}";
Modified: XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/task.php
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/task.php 2014-12-22 22:05:24 UTC (rev 12917)
+++ XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/task.php 2014-12-22 22:34:34 UTC (rev 12918)
@@ -136,7 +136,7 @@
$letters = $xnewsletter->getHandler('letter')->getObjects($letterCriteria, true, false);
//
if ($taskFilterCount > $limit) {
- include_once XOOPS_ROOT_PATH . '/class/pagenav.php';
+ xoops_load('xoopspagenav');
$linklist = "op={$op}";
foreach ($filter_task_letter_ids as $filter_task_letter_id) {
$linklist .= "&filter_task_letter_ids[]={$filter_task_letter_id}";
Modified: XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/template.php
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/template.php 2014-12-22 22:05:24 UTC (rev 12917)
+++ XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/template.php 2014-12-22 22:34:34 UTC (rev 12918)
@@ -114,7 +114,7 @@
$templateCriteria->setLimit($limit);
//
if ($templateCount > $limit) {
- include_once XOOPS_ROOT_PATH . '/class/pagenav.php';
+ xoops_load('xoopspagenav');
$pagenav = new XoopsPageNav($templateCount, $limit, $start, 'start', 'op=list');
$pagenav = $pagenav->renderNav(4);
} else {
Modified: XoopsModules/xnewsletter/branches/luciorota/xnewsletter/header.php
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xnewsletter/header.php 2014-12-22 22:05:24 UTC (rev 12917)
+++ XoopsModules/xnewsletter/branches/luciorota/xnewsletter/header.php 2014-12-22 22:34:34 UTC (rev 12918)
@@ -30,7 +30,7 @@
include_once dirname(dirname(__DIR__)) . '/mainfile.php';
include_once __DIR__ . '/include/common.php';
-include_once XOOPS_ROOT_PATH . '/class/pagenav.php';
+xoops_load('xoopspagenav');
include_once XOOPS_ROOT_PATH . '/include/functions.php';
//Load languages
Modified: XoopsModules/xnewsletter/branches/luciorota/xnewsletter/xoops_version.php
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xnewsletter/xoops_version.php 2014-12-22 22:05:24 UTC (rev 12917)
+++ XoopsModules/xnewsletter/branches/luciorota/xnewsletter/xoops_version.php 2014-12-22 22:34:34 UTC (rev 12918)
@@ -49,7 +49,7 @@
// About
$modversion['module_status'] = 'Beta 1';
-$modversion['release_date'] = '2014/12/19';
+$modversion['release_date'] = '2014/12/22';
$modversion['module_website_url'] = 'wedega.com';
$modversion['module_website_name'] = 'Webdesign Gabor';
$modversion['min_php'] = '5.3.7';
|
|
From: <luc...@us...> - 2015-02-03 22:32:22
|
Revision: 12965
http://sourceforge.net/p/xoops/svn/12965
Author: luciorota
Date: 2015-02-03 22:32:13 +0000 (Tue, 03 Feb 2015)
Log Message:
-----------
xoosp 2.5.7.1 compatible
change directory structure
improved subscr form
standardize code
code cleanup
Modified Paths:
--------------
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/subscr.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/catsubscr.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/subscr.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/common.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/xoops_version.php
Added Paths:
-----------
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/common/
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/common/breadcrumb.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/common/breadcrumb.tpl
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/common/session.php
Removed Paths:
-------------
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/session.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/templates/xNewsletter_common_breadcrumb.tpl
Modified: XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/subscr.php
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/subscr.php 2015-02-03 22:20:34 UTC (rev 12964)
+++ XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/subscr.php 2015-02-03 22:32:13 UTC (rev 12965)
@@ -172,6 +172,7 @@
}
$GLOBALS['xoopsTpl']->assign('subscrs_pagenav', $pagenav);
//
+ xoops_load('XoopsFormLoader');
$filter_subscr_criteria_select = new XoopsFormSelect(_AM_XNEWSLETTER_LETTER_TITLE, 'filter_subscr_criteria', $filter_subscr_criteria, 1, false);
$filter_subscr_criteria_select->addOption('CONTAINS', _CONTAINS);
$filter_subscr_criteria_select->addOption('MATCHES', _MATCHES);
@@ -260,7 +261,7 @@
echo $subscrAdmin->renderButton();
//
$subscrObj = $xnewsletter->getHandler('subscr')->create();
- $form = $subscrObj->getFormAdmin();
+ $form = $subscrObj->getFormAdmin();
$form->display();
include_once __DIR__ . '/admin_footer.php';
break;
@@ -283,16 +284,70 @@
$subscrObj->setVar('subscr_actkey', $_REQUEST['subscr_actkey']);
$subscrObj->setVar('subscr_activated', XoopsRequest::getInt('subscr_activated', 0));
//
- if ($xnewsletter->getHandler('subscr')->insert($subscrObj)) {
- redirect_header('?op=list_subscrs', 3, _AM_XNEWSLETTER_FORMOK);
+ if (!$xnewsletter->getHandler('subscr')->insert($subscrObj)) {
+ // render start here
+ xoops_cp_header();
+ // render form
+ echo $subscrObj->getHtmlErrors();
+ $form = $subscrObj->getFormAdmin();
+ $form->display();
+ include_once __DIR__ . '/admin_footer.php';
+ exit();
}
- // render start here
- xoops_cp_header();
- // render form
- echo $subscrObj->getHtmlErrors();
- $form = $subscrObj->getFormAdmin();
- $form->display();
- include_once __DIR__ . '/admin_footer.php';
+ //
+ $cat_ids = XoopsRequest::getArray('cat_ids', array());
+ $subscr_id = $subscrObj->getVar('subscr_id');
+ $catObjs = $xnewsletter->getHandler('cat')->getAll();
+ foreach ($catObjs as $cat_id => $catObj) {
+ $catsubscrCriteria = new CriteriaCompo();
+ $catsubscrCriteria->add(new Criteria('catsubscr_catid', $cat_id));
+ $catsubscrCriteria->add(new Criteria('catsubscr_subscrid', $subscr_id));
+ $catsubscrCount = $xnewsletter->getHandler('catsubscr')->getCount($catsubscrCriteria);
+ if (in_array($cat_id, $cat_ids)) {
+ // checked
+ switch($catsubscrCount) {
+ case 0:
+ // create catsubscr
+ $catsubscrObj = $xnewsletter->getHandler('catsubscr')->create();
+ $catsubscrObj->setVar('catsubscr_catid', $cat_id);
+ $catsubscrObj->setVar('catsubscr_subscrid', $subscr_id);
+ $catsubscrObj->setVar('catsubscr_submitter', $_REQUEST['subscr_uid']);
+ $catsubscrObj->setVar('catsubscr_created', $_REQUEST['subscr_created']);
+ $xnewsletter->getHandler('catsubscr')->insert($catsubscrObj);
+ break;
+ case 1:
+ // NOP
+ break;
+ default:
+ // delete all catsubscrs
+ $xnewsletter->getHandler('catsubscr')->deleteAll($catsubscrCriteria);
+ // create catsubscr
+ $catsubscrObj = $xnewsletter->getHandler('catsubscr')->create();
+ $catsubscrObj->setVar('catsubscr_catid', $cat_id);
+ $catsubscrObj->setVar('catsubscr_subscrid', $subscr_id);
+ $catsubscrObj->setVar('catsubscr_submitter', $_REQUEST['subscr_uid']);
+ $catsubscrObj->setVar('catsubscr_created', $_REQUEST['subscr_created']);
+ $xnewsletter->getHandler('catsubscr')->insert($catsubscrObj);
+ break;
+ }
+ } else {
+ // not checked
+ switch($catsubscrCount) {
+ case 0:
+ // NOP
+ break;
+ case 1:
+ // delete catsubscr
+ $xnewsletter->getHandler('catsubscr')->deleteAll($catsubscrCriteria);
+ break;
+ default:
+ // delete all catsubscrs
+ $xnewsletter->getHandler('catsubscr')->deleteAll($catsubscrCriteria);
+ break;
+ }
+ }
+ }
+ redirect_header('?op=list_subscrs', 3, _AM_XNEWSLETTER_FORMOK);
break;
case 'edit_subscr':
Modified: XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/catsubscr.php
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/catsubscr.php 2015-02-03 22:20:34 UTC (rev 12964)
+++ XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/catsubscr.php 2015-02-03 22:32:13 UTC (rev 12965)
@@ -74,6 +74,13 @@
//
$form = new XoopsThemeForm($title, 'form', $action, 'post', true);
$form->setExtra('enctype="multipart/form-data"');
+ // catsubsr: catsubscr_subscrid
+ $subscrCriteria = new CriteriaCompo();
+ $subscrCriteria->setSort('subscr_email ');
+ $subscrCriteria->setOrder('ASC');
+ $subscr_select = new XoopsFormSelect(_AM_XNEWSLETTER_CATSUBSCR_SUBSCRID, 'catsubscr_subscrid', $this->getVar('catsubscr_subscrid'));
+ $subscr_select->addOptionArray($this->xnewsletter->getHandler('subscr')->getList($subscrCriteria));
+ $form->addElement($subscr_select, true);
// catsubsr: catsubscr_catid
$criteria = new CriteriaCompo();
$criteria->setSort('cat_id ASC, cat_name');
@@ -81,16 +88,8 @@
$cat_select = new XoopsFormSelect(_AM_XNEWSLETTER_CATSUBSCR_CATID, 'catsubscr_catid', $this->getVar('catsubscr_catid'));
$cat_select->addOptionArray($this->xnewsletter->getHandler('cat')->getList());
$form->addElement($cat_select, true);
- // catsubsr: catsubscr_subscrid
- $subscrCriteria = new CriteriaCompo();
- $subscrCriteria->setSort('subscr_email ');
- $subscrCriteria->setOrder('ASC');
- $subscr_select = new XoopsFormSelect(_AM_XNEWSLETTER_CATSUBSCR_SUBSCRID, 'catsubscr_subscrid', $this->getVar('catsubscr_subscrid'));
- $subscr_select->addOptionArray($this->xnewsletter->getHandler('subscr')->getList($subscrCriteria));
- $form->addElement($subscr_select, true);
- //
+ // form: catsubscr_quit_now
$quited_tray = new XoopsFormElementTray(_AM_XNEWSLETTER_CATSUBSCR_QUITED, ' ');
- //
$quit_now = new XoopsFormRadio('', 'catsubscr_quit_now', _XNEWSLETTER_CATSUBSCR_QUIT_NO_VAL_NONE);
$quit_now->addOptionArray(
array(
Added: XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/common/breadcrumb.php
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/common/breadcrumb.php (rev 0)
+++ XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/common/breadcrumb.php 2015-02-03 22:32:13 UTC (rev 12965)
@@ -0,0 +1,86 @@
+<?php
+/*
+ You may not change or alter any portion of this comment or credits
+ of supporting developers from this source code or any supporting source code
+ which is considered copyrighted (c) material of the original comment or credit authors.
+
+ This program 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.
+ */
+/**
+ * XnewsletterBreadcrumb Class
+ *
+ * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/
+ * @license http://www.fsf.org/copyleft/gpl.html GNU public license
+ * @author lucio <luc...@gm...>
+ * @package Xnewsletter
+ * @since 1.00
+ * @version $Id:$
+ *
+ * Example:
+ * $breadcrumb = new XnewsletterBreadcrumb();
+ * $breadcrumb->addLink( 'bread 1', 'index1.php' );
+ * $breadcrumb->addLink( 'bread 2', '' );
+ * $breadcrumb->addLink( 'bread 3', 'index3.php' );
+ * echo $breadcrumb->render();
+ */
+defined('XOOPS_ROOT_PATH') || die('XOOPS root path not defined');
+
+/**
+ * Class XnewsletterBreadcrumb
+ */
+class XnewsletterBreadcrumb
+{
+ private $dirname;
+ private $_bread = array();
+
+ /**
+ *
+ */
+ public function __construct()
+ {
+ $this->dirname = basename(dirname(dirname(__DIR__)));
+ }
+
+ /**
+ * Add link to breadcrumb
+ *
+ * @param string $title
+ * @param string $link
+ */
+ public function addLink( $title='', $link='' )
+ {
+ $this->_bread[] = array(
+ 'link' => $link,
+ 'title' => $title
+ );
+ }
+
+ /**
+ * Render Xnewsletter BreadCrumb
+ *
+ */
+ public function render()
+ {
+ $ret = '';
+
+ if (!isset($GLOBALS['xoTheme']) || !is_object($GLOBALS['xoTheme'])) {
+ include_once $GLOBALS['xoops']->path('/class/theme.php');
+ $GLOBALS['xoTheme'] = new xos_opal_Theme();
+ }
+ require_once $GLOBALS['xoops']->path('/class/template.php');
+ $breadcrumbTpl = new XoopsTpl();
+ $breadcrumbTpl->assign('breadcrumb', $this->_bread);
+// IN PROGRESS
+// IN PROGRESS
+// IN PROGRESS
+ //$ret .= $breadcrumbTpl->fetch(__DIR__ . '_breadcrumb.tpl');
+ $tplSource = file_get_contents(__DIR__ . '/breadcrumb.tpl');
+// $ret .= $choiceByLetterTpl->fetchFromData($tplSource, false, null);
+ $ret .= $breadcrumbTpl->fetchFromData($tplSource, false, null);
+ unset($breadcrumbTpl);
+
+ return $ret;
+ }
+}
Added: XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/common/breadcrumb.tpl
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/common/breadcrumb.tpl (rev 0)
+++ XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/common/breadcrumb.tpl 2015-02-03 22:32:13 UTC (rev 12965)
@@ -0,0 +1,16 @@
+<div class="module_skeleton_headertable">
+ <div class="module_skeleton_breadcrumb">
+ <{foreach item=bread from=$breadcrumb name=bcloop}>
+ <span class="bread">
+ <{if ($bread.link)}>
+ <a href="<{$bread.link}>" title="<{$bread.title}>"><{$bread.title}></a>
+ <{else}>
+ <{$bread.title}>
+ <{/if}>
+ </span>
+ <{if !$smarty.foreach.bcloop.last}>
+ <span class="delimiter">></span>
+ <{/if}>
+ <{/foreach}>
+ </div>
+</div>
Added: XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/common/session.php
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/common/session.php (rev 0)
+++ XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/common/session.php 2015-02-03 22:32:13 UTC (rev 12965)
@@ -0,0 +1,110 @@
+<?php
+/*
+ You may not change or alter any portion of this comment or credits
+ of supporting developers from this source code or any supporting source code
+ which is considered copyrighted (c) material of the original comment or credit authors.
+
+ This program 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.
+ */
+/**
+ * XnewsletterSession class
+ *
+ * @copyright The XUUPS Project http://sourceforge.net/projects/xuups/
+ * @license http://www.fsf.org/copyleft/gpl.html GNU public license
+ * @package xnewsletter
+ * @since 1.3
+ * @author trabis <lus...@gm...>
+ * @author Harry Fuecks (PHP Anthology Volume II)
+ * @version svn:$id$
+ */
+defined('XOOPS_ROOT_PATH') || die('XOOPS root path not defined');
+
+include_once dirname(dirname(__DIR__)) . '/include/common.php';
+
+/**
+ * Class XnewsletterSession
+ */
+class XnewsletterSession
+{
+ /**
+ * Session constructor<br />
+ * Starts the session with session_start()
+ * <strong>Note:</strong> that if the session has already started,
+ * session_start() does nothing
+ */
+ protected function __construct()
+ {
+ @session_start();
+ }
+
+ /**
+ * Sets a session variable
+ *
+ * @param string $name name of variable
+ * @param mixed $value value of variable
+ *
+ * @return void
+ * @access public
+ */
+ public function set($name, $value)
+ {
+ $_SESSION[$name] = $value;
+ }
+
+ /**
+ * Fetches a session variable
+ *
+ * @param string $name name of variable
+ *
+ * @return mixed value of session variable
+ * @access public
+ */
+ public function get($name)
+ {
+ if (isset($_SESSION[$name])) {
+ return $_SESSION[$name];
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * Deletes a session variable
+ *
+ * @param string $name name of variable
+ *
+ * @return void
+ * @access public
+ */
+ public function del($name)
+ {
+ unset($_SESSION[$name]);
+ }
+
+ /**
+ * Destroys the whole session
+ *
+ * @return void
+ * @access public
+ */
+ public function destroy()
+ {
+ $_SESSION = array();
+ session_destroy();
+ }
+
+ /**
+ * @return XnewsletterSession
+ */
+ public static function &getInstance()
+ {
+ static $_sess;
+ if (!isset($_sess)) {
+ $_sess = new XnewsletterSession();
+ }
+
+ return $_sess;
+ }
+}
Deleted: XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/session.php
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/session.php 2015-02-03 22:20:34 UTC (rev 12964)
+++ XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/session.php 2015-02-03 22:32:13 UTC (rev 12965)
@@ -1,109 +0,0 @@
-<?php
-/*
- You may not change or alter any portion of this comment or credits
- of supporting developers from this source code or any supporting source code
- which is considered copyrighted (c) material of the original comment or credit authors.
-
- This program 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.
- */
-/**
- * XnewsletterSession class
- *
- * @copyright The XUUPS Project http://sourceforge.net/projects/xuups/
- * @license http://www.fsf.org/copyleft/gpl.html GNU public license
- * @package xnewsletter
- * @since 1.3
- * @author trabis <lus...@gm...>
- * @author Harry Fuecks (PHP Anthology Volume II)
- * @version svn:$id$
- */
-
-include_once dirname(__DIR__) . '/include/common.php';
-
-/**
- * Class XnewsletterSession
- */
-class XnewsletterSession
-{
- /**
- * Session constructor<br />
- * Starts the session with session_start()
- * <strong>Note:</strong> that if the session has already started,
- * session_start() does nothing
- */
- protected function __construct()
- {
- @session_start();
- }
-
- /**
- * Sets a session variable
- *
- * @param string $name name of variable
- * @param mixed $value value of variable
- *
- * @return void
- * @access public
- */
- public function set($name, $value)
- {
- $_SESSION[$name] = $value;
- }
-
- /**
- * Fetches a session variable
- *
- * @param string $name name of variable
- *
- * @return mixed value of session variable
- * @access public
- */
- public function get($name)
- {
- if (isset($_SESSION[$name])) {
- return $_SESSION[$name];
- } else {
- return false;
- }
- }
-
- /**
- * Deletes a session variable
- *
- * @param string $name name of variable
- *
- * @return void
- * @access public
- */
- public function del($name)
- {
- unset($_SESSION[$name]);
- }
-
- /**
- * Destroys the whole session
- *
- * @return void
- * @access public
- */
- public function destroy()
- {
- $_SESSION = array();
- session_destroy();
- }
-
- /**
- * @return XnewsletterSession
- */
- public static function &getInstance()
- {
- static $_sess;
- if (!isset($_sess)) {
- $_sess = new XnewsletterSession();
- }
-
- return $_sess;
- }
-}
Modified: XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/subscr.php
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/subscr.php 2015-02-03 22:20:34 UTC (rev 12964)
+++ XoopsModules/xnewsletter/branches/luciorota/xnewsletter/class/subscr.php 2015-02-03 22:32:13 UTC (rev 12965)
@@ -48,7 +48,7 @@
$this->initVar('subscr_email', XOBJ_DTYPE_TXTBOX, '', false, 255);
$this->initVar('subscr_firstname', XOBJ_DTYPE_TXTBOX, '', true, 255);
$this->initVar('subscr_lastname', XOBJ_DTYPE_TXTBOX, '', false, 255);
- $this->initVar('subscr_uid', XOBJ_DTYPE_INT, null, false);
+ $this->initVar('subscr_uid', XOBJ_DTYPE_INT, 0, false); // default: anonymous
$this->initVar('subscr_sex', XOBJ_DTYPE_TXTBOX, '', false, 100);
$this->initVar('subscr_submitter', XOBJ_DTYPE_INT, null, false);
$this->initVar('subscr_created', XOBJ_DTYPE_INT, time(), false);
@@ -115,7 +115,8 @@
public function getForm($action = false)
{
global $xoopsUser;
- //
+ $gperm_handler = xoops_gethandler('groupperm');
+ $user_handler = xoops_gethandler('user');
xoops_load('XoopsFormLoader');
//
if ($action === false) {
@@ -123,10 +124,12 @@
}
//
$isAdmin = xnewsletter_userIsAdmin();
- $groups = is_object($xoopsUser) ? $xoopsUser->getGroups() : array(0 => XOOPS_GROUP_ANONYMOUS);
//
+ $uid = (is_object($GLOBALS['xoopsUser']) && isset($GLOBALS['xoopsUser'])) ? $GLOBALS['xoopsUser']->uid() : 0;
+ $groups = is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getGroups() : array(0 => XOOPS_GROUP_ANONYMOUS);
+ //
$title = $this->isNew() ? sprintf(_MA_XNEWSLETTER_SUBSCRIPTION_ADD) : sprintf(_MA_XNEWSLETTER_SUBSCRIPTION_EDIT);
- $form = new XoopsThemeForm($title, 'form', $action, 'post', true);
+ $form = new XoopsThemeForm($title, 'form', $action, 'post', true);
$form->setExtra('enctype="multipart/form-data"');
//
$form->addElement(new XoopsFormLabel("<span style='text-decoration:underline'>" . _MA_XNEWSLETTER_SUBSCRIPTION_INFO_PERS . "</span>", ''));
@@ -155,17 +158,11 @@
//
$form->addElement(new XoopsFormLabel('<br/><br/>', ''));
// get newsletters available for current user
- $opt_cat = array();
- $opt_tray = new XoopsFormElementTray("<span style='text-decoration:underline'>" . _MA_XNEWSLETTER_SUBSCRIPTION_CATS_AVAIL . "</span>", "<br />");
- $opt_tray->setDescription(_MA_XNEWSLETTER_SUBSCRIPTION_CATS_AVAIL_DESC);
- $gperm_handler = xoops_gethandler('groupperm');
- $uid = (is_object($GLOBALS['xoopsUser']) && isset($GLOBALS['xoopsUser'])) ? $GLOBALS['xoopsUser']->uid() : 0;
- $groups = is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getGroups() : array(0 => XOOPS_GROUP_ANONYMOUS);
// cats[], existing_catsubcr_id_{$cat_id}, existing_catsubscr_quited_{$cat_id}
$catCriteria = new CriteriaCompo();
$catCriteria->setSort('cat_id');
$catCriteria->setOrder('ASC');
- $catObjs = $this->xnewsletter->getHandler('cat')->getAll($catCriteria);
+ $catObjs = $this->xnewsletter->getHandler('cat')->getAll($catCriteria);
$cat_checkbox = new XoopsFormCheckBox(_MA_XNEWSLETTER_SUBSCRIPTION_SELECT_CATS, "cats", null, '<br />');
$cat_checkbox->setDescription(_MA_XNEWSLETTER_SUBSCRIPTION_CATS_AVAIL_DESC);
$values = array();
@@ -177,16 +174,16 @@
// get existing catsubscr
$catsubscrCriteria = new CriteriaCompo();
$catsubscrCriteria->add(new Criteria('catsubscr_catid', $cat_id));
- $catsubscrCriteria->add(new Criteria('catsubscr_subscrid', $subscr_id));
+ $catsubscrCriteria->add(new Criteria('catsubscr_subscrid', $this->getVar('subscr_id')));
$catsubscrCriteria->setLimit(1);
$catsubscrObjs = $this->xnewsletter->getHandler('catsubscr')->getObjects($catsubscrCriteria);
if (isset($catsubscrObjs[0])) {
- $values[] = $cat_id;
+ $values[] = $cat_id;
$catsubscr_quited = $catsubscrObjs[0]->getVar('catsubscr_quited');
- $catsubscr_id = $catsubscrObjs[0]->getVar('catsubscr_id');
+ $catsubscr_id = $catsubscrObjs[0]->getVar('catsubscr_id');
} else {
$catsubscr_quited = 0;
- $catsubscr_id = 0;
+ $catsubscr_id = 0;
}
$name = $catObj->getVar('cat_name');
$name .= "<div>" . $catObj->getVar('cat_info', 's') . "</div>";
@@ -225,10 +222,9 @@
return $form;
}
- //**********************************************************************************************
- // form for admin aerea *******************************************************************
- //**********************************************************************************************
/**
+ * Form for admin area
+ * * *
* @param bool $action
*
* @return XoopsThemeForm
@@ -236,7 +232,8 @@
public function getFormAdmin($action = false)
{
global $xoopsUser;
- //
+ $gperm_handler = xoops_gethandler('groupperm');
+ $user_handler = xoops_gethandler('user');
xoops_load('XoopsFormLoader');
//
if ($action === false) {
@@ -244,26 +241,87 @@
}
//
$isAdmin = xnewsletter_userIsAdmin();
- $groups = is_object($xoopsUser) ? $xoopsUser->getGroups() : array(0 => XOOPS_GROUP_ANONYMOUS);
+ $subscr_uid = $this->getVar('subscr_uid');
+ $subscr_xoopsUser = $user_handler->get($subscr_uid);
+ $subscr_groups = is_object($subscr_xoopsUser) ? $subscr_xoopsUser->getGroups() : array(0 => XOOPS_GROUP_ANONYMOUS);
//
$title = $this->isNew() ? sprintf(_AM_XNEWSLETTER_SUBSCR_ADD) : sprintf(_AM_XNEWSLETTER_SUBSCR_EDIT);
$form = new XoopsThemeForm($title, 'form', $action, 'post', true);
$form->setExtra('enctype="multipart/form-data"');
+ // subscr: subscr_email
+ if ($subscr_id > 0 || $this->getVar('subscr_email') != '') {
+ $form->addElement(new XoopsFormLabel(_AM_XNEWSLETTER_SUBSCR_EMAIL, $this->getVar('subscr_email')));
+ $form->addElement(new XoopsFormHidden('subscr_email', $this->getVar('subscr_email')));
+ } else {
+ $form->addElement(new XoopsFormText(_AM_XNEWSLETTER_SUBSCR_EMAIL, 'subscr_email', 50, 255, $this->getVar('subscr_email')), true);
+ }
// subscr: subscr_sex
- $form->addElement(new XoopsFormText(_AM_XNEWSLETTER_SUBSCR_EMAIL, 'subscr_email', 50, 255, $this->getVar('subscr_email')), true);
- $select_subscr_sex = new XoopsFormSelect(_AM_XNEWSLETTER_SUBSCR_SEX, 'subscr_sex', $this->getVar('subscr_sex'));
- $select_subscr_sex->addOption(_AM_XNEWSLETTER_SUBSCR_SEX_EMPTY, _AM_XNEWSLETTER_SUBSCR_SEX_EMPTY);
- $select_subscr_sex->addOption(_AM_XNEWSLETTER_SUBSCR_SEX_FEMALE, _AM_XNEWSLETTER_SUBSCR_SEX_FEMALE);
- $select_subscr_sex->addOption(_AM_XNEWSLETTER_SUBSCR_SEX_MALE, _AM_XNEWSLETTER_SUBSCR_SEX_MALE);
- $select_subscr_sex->addOption(_AM_XNEWSLETTER_SUBSCR_SEX_COMP, _AM_XNEWSLETTER_SUBSCR_SEX_COMP);
- $select_subscr_sex->addOption(_AM_XNEWSLETTER_SUBSCR_SEX_FAMILY, _AM_XNEWSLETTER_SUBSCR_SEX_FAMILY);
- $form->addElement($select_subscr_sex);
+ if ($this->xnewsletter->getConfig('xn_use_salutation') == 1) {
+ $select_subscr_sex = new XoopsFormSelect(_AM_XNEWSLETTER_SUBSCR_SEX, 'subscr_sex', $this->getVar('subscr_sex'));
+ $select_subscr_sex->addOption(_AM_XNEWSLETTER_SUBSCR_SEX_EMPTY, _AM_XNEWSLETTER_SUBSCR_SEX_EMPTY);
+ $select_subscr_sex->addOption(_AM_XNEWSLETTER_SUBSCR_SEX_FEMALE, _AM_XNEWSLETTER_SUBSCR_SEX_FEMALE);
+ $select_subscr_sex->addOption(_AM_XNEWSLETTER_SUBSCR_SEX_MALE, _AM_XNEWSLETTER_SUBSCR_SEX_MALE);
+ $select_subscr_sex->addOption(_AM_XNEWSLETTER_SUBSCR_SEX_COMP, _AM_XNEWSLETTER_SUBSCR_SEX_COMP);
+ $select_subscr_sex->addOption(_AM_XNEWSLETTER_SUBSCR_SEX_FAMILY, _AM_XNEWSLETTER_SUBSCR_SEX_FAMILY);
+ $form->addElement($select_subscr_sex);
+ }
// subscr: subscr_firstname
$form->addElement(new XoopsFormText(_AM_XNEWSLETTER_SUBSCR_FIRSTNAME, 'subscr_firstname', 50, 255, $this->getVar('subscr_firstname')), false);
// subscr: subscr_lastname
$form->addElement(new XoopsFormText(_AM_XNEWSLETTER_SUBSCR_LASTNAME, 'subscr_lastname', 50, 255, $this->getVar('subscr_lastname')), false);
// subscr: subscr_uid
$form->addElement(new XoopsFormSelectUser(_AM_XNEWSLETTER_SUBSCR_UID, 'subscr_uid', true, $this->getVar('subscr_uid'), 1, false), false);
+ // subscr: subscr_activated
+ $form->addElement(new XoopsFormRadioYN(_AM_XNEWSLETTER_SUBSCR_ACTIVATED, 'subscr_activated', $this->getVar('subscr_activated')));
+ // get newsletters available for subscr
+ // cats[], existing_catsubcr_id_{$cat_id}, existing_catsubscr_quited_{$cat_id}
+ $catCriteria = new CriteriaCompo();
+ $catCriteria->setSort('cat_id');
+ $catCriteria->setOrder('ASC');
+ $catObjs = $this->xnewsletter->getHandler('cat')->getAll($catCriteria);
+ $cat_checkbox = new XoopsFormCheckBox(_MA_XNEWSLETTER_SUBSCRIPTION_SELECT_CATS, "cat_ids", null, '<br />');
+ $cat_checkbox->setDescription(_MA_XNEWSLETTER_SUBSCRIPTION_CATS_AVAIL_DESC);
+ $values = array();
+ foreach ($catObjs as $cat_id => $catObj) {
+ // if anonymous user or Xoops user can read cat...
+ if ($gperm_handler->checkRight('newsletter_read_cat', $cat_id, XOOPS_GROUP_ANONYMOUS, $this->xnewsletter->getModule()->mid())
+ || $gperm_handler->checkRight('newsletter_read_cat', $cat_id, $subscr_groups, $this->xnewsletter->getModule()->mid())
+ ) {
+ // get existing catsubscr
+ $catsubscrCriteria = new CriteriaCompo();
+ $catsubscrCriteria->add(new Criteria('catsubscr_catid', $cat_id));
+ $catsubscrCriteria->add(new Criteria('catsubscr_subscrid', $this->getVar('subscr_id')));
+ $catsubscrCriteria->setLimit(1);
+ $catsubscrObjs = $this->xnewsletter->getHandler('catsubscr')->getObjects($catsubscrCriteria);
+ if (isset($catsubscrObjs[0])) {
+ $values[] = $cat_id;
+ $catsubscr_quited = $catsubscrObjs[0]->getVar('catsubscr_quited');
+ $catsubscr_id = $catsubscrObjs[0]->getVar('catsubscr_id');
+ } else {
+ $catsubscr_quited = 0;
+ $catsubscr_id = 0;
+ }
+ $name = $catObj->getVar('cat_name');
+ $name .= "<div>" . $catObj->getVar('cat_info', 's') . "</div>";
+ if ($catsubscr_quited == 0) {
+ // NOP
+ } else {
+ $name .= "<div>";
+ $name .= str_replace("%q", formatTimeStamp($catsubscr_quited, $this->xnewsletter->getConfig('dateformat')), _MA_XNEWSLETTER_SUBSCRIPTION_QUITED_DETAIL);
+ $name .= "</div>";
+ }
+ ...
[truncated message content] |
|
From: <luc...@us...> - 2015-02-16 19:07:52
|
Revision: 12985
http://sourceforge.net/p/xoops/svn/12985
Author: luciorota
Date: 2015-02-16 19:07:35 +0000 (Mon, 16 Feb 2015)
Log Message:
-----------
update PHPMailer
update html2text
fixed bug in text decoding
Modified Paths:
--------------
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/accounts.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/letter.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/template.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/functions.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/functions.task.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/html2text/html2text.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/phpmailer/PHPMailerAutoload.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/phpmailer/class.phpmailer.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/phpmailer/class.pop3.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/phpmailer/class.smtp.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/phpmailer/extras/EasyPeasyICS.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/phpmailer/extras/README.md
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/phpmailer/extras/htmlfilter.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/phpmailer/extras/ntlm_sasl_client.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/phpmailer/language/phpmailer.lang-ar.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/phpmailer/language/phpmailer.lang-be.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/phpmailer/language/phpmailer.lang-br.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/phpmailer/language/phpmailer.lang-ca.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/phpmailer/language/phpmailer.lang-ch.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/phpmailer/language/phpmailer.lang-cz.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/phpmailer/language/phpmailer.lang-de.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/phpmailer/language/phpmailer.lang-dk.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/phpmailer/language/phpmailer.lang-el.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/phpmailer/language/phpmailer.lang-eo.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/phpmailer/language/phpmailer.lang-es.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/phpmailer/language/phpmailer.lang-et.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/phpmailer/language/phpmailer.lang-fa.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/phpmailer/language/phpmailer.lang-fi.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/phpmailer/language/phpmailer.lang-fo.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/phpmailer/language/phpmailer.lang-fr.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/phpmailer/language/phpmailer.lang-gl.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/phpmailer/language/phpmailer.lang-he.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/phpmailer/language/phpmailer.lang-hr.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/phpmailer/language/phpmailer.lang-hu.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/phpmailer/language/phpmailer.lang-it.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/phpmailer/language/phpmailer.lang-ja.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/phpmailer/language/phpmailer.lang-ka.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/phpmailer/language/phpmailer.lang-lt.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/phpmailer/language/phpmailer.lang-lv.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/phpmailer/language/phpmailer.lang-nl.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/phpmailer/language/phpmailer.lang-no.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/phpmailer/language/phpmailer.lang-pl.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/phpmailer/language/phpmailer.lang-pt.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/phpmailer/language/phpmailer.lang-ro.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/phpmailer/language/phpmailer.lang-ru.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/phpmailer/language/phpmailer.lang-se.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/phpmailer/language/phpmailer.lang-sk.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/phpmailer/language/phpmailer.lang-sr.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/phpmailer/language/phpmailer.lang-tr.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/phpmailer/language/phpmailer.lang-uk.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/phpmailer/language/phpmailer.lang-vi.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/phpmailer/language/phpmailer.lang-zh.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/phpmailer/language/phpmailer.lang-zh_cn.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/letter.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/xoops_version.php
Added Paths:
-----------
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/html2text/README.md
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/html2text/src/
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/html2text/src/Html2Text.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/html2text/src/Html2TextException.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/phpmailer/language/phpmailer.lang-az.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/phpmailer/language/phpmailer.lang-id.php
XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/phpmailer/language/phpmailer.lang-ms.php
Modified: XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/accounts.php
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/accounts.php 2015-02-16 19:00:46 UTC (rev 12984)
+++ XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/accounts.php 2015-02-16 19:07:35 UTC (rev 12985)
@@ -200,6 +200,7 @@
imap_close($mbox);
}
echo "</table>";
+ include_once __DIR__ . '/admin_footer.php';
break;
case 'list':
Modified: XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/letter.php
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/letter.php 2015-02-16 19:00:46 UTC (rev 12984)
+++ XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/letter.php 2015-02-16 19:07:35 UTC (rev 12985)
@@ -98,7 +98,7 @@
echo $htmlBody;
echo "</div>";
echo "<div style='padding:10px; margin:0px; border:1px solid black; font-family: monospace;'>";
- echo nl2br(utf8_encode($textBody));
+ echo nl2br(utf8_decode($textBody));
echo "</div>";
echo "</div>";
include_once __DIR__ . '/admin_footer.php';
Modified: XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/template.php
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/template.php 2015-02-16 19:00:46 UTC (rev 12984)
+++ XoopsModules/xnewsletter/branches/luciorota/xnewsletter/admin/template.php 2015-02-16 19:07:35 UTC (rev 12985)
@@ -87,7 +87,7 @@
echo $htmlBody;
echo "</div>";
echo "<div style='padding:10px;border:1px solid black; font-family: monospace;'>";
- echo nl2br(utf8_encode($textBody));
+ echo nl2br(utf8_decode($textBody));
echo "</div>";
echo "</div>";
include_once __DIR__ . '/admin_footer.php';
Modified: XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/functions.php
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/functions.php 2015-02-16 19:00:46 UTC (rev 12984)
+++ XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/functions.php 2015-02-16 19:07:35 UTC (rev 12985)
@@ -555,7 +555,7 @@
$htmlBody = $letterTpl->fetch($template);
}
$textBody = xnewsletter_html2text($htmlBody); // new from v1.3
- //$textBody = mb_convert_encoding($textBody, 'ISO-8859-1', _CHARSET); // "text/plain; charset=us-ascii" [http://www.w3.org/Protocols/rfc1341/7_1_Text.html]
+ $textBody = mb_convert_encoding($textBody, 'ISO-8859-1', _CHARSET); // "text/plain; charset=us-ascii" [http://www.w3.org/Protocols/rfc1341/7_1_Text.html]
// get letter attachments as attachment
$attachmentAsAttachmentCriteria = new CriteriaCompo();
@@ -591,7 +591,7 @@
$mail->Subject = html_entity_decode($letter_title, ENT_QUOTES);
$mail->AddAddress($letterObj->getVar('letter_email_test'), _AM_XNEWSLETTER_SUBSCR_FIRSTNAME_PREVIEW . " " . _AM_XNEWSLETTER_SUBSCR_LASTNAME_PREVIEW);
- $mail->MsgHTML($htmlBody); // $mail->Body = $htmlBody;
+ $mail->Body = $htmlBody;
$mail->AltBody = $textBody;
foreach ($attachmentsPath as $attachmentPath) {
Modified: XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/functions.task.php
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/functions.task.php 2015-02-16 19:00:46 UTC (rev 12984)
+++ XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/functions.task.php 2015-02-16 19:07:35 UTC (rev 12985)
@@ -373,10 +373,10 @@
$htmlBody = $letterTpl->fetch($template);
}
$textBody = xnewsletter_html2text($htmlBody); // new from v1.3
- //$textBody = mb_convert_encoding($textBody, 'ISO-8859-1', _CHARSET); // "text/plain; charset=us-ascii" [http://www.w3.org/Protocols/rfc1341/7_1_Text.html]
+ $textBody = mb_convert_encoding($textBody, 'ISO-8859-1', _CHARSET); // "text/plain; charset=us-ascii" [http://www.w3.org/Protocols/rfc1341/7_1_Text.html]
$mail->AddAddress($recipient['address'], $recipient['firstname'] . ' ' . $recipient['lastname']);
- $mail->MsgHTML($htmlBody); // $mail->Body = $htmlBody;
+ $mail->Body = $htmlBody;
$mail->AltBody = $textBody;
foreach ($attachmentsPath as $attachmentPath) {
Added: XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/html2text/README.md
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/html2text/README.md (rev 0)
+++ XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/html2text/README.md 2015-02-16 19:07:35 UTC (rev 12985)
@@ -0,0 +1,71 @@
+html2text
+=========
+
+html2text is a very simple script that uses PHP's DOM methods to load from HTML, and then iterates over the resulting DOM to correctly output plain text. For example:
+
+```html
+<html>
+<title>Ignored Title</title>
+<body>
+ <h1>Hello, World!</h1>
+
+ <p>This is some e-mail content.
+ Even though it has whitespace and newlines, the e-mail converter
+ will handle it correctly.
+
+ <p>Even mismatched tags.</p>
+
+ <div>A div</div>
+ <div>Another div</div>
+ <div>A div<div>within a div</div></div>
+
+ <a href="http://foo.com">A link</a>
+
+</body>
+</html>
+```
+
+Will be converted into:
+
+```text
+Hello, World!
+
+This is some e-mail content. Even though it has whitespace and newlines, the e-mail converter will handle it correctly.
+
+Even mismatched tags.
+A div
+Another div
+A div
+within a div
+[A link](http://foo.com)
+```
+
+See the [original blog post](http://journals.jevon.org/users/jevon-phd/entry/19818) or the related [StackOverflow answer](http://stackoverflow.com/a/2564472/39531).
+
+## Installing
+
+You can use [Composer](http://getcomposer.org/) to add the [package](https://packagist.org/packages/soundasleep/html2text) to your project:
+
+```json
+{
+ "require": {
+ "soundasleep/html2text": "~0.2"
+ }
+}
+```
+
+And then use it quite simply:
+
+```php
+$text = Html2Text\Html2Text::convert($html);
+```
+
+You can also include the supplied `html2text.php` and use `$text = convert_html_to_text($html);` instead.
+
+## Tests
+
+Some very basic tests are provided in the `tests/` directory. Run them with `composer install --dev && vendor/bin/phpunit`.
+
+## License
+
+`html2text` is dual licensed under both [EPL v1.0](https://www.eclipse.org/legal/epl-v10.html) and [LGPL v3.0](http://www.gnu.org/licenses/lgpl.html), making it suitable for both Eclipse and GPL projects.
Modified: XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/html2text/html2text.php
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/html2text/html2text.php 2015-02-16 19:00:46 UTC (rev 12984)
+++ XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/html2text/html2text.php 2015-02-16 19:07:35 UTC (rev 12985)
@@ -6,262 +6,27 @@
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
+ * or
+ *
+ * LGPL which is available at http://www.gnu.org/licenses/lgpl.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 the $html
- *
- * @throws Html2TextException
- * @internal param \the $html input HTML
- * @return the HTML converted, as best as possible, to text
+ * This file is available if you still want to use functions rather than
+ * autoloading classes.
*/
-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);
- }
+require_once(__DIR__ . "/src/Html2Text.php");
+require_once(__DIR__ . "/src/Html2TextException.php");
- $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;
+function convert_html_to_text($html) {
+ return Html2Text\Html2Text::convert($html);
}
-/**
- * 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 fix_newlines($text) {
+ return Html2Text\Html2Text::fixNewlines($text);
}
-
-/**
- * @param $node
- *
- * @return null|string
- */
-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;
-}
-
-/**
- * @param $node
- *
- * @return null|string
- */
-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;
-}
-
-/**
- * @param $node
- *
- * @return string
- */
-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
- */
-class Html2TextException extends Exception
-{
- var $more_info;
-
- /**
- * @param string $message
- * @param string $more_info
- */
- public function __construct($message = "", $more_info = "")
- {
- parent::__construct($message);
- $this->more_info = $more_info;
- }
-}
Added: XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/html2text/src/Html2Text.php
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/html2text/src/Html2Text.php (rev 0)
+++ XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/html2text/src/Html2Text.php 2015-02-16 19:07:35 UTC (rev 12985)
@@ -0,0 +1,240 @@
+<?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
+ *
+ * or
+ *
+ * LGPL which is available at http://www.gnu.org/licenses/lgpl.html
+ *
+ *
+ * Contributors:
+ * Jevon Wright - initial API and implementation
+ ****************************************************************************/
+
+namespace Html2Text;
+
+class Html2Text {
+
+ /**
+ * 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 string html the input HTML
+ * @return string the HTML converted, as best as possible, to text
+ * @throws Html2TextException if the HTML could not be loaded as a {@link DOMDocument}
+ */
+ static function convert($html) {
+ $html = static::fixNewlines($html);
+
+ $doc = new \DOMDocument();
+ if (!$doc->loadHTML($html)) {
+ throw new Html2TextException("Could not load HTML - badly formed?", $html);
+ }
+
+ $output = static::iterateOverNode($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 string text text with any number of \r, \r\n and \n combinations
+ * @return string the fixed text
+ */
+ static function fixNewlines($text) {
+ // replace \r\n to \n
+ $text = str_replace("\r\n", "\n", $text);
+ // remove \rs
+ $text = str_replace("\r", "\n", $text);
+
+ return $text;
+ }
+
+ static function nextChildName($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;
+ }
+
+ static function prevChildName($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;
+ }
+
+ static function iterateOverNode($node) {
+ if ($node instanceof \DOMText) {
+ // Replace whitespace characters with a space (equivilant to \s)
+ return preg_replace("/[\\t\\n\\f\\r ]+/im", " ", $node->wholeText);
+ }
+ if ($node instanceof \DOMDocumentType) {
+ // ignore
+ return "";
+ }
+
+ $nextName = static::nextChildName($node);
+ $prevName = static::prevChildName($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, second line is added below
+ $output = "\n";
+ break;
+
+ case "td":
+ case "th":
+ // add tab char to separate table fields
+ $output = "\t";
+ break;
+
+ case "tr":
+ case "p":
+ case "div":
+ // add one line
+ $output = "\n";
+ break;
+
+ default:
+ // print out contents of unknown tags
+ $output = "";
+ break;
+ }
+
+ // debug
+ //$output .= "[$name,$nextName]";
+
+ if (isset($node->childNodes)) {
+ for ($i = 0; $i < $node->childNodes->length; $i++) {
+ $n = $node->childNodes->item($i);
+
+ $text = static::iterateOverNode($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 || $href == "mailto:$output" || $href == "http://$output" || $href == "https://$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;
+ }
+
+}
Added: XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/html2text/src/Html2TextException.php
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/html2text/src/Html2TextException.php (rev 0)
+++ XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/html2text/src/Html2TextException.php 2015-02-16 19:07:35 UTC (rev 12985)
@@ -0,0 +1,28 @@
+<?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
+ *
+ * or
+ *
+ * LGPL which is available at http://www.gnu.org/licenses/lgpl.html
+ *
+ *
+ * Contributors:
+ * Jevon Wright - initial API and implementation
+ ****************************************************************************/
+
+namespace Html2Text;
+
+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/phpmailer/PHPMailerAutoload.php
===================================================================
--- XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/phpmailer/PHPMailerAutoload.php 2015-02-16 19:00:46 UTC (rev 12984)
+++ XoopsModules/xnewsletter/branches/luciorota/xnewsletter/include/phpmailer/PHPMailerAutoload.php 2015-02-16 19:07:35 UTC (rev 12985)
@@ -2,31 +2,29 @@
/**
* PHPMailer SPL autoloader.
* PHP Version 5
- *
- * @package PHPMailer
- * @link https://github.com/PHPMailer/PHPMailer/ The PHPMailer GitHub project
- * @author Marcus Bointon (Synchro/coolbru) <php...@sy...>
- * @author Jim Jagielski (jimjag) <ji...@gm...>
- * @author Andy Prevost (codeworxtech) <cod...@us...>
- * @author Brent R. Matzelle (original founder)
+ * @package PHPMailer
+ * @link https://github.com/PHPMailer/PHPMailer/ The PHPMailer GitHub project
+ * @author Marcus Bointon (Synchro/coolbru) <php...@sy...>
+ * @author Jim Jagielski (jimjag) <ji...@gm...>
+ * @author Andy Prevost (codeworxtech) <cod...@us...>
+ * @author Brent R. Matzelle (original founder)
* @copyright 2012 - 2014 Marcus Bointon
* @copyright 2010 - 2012 Jim Jagielski
* @copyright 2004 - 2009 Andy Prevost
- * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
- * @note This program is distributed in the hope that it will be useful - WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.
+ * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
+ * @note This program is distributed in the hope that it will be useful - WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS...
[truncated message content] |