localization FS#172

Dieser Commit ist enthalten in:
Oldperl 2017-08-01 12:52:06 +00:00
Ursprung 0941e0b25d
Commit 07c09452f9
23 geänderte Dateien mit 4792 neuen und 2737 gelöschten Zeilen

Datei anzeigen

@ -1,4 +1,5 @@
<?php
/**
* Project:
* Contenido Content Management System
@ -28,7 +29,6 @@
* }}
*
*/
if (!defined('CON_FRAMEWORK')) {
die('Illegal call');
}
@ -36,22 +36,20 @@ if (!defined('CON_FRAMEWORK')) {
/**
* Recipient group management class
*/
class RecipientGroupCollection extends ItemCollection
{
class RecipientGroupCollection extends ItemCollection {
/**
* Constructor Function
* @param none
*/
public function __construct()
{
public function __construct() {
global $cfg;
parent::__construct($cfg["tab"]["news_groups"], "idnewsgroup");
$this->_setItemClass("RecipientGroup");
}
/** @deprecated [2011-03-15] Old constructor function for downwards compatibility */
public function RecipientGroupCollection()
{
public function RecipientGroupCollection() {
cWarning(__FILE__, __LINE__, "Deprecated method call, use __construct()");
$this->__construct();
}
@ -61,12 +59,11 @@ class RecipientGroupCollection extends ItemCollection
* @param $groupname string Specifies the groupname
* @param $defaultgroup integer Specfies, if group is default group (optional)
*/
public function create($groupname, $defaultgroup = 0)
{
public function create($groupname, $defaultgroup = 0) {
global $client, $lang;
$client = Contenido_Security::toInteger($client);
$lang = Contenido_Security::toInteger($lang);
$lang = Contenido_Security::toInteger($lang);
$group = new RecipientGroup();
@ -74,7 +71,7 @@ class RecipientGroupCollection extends ItemCollection
$mangledGroupName = $group->_inFilter($groupname);
$this->setWhere("idclient", $client);
$this->setWhere("idlang", $lang);
$this->setWhere("idlang", $lang);
$this->setWhere("groupname", $mangledGroupName);
$this->query();
@ -99,8 +96,7 @@ class RecipientGroupCollection extends ItemCollection
*
* @param $itemID int specifies the newsletter recipient group
*/
public function delete($itemID)
{
public function delete($itemID) {
$oAssociations = new RecipientGroupMemberCollection;
$oAssociations->setWhere("idnewsgroup", $itemID);
$oAssociations->query();
@ -110,20 +106,19 @@ class RecipientGroupCollection extends ItemCollection
}
parent::delete($itemID);
}
}
}
/**
* Single RecipientGroup Item
*/
class RecipientGroup extends Item
{
class RecipientGroup extends Item {
/**
* Constructor Function
* @param mixed $mId Specifies the ID of item to load
*/
public function __construct($mId = false)
{
public function __construct($mId = false) {
global $cfg;
parent::__construct($cfg["tab"]["news_groups"], "idnewsgroup");
if ($mId !== false) {
@ -132,21 +127,19 @@ class RecipientGroup extends Item
}
/** @deprecated [2011-03-15] Old constructor function for downwards compatibility */
public function RecipientGroup($mId = false)
{
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
**/
public function store()
{
* */
public function store() {
global $client, $lang;
$client = Contenido_Security::toInteger($client);
$lang = Contenido_Security::toInteger($lang);
$lang = Contenido_Security::toInteger($lang);
if ($this->get("defaultgroup") == 1) {
$oItems = new RecipientGroupCollection();
@ -163,30 +156,28 @@ class RecipientGroup extends Item
}
parent::store();
}
}
}
/**
* Recipient group member management class
*/
class RecipientGroupMemberCollection extends ItemCollection
{
class RecipientGroupMemberCollection extends ItemCollection {
/**
* Constructor Function
* @param none
*/
public function __construct()
{
public function __construct() {
global $cfg;
parent::__construct($cfg["tab"]["news_groupmembers"], "idnewsgroupmember");
$this->_setJoinPartner ('RecipientGroupCollection');
$this->_setJoinPartner ('RecipientCollection');
$this->_setJoinPartner('RecipientGroupCollection');
$this->_setJoinPartner('RecipientCollection');
$this->_setItemClass("RecipientGroupMember");
}
/** @deprecated [2011-03-15] Old constructor function for downwards compatibility */
public function RecipientGroupMemberCollection()
{
public function RecipientGroupMemberCollection() {
cWarning(__FILE__, __LINE__, "Deprecated method call, use __construct()");
$this->__construct();
}
@ -196,10 +187,9 @@ class RecipientGroupMemberCollection extends ItemCollection
* @param $idrecipientgroup int specifies the newsletter group
* @param $idrecipient int specifies the newsletter user
*/
public function create($idrecipientgroup, $idrecipient)
{
public function create($idrecipientgroup, $idrecipient) {
$idrecipientgroup = Contenido_Security::toInteger($idrecipientgroup);
$idrecipient = Contenido_Security::toInteger($idrecipient);
$idrecipient = Contenido_Security::toInteger($idrecipient);
$this->setWhere("idnewsgroup", $idrecipientgroup);
$this->setWhere("idnewsrcp", $idrecipient);
@ -223,10 +213,9 @@ class RecipientGroupMemberCollection extends ItemCollection
* @param $idrecipientgroup int specifies the newsletter group
* @param $idrecipient int specifies the newsletter user
*/
public function remove($idrecipientgroup, $idrecipient)
{
public function remove($idrecipientgroup, $idrecipient) {
$idrecipientgroup = Contenido_Security::toInteger($idrecipientgroup);
$idrecipient = Contenido_Security::toInteger($idrecipient);
$idrecipient = Contenido_Security::toInteger($idrecipient);
$this->setWhere("idnewsgroup", $idrecipientgroup);
$this->setWhere("idnewsrcp", $idrecipient);
@ -241,8 +230,7 @@ class RecipientGroupMemberCollection extends ItemCollection
* Removes all associations from any newsletter group
* @param $idrecipient int specifies the newsletter recipient
*/
public function removeRecipientFromGroups($idrecipient)
{
public function removeRecipientFromGroups($idrecipient) {
$idrecipient = Contenido_Security::toInteger($idrecipient);
$this->setWhere("idnewsrcp", $idrecipient);
@ -257,8 +245,7 @@ class RecipientGroupMemberCollection extends ItemCollection
* Removes all associations of a newsletter group
* @param $idgroup int specifies the newsletter recipient group
*/
public function removeGroup($idgroup)
{
public function removeGroup($idgroup) {
$idgroup = Contenido_Security::toInteger($idgroup);
$this->setWhere("idnewsgroup", $idgroup);
@ -275,8 +262,7 @@ class RecipientGroupMemberCollection extends ItemCollection
* @param $asObjects boolean specifies if the function should return objects
* @return array RecipientRecipient items
*/
public function getRecipientsInGroup($idrecipientgroup, $asObjects = true)
{
public function getRecipientsInGroup($idrecipientgroup, $asObjects = true) {
$idrecipientgroup = Contenido_Security::toInteger($idrecipientgroup);
$this->setWhere("idnewsgroup", $idrecipientgroup);
@ -297,20 +283,19 @@ class RecipientGroupMemberCollection extends ItemCollection
return ($aObjects);
}
}
}
/**
* Single RecipientGroup Item
*/
class RecipientGroupMember extends Item
{
class RecipientGroupMember extends Item {
/**
* Constructor Function
* @param mixed $mId Specifies the ID of item to load
*/
public function __construct($mId = false)
{
public function __construct($mId = false) {
global $cfg;
parent::__construct($cfg["tab"]["news_groupmembers"], "idnewsgroupmember");
if ($mId !== false) {
@ -319,11 +304,11 @@ class RecipientGroupMember extends Item
}
/** @deprecated [2011-03-15] Old constructor function for downwards compatibility */
public function RecipientGroupMember($mId = false)
{
public function RecipientGroupMember($mId = false) {
cWarning(__FILE__, __LINE__, "Deprecated method call, use __construct()");
$this->__construct($mId);
}
}
?>

Datei anzeigen

@ -1,4 +1,5 @@
<?php
/**
* Project:
* Contenido Content Management System
@ -28,31 +29,27 @@
* }}
*
*/
if (!defined('CON_FRAMEWORK')) {
die('Illegal call');
}
/**
* Collection management class
*/
class cNewsletterJobCollection extends ItemCollection
{
class cNewsletterJobCollection extends ItemCollection {
/**
* Constructor Function
* @param none
*/
public function __construct()
{
public function __construct() {
global $cfg;
parent::__construct($cfg["tab"]["news_jobs"], "idnewsjob");
$this->_setItemClass("cNewsletterJob");
}
/** @deprecated [2011-03-15] Old constructor function for downwards compatibility */
public function cNewsletterJobCollection()
{
public function cNewsletterJobCollection() {
cWarning(__FILE__, __LINE__, "Deprecated method call, use __construct()");
$this->__construct();
}
@ -62,17 +59,16 @@ class cNewsletterJobCollection extends ItemCollection
* @param $name string Specifies the name of the newsletter, the same name may be used more than once
* @param $idnews integer Newsletter id
*/
public function create($iIDNews, $iIDCatArt, $sName = "")
{
public function create($iIDNews, $iIDCatArt, $sName = "") {
global $client, $lang, $cfg, $cfgClient, $auth;
$oNewsletter = new Newsletter;
if ($oNewsletter->loadByPrimaryKey($iIDNews)) {
$iIDNews = Contenido_Security::toInteger($iIDNews);
$iIDNews = Contenido_Security::toInteger($iIDNews);
$iIDCatArt = Contenido_Security::toInteger($iIDCatArt);
$lang = Contenido_Security::toInteger($lang);
$client = Contenido_Security::toInteger($client);
$sName = Contenido_Security::escapeDB($sName, null);
$lang = Contenido_Security::toInteger($lang);
$client = Contenido_Security::toInteger($client);
$sName = Contenido_Security::escapeDB($sName, null);
$oItem = parent::createNewItem();
@ -90,13 +86,13 @@ class cNewsletterJobCollection extends ItemCollection
$oLang = new cApiLanguage($lang);
$oItem->set("encoding", $oLang->get("encoding"));
unset ($oLang);
unset($oLang);
$oItem->set("idart", $oNewsletter->get("idart"));
$oItem->set("subject", $oNewsletter->get("subject"));
// Precompile messages
$sPath = $cfgClient[$client]["path"]["htmlpath"]."front_content.php?changelang=".$lang."&idcatart=".$iIDCatArt."&";
$sPath = $cfgClient[$client]["path"]["htmlpath"] . "front_content.php?changelang=" . $lang . "&idcatart=" . $iIDCatArt . "&";
$sMessageText = $oNewsletter->get("message");
@ -105,10 +101,10 @@ class cNewsletterJobCollection extends ItemCollection
$sMessageText = str_replace("\r\n", "\n", $sMessageText);
}
$oNewsletter->_replaceTag($sMessageText, false, "unsubscribe", $sPath."unsubscribe={KEY}");
$oNewsletter->_replaceTag($sMessageText, false, "change", $sPath."change={KEY}");
$oNewsletter->_replaceTag($sMessageText, false, "stop", $sPath."stop={KEY}");
$oNewsletter->_replaceTag($sMessageText, false, "goon", $sPath."goon={KEY}");
$oNewsletter->_replaceTag($sMessageText, false, "unsubscribe", $sPath . "unsubscribe={KEY}");
$oNewsletter->_replaceTag($sMessageText, false, "change", $sPath . "change={KEY}");
$oNewsletter->_replaceTag($sMessageText, false, "stop", $sPath . "stop={KEY}");
$oNewsletter->_replaceTag($sMessageText, false, "goon", $sPath . "goon={KEY}");
$oItem->set("message_text", $sMessageText);
@ -125,22 +121,22 @@ class cNewsletterJobCollection extends ItemCollection
$oNewsletter->_replaceTag($sMessageHTML, true, "date", "MAIL_DATE");
$oNewsletter->_replaceTag($sMessageHTML, true, "time", "MAIL_TIME");
$oNewsletter->_replaceTag($sMessageHTML, true, "unsubscribe", $sPath."unsubscribe={KEY}");
$oNewsletter->_replaceTag($sMessageHTML, true, "change", $sPath."change={KEY}");
$oNewsletter->_replaceTag($sMessageHTML, true, "stop", $sPath."stop={KEY}");
$oNewsletter->_replaceTag($sMessageHTML, true, "goon", $sPath."goon={KEY}");
$oNewsletter->_replaceTag($sMessageHTML, true, "unsubscribe", $sPath . "unsubscribe={KEY}");
$oNewsletter->_replaceTag($sMessageHTML, true, "change", $sPath . "change={KEY}");
$oNewsletter->_replaceTag($sMessageHTML, true, "stop", $sPath . "stop={KEY}");
$oNewsletter->_replaceTag($sMessageHTML, true, "goon", $sPath . "goon={KEY}");
// Replace plugin tags by simple MAIL_ tags
if (getSystemProperty("newsletter", "newsletter-recipients-plugin") == "true") {
if (is_array($cfg['plugins']['recipients'])) {
foreach ($cfg['plugins']['recipients'] as $sPlugin) {
plugin_include("recipients", $sPlugin."/".$sPlugin.".php");
if (function_exists("recipients_".$sPlugin."_wantedVariables")) {
plugin_include("recipients", $sPlugin . "/" . $sPlugin . ".php");
if (function_exists("recipients_" . $sPlugin . "_wantedVariables")) {
$aPluginVars = array();
$aPluginVars = call_user_func("recipients_".$sPlugin."_wantedVariables");
$aPluginVars = call_user_func("recipients_" . $sPlugin . "_wantedVariables");
foreach ($aPluginVars as $sPluginVar) {
$oNewsletter->_replaceTag($sMessageHTML, true, $sPluginVar, "MAIL_".strtoupper($sPluginVar));
$oNewsletter->_replaceTag($sMessageHTML, true, $sPluginVar, "MAIL_" . strtoupper($sPluginVar));
}
}
}
@ -167,7 +163,7 @@ class cNewsletterJobCollection extends ItemCollection
$oItem->set("dispatch_delay", $oNewsletter->get("dispatch_delay"));
// Store "send to" info in serialized array (just info)
$aSendInfo = array();
$aSendInfo = array();
$aSendInfo[] = $oNewsletter->get("send_to");
switch ($oNewsletter->get("send_to")) {
@ -182,8 +178,8 @@ class cNewsletterJobCollection extends ItemCollection
$aSendInfo[] = $oGroup->get("groupname");
}
unset ($oGroup);
unset ($oGroups);
unset($oGroup);
unset($oGroups);
break;
case "single":
if (is_numeric($oNewsletter->get("send_ids"))) {
@ -206,12 +202,11 @@ class cNewsletterJobCollection extends ItemCollection
$oItem->set("created", date("Y-m-d H:i:s"), false);
$oItem->set("author", $auth->auth["uid"]);
$oItem->set("authorname", $auth->auth["uname"]);
unset ($oNewsletter); // Not needed anymore
unset($oNewsletter); // Not needed anymore
// Adds log items for all recipients and returns recipient count
$oLogs = new cNewsletterLogCollection();
$iRecipientCount = $oLogs->initializeJob($oItem->get($oItem->primaryKey), $iIDNews);
unset ($oLogs);
unset($oLogs);
$oItem->set("rcpcount", $iRecipientCount);
$oItem->set("sendcount", 0);
@ -231,27 +226,25 @@ class cNewsletterJobCollection extends ItemCollection
*
* @param $iItemID int specifies the frontend user group
*/
public function delete($iItemID)
{
public function delete($iItemID) {
$oLogs = new cNewsletterLogCollection();
$oLogs->delete($iItemID);
parent::delete($iItemID);
}
}
}
/**
* Single NewsletterJob Item
*/
class cNewsletterJob extends Item
{
class cNewsletterJob extends Item {
/**
* Constructor Function
* @param mixed $mId Specifies the ID of item to load
*/
public function __construct($mId = false)
{
public function __construct($mId = false) {
global $cfg;
parent::__construct($cfg["tab"]["news_jobs"], "idnewsjob");
if ($mId !== false) {
@ -260,14 +253,12 @@ class cNewsletterJob extends Item
}
/** @deprecated [2011-03-15] Old constructor function for downwards compatibility */
public function cNewsletterJob($mId = false)
{
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;
$iCount = 0;
@ -275,7 +266,7 @@ class cNewsletterJob extends Item
// Job is currently running, check start time and restart if
// started 5 minutes ago
$dStart = strtotime($this->get("started"));
$dNow = time();
$dNow = time();
if (($dNow - $dStart) > (5 * 60)) {
$this->set("status", 1);
@ -296,7 +287,7 @@ class cNewsletterJob extends Item
if ($this->get("status") == 1) {
// Job waiting for sending
$this->set("status", 2);
$this->set("started", date("Y-m-d H:i:s"), false);
$this->set("started", date("Y-m-d H:i:s"), false);
$this->store();
// Initialization
@ -305,7 +296,7 @@ class cNewsletterJob extends Item
$oLanguage = new cApiLanguage($this->get("idlang"));
$sFormatDate = $oLanguage->getProperty("dateformat", "date");
$sFormatTime = $oLanguage->getProperty("dateformat", "time");
unset ($oLanguage);
unset($oLanguage);
if ($sFormatDate == "") {
$sFormatDate = "%d.%m.%Y";
@ -315,14 +306,14 @@ class cNewsletterJob extends Item
}
// Get newsletter data
$sFrom = $this->get("newsfrom");
$sFromName = $this->get("newsfromname");
$sSubject = $this->get("subject");
$sMessageText = $this->get("message_text");
$sMessageHTML = $this->get("message_html");
$dNewsDate = strtotime($this->get("newsdate"));
$sEncoding = $this->get("encoding");
$bIsHTML = false;
$sFrom = $this->get("newsfrom");
$sFromName = $this->get("newsfromname");
$sSubject = $this->get("subject");
$sMessageText = $this->get("message_text");
$sMessageHTML = $this->get("message_html");
$dNewsDate = strtotime($this->get("newsdate"));
$sEncoding = $this->get("encoding");
$bIsHTML = false;
if ($this->get("type") == "html" && $sMessageHTML != "") {
$bIsHTML = true;
}
@ -349,13 +340,13 @@ class cNewsletterJob extends Item
$bPluginEnabled = false;
if (getSystemProperty("newsletter", "newsletter-recipients-plugin") == "true") {
$bPluginEnabled = true;
$aPlugins = array();
$aPlugins = array();
if (is_array($cfg['plugins']['recipients'])) {
foreach ($cfg['plugins']['recipients'] as $sPlugin) {
plugin_include("recipients", $sPlugin."/".$sPlugin.".php");
if (function_exists("recipients_".$sPlugin."_wantedVariables")) {
$aPlugins[$sPlugin] = call_user_func("recipients_".$sPlugin."_wantedVariables");
plugin_include("recipients", $sPlugin . "/" . $sPlugin . ".php");
if (function_exists("recipients_" . $sPlugin . "_wantedVariables")) {
$aPlugins[$sPlugin] = call_user_func("recipients_" . $sPlugin . "_wantedVariables");
}
}
}
@ -383,21 +374,21 @@ class cNewsletterJob extends Item
$sRcpMsgText = $sMessageText;
$sRcpMsgHTML = $sMessageHTML;
$sKey = $oLog->get("rcphash");
$sKey = $oLog->get("rcphash");
$sEMail = $oLog->get("rcpemail");
$bSendHTML = false;
$bSendHTML = false;
if ($oLog->get("rcpnewstype") == 1) {
$bSendHTML = true; // Recipient accepts html newsletter
}
if (strlen($sKey) == 30) { // Prevents sending without having a key
$sRcpMsgText = str_replace("{KEY}", $sKey, $sRcpMsgText);
$sRcpMsgText = str_replace("{KEY}", $sKey, $sRcpMsgText);
$sRcpMsgText = str_replace("MAIL_MAIL", $sEMail, $sRcpMsgText);
$sRcpMsgText = str_replace("MAIL_NAME", $oLog->get("rcpname"), $sRcpMsgText);
// Replace message tags (html message)
if ($bIsHTML && $bSendHTML) {
$sRcpMsgHTML = str_replace("{KEY}", $sKey, $sRcpMsgHTML);
$sRcpMsgHTML = str_replace("{KEY}", $sKey, $sRcpMsgHTML);
$sRcpMsgHTML = str_replace("MAIL_MAIL", $sEMail, $sRcpMsgHTML);
$sRcpMsgHTML = str_replace("MAIL_NAME", $oLog->get("rcpname"), $sRcpMsgHTML);
}
@ -410,11 +401,11 @@ class cNewsletterJob extends Item
foreach ($aPlugins as $sPlugin => $aPluginVar) {
foreach ($aPluginVar as $sPluginVar) {
// Replace tags in text message
$sRcpMsgText = str_replace("MAIL_".strtoupper($sPluginVar), call_user_func("recipients_".$sPlugin."_getvalue", $sPluginVar), $sRcpMsgText);
$sRcpMsgText = str_replace("MAIL_" . strtoupper($sPluginVar), call_user_func("recipients_" . $sPlugin . "_getvalue", $sPluginVar), $sRcpMsgText);
// Replace tags in html message
if ($bIsHTML && $bSendHTML) {
$sRcpMsgHTML = str_replace("MAIL_".strtoupper($sPluginVar), call_user_func("recipients_".$sPlugin."_getvalue", $sPluginVar), $sRcpMsgHTML);
$sRcpMsgHTML = str_replace("MAIL_" . strtoupper($sPluginVar), call_user_func("recipients_" . $sPlugin . "_getvalue", $sPluginVar), $sRcpMsgHTML);
}
}
}
@ -422,24 +413,24 @@ class cNewsletterJob extends Item
}
$oMail = new PHPMailer();
$oMail->CharSet = $sEncoding;
$oMail->CharSet = $sEncoding;
$oMail->IsHTML($bIsHTML && $bSendHTML);
$oMail->From = $sFrom;
$oMail->FromName = $sFromName;
$oMail->From = $sFrom;
$oMail->FromName = $sFromName;
$oMail->AddAddress($sEMail);
$oMail->Mailer = "mail";
$oMail->Subject = $sSubject;
$oMail->Mailer = "mail";
$oMail->Subject = $sSubject;
if ($bIsHTML && $bSendHTML) {
$oMail->Body = $sRcpMsgHTML;
$oMail->AltBody = $sRcpMsgText."\n\n";
$oMail->Body = $sRcpMsgHTML;
$oMail->AltBody = $sRcpMsgText . "\n\n";
} else {
$oMail->Body = $sRcpMsgText."\n\n";
$oMail->Body = $sRcpMsgText . "\n\n";
}
if ($oMail->Send()) {
$oLog->set("status", "successful");
$oLog->set("sent", date("Y-m-d H:i:s"), false);
$oLog->set("sent", date("Y-m-d H:i:s"), false);
} else {
$oLog->set("status", "error (sending)");
}
@ -466,7 +457,7 @@ class cNewsletterJob extends Item
If ($oLogs->next()) {
// Remaining recipients found, set job back to pending
$this->set("status", 1);
$this->set("started", "0000-00-00 00:00:00", false);
$this->set("started", "0000-00-00 00:00:00", false);
} else {
// No remaining recipients, job finished
$this->set("status", 9);
@ -475,7 +466,7 @@ class cNewsletterJob extends Item
} else {
// Set job back to pending
$this->set("status", 1);
$this->set("started", "0000-00-00 00:00:00", false);
$this->set("started", "0000-00-00 00:00:00", false);
}
$this->store();
}
@ -486,19 +477,19 @@ class cNewsletterJob extends Item
/**
* Overriden store() method to set status to finished if rcpcount is 0
*/
public function store()
{
public function store() {
if ($this->get("rcpcount") == 0) {
// No recipients, job finished
$this->set("status", 9);
$this->set("status", 9);
if ($this->get("started") == "0000-00-00 00:00:00") {
$this->set("started", date("Y-m-d H:i:s"), false);
}
$this->set("finished", date("Y-m-d H:i:s"), false);
$this->set("finished", date("Y-m-d H:i:s"), false);
}
parent::store();
}
}
?>

Datei anzeigen

@ -1,4 +1,5 @@
<?php
/**
* Project:
* Contenido Content Management System
@ -28,31 +29,27 @@
* }}
*
*/
if (!defined('CON_FRAMEWORK')) {
die('Illegal call');
}
/**
* Collection management class
*/
class cNewsletterLogCollection extends ItemCollection
{
class cNewsletterLogCollection extends ItemCollection {
/**
* Constructor Function
* @param none
*/
public function __construct()
{
public function __construct() {
global $cfg;
parent::__construct($cfg["tab"]["news_log"], "idnewslog");
$this->_setItemClass("cNewsletterLog");
}
/** @deprecated [2011-03-15] Old constructor function for downwards compatibility */
public function cNewsletterLogCollection()
{
public function cNewsletterLogCollection() {
cWarning(__FILE__, __LINE__, "Deprecated method call, use __construct()");
$this->__construct();
}
@ -64,14 +61,13 @@ class cNewsletterLogCollection extends ItemCollection
* @param $rcp_name string Name of the recipient (-> recipient may be deleted)
* @param $rcp_email string E-Mail of the recipient (-> recipient may be deleted)
*/
public function create($idnewsjob, $idnewsrcp)
{
public function create($idnewsjob, $idnewsrcp) {
global $client, $lang, $auth;
$idnewsjob = Contenido_Security::toInteger($idnewsjob);
$idnewsrcp = Contenido_Security::toInteger($idnewsrcp);
$client = Contenido_Security::toInteger($client);
$lang = Contenido_Security::toInteger($lang);
$idnewsjob = Contenido_Security::toInteger($idnewsjob);
$idnewsrcp = Contenido_Security::toInteger($idnewsrcp);
$client = Contenido_Security::toInteger($client);
$lang = Contenido_Security::toInteger($lang);
$this->resetQuery();
$this->setWhere("idnewsjob", $idnewsjob);
@ -90,7 +86,7 @@ class cNewsletterLogCollection extends ItemCollection
$oItem->set("idnewsrcp", $idnewsrcp);
$sEMail = $oRecipient->get("email");
$sName = $oRecipient->get("name");
$sName = $oRecipient->get("name");
if ($sName == "") {
$oItem->set("rcpname", $sEMail);
@ -118,51 +114,50 @@ class cNewsletterLogCollection extends ItemCollection
* @param integer $idnews ID of newsletter
* @return integer Recipient count
*/
public function initializeJob($idnewsjob, $idnews)
{
public function initializeJob($idnewsjob, $idnews) {
global $cfg;
$idnewsjob = Contenido_Security::toInteger($idnewsjob);
$idnews = Contenido_Security::toInteger($idnews);
$idnews = Contenido_Security::toInteger($idnews);
$oNewsletter = new Newsletter();
if ($oNewsletter->loadByPrimaryKey($idnews)) {
$sDestination = $oNewsletter->get("send_to");
$iIDClient = $oNewsletter->get("idclient");
$iIDLang = $oNewsletter->get("idlang");
$iIDClient = $oNewsletter->get("idclient");
$iIDLang = $oNewsletter->get("idlang");
switch ($sDestination) {
case "all" :
$sDistinct = "";
$sFrom = "";
$sSQL = "deactivated='0' AND confirmed='1' AND idclient='".$iIDClient."' AND idlang='".$iIDLang."'";
$sFrom = "";
$sSQL = "deactivated='0' AND confirmed='1' AND idclient='" . $iIDClient . "' AND idlang='" . $iIDLang . "'";
break;
case "default" :
$sDistinct = "distinct";
$sFrom = $cfg["tab"]["news_groups"]." AS groups, ".$cfg["tab"]["news_groupmembers"]." AS groupmembers ";
$sSQL = "recipientcollection.idclient = '".$iIDClient."' AND ".
"recipientcollection.idlang = '".$iIDLang."' AND ".
"recipientcollection.deactivated = '0' AND ".
"recipientcollection.confirmed = '1' AND ".
"recipientcollection.idnewsrcp = groupmembers.idnewsrcp AND ".
"groupmembers.idnewsgroup = groups.idnewsgroup AND ".
"groups.defaultgroup = '1' AND groups.idclient = '".$iIDClient."' AND ".
"groups.idlang = '".$iIDLang."'";
$sFrom = $cfg["tab"]["news_groups"] . " AS groups, " . $cfg["tab"]["news_groupmembers"] . " AS groupmembers ";
$sSQL = "recipientcollection.idclient = '" . $iIDClient . "' AND " .
"recipientcollection.idlang = '" . $iIDLang . "' AND " .
"recipientcollection.deactivated = '0' AND " .
"recipientcollection.confirmed = '1' AND " .
"recipientcollection.idnewsrcp = groupmembers.idnewsrcp AND " .
"groupmembers.idnewsgroup = groups.idnewsgroup AND " .
"groups.defaultgroup = '1' AND groups.idclient = '" . $iIDClient . "' AND " .
"groups.idlang = '" . $iIDLang . "'";
break;
case "selection" :
$aGroups = unserialize ($oNewsletter->get("send_ids"));
$aGroups = unserialize($oNewsletter->get("send_ids"));
if (is_array($aGroups) && count($aGroups) > 0) {
$sGroups = "'" . implode("','", $aGroups) . "'";
$sGroups = "'" . implode("','", $aGroups) . "'";
$sDistinct = "distinct";
$sFrom = $cfg["tab"]["news_groupmembers"]." AS groupmembers ";
$sSQL = "recipientcollection.idclient = '".$iIDClient."' AND ".
"recipientcollection.idlang = '".$iIDLang."' AND ".
"recipientcollection.deactivated = '0' AND ".
"recipientcollection.confirmed = '1' AND ".
"recipientcollection.idnewsrcp = groupmembers.idnewsrcp AND ".
"groupmembers.idnewsgroup IN (".$sGroups.")";
$sDistinct = "distinct";
$sFrom = $cfg["tab"]["news_groupmembers"] . " AS groupmembers ";
$sSQL = "recipientcollection.idclient = '" . $iIDClient . "' AND " .
"recipientcollection.idlang = '" . $iIDLang . "' AND " .
"recipientcollection.deactivated = '0' AND " .
"recipientcollection.confirmed = '1' AND " .
"recipientcollection.idnewsrcp = groupmembers.idnewsrcp AND " .
"groupmembers.idnewsgroup IN (" . $sGroups . ")";
} else {
$sDestination = "unknown";
}
@ -171,8 +166,8 @@ class cNewsletterLogCollection extends ItemCollection
$iID = $oNewsletter->get("send_ids");
if (is_numeric($iID)) {
$sDistinct = "";
$sFrom = "";
$sSQL = "idnewsrcp = '".$iID."'";
$sFrom = "";
$sSQL = "idnewsrcp = '" . $iID . "'";
} else {
$sDestination = "unknown";
}
@ -180,7 +175,7 @@ class cNewsletterLogCollection extends ItemCollection
default:
$sDestination = "unknown";
}
unset ($oNewsletter);
unset($oNewsletter);
if ($sDestination == "unknown") {
return 0;
@ -205,8 +200,7 @@ class cNewsletterLogCollection extends ItemCollection
* Overriden delete function to update recipient count if removing recipient from the list
* @param integer $idnewslog ID
*/
public function delete($idnewslog)
{
public function delete($idnewslog) {
$idnewslog = Contenido_Security::toInteger($idnewslog);
$oLog = new cNewsletterLog($idnewslog);
@ -216,13 +210,12 @@ class cNewsletterLogCollection extends ItemCollection
$oJob = new cNewsletterJob($iIDNewsJob);
$oJob->set("rcpcount", $oJob->get("rcpcount") - 1);
$oJob->store();
unset ($oJob);
unset($oJob);
parent::delete($idnewslog);
}
public function deleteJob($idnewsjob)
{
public function deleteJob($idnewsjob) {
$idnewsjob = Contenido_Security::toInteger($idnewsjob);
$this->setWhere("idnewsjob", $idnewsjob);
$this->query();
@ -233,20 +226,19 @@ class cNewsletterLogCollection extends ItemCollection
return true;
}
}
}
/**
* Single NewsletterLog Item
*/
class cNewsletterLog extends Item
{
class cNewsletterLog extends Item {
/**
* Constructor Function
* @param mixed $mId Specifies the ID of item to load
*/
public function __construct($mId = false)
{
public function __construct($mId = false) {
global $cfg;
parent::__construct($cfg["tab"]["news_log"], "idnewslog");
if ($mId !== false) {
@ -255,11 +247,11 @@ class cNewsletterLog extends Item
}
/** @deprecated [2011-03-15] Old constructor function for downwards compatibility */
public function cNewsletterLog($mId = false)
{
public function cNewsletterLog($mId = false) {
cWarning(__FILE__, __LINE__, "Deprecated method call, use __construct()");
$this->__construct($mId);
}
}
?>

Datei anzeigen

@ -118,7 +118,7 @@ class NewsletterCollection extends ItemCollection
if ($oClientLang->getProperty("newsletter", "html_newsletter") == "true") {
$iIDArt = conCopyArticle($oBaseItem->get("idart"),
$oClientLang->getProperty("newsletter", "html_newsletter_idcat"),
sprintf(i18n("Newsletter: %s"), $oItem->get("name")));
sprintf(i18n("Newsletter: %s", "newsletter"), $oItem->get("name")));
conMakeOnline($iIDArt, $lang); // Article has to be online for sending...
}
unset ($oClientLang);
@ -564,7 +564,7 @@ class Newsletter extends Item
$sReturn = $sHTML;
} else {
if ($contenido) { // Use i18n only in backend
$sErrorText = i18n("There was a problem getting the newsletter article using http. Error: %s (%s)");
$sErrorText = i18n("There was a problem getting the newsletter article using http. Error: %s (%s)", "newsletter");
} else {
$sErrorText = "There was a problem getting the newsletter article using http. Error: %s (%s)";
}
@ -671,7 +671,7 @@ class Newsletter extends Item
// deleted). Exit with error instead of sending as text message only
if ($contenido) { // Use i18n only in backend
$sError = i18n("Newsletter to %s could not be sent: No html message available");
$sError = i18n("Newsletter to %s could not be sent: No html message available", "newsletter");
} else {
$sError = "Newsletter to %s could not be sent: No html message available";
}
@ -742,7 +742,7 @@ class Newsletter extends Item
if (!isValidMail($sEMail) || strtolower($sEMail) == "sysadmin@ihresite.de") {
// No valid destination mail address specified
if ($contenido) { // Use i18n only in backend
$sError = i18n("Newsletter to %s could not be sent: No valid e-mail address");
$sError = i18n("Newsletter to %s could not be sent: No valid e-mail address", "newsletter");
} else {
$sError = "Newsletter to %s could not be sent: No valid e-mail address";
}
@ -767,7 +767,7 @@ class Newsletter extends Item
if (!$oMail->Send()) {
if ($contenido) { // Use i18n only in backend
$sError = i18n("Newsletter to %s could not be sent");
$sError = i18n("Newsletter to %s could not be sent", "newsletter");
} else {
$sError = "Newsletter to %s could not be sent";
}
@ -830,7 +830,7 @@ class Newsletter extends Item
// deleted). Exit with error instead of sending as text message only
if ($contenido) { // Use i18n only in backend
$sError = i18n("Newsletter could not be sent: No html message available");
$sError = i18n("Newsletter could not be sent: No html message available", "newsletter");
} else {
$sError = "Newsletter could not be sent: No html message available";
}
@ -942,14 +942,14 @@ class Newsletter extends Item
if (strlen($sKey) != 30) { // Prevents sending without having a key
if ($contenido) { // Use i18n only in backend
$sError = i18n("Newsletter to %s could not be sent: Recipient has an incompatible or empty key");
$sError = i18n("Newsletter to %s could not be sent: Recipient has an incompatible or empty key", "newsletter");
} else {
$sError = "Newsletter to %s could not be sent: Recipient has an incompatible or empty key";
}
$aMessages[] = $sName." (".$sEMail."): ".sprintf($sError, $sEMail);
} else if (!isValidMail($sEMail)) {
if ($contenido) { // Use i18n only in backend
$sError = i18n("Newsletter to %s could not be sent: No valid e-mail address specified");
$sError = i18n("Newsletter to %s could not be sent: No valid e-mail address specified", "newsletter");
} else {
$sError = "Newsletter to %s could not be sent: No valid e-mail address specified";
}
@ -975,7 +975,7 @@ class Newsletter extends Item
$aSendRcps[] = $sName." (".$sEMail.")";
} else {
if ($contenido) { // Use i18n only in backend
$sError = i18n("Newsletter to %s could not be sent");
$sError = i18n("Newsletter to %s could not be sent", "newsletter");
} else {
$sError = "Newsletter to %s could not be sent";
}
@ -985,7 +985,7 @@ class Newsletter extends Item
}
} else {
if ($contenido) { // Use i18n only in backend
$sError = i18n("No recipient with specified recipient/group id %s/%s found");
$sError = i18n("No recipient with specified recipient/group id %s/%s found", "newsletter");
} else {
$sError = "No recipient with specified recpient/group id %s/%s found";
}

Datei anzeigen

@ -1,4 +1,5 @@
<?php
/**
* Project:
* Contenido Content Management System
@ -28,31 +29,27 @@
* }}
*
*/
if (!defined('CON_FRAMEWORK')) {
die('Illegal call');
}
/**
* Recipient management class
*/
class RecipientCollection extends ItemCollection
{
class RecipientCollection extends ItemCollection {
/**
* Constructor Function
* @param none
*/
public function __construct()
{
public function __construct() {
global $cfg;
parent::__construct($cfg["tab"]["news_rcp"], "idnewsrcp");
$this->_setItemClass("Recipient");
}
/** @deprecated [2011-03-15] Old constructor function for downwards compatibility */
public function RecipientCollection()
{
public function RecipientCollection() {
cWarning(__FILE__, __LINE__, "Deprecated method call, use __construct()");
$this->__construct();
}
@ -65,12 +62,11 @@ class RecipientCollection extends ItemCollection
* @param string $sJoinID Specifies additional recipient group ids to join (optional, e.g. 47,12,...)
* @param int $iMessageType Specifies the message type for the recipient (0 = text, 1 = html)
*/
public function create($sEMail, $sName = "", $iConfirmed = 0, $sJoinID = "", $iMessageType = 0)
{
public function create($sEMail, $sName = "", $iConfirmed = 0, $sJoinID = "", $iMessageType = 0) {
global $client, $lang, $auth;
$iConfirmed = (int)$iConfirmed;
$iMessageType = (int)$iMessageType;
$iConfirmed = (int) $iConfirmed;
$iMessageType = (int) $iMessageType;
/* Check if the e-mail adress already exists */
$email = strtolower($email); // e-mail always lower case
@ -80,14 +76,14 @@ class RecipientCollection extends ItemCollection
$this->query();
if ($this->next()) {
return $this->create($sEMail."_".substr(md5(rand()),0,10), $sName, 0, $sJoinID, $iMessageType); // 0: Deactivate 'confirmed'
return $this->create($sEMail . "_" . substr(md5(rand()), 0, 10), $sName, 0, $sJoinID, $iMessageType); // 0: Deactivate 'confirmed'
}
$oItem = parent::createNewItem();
$oItem->set("idclient", $client);
$oItem->set("idlang", $lang);
$oItem->set("name", $sName);
$oItem->set("email", $sEMail);
$oItem->set("hash", substr(md5(rand()),0,17) . uniqid("")); // Generating UID, 30 characters
$oItem->set("hash", substr(md5(rand()), 0, 17) . uniqid("")); // Generating UID, 30 characters
$oItem->set("confirmed", $iConfirmed);
$oItem->set("news_type", $iMessageType);
@ -100,9 +96,8 @@ class RecipientCollection extends ItemCollection
$oItem->store();
$iIDRcp = $oItem->get("idnewsrcp"); // Getting internal id of new recipient
// Add this recipient to the default recipient group (if available)
$oGroups = new RecipientGroupCollection();
$oGroups = new RecipientGroupCollection();
$oGroupMembers = new RecipientGroupMemberCollection();
$oGroups->setWhere("idclient", $client);
@ -135,8 +130,7 @@ class RecipientCollection extends ItemCollection
*
* @param $itemID int specifies the recipient
*/
public function delete($itemID)
{
public function delete($itemID) {
$oAssociations = new RecipientGroupMemberCollection();
$oAssociations->setWhere("idnewsrcp", $itemID);
$oAssociations->query();
@ -152,8 +146,7 @@ class RecipientCollection extends ItemCollection
* @param $timeframe int Days after creation a not confirmed recipient will be removed
* @return int Count of deleted recipients
*/
public function purge($timeframe)
{
public function purge($timeframe) {
global $client, $lang;
$oRecipientCollection = new RecipientCollection();
@ -172,14 +165,12 @@ class RecipientCollection extends ItemCollection
return $oRecipientCollection->count();
}
/**
* checkEMail returns true, if there is no recipient with the same e-mail address; otherwise false
* @param $email string e-mail
* @return recpient item if item with e-mail exists, false otherwise
*/
public function emailExists($sEmail)
{
public function emailExists($sEmail) {
global $client, $lang;
$oRecipientCollection = new RecipientCollection();
@ -200,33 +191,31 @@ class RecipientCollection extends ItemCollection
* Sets a key for all recipients without key or an old key (len(key) <> 30)
* @param none
*/
public function updateKeys()
{
public function updateKeys() {
$this->setWhere("LENGTH(hash)", 30, "<>");
$this->query();
$iUpdated = $this->count();
while ($oItem = $this->next()) {
$oItem->set("hash", substr(md5(rand()),0,17) . uniqid("")); /* Generating UID, 30 characters */
$oItem->set("hash", substr(md5(rand()), 0, 17) . uniqid("")); /* Generating UID, 30 characters */
$oItem->store();
}
return $iUpdated;
}
}
}
/**
* Single Recipient Item
*/
class Recipient extends Item
{
class Recipient extends Item {
/**
* Constructor Function
* @param mixed $mId Specifies the ID of item to load
*/
public function __construct($mId = false)
{
public function __construct($mId = false) {
global $cfg;
parent::__construct($cfg["tab"]["news_rcp"], "idnewsrcp");
if ($mId !== false) {
@ -235,8 +224,7 @@ class Recipient extends Item
}
/** @deprecated [2011-03-15] Old constructor function for downwards compatibility */
public function Recipient($mId = false)
{
public function Recipient($mId = false) {
cWarning(__FILE__, __LINE__, "Deprecated method call, use __construct()");
$this->__construct($mId);
}
@ -247,8 +235,7 @@ class Recipient extends Item
* @return boolean True if the hash matches, false otherwise
* @deprecated 4.6.15 - 10.08.2006
*/
public function checkMD5Email($md5email)
{
public function checkMD5Email($md5email) {
if ($md5email == md5($this->get("email"))) {
return true;
} else {
@ -256,8 +243,7 @@ class Recipient extends Item
}
}
public function store()
{
public function store() {
global $auth;
$this->set("lastmodified", date("Y-m-d H:i:s"), false);
@ -265,7 +251,7 @@ class Recipient extends Item
parent::store();
// Update name, email and newsletter type for recipients in pending newsletter jobs
$sName = $this->get("name");
$sName = $this->get("name");
$sEmail = $this->get("email");
if ($sName == "") {
$sName = $sEmail;
@ -284,6 +270,7 @@ class Recipient extends Item
$oLog->store();
}
}
}
?>

Datei anzeigen

@ -1,4 +1,5 @@
<?php
/**
* Project:
* Contenido Content Management System
@ -27,22 +28,20 @@
* }}
*
*/
if(!defined('CON_FRAMEWORK')) {
die('Illegal call');
if (!defined('CON_FRAMEWORK')) {
die('Illegal call');
}
cInclude("includes", "functions.con.php"); // For conDeleteArt and conCopyArt
cInclude("includes", "functions.con.php"); // For conDeleteArt and conCopyArt
// Initialization
$oPage = new cPage;
$oClientLang = new cApiClientLanguage(false, $client, $lang);
$oPage = new cPage;
$oClientLang = new cApiClientLanguage(false, $client, $lang);
// Include plugins
if (is_array($cfg['plugins']['newsletters'])) {
foreach ($cfg['plugins']['newsletters'] as $plugin) {
plugin_include("newsletters", $plugin."/".$plugin.".php");
}
foreach ($cfg['plugins']['newsletters'] as $plugin) {
plugin_include("newsletters", $plugin . "/" . $plugin . ".php");
}
}
// Exec actions
@ -50,185 +49,167 @@ $oNewsletter = new Newsletter;
$oNewsletter->loadByPrimaryKey($idnewsletter);
if ($oNewsletter->virgin == false && $oNewsletter->get("idclient") == $client && $oNewsletter->get("idlang") == $lang) {
// Check and set values
if (!is_numeric($_REQUEST["selTemplate"])) {
$_REQUEST["selTemplate"] = 0;
}
// Saving message changes; note, that if a user doesn't have the right to save the
// text message he may still have the right to change the html article. To prevent
// changing the html article, give the user only read access right for the newsletter
// article category - the article will be shown also, if he doesn't have any rights at all...
if ($action == "news_save" && $perm->have_perm_area_action("news", $action)) // Don't use $area!
{
// Changing e.g. \' back to ' (magic_quotes)
$sMessage = Contenido_Security::unescapeDB($_REQUEST["txtMessage"]);
$oNewsletter->set("message", $sMessage);
if ($oNewsletter->get("template_idart") != $_REQUEST["selTemplate"])
{
if ($oNewsletter->get("idart") > 0)
{
// Template has been changed: Delete old article
// (this discards the current html content as it deletes the existing newsletter article)
conDeleteArt($oNewsletter->get("idart"));
$iIDArt = 0;
}
if ($_REQUEST["selTemplate"] > 0)
{
// Template has been changed, but specified: Store template article as new newsletter article
$iIDArt = conCopyArticle($_REQUEST["selTemplate"],
$oClientLang->getProperty("newsletter", "html_newsletter_idcat"),
sprintf(i18n("Newsletter: %s"), $oNewsletter->get("name")));
conMakeOnline($iIDArt, $lang); // Article has to be online for sending...
}
$oNewsletter->set("idart", $iIDArt);
$oNewsletter->set("template_idart", $_REQUEST["selTemplate"]);
}
$oNewsletter->store();
} else if ($oNewsletter->get("idart") > 0) {
// Check, if html message article and template article are still available
$oArticles = new cApiArticleLanguageCollection;
$oArticles->setWhere("idlang", $lang);
$oArticles->setWhere("idart", $oNewsletter->get("idart"));
$oArticles->query();
if ($oArticles->count() == 0)
{
// Ups, article lost, reset idart and template_idart for newsletter
$notis = $notification->returnNotification("error", sprintf(i18n("The html newsletter article has been deleted (idart: %s), the html message is lost"), $oNewsletter->get("idart"))) . "<br>";
$oNewsletter->set("idart", 0);
$oNewsletter->set("template_idart", 0);
$oNewsletter->store();
} else {
$oArticles->resetQuery();
$oArticles->setWhere("idlang", $lang);
$oArticles->setWhere("idart", $oNewsletter->get("template_idart"));
$oArticles->query();
if ($oArticles->count() == 0)
{
// Ups, template has been deleted: Restore from current newsletter message article
$notis = $notification->returnNotification("warning", i18n("The html newsletter template article has been deleted, it has been restored using the html message article of this newsletter")) . "<br>";
$iIDArt = conCopyArticle($oNewsletter->get("idart"),
$oClientLang->getProperty("newsletter", "html_template_idcat"),
sprintf(i18n("%s (Template restored)"), $oNewsletter->get("name")));
$oNewsletter->set("template_idart", $iIDArt);
$oNewsletter->store();
}
}
}
$oForm = new UI_Table_Form("frmNewsletterMsg");
$oForm->setVar("frame", $frame);
$oForm->setVar("area", $area);
$oForm->setVar("action", "news_save");
$oForm->setVar("idnewsletter", $idnewsletter);
$oForm->setWidth("100%");
// Check and set values
if (!is_numeric($_REQUEST["selTemplate"])) {
$_REQUEST["selTemplate"] = 0;
}
$oForm->addHeader(sprintf(i18n("Edit newsletter message (%s)"), $oNewsletter->get("name")));
$oForm->add(i18n("Subject"), $oNewsletter->get("subject"));
$sTagInfoText = '<a href="javascript:fncShowHide(\'idTagInfoText\');"><strong>'.i18n("Tag information").'</strong></a>'.
'<div id="idTagInfoText" style="display: none"><br /><b>'. i18n("Special message tags (will be replaced when sending)").':</b><br>'.
'MAIL_NAME: '.i18n("Name of the recipient").'<br />'.
'MAIL_DATE: '.i18n("Date, when the mail has been sent").'<br />'.
'MAIL_TIME: '.i18n("Time, when the mail has been sent").'<br />'.
'MAIL_NUMBER: '.i18n("Number of recipients").'<br />'.
#'MAIL_CHANGE: '.i18n("Link to change the e-mail adress").'<br />'.
'MAIL_UNSUBSCRIBE: '.i18n("Link to unsubscribe").'<br />'.
'MAIL_STOP: '.i18n("Link to pause the subscription").'<br />'.
'MAIL_GOON: '.i18n("Link to resume the subscription");
// Saving message changes; note, that if a user doesn't have the right to save the
// text message he may still have the right to change the html article. To prevent
// changing the html article, give the user only read access right for the newsletter
// article category - the article will be shown also, if he doesn't have any rights at all...
if ($action == "news_save" && $perm->have_perm_area_action("news", $action)) { // Don't use $area!
// Changing e.g. \' back to ' (magic_quotes)
$sMessage = Contenido_Security::unescapeDB($_REQUEST["txtMessage"]);
$oNewsletter->set("message", $sMessage);
$sTagInfoHTML = '<a href="javascript:fncShowHide(\'idTagInfoHTML\');"><strong>'.i18n("Tag information").'</strong></a>'.
'<div id="idTagInfoHTML" style="display: none"><br /><b>'.i18n("Special message tags (will be replaced when sending, {..} = optional)").":</b><br />".
'[mail name="name" type="text"]{text}MAIL_NAME{text}[/mail]: '.i18n("Name of the recipient")."<br />".
'[mail name="date" type="text"]{text}MAIL_DATE{text}[/mail]: '.i18n("Date, when the mail has been sent")."<br />".
'[mail name="time" type="text"]{text}MAIL_TIME{text}[/mail]: '.i18n("Time, when the mail has been sent")."<br />".
'[mail name="number" type="text"]{text}MAIL_NUMBER{text}[/mail]: '.i18n("Number of recipients")."<br />".
#'[mail name="change" type="link" {text="'.i18n("Link text").'"}]{text}MAIL_CHANGE{text}[/mail]: '.i18n("Link to change the e-mail adress")."<br />".
'[mail name="unsubscribe" type="link" {text="'.i18n("Link text").'" }]{text}MAIL_UNSUBSCRIBE{text}[/mail]: '.i18n("Link to unsubscribe")."<br />".
'[mail name="stop" type="link" {text="'.i18n("Link text").'" }]{text}MAIL_STOP{text}[/mail]: '.i18n("Link to pause the subscription")."<br />".
'[mail name="goon" type="link" {text="'.i18n("Link text").'" }]{text}MAIL_GOON{text}[/mail]: '.i18n("Link to resume the subscription");
// Mention plugin interface
if (getSystemProperty("newsletter", "newsletter-recipients-plugin") == "true")
{
$sTagInfoText .= "<br /><br /><strong>".i18n("Additional message tags from recipients plugins:")."</strong><br />";
$sTagInfoHTML .= "<br /><br /><strong>".i18n("Additional message tags from recipients plugins:")."</strong><br />";
if ($oNewsletter->get("template_idart") != $_REQUEST["selTemplate"]) {
if ($oNewsletter->get("idart") > 0) {
// Template has been changed: Delete old article
// (this discards the current html content as it deletes the existing newsletter article)
conDeleteArt($oNewsletter->get("idart"));
$iIDArt = 0;
}
if (is_array($cfg['plugins']['recipients']))
{
foreach ($cfg['plugins']['recipients'] as $plugin)
{
plugin_include("recipients", $plugin."/".$plugin.".php");
if ($_REQUEST["selTemplate"] > 0) {
// Template has been changed, but specified: Store template article as new newsletter article
$iIDArt = conCopyArticle($_REQUEST["selTemplate"], $oClientLang->getProperty("newsletter", "html_newsletter_idcat"), sprintf(i18n("Newsletter: %s", "newsletter"), $oNewsletter->get("name")));
conMakeOnline($iIDArt, $lang); // Article has to be online for sending...
}
if (function_exists("recipients_".$plugin."_wantedVariables"))
{
$aPluginVars = call_user_func("recipients_".$plugin."_wantedVariables");
foreach ($aPluginVars as $sPluginVar)
{
$sTagInfoText .= 'MAIL_'.strtoupper($sPluginVar).'<br />';
$sTagInfoHTML .= '[mail name="'.strtolower($sPluginVar).'" type="text"][/mail]<br />';
}
}
}
}
} else {
setSystemProperty("newsletter", "newsletter-recipients-plugin", "false"); // -> Property available in system settings
}
$sTagInfoText .= "</div>";
$sTagInfoHTML .= "</div>";
$oNewsletter->set("idart", $iIDArt);
$oNewsletter->set("template_idart", $_REQUEST["selTemplate"]);
}
$iTplIDArt = 0; // Used later for on change event
if ($oNewsletter->get("type") == "html")
{
$iTplIDArt = $oNewsletter->get("template_idart");
$oSelTemplate = new cHTMLSelectElement("selTemplate");
$oSelTemplate->setEvent("change", "askSubmitOnTplChange(this);");
$aOptions = array( "idcat" => $oClientLang->getProperty("newsletter", "html_template_idcat"),
"start" => true,
"offline" => true,
"order" => "title");
$oTemplateArticles = new ArticleCollection($aOptions);
$aItems = array();
$aItems[] = array(0, i18n("-- none --"));
while ($oArticle = $oTemplateArticles->nextArticle())
{
$aItems[] = array($oArticle->get("idart"), $oArticle->get("title"));
}
$oSelTemplate->autoFill($aItems);
$oSelTemplate->setDefault($iTplIDArt);
unset ($aItems);
unset ($oArticles);
unset ($oTemplateArticles);
$oForm->add(i18n("HTML Template"), $oSelTemplate->render()."&nbsp;".i18n("Note, that changing the template discards the current html message content"));
if ($iTplIDArt != 0)
{
$sFrameSrc = $cfgClient[$client]["path"]["htmlpath"]."front_content.php?changeview=edit&action=con_editart&idart=".$oNewsletter->get("idart")."&idcat=".$oClientLang->getProperty("newsletter", "html_newsletter_idcat")."&lang=".$lang."&contenido=".$sess->id;
$oForm->add(i18n("HTML Message"), '<iframe width="100%" height="600" src="'.$sFrameSrc.'"></iframe><br />'.$sTagInfoHTML);
} else {
// Add a real note, that a template has to be specified
$notis .= $notification->returnNotification("warning", i18n("Newsletter type has been set to HTML/text, please remember to select an html template")) . "<br />";
$oForm->add(i18n("HTML Message"), i18n("Please choose a template first"));
}
}
$oNewsletter->store();
} else if ($oNewsletter->get("idart") > 0) {
// Check, if html message article and template article are still available
$oArticles = new cApiArticleLanguageCollection;
$oArticles->setWhere("idlang", $lang);
$oArticles->setWhere("idart", $oNewsletter->get("idart"));
$oArticles->query();
$oTxtMessage = new cHTMLTextarea("txtMessage", $oNewsletter->get("message"), 80, 20);
$oForm->add(i18n("Text Message"), $oTxtMessage->render()."<br />".$sTagInfoText);
$sExecScript = '
if ($oArticles->count() == 0) {
// Ups, article lost, reset idart and template_idart for newsletter
$notis = $notification->returnNotification("error", sprintf(i18n("The html newsletter article has been deleted (idart: %s), the html message is lost", "newsletter"), $oNewsletter->get("idart"))) . "<br>";
$oNewsletter->set("idart", 0);
$oNewsletter->set("template_idart", 0);
$oNewsletter->store();
} else {
$oArticles->resetQuery();
$oArticles->setWhere("idlang", $lang);
$oArticles->setWhere("idart", $oNewsletter->get("template_idart"));
$oArticles->query();
if ($oArticles->count() == 0) {
// Ups, template has been deleted: Restore from current newsletter message article
$notis = $notification->returnNotification("warning", i18n("The html newsletter template article has been deleted, it has been restored using the html message article of this newsletter", "newsletter")) . "<br>";
$iIDArt = conCopyArticle($oNewsletter->get("idart"), $oClientLang->getProperty("newsletter", "html_template_idcat"), sprintf(i18n("%s (Template restored)", "newsletter"), $oNewsletter->get("name")));
$oNewsletter->set("template_idart", $iIDArt);
$oNewsletter->store();
}
}
}
$oForm = new UI_Table_Form("frmNewsletterMsg");
$oForm->setVar("frame", $frame);
$oForm->setVar("area", $area);
$oForm->setVar("action", "news_save");
$oForm->setVar("idnewsletter", $idnewsletter);
$oForm->setWidth("100%");
$oForm->addHeader(sprintf(i18n("Edit newsletter message (%s)", "newsletter"), $oNewsletter->get("name")));
$oForm->add(i18n("Subject"), $oNewsletter->get("subject"));
$sTagInfoText = '<a href="javascript:fncShowHide(\'idTagInfoText\');"><strong>' . i18n("Tag information", "newsletter") . '</strong></a>' .
'<div id="idTagInfoText" style="display: none"><br /><b>' . i18n("Special message tags (will be replaced when sending)", "newsletter") . ':</b><br>' .
'MAIL_NAME: ' . i18n("Name of the recipient", "newsletter") . '<br />' .
'MAIL_DATE: ' . i18n("Date, when the mail has been sent", "newsletter") . '<br />' .
'MAIL_TIME: ' . i18n("Time, when the mail has been sent", "newsletter") . '<br />' .
'MAIL_NUMBER: ' . i18n("Number of recipients", "newsletter") . '<br />' .
#'MAIL_CHANGE: '.i18n("Link to change the e-mail adress", "newsletter").'<br />'.
'MAIL_UNSUBSCRIBE: ' . i18n("Link to unsubscribe", "newsletter") . '<br />' .
'MAIL_STOP: ' . i18n("Link to pause the subscription", "newsletter") . '<br />' .
'MAIL_GOON: ' . i18n("Link to resume the subscription", "newsletter");
$sTagInfoHTML = '<a href="javascript:fncShowHide(\'idTagInfoHTML\');"><strong>' . i18n("Tag information", "newsletter") . '</strong></a>' .
'<div id="idTagInfoHTML" style="display: none"><br /><b>' . i18n("Special message tags (will be replaced when sending, {..} = optional)", "newsletter") . ":</b><br />" .
'[mail name="name" type="text"]{text}MAIL_NAME{text}[/mail]: ' . i18n("Name of the recipient", "newsletter") . "<br />" .
'[mail name="date" type="text"]{text}MAIL_DATE{text}[/mail]: ' . i18n("Date, when the mail has been sent", "newsletter") . "<br />" .
'[mail name="time" type="text"]{text}MAIL_TIME{text}[/mail]: ' . i18n("Time, when the mail has been sent", "newsletter") . "<br />" .
'[mail name="number" type="text"]{text}MAIL_NUMBER{text}[/mail]: ' . i18n("Number of recipients", "newsletter") . "<br />" .
#'[mail name="change" type="link" {text="'.i18n("Link text", "newsletter").'"}]{text}MAIL_CHANGE{text}[/mail]: '.i18n("Link to change the e-mail adress", "newsletter")."<br />".
'[mail name="unsubscribe" type="link" {text="' . i18n("Link text", "newsletter") . '" }]{text}MAIL_UNSUBSCRIBE{text}[/mail]: ' . i18n("Link to unsubscribe", "newsletter") . "<br />" .
'[mail name="stop" type="link" {text="' . i18n("Link text", "newsletter") . '" }]{text}MAIL_STOP{text}[/mail]: ' . i18n("Link to pause the subscription", "newsletter") . "<br />" .
'[mail name="goon" type="link" {text="' . i18n("Link text", "newsletter") . '" }]{text}MAIL_GOON{text}[/mail]: ' . i18n("Link to resume the subscription", "newsletter");
// Mention plugin interface
if (getSystemProperty("newsletter", "newsletter-recipients-plugin") == "true") {
$sTagInfoText .= "<br /><br /><strong>" . i18n("Additional message tags from recipients plugins:", "newsletter") . "</strong><br />";
$sTagInfoHTML .= "<br /><br /><strong>" . i18n("Additional message tags from recipients plugins:", "newsletter") . "</strong><br />";
if (is_array($cfg['plugins']['recipients'])) {
foreach ($cfg['plugins']['recipients'] as $plugin) {
plugin_include("recipients", $plugin . "/" . $plugin . ".php");
if (function_exists("recipients_" . $plugin . "_wantedVariables")) {
$aPluginVars = call_user_func("recipients_" . $plugin . "_wantedVariables");
foreach ($aPluginVars as $sPluginVar) {
$sTagInfoText .= 'MAIL_' . strtoupper($sPluginVar) . '<br />';
$sTagInfoHTML .= '[mail name="' . strtolower($sPluginVar) . '" type="text"][/mail]<br />';
}
}
}
}
} else {
setSystemProperty("newsletter", "newsletter-recipients-plugin", "false"); // -> Property available in system settings
}
$sTagInfoText .= "</div>";
$sTagInfoHTML .= "</div>";
$iTplIDArt = 0; // Used later for on change event
if ($oNewsletter->get("type") == "html") {
$iTplIDArt = $oNewsletter->get("template_idart");
$oSelTemplate = new cHTMLSelectElement("selTemplate");
$oSelTemplate->setEvent("change", "askSubmitOnTplChange(this);");
$aOptions = array("idcat" => $oClientLang->getProperty("newsletter", "html_template_idcat"),
"start" => true,
"offline" => true,
"order" => "title");
$oTemplateArticles = new ArticleCollection($aOptions);
$aItems = array();
$aItems[] = array(0, i18n("-- none --", "newsletter"));
while ($oArticle = $oTemplateArticles->nextArticle()) {
$aItems[] = array($oArticle->get("idart"), $oArticle->get("title"));
}
$oSelTemplate->autoFill($aItems);
$oSelTemplate->setDefault($iTplIDArt);
unset($aItems);
unset($oArticles);
unset($oTemplateArticles);
$oForm->add(i18n("HTML Template", "newsletter"), $oSelTemplate->render() . "&nbsp;" . i18n("Note, that changing the template discards the current html message content", "newsletter"));
if ($iTplIDArt != 0) {
$sFrameSrc = $cfgClient[$client]["path"]["htmlpath"] . "front_content.php?changeview=edit&action=con_editart&idart=" . $oNewsletter->get("idart") . "&idcat=" . $oClientLang->getProperty("newsletter", "html_newsletter_idcat") . "&lang=" . $lang . "&contenido=" . $sess->id;
$oForm->add(i18n("HTML Message", "newsletter"), '<iframe width="100%" height="600" src="' . $sFrameSrc . '"></iframe><br />' . $sTagInfoHTML);
} else {
// Add a real note, that a template has to be specified
$notis .= $notification->returnNotification("warning", i18n("Newsletter type has been set to HTML/text, please remember to select an html template", "newsletter")) . "<br />";
$oForm->add(i18n("HTML Message", "newsletter"), i18n("Please choose a template first", "newsletter"));
}
}
$oTxtMessage = new cHTMLTextarea("txtMessage", $oNewsletter->get("message"), 80, 20);
$oForm->add(i18n("Text Message", "newsletter"), $oTxtMessage->render() . "<br />" . $sTagInfoText);
$sExecScript = '
<script type="text/javascript">
// Enabled/Disable group box
function fncShowHide(strItemID) {
@ -248,7 +229,7 @@ if ($oNewsletter->virgin == false && $oNewsletter->get("idclient") == $client &&
// if he/she may like to save this change (e.g. to get an html
// newsletter immediately)
function askSubmitOnTplChange(oSelectObject) {
iOriginalTplIDArt = '.$iTplIDArt.';
iOriginalTplIDArt = ' . $iTplIDArt . ';
if (iOriginalTplIDArt != oSelectObject.options[oSelectObject.selectedIndex].value) {
if (iOriginalTplIDArt == 0) {
@ -256,7 +237,7 @@ if ($oNewsletter->virgin == false && $oNewsletter->get("idclient") == $client &&
submitForm();
} else {
// You may loose information, warn!
box.confirm("'.i18n("HTML newsletter template changed").'", "'.i18n("HTML template has been changed. Do you like to save now to apply changes?<br /><br /><b>Note, that existing HTML newsletter content will get lost!</b>").'", "submitForm()");
box.confirm("' . i18n("HTML newsletter template changed", "newsletter") . '", "' . i18n("HTML template has been changed. Do you like to save now to apply changes?<br /><br /><b>Note, that existing HTML newsletter content will get lost!</b>", "newsletter") . '", "submitForm()");
}
}
}
@ -265,11 +246,11 @@ if ($oNewsletter->virgin == false && $oNewsletter->get("idclient") == $client &&
document.frmNewsletterMsg.submit();
}
</script>';
$oPage->addScript('messagebox', '<script type="text/javascript" src="scripts/messageBox.js.php?contenido='.$sess->id.'"></script>');
$oPage->addScript('execscript', $sExecScript);
$oPage->setContent($notis . $oForm->render(true));
$oPage->addScript('messagebox', '<script type="text/javascript" src="scripts/messageBox.js.php?contenido=' . $sess->id . '"></script>');
$oPage->addScript('execscript', $sExecScript);
$oPage->setContent($notis . $oForm->render(true));
} else {
$oPage->setContent($notis . "");
$oPage->setContent($notis . "");
}
$oPage->render();

Datei anzeigen

@ -1,4 +1,5 @@
<?php
/**
* Project:
* Contenido Content Management System
@ -27,372 +28,352 @@
* }}
*
*/
if(!defined('CON_FRAMEWORK')) {
die('Illegal call');
if (!defined('CON_FRAMEWORK')) {
die('Illegal call');
}
// Initialization
$oPage = new cPage;
$oPage = new cPage;
if ($action == "news_job_run" && $perm->have_perm_area_action($area, $action) && is_numeric($_REQUEST["idnewsjob"])) {
// Run job
$oJob = new cNewsletterJob($_REQUEST["idnewsjob"]);
$iSendCount = $oJob->runJob();
if ($oJob->get("dispatch") == 1 && $oJob->get("sendcount") < $oJob->get("rcpcount")) {
// Send in chunks
$sPathNext = $sess->url("main.php?area=$area&action=news_job_run&frame=4&idnewsjob=".$_REQUEST["idnewsjob"]);
// Calculating some statistics
$iChunk = ceil($oJob->get("sendcount") / $oJob->get("dispatch_count"));
$iChunks = ceil($oJob->get("rcpcount") / $oJob->get("dispatch_count"));
// Dispatch count > send/recipient count, set values to 1, at least
if ($iChunk == 0) {
$iChunk = 1;
}
if ($iChunks == 0) {
$iChunks = 1;
}
if ($oJob->get("dispatch_delay") == 0) {
// Send manually
$oForm = new UI_Table_Form("properties", $sPathNext);
$oForm->addHeader(i18n("Report:"));
$oForm->add("", "");
$oForm->add("", sprintf(i18n("Sending newsletter ... (chunk %s of %s, recipients: %s, sent: %s)"),
$iChunk, $iChunks, $oJob->get("rcpcount"), $oJob->get("sendcount")));
// Run job
$oJob = new cNewsletterJob($_REQUEST["idnewsjob"]);
$iSendCount = $oJob->runJob();
$oForm->setActionButton("cancel", $cfg['path']['contenido_fullhtml']."images/but_cancel.gif", i18n("Stop sending"), "c");
$oForm->setActionButton("submit", $cfg['path']['contenido_fullhtml']."images/but_ok.gif", i18n("Send next chunk"), "s", "news_job_run");
} else {
// Send automatically
$oForm = new UI_Table_Form("properties");
$oForm->addHeader(i18n("Report:"));
$oForm->add("", "");
$oForm->add("", sprintf(i18n("Sending newsletter ... (chunk %s of %s, recipients: %s, sent: %s)"),
$iChunk, $iChunks, $oJob->get("rcpcount"), $oJob->get("sendcount")));
if ($oJob->get("dispatch") == 1 && $oJob->get("sendcount") < $oJob->get("rcpcount")) {
// Send in chunks
$sPathNext = $sess->url("main.php?area=$area&action=news_job_run&frame=4&idnewsjob=" . $_REQUEST["idnewsjob"]);
$oPage->addScript("Refresh", '<meta http-equiv="refresh" content="'.$oJob->get("dispatch_delay").'; URL='.$sPathNext.'">');
$oForm->unsetActionButton("submit");
$oForm->setActionButton("cancel", $cfg['path']['contenido_fullhtml']."images/but_cancel.gif", i18n("Stop sending"), "c");
}
} else {
// All newsletters should have been sent
$oForm = new UI_Table_Form("properties");
$oForm->addHeader(i18n("Report:"));
$oForm->add("", "");
$oForm->add("", sprintf(i18n("The newsletter has been sent to %s recipients"), $oJob->get("sendcount")));
$oPage->setReload();
}
$oPage->setContent($notis . $oForm->render(true));
// Calculating some statistics
$iChunk = ceil($oJob->get("sendcount") / $oJob->get("dispatch_count"));
$iChunks = ceil($oJob->get("rcpcount") / $oJob->get("dispatch_count"));
// Dispatch count > send/recipient count, set values to 1, at least
if ($iChunk == 0) {
$iChunk = 1;
}
if ($iChunks == 0) {
$iChunks = 1;
}
if ($oJob->get("dispatch_delay") == 0) {
// Send manually
$oForm = new UI_Table_Form("properties", $sPathNext);
$oForm->addHeader(i18n("Report:", "newsletter"));
$oForm->add("", "");
$oForm->add("", sprintf(i18n("Sending newsletter ... (chunk %s of %s, recipients: %s, sent: %s)", "newsletter"), $iChunk, $iChunks, $oJob->get("rcpcount"), $oJob->get("sendcount")));
$oForm->setActionButton("cancel", $cfg['path']['contenido_fullhtml'] . "images/but_cancel.gif", i18n("Stop sending", "newsletter"), "c");
$oForm->setActionButton("submit", $cfg['path']['contenido_fullhtml'] . "images/but_ok.gif", i18n("Send next chunk", "newsletter"), "s", "news_job_run");
} else {
// Send automatically
$oForm = new UI_Table_Form("properties");
$oForm->addHeader(i18n("Report:", "newsletter"));
$oForm->add("", "");
$oForm->add("", sprintf(i18n("Sending newsletter ... (chunk %s of %s, recipients: %s, sent: %s)", "newsletter"), $iChunk, $iChunks, $oJob->get("rcpcount"), $oJob->get("sendcount")));
$oPage->addScript("Refresh", '<meta http-equiv="refresh" content="' . $oJob->get("dispatch_delay") . '; URL=' . $sPathNext . '">');
$oForm->unsetActionButton("submit");
$oForm->setActionButton("cancel", $cfg['path']['contenido_fullhtml'] . "images/but_cancel.gif", i18n("Stop sending", "newsletter"), "c");
}
} else {
// All newsletters should have been sent
$oForm = new UI_Table_Form("properties");
$oForm->addHeader(i18n("Report:", "newsletter"));
$oForm->add("", "");
$oForm->add("", sprintf(i18n("The newsletter has been sent to %s recipients", "newsletter"), $oJob->get("sendcount")));
$oPage->setReload();
}
$oPage->setContent($notis . $oForm->render(true));
} else if ($action == "news_job_delete" && $perm->have_perm_area_action($area, $action) && is_numeric($_REQUEST["idnewsjob"])) {
$oJobs = new cNewsletterJobCollection;
$oJobs->delete($_REQUEST["idnewsjob"]);
$oPage->setSubnav("blank", "news_jobs");
$oPage->setReload();
$oPage->setContent($notis);
$oJobs = new cNewsletterJobCollection;
$oJobs->delete($_REQUEST["idnewsjob"]);
$oPage->setSubnav("blank", "news_jobs");
$oPage->setReload();
$oPage->setContent($notis);
} else if ($action == "news_job_details" || $action == "news_job_detail_delete") {
// Show job details (recipients)
$oLogs = new cNewsletterLogCollection;
// Remove recipient from a job
if ($action == "news_job_detail_delete" && is_numeric($_REQUEST["idnewslog"]) && $perm->have_perm_area_action($area, "news_job_detail_delete"))
{
$oLogs->delete($_REQUEST["idnewslog"]);
}
// Initialize
$iNextPage = Contenido_Security::toInteger($_GET['nextpage']);
if ($iNextPage <= 0) {
$iNextPage = 1;
}
if ($_REQUEST["sortmode"] !== "DESC") {
$_REQUEST["sortmode"] = "ASC";
}
$sDateFormat = getEffectiveSetting("backend", "timeformat", "d.m.Y H:i");
// Set default values
$oUser = new cApiUser($auth->auth["uid"]);
if (!isset($_REQUEST["elemperpage"]) || !is_numeric($_REQUEST["elemperpage"]) || $_REQUEST["elemperpage"] < 0) {
$_REQUEST["elemperpage"] = $oUser->getProperty("itemsperpage", $area."_job_details");
}
if (!is_numeric($_REQUEST["elemperpage"])) {
$_REQUEST["elemperpage"] = 50;
}
if ($_REQUEST["elemperpage"] > 0) {
// - All - will not be saved
$oUser->setProperty("itemsperpage", $area."_job_details", $_REQUEST["elemperpage"]);
}
$oFrmOptions = new UI_Table_Form("frmOptions");
$oFrmOptions->setVar("contenido", $sess->id);
$oFrmOptions->setVar("area", $area);
$oFrmOptions->setVar("action", $action);
$oFrmOptions->setVar("frame", $frame);
$oFrmOptions->setVar("sortmode", $_REQUEST["sortmode"]);
$oFrmOptions->setVar("sortby", $_REQUEST["sortby"]);
$oFrmOptions->setVar("idnewsjob", $_REQUEST["idnewsjob"]);
//$oFrmOptions->setVar("startpage", $startpage);
//$oFrmOptions->setVar("appendparameters", $appendparameters);
$oFrmOptions->addHeader(i18n("List options"));
// Show job details (recipients)
$oSelElements = new cHTMLSelectElement("elemperpage");
$oSelElements->setEvent("onchange", "document.forms.frmOptions.submit();");
$aData = Array("0" => i18n("-All-"),
"50" => "50",
"100" => "100",
"250" => "250",
"500" => "500");
foreach ($aData as $sKey => $sValue)
{
$oOption = new cHTMLOptionElement($sValue, $sKey);
$oSelElements->addOptionElement($sKey, $oOption);
}
$oSelElements->setDefault($_REQUEST["elemperpage"]);
//$oSelElements->setStyle('border:1px;border-style:solid;border-color:black;');
$oFrmOptions->add(i18n("Items per page:"), $oSelElements->render());
// Ouput data
$oList = new cScrollList (true, "news_job_details");
$oList->setCustom("idnewsjob", $_REQUEST["idnewsjob"]);
$oList->setCustom("nextpage", $iNextPage);
$oList->setCustom("elemperpage", $_REQUEST["elemperpage"]);
$aCols = array("rcpname", "rcpemail", "", "status", "sent");
$oList->setHeader(i18n("Recipient"), i18n("E-Mail"), i18n("Type"), i18n("Status"), i18n("Sent"), i18n("Actions"));
$oList->setSortable(0, true);
$oList->setSortable(1, true);
$oList->setSortable(2, false);
$oList->setSortable(3, true);
$oList->setSortable(4, true);
// Get data
$oLogs->resetQuery();
$oLogs->setWhere("idnewsjob", $_REQUEST["idnewsjob"]);
$sBrowseLinks = "1";
if ($_REQUEST["elemperpage"] > 0)
{
// First, get total data count
$oLogs->query();
$iRecipients = $oLogs->count(); // Getting item count without limit (for page function) - better idea anybody (performance)?
if ($iRecipients > 0 && $iRecipients > $_REQUEST["elemperpage"])
{
$sBrowseLinks = "";
for ($i = 1; $i <= ceil($iRecipients / $_REQUEST["elemperpage"]); $i++)
{
//$iNext = (($i - 1) * $_REQUEST["elemperpage"]) + 1;
if ($sBrowseLinks !== "") {
$sBrowseLinks .= "&nbsp;";
}
if ($iNextPage == $i)
{
$sBrowseLinks .= $i."\n"; // I'm on the current page, no link
} else {
$sBrowseLinks .= '<a href="'.$sess->url("main.php?area=$area&action=$action&frame=$frame&idnewsjob=" .
$_REQUEST["idnewsjob"] . "&nextpage=$i&sortmode=" .
$_REQUEST["sortmode"] . "&sortby=" . $_REQUEST["sortby"]) . '">'.$i.'</a>'."\n";
}
}
}
$oLogs->setLimit($_REQUEST["elemperpage"] * ($iNextPage - 1), $_REQUEST["elemperpage"]);
}
if (!array_key_exists($_REQUEST["sortby"], $aCols)) {
$_REQUEST["sortby"] = 0; // Sort by rcpname by default
}
$oLogs->setOrder($aCols[$_REQUEST["sortby"]] . " " . $_REQUEST["sortmode"]);
$oLogs->query();
$oImgDelete = new cHTMLImage("images/delete.gif");
$oImgDelete->setAlt(i18n("Delete item"));
$sImgDelete = $oImgDelete->render();
unset ($oImgDelete);
$iCount = 0;
$aNewsType[] = array(); // Performance
$aNewsType[0] = i18n("Text only");
$aNewsType[1] = i18n("HTML/Text");
while ($oLog = $oLogs->next())
{
$sName = $oLog->get("rcpname");
$sEMail = $oLog->get("rcpemail");
switch ($oLog->get("status"))
{
case "pending":
$sStatus = i18n("Waiting for sending");
break;
case "sending":
$sStatus = i18n("Sending");
break;
case "successful":
$sStatus = i18n("Successful");
break;
default:
$sStatus = sprintf(i18n("Error: %s"), $oLog->get("status"));
}
if ($oLog->get("sent") == "0000-00-00 00:00:00") {
$sSent = "-";
} else {
$sSent = date($sDateFormat, strtotime($oLog->get("sent")));
}
$sLnkRemove = "";
if ($oLog->get("status") == "pending" && $perm->have_perm_area_action($area, "news_job_detail_delete"))
{
$oLnkRemove = new cHTMLLink;
$oLnkRemove->setCLink("news_jobs", 4, "news_job_detail_delete");
$oLnkRemove->setCustom("idnewsjob", $_REQUEST["idnewsjob"]);
$oLnkRemove->setCustom("idnewslog", $oLog->get($oLog->primaryKey));
$oLnkRemove->setCustom("sortby", $_REQUEST["sortby"]);
$oLnkRemove->setCustom("sortmode", $_REQUEST["sortmode"]);
$oLnkRemove->setContent($sImgDelete);
$sLnkRemove = $oLnkRemove->render();
}
$oList->setData($iCount, $sName, $sEMail, $aNewsType[$oLog->get("rcpnewstype")], $sStatus, $sSent, $sLnkRemove);
$oLogs = new cNewsletterLogCollection;
$iCount++;
}
// A little bit senseless, as the data is already sorted, but
// we need the sortmode in the header link
$oList->sort($_REQUEST["sortby"], $_REQUEST["sortmode"]);
// HerrB: Hardcore UI for browsing elements ... sorry
$sBrowseHTML = '<table width="100%" cellspacing="0" cellpadding="2" border="0">
// Remove recipient from a job
if ($action == "news_job_detail_delete" && is_numeric($_REQUEST["idnewslog"]) && $perm->have_perm_area_action($area, "news_job_detail_delete")) {
$oLogs->delete($_REQUEST["idnewslog"]);
}
// Initialize
$iNextPage = Contenido_Security::toInteger($_GET['nextpage']);
if ($iNextPage <= 0) {
$iNextPage = 1;
}
if ($_REQUEST["sortmode"] !== "DESC") {
$_REQUEST["sortmode"] = "ASC";
}
$sDateFormat = getEffectiveSetting("backend", "timeformat", "d.m.Y H:i");
// Set default values
$oUser = new cApiUser($auth->auth["uid"]);
if (!isset($_REQUEST["elemperpage"]) || !is_numeric($_REQUEST["elemperpage"]) || $_REQUEST["elemperpage"] < 0) {
$_REQUEST["elemperpage"] = $oUser->getProperty("itemsperpage", $area . "_job_details");
}
if (!is_numeric($_REQUEST["elemperpage"])) {
$_REQUEST["elemperpage"] = 50;
}
if ($_REQUEST["elemperpage"] > 0) {
// - All - will not be saved
$oUser->setProperty("itemsperpage", $area . "_job_details", $_REQUEST["elemperpage"]);
}
$oFrmOptions = new UI_Table_Form("frmOptions");
$oFrmOptions->setVar("contenido", $sess->id);
$oFrmOptions->setVar("area", $area);
$oFrmOptions->setVar("action", $action);
$oFrmOptions->setVar("frame", $frame);
$oFrmOptions->setVar("sortmode", $_REQUEST["sortmode"]);
$oFrmOptions->setVar("sortby", $_REQUEST["sortby"]);
$oFrmOptions->setVar("idnewsjob", $_REQUEST["idnewsjob"]);
//$oFrmOptions->setVar("startpage", $startpage);
//$oFrmOptions->setVar("appendparameters", $appendparameters);
$oFrmOptions->addHeader(i18n("List options", "newsletter"));
$oSelElements = new cHTMLSelectElement("elemperpage");
$oSelElements->setEvent("onchange", "document.forms.frmOptions.submit();");
$aData = Array("0" => i18n("-All-", "newsletter"),
"50" => "50",
"100" => "100",
"250" => "250",
"500" => "500");
foreach ($aData as $sKey => $sValue) {
$oOption = new cHTMLOptionElement($sValue, $sKey);
$oSelElements->addOptionElement($sKey, $oOption);
}
$oSelElements->setDefault($_REQUEST["elemperpage"]);
//$oSelElements->setStyle('border:1px;border-style:solid;border-color:black;');
$oFrmOptions->add(i18n("Items per page:", "newsletter"), $oSelElements->render());
// Ouput data
$oList = new cScrollList(true, "news_job_details");
$oList->setCustom("idnewsjob", $_REQUEST["idnewsjob"]);
$oList->setCustom("nextpage", $iNextPage);
$oList->setCustom("elemperpage", $_REQUEST["elemperpage"]);
$aCols = array("rcpname", "rcpemail", "", "status", "sent");
$oList->setHeader(i18n("Recipient", "newsletter"), i18n("E-Mail", "newsletter"), i18n("Type", "newsletter"), i18n("Status", "newsletter"), i18n("Sent", "newsletter"), i18n("Actions", "newsletter"));
$oList->setSortable(0, true);
$oList->setSortable(1, true);
$oList->setSortable(2, false);
$oList->setSortable(3, true);
$oList->setSortable(4, true);
// Get data
$oLogs->resetQuery();
$oLogs->setWhere("idnewsjob", $_REQUEST["idnewsjob"]);
$sBrowseLinks = "1";
if ($_REQUEST["elemperpage"] > 0) {
// First, get total data count
$oLogs->query();
$iRecipients = $oLogs->count(); // Getting item count without limit (for page function) - better idea anybody (performance)?
if ($iRecipients > 0 && $iRecipients > $_REQUEST["elemperpage"]) {
$sBrowseLinks = "";
for ($i = 1; $i <= ceil($iRecipients / $_REQUEST["elemperpage"]); $i++) {
//$iNext = (($i - 1) * $_REQUEST["elemperpage"]) + 1;
if ($sBrowseLinks !== "") {
$sBrowseLinks .= "&nbsp;";
}
if ($iNextPage == $i) {
$sBrowseLinks .= $i . "\n"; // I'm on the current page, no link
} else {
$sBrowseLinks .= '<a href="' . $sess->url("main.php?area=$area&action=$action&frame=$frame&idnewsjob=" .
$_REQUEST["idnewsjob"] . "&nextpage=$i&sortmode=" .
$_REQUEST["sortmode"] . "&sortby=" . $_REQUEST["sortby"]) . '">' . $i . '</a>' . "\n";
}
}
}
$oLogs->setLimit($_REQUEST["elemperpage"] * ($iNextPage - 1), $_REQUEST["elemperpage"]);
}
if (!array_key_exists($_REQUEST["sortby"], $aCols)) {
$_REQUEST["sortby"] = 0; // Sort by rcpname by default
}
$oLogs->setOrder($aCols[$_REQUEST["sortby"]] . " " . $_REQUEST["sortmode"]);
$oLogs->query();
$oImgDelete = new cHTMLImage("images/delete.gif");
$oImgDelete->setAlt(i18n("Delete item", "newsletter"));
$sImgDelete = $oImgDelete->render();
unset($oImgDelete);
$iCount = 0;
$aNewsType[] = array(); // Performance
$aNewsType[0] = i18n("Text only", "newsletter");
$aNewsType[1] = i18n("HTML/Text", "newsletter");
while ($oLog = $oLogs->next()) {
$sName = $oLog->get("rcpname");
$sEMail = $oLog->get("rcpemail");
switch ($oLog->get("status")) {
case "pending":
$sStatus = i18n("Waiting for sending", "newsletter");
break;
case "sending":
$sStatus = i18n("Sending", "newsletter");
break;
case "successful":
$sStatus = i18n("Successful", "newsletter");
break;
default:
$sStatus = sprintf(i18n("Error: %s", "newsletter"), $oLog->get("status"));
}
if ($oLog->get("sent") == "0000-00-00 00:00:00") {
$sSent = "-";
} else {
$sSent = date($sDateFormat, strtotime($oLog->get("sent")));
}
$sLnkRemove = "";
if ($oLog->get("status") == "pending" && $perm->have_perm_area_action($area, "news_job_detail_delete")) {
$oLnkRemove = new cHTMLLink;
$oLnkRemove->setCLink("news_jobs", 4, "news_job_detail_delete");
$oLnkRemove->setCustom("idnewsjob", $_REQUEST["idnewsjob"]);
$oLnkRemove->setCustom("idnewslog", $oLog->get($oLog->primaryKey));
$oLnkRemove->setCustom("sortby", $_REQUEST["sortby"]);
$oLnkRemove->setCustom("sortmode", $_REQUEST["sortmode"]);
$oLnkRemove->setContent($sImgDelete);
$sLnkRemove = $oLnkRemove->render();
}
$oList->setData($iCount, $sName, $sEMail, $aNewsType[$oLog->get("rcpnewstype")], $sStatus, $sSent, $sLnkRemove);
$iCount++;
}
// A little bit senseless, as the data is already sorted, but
// we need the sortmode in the header link
$oList->sort($_REQUEST["sortby"], $_REQUEST["sortmode"]);
// HerrB: Hardcore UI for browsing elements ... sorry
$sBrowseHTML = '<table width="100%" cellspacing="0" cellpadding="2" border="0">
<tr>
<td><img src="images/spacer.gif" width="1" height="10"></td>
</tr>
<tr class="text_medium" style="background-color: #ffffff;">
<td style="border: 1px; border-color: #B3B3B3; border-style: solid; background-color: #E2E2E2; color:#666666"> ' .
sprintf(i18n("Go to page: %s"), $sBrowseLinks) . '</td>
sprintf(i18n("Go to page: %s", "newsletter"), $sBrowseLinks) . '</td>
</tr>
</table>';
$oPage->setContent($oFrmOptions->render() . "<br />" . $oList->render() . $sBrowseHTML);
$oPage->setContent($oFrmOptions->render() . "<br />" . $oList->render() . $sBrowseHTML);
} else {
// Just show the job data
$oJob = new cNewsletterJob($_REQUEST["idnewsjob"]);
$oForm = new UI_Table_Form("properties");
$oForm->setVar("frame", $frame);
$oForm->setVar("area", $area);
$oForm->setVar("action", "");
$oForm->setVar("idnewsjob", $idnewsjob);
// Just show the job data
$oJob = new cNewsletterJob($_REQUEST["idnewsjob"]);
$oForm->addHeader(i18n("Newsletter Dispatch Job"));
$oForm->add(i18n("Name"), $oJob->get("name"));
$sDateFormat = getEffectiveSetting("backend", "timeformat", "d.m.Y H:i");
switch ($oJob->get("status"))
{
case 1:
$oForm->add(i18n("Status"), i18n("Pending"));
break;
case 2:
$oForm->add(i18n("Status"), sprintf(i18n("Sending (started: %s)"),
date($sDateFormat, strtotime($oJob->get("started")))));
break;
case 9:
$oForm->add(i18n("Status"), sprintf(i18n("Finished (started: %s, finished: %s)"),
date($sDateFormat, strtotime($oJob->get("started"))),
date($sDateFormat, strtotime($oJob->get("finished")))));
break;
}
$oForm->add(i18n("Statistics"), sprintf(i18n("Planned: %s, Send: %s"), $oJob->get("rcpcount"), $oJob->get("sendcount")));
$oForm->add(i18n("From"), $oJob->get("newsfrom") . " (" . $oJob->get("newsfromname") . ")");
$oForm->add(i18n("Subject"), $oJob->get("subject"));
$oForm = new UI_Table_Form("properties");
$oForm->setVar("frame", $frame);
$oForm->setVar("area", $area);
$oForm->setVar("action", "");
$oForm->setVar("idnewsjob", $idnewsjob);
if ($oJob->get("type") == "html")
{
$oForm->add(i18n("Type"), i18n("HTML and text"));
$txtMessageHTML = new cHTMLTextarea("txtMessageHTML", $oJob->get("message_html"), 80, 20);
$txtMessageHTML->setDisabled("disabled");
$oForm->add(i18n("HTML Message"), $txtMessageHTML->render());
} else {
$oForm->add(i18n("Type"), i18n("Text only"));
}
$txtMessageText = new cHTMLTextarea("txtMessageText", $oJob->get("message_text"), 80, 20);
$txtMessageText->setDisabled("disabled");
$oForm->add(i18n("Text Message"), $txtMessageText->render());
$aSendTo = unserialize($oJob->get("send_to"));
switch ($aSendTo[0])
{
case "all":
$sSendToInfo = i18n("Send newsletter to all recipients");
break;
case "default":
$sSendToInfo = i18n("Send newsletter to the members of the default group");
break;
case "selection":
$sSendToInfo = i18n("Send newsletter to the members of the selected group(s):");
unset ($aSendTo[0]);
foreach ($aSendTo as $sGroup)
{
$sSendToInfo .= "<br />" . $sGroup;
}
break;
case "single":
$sSendToInfo = i18n("Send newsletter to single recipient:");
$sSendToInfo .= "<br />" . $aSendTo[1] . " (" . $aSendTo[2] . ")";
break;
default:
}
unset ($aSendTo);
$oForm->add(i18n("Recipients"), $sSendToInfo);
if ($oJob->get("use_cronjob") == 1) {
$sOptionsInfo = i18n("Use cronjob: Enabled");
} else {
$sOptionsInfo = i18n("Use cronjob: Not enabled");
}
if ($oJob->get("dispatch")) {
$sOptionsInfo .= "<br />" . sprintf(i18n("Dispatch: Enabled (block size: %s, delay: %s sec.)"), $oJob->get("dispatch_count"), $oJob->get("dispatch_delay"));
} else {
$sOptionsInfo .= "<br />" . i18n("Dispatch: Disabled");
}
$oForm->add(i18n("Options"), $sOptionsInfo);
$oForm->add(i18n("Author"), $oJob->get("authorname"));
$oForm->add(i18n("Created"), $oJob->get("created"));
// Just remove the "save changes" message (as it is not possible to remove the image completely in ui_table_form)
$oForm->setActionButton("submit", $cfg['path']['contenido_fullhtml']."images/but_ok.gif", "", "s");
$oPage->setContent($oForm->render(true));
$oForm->addHeader(i18n("Newsletter Dispatch Job", "newsletter"));
$oForm->add(i18n("Name", "newsletter"), $oJob->get("name"));
$sDateFormat = getEffectiveSetting("backend", "timeformat", "d.m.Y H:i");
switch ($oJob->get("status")) {
case 1:
$oForm->add(i18n("Status", "newsletter"), i18n("Pending", "newsletter"));
break;
case 2:
$oForm->add(i18n("Status", "newsletter"), sprintf(i18n("Sending (started: %s)", "newsletter"), date($sDateFormat, strtotime($oJob->get("started")))));
break;
case 9:
$oForm->add(i18n("Status", "newsletter"), sprintf(i18n("Finished (started: %s, finished: %s)", "newsletter"), date($sDateFormat, strtotime($oJob->get("started"))), date($sDateFormat, strtotime($oJob->get("finished")))));
break;
}
$oForm->add(i18n("Statistics", "newsletter"), sprintf(i18n("Planned: %s, Send: %s", "newsletter"), $oJob->get("rcpcount"), $oJob->get("sendcount")));
$oForm->add(i18n("From", "newsletter"), $oJob->get("newsfrom") . " (" . $oJob->get("newsfromname") . ")");
$oForm->add(i18n("Subject", "newsletter"), $oJob->get("subject"));
if ($oJob->get("type") == "html") {
$oForm->add(i18n("Type", "newsletter"), i18n("HTML and text", "newsletter"));
$txtMessageHTML = new cHTMLTextarea("txtMessageHTML", $oJob->get("message_html"), 80, 20);
$txtMessageHTML->setDisabled("disabled");
$oForm->add(i18n("HTML Message", "newsletter"), $txtMessageHTML->render());
} else {
$oForm->add(i18n("Type", "newsletter"), i18n("Text only", "newsletter"));
}
$txtMessageText = new cHTMLTextarea("txtMessageText", $oJob->get("message_text"), 80, 20);
$txtMessageText->setDisabled("disabled");
$oForm->add(i18n("Text Message", "newsletter"), $txtMessageText->render());
$aSendTo = unserialize($oJob->get("send_to"));
switch ($aSendTo[0]) {
case "all":
$sSendToInfo = i18n("Send newsletter to all recipients", "newsletter");
break;
case "default":
$sSendToInfo = i18n("Send newsletter to the members of the default group", "newsletter");
break;
case "selection":
$sSendToInfo = i18n("Send newsletter to the members of the selected group(s):", "newsletter");
unset($aSendTo[0]);
foreach ($aSendTo as $sGroup) {
$sSendToInfo .= "<br />" . $sGroup;
}
break;
case "single":
$sSendToInfo = i18n("Send newsletter to single recipient:", "newsletter");
$sSendToInfo .= "<br />" . $aSendTo[1] . " (" . $aSendTo[2] . ")";
break;
default:
}
unset($aSendTo);
$oForm->add(i18n("Recipients", "newsletter"), $sSendToInfo);
if ($oJob->get("use_cronjob") == 1) {
$sOptionsInfo = i18n("Use cronjob: Enabled", "newsletter");
} else {
$sOptionsInfo = i18n("Use cronjob: Not enabled", "newsletter");
}
if ($oJob->get("dispatch")) {
$sOptionsInfo .= "<br />" . sprintf(i18n("Dispatch: Enabled (block size: %s, delay: %s sec.)", "newsletter"), $oJob->get("dispatch_count"), $oJob->get("dispatch_delay"));
} else {
$sOptionsInfo .= "<br />" . i18n("Dispatch: Disabled", "newsletter");
}
$oForm->add(i18n("Options", "newsletter"), $sOptionsInfo);
$oForm->add(i18n("Author", "newsletter"), $oJob->get("authorname"));
$oForm->add(i18n("Created", "newsletter"), $oJob->get("created"));
// Just remove the "save changes" message (as it is not possible to remove the image completely in ui_table_form)
$oForm->setActionButton("submit", $cfg['path']['contenido_fullhtml'] . "images/but_ok.gif", "", "s");
$oPage->setContent($oForm->render(true));
}
$oPage->render();
?>

Datei anzeigen

@ -50,9 +50,9 @@ $oUser = new cApiUser($auth->auth["uid"]);
// sort: Element can be used to be sorted by
// search: Element can be used to search in
$aFields = array();
$aFields["name"] = array("field" => "name", "caption" => i18n("Name"), "type" => "base,sort,search");
$aFields["created"] = array("field" => "created", "caption" => i18n("Created"), "type" => "base,sort");
$aFields["status"] = array("field" => "status", "caption" => i18n("Status"), "type" => "base,sort");
$aFields["name"] = array("field" => "name", "caption" => i18n("Name", "newsletter"), "type" => "base,sort,search");
$aFields["created"] = array("field" => "created", "caption" => i18n("Created", "newsletter"), "type" => "base,sort");
$aFields["status"] = array("field" => "status", "caption" => i18n("Status", "newsletter"), "type" => "base,sort");
// Not needed, as no sort/search, but keep as memo: $aFields["cronjob"] = array("field" => "use_cronjob", "caption" => i18n("Use cronjob"), "type" => "base");
##################################
@ -158,11 +158,11 @@ $sDateFormat = getEffectiveSetting("backend", "timeformat", "d.m.Y H:i");
// Store messages for repeated use (speeds performance, as i18n translation is only needed once)
$aMsg = array();
$aMsg["DelTitle"] = i18n("Delete dispatch job");
$aMsg["DelDescr"] = i18n("Do you really want to delete the following newsletter dispatch job:<br>");
$aMsg["DelTitle"] = i18n("Delete dispatch job", "newsletter");
$aMsg["DelDescr"] = i18n("Do you really want to delete the following newsletter dispatch job:<br>", "newsletter");
$aMsg["SendTitle"] = i18n("Run job");
$aMsg["SendDescr"] = i18n("Do you really want to run the following job:<br>");
$aMsg["SendTitle"] = i18n("Run job", "newsletter");
$aMsg["SendDescr"] = i18n("Do you really want to run the following job:<br>", "newsletter");
// Prepare "send link" template
$sTplSend = '<a title="'.$aMsg["SendTitle"].'" href="javascript://" onclick="showSendMsg(\'{ID}\',\'{NAME}\')"><img src="'.$cfg['path']['images'].'newsletter_16.gif" border="0" title="'.$aMsg["SendTitle"].'" alt="'.$aMsg["SendTitle"].'"></a>';

Datei anzeigen

@ -36,7 +36,7 @@ if (!defined('CON_FRAMEWORK')) {
if (isset($_GET['idnewsjob']) && (int)$_GET['idnewsjob'] > 0)
{
$sCaption = i18n("View");
$sCaption = i18n("View", "newsletter");
$tmp_area = "foo2";
# Set template data
@ -46,7 +46,7 @@ if (isset($_GET['idnewsjob']) && (int)$_GET['idnewsjob'] > 0)
$tpl->set("d", "CAPTION", '<a class="white" onclick="sub.clicked(this)" target="right_bottom" href="'.$sess->url("main.php?area=news_jobs&frame=4&idnewsjob=$idnewsjob").'">'.$sCaption.'</a>');
$tpl->next();
$sCaption = i18n("Details");
$sCaption = i18n("Details", "newsletter");
$tmp_area = "foo2";
# Set template data

Datei anzeigen

@ -56,7 +56,7 @@ $sId = 'img_newsletter';
$oTpl->set('s', 'INEWSLETTER', $sId);
if ($perm->have_perm_area_action('news')) {
$sButtonRow = '<a style="margin-right:5px;" href="javascript://" onclick="toggleContainer(\''.$sId.'\');reloadLeftBottomAndTransportFormVars(document.newsletter_listoptionsform);">';
$sButtonRow .= '<img onmouseover="hoverEffect(\''.$sId.'\', \'in\')" onmouseout="hoverEffect(\''.$sId.'\', \'out\')" alt="'.i18n("Newsletter").'" title="'.i18n("Newsletter").'" name="'.$sId.'" id="'.$sId.'" src="'.$cfg["path"]["images"].'newsletter_on.gif"/>';
$sButtonRow .= '<img onmouseover="hoverEffect(\''.$sId.'\', \'in\')" onmouseout="hoverEffect(\''.$sId.'\', \'out\')" alt="'. i18n("Newsletter", "newsletter").'" title="'.i18n("Newsletter", "newsletter").'" name="'.$sId.'" id="'.$sId.'" src="'.$cfg["path"]["images"].'newsletter_on.gif"/>';
$sButtonRow .= '</a>';
}
@ -65,7 +65,7 @@ $sId = 'img_dispatch';
$oTpl->set('s', 'IDISPATCH', $sId);
if ($perm->have_perm_area_action('news_jobs')) {
$sButtonRow .= '<a style="margin-right:5px;" href="javascript://" onclick="toggleContainer(\''.$sId.'\');reloadLeftBottomAndTransportFormVars(document.dispatch_listoptionsform);">';
$sButtonRow .= '<img onmouseover="hoverEffect(\''.$sId.'\', \'in\')" onmouseout="hoverEffect(\''.$sId.'\', \'out\')" alt="'.i18n("Dispatch").'" title="'.i18n("Dispatch").'" name="'.$sId.'" id="'.$sId.'" src="'.$cfg["path"]["images"].'newsletter_dispatch_on.gif"/>';
$sButtonRow .= '<img onmouseover="hoverEffect(\''.$sId.'\', \'in\')" onmouseout="hoverEffect(\''.$sId.'\', \'out\')" alt="'.i18n("Dispatch", "newsletter").'" title="'.i18n("Dispatch", "newsletter").'" name="'.$sId.'" id="'.$sId.'" src="'.$cfg["path"]["images"].'newsletter_dispatch_on.gif"/>';
$sButtonRow .= '</a>';
}
@ -74,7 +74,7 @@ $sId = 'img_recipient';
$oTpl->set('s', 'IRECIPIENTS', $sId);
if ($perm->have_perm_area_action('recipients')) {
$sButtonRow .= '<a style="margin-right:5px;" href="javascript://" onclick="toggleContainer(\''.$sId.'\');reloadLeftBottomAndTransportFormVars(document.recipients_listoptionsform);">';
$sButtonRow .= '<img onmouseover="hoverEffect(\''.$sId.'\', \'in\')" onmouseout="hoverEffect(\''.$sId.'\', \'out\')" alt="'.i18n("Recipients").'" title="'.i18n("Recipients").'" id="'.$sId.'" src="'.$cfg["path"]["images"].'newsletter_recipients_on.gif"/>';
$sButtonRow .= '<img onmouseover="hoverEffect(\''.$sId.'\', \'in\')" onmouseout="hoverEffect(\''.$sId.'\', \'out\')" alt="'.i18n("Recipients", "newsletter").'" title="'.i18n("Recipients", "newsletter").'" id="'.$sId.'" src="'.$cfg["path"]["images"].'newsletter_recipients_on.gif"/>';
$sButtonRow .= '</a>';
}
@ -83,7 +83,7 @@ $sId = 'img_recipientgroup';
$oTpl->set('s', 'IRECIPIENTGROUP', $sId);
if ($perm->have_perm_area_action('recipientgroups')) {
$sButtonRow .= '<a style="margin-right:5px;" href="javascript://" onclick="toggleContainer(\''.$sId.'\');reloadLeftBottomAndTransportFormVars(groups_listoptionsform);">';
$sButtonRow .= '<img onmouseover="hoverEffect(\''.$sId.'\', \'in\')" onmouseout="hoverEffect(\''.$sId.'\', \'out\')" alt="'.i18n("Recipient groups").'" title="'.i18n("Recipient groups").'" id="'.$sId.'" src="'.$cfg["path"]["images"].'newsletter_recipientgroups_on.gif"/>';
$sButtonRow .= '<img onmouseover="hoverEffect(\''.$sId.'\', \'in\')" onmouseout="hoverEffect(\''.$sId.'\', \'out\')" alt="'.i18n("Recipient groups", "newsletter").'" title="'.i18n("Recipient groups", "newsletter").'" id="'.$sId.'" src="'.$cfg["path"]["images"].'newsletter_recipientgroups_on.gif"/>';
$sButtonRow .= '</a>';
}
@ -98,7 +98,7 @@ unset($sButtonRow);
# 1.1 Newsletter: Actions folding row
######################################
$sLink = "actionlink"; // ID for HTML element
$oActionsRow = new cFoldingRow("28cf9b31-e6d7-4657-a9a7-db31478e7a5c",i18n("Actions"), $sLink);
$oActionsRow = new cFoldingRow("28cf9b31-e6d7-4657-a9a7-db31478e7a5c",i18n("Actions", "newsletter"), $sLink);
$oTpl->set('s', 'ACTIONLINK', $sLink);
if ($perm->have_perm_area_action("news", "news_create"))
@ -108,7 +108,7 @@ if ($perm->have_perm_area_action("news", "news_create"))
$oLink = new cHTMLLink;
$oLink->setMultiLink("news", "", "news", "news_create");
$oLink->setContent('<img style="margin-right: 4px;" src="'.$cfg["path"]["images"] . 'folder_new.gif" align="middle">'.i18n("Create newsletter"));
$oLink->setContent('<img style="margin-right: 4px;" src="'.$cfg["path"]["images"] . 'folder_new.gif" align="middle">'.i18n("Create newsletter", "newsletter"));
$sContent .= $oLink->render() . '</div>'."\n";
$oActionsRow->setContentData($sContent);
@ -120,7 +120,7 @@ if ($perm->have_perm_area_action("news", "news_create"))
# 1.2 Newsletter: Settings folding row
######################################
$sLink = "settingslink";
$oSettingsRow = new cFoldingRow("d64baf0a-aea9-47b3-8490-54a00fce02b5",i18n("Settings"), $sLink);
$oSettingsRow = new cFoldingRow("d64baf0a-aea9-47b3-8490-54a00fce02b5",i18n("Settings", "newsletter"), $sLink);
$oTpl->set('s', 'SETTINGSLINK', $sLink);
// HTML Newsletter: Template and newsletter category
@ -132,9 +132,9 @@ $oSelHTMLTemplateIDCat->setStyle("width: 220px;");
$oSelHTMLNewsletterIDCat = new cHTMLSelectElement("selHTMLNewsletterCat");
$oSelHTMLNewsletterIDCat->setStyle("width: 220px;");
$oOptionTemplate = new cHTMLOptionElement("--".i18n("Please select")."--", 0);
$oOptionTemplate = new cHTMLOptionElement("--".i18n("Please select", "newsletter")."--", 0);
$oSelHTMLTemplateIDCat->addOptionElement(0, $oOptionTemplate);
$oOptionNewsletter = new cHTMLOptionElement("--".i18n("Please select")."--", 0);
$oOptionNewsletter = new cHTMLOptionElement("--".i18n("Please select", "newsletter")."--", 0);
$oSelHTMLNewsletterIDCat->addOptionElement(0, $oOptionNewsletter);
$sSQL = "SELECT tblCat.idcat AS idcat, tblCatLang.name AS name, tblCatTree.level AS level, ";
@ -200,7 +200,7 @@ if (!$perm->have_perm_area_action($area, "news_html_settings"))
$oSelTestDestination = new cHTMLSelectElement("selTestDestination");
$oSelTestDestination->setStyle("width: 220px;");
$oOption = new cHTMLOptionElement(i18n("My mail address"), 0);
$oOption = new cHTMLOptionElement(i18n("My mail address", "newsletter"), 0);
$oSelTestDestination->addOptionElement(0, $oOption);
$oRcpGroups = new RecipientGroupCollection;
@ -237,7 +237,7 @@ if (!$perm->have_perm_area_action($area, "news_send_test"))
}
$oSelTestDestination->setDefault($iTestDestination);
$oBtnSave = new cHTMLButton("submit", i18n("Save"));
$oBtnSave = new cHTMLButton("submit", i18n("Save", "newsletter"));
$sContent = '<div style="border-bottom: 0px solid #B3B3B3; padding-left:17px; background: '.$cfg['color']['table_dark'].';">'."\n";
$sContent .= ' <form target="left_bottom" onsubmit="append_registered_parameters(this);" id="htmlnewsletter" name="htmlnewsletter" method="get" action="main.php?1">'."\n";
@ -253,16 +253,16 @@ $sContent .= ' <input type="hidden" name="searchin" value="'.$_REQUEST["search
$sContent .= ' <input type="hidden" name="action_html" value="save_newsletter_properties">'."\n";
$sContent .= ' <table>'."\n";
$sContent .= ' <tr>'."\n";
$sContent .= ' <td>'.$oCkbHTMLNewsletter->toHTML(false).' '.i18n("Enable HTML Newsletter").'</td>'."\n";
$sContent .= ' <td>'.$oCkbHTMLNewsletter->toHTML(false).' '.i18n("Enable HTML Newsletter", "newsletter").'</td>'."\n";
$sContent .= ' </tr>'."\n";
$sContent .= ' <tr>'."\n";
$sContent .= ' <td>'.i18n("HTML Template Category:").'<br />'.$oSelHTMLTemplateIDCat->render().'</td>'."\n";
$sContent .= ' <td>'.i18n("HTML Template Category:", "newsletter").'<br />'.$oSelHTMLTemplateIDCat->render().'</td>'."\n";
$sContent .= ' </tr>'."\n";
$sContent .= ' <tr>'."\n";
$sContent .= ' <td>'.i18n("HTML Newsletter Category:").'<br />'.$oSelHTMLNewsletterIDCat->render().'</td>'."\n";
$sContent .= ' <td>'.i18n("HTML Newsletter Category:", "newsletter").'<br />'.$oSelHTMLNewsletterIDCat->render().'</td>'."\n";
$sContent .= ' </tr>'."\n";
$sContent .= ' <tr>'."\n";
$sContent .= ' <td>'.i18n("Send test destination:").'<br />'.$oSelTestDestination->render().'</td>'."\n";
$sContent .= ' <td>'.i18n("Send test destination:", "newsletter").'<br />'.$oSelTestDestination->render().'</td>'."\n";
$sContent .= ' </tr>'."\n";
$sContent .= ' <tr>'."\n";
$sContent .= ' <td style="text-align: right;">'.$oBtnSave->render().'</td>'."\n";
@ -282,7 +282,7 @@ if ($iItemsPerPage == 0) {
}
$oSelItemsPerPage = new cHTMLSelectElement("elemperpage");
$oSelItemsPerPage->autoFill(array(0 => i18n("-- All --"), 25 => 25, 50 => 50, 75 => 75, 100 => 100));
$oSelItemsPerPage->autoFill(array(0 => i18n("-- All --", "newsletter"), 25 => 25, 50 => 50, 75 => 75, 100 => 100));
$oSelItemsPerPage->setDefault($iItemsPerPage);
// Sort By
$oSelSortBy = new cHTMLSelectElement("sortby");
@ -291,19 +291,19 @@ $oSelSortBy->addOptionElement($sKey, $oOption);
$oSelSortBy->setDefault("name");
// Sort Order
$oSelSortOrder = new cHTMLSelectElement("sortorder");
$oSelSortOrder->autoFill(array("ASC" => i18n("Ascending"), "DESC" => i18n("Descending")));
$oSelSortOrder->autoFill(array("ASC" => i18n("Ascending", "newsletter"), "DESC" => i18n("Descending", "newsletter")));
$oSelSortOrder->setDefault("ASC");
// Search For
$oTextboxFilter = new cHTMLTextbox("filter", "", 16);
// Search In
$oSelSearchIn = new cHTMLSelectElement("searchin");
$oOption = new cHTMLOptionElement(i18n("-- All fields --"), "--all--");
$oOption = new cHTMLOptionElement(i18n("-- All fields --", "newsletter"), "--all--");
$oSelSearchIn->addOptionElement("all", $oOption);
$oOption = new cHTMLOptionElement("Name", "name");
$oSelSearchIn->addOptionElement($sKey, $oOption);
$oSelSearchIn->setDefault("name");
// Apply button
$oBtnApply = new cHTMLButton("submit", i18n("Apply"));
$oBtnApply = new cHTMLButton("submit", i18n("Apply", "newsletter"));
$sContent = '<div style="border-bottom: 0px solid #B3B3B3; padding-left: 17px; background: '.$cfg['color']['table_dark'].';">'."\n";
$sContent .= '<form target="left_bottom" onsubmit="reloadLeftBottomAndTransportFormVars(this);" id="newsletter_listoptionsform" name="newsletter_listoptionsform" method="get" action="">'."\n";
@ -312,23 +312,23 @@ $sContent .= ' <input type="hidden" name="frame" value="2">'."\n";
$sContent .= ' <input type="hidden" name="contenido" value="'.$sess->id.'">'."\n";
$sContent .= ' <table>'."\n";
$sContent .= ' <tr>'."\n";
$sContent .= ' <td>'. i18n("Items / page").'</td>'."\n";
$sContent .= ' <td>'. i18n("Items / page", "newsletter").'</td>'."\n";
$sContent .= ' <td>'.$oSelItemsPerPage->render().'</td>'."\n";
$sContent .= ' </tr>'."\n";
$sContent .= ' <tr>'."\n";
$sContent .= ' <td>'. i18n("Sort by").'</td>'."\n";
$sContent .= ' <td>'. i18n("Sort by", "newsletter").'</td>'."\n";
$sContent .= ' <td>'.$oSelSortBy->render().'</td>'."\n";
$sContent .= ' </tr>'."\n";
$sContent .= ' <tr>'."\n";
$sContent .= ' <td>'. i18n("Sort order").'</td>'."\n";
$sContent .= ' <td>'. i18n("Sort order", "newsletter").'</td>'."\n";
$sContent .= ' <td>'.$oSelSortOrder->render().'</td>'."\n";
$sContent .= ' </tr>'."\n";
$sContent .= ' <tr>'."\n";
$sContent .= ' <td>'. i18n("Search for").'</td>'."\n";
$sContent .= ' <td>'. i18n("Search for", "newsletter").'</td>'."\n";
$sContent .= ' <td>'.$oTextboxFilter->render().'</td>'."\n";
$sContent .= ' </tr>'."\n";
$sContent .= ' <tr>'."\n";
$sContent .= ' <td>'. i18n("Search in").'</td>'."\n";
$sContent .= ' <td>'. i18n("Search in", "newsletter").'</td>'."\n";
$sContent .= ' <td>'.$oSelSearchIn->render().'</td>'."\n";
$sContent .= ' </tr>'."\n";
$sContent .= ' <tr>'."\n";
@ -341,7 +341,7 @@ $sContent .= '</div>'."\n";
// To template
$sLink = "listoption";
$oListOptionsRow = new cFoldingRow("9d0968be-601d-44f8-a666-99d51c9c777d",i18n("List options"), $sLink);
$oListOptionsRow = new cFoldingRow("9d0968be-601d-44f8-a666-99d51c9c777d",i18n("List options", "newsletter"), $sLink);
$oListOptionsRow->setContentData($sContent);
$oTpl->set('s', 'LISTOPTIONLINK', $sLink);
@ -400,10 +400,10 @@ $oTpl->set('s', 'ID_CNEWSLETTER', $sContainerId);
// sort: Element can be used to be sorted by
// search: Element can be used to search in
$aFields = array();
$aFields["name"] = array("field" => "name", "caption" => i18n("Name"), "type" => "base,sort,search");
$aFields["created"] = array("field" => "created", "caption" => i18n("Created"), "type" => "base,sort");
$aFields["status"] = array("field" => "status", "caption" => i18n("Status"), "type" => "base,sort");
$aFields["cronjob"] = array("field" => "use_cronjob", "caption" => i18n("Use cronjob"), "type" => "base");
$aFields["name"] = array("field" => "name", "caption" => i18n("Name", "newsletter"), "type" => "base,sort,search");
$aFields["created"] = array("field" => "created", "caption" => i18n("Created", "newsletter"), "type" => "base,sort");
$aFields["status"] = array("field" => "status", "caption" => i18n("Status", "newsletter"), "type" => "base,sort");
$aFields["cronjob"] = array("field" => "use_cronjob", "caption" => i18n("Use cronjob", "newsletter"), "type" => "base");
######################################
# 2.1 Job dispatch: List options folding row
@ -441,7 +441,7 @@ if ($iItemsPerPage == 0) {
}
$oSelItemsPerPage = new cHTMLSelectElement("elemperpage");
$oSelItemsPerPage->autoFill(array(0 => i18n("-- All --"), 25 => 25, 50 => 50, 75 => 75, 100 => 100));
$oSelItemsPerPage->autoFill(array(0 => i18n("-- All --", "newsletter"), 25 => 25, 50 => 50, 75 => 75, 100 => 100));
$oSelItemsPerPage->setDefault($iItemsPerPage);
// Sort by
@ -457,7 +457,7 @@ $oSelSortBy->setDefault("created");
// Sort order
$oSelSortOrder = new cHTMLSelectElement("sortorder");
$oSelSortOrder->autoFill(array("ASC" => i18n("Ascending"), "DESC" => i18n("Descending")));
$oSelSortOrder->autoFill(array("ASC" => i18n("Ascending", "newsletter"), "DESC" => i18n("Descending", "newsletter")));
$oSelSortOrder->setDefault("DESC");
// Filter
@ -465,7 +465,7 @@ $oTxtFilter = new cHTMLTextbox("filter", "", 16);
//Search in
$oSelSearchIn = new cHTMLSelectElement("searchin");
$oOption = new cHTMLOptionElement(i18n("-- All fields --"), "--all--");
$oOption = new cHTMLOptionElement(i18n("-- All fields --", "newsletter"), "--all--");
$oSelSearchIn->addOptionElement("all", $oOption);
foreach ($aFields as $sKey => $aData)
@ -478,7 +478,7 @@ foreach ($aFields as $sKey => $aData)
}
$oSelSearchIn->setDefault("--all--");
$oBtnApply = new cHTMLButton("submit", i18n("Apply"));
$oBtnApply = new cHTMLButton("submit", i18n("Apply", "newsletter"));
$sContent = '<div style="border-bottom: 0px solid #B3B3B3; padding-left: 17px; background: '.$cfg['color']['table_dark'].';">'."\n";
$sContent .= '<form target="left_bottom" onsubmit="reloadLeftBottomAndTransportFormVars(this);" id="dispatch_listoptionsform" name="dispatch_listoptionsform" method="get" action="">'."\n";
@ -487,27 +487,27 @@ $sContent .= ' <input type="hidden" name="frame" value="2">'."\n";
$sContent .= ' <input type="hidden" name="contenido" value="'.$sess->id.'">'."\n";
$sContent .= ' <table>'."\n";
$sContent .= ' <tr>'."\n";
$sContent .= ' <td>'. i18n("Author").'</td>'."\n";
$sContent .= ' <td>'. i18n("Author", "newsletter").'</td>'."\n";
$sContent .= ' <td>'.$oSelAuthor->render().'</td>'."\n";
$sContent .= ' </tr>'."\n";
$sContent .= ' <tr>'."\n";
$sContent .= ' <td>'. i18n("Items / page").'</td>'."\n";
$sContent .= ' <td>'. i18n("Items / page", "newsletter").'</td>'."\n";
$sContent .= ' <td>'.$oSelItemsPerPage->render().'</td>'."\n";
$sContent .= ' </tr>'."\n";
$sContent .= ' <tr>'."\n";
$sContent .= ' <td>'. i18n("Sort by").'</td>'."\n";
$sContent .= ' <td>'. i18n("Sort by", "newsletter").'</td>'."\n";
$sContent .= ' <td>'.$oSelSortBy->render().'</td>'."\n";
$sContent .= ' </tr>'."\n";
$sContent .= ' <tr>'."\n";
$sContent .= ' <td>'. i18n("Sort order").'</td>'."\n";
$sContent .= ' <td>'. i18n("Sort order", "newsletter").'</td>'."\n";
$sContent .= ' <td>'.$oSelSortOrder->render().'</td>'."\n";
$sContent .= ' </tr>'."\n";
$sContent .= ' <tr>'."\n";
$sContent .= ' <td>'. i18n("Search for").'</td>'."\n";
$sContent .= ' <td>'. i18n("Search for", "newsletter").'</td>'."\n";
$sContent .= ' <td>'.$oTxtFilter->render().'</td>'."\n";
$sContent .= ' </tr>'."\n";
$sContent .= ' <tr>'."\n";
$sContent .= ' <td>'. i18n("Search in").'</td>'."\n";
$sContent .= ' <td>'. i18n("Search in", "newsletter").'</td>'."\n";
$sContent .= ' <td>'.$oSelSearchIn->render().'</td>'."\n";
$sContent .= ' </tr>'."\n";
$sContent .= ' <tr>'."\n";
@ -520,7 +520,7 @@ $sContent .= '</div>'."\n";
// To template
$sLink = "listoptiondisp";
$oListOptionsRow = new cFoldingRow("dfa6cc00-0acf-11db-9cd8-0800200c9a66",i18n("List options"), $sLink);
$oListOptionsRow = new cFoldingRow("dfa6cc00-0acf-11db-9cd8-0800200c9a66",i18n("List options", "newsletter"), $sLink);
$oListOptionsRow->setContentData($sContent);
$oTpl->set('s', 'LISTOPTIONLINKDISP', $sLink);
@ -565,10 +565,10 @@ $oTpl->set('s', 'ID_CDISPATCH', $sContainerId);
######################################
// See comment at 2. Job dispatch
$aFields = array();
$aFields["name"] = array("field" => "name", "caption" => i18n("Name"), "type" => "base,sort,search");
$aFields["email"] = array("field" => "email", "caption" => i18n("E-Mail"), "type" => "base,sort,search");
$aFields["confirmed"] = array("field" => "confirmed", "caption" => i18n("Confirmed"), "type" => "base");
$aFields["deactivated"] = array("field" => "deactivated", "caption" => i18n("Deactivated"), "type" => "base");
$aFields["name"] = array("field" => "name", "caption" => i18n("Name", "newsletter"),"type" => "base,sort,search");
$aFields["email"] = array("field" => "email", "caption" => i18n("E-Mail", "newsletter"),"type" => "base,sort,search");
$aFields["confirmed"] = array("field" => "confirmed", "caption" => i18n("Confirmed", "newsletter"), "type" => "base");
$aFields["deactivated"] = array("field" => "deactivated", "caption" => i18n("Deactivated", "newsletter"), "type" => "base");
######################################
# 3.1 Recipients: Actions folding row
@ -580,7 +580,7 @@ if ($perm->have_perm_area_action("recipients", "recipients_create"))
{
$oLink = new cHTMLLink;
$oLink->setMultiLink("recipients","","recipients","recipients_create");
$oLink->setContent('<img style="margin-right: 4px;" src="'.$cfg["path"]["images"] . 'folder_new.gif" align="middle">'.i18n("Create recipient").'</a>');
$oLink->setContent('<img style="margin-right: 4px;" src="'.$cfg["path"]["images"] . 'folder_new.gif" align="middle">'.i18n("Create recipient", "newsletter").'</a>');
$sContent .= $oLink->render().'<br />'."\n";
}
@ -590,7 +590,7 @@ if ($perm->have_perm_area_action("recipients", "recipients_create"))
{
$oLink = new cHTMLLink;
$oLink->setMultiLink("recipients", "", "recipients_import", "recipients_import");
$oLink->setContent('<img style="margin-right: 4px;" src="'.$cfg["path"]["images"] . 'importieren.gif" align="middle">'.i18n("Import recipients").'</a>');
$oLink->setContent('<img style="margin-right: 4px;" src="'.$cfg["path"]["images"] . 'importieren.gif" align="middle">'.i18n("Import recipients", "newsletter").'</a>');
$sContent .= $oLink->render().'<br />'."\n";
}
@ -604,9 +604,9 @@ if ($iTimeframe <= 0) {
if ($perm->have_perm_area_action("recipients", "recipients_delete"))
{
$oLink = new cHTMLLink;
$oLink->setLink('javascript:showPurgeMsg("'.i18n('Purge recipients').'", "'.sprintf(i18n("Do you really want to remove recipients, that have not been confirmed since %s days and over?"), '"+purgetimeframe+"').'")');
$oLink->setLink('javascript:showPurgeMsg("'.i18n('Purge recipients', "newsletter").'", "'.sprintf(i18n("Do you really want to remove recipients, that have not been confirmed since %s days and over?", "newsletter"), '"+purgetimeframe+"').'")');
$oLink->setContent('<img style="margin-right: 4px;" src="'.$cfg["path"]["images"] . 'delete.gif" align="middle">'.i18n("Purge recipients").'</a>');
$oLink->setContent('<img style="margin-right: 4px;" src="'.$cfg["path"]["images"] . 'delete.gif" align="middle">'.i18n("Purge recipients", "newsletter").'</a>');
$sContent .= $oLink->render();
}
@ -615,7 +615,7 @@ $oTpl->set('s', 'VALUE_PURGETIMEFRAME', $iTimeframe);
// To template
$sLink = "actionrec";
$oListActionsRow = new cFoldingRow("f0d7bf80-e73e-11d9-8cd6-0800200c9a66", i18n("Actions"), $sLink);
$oListActionsRow = new cFoldingRow("f0d7bf80-e73e-11d9-8cd6-0800200c9a66", i18n("Actions", "newsletter"), $sLink);
$oListActionsRow->setContentData($sContent);
$oTpl->set('s', 'ACTIONLINKREC', $sLink);
@ -623,7 +623,7 @@ $oTpl->set('s', 'ACTIONLINKREC', $sLink);
# 3.2 Recipients: Settings folding row
######################################
$oTxtTimeframe = new cHTMLTextbox("txtPurgeTimeframe", $iTimeframe, 5);
$oBtnSave = new cHTMLButton("submit", i18n("Save"));
$oBtnSave = new cHTMLButton("submit", i18n("Save", "newsletter"));
$sContent = '<div style="border-bottom: 0px solid #B3B3B3; padding-left: 17px; background: '.$cfg['color']['table_dark'].';">'."\n";
$sContent .= '<form target="left_bottom" onsubmit="purgetimeframe = document.options.txtPurgeTimeframe.value; append_registered_parameters(this);" id="options" name="options" method="get" action="main.php?1">'."\n";
@ -638,8 +638,8 @@ $sContent .= ' <input type="hidden" name="filter" value="'.$_REQUEST["filter"]
$sContent .= ' <input type="hidden" name="searchin" value="'.$_REQUEST["searchin"].'">'."\n";
$sContent .= ' <table>'."\n";
$sContent .= ' <tr>'."\n";
$sContent .= ' <td>'. i18n("Purge timeframe").':</td>'."\n";
$sContent .= ' <td>'.$oTxtTimeframe->render().'&nbsp;'.i18n("days").'</td>'."\n";
$sContent .= ' <td>'. i18n("Purge timeframe", "newsletter").':</td>'."\n";
$sContent .= ' <td>'.$oTxtTimeframe->render().'&nbsp;'.i18n("days", "newsletter").'</td>'."\n";
$sContent .= ' </tr>'."\n";
$sContent .= ' <tr>'."\n";
$sContent .= ' <td>&nbsp;</td>'."\n";
@ -651,7 +651,7 @@ $sContent .= '</div>'."\n";
// To template
$sLink = "settingsrec";
$oSettingsRow = new cFoldingRow("5ddbe820-e6f1-11d9-8cd6-0800200c9a69",i18n("Settings"), $sLink);
$oSettingsRow = new cFoldingRow("5ddbe820-e6f1-11d9-8cd6-0800200c9a69",i18n("Settings", "newsletter"), $sLink);
$oSettingsRow->setContentData($sContent);
$oTpl->set('s', 'SETTINGSLINKREC', $sLink);
@ -664,7 +664,7 @@ if ($iItemsPerPage == 0) {
}
$oSelItemsPerPage = new cHTMLSelectElement("elemperpage");
$oSelItemsPerPage->autoFill(array(0 => i18n("-- All --"), 25 => 25, 50 => 50, 75 => 75, 100 => 100));
$oSelItemsPerPage->autoFill(array(0 => i18n("-- All --", "newsletter"), 25 => 25, 50 => 50, 75 => 75, 100 => 100));
$oSelItemsPerPage->setDefault($iItemsPerPage);
$oSelSortBy = new cHTMLSelectElement("sortby");
@ -678,11 +678,11 @@ foreach ($aFields as $sKey => $aData)
$oSelSortBy->setDefault("name");
$oSelSortOrder = new cHTMLSelectElement("sortorder");
$oSelSortOrder->autoFill(array("ASC" => i18n("Ascending"), "DESC" => i18n("Descending")));
$oSelSortOrder->autoFill(array("ASC" => i18n("Ascending", "newsletter"), "DESC" => i18n("Descending", "newsletter")));
$oSelSortOrder->setDefault("ASC");
$oSelRestrictGroup = new cHTMLSelectElement("restrictgroup");
$oOption = new cHTMLOptionElement(i18n("-- All groups --"), "--all--");
$oOption = new cHTMLOptionElement(i18n("-- All groups --", "newsletter"), "--all--");
$oSelRestrictGroup->addOptionElement("all", $oOption);
// Fetch recipient groups
@ -710,7 +710,7 @@ $oSelRestrictGroup->setDefault("--all--");
$oTxtFilter = new cHTMLTextbox("filter", "", 16);
$oSelSearchIn = new cHTMLSelectElement("searchin");
$oOption = new cHTMLOptionElement(i18n("-- All fields --"), "--all--");
$oOption = new cHTMLOptionElement(i18n("-- All fields --", "newsletter"), "--all--");
$oSelSearchIn->addOptionElement("all", $oOption);
foreach ($aFields as $sKey => $aData) {
@ -730,27 +730,27 @@ $sContent .= ' <input type="hidden" name="frame" value="2">'."\n";
$sContent .= ' <input type="hidden" name="contenido" value="'.$sess->id.'">'."\n";
$sContent .= ' <table>'."\n";
$sContent .= ' <tr>'."\n";
$sContent .= ' <td>'. i18n("Items / page").'</td>'."\n";
$sContent .= ' <td>'. i18n("Items / page", "newsletter").'</td>'."\n";
$sContent .= ' <td>'.$oSelItemsPerPage->render().'</td>'."\n";
$sContent .= ' </tr>'."\n";
$sContent .= ' <tr>'."\n";
$sContent .= ' <td>'. i18n("Sort by").'</td>'."\n";
$sContent .= ' <td>'. i18n("Sort by", "newsletter").'</td>'."\n";
$sContent .= ' <td>'.$oSelSortBy->render().'</td>'."\n";
$sContent .= ' </tr>'."\n";
$sContent .= ' <tr>'."\n";
$sContent .= ' <td>'. i18n("Sort order").'</td>'."\n";
$sContent .= ' <td>'. i18n("Sort order", "newsletter").'</td>'."\n";
$sContent .= ' <td>'.$oSelSortOrder->render().'</td>'."\n";
$sContent .= ' </tr>'."\n";
$sContent .= ' <tr>'."\n";
$sContent .= ' <td>'. i18n("Show group").'</td>'."\n";
$sContent .= ' <td>'. i18n("Show group", "newsletter").'</td>'."\n";
$sContent .= ' <td>'.$oSelRestrictGroup->render().'</td>'."\n";
$sContent .= ' </tr>'."\n";
$sContent .= ' <tr>'."\n";
$sContent .= ' <td>'. i18n("Search for").'</td>'."\n";
$sContent .= ' <td>'. i18n("Search for", "newsletter").'</td>'."\n";
$sContent .= ' <td>'.$oTxtFilter->render().'</td>'."\n";
$sContent .= ' </tr>'."\n";
$sContent .= ' <tr>'."\n";
$sContent .= ' <td>'. i18n("Search in").'</td>'."\n";
$sContent .= ' <td>'. i18n("Search in", "newsletter").'</td>'."\n";
$sContent .= ' <td>'.$oSelSearchIn->render().'</td>'."\n";
$sContent .= ' </tr>'."\n";
$sContent .= ' <tr>'."\n";
@ -763,7 +763,7 @@ $sContent .= '</div>'."\n";
// To template
$sLink = "listoptionsrec";
$oListOptionsRow = new cFoldingRow("5ddbe820-e6f1-11d9-8cd6-0800200c9a66",i18n("List options"), $sLink);
$oListOptionsRow = new cFoldingRow("5ddbe820-e6f1-11d9-8cd6-0800200c9a66",i18n("List options", "newsletter"), $sLink);
$oListOptionsRow->setContentData($sContent);
$oTpl->set('s', 'LISTOPTIONLINKREC', $sLink);
@ -812,7 +812,7 @@ $oTpl->set('s', 'ID_CRECIPIENTS', $sContainerId);
######################################
// See comment at 2. Job dispatch
$aFields = array();
$aFields["name"] = array("field" => "groupname", "caption" => i18n("Name"), "type" => "base,sort,search");
$aFields["name"] = array("field" => "groupname", "caption" => i18n("Name", "newsletter"), "type" => "base,sort,search");
######################################
# 4.1 Recipient groups: Actions
@ -824,14 +824,14 @@ if ($perm->have_perm_area_action("recipientgroups", "recipientgroup_create"))
{
$oLnk = new cHTMLLink;
$oLnk->setMultiLink("recipientgroups","","recipientgroups","recipientgroup_create");
$oLnk->setContent('<img style="margin-right: 4px;" src="'.$cfg["path"]["images"] . 'folder_new.gif" align="middle">'.i18n("Create group").'</a>');
$oLnk->setContent('<img style="margin-right: 4px;" src="'.$cfg["path"]["images"] . 'folder_new.gif" align="middle">'.i18n("Create group", "newsletter").'</a>');
$sContent .= $oLnk->render().'<br />'."\n";
}
$sContent .= '</div>'."\n";
$sLink = "actiongroup";
$oListActionsRow = new cFoldingRow("f0d7bf80-e73e-11d9-8cd6-0800200c9a67",i18n("Actions"), $sLink);
$oListActionsRow = new cFoldingRow("f0d7bf80-e73e-11d9-8cd6-0800200c9a67",i18n("Actions", "newsletter"), $sLink);
$oListActionsRow->setContentData($sContent);
$oTpl->set('s', 'ACTIONLINKGROUP', $sLink);
@ -844,7 +844,7 @@ if ($iItemsPerPage == 0) {
}
$oSelItemsPerPage = new cHTMLSelectElement("elemperpage");
$oSelItemsPerPage->autoFill(array(0 => i18n("-- All --"), 25 => 25, 50 => 50, 75 => 75, 100 => 100));
$oSelItemsPerPage->autoFill(array(0 => i18n("-- All --", "newsletter"), 25 => 25, 50 => 50, 75 => 75, 100 => 100));
$oSelItemsPerPage->setDefault($iItemsPerPage);
$oSelSortBy = new cHTMLSelectElement("sortby");
@ -857,13 +857,13 @@ foreach ($aFields as $sKey => $aData) {
$oSelSortBy->setDefault("name");
$oSelSortOrder = new cHTMLSelectElement("sortorder");
$oSelSortOrder->autoFill(array("ASC" => i18n("Ascending"), "DESC" => i18n("Descending")));
$oSelSortOrder->autoFill(array("ASC" => i18n("Ascending", "newsletter"), "DESC" => i18n("Descending", "newsletter")));
$oSelSortOrder->setDefault("ASC");
$oTxtFilter = new cHTMLTextbox("filter", "", 16);
$oSelSearchIn = new cHTMLSelectElement("searchin");
$oOption = new cHTMLOptionElement(i18n("-- All fields --"), "--all--");
$oOption = new cHTMLOptionElement(i18n("-- All fields --", "newsletter"), "--all--");
$oSelSearchIn->addOptionElement("all", $oOption);
foreach ($aFields as $sKey => $aData) {
@ -874,7 +874,7 @@ foreach ($aFields as $sKey => $aData) {
}
$oSelSearchIn->setDefault("--all--");
$oBtnApply = new cHTMLButton("submit", i18n("Apply"));
$oBtnApply = new cHTMLButton("submit", i18n("Apply", "newsletter"));
$sContent = '<div style="border-bottom: 0px solid #B3B3B3; padding-left: 17px; background: '.$cfg['color']['table_dark'].';">'."\n";
$sContent .= '<form target="left_bottom" onsubmit="reloadLeftBottomAndTransportFormVars(this);" id="groups_listoptionsform" name="groups_listoptionsform" method="get" action="">'."\n";
@ -883,23 +883,23 @@ $sContent .= ' <input type="hidden" name="frame" value="2">'."\n";
$sContent .= ' <input type="hidden" name="contenido" value="'.$sess->id.'">'."\n";
$sContent .= ' <table>'."\n";
$sContent .= ' <tr>'."\n";
$sContent .= ' <td>'. i18n("Items / page").'</td>'."\n";
$sContent .= ' <td>'. i18n("Items / page", "newsletter").'</td>'."\n";
$sContent .= ' <td>'.$oSelItemsPerPage->render().'</td>'."\n";
$sContent .= ' </tr>'."\n";
$sContent .= ' <tr>'."\n";
$sContent .= ' <td>'. i18n("Sort by").'</td>'."\n";
$sContent .= ' <td>'. i18n("Sort by", "newsletter").'</td>'."\n";
$sContent .= ' <td>'.$oSelSortBy->render().'</td>'."\n";
$sContent .= ' </tr>'."\n";
$sContent .= ' <tr>'."\n";
$sContent .= ' <td>'. i18n("Sort order").'</td>'."\n";
$sContent .= ' <td>'. i18n("Sort order", "newsletter").'</td>'."\n";
$sContent .= ' <td>'.$oSelSortOrder->render().'</td>'."\n";
$sContent .= ' </tr>'."\n";
$sContent .= ' <tr>'."\n";
$sContent .= ' <td>'. i18n("Search for").'</td>'."\n";
$sContent .= ' <td>'. i18n("Search for", "newsletter").'</td>'."\n";
$sContent .= ' <td>'.$oTxtFilter->render().'</td>'."\n";
$sContent .= ' </tr>'."\n";
$sContent .= ' <tr>'."\n";
$sContent .= ' <td>'. i18n("Search in").'</td>'."\n";
$sContent .= ' <td>'. i18n("Search in", "newsletter").'</td>'."\n";
$sContent .= ' <td>'.$oSelSearchIn->render().'</td>'."\n";
$sContent .= ' </tr>'."\n";
$sContent .= ' <tr>'."\n";
@ -912,7 +912,7 @@ $sContent .= '</div>'."\n";
// To template
$sLink = "listoptionsgroup";
$oListOptionsRow = new cFoldingRow("79efc1fc-111d-11dc-8314-0800200c9a66",i18n("List options"), $sLink);
$oListOptionsRow = new cFoldingRow("79efc1fc-111d-11dc-8314-0800200c9a66",i18n("List options", "newsletter"), $sLink);
$oListOptionsRow->setContentData($sContent);
$oTpl->set('s', 'LISTOPTIONLINKGROUP', $sLink);

Datei anzeigen

@ -1,4 +1,5 @@
<?php
/**
* Project:
* Contenido Content Management System
@ -27,21 +28,20 @@
* }}
*
*/
if(!defined('CON_FRAMEWORK')) {
die('Illegal call');
if (!defined('CON_FRAMEWORK')) {
die('Illegal call');
}
##################################
# Initialization
##################################
$oPage = new cPage;
$oUser = new cApiUser($auth->auth["uid"]);
$oClientLang = new cApiClientLanguage(false, $client, $lang);
$oPage = new cPage;
$oUser = new cApiUser($auth->auth["uid"]);
$oClientLang = new cApiClientLanguage(false, $client, $lang);
// Get idCatArt to check, if we may send a test newsletter
$lIDCatArt = (int)$oClientLang->getProperty("newsletter", "idcatart");
$lIDCatArt = (int) $oClientLang->getProperty("newsletter", "idcatart");
// Specify fields for search, sort and validation. Design makes enhancements
// using plugins possible (currently not implemented). If you are changing things here,
@ -52,75 +52,74 @@ $lIDCatArt = (int)$oClientLang->getProperty("newsletter", "idcatart");
// sort: Element can be used to be sorted by
// search: Element can be used to search in
$aFields = array();
$aFields["name"] = array("field" => "name", "caption" => i18n("Name"), "type" => "base,sort,search");
$aFields["name"] = array("field" => "name", "caption" => i18n("Name", "newsletter"), "type" => "base,sort,search");
##################################
# Store settings/Get basic data
##################################
if (isset($_REQUEST['action_html']) && $_REQUEST['action_html'] == 'save_newsletter_properties' && $perm->have_perm_area_action($area, "news_html_settings")) {
// Storing settings
// Storing settings
if (isset($_REQUEST["ckbHTMLNewsletter"])) {
$oClientLang->setProperty("newsletter", "html_newsletter", "true");
} else {
$oClientLang->setProperty("newsletter", "html_newsletter", "false");
}
$oClientLang->setProperty("newsletter", "html_template_idcat", (int)$_REQUEST["selHTMLTemplateCat"]);
$oClientLang->setProperty("newsletter", "html_newsletter_idcat", (int)$_REQUEST["selHTMLNewsletterCat"]);
$oUser->setProperty("newsletter", "test_idnewsgrp_lang" . $lang, (int)$_REQUEST["selTestDestination"]);
$oClientLang->setProperty("newsletter", "html_template_idcat", (int) $_REQUEST["selHTMLTemplateCat"]);
$oClientLang->setProperty("newsletter", "html_newsletter_idcat", (int) $_REQUEST["selHTMLNewsletterCat"]);
$oUser->setProperty("newsletter", "test_idnewsgrp_lang" . $lang, (int) $_REQUEST["selTestDestination"]);
} else {
// No settings to be stored, get current settings (language sepcific, as lang is client specific, lang is sufficient)
$_REQUEST["selTestDestination"] = (int)$oUser->getProperty("newsletter", "test_idnewsgrp_lang" . $lang);
// No settings to be stored, get current settings (language sepcific, as lang is client specific, lang is sufficient)
$_REQUEST["selTestDestination"] = (int) $oUser->getProperty("newsletter", "test_idnewsgrp_lang" . $lang);
}
// Default value: Current user mail
$sSendTestTarget = $oUser->get("realname"). " (" . $oUser->get("email") . ")";
$sSendTestTarget = $oUser->get("realname") . " (" . $oUser->get("email") . ")";
##################################
# Check external input
##################################
// Items per page (value stored per area in user property)
if (!isset($_REQUEST["elemperpage"]) || !is_numeric($_REQUEST["elemperpage"]) || $_REQUEST["elemperpage"] < 0) {
$_REQUEST["elemperpage"] = $oUser->getProperty("itemsperpage", $area);
$_REQUEST["elemperpage"] = $oUser->getProperty("itemsperpage", $area);
}
if (!is_numeric($_REQUEST["elemperpage"])) {
// This is the case, if the user property has never been set (first time user)
$_REQUEST["elemperpage"] = 25;
// This is the case, if the user property has never been set (first time user)
$_REQUEST["elemperpage"] = 25;
}
if ($_REQUEST["elemperpage"] > 0) {
// -- All -- will not be stored, as it may be impossible to change this back to something more useful
$oUser->setProperty("itemsperpage", $area, $_REQUEST["elemperpage"]);
// -- All -- will not be stored, as it may be impossible to change this back to something more useful
$oUser->setProperty("itemsperpage", $area, $_REQUEST["elemperpage"]);
}
$_REQUEST["page"] = (int)$_REQUEST["page"];
$_REQUEST["page"] = (int) $_REQUEST["page"];
if ($_REQUEST["page"] <= 0 || $_REQUEST["elemperpage"] == 0) {
$_REQUEST["page"] = 1;
$_REQUEST["page"] = 1;
}
// Sort order
if ($_REQUEST["sortorder"] != "DESC") {
$_REQUEST["sortorder"] = "ASC";
$_REQUEST["sortorder"] = "ASC";
}
// Check sort by and search in criteria
$bSortByFound = false;
$bSearchInFound = false;
foreach ($aFields as $sKey => $aData)
{
if ($aData["field"] == $_REQUEST["sortby"] && strpos($aData["type"], "sort") !== false) {
$bSortByFound = true;
}
if ($aData["field"] == $_REQUEST["searchin"] && strpos($aData["type"], "search") !== false) {
$bSearchInFound = true;
}
$bSortByFound = false;
$bSearchInFound = false;
foreach ($aFields as $sKey => $aData) {
if ($aData["field"] == $_REQUEST["sortby"] && strpos($aData["type"], "sort") !== false) {
$bSortByFound = true;
}
if ($aData["field"] == $_REQUEST["searchin"] && strpos($aData["type"], "search") !== false) {
$bSearchInFound = true;
}
}
if (!$bSortByFound) {
$_REQUEST["sortby"] = "name"; // Default sort by field, possible values see above
$_REQUEST["sortby"] = "name"; // Default sort by field, possible values see above
}
if (!$bSearchInFound) {
$_REQUEST["searchin"] = "--all--";
$_REQUEST["searchin"] = "--all--";
}
// Free memory
unset ($oClientLang);
unset ($oUser);
unset($oClientLang);
unset($oUser);
##################################
# Get data
@ -129,154 +128,143 @@ $oNewsletters = new NewsletterCollection;
$oNewsletters->setWhere("idclient", $client);
$oNewsletters->setWhere("idlang", $lang);
if ($_REQUEST["filter"] != "")
{
if ($_REQUEST["searchin"] == "--all--" || $_REQUEST["searchin"] == "")
{
foreach ($aFields as $sKey => $aData)
{
if (strpos($aData["type"], "search") !== false) {
$oNewsletters->setWhereGroup("filter", $aData["field"], $_REQUEST["filter"], "LIKE");
}
}
$oNewsletters->setInnerGroupCondition("filter", "OR");
} else {
$oNewsletters->setWhere($_REQUEST["searchin"], $_REQUEST["filter"], "LIKE");
}
if ($_REQUEST["filter"] != "") {
if ($_REQUEST["searchin"] == "--all--" || $_REQUEST["searchin"] == "") {
foreach ($aFields as $sKey => $aData) {
if (strpos($aData["type"], "search") !== false) {
$oNewsletters->setWhereGroup("filter", $aData["field"], $_REQUEST["filter"], "LIKE");
}
}
$oNewsletters->setInnerGroupCondition("filter", "OR");
} else {
$oNewsletters->setWhere($_REQUEST["searchin"], $_REQUEST["filter"], "LIKE");
}
}
if ($_REQUEST["elemperpage"] > 0)
{
// Getting item count without limit (for page function) - better idea anyone (performance)?
$oNewsletters->query();
if ($_REQUEST["elemperpage"] > 0) {
// Getting item count without limit (for page function) - better idea anyone (performance)?
$oNewsletters->query();
$iItemCount = $oNewsletters->count();
if ($_REQUEST["elemperpage"]*($_REQUEST["page"]) >= $iItemCount+$_REQUEST["elemperpage"] && $_REQUEST["page"] != 1) {
$_REQUEST["page"]--;
if ($_REQUEST["elemperpage"] * ($_REQUEST["page"]) >= $iItemCount + $_REQUEST["elemperpage"] && $_REQUEST["page"] != 1) {
$_REQUEST["page"] --;
}
$oNewsletters->setLimit($_REQUEST["elemperpage"] * ($_REQUEST["page"] - 1), $_REQUEST["elemperpage"]);
$oNewsletters->setLimit($_REQUEST["elemperpage"] * ($_REQUEST["page"] - 1), $_REQUEST["elemperpage"]);
} else {
$iItemCount = 0;
$iItemCount = 0;
}
$oNewsletters->setOrder("welcome DESC, " . $_REQUEST["sortby"] . " " . $_REQUEST["sortorder"]);
$oNewsletters->query();
// Output data
$oMenu = new UI_Menu;
$iMenu = 0;
$oMenu = new UI_Menu;
$iMenu = 0;
// Store messages for repeated use (speeds performance, as i18n translation is only needed once)
$aMsg = array();
$aMsg["DelTitle"] = i18n("Delete newsletter");
$aMsg["DelDescr"] = i18n("Do you really want to delete the following newsletter:<br>");
$aMsg["DelTitle"] = i18n("Delete newsletter", "newsletter");
$aMsg["DelDescr"] = i18n("Do you really want to delete the following newsletter:<br>", "newsletter");
$aMsg["SendTestTitle"] = i18n("Send test newsletter");
$aMsg["SendTestTitleOff"] = i18n("Send test newsletter (disabled, check newsletter sender e-mail address and handler article selection)");
$aMsg["AddJobTitle"] = i18n("Add newsletter dispatch job");
$aMsg["AddJobTitleOff"] = i18n("Add newsletter dispatch job (disabled, check newsletter sender e-mail address and handler article selection)");
$aMsg["CopyTitle"] = i18n("Duplicate newsletter");
$aMsg["SendTestTitle"] = i18n("Send test newsletter", "newsletter");
$aMsg["SendTestTitleOff"] = i18n("Send test newsletter (disabled, check newsletter sender e-mail address and handler article selection)", "newsletter");
$aMsg["AddJobTitle"] = i18n("Add newsletter dispatch job", "newsletter");
$aMsg["AddJobTitleOff"] = i18n("Add newsletter dispatch job (disabled, check newsletter sender e-mail address and handler article selection)", "newsletter");
$aMsg["CopyTitle"] = i18n("Duplicate newsletter", "newsletter");
while ($oNewsletter = $oNewsletters->next())
{
$idnewsletter = $oNewsletter->get("idnews");
$iMenu++;
$sName = $oNewsletter->get("name");
if ($oNewsletter->get("welcome")) {
$sName = $sName . "*";
}
while ($oNewsletter = $oNewsletters->next()) {
$idnewsletter = $oNewsletter->get("idnews");
$iMenu++;
// Create the link to show/edit the newsletter
$oLnk = new cHTMLLink;
$oLnk->setMultiLink($area, "", $area, "");
$oLnk->setCustom("idnewsletter", $idnewsletter);
$oMenu->setTitle($iMenu, $sName);
$oMenu->setLink($iMenu, $oLnk);
if ($perm->have_perm_area_action($area, "news_add_job") ||
$perm->have_perm_area_action($area, "news_create") ||
$perm->have_perm_area_action($area, "news_save"))
{
// Rights: If you are able to add a job, you should be able to test it
// If you are able to add or change a newsletter, you should be able to test it
// Usability: If no e-mail has been specified, you can't send a test newsletter
if (isValidMail($oNewsletter->get("newsfrom")) && $lIDCatArt > 0) {
$sLnkSendTest = '<a title="'.$aMsg["SendTestTitle"].'" href="javascript://" onclick="showSendTestMsg('.$idnewsletter.')"><img src="'.$cfg['path']['images'].'newsletter_sendtest_16.gif" border="0" title="'.$aMsg["SendTestTitle"].'" alt="'.$aMsg["SendTestTitle"].'" /></a>';
} else {
$sLnkSendTest = '<img src="'.$cfg['path']['images'].'newsletter_sendtest_16_off.gif" border="0" title="'.$aMsg["SendTestTitleOff"].'" alt="'.$aMsg["SendTestTitleOff"].'" />';
}
$oMenu->setActions($iMenu, 'test', $sLnkSendTest);
}
if ($perm->have_perm_area_action($area, "news_add_job"))
{
if (isValidMail($oNewsletter->get("newsfrom")) && $lIDCatArt > 0)
{
$oLnkAddJob = new Link;
$oLnkAddJob->setMultiLink("news","","news","news_add_job");
$oLnkAddJob->setCustom("idnewsletter", $idnewsletter);
$oLnkAddJob->setAlt($aMsg["AddJobTitle"]);
$oLnkAddJob->setContent('<img src="'.$cfg['path']['images'].'newsletter_dispatch_16.gif" border="0" title="'.$aMsg["AddJobTitle"].'" alt="'.$aMsg["AddJobTitle"].'">');
$sLnkAddJob = $oLnkAddJob->render();
} else {
$sLnkAddJob = '<img src="'.$cfg['path']['images'].'newsletter_dispatch_16_off.gif" border="0" title="'.$aMsg["AddJobTitleOff"].'" alt="'.$aMsg["AddJobTitleOff"].'" />';
}
$oMenu->setActions($iMenu, 'dispatch', $sLnkAddJob);
}
if ($perm->have_perm_area_action($area, "news_create"))
{
$oLnkCopy = new Link;
$oLnkCopy->setMultiLink("news", "", "news", "news_duplicate");
$oLnkCopy->setCustom("idnewsletter", $idnewsletter);
$oLnkCopy->setAlt($aMsg["CopyTitle"]);
$oLnkCopy->setContent('<img src="'.$cfg['path']['images'].'but_copy.gif" border="0" title="'.$aMsg["CopyTitle"].'" alt="'.$aMsg["CopyTitle"].'">');
$oMenu->setActions($iMenu, 'copy', $oLnkCopy->render());
}
if ($perm->have_perm_area_action($area, "news_delete"))
{
$sDelete = '<a title="'.$aMsg["DelTitle"].'" href="javascript://" onclick="showDelMsg('.$idnewsletter.',\''.addslashes($sName).'\')"><img src="'.$cfg['path']['images'].'delete.gif" border="0" title="'.$aMsg["DelTitle"].'" alt="'.$aMsg["DelTitle"].'"></a>';
$oMenu->setActions($iMenu, 'delete', $sDelete);
}
$sName = $oNewsletter->get("name");
if ($oNewsletter->get("welcome")) {
$sName = $sName . "*";
}
// Create the link to show/edit the newsletter
$oLnk = new cHTMLLink;
$oLnk->setMultiLink($area, "", $area, "");
$oLnk->setCustom("idnewsletter", $idnewsletter);
$oMenu->setTitle($iMenu, $sName);
$oMenu->setLink($iMenu, $oLnk);
if ($perm->have_perm_area_action($area, "news_add_job") ||
$perm->have_perm_area_action($area, "news_create") ||
$perm->have_perm_area_action($area, "news_save")) {
// Rights: If you are able to add a job, you should be able to test it
// If you are able to add or change a newsletter, you should be able to test it
// Usability: If no e-mail has been specified, you can't send a test newsletter
if (isValidMail($oNewsletter->get("newsfrom")) && $lIDCatArt > 0) {
$sLnkSendTest = '<a title="' . $aMsg["SendTestTitle"] . '" href="javascript://" onclick="showSendTestMsg(' . $idnewsletter . ')"><img src="' . $cfg['path']['images'] . 'newsletter_sendtest_16.gif" border="0" title="' . $aMsg["SendTestTitle"] . '" alt="' . $aMsg["SendTestTitle"] . '" /></a>';
} else {
$sLnkSendTest = '<img src="' . $cfg['path']['images'] . 'newsletter_sendtest_16_off.gif" border="0" title="' . $aMsg["SendTestTitleOff"] . '" alt="' . $aMsg["SendTestTitleOff"] . '" />';
}
$oMenu->setActions($iMenu, 'test', $sLnkSendTest);
}
if ($perm->have_perm_area_action($area, "news_add_job")) {
if (isValidMail($oNewsletter->get("newsfrom")) && $lIDCatArt > 0) {
$oLnkAddJob = new Link;
$oLnkAddJob->setMultiLink("news", "", "news", "news_add_job");
$oLnkAddJob->setCustom("idnewsletter", $idnewsletter);
$oLnkAddJob->setAlt($aMsg["AddJobTitle"]);
$oLnkAddJob->setContent('<img src="' . $cfg['path']['images'] . 'newsletter_dispatch_16.gif" border="0" title="' . $aMsg["AddJobTitle"] . '" alt="' . $aMsg["AddJobTitle"] . '">');
$sLnkAddJob = $oLnkAddJob->render();
} else {
$sLnkAddJob = '<img src="' . $cfg['path']['images'] . 'newsletter_dispatch_16_off.gif" border="0" title="' . $aMsg["AddJobTitleOff"] . '" alt="' . $aMsg["AddJobTitleOff"] . '" />';
}
$oMenu->setActions($iMenu, 'dispatch', $sLnkAddJob);
}
if ($perm->have_perm_area_action($area, "news_create")) {
$oLnkCopy = new Link;
$oLnkCopy->setMultiLink("news", "", "news", "news_duplicate");
$oLnkCopy->setCustom("idnewsletter", $idnewsletter);
$oLnkCopy->setAlt($aMsg["CopyTitle"]);
$oLnkCopy->setContent('<img src="' . $cfg['path']['images'] . 'but_copy.gif" border="0" title="' . $aMsg["CopyTitle"] . '" alt="' . $aMsg["CopyTitle"] . '">');
$oMenu->setActions($iMenu, 'copy', $oLnkCopy->render());
}
if ($perm->have_perm_area_action($area, "news_delete")) {
$sDelete = '<a title="' . $aMsg["DelTitle"] . '" href="javascript://" onclick="showDelMsg(' . $idnewsletter . ',\'' . addslashes($sName) . '\')"><img src="' . $cfg['path']['images'] . 'delete.gif" border="0" title="' . $aMsg["DelTitle"] . '" alt="' . $aMsg["DelTitle"] . '"></a>';
$oMenu->setActions($iMenu, 'delete', $sDelete);
}
}
// Check destination for sending test newsletter
if ($_REQUEST["selTestDestination"] > 0 && $perm->have_perm_area_action($area, "news_send_test"))
{
$oRcpGroups = new RecipientGroupCollection;
$oRcpGroups->setWhere("idclient", $client);
$oRcpGroups->setWhere("idlang", $lang);
$oRcpGroups->setWhere($oRcpGroups->primaryKey, $_REQUEST["selTestDestination"]);
$oRcpGroups->query();
if ($_REQUEST["selTestDestination"] > 0 && $perm->have_perm_area_action($area, "news_send_test")) {
$oRcpGroups = new RecipientGroupCollection;
$oRcpGroups->setWhere("idclient", $client);
$oRcpGroups->setWhere("idlang", $lang);
$oRcpGroups->setWhere($oRcpGroups->primaryKey, $_REQUEST["selTestDestination"]);
$oRcpGroups->query();
if ($oRcpGroup = $oRcpGroups->next()) {
$sSendTestTarget = sprintf(i18n("Recipient group: %s"), $oRcpGroup->get("groupname"));
}
unset ($oRcpGroups);
if ($oRcpGroup = $oRcpGroups->next()) {
$sSendTestTarget = sprintf(i18n("Recipient group: %s", "newsletter"), $oRcpGroup->get("groupname"));
}
unset($oRcpGroups);
}
$aMsg["SendTestDescr"] = sprintf(i18n("Do you really want to send the newsletter to:<br><strong>%s</strong>"), $sSendTestTarget);
$aMsg["SendTestDescr"] = sprintf(i18n("Do you really want to send the newsletter to:<br><strong>%s</strong>", "newsletter"), $sSendTestTarget);
$sExecScript = '
<script type="text/javascript">
var sid = "'.$sess->id.'";
var sid = "' . $sess->id . '";
// Create messageBox instance
box = new messageBox("", "", "", 0, 0);
function showSendTestMsg(lngId) {
box.confirm("'.$aMsg["SendTestTitle"].'", "'.$aMsg["SendTestDescr"].'", "sendTestNewsletter(\'" + lngId + "\')");
box.confirm("' . $aMsg["SendTestTitle"] . '", "' . $aMsg["SendTestDescr"] . '", "sendTestNewsletter(\'" + lngId + "\')");
}
function showDelMsg(lngId, strElement) {
box.confirm("'.$aMsg["DelTitle"].'", "'.$aMsg["DelDescr"].'<b>" + strElement + "</b>", "deleteNewsletter(\'" + lngId + "\')");
box.confirm("' . $aMsg["DelTitle"] . '", "' . $aMsg["DelDescr"] . '<b>" + strElement + "</b>", "deleteNewsletter(\'" + lngId + "\')");
}
//
@ -331,12 +319,12 @@ $sExecScript = '
$oPage->setMargin(0);
// Messagebox JS has to be included before ExecScript!
$oPage->addScript('messagebox', '<script type="text/javascript" src="scripts/messageBox.js.php?contenido='.$sess->id.'"></script>');
$oPage->addScript('messagebox', '<script type="text/javascript" src="scripts/messageBox.js.php?contenido=' . $sess->id . '"></script>');
$oPage->addScript('exec', $sExecScript);
$oPage->addScript('parameterCollector.js', '<script language="JavaScript" src="scripts/parameterCollector.js"></script>');
// Generate current content for Object Pager
$sPagerId = "0ed6d632-6adf-4f09-a0c6-1e38ab60e302";
$sPagerId = "0ed6d632-6adf-4f09-a0c6-1e38ab60e302";
$oPagerLink = new cHTMLLink;
$oPagerLink->setLink("main.php");
$oPagerLink->setTargetFrame('left_bottom');
@ -366,7 +354,7 @@ $oPage->addScript('setpager', '<script type="text/javascript" src="scripts/setPa
$sRefreshPager = '
<script type="text/javascript">
var sNavigation = \''.$sPagerContent.'\';
var sNavigation = \'' . $sPagerContent . '\';
// Activate time to refresh pager folding row in left top
var oTimer = window.setInterval("fncSetPager(\'' . $sPagerId . '\',\'' . $_REQUEST["page"] . '\')", 200);
@ -376,5 +364,4 @@ $oPage->addScript('refreshpager', $sRefreshPager);
$oPage->setContent($oMenu->render(false));
$oPage->render();
?>

Datei anzeigen

@ -37,7 +37,7 @@ if (!defined('CON_FRAMEWORK')) {
if (isset($_GET['idnewsletter']))
{
# Set template data
$sCaption = i18n("Edit");
$sCaption = i18n("Edit", "newsletter");
$tpl->set("d", "ID", 'c_'.$tpl->dyn_cnt);
$tpl->set("d", "CLASS", '');
@ -46,7 +46,7 @@ if (isset($_GET['idnewsletter']))
$tpl->next();
# Set template data
$sCaption = i18n("Edit Message");
$sCaption = i18n("Edit Message", "newsletter");
$tpl->set("d", "ID", 'c_'.$tpl->dyn_cnt);
$tpl->set("d", "CLASS", '');

Datei anzeigen

@ -1,4 +1,5 @@
<?php
/**
* Project:
* Contenido Content Management System
@ -28,47 +29,44 @@
* }}
*
*/
if (!defined('CON_FRAMEWORK')) {
die('Illegal call');
die('Illegal call');
}
if (isset($_GET['idrecipientgroup']) && (int)$_GET['idrecipientgroup'] > 0)
{
$caption = i18n("Overview");
$tmp_area = "foo2";
if (isset($_GET['idrecipientgroup']) && (int) $_GET['idrecipientgroup'] > 0) {
$caption = i18n("Overview", "newsletter");
$tmp_area = "foo2";
# Set template data
$tpl->set("d", "ID", 'c_'.$tpl->dyn_cnt);
$tpl->set("d", "CLASS", '');
$tpl->set("d", "OPTIONS", '');
$tpl->set("d", "CAPTION", '<a class="white" onclick="sub.clicked(this)" target="right_bottom" href="'.$sess->url("main.php?area=$area&frame=4&idrecipientgroup=$idrecipientgroup").'">'.$caption.'</a>');
$tpl->next();
if (is_array($cfg['plugins']['recipientslogic'])) {
foreach ($cfg['plugins']['recipientslogic'] as $plugin) {
cInclude("plugins", "recipientslogic/$plugin/".$plugin.".php");
# Set template data
$tpl->set("d", "ID", 'c_' . $tpl->dyn_cnt);
$tpl->set("d", "CLASS", '');
$tpl->set("d", "OPTIONS", '');
$tpl->set("d", "CAPTION", '<a class="white" onclick="sub.clicked(this)" target="right_bottom" href="' . $sess->url("main.php?area=$area&frame=4&idrecipientgroup=$idrecipientgroup") . '">' . $caption . '</a>');
$tpl->next();
$className = "recipientslogic_".$plugin;
$class = new $className;
$caption = $class->getFriendlyName();
$tmp_area = "foo2";
$tpl->set("d", "ID", 'c_'.$tpl->dyn_cnt);
$tpl->set("d", "CLASS", '');
$tpl->set("d", "OPTIONS", '');
$tpl->set("d", "CAPTION", '<a class="white" onclick="sub.clicked(this)" target="right_bottom" href="'.$sess->url("main.php?area=recipientgroup_rights&frame=4&useplugin=$plugin&idrecipientgroup=$idrecipientgroup").'">'.$caption.'</a>');
$tpl->next();
}
}
if (is_array($cfg['plugins']['recipientslogic'])) {
foreach ($cfg['plugins']['recipientslogic'] as $plugin) {
cInclude("plugins", "recipientslogic/$plugin/" . $plugin . ".php");
$tpl->set('s', 'COLSPAN', ($tpl->dyn_cnt * 2) + 2);
$className = "recipientslogic_" . $plugin;
$class = new $className;
# Generate the third navigation layer
$tpl->generate($cfg["path"]["templates"] . $cfg["templates"]["subnav"]);
$caption = $class->getFriendlyName();
$tmp_area = "foo2";
$tpl->set("d", "ID", 'c_' . $tpl->dyn_cnt);
$tpl->set("d", "CLASS", '');
$tpl->set("d", "OPTIONS", '');
$tpl->set("d", "CAPTION", '<a class="white" onclick="sub.clicked(this)" target="right_bottom" href="' . $sess->url("main.php?area=recipientgroup_rights&frame=4&useplugin=$plugin&idrecipientgroup=$idrecipientgroup") . '">' . $caption . '</a>');
$tpl->next();
}
}
$tpl->set('s', 'COLSPAN', ($tpl->dyn_cnt * 2) + 2);
# Generate the third navigation layer
$tpl->generate($cfg["path"]["templates"] . $cfg["templates"]["subnav"]);
} else {
include ($cfg["path"]["contenido"].$cfg["path"]["templates"] . $cfg["templates"]["right_top_blank"]);
include ($cfg["path"]["contenido"] . $cfg["path"]["templates"] . $cfg["templates"]["right_top_blank"]);
}
?>

Datei anzeigen

@ -1,4 +1,5 @@
<?php
/**
* Project:
* Contenido Content Management System
@ -27,18 +28,17 @@
* }}
*
*/
if(!defined('CON_FRAMEWORK')) {
die('Illegal call');
if (!defined('CON_FRAMEWORK')) {
die('Illegal call');
}
##################################
# Initialization
##################################
$oPage = new cPage;
$oMenu = new UI_Menu;
$oUser = new cApiUser($auth->auth["uid"]);
$oPage = new cPage;
$oMenu = new UI_Menu;
$oUser = new cApiUser($auth->auth["uid"]);
// Specify fields for search, sort and validation. Design makes enhancements
// using plugins possible (currently not implemented). If you are changing things here,
@ -48,125 +48,120 @@ $oUser = new cApiUser($auth->auth["uid"]);
// base: Elements from core code (other type may be: "plugin")
// sort: Element can be used to be sorted by
// search: Element can be used to search in
$aFields = array();
$aFields["name"] = array("field" => "groupname", "caption" => i18n("Name"), "type" => "base,sort,search");
$aFields = array();
$aFields["name"] = array("field" => "groupname", "caption" => i18n("Name", "newsletter"), "type" => "base,sort,search");
##################################
# Check external input
##################################
// Items per page (value stored per area in user property)
if (!isset($_REQUEST["elemperpage"]) || !is_numeric($_REQUEST["elemperpage"]) || $_REQUEST["elemperpage"] < 0) {
$_REQUEST["elemperpage"] = $oUser->getProperty("itemsperpage", $area);
$_REQUEST["elemperpage"] = $oUser->getProperty("itemsperpage", $area);
}
if (!is_numeric($_REQUEST["elemperpage"])) {
// This is the case, if the user property has never been set (first time user)
$_REQUEST["elemperpage"] = 25;
// This is the case, if the user property has never been set (first time user)
$_REQUEST["elemperpage"] = 25;
}
if ($_REQUEST["elemperpage"] > 0) {
// -- All -- will not be stored, as it may be impossible to change this back to something more useful
$oUser->setProperty("itemsperpage", $area, $_REQUEST["elemperpage"]);
if ($_REQUEST["elemperpage"] > 0) {
// -- All -- will not be stored, as it may be impossible to change this back to something more useful
$oUser->setProperty("itemsperpage", $area, $_REQUEST["elemperpage"]);
}
$_REQUEST["page"] = (int)$_REQUEST["page"];
$_REQUEST["page"] = (int) $_REQUEST["page"];
if ($_REQUEST["page"] <= 0 || $_REQUEST["elemperpage"] == 0) {
$_REQUEST["page"] = 1;
$_REQUEST["page"] = 1;
}
// Sort order
if ($_REQUEST["sortorder"] != "DESC") {
$_REQUEST["sortorder"] = "ASC";
$_REQUEST["sortorder"] = "ASC";
}
// Don't need to check sort by and search in criteria - just set it
$_REQUEST["sortby"] = "groupname"; // Default sort by field, possible values see above
$_REQUEST["searchin"] = "--all--";
$_REQUEST["sortby"] = "groupname"; // Default sort by field, possible values see above
$_REQUEST["searchin"] = "--all--";
// Free memory
unset ($oUser);
unset ($oClient);
unset($oUser);
unset($oClient);
##################################
# Get data
##################################
$oRcpGroups = new RecipientGroupCollection;
$oRcpGroups->setWhere("idclient", $client);
$oRcpGroups->setWhere("idlang", $lang);
$oRcpGroups->setWhere("idclient", $client);
$oRcpGroups->setWhere("idlang", $lang);
if ($_REQUEST["filter"] != "")
{
if ($_REQUEST["searchin"] == "--all--" || $_REQUEST["searchin"] == "")
{
foreach ($aFields as $sKey => $aData)
{
if (strpos($aData["type"], "search") !== false) {
$oRcpGroups->setWhereGroup("filter", $aData["field"], $_REQUEST["filter"], "LIKE");
}
}
$oRcpGroups->setInnerGroupCondition("filter", "OR");
} else {
$oRcpGroups->setWhere($_REQUEST["searchin"], $_REQUEST["filter"], "LIKE");
}
if ($_REQUEST["filter"] != "") {
if ($_REQUEST["searchin"] == "--all--" || $_REQUEST["searchin"] == "") {
foreach ($aFields as $sKey => $aData) {
if (strpos($aData["type"], "search") !== false) {
$oRcpGroups->setWhereGroup("filter", $aData["field"], $_REQUEST["filter"], "LIKE");
}
}
$oRcpGroups->setInnerGroupCondition("filter", "OR");
} else {
$oRcpGroups->setWhere($_REQUEST["searchin"], $_REQUEST["filter"], "LIKE");
}
}
if ($_REQUEST["elemperpage"] > 0)
{
// Getting item count without limit (for page function) - better idea anyone (performance)?
if ($_REQUEST["elemperpage"] > 0) {
// Getting item count without limit (for page function) - better idea anyone (performance)?
$oRcpGroups->query();
$iItemCount = $oRcpGroups->count();
if ($_REQUEST["elemperpage"]*($_REQUEST["page"]) >= $iItemCount+$_REQUEST["elemperpage"] && $_REQUEST["page"] != 1) {
$_REQUEST["page"]--;
if ($_REQUEST["elemperpage"] * ($_REQUEST["page"]) >= $iItemCount + $_REQUEST["elemperpage"] && $_REQUEST["page"] != 1) {
$_REQUEST["page"] --;
}
$oRcpGroups->setLimit($_REQUEST["elemperpage"] * ($_REQUEST["page"] - 1), $_REQUEST["elemperpage"]);
} else {
$iItemCount = 0;
}
$oRcpGroups->setOrder("defaultgroup DESC, ".$_REQUEST["sortby"]." ".$_REQUEST["sortorder"]);
$oRcpGroups->setOrder("defaultgroup DESC, " . $_REQUEST["sortby"] . " " . $_REQUEST["sortorder"]);
$oRcpGroups->query();
// Output data
$oMenu = new UI_Menu;
$iMenu = 0;
$oMenu = new UI_Menu;
$iMenu = 0;
// Store messages for repeated use (speeds performance, as i18n translation is only needed once)
$aMsg = array();
$aMsg["DelTitle"] = i18n("Delete recipient group");
$aMsg["DelDescr"] = i18n("Do you really want to delete the following newsletter recipient group:<br>");
$aMsg["DelTitle"] = i18n("Delete recipient group", "newsletter");
$aMsg["DelDescr"] = i18n("Do you really want to delete the following newsletter recipient group:<br>", "newsletter");
while ($oRcpGroup = $oRcpGroups->next())
{
$iMenu++;
$iIDGroup = $oRcpGroup->get("idnewsgroup");
$sName = $oRcpGroup->get("groupname");
if ($oRcpGroup->get("defaultgroup")) {
$sName = $sName . "*";
}
while ($oRcpGroup = $oRcpGroups->next()) {
$iMenu++;
$iIDGroup = $oRcpGroup->get("idnewsgroup");
// Create the link to show/edit the recipient group
$oLnk = new cHTMLLink;
$oLnk->setMultiLink("recipientgroups","","recipientgroups","");
$oLnk->setCustom("idrecipientgroup", $iIDGroup);
$sName = $oRcpGroup->get("groupname");
if ($oRcpGroup->get("defaultgroup")) {
$sName = $sName . "*";
}
#$oMenu->setImage($iMenu, $cfg["path"]["images"] . "groups.gif");
$oMenu->setTitle($iMenu, $sName);
$oMenu->setLink($iMenu, $oLnk);
if ($perm->have_perm_area_action($area, recipientgroup_delete)) {
$oMenu->setActions($iMenu, 'delete', '<a title="'.$aMsg["DelTitle"].'" href="javascript://" onclick="showDelMsg('.$iIDGroup.',\''.addslashes($sName).'\')"><img src="'.$cfg['path']['images'].'delete.gif" border="0" title="'.$aMsg["DelTitle"].'" alt="'.$aMsg["DelTitle"].'"></a>');
}
// Create the link to show/edit the recipient group
$oLnk = new cHTMLLink;
$oLnk->setMultiLink("recipientgroups", "", "recipientgroups", "");
$oLnk->setCustom("idrecipientgroup", $iIDGroup);
#$oMenu->setImage($iMenu, $cfg["path"]["images"] . "groups.gif");
$oMenu->setTitle($iMenu, $sName);
$oMenu->setLink($iMenu, $oLnk);
if ($perm->have_perm_area_action($area, recipientgroup_delete)) {
$oMenu->setActions($iMenu, 'delete', '<a title="' . $aMsg["DelTitle"] . '" href="javascript://" onclick="showDelMsg(' . $iIDGroup . ',\'' . addslashes($sName) . '\')"><img src="' . $cfg['path']['images'] . 'delete.gif" border="0" title="' . $aMsg["DelTitle"] . '" alt="' . $aMsg["DelTitle"] . '"></a>');
}
}
$sExecScript = '
<script type="text/javascript">
// Session-ID
var sid = "'.$sess->id.'";
var sid = "' . $sess->id . '";
// Create messageBox instance
box = new messageBox("", "", "", 0, 0);
function showDelMsg(lngId, strElement) {
box.confirm("'.$aMsg["DelTitle"].'", "'.$aMsg["DelDescr"].'<b>" + strElement + "</b>", "deleteRecipientGroup(\'" + lngId + "\')");
box.confirm("' . $aMsg["DelTitle"] . '", "' . $aMsg["DelDescr"] . '<b>" + strElement + "</b>", "deleteRecipientGroup(\'" + lngId + "\')");
}
// Function for deleting recipient groups
@ -187,16 +182,16 @@ $sExecScript = '
parent.parent.right.right_bottom.location.href = url;
}
</script>';
</script>';
$oPage->setMargin(0);
$oPage->addScript('messagebox', '<script type="text/javascript" src="scripts/messageBox.js.php?contenido='.$sess->id.'"></script>');
$oPage->addScript('messagebox', '<script type="text/javascript" src="scripts/messageBox.js.php?contenido=' . $sess->id . '"></script>');
$oPage->addScript('delete', $sExecScript);
//$oPage->addScript('cfoldingrow.js', '<script language="JavaScript" src="scripts/cfoldingrow.js"></script>');
$oPage->addScript('parameterCollector.js', '<script language="JavaScript" src="scripts/parameterCollector.js"></script>');
// Generate current content for Object Pager
$sPagerId = "0ed6d632-6adf-4f09-a0c6-1e38ab60e305";
$sPagerId = "0ed6d632-6adf-4f09-a0c6-1e38ab60e305";
$oPagerLink = new cHTMLLink;
$oPagerLink->setLink("main.php");
$oPagerLink->setTargetFrame('left_bottom');
@ -225,16 +220,15 @@ $oPage->addScript('setpager', '<script type="text/javascript" src="scripts/setPa
$sRefreshPager = '
<script type="text/javascript">
var sNavigation = \''.$sPagerContent.'\';
var sNavigation = \'' . $sPagerContent . '\';
// Activate time to refresh pager folding row in left top
var oTimer = window.setInterval("fncSetPager(\'' . $sPagerId . '\',\'' . $_REQUEST["page"] . '\')", 200);
</script>';
$oPage->addScript('refreshpager', $sRefreshPager);
$oPage->addScript('refreshpager', $sRefreshPager);
//$oPage->setContent(array('<table border="0" cellspacing="0" cellpadding="0" width="100%">', '</table>', $oMenu->render(false)));
$oPage->setContent($oMenu->render(false));
$oPage->render();
?>

Datei anzeigen

@ -1,4 +1,5 @@
<?php
/**
* Project:
* Contenido Content Management System
@ -27,224 +28,219 @@
* }}
*
*/
if(!defined('CON_FRAMEWORK')) {
die('Illegal call');
if (!defined('CON_FRAMEWORK')) {
die('Illegal call');
}
$oPage = new cPage;
$oRecipients = new RecipientCollection;
$oPage = new cPage;
$oRecipients = new RecipientCollection;
if (is_array($cfg['plugins']['recipients'])) {
foreach ($cfg['plugins']['recipients'] as $plugin) {
plugin_include("recipients", $plugin."/".$plugin.".php");
}
foreach ($cfg['plugins']['recipients'] as $plugin) {
plugin_include("recipients", $plugin . "/" . $plugin . ".php");
}
}
// Note, that the object name has to be $recipient for plugins
if ($action == "recipients_create" && $perm->have_perm_area_action($area, $action)) {
$recipient = $oRecipients->create("mail@domain.tld"," ".i18n("-- new recipient --"));
$oPage->setReload();
$recipient = $oRecipients->create("mail@domain.tld", " " . i18n("-- new recipient --", "newsletter"));
$oPage->setReload();
} elseif ($action == "recipients_delete" && $perm->have_perm_area_action($area, $action)) {
$oRecipients->delete($idrecipient);
$recipient = new Recipient;
$oPage->setReload();
$oRecipients->delete($idrecipient);
$recipient = new Recipient;
$oPage->setReload();
} elseif ($action == "recipients_purge" && $perm->have_perm_area_action($area, "recipients_delete")) {
$oClient = new cApiClient($client);
$timeframe = $oClient->getProperty("newsletter", "purgetimeframe");
if (!$timeframe) {
$timeframe = 30;
}
$purgedrecipients = $oRecipients->purge($timeframe);
/* backslashdollar: There is a problem translating \$ - it is either not recognized or translated correctly (using poEdit) */
if ($purgedrecipients > 0) {
$sNotis = $notification->messageBox("info", sprintf(str_replace("backslashdollar", "\$", i18n("%1backslashdollard recipients, which hasn't been confirmed since more than %2backslashdollard days has been removed.")),$purgedrecipients,$timeframe),0);
} else {
$sNotis = $notification->messageBox("info", sprintf(str_replace("backslashdollar", "\$", i18n("There are no recipients, which hasn't been confirmed since more than %2backslashdollard days has been removed.")), 0, $timeframe),0);
}
$recipient = new Recipient;
$oPage->setReload();
if (!$timeframe) {
$timeframe = 30;
}
$purgedrecipients = $oRecipients->purge($timeframe);
/* backslashdollar: There is a problem translating \$ - it is either not recognized or translated correctly (using poEdit) */
if ($purgedrecipients > 0) {
$sNotis = $notification->messageBox("info", sprintf(str_replace("backslashdollar", "\$", i18n("%1backslashdollard recipients, which hasn't been confirmed since more than %2backslashdollard days has been removed.", "newsletter")), $purgedrecipients, $timeframe), 0);
} else {
$sNotis = $notification->messageBox("info", sprintf(str_replace("backslashdollar", "\$", i18n("There are no recipients, which hasn't been confirmed since more than %2backslashdollard days has been removed.", "newsletter")), 0, $timeframe), 0);
}
$recipient = new Recipient;
$oPage->setReload();
} else {
$recipient = new Recipient($idrecipient);
$recipient = new Recipient($idrecipient);
}
if ($recipient->virgin == false && $recipient->get("idclient") == $client && $recipient->get("idlang") == $lang) {
if ($action == "recipients_save" && $perm->have_perm_area_action($area, $action)) {
$oPage->setReload();
$aMessages = array();
if ($action == "recipients_save" && $perm->have_perm_area_action($area, $action)) {
$oPage->setReload();
$aMessages = array();
$name = stripslashes($name);
$email = stripslashes($email);
$confirmed = (int)$confirmed;
$deactivated = (int)$deactivated;
$newstype = (int)$newstype;
$recipient->set("name", $name);
$name = stripslashes($name);
$email = stripslashes($email);
$confirmed = (int) $confirmed;
$deactivated = (int) $deactivated;
$newstype = (int) $newstype;
if (!isValidMail($email))
{
$aMessages[] = i18n("Please specify a valid e-mail address");
} else {
$email = strtolower($email); // e-mail always in lower case
if ($recipient->get("email") != $email) {
$oRecipients->resetQuery();
$oRecipients->setWhere("email", $email);
$oRecipients->setWhere("idclient", $client);
$oRecipients->setWhere("idlang", $lang);
$oRecipients->setWhere($recipient->primaryKey, $recipient->get($recipient->primaryKey), "!=");
$oRecipients->query();
if ($oRecipients->next()) {
$aMessages[] = i18n("Could not set new e-mail adress: Other recipient with same e-mail address already exists");
} else {
$recipient->set("email", $email);
}
}
}
if ($recipient->get("confirmed") != $confirmed && $confirmed) {
$recipient->set("confirmeddate", date("Y-m-d H:i:s"), false);
} elseif (!$confirmed) {
$recipient->set("confirmeddate", "0000-00-00 00:00:00", false);
}
$recipient->set("confirmed", $confirmed);
$recipient->set("deactivated", $deactivated);
$recipient->set("news_type", $newstype);
// Check out if there are any plugins
if (is_array($cfg['plugins']['recipients'])) {
foreach ($cfg['plugins']['recipients'] as $plugin) {
if (function_exists("recipients_".$plugin."_wantedVariables") && function_exists("recipients_".$plugin."_store")) {
$wantVariables = call_user_func("recipients_".$plugin."_wantedVariables");
if (is_array($wantVariables)) {
$varArray = array();
foreach ($wantVariables as $value) {
$varArray[$value] = stripslashes($GLOBALS[$value]);
}
}
$store = call_user_func("recipients_".$plugin."_store", $varArray);
}
}
}
$recipient->store();
// Remove group associations
if (isset($_REQUEST["ckbRemove"])) {
$oGroupMembers = new RecipientGroupMemberCollection;
foreach ($_REQUEST["ckbRemove"] as $iGroupMemberID) {
if (is_numeric($iGroupMemberID)) {
$oGroupMembers->delete($iGroupMemberID);
}
}
}
}
if (count($aMessages) > 0) {
$sNotis = $notification->returnNotification("warning", implode("<br>", $aMessages)) . "<br>";
}
$oForm = new UI_Table_Form("properties");
$oForm->setVar("frame", $frame);
$oForm->setVar("area", $area);
$oForm->setVar("action", "recipients_save");
$oForm->setVar("idrecipient", $recipient->get("idnewsrcp"));
$recipient->set("name", $name);
$oForm->addHeader(i18n("Edit recipient"));
if (!isValidMail($email)) {
$aMessages[] = i18n("Please specify a valid e-mail address", "newsletter");
} else {
$email = strtolower($email); // e-mail always in lower case
if ($recipient->get("email") != $email) {
$oRecipients->resetQuery();
$oRecipients->setWhere("email", $email);
$oRecipients->setWhere("idclient", $client);
$oRecipients->setWhere("idlang", $lang);
$oRecipients->setWhere($recipient->primaryKey, $recipient->get($recipient->primaryKey), "!=");
$oRecipients->query();
$oTxtName = new cHTMLTextbox("name", $recipient->get("name"), 40);
$oTxtEMail = new cHTMLTextbox("email", $recipient->get("email"), 40);
$oCkbConfirmed = new cHTMLCheckbox("confirmed", "1");
$oCkbConfirmed->setChecked($recipient->get("confirmed"));
$oCkbDeactivated = new cHTMLCheckbox("deactivated", "1");
$oCkbDeactivated->setChecked($recipient->get("deactivated"));
$oSelNewsType = new cHTMLSelectElement("newstype");
$oOption = new cHTMLOptionElement(i18n("Text only"), "0");
$oSelNewsType->addOptionElement(0, $oOption);
$oOption = new cHTMLOptionElement(i18n("HTML and text"), "1");
$oSelNewsType->addOptionElement(1, $oOption);
$oSelNewsType->setDefault($recipient->get("news_type"));
$oForm->add(i18n("Name"), $oTxtName->render());
$oForm->add(i18n("E-Mail"), $oTxtEMail->render());
$oForm->add(i18n("Confirmed"), $oCkbConfirmed->toHTML(false) . " (" . $recipient->get("confirmeddate") . ")");
$oForm->add(i18n("Deactivated"), $oCkbDeactivated->toHTML(false));
$oForm->add(i18n("Message type"), $oSelNewsType->render());
$aPluginOrder = trim_array(explode(",",getSystemProperty("plugin", "recipients-pluginorder")));
// Check out if there are any plugins
if (is_array($aPluginOrder)) {
foreach ($aPluginOrder as $sPlugin) {
if (function_exists("recipients_".$sPlugin."_getTitle") &&
function_exists("recipients_".$sPlugin."_display")) {
$aPluginTitle = call_user_func("recipients_".$sPlugin."_getTitle");
$aPluginDisplay = call_user_func("recipients_".$sPlugin."_display", $recipient);
if (is_array($aPluginTitle) && is_array($aPluginDisplay)) {
foreach ($aPluginTitle as $sKey => $sValue) {
$oForm->add($sValue, $aPluginDisplay[$sKey]);
}
} else {
if (is_array($aPluginTitle) || is_array($aPluginDisplay)) {
$oForm->add(i18n("WARNING"), sprintf(i18n("The plugin %s delivered an array for the displayed titles, but did not return an array for the contents."), $sPlugin));
} else {
$oForm->add($aPluginTitle, $aPluginDisplay);
}
}
}
}
}
$oGroupList = new UI_List;
$oGroupList->setWidth("100%");
$oGroupList->setBorder(1);
if ($oRecipients->next()) {
$aMessages[] = i18n("Could not set new e-mail adress: Other recipient with same e-mail address already exists", "newsletter");
} else {
$recipient->set("email", $email);
}
}
}
$oAssocGroups = new RecipientGroupMemberCollection;
$oAssocGroups->link("RecipientGroupCollection");
$oAssocGroups->setWhere("recipientgroupmembercollection.idnewsrcp", $recipient->get("idnewsrcp"));
$oAssocGroups->setOrder("recipientgroupcollection.groupname");
$oAssocGroups->query();
if ($oAssocGroups->count() == 0)
{
$oGroupList->setCell(0, 1, i18n("Recipient is not member of any group"));
} else {
// Headline
$oGroupList->setCell(0, 1, "<strong>".i18n("Groupname")."</strong>");
$oImgDel = new cHTMLImage("images/delete.gif");
$oGroupList->setCell(0, 2, $oImgDel->render());
$oGroupList->setCellAlignment(0, 2, "right");
// Data
while ($oAssocGroup = $oAssocGroups->next())
{
$oGroup = $oAssocGroups->fetchObject("RecipientGroupCollection");
$oCkbRemove = new cHTMLCheckbox("ckbRemove[]", $oAssocGroup->get("idnewsgroupmember"));
echo ($oGroup->get("idnewsgroupmember"));
$oGroupList->setCell($oAssocGroup->get("idnewsgroupmember"), 1, $oGroup->get("groupname"));
$oGroupList->setCell($oAssocGroup->get("idnewsgroupmember"), 2, $oCkbRemove->toHTML(false));
$oGroupList->setCellAlignment($oAssocGroup->get("idnewsgroupmember"), 2, "right");
}
}
$oForm->add(i18n("Associated Groups"), $oGroupList->render());
$oForm->add(i18n("Author"), $classuser->getUserName($recipient->get("author")) . " (". $recipient->get("created").")" );
$oForm->add(i18n("Last modified by"), $classuser->getUserName($recipient->get("modifiedby")). " (". $recipient->get("lastmodified").")" );
$oPage->setContent($sNotis . $oForm->render(true));
if ($recipient->get("confirmed") != $confirmed && $confirmed) {
$recipient->set("confirmeddate", date("Y-m-d H:i:s"), false);
} elseif (!$confirmed) {
$recipient->set("confirmeddate", "0000-00-00 00:00:00", false);
}
$recipient->set("confirmed", $confirmed);
$recipient->set("deactivated", $deactivated);
$recipient->set("news_type", $newstype);
// Check out if there are any plugins
if (is_array($cfg['plugins']['recipients'])) {
foreach ($cfg['plugins']['recipients'] as $plugin) {
if (function_exists("recipients_" . $plugin . "_wantedVariables") && function_exists("recipients_" . $plugin . "_store")) {
$wantVariables = call_user_func("recipients_" . $plugin . "_wantedVariables");
if (is_array($wantVariables)) {
$varArray = array();
foreach ($wantVariables as $value) {
$varArray[$value] = stripslashes($GLOBALS[$value]);
}
}
$store = call_user_func("recipients_" . $plugin . "_store", $varArray);
}
}
}
$recipient->store();
// Remove group associations
if (isset($_REQUEST["ckbRemove"])) {
$oGroupMembers = new RecipientGroupMemberCollection;
foreach ($_REQUEST["ckbRemove"] as $iGroupMemberID) {
if (is_numeric($iGroupMemberID)) {
$oGroupMembers->delete($iGroupMemberID);
}
}
}
}
if (count($aMessages) > 0) {
$sNotis = $notification->returnNotification("warning", implode("<br>", $aMessages)) . "<br>";
}
$oForm = new UI_Table_Form("properties");
$oForm->setVar("frame", $frame);
$oForm->setVar("area", $area);
$oForm->setVar("action", "recipients_save");
$oForm->setVar("idrecipient", $recipient->get("idnewsrcp"));
$oForm->addHeader(i18n("Edit recipient", "newsletter"));
$oTxtName = new cHTMLTextbox("name", $recipient->get("name"), 40);
$oTxtEMail = new cHTMLTextbox("email", $recipient->get("email"), 40);
$oCkbConfirmed = new cHTMLCheckbox("confirmed", "1");
$oCkbConfirmed->setChecked($recipient->get("confirmed"));
$oCkbDeactivated = new cHTMLCheckbox("deactivated", "1");
$oCkbDeactivated->setChecked($recipient->get("deactivated"));
$oSelNewsType = new cHTMLSelectElement("newstype");
$oOption = new cHTMLOptionElement(i18n("Text only", "newsletter"), "0");
$oSelNewsType->addOptionElement(0, $oOption);
$oOption = new cHTMLOptionElement(i18n("HTML and text", "newsletter"), "1");
$oSelNewsType->addOptionElement(1, $oOption);
$oSelNewsType->setDefault($recipient->get("news_type"));
$oForm->add(i18n("Name", "newsletter"), $oTxtName->render());
$oForm->add(i18n("E-Mail", "newsletter"), $oTxtEMail->render());
$oForm->add(i18n("Confirmed", "newsletter"), $oCkbConfirmed->toHTML(false) . " (" . $recipient->get("confirmeddate") . ")");
$oForm->add(i18n("Deactivated", "newsletter"), $oCkbDeactivated->toHTML(false));
$oForm->add(i18n("Message type", "newsletter"), $oSelNewsType->render());
$aPluginOrder = trim_array(explode(",", getSystemProperty("plugin", "recipients-pluginorder")));
// Check out if there are any plugins
if (is_array($aPluginOrder)) {
foreach ($aPluginOrder as $sPlugin) {
if (function_exists("recipients_" . $sPlugin . "_getTitle") &&
function_exists("recipients_" . $sPlugin . "_display")) {
$aPluginTitle = call_user_func("recipients_" . $sPlugin . "_getTitle");
$aPluginDisplay = call_user_func("recipients_" . $sPlugin . "_display", $recipient);
if (is_array($aPluginTitle) && is_array($aPluginDisplay)) {
foreach ($aPluginTitle as $sKey => $sValue) {
$oForm->add($sValue, $aPluginDisplay[$sKey]);
}
} else {
if (is_array($aPluginTitle) || is_array($aPluginDisplay)) {
$oForm->add(i18n("WARNING", "newsletter"), sprintf(i18n("The plugin %s delivered an array for the displayed titles, but did not return an array for the contents.", "newsletter"), $sPlugin));
} else {
$oForm->add($aPluginTitle, $aPluginDisplay);
}
}
}
}
}
$oGroupList = new UI_List;
$oGroupList->setWidth("100%");
$oGroupList->setBorder(1);
$oAssocGroups = new RecipientGroupMemberCollection;
$oAssocGroups->link("RecipientGroupCollection");
$oAssocGroups->setWhere("recipientgroupmembercollection.idnewsrcp", $recipient->get("idnewsrcp"));
$oAssocGroups->setOrder("recipientgroupcollection.groupname");
$oAssocGroups->query();
if ($oAssocGroups->count() == 0) {
$oGroupList->setCell(0, 1, i18n("Recipient is not member of any group", "newsletter"));
} else {
// Headline
$oGroupList->setCell(0, 1, "<strong>" . i18n("Groupname", "newsletter") . "</strong>");
$oImgDel = new cHTMLImage("images/delete.gif");
$oGroupList->setCell(0, 2, $oImgDel->render());
$oGroupList->setCellAlignment(0, 2, "right");
// Data
while ($oAssocGroup = $oAssocGroups->next()) {
$oGroup = $oAssocGroups->fetchObject("RecipientGroupCollection");
$oCkbRemove = new cHTMLCheckbox("ckbRemove[]", $oAssocGroup->get("idnewsgroupmember"));
echo ($oGroup->get("idnewsgroupmember"));
$oGroupList->setCell($oAssocGroup->get("idnewsgroupmember"), 1, $oGroup->get("groupname"));
$oGroupList->setCell($oAssocGroup->get("idnewsgroupmember"), 2, $oCkbRemove->toHTML(false));
$oGroupList->setCellAlignment($oAssocGroup->get("idnewsgroupmember"), 2, "right");
}
}
$oForm->add(i18n("Associated Groups", "newsletter"), $oGroupList->render());
$oForm->add(i18n("Author", "newsletter"), $classuser->getUserName($recipient->get("author")) . " (" . $recipient->get("created") . ")");
$oForm->add(i18n("Last modified by", "newsletter"), $classuser->getUserName($recipient->get("modifiedby")) . " (" . $recipient->get("lastmodified") . ")");
$oPage->setContent($sNotis . $oForm->render(true));
} else {
$oPage->setContent($sNotis . "");
$oPage->setContent($sNotis . "");
}
$oPage->render();
?>

Datei anzeigen

@ -1,4 +1,5 @@
<?php
/**
* Project:
* Contenido Content Management System
@ -27,87 +28,82 @@
* }}
*
*/
if(!defined('CON_FRAMEWORK')) {
die('Illegal call');
if (!defined('CON_FRAMEWORK')) {
die('Illegal call');
}
$oPage = new cPage;
$oPage = new cPage;
$oRecipients = new RecipientCollection;
if (is_array($cfg['plugins']['recipients'])) {
foreach ($cfg['plugins']['recipients'] as $plugin) {
plugin_include("recipients", $plugin."/".$plugin.".php");
}
foreach ($cfg['plugins']['recipients'] as $plugin) {
plugin_include("recipients", $plugin . "/" . $plugin . ".php");
}
}
// Check form data
if ($_REQUEST["selDelimiter"] == "") {
$_REQUEST["selDelimiter"] = "tab";
$_REQUEST["selDelimiter"] = "tab";
}
$aFields = array();
$aFieldDetails = array();
$aFields["name"] = strtolower(i18n("Name"));
$aFieldDetails["name"]["fieldtype"] = "field"; // field, plugin or group
$aFieldDetails["name"]["mandatory"] = false; // true or false
$aFieldDetails["name"]["type"] = "string"; // string, boolean or date
$aFieldDetails["name"]["link"] = false; // plugin name for plugins, recipient group id for groups
$aFieldDetails["name"]["col"] = -1; // Stores column index where this field has been found
$aFields["email"] = strtolower(i18n("Mail"));
$aFieldDetails["email"]["fieldtype"] = "field";
$aFieldDetails["email"]["mandatory"] = true;
$aFieldDetails["email"]["type"] = "string";
$aFieldDetails["email"]["link"] = false;
$aFieldDetails["email"]["col"] = -1;
$aFields["deactivated"] = strtolower(i18n("Deactivated"));
$aFieldDetails["deactivated"]["fieldtype"] = "field";
$aFieldDetails["deactivated"]["mandatory"] = false;
$aFieldDetails["deactivated"]["type"] = "boolean";
$aFieldDetails["deactivated"]["link"] = false;
$aFieldDetails["deactivated"]["col"] = -1;
$aFields["confirmed"] = strtolower(i18n("Confirmed"));
$aFieldDetails["confirmed"]["fieldtype"] = "field";
$aFieldDetails["confirmed"]["mandatory"] = false;
$aFieldDetails["confirmed"]["type"] = "boolean";
$aFieldDetails["confirmed"]["link"] = false;
$aFieldDetails["confirmed"]["col"] = -1;
$aFields["confirmeddate"] = strtolower(i18n("Confirmed Date"));
$aFieldDetails["confirmeddate"]["fieldtype"]= "field";
$aFieldDetails["confirmeddate"]["mandatory"]= false;
$aFieldDetails["confirmeddate"]["type"] = "date";
$aFieldDetails["confirmeddate"]["link"] = false;
$aFieldDetails["confirmeddate"]["col"] = -1;
$aFields["news_type"] = strtolower(i18n("Message type"));
$aFieldDetails["news_type"]["fieldtype"] = "field";
$aFieldDetails["news_type"]["mandatory"] = false;
$aFieldDetails["news_type"]["type"] = "boolean";
$aFieldDetails["news_type"]["link"] = false;
$aFieldDetails["news_type"]["col"] = -1;
$aFields = array();
$aFieldDetails = array();
$aFields["name"] = strtolower(i18n("Name", "newsletter"));
$aFieldDetails["name"]["fieldtype"] = "field"; // field, plugin or group
$aFieldDetails["name"]["mandatory"] = false; // true or false
$aFieldDetails["name"]["type"] = "string"; // string, boolean or date
$aFieldDetails["name"]["link"] = false; // plugin name for plugins, recipient group id for groups
$aFieldDetails["name"]["col"] = -1; // Stores column index where this field has been found
$aFields["email"] = strtolower(i18n("Mail", "newsletter"));
$aFieldDetails["email"]["fieldtype"] = "field";
$aFieldDetails["email"]["mandatory"] = true;
$aFieldDetails["email"]["type"] = "string";
$aFieldDetails["email"]["link"] = false;
$aFieldDetails["email"]["col"] = -1;
$aFields["deactivated"] = strtolower(i18n("Deactivated", "newsletter"));
$aFieldDetails["deactivated"]["fieldtype"] = "field";
$aFieldDetails["deactivated"]["mandatory"] = false;
$aFieldDetails["deactivated"]["type"] = "boolean";
$aFieldDetails["deactivated"]["link"] = false;
$aFieldDetails["deactivated"]["col"] = -1;
$aFields["confirmed"] = strtolower(i18n("Confirmed", "newsletter"));
$aFieldDetails["confirmed"]["fieldtype"] = "field";
$aFieldDetails["confirmed"]["mandatory"] = false;
$aFieldDetails["confirmed"]["type"] = "boolean";
$aFieldDetails["confirmed"]["link"] = false;
$aFieldDetails["confirmed"]["col"] = -1;
$aFields["confirmeddate"] = strtolower(i18n("Confirmed Date", "newsletter"));
$aFieldDetails["confirmeddate"]["fieldtype"] = "field";
$aFieldDetails["confirmeddate"]["mandatory"] = false;
$aFieldDetails["confirmeddate"]["type"] = "date";
$aFieldDetails["confirmeddate"]["link"] = false;
$aFieldDetails["confirmeddate"]["col"] = -1;
$aFields["news_type"] = strtolower(i18n("Message type", "newsletter"));
$aFieldDetails["news_type"]["fieldtype"] = "field";
$aFieldDetails["news_type"]["mandatory"] = false;
$aFieldDetails["news_type"]["type"] = "boolean";
$aFieldDetails["news_type"]["link"] = false;
$aFieldDetails["news_type"]["col"] = -1;
// Check out if there are any plugins
if (is_array($cfg['plugins']['recipients']))
{
foreach ($cfg['plugins']['recipients'] as $sPlugin)
{
if (function_exists("recipients_".$sPlugin."_wantedVariables") && function_exists("recipients_".$sPlugin."_canonicalVariables"))
{
$aPluginTitles = call_user_func("recipients_".$sPlugin."_canonicalVariables");
$aPluginFields = call_user_func("recipients_".$sPlugin."_wantedVariables");
foreach ($aPluginFields as $sField)
{
//if ($_REQUEST["ckb".$sField]) {
$aFields[$sField] = strtolower(str_replace(" ","", $aPluginTitles[$sField]));
$aFieldDetails[$sField]["fieldtype"]= "plugin";
$aFieldDetails[$sField]["mandatory"]= false;
$aFieldDetails[$sField]["type"] = "string";
$aFieldDetails[$sField]["link"] = $sPlugin;
$aFieldDetails[$sField]["col"] = -1;
//}
}
}
}
if (is_array($cfg['plugins']['recipients'])) {
foreach ($cfg['plugins']['recipients'] as $sPlugin) {
if (function_exists("recipients_" . $sPlugin . "_wantedVariables") && function_exists("recipients_" . $sPlugin . "_canonicalVariables")) {
$aPluginTitles = call_user_func("recipients_" . $sPlugin . "_canonicalVariables");
$aPluginFields = call_user_func("recipients_" . $sPlugin . "_wantedVariables");
foreach ($aPluginFields as $sField) {
//if ($_REQUEST["ckb".$sField]) {
$aFields[$sField] = strtolower(str_replace(" ", "", $aPluginTitles[$sField]));
$aFieldDetails[$sField]["fieldtype"] = "plugin";
$aFieldDetails[$sField]["mandatory"] = false;
$aFieldDetails[$sField]["type"] = "string";
$aFieldDetails[$sField]["link"] = $sPlugin;
$aFieldDetails[$sField]["col"] = -1;
//}
}
}
}
}
// Get groups
@ -117,244 +113,232 @@ $oRcpGroups->setWhere("idlang", $lang);
$oRcpGroups->setOrder("groupname");
$oRcpGroups->query();
while ($oRcpGroup = $oRcpGroups->next())
{
$sField = "g" . $oRcpGroup->get($oRcpGroup->primaryKey);
$sGroupName = $oRcpGroup->get("groupname");
$sGroupName = str_replace(" ", "", $sGroupName);
$sGroupName = str_replace("\t", "", $sGroupName);
$sGroupName = str_replace("\n", "", $sGroupName);
$sGroupName = str_replace("\r", "", $sGroupName);
$sGroupName = str_replace("\0", "", $sGroupName);
$sGroupName = str_replace("\x0B;", "", $sGroupName);
// Only PHP5!
//$sGroupName = str_replace(str_split(" \t\n\r\0\x0B;"), "", $oRcpGroup->get("groupname"));
$aFields[$sField] = strtolower(clHtmlEntities(trim(i18n("Group") . "_" . $sGroupName)));
$aFieldDetails[$sField]["fieldtype"]= "group";
$aFieldDetails[$sField]["mandatory"]= false;
$aFieldDetails[$sField]["type"] = "string";
$aFieldDetails[$sField]["link"] = $oRcpGroup->get($oRcpGroup->primaryKey);
$aFieldDetails[$sField]["col"] = -1;
while ($oRcpGroup = $oRcpGroups->next()) {
$sField = "g" . $oRcpGroup->get($oRcpGroup->primaryKey);
$sGroupName = $oRcpGroup->get("groupname");
$sGroupName = str_replace(" ", "", $sGroupName);
$sGroupName = str_replace("\t", "", $sGroupName);
$sGroupName = str_replace("\n", "", $sGroupName);
$sGroupName = str_replace("\r", "", $sGroupName);
$sGroupName = str_replace("\0", "", $sGroupName);
$sGroupName = str_replace("\x0B;", "", $sGroupName);
// Only PHP5!
//$sGroupName = str_replace(str_split(" \t\n\r\0\x0B;"), "", $oRcpGroup->get("groupname"));
$aFields[$sField] = strtolower(clHtmlEntities(trim(i18n("Group", "newsletter") . "_" . $sGroupName)));
$aFieldDetails[$sField]["fieldtype"] = "group";
$aFieldDetails[$sField]["mandatory"] = false;
$aFieldDetails[$sField]["type"] = "string";
$aFieldDetails[$sField]["link"] = $oRcpGroup->get($oRcpGroup->primaryKey);
$aFieldDetails[$sField]["col"] = -1;
}
if ($action == "recipients_import_exec" && $perm->have_perm_area_action("recipients", "recipients_create")) {
$_REQUEST["txtData"] = trim(stripslashes($_REQUEST["txtData"]));
if ($action == "recipients_import_exec" && $perm->have_perm_area_action("recipients", "recipients_create")) {
$_REQUEST["txtData"] = trim(stripslashes($_REQUEST["txtData"]));
if ($_REQUEST["txtData"]) {
switch ($_REQUEST["selDelimiter"])
{
case "semicolon":
$sDelimiter = ";";
break;
default:
$sDelimiter = "\t"; //chr(9);
}
//echo "<pre>".nl2br(stripslashes($_REQUEST["txtData"]))."</pre>";
$aLines = explode("\n", stripslashes($_REQUEST["txtData"]));
$iAdded = 0;
$iDublettes = 0;
$iInvalid = 0;
$iRow = 0;
$iCol = 0;
$bStop = false;
$sMessage = "";
$aMessage = array();
$aInvalidLines = array();
$oGroupMembers = new RecipientGroupMemberCollection;
if ($_REQUEST["txtData"]) {
switch ($_REQUEST["selDelimiter"]) {
case "semicolon":
$sDelimiter = ";";
break;
default:
$sDelimiter = "\t"; //chr(9);
}
foreach($aLines as $sLine) {
$iRow++;
//echo "<pre>".nl2br(stripslashes($_REQUEST["txtData"]))."</pre>";
$aLines = explode("\n", stripslashes($_REQUEST["txtData"]));
$iAdded = 0;
$iDublettes = 0;
$iInvalid = 0;
$iRow = 0;
$iCol = 0;
$bStop = false;
$sMessage = "";
$aMessage = array();
$aInvalidLines = array();
$oGroupMembers = new RecipientGroupMemberCollection;
$aParts = explode($sDelimiter, trim($sLine));
if ($iRow == 1) {
$aInvalidLines[] = $sLine;
foreach ($aParts as $sHeader) {
$sKey = array_search(strtolower(clHtmlEntities(trim($sHeader))), $aFields);
if ($sKey === false) {
$aMessage[] = sprintf(i18n("Given column header '%s' unknown, column ignored"), $sHeader);
} else {
$aFieldDetails[$sKey]["col"] = $iCol;
$iCol++;
}
}
foreach ($aFieldDetails as $sKey => $aDetails) {
if ($aDetails["mandatory"] && $aDetails["col"] == -1) {
$aMessage[] = sprintf(i18n("Mandatory column '%s' wasn't found, import stopped"), $aDetails[$sKey]);
$bStop = true;
}
}
if ($bStop) {
exit;
} else {
$_REQUEST["txtData"] = "";
}
} else {
$sEMail = trim($aParts[$aFieldDetails["email"]["col"]]);
if ($aFieldDetails["name"]["col"] > -1) {
$sName = trim($aParts[$aFieldDetails["name"]["col"]]);
if ($sName == "") {
$sName = $sEMail;
}
} else {
$sName = $sEMail;
}
if ($sEMail == "") {
$aMessage[] = sprintf(i18n("Item with empty mail address found, item ignored (name: %s, row: %s)"), $sName, $iRow);
$aInvalidLines[] = $sLine;
$iInvalid++;
} else if (!isValidMail($sEMail)) {
$aMessage[] = sprintf(i18n("Mail address '%s' is invalid, item ignored (row: %s)"), $sEMail, $iRow);
$aInvalidLines[] = $sLine;
$iInvalid++;
} else if ($oRecipients->emailExists($sEMail)) {
$aMessage[] = sprintf(i18n("Recipient with mail address '%s' already exists, item skipped (row: %s)"), $sEMail, $iRow);
$aInvalidLines[] = $sLine;
$iDublettes++;
} else {
unset ($sLine);
// Must be $recipient for plugins
if ($recipient = $oRecipients->create($sEMail, $sName))
{
$iID = $recipient->get($recipient->primaryKey);
$iAdded++;
unset($aPluginValue);
$aPluginValue = array();
foreach ($aFieldDetails as $sKey => $aDetails)
{
if ($aDetails["col"] > -1)
{
switch ($aDetails["fieldtype"])
{
case "field":
switch ($aDetails["type"])
{
case "boolean":
$sValue = strtolower(trim($aParts[$aDetails["col"]]));
// html is only treated as "true", to get html messages for recipients
// - quick and dirty...
if ($sValue == "yes" || $sValue == i18n("yes") || $sValue == "true" ||
(is_numeric($sValue) && $sValue > 0) ||
$sValue == "html")
{
$recipient->set($sKey, 1);
if ($sKey == "confirmed") {
// Ensure, that if a recipient is confirmed, a confirmed date
// is available. As "confirmeddate" will be set after "confirmed"
// a specified confirmeddate will overwrite this default
$recipient->set("confirmeddate", date("Y-m-d H:i:s"), false);
}
} else {
$recipient->set($sKey, 0);
}
break;
case "date":
// TODO: Check conversion: Result may be unpredictable...
$sValue = trim($aParts[$aDetails["col"]]);
$recipient->set($sKey, date("Y-m-d H:i:s", strtotime($sValue)), false);
break;
default:
$sValue = trim($aParts[$aDetails["col"]]);
$recipient->set($sKey, $sValue);
}
break;
case "plugin":
// type may be mentioned here, also, but as plugins currently can't
// specify the type, just treat everything as string
// There may be plugins which store more than one value per plugin_store-
// function. As the plugin_store parameter is an array of values, collect
// all values in an array for later storing... unfortunately, that means,
// that we have to go through the fields array second time per item *sigh*
$aPluginValue[$aDetails["link"]][$sKey] = trim($aParts[$aDetails["col"]]);
break;
case "group":
// Add recipient to group
$sValue = strtolower(trim($aParts[$aDetails["col"]]));
if ($sValue == "yes" || $sValue == i18n("yes") ||
$sValue == "true" || (is_numeric($sValue) && $sValue > 0))
{
$oGroupMembers->create($aDetails["link"], $iID);
}
break;
}
}
}
// Store all base data
$recipient->store();
// Store plugin data (to store plugin data, only, where the column has been found in the data
// should be faster than going through all plugins and store mostly empty arrays)
$sCurrentPlugin = "";
foreach ($aFieldDetails as $sKey => $aDetails)
{
if ($aDetails["col"] > -1 &&
$aDetails["fieldtype"] == "plugin" &&
$aDetails["link"] !== $sCurrentPlugin)
{
$sCurrentPlugin = $aDetails["link"];
call_user_func("recipients_".$sCurrentPlugin."_store", $aPluginValue[$sCurrentPlugin]);
}
}
}
}
}
}
if (count($aInvalidLines) > 1) {
$_REQUEST["txtData"] = implode("\n", $aInvalidLines);
}
if (count($aMessage) > 0) {
$sMessage = $notification->returnNotification("warning", implode("<br />", $aMessage))."<br />";
}
$sMessage .= $notification->returnNotification("info", sprintf(i18n("%d recipients added, %d recipients skipped (email already exists) and %d invalid recipients/e-mail adresses ignored. Invalid recipients are shown (if any)."), $iAdded, $iDublettes, $iInvalid));
if ($iAdded > 0) {
$oPage->setReload();
}
}
foreach ($aLines as $sLine) {
$iRow++;
$aParts = explode($sDelimiter, trim($sLine));
if ($iRow == 1) {
$aInvalidLines[] = $sLine;
foreach ($aParts as $sHeader) {
$sKey = array_search(strtolower(clHtmlEntities(trim($sHeader))), $aFields);
if ($sKey === false) {
$aMessage[] = sprintf(i18n("Given column header '%s' unknown, column ignored", "newsletter"), $sHeader);
} else {
$aFieldDetails[$sKey]["col"] = $iCol;
$iCol++;
}
}
foreach ($aFieldDetails as $sKey => $aDetails) {
if ($aDetails["mandatory"] && $aDetails["col"] == -1) {
$aMessage[] = sprintf(i18n("Mandatory column '%s' wasn't found, import stopped", "newsletter"), $aDetails[$sKey]);
$bStop = true;
}
}
if ($bStop) {
exit;
} else {
$_REQUEST["txtData"] = "";
}
} else {
$sEMail = trim($aParts[$aFieldDetails["email"]["col"]]);
if ($aFieldDetails["name"]["col"] > -1) {
$sName = trim($aParts[$aFieldDetails["name"]["col"]]);
if ($sName == "") {
$sName = $sEMail;
}
} else {
$sName = $sEMail;
}
if ($sEMail == "") {
$aMessage[] = sprintf(i18n("Item with empty mail address found, item ignored (name: %s, row: %s)", "newsletter"), $sName, $iRow);
$aInvalidLines[] = $sLine;
$iInvalid++;
} else if (!isValidMail($sEMail)) {
$aMessage[] = sprintf(i18n("Mail address '%s' is invalid, item ignored (row: %s)", "newsletter"), $sEMail, $iRow);
$aInvalidLines[] = $sLine;
$iInvalid++;
} else if ($oRecipients->emailExists($sEMail)) {
$aMessage[] = sprintf(i18n("Recipient with mail address '%s' already exists, item skipped (row: %s)", "newsletter"), $sEMail, $iRow);
$aInvalidLines[] = $sLine;
$iDublettes++;
} else {
unset($sLine);
// Must be $recipient for plugins
if ($recipient = $oRecipients->create($sEMail, $sName)) {
$iID = $recipient->get($recipient->primaryKey);
$iAdded++;
unset($aPluginValue);
$aPluginValue = array();
foreach ($aFieldDetails as $sKey => $aDetails) {
if ($aDetails["col"] > -1) {
switch ($aDetails["fieldtype"]) {
case "field":
switch ($aDetails["type"]) {
case "boolean":
$sValue = strtolower(trim($aParts[$aDetails["col"]]));
// html is only treated as "true", to get html messages for recipients
// - quick and dirty...
if ($sValue == "yes" || $sValue == i18n("yes", "newsletter") || $sValue == "true" ||
(is_numeric($sValue) && $sValue > 0) ||
$sValue == "html") {
$recipient->set($sKey, 1);
if ($sKey == "confirmed") {
// Ensure, that if a recipient is confirmed, a confirmed date
// is available. As "confirmeddate" will be set after "confirmed"
// a specified confirmeddate will overwrite this default
$recipient->set("confirmeddate", date("Y-m-d H:i:s"), false);
}
} else {
$recipient->set($sKey, 0);
}
break;
case "date":
// TODO: Check conversion: Result may be unpredictable...
$sValue = trim($aParts[$aDetails["col"]]);
$recipient->set($sKey, date("Y-m-d H:i:s", strtotime($sValue)), false);
break;
default:
$sValue = trim($aParts[$aDetails["col"]]);
$recipient->set($sKey, $sValue);
}
break;
case "plugin":
// type may be mentioned here, also, but as plugins currently can't
// specify the type, just treat everything as string
// There may be plugins which store more than one value per plugin_store-
// function. As the plugin_store parameter is an array of values, collect
// all values in an array for later storing... unfortunately, that means,
// that we have to go through the fields array second time per item *sigh*
$aPluginValue[$aDetails["link"]][$sKey] = trim($aParts[$aDetails["col"]]);
break;
case "group":
// Add recipient to group
$sValue = strtolower(trim($aParts[$aDetails["col"]]));
if ($sValue == "yes" || $sValue == i18n("yes", "newsletter") ||
$sValue == "true" || (is_numeric($sValue) && $sValue > 0)) {
$oGroupMembers->create($aDetails["link"], $iID);
}
break;
}
}
}
// Store all base data
$recipient->store();
// Store plugin data (to store plugin data, only, where the column has been found in the data
// should be faster than going through all plugins and store mostly empty arrays)
$sCurrentPlugin = "";
foreach ($aFieldDetails as $sKey => $aDetails) {
if ($aDetails["col"] > -1 &&
$aDetails["fieldtype"] == "plugin" &&
$aDetails["link"] !== $sCurrentPlugin) {
$sCurrentPlugin = $aDetails["link"];
call_user_func("recipients_" . $sCurrentPlugin . "_store", $aPluginValue[$sCurrentPlugin]);
}
}
}
}
}
}
if (count($aInvalidLines) > 1) {
$_REQUEST["txtData"] = implode("\n", $aInvalidLines);
}
if (count($aMessage) > 0) {
$sMessage = $notification->returnNotification("warning", implode("<br />", $aMessage)) . "<br />";
}
$sMessage .= $notification->returnNotification("info", sprintf(i18n("%d recipients added, %d recipients skipped (email already exists) and %d invalid recipients/e-mail adresses ignored. Invalid recipients are shown (if any).", "newsletter"), $iAdded, $iDublettes, $iInvalid));
if ($iAdded > 0) {
$oPage->setReload();
}
}
}
$oForm = new UI_Table_Form("properties");
$oForm->setVar("frame", $frame);
$oForm->setVar("area", $area);
$oForm->setVar("action", "recipients_import_exec");
$oForm->addHeader(i18n("Import recipients"));
$oForm->addHeader(i18n("Import recipients", "newsletter"));
$oSelDelimiter = new cHTMLSelectElement("selDelimiter");
$aItems = array();
$aItems[] = array("tab", i18n("Tab"));
$aItems[] = array("semicolon", i18n("Semicolon"));
$aItems[] = array("tab", i18n("Tab", "newsletter"));
$aItems[] = array("semicolon", i18n("Semicolon", "newsletter"));
$oSelDelimiter->autoFill($aItems);
$oSelDelimiter->setDefault($_REQUEST["selDelimiter"]);
$oForm->add(i18n("Delimiter"), $oSelDelimiter->render());
$oForm->add(i18n("Delimiter", "newsletter"), $oSelDelimiter->render());
$oAreaData = new cHTMLTextarea("txtData", $_REQUEST["txtData"], 80, 20);
$sInfo = '<a href="javascript:fncShowHide(\'idInfoText\');"><strong>'.i18n("Import information").'</strong></a>'.
'<div id="idInfoText" style="display: none">'.
'<br /><br /><strong>'.i18n("Specify colum types:").'</strong>'.
i18n("<br />The first line must contain the column names; this specifies the column order.<br />&lt;column name&gt;[delimiter]&lt;column name&gt;...").
'<br /><br /><strong>'.i18n("Data structure:").'</strong><br />'.
i18n("The recipients have to be entered using the following format:<br />&lt;data&gt;[Delimiter]&lt;data&gt;... - each recipient in a new line.").
'<br /><br /><strong>'.i18n("Example:").'</strong>'.
i18n("<br />name;mail;confirmed<br />Smith;jon.smith@example.org;1").
'<br /><br /><strong>'.i18n("The following column names will be recognized:").'</strong><br />'.
implode("<br />\n", $aFields);
$oForm->add(i18n("Recipients"), $oAreaData->render()."<br />".$sInfo);
unset ($sInfo);
$sInfo = '<a href="javascript:fncShowHide(\'idInfoText\');"><strong>' . i18n("Import information", "newsletter") . '</strong></a>' .
'<div id="idInfoText" style="display: none">' .
'<br /><br /><strong>' . i18n("Specify colum types:", "newsletter") . '</strong>' .
i18n("<br />The first line must contain the column names; this specifies the column order.<br />&lt;column name&gt;[delimiter]&lt;column name&gt;...", "newsletter") .
'<br /><br /><strong>' . i18n("Data structure:", "newsletter") . '</strong><br />' .
i18n("The recipients have to be entered using the following format:<br />&lt;data&gt;[Delimiter]&lt;data&gt;... - each recipient in a new line.", "newsletter") .
'<br /><br /><strong>' . i18n("Example:", "newsletter") . '</strong>' .
i18n("<br />name;mail;confirmed<br />Smith;jon.smith@example.org;1", "newsletter") .
'<br /><br /><strong>' . i18n("The following column names will be recognized:", "newsletter") . '</strong><br />' .
implode("<br />\n", $aFields);
$oForm->add(i18n("Recipients", "newsletter"), $oAreaData->render() . "<br />" . $sInfo);
unset($sInfo);
$sExecScript = '
<script type="text/javascript">
@ -371,7 +355,6 @@ $sExecScript = '
</script>';
$oPage->addScript('execscript', $sExecScript);
$oPage->setContent($sMessage.$oForm->render(true));
$oPage->setContent($sMessage . $oForm->render(true));
$oPage->render();
?>

Datei anzeigen

@ -1,4 +1,5 @@
<?php
/**
* Project:
* Contenido Content Management System
@ -27,21 +28,19 @@
* }}
*
*/
if(!defined('CON_FRAMEWORK')) {
die('Illegal call');
if (!defined('CON_FRAMEWORK')) {
die('Illegal call');
}
##################################
# Initialization
##################################
$oPage = new cPage;
$oMenu = new UI_Menu;
$oClient = new cApiClient($client);
$oUser = new cApiUser($auth->auth["uid"]);
$oPage = new cPage;
$oMenu = new UI_Menu;
$oClient = new cApiClient($client);
$oUser = new cApiUser($auth->auth["uid"]);
//$sLocation = $sess->url("main.php?area=$area&frame=$frame");
// Specify fields for search, sort and validation. Design makes enhancements
// using plugins possible (currently not implemented). If you are changing things here,
// remember to update include.newsletter_left_top.php, also.
@ -51,10 +50,10 @@ $oUser = new cApiUser($auth->auth["uid"]);
// sort: Element can be used to be sorted by
// search: Element can be used to search in
$aFields = array();
$aFields["name"] = array("field" => "name", "caption" => i18n("Name"), "type" => "base,sort,search");
$aFields["email"] = array("field" => "email", "caption" => i18n("E-Mail"), "type" => "base,sort,search");
$aFields["confirmed"] = array("field" => "confirmed", "caption" => i18n("Confirmed"), "type" => "base");
$aFields["deactivated"] = array("field" => "deactivated", "caption" => i18n("Deactivated"), "type" => "base");
$aFields["name"] = array("field" => "name", "caption" => i18n("Name", "newsletter"), "type" => "base,sort,search");
$aFields["email"] = array("field" => "email", "caption" => i18n("E-Mail", "newsletter"), "type" => "base,sort,search");
$aFields["confirmed"] = array("field" => "confirmed", "caption" => i18n("Confirmed", "newsletter"), "type" => "base");
$aFields["deactivated"] = array("field" => "deactivated", "caption" => i18n("Deactivated", "newsletter"), "type" => "base");
##################################
# Store settings
@ -62,9 +61,7 @@ $aFields["deactivated"] = array("field" => "deactivated", "caption" => i18n("Dea
//Update purgetimeframe if submitted
//$sRefreshTop = '';
$iTimeframe = $oClient->getProperty("newsletter", "purgetimeframe");
if (isset($_REQUEST["txtPurgeTimeframe"]) && $_REQUEST["txtPurgeTimeframe"] > 0
&& $_REQUEST["txtPurgeTimeframe"] != $iTimeframe && $perm->have_perm_area_action($area, "recipients_delete"))
{
if (isset($_REQUEST["txtPurgeTimeframe"]) && $_REQUEST["txtPurgeTimeframe"] > 0 && $_REQUEST["txtPurgeTimeframe"] != $iTimeframe && $perm->have_perm_area_action($area, "recipients_delete")) {
$oClient->setProperty("newsletter", "purgetimeframe", $_REQUEST["txtPurgeTimeframe"]);
//$sRefreshTop = '<script language="JavaScript">parent.left_top.purgetimeframe = '.$_REQUEST["txtPurgeTimeframe"].'</script>';
}
@ -74,53 +71,52 @@ if (isset($_REQUEST["txtPurgeTimeframe"]) && $_REQUEST["txtPurgeTimeframe"] > 0
##################################
// Items per page (value stored per area in user property)
if (!isset($_REQUEST["elemperpage"]) || !is_numeric($_REQUEST["elemperpage"]) || $_REQUEST["elemperpage"] < 0) {
$_REQUEST["elemperpage"] = $oUser->getProperty("itemsperpage", $area);
$_REQUEST["elemperpage"] = $oUser->getProperty("itemsperpage", $area);
}
if (!is_numeric($_REQUEST["elemperpage"])) {
// This is the case, if the user property has never been set (first time user)
$_REQUEST["elemperpage"] = 25;
// This is the case, if the user property has never been set (first time user)
$_REQUEST["elemperpage"] = 25;
}
if ($_REQUEST["elemperpage"] > 0) {
// -- All -- will not be stored, as it may be impossible to change this back to something more useful
$oUser->setProperty("itemsperpage", $area, $_REQUEST["elemperpage"]);
if ($_REQUEST["elemperpage"] > 0) {
// -- All -- will not be stored, as it may be impossible to change this back to something more useful
$oUser->setProperty("itemsperpage", $area, $_REQUEST["elemperpage"]);
}
$_REQUEST["restrictgroup"] = (int)$_REQUEST["restrictgroup"];
$_REQUEST["restrictgroup"] = (int) $_REQUEST["restrictgroup"];
if ($_REQUEST["restrictgroup"] == 0) {
$_REQUEST["restrictgroup"] = "--all--";
$_REQUEST["restrictgroup"] = "--all--";
}
$_REQUEST["page"] = (int)$_REQUEST["page"];
$_REQUEST["page"] = (int) $_REQUEST["page"];
if ($_REQUEST["page"] <= 0 || $_REQUEST["elemperpage"] == 0) {
$_REQUEST["page"] = 1;
$_REQUEST["page"] = 1;
}
// Sort order
if ($_REQUEST["sortorder"] != "DESC") {
$_REQUEST["sortorder"] = "ASC";
$_REQUEST["sortorder"] = "ASC";
}
// Check sort by and search in criteria
$bSortByFound = false;
$bSearchInFound = false;
foreach ($aFields as $sKey => $aData)
{
if ($aData["field"] == $_REQUEST["sortby"] && strpos($aData["type"], "sort") !== false) {
$bSortByFound = true;
}
if ($aData["field"] == $_REQUEST["searchin"] && strpos($aData["type"], "search") !== false) {
$bSearchInFound = true;
}
$bSortByFound = false;
$bSearchInFound = false;
foreach ($aFields as $sKey => $aData) {
if ($aData["field"] == $_REQUEST["sortby"] && strpos($aData["type"], "sort") !== false) {
$bSortByFound = true;
}
if ($aData["field"] == $_REQUEST["searchin"] && strpos($aData["type"], "search") !== false) {
$bSearchInFound = true;
}
}
if (!$bSortByFound) {
$_REQUEST["sortby"] = "name"; // Default sort by field, possible values see above
$_REQUEST["sortby"] = "name"; // Default sort by field, possible values see above
}
if (!$bSearchInFound) {
$_REQUEST["searchin"] = "--all--";
$_REQUEST["searchin"] = "--all--";
}
// Free memory
unset ($oUser);
unset ($oClient);
unset($oUser);
unset($oClient);
##################################
# Get data
@ -129,104 +125,97 @@ $oRecipients = new RecipientCollection;
// Updating keys, if activated; all recipients of all clients!
$sMsg = "";
if (getSystemProperty("newsletter", "updatekeys"))
{
$iUpdatedRecipients = $oRecipients->updateKeys();
$sMsg = $notification->returnNotification("info", sprintf(i18n("%d recipients, with no or incompatible key has been updated. Deactivate update function."), $iUpdatedRecipients));
if (getSystemProperty("newsletter", "updatekeys")) {
$iUpdatedRecipients = $oRecipients->updateKeys();
$sMsg = $notification->returnNotification("info", sprintf(i18n("%d recipients, with no or incompatible key has been updated. Deactivate update function.", "newsletter"), $iUpdatedRecipients));
}
$oRecipients->setWhere("recipientcollection.idclient", $client);
$oRecipients->setWhere("recipientcollection.idlang", $lang);
$oRecipients->setWhere("recipientcollection.idclient", $client);
$oRecipients->setWhere("recipientcollection.idlang", $lang);
// sort by and sort order
$oRecipients->setOrder("recipientcollection." . $_REQUEST["sortby"] . " " . $_REQUEST["sortorder"]);
// Show group
if ($_REQUEST["restrictgroup"] != "--all--")
{
$oRecipients->link("RecipientGroupMemberCollection");
$oRecipients->setWhere("RecipientGroupMemberCollection.idnewsgroup", $_REQUEST["restrictgroup"]);
if ($_REQUEST["restrictgroup"] != "--all--") {
$oRecipients->link("RecipientGroupMemberCollection");
$oRecipients->setWhere("RecipientGroupMemberCollection.idnewsgroup", $_REQUEST["restrictgroup"]);
}
// Search for
if ($_REQUEST["filter"] != "")
{
if ($_REQUEST["searchin"] == "--all--" || $_REQUEST["searchin"] == "")
{
foreach ($aFields as $sKey => $aData)
{
if (strpos($aData["type"], "search") !== false) {
$oRecipients->setWhereGroup("filter", "recipientcollection.".$aData["field"], $_REQUEST["filter"], "LIKE");
}
}
$oRecipients->setInnerGroupCondition("filter", "OR");
} else {
$oRecipients->setWhere("recipientcollection.".$_REQUEST["searchin"], $_REQUEST["filter"], "LIKE");
}
if ($_REQUEST["filter"] != "") {
if ($_REQUEST["searchin"] == "--all--" || $_REQUEST["searchin"] == "") {
foreach ($aFields as $sKey => $aData) {
if (strpos($aData["type"], "search") !== false) {
$oRecipients->setWhereGroup("filter", "recipientcollection." . $aData["field"], $_REQUEST["filter"], "LIKE");
}
}
$oRecipients->setInnerGroupCondition("filter", "OR");
} else {
$oRecipients->setWhere("recipientcollection." . $_REQUEST["searchin"], $_REQUEST["filter"], "LIKE");
}
}
// Items / page
if ($_REQUEST["elemperpage"] > 0)
{
// Getting item count without limit (for page function) - better idea anyone (performance)?
$oRecipients->query();
$iItemCount = $oRecipients->count();
if ($_REQUEST["elemperpage"] > 0) {
// Getting item count without limit (for page function) - better idea anyone (performance)?
$oRecipients->query();
$iItemCount = $oRecipients->count();
if ($_REQUEST["elemperpage"]*($_REQUEST["page"]) >= $iItemCount+$_REQUEST["elemperpage"] && $_REQUEST["page"] != 1) {
$_REQUEST["page"]--;
if ($_REQUEST["elemperpage"] * ($_REQUEST["page"]) >= $iItemCount + $_REQUEST["elemperpage"] && $_REQUEST["page"] != 1) {
$_REQUEST["page"] --;
}
$oRecipients->setLimit($_REQUEST["elemperpage"] * ($_REQUEST["page"] - 1), $_REQUEST["elemperpage"]);
$oRecipients->setLimit($_REQUEST["elemperpage"] * ($_REQUEST["page"] - 1), $_REQUEST["elemperpage"]);
} else {
$iItemCount = 0;
$iItemCount = 0;
}
$oRecipients->query();
// Output data
$oMenu = new UI_Menu;
$iMenu = 0;
$oMenu = new UI_Menu;
$iMenu = 0;
// Store messages for repeated use (speeds performance, as i18n translation is only needed once)
$aMsg = array();
$aMsg["DelTitle"] = i18n("Delete recipient");
$aMsg["DelDescr"] = i18n("Do you really want to delete the following recipient:<br>");
$aMsg["DelTitle"] = i18n("Delete recipient", "newsletter");
$aMsg["DelDescr"] = i18n("Do you really want to delete the following recipient:<br>", "newsletter");
while ($oRecipient = $oRecipients->next())
{
$iMenu++;
$idnewsrcp = $oRecipient->get("idnewsrcp");
$sName = $oRecipient->get("name");
if (empty($sName)) {
$sName = $oRecipient->get("email");
}
while ($oRecipient = $oRecipients->next()) {
$iMenu++;
$idnewsrcp = $oRecipient->get("idnewsrcp");
$oLnk = new cHTMLLink;
$oLnk->setMultiLink($area, "", $area, "");
$oLnk->setCustom("idrecipient", $idnewsrcp);
$sName = $oRecipient->get("name");
if (empty($sName)) {
$sName = $oRecipient->get("email");
}
if ($oRecipient->get("deactivated") == 1 || $oRecipient->get("confirmed") == 0) {
$oLnk->updateAttributes(array("style" => "color:#A20000"));
}
$oLnk = new cHTMLLink;
$oLnk->setMultiLink($area, "", $area, "");
$oLnk->setCustom("idrecipient", $idnewsrcp);
$oMenu->setTitle($iMenu, $sName);
$oMenu->setLink($iMenu, $oLnk);
if ($perm->have_perm_area_action("recipients", "recipients_delete")) {
$oMenu->setActions($iMenu, "delete", '<a title="'.$aMsg["DelTitle"].'" href="javascript://" onclick="showDelMsg('.$idnewsrcp.',\''.addslashes($sName).'\')"><img src="'.$cfg['path']['images'].'delete.gif" border="0" title="'.$aMsg["DelTitle"].'" alt="'.$aMsg["DelTitle"].'"></a>');
}
if ($oRecipient->get("deactivated") == 1 || $oRecipient->get("confirmed") == 0) {
$oLnk->updateAttributes(array("style" => "color:#A20000"));
}
$oMenu->setTitle($iMenu, $sName);
$oMenu->setLink($iMenu, $oLnk);
if ($perm->have_perm_area_action("recipients", "recipients_delete")) {
$oMenu->setActions($iMenu, "delete", '<a title="' . $aMsg["DelTitle"] . '" href="javascript://" onclick="showDelMsg(' . $idnewsrcp . ',\'' . addslashes($sName) . '\')"><img src="' . $cfg['path']['images'] . 'delete.gif" border="0" title="' . $aMsg["DelTitle"] . '" alt="' . $aMsg["DelTitle"] . '"></a>');
}
}
$sExecScript = '
<script type="text/javascript">
// Session-ID
var sid = "'.$sess->id.'";
var sid = "' . $sess->id . '";
// Create messageBox instance
box = new messageBox("", "", "", 0, 0);
function showDelMsg(lngId, strElement) {
box.confirm("'.$aMsg["DelTitle"].'", "'.$aMsg["DelDescr"].'<b>" + strElement + "</b>", "deleteRecipient(\'" + lngId + "\')");
box.confirm("' . $aMsg["DelTitle"] . '", "' . $aMsg["DelDescr"] . '<b>" + strElement + "</b>", "deleteRecipient(\'" + lngId + "\')");
}
// Function for deleting recipients
@ -250,27 +239,26 @@ $sExecScript = '
</script>';
$oPage->setMargin(0);
$oPage->addScript('messagebox', '<script type="text/javascript" src="scripts/messageBox.js.php?contenido='.$sess->id.'"></script>');
$oPage->addScript('messagebox', '<script type="text/javascript" src="scripts/messageBox.js.php?contenido=' . $sess->id . '"></script>');
$oPage->addScript('exec', $sExecScript);
//$oPage->addScript('cfoldingrow.js', '<script language="JavaScript" src="scripts/cfoldingrow.js"></script>');
$oPage->addScript('parameterCollector.js', '<script language="JavaScript" src="scripts/parameterCollector.js"></script>');
//$oPage->addScript('refreshTop', $sRefreshTop);
//generate current content for Object Pager<65>
$sPagerId = '0ed6d632-6adf-4f09-a0c6-1e38ab60e304';
$sPagerId = '0ed6d632-6adf-4f09-a0c6-1e38ab60e304';
$oPagerLink = new cHTMLLink;
$oPagerLink->setLink("main.php");
$oPagerLink->setTargetFrame('left_bottom');
$oPagerLink->setCustom("elemperpage", $_REQUEST["elemperpage"]);
$oPagerLink->setCustom("filter", $_REQUEST["filter"]);
$oPagerLink->setCustom("restrictgroup", $_REQUEST["restrictgroup"]);
$oPagerLink->setCustom("sortby", $_REQUEST["sortby"]);
$oPagerLink->setCustom("sortorder", $_REQUEST["sortorder"]);
$oPagerLink->setCustom("searchin", $_REQUEST["searchin"]);
$oPagerLink->setCustom("frame", $frame);
$oPagerLink->setCustom("area", $area);
$oPagerLink->setCustom("elemperpage", $_REQUEST["elemperpage"]);
$oPagerLink->setCustom("filter", $_REQUEST["filter"]);
$oPagerLink->setCustom("restrictgroup", $_REQUEST["restrictgroup"]);
$oPagerLink->setCustom("sortby", $_REQUEST["sortby"]);
$oPagerLink->setCustom("sortorder", $_REQUEST["sortorder"]);
$oPagerLink->setCustom("searchin", $_REQUEST["searchin"]);
$oPagerLink->setCustom("frame", $frame);
$oPagerLink->setCustom("area", $area);
$oPagerLink->enableAutomaticParameterAppend();
$oPagerLink->setCustom("contenido", $sess->id);
$oPagerLink->setCustom("contenido", $sess->id);
// Note, that after the "page" parameter no "pagerlink" parameter is specified -
// it is not used, as the JS below only uses the INNER html and the "pagerlink" parameter is
// set by ...left_top.html for the foldingrow itself
@ -286,16 +274,15 @@ $oPage->addScript('setpager', '<script type="text/javascript" src="scripts/setPa
$sRefreshPager = '
<script type="text/javascript">
var sNavigation = \''.$sPagerContent.'\';
var sNavigation = \'' . $sPagerContent . '\';
// Activate time to refresh pager folding row in left top
var oTimer = window.setInterval("fncSetPager(\'' . $sPagerId . '\',\'' . $_REQUEST["page"] . '\')", 200);
</script>';
$oPage->addScript('refreshpager', $sRefreshPager);
$oPage->addScript('refreshpager', $sRefreshPager);
//$oPage->setContent(array('<table border="0" cellspacing="0" cellpadding="0" width="100%">', '</table>', $sMsg . $oMenu->render(false)));
$oPage->setContent($sMsg . $oMenu->render(false));
$oPage->render();
?>

Datei-Diff unterdrückt, da er zu groß ist Diff laden

Datei-Diff unterdrückt, da er zu groß ist Diff laden

Datei anzeigen

@ -0,0 +1,21 @@
./includes/include.newsletter_jobs_menu.php
./includes/include.newsletter_edit.php
./includes/include.recipients_menu.php
./includes/include.newsletter_left_top.php
./includes/include.newsletter_subnav.php
./includes/config.autoloader.php
./includes/include.newsletter_jobs_details.php
./includes/include.recipients.group_menu.php
./includes/include.recipients.group.subnav.php
./includes/include.newsletter_jobs_subnav.php
./includes/include.recipients.group_edit.php
./includes/include.newsletter_menu.php
./includes/include.recipients_edit.php
./includes/include.newsletter_edit_message.php
./includes/include.recipients_import.php
./includes/config.plugin.php
./classes/class.newsletter.php
./classes/class.newsletter.groups.php
./classes/class.newsletter.recipients.php
./classes/class.newsletter.logs.php
./classes/class.newsletter.jobs.php