cl_nl: recodings for new pluginmanager
Dieser Commit ist enthalten in:
Ursprung
3490184008
Commit
3bf883e336
|
@ -0,0 +1,82 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||||
|
<plugin>
|
||||||
|
<general active="1">
|
||||||
|
<plugin_name>ConLite Newsletter</plugin_name>
|
||||||
|
<plugin_foldername>cl_newsletter</plugin_foldername>
|
||||||
|
<uuid>45D7F1F3-41E9-57BC-8987-C0550B3B07B8</uuid>
|
||||||
|
<description>ConLite Newsletter System</description>
|
||||||
|
<author>ConLite Team</author>
|
||||||
|
<copyright>ConLite Team</copyright>
|
||||||
|
<mail>cl_newsletter@conlite.org</mail>
|
||||||
|
<website>https://conlite.org</website>
|
||||||
|
<version>1.0.0</version>
|
||||||
|
</general>
|
||||||
|
<requirements php="5.6">
|
||||||
|
<conlite minversion="2.1.0" />
|
||||||
|
</requirements>
|
||||||
|
<conlite>
|
||||||
|
<areas>
|
||||||
|
<area menuless="0">news</area>
|
||||||
|
<area parent="news" menuless="0">news_edit</area>
|
||||||
|
<area parent="news" menuless="0">news_edittpl</area>
|
||||||
|
<area parent="news" menuless="0">news_editcontent</area>
|
||||||
|
<area parent="news" menuless="0">news_jobs</area>
|
||||||
|
<area menuless="0">recipients</area>
|
||||||
|
<area parent="recipients" menuless="0">recipients_import</area>
|
||||||
|
<area menuless="0">recipientgroups</area>
|
||||||
|
</areas>
|
||||||
|
<actions>
|
||||||
|
<action area="news">news_save</action>
|
||||||
|
<action area="news">news_create</action>
|
||||||
|
<action area="news">news_delete</action>
|
||||||
|
<action area="news">news_duplicate</action>
|
||||||
|
<action area="news">news_add_job</action>
|
||||||
|
<action area="news">news_send_test</action>
|
||||||
|
<action area="news_jobs">news_job_delete</action>
|
||||||
|
<action area="news_jobs">news_job_details</action>
|
||||||
|
<action area="news_jobs">news_job_detail_delete</action>
|
||||||
|
<action area="news">news_html_settings</action>
|
||||||
|
<action area="news_jobs">news_job_run</action>
|
||||||
|
<action area="recipients">recipients_save</action>
|
||||||
|
<action area="recipients">recipients_create</action>
|
||||||
|
<action area="recipients">recipients_delete</action>
|
||||||
|
<action area="recipientgroups">recipientgroup_delete</action>
|
||||||
|
<action area="recipientgroups">recipientgroup_create</action>
|
||||||
|
<action area="recipientgroups">recipientgroup_recipient_delete</action>
|
||||||
|
<action area="recipientgroups">recipientgroup_save_group</action>
|
||||||
|
<action area="recipients">recipients_purge</action>
|
||||||
|
<action area="recipients_import">recipients_import</action>
|
||||||
|
<action area="recipients_import">recipients_import_exec</action>
|
||||||
|
</actions>
|
||||||
|
<frames>
|
||||||
|
<frame area="news" filetype="main" name="cl_newsletter/includes/include.newsletter_edit.php" frameId="4" />
|
||||||
|
<frame area="news" filetype="main" name="cl_newsletter/includes/include.newsletter_left_top.php" frameId="1" />
|
||||||
|
<frame area="news" filetype="main" name="cl_newsletter/includes/include.newsletter_menu.php" frameId="2" />
|
||||||
|
<frame area="news" filetype="main" name="cl_newsletter/includes/include.newsletter_subnav.php" frameId="3" />
|
||||||
|
<frame area="news" filetype="inc" name="functions.forms.php" frameId="4" />
|
||||||
|
|
||||||
|
<frame area="news_edit" filetype="main" name="cl_newsletter/includes/include.newsletter_edit_message.php" frameId="4" />
|
||||||
|
|
||||||
|
<frame area="recipients" filetype="main" name="cl_newsletter/includes/include.recipients_edit.php" frameId="4" />
|
||||||
|
<frame area="recipients" filetype="main" name="cl_newsletter/includes/include.recipients_menu.php" frameId="2" />
|
||||||
|
<frame area="recipients" filetype="main" name="cl_newsletter/includes/include.recipients_left_top.php" frameId="1" />
|
||||||
|
<frame area="recipients" filetype="inc" name="functions.forms.php" frameId="4" />
|
||||||
|
<frame area="recipients" filetype="main" name="include.subnav_blank.php" frameId="3" />
|
||||||
|
|
||||||
|
<frame area="recipientgroups" filetype="main" name="cl_newsletter/includes/include.recipients.group.subnav.php" frameId="3" />
|
||||||
|
<frame area="recipientgroups" filetype="main" name="cl_newsletter/includes/include.recipients.group_edit.php" frameId="4" />
|
||||||
|
<frame area="recipientgroups" filetype="main" name="cl_newsletter/includes/include.recipients.group_menu.php" frameId="2" />
|
||||||
|
|
||||||
|
<frame area="news_jobs" filetype="main" name="cl_newsletter/includes/include.newsletter_jobs_details.php" frameId="4" />
|
||||||
|
<frame area="news_jobs" filetype="main" name="cl_newsletter/includes/include.newsletter_jobs_menu.php" frameId="2" />
|
||||||
|
<frame area="news_jobs" filetype="main" name="cl_newsletter/includes/include.newsletter_jobs_subnav.php" frameId="3" />
|
||||||
|
|
||||||
|
<frame area="recipients_import" filetype="main" name="cl_newsletter/includes/include.recipients_import.php" frameId="4" />
|
||||||
|
</frames>
|
||||||
|
<nav_sub>
|
||||||
|
<nav area="news" level="0" navm="extra">newsletter/xml/;navigation/extra/newsletter</nav>
|
||||||
|
<nav area="recipients" level="1" navm="extra">newsletter/xml/;navigation/extra/recipients</nav>
|
||||||
|
<nav area="recipientgroups" level="1" navm="extra">newsletter/xml/;navigation/extra/recipientgroups</nav>
|
||||||
|
</nav_sub>
|
||||||
|
</conlite>
|
||||||
|
</plugin>
|
|
@ -48,12 +48,6 @@ class RecipientGroupCollection extends ItemCollection {
|
||||||
$this->_setItemClass("RecipientGroup");
|
$this->_setItemClass("RecipientGroup");
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @deprecated [2011-03-15] Old constructor function for downwards compatibility */
|
|
||||||
public function RecipientGroupCollection() {
|
|
||||||
cWarning(__FILE__, __LINE__, "Deprecated method call, use __construct()");
|
|
||||||
$this->__construct();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new group
|
* Creates a new group
|
||||||
* @param $groupname string Specifies the groupname
|
* @param $groupname string Specifies the groupname
|
||||||
|
@ -126,12 +120,6 @@ class RecipientGroup extends Item {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @deprecated [2011-03-15] Old constructor function for downwards compatibility */
|
|
||||||
public function RecipientGroup($mId = false) {
|
|
||||||
cWarning(__FILE__, __LINE__, "Deprecated method call, use __construct()");
|
|
||||||
$this->__construct($mId);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Overriden store() method to ensure, that there is only one default group
|
* Overriden store() method to ensure, that there is only one default group
|
||||||
* */
|
* */
|
||||||
|
@ -176,12 +164,6 @@ class RecipientGroupMemberCollection extends ItemCollection {
|
||||||
$this->_setItemClass("RecipientGroupMember");
|
$this->_setItemClass("RecipientGroupMember");
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @deprecated [2011-03-15] Old constructor function for downwards compatibility */
|
|
||||||
public function RecipientGroupMemberCollection() {
|
|
||||||
cWarning(__FILE__, __LINE__, "Deprecated method call, use __construct()");
|
|
||||||
$this->__construct();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new association
|
* Creates a new association
|
||||||
* @param $idrecipientgroup int specifies the newsletter group
|
* @param $idrecipientgroup int specifies the newsletter group
|
||||||
|
@ -303,12 +285,4 @@ class RecipientGroupMember extends Item {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @deprecated [2011-03-15] Old constructor function for downwards compatibility */
|
|
||||||
public function RecipientGroupMember($mId = false) {
|
|
||||||
cWarning(__FILE__, __LINE__, "Deprecated method call, use __construct()");
|
|
||||||
$this->__construct($mId);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
|
|
@ -48,12 +48,6 @@ class cNewsletterJobCollection extends ItemCollection {
|
||||||
$this->_setItemClass("cNewsletterJob");
|
$this->_setItemClass("cNewsletterJob");
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @deprecated [2011-03-15] Old constructor function for downwards compatibility */
|
|
||||||
public function cNewsletterJobCollection() {
|
|
||||||
cWarning(__FILE__, __LINE__, "Deprecated method call, use __construct()");
|
|
||||||
$this->__construct();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a newsletter job
|
* Creates a newsletter job
|
||||||
* @param $name string Specifies the name of the newsletter, the same name may be used more than once
|
* @param $name string Specifies the name of the newsletter, the same name may be used more than once
|
||||||
|
@ -252,12 +246,6 @@ class cNewsletterJob extends Item {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @deprecated [2011-03-15] Old constructor function for downwards compatibility */
|
|
||||||
public function cNewsletterJob($mId = false) {
|
|
||||||
cWarning(__FILE__, __LINE__, "Deprecated method call, use __construct()");
|
|
||||||
$this->__construct($mId);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function runJob() {
|
public function runJob() {
|
||||||
global $cfg, $recipient;
|
global $cfg, $recipient;
|
||||||
|
|
|
@ -48,12 +48,6 @@ class cNewsletterLogCollection extends ItemCollection {
|
||||||
$this->_setItemClass("cNewsletterLog");
|
$this->_setItemClass("cNewsletterLog");
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @deprecated [2011-03-15] Old constructor function for downwards compatibility */
|
|
||||||
public function cNewsletterLogCollection() {
|
|
||||||
cWarning(__FILE__, __LINE__, "Deprecated method call, use __construct()");
|
|
||||||
$this->__construct();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a single new log item
|
* Creates a single new log item
|
||||||
* @param $idnewsjob integer ID of corresponding newsletter send job
|
* @param $idnewsjob integer ID of corresponding newsletter send job
|
||||||
|
@ -246,12 +240,4 @@ class cNewsletterLog extends Item {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @deprecated [2011-03-15] Old constructor function for downwards compatibility */
|
|
||||||
public function cNewsletterLog($mId = false) {
|
|
||||||
cWarning(__FILE__, __LINE__, "Deprecated method call, use __construct()");
|
|
||||||
$this->__construct($mId);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
|
|
@ -1,4 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Project:
|
* Project:
|
||||||
* Contenido Content Management System
|
* Contenido Content Management System
|
||||||
|
@ -28,46 +29,35 @@
|
||||||
* }}
|
* }}
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('CON_FRAMEWORK')) {
|
if (!defined('CON_FRAMEWORK')) {
|
||||||
die('Illegal call');
|
die('Illegal call');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Newsletter management class
|
* Newsletter management class
|
||||||
*/
|
*/
|
||||||
class NewsletterCollection extends ItemCollection
|
class NewsletterCollection extends ItemCollection {
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* Constructor Function
|
* Constructor Function
|
||||||
* @param none
|
* @param none
|
||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct() {
|
||||||
{
|
|
||||||
global $cfg;
|
global $cfg;
|
||||||
parent::__construct($cfg["tab"]["news"], "idnews");
|
parent::__construct($cfg["tab"]["news"], "idnews");
|
||||||
$this->_setItemClass("Newsletter");
|
$this->_setItemClass("Newsletter");
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @deprecated [2011-03-15] Old constructor function for downwards compatibility */
|
|
||||||
public function NewsletterCollection()
|
|
||||||
{
|
|
||||||
cWarning(__FILE__, __LINE__, "Deprecated method call, use __construct()");
|
|
||||||
$this->__construct();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new newsletter
|
* Creates a new newsletter
|
||||||
* @param $name string specifies the newsletter name
|
* @param $name string specifies the newsletter name
|
||||||
*/
|
*/
|
||||||
public function create($sName)
|
public function create($sName) {
|
||||||
{
|
|
||||||
global $client, $lang, $auth;
|
global $client, $lang, $auth;
|
||||||
|
|
||||||
$sName = Contenido_Security::escapeDB($sName, null);
|
$sName = Contenido_Security::escapeDB($sName, null);
|
||||||
$client = Contenido_Security::toInteger($client);
|
$client = Contenido_Security::toInteger($client);
|
||||||
$lang = Contenido_Security::toInteger($lang);
|
$lang = Contenido_Security::toInteger($lang);
|
||||||
|
|
||||||
// Check if the newsletter name already exists
|
// Check if the newsletter name already exists
|
||||||
$this->resetQuery;
|
$this->resetQuery;
|
||||||
|
@ -77,7 +67,7 @@ class NewsletterCollection extends ItemCollection
|
||||||
$this->query();
|
$this->query();
|
||||||
|
|
||||||
if ($this->next()) {
|
if ($this->next()) {
|
||||||
return $this->create($sName."_".substr(md5(rand()), 0, 10));
|
return $this->create($sName . "_" . substr(md5(rand()), 0, 10));
|
||||||
}
|
}
|
||||||
|
|
||||||
$oItem = parent::createNewItem();
|
$oItem = parent::createNewItem();
|
||||||
|
@ -96,12 +86,11 @@ class NewsletterCollection extends ItemCollection
|
||||||
* Duplicates the newsletter specified by $itemID
|
* Duplicates the newsletter specified by $itemID
|
||||||
* @param $itemID integer specifies the newsletter id
|
* @param $itemID integer specifies the newsletter id
|
||||||
*/
|
*/
|
||||||
public function duplicate($iItemID)
|
public function duplicate($iItemID) {
|
||||||
{
|
|
||||||
global $client, $lang, $auth;
|
global $client, $lang, $auth;
|
||||||
|
|
||||||
$client = Contenido_Security::toInteger($client);
|
$client = Contenido_Security::toInteger($client);
|
||||||
$lang = Contenido_Security::toInteger($lang);
|
$lang = Contenido_Security::toInteger($lang);
|
||||||
|
|
||||||
cInclude("includes", "functions.con.php");
|
cInclude("includes", "functions.con.php");
|
||||||
|
|
||||||
|
@ -109,7 +98,7 @@ class NewsletterCollection extends ItemCollection
|
||||||
$oBaseItem->loadByPrimaryKey($iItemID);
|
$oBaseItem->loadByPrimaryKey($iItemID);
|
||||||
|
|
||||||
$oItem = parent::createNewItem();
|
$oItem = parent::createNewItem();
|
||||||
$oItem->set("name", $oBaseItem->get("name")."_".substr(md5(rand()), 0, 10));
|
$oItem->set("name", $oBaseItem->get("name") . "_" . substr(md5(rand()), 0, 10));
|
||||||
|
|
||||||
$iIDArt = 0;
|
$iIDArt = 0;
|
||||||
if ($oBaseItem->get("type") == "html" && $oBaseItem->get("idart") > 0 && $oBaseItem->get("template_idart") > 0) {
|
if ($oBaseItem->get("type") == "html" && $oBaseItem->get("idart") > 0 && $oBaseItem->get("template_idart") > 0) {
|
||||||
|
@ -117,11 +106,11 @@ class NewsletterCollection extends ItemCollection
|
||||||
|
|
||||||
if ($oClientLang->getProperty("newsletter", "html_newsletter") == "true") {
|
if ($oClientLang->getProperty("newsletter", "html_newsletter") == "true") {
|
||||||
$iIDArt = conCopyArticle($oBaseItem->get("idart"),
|
$iIDArt = conCopyArticle($oBaseItem->get("idart"),
|
||||||
$oClientLang->getProperty("newsletter", "html_newsletter_idcat"),
|
$oClientLang->getProperty("newsletter", "html_newsletter_idcat"),
|
||||||
sprintf(i18n("Newsletter: %s", "newsletter"), $oItem->get("name")));
|
sprintf(i18n("Newsletter: %s", "newsletter"), $oItem->get("name")));
|
||||||
conMakeOnline($iIDArt, $lang); // Article has to be online for sending...
|
conMakeOnline($iIDArt, $lang); // Article has to be online for sending...
|
||||||
}
|
}
|
||||||
unset ($oClientLang);
|
unset($oClientLang);
|
||||||
}
|
}
|
||||||
$oItem->set("idart", $iIDArt);
|
$oItem->set("idart", $iIDArt);
|
||||||
$oItem->set("template_idart", $oBaseItem->get("template_idart"));
|
$oItem->set("template_idart", $oBaseItem->get("template_idart"));
|
||||||
|
@ -160,13 +149,14 @@ class NewsletterCollection extends ItemCollection
|
||||||
|
|
||||||
return $oItem;
|
return $oItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Single Newsletter Item
|
* Single Newsletter Item
|
||||||
*/
|
*/
|
||||||
class Newsletter extends Item
|
class Newsletter extends Item {
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* @var string Error storage
|
* @var string Error storage
|
||||||
* @access private
|
* @access private
|
||||||
|
@ -177,8 +167,7 @@ class Newsletter extends Item
|
||||||
* Constructor Function
|
* Constructor Function
|
||||||
* @param mixed $mId Specifies the ID of item to load
|
* @param mixed $mId Specifies the ID of item to load
|
||||||
*/
|
*/
|
||||||
public function __construct($mId = false)
|
public function __construct($mId = false) {
|
||||||
{
|
|
||||||
global $cfg;
|
global $cfg;
|
||||||
parent::__construct($cfg["tab"]["news"], "idnews");
|
parent::__construct($cfg["tab"]["news"], "idnews");
|
||||||
$this->_sError = "";
|
$this->_sError = "";
|
||||||
|
@ -187,23 +176,15 @@ class Newsletter extends Item
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @deprecated [2011-03-15] Old constructor function for downwards compatibility */
|
|
||||||
public function Newsletter($mId = false)
|
|
||||||
{
|
|
||||||
cWarning(__FILE__, __LINE__, "Deprecated method call, use __construct()");
|
|
||||||
$this->__construct($mId);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Overriden store()-Method to set modified and modifiedby data and
|
* Overriden store()-Method to set modified and modifiedby data and
|
||||||
* to ensure, that there is only one welcome newsletter
|
* to ensure, that there is only one welcome newsletter
|
||||||
*/
|
*/
|
||||||
public function store()
|
public function store() {
|
||||||
{
|
|
||||||
global $client, $lang, $auth;
|
global $client, $lang, $auth;
|
||||||
|
|
||||||
$client = Contenido_Security::toInteger($client);
|
$client = Contenido_Security::toInteger($client);
|
||||||
$lang = Contenido_Security::toInteger($lang);
|
$lang = Contenido_Security::toInteger($lang);
|
||||||
|
|
||||||
$this->set("modified", date("Y-m-d H:i:s"), false);
|
$this->set("modified", date("Y-m-d H:i:s"), false);
|
||||||
$this->set("modifiedby", $auth->auth["uid"]);
|
$this->set("modifiedby", $auth->auth["uid"]);
|
||||||
|
@ -220,8 +201,8 @@ class Newsletter extends Item
|
||||||
$oItem->set("welcome", 0);
|
$oItem->set("welcome", 0);
|
||||||
$oItem->store();
|
$oItem->store();
|
||||||
}
|
}
|
||||||
unset ($oItem);
|
unset($oItem);
|
||||||
unset ($oItems);
|
unset($oItems);
|
||||||
}
|
}
|
||||||
|
|
||||||
parent::store();
|
parent::store();
|
||||||
|
@ -236,27 +217,26 @@ class Newsletter extends Item
|
||||||
* @param string sData Data
|
* @param string sData Data
|
||||||
* @access private
|
* @access private
|
||||||
*/
|
*/
|
||||||
public function _replaceTag(&$sCode, $bIsHTML, $sField, $sData)
|
public function _replaceTag(&$sCode, $bIsHTML, $sField, $sData) {
|
||||||
{
|
|
||||||
if ($sCode && !$bIsHTML) {
|
if ($sCode && !$bIsHTML) {
|
||||||
$sCode = str_replace("MAIL_".strtoupper($sField), $sData, $sCode);
|
$sCode = str_replace("MAIL_" . strtoupper($sField), $sData, $sCode);
|
||||||
} else if ($sCode) {
|
} else if ($sCode) {
|
||||||
// Extract certain tag
|
// Extract certain tag
|
||||||
$sRegExp = '/\[mail\s*([^]]+)\s*name=(?:"|")'.$sField.'(?:"|")\s*(.*?)\s*\]((?:.|\s)+?)\[\/mail\]/i';
|
$sRegExp = '/\[mail\s*([^]]+)\s*name=(?:"|")' . $sField . '(?:"|")\s*(.*?)\s*\]((?:.|\s)+?)\[\/mail\]/i';
|
||||||
$aMatch = array();
|
$aMatch = array();
|
||||||
$iMatches = preg_match($sRegExp, $sCode, $aMatch) ;
|
$iMatches = preg_match($sRegExp, $sCode, $aMatch);
|
||||||
|
|
||||||
if ($iMatches > 0) {
|
if ($iMatches > 0) {
|
||||||
// $aMatch contains parameter info from left [1] or right [2] to name="field"
|
// $aMatch contains parameter info from left [1] or right [2] to name="field"
|
||||||
$sParameter = $aMatch[1] . $aMatch[2];
|
$sParameter = $aMatch[1] . $aMatch[2];
|
||||||
$sMessage = $aMatch[3];
|
$sMessage = $aMatch[3];
|
||||||
$sRegExp = '/\s*(.*?)\s*=\s*(?:"|")(.*?)(?:"|")\s*/i';
|
$sRegExp = '/\s*(.*?)\s*=\s*(?:"|")(.*?)(?:"|")\s*/i';
|
||||||
$aMatch = array();
|
$aMatch = array();
|
||||||
|
|
||||||
if (preg_match_all($sRegExp, $sParameter, $aMatch) > 0) {
|
if (preg_match_all($sRegExp, $sParameter, $aMatch) > 0) {
|
||||||
// Store parameter data as assoziative array
|
// Store parameter data as assoziative array
|
||||||
$aParameter = array_combine($aMatch[1], $aMatch[2]);
|
$aParameter = array_combine($aMatch[1], $aMatch[2]);
|
||||||
unset ($aMatch); // $aMatch not needed anymore
|
unset($aMatch); // $aMatch not needed anymore
|
||||||
|
|
||||||
if (!array_key_exists("type", $aParameter)) {
|
if (!array_key_exists("type", $aParameter)) {
|
||||||
$aParameter["type"] = "text";
|
$aParameter["type"] = "text";
|
||||||
|
@ -283,32 +263,32 @@ class Newsletter extends Item
|
||||||
|
|
||||||
// Remove not needed parameters from the parameters list
|
// Remove not needed parameters from the parameters list
|
||||||
// everything else goes into the link as parameters
|
// everything else goes into the link as parameters
|
||||||
unset ($aParameter["type"]);
|
unset($aParameter["type"]);
|
||||||
unset ($aParameter["text"]);
|
unset($aParameter["text"]);
|
||||||
|
|
||||||
$sParameter = "";
|
$sParameter = "";
|
||||||
if (count($aParameter) > 0) {
|
if (count($aParameter) > 0) {
|
||||||
foreach ($aParameter as $sKey => $sValue) {
|
foreach ($aParameter as $sKey => $sValue) {
|
||||||
$sParameter .= ' '.$sKey . '="' . $sValue . '"';
|
$sParameter .= ' ' . $sKey . '="' . $sValue . '"';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$sMessage = str_replace("MAIL_".strtoupper($sField), '<a href="'.clHtmlEntities($sData).'"'.$sParameter.'>'.$sText.'</a>', $sMessage);
|
$sMessage = str_replace("MAIL_" . strtoupper($sField), '<a href="' . clHtmlEntities($sData) . '"' . $sParameter . '>' . $sText . '</a>', $sMessage);
|
||||||
#$sMessage = '<a href="'.clHtmlEntities($sData).'"'.$sParameter.'>'.$sMessage.'</a>';
|
#$sMessage = '<a href="'.clHtmlEntities($sData).'"'.$sParameter.'>'.$sMessage.'</a>';
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$sMessage = str_replace("MAIL_".strtoupper($sField), $sData, $sMessage);
|
$sMessage = str_replace("MAIL_" . strtoupper($sField), $sData, $sMessage);
|
||||||
#$sMessage = $sData;
|
#$sMessage = $sData;
|
||||||
}
|
}
|
||||||
|
|
||||||
$sRegExp = '/\[mail[^]]+name=(?:"|")'.$sField.'(?:"|").*?\].*?\[\/mail\]/is';
|
$sRegExp = '/\[mail[^]]+name=(?:"|")' . $sField . '(?:"|").*?\].*?\[\/mail\]/is';
|
||||||
$sCode = preg_replace($sRegExp, $sMessage, $sCode, -1);
|
$sCode = preg_replace($sRegExp, $sMessage, $sCode, -1);
|
||||||
// Just to replace "text"-tags in HTML message also, just in case...
|
// Just to replace "text"-tags in HTML message also, just in case...
|
||||||
$sCode = str_replace("MAIL_".strtoupper($sField), $sData, $sCode);
|
$sCode = str_replace("MAIL_" . strtoupper($sField), $sData, $sCode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Replaces relative URL for url, src or href with absolute client htmlpath
|
* Replaces relative URL for url, src or href with absolute client htmlpath
|
||||||
*
|
*
|
||||||
|
@ -324,29 +304,29 @@ class Newsletter extends Item
|
||||||
global $client, $cfgClient;
|
global $client, $cfgClient;
|
||||||
$returnUrl = '';
|
$returnUrl = '';
|
||||||
print_r($sUrl);
|
print_r($sUrl);
|
||||||
if($sUrl[1] == "url") {
|
if ($sUrl[1] == "url") {
|
||||||
if(empty($sUrl[3])) {
|
if (empty($sUrl[3])) {
|
||||||
$returnUrl = $sUrl[1]."(".$sUrl[2];
|
$returnUrl = $sUrl[1] . "(" . $sUrl[2];
|
||||||
$returnUrl .= $cfgClient[$client]['path']['htmlpath'];
|
$returnUrl .= $cfgClient[$client]['path']['htmlpath'];
|
||||||
$returnUrl .= ltrim(ltrim($sUrl[4], "."), "/");
|
$returnUrl .= ltrim(ltrim($sUrl[4], "."), "/");
|
||||||
$returnUrl .= $sUrl[2].")";
|
$returnUrl .= $sUrl[2] . ")";
|
||||||
} else {
|
} else {
|
||||||
$returnUrl = $sUrl[0];
|
$returnUrl = $sUrl[0];
|
||||||
}
|
}
|
||||||
} else if(empty($sUrl[2])) {
|
} else if (empty($sUrl[2])) {
|
||||||
$returnUrl = $sUrl[1].'="';
|
$returnUrl = $sUrl[1] . '="';
|
||||||
$returnUrl .= $cfgClient[$client]['path']['htmlpath'];
|
$returnUrl .= $cfgClient[$client]['path']['htmlpath'];
|
||||||
$returnUrl .= ltrim(ltrim($sUrl[3], "."), "/").'"';
|
$returnUrl .= ltrim(ltrim($sUrl[3], "."), "/") . '"';
|
||||||
} else {
|
} else {
|
||||||
$returnUrl = $sUrl[0];
|
$returnUrl = $sUrl[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
return $returnUrl;
|
return $returnUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TODO: HerrB: Remove or insert some functionality */
|
/* TODO: HerrB: Remove or insert some functionality */
|
||||||
protected function _getNewsletterTagData($sHTML, $sTag)
|
|
||||||
{
|
protected function _getNewsletterTagData($sHTML, $sTag) {
|
||||||
//$sRegExp = "/<newsletter[^>](.*?)>.*?<\/newsletter>/i";
|
//$sRegExp = "/<newsletter[^>](.*?)>.*?<\/newsletter>/i";
|
||||||
//$sRegExp = "/\[mail[^\]](.*?)>.*?\[\/mail\]/i";
|
//$sRegExp = "/\[mail[^\]](.*?)>.*?\[\/mail\]/i";
|
||||||
#\[mail[^\]]((name="(?P<name>.*?)")|(type="(?P<type>.*?)"))\](?P<content>.*?)\[\/mail\]
|
#\[mail[^\]]((name="(?P<name>.*?)")|(type="(?P<type>.*?)"))\](?P<content>.*?)\[\/mail\]
|
||||||
|
@ -371,19 +351,19 @@ class Newsletter extends Item
|
||||||
* Match the characters "/mail" literally <EFBFBD>/mail<EFBFBD>
|
* Match the characters "/mail" literally <EFBFBD>/mail<EFBFBD>
|
||||||
* Match the character "]" literally <EFBFBD>\]<EFBFBD>
|
* Match the character "]" literally <EFBFBD>\]<EFBFBD>
|
||||||
* Ignore case (i), . includes new lines (s)
|
* Ignore case (i), . includes new lines (s)
|
||||||
**/
|
* */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
$sRegExp = '/\[mail\s*([^]]+)\]((?:.|\s)+?)\[\/mail\]/is';
|
$sRegExp = '/\[mail\s*([^]]+)\]((?:.|\s)+?)\[\/mail\]/is';
|
||||||
$aMatch = array ();
|
$aMatch = array ();
|
||||||
preg_match_all($sRegExp, $sHTML, $aMatch, PREG_SET_ORDER);
|
preg_match_all($sRegExp, $sHTML, $aMatch, PREG_SET_ORDER);
|
||||||
print_r ($aMatch);
|
print_r ($aMatch);
|
||||||
|
|
||||||
// Auf bestimmten Typ matchen
|
// Auf bestimmten Typ matchen
|
||||||
$sRegExp = '/\[mail.*?name="name".*?\]((?:.|\s)+?)\[\/mail\]/is';
|
$sRegExp = '/\[mail.*?name="name".*?\]((?:.|\s)+?)\[\/mail\]/is';
|
||||||
$aMatch = array ();
|
$aMatch = array ();
|
||||||
preg_match_all($sRegExp, $sHTML, $aMatch, PREG_SET_ORDER);
|
preg_match_all($sRegExp, $sHTML, $aMatch, PREG_SET_ORDER);
|
||||||
print_r ($aMatch); */
|
print_r ($aMatch); */
|
||||||
|
|
||||||
// Parameter auseinandernehmen (ohne PREG_SET_ORDER)
|
// Parameter auseinandernehmen (ohne PREG_SET_ORDER)
|
||||||
#$sRegExp = '/\s*(.*?)\s*=\s*"(.*?)"\s*/i';
|
#$sRegExp = '/\s*(.*?)\s*=\s*"(.*?)"\s*/i';
|
||||||
|
@ -392,24 +372,22 @@ class Newsletter extends Item
|
||||||
#print_r ($aMatch);
|
#print_r ($aMatch);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function _deChunkHTTPBody($sHeader, $sBody, $sEOL = "\r\n")
|
protected function _deChunkHTTPBody($sHeader, $sBody, $sEOL = "\r\n") {
|
||||||
{
|
|
||||||
// Based on code from jbr at ya-right dot com, posted on http://www.php.net
|
// Based on code from jbr at ya-right dot com, posted on http://www.php.net
|
||||||
// as user comment on fsockopen documentation (2007-05-01)
|
// as user comment on fsockopen documentation (2007-05-01)
|
||||||
|
|
||||||
// Analyze header
|
// Analyze header
|
||||||
$aParts = preg_split("/\r?\n/", $sHeader, -1, PREG_SPLIT_NO_EMPTY);
|
$aParts = preg_split("/\r?\n/", $sHeader, -1, PREG_SPLIT_NO_EMPTY);
|
||||||
|
|
||||||
$aHeader = array();
|
$aHeader = array();
|
||||||
for ($i = 0;$i < sizeof ($aParts); $i++) {
|
for ($i = 0; $i < sizeof($aParts); $i++) {
|
||||||
if ($i != 0) {
|
if ($i != 0) {
|
||||||
$iPos = strpos($aParts[$i], ':');
|
$iPos = strpos($aParts[$i], ':');
|
||||||
$sParameter = strtolower (str_replace(' ', '', substr ($aParts[$i], 0, $iPos)));
|
$sParameter = strtolower(str_replace(' ', '', substr($aParts[$i], 0, $iPos)));
|
||||||
$sValue = trim(substr($aParts[$i], ($iPos + 1)));
|
$sValue = trim(substr($aParts[$i], ($iPos + 1)));
|
||||||
} else {
|
} else {
|
||||||
$sField = 'status';
|
$sField = 'status';
|
||||||
$aParameters = explode(' ', $aParts[$i]);
|
$aParameters = explode(' ', $aParts[$i]);
|
||||||
$sParameter = $aParameters[1];
|
$sParameter = $aParameters[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($sParameter == 'set-cookie') {
|
if ($sParameter == 'set-cookie') {
|
||||||
|
@ -431,9 +409,9 @@ class Newsletter extends Item
|
||||||
$sBuffer = '';
|
$sBuffer = '';
|
||||||
if (isset($aHeader['transfer-encoding']) && $aHeader['transfer-encoding'] == 'chunked') {
|
if (isset($aHeader['transfer-encoding']) && $aHeader['transfer-encoding'] == 'chunked') {
|
||||||
do {
|
do {
|
||||||
$sBody = ltrim ($sBody);
|
$sBody = ltrim($sBody);
|
||||||
$iPos = strpos($sBody, $sEOL);
|
$iPos = strpos($sBody, $sEOL);
|
||||||
$iDataLen = hexdec (substr($sBody, 0, $iPos));
|
$iDataLen = hexdec(substr($sBody, 0, $iPos));
|
||||||
|
|
||||||
if (isset($aHeader['content-encoding'])) {
|
if (isset($aHeader['content-encoding'])) {
|
||||||
$sBuffer .= gzinflate(substr($sBody, ($iPos + $iEOLLen + 10), $iDataLen));
|
$sBuffer .= gzinflate(substr($sBody, ($iPos + $iEOLLen + 10), $iDataLen));
|
||||||
|
@ -441,9 +419,8 @@ class Newsletter extends Item
|
||||||
$sBuffer .= substr($sBody, ($iPos + $iEOLLen), $iDataLen);
|
$sBuffer .= substr($sBody, ($iPos + $iEOLLen), $iDataLen);
|
||||||
}
|
}
|
||||||
|
|
||||||
$sBody = substr ($sBody, ($iPos + $iDataLen + $iEOLLen));
|
$sBody = substr($sBody, ($iPos + $iDataLen + $iEOLLen));
|
||||||
$sRemaining = trim ($sBody);
|
$sRemaining = trim($sBody);
|
||||||
|
|
||||||
} while (!empty($sRemaining));
|
} while (!empty($sRemaining));
|
||||||
} else if (isset($aHeader['content-encoding'])) {
|
} else if (isset($aHeader['content-encoding'])) {
|
||||||
$sBuffer = gzinflate(substr($sBody, 10));
|
$sBuffer = gzinflate(substr($sBody, 10));
|
||||||
|
@ -469,14 +446,14 @@ class Newsletter extends Item
|
||||||
|
|
||||||
// Category ID
|
// Category ID
|
||||||
$oClientLang = new cApiClientLanguage(false, $client, $lang);
|
$oClientLang = new cApiClientLanguage(false, $client, $lang);
|
||||||
$iIDCat = $oClientLang->getProperty("newsletter", "html_newsletter_idcat");
|
$iIDCat = $oClientLang->getProperty("newsletter", "html_newsletter_idcat");
|
||||||
unset ($oClientLang);
|
unset($oClientLang);
|
||||||
|
|
||||||
// Get http username and password, if frontend is protected
|
// Get http username and password, if frontend is protected
|
||||||
$oClient = new cApiClient($client);
|
$oClient = new cApiClient($client);
|
||||||
$sHTTPUserName = $oClient->getProperty("newsletter", "html_username");
|
$sHTTPUserName = $oClient->getProperty("newsletter", "html_username");
|
||||||
$sHTTPPassword = $oClient->getProperty("newsletter", "html_password");
|
$sHTTPPassword = $oClient->getProperty("newsletter", "html_password");
|
||||||
unset ($oClient);
|
unset($oClient);
|
||||||
|
|
||||||
// Get HTML
|
// Get HTML
|
||||||
if ($iIDArt > 0 && $iIDCat > 0) {
|
if ($iIDArt > 0 && $iIDCat > 0) {
|
||||||
|
@ -493,47 +470,47 @@ class Newsletter extends Item
|
||||||
$oArticle->set("online", 1);
|
$oArticle->set("online", 1);
|
||||||
$oArticle->store();
|
$oArticle->store();
|
||||||
}
|
}
|
||||||
unset ($oArticle);
|
unset($oArticle);
|
||||||
}
|
}
|
||||||
unset ($oArticles);
|
unset($oArticles);
|
||||||
|
|
||||||
$sFile = "front_content.php?client=$client&lang=$lang&idcat=$iIDCat&idart=$iIDArt&noex=1&send=1";
|
$sFile = "front_content.php?client=$client&lang=$lang&idcat=$iIDCat&idart=$iIDArt&noex=1&send=1";
|
||||||
$aURL = parse_url($cfgClient[$client]['path']['htmlpath']);
|
$aURL = parse_url($cfgClient[$client]['path']['htmlpath']);
|
||||||
|
|
||||||
// TODO: Other schemes than http should be tested before use!
|
// TODO: Other schemes than http should be tested before use!
|
||||||
if ($aURL["scheme"] == "https") {
|
if ($aURL["scheme"] == "https") {
|
||||||
$iPort = 443;
|
$iPort = 443;
|
||||||
$sTarget = "ssl://".$aURL["host"];
|
$sTarget = "ssl://" . $aURL["host"];
|
||||||
} else {
|
} else {
|
||||||
$iPort = 80;
|
$iPort = 80;
|
||||||
$sTarget = $aURL["host"];
|
$sTarget = $aURL["host"];
|
||||||
}
|
}
|
||||||
if ($aURL["port"]) {
|
if ($aURL["port"]) {
|
||||||
$iPort = $aURL["port"];
|
$iPort = $aURL["port"];
|
||||||
}
|
}
|
||||||
|
|
||||||
$iErrorNo = 0;
|
$iErrorNo = 0;
|
||||||
$sErrorMsg = "";
|
$sErrorMsg = "";
|
||||||
if ($iHandler = fsockopen($sTarget, $iPort, $iErrorNo, $sErrorMsg, 30)) {
|
if ($iHandler = fsockopen($sTarget, $iPort, $iErrorNo, $sErrorMsg, 30)) {
|
||||||
// If you use HTTP 1.1 you may get chunked data... you could solve
|
// If you use HTTP 1.1 you may get chunked data... you could solve
|
||||||
// this easily by using HTTP 1.0, but then you get a problem with
|
// this easily by using HTTP 1.0, but then you get a problem with
|
||||||
// virtual servers, as HTTP 1.0 doesn't use the host information...
|
// virtual servers, as HTTP 1.0 doesn't use the host information...
|
||||||
fputs($iHandler, "GET ".$aURL["path"].$sFile." HTTP/1.1\r\n");
|
fputs($iHandler, "GET " . $aURL["path"] . $sFile . " HTTP/1.1\r\n");
|
||||||
fputs($iHandler, "Host: ".$aURL["host"]."\r\n");
|
fputs($iHandler, "Host: " . $aURL["host"] . "\r\n");
|
||||||
|
|
||||||
// Maybe the website has been protected using .htaccess, then login
|
// Maybe the website has been protected using .htaccess, then login
|
||||||
if ($sHTTPUserName != "" && $sHTTPPassword != "") {
|
if ($sHTTPUserName != "" && $sHTTPPassword != "") {
|
||||||
fputs($iHandler, "Authorization: Basic " . base64_encode("$sHTTPUserName:$sHTTPPassword") . "\r\n");
|
fputs($iHandler, "Authorization: Basic " . base64_encode("$sHTTPUserName:$sHTTPPassword") . "\r\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
fputs($iHandler, "Referer: http://".$aURL["host"]."\r\n");
|
fputs($iHandler, "Referer: http://" . $aURL["host"] . "\r\n");
|
||||||
fputs($iHandler, "User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)\r\n");
|
fputs($iHandler, "User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)\r\n");
|
||||||
fputs($iHandler, "Connection: close\r\n\r\n");
|
fputs($iHandler, "Connection: close\r\n\r\n");
|
||||||
|
|
||||||
// Get the HTTP header and body separately
|
// Get the HTTP header and body separately
|
||||||
$sHTML = "";
|
$sHTML = "";
|
||||||
$sHeader = "";
|
$sHeader = "";
|
||||||
$bBody = false;
|
$bBody = false;
|
||||||
while (!feof($iHandler)) {
|
while (!feof($iHandler)) {
|
||||||
// $sLine = fgets($iHandler, 4096);
|
// $sLine = fgets($iHandler, 4096);
|
||||||
$sLine = fgets($iHandler, 1024);
|
$sLine = fgets($iHandler, 1024);
|
||||||
|
@ -545,7 +522,7 @@ class Newsletter extends Item
|
||||||
$sHeader .= $sLine;
|
$sHeader .= $sLine;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fclose ($iHandler);
|
fclose($iHandler);
|
||||||
|
|
||||||
$sHTML = $this->_deChunkHTTPBody($sHeader, $sHTML);
|
$sHTML = $this->_deChunkHTTPBody($sHeader, $sHTML);
|
||||||
|
|
||||||
|
@ -558,7 +535,7 @@ class Newsletter extends Item
|
||||||
$sHTML = preg_replace_callback('/(url)\((\'|\")?(http:\/\/|https:\/\/|ftp:\/\/)?([A-Za-z0-9#\.?\-=_&\/]*)[\'|\"]?\)/', array($this, "_callbackReplaceUrl"), $sHTML);
|
$sHTML = preg_replace_callback('/(url)\((\'|\")?(http:\/\/|https:\/\/|ftp:\/\/)?([A-Za-z0-9#\.?\-=_&\/]*)[\'|\"]?\)/', array($this, "_callbackReplaceUrl"), $sHTML);
|
||||||
$sHTML = preg_replace_callback('/\b(src|href|ftp)[ ]*=[ ]*"(http:\/\/|https:\/\/|ftp:\/\/)?([A-Za-z0-9#\.?\-=_&\/]*)"/', array($this, "_callbackReplaceUrl"), $sHTML);
|
$sHTML = preg_replace_callback('/\b(src|href|ftp)[ ]*=[ ]*"(http:\/\/|https:\/\/|ftp:\/\/)?([A-Za-z0-9#\.?\-=_&\/]*)"/', array($this, "_callbackReplaceUrl"), $sHTML);
|
||||||
// Now replace anchor tags to the newsletter article itself just by the anchor
|
// Now replace anchor tags to the newsletter article itself just by the anchor
|
||||||
$sHTML = str_replace($cfgClient[$client]['path']['htmlpath']."front_content.php?idart=".$iIDArt."#", "#", $sHTML);
|
$sHTML = str_replace($cfgClient[$client]['path']['htmlpath'] . "front_content.php?idart=" . $iIDArt . "#", "#", $sHTML);
|
||||||
}
|
}
|
||||||
|
|
||||||
$sReturn = $sHTML;
|
$sReturn = $sHTML;
|
||||||
|
@ -584,8 +561,8 @@ class Newsletter extends Item
|
||||||
$oArticle->set("online", 0);
|
$oArticle->set("online", 0);
|
||||||
$oArticle->store();
|
$oArticle->store();
|
||||||
}
|
}
|
||||||
unset ($oArticle);
|
unset($oArticle);
|
||||||
unset ($oArticles);
|
unset($oArticles);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $sReturn;
|
return $sReturn;
|
||||||
|
@ -601,8 +578,7 @@ class Newsletter extends Item
|
||||||
* Checks, if html newsletter article still exists
|
* Checks, if html newsletter article still exists
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function htmlArticleExists()
|
public function htmlArticleExists() {
|
||||||
{
|
|
||||||
if ($this->get("idart") > 0) {
|
if ($this->get("idart") > 0) {
|
||||||
$oArticles = new cApiArticleLanguageCollection();
|
$oArticles = new cApiArticleLanguageCollection();
|
||||||
$oArticles->setWhere("idlang", $this->get("idlang"));
|
$oArticles->setWhere("idlang", $this->get("idlang"));
|
||||||
|
@ -615,11 +591,11 @@ class Newsletter extends Item
|
||||||
$bReturn = false;
|
$bReturn = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
unset ($oArticles);
|
unset($oArticles);
|
||||||
} else {
|
} else {
|
||||||
$bReturn = false;
|
$bReturn = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $bReturn;
|
return $bReturn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -632,8 +608,7 @@ class Newsletter extends Item
|
||||||
* and simulate values from plugins
|
* and simulate values from plugins
|
||||||
* @param string $sEncoding Message (and header) encoding, e.g. iso-8859-1
|
* @param string $sEncoding Message (and header) encoding, e.g. iso-8859-1
|
||||||
*/
|
*/
|
||||||
public function sendEMail($iIDCatArt, $sEMail, $sName = "", $bSimulatePlugins = true, $sEncoding = "iso-8859-1")
|
public function sendEMail($iIDCatArt, $sEMail, $sName = "", $bSimulatePlugins = true, $sEncoding = "iso-8859-1") {
|
||||||
{
|
|
||||||
global $lang, $client, $cfg, $cfgClient, $contenido;
|
global $lang, $client, $cfg, $cfgClient, $contenido;
|
||||||
|
|
||||||
// Initialization
|
// Initialization
|
||||||
|
@ -644,7 +619,7 @@ class Newsletter extends Item
|
||||||
$oLanguage = new cApiLanguage($lang);
|
$oLanguage = new cApiLanguage($lang);
|
||||||
$sFormatDate = $oLanguage->getProperty("dateformat", "date");
|
$sFormatDate = $oLanguage->getProperty("dateformat", "date");
|
||||||
$sFormatTime = $oLanguage->getProperty("dateformat", "time");
|
$sFormatTime = $oLanguage->getProperty("dateformat", "time");
|
||||||
unset ($oLanguage);
|
unset($oLanguage);
|
||||||
|
|
||||||
if ($sFormatDate == "") {
|
if ($sFormatDate == "") {
|
||||||
$sFormatDate = "%d.%m.%Y";
|
$sFormatDate = "%d.%m.%Y";
|
||||||
|
@ -654,17 +629,17 @@ class Newsletter extends Item
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get newsletter data
|
// Get newsletter data
|
||||||
$sFrom = $this->get("newsfrom");
|
$sFrom = $this->get("newsfrom");
|
||||||
$sFromName = $this->get("newsfromname");
|
$sFromName = $this->get("newsfromname");
|
||||||
if ($sFromName == "") {
|
if ($sFromName == "") {
|
||||||
$sFromName = $sFrom;
|
$sFromName = $sFrom;
|
||||||
}
|
}
|
||||||
$sSubject = $this->get("subject");
|
$sSubject = $this->get("subject");
|
||||||
$sMessageText = $this->get("message");
|
$sMessageText = $this->get("message");
|
||||||
|
|
||||||
$bIsHTML = false;
|
$bIsHTML = false;
|
||||||
if ($this->get("type") == "html") {
|
if ($this->get("type") == "html") {
|
||||||
$sMessageHTML = $this->getHTMLMessage();
|
$sMessageHTML = $this->getHTMLMessage();
|
||||||
|
|
||||||
if ($sMessageHTML === false) {
|
if ($sMessageHTML === false) {
|
||||||
// There was a problem getting the html message (maybe article
|
// There was a problem getting the html message (maybe article
|
||||||
|
@ -675,7 +650,7 @@ class Newsletter extends Item
|
||||||
} else {
|
} else {
|
||||||
$sError = "Newsletter to %s could not be sent: No html message available";
|
$sError = "Newsletter to %s could not be sent: No html message available";
|
||||||
}
|
}
|
||||||
$this->_sError = $sName." (".$sEMail."): ".sprintf($sError, $sEMail);
|
$this->_sError = $sName . " (" . $sEMail . "): " . sprintf($sError, $sEMail);
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
$bIsHTML = true;
|
$bIsHTML = true;
|
||||||
|
@ -688,18 +663,18 @@ class Newsletter extends Item
|
||||||
}
|
}
|
||||||
|
|
||||||
// Simulate key, an alphanumeric string of 30 characters
|
// Simulate key, an alphanumeric string of 30 characters
|
||||||
$sKey = str_repeat("key", 10);
|
$sKey = str_repeat("key", 10);
|
||||||
$sPath = $cfgClient[$client]["path"]["htmlpath"]."front_content.php?changelang=".$lang."&idcatart=".$iIDCatArt."&";
|
$sPath = $cfgClient[$client]["path"]["htmlpath"] . "front_content.php?changelang=" . $lang . "&idcatart=" . $iIDCatArt . "&";
|
||||||
|
|
||||||
// Replace message tags (text message)
|
// Replace message tags (text message)
|
||||||
$this->_replaceTag($sMessageText, false, "name", $sName);
|
$this->_replaceTag($sMessageText, false, "name", $sName);
|
||||||
$this->_replaceTag($sMessageText, false, "number", 1);
|
$this->_replaceTag($sMessageText, false, "number", 1);
|
||||||
$this->_replaceTag($sMessageText, false, "date", strftime($sFormatDate));
|
$this->_replaceTag($sMessageText, false, "date", strftime($sFormatDate));
|
||||||
$this->_replaceTag($sMessageText, false, "time", strftime($sFormatTime));
|
$this->_replaceTag($sMessageText, false, "time", strftime($sFormatTime));
|
||||||
$this->_replaceTag($sMessageText, false, "unsubscribe", $sPath."unsubscribe=".$sKey);
|
$this->_replaceTag($sMessageText, false, "unsubscribe", $sPath . "unsubscribe=" . $sKey);
|
||||||
$this->_replaceTag($sMessageText, false, "change", $sPath."change=".$sKey);
|
$this->_replaceTag($sMessageText, false, "change", $sPath . "change=" . $sKey);
|
||||||
$this->_replaceTag($sMessageText, false, "stop", $sPath."stop=".$sKey);
|
$this->_replaceTag($sMessageText, false, "stop", $sPath . "stop=" . $sKey);
|
||||||
$this->_replaceTag($sMessageText, false, "goon", $sPath."goon=".$sKey);
|
$this->_replaceTag($sMessageText, false, "goon", $sPath . "goon=" . $sKey);
|
||||||
|
|
||||||
// Replace message tags (html message)
|
// Replace message tags (html message)
|
||||||
if ($bIsHTML) {
|
if ($bIsHTML) {
|
||||||
|
@ -707,10 +682,10 @@ class Newsletter extends Item
|
||||||
$this->_replaceTag($sMessageHTML, true, "number", 1);
|
$this->_replaceTag($sMessageHTML, true, "number", 1);
|
||||||
$this->_replaceTag($sMessageHTML, true, "date", strftime($sFormatDate));
|
$this->_replaceTag($sMessageHTML, true, "date", strftime($sFormatDate));
|
||||||
$this->_replaceTag($sMessageHTML, true, "time", strftime($sFormatTime));
|
$this->_replaceTag($sMessageHTML, true, "time", strftime($sFormatTime));
|
||||||
$this->_replaceTag($sMessageHTML, true, "unsubscribe", $sPath."unsubscribe=".$sKey);
|
$this->_replaceTag($sMessageHTML, true, "unsubscribe", $sPath . "unsubscribe=" . $sKey);
|
||||||
$this->_replaceTag($sMessageHTML, true, "change", $sPath."change=".$sKey);
|
$this->_replaceTag($sMessageHTML, true, "change", $sPath . "change=" . $sKey);
|
||||||
$this->_replaceTag($sMessageHTML, true, "stop", $sPath."stop=".$sKey);
|
$this->_replaceTag($sMessageHTML, true, "stop", $sPath . "stop=" . $sKey);
|
||||||
$this->_replaceTag($sMessageHTML, true, "goon", $sPath."goon=".$sKey);
|
$this->_replaceTag($sMessageHTML, true, "goon", $sPath . "goon=" . $sKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($bSimulatePlugins) {
|
if ($bSimulatePlugins) {
|
||||||
|
@ -718,17 +693,17 @@ class Newsletter extends Item
|
||||||
if (getSystemProperty("newsletter", "newsletter-recipients-plugin") == "true") {
|
if (getSystemProperty("newsletter", "newsletter-recipients-plugin") == "true") {
|
||||||
if (is_array($cfg['plugins']['recipients'])) {
|
if (is_array($cfg['plugins']['recipients'])) {
|
||||||
foreach ($cfg['plugins']['recipients'] as $sPlugin) {
|
foreach ($cfg['plugins']['recipients'] as $sPlugin) {
|
||||||
plugin_include("recipients", $sPlugin."/".$sPlugin.".php");
|
plugin_include("recipients", $sPlugin . "/" . $sPlugin . ".php");
|
||||||
if (function_exists("recipients_".$sPlugin."_wantedVariables")) {
|
if (function_exists("recipients_" . $sPlugin . "_wantedVariables")) {
|
||||||
$aPluginVars = array();
|
$aPluginVars = array();
|
||||||
$aPluginVars = call_user_func("recipients_".$sPlugin."_wantedVariables");
|
$aPluginVars = call_user_func("recipients_" . $sPlugin . "_wantedVariables");
|
||||||
|
|
||||||
foreach ($aPluginVars as $sPluginVar) {
|
foreach ($aPluginVars as $sPluginVar) {
|
||||||
// Replace tags in text message
|
// Replace tags in text message
|
||||||
$this->_replaceTag($sMessageText, false, $sPluginVar, ":: ".$sPlugin.": ".$sPluginVar." ::");
|
$this->_replaceTag($sMessageText, false, $sPluginVar, ":: " . $sPlugin . ": " . $sPluginVar . " ::");
|
||||||
// Replace tags in html message
|
// Replace tags in html message
|
||||||
if ($bIsHTML) {
|
if ($bIsHTML) {
|
||||||
$this->_replaceTag($sMessageHTML, true, $sPluginVar, ":: ".$sPlugin.": ".$sPluginVar." ::");
|
$this->_replaceTag($sMessageHTML, true, $sPluginVar, ":: " . $sPlugin . ": " . $sPluginVar . " ::");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -746,23 +721,23 @@ class Newsletter extends Item
|
||||||
} else {
|
} else {
|
||||||
$sError = "Newsletter to %s could not be sent: No valid e-mail address";
|
$sError = "Newsletter to %s could not be sent: No valid e-mail address";
|
||||||
}
|
}
|
||||||
$this->_sError = $sName." (".$sEMail."): ".sprintf($sError, $sEMail);
|
$this->_sError = $sName . " (" . $sEMail . "): " . sprintf($sError, $sEMail);
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
$oMail = new PHPMailer();
|
$oMail = new PHPMailer();
|
||||||
$oMail->CharSet = $sEncoding;
|
$oMail->CharSet = $sEncoding;
|
||||||
$oMail->IsHTML($bIsHTML);
|
$oMail->IsHTML($bIsHTML);
|
||||||
$oMail->From = $sFrom;
|
$oMail->From = $sFrom;
|
||||||
$oMail->FromName = $sFromName;
|
$oMail->FromName = $sFromName;
|
||||||
$oMail->AddAddress($sEMail);
|
$oMail->AddAddress($sEMail);
|
||||||
$oMail->Mailer = "mail";
|
$oMail->Mailer = "mail";
|
||||||
$oMail->Subject = $sSubject;
|
$oMail->Subject = $sSubject;
|
||||||
|
|
||||||
if ($bIsHTML) {
|
if ($bIsHTML) {
|
||||||
$oMail->Body = $sMessageHTML;
|
$oMail->Body = $sMessageHTML;
|
||||||
$oMail->AltBody = $sMessageText."\n\n";
|
$oMail->AltBody = $sMessageText . "\n\n";
|
||||||
} else {
|
} else {
|
||||||
$oMail->Body = $sMessageText."\n\n";
|
$oMail->Body = $sMessageText . "\n\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$oMail->Send()) {
|
if (!$oMail->Send()) {
|
||||||
|
@ -771,7 +746,7 @@ class Newsletter extends Item
|
||||||
} else {
|
} else {
|
||||||
$sError = "Newsletter to %s could not be sent";
|
$sError = "Newsletter to %s could not be sent";
|
||||||
}
|
}
|
||||||
$this->_sError = $sName." (".$sEMail."): ".sprintf($sError, $sEMail);
|
$this->_sError = $sName . " (" . $sEMail . "): " . sprintf($sError, $sEMail);
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
return true;
|
return true;
|
||||||
|
@ -791,17 +766,16 @@ class Newsletter extends Item
|
||||||
* @param array $aSendRcps As reference: Filled with a list of succesfull recipients
|
* @param array $aSendRcps As reference: Filled with a list of succesfull recipients
|
||||||
* @param string $sEncoding Message (and header) encoding, e.g. iso-8859-1
|
* @param string $sEncoding Message (and header) encoding, e.g. iso-8859-1
|
||||||
*/
|
*/
|
||||||
public function sendDirect($iIDCatArt, $iIDNewsRcp = false, $iIDNewsGroup = false, &$aSendRcps, $sEncoding = "iso-8859-1")
|
public function sendDirect($iIDCatArt, $iIDNewsRcp = false, $iIDNewsGroup = false, &$aSendRcps, $sEncoding = "iso-8859-1") {
|
||||||
{
|
|
||||||
global $lang, $client, $cfg, $cfgClient, $contenido, $recipient;
|
global $lang, $client, $cfg, $cfgClient, $contenido, $recipient;
|
||||||
|
|
||||||
// Initialization
|
// Initialization
|
||||||
$aMessages = array();
|
$aMessages = array();
|
||||||
|
|
||||||
$oLanguage = new cApiLanguage($lang);
|
$oLanguage = new cApiLanguage($lang);
|
||||||
$sFormatDate = $oLanguage->getProperty("dateformat", "date");
|
$sFormatDate = $oLanguage->getProperty("dateformat", "date");
|
||||||
$sFormatTime = $oLanguage->getProperty("dateformat", "time");
|
$sFormatTime = $oLanguage->getProperty("dateformat", "time");
|
||||||
unset ($oLanguage);
|
unset($oLanguage);
|
||||||
|
|
||||||
if ($sFormatDate == "") {
|
if ($sFormatDate == "") {
|
||||||
$sFormatDate = "%d.%m.%Y";
|
$sFormatDate = "%d.%m.%Y";
|
||||||
|
@ -810,20 +784,20 @@ class Newsletter extends Item
|
||||||
$sFormatTime = "%H:%M";
|
$sFormatTime = "%H:%M";
|
||||||
}
|
}
|
||||||
|
|
||||||
$sPath = $cfgClient[$client]["path"]["htmlpath"]."front_content.php?changelang=".$lang."&idcatart=".$iIDCatArt."&";
|
$sPath = $cfgClient[$client]["path"]["htmlpath"] . "front_content.php?changelang=" . $lang . "&idcatart=" . $iIDCatArt . "&";
|
||||||
|
|
||||||
// Get newsletter data
|
// Get newsletter data
|
||||||
$sFrom = $this->get("newsfrom");
|
$sFrom = $this->get("newsfrom");
|
||||||
$sFromName = $this->get("newsfromname");
|
$sFromName = $this->get("newsfromname");
|
||||||
if ($sFromName == "") {
|
if ($sFromName == "") {
|
||||||
$sFromName = $sFrom;
|
$sFromName = $sFrom;
|
||||||
}
|
}
|
||||||
$sSubject = $this->get("subject");
|
$sSubject = $this->get("subject");
|
||||||
$sMessageText = $this->get("message");
|
$sMessageText = $this->get("message");
|
||||||
|
|
||||||
$bIsHTML = false;
|
$bIsHTML = false;
|
||||||
if ($this->get("type") == "html") {
|
if ($this->get("type") == "html") {
|
||||||
$sMessageHTML = $this->getHTMLMessage();
|
$sMessageHTML = $this->getHTMLMessage();
|
||||||
|
|
||||||
if ($sMessageHTML === false) {
|
if ($sMessageHTML === false) {
|
||||||
// There was a problem getting the html message (maybe article
|
// There was a problem getting the html message (maybe article
|
||||||
|
@ -860,13 +834,13 @@ class Newsletter extends Item
|
||||||
// Enabling plugin interface
|
// Enabling plugin interface
|
||||||
if (getSystemProperty("newsletter", "newsletter-recipients-plugin") == "true") {
|
if (getSystemProperty("newsletter", "newsletter-recipients-plugin") == "true") {
|
||||||
$bPluginEnabled = true;
|
$bPluginEnabled = true;
|
||||||
$aPlugins = array();
|
$aPlugins = array();
|
||||||
|
|
||||||
if (is_array($cfg['plugins']['recipients'])) {
|
if (is_array($cfg['plugins']['recipients'])) {
|
||||||
foreach ($cfg['plugins']['recipients'] as $sPlugin) {
|
foreach ($cfg['plugins']['recipients'] as $sPlugin) {
|
||||||
plugin_include("recipients", $sPlugin."/".$sPlugin.".php");
|
plugin_include("recipients", $sPlugin . "/" . $sPlugin . ".php");
|
||||||
if (function_exists("recipients_".$sPlugin."_wantedVariables")) {
|
if (function_exists("recipients_" . $sPlugin . "_wantedVariables")) {
|
||||||
$aPlugins[$sPlugin] = call_user_func("recipients_".$sPlugin."_wantedVariables");
|
$aPlugins[$sPlugin] = call_user_func("recipients_" . $sPlugin . "_wantedVariables");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -878,7 +852,7 @@ class Newsletter extends Item
|
||||||
$aRecipients = array();
|
$aRecipients = array();
|
||||||
if ($iIDNewsGroup !== false) {
|
if ($iIDNewsGroup !== false) {
|
||||||
$oGroupMembers = new RecipientGroupMemberCollection;
|
$oGroupMembers = new RecipientGroupMemberCollection;
|
||||||
$aRecipients = $oGroupMembers->getRecipientsInGroup ($iIDNewsGroup, false);
|
$aRecipients = $oGroupMembers->getRecipientsInGroup($iIDNewsGroup, false);
|
||||||
} else if ($iIDNewsRcp !== false) {
|
} else if ($iIDNewsRcp !== false) {
|
||||||
$aRecipients[] = $iIDNewsRcp;
|
$aRecipients[] = $iIDNewsRcp;
|
||||||
}
|
}
|
||||||
|
@ -889,7 +863,7 @@ class Newsletter extends Item
|
||||||
|
|
||||||
// Replace message tags (html message)
|
// Replace message tags (html message)
|
||||||
if ($bIsHTML) {
|
if ($bIsHTML) {
|
||||||
$this->_replaceTag($sMessageHTML, true, "number", $iCount);
|
$this->_replaceTag($sMessageHTML, true, "number", $iCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($aRecipients as $iID) {
|
foreach ($aRecipients as $iID) {
|
||||||
|
@ -897,15 +871,15 @@ class Newsletter extends Item
|
||||||
$sRcpMsgHTML = $sMessageHTML;
|
$sRcpMsgHTML = $sMessageHTML;
|
||||||
|
|
||||||
// Don't change name of $recipient variable as it is used in plugins!
|
// Don't change name of $recipient variable as it is used in plugins!
|
||||||
$recipient = new Recipient;
|
$recipient = new Recipient;
|
||||||
$recipient->loadByPrimaryKey($iID);
|
$recipient->loadByPrimaryKey($iID);
|
||||||
|
|
||||||
$sEMail = $recipient->get("email");
|
$sEMail = $recipient->get("email");
|
||||||
$sName = $recipient->get("name");
|
$sName = $recipient->get("name");
|
||||||
if (empty ($sName)) {
|
if (empty($sName)) {
|
||||||
$sName = $sEMail;
|
$sName = $sEMail;
|
||||||
}
|
}
|
||||||
$sKey = $recipient->get("hash");
|
$sKey = $recipient->get("hash");
|
||||||
|
|
||||||
$bSendHTML = false;
|
$bSendHTML = false;
|
||||||
if ($recipient->get("news_type") == 1) {
|
if ($recipient->get("news_type") == 1) {
|
||||||
|
@ -913,28 +887,28 @@ class Newsletter extends Item
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->_replaceTag($sRcpMsgText, false, "name", $sName);
|
$this->_replaceTag($sRcpMsgText, false, "name", $sName);
|
||||||
$this->_replaceTag($sRcpMsgText, false, "unsubscribe", $sPath."unsubscribe=".$sKey);
|
$this->_replaceTag($sRcpMsgText, false, "unsubscribe", $sPath . "unsubscribe=" . $sKey);
|
||||||
$this->_replaceTag($sRcpMsgText, false, "change", $sPath."change=".$sKey);
|
$this->_replaceTag($sRcpMsgText, false, "change", $sPath . "change=" . $sKey);
|
||||||
$this->_replaceTag($sRcpMsgText, false, "stop", $sPath."stop=".$sKey);
|
$this->_replaceTag($sRcpMsgText, false, "stop", $sPath . "stop=" . $sKey);
|
||||||
$this->_replaceTag($sRcpMsgText, false, "goon", $sPath."goon=".$sKey);
|
$this->_replaceTag($sRcpMsgText, false, "goon", $sPath . "goon=" . $sKey);
|
||||||
|
|
||||||
// Replace message tags (html message)
|
// Replace message tags (html message)
|
||||||
if ($bIsHTML && $bSendHTML) {
|
if ($bIsHTML && $bSendHTML) {
|
||||||
$this->_replaceTag($sRcpMsgHTML, true, "name", $sName);
|
$this->_replaceTag($sRcpMsgHTML, true, "name", $sName);
|
||||||
$this->_replaceTag($sRcpMsgHTML, true, "unsubscribe", $sPath."unsubscribe=".$sKey);
|
$this->_replaceTag($sRcpMsgHTML, true, "unsubscribe", $sPath . "unsubscribe=" . $sKey);
|
||||||
$this->_replaceTag($sRcpMsgHTML, true, "change", $sPath."change=".$sKey);
|
$this->_replaceTag($sRcpMsgHTML, true, "change", $sPath . "change=" . $sKey);
|
||||||
$this->_replaceTag($sRcpMsgHTML, true, "stop", $sPath."stop=".$sKey);
|
$this->_replaceTag($sRcpMsgHTML, true, "stop", $sPath . "stop=" . $sKey);
|
||||||
$this->_replaceTag($sRcpMsgHTML, true, "goon", $sPath."goon=".$sKey);
|
$this->_replaceTag($sRcpMsgHTML, true, "goon", $sPath . "goon=" . $sKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($bPluginEnabled) {
|
if ($bPluginEnabled) {
|
||||||
foreach ($aPlugins as $sPlugin => $aPluginVar) {
|
foreach ($aPlugins as $sPlugin => $aPluginVar) {
|
||||||
foreach ($aPluginVar as $sPluginVar) {
|
foreach ($aPluginVar as $sPluginVar) {
|
||||||
// Replace tags in text message
|
// Replace tags in text message
|
||||||
$this->_replaceTag($sRcpMsgText, false, $sPluginVar, call_user_func("recipients_".$sPlugin."_getvalue", $sPluginVar));
|
$this->_replaceTag($sRcpMsgText, false, $sPluginVar, call_user_func("recipients_" . $sPlugin . "_getvalue", $sPluginVar));
|
||||||
// Replace tags in html message
|
// Replace tags in html message
|
||||||
if ($bIsHTML && $bSendHTML) {
|
if ($bIsHTML && $bSendHTML) {
|
||||||
$this->_replaceTag($sRcpMsgHTML, true, $sPluginVar, call_user_func("recipients_".$sPlugin."_getvalue", $sPluginVar));
|
$this->_replaceTag($sRcpMsgHTML, true, $sPluginVar, call_user_func("recipients_" . $sPlugin . "_getvalue", $sPluginVar));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -946,40 +920,40 @@ class Newsletter extends Item
|
||||||
} else {
|
} else {
|
||||||
$sError = "Newsletter to %s could not be sent: Recipient has an incompatible or empty key";
|
$sError = "Newsletter to %s could not be sent: Recipient has an incompatible or empty key";
|
||||||
}
|
}
|
||||||
$aMessages[] = $sName." (".$sEMail."): ".sprintf($sError, $sEMail);
|
$aMessages[] = $sName . " (" . $sEMail . "): " . sprintf($sError, $sEMail);
|
||||||
} else if (!isValidMail($sEMail)) {
|
} else if (!isValidMail($sEMail)) {
|
||||||
if ($contenido) { // Use i18n only in backend
|
if ($contenido) { // Use i18n only in backend
|
||||||
$sError = i18n("Newsletter to %s could not be sent: No valid e-mail address specified", "newsletter");
|
$sError = i18n("Newsletter to %s could not be sent: No valid e-mail address specified", "newsletter");
|
||||||
} else {
|
} else {
|
||||||
$sError = "Newsletter to %s could not be sent: No valid e-mail address specified";
|
$sError = "Newsletter to %s could not be sent: No valid e-mail address specified";
|
||||||
}
|
}
|
||||||
$aMessages[] = $sName." (".$sEMail."): ".sprintf($sError, $sEMail);
|
$aMessages[] = $sName . " (" . $sEMail . "): " . sprintf($sError, $sEMail);
|
||||||
} else {
|
} else {
|
||||||
$oMail = new PHPMailer();
|
$oMail = new PHPMailer();
|
||||||
$oMail->CharSet = $sEncoding;
|
$oMail->CharSet = $sEncoding;
|
||||||
$oMail->IsHTML($bIsHTML && $bSendHTML);
|
$oMail->IsHTML($bIsHTML && $bSendHTML);
|
||||||
$oMail->From = $sFrom;
|
$oMail->From = $sFrom;
|
||||||
$oMail->FromName = $sFromName;
|
$oMail->FromName = $sFromName;
|
||||||
$oMail->AddAddress($sEMail);
|
$oMail->AddAddress($sEMail);
|
||||||
$oMail->Mailer = "mail";
|
$oMail->Mailer = "mail";
|
||||||
$oMail->Subject = $sSubject;
|
$oMail->Subject = $sSubject;
|
||||||
|
|
||||||
if ($bIsHTML && $bSendHTML) {
|
if ($bIsHTML && $bSendHTML) {
|
||||||
$oMail->Body = $sRcpMsgHTML;
|
$oMail->Body = $sRcpMsgHTML;
|
||||||
$oMail->AltBody = $sRcpMsgText."\n\n";
|
$oMail->AltBody = $sRcpMsgText . "\n\n";
|
||||||
} else {
|
} else {
|
||||||
$oMail->Body = $sRcpMsgText."\n\n";
|
$oMail->Body = $sRcpMsgText . "\n\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($oMail->Send()) {
|
if ($oMail->Send()) {
|
||||||
$aSendRcps[] = $sName." (".$sEMail.")";
|
$aSendRcps[] = $sName . " (" . $sEMail . ")";
|
||||||
} else {
|
} else {
|
||||||
if ($contenido) { // Use i18n only in backend
|
if ($contenido) { // Use i18n only in backend
|
||||||
$sError = i18n("Newsletter to %s could not be sent", "newsletter");
|
$sError = i18n("Newsletter to %s could not be sent", "newsletter");
|
||||||
} else {
|
} else {
|
||||||
$sError = "Newsletter to %s could not be sent";
|
$sError = "Newsletter to %s could not be sent";
|
||||||
}
|
}
|
||||||
$aMessages[] = $sName." (".$sEMail."): ".sprintf($sError, $sEMail);
|
$aMessages[] = $sName . " (" . $sEMail . "): " . sprintf($sError, $sEMail);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1013,14 +987,12 @@ class Newsletter extends Item
|
||||||
* @param $iChunk integer specifies current chunk number when sending in chunks
|
* @param $iChunk integer specifies current chunk number when sending in chunks
|
||||||
* result array array of recipient names/e-mails
|
* result array array of recipient names/e-mails
|
||||||
*/
|
*/
|
||||||
public function send($idcatart, $destination = "other", $to = "", $iChunkSize = 0, $iChunk = 0, $sEncoding = "iso-8859-1")
|
public function send($idcatart, $destination = "other", $to = "", $iChunkSize = 0, $iChunk = 0, $sEncoding = "iso-8859-1") {
|
||||||
{
|
|
||||||
// What should we do with this deprecated method?
|
// What should we do with this deprecated method?
|
||||||
$aResult = array();
|
$aResult = array();
|
||||||
$aResult[] = 0;
|
$aResult[] = 0;
|
||||||
$aResult[] = "Newsletter->send() not supported anymore (class.newsletter.php)";
|
$aResult[] = "Newsletter->send() not supported anymore (class.newsletter.php)";
|
||||||
return $aResult;
|
return $aResult;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
}
|
|
@ -48,12 +48,6 @@ class RecipientCollection extends ItemCollection {
|
||||||
$this->_setItemClass("Recipient");
|
$this->_setItemClass("Recipient");
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @deprecated [2011-03-15] Old constructor function for downwards compatibility */
|
|
||||||
public function RecipientCollection() {
|
|
||||||
cWarning(__FILE__, __LINE__, "Deprecated method call, use __construct()");
|
|
||||||
$this->__construct();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new recipient
|
* Creates a new recipient
|
||||||
* @param string $sEMail Specifies the e-mail adress
|
* @param string $sEMail Specifies the e-mail adress
|
||||||
|
@ -223,26 +217,6 @@ class Recipient extends Item {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @deprecated [2011-03-15] Old constructor function for downwards compatibility */
|
|
||||||
public function Recipient($mId = false) {
|
|
||||||
cWarning(__FILE__, __LINE__, "Deprecated method call, use __construct()");
|
|
||||||
$this->__construct($mId);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks if the given md5 matches the md5(email) in the database
|
|
||||||
* @param $md5email string md5 of E-Mail to check
|
|
||||||
* @return boolean True if the hash matches, false otherwise
|
|
||||||
* @deprecated 4.6.15 - 10.08.2006
|
|
||||||
*/
|
|
||||||
public function checkMD5Email($md5email) {
|
|
||||||
if ($md5email == md5($this->get("email"))) {
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function store() {
|
public function store() {
|
||||||
global $auth;
|
global $auth;
|
||||||
|
|
||||||
|
@ -272,5 +246,3 @@ class Recipient extends Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
|
|
@ -1,20 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
$sAutoloadClassPath = strstr(dirname(dirname(__FILE__)), "conlite/plugins")."/classes/";
|
||||||
* File:
|
|
||||||
* config.autoloader.php
|
|
||||||
*
|
|
||||||
* @package Plugins
|
|
||||||
* @subpackage Newsletter
|
|
||||||
* @version $Rev: 283 $
|
|
||||||
* @since 2.0
|
|
||||||
* @author Ortwin Pinke <o.pinke@conlite.org>
|
|
||||||
* @copyright 2012 CL-Team
|
|
||||||
* @link http://www.conlite.org
|
|
||||||
*
|
|
||||||
* $Id: config.autoloader.php 283 2014-01-09 14:48:38Z oldperl $
|
|
||||||
*/
|
|
||||||
|
|
||||||
$sAutoloadClassPath = 'conlite/plugins/newsletter/classes/';
|
|
||||||
return array(
|
return array(
|
||||||
'RecipientGroupCollection' => $sAutoloadClassPath.'class.newsletter.groups.php',
|
'RecipientGroupCollection' => $sAutoloadClassPath.'class.newsletter.groups.php',
|
||||||
'RecipientGroup' => $sAutoloadClassPath.'class.newsletter.groups.php',
|
'RecipientGroup' => $sAutoloadClassPath.'class.newsletter.groups.php',
|
||||||
|
@ -27,6 +12,6 @@ return array(
|
||||||
'NewsletterCollection' => $sAutoloadClassPath.'class.newsletter.php',
|
'NewsletterCollection' => $sAutoloadClassPath.'class.newsletter.php',
|
||||||
'Newsletter' => $sAutoloadClassPath.'class.newsletter.php',
|
'Newsletter' => $sAutoloadClassPath.'class.newsletter.php',
|
||||||
'RecipientCollection' => $sAutoloadClassPath.'class.newsletter.recipients.php',
|
'RecipientCollection' => $sAutoloadClassPath.'class.newsletter.recipients.php',
|
||||||
'Recipient' => $sAutoloadClassPath.'class.newsletter.recipients.php',
|
'Recipient' => $sAutoloadClassPath.'class.newsletter.recipients.php'
|
||||||
);
|
);
|
||||||
?>
|
?>
|
|
@ -17,4 +17,11 @@
|
||||||
// security check
|
// security check
|
||||||
defined('CON_FRAMEWORK') or die('Illegal call');
|
defined('CON_FRAMEWORK') or die('Illegal call');
|
||||||
|
|
||||||
?>
|
class nlHandler extends pluginHandlerAbstract {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
plugin_include(nlHandler::getName(), "includes/functions/demo1.php");
|
||||||
|
plugin_include(nlHandler::getName(), "includes/functions/demo2.php");
|
||||||
|
*/
|
|
@ -35,10 +35,10 @@ if (!defined('CON_FRAMEWORK')) {
|
||||||
|
|
||||||
|
|
||||||
// Initialization
|
// Initialization
|
||||||
$oPage = new cPage;
|
$oPage = new cPage();
|
||||||
$oRcpGroups = new RecipientGroupCollection;
|
$oRcpGroups = new RecipientGroupCollection();
|
||||||
$oClientLang = new cApiClientLanguage(false, $client, $lang);
|
$oClientLang = new cApiClientLanguage(false, $client, $lang);
|
||||||
$oNewsletters = new NewsletterCollection;
|
$oNewsletters = new NewsletterCollection();
|
||||||
|
|
||||||
// Include plugins
|
// Include plugins
|
||||||
if (is_array($cfg['plugins']['newsletters'])) {
|
if (is_array($cfg['plugins']['newsletters'])) {
|
|
@ -0,0 +1,10 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<language>
|
||||||
|
<navigation>
|
||||||
|
<extra>
|
||||||
|
<newsletter>Newsletter</newsletter>
|
||||||
|
<recipients>Empfänger</recipients>
|
||||||
|
<recipientgroups>Empfängergruppe</recipientgroups>
|
||||||
|
</extra>
|
||||||
|
</navigation>
|
||||||
|
</language>
|
|
@ -0,0 +1,10 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<language>
|
||||||
|
<navigation>
|
||||||
|
<extra>
|
||||||
|
<newsletter>Newsletter</newsletter>
|
||||||
|
<recipients>Empfänger</recipients>
|
||||||
|
<recipientgroups>Empfängergruppe</recipientgroups>
|
||||||
|
</extra>
|
||||||
|
</navigation>
|
||||||
|
</language>
|
|
@ -0,0 +1,10 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<language>
|
||||||
|
<navigation>
|
||||||
|
<extra>
|
||||||
|
<newsletter>Newsletter</newsletter>
|
||||||
|
<recipients>Empfänger</recipients>
|
||||||
|
<recipientgroups>Empfängergruppe</recipientgroups>
|
||||||
|
</extra>
|
||||||
|
</navigation>
|
||||||
|
</language>
|
|
@ -1,73 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
||||||
<plugin>
|
|
||||||
<general active="1">
|
|
||||||
<plugin_name>Newsletter</plugin_name>
|
|
||||||
<plugin_foldername>newsletter</plugin_foldername>
|
|
||||||
<uuid>88783B7D-9C64-A284-9A70-721F09BF7FE4</uuid>
|
|
||||||
<description>Newsletter System for CONTENIDO</description>
|
|
||||||
<author>Bjoern Behrens</author>
|
|
||||||
<copyright>four for business AG</copyright>
|
|
||||||
<mail>info@4fb.de</mail>
|
|
||||||
<website>http://www.4fb.de</website>
|
|
||||||
<version>0.1.0</version>
|
|
||||||
</general>
|
|
||||||
<requirements php="5.2.3">
|
|
||||||
<conlite minversion="2.0.0" />
|
|
||||||
</requirements>
|
|
||||||
<contenido>
|
|
||||||
<areas>
|
|
||||||
<area menuless="0">news</area>
|
|
||||||
<area parent="news" menuless="0">news_edit</area>
|
|
||||||
<area menuless="0">recipients</area>
|
|
||||||
<area menuless="0">recipientgroups</area>
|
|
||||||
<area parent="news" menuless="0">news_jobs</area>
|
|
||||||
<area parent="recipients" menuless="0">recipients_import</area>
|
|
||||||
</areas>
|
|
||||||
<actions>
|
|
||||||
<action area="news">news_save</action>
|
|
||||||
<action area="news">news_create</action>
|
|
||||||
<action area="news">news_delete</action>
|
|
||||||
<action area="news">news_duplicate</action>
|
|
||||||
<action area="news">news_add_job</action>
|
|
||||||
<action area="news">news_send_test</action>
|
|
||||||
<action area="news_jobs">news_job_delete</action>
|
|
||||||
<action area="news_jobs">news_job_details</action>
|
|
||||||
<action area="news_jobs">news_job_detail_delete</action>
|
|
||||||
<action area="news">news_html_settings</action>
|
|
||||||
<action area="news_jobs">news_job_run</action>
|
|
||||||
<action area="recipients">recipients_save</action>
|
|
||||||
<action area="recipients">recipients_create</action>
|
|
||||||
<action area="recipients">recipients_delete</action>
|
|
||||||
<action area="recipientgroups">recipientgroup_delete</action>
|
|
||||||
<action area="recipientgroups">recipientgroup_create</action>
|
|
||||||
<action area="recipientgroups">recipientgroup_recipient_delete</action>
|
|
||||||
<action area="recipientgroups">recipientgroup_save_group</action>
|
|
||||||
<action area="recipients">recipients_purge</action>
|
|
||||||
<action area="recipients_import">recipients_import</action>
|
|
||||||
<action area="recipients_import">recipients_import_exec</action>
|
|
||||||
</actions>
|
|
||||||
<frames>
|
|
||||||
<frame area="news" filetype="main" name="newsletter/includes/include.newsletter_left_top.php" frameId="1" />
|
|
||||||
<frame area="news" filetype="main" name="newsletter/includes/include.newsletter_menu.php" frameId="2" />
|
|
||||||
<frame area="news" filetype="main" name="newsletter/includes/include.newsletter_edit.php" frameId="4" />
|
|
||||||
<frame area="recipients" filetype="main" name="newsletter/includes/include.recipients_left_top.php" frameId="1" />
|
|
||||||
<frame area="recipients" filetype="main" name="newsletter/includes/include.recipients_menu.php" frameId="2" />
|
|
||||||
<frame area="recipients" filetype="main" name="include.subnav_blank.php" frameId="3" />
|
|
||||||
<frame area="recipients" filetype="main" name="newsletter/includes/include.recipients_edit.php" frameId="4" />
|
|
||||||
<frame area="news" filetype="main" name="newsletter/includes/include.newsletter_subnav.php" frameId="3" />
|
|
||||||
<frame area="recipientgroups" filetype="main" name="newsletter/includes/include.recipients.group_menu.php" frameId="2" />
|
|
||||||
<frame area="recipientgroups" filetype="main" name="newsletter/includes/include.recipients.group.subnav.php" frameId="3" />
|
|
||||||
<frame area="recipientgroups" filetype="main" name="newsletter/includes/include.recipients.group_edit.php" frameId="4" />
|
|
||||||
<frame area="news_jobs" filetype="main" name="newsletter/includes/include.newsletter_jobs_menu.php" frameId="2" />
|
|
||||||
<frame area="news_jobs" filetype="main" name="newsletter/includes/include.newsletter_jobs_details.php" frameId="4" />
|
|
||||||
<frame area="news_jobs" filetype="main" name="newsletter/includes/include.newsletter_jobs_subnav.php" frameId="3" />
|
|
||||||
<frame area="news_edit" filetype="main" name="newsletter/includes/include.newsletter_edit_message.php" frameId="4" />
|
|
||||||
<frame area="recipients_import" filetype="main" name="newsletter/includes/include.recipients_import.php" frameId="4" />
|
|
||||||
</frames>
|
|
||||||
<nav_sub>
|
|
||||||
<nav area="news" level="0" navm="3">newsletter/xml/;navigation/extra/newsletter</nav>
|
|
||||||
<nav area="recipients" level="1" navm="3">newsletter/xml/;navigation/extra/recipients</nav>
|
|
||||||
<nav area="recipientgroups" level="1" navm="3">newsletter/xml/;navigation/extra/recipientgroups</nav>
|
|
||||||
</nav_sub>
|
|
||||||
</contenido>
|
|
||||||
</plugin>
|
|
Laden…
In neuem Issue referenzieren