updates for PHP 7.3; remove old plugins; setup data without demo and adding plugins; increase CL-version to 2.1.1
Dieser Commit ist enthalten in:
Ursprung
a0ea0e7255
Commit
529d9c96f0
|
@ -1,82 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<plugin>
|
||||
<general active="1">
|
||||
<plugin_name>ConLite Newsletter</plugin_name>
|
||||
<plugin_foldername>cl_newsletter</plugin_foldername>
|
||||
<uuid>45D7F1F3-41E9-57BC-8987-C0550B3B07B8</uuid>
|
||||
<description>ConLite Newsletter System</description>
|
||||
<author>ConLite Team</author>
|
||||
<copyright>ConLite Team</copyright>
|
||||
<mail>cl_newsletter@conlite.org</mail>
|
||||
<website>https://conlite.org</website>
|
||||
<version>1.0.0</version>
|
||||
</general>
|
||||
<requirements php="5.6">
|
||||
<conlite minversion="2.1.0" />
|
||||
</requirements>
|
||||
<conlite>
|
||||
<areas>
|
||||
<area menuless="0">news</area>
|
||||
<area parent="news" menuless="0">news_edit</area>
|
||||
<area parent="news" menuless="0">news_edittpl</area>
|
||||
<area parent="news" menuless="0">news_editcontent</area>
|
||||
<area parent="news" menuless="0">news_jobs</area>
|
||||
<area menuless="0">recipients</area>
|
||||
<area parent="recipients" menuless="0">recipients_import</area>
|
||||
<area menuless="0">recipientgroups</area>
|
||||
</areas>
|
||||
<actions>
|
||||
<action area="news">news_save</action>
|
||||
<action area="news">news_create</action>
|
||||
<action area="news">news_delete</action>
|
||||
<action area="news">news_duplicate</action>
|
||||
<action area="news">news_add_job</action>
|
||||
<action area="news">news_send_test</action>
|
||||
<action area="news_jobs">news_job_delete</action>
|
||||
<action area="news_jobs">news_job_details</action>
|
||||
<action area="news_jobs">news_job_detail_delete</action>
|
||||
<action area="news">news_html_settings</action>
|
||||
<action area="news_jobs">news_job_run</action>
|
||||
<action area="recipients">recipients_save</action>
|
||||
<action area="recipients">recipients_create</action>
|
||||
<action area="recipients">recipients_delete</action>
|
||||
<action area="recipientgroups">recipientgroup_delete</action>
|
||||
<action area="recipientgroups">recipientgroup_create</action>
|
||||
<action area="recipientgroups">recipientgroup_recipient_delete</action>
|
||||
<action area="recipientgroups">recipientgroup_save_group</action>
|
||||
<action area="recipients">recipients_purge</action>
|
||||
<action area="recipients_import">recipients_import</action>
|
||||
<action area="recipients_import">recipients_import_exec</action>
|
||||
</actions>
|
||||
<frames>
|
||||
<frame area="news" filetype="main" name="cl_newsletter/includes/include.newsletter_edit.php" frameId="4" />
|
||||
<frame area="news" filetype="main" name="cl_newsletter/includes/include.newsletter_left_top.php" frameId="1" />
|
||||
<frame area="news" filetype="main" name="cl_newsletter/includes/include.newsletter_menu.php" frameId="2" />
|
||||
<frame area="news" filetype="main" name="cl_newsletter/includes/include.newsletter_subnav.php" frameId="3" />
|
||||
<frame area="news" filetype="inc" name="functions.forms.php" frameId="4" />
|
||||
|
||||
<frame area="news_edit" filetype="main" name="cl_newsletter/includes/include.newsletter_edit_message.php" frameId="4" />
|
||||
|
||||
<frame area="recipients" filetype="main" name="cl_newsletter/includes/include.recipients_edit.php" frameId="4" />
|
||||
<frame area="recipients" filetype="main" name="cl_newsletter/includes/include.recipients_menu.php" frameId="2" />
|
||||
<frame area="recipients" filetype="main" name="cl_newsletter/includes/include.recipients_left_top.php" frameId="1" />
|
||||
<frame area="recipients" filetype="inc" name="functions.forms.php" frameId="4" />
|
||||
<frame area="recipients" filetype="main" name="include.subnav_blank.php" frameId="3" />
|
||||
|
||||
<frame area="recipientgroups" filetype="main" name="cl_newsletter/includes/include.recipients.group.subnav.php" frameId="3" />
|
||||
<frame area="recipientgroups" filetype="main" name="cl_newsletter/includes/include.recipients.group_edit.php" frameId="4" />
|
||||
<frame area="recipientgroups" filetype="main" name="cl_newsletter/includes/include.recipients.group_menu.php" frameId="2" />
|
||||
|
||||
<frame area="news_jobs" filetype="main" name="cl_newsletter/includes/include.newsletter_jobs_details.php" frameId="4" />
|
||||
<frame area="news_jobs" filetype="main" name="cl_newsletter/includes/include.newsletter_jobs_menu.php" frameId="2" />
|
||||
<frame area="news_jobs" filetype="main" name="cl_newsletter/includes/include.newsletter_jobs_subnav.php" frameId="3" />
|
||||
|
||||
<frame area="recipients_import" filetype="main" name="cl_newsletter/includes/include.recipients_import.php" frameId="4" />
|
||||
</frames>
|
||||
<nav_sub>
|
||||
<nav area="news" level="0" navm="extra">cl_newsletter/xml/;navigation/extra/newsletter</nav>
|
||||
<nav area="recipients" level="1" navm="extra">cl_newsletter/xml/;navigation/extra/recipients</nav>
|
||||
<nav area="recipientgroups" level="1" navm="extra">cl_newsletter/xml/;navigation/extra/recipientgroups</nav>
|
||||
</nav_sub>
|
||||
</conlite>
|
||||
</plugin>
|
|
@ -1,288 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Project:
|
||||
* Contenido Content Management System
|
||||
*
|
||||
* Description:
|
||||
* Recipient groups class
|
||||
*
|
||||
* Requirements:
|
||||
* @con_php_req 5.0
|
||||
*
|
||||
*
|
||||
* @package Contenido Backend classes
|
||||
* @version 1.1
|
||||
* @author Björn Behrens
|
||||
* @copyright four for business AG <www.4fb.de>
|
||||
* @license http://www.contenido.org/license/LIZENZ.txt
|
||||
* @link http://www.4fb.de
|
||||
* @link http://www.contenido.org
|
||||
* @since file available since contenido release <= 4.6
|
||||
*
|
||||
* {@internal
|
||||
* created 2004-08-01
|
||||
* modified 2008-06-30, Dominik Ziegler, add security fix
|
||||
* modified 2011-03-14, Murat Purc, adapted to new GenericDB, partly ported to PHP 5, formatting
|
||||
*
|
||||
* $Id$:
|
||||
* }}
|
||||
*
|
||||
*/
|
||||
if (!defined('CON_FRAMEWORK')) {
|
||||
die('Illegal call');
|
||||
}
|
||||
|
||||
/**
|
||||
* Recipient group management class
|
||||
*/
|
||||
class RecipientGroupCollection extends ItemCollection {
|
||||
|
||||
/**
|
||||
* Constructor Function
|
||||
* @param none
|
||||
*/
|
||||
public function __construct() {
|
||||
global $cfg;
|
||||
parent::__construct($cfg["tab"]["news_groups"], "idnewsgroup");
|
||||
$this->_setItemClass("RecipientGroup");
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new group
|
||||
* @param $groupname string Specifies the groupname
|
||||
* @param $defaultgroup integer Specfies, if group is default group (optional)
|
||||
*/
|
||||
public function create($groupname, $defaultgroup = 0) {
|
||||
global $client, $lang;
|
||||
|
||||
$client = Contenido_Security::toInteger($client);
|
||||
$lang = Contenido_Security::toInteger($lang);
|
||||
|
||||
$group = new RecipientGroup();
|
||||
|
||||
#$_arrInFilters = array('urlencode', 'clHtmlSpecialChars', 'addslashes');
|
||||
|
||||
$mangledGroupName = $group->_inFilter($groupname);
|
||||
$this->setWhere("idclient", $client);
|
||||
$this->setWhere("idlang", $lang);
|
||||
$this->setWhere("groupname", $mangledGroupName);
|
||||
$this->query();
|
||||
|
||||
if ($obj = $this->next()) {
|
||||
$groupname = $groupname . md5(rand());
|
||||
}
|
||||
|
||||
$item = parent::createNewItem();
|
||||
|
||||
$item->set("idclient", $client);
|
||||
$item->set("idlang", $lang);
|
||||
$item->set("groupname", $groupname);
|
||||
$item->set("defaultgroup", $defaultgroup);
|
||||
$item->store();
|
||||
|
||||
return $item;
|
||||
}
|
||||
|
||||
/**
|
||||
* Overridden delete method to remove groups from groupmember table
|
||||
* before deleting group
|
||||
*
|
||||
* @param $itemID int specifies the newsletter recipient group
|
||||
*/
|
||||
public function delete($itemID) {
|
||||
$oAssociations = new RecipientGroupMemberCollection;
|
||||
$oAssociations->setWhere("idnewsgroup", $itemID);
|
||||
$oAssociations->query();
|
||||
|
||||
while ($oItem = $oAssociations->next()) {
|
||||
$oAssociations->delete($oItem->get("idnewsgroupmember"));
|
||||
}
|
||||
parent::delete($itemID);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Single RecipientGroup Item
|
||||
*/
|
||||
class RecipientGroup extends Item {
|
||||
|
||||
/**
|
||||
* Constructor Function
|
||||
* @param mixed $mId Specifies the ID of item to load
|
||||
*/
|
||||
public function __construct($mId = false) {
|
||||
global $cfg;
|
||||
parent::__construct($cfg["tab"]["news_groups"], "idnewsgroup");
|
||||
if ($mId !== false) {
|
||||
$this->loadByPrimaryKey($mId);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Overriden store() method to ensure, that there is only one default group
|
||||
* */
|
||||
public function store() {
|
||||
global $client, $lang;
|
||||
|
||||
$client = Contenido_Security::toInteger($client);
|
||||
$lang = Contenido_Security::toInteger($lang);
|
||||
|
||||
if ($this->get("defaultgroup") == 1) {
|
||||
$oItems = new RecipientGroupCollection();
|
||||
$oItems->setWhere("idclient", $client);
|
||||
$oItems->setWhere("idlang", $lang);
|
||||
$oItems->setWhere("defaultgroup", 1);
|
||||
$oItems->setWhere("idnewsgroup", $this->get("idnewsgroup"), "<>");
|
||||
$oItems->query();
|
||||
|
||||
while ($oItem = $oItems->next()) {
|
||||
$oItem->set("defaultgroup", 0);
|
||||
$oItem->store();
|
||||
}
|
||||
}
|
||||
parent::store();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Recipient group member management class
|
||||
*/
|
||||
class RecipientGroupMemberCollection extends ItemCollection {
|
||||
|
||||
/**
|
||||
* Constructor Function
|
||||
* @param none
|
||||
*/
|
||||
public function __construct() {
|
||||
global $cfg;
|
||||
parent::__construct($cfg["tab"]["news_groupmembers"], "idnewsgroupmember");
|
||||
$this->_setJoinPartner('RecipientGroupCollection');
|
||||
$this->_setJoinPartner('RecipientCollection');
|
||||
$this->_setItemClass("RecipientGroupMember");
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new association
|
||||
* @param $idrecipientgroup int specifies the newsletter group
|
||||
* @param $idrecipient int specifies the newsletter user
|
||||
*/
|
||||
public function create($idrecipientgroup, $idrecipient) {
|
||||
$idrecipientgroup = Contenido_Security::toInteger($idrecipientgroup);
|
||||
$idrecipient = Contenido_Security::toInteger($idrecipient);
|
||||
|
||||
$this->setWhere("idnewsgroup", $idrecipientgroup);
|
||||
$this->setWhere("idnewsrcp", $idrecipient);
|
||||
$this->query();
|
||||
|
||||
if ($this->next()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$oItem = parent::create();
|
||||
|
||||
$oItem->set("idnewsrcp", $idrecipient);
|
||||
$oItem->set("idnewsgroup", $idrecipientgroup);
|
||||
$oItem->store();
|
||||
|
||||
return $oItem;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes an association
|
||||
* @param $idrecipientgroup int specifies the newsletter group
|
||||
* @param $idrecipient int specifies the newsletter user
|
||||
*/
|
||||
public function remove($idrecipientgroup, $idrecipient) {
|
||||
$idrecipientgroup = Contenido_Security::toInteger($idrecipientgroup);
|
||||
$idrecipient = Contenido_Security::toInteger($idrecipient);
|
||||
|
||||
$this->setWhere("idnewsgroup", $idrecipientgroup);
|
||||
$this->setWhere("idnewsrcp", $idrecipient);
|
||||
$this->query();
|
||||
|
||||
if ($oItem = $this->next()) {
|
||||
$this->delete($oItem->get("idnewsgroupmember"));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes all associations from any newsletter group
|
||||
* @param $idrecipient int specifies the newsletter recipient
|
||||
*/
|
||||
public function removeRecipientFromGroups($idrecipient) {
|
||||
$idrecipient = Contenido_Security::toInteger($idrecipient);
|
||||
|
||||
$this->setWhere("idnewsrcp", $idrecipient);
|
||||
$this->query();
|
||||
|
||||
while ($oItem = $this->next()) {
|
||||
$this->delete($oItem->get("idnewsgroupmember"));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes all associations of a newsletter group
|
||||
* @param $idgroup int specifies the newsletter recipient group
|
||||
*/
|
||||
public function removeGroup($idgroup) {
|
||||
$idgroup = Contenido_Security::toInteger($idgroup);
|
||||
|
||||
$this->setWhere("idnewsgroup", $idgroup);
|
||||
$this->query();
|
||||
|
||||
while ($oItem = $this->next()) {
|
||||
$this->delete($oItem->get("idnewsgroupmember"));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns all recipients in a single group
|
||||
* @param $idrecipientgroup int specifies the newsletter group
|
||||
* @param $asObjects boolean specifies if the function should return objects
|
||||
* @return array RecipientRecipient items
|
||||
*/
|
||||
public function getRecipientsInGroup($idrecipientgroup, $asObjects = true) {
|
||||
$idrecipientgroup = Contenido_Security::toInteger($idrecipientgroup);
|
||||
|
||||
$this->setWhere("idnewsgroup", $idrecipientgroup);
|
||||
$this->query();
|
||||
|
||||
$aObjects = array();
|
||||
|
||||
while ($oItem = $this->next()) {
|
||||
if ($asObjects) {
|
||||
$oRecipient = new Recipient();
|
||||
$oRecipient->loadByPrimaryKey($oItem->get("idnewsrcp"));
|
||||
|
||||
$aObjects[] = $oRecipient;
|
||||
} else {
|
||||
$aObjects[] = $oItem->get("idnewsrcp");
|
||||
}
|
||||
}
|
||||
|
||||
return ($aObjects);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Single RecipientGroup Item
|
||||
*/
|
||||
class RecipientGroupMember extends Item {
|
||||
|
||||
/**
|
||||
* Constructor Function
|
||||
* @param mixed $mId Specifies the ID of item to load
|
||||
*/
|
||||
public function __construct($mId = false) {
|
||||
global $cfg;
|
||||
parent::__construct($cfg["tab"]["news_groupmembers"], "idnewsgroupmember");
|
||||
if ($mId !== false) {
|
||||
$this->loadByPrimaryKey($mId);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,483 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Project:
|
||||
* Contenido Content Management System
|
||||
*
|
||||
* Description:
|
||||
* Newsletter job class
|
||||
*
|
||||
* Requirements:
|
||||
* @con_php_req 5.0
|
||||
*
|
||||
*
|
||||
* @package Contenido Backend classes
|
||||
* @version 1.1
|
||||
* @author Björn Behrens
|
||||
* @copyright four for business AG <www.4fb.de>
|
||||
* @license http://www.contenido.org/license/LIZENZ.txt
|
||||
* @link http://www.4fb.de
|
||||
* @link http://www.contenido.org
|
||||
* @since file available since contenido release <= 4.6
|
||||
*
|
||||
* {@internal
|
||||
* created 2004-08-01
|
||||
* modified 2008-06-30, Dominik Ziegler, add security fix
|
||||
* modified 2011-03-14, Murat Purc, adapted to new GenericDB, partly ported to PHP 5, formatting
|
||||
*
|
||||
* $Id$:
|
||||
* }}
|
||||
*
|
||||
*/
|
||||
if (!defined('CON_FRAMEWORK')) {
|
||||
die('Illegal call');
|
||||
}
|
||||
|
||||
/**
|
||||
* Collection management class
|
||||
*/
|
||||
class cNewsletterJobCollection extends ItemCollection {
|
||||
|
||||
/**
|
||||
* Constructor Function
|
||||
* @param none
|
||||
*/
|
||||
public function __construct() {
|
||||
global $cfg;
|
||||
parent::__construct($cfg["tab"]["news_jobs"], "idnewsjob");
|
||||
$this->_setItemClass("cNewsletterJob");
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a newsletter job
|
||||
* @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 = "") {
|
||||
global $client, $lang, $cfg, $cfgClient, $auth;
|
||||
|
||||
$oNewsletter = new Newsletter;
|
||||
if ($oNewsletter->loadByPrimaryKey($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);
|
||||
|
||||
$oItem = parent::createNewItem();
|
||||
|
||||
$oItem->set("idnews", $iIDNews);
|
||||
$oItem->set("idclient", $client);
|
||||
$oItem->set("idlang", $lang);
|
||||
|
||||
if ($sName == "") {
|
||||
$oItem->set("name", $oNewsletter->get("name"));
|
||||
} else {
|
||||
$oItem->set("name", $sName);
|
||||
}
|
||||
$oItem->set("type", $oNewsletter->get("type"));
|
||||
$oItem->set("use_cronjob", $oNewsletter->get("use_cronjob"));
|
||||
|
||||
$oLang = new cApiLanguage($lang);
|
||||
$oItem->set("encoding", $oLang->get("encoding"));
|
||||
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 . "&";
|
||||
|
||||
$sMessageText = $oNewsletter->get("message");
|
||||
|
||||
// Preventing double lines in mail, you may wish to disable this function on windows servers
|
||||
if (!getSystemProperty("newsletter", "disable-rn-replacement")) {
|
||||
$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}");
|
||||
|
||||
$oItem->set("message_text", $sMessageText);
|
||||
|
||||
if ($oNewsletter->get("type") == "text") {
|
||||
// Text newsletter, no html message
|
||||
$sMessageHTML = "";
|
||||
} else {
|
||||
// HTML newsletter, get article content
|
||||
$sMessageHTML = $oNewsletter->getHTMLMessage();
|
||||
|
||||
if ($sMessageHTML) {
|
||||
$oNewsletter->_replaceTag($sMessageHTML, true, "name", "MAIL_NAME");
|
||||
$oNewsletter->_replaceTag($sMessageHTML, true, "number", "MAIL_NUMBER");
|
||||
$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}");
|
||||
|
||||
// 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")) {
|
||||
$aPluginVars = array();
|
||||
$aPluginVars = call_user_func("recipients_" . $sPlugin . "_wantedVariables");
|
||||
|
||||
foreach ($aPluginVars as $sPluginVar) {
|
||||
$oNewsletter->_replaceTag($sMessageHTML, true, $sPluginVar, "MAIL_" . strtoupper($sPluginVar));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// There was a problem getting html message (maybe article deleted)
|
||||
// Cancel job generation
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
$oItem->set("message_html", $sMessageHTML);
|
||||
|
||||
$oItem->set("newsfrom", $oNewsletter->get("newsfrom"));
|
||||
if ($oNewsletter->get("newsfromname") == "") {
|
||||
$oItem->set("newsfromname", $oNewsletter->get("newsfrom"));
|
||||
} else {
|
||||
$oItem->set("newsfromname", $oNewsletter->get("newsfromname"));
|
||||
}
|
||||
$oItem->set("newsdate", date("Y-m-d H:i:s"), false); //$oNewsletter->get("newsdate"));
|
||||
$oItem->set("dispatch", $oNewsletter->get("dispatch"));
|
||||
$oItem->set("dispatch_count", $oNewsletter->get("dispatch_count"));
|
||||
$oItem->set("dispatch_delay", $oNewsletter->get("dispatch_delay"));
|
||||
|
||||
// Store "send to" info in serialized array (just info)
|
||||
$aSendInfo = array();
|
||||
$aSendInfo[] = $oNewsletter->get("send_to");
|
||||
|
||||
switch ($oNewsletter->get("send_to")) {
|
||||
case "selection":
|
||||
$oGroups = new RecipientGroupCollection;
|
||||
$oGroups->setWhere("idnewsgroup", unserialize($oNewsletter->get("send_ids")), "IN");
|
||||
$oGroups->setOrder("groupname");
|
||||
$oGroups->query();
|
||||
#$oGroups->select("idnewsgroup IN ('" . implode("','", unserialize($oNewsletter->get("send_ids"))) . "')", "", "groupname");
|
||||
|
||||
while ($oGroup = $oGroups->next()) {
|
||||
$aSendInfo[] = $oGroup->get("groupname");
|
||||
}
|
||||
|
||||
unset($oGroup);
|
||||
unset($oGroups);
|
||||
break;
|
||||
case "single":
|
||||
if (is_numeric($oNewsletter->get("send_ids"))) {
|
||||
$oRcp = new Recipient($oNewsletter->get("send_ids"));
|
||||
|
||||
if ($oRcp->get("name") == "") {
|
||||
$aSendInfo[] = $oRcp->get("email");
|
||||
} else {
|
||||
$aSendInfo[] = $oRcp->get("name");
|
||||
}
|
||||
$aSendInfo[] = $oRcp->get("email");
|
||||
|
||||
unset($oRcp);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
}
|
||||
$oItem->set("send_to", serialize($aSendInfo), false);
|
||||
|
||||
$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
|
||||
// Adds log items for all recipients and returns recipient count
|
||||
$oLogs = new cNewsletterLogCollection();
|
||||
$iRecipientCount = $oLogs->initializeJob($oItem->get($oItem->primaryKey), $iIDNews);
|
||||
unset($oLogs);
|
||||
|
||||
$oItem->set("rcpcount", $iRecipientCount);
|
||||
$oItem->set("sendcount", 0);
|
||||
$oItem->set("status", 1); // Waiting for sending; note, that status will be set to 9, if $iRecipientCount = 0 in store() method
|
||||
|
||||
$oItem->store();
|
||||
|
||||
return $oItem;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Overridden delete method to remove job details (logs) from newsletter logs table
|
||||
* before deleting newsletter job
|
||||
*
|
||||
* @param $iItemID int specifies the frontend user group
|
||||
*/
|
||||
public function delete($iItemID) {
|
||||
$oLogs = new cNewsletterLogCollection();
|
||||
$oLogs->delete($iItemID);
|
||||
|
||||
parent::delete($iItemID);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Single NewsletterJob Item
|
||||
*/
|
||||
class cNewsletterJob extends Item {
|
||||
|
||||
/**
|
||||
* Constructor Function
|
||||
* @param mixed $mId Specifies the ID of item to load
|
||||
*/
|
||||
public function __construct($mId = false) {
|
||||
global $cfg;
|
||||
parent::__construct($cfg["tab"]["news_jobs"], "idnewsjob");
|
||||
if ($mId !== false) {
|
||||
$this->loadByPrimaryKey($mId);
|
||||
}
|
||||
}
|
||||
|
||||
public function runJob() {
|
||||
global $cfg, $recipient;
|
||||
|
||||
$iCount = 0;
|
||||
if ($this->get("status") == 2) {
|
||||
// Job is currently running, check start time and restart if
|
||||
// started 5 minutes ago
|
||||
$dStart = strtotime($this->get("started"));
|
||||
$dNow = time();
|
||||
|
||||
if (($dNow - $dStart) > (5 * 60)) {
|
||||
$this->set("status", 1);
|
||||
$this->set("started", "0000-00-00 00:00:00", false);
|
||||
|
||||
$oLogs = new cNewsletterLogCollection();
|
||||
$oLogs->setWhere("idnewsjob", $this->get($this->primaryKey));
|
||||
$oLogs->setWhere("status", "sending");
|
||||
$oLogs->query();
|
||||
|
||||
while ($oLog = $oLogs->next()) {
|
||||
$oLog->set("status", "error (sending)");
|
||||
$oLog->store();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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->store();
|
||||
|
||||
// Initialization
|
||||
$aMessages = array();
|
||||
|
||||
$oLanguage = new cApiLanguage($this->get("idlang"));
|
||||
$sFormatDate = $oLanguage->getProperty("dateformat", "date");
|
||||
$sFormatTime = $oLanguage->getProperty("dateformat", "time");
|
||||
unset($oLanguage);
|
||||
|
||||
if ($sFormatDate == "") {
|
||||
$sFormatDate = "%d.%m.%Y";
|
||||
}
|
||||
if ($sFormatTime == "") {
|
||||
$sFormatTime = "%H:%M";
|
||||
}
|
||||
|
||||
// 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;
|
||||
if ($this->get("type") == "html" && $sMessageHTML != "") {
|
||||
$bIsHTML = true;
|
||||
}
|
||||
|
||||
$bDispatch = false;
|
||||
if ($this->get("dispatch") == 1) {
|
||||
$bDispatch = true;
|
||||
}
|
||||
|
||||
// Single replacements
|
||||
// Replace message tags (text message)
|
||||
$sMessageText = str_replace("MAIL_DATE", strftime($sFormatDate, $dNewsDate), $sMessageText);
|
||||
$sMessageText = str_replace("MAIL_TIME", strftime($sFormatTime, $dNewsDate), $sMessageText);
|
||||
$sMessageText = str_replace("MAIL_NUMBER", $this->get("rcpcount"), $sMessageText);
|
||||
|
||||
// Replace message tags (html message)
|
||||
if ($bIsHTML) {
|
||||
$sMessageHTML = str_replace("MAIL_DATE", strftime($sFormatDate, $dNewsDate), $sMessageHTML);
|
||||
$sMessageHTML = str_replace("MAIL_TIME", strftime($sFormatTime, $dNewsDate), $sMessageHTML);
|
||||
$sMessageHTML = str_replace("MAIL_NUMBER", $this->get("rcpcount"), $sMessageHTML);
|
||||
}
|
||||
|
||||
// Enabling plugin interface
|
||||
$bPluginEnabled = false;
|
||||
if (getSystemProperty("newsletter", "newsletter-recipients-plugin") == "true") {
|
||||
$bPluginEnabled = true;
|
||||
$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");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Get recipients (from log table)
|
||||
if (!is_object($oLogs)) {
|
||||
$oLogs = new cNewsletterLogCollection;
|
||||
} else {
|
||||
$oLogs->resetQuery();
|
||||
}
|
||||
$oLogs->setWhere("idnewsjob", $this->get($this->primaryKey));
|
||||
$oLogs->setWhere("status", "pending");
|
||||
|
||||
if ($bDispatch) {
|
||||
$oLogs->setLimit(0, $this->get("dispatch_count"));
|
||||
}
|
||||
|
||||
$oLogs->query();
|
||||
while ($oLog = $oLogs->next()) {
|
||||
$iCount++;
|
||||
$oLog->set("status", "sending");
|
||||
$oLog->store();
|
||||
|
||||
$sRcpMsgText = $sMessageText;
|
||||
$sRcpMsgHTML = $sMessageHTML;
|
||||
|
||||
$sKey = $oLog->get("rcphash");
|
||||
$sEMail = $oLog->get("rcpemail");
|
||||
$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("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("MAIL_MAIL", $sEMail, $sRcpMsgHTML);
|
||||
$sRcpMsgHTML = str_replace("MAIL_NAME", $oLog->get("rcpname"), $sRcpMsgHTML);
|
||||
}
|
||||
|
||||
if ($bPluginEnabled) {
|
||||
// Don't change name of $recipient variable as it is used in plugins!
|
||||
$recipient = new Recipient();
|
||||
$recipient->loadByPrimaryKey($oLog->get("idnewsrcp"));
|
||||
|
||||
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);
|
||||
|
||||
// Replace tags in html message
|
||||
if ($bIsHTML && $bSendHTML) {
|
||||
$sRcpMsgHTML = str_replace("MAIL_" . strtoupper($sPluginVar), call_user_func("recipients_" . $sPlugin . "_getvalue", $sPluginVar), $sRcpMsgHTML);
|
||||
}
|
||||
}
|
||||
}
|
||||
unset($recipient);
|
||||
}
|
||||
|
||||
$oMail = new PHPMailer();
|
||||
$oMail->CharSet = $sEncoding;
|
||||
$oMail->IsHTML($bIsHTML && $bSendHTML);
|
||||
$oMail->From = $sFrom;
|
||||
$oMail->FromName = $sFromName;
|
||||
$oMail->AddAddress($sEMail);
|
||||
$oMail->Mailer = "mail";
|
||||
$oMail->Subject = $sSubject;
|
||||
|
||||
if ($bIsHTML && $bSendHTML) {
|
||||
$oMail->Body = $sRcpMsgHTML;
|
||||
$oMail->AltBody = $sRcpMsgText . "\n\n";
|
||||
} else {
|
||||
$oMail->Body = $sRcpMsgText . "\n\n";
|
||||
}
|
||||
|
||||
if ($oMail->Send()) {
|
||||
$oLog->set("status", "successful");
|
||||
$oLog->set("sent", date("Y-m-d H:i:s"), false);
|
||||
} else {
|
||||
$oLog->set("status", "error (sending)");
|
||||
}
|
||||
} else {
|
||||
$oLog->set("status", "error (key)");
|
||||
}
|
||||
$oLog->store();
|
||||
}
|
||||
|
||||
$this->set("sendcount", $this->get("sendcount") + $iCount);
|
||||
|
||||
if ($iCount == 0 || !$bDispatch) {
|
||||
// No recipients remaining, job finished
|
||||
$this->set("status", 9);
|
||||
$this->set("finished", date("Y-m-d H:i:s"), false);
|
||||
} else if ($bDispatch) {
|
||||
// Check, if there are recipients remaining - stops job faster
|
||||
$oLogs->resetQuery();
|
||||
$oLogs->setWhere("idnewsjob", $this->get($this->primaryKey));
|
||||
$oLogs->setWhere("status", "pending");
|
||||
$oLogs->setLimit(0, $this->get("dispatch_count"));
|
||||
$oLogs->query();
|
||||
|
||||
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);
|
||||
} else {
|
||||
// No remaining recipients, job finished
|
||||
$this->set("status", 9);
|
||||
$this->set("finished", date("Y-m-d H:i:s"), false);
|
||||
}
|
||||
} else {
|
||||
// Set job back to pending
|
||||
$this->set("status", 1);
|
||||
$this->set("started", "0000-00-00 00:00:00", false);
|
||||
}
|
||||
$this->store();
|
||||
}
|
||||
|
||||
return $iCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Overriden store() method to set status to finished if rcpcount is 0
|
||||
*/
|
||||
public function store() {
|
||||
if ($this->get("rcpcount") == 0) {
|
||||
// No recipients, job finished
|
||||
$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);
|
||||
}
|
||||
|
||||
parent::store();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,243 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Project:
|
||||
* Contenido Content Management System
|
||||
*
|
||||
* Description:
|
||||
* Newsletter log class
|
||||
*
|
||||
* Requirements:
|
||||
* @con_php_req 5.0
|
||||
*
|
||||
*
|
||||
* @package Contenido Backend classes
|
||||
* @version 1.1
|
||||
* @author Björn Behrens
|
||||
* @copyright four for business AG <www.4fb.de>
|
||||
* @license http://www.contenido.org/license/LIZENZ.txt
|
||||
* @link http://www.4fb.de
|
||||
* @link http://www.contenido.org
|
||||
* @since file available since contenido release <= 4.6
|
||||
*
|
||||
* {@internal
|
||||
* created 2004-08-01
|
||||
* modified 2008-06-30, Dominik Ziegler, add security fix
|
||||
* modified 2011-03-14, Murat Purc, adapted to new GenericDB, partly ported to PHP 5, formatting
|
||||
*
|
||||
* $Id$:
|
||||
* }}
|
||||
*
|
||||
*/
|
||||
if (!defined('CON_FRAMEWORK')) {
|
||||
die('Illegal call');
|
||||
}
|
||||
|
||||
/**
|
||||
* Collection management class
|
||||
*/
|
||||
class cNewsletterLogCollection extends ItemCollection {
|
||||
|
||||
/**
|
||||
* Constructor Function
|
||||
* @param none
|
||||
*/
|
||||
public function __construct() {
|
||||
global $cfg;
|
||||
parent::__construct($cfg["tab"]["news_log"], "idnewslog");
|
||||
$this->_setItemClass("cNewsletterLog");
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a single new log item
|
||||
* @param $idnewsjob integer ID of corresponding newsletter send job
|
||||
* @param $idnewsrcp integer ID of recipient
|
||||
* @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) {
|
||||
global $client, $lang, $auth;
|
||||
|
||||
$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);
|
||||
$this->setWhere("idnewsrcp", $idnewsrcp);
|
||||
$this->query();
|
||||
|
||||
if ($oItem = $this->next()) {
|
||||
return $oItem;
|
||||
}
|
||||
|
||||
$oRecipient = new Recipient;
|
||||
if ($oRecipient->loadByPrimaryKey($idnewsrcp)) {
|
||||
$oItem = parent::createNewItem();
|
||||
|
||||
$oItem->set("idnewsjob", $idnewsjob);
|
||||
$oItem->set("idnewsrcp", $idnewsrcp);
|
||||
|
||||
$sEMail = $oRecipient->get("email");
|
||||
$sName = $oRecipient->get("name");
|
||||
|
||||
if ($sName == "") {
|
||||
$oItem->set("rcpname", $sEMail);
|
||||
} else {
|
||||
$oItem->set("rcpname", $sName);
|
||||
}
|
||||
|
||||
$oItem->set("rcpemail", $sEMail);
|
||||
$oItem->set("rcphash", $oRecipient->get("hash"));
|
||||
$oItem->set("rcpnewstype", $oRecipient->get("news_type"));
|
||||
$oItem->set("status", "pending");
|
||||
$oItem->set("created", date("Y-m-d H:i:s"), false);
|
||||
$oItem->store();
|
||||
|
||||
return $oItem;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets all active recipients as specified for the newsletter and adds for
|
||||
* every recipient a log item
|
||||
* @param integer $idnewsjob ID of corresponding newsletter dispatch job
|
||||
* @param integer $idnews ID of newsletter
|
||||
* @return integer Recipient count
|
||||
*/
|
||||
public function initializeJob($idnewsjob, $idnews) {
|
||||
global $cfg;
|
||||
|
||||
$idnewsjob = Contenido_Security::toInteger($idnewsjob);
|
||||
$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");
|
||||
|
||||
switch ($sDestination) {
|
||||
case "all" :
|
||||
$sDistinct = "";
|
||||
$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 . "'";
|
||||
break;
|
||||
case "selection" :
|
||||
$aGroups = unserialize($oNewsletter->get("send_ids"));
|
||||
|
||||
if (is_array($aGroups) && count($aGroups) > 0) {
|
||||
$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 . ")";
|
||||
} else {
|
||||
$sDestination = "unknown";
|
||||
}
|
||||
break;
|
||||
case "single" :
|
||||
$iID = $oNewsletter->get("send_ids");
|
||||
if (is_numeric($iID)) {
|
||||
$sDistinct = "";
|
||||
$sFrom = "";
|
||||
$sSQL = "idnewsrcp = '" . $iID . "'";
|
||||
} else {
|
||||
$sDestination = "unknown";
|
||||
}
|
||||
break;
|
||||
default:
|
||||
$sDestination = "unknown";
|
||||
}
|
||||
unset($oNewsletter);
|
||||
|
||||
if ($sDestination == "unknown") {
|
||||
return 0;
|
||||
} else {
|
||||
$oRecipients = new RecipientCollection;
|
||||
$oRecipients->flexSelect($sDistinct, $sFrom, $sSQL, "", "", "");
|
||||
|
||||
$iRecipients = $oRecipients->count();
|
||||
|
||||
while ($oRecipient = $oRecipients->next()) {
|
||||
$this->create($idnewsjob, $oRecipient->get($oRecipient->primaryKey));
|
||||
}
|
||||
|
||||
return $iRecipients;
|
||||
}
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Overriden delete function to update recipient count if removing recipient from the list
|
||||
* @param integer $idnewslog ID
|
||||
*/
|
||||
public function delete($idnewslog) {
|
||||
$idnewslog = Contenido_Security::toInteger($idnewslog);
|
||||
|
||||
$oLog = new cNewsletterLog($idnewslog);
|
||||
$iIDNewsJob = $oLog->get("idnewsjob");
|
||||
unset($oLog);
|
||||
|
||||
$oJob = new cNewsletterJob($iIDNewsJob);
|
||||
$oJob->set("rcpcount", $oJob->get("rcpcount") - 1);
|
||||
$oJob->store();
|
||||
unset($oJob);
|
||||
|
||||
parent::delete($idnewslog);
|
||||
}
|
||||
|
||||
public function deleteJob($idnewsjob) {
|
||||
$idnewsjob = Contenido_Security::toInteger($idnewsjob);
|
||||
$this->setWhere("idnewsjob", $idnewsjob);
|
||||
$this->query();
|
||||
|
||||
while ($oItem = $this->next()) {
|
||||
$this->delete($oItem->get($oItem->primaryKey));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Single NewsletterLog Item
|
||||
*/
|
||||
class cNewsletterLog extends Item {
|
||||
|
||||
/**
|
||||
* Constructor Function
|
||||
* @param mixed $mId Specifies the ID of item to load
|
||||
*/
|
||||
public function __construct($mId = false) {
|
||||
global $cfg;
|
||||
parent::__construct($cfg["tab"]["news_log"], "idnewslog");
|
||||
if ($mId !== false) {
|
||||
$this->loadByPrimaryKey($mId);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,998 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Project:
|
||||
* Contenido Content Management System
|
||||
*
|
||||
* Description:
|
||||
* Newsletter recipient class
|
||||
*
|
||||
* Requirements:
|
||||
* @con_php_req 5.0
|
||||
*
|
||||
*
|
||||
* @package Contenido Backend classes
|
||||
* @version 1.1
|
||||
* @author Björn Behrens
|
||||
* @copyright four for business AG <www.4fb.de>
|
||||
* @license http://www.contenido.org/license/LIZENZ.txt
|
||||
* @link http://www.4fb.de
|
||||
* @link http://www.contenido.org
|
||||
* @since file available since contenido release <= 4.6
|
||||
*
|
||||
* {@internal
|
||||
* created 2004-08-01
|
||||
* modified 2008-06-30, Dominik Ziegler, add security fix
|
||||
* modified 2011-03-14, Murat Purc, adapted to new GenericDB, partly ported to PHP 5, formatting
|
||||
*
|
||||
* $Id$:
|
||||
* }}
|
||||
*
|
||||
*/
|
||||
if (!defined('CON_FRAMEWORK')) {
|
||||
die('Illegal call');
|
||||
}
|
||||
|
||||
/**
|
||||
* Newsletter management class
|
||||
*/
|
||||
class NewsletterCollection extends ItemCollection {
|
||||
|
||||
/**
|
||||
* Constructor Function
|
||||
* @param none
|
||||
*/
|
||||
public function __construct() {
|
||||
global $cfg;
|
||||
parent::__construct($cfg["tab"]["news"], "idnews");
|
||||
$this->_setItemClass("Newsletter");
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new newsletter
|
||||
* @param $name string specifies the newsletter name
|
||||
*/
|
||||
public function create($sName) {
|
||||
global $client, $lang, $auth;
|
||||
|
||||
$sName = Contenido_Security::escapeDB($sName, null);
|
||||
$client = Contenido_Security::toInteger($client);
|
||||
$lang = Contenido_Security::toInteger($lang);
|
||||
|
||||
// Check if the newsletter name already exists
|
||||
$this->resetQuery;
|
||||
$this->setWhere("idclient", $client);
|
||||
$this->setWhere("idlang", $lang);
|
||||
$this->setWhere("name", $sName);
|
||||
$this->query();
|
||||
|
||||
if ($this->next()) {
|
||||
return $this->create($sName . "_" . substr(md5(rand()), 0, 10));
|
||||
}
|
||||
|
||||
$oItem = parent::createNewItem();
|
||||
$oItem->set("idclient", $client);
|
||||
$oItem->set("idlang", $lang);
|
||||
$oItem->set("name", $sName);
|
||||
$oItem->set("created", date("Y-m-d H:i:s"), false);
|
||||
$oItem->set("author", Contenido_Security::escapeDB($auth->auth["uid"], null));
|
||||
|
||||
$oItem->store();
|
||||
|
||||
return $oItem;
|
||||
}
|
||||
|
||||
/**
|
||||
* Duplicates the newsletter specified by $itemID
|
||||
* @param $itemID integer specifies the newsletter id
|
||||
*/
|
||||
public function duplicate($iItemID) {
|
||||
global $client, $lang, $auth;
|
||||
|
||||
$client = Contenido_Security::toInteger($client);
|
||||
$lang = Contenido_Security::toInteger($lang);
|
||||
|
||||
cInclude("includes", "functions.con.php");
|
||||
|
||||
$oBaseItem = new Newsletter();
|
||||
$oBaseItem->loadByPrimaryKey($iItemID);
|
||||
|
||||
$oItem = parent::createNewItem();
|
||||
$oItem->set("name", $oBaseItem->get("name") . "_" . substr(md5(rand()), 0, 10));
|
||||
|
||||
$iIDArt = 0;
|
||||
if ($oBaseItem->get("type") == "html" && $oBaseItem->get("idart") > 0 && $oBaseItem->get("template_idart") > 0) {
|
||||
$oClientLang = new cApiClientLanguage(false, $client, $lang);
|
||||
|
||||
if ($oClientLang->getProperty("newsletter", "html_newsletter") == "true") {
|
||||
$iIDArt = conCopyArticle($oBaseItem->get("idart"),
|
||||
$oClientLang->getProperty("newsletter", "html_newsletter_idcat"),
|
||||
sprintf(i18n("Newsletter: %s", "cl_newsletter"), $oItem->get("name")));
|
||||
conMakeOnline($iIDArt, $lang); // Article has to be online for sending...
|
||||
}
|
||||
unset($oClientLang);
|
||||
}
|
||||
$oItem->set("idart", $iIDArt);
|
||||
$oItem->set("template_idart", $oBaseItem->get("template_idart"));
|
||||
$oItem->set("idclient", $client);
|
||||
$oItem->set("idlang", $lang);
|
||||
$oItem->set("welcome", 0);
|
||||
$oItem->set("type", $oBaseItem->get("type"));
|
||||
$oItem->set("subject", $oBaseItem->get("subject"));
|
||||
$oItem->set("message", $oBaseItem->get("message"));
|
||||
$oItem->set("newsfrom", $oBaseItem->get("newsfrom"));
|
||||
$oItem->set("newsfromname", $oBaseItem->get("newsfromname"));
|
||||
$oItem->set("newsdate", date("Y-m-d H:i:s"), false); // But more or less deprecated
|
||||
$oItem->set("use_cronjob", $oBaseItem->get("use_cronjob"));
|
||||
$oItem->set("send_to", $oBaseItem->get("send_to"));
|
||||
$oItem->set("send_ids", $oBaseItem->get("send_ids"));
|
||||
$oItem->set("dispatch", $oBaseItem->get("dispatch"));
|
||||
$oItem->set("dispatch_count", $oBaseItem->get("dispatch_count"));
|
||||
$oItem->set("dispatch_delay", $oBaseItem->get("dispatch_delay"));
|
||||
$oItem->set("author", $auth->auth["uid"]);
|
||||
$oItem->set("created", date("Y-m-d H:i:s"), false);
|
||||
|
||||
// Copy properties, runtime on-demand allocation of the properties object
|
||||
if (!is_object($this->properties)) {
|
||||
$this->properties = new PropertyCollection;
|
||||
}
|
||||
$this->properties->setWhere("idclient", $client);
|
||||
$this->properties->setWhere("itemtype", $this->primaryKey);
|
||||
$this->properties->setWhere("itemid", $iItemID);
|
||||
$this->properties->query();
|
||||
|
||||
while ($oPropertyItem = $this->properties->next()) {
|
||||
$oItem->setProperty($oPropertyItem->get("type"), $oPropertyItem->get("name"), $oPropertyItem->get("value"));
|
||||
}
|
||||
|
||||
$oItem->store();
|
||||
|
||||
return $oItem;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Single Newsletter Item
|
||||
*/
|
||||
class Newsletter extends Item {
|
||||
|
||||
/**
|
||||
* @var string Error storage
|
||||
* @access private
|
||||
*/
|
||||
protected $_sError;
|
||||
|
||||
/**
|
||||
* Constructor Function
|
||||
* @param mixed $mId Specifies the ID of item to load
|
||||
*/
|
||||
public function __construct($mId = false) {
|
||||
global $cfg;
|
||||
parent::__construct($cfg["tab"]["news"], "idnews");
|
||||
$this->_sError = "";
|
||||
if ($mId !== false) {
|
||||
$this->loadByPrimaryKey($mId);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Overriden store()-Method to set modified and modifiedby data and
|
||||
* to ensure, that there is only one welcome newsletter
|
||||
*/
|
||||
public function store() {
|
||||
global $client, $lang, $auth;
|
||||
|
||||
$client = Contenido_Security::toInteger($client);
|
||||
$lang = Contenido_Security::toInteger($lang);
|
||||
|
||||
$this->set("modified", date("Y-m-d H:i:s"), false);
|
||||
$this->set("modifiedby", $auth->auth["uid"]);
|
||||
|
||||
if ($this->get("welcome") == 1) {
|
||||
$oItems = new NewsletterCollection();
|
||||
$oItems->setWhere("idclient", $client);
|
||||
$oItems->setWhere("idlang", $lang);
|
||||
$oItems->setWhere("welcome", 1);
|
||||
$oItems->setWhere("idnews", $this->get("idnews"), "<>");
|
||||
$oItems->query();
|
||||
|
||||
while ($oItem = $oItems->next()) {
|
||||
$oItem->set("welcome", 0);
|
||||
$oItem->store();
|
||||
}
|
||||
unset($oItem);
|
||||
unset($oItems);
|
||||
}
|
||||
|
||||
parent::store();
|
||||
}
|
||||
|
||||
/**
|
||||
* Replaces newsletter tag (e.g. MAIL_NAME) with data.
|
||||
* If code is just text using str_replace; if it is HTML by using regular expressions
|
||||
* @param string sCode Code, where the tags will be replaced (by reference)
|
||||
* @param bool bIsHTML Is code HTML?
|
||||
* @param string sField Field name, without MAIL_ (e.g. just "name")
|
||||
* @param string sData Data
|
||||
* @access private
|
||||
*/
|
||||
public function _replaceTag(&$sCode, $bIsHTML, $sField, $sData) {
|
||||
if ($sCode && !$bIsHTML) {
|
||||
$sCode = str_replace("MAIL_" . strtoupper($sField), $sData, $sCode);
|
||||
} else if ($sCode) {
|
||||
// Extract certain tag
|
||||
$sRegExp = '/\[mail\s*([^]]+)\s*name=(?:"|")' . $sField . '(?:"|")\s*(.*?)\s*\]((?:.|\s)+?)\[\/mail\]/i';
|
||||
$aMatch = array();
|
||||
$iMatches = preg_match($sRegExp, $sCode, $aMatch);
|
||||
|
||||
if ($iMatches > 0) {
|
||||
// $aMatch contains parameter info from left [1] or right [2] to name="field"
|
||||
$sParameter = $aMatch[1] . $aMatch[2];
|
||||
$sMessage = $aMatch[3];
|
||||
$sRegExp = '/\s*(.*?)\s*=\s*(?:"|")(.*?)(?:"|")\s*/i';
|
||||
$aMatch = array();
|
||||
|
||||
if (preg_match_all($sRegExp, $sParameter, $aMatch) > 0) {
|
||||
// Store parameter data as assoziative array
|
||||
$aParameter = array_combine($aMatch[1], $aMatch[2]);
|
||||
unset($aMatch); // $aMatch not needed anymore
|
||||
|
||||
if (!array_key_exists("type", $aParameter)) {
|
||||
$aParameter["type"] = "text";
|
||||
}
|
||||
|
||||
switch ($aParameter["type"]) {
|
||||
case "link":
|
||||
# TODO: Works everything fine?
|
||||
# The current code makes it possible to do something like
|
||||
# [mail ...]Some text here, then the link: [MAIL_STOP] and more text[/mail]
|
||||
#
|
||||
# If the other lines will be used, you don't need to
|
||||
# set [MAIL_xy] and the message between the [mail]-tags will
|
||||
# be used as link text (instead of using the tag parameter "text")
|
||||
|
||||
$sText = $aParameter["text"];
|
||||
|
||||
if ($sText == "") {
|
||||
$sText = $sData;
|
||||
}
|
||||
if ($sMessage == "") {
|
||||
$sMessage = $sData;
|
||||
}
|
||||
|
||||
// Remove not needed parameters from the parameters list
|
||||
// everything else goes into the link as parameters
|
||||
unset($aParameter["type"]);
|
||||
unset($aParameter["text"]);
|
||||
|
||||
$sParameter = "";
|
||||
if (count($aParameter) > 0) {
|
||||
foreach ($aParameter as $sKey => $sValue) {
|
||||
$sParameter .= ' ' . $sKey . '="' . $sValue . '"';
|
||||
}
|
||||
}
|
||||
$sMessage = str_replace("MAIL_" . strtoupper($sField), '<a href="' . clHtmlEntities($sData) . '"' . $sParameter . '>' . $sText . '</a>', $sMessage);
|
||||
#$sMessage = '<a href="'.clHtmlEntities($sData).'"'.$sParameter.'>'.$sMessage.'</a>';
|
||||
break;
|
||||
default:
|
||||
$sMessage = str_replace("MAIL_" . strtoupper($sField), $sData, $sMessage);
|
||||
#$sMessage = $sData;
|
||||
}
|
||||
|
||||
$sRegExp = '/\[mail[^]]+name=(?:"|")' . $sField . '(?:"|").*?\].*?\[\/mail\]/is';
|
||||
$sCode = preg_replace($sRegExp, $sMessage, $sCode, -1);
|
||||
// Just to replace "text"-tags in HTML message also, just in case...
|
||||
$sCode = str_replace("MAIL_" . strtoupper($sField), $sData, $sCode);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Replaces relative URL for url, src or href with absolute client htmlpath
|
||||
*
|
||||
* @author Ortwin Pinke <o.pinke@conlite.org>
|
||||
* @since CL 2.0
|
||||
*
|
||||
* @global int $client
|
||||
* @global array $cfgClient
|
||||
* @param string $sUrl
|
||||
* @return string
|
||||
*/
|
||||
protected function _callbackReplaceUrl($sUrl) {
|
||||
global $client, $cfgClient;
|
||||
$returnUrl = '';
|
||||
print_r($sUrl);
|
||||
if ($sUrl[1] == "url") {
|
||||
if (empty($sUrl[3])) {
|
||||
$returnUrl = $sUrl[1] . "(" . $sUrl[2];
|
||||
$returnUrl .= $cfgClient[$client]['path']['htmlpath'];
|
||||
$returnUrl .= ltrim(ltrim($sUrl[4], "."), "/");
|
||||
$returnUrl .= $sUrl[2] . ")";
|
||||
} else {
|
||||
$returnUrl = $sUrl[0];
|
||||
}
|
||||
} else if (empty($sUrl[2])) {
|
||||
$returnUrl = $sUrl[1] . '="';
|
||||
$returnUrl .= $cfgClient[$client]['path']['htmlpath'];
|
||||
$returnUrl .= ltrim(ltrim($sUrl[3], "."), "/") . '"';
|
||||
} else {
|
||||
$returnUrl = $sUrl[0];
|
||||
}
|
||||
|
||||
return $returnUrl;
|
||||
}
|
||||
|
||||
/* TODO: HerrB: Remove or insert some functionality */
|
||||
|
||||
protected function _getNewsletterTagData($sHTML, $sTag) {
|
||||
//$sRegExp = "/<newsletter[^>](.*?)>.*?<\/newsletter>/i";
|
||||
//$sRegExp = "/\[mail[^\]](.*?)>.*?\[\/mail\]/i";
|
||||
#\[mail[^\]]((name="(?P<name>.*?)")|(type="(?P<type>.*?)"))\](?P<content>.*?)\[\/mail\]
|
||||
#\[mail[^\]]((name=(?P<name>[^"]*.*?[^"]*))|(type="(?P<type>.*?)"))\](?P<content>.*?)\[\/mail\]
|
||||
|
||||
/* RegExp explanation:
|
||||
* Match the character "[" literally <EFBFBD>\[<EFBFBD>
|
||||
* Match the characters "mail" literally <EFBFBD>mail<EFBFBD>
|
||||
* Match "whitespace characters" (spaces, tabs, line breaks, etc.) after "mail" <EFBFBD>\s*<EFBFBD>
|
||||
* Match the regular expression below and capture its match into backreference number 1 <EFBFBD>([^]]+)<EFBFBD>
|
||||
* Match any character that is not a "]" <EFBFBD>[^]]+<EFBFBD>
|
||||
* Between one and unlimited times, as many times as possible, giving back as needed (greedy) <EFBFBD>+<EFBFBD>
|
||||
* Match the character "]" literally <EFBFBD>\]<EFBFBD>
|
||||
* Match the regular expression below and capture its match into backreference number 2 <EFBFBD>((?:.|\s)+?)<EFBFBD>
|
||||
* Match the regular expression below <EFBFBD>(?:.|\s)+?<EFBFBD>
|
||||
* Between one and unlimited times, as few times as possible, expanding as needed (lazy) <EFBFBD>+?<EFBFBD>
|
||||
* Match either the regular expression below (attempting the next alternative only if this one fails) <EFBFBD>.<EFBFBD>
|
||||
* Match any single character that is not a line break character <EFBFBD>.<EFBFBD>
|
||||
* Or match regular expression number 2 below (the entire group fails if this one fails to match) <EFBFBD>\s<>
|
||||
* Match a single character that is a "whitespace character" (spaces, tabs, line breaks, etc.) <EFBFBD>\s<>
|
||||
* Match the character "[" literally <EFBFBD>\[<EFBFBD>
|
||||
* Match the characters "/mail" literally <EFBFBD>/mail<EFBFBD>
|
||||
* Match the character "]" literally <EFBFBD>\]<EFBFBD>
|
||||
* Ignore case (i), . includes new lines (s)
|
||||
* */
|
||||
|
||||
/*
|
||||
$sRegExp = '/\[mail\s*([^]]+)\]((?:.|\s)+?)\[\/mail\]/is';
|
||||
$aMatch = array ();
|
||||
preg_match_all($sRegExp, $sHTML, $aMatch, PREG_SET_ORDER);
|
||||
print_r ($aMatch);
|
||||
|
||||
// Auf bestimmten Typ matchen
|
||||
$sRegExp = '/\[mail.*?name="name".*?\]((?:.|\s)+?)\[\/mail\]/is';
|
||||
$aMatch = array ();
|
||||
preg_match_all($sRegExp, $sHTML, $aMatch, PREG_SET_ORDER);
|
||||
print_r ($aMatch); */
|
||||
|
||||
// Parameter auseinandernehmen (ohne PREG_SET_ORDER)
|
||||
#$sRegExp = '/\s*(.*?)\s*=\s*"(.*?)"\s*/i';
|
||||
#$aMatch = array ();
|
||||
#preg_match_all($sRegExp, $sHTML, $aMatch);
|
||||
#print_r ($aMatch);
|
||||
}
|
||||
|
||||
protected function _deChunkHTTPBody($sHeader, $sBody, $sEOL = "\r\n") {
|
||||
// Based on code from jbr at ya-right dot com, posted on http://www.php.net
|
||||
// as user comment on fsockopen documentation (2007-05-01)
|
||||
// Analyze header
|
||||
$aParts = preg_split("/\r?\n/", $sHeader, -1, PREG_SPLIT_NO_EMPTY);
|
||||
|
||||
$aHeader = array();
|
||||
for ($i = 0; $i < sizeof($aParts); $i++) {
|
||||
if ($i != 0) {
|
||||
$iPos = strpos($aParts[$i], ':');
|
||||
$sParameter = strtolower(str_replace(' ', '', substr($aParts[$i], 0, $iPos)));
|
||||
$sValue = trim(substr($aParts[$i], ($iPos + 1)));
|
||||
} else {
|
||||
$sField = 'status';
|
||||
$aParameters = explode(' ', $aParts[$i]);
|
||||
$sParameter = $aParameters[1];
|
||||
}
|
||||
|
||||
if ($sParameter == 'set-cookie') {
|
||||
$aHeader['cookies'][] = $sValue;
|
||||
} else if ($sParameter == 'content-type') {
|
||||
if (($iPos = strpos($sValue, ';')) !== false) {
|
||||
$aHeader[$sParameter] = substr($sValue, 0, $iPos);
|
||||
} else {
|
||||
$aHeader[$sParameter] = $sValue;
|
||||
}
|
||||
} else {
|
||||
$aHeader[$sParameter] = $sValue;
|
||||
}
|
||||
}
|
||||
|
||||
// Get dechunked and decompressed body
|
||||
$iEOLLen = strlen($sEOL);
|
||||
|
||||
$sBuffer = '';
|
||||
if (isset($aHeader['transfer-encoding']) && $aHeader['transfer-encoding'] == 'chunked') {
|
||||
do {
|
||||
$sBody = ltrim($sBody);
|
||||
$iPos = strpos($sBody, $sEOL);
|
||||
$iDataLen = hexdec(substr($sBody, 0, $iPos));
|
||||
|
||||
if (isset($aHeader['content-encoding'])) {
|
||||
$sBuffer .= gzinflate(substr($sBody, ($iPos + $iEOLLen + 10), $iDataLen));
|
||||
} else {
|
||||
$sBuffer .= substr($sBody, ($iPos + $iEOLLen), $iDataLen);
|
||||
}
|
||||
|
||||
$sBody = substr($sBody, ($iPos + $iDataLen + $iEOLLen));
|
||||
$sRemaining = trim($sBody);
|
||||
} while (!empty($sRemaining));
|
||||
} else if (isset($aHeader['content-encoding'])) {
|
||||
$sBuffer = gzinflate(substr($sBody, 10));
|
||||
} else {
|
||||
$sBuffer = $sBody; // Not chunked, not compressed
|
||||
}
|
||||
|
||||
return $sBuffer;
|
||||
}
|
||||
|
||||
/**
|
||||
* If newsletter is HTML newsletter and necessary data available
|
||||
* returns final HTML message
|
||||
* @return string HTML message
|
||||
*/
|
||||
public function getHTMLMessage() {
|
||||
global $lang, $client, $cfgClient, $contenido;
|
||||
|
||||
if ($this->get("type") == "html" && $this->get("idart") > 0 && $this->htmlArticleExists()) {
|
||||
|
||||
// Article ID
|
||||
$iIDArt = $this->get("idart");
|
||||
|
||||
// Category ID
|
||||
$oClientLang = new cApiClientLanguage(false, $client, $lang);
|
||||
$iIDCat = $oClientLang->getProperty("newsletter", "html_newsletter_idcat");
|
||||
unset($oClientLang);
|
||||
|
||||
// Get http username and password, if frontend is protected
|
||||
$oClient = new cApiClient($client);
|
||||
$sHTTPUserName = $oClient->getProperty("newsletter", "html_username");
|
||||
$sHTTPPassword = $oClient->getProperty("newsletter", "html_password");
|
||||
unset($oClient);
|
||||
|
||||
// Get HTML
|
||||
if ($iIDArt > 0 && $iIDCat > 0) {
|
||||
// Check, if newsletter is online and set temporarely online, otherwise
|
||||
$bSetOffline = false;
|
||||
$oArticles = new cApiArticleLanguageCollection;
|
||||
$oArticles->setWhere("idlang", $this->get("idlang"));
|
||||
$oArticles->setWhere("idart", $this->get("idart"));
|
||||
$oArticles->query();
|
||||
|
||||
if ($oArticle = $oArticles->next()) {
|
||||
if ($oArticle->get("online") == 0) {
|
||||
$bSetOffline = true;
|
||||
$oArticle->set("online", 1);
|
||||
$oArticle->store();
|
||||
}
|
||||
unset($oArticle);
|
||||
}
|
||||
unset($oArticles);
|
||||
|
||||
$sFile = "front_content.php?client=$client&lang=$lang&idcat=$iIDCat&idart=$iIDArt&noex=1&send=1";
|
||||
$aURL = parse_url($cfgClient[$client]['path']['htmlpath']);
|
||||
|
||||
// TODO: Other schemes than http should be tested before use!
|
||||
if ($aURL["scheme"] == "https") {
|
||||
$iPort = 443;
|
||||
$sTarget = "ssl://" . $aURL["host"];
|
||||
} else {
|
||||
$iPort = 80;
|
||||
$sTarget = $aURL["host"];
|
||||
}
|
||||
if ($aURL["port"]) {
|
||||
$iPort = $aURL["port"];
|
||||
}
|
||||
|
||||
$iErrorNo = 0;
|
||||
$sErrorMsg = "";
|
||||
if ($iHandler = fsockopen($sTarget, $iPort, $iErrorNo, $sErrorMsg, 30)) {
|
||||
// If you use HTTP 1.1 you may get chunked data... you could solve
|
||||
// this easily by using HTTP 1.0, but then you get a problem with
|
||||
// virtual servers, as HTTP 1.0 doesn't use the host information...
|
||||
fputs($iHandler, "GET " . $aURL["path"] . $sFile . " HTTP/1.1\r\n");
|
||||
fputs($iHandler, "Host: " . $aURL["host"] . "\r\n");
|
||||
|
||||
// Maybe the website has been protected using .htaccess, then login
|
||||
if ($sHTTPUserName != "" && $sHTTPPassword != "") {
|
||||
fputs($iHandler, "Authorization: Basic " . base64_encode("$sHTTPUserName:$sHTTPPassword") . "\r\n");
|
||||
}
|
||||
|
||||
fputs($iHandler, "Referer: http://" . $aURL["host"] . "\r\n");
|
||||
fputs($iHandler, "User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)\r\n");
|
||||
fputs($iHandler, "Connection: close\r\n\r\n");
|
||||
|
||||
// Get the HTTP header and body separately
|
||||
$sHTML = "";
|
||||
$sHeader = "";
|
||||
$bBody = false;
|
||||
while (!feof($iHandler)) {
|
||||
// $sLine = fgets($iHandler, 4096);
|
||||
$sLine = fgets($iHandler, 1024);
|
||||
if ($bBody) {
|
||||
$sHTML .= $sLine;
|
||||
} else if ($sLine == "\r\n") {
|
||||
$bBody = true;
|
||||
} else {
|
||||
$sHeader .= $sLine;
|
||||
}
|
||||
}
|
||||
fclose($iHandler);
|
||||
|
||||
$sHTML = $this->_deChunkHTTPBody($sHeader, $sHTML);
|
||||
|
||||
// If someone likes to use anchors in html newsletters (*sigh*)
|
||||
// the base href tag has to be removed - that means, we have to fix
|
||||
// all source paths manually...
|
||||
if (getEffectiveSetting('newsletter', 'remove_base_tag', "false") == "true") {
|
||||
// Remove base tag
|
||||
$sHTML = preg_replace('/<base href=(.*?)>/is', '', $sHTML, 1);
|
||||
$sHTML = preg_replace_callback('/(url)\((\'|\")?(http:\/\/|https:\/\/|ftp:\/\/)?([A-Za-z0-9#\.?\-=_&\/]*)[\'|\"]?\)/', array($this, "_callbackReplaceUrl"), $sHTML);
|
||||
$sHTML = preg_replace_callback('/\b(src|href|ftp)[ ]*=[ ]*"(http:\/\/|https:\/\/|ftp:\/\/)?([A-Za-z0-9#\.?\-=_&\/]*)"/', array($this, "_callbackReplaceUrl"), $sHTML);
|
||||
// Now replace anchor tags to the newsletter article itself just by the anchor
|
||||
$sHTML = str_replace($cfgClient[$client]['path']['htmlpath'] . "front_content.php?idart=" . $iIDArt . "#", "#", $sHTML);
|
||||
}
|
||||
|
||||
$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)", "cl_newsletter");
|
||||
} else {
|
||||
$sErrorText = "There was a problem getting the newsletter article using http. Error: %s (%s)";
|
||||
}
|
||||
|
||||
$this->_sError = sprintf($sErrorText, $sErrorMsg, $iErrorNo);
|
||||
$sReturn = false;
|
||||
}
|
||||
|
||||
// Set previously offline article back to offline
|
||||
if ($bSetOffline) {
|
||||
$oArticles = new cApiArticleLanguageCollection();
|
||||
$oArticles->setWhere("idlang", $this->get("idlang"));
|
||||
$oArticles->setWhere("idart", $this->get("idart"));
|
||||
$oArticles->query();
|
||||
|
||||
if ($oArticle = $oArticles->next()) {
|
||||
$oArticle->set("online", 0);
|
||||
$oArticle->store();
|
||||
}
|
||||
unset($oArticle);
|
||||
unset($oArticles);
|
||||
}
|
||||
|
||||
return $sReturn;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks, if html newsletter article still exists
|
||||
* @return bool
|
||||
*/
|
||||
public function htmlArticleExists() {
|
||||
if ($this->get("idart") > 0) {
|
||||
$oArticles = new cApiArticleLanguageCollection();
|
||||
$oArticles->setWhere("idlang", $this->get("idlang"));
|
||||
$oArticles->setWhere("idart", $this->get("idart"));
|
||||
$oArticles->query();
|
||||
|
||||
if ($oArticles->count() > 0) {
|
||||
$bReturn = true;
|
||||
} else {
|
||||
$bReturn = false;
|
||||
}
|
||||
|
||||
unset($oArticles);
|
||||
} else {
|
||||
$bReturn = false;
|
||||
}
|
||||
|
||||
return $bReturn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends test newsletter directly to specified email address
|
||||
* @param integer $iIDCatArt idcatart of newsletter handler article
|
||||
* @param string $sEMail Recipient email address
|
||||
* @param string $sName Optional: Recipient name
|
||||
* @param bool $bSimulatePlugin If recipient plugin activated, include plugins
|
||||
* and simulate values from plugins
|
||||
* @param string $sEncoding Message (and header) encoding, e.g. iso-8859-1
|
||||
*/
|
||||
public function sendEMail($iIDCatArt, $sEMail, $sName = "", $bSimulatePlugins = true, $sEncoding = "iso-8859-1") {
|
||||
global $lang, $client, $cfg, $cfgClient, $contenido;
|
||||
|
||||
// Initialization
|
||||
if ($sName == "") {
|
||||
$sName = $sEMail;
|
||||
}
|
||||
|
||||
$oLanguage = new cApiLanguage($lang);
|
||||
$sFormatDate = $oLanguage->getProperty("dateformat", "date");
|
||||
$sFormatTime = $oLanguage->getProperty("dateformat", "time");
|
||||
unset($oLanguage);
|
||||
|
||||
if ($sFormatDate == "") {
|
||||
$sFormatDate = "%d.%m.%Y";
|
||||
}
|
||||
if ($sFormatTime == "") {
|
||||
$sFormatTime = "%H:%M";
|
||||
}
|
||||
|
||||
// Get newsletter data
|
||||
$sFrom = $this->get("newsfrom");
|
||||
$sFromName = $this->get("newsfromname");
|
||||
if ($sFromName == "") {
|
||||
$sFromName = $sFrom;
|
||||
}
|
||||
$sSubject = $this->get("subject");
|
||||
$sMessageText = $this->get("message");
|
||||
|
||||
$bIsHTML = false;
|
||||
if ($this->get("type") == "html") {
|
||||
$sMessageHTML = $this->getHTMLMessage();
|
||||
|
||||
if ($sMessageHTML === false) {
|
||||
// There was a problem getting the html message (maybe article
|
||||
// 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", "cl_newsletter");
|
||||
} else {
|
||||
$sError = "Newsletter to %s could not be sent: No html message available";
|
||||
}
|
||||
$this->_sError = $sName . " (" . $sEMail . "): " . sprintf($sError, $sEMail);
|
||||
return false;
|
||||
} else {
|
||||
$bIsHTML = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Preventing double lines in mail, you may wish to disable this function on windows servers
|
||||
if (!getSystemProperty("newsletter", "disable-rn-replacement")) {
|
||||
$sMessageText = str_replace("\r\n", "\n", $sMessageText);
|
||||
}
|
||||
|
||||
// Simulate key, an alphanumeric string of 30 characters
|
||||
$sKey = str_repeat("key", 10);
|
||||
$sPath = $cfgClient[$client]["path"]["htmlpath"] . "front_content.php?changelang=" . $lang . "&idcatart=" . $iIDCatArt . "&";
|
||||
|
||||
// Replace message tags (text message)
|
||||
$this->_replaceTag($sMessageText, false, "name", $sName);
|
||||
$this->_replaceTag($sMessageText, false, "number", 1);
|
||||
$this->_replaceTag($sMessageText, false, "date", strftime($sFormatDate));
|
||||
$this->_replaceTag($sMessageText, false, "time", strftime($sFormatTime));
|
||||
$this->_replaceTag($sMessageText, false, "unsubscribe", $sPath . "unsubscribe=" . $sKey);
|
||||
$this->_replaceTag($sMessageText, false, "change", $sPath . "change=" . $sKey);
|
||||
$this->_replaceTag($sMessageText, false, "stop", $sPath . "stop=" . $sKey);
|
||||
$this->_replaceTag($sMessageText, false, "goon", $sPath . "goon=" . $sKey);
|
||||
|
||||
// Replace message tags (html message)
|
||||
if ($bIsHTML) {
|
||||
$this->_replaceTag($sMessageHTML, true, "name", $sName);
|
||||
$this->_replaceTag($sMessageHTML, true, "number", 1);
|
||||
$this->_replaceTag($sMessageHTML, true, "date", strftime($sFormatDate));
|
||||
$this->_replaceTag($sMessageHTML, true, "time", strftime($sFormatTime));
|
||||
$this->_replaceTag($sMessageHTML, true, "unsubscribe", $sPath . "unsubscribe=" . $sKey);
|
||||
$this->_replaceTag($sMessageHTML, true, "change", $sPath . "change=" . $sKey);
|
||||
$this->_replaceTag($sMessageHTML, true, "stop", $sPath . "stop=" . $sKey);
|
||||
$this->_replaceTag($sMessageHTML, true, "goon", $sPath . "goon=" . $sKey);
|
||||
}
|
||||
|
||||
if ($bSimulatePlugins) {
|
||||
// Enabling plugin interface
|
||||
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")) {
|
||||
$aPluginVars = array();
|
||||
$aPluginVars = call_user_func("recipients_" . $sPlugin . "_wantedVariables");
|
||||
|
||||
foreach ($aPluginVars as $sPluginVar) {
|
||||
// Replace tags in text message
|
||||
$this->_replaceTag($sMessageText, false, $sPluginVar, ":: " . $sPlugin . ": " . $sPluginVar . " ::");
|
||||
// Replace tags in html message
|
||||
if ($bIsHTML) {
|
||||
$this->_replaceTag($sMessageHTML, true, $sPluginVar, ":: " . $sPlugin . ": " . $sPluginVar . " ::");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
setSystemProperty("newsletter", "newsletter-recipients-plugin", "false");
|
||||
}
|
||||
}
|
||||
|
||||
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", "cl_newsletter");
|
||||
} else {
|
||||
$sError = "Newsletter to %s could not be sent: No valid e-mail address";
|
||||
}
|
||||
$this->_sError = $sName . " (" . $sEMail . "): " . sprintf($sError, $sEMail);
|
||||
return false;
|
||||
} else {
|
||||
$oMail = new PHPMailer();
|
||||
$oMail->CharSet = $sEncoding;
|
||||
$oMail->IsHTML($bIsHTML);
|
||||
$oMail->From = $sFrom;
|
||||
$oMail->FromName = $sFromName;
|
||||
$oMail->AddAddress($sEMail);
|
||||
$oMail->Mailer = "mail";
|
||||
$oMail->Subject = $sSubject;
|
||||
|
||||
if ($bIsHTML) {
|
||||
$oMail->Body = $sMessageHTML;
|
||||
$oMail->AltBody = $sMessageText . "\n\n";
|
||||
} else {
|
||||
$oMail->Body = $sMessageText . "\n\n";
|
||||
}
|
||||
|
||||
if (!$oMail->Send()) {
|
||||
if ($contenido) { // Use i18n only in backend
|
||||
$sError = i18n("Newsletter to %s could not be sent", "cl_newsletter");
|
||||
} else {
|
||||
$sError = "Newsletter to %s could not be sent";
|
||||
}
|
||||
$this->_sError = $sName . " (" . $sEMail . "): " . sprintf($sError, $sEMail);
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends test newsletter directly to specified recipients (single or group)
|
||||
*
|
||||
* Note: Sending in chunks not supported! Only usable for tests and only a few
|
||||
* recipients.
|
||||
*
|
||||
* @param integer $iIDCatArt idcatart of newsletter handler article
|
||||
* @param integer $iIDNewsRcp If specified, newsletter recipient id, ignored, if group specified
|
||||
* @param integer $iIDNewsGroup If specified, newsletter recipient group id
|
||||
* @param array $aSendRcps As reference: Filled with a list of succesfull recipients
|
||||
* @param string $sEncoding Message (and header) encoding, e.g. iso-8859-1
|
||||
*/
|
||||
public function sendDirect($iIDCatArt, $iIDNewsRcp = false, $iIDNewsGroup = false, &$aSendRcps, $sEncoding = "iso-8859-1") {
|
||||
global $lang, $client, $cfg, $cfgClient, $contenido, $recipient;
|
||||
|
||||
// Initialization
|
||||
$aMessages = array();
|
||||
|
||||
$oLanguage = new cApiLanguage($lang);
|
||||
$sFormatDate = $oLanguage->getProperty("dateformat", "date");
|
||||
$sFormatTime = $oLanguage->getProperty("dateformat", "time");
|
||||
unset($oLanguage);
|
||||
|
||||
if ($sFormatDate == "") {
|
||||
$sFormatDate = "%d.%m.%Y";
|
||||
}
|
||||
if ($sFormatTime == "") {
|
||||
$sFormatTime = "%H:%M";
|
||||
}
|
||||
|
||||
$sPath = $cfgClient[$client]["path"]["htmlpath"] . "front_content.php?changelang=" . $lang . "&idcatart=" . $iIDCatArt . "&";
|
||||
|
||||
// Get newsletter data
|
||||
$sFrom = $this->get("newsfrom");
|
||||
$sFromName = $this->get("newsfromname");
|
||||
if ($sFromName == "") {
|
||||
$sFromName = $sFrom;
|
||||
}
|
||||
$sSubject = $this->get("subject");
|
||||
$sMessageText = $this->get("message");
|
||||
|
||||
$bIsHTML = false;
|
||||
if ($this->get("type") == "html") {
|
||||
$sMessageHTML = $this->getHTMLMessage();
|
||||
|
||||
if ($sMessageHTML === false) {
|
||||
// There was a problem getting the html message (maybe article
|
||||
// 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", "cl_newsletter");
|
||||
} else {
|
||||
$sError = "Newsletter could not be sent: No html message available";
|
||||
}
|
||||
$this->_sError = $sError;
|
||||
return false;
|
||||
} else {
|
||||
$bIsHTML = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Preventing double lines in mail, you may wish to disable this function on windows servers
|
||||
if (!getSystemProperty("newsletter", "disable-rn-replacement")) {
|
||||
$sMessageText = str_replace("\r\n", "\n", $sMessageText);
|
||||
}
|
||||
|
||||
// Single replacements
|
||||
// Replace message tags (text message)
|
||||
$this->_replaceTag($sMessageText, false, "date", strftime($sFormatDate));
|
||||
$this->_replaceTag($sMessageText, false, "time", strftime($sFormatTime));
|
||||
|
||||
// Replace message tags (html message)
|
||||
if ($bIsHTML) {
|
||||
$this->_replaceTag($sMessageHTML, true, "date", strftime($sFormatDate));
|
||||
$this->_replaceTag($sMessageHTML, true, "time", strftime($sFormatTime));
|
||||
}
|
||||
|
||||
// Enabling plugin interface
|
||||
if (getSystemProperty("newsletter", "newsletter-recipients-plugin") == "true") {
|
||||
$bPluginEnabled = true;
|
||||
$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");
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
setSystemProperty("newsletter", "newsletter-recipients-plugin", "false");
|
||||
$bPluginEnabled = false;
|
||||
}
|
||||
|
||||
$aRecipients = array();
|
||||
if ($iIDNewsGroup !== false) {
|
||||
$oGroupMembers = new RecipientGroupMemberCollection;
|
||||
$aRecipients = $oGroupMembers->getRecipientsInGroup($iIDNewsGroup, false);
|
||||
} else if ($iIDNewsRcp !== false) {
|
||||
$aRecipients[] = $iIDNewsRcp;
|
||||
}
|
||||
|
||||
$iCount = count($aRecipients);
|
||||
if ($iCount > 0) {
|
||||
$this->_replaceTag($sMessageText, false, "number", $iCount);
|
||||
|
||||
// Replace message tags (html message)
|
||||
if ($bIsHTML) {
|
||||
$this->_replaceTag($sMessageHTML, true, "number", $iCount);
|
||||
}
|
||||
|
||||
foreach ($aRecipients as $iID) {
|
||||
$sRcpMsgText = $sMessageText;
|
||||
$sRcpMsgHTML = $sMessageHTML;
|
||||
|
||||
// Don't change name of $recipient variable as it is used in plugins!
|
||||
$recipient = new Recipient;
|
||||
$recipient->loadByPrimaryKey($iID);
|
||||
|
||||
$sEMail = $recipient->get("email");
|
||||
$sName = $recipient->get("name");
|
||||
if (empty($sName)) {
|
||||
$sName = $sEMail;
|
||||
}
|
||||
$sKey = $recipient->get("hash");
|
||||
|
||||
$bSendHTML = false;
|
||||
if ($recipient->get("news_type") == 1) {
|
||||
$bSendHTML = true; // Recipient accepts html newsletter
|
||||
}
|
||||
|
||||
$this->_replaceTag($sRcpMsgText, false, "name", $sName);
|
||||
$this->_replaceTag($sRcpMsgText, false, "unsubscribe", $sPath . "unsubscribe=" . $sKey);
|
||||
$this->_replaceTag($sRcpMsgText, false, "change", $sPath . "change=" . $sKey);
|
||||
$this->_replaceTag($sRcpMsgText, false, "stop", $sPath . "stop=" . $sKey);
|
||||
$this->_replaceTag($sRcpMsgText, false, "goon", $sPath . "goon=" . $sKey);
|
||||
|
||||
// Replace message tags (html message)
|
||||
if ($bIsHTML && $bSendHTML) {
|
||||
$this->_replaceTag($sRcpMsgHTML, true, "name", $sName);
|
||||
$this->_replaceTag($sRcpMsgHTML, true, "unsubscribe", $sPath . "unsubscribe=" . $sKey);
|
||||
$this->_replaceTag($sRcpMsgHTML, true, "change", $sPath . "change=" . $sKey);
|
||||
$this->_replaceTag($sRcpMsgHTML, true, "stop", $sPath . "stop=" . $sKey);
|
||||
$this->_replaceTag($sRcpMsgHTML, true, "goon", $sPath . "goon=" . $sKey);
|
||||
}
|
||||
|
||||
if ($bPluginEnabled) {
|
||||
foreach ($aPlugins as $sPlugin => $aPluginVar) {
|
||||
foreach ($aPluginVar as $sPluginVar) {
|
||||
// Replace tags in text message
|
||||
$this->_replaceTag($sRcpMsgText, false, $sPluginVar, call_user_func("recipients_" . $sPlugin . "_getvalue", $sPluginVar));
|
||||
// Replace tags in html message
|
||||
if ($bIsHTML && $bSendHTML) {
|
||||
$this->_replaceTag($sRcpMsgHTML, true, $sPluginVar, call_user_func("recipients_" . $sPlugin . "_getvalue", $sPluginVar));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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", "cl_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", "cl_newsletter");
|
||||
} else {
|
||||
$sError = "Newsletter to %s could not be sent: No valid e-mail address specified";
|
||||
}
|
||||
$aMessages[] = $sName . " (" . $sEMail . "): " . sprintf($sError, $sEMail);
|
||||
} else {
|
||||
$oMail = new PHPMailer();
|
||||
$oMail->CharSet = $sEncoding;
|
||||
$oMail->IsHTML($bIsHTML && $bSendHTML);
|
||||
$oMail->From = $sFrom;
|
||||
$oMail->FromName = $sFromName;
|
||||
$oMail->AddAddress($sEMail);
|
||||
$oMail->Mailer = "mail";
|
||||
$oMail->Subject = $sSubject;
|
||||
|
||||
if ($bIsHTML && $bSendHTML) {
|
||||
$oMail->Body = $sRcpMsgHTML;
|
||||
$oMail->AltBody = $sRcpMsgText . "\n\n";
|
||||
} else {
|
||||
$oMail->Body = $sRcpMsgText . "\n\n";
|
||||
}
|
||||
|
||||
if ($oMail->Send()) {
|
||||
$aSendRcps[] = $sName . " (" . $sEMail . ")";
|
||||
} else {
|
||||
if ($contenido) { // Use i18n only in backend
|
||||
$sError = i18n("Newsletter to %s could not be sent", "cl_newsletter");
|
||||
} else {
|
||||
$sError = "Newsletter to %s could not be sent";
|
||||
}
|
||||
$aMessages[] = $sName . " (" . $sEMail . "): " . sprintf($sError, $sEMail);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ($contenido) { // Use i18n only in backend
|
||||
$sError = i18n("No recipient with specified recipient/group id %s/%s found", "cl_newsletter");
|
||||
} else {
|
||||
$sError = "No recipient with specified recpient/group id %s/%s found";
|
||||
}
|
||||
$aMessages[] = sprintf($sError, $iIDNewsRcp, $iIDNewsGroup);
|
||||
}
|
||||
|
||||
if (count($aMessages) > 0) {
|
||||
$this->_sError = implode("<br />", $aMessages);
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated >V4.6.15 - 21.05.2007
|
||||
*
|
||||
* Sends a newsletter
|
||||
* @param $idcatart integer specifies id of the 'BlackBox'-acrticle containing the 'BlackBox'-module for management
|
||||
* @param $destination string specifies, who will receive the newsletter ("all", "default" = defaultgroup,
|
||||
* "selection" = selected groups, "single" = one recepient [e.g. Welcome-Newsletter])
|
||||
* @param $to array specifies, which group of recipients shall receive the
|
||||
* newsletter ("all", "default" = defaultgroup, "4,5,6" = group IDs)
|
||||
* @param $iChunkSize integer specifies size of chunks when sending in chunks, 0 = don't send in chunks
|
||||
* @param $iChunk integer specifies current chunk number when sending in chunks
|
||||
* result array array of recipient names/e-mails
|
||||
*/
|
||||
public function send($idcatart, $destination = "other", $to = "", $iChunkSize = 0, $iChunk = 0, $sEncoding = "iso-8859-1") {
|
||||
// What should we do with this deprecated method?
|
||||
$aResult = array();
|
||||
$aResult[] = 0;
|
||||
$aResult[] = "Newsletter->send() not supported anymore (class.newsletter.php)";
|
||||
return $aResult;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,248 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Project:
|
||||
* Contenido Content Management System
|
||||
*
|
||||
* Description:
|
||||
* Newsletter recipient class
|
||||
*
|
||||
* Requirements:
|
||||
* @con_php_req 5.0
|
||||
*
|
||||
*
|
||||
* @package Contenido Backend classes
|
||||
* @version 1.1
|
||||
* @author Björn Behrens
|
||||
* @copyright four for business AG <www.4fb.de>
|
||||
* @license http://www.contenido.org/license/LIZENZ.txt
|
||||
* @link http://www.4fb.de
|
||||
* @link http://www.contenido.org
|
||||
* @since file available since contenido release <= 4.6
|
||||
*
|
||||
* {@internal
|
||||
* created 2004-08-01
|
||||
* modified 2008-06-30, Dominik Ziegler, add security fix
|
||||
* modified 2011-03-14, Murat Purc, adapted to new GenericDB, partly ported to PHP 5, formatting
|
||||
*
|
||||
* $Id$:
|
||||
* }}
|
||||
*
|
||||
*/
|
||||
if (!defined('CON_FRAMEWORK')) {
|
||||
die('Illegal call');
|
||||
}
|
||||
|
||||
/**
|
||||
* Recipient management class
|
||||
*/
|
||||
class RecipientCollection extends ItemCollection {
|
||||
|
||||
/**
|
||||
* Constructor Function
|
||||
* @param none
|
||||
*/
|
||||
public function __construct() {
|
||||
global $cfg;
|
||||
parent::__construct($cfg["tab"]["news_rcp"], "idnewsrcp");
|
||||
$this->_setItemClass("Recipient");
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new recipient
|
||||
* @param string $sEMail Specifies the e-mail adress
|
||||
* @param string $sName Specifies the recipient name (optional)
|
||||
* @param int $iConfirmed Specifies, if the recipient is confirmed (optional)
|
||||
* @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) {
|
||||
global $client, $lang, $auth;
|
||||
|
||||
$iConfirmed = (int) $iConfirmed;
|
||||
$iMessageType = (int) $iMessageType;
|
||||
|
||||
/* Check if the e-mail adress already exists */
|
||||
$email = strtolower($email); // e-mail always lower case
|
||||
$this->setWhere("idclient", $client);
|
||||
$this->setWhere("idlang", $lang);
|
||||
$this->setWhere("email", $sEMail);
|
||||
$this->query();
|
||||
|
||||
if ($this->next()) {
|
||||
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("confirmed", $iConfirmed);
|
||||
$oItem->set("news_type", $iMessageType);
|
||||
|
||||
if ($iConfirmed) {
|
||||
$oItem->set("confirmeddate", date("Y-m-d H:i:s"), false);
|
||||
}
|
||||
$oItem->set("deactivated", 0);
|
||||
$oItem->set("created", date("Y-m-d H:i:s"), false);
|
||||
$oItem->set("author", $auth->auth["uid"]);
|
||||
$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();
|
||||
$oGroupMembers = new RecipientGroupMemberCollection();
|
||||
|
||||
$oGroups->setWhere("idclient", $client);
|
||||
$oGroups->setWhere("idlang", $lang);
|
||||
$oGroups->setWhere("defaultgroup", 1);
|
||||
$oGroups->query();
|
||||
|
||||
while ($oGroup = $oGroups->next()) {
|
||||
$iIDGroup = $oGroup->get("idnewsgroup");
|
||||
$oGroupMembers->create($iIDGroup, $iIDRcp);
|
||||
}
|
||||
|
||||
// Add to other recipient groups as well? Do so!
|
||||
if ($sJoinID != "") {
|
||||
$aJoinID = explode(",", $sJoinID);
|
||||
|
||||
if (count($aJoinID) > 0) {
|
||||
foreach ($aJoinID as $iIDGroup) {
|
||||
$oGroupMembers->create($iIDGroup, $iIDRcp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $oItem;
|
||||
}
|
||||
|
||||
/**
|
||||
* Overridden delete method to remove recipient from groupmember table
|
||||
* before deleting recipient
|
||||
*
|
||||
* @param $itemID int specifies the recipient
|
||||
*/
|
||||
public function delete($itemID) {
|
||||
$oAssociations = new RecipientGroupMemberCollection();
|
||||
$oAssociations->setWhere("idnewsrcp", $itemID);
|
||||
$oAssociations->query();
|
||||
|
||||
While ($oItem = $oAssociations->next()) {
|
||||
$oAssociations->delete($oItem->get("idnewsgroupmember"));
|
||||
}
|
||||
parent::delete($itemID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Purge method to delete recipients which hasn't been confirmed since over a month
|
||||
* @param $timeframe int Days after creation a not confirmed recipient will be removed
|
||||
* @return int Count of deleted recipients
|
||||
*/
|
||||
public function purge($timeframe) {
|
||||
global $client, $lang;
|
||||
|
||||
$oRecipientCollection = new RecipientCollection();
|
||||
|
||||
// DATEDIFF(created, NOW()) > 30 would be better, but it's only available in MySQL V4.1.1 and above
|
||||
// Note, that, TO_DAYS or NOW may not be available in other database systems than MySQL
|
||||
$oRecipientCollection->setWhere("idclient", $client);
|
||||
$oRecipientCollection->setWhere("idlang", $lang);
|
||||
$oRecipientCollection->setWhere("confirmed", 0);
|
||||
$oRecipientCollection->setWhere("(TO_DAYS(NOW()) - TO_DAYS(created))", $timeframe, ">");
|
||||
$oRecipientCollection->query();
|
||||
|
||||
while ($oItem = $oRecipientCollection->next()) {
|
||||
$oRecipientCollection->delete($oItem->get("idnewsrcp"));
|
||||
}
|
||||
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) {
|
||||
global $client, $lang;
|
||||
|
||||
$oRecipientCollection = new RecipientCollection();
|
||||
|
||||
$oRecipientCollection->setWhere("idclient", $client);
|
||||
$oRecipientCollection->setWhere("idlang", $lang);
|
||||
$oRecipientCollection->setWhere("email", strtolower($sEmail));
|
||||
$oRecipientCollection->query();
|
||||
|
||||
if ($oItem = $oRecipientCollection->next()) {
|
||||
return $oItem;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a key for all recipients without key or an old key (len(key) <> 30)
|
||||
* @param none
|
||||
*/
|
||||
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->store();
|
||||
}
|
||||
|
||||
return $iUpdated;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Single Recipient Item
|
||||
*/
|
||||
class Recipient extends Item {
|
||||
|
||||
/**
|
||||
* Constructor Function
|
||||
* @param mixed $mId Specifies the ID of item to load
|
||||
*/
|
||||
public function __construct($mId = false) {
|
||||
global $cfg;
|
||||
parent::__construct($cfg["tab"]["news_rcp"], "idnewsrcp");
|
||||
if ($mId !== false) {
|
||||
$this->loadByPrimaryKey($mId);
|
||||
}
|
||||
}
|
||||
|
||||
public function store() {
|
||||
global $auth;
|
||||
|
||||
$this->set("lastmodified", date("Y-m-d H:i:s"), false);
|
||||
$this->set("modifiedby", $auth->auth["uid"]);
|
||||
parent::store();
|
||||
|
||||
// Update name, email and newsletter type for recipients in pending newsletter jobs
|
||||
$sName = $this->get("name");
|
||||
$sEmail = $this->get("email");
|
||||
if ($sName == "") {
|
||||
$sName = $sEmail;
|
||||
}
|
||||
$iNewsType = $this->get("news_type");
|
||||
|
||||
$oLogs = new cNewsletterLogCollection();
|
||||
$oLogs->setWhere("idnewsrcp", $this->get($this->primaryKey));
|
||||
$oLogs->setWhere("status", "pending");
|
||||
$oLogs->query();
|
||||
|
||||
while ($oLog = $oLogs->next()) {
|
||||
$oLog->set("rcpname", $sName);
|
||||
$oLog->set("rcpemail", $sEmail);
|
||||
$oLog->set("rcpnewstype", $iNewsType);
|
||||
$oLog->store();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,17 +0,0 @@
|
|||
<?php
|
||||
$sAutoloadClassPath = strstr(dirname(dirname(__FILE__)), "conlite/plugins")."/classes/";
|
||||
return array(
|
||||
'RecipientGroupCollection' => $sAutoloadClassPath.'class.newsletter.groups.php',
|
||||
'RecipientGroup' => $sAutoloadClassPath.'class.newsletter.groups.php',
|
||||
'RecipientGroupMemberCollection' => $sAutoloadClassPath.'class.newsletter.groups.php',
|
||||
'RecipientGroupMember' => $sAutoloadClassPath.'class.newsletter.groups.php',
|
||||
'cNewsletterJobCollection' => $sAutoloadClassPath.'class.newsletter.jobs.php',
|
||||
'cNewsletterJob' => $sAutoloadClassPath.'class.newsletter.jobs.php',
|
||||
'cNewsletterLogCollection' => $sAutoloadClassPath.'class.newsletter.logs.php',
|
||||
'cNewsletterLog' => $sAutoloadClassPath.'class.newsletter.logs.php',
|
||||
'NewsletterCollection' => $sAutoloadClassPath.'class.newsletter.php',
|
||||
'Newsletter' => $sAutoloadClassPath.'class.newsletter.php',
|
||||
'RecipientCollection' => $sAutoloadClassPath.'class.newsletter.recipients.php',
|
||||
'Recipient' => $sAutoloadClassPath.'class.newsletter.recipients.php'
|
||||
);
|
||||
?>
|
|
@ -1,35 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* File:
|
||||
* plugin.conf.php.php
|
||||
*
|
||||
* @package Plugins
|
||||
* @subpackage Newsletter
|
||||
* @version $Rev$
|
||||
* @since 2.0
|
||||
* @author Ortwin Pinke <o.pinke@conlite.org>
|
||||
* @copyright 2012 CL-Team
|
||||
* @link http://www.conlite.org
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
// security check
|
||||
defined('CON_FRAMEWORK') or die('Illegal call');
|
||||
|
||||
class nlHandler extends pluginHandlerAbstract {
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
plugin_include(nlHandler::getName(), "includes/functions/demo1.php");
|
||||
plugin_include(nlHandler::getName(), "includes/functions/demo2.php");
|
||||
*/
|
||||
|
||||
|
||||
$cfg["tab"]["news"] = $cfg['sql']['sqlprefix']."_pi_news";
|
||||
$cfg["tab"]["news_rcp"] = $cfg['sql']['sqlprefix']."_pi_news_rcp";
|
||||
$cfg["tab"]["news_groups"] = $cfg['sql']['sqlprefix']."_pi_news_groups";
|
||||
$cfg["tab"]["news_groupmembers"] = $cfg['sql']['sqlprefix']."_pi_news_groupmembers";
|
||||
$cfg["tab"]["news_jobs"] = $cfg['sql']['sqlprefix']."_pi_news_jobs";
|
||||
$cfg["tab"]["news_log"] = $cfg['sql']['sqlprefix']."_pi_news_log";
|
|
@ -1,556 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Project:
|
||||
* Contenido Content Management System
|
||||
*
|
||||
* Description:
|
||||
* Frontend user editor
|
||||
*
|
||||
* Requirements:
|
||||
* @con_php_req 5.0
|
||||
*
|
||||
*
|
||||
* @package Contenido Backend includes
|
||||
* @version 1.1.7
|
||||
* @author Bj<EFBFBD>rn Behrens (HerrB)
|
||||
* @copyright four for business AG <www.4fb.de>
|
||||
* @license http://www.contenido.org/license/LIZENZ.txt
|
||||
* @link http://www.4fb.de
|
||||
* @link http://www.contenido.org
|
||||
* @since file available since contenido release <= 4.6
|
||||
*
|
||||
* {@internal
|
||||
* created 2007-01-01, Bj<EFBFBD>rn Behrens (HerrB)
|
||||
* modified 2008-06-27, Dominik Ziegler, add security fix
|
||||
* modified 2010-12-14, Dominik Ziegler, newsletter encoding is ignored due to wrong parameter values [#CON-374]
|
||||
*
|
||||
* $Id$:
|
||||
* }}
|
||||
*
|
||||
*/
|
||||
if (!defined('CON_FRAMEWORK')) {
|
||||
die('Illegal call');
|
||||
}
|
||||
|
||||
|
||||
// Initialization
|
||||
$oPage = new cPage();
|
||||
$oRcpGroups = new RecipientGroupCollection();
|
||||
$oClientLang = new cApiClientLanguage(false, $client, $lang);
|
||||
$oNewsletters = new NewsletterCollection();
|
||||
|
||||
// Include plugins
|
||||
if (is_array($cfg['plugins']['newsletters'])) {
|
||||
foreach ($cfg['plugins']['newsletters'] as $plugin) {
|
||||
plugin_include("newsletters", $plugin . "/" . $plugin . ".php");
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == "news_create" && $perm->have_perm_area_action($area, "news_create")) {
|
||||
// Create new newsletter
|
||||
$oNewsletter = $oNewsletters->create(i18n("-- new newsletter --", "cl_newsletter"));
|
||||
$idnewsletter = $oNewsletter->get("idnews");
|
||||
$oPage->setSubnav("idnewsletter=$idnewsletter", "news");
|
||||
$oPage->setReload();
|
||||
|
||||
// Populating default values
|
||||
$oNewsletter->set("newsfrom", $oClientLang->getProperty("newsletter", "newsfrom"));
|
||||
$oNewsletter->set("newsfromname", $oClientLang->getProperty("newsletter", "newsfromname"));
|
||||
|
||||
$sValue = $oClientLang->getProperty("newsletter", "sendto");
|
||||
if ($sValue == "") {
|
||||
$sValue = "all";
|
||||
}
|
||||
$oNewsletter->set("send_to", $sValue);
|
||||
|
||||
$oNewsletter->set("send_ids", $oClientLang->getProperty("newsletter", "sendids"));
|
||||
|
||||
$iValue = $oClientLang->getProperty("newsletter", "use_cronjob");
|
||||
if (!is_numeric($iValue)) {
|
||||
$iValue = 0;
|
||||
}
|
||||
$oNewsletter->set("use_cronjob", $iValue);
|
||||
|
||||
$iValue = $oClientLang->getProperty("newsletter", "dispatch");
|
||||
if (!is_numeric($iValue)) {
|
||||
$iValue = 0;
|
||||
}
|
||||
$oNewsletter->set("dispatch", $iValue);
|
||||
|
||||
$iValue = $oClientLang->getProperty("newsletter", "dispatchcount");
|
||||
if (!is_numeric($iValue)) {
|
||||
$iValue = 50;
|
||||
}
|
||||
$oNewsletter->set("dispatch_count", $iValue);
|
||||
|
||||
$iValue = $oClientLang->getProperty("newsletter", "dispatchdelay");
|
||||
if (!is_numeric($iValue)) {
|
||||
$iValue = 5;
|
||||
}
|
||||
$oNewsletter->set("dispatch_delay", $iValue);
|
||||
$oNewsletter->store();
|
||||
} else if ($action == "news_duplicate" && $perm->have_perm_area_action($area, "news_create")) {
|
||||
// Copy newsletter
|
||||
$oNewsletter = $oNewsletters->duplicate($idnewsletter);
|
||||
|
||||
// Update subnav with new ID
|
||||
$oPage->setSubnav("idnewsletter=" . $oNewsletter->get("idnews"), "news");
|
||||
$oPage->setReload();
|
||||
} else if ($action == "news_delete" && $perm->have_perm_area_action($area, "news_delete")) {
|
||||
// Delete newsletter
|
||||
// If it is an html newsletter, delete html message article, also
|
||||
$oNewsletter = new Newsletter($idnewsletter);
|
||||
|
||||
if ($oNewsletter->get("type") == "html" && $oNewsletter->get("idart") > 0) {
|
||||
conDeleteArt($oNewsletter->get("idart"));
|
||||
}
|
||||
|
||||
// Delete newsletter
|
||||
$oNewsletters->delete($idnewsletter);
|
||||
$oNewsletter = new Newsletter; // Generate empty newsletter object
|
||||
// Setting blank subnav - "blank" doesn't mean anything special, it just can't be empty
|
||||
// and must not contain "idnewsletter" as this is checked in the _subnav file.
|
||||
$oPage->setSubnav("blank", "news");
|
||||
$oPage->setReload();
|
||||
} else if ($action == "news_add_job" && $perm->have_perm_area_action($area, "news_add_job")) {
|
||||
// Create job
|
||||
$oJobs = new cNewsletterJobCollection;
|
||||
$oJob = $oJobs->create($idnewsletter, $oClientLang->getProperty("newsletter", "idcatart"));
|
||||
unset($oJobs);
|
||||
|
||||
if ($oJob) {
|
||||
$notis = $notification->returnNotification("info", i18n("Newsletter dispatch job has been added for this newsletter", "cl_newsletter")) . "<br>";
|
||||
} else {
|
||||
$notis = $notification->returnNotification("error", i18n("Newsletter dispatch job has been not been added! Please check newsletter details", "cl_newsletter")) . "<br>";
|
||||
}
|
||||
|
||||
$oNewsletter = new Newsletter($idnewsletter);
|
||||
} else if ($action == "news_send_test" &&
|
||||
($perm->have_perm_area_action($area, "news_create") ||
|
||||
$perm->have_perm_area_action($area, "news_save") ||
|
||||
$perm->have_perm_area_action($area, "news_add_job"))) {
|
||||
// Send test newsletter
|
||||
$oUser = new cApiUser($auth->auth["uid"]);
|
||||
|
||||
// Subnav gets not updated otherwise (no multilink from newsletter_menu)
|
||||
$oPage->setSubnav("idnewsletter=" . $idnewsletter, "news");
|
||||
|
||||
// Get test destination
|
||||
if ($perm->have_perm_area_action($area, "news_send_test")) {
|
||||
$iTestIDNewsGroup = (int) $oUser->getProperty("newsletter", "test_idnewsgrp_lang" . $lang);
|
||||
} else {
|
||||
$iTestIDNewsGroup = 0; // If user doesn't have the news_send_test right, just send to himself
|
||||
}
|
||||
|
||||
// Get encoding
|
||||
$oLang = new cApiLanguage($lang);
|
||||
$sEncoding = $oLang->get("encoding");
|
||||
unset($oLang);
|
||||
|
||||
// Send test newsletter
|
||||
$oNewsletter = new Newsletter($idnewsletter);
|
||||
$aRecipients = array();
|
||||
if ($iTestIDNewsGroup == 0) {
|
||||
// Send test newsletter to current user email address
|
||||
$sName = $oUser->get("realname");
|
||||
$sEMail = $oUser->get("email");
|
||||
|
||||
$bSend = $oNewsletter->sendEMail($oClientLang->getProperty("newsletter", "idcatart"), $sEMail, $sName, true, $sEncoding);
|
||||
if ($bSend) {
|
||||
$aRecipients[] = $sName . " (" . $sEMail . ")";
|
||||
} else {
|
||||
$aRecipients[] = i18n("None", "cl_newsletter");
|
||||
}
|
||||
} else {
|
||||
$bSend = $oNewsletter->sendDirect($oClientLang->getProperty("newsletter", "idcatart"), 0, $iTestIDNewsGroup, $aRecipients, $sEncoding);
|
||||
}
|
||||
unset($oUser);
|
||||
|
||||
if ($bSend) {
|
||||
$notis = $notification->returnNotification("info", i18n("Test newsletter has been sent to:", "cl_newsletter") . "<br />" . implode("<br />", $aRecipients) . "<br />");
|
||||
} else {
|
||||
$notis = $notification->returnNotification("warning", i18n("Test newsletter has not been sent (partly or completely):", "cl_newsletter") . "<br />" .
|
||||
i18n("Successful:", "cl_newsletter") . "<br />" . implode("<br />", $aRecipients) . "<br />" .
|
||||
i18n("Error messages:", "cl_newsletter") . "<br />" . $oNewsletter->_sError);
|
||||
}
|
||||
} else {
|
||||
// No action, just get selected newsletter
|
||||
$oNewsletter = new Newsletter($idnewsletter);
|
||||
}
|
||||
|
||||
if ($oNewsletter->virgin == false && $oNewsletter->get("idclient") == $client && $oNewsletter->get("idlang") == $lang) {
|
||||
// Check and set values
|
||||
if ($_REQUEST["optSendTo"] == "") {
|
||||
$_REQUEST["optSendTo"] = $oNewsletter->get("send_to");
|
||||
}
|
||||
|
||||
if (!is_numeric($_REQUEST["ckbWelcome"])) {
|
||||
$_REQUEST["ckbWelcome"] = 0;
|
||||
}
|
||||
|
||||
if (!is_numeric($_REQUEST["txtDispatchCount"]) || $_REQUEST["txtDispatchCount"] <= 0) {
|
||||
$_REQUEST["txtDispatchCount"] = $oNewsletter->get("dispatch_count");
|
||||
}
|
||||
|
||||
// Note, that for DispatchDelay 0 is possible (= send chunks manually)
|
||||
if (!is_numeric($_REQUEST["txtDispatchDelay"]) || $_REQUEST["txtDispatchDelay"] < 0) {
|
||||
$_REQUEST["txtDispatchDelay"] = $oNewsletter->get("dispatch_delay");
|
||||
}
|
||||
|
||||
// Only set template id to 0 if it has been specified (as something not useful).
|
||||
// This prevents deleting of the template id, if type setting is changed to "text"
|
||||
if (isset($_REQUEST["selTemplate"]) && !is_numeric($_REQUEST["selTemplate"])) {
|
||||
$_REQUEST["selTemplate"] = 0;
|
||||
}
|
||||
|
||||
if ($action == "news_save" && $perm->have_perm_area_action($area, $action)) {
|
||||
// Save changes
|
||||
$aMessages = array();
|
||||
|
||||
// Changing e.g. \' back to ' (magic_quotes)
|
||||
$sName = stripslashes($_REQUEST["txtName"]);
|
||||
$sFromEMail = stripslashes($_REQUEST["txtFromEMail"]);
|
||||
$sFromName = stripslashes($_REQUEST["txtFromName"]);
|
||||
$sSubject = stripslashes($_REQUEST["txtSubject"]);
|
||||
|
||||
if ($oNewsletter->get("name") != $sName ||
|
||||
$oNewsletter->get("welcome") != $_REQUEST["ckbWelcome"] ||
|
||||
!isValidMail($oNewsletter->get("newsfrom")) && isValidMail($sFromEMail)) {
|
||||
// Only reload, if something visible has changed
|
||||
$oPage->setReload();
|
||||
}
|
||||
|
||||
if ($oNewsletter->get("name") != $sName) {
|
||||
// Check, if item with same name exists
|
||||
$oNewsletters->setWhere("name", $sName);
|
||||
$oNewsletters->setWhere("idclient", $client);
|
||||
$oNewsletters->setWhere("idlang", $lang);
|
||||
$oNewsletters->setWhere($oNewsletter->primaryKey, $oNewsletter->get($oNewsletter->primaryKey), "!=");
|
||||
$oNewsletters->query();
|
||||
|
||||
if ($oNewsletters->next()) {
|
||||
$aMessages[] = i18n("Could not set new newsletter name: name already exists", "cl_newsletter");
|
||||
} else {
|
||||
$oNewsletter->set("name", $sName);
|
||||
if ($oNewsletter->get("idart") > 0) {
|
||||
// Update also HTML newsletter article title, if newsletter name has been changed
|
||||
$oArticles = new cApiArticleLanguageCollection;
|
||||
$oArticles->setWhere("idlang", $lang);
|
||||
$oArticles->setWhere("idart", $oNewsletter->get("idart"));
|
||||
$oArticles->query();
|
||||
|
||||
if ($oArticle = $oArticles->next()) {
|
||||
$oArticle->set("title", sprintf(i18n("Newsletter: %s", "cl_newsletter"), $oNewsletter->get("name")));
|
||||
$oArticle->store();
|
||||
}
|
||||
unset($oArticle);
|
||||
unset($oArticles);
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($oClientLang->getProperty("newsletter", "html_newsletter") == "true") {
|
||||
$oNewsletter->set("type", $selType);
|
||||
} else {
|
||||
$oNewsletter->set("type", "text");
|
||||
}
|
||||
$oNewsletter->set("newsfrom", $sFromEMail);
|
||||
$oNewsletter->set("newsfromname", $sFromName);
|
||||
$oNewsletter->set("subject", $sSubject);
|
||||
|
||||
// Options
|
||||
$oNewsletter->set("welcome", $_REQUEST["ckbWelcome"]);
|
||||
|
||||
// Check out if there are any plugins
|
||||
if (is_array($cfg['plugins']['newsletters'])) {
|
||||
foreach ($cfg['plugins']['newsletters'] as $plugin) {
|
||||
if (function_exists("newsletters_" . $plugin . "_wantedVariables") && function_exists("newsletters_" . $plugin . "_store")) {
|
||||
$wantVariables = call_user_func("newsletters_" . $plugin . "_wantedVariables");
|
||||
|
||||
if (is_array($wantVariables)) {
|
||||
$varArray = array();
|
||||
|
||||
foreach ($wantVariables as $value) {
|
||||
$varArray[$value] = stripslashes($GLOBALS[$value]);
|
||||
}
|
||||
}
|
||||
$store = call_user_func("newsletters_" . $plugin . "_store", $varArray);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If "selected groups" have been selected and no group specified, set
|
||||
// selection to "all"
|
||||
if ($_REQUEST["optSendTo"] == "selection" && !is_array($_REQUEST["selGroup"])) {
|
||||
$aMessages[] = i18n("'Send to recipients in selected groups' has been selected, but no group has been specified. Selection has been set to 'Send to all recipients'", "cl_newsletter");
|
||||
$_REQUEST["optSendTo"] = "all";
|
||||
}
|
||||
$oNewsletter->set("send_to", $_REQUEST["optSendTo"]);
|
||||
$oNewsletter->set("send_ids", serialize($_REQUEST["selGroup"]));
|
||||
|
||||
if (getEffectiveSetting("newsletter", "option-cronjob-available", "false") == "true") {
|
||||
// Only store changes, if cronjob option is available
|
||||
if (isset($_REQUEST["ckbCronJob"])) {
|
||||
$oNewsletter->set("use_cronjob", 1);
|
||||
} else {
|
||||
$oNewsletter->set("use_cronjob", 0);
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($_REQUEST["ckbDispatch"])) {
|
||||
$oNewsletter->set("dispatch", 1);
|
||||
} else {
|
||||
$oNewsletter->set("dispatch", 0);
|
||||
}
|
||||
|
||||
$oNewsletter->set("dispatch_count", $_REQUEST["txtDispatchCount"]);
|
||||
$oNewsletter->set("dispatch_delay", $_REQUEST["txtDispatchDelay"]);
|
||||
|
||||
$oNewsletter->store(); // Note, that the properties are stored, anyway
|
||||
// Storing from (e-mail), from (name) and options as default
|
||||
if ($_REQUEST["ckbSetDefault"]) {
|
||||
$oClientLang->setProperty("newsletter", "newsfrom", $sFromEMail);
|
||||
$oClientLang->setProperty("newsletter", "newsfromname", $sFromName);
|
||||
$oClientLang->setProperty("newsletter", "sendto", $_REQUEST["optSendTo"]);
|
||||
$oClientLang->setProperty("newsletter", "sendgroups", serialize($_REQUEST["selGroup"]));
|
||||
if (isset($_REQUEST["ckbCronJob"])) {
|
||||
$oClientLang->setProperty("newsletter", "use_cronjob", "1");
|
||||
} else {
|
||||
$oClientLang->setProperty("newsletter", "use_cronjob", "0");
|
||||
}
|
||||
if (isset($_REQUEST["ckbDispatch"])) {
|
||||
$oClientLang->setProperty("newsletter", "dispatch", "1");
|
||||
} else {
|
||||
$oClientLang->setProperty("newsletter", "dispatch", "0");
|
||||
}
|
||||
$oClientLang->setProperty("newsletter", "dispatchcount", $_REQUEST["txtDispatchCount"]);
|
||||
$oClientLang->setProperty("newsletter", "dispatchdelay", $_REQUEST["txtDispatchDelay"]);
|
||||
}
|
||||
|
||||
if (count($aMessages) > 0) {
|
||||
$notis .= $notification->returnNotification("warning", implode("<br>", $aMessages)) . "<br>";
|
||||
}
|
||||
} else {
|
||||
$_REQUEST["selGroup"] = unserialize($oNewsletter->get("send_ids"));
|
||||
if (!is_array($_REQUEST["selGroup"])) {
|
||||
$_REQUEST["selGroup"] = unserialize($oClientLang->getProperty("newsletter", "sendgroups"));
|
||||
if (!is_array($_REQUEST["selGroup"])) {
|
||||
$_REQUEST["selGroup"] = array();
|
||||
}
|
||||
}
|
||||
|
||||
$_REQUEST["ckbDispatch"] = false;
|
||||
if ($oNewsletter->get("dispatch") == 1) {
|
||||
$_REQUEST["ckbDispatch"] = true;
|
||||
} else if ($oNewsletter->get("dispatch") == "" && $oClientLang->getProperty("newsletter", "dispatch") == "true") {
|
||||
$_REQUEST["ckbDispatch"] = true;
|
||||
}
|
||||
}
|
||||
|
||||
$oForm = new UI_Table_Form("properties");
|
||||
$oForm->setVar("frame", $frame);
|
||||
$oForm->setVar("area", $area);
|
||||
$oForm->setVar("action", "news_save");
|
||||
$oForm->setVar("idnewsletter", $oNewsletter->get("idnews"));
|
||||
|
||||
$oForm->addHeader(i18n("Edit newsletter", "cl_newsletter"));
|
||||
|
||||
$oTxtName = new cHTMLTextbox("txtName", $oNewsletter->get("name"), 40);
|
||||
$oForm->add(i18n("Name", "cl_newsletter"), $oTxtName->render());
|
||||
|
||||
$oSelType = new cHTMLSelectElement("selType");
|
||||
$aItems = array();
|
||||
$aItems[] = array("text", i18n("Text only", "cl_newsletter"));
|
||||
if ($oClientLang->getProperty("newsletter", "html_newsletter") == "true") {
|
||||
$aItems[] = array("html", i18n("HTML and text", "cl_newsletter"));
|
||||
} else {
|
||||
$oNewsletter->set("type", "text"); // just in case the global setting was switched off
|
||||
// TODO: Should this setting be stored?
|
||||
}
|
||||
$oSelType->autoFill($aItems);
|
||||
$oSelType->setDefault($oNewsletter->get("type"));
|
||||
|
||||
$oForm->add(i18n("Type", "cl_newsletter"), $oSelType->render());
|
||||
|
||||
$oTxtFromEMail = new cHTMLTextbox("txtFromEMail", $oNewsletter->get("newsfrom"), 40);
|
||||
$oTxtFromName = new cHTMLTextbox("txtFromName", $oNewsletter->get("newsfromname"), 40);
|
||||
$oTxtSubject = new cHTMLTextarea("txtSubject", $oNewsletter->get("subject"), 80, 2);
|
||||
|
||||
$oForm->add(i18n("From (E-Mail)", "cl_newsletter"), $oTxtFromEMail->render());
|
||||
$oForm->add(i18n("From (Name)", "cl_newsletter"), $oTxtFromName->render() . " " . i18n("optional", "cl_newsletter"));
|
||||
$oForm->add(i18n("Subject", "cl_newsletter"), $oTxtSubject->render());
|
||||
|
||||
// Send options
|
||||
$oSendToAll = new cHTMLRadiobutton("optSendTo", "all");
|
||||
$oSendToAll->setEvent("Click", "checkSelection(this.value)");
|
||||
$oSendToDefault = new cHTMLRadiobutton("optSendTo", "default");
|
||||
$oSendToDefault->setEvent("Click", "checkSelection(this.value)");
|
||||
$oSendToGroups = new cHTMLRadiobutton("optSendTo", "selection");
|
||||
$oSendToGroups->setEvent("Click", "checkSelection(this.value)");
|
||||
|
||||
$oRcpGroups->setWhere("idclient", $client);
|
||||
$oRcpGroups->setWhere("idlang", $lang);
|
||||
$oRcpGroups->setOrder("defaultgroup DESC, groupname ASC");
|
||||
$oRcpGroups->query();
|
||||
|
||||
$aItems = array();
|
||||
while ($oRcpGroup = $oRcpGroups->next()) {
|
||||
$sGroupName = $oRcpGroup->get("groupname");
|
||||
if ($oRcpGroup->get("defaultgroup")) {
|
||||
$sGroupName = $sGroupName . "*";
|
||||
}
|
||||
$aItems[] = array($oRcpGroup->get("idnewsgroup"), $sGroupName);
|
||||
}
|
||||
|
||||
$oSelGroup = new cHTMLSelectElement("selGroup[]", "", "groupselect");
|
||||
$oSelGroup->setSize(10);
|
||||
$oSelGroup->setStyle("width: 350px; margin-top: 5px; margin-bottom: 5px; margin-left: 25px;");
|
||||
$oSelGroup->setMultiSelect();
|
||||
$oSelGroup->setAlt(i18n("Note: Hold <Ctrl> to select multiple items.", "cl_newsletter"));
|
||||
$oSelGroup->autoFill($aItems);
|
||||
|
||||
// No groups in the list, sendToGroups and group listbox disabled
|
||||
if (count($aItems) == 0) {
|
||||
$oSendToGroups->setDisabled(true);
|
||||
if ($_REQUEST["optSendTo"] == "selection") {
|
||||
$_REQUEST["optSendTo"] == "all";
|
||||
}
|
||||
} else if (is_array($_REQUEST["selGroup"])) {
|
||||
foreach ($_REQUEST["selGroup"] as $sValue) {
|
||||
if (array_key_exists($sValue, $oSelGroup->_options)) {
|
||||
// only select, if item still exists
|
||||
$oSelGroup->_options[$sValue]->setSelected(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
switch ($_REQUEST["optSendTo"]) {
|
||||
case "default":
|
||||
$oSendToDefault->setChecked(true);
|
||||
$oSelGroup->setDisabled(true);
|
||||
break;
|
||||
case "selection":
|
||||
$oSendToGroups->setChecked(true);
|
||||
break;
|
||||
default:
|
||||
$oSendToAll->setChecked(true);
|
||||
$oSelGroup->setDisabled(true);
|
||||
}
|
||||
|
||||
// Recipients
|
||||
$oForm->add(i18n("Recipients", "cl_newsletter"), $oSendToAll->toHTML(false) . " " . i18n("Send newsletter to all recipients", "cl_newsletter") . "<br />" . chr(10) .
|
||||
$oSendToDefault->toHTML(false) . " " . i18n("Send newsletter to the members of the default group", "cl_newsletter") . "<br />" . chr(10) .
|
||||
$oSendToGroups->toHTML(false) . " " . i18n("Send newsletter to the members of the selected group(s):", "cl_newsletter") . "<br />" . chr(10) .
|
||||
$oSelGroup->render());
|
||||
|
||||
/* TODO: Work in progress
|
||||
// Files
|
||||
$oSelFiles = new cHTMLSelectElement("selFiles[]", "", "fileselect");
|
||||
$oSelFiles->setSize(5);
|
||||
//$oSelGroup->setStyle("width: 350px; margin-top: 5px; margin-bottom: 5px; margin-left: 25px;");
|
||||
$oSelFiles->setMultiSelect();
|
||||
$oSelFiles->setAlt(i18n("Note: Hold <Ctrl> to select multiple items."));
|
||||
//$oSelGroup->autoFill($aItems);
|
||||
$sFileSelScript = '<script type="text/javascript">
|
||||
var fb_handle;
|
||||
var fb_intervalhandle;
|
||||
|
||||
function fncShowImageBrowser()
|
||||
{
|
||||
fb_handle = window.open(\''.$cfg["path"]["contenido_fullhtml"] .'frameset.php?area=upl&contenido='.$sess->id.'&appendparameters=imagebrowser\', \'imagebrowser\', \'dialog=yes,resizable=yes\');
|
||||
fb_intervalhandle = window.setInterval("fncUpdateImageFilebrowser()", 250);
|
||||
}
|
||||
|
||||
function fncUpdateImageFilebrowser()
|
||||
{
|
||||
if (!fb_handle.left)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!fb_handle.left.left_top)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!fb_handle.left.left_top.document.getElementById("selectedfile"))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (fb_handle.left.left_top.document.getElementById("selectedfile").value != "")
|
||||
{
|
||||
var oSelElement = document.forms[0].elements["selFiles[]"];
|
||||
var sValue = fb_handle.left.left_top.document.getElementById("selectedfile").value;
|
||||
|
||||
oSelElement.options[oSelElement.length] = new Option(sValue, sValue, false, false);
|
||||
|
||||
//fb_win.document.forms[0].elements[fb_fieldname].value = fb_handle.left.left_top.document.getElementById("selectedfile").value;
|
||||
|
||||
fb_handle.close();
|
||||
window.clearInterval(fb_intervalhandle);
|
||||
}
|
||||
}
|
||||
</script>';
|
||||
$oPage->addScript('selFile', $sFileSelScript);
|
||||
$oForm->add(i18n("Attachments"), $oSelFiles->render().'<br /><span onclick="fncShowImageBrowser();">Test</span>');
|
||||
*/
|
||||
|
||||
// Options
|
||||
$ckbWelcome = new cHTMLCheckbox("ckbWelcome", "1");
|
||||
$ckbWelcome->setChecked($oNewsletter->get("welcome"));
|
||||
|
||||
// Generate disabled cronjob element
|
||||
// Provide only "Use cronjob" option, if it has been explicitely enabled
|
||||
// (and the admin knows, what he is doing - like using a real cronjob, not a simulated one...)
|
||||
// Note, that the run_newsletter_job.php file has not been added to the cronjob
|
||||
// list in the cronjobs folder - as it may be used, but not via cronjob simulation
|
||||
$ckbCronJob = new cHTMLCheckbox("ckbCronJob", "1", "", $oNewsletter->get("use_cronjob"), true);
|
||||
|
||||
if (getEffectiveSetting("newsletter", "option-cronjob-available", "false") == "true") {
|
||||
// Enable cronjob checkbox
|
||||
$ckbCronJob->setDisabled("");
|
||||
} else {
|
||||
// Give the user a hint
|
||||
$ckbCronJob->setAlt(i18n("Option has to be enabled as client setting - see techref for details", "cl_newsletter"));
|
||||
}
|
||||
|
||||
$oCkbDispatch = new cHTMLCheckbox("ckbDispatch", "enabled");
|
||||
$oCkbDispatch->setChecked($oNewsletter->get("dispatch"));
|
||||
$oTxtDispatchCount = new cHTMLTextbox("txtDispatchCount", $oNewsletter->get("dispatch_count"), 4);
|
||||
$oTxtDispatchDelay = new cHTMLTextbox("txtDispatchDelay", $oNewsletter->get("dispatch_delay"), 4);
|
||||
$oTxtDispatchDelay->setAlt(i18n("Note: Set to 0 to send chunks manually.", "cl_newsletter"));
|
||||
$oCkbSaveAsDefault = new cHTMLCheckbox("ckbSetDefault", "1");
|
||||
|
||||
$oForm->add(i18n("Options", "cl_newsletter"), $ckbWelcome->toHTML(false) . " " . i18n("Welcome-Newsletter", "cl_newsletter") . "<br />" .
|
||||
$ckbCronJob->toHTML(false) . " " . i18n("Use cronjob", "cl_newsletter") . "<br />" .
|
||||
$oCkbDispatch->toHTML(false) . " " . i18n("Send in blocks:", "cl_newsletter") . " " .
|
||||
i18n("Recipients per block:", "cl_newsletter") . " " . $oTxtDispatchCount->render() . " " .
|
||||
i18n("Delay between blocks:", "cl_newsletter") . " " . $oTxtDispatchDelay->render() . " " . i18n("sec.", "cl_newsletter") . "<br />" .
|
||||
$oCkbSaveAsDefault->toHTML(false) . " " . i18n("Save option settings as default", "cl_newsletter"));
|
||||
|
||||
$oForm->add(i18n("Author", "cl_newsletter"), $classuser->getUserName($oNewsletter->get("author")) . " (" . $oNewsletter->get("created") . ")");
|
||||
$oForm->add(i18n("Last modified by", "cl_newsletter"), $classuser->getUserName($oNewsletter->get("modifiedby")) . " (" . $oNewsletter->get("modified") . ")");
|
||||
|
||||
$sExecScript = '
|
||||
<script type="text/javascript">
|
||||
|
||||
// Enabled/Disable group box
|
||||
function checkSelection(strValue)
|
||||
{
|
||||
if (strValue == "selection") {
|
||||
document.getElementById("groupselect").disabled = false;
|
||||
} else {
|
||||
document.getElementById("groupselect").disabled = true;
|
||||
}
|
||||
}
|
||||
</script>';
|
||||
$oPage->addScript('exec', $sExecScript);
|
||||
|
||||
$oPage->setContent($notis . $oForm->render(true));
|
||||
} else {
|
||||
$oPage->setContent($notis . "");
|
||||
}
|
||||
|
||||
$oPage->render();
|
||||
?>
|
|
@ -1,257 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Project:
|
||||
* Contenido Content Management System
|
||||
*
|
||||
* Description:
|
||||
* Frontend user editor
|
||||
*
|
||||
* Requirements:
|
||||
* @con_php_req 5.0
|
||||
*
|
||||
*
|
||||
* @package Contenido Backend includes
|
||||
* @version 1.0.0
|
||||
* @author Bj<EFBFBD>rn Behrens (HerrB)
|
||||
* @copyright four for business AG <www.4fb.de>
|
||||
* @license http://www.contenido.org/license/LIZENZ.txt
|
||||
* @link http://www.4fb.de
|
||||
* @link http://www.contenido.org
|
||||
* @since file available since contenido release <= 4.6
|
||||
*
|
||||
* {@internal
|
||||
* created 2007-01-01, Bj<EFBFBD>rn Behrens (HerrB)
|
||||
* modified 2008-06-27, Dominik Ziegler, add security fix
|
||||
*
|
||||
* $Id$:
|
||||
* }}
|
||||
*
|
||||
*/
|
||||
if (!defined('CON_FRAMEWORK')) {
|
||||
die('Illegal call');
|
||||
}
|
||||
|
||||
cInclude("includes", "functions.con.php"); // For conDeleteArt and conCopyArt
|
||||
// Initialization
|
||||
$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");
|
||||
}
|
||||
}
|
||||
|
||||
// Exec actions
|
||||
$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", "cl_newsletter"), $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", "cl_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", "cl_newsletter")) . "<br>";
|
||||
|
||||
$iIDArt = conCopyArticle($oNewsletter->get("idart"), $oClientLang->getProperty("newsletter", "html_template_idcat"), sprintf(i18n("%s (Template restored)", "cl_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)", "cl_newsletter"), $oNewsletter->get("name")));
|
||||
$oForm->add(i18n("Subject"), $oNewsletter->get("subject"));
|
||||
|
||||
$sTagInfoText = '<a href="javascript:fncShowHide(\'idTagInfoText\');"><strong>' . i18n("Tag information", "cl_newsletter") . '</strong></a>' .
|
||||
'<div id="idTagInfoText" style="display: none"><br /><b>' . i18n("Special message tags (will be replaced when sending)", "cl_newsletter") . ':</b><br>' .
|
||||
'MAIL_NAME: ' . i18n("Name of the recipient", "cl_newsletter") . '<br />' .
|
||||
'MAIL_DATE: ' . i18n("Date, when the mail has been sent", "cl_newsletter") . '<br />' .
|
||||
'MAIL_TIME: ' . i18n("Time, when the mail has been sent", "cl_newsletter") . '<br />' .
|
||||
'MAIL_NUMBER: ' . i18n("Number of recipients", "cl_newsletter") . '<br />' .
|
||||
#'MAIL_CHANGE: '.i18n("Link to change the e-mail adress", "cl_newsletter").'<br />'.
|
||||
'MAIL_UNSUBSCRIBE: ' . i18n("Link to unsubscribe", "cl_newsletter") . '<br />' .
|
||||
'MAIL_STOP: ' . i18n("Link to pause the subscription", "cl_newsletter") . '<br />' .
|
||||
'MAIL_GOON: ' . i18n("Link to resume the subscription", "cl_newsletter");
|
||||
|
||||
$sTagInfoHTML = '<a href="javascript:fncShowHide(\'idTagInfoHTML\');"><strong>' . i18n("Tag information", "cl_newsletter") . '</strong></a>' .
|
||||
'<div id="idTagInfoHTML" style="display: none"><br /><b>' . i18n("Special message tags (will be replaced when sending, {..} = optional)", "cl_newsletter") . ":</b><br />" .
|
||||
'[mail name="name" type="text"]{text}MAIL_NAME{text}[/mail]: ' . i18n("Name of the recipient", "cl_newsletter") . "<br />" .
|
||||
'[mail name="date" type="text"]{text}MAIL_DATE{text}[/mail]: ' . i18n("Date, when the mail has been sent", "cl_newsletter") . "<br />" .
|
||||
'[mail name="time" type="text"]{text}MAIL_TIME{text}[/mail]: ' . i18n("Time, when the mail has been sent", "cl_newsletter") . "<br />" .
|
||||
'[mail name="number" type="text"]{text}MAIL_NUMBER{text}[/mail]: ' . i18n("Number of recipients", "cl_newsletter") . "<br />" .
|
||||
#'[mail name="change" type="link" {text="'.i18n("Link text", "cl_newsletter").'"}]{text}MAIL_CHANGE{text}[/mail]: '.i18n("Link to change the e-mail adress", "cl_newsletter")."<br />".
|
||||
'[mail name="unsubscribe" type="link" {text="' . i18n("Link text", "cl_newsletter") . '" }]{text}MAIL_UNSUBSCRIBE{text}[/mail]: ' . i18n("Link to unsubscribe", "cl_newsletter") . "<br />" .
|
||||
'[mail name="stop" type="link" {text="' . i18n("Link text", "cl_newsletter") . '" }]{text}MAIL_STOP{text}[/mail]: ' . i18n("Link to pause the subscription", "cl_newsletter") . "<br />" .
|
||||
'[mail name="goon" type="link" {text="' . i18n("Link text", "cl_newsletter") . '" }]{text}MAIL_GOON{text}[/mail]: ' . i18n("Link to resume the subscription", "cl_newsletter");
|
||||
|
||||
// Mention plugin interface
|
||||
if (getSystemProperty("newsletter", "newsletter-recipients-plugin") == "true") {
|
||||
$sTagInfoText .= "<br /><br /><strong>" . i18n("Additional message tags from recipients plugins:", "cl_newsletter") . "</strong><br />";
|
||||
$sTagInfoHTML .= "<br /><br /><strong>" . i18n("Additional message tags from recipients plugins:", "cl_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 --", "cl_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", "cl_newsletter"), $oSelTemplate->render() . " " . i18n("Note, that changing the template discards the current html message content", "cl_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", "cl_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", "cl_newsletter")) . "<br />";
|
||||
|
||||
$oForm->add(i18n("HTML Message", "cl_newsletter"), i18n("Please choose a template first", "cl_newsletter"));
|
||||
}
|
||||
}
|
||||
|
||||
$oTxtMessage = new cHTMLTextarea("txtMessage", $oNewsletter->get("message"), 80, 20);
|
||||
$oForm->add(i18n("Text Message", "cl_newsletter"), $oTxtMessage->render() . "<br />" . $sTagInfoText);
|
||||
|
||||
$sExecScript = '
|
||||
<script type="text/javascript">
|
||||
// Enabled/Disable group box
|
||||
function fncShowHide(strItemID) {
|
||||
objItem = document.getElementById(strItemID);
|
||||
|
||||
if (objItem.style.display == "none") {
|
||||
objItem.style.display = "inline";
|
||||
} else {
|
||||
objItem.style.display = "none";
|
||||
}
|
||||
}
|
||||
|
||||
// Create messageBox instance
|
||||
box = new messageBox("", "", "", 0, 0);
|
||||
|
||||
// If html newsletter template selection has changed, ask user
|
||||
// if he/she may like to save this change (e.g. to get an html
|
||||
// newsletter immediately)
|
||||
function askSubmitOnTplChange(oSelectObject) {
|
||||
iOriginalTplIDArt = ' . $iTplIDArt . ';
|
||||
|
||||
if (iOriginalTplIDArt != oSelectObject.options[oSelectObject.selectedIndex].value) {
|
||||
if (iOriginalTplIDArt == 0) {
|
||||
// Everything fine: Just selecting a template for the first time
|
||||
submitForm();
|
||||
} else {
|
||||
// You may loose information, warn!
|
||||
box.confirm("' . i18n("HTML newsletter template changed", "cl_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>", "cl_newsletter") . '", "submitForm()");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function submitForm() {
|
||||
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));
|
||||
} else {
|
||||
$oPage->setContent($notis . "");
|
||||
}
|
||||
|
||||
$oPage->render();
|
||||
?>
|
|
@ -1,379 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Project:
|
||||
* Contenido Content Management System
|
||||
*
|
||||
* Description:
|
||||
* Shows job details
|
||||
*
|
||||
* Requirements:
|
||||
* @con_php_req 5.0
|
||||
*
|
||||
*
|
||||
* @package Contenido Backend includes
|
||||
* @version 1.0.0
|
||||
* @author Bj<EFBFBD>rn Behrens (HerrB)
|
||||
* @copyright four for business AG <www.4fb.de>
|
||||
* @license http://www.contenido.org/license/LIZENZ.txt
|
||||
* @link http://www.4fb.de
|
||||
* @link http://www.contenido.org
|
||||
* @since file available since contenido release <= 4.6
|
||||
*
|
||||
* {@internal
|
||||
* created 2007-01-01, Bj<EFBFBD>rn Behrens (HerrB)
|
||||
* modified 2008-06-27, Dominik Ziegler, add security fix
|
||||
*
|
||||
* $Id$:
|
||||
* }}
|
||||
*
|
||||
*/
|
||||
if (!defined('CON_FRAMEWORK')) {
|
||||
die('Illegal call');
|
||||
}
|
||||
|
||||
|
||||
// Initialization
|
||||
$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:", "cl_newsletter"));
|
||||
$oForm->add("", "");
|
||||
|
||||
$oForm->add("", sprintf(i18n("Sending newsletter ... (chunk %s of %s, recipients: %s, sent: %s)", "cl_newsletter"), $iChunk, $iChunks, $oJob->get("rcpcount"), $oJob->get("sendcount")));
|
||||
|
||||
$oForm->setActionButton("cancel", $cfg['path']['contenido_fullhtml'] . "images/but_cancel.gif", i18n("Stop sending", "cl_newsletter"), "c");
|
||||
$oForm->setActionButton("submit", $cfg['path']['contenido_fullhtml'] . "images/but_ok.gif", i18n("Send next chunk", "cl_newsletter"), "s", "news_job_run");
|
||||
} else {
|
||||
// Send automatically
|
||||
$oForm = new UI_Table_Form("properties");
|
||||
$oForm->addHeader(i18n("Report:", "cl_newsletter"));
|
||||
$oForm->add("", "");
|
||||
|
||||
$oForm->add("", sprintf(i18n("Sending newsletter ... (chunk %s of %s, recipients: %s, sent: %s)", "cl_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", "cl_newsletter"), "c");
|
||||
}
|
||||
} else {
|
||||
// All newsletters should have been sent
|
||||
$oForm = new UI_Table_Form("properties");
|
||||
$oForm->addHeader(i18n("Report:", "cl_newsletter"));
|
||||
$oForm->add("", "");
|
||||
|
||||
$oForm->add("", sprintf(i18n("The newsletter has been sent to %s recipients", "cl_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);
|
||||
} 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", "cl_newsletter"));
|
||||
|
||||
$oSelElements = new cHTMLSelectElement("elemperpage");
|
||||
$oSelElements->setEvent("onchange", "document.forms.frmOptions.submit();");
|
||||
|
||||
$aData = Array("0" => i18n("-All-", "cl_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:", "cl_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", "cl_newsletter"), i18n("E-Mail", "cl_newsletter"), i18n("Type", "cl_newsletter"), i18n("Status", "cl_newsletter"), i18n("Sent", "cl_newsletter"), i18n("Actions", "cl_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 .= " ";
|
||||
}
|
||||
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", "cl_newsletter"));
|
||||
$sImgDelete = $oImgDelete->render();
|
||||
unset($oImgDelete);
|
||||
|
||||
$iCount = 0;
|
||||
$aNewsType[] = array(); // Performance
|
||||
$aNewsType[0] = i18n("Text only", "cl_newsletter");
|
||||
$aNewsType[1] = i18n("HTML/Text", "cl_newsletter");
|
||||
while ($oLog = $oLogs->next()) {
|
||||
$sName = $oLog->get("rcpname");
|
||||
$sEMail = $oLog->get("rcpemail");
|
||||
|
||||
switch ($oLog->get("status")) {
|
||||
case "pending":
|
||||
$sStatus = i18n("Waiting for sending", "cl_newsletter");
|
||||
break;
|
||||
case "sending":
|
||||
$sStatus = i18n("Sending", "cl_newsletter");
|
||||
break;
|
||||
case "successful":
|
||||
$sStatus = i18n("Successful", "cl_newsletter");
|
||||
break;
|
||||
default:
|
||||
$sStatus = sprintf(i18n("Error: %s", "cl_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", "cl_newsletter"), $sBrowseLinks) . '</td>
|
||||
</tr>
|
||||
</table>';
|
||||
|
||||
$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);
|
||||
|
||||
$oForm->addHeader(i18n("Newsletter Dispatch Job", "cl_newsletter"));
|
||||
|
||||
$oForm->add(i18n("Name", "cl_newsletter"), $oJob->get("name"));
|
||||
|
||||
$sDateFormat = getEffectiveSetting("backend", "timeformat", "d.m.Y H:i");
|
||||
switch ($oJob->get("status")) {
|
||||
case 1:
|
||||
$oForm->add(i18n("Status", "cl_newsletter"), i18n("Pending", "cl_newsletter"));
|
||||
break;
|
||||
case 2:
|
||||
$oForm->add(i18n("Status", "cl_newsletter"), sprintf(i18n("Sending (started: %s)", "cl_newsletter"), date($sDateFormat, strtotime($oJob->get("started")))));
|
||||
break;
|
||||
case 9:
|
||||
$oForm->add(i18n("Status", "cl_newsletter"), sprintf(i18n("Finished (started: %s, finished: %s)", "cl_newsletter"), date($sDateFormat, strtotime($oJob->get("started"))), date($sDateFormat, strtotime($oJob->get("finished")))));
|
||||
break;
|
||||
}
|
||||
|
||||
$oForm->add(i18n("Statistics", "cl_newsletter"), sprintf(i18n("Planned: %s, Send: %s", "cl_newsletter"), $oJob->get("rcpcount"), $oJob->get("sendcount")));
|
||||
$oForm->add(i18n("From", "cl_newsletter"), $oJob->get("newsfrom") . " (" . $oJob->get("newsfromname") . ")");
|
||||
$oForm->add(i18n("Subject", "cl_newsletter"), $oJob->get("subject"));
|
||||
|
||||
if ($oJob->get("type") == "html") {
|
||||
$oForm->add(i18n("Type", "cl_newsletter"), i18n("HTML and text", "cl_newsletter"));
|
||||
|
||||
$txtMessageHTML = new cHTMLTextarea("txtMessageHTML", $oJob->get("message_html"), 80, 20);
|
||||
$txtMessageHTML->setDisabled("disabled");
|
||||
|
||||
$oForm->add(i18n("HTML Message", "cl_newsletter"), $txtMessageHTML->render());
|
||||
} else {
|
||||
$oForm->add(i18n("Type", "cl_newsletter"), i18n("Text only", "cl_newsletter"));
|
||||
}
|
||||
$txtMessageText = new cHTMLTextarea("txtMessageText", $oJob->get("message_text"), 80, 20);
|
||||
$txtMessageText->setDisabled("disabled");
|
||||
|
||||
$oForm->add(i18n("Text Message", "cl_newsletter"), $txtMessageText->render());
|
||||
|
||||
$aSendTo = unserialize($oJob->get("send_to"));
|
||||
switch ($aSendTo[0]) {
|
||||
case "all":
|
||||
$sSendToInfo = i18n("Send newsletter to all recipients", "cl_newsletter");
|
||||
break;
|
||||
case "default":
|
||||
$sSendToInfo = i18n("Send newsletter to the members of the default group", "cl_newsletter");
|
||||
break;
|
||||
case "selection":
|
||||
$sSendToInfo = i18n("Send newsletter to the members of the selected group(s):", "cl_newsletter");
|
||||
|
||||
unset($aSendTo[0]);
|
||||
foreach ($aSendTo as $sGroup) {
|
||||
$sSendToInfo .= "<br />" . $sGroup;
|
||||
}
|
||||
break;
|
||||
case "single":
|
||||
$sSendToInfo = i18n("Send newsletter to single recipient:", "cl_newsletter");
|
||||
$sSendToInfo .= "<br />" . $aSendTo[1] . " (" . $aSendTo[2] . ")";
|
||||
break;
|
||||
default:
|
||||
}
|
||||
unset($aSendTo);
|
||||
|
||||
$oForm->add(i18n("Recipients", "cl_newsletter"), $sSendToInfo);
|
||||
|
||||
if ($oJob->get("use_cronjob") == 1) {
|
||||
$sOptionsInfo = i18n("Use cronjob: Enabled", "cl_newsletter");
|
||||
} else {
|
||||
$sOptionsInfo = i18n("Use cronjob: Not enabled", "cl_newsletter");
|
||||
}
|
||||
|
||||
if ($oJob->get("dispatch")) {
|
||||
$sOptionsInfo .= "<br />" . sprintf(i18n("Dispatch: Enabled (block size: %s, delay: %s sec.)", "cl_newsletter"), $oJob->get("dispatch_count"), $oJob->get("dispatch_delay"));
|
||||
} else {
|
||||
$sOptionsInfo .= "<br />" . i18n("Dispatch: Disabled", "cl_newsletter");
|
||||
}
|
||||
|
||||
$oForm->add(i18n("Options", "cl_newsletter"), $sOptionsInfo);
|
||||
|
||||
$oForm->add(i18n("Author", "cl_newsletter"), $oJob->get("authorname"));
|
||||
$oForm->add(i18n("Created", "cl_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();
|
||||
?>
|
|
@ -1,344 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* Project:
|
||||
* Contenido Content Management System
|
||||
*
|
||||
* Description:
|
||||
* Frontend user list
|
||||
*
|
||||
* Requirements:
|
||||
* @con_php_req 5.0
|
||||
*
|
||||
*
|
||||
* @package Contenido Backend includes
|
||||
* @version 1.0.0
|
||||
* @author Bj<EFBFBD>rn Behrens (HerrB)
|
||||
* @copyright four for business AG <www.4fb.de>
|
||||
* @license http://www.contenido.org/license/LIZENZ.txt
|
||||
* @link http://www.4fb.de
|
||||
* @link http://www.contenido.org
|
||||
* @since file available since contenido release <= 4.6
|
||||
*
|
||||
* {@internal
|
||||
* created 2007-01-01, Bj<EFBFBD>rn Behrens (HerrB)
|
||||
* modified 2008-06-27, Dominik Ziegler, add security fix
|
||||
*
|
||||
* $Id$:
|
||||
* }}
|
||||
*
|
||||
*/
|
||||
|
||||
if(!defined('CON_FRAMEWORK')) {
|
||||
die('Illegal call');
|
||||
}
|
||||
|
||||
|
||||
##################################
|
||||
# Initialization
|
||||
##################################
|
||||
$oPage = new cPage;
|
||||
$oMenu = new UI_Menu;
|
||||
$oJobs = new cNewsletterJobCollection;
|
||||
$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,
|
||||
// remember to update include.newsletter_left_top.php, also.
|
||||
// field: Field name in the db
|
||||
// caption: Shown field name (-> user)
|
||||
// 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" => "name", "caption" => i18n("Name", "cl_newsletter"), "type" => "base,sort,search");
|
||||
$aFields["created"] = array("field" => "created", "caption" => i18n("Created", "cl_newsletter"), "type" => "base,sort");
|
||||
$aFields["status"] = array("field" => "status", "caption" => i18n("Status", "cl_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");
|
||||
|
||||
##################################
|
||||
# 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);
|
||||
}
|
||||
if (!is_numeric($_REQUEST["elemperpage"])) {
|
||||
// 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"]);
|
||||
}
|
||||
unset ($oUser);
|
||||
|
||||
$_REQUEST["page"] = (int)$_REQUEST["page"];
|
||||
if ($_REQUEST["page"] <= 0 || $_REQUEST["elemperpage"] == 0) {
|
||||
$_REQUEST["page"] = 1;
|
||||
}
|
||||
// Sort order
|
||||
if ($_REQUEST["sortorder"] != "ASC") {
|
||||
$_REQUEST["sortorder"] = "DESC"; // Note, default is DESC (as default sortby is "created" date)
|
||||
}
|
||||
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$bSortByFound) {
|
||||
$_REQUEST["sortby"] = "created"; // Default sort by field, possible values see above
|
||||
}
|
||||
if (!$bSearchInFound) {
|
||||
$_REQUEST["searchin"] = "--all--";
|
||||
}
|
||||
|
||||
// Author
|
||||
if ($_REQUEST["selAuthor"] == "") {
|
||||
$_REQUEST["selAuthor"] = $auth->auth["uid"];
|
||||
}
|
||||
|
||||
// Free memory
|
||||
unset($oUser);
|
||||
|
||||
##################################
|
||||
# Get data
|
||||
##################################
|
||||
|
||||
$oJobs->setWhere("idclient", $client);
|
||||
$oJobs->setWhere("idlang", $lang);
|
||||
$oJobs->setWhere("author", $_REQUEST["selAuthor"]);
|
||||
|
||||
if ($_REQUEST["filter"] != "")
|
||||
{
|
||||
if ($_REQUEST["searchin"] == "--all--" || $_REQUEST["searchin"] == "")
|
||||
{
|
||||
foreach ($aFields as $sKey => $aData)
|
||||
{
|
||||
if (strpos($aData["type"], "search") !== false) {
|
||||
$oJobs->setWhereGroup("filter", $aData["field"], $_REQUEST["filter"], "LIKE");
|
||||
}
|
||||
}
|
||||
$oJobs->setInnerGroupCondition("filter", "OR");
|
||||
} else {
|
||||
$oJobs->setWhere($_REQUEST["searchin"], $_REQUEST["filter"], "LIKE");
|
||||
}
|
||||
}
|
||||
|
||||
if ($_REQUEST["elemperpage"] > 0)
|
||||
{
|
||||
$oJobs->query();
|
||||
|
||||
// Getting item count without limit (for page function) - better idea anyone (performance)?
|
||||
$iItemCount = $oJobs->count();
|
||||
|
||||
if ($_REQUEST["elemperpage"]*($_REQUEST["page"]) >= $iItemCount+$_REQUEST["elemperpage"] && $_REQUEST["page"] != 1) {
|
||||
$_REQUEST["page"]--;
|
||||
}
|
||||
$oJobs->setLimit($_REQUEST["elemperpage"] * ($_REQUEST["page"] - 1), $_REQUEST["elemperpage"]);
|
||||
} else {
|
||||
$iItemCount = 0;
|
||||
}
|
||||
|
||||
$oJobs->setOrder($_REQUEST["sortby"] . " " . $_REQUEST["sortorder"]);
|
||||
$oJobs->query();
|
||||
|
||||
// Output data
|
||||
$oMenu = new UI_Menu;
|
||||
$iMenu = 0;
|
||||
$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", "cl_newsletter");
|
||||
$aMsg["DelDescr"] = i18n("Do you really want to delete the following newsletter dispatch job:<br>", "cl_newsletter");
|
||||
|
||||
$aMsg["SendTitle"] = i18n("Run job", "cl_newsletter");
|
||||
$aMsg["SendDescr"] = i18n("Do you really want to run the following job:<br>", "cl_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>';
|
||||
|
||||
while ($oJob = $oJobs->next())
|
||||
{
|
||||
$iMenu++;
|
||||
$iID = $oJob->get("idnewsjob");
|
||||
$sName = $oJob->get("name") . " (" . date($sDateFormat, strtotime($oJob->get("created"))) .")";
|
||||
|
||||
$oLnk = new cHTMLLink;
|
||||
$oLnk->setMultiLink($area, "", $area, "");
|
||||
$oLnk->setCustom("idnewsjob", $iID);
|
||||
|
||||
// Is at present redundant
|
||||
// HerrB: No, it's just not used/set...
|
||||
//$oMenu->setImage($iMenu, "images/newsletter_16.gif");
|
||||
$oMenu->setTitle($iMenu, $sName);
|
||||
|
||||
switch ($oJob->get("status"))
|
||||
{
|
||||
case 1:
|
||||
// Pending
|
||||
if ($oJob->get("cronjob") == 0)
|
||||
{
|
||||
// Standard job can be run if user has the right to do so
|
||||
if ($perm->have_perm_area_action($area, "news_job_run"))
|
||||
{
|
||||
$sLnkSend = str_replace('{ID}', $iID, $sTplSend);
|
||||
$sLnkSend = str_replace('{NAME}', addslashes($sName), $sLnkSend);
|
||||
|
||||
$oMenu->setActions($iMenu, 'send', $sLnkSend);
|
||||
}
|
||||
} else if ($oJob->get("cronjob") == 1) {
|
||||
// It's a cronjob job - no manual sending, show it blue
|
||||
$oLnk->updateAttributes(array("style" => "color:#0000FF"));
|
||||
}
|
||||
|
||||
if ($perm->have_perm_area_action($area, "news_job_delete")) {
|
||||
// Job may be deleted, if user has the right to do so
|
||||
$oMenu->setActions($iMenu, 'delete', '<a title="'.$aMsg["DelTitle"].'" href="javascript://" onclick="showDelMsg('.$iID.',\''.addslashes($sName).'\')"><img src="'.$cfg['path']['images'].'delete.gif" border="0" title="'.$aMsg["DelTitle"].'" alt="'.$aMsg["DelTitle"].'"></a>');
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
// Sending job
|
||||
if ($perm->have_perm_area_action($area, "news_job_run"))
|
||||
{
|
||||
// User may try to start sending, again - if he has the right to do so
|
||||
$sLnkSend = str_replace('{ID}', $iID, $sTplSend);
|
||||
$sLnkSend = str_replace('{NAME}', addslashes($sName), $sLnkSend);
|
||||
|
||||
$oMenu->setActions($iMenu, 'send', $sLnkSend);
|
||||
}
|
||||
|
||||
$oLnk->updateAttributes(array("style" => "color:#da8a00"));
|
||||
|
||||
$sDelete = '<img src="'.$cfg['path']['images'].'delete_inact.gif" border="0" title="'.$aMsg["DelTitle"].'" alt="'.$aMsg["DelTitle"].'">';
|
||||
break;
|
||||
case 9:
|
||||
// Job finished, don't do anything
|
||||
$oLnk->updateAttributes(array("style" => "color:#808080"));
|
||||
|
||||
if ($perm->have_perm_area_action($area, "news_job_delete")) {
|
||||
// You have the right, but you can't delete the job after sending
|
||||
$oMenu->setActions($iMenu, 'delete', '<img src="'.$cfg['path']['images'].'delete_inact.gif" border="0" title="'.$aMsg["DelTitle"].'" alt="'.$aMsg["DelTitle"].'">');
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
$oMenu->setLink($iMenu, $oLnk);
|
||||
}
|
||||
|
||||
$sExecScript = '
|
||||
<script type="text/javascript">
|
||||
// Session-ID
|
||||
var sid = "'.$sess->id.'";
|
||||
|
||||
// Create messageBox instance
|
||||
box = new messageBox("", "", "", 0, 0);
|
||||
|
||||
function showSendMsg(lngId, strElement) {
|
||||
box.confirm("'.$aMsg["SendTitle"].'", "'.$aMsg["SendDescr"].'<b>" + strElement + "</b>", "runJob(\'" + lngId + "\')");
|
||||
}
|
||||
|
||||
function showDelMsg(lngId, strElement) {
|
||||
box.confirm("'.$aMsg["DelTitle"].'", "'.$aMsg["DelDescr"].'<b>" + strElement + "</b>", "deleteJob(\'" + lngId + "\')");
|
||||
}
|
||||
|
||||
// Function for running job
|
||||
function runJob(idnewsjob)
|
||||
{
|
||||
oForm = parent.parent.left.left_top.document.getElementById("dispatch_listoptionsform");
|
||||
|
||||
url = "main.php?area=news_jobs";
|
||||
url += "&action=news_job_run";
|
||||
url += "&frame=4";
|
||||
url += "&idnewsjob=" + idnewsjob;
|
||||
url += "&contenido=" + sid;
|
||||
url += get_registered_parameters();
|
||||
url += "&selAuthor=" + oForm.selAuthor.value;
|
||||
url += "&sortby=" + oForm.sortby.value;
|
||||
url += "&sortorder=" + oForm.sortorder.value;
|
||||
url += "&filter=" + oForm.filter.value;
|
||||
url += "&elemperpage=" + oForm.elemperpage.value;
|
||||
|
||||
parent.parent.right.right_bottom.location.href = url;
|
||||
}
|
||||
|
||||
// Function for deleting job
|
||||
function deleteJob(idnewsjob)
|
||||
{
|
||||
oForm = parent.parent.left.left_top.document.getElementById("dispatch_listoptionsform");
|
||||
|
||||
url = "main.php?area=news_jobs";
|
||||
url += "&action=news_job_delete";
|
||||
url += "&frame=4";
|
||||
url += "&idnewsjob=" + idnewsjob;
|
||||
url += "&contenido=" + sid;
|
||||
url += get_registered_parameters();
|
||||
url += "&selAuthor=" + oForm.selAuthor.value;
|
||||
url += "&sortby=" + oForm.sortby.value;
|
||||
url += "&sortorder=" + oForm.sortorder.value;
|
||||
url += "&filter=" + oForm.filter.value;
|
||||
url += "&elemperpage=" + oForm.elemperpage.value;
|
||||
|
||||
parent.parent.right.right_bottom.location.href = url;
|
||||
}
|
||||
</script>';
|
||||
|
||||
$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('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-1e38ab60e303';
|
||||
$oPagerLink = new cHTMLLink;
|
||||
$oPagerLink->setLink("main.php");
|
||||
$oPagerLink->setTargetFrame('left_bottom');
|
||||
$oPagerLink->setCustom("selAuthor", $_REQUEST["selAuthor"]);
|
||||
$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);
|
||||
// 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
|
||||
$oPager = new cObjectPager($sPagerId, $iItemCount, $_REQUEST["elemperpage"], $_REQUEST["page"], $oPagerLink, "page");
|
||||
|
||||
// Add slashes, to insert in javascript
|
||||
$sPagerContent = $oPager->render(1);
|
||||
$sPagerContent = str_replace('\\', '\\\\', $sPagerContent);
|
||||
$sPagerContent = str_replace('\'', '\\\'', $sPagerContent);
|
||||
|
||||
// Send new object pager to left_top
|
||||
$oPage->addScript('setpager', '<script type="text/javascript" src="scripts/setPager.js"></script>');
|
||||
|
||||
$sRefreshPager = '
|
||||
<script type="text/javascript">
|
||||
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->setContent(array('<table border="0" cellspacing="0" cellpadding="0" width="100%">', $oListOptionRow, '</table>', $oMenu->render(false)));
|
||||
$oPage->setContent($oMenu->render(false));
|
||||
$oPage->render();
|
||||
|
||||
?>
|
|
@ -1,67 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* Project:
|
||||
* Contenido Content Management System
|
||||
*
|
||||
* Description:
|
||||
* Custom subnavigation for the newsletters
|
||||
*
|
||||
* Requirements:
|
||||
* @con_php_req 5.0
|
||||
*
|
||||
*
|
||||
* @package Contenido Backend includes
|
||||
* @version 1.0.1
|
||||
* @author Bj<EFBFBD>rn Behrens (HerrB)
|
||||
* @copyright four for business AG <www.4fb.de>
|
||||
* @license http://www.contenido.org/license/LIZENZ.txt
|
||||
* @link http://www.4fb.de
|
||||
* @link http://www.contenido.org
|
||||
* @since file available since contenido release <= 4.6
|
||||
*
|
||||
* {@internal
|
||||
* created 2007-01-01, Bj<EFBFBD>rn Behrens (HerrB)
|
||||
* modified 2008-06-27, Dominik Ziegler, add security fix
|
||||
* modified 2010-05-20, Murat Purc, removed request check during processing ticket [#CON-307]
|
||||
*
|
||||
* $Id$:
|
||||
* }}
|
||||
*
|
||||
*/
|
||||
|
||||
if (!defined('CON_FRAMEWORK')) {
|
||||
die('Illegal call');
|
||||
}
|
||||
|
||||
|
||||
if (isset($_GET['idnewsjob']) && (int)$_GET['idnewsjob'] > 0)
|
||||
{
|
||||
$sCaption = i18n("View", "cl_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=news_jobs&frame=4&idnewsjob=$idnewsjob").'">'.$sCaption.'</a>');
|
||||
$tpl->next();
|
||||
|
||||
$sCaption = i18n("Details", "cl_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=news_jobs&action=news_job_details&frame=4&idnewsjob=$idnewsjob").'">'.$sCaption.'</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"]);
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,960 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* Project:
|
||||
* Contenido Content Management System
|
||||
*
|
||||
* Description:
|
||||
* Left top pane
|
||||
*
|
||||
* Requirements:
|
||||
* @con_php_req 5.0
|
||||
*
|
||||
*
|
||||
* @package Contenido Backend includes
|
||||
* @version 1.0.0
|
||||
* @author Bj<EFBFBD>rn Behrens (HerrB)
|
||||
* @copyright four for business AG <www.4fb.de>
|
||||
* @license http://www.contenido.org/license/LIZENZ.txt
|
||||
* @link http://www.4fb.de
|
||||
* @link http://www.contenido.org
|
||||
* @since file available since contenido release <= 4.6
|
||||
*
|
||||
* {@internal
|
||||
* created 2007-01-01, Bj<EFBFBD>rn Behrens (HerrB)
|
||||
* modified 2008-06-27, Dominik Ziegler, add security fix
|
||||
* modified 2008-08-03, Bj<EFBFBD>rn Behrens (HerrB), complete makeover to fix bugs and reduce memory waste
|
||||
*
|
||||
* $Id$:
|
||||
* }}
|
||||
*
|
||||
*/
|
||||
|
||||
if(!defined('CON_FRAMEWORK')) {
|
||||
die('Illegal call');
|
||||
}
|
||||
|
||||
|
||||
######################################
|
||||
# Initialization
|
||||
######################################
|
||||
if (!is_object($oTpl)) {
|
||||
$oTpl = new Template;
|
||||
}
|
||||
if (!is_object($oDB)) {
|
||||
$oDB = new DB_ConLite; // We have really to send a special SQL statement - we need a DB object
|
||||
}
|
||||
|
||||
$oUser = new cApiUser($auth->auth["uid"]);
|
||||
$oClient = new cApiClient($client);
|
||||
$oClientLang = new cApiClientLanguage(false, $client, $lang);
|
||||
|
||||
######################################
|
||||
# 0. BUTTONS
|
||||
######################################
|
||||
// Newsletter
|
||||
$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", "cl_newsletter").'" title="'.i18n("Newsletter", "cl_newsletter").'" name="'.$sId.'" id="'.$sId.'" src="'.$cfg["path"]["images"].'newsletter_on.gif"/>';
|
||||
$sButtonRow .= '</a>';
|
||||
}
|
||||
|
||||
// Job dispatch
|
||||
$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", "cl_newsletter").'" title="'.i18n("Dispatch", "cl_newsletter").'" name="'.$sId.'" id="'.$sId.'" src="'.$cfg["path"]["images"].'newsletter_dispatch_on.gif"/>';
|
||||
$sButtonRow .= '</a>';
|
||||
}
|
||||
|
||||
// Recipients
|
||||
$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", "cl_newsletter").'" title="'.i18n("Recipients", "cl_newsletter").'" id="'.$sId.'" src="'.$cfg["path"]["images"].'newsletter_recipients_on.gif"/>';
|
||||
$sButtonRow .= '</a>';
|
||||
}
|
||||
|
||||
// Recipient groups
|
||||
$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", "cl_newsletter").'" title="'.i18n("Recipient groups", "cl_newsletter").'" id="'.$sId.'" src="'.$cfg["path"]["images"].'newsletter_recipientgroups_on.gif"/>';
|
||||
$sButtonRow .= '</a>';
|
||||
}
|
||||
|
||||
$oTpl->set('s', 'BUTTONROW', $sButtonRow);
|
||||
unset($sButtonRow);
|
||||
|
||||
######################################
|
||||
# 1. NEWSLETTER
|
||||
######################################
|
||||
|
||||
######################################
|
||||
# 1.1 Newsletter: Actions folding row
|
||||
######################################
|
||||
$sLink = "actionlink"; // ID for HTML element
|
||||
$oActionsRow = new cFoldingRow("28cf9b31-e6d7-4657-a9a7-db31478e7a5c",i18n("Actions", "cl_newsletter"), $sLink);
|
||||
$oTpl->set('s', 'ACTIONLINK', $sLink);
|
||||
|
||||
if ($perm->have_perm_area_action("news", "news_create"))
|
||||
{
|
||||
// Create the link to add a newsletter
|
||||
$sContent = '<div style="padding: 4px; padding-left: 17px; margin-bottom:2px; background: '.$cfg['color']['table_dark'].';">'."\n";
|
||||
|
||||
$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", "cl_newsletter"));
|
||||
|
||||
$sContent .= $oLink->render() . '</div>'."\n";
|
||||
$oActionsRow->setContentData($sContent);
|
||||
} else {
|
||||
$oActionsRow->setContentData("");
|
||||
}
|
||||
|
||||
######################################
|
||||
# 1.2 Newsletter: Settings folding row
|
||||
######################################
|
||||
$sLink = "settingslink";
|
||||
$oSettingsRow = new cFoldingRow("d64baf0a-aea9-47b3-8490-54a00fce02b5",i18n("Settings", "cl_newsletter"), $sLink);
|
||||
$oTpl->set('s', 'SETTINGSLINK', $sLink);
|
||||
|
||||
// HTML Newsletter: Template and newsletter category
|
||||
// Note, that in PHP 5 it is not possible to have a truely working copy of an object
|
||||
// so, we are filling two almost identical objects with the same data ("clone" may work, but is not available in PHP4 ...)
|
||||
$oSelHTMLTemplateIDCat = new cHTMLSelectElement("selHTMLTemplateCat");
|
||||
$oSelHTMLTemplateIDCat->setStyle("width: 220px;");
|
||||
|
||||
$oSelHTMLNewsletterIDCat = new cHTMLSelectElement("selHTMLNewsletterCat");
|
||||
$oSelHTMLNewsletterIDCat->setStyle("width: 220px;");
|
||||
|
||||
$oOptionTemplate = new cHTMLOptionElement("--".i18n("Please select", "cl_newsletter")."--", 0);
|
||||
$oSelHTMLTemplateIDCat->addOptionElement(0, $oOptionTemplate);
|
||||
$oOptionNewsletter = new cHTMLOptionElement("--".i18n("Please select", "cl_newsletter")."--", 0);
|
||||
$oSelHTMLNewsletterIDCat->addOptionElement(0, $oOptionNewsletter);
|
||||
|
||||
$sSQL = "SELECT tblCat.idcat AS idcat, tblCatLang.name AS name, tblCatTree.level AS level, ";
|
||||
$sSQL .= "tblCatLang.visible AS visible, tblCatLang.public AS public FROM ";
|
||||
$sSQL .= $cfg["tab"]["cat"]." AS tblCat, ".$cfg["tab"]["cat_lang"]." AS tblCatLang, ";
|
||||
$sSQL .= $cfg["tab"]["cat_tree"]." AS tblCatTree ";
|
||||
$sSQL .= "WHERE tblCat.idclient = '".Contenido_Security::toInteger($client)."' AND tblCatLang.idlang = '".Contenido_Security::toInteger($lang)."' AND ";
|
||||
$sSQL .= "tblCatLang.idcat = tblCat.idcat AND tblCatTree.idcat = tblCat.idcat ";
|
||||
$sSQL .= "ORDER BY tblCatTree.idtree";
|
||||
|
||||
$oDB->query($sSQL);
|
||||
|
||||
while ($oDB->next_record()) {
|
||||
$sSpaces = " ";
|
||||
|
||||
for ($i = 0; $i < $oDB->f("level"); $i ++) {
|
||||
$sSpaces .= " ";
|
||||
}
|
||||
|
||||
$oOptionTemplate = new cHTMLOptionElement($sSpaces.$oDB->f("name"), $oDB->f("idcat"));
|
||||
$oOptionNewsletter = new cHTMLOptionElement($sSpaces.$oDB->f("name"), $oDB->f("idcat"));
|
||||
if ($oDB->f("visible") == 0 || $oDB->f("public") == 0) {
|
||||
$oOptionTemplate->setStyle("color: #666666;");
|
||||
$oOptionNewsletter->setStyle("color: #666666;");
|
||||
}
|
||||
|
||||
$oSelHTMLTemplateIDCat->addOptionElement($oDB->f("idcat"), $oOptionTemplate);
|
||||
$oSelHTMLNewsletterIDCat->addOptionElement($oDB->f("idcat"), $oOptionNewsletter);
|
||||
}
|
||||
|
||||
// Get html template category
|
||||
$iHTMLTemplateIDCat = (int)$oClientLang->getProperty("newsletter", "html_template_idcat");
|
||||
if ($iHTMLTemplateIDCat < 0) {
|
||||
$iHTMLTemplateIDCat = 0;
|
||||
}
|
||||
$oSelHTMLTemplateIDCat->setDefault($iHTMLTemplateIDCat);
|
||||
|
||||
// Get html newsletter article category
|
||||
$iHTMLNewsletterIDCat = (int)$oClientLang->getProperty("newsletter", "html_newsletter_idcat");
|
||||
if ($iHTMLNewsletterIDCat < 0) {
|
||||
$iHTMLNewsletterIDCat = 0;
|
||||
}
|
||||
$oSelHTMLNewsletterIDCat->setDefault($iHTMLNewsletterIDCat);
|
||||
|
||||
// Global HTML newsletter option
|
||||
$bHTMLNewsletter = false;
|
||||
if ($iHTMLTemplateIDCat > 0 && $iHTMLNewsletterIDCat > 0 && $oClientLang->getProperty("newsletter", "html_newsletter") == "true") {
|
||||
// If necessary idcats are not specified or the option is disabled,
|
||||
// then HTML are not used
|
||||
$bHTMLNewsletter = true;
|
||||
}
|
||||
$oCkbHTMLNewsletter = new cHTMLCheckbox("ckbHTMLNewsletter", "enabled", "", $bHTMLNewsletter);
|
||||
|
||||
// Disable HTML options, if user has no rights
|
||||
if (!$perm->have_perm_area_action($area, "news_html_settings"))
|
||||
{
|
||||
$oSelHTMLTemplateIDCat->setDisabled("disabled");
|
||||
$oSelHTMLNewsletterIDCat->setDisabled("disabled");
|
||||
$oCkbHTMLNewsletter->setDisabled("disabled");
|
||||
}
|
||||
|
||||
// Destination for sending test newsletter
|
||||
$oSelTestDestination = new cHTMLSelectElement("selTestDestination");
|
||||
$oSelTestDestination->setStyle("width: 220px;");
|
||||
|
||||
$oOption = new cHTMLOptionElement(i18n("My mail address", "cl_newsletter"), 0);
|
||||
$oSelTestDestination->addOptionElement(0, $oOption);
|
||||
|
||||
$oRcpGroups = new RecipientGroupCollection;
|
||||
$oRcpGroups->setWhere("idclient", (int)$client);
|
||||
$oRcpGroups->setWhere("idlang", (int)$lang);
|
||||
$oRcpGroups->setOrder("groupname");
|
||||
$oRcpGroups->query();
|
||||
|
||||
$bTestTargetFound = false;
|
||||
// Get client and language specific test destination. As lang is client specific, lang is sufficient
|
||||
$iTestDestination = (int)$oUser->getProperty("newsletter", "test_idnewsgrp_lang" . $lang);
|
||||
while ($oRcpGroup = $oRcpGroups->next())
|
||||
{
|
||||
$iID = $oRcpGroup->get($oRcpGroup->primaryKey);
|
||||
|
||||
if ($iTestDestination == $iID) {
|
||||
$bTestTargetFound = true;
|
||||
}
|
||||
|
||||
$oOption = new cHTMLOptionElement($oRcpGroup->get("groupname"), $iID);
|
||||
$oSelTestDestination->addOptionElement($iID, $oOption);
|
||||
}
|
||||
unset($oRcpGroups);
|
||||
|
||||
if (!$bTestTargetFound) {
|
||||
// Currently specified test target doesn't exist anymore, get back to "my mail"
|
||||
$iTestDestination = 0;
|
||||
}
|
||||
if (!$perm->have_perm_area_action($area, "news_send_test"))
|
||||
{
|
||||
// No right to send somewhere else than to yourself
|
||||
$iTestDestination = 0;
|
||||
$oSelTestDestination->setDisabled("disabled");
|
||||
}
|
||||
$oSelTestDestination->setDefault($iTestDestination);
|
||||
|
||||
$oBtnSave = new cHTMLButton("submit", i18n("Save", "cl_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";
|
||||
$sContent .= ' <input type="hidden" name="area" value="'.$area.'">'."\n";
|
||||
$sContent .= ' <input type="hidden" name="frame" value="2">'."\n";
|
||||
$sContent .= ' <input type="hidden" name="contenido" value="'.$sess->id.'">'."\n";
|
||||
$sContent .= ' <input type="hidden" name="elemperpage" value="'.$_REQUEST["elemperpage"].'">'."\n";
|
||||
$sContent .= ' <input type="hidden" name="sortby" value="'.$_REQUEST["sortby"].'">'."\n";
|
||||
$sContent .= ' <input type="hidden" name="sortorder" value="'.$_REQUEST["sortorder"].'">'."\n";
|
||||
$sContent .= ' <input type="hidden" name="restrictgroup" value="'.$_REQUEST["restrictgroup"].'">'."\n";
|
||||
$sContent .= ' <input type="hidden" name="filter" value="'.$_REQUEST["filter"].'">'."\n";
|
||||
$sContent .= ' <input type="hidden" name="searchin" value="'.$_REQUEST["searchin"].'">'."\n";
|
||||
$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", "cl_newsletter").'</td>'."\n";
|
||||
$sContent .= ' </tr>'."\n";
|
||||
$sContent .= ' <tr>'."\n";
|
||||
$sContent .= ' <td>'.i18n("HTML Template Category:", "cl_newsletter").'<br />'.$oSelHTMLTemplateIDCat->render().'</td>'."\n";
|
||||
$sContent .= ' </tr>'."\n";
|
||||
$sContent .= ' <tr>'."\n";
|
||||
$sContent .= ' <td>'.i18n("HTML Newsletter Category:", "cl_newsletter").'<br />'.$oSelHTMLNewsletterIDCat->render().'</td>'."\n";
|
||||
$sContent .= ' </tr>'."\n";
|
||||
$sContent .= ' <tr>'."\n";
|
||||
$sContent .= ' <td>'.i18n("Send test destination:", "cl_newsletter").'<br />'.$oSelTestDestination->render().'</td>'."\n";
|
||||
$sContent .= ' </tr>'."\n";
|
||||
$sContent .= ' <tr>'."\n";
|
||||
$sContent .= ' <td style="text-align: right;">'.$oBtnSave->render().'</td>'."\n";
|
||||
$sContent .= ' </tr>'."\n";
|
||||
$sContent .= ' </table>'."\n";
|
||||
$sContent .= ' </form>'."\n";
|
||||
$sContent .= '</div>'."\n";
|
||||
$oSettingsRow->setContentData($sContent);
|
||||
|
||||
######################################
|
||||
# 1.3 Newsletter: List options folding row
|
||||
######################################
|
||||
// Items per Page
|
||||
$iItemsPerPage = (int)$oUser->getProperty("itemsperpage", "news"); // Also used in query below
|
||||
if ($iItemsPerPage == 0) {
|
||||
$iItemsPerPage = 25; // All can't be saved
|
||||
}
|
||||
|
||||
$oSelItemsPerPage = new cHTMLSelectElement("elemperpage");
|
||||
$oSelItemsPerPage->autoFill(array(0 => i18n("-- All --", "cl_newsletter"), 25 => 25, 50 => 50, 75 => 75, 100 => 100));
|
||||
$oSelItemsPerPage->setDefault($iItemsPerPage);
|
||||
// Sort By
|
||||
$oSelSortBy = new cHTMLSelectElement("sortby");
|
||||
$oOption = new cHTMLOptionElement("Name", "name");
|
||||
$oSelSortBy->addOptionElement($sKey, $oOption);
|
||||
$oSelSortBy->setDefault("name");
|
||||
// Sort Order
|
||||
$oSelSortOrder = new cHTMLSelectElement("sortorder");
|
||||
$oSelSortOrder->autoFill(array("ASC" => i18n("Ascending", "cl_newsletter"), "DESC" => i18n("Descending", "cl_newsletter")));
|
||||
$oSelSortOrder->setDefault("ASC");
|
||||
// Search For
|
||||
$oTextboxFilter = new cHTMLTextbox("filter", "", 16);
|
||||
// Search In
|
||||
$oSelSearchIn = new cHTMLSelectElement("searchin");
|
||||
$oOption = new cHTMLOptionElement(i18n("-- All fields --", "cl_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", "cl_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";
|
||||
$sContent .= ' <input type="hidden" name="area" value="news">'."\n";
|
||||
$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", "cl_newsletter").'</td>'."\n";
|
||||
$sContent .= ' <td>'.$oSelItemsPerPage->render().'</td>'."\n";
|
||||
$sContent .= ' </tr>'."\n";
|
||||
$sContent .= ' <tr>'."\n";
|
||||
$sContent .= ' <td>'. i18n("Sort by", "cl_newsletter").'</td>'."\n";
|
||||
$sContent .= ' <td>'.$oSelSortBy->render().'</td>'."\n";
|
||||
$sContent .= ' </tr>'."\n";
|
||||
$sContent .= ' <tr>'."\n";
|
||||
$sContent .= ' <td>'. i18n("Sort order", "cl_newsletter").'</td>'."\n";
|
||||
$sContent .= ' <td>'.$oSelSortOrder->render().'</td>'."\n";
|
||||
$sContent .= ' </tr>'."\n";
|
||||
$sContent .= ' <tr>'."\n";
|
||||
$sContent .= ' <td>'. i18n("Search for", "cl_newsletter").'</td>'."\n";
|
||||
$sContent .= ' <td>'.$oTextboxFilter->render().'</td>'."\n";
|
||||
$sContent .= ' </tr>'."\n";
|
||||
$sContent .= ' <tr>'."\n";
|
||||
$sContent .= ' <td>'. i18n("Search in", "cl_newsletter").'</td>'."\n";
|
||||
$sContent .= ' <td>'.$oSelSearchIn->render().'</td>'."\n";
|
||||
$sContent .= ' </tr>'."\n";
|
||||
$sContent .= ' <tr>'."\n";
|
||||
$sContent .= ' <td> </td>'."\n";
|
||||
$sContent .= ' <td>'.$oBtnApply->render().'</td>'."\n";
|
||||
$sContent .= ' </tr>'."\n";
|
||||
$sContent .= ' </table>'."\n";
|
||||
$sContent .= '</form>'."\n";
|
||||
$sContent .= '</div>'."\n";
|
||||
|
||||
// To template
|
||||
$sLink = "listoption";
|
||||
$oListOptionsRow = new cFoldingRow("9d0968be-601d-44f8-a666-99d51c9c777d",i18n("List options", "cl_newsletter"), $sLink);
|
||||
$oListOptionsRow->setContentData($sContent);
|
||||
$oTpl->set('s', 'LISTOPTIONLINK', $sLink);
|
||||
|
||||
######################################
|
||||
# 1.4 Newsletter: Paging folding row
|
||||
######################################
|
||||
|
||||
// Add paging folding row (current page = 1) to get HTML paging container (later on updated by ...menu.php)
|
||||
$oPagerLink = new cHTMLLink;
|
||||
$oPagerLink->setLink("main.php");
|
||||
$oPagerLink->setTargetFrame("left_bottom");
|
||||
$oPagerLink->setCustom("elemperpage", $iItemsPerPage);
|
||||
$oPagerLink->setCustom("filter", "");
|
||||
//$oPagerLink->setCustom("restrictgroup", $_REQUEST["restrictgroup"]);
|
||||
$oPagerLink->setCustom("sortby", "name");
|
||||
$oPagerLink->setCustom("sortorder", "ASC");
|
||||
$oPagerLink->setCustom("searchin", "name");
|
||||
$oPagerLink->setCustom("frame", "2");
|
||||
$oPagerLink->setCustom("area", "news");
|
||||
$oPagerLink->enableAutomaticParameterAppend();
|
||||
$oPagerLink->setCustom("contenido", $sess->id);
|
||||
|
||||
$sLink = "pagerlink";
|
||||
$oTpl->set('s', 'PAGINGLINK', $sLink);
|
||||
//$oPagerRow = new cObjectPager("0ed6d632-6adf-4f09-a0c6-1e38ab60e302", $iItemCount, $iItemsPerPage, 1, $oPagerLink, 'page', $sLink);
|
||||
$oPagerRow = new cObjectPager("0ed6d632-6adf-4f09-a0c6-1e38ab60e302", 0, 1, 1, $oPagerLink, 'page', $sLink);
|
||||
|
||||
######################################
|
||||
# Newsletter: Container
|
||||
######################################
|
||||
$sContainerId = 'cont_newsletter';
|
||||
$sContainer = '<div id="'.$sContainerId.'">';
|
||||
$sContainer .= '<table border="0" cellspacing="0" cellpadding="0" width="100%">';
|
||||
if ($perm->have_perm_area_action("news", "news_create")) {
|
||||
$sContainer .= $oActionsRow->render();
|
||||
}
|
||||
if ($perm->have_perm_area_action("news", "news_html_settings")) {
|
||||
$sContainer .= $oSettingsRow->render();
|
||||
}
|
||||
$sContainer .= $oListOptionsRow->render();
|
||||
$sContainer .= $oPagerRow->render();
|
||||
$sContainer .= '</table>';
|
||||
$sContainer .= '</div>';
|
||||
$oTpl->set('s', 'CNEWSLETTER', $sContainer);
|
||||
$oTpl->set('s', 'ID_CNEWSLETTER', $sContainerId);
|
||||
|
||||
######################################
|
||||
# 2. Job dispatch
|
||||
######################################
|
||||
// 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. ... menu.php, also.
|
||||
// field: Field name in the db
|
||||
// caption: Shown field name (-> user)
|
||||
// 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" => "name", "caption" => i18n("Name", "cl_newsletter"), "type" => "base,sort,search");
|
||||
$aFields["created"] = array("field" => "created", "caption" => i18n("Created", "cl_newsletter"), "type" => "base,sort");
|
||||
$aFields["status"] = array("field" => "status", "caption" => i18n("Status", "cl_newsletter"), "type" => "base,sort");
|
||||
$aFields["cronjob"] = array("field" => "use_cronjob", "caption" => i18n("Use cronjob", "cl_newsletter"), "type" => "base");
|
||||
|
||||
######################################
|
||||
# 2.1 Job dispatch: List options folding row
|
||||
######################################
|
||||
// Author
|
||||
$oSelAuthor = new cHTMLSelectElement("selAuthor");
|
||||
|
||||
// Get possible authors/users from available jobs
|
||||
// For this query genericdb can't be used, as the class id is always included (distinct won't work)
|
||||
$sSQL = "SELECT DISTINCT author, authorname FROM ".$cfg["tab"]["news_jobs"]." ORDER BY authorname";
|
||||
$oDB->query($sSQL);
|
||||
|
||||
$aItems = array();
|
||||
$bUserInList = false;
|
||||
while ($oDB->next_record())
|
||||
{
|
||||
if ($oDB->f("author") == $auth->auth["uid"]) {
|
||||
$bUserInList = true;
|
||||
}
|
||||
$aItems[] = array($oDB->f("author"), urldecode($oDB->f("authorname")));
|
||||
}
|
||||
$oSelAuthor->autoFill($aItems);
|
||||
|
||||
if (!$bUserInList) {
|
||||
// Current ser hasn't sent newsletter jobs, yet - add him to the list (it's the default author)
|
||||
$oOption = new cHTMLOptionElement($auth->auth["uname"], $auth->auth["uid"]);
|
||||
$oSelAuthor->addOptionElement($auth->auth["uid"], $oOption);
|
||||
}
|
||||
$oSelAuthor->setDefault($auth->auth["uid"]);
|
||||
|
||||
// Items per page
|
||||
$iItemsPerPage = (int)$oUser->getProperty("itemsperpage", "news_jobs"); // Used also below in query
|
||||
if ($iItemsPerPage == 0) {
|
||||
$iItemsPerPage = 25; // All can't be saved
|
||||
}
|
||||
|
||||
$oSelItemsPerPage = new cHTMLSelectElement("elemperpage");
|
||||
$oSelItemsPerPage->autoFill(array(0 => i18n("-- All --", "cl_newsletter"), 25 => 25, 50 => 50, 75 => 75, 100 => 100));
|
||||
$oSelItemsPerPage->setDefault($iItemsPerPage);
|
||||
|
||||
// Sort by
|
||||
$oSelSortBy = new cHTMLSelectElement("sortby");
|
||||
foreach ($aFields as $sKey => $aData) {
|
||||
if (strpos($aData["type"], "sort") !== false)
|
||||
{
|
||||
$oOption = new cHTMLOptionElement($aData["caption"], $sKey);
|
||||
$oSelSortBy->addOptionElement($sKey, $oOption);
|
||||
}
|
||||
}
|
||||
$oSelSortBy->setDefault("created");
|
||||
|
||||
// Sort order
|
||||
$oSelSortOrder = new cHTMLSelectElement("sortorder");
|
||||
$oSelSortOrder->autoFill(array("ASC" => i18n("Ascending", "cl_newsletter"), "DESC" => i18n("Descending", "cl_newsletter")));
|
||||
$oSelSortOrder->setDefault("DESC");
|
||||
|
||||
// Filter
|
||||
$oTxtFilter = new cHTMLTextbox("filter", "", 16);
|
||||
|
||||
//Search in
|
||||
$oSelSearchIn = new cHTMLSelectElement("searchin");
|
||||
$oOption = new cHTMLOptionElement(i18n("-- All fields --", "cl_newsletter"), "--all--");
|
||||
$oSelSearchIn->addOptionElement("all", $oOption);
|
||||
|
||||
foreach ($aFields as $sKey => $aData)
|
||||
{
|
||||
if (strpos($aData["type"], "search") !== false)
|
||||
{
|
||||
$oOption = new cHTMLOptionElement($aData["caption"], $sKey);
|
||||
$oSelSearchIn->addOptionElement($sKey, $oOption);
|
||||
}
|
||||
}
|
||||
$oSelSearchIn->setDefault("--all--");
|
||||
|
||||
$oBtnApply = new cHTMLButton("submit", i18n("Apply", "cl_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";
|
||||
$sContent .= ' <input type="hidden" name="area" value="news_jobs">'."\n";
|
||||
$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", "cl_newsletter").'</td>'."\n";
|
||||
$sContent .= ' <td>'.$oSelAuthor->render().'</td>'."\n";
|
||||
$sContent .= ' </tr>'."\n";
|
||||
$sContent .= ' <tr>'."\n";
|
||||
$sContent .= ' <td>'. i18n("Items / page", "cl_newsletter").'</td>'."\n";
|
||||
$sContent .= ' <td>'.$oSelItemsPerPage->render().'</td>'."\n";
|
||||
$sContent .= ' </tr>'."\n";
|
||||
$sContent .= ' <tr>'."\n";
|
||||
$sContent .= ' <td>'. i18n("Sort by", "cl_newsletter").'</td>'."\n";
|
||||
$sContent .= ' <td>'.$oSelSortBy->render().'</td>'."\n";
|
||||
$sContent .= ' </tr>'."\n";
|
||||
$sContent .= ' <tr>'."\n";
|
||||
$sContent .= ' <td>'. i18n("Sort order", "cl_newsletter").'</td>'."\n";
|
||||
$sContent .= ' <td>'.$oSelSortOrder->render().'</td>'."\n";
|
||||
$sContent .= ' </tr>'."\n";
|
||||
$sContent .= ' <tr>'."\n";
|
||||
$sContent .= ' <td>'. i18n("Search for", "cl_newsletter").'</td>'."\n";
|
||||
$sContent .= ' <td>'.$oTxtFilter->render().'</td>'."\n";
|
||||
$sContent .= ' </tr>'."\n";
|
||||
$sContent .= ' <tr>'."\n";
|
||||
$sContent .= ' <td>'. i18n("Search in", "cl_newsletter").'</td>'."\n";
|
||||
$sContent .= ' <td>'.$oSelSearchIn->render().'</td>'."\n";
|
||||
$sContent .= ' </tr>'."\n";
|
||||
$sContent .= ' <tr>'."\n";
|
||||
$sContent .= ' <td> </td>'."\n";
|
||||
$sContent .= ' <td>'.$oBtnApply->render().'</td>'."\n";
|
||||
$sContent .= ' </tr>'."\n";
|
||||
$sContent .= ' </table>'."\n";
|
||||
$sContent .= '</form>'."\n";
|
||||
$sContent .= '</div>'."\n";
|
||||
|
||||
// To template
|
||||
$sLink = "listoptiondisp";
|
||||
$oListOptionsRow = new cFoldingRow("dfa6cc00-0acf-11db-9cd8-0800200c9a66",i18n("List options", "cl_newsletter"), $sLink);
|
||||
$oListOptionsRow->setContentData($sContent);
|
||||
$oTpl->set('s', 'LISTOPTIONLINKDISP', $sLink);
|
||||
|
||||
######################################
|
||||
# 2.2 Job dispatch: Paging folding row
|
||||
######################################
|
||||
$oPagerLink = new cHTMLLink;
|
||||
$oPagerLink->setLink("main.php");
|
||||
$oPagerLink->setTargetFrame('left_bottom');
|
||||
$oPagerLink->setCustom("selAuthor", $auth->auth["uid"]);
|
||||
$oPagerLink->setCustom("elemperpage", $iItemsPerPage);
|
||||
$oPagerLink->setCustom("filter", "");
|
||||
//$oPagerLink->setCustom("restrictgroup", $_REQUEST["restrictgroup"]);
|
||||
$oPagerLink->setCustom("sortby", "created");
|
||||
$oPagerLink->setCustom("sortorder", "DESC");
|
||||
$oPagerLink->setCustom("searchin", "--all--");
|
||||
$oPagerLink->setCustom("frame", "2"); // HIER!!! Stimmt das?
|
||||
$oPagerLink->setCustom("area", "news_jobs");
|
||||
$oPagerLink->enableAutomaticParameterAppend();
|
||||
$oPagerLink->setCustom("contenido", $sess->id);
|
||||
|
||||
$sLink = "pagerlinkdisp";
|
||||
$oTpl->set('s', 'PAGINGLINKDISP', $sLink);
|
||||
//$oPagerRow = new cObjectPager("0ed6d632-6adf-4f09-a0c6-1e38ab60e303", $iItemCount, $iItemsPerPage, 1, $oPagerLink, "page", $sLink);
|
||||
$oPagerRow = new cObjectPager("0ed6d632-6adf-4f09-a0c6-1e38ab60e303", 0, 1, 1, $oPagerLink, 'page', $sLink);
|
||||
|
||||
######################################
|
||||
# Job dispatch: Container
|
||||
######################################
|
||||
$sContainerId = 'cont_dispatch';
|
||||
$sContainer = '<div id="'.$sContainerId.'">';
|
||||
$sContainer .= '<table border="0" cellspacing="0" cellpadding="0" width="100%">';
|
||||
$sContainer .= $oListOptionsRow->render();
|
||||
$sContainer .= $oPagerRow->render();
|
||||
$sContainer .= '</table>';
|
||||
$sContainer .= '</div>';
|
||||
$oTpl->set('s', 'CDISPATCH', $sContainer);
|
||||
$oTpl->set('s', 'ID_CDISPATCH', $sContainerId);
|
||||
|
||||
######################################
|
||||
# 3. Recipients
|
||||
######################################
|
||||
// See comment at 2. Job dispatch
|
||||
$aFields = array();
|
||||
$aFields["name"] = array("field" => "name", "caption" => i18n("Name", "cl_newsletter"),"type" => "base,sort,search");
|
||||
$aFields["email"] = array("field" => "email", "caption" => i18n("E-Mail", "cl_newsletter"),"type" => "base,sort,search");
|
||||
$aFields["confirmed"] = array("field" => "confirmed", "caption" => i18n("Confirmed", "cl_newsletter"), "type" => "base");
|
||||
$aFields["deactivated"] = array("field" => "deactivated", "caption" => i18n("Deactivated", "cl_newsletter"), "type" => "base");
|
||||
|
||||
######################################
|
||||
# 3.1 Recipients: Actions folding row
|
||||
######################################
|
||||
$sContent = '<div style="padding: 4px; padding-left: 17px; border-bottom: 0px solid black; background: '.$cfg['color']['table_dark'].';">'."\n";
|
||||
|
||||
// Create a link to add a recipient
|
||||
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", "cl_newsletter").'</a>');
|
||||
|
||||
$sContent .= $oLink->render().'<br />'."\n";
|
||||
}
|
||||
|
||||
// Create a link to import recipients
|
||||
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", "cl_newsletter").'</a>');
|
||||
|
||||
$sContent .= $oLink->render().'<br />'."\n";
|
||||
}
|
||||
|
||||
// Create a link to purge subscribed but not confirmed recipients
|
||||
$iTimeframe = (int)$oClient->getProperty("newsletter", "purgetimeframe");
|
||||
if ($iTimeframe <= 0) {
|
||||
$iTimeframe = 30;
|
||||
}
|
||||
|
||||
if ($perm->have_perm_area_action("recipients", "recipients_delete"))
|
||||
{
|
||||
$oLink = new cHTMLLink;
|
||||
$oLink->setLink('javascript:showPurgeMsg("'.i18n('Purge recipients', "cl_newsletter").'", "'.sprintf(i18n("Do you really want to remove recipients, that have not been confirmed since %s days and over?", "cl_newsletter"), '"+purgetimeframe+"').'")');
|
||||
|
||||
$oLink->setContent('<img style="margin-right: 4px;" src="'.$cfg["path"]["images"] . 'delete.gif" align="middle">'.i18n("Purge recipients", "cl_newsletter").'</a>');
|
||||
|
||||
$sContent .= $oLink->render();
|
||||
}
|
||||
$sContent .= '</div>'."\n";
|
||||
$oTpl->set('s', 'VALUE_PURGETIMEFRAME', $iTimeframe);
|
||||
|
||||
// To template
|
||||
$sLink = "actionrec";
|
||||
$oListActionsRow = new cFoldingRow("f0d7bf80-e73e-11d9-8cd6-0800200c9a66", i18n("Actions", "cl_newsletter"), $sLink);
|
||||
$oListActionsRow->setContentData($sContent);
|
||||
$oTpl->set('s', 'ACTIONLINKREC', $sLink);
|
||||
|
||||
######################################
|
||||
# 3.2 Recipients: Settings folding row
|
||||
######################################
|
||||
$oTxtTimeframe = new cHTMLTextbox("txtPurgeTimeframe", $iTimeframe, 5);
|
||||
$oBtnSave = new cHTMLButton("submit", i18n("Save", "cl_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";
|
||||
$sContent .= ' <input type="hidden" name="area" value="recipients">'."\n";
|
||||
$sContent .= ' <input type="hidden" name="frame" value="2">'."\n";
|
||||
$sContent .= ' <input type="hidden" name="contenido" value="'.$sess->id.'">'."\n";
|
||||
$sContent .= ' <input type="hidden" name="elemperpage" value="'.$_REQUEST["elemperpage"].'">'."\n";
|
||||
$sContent .= ' <input type="hidden" name="sortby" value="'.$_REQUEST["sortby"].'">'."\n";
|
||||
$sContent .= ' <input type="hidden" name="sortorder" value="'.$_REQUEST["sortorder"].'">'."\n";
|
||||
$sContent .= ' <input type="hidden" name="restrictgroup" value="'.$_REQUEST["restrictgroup"].'">'."\n";
|
||||
$sContent .= ' <input type="hidden" name="filter" value="'.$_REQUEST["filter"].'">'."\n";
|
||||
$sContent .= ' <input type="hidden" name="searchin" value="'.$_REQUEST["searchin"].'">'."\n";
|
||||
$sContent .= ' <table>'."\n";
|
||||
$sContent .= ' <tr>'."\n";
|
||||
$sContent .= ' <td>'. i18n("Purge timeframe", "cl_newsletter").':</td>'."\n";
|
||||
$sContent .= ' <td>'.$oTxtTimeframe->render().' '.i18n("days", "cl_newsletter").'</td>'."\n";
|
||||
$sContent .= ' </tr>'."\n";
|
||||
$sContent .= ' <tr>'."\n";
|
||||
$sContent .= ' <td> </td>'."\n";
|
||||
$sContent .= ' <td>'.$oBtnSave->render().'</td>'."\n";
|
||||
$sContent .= ' </tr>'."\n";
|
||||
$sContent .= ' </table>'."\n";
|
||||
$sContent .= '</form>'."\n";
|
||||
$sContent .= '</div>'."\n";
|
||||
|
||||
// To template
|
||||
$sLink = "settingsrec";
|
||||
$oSettingsRow = new cFoldingRow("5ddbe820-e6f1-11d9-8cd6-0800200c9a69",i18n("Settings", "cl_newsletter"), $sLink);
|
||||
$oSettingsRow->setContentData($sContent);
|
||||
$oTpl->set('s', 'SETTINGSLINKREC', $sLink);
|
||||
|
||||
######################################
|
||||
# 3.3 Recipients: List options folding row
|
||||
######################################
|
||||
$iItemsPerPage = (int)$oUser->getProperty("itemsperpage", "recipients");
|
||||
if ($iItemsPerPage == 0) {
|
||||
$iItemsPerPage = 25; // All can't be saved
|
||||
}
|
||||
|
||||
$oSelItemsPerPage = new cHTMLSelectElement("elemperpage");
|
||||
$oSelItemsPerPage->autoFill(array(0 => i18n("-- All --", "cl_newsletter"), 25 => 25, 50 => 50, 75 => 75, 100 => 100));
|
||||
$oSelItemsPerPage->setDefault($iItemsPerPage);
|
||||
|
||||
$oSelSortBy = new cHTMLSelectElement("sortby");
|
||||
foreach ($aFields as $sKey => $aData)
|
||||
{
|
||||
if (strpos($aData["type"], "sort") !== false) {
|
||||
$oOption = new cHTMLOptionElement($aData["caption"], $aData["field"]);
|
||||
$oSelSortBy->addOptionElement($aData["field"], $oOption);
|
||||
}
|
||||
}
|
||||
$oSelSortBy->setDefault("name");
|
||||
|
||||
$oSelSortOrder = new cHTMLSelectElement("sortorder");
|
||||
$oSelSortOrder->autoFill(array("ASC" => i18n("Ascending", "cl_newsletter"), "DESC" => i18n("Descending", "cl_newsletter")));
|
||||
$oSelSortOrder->setDefault("ASC");
|
||||
|
||||
$oSelRestrictGroup = new cHTMLSelectElement("restrictgroup");
|
||||
$oOption = new cHTMLOptionElement(i18n("-- All groups --", "cl_newsletter"), "--all--");
|
||||
$oSelRestrictGroup->addOptionElement("all", $oOption);
|
||||
|
||||
// Fetch recipient groups
|
||||
$oRGroups = new RecipientGroupCollection;
|
||||
$oRGroups->setWhere("idclient", $client);
|
||||
$oRGroups->setWhere("idlang", $lang);
|
||||
$oRGroups->setOrder("defaultgroup DESC, groupname ASC");
|
||||
$oRGroups->query();
|
||||
|
||||
$i = 1;
|
||||
while ($oRGroup = $oRGroups->next())
|
||||
{
|
||||
if ($oRGroup->get("defaultgroup") == 1) {
|
||||
$sGroupname = $oRGroup->get("groupname") . "*";
|
||||
} else {
|
||||
$sGroupname = $oRGroup->get("groupname");
|
||||
}
|
||||
$oOption = new cHTMLOptionElement($sGroupname, $oRGroup->get("idnewsgroup"));
|
||||
$oSelRestrictGroup->addOptionElement($i, $oOption);
|
||||
$i++;
|
||||
}
|
||||
|
||||
$oSelRestrictGroup->setDefault("--all--");
|
||||
|
||||
$oTxtFilter = new cHTMLTextbox("filter", "", 16);
|
||||
|
||||
$oSelSearchIn = new cHTMLSelectElement("searchin");
|
||||
$oOption = new cHTMLOptionElement(i18n("-- All fields --", "cl_newsletter"), "--all--");
|
||||
$oSelSearchIn->addOptionElement("all", $oOption);
|
||||
|
||||
foreach ($aFields as $sKey => $aData) {
|
||||
if (strpos($aData["type"], "search") !== false) {
|
||||
$oOption = new cHTMLOptionElement($aData["caption"], $aData["field"]);
|
||||
$oSelSearchIn->addOptionElement($aData["field"], $oOption);
|
||||
}
|
||||
}
|
||||
$oSelSearchIn->setDefault("--all--");
|
||||
|
||||
$oBtnApply = new cHTMLButton("submit", i18n("Apply"));
|
||||
|
||||
$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="recipients_listoptionsform" name="recipients_listoptionsform" method="get" action="">'."\n";
|
||||
$sContent .= ' <input type="hidden" name="area" value="recipients">'."\n";
|
||||
$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", "cl_newsletter").'</td>'."\n";
|
||||
$sContent .= ' <td>'.$oSelItemsPerPage->render().'</td>'."\n";
|
||||
$sContent .= ' </tr>'."\n";
|
||||
$sContent .= ' <tr>'."\n";
|
||||
$sContent .= ' <td>'. i18n("Sort by", "cl_newsletter").'</td>'."\n";
|
||||
$sContent .= ' <td>'.$oSelSortBy->render().'</td>'."\n";
|
||||
$sContent .= ' </tr>'."\n";
|
||||
$sContent .= ' <tr>'."\n";
|
||||
$sContent .= ' <td>'. i18n("Sort order", "cl_newsletter").'</td>'."\n";
|
||||
$sContent .= ' <td>'.$oSelSortOrder->render().'</td>'."\n";
|
||||
$sContent .= ' </tr>'."\n";
|
||||
$sContent .= ' <tr>'."\n";
|
||||
$sContent .= ' <td>'. i18n("Show group", "cl_newsletter").'</td>'."\n";
|
||||
$sContent .= ' <td>'.$oSelRestrictGroup->render().'</td>'."\n";
|
||||
$sContent .= ' </tr>'."\n";
|
||||
$sContent .= ' <tr>'."\n";
|
||||
$sContent .= ' <td>'. i18n("Search for", "cl_newsletter").'</td>'."\n";
|
||||
$sContent .= ' <td>'.$oTxtFilter->render().'</td>'."\n";
|
||||
$sContent .= ' </tr>'."\n";
|
||||
$sContent .= ' <tr>'."\n";
|
||||
$sContent .= ' <td>'. i18n("Search in", "cl_newsletter").'</td>'."\n";
|
||||
$sContent .= ' <td>'.$oSelSearchIn->render().'</td>'."\n";
|
||||
$sContent .= ' </tr>'."\n";
|
||||
$sContent .= ' <tr>'."\n";
|
||||
$sContent .= ' <td> </td>'."\n";
|
||||
$sContent .= ' <td>'.$oBtnApply->render().'</td>'."\n";
|
||||
$sContent .= ' </tr>'."\n";
|
||||
$sContent .= ' </table>'."\n";
|
||||
$sContent .= '</form>'."\n";
|
||||
$sContent .= '</div>'."\n";
|
||||
|
||||
// To template
|
||||
$sLink = "listoptionsrec";
|
||||
$oListOptionsRow = new cFoldingRow("5ddbe820-e6f1-11d9-8cd6-0800200c9a66",i18n("List options", "cl_newsletter"), $sLink);
|
||||
$oListOptionsRow->setContentData($sContent);
|
||||
$oTpl->set('s', 'LISTOPTIONLINKREC', $sLink);
|
||||
|
||||
######################################
|
||||
# 3.4 Recipients: Paging
|
||||
######################################
|
||||
$oPagerLink = new cHTMLLink;
|
||||
$oPagerLink->setLink("main.php");
|
||||
$oPagerLink->setTargetFrame('left_bottom');
|
||||
$oPagerLink->setCustom("elemperpage", $iItemsPerPage);
|
||||
$oPagerLink->setCustom("filter", "");
|
||||
$oPagerLink->setCustom("restrictgroup", "--all--");
|
||||
$oPagerLink->setCustom("sortby", "name");
|
||||
$oPagerLink->setCustom("sortorder", "ASC");
|
||||
$oPagerLink->setCustom("searchin", "--all--");
|
||||
$oPagerLink->setCustom("frame", "2");
|
||||
$oPagerLink->setCustom("area", "recipients");
|
||||
$oPagerLink->enableAutomaticParameterAppend();
|
||||
$oPagerLink->setCustom("contenido", $sess->id);
|
||||
|
||||
// To template
|
||||
$sLink = "pagingrec";
|
||||
$oTpl->set('s', 'PAGINGLINKREC', $sLink);
|
||||
//$oPagerRow = new cObjectPager("0ed6d632-6adf-4f09-a0c6-1e38ab60e304", $iItemCount, $iItemsPerPage, 1, $oPagerLink, "page", $sLink);
|
||||
$oPagerRow = new cObjectPager("0ed6d632-6adf-4f09-a0c6-1e38ab60e304", 0, 1, 1, $oPagerLink, 'page', $sLink);
|
||||
|
||||
######################################
|
||||
# Recipients: Container
|
||||
######################################
|
||||
$sContainerId = 'cont_recipients';
|
||||
$sContainer = '<div id="' . $sContainerId . '">';
|
||||
$sContainer .= '<table border="0" cellspacing="0" cellpadding="0" width="100%">';
|
||||
if ($perm->have_perm_area_action('recipients', "recipients_delete") || $perm->have_perm_area_action("recipients", "recipients_create")) {
|
||||
$sContainer .= $oListActionsRow->render();
|
||||
}
|
||||
$sContainer .= $oSettingsRow->render();
|
||||
$sContainer .= $oListOptionsRow->render();
|
||||
$sContainer .= $oPagerRow->render();
|
||||
$sContainer .= '</table>';
|
||||
$sContainer .= '</div>';
|
||||
$oTpl->set('s', 'CRECIPIENTS', $sContainer);
|
||||
$oTpl->set('s', 'ID_CRECIPIENTS', $sContainerId);
|
||||
|
||||
######################################
|
||||
# 4 Recipient groups
|
||||
######################################
|
||||
// See comment at 2. Job dispatch
|
||||
$aFields = array();
|
||||
$aFields["name"] = array("field" => "groupname", "caption" => i18n("Name", "cl_newsletter"), "type" => "base,sort,search");
|
||||
|
||||
######################################
|
||||
# 4.1 Recipient groups: Actions
|
||||
######################################
|
||||
$sContent = '<div style="padding: 4px; padding-left: 17px; border-bottom: 0px solid black; background: '.$cfg['color']['table_dark'].';">'."\n";
|
||||
|
||||
// Create a link to add a group
|
||||
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", "cl_newsletter").'</a>');
|
||||
$sContent .= $oLnk->render().'<br />'."\n";
|
||||
}
|
||||
|
||||
$sContent .= '</div>'."\n";
|
||||
|
||||
$sLink = "actiongroup";
|
||||
$oListActionsRow = new cFoldingRow("f0d7bf80-e73e-11d9-8cd6-0800200c9a67",i18n("Actions", "cl_newsletter"), $sLink);
|
||||
$oListActionsRow->setContentData($sContent);
|
||||
$oTpl->set('s', 'ACTIONLINKGROUP', $sLink);
|
||||
|
||||
######################################
|
||||
# 4.2 Recipient groups: List Options
|
||||
######################################
|
||||
$iItemsPerPage = (int)$oUser->getProperty("itemsperpage", "recipientgroups");
|
||||
if ($iItemsPerPage == 0) {
|
||||
$iItemsPerPage = 25; // All can't be saved
|
||||
}
|
||||
|
||||
$oSelItemsPerPage = new cHTMLSelectElement("elemperpage");
|
||||
$oSelItemsPerPage->autoFill(array(0 => i18n("-- All --", "cl_newsletter"), 25 => 25, 50 => 50, 75 => 75, 100 => 100));
|
||||
$oSelItemsPerPage->setDefault($iItemsPerPage);
|
||||
|
||||
$oSelSortBy = new cHTMLSelectElement("sortby");
|
||||
foreach ($aFields as $sKey => $aData) {
|
||||
if (strpos($aData["type"], "sort") !== false) {
|
||||
$oOption = new cHTMLOptionElement($aData["caption"], $aData["field"]);
|
||||
$oSelSortBy->addOptionElement($aData["field"], $oOption);
|
||||
}
|
||||
}
|
||||
$oSelSortBy->setDefault("name");
|
||||
|
||||
$oSelSortOrder = new cHTMLSelectElement("sortorder");
|
||||
$oSelSortOrder->autoFill(array("ASC" => i18n("Ascending", "cl_newsletter"), "DESC" => i18n("Descending", "cl_newsletter")));
|
||||
$oSelSortOrder->setDefault("ASC");
|
||||
|
||||
$oTxtFilter = new cHTMLTextbox("filter", "", 16);
|
||||
|
||||
$oSelSearchIn = new cHTMLSelectElement("searchin");
|
||||
$oOption = new cHTMLOptionElement(i18n("-- All fields --", "cl_newsletter"), "--all--");
|
||||
$oSelSearchIn->addOptionElement("all", $oOption);
|
||||
|
||||
foreach ($aFields as $sKey => $aData) {
|
||||
if (strpos($aData["type"], "search") !== false) {
|
||||
$oOption = new cHTMLOptionElement($aData["caption"], $aData["field"]);
|
||||
$oSelSearchIn->addOptionElement($aData["field"], $oOption);
|
||||
}
|
||||
}
|
||||
$oSelSearchIn->setDefault("--all--");
|
||||
|
||||
$oBtnApply = new cHTMLButton("submit", i18n("Apply", "cl_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";
|
||||
$sContent .= ' <input type="hidden" name="area" value="recipientgroups">'."\n";
|
||||
$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", "cl_newsletter").'</td>'."\n";
|
||||
$sContent .= ' <td>'.$oSelItemsPerPage->render().'</td>'."\n";
|
||||
$sContent .= ' </tr>'."\n";
|
||||
$sContent .= ' <tr>'."\n";
|
||||
$sContent .= ' <td>'. i18n("Sort by", "cl_newsletter").'</td>'."\n";
|
||||
$sContent .= ' <td>'.$oSelSortBy->render().'</td>'."\n";
|
||||
$sContent .= ' </tr>'."\n";
|
||||
$sContent .= ' <tr>'."\n";
|
||||
$sContent .= ' <td>'. i18n("Sort order", "cl_newsletter").'</td>'."\n";
|
||||
$sContent .= ' <td>'.$oSelSortOrder->render().'</td>'."\n";
|
||||
$sContent .= ' </tr>'."\n";
|
||||
$sContent .= ' <tr>'."\n";
|
||||
$sContent .= ' <td>'. i18n("Search for", "cl_newsletter").'</td>'."\n";
|
||||
$sContent .= ' <td>'.$oTxtFilter->render().'</td>'."\n";
|
||||
$sContent .= ' </tr>'."\n";
|
||||
$sContent .= ' <tr>'."\n";
|
||||
$sContent .= ' <td>'. i18n("Search in", "cl_newsletter").'</td>'."\n";
|
||||
$sContent .= ' <td>'.$oSelSearchIn->render().'</td>'."\n";
|
||||
$sContent .= ' </tr>'."\n";
|
||||
$sContent .= ' <tr>'."\n";
|
||||
$sContent .= ' <td> </td>'."\n";
|
||||
$sContent .= ' <td>'.$oBtnApply->render().'</td>'."\n";
|
||||
$sContent .= ' </tr>'."\n";
|
||||
$sContent .= ' </table>'."\n";
|
||||
$sContent .= '</form>'."\n";
|
||||
$sContent .= '</div>'."\n";
|
||||
|
||||
// To template
|
||||
$sLink = "listoptionsgroup";
|
||||
$oListOptionsRow = new cFoldingRow("79efc1fc-111d-11dc-8314-0800200c9a66",i18n("List options", "cl_newsletter"), $sLink);
|
||||
$oListOptionsRow->setContentData($sContent);
|
||||
$oTpl->set('s', 'LISTOPTIONLINKGROUP', $sLink);
|
||||
|
||||
######################################
|
||||
# 4.3 Recipient groups: Paging
|
||||
######################################
|
||||
$oPagerLink = new cHTMLLink;
|
||||
$oPagerLink->setLink("main.php");
|
||||
$oPagerLink->setTargetFrame('left_bottom');
|
||||
$oPagerLink->setCustom("elemperpage", $iItemsPerPage);
|
||||
$oPagerLink->setCustom("filter", "");
|
||||
$oPagerLink->setCustom("sortby", "name");
|
||||
$oPagerLink->setCustom("sortorder", "ASC");
|
||||
$oPagerLink->setCustom("searchin", "--all--");
|
||||
$oPagerLink->setCustom("frame", "2");
|
||||
$oPagerLink->setCustom("area", "recipientgroups");
|
||||
$oPagerLink->enableAutomaticParameterAppend();
|
||||
$oPagerLink->setCustom("contenido", $sess->id);
|
||||
|
||||
// To template
|
||||
$sLink = "paginggroup";
|
||||
$oTpl->set('s', 'PAGINGLINKGROUP', $sLink);
|
||||
//$oPagerRow = new cObjectPager("0ed6d632-6adf-4f09-a0c6-1e38ab60e305", $iItemCount, $iItemsPerPage, 1, $oPagerLink, "page", $sLink);
|
||||
$oPagerRow = new cObjectPager("0ed6d632-6adf-4f09-a0c6-1e38ab60e305", 0, 1, 1, $oPagerLink, 'page', $sLink);
|
||||
|
||||
######################################
|
||||
# Recipient Groups: Container
|
||||
######################################
|
||||
$sContainerId = 'cont_recipientgroup';
|
||||
$sContainer = '<div id="' . $sContainerId . '">';
|
||||
$sContainer .= '<table border="0" cellspacing="0" cellpadding="0" width="100%">';
|
||||
if ($perm->have_perm_area_action("recipientgroups", "recipientgroup_create")) {
|
||||
$sContainer .= $oListActionsRow->render();
|
||||
}
|
||||
$sContainer .= $oListOptionsRow->render();
|
||||
$sContainer .= $oPagerRow->render();
|
||||
$sContainer .= '</table>';
|
||||
$sContainer .= '</div>';
|
||||
$oTpl->set('s', 'CRECIPIENTGROUP', $sContainer);
|
||||
$oTpl->set('s', 'ID_CRECIPIENTGROUP', $sContainerId);
|
||||
|
||||
$oTpl->set('s', 'SESSID', $sess->id);
|
||||
$oTpl->generate($cfg['path']['templates'] . $cfg['templates']['newsletter_left_top']);
|
||||
|
||||
?>
|
|
@ -1,367 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Project:
|
||||
* Contenido Content Management System
|
||||
*
|
||||
* Description:
|
||||
* Frontend user list
|
||||
*
|
||||
* Requirements:
|
||||
* @con_php_req 5.0
|
||||
*
|
||||
*
|
||||
* @package Contenido Backend includes
|
||||
* @version 1.2.0
|
||||
* @author Bj<EFBFBD>rn Behrens (HerrB)
|
||||
* @copyright four for business AG <www.4fb.de>
|
||||
* @license http://www.contenido.org/license/LIZENZ.txt
|
||||
* @link http://www.4fb.de
|
||||
* @link http://www.contenido.org
|
||||
* @since file available since contenido release <= 4.6
|
||||
*
|
||||
* {@internal
|
||||
* created 2007-01-01, Bj<EFBFBD>rn Behrens (HerrB)
|
||||
* modified 2008-06-27, Dominik Ziegler, add security fix
|
||||
*
|
||||
* $Id$:
|
||||
* }}
|
||||
*
|
||||
*/
|
||||
if (!defined('CON_FRAMEWORK')) {
|
||||
die('Illegal call');
|
||||
}
|
||||
|
||||
|
||||
##################################
|
||||
# Initialization
|
||||
##################################
|
||||
$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");
|
||||
|
||||
// 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.
|
||||
// field: Field name in the db
|
||||
// caption: Shown field name (-> user)
|
||||
// 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" => "name", "caption" => i18n("Name", "cl_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
|
||||
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"]);
|
||||
} 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);
|
||||
}
|
||||
// Default value: Current user mail
|
||||
$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);
|
||||
}
|
||||
if (!is_numeric($_REQUEST["elemperpage"])) {
|
||||
// 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"]);
|
||||
}
|
||||
$_REQUEST["page"] = (int) $_REQUEST["page"];
|
||||
if ($_REQUEST["page"] <= 0 || $_REQUEST["elemperpage"] == 0) {
|
||||
$_REQUEST["page"] = 1;
|
||||
}
|
||||
// Sort order
|
||||
if ($_REQUEST["sortorder"] != "DESC") {
|
||||
$_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;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$bSortByFound) {
|
||||
$_REQUEST["sortby"] = "name"; // Default sort by field, possible values see above
|
||||
}
|
||||
if (!$bSearchInFound) {
|
||||
$_REQUEST["searchin"] = "--all--";
|
||||
}
|
||||
|
||||
// Free memory
|
||||
unset($oClientLang);
|
||||
unset($oUser);
|
||||
|
||||
##################################
|
||||
# Get data
|
||||
##################################
|
||||
$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["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"] --;
|
||||
}
|
||||
|
||||
$oNewsletters->setLimit($_REQUEST["elemperpage"] * ($_REQUEST["page"] - 1), $_REQUEST["elemperpage"]);
|
||||
} else {
|
||||
$iItemCount = 0;
|
||||
}
|
||||
|
||||
$oNewsletters->setOrder("welcome DESC, " . $_REQUEST["sortby"] . " " . $_REQUEST["sortorder"]);
|
||||
$oNewsletters->query();
|
||||
|
||||
// Output data
|
||||
$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", "cl_newsletter");
|
||||
$aMsg["DelDescr"] = i18n("Do you really want to delete the following newsletter:<br>", "cl_newsletter");
|
||||
|
||||
$aMsg["SendTestTitle"] = i18n("Send test newsletter", "cl_newsletter");
|
||||
$aMsg["SendTestTitleOff"] = i18n("Send test newsletter (disabled, check newsletter sender e-mail address and handler article selection)", "cl_newsletter");
|
||||
$aMsg["AddJobTitle"] = i18n("Add newsletter dispatch job", "cl_newsletter");
|
||||
$aMsg["AddJobTitleOff"] = i18n("Add newsletter dispatch job (disabled, check newsletter sender e-mail address and handler article selection)", "cl_newsletter");
|
||||
$aMsg["CopyTitle"] = i18n("Duplicate newsletter", "cl_newsletter");
|
||||
|
||||
while ($oNewsletter = $oNewsletters->next()) {
|
||||
$idnewsletter = $oNewsletter->get("idnews");
|
||||
$iMenu++;
|
||||
|
||||
$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 ($oRcpGroup = $oRcpGroups->next()) {
|
||||
$sSendTestTarget = sprintf(i18n("Recipient group: %s", "cl_newsletter"), $oRcpGroup->get("groupname"));
|
||||
}
|
||||
unset($oRcpGroups);
|
||||
}
|
||||
|
||||
$aMsg["SendTestDescr"] = sprintf(i18n("Do you really want to send the newsletter to:<br><strong>%s</strong>", "cl_newsletter"), $sSendTestTarget);
|
||||
|
||||
$sExecScript = '
|
||||
<script type="text/javascript">
|
||||
var sid = "' . $sess->id . '";
|
||||
|
||||
// Create messageBox instance
|
||||
box = new messageBox("", "", "", 0, 0);
|
||||
|
||||
function showSendTestMsg(lngId) {
|
||||
box.confirm("' . $aMsg["SendTestTitle"] . '", "' . $aMsg["SendTestDescr"] . '", "sendTestNewsletter(\'" + lngId + "\')");
|
||||
}
|
||||
|
||||
function showDelMsg(lngId, strElement) {
|
||||
box.confirm("' . $aMsg["DelTitle"] . '", "' . $aMsg["DelDescr"] . '<b>" + strElement + "</b>", "deleteNewsletter(\'" + lngId + "\')");
|
||||
}
|
||||
|
||||
//
|
||||
function checkSelection(strValue)
|
||||
{
|
||||
if (strValue == "selection") {
|
||||
document.getElementById("groupselect").disabled = false;
|
||||
} else {
|
||||
document.getElementById("groupselect").disabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Function for sending test newsletter
|
||||
function sendTestNewsletter(idnewsletter)
|
||||
{
|
||||
oForm = top.content.left.left_top.document.getElementById("newsletter_listoptionsform");
|
||||
|
||||
url = "main.php?area=news";
|
||||
url += "&action=news_send_test";
|
||||
url += "&frame=4";
|
||||
url += "&idnewsletter=" + idnewsletter;
|
||||
url += "&contenido=" + sid;
|
||||
url += get_registered_parameters();
|
||||
url += "&sortby=" + oForm.sortby.value;
|
||||
url += "&sortorder=" + oForm.sortorder.value;
|
||||
url += "&filter=" + oForm.filter.value;
|
||||
url += "&elemperpage=" + oForm.elemperpage.value;
|
||||
|
||||
parent.parent.right.right_bottom.location.href = url;
|
||||
}
|
||||
|
||||
// Function for deleting newsletters
|
||||
function deleteNewsletter(idnewsletter)
|
||||
{
|
||||
oForm = top.content.left.left_top.document.getElementById("newsletter_listoptionsform");
|
||||
|
||||
url = "main.php?area=news";
|
||||
url += "&action=news_delete";
|
||||
url += "&frame=4";
|
||||
url += "&idnewsletter=" + idnewsletter;
|
||||
url += "&contenido=" + sid;
|
||||
url += get_registered_parameters();
|
||||
url += "&sortby=" + oForm.sortby.value;
|
||||
url += "&sortorder=" + oForm.sortorder.value;
|
||||
url += "&filter=" + oForm.filter.value;
|
||||
url += "&elemperpage=" + oForm.elemperpage.value;
|
||||
|
||||
parent.parent.right.right_bottom.location.href = url;
|
||||
}
|
||||
</script>';
|
||||
|
||||
$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('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";
|
||||
$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("restrictgroup", $_REQUEST["restrictgroup"]);
|
||||
$oPagerLink->setCustom("frame", 2);
|
||||
$oPagerLink->setCustom("area", $area);
|
||||
$oPagerLink->enableAutomaticParameterAppend();
|
||||
$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
|
||||
$oPager = new cObjectPager($sPagerId, $iItemCount, $_REQUEST["elemperpage"], $_REQUEST["page"], $oPagerLink, "page");
|
||||
|
||||
// Add slashes, to insert in javascript
|
||||
$sPagerContent = $oPager->render(1);
|
||||
$sPagerContent = str_replace('\\', '\\\\', $sPagerContent);
|
||||
$sPagerContent = str_replace('\'', '\\\'', $sPagerContent);
|
||||
|
||||
// Send new object pager to left_top
|
||||
$oPage->addScript('setpager', '<script type="text/javascript" src="scripts/setPager.js"></script>');
|
||||
|
||||
$sRefreshPager = '
|
||||
<script type="text/javascript">
|
||||
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->setContent($oMenu->render(false));
|
||||
$oPage->render();
|
||||
?>
|
|
@ -1,65 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* Project:
|
||||
* Contenido Content Management System
|
||||
*
|
||||
* Description:
|
||||
* Custom subnavigation for the newsletters
|
||||
*
|
||||
* Requirements:
|
||||
* @con_php_req 5.0
|
||||
*
|
||||
*
|
||||
* @package Contenido Backend includes
|
||||
* @version 1.0.1
|
||||
* @author Bj<EFBFBD>rn Behrens (HerrB)
|
||||
* @copyright four for business AG <www.4fb.de>
|
||||
* @license http://www.contenido.org/license/LIZENZ.txt
|
||||
* @link http://www.4fb.de
|
||||
* @link http://www.contenido.org
|
||||
* @since file available since contenido release <= 4.6
|
||||
*
|
||||
* {@internal
|
||||
* created 2007-01-01, Bj<EFBFBD>rn Behrens (HerrB)
|
||||
* modified 2008-06-27, Dominik Ziegler, add security fix
|
||||
* modified 2010-05-20, Murat Purc, removed request check during processing ticket [#CON-307]
|
||||
*
|
||||
* $Id$:
|
||||
* }}
|
||||
*
|
||||
*/
|
||||
|
||||
if (!defined('CON_FRAMEWORK')) {
|
||||
die('Illegal call');
|
||||
}
|
||||
|
||||
|
||||
if (isset($_GET['idnewsletter']))
|
||||
{
|
||||
# Set template data
|
||||
$sCaption = i18n("Edit", "cl_newsletter");
|
||||
|
||||
$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=news&frame=4&idnewsletter=$idnewsletter").'">'.$sCaption.'</a>');
|
||||
$tpl->next();
|
||||
|
||||
# Set template data
|
||||
$sCaption = i18n("Edit Message", "cl_newsletter");
|
||||
|
||||
$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=news_edit&frame=4&idnewsletter=$idnewsletter").'">'.$sCaption.'</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"]);
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,72 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Project:
|
||||
* Contenido Content Management System
|
||||
*
|
||||
* Description:
|
||||
* Custom subnavigation for the newsletter recipient groups
|
||||
*
|
||||
* Requirements:
|
||||
* @con_php_req 5.0
|
||||
*
|
||||
*
|
||||
* @package Contenido Backend includes
|
||||
* @version 1.0.1
|
||||
* @author Bj<EFBFBD>rn Behrens (HerrB)
|
||||
* @copyright four for business AG <www.4fb.de>
|
||||
* @license http://www.contenido.org/license/LIZENZ.txt
|
||||
* @link http://www.4fb.de
|
||||
* @link http://www.contenido.org
|
||||
* @since file available since contenido release <= 4.6
|
||||
*
|
||||
* {@internal
|
||||
* created 2004-08-01, Bj<EFBFBD>rn Behrens (HerrB)
|
||||
* modified 2008-06-27, Dominik Ziegler, add security fix
|
||||
* modified 2010-05-20, Murat Purc, removed request check during processing ticket [#CON-307]
|
||||
*
|
||||
* $Id$:
|
||||
* }}
|
||||
*
|
||||
*/
|
||||
if (!defined('CON_FRAMEWORK')) {
|
||||
die('Illegal call');
|
||||
}
|
||||
|
||||
|
||||
if (isset($_GET['idrecipientgroup']) && (int) $_GET['idrecipientgroup'] > 0) {
|
||||
$caption = i18n("Overview", "cl_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");
|
||||
|
||||
$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();
|
||||
}
|
||||
}
|
||||
|
||||
$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"]);
|
||||
}
|
||||
?>
|
|
@ -1,568 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Project:
|
||||
* Contenido Content Management System
|
||||
*
|
||||
* Description:
|
||||
* Recipient group editor
|
||||
*
|
||||
* Requirements:
|
||||
* @con_php_req 5.0
|
||||
*
|
||||
*
|
||||
* @package Contenido Backend includes
|
||||
* @version 1.1.1
|
||||
* @author Bj<EFBFBD>rn Behrens (HerrB)
|
||||
* @copyright four for business AG <www.4fb.de>
|
||||
* @license http://www.contenido.org/license/LIZENZ.txt
|
||||
* @link http://www.4fb.de
|
||||
* @link http://www.contenido.org
|
||||
* @since file available since contenido release <= 4.6
|
||||
*
|
||||
* {@internal
|
||||
* created 2004-08-01, Bj<EFBFBD>rn Behrens (HerrB)
|
||||
* modified 2008-06-27, Dominik Ziegler, add security fix
|
||||
*
|
||||
* $Id$:
|
||||
* }}
|
||||
*
|
||||
*/
|
||||
if (!defined('CON_FRAMEWORK')) {
|
||||
die('Illegal call');
|
||||
}
|
||||
|
||||
|
||||
// Initialization
|
||||
$oPage = new cPage;
|
||||
$oRGroups = new RecipientGroupCollection;
|
||||
$oRGroupMembers = new RecipientGroupMemberCollection;
|
||||
$oRGroup = new RecipientGroup;
|
||||
|
||||
$aFields = array();
|
||||
$aFields["name"] = array("field" => "name", "caption" => i18n("Name", "cl_newsletter"), "type" => "base,sort,search");
|
||||
$aFields["email"] = array("field" => "email", "caption" => i18n("E-Mail", "cl_newsletter"), "type" => "base,sort,search");
|
||||
$aFields["confirmed"] = array("field" => "confirmed", "caption" => i18n("Confirmed", "cl_newsletter"), "type" => "base");
|
||||
$aFields["deactivated"] = array("field" => "deactivated", "caption" => i18n("Deactivated", "cl_newsletter"), "type" => "base");
|
||||
|
||||
if ($action == "recipientgroup_create" && $perm->have_perm_area_action($area, $action)) {
|
||||
$oRGroup = $oRGroups->create(" " . i18n("-- new group --", "cl_newsletter"));
|
||||
$_REQUEST["idrecipientgroup"] = $oRGroup->get("idnewsgroup");
|
||||
$oPage->setReload();
|
||||
$sRefreshLeftTopScript = '<script type="text/javascript">top.content.left.left_top.refreshGroupOption(\'' . $_REQUEST["idrecipientgroup"] . '\', \'add\')</script>';
|
||||
$oPage->addScript('refreshlefttop', $sRefreshLeftTopScript);
|
||||
} elseif ($action == "recipientgroup_delete" && $perm->have_perm_area_action($area, $action)) {
|
||||
$oRGroups->delete($_REQUEST["idrecipientgroup"]);
|
||||
$sRefreshLeftTopScript = '<script type="text/javascript">top.content.left.left_top.refreshGroupOption(\'' . $_REQUEST["idrecipientgroup"] . '\', \'remove\')</script>';
|
||||
$oPage->addScript('refreshlefttop', $sRefreshLeftTopScript);
|
||||
|
||||
$_REQUEST["idrecipientgroup"] = 0;
|
||||
$oRGroup = new RecipientGroup;
|
||||
$oPage->setReload();
|
||||
} else {
|
||||
$oRGroup->loadByPrimaryKey($_REQUEST["idrecipientgroup"]);
|
||||
}
|
||||
|
||||
if ($oRGroup->virgin == false && $oRGroup->get("idclient") == $client && $oRGroup->get("idlang") == $lang) {
|
||||
if ($action == "recipientgroup_save_group" && $perm->have_perm_area_action($area, $action)) {
|
||||
// Saving changes
|
||||
$aMessages = array();
|
||||
$bReload = false;
|
||||
|
||||
$sGroupName = stripslashes($_REQUEST["groupname"]);
|
||||
if ($oRGroup->get("groupname") != $sGroupName) {
|
||||
$oRGroups->resetQuery();
|
||||
$oRGroups->setWhere("groupname", $sGroupName);
|
||||
$oRGroups->setWhere("idclient", $client);
|
||||
$oRGroups->setWhere("idlang", $lang);
|
||||
$oRGroups->setWhere($oRGroup->primaryKey, $oRGroup->get($oRGroup->primaryKey), "!=");
|
||||
$oRGroups->query();
|
||||
|
||||
if ($oRGroups->next()) {
|
||||
$aMessages[] = i18n("Could not set new group name: Group already exists", "cl_newsletter");
|
||||
} else {
|
||||
$bReload = true;
|
||||
|
||||
$oRGroup->set("groupname", $sGroupName);
|
||||
}
|
||||
}
|
||||
|
||||
if (count($_REQUEST["adduser"]) > 0) {
|
||||
foreach ($_REQUEST["adduser"] as $iRcpID) {
|
||||
if (is_numeric($iRcpID)) {
|
||||
$oRGroupMembers->create($_REQUEST["idrecipientgroup"], $iRcpID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($oRGroup->get("defaultgroup") != (int) $_REQUEST["defaultgroup"]) {
|
||||
$bReload = true;
|
||||
$oRGroup->set("defaultgroup", $_REQUEST["defaultgroup"]);
|
||||
}
|
||||
|
||||
$oRGroup->store();
|
||||
|
||||
if ($bReload) {
|
||||
$oPage->setReload();
|
||||
}
|
||||
|
||||
// Removing users from group (if specified)
|
||||
//print_r ($_REQUEST["deluser"]);
|
||||
if ($perm->have_perm_area_action($area, "recipientgroup_recipient_delete") && is_array($_REQUEST["deluser"])) {
|
||||
foreach ($_REQUEST["deluser"] as $iRcpID) {
|
||||
if (is_numeric($iRcpID)) {
|
||||
echo "yo: " . $iRcpID;
|
||||
$oRGroupMembers->remove($_REQUEST["idrecipientgroup"], $iRcpID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$sRefreshLeftTopScript = '<script type="text/javascript">top.content.left.left_top.refreshGroupOption(\'' . $_REQUEST["idrecipientgroup"] . '\', \'remove\');
|
||||
top.content.left.left_top.refreshGroupOption(\'' . $_REQUEST["idrecipientgroup"] . '\', \'add\', \'' . $sGroupName . '\');</script>';
|
||||
$oPage->addScript('refreshlefttop', $sRefreshLeftTopScript);
|
||||
}
|
||||
|
||||
if (count($aMessages) > 0) {
|
||||
$sNotis = $notification->returnNotification("warning", implode("<br>", $aMessages)) . "<br>";
|
||||
}
|
||||
|
||||
// Set default values
|
||||
$oUser = new cApiUser($auth->auth["uid"]);
|
||||
if (!isset($_REQUEST["member_elemperpage"]) || !is_numeric($_REQUEST["member_elemperpage"]) || $_REQUEST["member_elemperpage"] < 0) {
|
||||
$_REQUEST["member_elemperpage"] = $oUser->getProperty("itemsperpage", $area . "_edit_member");
|
||||
}
|
||||
if (!is_numeric($_REQUEST["member_elemperpage"])) {
|
||||
$_REQUEST["member_elemperpage"] = 25;
|
||||
}
|
||||
if ($_REQUEST["member_elemperpage"] > 0) {
|
||||
// -- All -- will not be stored, as it may be impossible to change this back to something more useful
|
||||
$oUser->setProperty("itemsperpage", $area . "_edit_member", $_REQUEST["member_elemperpage"]);
|
||||
}
|
||||
|
||||
if (!isset($_REQUEST["outsider_elemperpage"]) || !is_numeric($_REQUEST["outsider_elemperpage"]) || $_REQUEST["outsider_elemperpage"] < 0) {
|
||||
$_REQUEST["outsider_elemperpage"] = $oUser->getProperty("itemsperpage", $area . "_edit_outsider");
|
||||
}
|
||||
if (!is_numeric($_REQUEST["outsider_elemperpage"])) {
|
||||
$_REQUEST["outsider_elemperpage"] = 25;
|
||||
}
|
||||
if ($_REQUEST["outsider_elemperpage"] > 0) {
|
||||
// -- All -- will not be stored, as it may be impossible to change this back to something more useful
|
||||
$oUser->setProperty("itemsperpage", $area . "_edit_outsider", $_REQUEST["outsider_elemperpage"]);
|
||||
}
|
||||
unset($oUser);
|
||||
|
||||
if (!isset($_REQUEST["member_page"]) || !is_numeric($_REQUEST["member_page"]) || $_REQUEST["member_page"] <= 0 || $_REQUEST["member_elemperpage"] == 0) {
|
||||
$_REQUEST["member_page"] = 1;
|
||||
}
|
||||
if ($_REQUEST["member_sortorder"] != "DESC") {
|
||||
$_REQUEST["member_sortorder"] = "ASC";
|
||||
}
|
||||
if (!isset($_REQUEST["outsider_page"]) || !is_numeric($_REQUEST["outsider_page"]) || $_REQUEST["outsider_page"] <= 0 || $_REQUEST["outsider_elemperpage"] == 0) {
|
||||
$_REQUEST["outsider_page"] = 1;
|
||||
}
|
||||
if ($_REQUEST["outsider_sortorder"] != "DESC") {
|
||||
$_REQUEST["outsider_sortorder"] = "ASC";
|
||||
}
|
||||
|
||||
// Output form
|
||||
$oForm = new UI_Table_Form("properties", "main.php?1", "get"); // Use "get" for folding rows...
|
||||
$oForm->setVar("frame", $frame);
|
||||
$oForm->setVar("area", $area);
|
||||
$oForm->setVar("action", "recipientgroup_save_group");
|
||||
$oForm->setVar("idrecipientgroup", $_REQUEST["idrecipientgroup"]);
|
||||
$oForm->setSubmitJS("append_registered_parameters(this);");
|
||||
|
||||
$oForm->addHeader(i18n("Edit group", "cl_newsletter"));
|
||||
|
||||
$oTxtGroupName = new cHTMLTextbox("groupname", $oRGroup->get("groupname"), 40);
|
||||
$oForm->add(i18n("Group name", "cl_newsletter"), $oTxtGroupName->render());
|
||||
|
||||
$oCkbDefault = new cHTMLCheckbox("defaultgroup", "1");
|
||||
$oCkbDefault->setChecked($oRGroup->get("defaultgroup"));
|
||||
$oForm->add(i18n("Default group", "cl_newsletter"), $oCkbDefault->toHTML(false));
|
||||
|
||||
// Member list options folding row
|
||||
$oMemberListOptionRow = new cFoldingRow("a91f5540-52db-11db-b0de-0800200c9a66", i18n("Member list options", "cl_newsletter"));
|
||||
|
||||
$oSelItemsPerPage = new cHTMLSelectElement("member_elemperpage");
|
||||
$oSelItemsPerPage->autoFill(array(0 => i18n("-- All --", "cl_newsletter"), 25 => 25, 50 => 50, 75 => 75, 100 => 100));
|
||||
$oSelItemsPerPage->setDefault($_REQUEST["member_elemperpage"]);
|
||||
|
||||
$oSelSortBy = new cHTMLSelectElement("member_sortby");
|
||||
foreach ($aFields as $sKey => $aData) {
|
||||
if (strpos($aData["type"], "sort") !== false) {
|
||||
if ($_REQUEST["member_sortby"] == "") {
|
||||
$_REQUEST["member_sortby"] = $aData["field"];
|
||||
}
|
||||
$oOption = new cHTMLOptionElement($aData["caption"], $aData["field"]);
|
||||
$oSelSortBy->addOptionElement($aData["field"], $oOption);
|
||||
}
|
||||
}
|
||||
$oSelSortBy->setDefault($_REQUEST["member_sortby"]);
|
||||
|
||||
$oSelSortOrder = new cHTMLSelectElement("member_sortorder");
|
||||
$oSelSortOrder->autoFill(array("ASC" => i18n("Ascending", "cl_newsletter"), "DESC" => i18n("Descending", "cl_newsletter")));
|
||||
$oSelSortOrder->setDefault($_REQUEST["member_sortorder"]);
|
||||
|
||||
$oTxtFilter = new cHTMLTextbox("member_filter", $_REQUEST["member_filter"], 16);
|
||||
|
||||
$oSelSearchIn = new cHTMLSelectElement("member_searchin");
|
||||
$oOption = new cHTMLOptionElement(i18n("-- All fields --", "cl_newsletter"), "--all--");
|
||||
$oSelSearchIn->addOptionElement("all", $oOption);
|
||||
|
||||
foreach ($aFields as $sKey => $aData) {
|
||||
if (strpos($aData["type"], "search") !== false) {
|
||||
$oOption = new cHTMLOptionElement($aData["caption"], $aData["field"]);
|
||||
$oSelSearchIn->addOptionElement($aData["field"], $oOption);
|
||||
}
|
||||
}
|
||||
$oSelSearchIn->setDefault($_REQUEST["member_searchin"]);
|
||||
|
||||
$oSubmit = new cHTMLButton("submit", i18n("Apply", "cl_newsletter"));
|
||||
|
||||
$sContent = '<div style="border-bottom: 1px solid black; background: ' . $cfg['color']['table_dark'] . ';">' . chr(10);
|
||||
$sContent .= ' <table>' . chr(10);
|
||||
$sContent .= ' <tr>' . chr(10);
|
||||
$sContent .= ' <td>' . i18n("Items / page", "cl_newsletter") . '</td>' . chr(10);
|
||||
$sContent .= ' <td>' . $oSelItemsPerPage->render() . '</td>' . chr(10);
|
||||
$sContent .= ' </tr>' . chr(10);
|
||||
$sContent .= ' <tr>' . chr(10);
|
||||
$sContent .= ' <td>' . i18n("Sort by", "cl_newsletter") . '</td>' . chr(10);
|
||||
$sContent .= ' <td>' . $oSelSortBy->render() . '</td>' . chr(10);
|
||||
$sContent .= ' </tr>' . chr(10);
|
||||
$sContent .= ' <tr>' . chr(10);
|
||||
$sContent .= ' <td>' . i18n("Sort order", "cl_newsletter") . '</td>' . chr(10);
|
||||
$sContent .= ' <td>' . $oSelSortOrder->render() . '</td>' . chr(10);
|
||||
$sContent .= ' </tr>' . chr(10);
|
||||
$sContent .= ' <tr>' . chr(10);
|
||||
$sContent .= ' <td>' . i18n("Search for", "cl_newsletter") . '</td>' . chr(10);
|
||||
$sContent .= ' <td>' . $oTxtFilter->render() . '</td>' . chr(10);
|
||||
$sContent .= ' </tr>' . chr(10);
|
||||
$sContent .= ' <tr>' . chr(10);
|
||||
$sContent .= ' <td>' . i18n("Search in", "cl_newsletter") . '</td>' . chr(10);
|
||||
$sContent .= ' <td>' . $oSelSearchIn->render() . '</td>' . chr(10);
|
||||
$sContent .= ' </tr>' . chr(10);
|
||||
$sContent .= ' <tr>' . chr(10);
|
||||
$sContent .= ' <td> </td>' . chr(10);
|
||||
$sContent .= ' <td>' . $oSubmit->render() . '</td>' . chr(10);
|
||||
$sContent .= ' </tr>' . chr(10);
|
||||
$sContent .= ' </table>' . chr(10);
|
||||
$sContent .= '</div>' . chr(10);
|
||||
$oMemberListOptionRow->setContentData($sContent);
|
||||
|
||||
// Members
|
||||
$oAddedRecipientList = new UI_List;
|
||||
$oAddedRecipientList->setWidth("100%");
|
||||
$oAddedRecipientList->setBorder(1);
|
||||
|
||||
$oAddedRecipientList->setCell(0, 1, "<strong>" . i18n("Name", "cl_newsletter") . "</strong>");
|
||||
$oImgDel = new cHTMLImage("images/but_invert_selection.gif");
|
||||
$sLnkDelIcon = '<a title="' . i18n("Check all", "cl_newsletter") . '" href="javascript://" onclick="fncCheckDel(\'deluser[]\');">' . $oImgDel->render() . '</a>';
|
||||
$oAddedRecipientList->setCell(0, 2, $sLnkDelIcon);
|
||||
$oAddedRecipientList->setCellAlignment(0, 2, "right");
|
||||
|
||||
$oInsiders = new RecipientCollection;
|
||||
|
||||
$oInsiders->link("RecipientGroupMemberCollection");
|
||||
$oInsiders->setWhere("recipientcollection.idclient", $client);
|
||||
$oInsiders->setWhere("recipientcollection.idlang", $lang);
|
||||
$oInsiders->setWhere("RecipientGroupMemberCollection.idnewsgroup", $_REQUEST["idrecipientgroup"]);
|
||||
|
||||
// Get insiders for outsiders list (*sigh!*)
|
||||
// TODO: Ask user to have at least mySQL 4.1...
|
||||
$oInsiders->query();
|
||||
|
||||
$aInsiders = array();
|
||||
if ($oInsiders->count() > 0) {
|
||||
while ($oInsider = $oInsiders->next()) {
|
||||
$aInsiders[] = $oInsider->get($oInsider->primaryKey);
|
||||
}
|
||||
}
|
||||
|
||||
// Filter
|
||||
if ($_REQUEST["member_filter"] != "") {
|
||||
if ($_REQUEST["member_searchin"] == "--all--" || $_REQUEST["member_searchin"] == "") {
|
||||
foreach ($aFields as $sKey => $aData) {
|
||||
if (strpos($aData["type"], "search") !== false) {
|
||||
$oInsiders->setWhereGroup("filter", "recipientcollection." . $aData["field"], $_REQUEST["member_filter"], "LIKE");
|
||||
}
|
||||
}
|
||||
$oInsiders->setInnerGroupCondition("filter", "OR");
|
||||
} else {
|
||||
$oInsiders->setWhere("recipientcollection." . $_REQUEST["member_searchin"], $_REQUEST["member_filter"], "LIKE");
|
||||
}
|
||||
}
|
||||
|
||||
// If elemperpage is something else than "all", get item count based on filters
|
||||
if ($_REQUEST["member_elemperpage"] > 0) {
|
||||
$oInsiders->query();
|
||||
$iMembers = $oInsiders->count(); // Getting item count without limit (for page function) - better idea anybody (performance)?
|
||||
|
||||
$oInsiders->setLimit($_REQUEST["member_elemperpage"] * ($_REQUEST["member_page"] - 1), $_REQUEST["member_elemperpage"]);
|
||||
} else {
|
||||
$iMembers = 0;
|
||||
}
|
||||
|
||||
// Get data
|
||||
$sSortSQL = "recipientcollection." . $_REQUEST["member_sortby"] . " " . $_REQUEST["member_sortorder"];
|
||||
if ($_REQUEST["member_sortby"] == "name") {
|
||||
// Name field may be empty, add email as sort criteria
|
||||
$sSortSQL .= ", email " . $_REQUEST["member_sortorder"];
|
||||
}
|
||||
|
||||
$oInsiders->setOrder($sSortSQL);
|
||||
$oInsiders->query();
|
||||
|
||||
$iItems = $oInsiders->count();
|
||||
if ($iItems == 0 && $_REQUEST["member_filter"] == "" && ($_REQUEST["member_elemperpage"] == 0 || $iMembers == 0)) {
|
||||
$oAddedRecipientList->setCell(1, 1, i18n("No recipients are added to this group yet", "cl_newsletter"));
|
||||
$oAddedRecipientList->setCell(1, 2, ' ');
|
||||
} else if ($iItems == 0) {
|
||||
$oAddedRecipientList->setCell(1, 1, i18n("No recipients found", "cl_newsletter"));
|
||||
$oAddedRecipientList->setCell(1, 2, ' ');
|
||||
} else {
|
||||
while ($oRcp = $oInsiders->next()) {
|
||||
$iID = $oRcp->get("idnewsrcp");
|
||||
|
||||
$sName = $oRcp->get("name");
|
||||
$sEMail = $oRcp->get("email");
|
||||
if (empty($sName)) {
|
||||
$sName = $sEMail;
|
||||
}
|
||||
$oAddedRecipientList->setCell($iID, 1, $sName . " (" . $sEMail . ")");
|
||||
|
||||
if ($perm->have_perm_area_action($area, "recipientgroup_recipient_delete")) {
|
||||
$oCkbDel = new cHTMLCheckbox("deluser[]", $iID);
|
||||
$oAddedRecipientList->setCell($iID, 2, $oCkbDel->toHTML(false));
|
||||
} else {
|
||||
$oAddedRecipientList->setCell($iID, 2, " ");
|
||||
}
|
||||
$oAddedRecipientList->setCellAlignment($iID, 2, "right");
|
||||
}
|
||||
}
|
||||
|
||||
// Member list pager (-> below data, as iMembers is needed)
|
||||
$oPagerLink = new cHTMLLink;
|
||||
$oPagerLink->setLink("main.php");
|
||||
$oPagerLink->setCustom("member_elemperpage", $_REQUEST["member_elemperpage"]);
|
||||
$oPagerLink->setCustom("member_filter", $_REQUEST["member_filter"]);
|
||||
$oPagerLink->setCustom("member_sortby", $_REQUEST["member_sortby"]);
|
||||
$oPagerLink->setCustom("member_sortorder", $_REQUEST["member_sortorder"]);
|
||||
$oPagerLink->setCustom("member_searchin", $_REQUEST["member_searchin"]);
|
||||
$oPagerLink->setCustom("outsider_elemperpage", $_REQUEST["outsider_elemperpage"]);
|
||||
$oPagerLink->setCustom("outsider_filter", $_REQUEST["outsider_filter"]);
|
||||
$oPagerLink->setCustom("outsider_sortby", $_REQUEST["outsider_sortby"]);
|
||||
$oPagerLink->setCustom("outsider_sortorder", $_REQUEST["outsider_sortorder"]);
|
||||
$oPagerLink->setCustom("outsider_searchin", $_REQUEST["outsider_searchin"]);
|
||||
$oPagerLink->setCustom("idrecipientgroup", $_REQUEST["idrecipientgroup"]);
|
||||
$oPagerLink->setCustom("frame", $frame);
|
||||
$oPagerLink->setCustom("area", $area);
|
||||
#$oPagerLink->enableAutomaticParameterAppend();
|
||||
$oPagerLink->setCustom("contenido", $sess->id);
|
||||
|
||||
$oMemberPager = new cObjectPager("d82a3ff0-52d9-11db-b0de-0800200c9a66", $iMembers, $_REQUEST["member_elemperpage"], $_REQUEST["member_page"], $oPagerLink, "member_page");
|
||||
$oMemberPager->setCaption(i18n("Member navigation", "cl_newsletter"));
|
||||
|
||||
$oForm->add(i18n("Recipients in group", "cl_newsletter"), '<table border="0" cellspacing="0" cellpadding="0" width="100%">' .
|
||||
$oMemberListOptionRow->render() .
|
||||
$oMemberPager->render() .
|
||||
'<tr><td>' . $oAddedRecipientList->render() . '</td></tr></table>');
|
||||
unset($oInsiders);
|
||||
unset($oMemberListOptionRow);
|
||||
unset($oMemberPager);
|
||||
unset($oAddedRecipientList);
|
||||
|
||||
// Outsiders
|
||||
// Outsider list options folding row
|
||||
$oOutsiderListOptionRow = new cFoldingRow("ca633b00-52e9-11db-b0de-0800200c9a66", i18n("Outsider list options", "cl_newsletter"));
|
||||
|
||||
$oSelItemsPerPage = new cHTMLSelectElement("outsider_elemperpage");
|
||||
$oSelItemsPerPage->autoFill(array(0 => i18n("-- All --", "cl_newsletter"), 25 => 25, 50 => 50, 75 => 75, 100 => 100));
|
||||
$oSelItemsPerPage->setDefault($_REQUEST["outsider_elemperpage"]);
|
||||
|
||||
$oSelSortBy = new cHTMLSelectElement("outsider_sortby");
|
||||
foreach ($aFields as $sKey => $aData) {
|
||||
if (strpos($aData["type"], "sort") !== false) {
|
||||
if ($_REQUEST["outsider_sortby"] == "") {
|
||||
$_REQUEST["outsider_sortby"] = $aData["field"];
|
||||
}
|
||||
$oOption = new cHTMLOptionElement($aData["caption"], $aData["field"]);
|
||||
$oSelSortBy->addOptionElement($aData["field"], $oOption);
|
||||
}
|
||||
}
|
||||
$oSelSortBy->setDefault($_REQUEST["outsider_sortby"]);
|
||||
|
||||
$oSelSortOrder = new cHTMLSelectElement("outsider_sortorder");
|
||||
$oSelSortOrder->autoFill(array("ASC" => i18n("Ascending", "cl_newsletter"), "DESC" => i18n("Descending", "cl_newsletter")));
|
||||
$oSelSortOrder->setDefault($_REQUEST["outsider_sortorder"]);
|
||||
|
||||
$oTxtFilter = new cHTMLTextbox("outsider_filter", $_REQUEST["outsider_filter"], 16);
|
||||
|
||||
$oSelSearchIn = new cHTMLSelectElement("outsider_searchin");
|
||||
$oOption = new cHTMLOptionElement(i18n("-- All fields --", "cl_newsletter"), "--all--");
|
||||
$oSelSearchIn->addOptionElement("all", $oOption);
|
||||
|
||||
foreach ($aFields as $sKey => $aData) {
|
||||
if (strpos($aData["type"], "search") !== false) {
|
||||
$oOption = new cHTMLOptionElement($aData["caption"], $aData["field"]);
|
||||
$oSelSearchIn->addOptionElement($aData["field"], $oOption);
|
||||
}
|
||||
}
|
||||
$oSelSearchIn->setDefault($_REQUEST["outsider_searchin"]);
|
||||
|
||||
$oSubmit = new cHTMLButton("submit", i18n("Apply", "cl_newsletter"));
|
||||
|
||||
$sContent = '<div style="border-bottom: 1px solid black; background: ' . $cfg['color']['table_dark'] . ';">' . chr(10);
|
||||
$sContent .= ' <table>' . chr(10);
|
||||
$sContent .= ' <tr>' . chr(10);
|
||||
$sContent .= ' <td>' . i18n("Items / page", "cl_newsletter") . '</td>' . chr(10);
|
||||
$sContent .= ' <td>' . $oSelItemsPerPage->render() . '</td>' . chr(10);
|
||||
$sContent .= ' </tr>' . chr(10);
|
||||
$sContent .= ' <tr>' . chr(10);
|
||||
$sContent .= ' <td>' . i18n("Sort by", "cl_newsletter") . '</td>' . chr(10);
|
||||
$sContent .= ' <td>' . $oSelSortBy->render() . '</td>' . chr(10);
|
||||
$sContent .= ' </tr>' . chr(10);
|
||||
$sContent .= ' <tr>' . chr(10);
|
||||
$sContent .= ' <td>' . i18n("Sort order", "cl_newsletter") . '</td>' . chr(10);
|
||||
$sContent .= ' <td>' . $oSelSortOrder->render() . '</td>' . chr(10);
|
||||
$sContent .= ' </tr>' . chr(10);
|
||||
$sContent .= ' <tr>' . chr(10);
|
||||
$sContent .= ' <td>' . i18n("Search for", "cl_newsletter") . '</td>' . chr(10);
|
||||
$sContent .= ' <td>' . $oTxtFilter->render() . '</td>' . chr(10);
|
||||
$sContent .= ' </tr>' . chr(10);
|
||||
$sContent .= ' <tr>' . chr(10);
|
||||
$sContent .= ' <td>' . i18n("Search in", "cl_newsletter") . '</td>' . chr(10);
|
||||
$sContent .= ' <td>' . $oSelSearchIn->render() . '</td>' . chr(10);
|
||||
$sContent .= ' </tr>' . chr(10);
|
||||
$sContent .= ' <tr>' . chr(10);
|
||||
$sContent .= ' <td> </td>' . chr(10);
|
||||
$sContent .= ' <td>' . $oSubmit->render() . '</td>' . chr(10);
|
||||
$sContent .= ' </tr>' . chr(10);
|
||||
$sContent .= ' </table>' . chr(10);
|
||||
$sContent .= '</div>' . chr(10);
|
||||
$oOutsiderListOptionRow->setContentData($sContent);
|
||||
|
||||
// TODO: Try to enhance genericdb to get this working with the usual objects...
|
||||
$oOutsiders = new RecipientCollection;
|
||||
|
||||
# This requires mySQL V4.1, at least...
|
||||
# TODO: Add mySQL server version switch
|
||||
#$sSQL = "idclient = '".$client."' AND idlang = '".$lang."' AND ".
|
||||
# "idnewsrcp NOT IN (SELECT idnewsrcp FROM ".$cfg["tab"]["news_groupmembers"]." WHERE idnewsgroup = '".$_REQUEST["idrecipientgroup"]."')";
|
||||
// TODO: This works with every mySQL version but may be problematic, if a group
|
||||
// contains a lot of members (e.g. Oracle can't handle more than 1000 items in the brackets)
|
||||
$sSQL = "idclient = '" . $client . "' AND idlang = '" . $lang . "' AND " .
|
||||
"idnewsrcp NOT IN ('" . implode("','", $aInsiders) . "')";
|
||||
|
||||
if ($_REQUEST["outsider_filter"] != "") {
|
||||
$sSQLSearchIn = "";
|
||||
if ($_REQUEST["outsider_searchin"] == "--all--" || $_REQUEST["outsider_searchin"] == "") {
|
||||
foreach ($aFields as $sKey => $aData) {
|
||||
if (strpos($aData["type"], "search") !== false) {
|
||||
if ($sSQLSearchIn !== "") {
|
||||
$sSQLSearchIn .= " OR ";
|
||||
}
|
||||
$sSQLSearchIn .= $aData["field"] . " LIKE '%" . urlencode($_REQUEST["outsider_filter"]) . "%'";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$sSQLSearchIn .= urlencode($_REQUEST["outsider_searchin"]) . " LIKE '%" . urlencode($_REQUEST["outsider_filter"]) . "%'";
|
||||
}
|
||||
$sSQL .= " AND (" . $sSQLSearchIn . ")";
|
||||
}
|
||||
|
||||
// If elemperpage is something else than "all", get item count based on filters
|
||||
if ($_REQUEST["outsider_elemperpage"] > 0) {
|
||||
$oOutsiders->flexSelect("", "", $sSQL, "");
|
||||
$iOutsiders = $oOutsiders->count(); // Getting item count without limit (for page function) - better idea anyone (performance)?
|
||||
|
||||
$sSQLLimit = " LIMIT " . $_REQUEST["outsider_elemperpage"] * ($_REQUEST["outsider_page"] - 1) . ", " . $_REQUEST["outsider_elemperpage"];
|
||||
} else {
|
||||
$iMembers = 0;
|
||||
$sSQLLimit = "";
|
||||
}
|
||||
|
||||
// Get data
|
||||
$sSQLSort = " ORDER BY " . urlencode($_REQUEST["outsider_sortby"]) . " " . $_REQUEST["outsider_sortorder"];
|
||||
if ($_REQUEST["outsider_sortby"] == "name") {
|
||||
// Name field may be empty, add email as sort criteria
|
||||
$sSQLSort .= ", email " . $_REQUEST["outsider_sortorder"];
|
||||
}
|
||||
|
||||
$sSQL .= $sSQLSort . $sSQLLimit;
|
||||
$oOutsiders->flexSelect("", "", $sSQL, "");
|
||||
|
||||
$aItems = array();
|
||||
while ($oRecipient = $oOutsiders->next()) {
|
||||
$sName = $oRecipient->get("name");
|
||||
$sEMail = $oRecipient->get("email");
|
||||
|
||||
if (empty($sName)) {
|
||||
$sName = $sEMail;
|
||||
}
|
||||
$aItems[] = array($oRecipient->get("idnewsrcp"), $sName . " (" . $sEMail . ")");
|
||||
}
|
||||
|
||||
$oSelUser = new cHTMLSelectElement("adduser[]");
|
||||
$oSelUser->setSize(25);
|
||||
$oSelUser->setStyle("width: 100%;");
|
||||
$oSelUser->setMultiSelect();
|
||||
$oSelUser->autoFill($aItems);
|
||||
|
||||
// Outsider list pager (-> below data, as iOutsiders is needed)
|
||||
$oPagerLink = new cHTMLLink;
|
||||
$oPagerLink->setLink("main.php");
|
||||
$oPagerLink->setCustom("member_elemperpage", $_REQUEST["member_elemperpage"]);
|
||||
$oPagerLink->setCustom("member_filter", $_REQUEST["member_filter"]);
|
||||
$oPagerLink->setCustom("member_sortby", $_REQUEST["member_sortby"]);
|
||||
$oPagerLink->setCustom("member_sortorder", $_REQUEST["member_sortorder"]);
|
||||
$oPagerLink->setCustom("member_searchin", $_REQUEST["member_searchin"]);
|
||||
$oPagerLink->setCustom("outsider_elemperpage", $_REQUEST["outsider_elemperpage"]);
|
||||
$oPagerLink->setCustom("outsider_filter", $_REQUEST["outsider_filter"]);
|
||||
$oPagerLink->setCustom("outsider_sortby", $_REQUEST["outsider_sortby"]);
|
||||
$oPagerLink->setCustom("outsider_sortorder", $_REQUEST["outsider_sortorder"]);
|
||||
$oPagerLink->setCustom("outsider_searchin", $_REQUEST["outsider_searchin"]);
|
||||
$oPagerLink->setCustom("idrecipientgroup", $_REQUEST["idrecipientgroup"]);
|
||||
$oPagerLink->setCustom("frame", $frame);
|
||||
$oPagerLink->setCustom("area", $area);
|
||||
#$oPagerLink->enableAutomaticParameterAppend();
|
||||
$oPagerLink->setCustom("contenido", $sess->id);
|
||||
|
||||
$oOutsiderPager = new cObjectPager("4d3a7330-52eb-11db-b0de-0800200c9a66", $iOutsiders, $_REQUEST["outsider_elemperpage"], $_REQUEST["outsider_page"], $oPagerLink, "outsider_page");
|
||||
$oOutsiderPager->setCaption(i18n("Outsider navigation", "cl_newsletter"));
|
||||
|
||||
$oForm->add(i18n("Add recipients", "cl_newsletter"), '<table border="0" cellspacing="0" cellpadding="0" width="100%">' .
|
||||
$oOutsiderListOptionRow->render() .
|
||||
$oOutsiderPager->render() .
|
||||
'<tr><td>' . $oSelUser->render() . '<br />' . i18n("Note: Hold <Ctrl> to<br>select multiple items.", "cl_newsletter") . '</td></tr></table>');
|
||||
unset($oOutsiders);
|
||||
unset($oOutsiderListOptionRow);
|
||||
unset($oOutsiderPager);
|
||||
|
||||
$sDelMarkScript = ' <script type="text/javascript">
|
||||
/* Function to select all ckbDel boxes */
|
||||
function fncCheckDel(elementname) {
|
||||
var aBoxes = document.getElementsByName(elementname);
|
||||
|
||||
if (aBoxes.length > 0) {
|
||||
for (var i = 0; i < aBoxes.length; i++) {
|
||||
if (aBoxes[i].checked) {
|
||||
aBoxes[i].checked = false;
|
||||
} else {
|
||||
aBoxes[i].checked = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>';
|
||||
|
||||
$oPage->addScript('DelMarkScript', $sDelMarkScript);
|
||||
$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->setContent($sNotis . $oForm->render(true));
|
||||
} else {
|
||||
$oPage->setContent($sNotis . "");
|
||||
}
|
||||
$oPage->render();
|
||||
?>
|
|
@ -1,234 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Project:
|
||||
* Contenido Content Management System
|
||||
*
|
||||
* Description:
|
||||
* Frontend group list
|
||||
*
|
||||
* Requirements:
|
||||
* @con_php_req 5.0
|
||||
*
|
||||
*
|
||||
* @package Contenido Backend includes
|
||||
* @version 1.6.0
|
||||
* @author Bj<EFBFBD>rn Behrens (HerrB)
|
||||
* @copyright four for business AG <www.4fb.de>
|
||||
* @license http://www.contenido.org/license/LIZENZ.txt
|
||||
* @link http://www.4fb.de
|
||||
* @link http://www.contenido.org
|
||||
* @since file available since contenido release <= 4.6
|
||||
*
|
||||
* {@internal
|
||||
* created 2007-01-01, Bj<EFBFBD>rn Behrens (HerrB)
|
||||
* modified 2008-06-27, Dominik Ziegler, add security fix
|
||||
*
|
||||
* $Id$:
|
||||
* }}
|
||||
*
|
||||
*/
|
||||
if (!defined('CON_FRAMEWORK')) {
|
||||
die('Illegal call');
|
||||
}
|
||||
|
||||
|
||||
##################################
|
||||
# Initialization
|
||||
##################################
|
||||
$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,
|
||||
// remember to update include.newsletter_left_top.php, also.
|
||||
// field: Field name in the db
|
||||
// caption: Shown field name (-> user)
|
||||
// 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", "cl_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);
|
||||
}
|
||||
if (!is_numeric($_REQUEST["elemperpage"])) {
|
||||
// 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"]);
|
||||
}
|
||||
$_REQUEST["page"] = (int) $_REQUEST["page"];
|
||||
if ($_REQUEST["page"] <= 0 || $_REQUEST["elemperpage"] == 0) {
|
||||
$_REQUEST["page"] = 1;
|
||||
}
|
||||
// Sort order
|
||||
if ($_REQUEST["sortorder"] != "DESC") {
|
||||
$_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--";
|
||||
|
||||
// Free memory
|
||||
unset($oUser);
|
||||
unset($oClient);
|
||||
|
||||
##################################
|
||||
# Get data
|
||||
##################################
|
||||
$oRcpGroups = new RecipientGroupCollection;
|
||||
$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["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"] --;
|
||||
}
|
||||
|
||||
$oRcpGroups->setLimit($_REQUEST["elemperpage"] * ($_REQUEST["page"] - 1), $_REQUEST["elemperpage"]);
|
||||
} else {
|
||||
$iItemCount = 0;
|
||||
}
|
||||
|
||||
$oRcpGroups->setOrder("defaultgroup DESC, " . $_REQUEST["sortby"] . " " . $_REQUEST["sortorder"]);
|
||||
$oRcpGroups->query();
|
||||
|
||||
// Output data
|
||||
$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", "cl_newsletter");
|
||||
$aMsg["DelDescr"] = i18n("Do you really want to delete the following newsletter recipient group:<br>", "cl_newsletter");
|
||||
|
||||
while ($oRcpGroup = $oRcpGroups->next()) {
|
||||
$iMenu++;
|
||||
$iIDGroup = $oRcpGroup->get("idnewsgroup");
|
||||
|
||||
$sName = $oRcpGroup->get("groupname");
|
||||
if ($oRcpGroup->get("defaultgroup")) {
|
||||
$sName = $sName . "*";
|
||||
}
|
||||
|
||||
// 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 . '";
|
||||
|
||||
// Create messageBox instance
|
||||
box = new messageBox("", "", "", 0, 0);
|
||||
|
||||
function showDelMsg(lngId, strElement) {
|
||||
box.confirm("' . $aMsg["DelTitle"] . '", "' . $aMsg["DelDescr"] . '<b>" + strElement + "</b>", "deleteRecipientGroup(\'" + lngId + "\')");
|
||||
}
|
||||
|
||||
// Function for deleting recipient groups
|
||||
function deleteRecipientGroup(idrecipientgroup) {
|
||||
oForm = top.content.left.left_top.document.getElementById("groups_listoptionsform");
|
||||
|
||||
url = "main.php?area=recipientgroups";
|
||||
url += "&action=recipientgroup_delete";
|
||||
url += "&frame=4";
|
||||
url += "&idrecipientgroup=" + idrecipientgroup;
|
||||
url += "&contenido=" + sid;
|
||||
url += get_registered_parameters();
|
||||
url += "&sortby=" + oForm.sortby.value;
|
||||
url += "&sortorder=" + oForm.sortorder.value;
|
||||
url += "&filter=" + oForm.filter.value;
|
||||
url += "&elemperpage=" + oForm.elemperpage.value;
|
||||
|
||||
parent.parent.right.right_bottom.location.href = url;
|
||||
}
|
||||
|
||||
</script>';
|
||||
|
||||
$oPage->setMargin(0);
|
||||
$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";
|
||||
$oPagerLink = new cHTMLLink;
|
||||
$oPagerLink->setLink("main.php");
|
||||
$oPagerLink->setTargetFrame('left_bottom');
|
||||
$oPagerLink->setCustom("elemperpage", $_REQUEST["elemperpage"]);
|
||||
$oPagerLink->setCustom("filter", $_REQUEST["filter"]);
|
||||
$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);
|
||||
// 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
|
||||
$oPager = new cObjectPager($sPagerId, $iItemCount, $_REQUEST["elemperpage"], $_REQUEST["page"], $oPagerLink, "page");
|
||||
|
||||
// Add slashes, to insert in javascript
|
||||
$sPagerContent = $oPager->render(1);
|
||||
$sPagerContent = str_replace('\\', '\\\\', $sPagerContent);
|
||||
$sPagerContent = str_replace('\'', '\\\'', $sPagerContent);
|
||||
|
||||
// Send new object pager to left_top
|
||||
// Send new object pager to left_top
|
||||
$oPage->addScript('setpager', '<script type="text/javascript" src="scripts/setPager.js"></script>');
|
||||
|
||||
$sRefreshPager = '
|
||||
<script type="text/javascript">
|
||||
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->setContent(array('<table border="0" cellspacing="0" cellpadding="0" width="100%">', '</table>', $oMenu->render(false)));
|
||||
$oPage->setContent($oMenu->render(false));
|
||||
$oPage->render();
|
||||
?>
|
|
@ -1,246 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Project:
|
||||
* Contenido Content Management System
|
||||
*
|
||||
* Description:
|
||||
* Frontend user editor
|
||||
*
|
||||
* Requirements:
|
||||
* @con_php_req 5.0
|
||||
*
|
||||
*
|
||||
* @package Contenido Backend includes
|
||||
* @version 1.1.7
|
||||
* @author Bj<EFBFBD>rn Behrens (HerrB)
|
||||
* @copyright four for business AG <www.4fb.de>
|
||||
* @license http://www.contenido.org/license/LIZENZ.txt
|
||||
* @link http://www.4fb.de
|
||||
* @link http://www.contenido.org
|
||||
* @since file available since contenido release <= 4.6
|
||||
*
|
||||
* {@internal
|
||||
* created 2007-01-01, Bj<EFBFBD>rn Behrens (HerrB)
|
||||
* modified 2008-06-27, Dominik Ziegler, add security fix
|
||||
*
|
||||
* $Id$:
|
||||
* }}
|
||||
*
|
||||
*/
|
||||
if (!defined('CON_FRAMEWORK')) {
|
||||
die('Illegal call');
|
||||
}
|
||||
|
||||
|
||||
$oPage = new cPage;
|
||||
$oRecipients = new RecipientCollection;
|
||||
|
||||
if (is_array($cfg['plugins']['recipients'])) {
|
||||
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 --", "cl_newsletter"));
|
||||
$oPage->setReload();
|
||||
} elseif ($action == "recipients_delete" && $perm->have_perm_area_action($area, $action)) {
|
||||
$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.", "cl_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.", "cl_newsletter")), 0, $timeframe), 0);
|
||||
}
|
||||
|
||||
$recipient = new Recipient;
|
||||
$oPage->setReload();
|
||||
} else {
|
||||
$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();
|
||||
|
||||
$name = stripslashes($name);
|
||||
$email = stripslashes($email);
|
||||
$confirmed = (int) $confirmed;
|
||||
$deactivated = (int) $deactivated;
|
||||
$newstype = (int) $newstype;
|
||||
|
||||
$recipient->set("name", $name);
|
||||
|
||||
if (!isValidMail($email)) {
|
||||
$aMessages[] = i18n("Please specify a valid e-mail address", "cl_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();
|
||||
|
||||
if ($oRecipients->next()) {
|
||||
$aMessages[] = i18n("Could not set new e-mail adress: Other recipient with same e-mail address already exists", "cl_newsletter");
|
||||
} 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"));
|
||||
|
||||
$oForm->addHeader(i18n("Edit recipient", "cl_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", "cl_newsletter"), "0");
|
||||
$oSelNewsType->addOptionElement(0, $oOption);
|
||||
$oOption = new cHTMLOptionElement(i18n("HTML and text", "cl_newsletter"), "1");
|
||||
$oSelNewsType->addOptionElement(1, $oOption);
|
||||
$oSelNewsType->setDefault($recipient->get("news_type"));
|
||||
|
||||
$oForm->add(i18n("Name", "cl_newsletter"), $oTxtName->render());
|
||||
$oForm->add(i18n("E-Mail", "cl_newsletter"), $oTxtEMail->render());
|
||||
$oForm->add(i18n("Confirmed", "cl_newsletter"), $oCkbConfirmed->toHTML(false) . " (" . $recipient->get("confirmeddate") . ")");
|
||||
$oForm->add(i18n("Deactivated", "cl_newsletter"), $oCkbDeactivated->toHTML(false));
|
||||
$oForm->add(i18n("Message type", "cl_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", "cl_newsletter"), sprintf(i18n("The plugin %s delivered an array for the displayed titles, but did not return an array for the contents.", "cl_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", "cl_newsletter"));
|
||||
} else {
|
||||
// Headline
|
||||
$oGroupList->setCell(0, 1, "<strong>" . i18n("Groupname", "cl_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", "cl_newsletter"), $oGroupList->render());
|
||||
|
||||
$oForm->add(i18n("Author", "cl_newsletter"), $classuser->getUserName($recipient->get("author")) . " (" . $recipient->get("created") . ")");
|
||||
$oForm->add(i18n("Last modified by", "cl_newsletter"), $classuser->getUserName($recipient->get("modifiedby")) . " (" . $recipient->get("lastmodified") . ")");
|
||||
|
||||
$oPage->setContent($sNotis . $oForm->render(true));
|
||||
} else {
|
||||
$oPage->setContent($sNotis . "");
|
||||
}
|
||||
|
||||
$oPage->render();
|
||||
?>
|
|
@ -1,360 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Project:
|
||||
* Contenido Content Management System
|
||||
*
|
||||
* Description:
|
||||
* Frontend user editor
|
||||
*
|
||||
* Requirements:
|
||||
* @con_php_req 5.0
|
||||
*
|
||||
*
|
||||
* @package Contenido Backend includes
|
||||
* @version 1.0.0
|
||||
* @author Bj<EFBFBD>rn Behrens (HerrB)
|
||||
* @copyright four for business AG <www.4fb.de>
|
||||
* @license http://www.contenido.org/license/LIZENZ.txt
|
||||
* @link http://www.4fb.de
|
||||
* @link http://www.contenido.org
|
||||
* @since file available since contenido release <= 4.6
|
||||
*
|
||||
* {@internal
|
||||
* created 2007-01-01, Bj<EFBFBD>rn Behrens (HerrB)
|
||||
* modified 2008-06-27, Dominik Ziegler, add security fix
|
||||
*
|
||||
* $Id$:
|
||||
* }}
|
||||
*
|
||||
*/
|
||||
if (!defined('CON_FRAMEWORK')) {
|
||||
die('Illegal call');
|
||||
}
|
||||
|
||||
|
||||
$oPage = new cPage;
|
||||
$oRecipients = new RecipientCollection;
|
||||
|
||||
if (is_array($cfg['plugins']['recipients'])) {
|
||||
foreach ($cfg['plugins']['recipients'] as $plugin) {
|
||||
plugin_include("recipients", $plugin . "/" . $plugin . ".php");
|
||||
}
|
||||
}
|
||||
|
||||
// Check form data
|
||||
if ($_REQUEST["selDelimiter"] == "") {
|
||||
$_REQUEST["selDelimiter"] = "tab";
|
||||
}
|
||||
|
||||
$aFields = array();
|
||||
$aFieldDetails = array();
|
||||
$aFields["name"] = strtolower(i18n("Name", "cl_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", "cl_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", "cl_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", "cl_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", "cl_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", "cl_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;
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Get groups
|
||||
$oRcpGroups = new RecipientGroupCollection;
|
||||
$oRcpGroups->setWhere("idclient", $client);
|
||||
$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", "cl_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 ($_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;
|
||||
|
||||
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", "cl_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", "cl_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)", "cl_newsletter"), $sName, $iRow);
|
||||
$aInvalidLines[] = $sLine;
|
||||
$iInvalid++;
|
||||
} else if (!isValidMail($sEMail)) {
|
||||
$aMessage[] = sprintf(i18n("Mail address '%s' is invalid, item ignored (row: %s)", "cl_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)", "cl_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", "cl_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", "cl_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).", "cl_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", "cl_newsletter"));
|
||||
|
||||
$oSelDelimiter = new cHTMLSelectElement("selDelimiter");
|
||||
$aItems = array();
|
||||
$aItems[] = array("tab", i18n("Tab", "cl_newsletter"));
|
||||
$aItems[] = array("semicolon", i18n("Semicolon", "cl_newsletter"));
|
||||
$oSelDelimiter->autoFill($aItems);
|
||||
$oSelDelimiter->setDefault($_REQUEST["selDelimiter"]);
|
||||
$oForm->add(i18n("Delimiter", "cl_newsletter"), $oSelDelimiter->render());
|
||||
|
||||
$oAreaData = new cHTMLTextarea("txtData", $_REQUEST["txtData"], 80, 20);
|
||||
|
||||
$sInfo = '<a href="javascript:fncShowHide(\'idInfoText\');"><strong>' . i18n("Import information", "cl_newsletter") . '</strong></a>' .
|
||||
'<div id="idInfoText" style="display: none">' .
|
||||
'<br /><br /><strong>' . i18n("Specify colum types:", "cl_newsletter") . '</strong>' .
|
||||
i18n("<br />The first line must contain the column names; this specifies the column order.<br /><column name>[delimiter]<column name>...", "cl_newsletter") .
|
||||
'<br /><br /><strong>' . i18n("Data structure:", "cl_newsletter") . '</strong><br />' .
|
||||
i18n("The recipients have to be entered using the following format:<br /><data>[Delimiter]<data>... - each recipient in a new line.", "cl_newsletter") .
|
||||
'<br /><br /><strong>' . i18n("Example:", "cl_newsletter") . '</strong>' .
|
||||
i18n("<br />name;mail;confirmed<br />Smith;jon.smith@example.org;1", "cl_newsletter") .
|
||||
'<br /><br /><strong>' . i18n("The following column names will be recognized:", "cl_newsletter") . '</strong><br />' .
|
||||
implode("<br />\n", $aFields);
|
||||
|
||||
$oForm->add(i18n("Recipients", "cl_newsletter"), $oAreaData->render() . "<br />" . $sInfo);
|
||||
unset($sInfo);
|
||||
|
||||
$sExecScript = '
|
||||
<script type="text/javascript">
|
||||
/* Enabled/Disable group box */
|
||||
function fncShowHide(strItemID) {
|
||||
objItem = document.getElementById(strItemID);
|
||||
|
||||
if (objItem.style.display == "none") {
|
||||
objItem.style.display = "inline";
|
||||
} else {
|
||||
objItem.style.display = "none";
|
||||
}
|
||||
}
|
||||
</script>';
|
||||
|
||||
$oPage->addScript('execscript', $sExecScript);
|
||||
$oPage->setContent($sMessage . $oForm->render(true));
|
||||
$oPage->render();
|
||||
?>
|
|
@ -1,288 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Project:
|
||||
* Contenido Content Management System
|
||||
*
|
||||
* Description:
|
||||
* Recipient user list
|
||||
*
|
||||
* Requirements:
|
||||
* @con_php_req 5.0
|
||||
*
|
||||
*
|
||||
* @package Contenido Backend includes
|
||||
* @version 1.2.2
|
||||
* @author Bj<EFBFBD>rn Behrens (HerrB)
|
||||
* @copyright four for business AG <www.4fb.de>
|
||||
* @license http://www.contenido.org/license/LIZENZ.txt
|
||||
* @link http://www.4fb.de
|
||||
* @link http://www.contenido.org
|
||||
* @since file available since contenido release <= 4.6
|
||||
*
|
||||
* {@internal
|
||||
* created 2007-01-01, Bj<EFBFBD>rn Behrens (HerrB)
|
||||
* modified 2008-06-27, Dominik Ziegler, add security fix
|
||||
*
|
||||
* $Id$:
|
||||
* }}
|
||||
*
|
||||
*/
|
||||
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"]);
|
||||
//$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.
|
||||
// field: Field name in the db
|
||||
// caption: Shown field name (-> user)
|
||||
// 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" => "name", "caption" => i18n("Name", "cl_newsletter"), "type" => "base,sort,search");
|
||||
$aFields["email"] = array("field" => "email", "caption" => i18n("E-Mail", "cl_newsletter"), "type" => "base,sort,search");
|
||||
$aFields["confirmed"] = array("field" => "confirmed", "caption" => i18n("Confirmed", "cl_newsletter"), "type" => "base");
|
||||
$aFields["deactivated"] = array("field" => "deactivated", "caption" => i18n("Deactivated", "cl_newsletter"), "type" => "base");
|
||||
|
||||
##################################
|
||||
# Store settings
|
||||
##################################
|
||||
//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")) {
|
||||
$oClient->setProperty("newsletter", "purgetimeframe", $_REQUEST["txtPurgeTimeframe"]);
|
||||
//$sRefreshTop = '<script language="JavaScript">parent.left_top.purgetimeframe = '.$_REQUEST["txtPurgeTimeframe"].'</script>';
|
||||
}
|
||||
|
||||
##################################
|
||||
# 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);
|
||||
}
|
||||
if (!is_numeric($_REQUEST["elemperpage"])) {
|
||||
// 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"]);
|
||||
}
|
||||
|
||||
$_REQUEST["restrictgroup"] = (int) $_REQUEST["restrictgroup"];
|
||||
if ($_REQUEST["restrictgroup"] == 0) {
|
||||
$_REQUEST["restrictgroup"] = "--all--";
|
||||
}
|
||||
$_REQUEST["page"] = (int) $_REQUEST["page"];
|
||||
if ($_REQUEST["page"] <= 0 || $_REQUEST["elemperpage"] == 0) {
|
||||
$_REQUEST["page"] = 1;
|
||||
}
|
||||
// Sort order
|
||||
if ($_REQUEST["sortorder"] != "DESC") {
|
||||
$_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;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$bSortByFound) {
|
||||
$_REQUEST["sortby"] = "name"; // Default sort by field, possible values see above
|
||||
}
|
||||
if (!$bSearchInFound) {
|
||||
$_REQUEST["searchin"] = "--all--";
|
||||
}
|
||||
|
||||
// Free memory
|
||||
unset($oUser);
|
||||
unset($oClient);
|
||||
|
||||
##################################
|
||||
# Get data
|
||||
##################################
|
||||
$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.", "cl_newsletter"), $iUpdatedRecipients));
|
||||
}
|
||||
|
||||
$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"]);
|
||||
}
|
||||
// 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");
|
||||
}
|
||||
}
|
||||
|
||||
// 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"] * ($_REQUEST["page"]) >= $iItemCount + $_REQUEST["elemperpage"] && $_REQUEST["page"] != 1) {
|
||||
$_REQUEST["page"] --;
|
||||
}
|
||||
|
||||
$oRecipients->setLimit($_REQUEST["elemperpage"] * ($_REQUEST["page"] - 1), $_REQUEST["elemperpage"]);
|
||||
} else {
|
||||
$iItemCount = 0;
|
||||
}
|
||||
|
||||
$oRecipients->query();
|
||||
|
||||
// Output data
|
||||
$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", "cl_newsletter");
|
||||
$aMsg["DelDescr"] = i18n("Do you really want to delete the following recipient:<br>", "cl_newsletter");
|
||||
|
||||
while ($oRecipient = $oRecipients->next()) {
|
||||
$iMenu++;
|
||||
$idnewsrcp = $oRecipient->get("idnewsrcp");
|
||||
|
||||
$sName = $oRecipient->get("name");
|
||||
if (empty($sName)) {
|
||||
$sName = $oRecipient->get("email");
|
||||
}
|
||||
|
||||
$oLnk = new cHTMLLink;
|
||||
$oLnk->setMultiLink($area, "", $area, "");
|
||||
$oLnk->setCustom("idrecipient", $idnewsrcp);
|
||||
|
||||
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 . '";
|
||||
|
||||
// Create messageBox instance
|
||||
box = new messageBox("", "", "", 0, 0);
|
||||
|
||||
function showDelMsg(lngId, strElement) {
|
||||
box.confirm("' . $aMsg["DelTitle"] . '", "' . $aMsg["DelDescr"] . '<b>" + strElement + "</b>", "deleteRecipient(\'" + lngId + "\')");
|
||||
}
|
||||
|
||||
// Function for deleting recipients
|
||||
function deleteRecipient(idrecipient) {
|
||||
oForm = top.content.left.left_top.document.getElementById("options");
|
||||
|
||||
url = "main.php?area=recipients";
|
||||
url += "&action=recipients_delete";
|
||||
url += "&frame=4";
|
||||
url += "&idrecipient=" + idrecipient;
|
||||
url += "&contenido=" + sid;
|
||||
url += get_registered_parameters();
|
||||
url += "&restrictgroup=" + oForm.restrictgroup.value;
|
||||
url += "&sortby=" + oForm.sortby.value;
|
||||
url += "&sortorder=" + oForm.sortorder.value;
|
||||
url += "&filter=" + oForm.filter.value;
|
||||
url += "&elemperpage=" + oForm.elemperpage.value;
|
||||
|
||||
parent.parent.right.right_bottom.location.href = url;
|
||||
}
|
||||
</script>';
|
||||
|
||||
$oPage->setMargin(0);
|
||||
$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';
|
||||
$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->enableAutomaticParameterAppend();
|
||||
$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
|
||||
$oPager = new cObjectPager($sPagerId, $iItemCount, $_REQUEST["elemperpage"], $_REQUEST["page"], $oPagerLink, "page");
|
||||
|
||||
//add slashes, to insert in javascript
|
||||
$sPagerContent = $oPager->render(1);
|
||||
$sPagerContent = str_replace('\\', '\\\\', $sPagerContent);
|
||||
$sPagerContent = str_replace('\'', '\\\'', $sPagerContent);
|
||||
|
||||
// Send new object pager to left_top
|
||||
$oPage->addScript('setpager', '<script type="text/javascript" src="scripts/setPager.js"></script>');
|
||||
|
||||
$sRefreshPager = '
|
||||
<script type="text/javascript">
|
||||
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->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
Binäre Datei nicht angezeigt.
Datei-Diff unterdrückt, da er zu groß ist
Diff laden
|
@ -1,21 +0,0 @@
|
|||
./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
|
|
@ -1,114 +0,0 @@
|
|||
/**
|
||||
* Author: oldperl
|
||||
* Created: 13.12.2018
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `!PREFIX!_news` (
|
||||
`idnews` int(10) NOT NULL DEFAULT 0,
|
||||
`idclient` int(10) NOT NULL DEFAULT 0,
|
||||
`idlang` int(10) NOT NULL DEFAULT 0,
|
||||
`idart` int(10) NOT NULL DEFAULT 0,
|
||||
`template_idart` int(10) NOT NULL DEFAULT 0,
|
||||
`type` varchar(10) NOT NULL DEFAULT 'text',
|
||||
`name` varchar(255) NOT NULL,
|
||||
`subject` text DEFAULT NULL,
|
||||
`message` longtext DEFAULT NULL,
|
||||
`newsfrom` varchar(255) NOT NULL,
|
||||
`newsfromname` varchar(255) DEFAULT NULL,
|
||||
`newsdate` datetime DEFAULT NULL,
|
||||
`welcome` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`use_cronjob` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`send_to` varchar(32) NOT NULL DEFAULT 'all',
|
||||
`send_ids` text DEFAULT NULL,
|
||||
`dispatch` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`dispatch_count` int(5) NOT NULL DEFAULT 50,
|
||||
`dispatch_delay` int(5) NOT NULL DEFAULT 5,
|
||||
`author` varchar(32) NOT NULL,
|
||||
`created` datetime NOT NULL DEFAULT '1970-01-01 00:00:01',
|
||||
`modified` datetime NOT NULL DEFAULT '1970-01-01 00:00:01',
|
||||
`modifiedby` varchar(32) NOT NULL,
|
||||
PRIMARY KEY (`idnews`)
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `!PREFIX!_news_groupmembers` (
|
||||
`idnewsgroupmember` int(10) NOT NULL DEFAULT 0,
|
||||
`idnewsgroup` int(10) NOT NULL DEFAULT 0,
|
||||
`idnewsrcp` int(10) NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (`idnewsgroupmember`)
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `!PREFIX!_news_groups` (
|
||||
`idnewsgroup` int(10) NOT NULL DEFAULT 0,
|
||||
`idclient` int(10) NOT NULL DEFAULT 0,
|
||||
`idlang` int(10) NOT NULL DEFAULT 0,
|
||||
`groupname` varchar(32) NOT NULL,
|
||||
`defaultgroup` tinyint(1) NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (`idnewsgroup`)
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `!PREFIX!_news_jobs` (
|
||||
`idnewsjob` int(10) NOT NULL DEFAULT 0,
|
||||
`idclient` int(10) NOT NULL DEFAULT 0,
|
||||
`idlang` int(10) NOT NULL DEFAULT 0,
|
||||
`idnews` int(10) NOT NULL DEFAULT 0,
|
||||
`status` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`use_cronjob` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`started` datetime NOT NULL DEFAULT '1970-01-01 00:00:01',
|
||||
`finished` datetime NOT NULL DEFAULT '1970-01-01 00:00:01',
|
||||
`name` varchar(255) NOT NULL,
|
||||
`type` varchar(10) NOT NULL DEFAULT 'text',
|
||||
`encoding` varchar(32) NOT NULL DEFAULT 'iso-8859-1',
|
||||
`newsfrom` varchar(255) NOT NULL,
|
||||
`newsfromname` varchar(255) NOT NULL,
|
||||
`newsdate` datetime DEFAULT '1970-01-01 00:00:01',
|
||||
`subject` text DEFAULT NULL,
|
||||
`idart` int(10) NOT NULL DEFAULT 0,
|
||||
`message_text` longtext NOT NULL,
|
||||
`message_html` longtext DEFAULT NULL,
|
||||
`send_to` text NOT NULL,
|
||||
`dispatch` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`dispatch_count` int(5) NOT NULL DEFAULT 50,
|
||||
`dispatch_delay` int(5) NOT NULL DEFAULT 5,
|
||||
`author` varchar(32) NOT NULL,
|
||||
`authorname` varchar(32) NOT NULL,
|
||||
`rcpcount` int(10) NOT NULL DEFAULT 0,
|
||||
`sendcount` int(10) NOT NULL DEFAULT 0,
|
||||
`created` datetime NOT NULL DEFAULT '1970-01-01 00:00:01',
|
||||
`modified` datetime NOT NULL DEFAULT '1970-01-01 00:00:01',
|
||||
`modifiedby` varchar(32) NOT NULL,
|
||||
PRIMARY KEY (`idnewsjob`)
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `!PREFIX!_news_log` (
|
||||
`idnewslog` int(10) NOT NULL DEFAULT 0,
|
||||
`idnewsjob` int(10) NOT NULL DEFAULT 0,
|
||||
`idnewsrcp` int(10) NOT NULL DEFAULT 0,
|
||||
`rcpname` varchar(255) NOT NULL,
|
||||
`rcpemail` varchar(255) NOT NULL,
|
||||
`rcphash` varchar(32) NOT NULL,
|
||||
`rcpnewstype` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`status` varchar(255) NOT NULL,
|
||||
`sent` datetime NOT NULL DEFAULT '1970-01-01 00:00:01',
|
||||
`created` datetime NOT NULL DEFAULT '1970-01-01 00:00:01',
|
||||
PRIMARY KEY (`idnewslog`)
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `!PREFIX!_news_rcp` (
|
||||
`idnewsrcp` int(10) NOT NULL DEFAULT 0,
|
||||
`idclient` int(10) NOT NULL DEFAULT 0,
|
||||
`idlang` int(10) NOT NULL DEFAULT 0,
|
||||
`email` varchar(255) DEFAULT NULL,
|
||||
`confirmed` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`confirmeddate` datetime NOT NULL DEFAULT '1970-01-01 00:00:01',
|
||||
`lastaction` varchar(32) DEFAULT NULL,
|
||||
`name` varchar(255) DEFAULT NULL,
|
||||
`hash` varchar(32) NOT NULL,
|
||||
`deactivated` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`news_type` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`author` varchar(32) NOT NULL,
|
||||
`created` datetime NOT NULL DEFAULT '1970-01-01 00:00:01',
|
||||
`lastmodified` datetime NOT NULL DEFAULT '1970-01-01 00:00:01',
|
||||
`modifiedby` varchar(32) NOT NULL,
|
||||
PRIMARY KEY (`idnewsrcp`)
|
||||
);
|
|
@ -1,12 +0,0 @@
|
|||
/**
|
||||
* Author: oldperl
|
||||
* Created: 13.12.2018
|
||||
$Id$
|
||||
*/
|
||||
|
||||
DROP TABLE IF EXISTS !PREFIX!_news;
|
||||
DROP TABLE IF EXISTS !PREFIX!_news_groupmembers;
|
||||
DROP TABLE IF EXISTS !PREFIX!_news_groups;
|
||||
DROP TABLE IF EXISTS !PREFIX!_news_jobs;
|
||||
DROP TABLE IF EXISTS !PREFIX!_news_log;
|
||||
DROP TABLE IF EXISTS !PREFIX!_news_rcp;
|
|
@ -1,10 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<language>
|
||||
<navigation>
|
||||
<extra>
|
||||
<newsletter>Newsletter</newsletter>
|
||||
<recipients>Empfänger</recipients>
|
||||
<recipientgroups>Empfängergruppe</recipientgroups>
|
||||
</extra>
|
||||
</navigation>
|
||||
</language>
|
|
@ -1,10 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<language>
|
||||
<navigation>
|
||||
<extra>
|
||||
<newsletter>Newsletter</newsletter>
|
||||
<recipients>Recipients</recipients>
|
||||
<recipientgroups>Recipient groups</recipientgroups>
|
||||
</extra>
|
||||
</navigation>
|
||||
</language>
|
|
@ -1,10 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<language>
|
||||
<navigation>
|
||||
<extra>
|
||||
<newsletter>Newsletter</newsletter>
|
||||
<recipients>Empfänger</recipients>
|
||||
<recipientgroups>Empfängergruppe</recipientgroups>
|
||||
</extra>
|
||||
</navigation>
|
||||
</language>
|
|
@ -1,10 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<language>
|
||||
<navigation>
|
||||
<extra>
|
||||
<newsletter>Lettre d'information</newsletter>
|
||||
<recipients>Destinataires</recipients>
|
||||
<recipientgroups>Groupes de destinataires</recipientgroups>
|
||||
</extra>
|
||||
</navigation>
|
||||
</language>
|
|
@ -1,10 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<language>
|
||||
<navigation>
|
||||
<extra>
|
||||
<newsletter>Bollettino E-Mail</newsletter>
|
||||
<recipients>Destinatori</recipients>
|
||||
<recipientgroups>Gruppo Destinatori</recipientgroups>
|
||||
</extra>
|
||||
</navigation>
|
||||
</language>
|
|
@ -1,10 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<language>
|
||||
<navigation>
|
||||
<extra>
|
||||
<newsletter>Nieuwsbrief</newsletter>
|
||||
<recipients>Leden</recipients>
|
||||
<recipientgroups>Leden groepen</recipientgroups>
|
||||
</extra>
|
||||
</navigation>
|
||||
</language>
|
|
@ -1,400 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Project:
|
||||
* Contenido Content Management System
|
||||
*
|
||||
* Description:
|
||||
* Search articles by content allocation
|
||||
*
|
||||
* Requirements:
|
||||
* @con_php_req 5.0
|
||||
*
|
||||
*
|
||||
* @package Contenido Backend plugins
|
||||
* @version 0.7.8
|
||||
* @author Marco Jahn
|
||||
* @copyright four for business AG <www.4fb.de>
|
||||
* @license http://www.contenido.org/license/LIZENZ.txt
|
||||
* @link http://www.4fb.de
|
||||
* @link http://www.contenido.org
|
||||
* @since file available since contenido release <= 4.6
|
||||
*
|
||||
* {@internal
|
||||
* created 2005
|
||||
* modified 2005-10-27, Willi Man, debug option
|
||||
* modified 2005-11-16, Willi Man, new method findMatchingContentByContentAllocationByCategories
|
||||
* modified 2005-11-21, Willi Man, new method findMarchingCOntentByContentAllocation_OR_Categories
|
||||
* modified 2008-04-06, Holger Librenz, direct mysql_* calls remoced, using DB_ConLite:: methods instead
|
||||
* modified 2008-07-02, Frederic Schneider, add security fix
|
||||
*
|
||||
* $Id$:
|
||||
* }}
|
||||
*
|
||||
*/
|
||||
if (!defined('CON_FRAMEWORK')) {
|
||||
die('Illegal call');
|
||||
}
|
||||
|
||||
plugin_include('repository', 'custom/FrontendNavigation.php');
|
||||
|
||||
class pApiContentAllocation {
|
||||
|
||||
/**
|
||||
* References database object
|
||||
*
|
||||
* @var DB_ConLite
|
||||
*/
|
||||
var $db = null;
|
||||
var $table = null;
|
||||
var $lang = null;
|
||||
var $client = null;
|
||||
var $treeObj = null;
|
||||
|
||||
/**
|
||||
*
|
||||
* @modified 27.10.2005 new class variable $this->bDebug (if true print debug information)
|
||||
*/
|
||||
public function __construct() {
|
||||
global $db, $cfg, $lang, $client;
|
||||
|
||||
$this->db = new DB_ConLite;
|
||||
$this->table = $cfg['tab'];
|
||||
$this->lang = $lang;
|
||||
$this->client = $client;
|
||||
|
||||
# use this option carefully and only temporary.
|
||||
# the hidden debug output as html-comments can cause display problems.
|
||||
$this->bDebug = false;
|
||||
|
||||
$this->treeObj = new pApiTree('f31a4384-e5c1-4ede-b1bb-f43657ec73a5');
|
||||
}
|
||||
|
||||
function storeAllocations($idartlang, $allocations) {
|
||||
// empty before insert
|
||||
$this->deleteAllocationsByIdartlang($idartlang);
|
||||
|
||||
if (is_array($allocations)) {
|
||||
foreach ($allocations as $value) {
|
||||
$sql = "INSERT INTO " . $this->table['pica_alloc_con'] . " (idpica_alloc, idartlang) VALUES (" . Contenido_Security::toInteger($value) . ", " . Contenido_Security::toInteger($idartlang) . ")";
|
||||
$this->db->query($sql);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function deleteAllocations($idpica_alloc) {
|
||||
$sql = "DELETE FROM " . $this->table['pica_alloc_con'] . " WHERE idpica_alloc = " . Contenido_Security::toInteger($idpica_alloc);
|
||||
$this->db->query($sql);
|
||||
}
|
||||
|
||||
function deleteAllocationsByIdartlang($idartlang) {
|
||||
$sql = "DELETE FROM " . $this->table['pica_alloc_con'] . " WHERE idartlang = " . Contenido_Security::toInteger($idartlang);
|
||||
$this->db->query($sql);
|
||||
}
|
||||
|
||||
function loadAllocations($idartlang) {
|
||||
//$sql = "SELECT idpica_alloc FROM " . $this->table['pica_alloc_con'] . " WHERE idartlang = " . Contenido_Security::toInteger($idartlang);
|
||||
$this->db->query("-- pApiContentAllocation->loadAllocations()
|
||||
SELECT
|
||||
a.idpica_alloc
|
||||
FROM
|
||||
`{$this->table['pica_alloc']}` AS a
|
||||
, `{$this->table['pica_alloc_con']}` AS b
|
||||
WHERE
|
||||
idartlang = $idartlang
|
||||
AND a.idpica_alloc=b.idpica_alloc
|
||||
;");
|
||||
|
||||
$items = array();
|
||||
|
||||
while ($this->db->next_record()) {
|
||||
$items[] = $this->db->f('idpica_alloc');
|
||||
}
|
||||
return $items;
|
||||
}
|
||||
|
||||
function loadAllocationsWithNames($idartlang, $parent, $firstonly = false) {
|
||||
|
||||
global $cfg;
|
||||
|
||||
$sql = "SELECT " . $cfg['tab']['pica_alloc'] . ".idpica_alloc FROM " . $cfg['tab']['pica_alloc'] . "
|
||||
INNER JOIN " . $cfg['tab']['pica_alloc_con'] . " ON
|
||||
" . $cfg['tab']['pica_alloc'] . ".idpica_alloc = " . $cfg['tab']['pica_alloc_con'] . ".idpica_alloc
|
||||
WHERE (" . $cfg['tab']['pica_alloc'] . ".parentid = " . Contenido_Security::toInteger($parent) . ") AND (" . $cfg['tab']['pica_alloc_con'] . ".idartlang=" . Contenido_Security::toInteger($idartlang) . ")
|
||||
ORDER BY " . $cfg['tab']['pica_alloc'] . ".sortorder";
|
||||
|
||||
$this->db->query($sql);
|
||||
|
||||
while ($this->db->next_record()) {
|
||||
$tmp[$this->db->f("idpica_alloc")] = $this->treeObj->_fetchItemNameLang($this->db->f("idpica_alloc"));
|
||||
|
||||
if ($firstonly) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return $tmp;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build query to find matching content by content allocation
|
||||
* @param array $restrictions
|
||||
* @return string SQL
|
||||
* @modified 17.11.2005 by Willi Man
|
||||
*/
|
||||
function findMatchingContent($restrictions = null, $max = 0) {
|
||||
if (!is_array($restrictions)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
global $aCategoriesToExclude; # @see config.local.php!
|
||||
$sql = $this->_buildQuery($restrictions, $aCategoriesToExclude, $max);
|
||||
|
||||
return $sql;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build query to find matching content by content allocation
|
||||
* @param array $restrictions
|
||||
* @return string SQL
|
||||
*/
|
||||
function _buildQuery($restrictions, $aCategoriesToExclude, $max) {
|
||||
|
||||
global $cfg;
|
||||
|
||||
$size = sizeof($restrictions);
|
||||
|
||||
if ($size == 0) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$sql_concat = unserialize('a:78:{i:0;s:2:"aa";i:1;s:2:"ab";i:2;s:2:"ac";i:3;s:2:"ad";i:4;s:2:"ae";i:5;s:2:"af";i:6;s:2:"ag";i:7;s:2:"ah";i:8;s:2:"ai";i:9;s:2:"aj";i:10;s:2:"ak";i:11;s:2:"al";i:12;s:2:"am";i:13;s:2:"an";i:14;s:2:"ao";i:15;s:2:"ap";i:16;s:2:"aq";i:17;s:2:"ar";i:18;s:2:"as";i:19;s:2:"at";i:20;s:2:"au";i:21;s:2:"av";i:22;s:2:"aw";i:23;s:2:"ax";i:24;s:2:"ay";i:25;s:2:"az";i:26;s:2:"ca";i:27;s:2:"cb";i:28;s:2:"cc";i:29;s:2:"cd";i:30;s:2:"ce";i:31;s:2:"cf";i:32;s:2:"cg";i:33;s:2:"ch";i:34;s:2:"ci";i:35;s:2:"cj";i:36;s:2:"ck";i:37;s:2:"cl";i:38;s:2:"cm";i:39;s:2:"cn";i:40;s:2:"co";i:41;s:2:"cp";i:42;s:2:"cq";i:43;s:2:"cr";i:44;s:2:"cs";i:45;s:2:"ct";i:46;s:2:"cu";i:47;s:2:"cv";i:48;s:2:"cw";i:49;s:2:"cx";i:50;s:2:"cy";i:51;s:2:"cz";i:52;s:1:"a";i:53;s:1:"b";i:54;s:1:"c";i:55;s:1:"d";i:56;s:1:"e";i:57;s:1:"f";i:58;s:1:"g";i:59;s:1:"h";i:60;s:1:"i";i:61;s:1:"j";i:62;s:1:"k";i:63;s:1:"l";i:64;s:1:"m";i:65;s:1:"n";i:66;s:1:"o";i:67;s:1:"p";i:68;s:1:"q";i:69;s:1:"r";i:70;s:1:"s";i:71;s:1:"t";i:72;s:1:"u";i:73;s:1:"v";i:74;s:1:"w";i:75;s:1:"x";i:76;s:1:"y";i:77;s:1:"z";}');
|
||||
|
||||
$sqlTemplate = "SELECT cal.idart, cal.online, aa.idartlang, cat.idcat FROM {TABLES} WHERE {WHERE} ";
|
||||
|
||||
$tables = array();
|
||||
$where = array();
|
||||
|
||||
for ($i = 0; $i < $size; $i++) {
|
||||
if ($i == 0) { // first
|
||||
$tables[] = " " . $cfg['tab']['pica_alloc_con'] . " AS " . $sql_concat[$i];
|
||||
} else {
|
||||
$tables[] = " LEFT JOIN " . $cfg['tab']['pica_alloc_con'] . " AS " . $sql_concat[$i] . " USING (idartlang)";
|
||||
}
|
||||
if (is_int((int) $restrictions[$i]) AND $restrictions[$i] > 0) {
|
||||
$where[] = $sql_concat[$i] . ".idpica_alloc = " . $restrictions[$i];
|
||||
}
|
||||
}
|
||||
|
||||
# fetch only articles which are online
|
||||
$where[] = 'cal.online = 1';
|
||||
|
||||
# fetch only articles which are not in following categories
|
||||
if (count($aCategoriesToExclude) > 0) {
|
||||
$where[] = "cat.idcat NOT IN (" . implode(',', $aCategoriesToExclude) . ")";
|
||||
}
|
||||
|
||||
// join art_lang for idart
|
||||
$tables[] = " LEFT JOIN " . $this->table['art_lang'] . " AS cal USING (idartlang)";
|
||||
$tables[] = " LEFT JOIN " . $this->table['cat_art'] . " AS cart USING (idart)";
|
||||
$tables[] = " LEFT JOIN " . $this->table['cat'] . " as cat USING (idcat)";
|
||||
|
||||
$tables = implode('', $tables);
|
||||
$where = implode(' AND ', $where);
|
||||
|
||||
$sql = str_replace('{TABLES}', $tables, $sqlTemplate);
|
||||
$sql = str_replace('{WHERE}', $where, $sql);
|
||||
|
||||
$sql .= " ORDER BY cal.published DESC";
|
||||
|
||||
if ($max != 0 && is_integer($max)) {
|
||||
$sql .= " LIMIT " . $max;
|
||||
}
|
||||
|
||||
if ($this->bDebug) {
|
||||
print "<!-- ";
|
||||
print $sql;
|
||||
print " -->";
|
||||
} # @modified 27.10.2005
|
||||
|
||||
return $sql;
|
||||
}
|
||||
|
||||
/**
|
||||
* Search articles by content allocation and catgories
|
||||
* @param array $aContentAllocation
|
||||
* @param array $aCategories
|
||||
*
|
||||
* @return array of articles
|
||||
*/
|
||||
function findMatchingContentByContentAllocationByCategories($aContentAllocation, $aCategories = array(), $iOffset = 0, $iNumOfRows = 0) {
|
||||
if (!is_array($aContentAllocation)) {
|
||||
return array();
|
||||
}
|
||||
|
||||
for ($i = 0; $i < count($aContentAllocation); $i++) {
|
||||
if (!is_int((int) $aContentAllocation[$i]) OR ! $aContentAllocation[$i] > 0) {
|
||||
return array();
|
||||
}
|
||||
}
|
||||
|
||||
for ($i = 0; $i < count($aCategories); $i++) {
|
||||
if (!is_int((int) $aCategories[$i]) OR ! $aCategories[$i] > 0) {
|
||||
return array();
|
||||
}
|
||||
}
|
||||
|
||||
$sql = $this->_buildQuery_MatchingContentByContentAllocationByCategories($aContentAllocation, $aCategories, $iOffset, $iNumOfRows);
|
||||
|
||||
$this->db->query($sql);
|
||||
|
||||
$aResult = array();
|
||||
while ($oRow = $this->db->getResultObject()) {
|
||||
$aResult[] = $oRow;
|
||||
}
|
||||
return $aResult;
|
||||
}
|
||||
|
||||
/**
|
||||
* build SQL query to find articles by content allocation and catgories
|
||||
*
|
||||
*/
|
||||
function _buildQuery_MatchingContentByContentAllocationByCategories($aContentAllocation, $aCategories, $iOffset, $iNumOfRows) {
|
||||
|
||||
global $cfg;
|
||||
|
||||
$size = sizeof($aContentAllocation);
|
||||
|
||||
$sql_concat = unserialize('a:78:{i:0;s:2:"aa";i:1;s:2:"ab";i:2;s:2:"ac";i:3;s:2:"ad";i:4;s:2:"ae";i:5;s:2:"af";i:6;s:2:"ag";i:7;s:2:"ah";i:8;s:2:"ai";i:9;s:2:"aj";i:10;s:2:"ak";i:11;s:2:"al";i:12;s:2:"am";i:13;s:2:"an";i:14;s:2:"ao";i:15;s:2:"ap";i:16;s:2:"aq";i:17;s:2:"ar";i:18;s:2:"as";i:19;s:2:"at";i:20;s:2:"au";i:21;s:2:"av";i:22;s:2:"aw";i:23;s:2:"ax";i:24;s:2:"ay";i:25;s:2:"az";i:26;s:2:"ca";i:27;s:2:"cb";i:28;s:2:"cc";i:29;s:2:"cd";i:30;s:2:"ce";i:31;s:2:"cf";i:32;s:2:"cg";i:33;s:2:"ch";i:34;s:2:"ci";i:35;s:2:"cj";i:36;s:2:"ck";i:37;s:2:"cl";i:38;s:2:"cm";i:39;s:2:"cn";i:40;s:2:"co";i:41;s:2:"cp";i:42;s:2:"cq";i:43;s:2:"cr";i:44;s:2:"cs";i:45;s:2:"ct";i:46;s:2:"cu";i:47;s:2:"cv";i:48;s:2:"cw";i:49;s:2:"cx";i:50;s:2:"cy";i:51;s:2:"cz";i:52;s:1:"a";i:53;s:1:"b";i:54;s:1:"c";i:55;s:1:"d";i:56;s:1:"e";i:57;s:1:"f";i:58;s:1:"g";i:59;s:1:"h";i:60;s:1:"i";i:61;s:1:"j";i:62;s:1:"k";i:63;s:1:"l";i:64;s:1:"m";i:65;s:1:"n";i:66;s:1:"o";i:67;s:1:"p";i:68;s:1:"q";i:69;s:1:"r";i:70;s:1:"s";i:71;s:1:"t";i:72;s:1:"u";i:73;s:1:"v";i:74;s:1:"w";i:75;s:1:"x";i:76;s:1:"y";i:77;s:1:"z";}');
|
||||
|
||||
$sqlTemplate = "SELECT cal.idart, cal.online, aa.idartlang, cat.idcat, aa.idpica_alloc FROM {TABLES} WHERE {WHERE} ";
|
||||
|
||||
$tables = array();
|
||||
$where = array();
|
||||
|
||||
for ($i = 0; $i < $size; $i++) {
|
||||
if ($i == 0) { // first
|
||||
$tables[] = " " . $cfg['tab']['pica_alloc_con'] . " AS " . $sql_concat[$i];
|
||||
} else {
|
||||
$tables[] = " LEFT JOIN " . $cfg['tab']['pica_alloc_con'] . " AS " . $sql_concat[$i] . " USING (idartlang)";
|
||||
}
|
||||
if (is_int((int) $aContentAllocation[$i]) AND $aContentAllocation[$i] > 0) {
|
||||
$where[] = $sql_concat[$i] . ".idpica_alloc = " . $aContentAllocation[$i];
|
||||
}
|
||||
}
|
||||
|
||||
# fetch only articles which are online
|
||||
$where[] = 'cal.online = 1';
|
||||
|
||||
# fetch only articles in following categories
|
||||
if (count($aCategories) > 0) {
|
||||
$where[] = "cat.idcat IN (" . implode(',', $aCategories) . ")";
|
||||
}
|
||||
|
||||
// join art_lang for idart
|
||||
$tables[] = " LEFT JOIN " . $this->table['art_lang'] . " AS cal USING (idartlang)";
|
||||
$tables[] = " LEFT JOIN " . $this->table['cat_art'] . " AS cart USING (idart)";
|
||||
$tables[] = " LEFT JOIN " . $this->table['cat'] . " as cat USING (idcat)";
|
||||
|
||||
$tables = implode('', $tables);
|
||||
$where = implode(' AND ', $where);
|
||||
|
||||
$sql = str_replace('{TABLES}', $tables, $sqlTemplate);
|
||||
$sql = str_replace('{WHERE}', $where, $sql);
|
||||
|
||||
$sql .= " ORDER BY cal.published DESC";
|
||||
|
||||
if (is_integer($iNumOfRows) AND $iNumOfRows > 0) {
|
||||
$sql .= " LIMIT " . $iOffset . ", " . $iNumOfRows;
|
||||
}
|
||||
|
||||
if ($this->bDebug) {
|
||||
print "<!-- ";
|
||||
print $sql;
|
||||
print " -->";
|
||||
} # @modified 27.10.2005
|
||||
|
||||
return $sql;
|
||||
}
|
||||
|
||||
/**
|
||||
* Search articles by catgories without start articles
|
||||
* @param array $aCategories
|
||||
* @param int $iOffset
|
||||
* @param int $iNumOfRows
|
||||
* @param string $sResultType element of {article_id, object}
|
||||
*
|
||||
* @return array of articles
|
||||
*/
|
||||
function findMatchingContentByCategories($aCategories = array(), $iOffset = 0, $iNumOfRows = 0, $sResultType = '') {
|
||||
|
||||
for ($i = 0; $i < count($aCategories); $i++) {
|
||||
if (!is_int((int) $aCategories[$i]) OR ! $aCategories[$i] > 0) {
|
||||
return array();
|
||||
}
|
||||
}
|
||||
|
||||
$sql = $this->_buildQuery_MatchingContentByCategories($aCategories, $iOffset, $iNumOfRows);
|
||||
|
||||
$this->db->query($sql);
|
||||
|
||||
$aResult = array();
|
||||
|
||||
while ($oRow = $this->db->getResultObject()) {
|
||||
if ($sResultType == 'article_language_id') {
|
||||
$aResult[] = $oRow->idartlang;
|
||||
} else {
|
||||
$aResult[] = $oRow;
|
||||
}
|
||||
}
|
||||
return $aResult;
|
||||
}
|
||||
|
||||
/**
|
||||
* build SQL query to find articles by catgories
|
||||
*
|
||||
*/
|
||||
function _buildQuery_MatchingContentByCategories($aCategories, $iOffset, $iNumOfRows) {
|
||||
|
||||
if (count($aCategories) > 0) {
|
||||
$sWHERE_Category_IN = " c.idcat IN (" . implode(',', $aCategories) . ") AND ";
|
||||
} else {
|
||||
$sWHERE_Category_IN = '';
|
||||
}
|
||||
if (is_integer($iNumOfRows) AND $iNumOfRows > 0) {
|
||||
$sLimit = " LIMIT " . Contenido_Security::toInteger($iOffset) . ", " . Contenido_Security::toInteger($iNumOfRows);
|
||||
} else {
|
||||
$sLimit = '';
|
||||
}
|
||||
|
||||
$sql = '
|
||||
SELECT
|
||||
a.idart, a.online, a.idartlang, c.idcat
|
||||
FROM
|
||||
' . $this->table['art_lang'] . ' AS a,
|
||||
' . $this->table['art'] . ' AS b,
|
||||
' . $this->table['cat_art'] . ' AS c,
|
||||
' . $this->table['cat_lang'] . ' AS d
|
||||
WHERE
|
||||
' . $sWHERE_Category_IN . '
|
||||
b.idclient = ' . Contenido_Security::toInteger($this->client) . ' AND
|
||||
a.idlang = ' . Contenido_Security::toInteger($this->lang) . ' AND
|
||||
a.idartlang != d.startidartlang AND
|
||||
a.online = 1 AND
|
||||
c.idcat = d.idcat AND
|
||||
b.idart = c.idart AND
|
||||
a.idart = b.idart
|
||||
' . $sLimit . ' ';
|
||||
|
||||
if ($this->bDebug) {
|
||||
print "<!-- ";
|
||||
print $sql;
|
||||
print " -->";
|
||||
}
|
||||
|
||||
return $sql;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,117 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Project:
|
||||
* Contenido Content Management System
|
||||
*
|
||||
* Description:
|
||||
* Content Allocation article
|
||||
*
|
||||
* Requirements:
|
||||
* @con_php_req 5.0
|
||||
*
|
||||
*
|
||||
* @package Contenido Backend plugins
|
||||
* @version 0.2.1
|
||||
* @author Marco Jahn
|
||||
* @copyright four for business AG <www.4fb.de>
|
||||
* @license http://www.contenido.org/license/LIZENZ.txt
|
||||
* @link http://www.4fb.de
|
||||
* @link http://www.contenido.org
|
||||
* @since file available since contenido release <= 4.6
|
||||
*
|
||||
* {@internal
|
||||
* created unknown
|
||||
* modified 2008-07-02, Frederic Schneider, add security fix
|
||||
*
|
||||
* $Id$:
|
||||
* }}
|
||||
*
|
||||
*/
|
||||
if (!defined('CON_FRAMEWORK')) {
|
||||
die('Illegal call');
|
||||
}
|
||||
|
||||
class pApiContentAllocationArticle extends pApiTree {
|
||||
|
||||
var $tpl = null;
|
||||
var $template = '';
|
||||
var $load = array();
|
||||
|
||||
public function __construct($uuid) {
|
||||
global $cfg;
|
||||
|
||||
parent::pApiTree($uuid);
|
||||
$this->tpl = new Template;
|
||||
$this->template = $cfg['pica']['treetemplate_article'];
|
||||
}
|
||||
|
||||
function _buildRenderTree($tree) {
|
||||
global $action, $frame, $area, $sess, $idart;
|
||||
|
||||
$result = array();
|
||||
foreach ($tree as $item_tmp) {
|
||||
$item = array();
|
||||
|
||||
$expandCollapseImg = 'images/spacer.gif';
|
||||
$expandCollapse = '<img src="' . $expandCollapseImg . '" border="0" style="vertical-align: middle;" width="11" height="11">';
|
||||
|
||||
$item['ITEMNAME'] = $expandCollapse . ' ' . $item_tmp['name'];
|
||||
|
||||
$item['ITEMINDENT'] = $item_tmp['level'] * 15 + 3;
|
||||
|
||||
// set checked!
|
||||
$checked = '';
|
||||
if (in_array($item_tmp['idpica_alloc'], $this->load)) {
|
||||
$checked = ' checked="checked"';
|
||||
}
|
||||
$item['CHECKBOX'] = '<input type="checkbox" name="allocation[]" value="' . $item_tmp['idpica_alloc'] . '" ' . $checked . ' />';
|
||||
|
||||
array_push($result, $item);
|
||||
|
||||
if ($item_tmp['children']) {
|
||||
$children = $this->_buildRenderTree($item_tmp['children']);
|
||||
$result = array_merge($result, $children);
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
function setChecked($load) {
|
||||
$this->load = $load;
|
||||
}
|
||||
|
||||
function renderTree($return = true) {
|
||||
$this->tpl->reset();
|
||||
|
||||
$tree = $this->fetchTree();
|
||||
if ($tree === false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$tree = $this->_buildRenderTree($tree);
|
||||
|
||||
$even = true;
|
||||
foreach ($tree as $item) {
|
||||
$even = !$even;
|
||||
$bgcolor = ($even) ? '#FFFFFF' : '#F1F1F1';
|
||||
$this->tpl->set('d', 'BACKGROUND_COLOR', $bgcolor);
|
||||
foreach ($item as $key => $value) {
|
||||
$this->tpl->set('d', $key, $value);
|
||||
}
|
||||
$this->tpl->next();
|
||||
}
|
||||
|
||||
$this->tpl->set('s', "CATEGORY", i18n("Category", "content_allocation"));
|
||||
|
||||
if ($return === true) {
|
||||
return $this->tpl->generate($this->template, true);
|
||||
} else {
|
||||
$this->tpl->generate($this->template);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,114 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Project:
|
||||
* Contenido Content Management System
|
||||
*
|
||||
* Description:
|
||||
* Content Allocation
|
||||
*
|
||||
* Requirements:
|
||||
* @con_php_req 5.0
|
||||
*
|
||||
*
|
||||
* @package Contenido Backend plugins
|
||||
* @version 0.2.1
|
||||
* @author Marco Jahn
|
||||
* @copyright four for business AG <www.4fb.de>
|
||||
* @license http://www.contenido.org/license/LIZENZ.txt
|
||||
* @link http://www.4fb.de
|
||||
* @link http://www.contenido.org
|
||||
* @since file available since contenido release <= 4.6
|
||||
*
|
||||
* {@internal
|
||||
* created unknown
|
||||
* modified 2008-07-02, Frederic Schneider, add security fix
|
||||
*
|
||||
* $Id$:
|
||||
* }}
|
||||
*
|
||||
*/
|
||||
if (!defined('CON_FRAMEWORK')) {
|
||||
die('Illegal call');
|
||||
}
|
||||
|
||||
class pApiContentAllocationComplexList extends pApiTree {
|
||||
|
||||
var $idSetter = true;
|
||||
var $load = array();
|
||||
|
||||
public function __construct($uuid) {
|
||||
global $cfg;
|
||||
parent::__construct($uuid);
|
||||
}
|
||||
|
||||
public function _buildRenderTree($tree) {
|
||||
global $action, $frame, $area, $sess, $idart;
|
||||
|
||||
$oldIdSetter = $this->idSetter;
|
||||
$this->idSetter = false;
|
||||
|
||||
$result = '';
|
||||
|
||||
$even = true;
|
||||
|
||||
$levelElms = sizeof($tree);
|
||||
$cnt = 1;
|
||||
foreach ($tree as $item_tmp) {
|
||||
$item = '';
|
||||
$checked = '';
|
||||
if (in_array($item_tmp['idpica_alloc'], $this->load)) {
|
||||
$checked = ' checked="checked"';
|
||||
}
|
||||
|
||||
$li_closeElm = '';
|
||||
if ($cnt == $levelElms) {
|
||||
$li_closeElm = 'style="border-bottom: 0;"';
|
||||
}
|
||||
$cnt++;
|
||||
|
||||
$even = !$even;
|
||||
$bgcolor = ($even) ? 'bright' : 'dark';
|
||||
|
||||
// for wrapping purposes
|
||||
$item_tmp['name'] = str_replace('-', '- ', $item_tmp['name']);
|
||||
|
||||
$checkbox = '<input type="checkbox" name="allocation[]" onClick="addToList(this);" ' . $checked . '" id="e' . $item_tmp['idpica_alloc'] . '" value="' . $item_tmp['idpica_alloc'] . '" />';
|
||||
$item = "\n<li style=\"border-bottom: 1px solid #B3B3B3\" baseClass=\"" . $bgcolor . "\" " . $li_closeElm . ">" . $checkbox . " " . $item_tmp['name'];
|
||||
|
||||
$result .= $item;
|
||||
|
||||
if ($item_tmp['children']) {
|
||||
$children = $this->_buildRenderTree($item_tmp['children']);
|
||||
$result .= "\n<ul>" . $children . "</li>";
|
||||
} else {
|
||||
$result .= "\n</li>";
|
||||
}
|
||||
}
|
||||
|
||||
if ($oldIdSetter === true) {
|
||||
return "\n<ul id=\"finder\">" . $result . "\n</ul>";
|
||||
} else {
|
||||
return $result . "\n</ul>";
|
||||
}
|
||||
}
|
||||
|
||||
public function setChecked($load) {
|
||||
$this->load = $load;
|
||||
}
|
||||
|
||||
public function renderTree($return = true) {
|
||||
$tree = $this->fetchTree();
|
||||
if ($tree === false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$tree = $this->_buildRenderTree($tree);
|
||||
if ($return === true) {
|
||||
return $tree;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,87 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Project:
|
||||
* Contenido Content Management System
|
||||
*
|
||||
* @package Contenido Backend plugins
|
||||
* @version 0.2.1
|
||||
* @author Marco Jahn
|
||||
* @copyright four for business AG <www.4fb.de>
|
||||
* @license http://www.contenido.org/license/LIZENZ.txt
|
||||
* @link http://www.4fb.de
|
||||
* @link http://www.contenido.org
|
||||
* @since file available since contenido release <= 4.6
|
||||
*
|
||||
* $Id$:
|
||||
*/
|
||||
if (!defined('CON_FRAMEWORK')) {
|
||||
die('Illegal call');
|
||||
}
|
||||
|
||||
class pApiContentAllocationSelectBox extends pApiTree {
|
||||
|
||||
var $idSetter = true;
|
||||
var $load = array();
|
||||
|
||||
public function __construct($uuid) {
|
||||
global $cfg;
|
||||
|
||||
parent::__construct($uuid);
|
||||
}
|
||||
|
||||
public function _buildRenderTree($tree) {
|
||||
global $action, $frame, $area, $sess, $idart;
|
||||
|
||||
$oldIdSetter = $this->idSetter;
|
||||
$this->idSetter = false;
|
||||
|
||||
$result = '';
|
||||
|
||||
$levelElms = sizeof($tree);
|
||||
$cnt = 1;
|
||||
foreach ($tree as $item_tmp) {
|
||||
$item = '';
|
||||
|
||||
$spacer = '|-';
|
||||
$spacer = str_pad($spacer, (($item_tmp['level'] + 1) * 2), "--", STR_PAD_RIGHT);
|
||||
|
||||
$result .= '<option value="' . $item_tmp['idpica_alloc'] . '_' . $item_tmp['level'] . '">' . $spacer . $item_tmp['name'] . '</option>';
|
||||
|
||||
if ($item_tmp['children']) {
|
||||
$children = $this->_buildRenderTree($item_tmp['children']);
|
||||
$result .= $children;
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function setChecked($load) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @modified 27.10.2005 $bUseTreeStatus = false (content allocation tree in selectbox is always expanded)
|
||||
*/
|
||||
public function renderTree($return = true, $parentId = false, $bUseTreeStatus = false) {
|
||||
|
||||
$tree = $this->fetchTree($parentId, 0, $bUseTreeStatus);
|
||||
|
||||
if ($tree === false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$tree = $this->_buildRenderTree($tree);
|
||||
|
||||
if ($return === true) {
|
||||
return $tree;
|
||||
} else {
|
||||
echo $tree;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,558 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Project:
|
||||
* Contenido Content Management System
|
||||
*
|
||||
* Description:
|
||||
* Stores and handles content allocation management
|
||||
*
|
||||
* Requirements:
|
||||
* @con_php_req 5.0
|
||||
*
|
||||
*
|
||||
* @package Contenido Backend plugins
|
||||
* @version 0.10.1
|
||||
* @author Marco Jahn
|
||||
* @copyright four for business AG <www.4fb.de>
|
||||
* @license http://www.contenido.org/license/LIZENZ.txt
|
||||
* @link http://www.4fb.de
|
||||
* @link http://www.contenido.org
|
||||
* @since file available since contenido release <= 4.6
|
||||
*
|
||||
* {@internal
|
||||
* created unknown
|
||||
* modified 2008-07-02, Frederic Schneider, add security fix
|
||||
*
|
||||
* $Id$:
|
||||
* }}
|
||||
*
|
||||
*/
|
||||
if (!defined('CON_FRAMEWORK')) {
|
||||
die('Illegal call');
|
||||
}
|
||||
|
||||
/**
|
||||
* Todo
|
||||
* addslashes to all string db inserts
|
||||
* check if default language exists if new entry is added (otherwise)
|
||||
*/
|
||||
class pApiTree {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
var $db = null;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
var $table = null;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
var $lang = 1;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
var $client = 1;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
var $defaultLang = 1;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
var $logger = null;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
var $user = null;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
var $treeStatus = array();
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
var $uuid = null;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
var $_arrInFilters = array('urlencode', 'clHtmlSpecialChars', 'addslashes');
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
var $_arrOutFilters = array('stripslashes', 'htmldecode', 'urldecode');
|
||||
|
||||
public function __construct($uuid) {
|
||||
global $db, $cfg, $lang, $client, $auth;
|
||||
|
||||
$this->db = new DB_ConLite;
|
||||
$this->table = $cfg['tab'];
|
||||
$this->lang = $lang;
|
||||
$this->client = $client;
|
||||
$this->bDebug = false;
|
||||
|
||||
$this->uuid = $uuid;
|
||||
|
||||
$this->user = new cApiUser($auth->auth["uid"]);
|
||||
$this->loadTreeStatus();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param mixed $parentId
|
||||
* @param int $level
|
||||
* @param boolean $bUseTreeStatus (if true use expand/collapsed status of the tree, otherwise not)
|
||||
* @modified 27.10.2005 Willi Man
|
||||
*/
|
||||
function fetchTree($parentId = false, $level = 0, $bUseTreeStatus = true) {
|
||||
|
||||
// fetch current lang category
|
||||
$sql = "SELECT
|
||||
tree.idpica_alloc, tree.parentid, tree.sortorder
|
||||
FROM
|
||||
" . $this->table['pica_alloc'] . " as tree";
|
||||
|
||||
if ($parentId === false) { // fetch from root node
|
||||
$sql .= " WHERE tree.parentid = '0'";
|
||||
} else { // fetch by given id
|
||||
$sql .= " WHERE tree.parentid = " . Contenido_Security::toInteger($parentId);
|
||||
}
|
||||
|
||||
$sql .= " ORDER BY sortorder ASC";
|
||||
|
||||
$this->db->query($sql);
|
||||
|
||||
$result_tmp = array(); // tmp result array
|
||||
while ($this->db->next_record()) { // walk resultset
|
||||
$item = $this->_fetchItemNameLang($this->db->f('idpica_alloc'));
|
||||
|
||||
$itemStatus = 'expanded';
|
||||
|
||||
if ($bUseTreeStatus) { # modified 27.10.2005
|
||||
if (is_array($this->treeStatus) && array_key_exists($this->db->f('idpica_alloc'), $this->treeStatus)) {
|
||||
$itemStatus = 'collapsed';
|
||||
}
|
||||
}
|
||||
|
||||
$rs = array(
|
||||
'idpica_alloc' => $this->db->f('idpica_alloc'),
|
||||
'parentid' => ($this->db->f('parentid') == NULL) ? false : $this->db->f('parentid'),
|
||||
'sortorder' => $this->db->f('sortorder'),
|
||||
'name' => $this->_outFilter($item['name']),
|
||||
'idlang' => $item['idlang'],
|
||||
'level' => $level,
|
||||
'status' => $itemStatus,
|
||||
'online' => $item['online']
|
||||
);
|
||||
|
||||
array_push($result_tmp, $rs); // append recordset
|
||||
}
|
||||
|
||||
if (count($result_tmp) > 0) {
|
||||
$result = array(); // result array
|
||||
foreach ($result_tmp as $rs) { // run results
|
||||
$children = $this->fetchTree($rs['idpica_alloc'], $level + 1, $bUseTreeStatus);
|
||||
if ($children !== false && $rs['status'] == 'expanded') {
|
||||
$rs['children'] = $children;
|
||||
}
|
||||
array_push($result, $rs);
|
||||
}
|
||||
return $result;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch content allocation tree
|
||||
* Consider offline/online status
|
||||
*
|
||||
* @created 21.11.2005 Willi Man
|
||||
*
|
||||
* @param mixed $parentId
|
||||
* @param int $level
|
||||
* @return array with content allocation id's
|
||||
*/
|
||||
function fetchTreeIds($parentId = false, $level = 0, $showOffline = false) {
|
||||
|
||||
// fetch current lang category
|
||||
$sql = "SELECT
|
||||
tree.idpica_alloc, tree.parentid, tree.sortorder
|
||||
FROM
|
||||
" . $this->table['pica_alloc'] . " as tree";
|
||||
|
||||
if ($parentId === false) { // fetch from root node
|
||||
$sql .= " WHERE tree.parentid IS NULL";
|
||||
} else { // fetch by given id
|
||||
$sql .= " WHERE tree.parentid = " . Contenido_Security::toInteger($parentId);
|
||||
}
|
||||
|
||||
$sql .= " ORDER BY sortorder ASC";
|
||||
|
||||
if ($this->bDebug) {
|
||||
print "<!-- ";
|
||||
print $sql;
|
||||
print " -->";
|
||||
}
|
||||
|
||||
$this->db->query($sql);
|
||||
|
||||
$result_tmp = array(); // tmp result array
|
||||
while ($this->db->next_record()) { // walk resultset
|
||||
$item = $this->_fetchItemNameLang($this->db->f('idpica_alloc'));
|
||||
|
||||
if ($this->bDebug) {
|
||||
print "<!-- ";
|
||||
print_r($item);
|
||||
print " -->";
|
||||
}
|
||||
|
||||
if ($showOffline OR $item['online'] == 1) {
|
||||
$rs = array(
|
||||
'idpica_alloc' => $this->db->f('idpica_alloc')
|
||||
);
|
||||
|
||||
array_push($result_tmp, $rs); // append recordset
|
||||
}
|
||||
}
|
||||
|
||||
if (count($result_tmp) > 0) {
|
||||
$result = array(); // result array
|
||||
foreach ($result_tmp as $rs) { // run results
|
||||
$children = $this->fetchTreeIds($rs['idpica_alloc'], $level + 1, $bUseTreeStatus);
|
||||
if ($children !== false) {
|
||||
$rs['children'] = $children;
|
||||
}
|
||||
array_push($result, $rs);
|
||||
}
|
||||
return $result;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function setTreeStatus($idpica_alloc) {
|
||||
if (is_array($this->treeStatus) && array_key_exists($idpica_alloc, $this->treeStatus)) { // expand
|
||||
unset($this->treeStatus[$idpica_alloc]);
|
||||
} else { // collapse
|
||||
$this->treeStatus[$idpica_alloc] = true;
|
||||
}
|
||||
$this->user->setProperty("expandstate", $this->_uuid, serialize($this->treeStatus));
|
||||
}
|
||||
|
||||
function loadTreeStatus() {
|
||||
$status = $this->user->getProperty("expandstate", $this->_uuid);
|
||||
if ($status !== false) {
|
||||
$this->treeStatus = unserialize($status);
|
||||
}
|
||||
}
|
||||
|
||||
function fetchParent($idpica_alloc) {
|
||||
$sql = "SELECT idpica_alloc FROM " . $this->table['pica_alloc'] . " WHERE parentId = " . Contenido_Security::toInteger($idpica_alloc);
|
||||
$this->db->query($sql);
|
||||
|
||||
if ($this->db->next_record()) {
|
||||
return $this->fetchItem($this->db->f('idpica_alloc'));
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function fetchParents() {
|
||||
|
||||
}
|
||||
|
||||
function fetchLevel($parentId = false, $showOffline = false) {
|
||||
// fetch current lang category
|
||||
$sql = "SELECT
|
||||
tree.idpica_alloc, tree.parentid, tree.sortorder
|
||||
FROM
|
||||
" . $this->table['pica_alloc'] . " as tree
|
||||
LEFT JOIN " . $this->table['pica_lang'] . " as treelang USING (idpica_alloc)";
|
||||
|
||||
if ($parentId === false) { // fetch from root node
|
||||
$sql .= " WHERE tree.parentid IS NULL";
|
||||
} else { // fetch by given id
|
||||
$sql .= " WHERE tree.parentid = " . Contenido_Security::toInteger($parentId);
|
||||
}
|
||||
|
||||
if ($showOffline === false) {
|
||||
$sql .= " AND treelang.online = 1";
|
||||
}
|
||||
|
||||
$sql .= " ORDER BY sortorder ASC";
|
||||
|
||||
$this->db->query($sql);
|
||||
|
||||
$result_tmp = array(); // tmp result array
|
||||
while ($this->db->next_record()) { // walk resultset
|
||||
$item = $this->_fetchItemNameLang($this->db->f('idpica_alloc'));
|
||||
|
||||
$itemStatus = 'expanded';
|
||||
if (is_array($this->treeStatus) && array_key_exists($this->db->f('idpica_alloc'), $this->treeStatus)) {
|
||||
$itemStatus = 'collapsed';
|
||||
}
|
||||
|
||||
$rs = array(
|
||||
'idpica_alloc' => $this->db->f('idpica_alloc'),
|
||||
'parentid' => ($this->db->f('parentid') == NULL) ? false : $this->db->f('parentid'),
|
||||
'sortorder' => $this->db->f('sortorder'),
|
||||
'name' => $this->_outFilter($item['name']),
|
||||
'idlang' => $item['idlang'],
|
||||
'level' => 0,
|
||||
'status' => $itemStatus,
|
||||
'online' => $item['online']
|
||||
);
|
||||
|
||||
array_push($result_tmp, $rs); // append recordset
|
||||
}
|
||||
|
||||
return $result_tmp;
|
||||
}
|
||||
|
||||
function storeItem($treeItem) {
|
||||
|
||||
if (!$treeItem['idpica_alloc']) { // insert
|
||||
$treeItem['idpica_alloc'] = $this->db->nextid($this->table['pica_alloc']);
|
||||
$treeItem['sortorder'] = $this->_fetchMaxOrder($treeItem['parentid']) + 1;
|
||||
|
||||
if ($treeItem['parentid'] == 'root') {
|
||||
$treeItem['parentid'] = 'NULL';
|
||||
}
|
||||
|
||||
$treeItem['name'] = $this->_inFilter($treeItem['name']);
|
||||
|
||||
$sql = "INSERT INTO " . $this->table['pica_alloc'] . "
|
||||
(idpica_alloc, parentid, sortorder)
|
||||
VALUES
|
||||
(" . Contenido_Security::toInteger($treeItem['idpica_alloc']) . ", " . Contenido_Security::toInteger($treeItem['parentid']) . ", " . Contenido_Security::toInteger($treeItem['sortorder']) . ")";
|
||||
$this->db->query($sql);
|
||||
|
||||
$sql = "INSERT INTO " . $this->table['pica_lang'] . "
|
||||
(idpica_alloc, idlang, name)
|
||||
VALUES
|
||||
(" . Contenido_Security::toInteger($treeItem['idpica_alloc']) . ", " . Contenido_Security::toInteger($this->lang) . ", '" . Contenido_Security::escapeDB($treeItem['name'], $this->db) . "')";
|
||||
$this->db->query($sql);
|
||||
} else { // update
|
||||
$treeItem['name'] = $this->_inFilter($treeItem['name']);
|
||||
|
||||
$sql = "SELECT * FROM " . $this->table['pica_lang'] . " WHERE idpica_alloc = " . Contenido_Security::toInteger($treeItem['idpica_alloc']) . " AND idlang = " . Contenido_Security::toInteger($this->lang);
|
||||
$this->db->query($sql);
|
||||
|
||||
if ($this->db->num_rows() > 0) {
|
||||
#Update existing translation
|
||||
$sql = "UPDATE " . $this->table['pica_lang'] . " SET name = '" . Contenido_Security::escapeDB($treeItem['name'], $this->db) . "' WHERE idpica_alloc = " . Contenido_Security::toInteger($treeItem['idpica_alloc']) . "
|
||||
AND idlang = " . Contenido_Security::toInteger($this->lang);
|
||||
} else {
|
||||
#Get current online status for item
|
||||
$sql = "SELECT * FROM " . $this->table['pica_lang'] . " WHERE idpica_alloc = " . $treeItem['idpica_alloc'] . " ORDER BY idlang";
|
||||
$this->db->query($sql);
|
||||
|
||||
if ($this->db->next_record()) {
|
||||
$online_status = $this->db->f('online');
|
||||
} else {
|
||||
$online_status = 0;
|
||||
}
|
||||
|
||||
#Insert new translation
|
||||
$sql = "INSERT INTO " . $this->table['pica_lang'] . "(idpica_alloc, idlang, name, online) VALUES ( " . Contenido_Security::toInteger($treeItem['idpica_alloc']) . ", " . Contenido_Security::toInteger($this->lang) . ",
|
||||
'" . Contenido_Security::escapeDB($treeItem['name'], $this->db) . "', " . Contenido_Security::toInteger($online_status) . ")";
|
||||
}
|
||||
|
||||
$this->db->query($sql);
|
||||
}
|
||||
|
||||
return $treeItem;
|
||||
}
|
||||
|
||||
function setOnline($idpica_alloc) {
|
||||
$this->_switchOnOffline($idpica_alloc, 1);
|
||||
}
|
||||
|
||||
function setOffline($idpica_alloc) {
|
||||
$this->_switchOnOffline($idpica_alloc, 0);
|
||||
}
|
||||
|
||||
function _switchOnOffline($idpica_alloc, $status) {
|
||||
$sql = "UPDATE " . $this->table['pica_lang'] . " SET online = " . Contenido_Security::toInteger($status) . " WHERE idpica_alloc = " . Contenido_Security::toInteger($idpica_alloc) . "
|
||||
AND idlang = " . Contenido_Security::toInteger($this->lang);
|
||||
$this->db->query($sql);
|
||||
}
|
||||
|
||||
function itemMoveUp($idpica_alloc) {
|
||||
$treeItem = $this->fetchItem($idpica_alloc);
|
||||
$treeItem_old = $treeItem;
|
||||
$treeItem['sortorder'] --;
|
||||
|
||||
if ($treeItem['sortorder'] < $treeItem_old['sortorder']) {
|
||||
if ($treeItem['sortorder'] >= 1) {
|
||||
$this->_decreaseOrder($treeItem['parentid'], $treeItem_old['sortorder']);
|
||||
$this->_increaseOrder($treeItem['parentid'], $treeItem['sortorder']);
|
||||
} else {
|
||||
$treeItem['sortorder'] = $treeItem_old['sortorder'];
|
||||
}
|
||||
}
|
||||
|
||||
$sql = "UPDATE " . $this->table['pica_alloc'] . " SET sortorder = " . $treeItem['sortorder'] . " WHERE idpica_alloc = " . Contenido_Security::toInteger($idpica_alloc);
|
||||
$this->db->query($sql);
|
||||
}
|
||||
|
||||
function itemMoveDown() {
|
||||
|
||||
}
|
||||
|
||||
function deleteItem($idpica_alloc) {
|
||||
$sql = "DELETE FROM " . $this->table['pica_alloc'] . " WHERE idpica_alloc = " . Contenido_Security::toInteger($idpica_alloc);
|
||||
$this->db->query($sql);
|
||||
|
||||
$sql = "DELETE FROM " . $this->table['pica_lang'] . " WHERE idpica_alloc = " . Contenido_Security::toInteger($idpica_alloc);
|
||||
$this->db->query($sql);
|
||||
|
||||
$sql = "DELETE FROM " . $this->table['pica_alloc_con'] . " WHERE idpica_alloc = " . Contenido_Security::toInteger($idpica_alloc);
|
||||
$this->db->query($sql);
|
||||
}
|
||||
|
||||
function fetchItem($idpica_alloc) {
|
||||
$sql = "SELECT parentid, sortorder FROM " . $this->table['pica_alloc'] . " WHERE idpica_alloc = " . $idpica_alloc;
|
||||
$this->db->query($sql);
|
||||
|
||||
$item = $this->_fetchItemNameLang($idpica_alloc);
|
||||
|
||||
if ($this->db->next_record()) {
|
||||
$row = array(
|
||||
'idpica_alloc' => $idpica_alloc,
|
||||
'parentid' => ($this->db->f('parentid') == NULL) ? false : $this->db->f('parentid'),
|
||||
'sortorder' => $this->db->f('sortorder'),
|
||||
'name' => $item['name'],
|
||||
'idlang' => $item['idlang'],
|
||||
'online' => $item['online']
|
||||
);
|
||||
return $row;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function _fetchItemNameLang($idpica_alloc) {
|
||||
$oDB = new DB_ConLite; // temp instance
|
||||
|
||||
$sSQL = "SELECT name, idlang, online FROM " . $this->table['pica_lang'] . " WHERE idpica_alloc = " . Contenido_Security::toInteger($idpica_alloc) . " AND idlang = " . Contenido_Security::toInteger($this->lang);
|
||||
$oDB->query($sSQL);
|
||||
|
||||
$aResult = array();
|
||||
if ($oDB->next_record()) { // item found for this language
|
||||
$aResult['name'] = $this->_outFilter($oDB->f('name'));
|
||||
$aResult['idlang'] = $oDB->f('idlang');
|
||||
$aResult['online'] = $oDB->f('online');
|
||||
} else { // no item in this language found
|
||||
// fetch alternative language name
|
||||
// HerrB, 2008-04-21: Get all translations, try to use defaultLang translation, use
|
||||
// first available, otherwise. Only using defaultLang results in "ghost" elements, if
|
||||
// created in a non-default language. See CON-110 for details.
|
||||
$sSQL = "SELECT name, idlang, online FROM " . $this->table['pica_lang'] . " WHERE idpica_alloc = " . Contenido_Security::toInteger($idpica_alloc) . " ORDER BY idlang";
|
||||
$oDB->query($sSQL);
|
||||
|
||||
$aNames = array();
|
||||
while ($oDB->next_record()) {
|
||||
$sKey = "k" . $oDB->f('idlang');
|
||||
|
||||
$aNames[$sKey] = array();
|
||||
$aNames[$sKey]['name'] = $this->_outFilter($oDB->f('name'));
|
||||
$aNames[$sKey]['idlang'] = $oDB->f('idlang');
|
||||
$aNames[$sKey]['online'] = $oDB->f('online');
|
||||
}
|
||||
|
||||
if ($aNames["k" . $this->defaultLang]) {
|
||||
// defaultLang translation available
|
||||
$aResult = $aNames["k" . $this->defaultLang];
|
||||
} else {
|
||||
// no defaultLang translation available, use first in line (reset returns first element)
|
||||
$aResult = reset($aNames);
|
||||
}
|
||||
}
|
||||
unset($oDB);
|
||||
unset($aNames);
|
||||
|
||||
return $aResult;
|
||||
}
|
||||
|
||||
function _fetchMaxOrder($parentId = false) {
|
||||
|
||||
if ($parentId == 'root') {
|
||||
$parentId = false;
|
||||
}
|
||||
|
||||
$sql = "SELECT MAX(sortorder) as max FROM " . $this->table['pica_alloc'];
|
||||
if ($parentId === false) {
|
||||
$sql .= " WHERE parentid = 0";
|
||||
} else {
|
||||
$sql .= " WHERE parentid = " . Contenido_Security::toInteger($parentId);
|
||||
}
|
||||
$this->db->query($sql);
|
||||
if ($this->db->next_record()) {
|
||||
return $this->db->f('max');
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
function _decreaseOrder($parentId = false, $fromOrder) {
|
||||
$sql = "UPDATE " . $this->table['pica_alloc'] . " SET sortorder = sortorder - 1 WHERE sortorder >= " . Contenido_Security::toInteger($fromOrder);
|
||||
if ($parentId === false) {
|
||||
$sql .= " AND parentid IS NULL";
|
||||
} else {
|
||||
$sql .= " AND parentid = " . Contenido_Security::toInteger($parentId);
|
||||
}
|
||||
$this->db->query($sql);
|
||||
}
|
||||
|
||||
function _increaseOrder($parentId = false, $fromOrder) {
|
||||
$sql = "UPDATE " . $this->table['pica_alloc'] . " SET sortorder = sortorder + 1 WHERE sortorder >= " . Contenido_Security::toInteger($fromOrder);
|
||||
if ($parentId === false) {
|
||||
$sql .= " AND parentid IS NULL";
|
||||
} else {
|
||||
$sql .= " AND parentid = " . Contenido_Security::toInteger($parentId);
|
||||
}
|
||||
$this->db->query($sql);
|
||||
}
|
||||
|
||||
function setFilters($arrInFilters = array(), $arrOutFilters = array()) {
|
||||
$this->_arrInFilters = $arrInFilters;
|
||||
$this->_arrOutFilters = $arrOutFilters;
|
||||
}
|
||||
|
||||
function _inFilter($data) {
|
||||
foreach ($this->_arrInFilters as $_function) {
|
||||
if (function_exists($_function)) {
|
||||
$data = $_function($data);
|
||||
}
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
function _outFilter($data) {
|
||||
foreach ($this->_arrOutFilters as $_function) {
|
||||
if (function_exists($_function)) {
|
||||
$data = $_function($data);
|
||||
}
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,234 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Project:
|
||||
* Contenido Content Management System
|
||||
*
|
||||
* Description:
|
||||
* Stores and handles content allocation management
|
||||
*
|
||||
* Requirements:
|
||||
* @con_php_req 5.0
|
||||
*
|
||||
*
|
||||
* @package Contenido Backend plugins
|
||||
* @version 0.2.3
|
||||
* @author Marco Jahn
|
||||
* @copyright four for business AG <www.4fb.de>
|
||||
* @license http://www.contenido.org/license/LIZENZ.txt
|
||||
* @link http://www.4fb.de
|
||||
* @link http://www.contenido.org
|
||||
* @since file available since contenido release <= 4.6
|
||||
*
|
||||
* {@internal
|
||||
* created unknown
|
||||
* modified 2008-06-26, Timo Trautmann, changed post var from treeItem to treeItemPost (security issue)
|
||||
* modified 2008-07-02, Frederic Schneider, add security fix
|
||||
*
|
||||
* $Id$:
|
||||
* }}
|
||||
*
|
||||
*/
|
||||
if (!defined('CON_FRAMEWORK')) {
|
||||
die('Illegal call');
|
||||
}
|
||||
|
||||
/**
|
||||
* Todo
|
||||
* - generalize this and papitree !!!!
|
||||
* - Comments!
|
||||
*/
|
||||
class pApiContentAllocationTreeView extends pApiTree {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
var $tpl = null;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
var $template = '';
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function __construct($uuid) {
|
||||
global $cfg;
|
||||
|
||||
parent::__construct($uuid);
|
||||
$this->tpl = new Template;
|
||||
$this->template = $cfg['pica']['treetemplate'];
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
function _buildRenderTree($tree) {
|
||||
global $action, $frame, $area, $sess;
|
||||
$result = array();
|
||||
foreach ($tree as $item_tmp) {
|
||||
$item = array();
|
||||
|
||||
// update item
|
||||
if ($_GET['step'] == 'rename' && $item_tmp['idpica_alloc'] == $_GET['idpica_alloc']) {
|
||||
$item = array();
|
||||
|
||||
$item['ITEMNAME'] = '
|
||||
<table cellspacing="0" cellpaddin="0" border="0">
|
||||
<form name="rename" action="main.php" method="POST" onsubmit="return fieldCheck();">
|
||||
<input type="hidden" name="action" value="' . $action . '" />
|
||||
<input type="hidden" name="frame" value="' . $frame . '" />
|
||||
<input type="hidden" name="contenido" value="' . $sess->id . '" />
|
||||
<input type="hidden" name="area" value="' . $area . '" />
|
||||
<input type="hidden" name="step" value="storeRename" />
|
||||
<input type="hidden" name="treeItemPost[idpica_alloc]" value="' . $item_tmp['idpica_alloc'] . '" />
|
||||
<tr>
|
||||
<td class="text_medium"><input id="itemname" class="text_medium" type="text" name="treeItemPost[name]" value="' . $item_tmp['name'] . '"></td>
|
||||
<td>
|
||||
<a href="main.php?action=' . $action . '&frame=' . $frame . '&area=' . $area . '&contenido=' . $sess->id . '"><img src="images/but_cancel.gif" border="0" /></a>
|
||||
<input type="image" src="images/but_ok.gif" />
|
||||
</td></tr>
|
||||
</form>
|
||||
</table>
|
||||
<script language="JavaScript">
|
||||
controller = document.getElementById("itemname");
|
||||
controller.focus();
|
||||
function fieldCheck() {
|
||||
if (controller.value == "") {
|
||||
alert("' . i18n("Please enter a category name", "content_allocation") . '");
|
||||
controller.focus();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
</script>';
|
||||
} else {
|
||||
if ($item_tmp['children'] || $item_tmp['status'] == 'collapsed') {
|
||||
$expandCollapseImg = 'images/close_all.gif';
|
||||
if ($item_tmp['status'] == 'collapsed') {
|
||||
$expandCollapseImg = 'images/open_all.gif';
|
||||
}
|
||||
|
||||
$expandCollapse = '<a href="main.php?contenido=' . $sess->id . '&idart=' . $idart . '&action=' . $action . '&frame=' . $frame . '&area=' . $area . '&step=collapse&idpica_alloc=' . $item_tmp['idpica_alloc'] . '"><img src="' . $expandCollapseImg . '" border="0" style="vertical-align: middle; padding:4px;" width="7" height="7"></a>';
|
||||
} else {
|
||||
$expandCollapseImg = 'images/spacer.gif';
|
||||
$expandCollapse = '<img src="' . $expandCollapseImg . '" border="0" style="vertical-align: middle;" width="11" height="11">';
|
||||
}
|
||||
|
||||
$item['ITEMNAME'] = $expandCollapse . ' ' . $item_tmp['name'];
|
||||
}
|
||||
|
||||
$item['ITEMINDENT'] = $item_tmp['level'] * 15 + 3;
|
||||
$item['ACTION_CREATE'] = '<a href="main.php?contenido=' . $sess->id . '&action=' . $action . '&frame=' . $frame . '&area=' . $area . '&step=add&parentid=' . $item_tmp['idpica_alloc'] . '"><img src="images/folder_new.gif" border="0" title="' . i18n("New category", "content_allocation") . '" alt="' . i18n("New category", "content_allocation") . '" /></a>';
|
||||
|
||||
$item['ACTION_RENAME'] = '<a href="main.php?contenido=' . $sess->id . '&action=' . $action . '&frame=' . $frame . '&area=' . $area . '&step=rename&idpica_alloc=' . $item_tmp['idpica_alloc'] . '"><img src="images/but_todo.gif" width="16" height="16" border="0" alt="' . i18n("Rename category", "content_allocation") . '" title="' . i18n("Rename category", "content_allocation") . '" /></a>';
|
||||
$item['ACTION_MOVE_UP'] = (count($result) >= 1) ? '<a href="main.php?contenido=' . $sess->id . '&action=' . $action . '&frame=' . $frame . '&area=' . $area . '&step=moveup&idpica_alloc=' . $item_tmp['idpica_alloc'] . '"><img src="images/folder_moveup.gif" border="0" alt="' . i18n("Move category up", "content_allocation") . '" title="' . i18n("Move category up", "content_allocation") . '" /></a>' : '<img src="images/spacer.gif" width="16" height="16" /></a>';
|
||||
$item['ACTION_MOVE_DOWN'] = (count($result) >= 1) ? '<img src="images/folder_movedown.gif" border="0" alt="' . i18n("Move category down", "content_allocation") . '" title="' . i18n("Move category down", "content_allocation") . '" />' : '<img src="images/spacer.gif" width="16" height="16" />';
|
||||
$item['ACTION_MOVE_DOWN'] = '';
|
||||
|
||||
if ($item_tmp['online'] == 1) { // set offline
|
||||
$item['ACTION_ONOFFLINE'] = '<a href="main.php?contenido=' . $sess->id . '&action=' . $action . '&frame=' . $frame . '&area=' . $area . '&step=offline&idpica_alloc=' . $item_tmp['idpica_alloc'] . '""><img src="images/online.gif" alt="' . i18n("Set category offline", "content_allocation") . '" title="' . i18n("Set category offline", "content_allocation") . '"></a>';
|
||||
} else {
|
||||
$item['ACTION_ONOFFLINE'] = '<a href="main.php?contenido=' . $sess->id . '&action=' . $action . '&frame=' . $frame . '&area=' . $area . '&step=online&idpica_alloc=' . $item_tmp['idpica_alloc'] . '""><img src="images/offline.gif" alt="' . i18n("Set category online", "content_allocation") . '" title="' . i18n("Set category online", "content_allocation") . '"></a>';
|
||||
}
|
||||
|
||||
if ($item_tmp['children']) {
|
||||
$item['ACTION_DELETE'] = '<img src="images/delete_inact.gif" border="0" alt="' . i18n("One or more subcategories exist, unable to delete", "content_allocation") . '" title="' . i18n("One or more subcategories exist, unable to delete", "content_allocation") . '">';
|
||||
} else {
|
||||
$item['ACTION_DELETE'] = '<a href="javascript://" onclick="box.confirm("' . i18n("Delete category", "content_allocation") . '", "' . i18n("Are you sure to delete the following category", "content_allocation") . ':<br><br><b>' . str_replace("'", "\'", $item_tmp['name']) . '</b>","deleteCategory(' . $item_tmp['idpica_alloc'] . ')");"><img src="images/delete.gif" border="0" alt="' . i18n("Delete category", "content_allocation") . '" title="' . i18n("Delete category", "content_allocation") . '"></a>';
|
||||
}
|
||||
|
||||
array_push($result, $item);
|
||||
|
||||
if ($item_tmp['children']) {
|
||||
$children = $this->_buildRenderTree($item_tmp['children']);
|
||||
$result = array_merge($result, $children);
|
||||
}
|
||||
|
||||
// add new item -> show formular
|
||||
if ($_GET['step'] == 'add' && $item_tmp['idpica_alloc'] == $_GET['parentid']) {
|
||||
$item = array();
|
||||
|
||||
$item['ITEMNAME'] = '
|
||||
<table cellspacing="0" cellpaddin="0" border="0">
|
||||
<form name="create" action="main.php" method="POST" onsubmit="return fieldCheck();">
|
||||
<input type="hidden" name="action" value="' . $action . '" />
|
||||
<input type="hidden" name="frame" value="' . $frame . '" />
|
||||
<input type="hidden" name="contenido" value="' . $sess->id . '" />
|
||||
<input type="hidden" name="area" value="' . $area . '" />
|
||||
<input type="hidden" name="step" value="store" />
|
||||
<input type="hidden" name="treeItemPost[parentid]" value="' . $_GET['parentid'] . '" />
|
||||
<tr>
|
||||
<td class="text_medium"><input id="itemname" class="text_medium" type="text" name="treeItemPost[name]" value=""></td>
|
||||
<td>
|
||||
<a href="main.php?action=' . $action . '&frame=' . $frame . '&area=' . $area . '&contenido=' . $sess->id . '"><img src="images/but_cancel.gif" border="0" /></a>
|
||||
<input type="image" src="images/but_ok.gif" />
|
||||
</td></tr>
|
||||
</form>
|
||||
</table>
|
||||
<script language="JavaScript">
|
||||
controller = document.getElementById("itemname");
|
||||
controller.focus();
|
||||
function fieldCheck() {
|
||||
if (controller.value == "") {
|
||||
alert("' . i18n("Please enter a category name", "content_allocation") . '");
|
||||
controller.focus();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
</script>';
|
||||
$item['ITEMINDENT'] = ($item_tmp['level'] + 1) * 15;
|
||||
$item['ACTION_CREATE'] = '<img src="images/spacer.gif" width="15" height="13" />';
|
||||
$item['ACTION_RENAME'] = '<img src="images/spacer.gif" width="23" height="14" />';
|
||||
$item['ACTION_MOVE_UP'] = '<img src="images/spacer.gif" width="15" height="13" />';
|
||||
$item['ACTION_MOVE_DOWN'] = '<img src="images/spacer.gif" width="15" height="13" />';
|
||||
$item['ACTION_MOVE_DOWN'] = '';
|
||||
$item['ACTION_DELETE'] = '<img src="images/spacer.gif" width="14" height="13" />';
|
||||
$item['ACTION_ONOFFLINE'] = '<img src="images/spacer.gif" width="11" height="12" />';
|
||||
|
||||
array_push($result, $item);
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
function renderTree($return = true) {
|
||||
$this->tpl->reset();
|
||||
|
||||
$tree = $this->fetchTree(false, 0, true); # modified 27.10.2005
|
||||
|
||||
if ($tree === false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$tree = $this->_buildRenderTree($tree);
|
||||
|
||||
$even = true;
|
||||
foreach ($tree as $item) {
|
||||
$even = !$even;
|
||||
$bgcolor = ($even) ? '#FFFFFF' : '#F1F1F1';
|
||||
$this->tpl->set('d', 'BACKGROUND_COLOR', $bgcolor);
|
||||
foreach ($item as $key => $value) {
|
||||
$this->tpl->set('d', $key, $value);
|
||||
}
|
||||
$this->tpl->next();
|
||||
}
|
||||
|
||||
$this->tpl->set('s', 'CATEGORY', i18n("Category", "content_allocation"));
|
||||
$this->tpl->set('s', 'ACTIONS', i18n("Actions", "content_allocation"));
|
||||
|
||||
if ($return === true) {
|
||||
return $this->tpl->generate($this->template, true);
|
||||
} else {
|
||||
$this->tpl->generate($this->template);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
Binäre Datei nicht angezeigt.
Vorher Breite: | Höhe: | Größe: 56 B |
Binäre Datei nicht angezeigt.
Vorher Breite: | Höhe: | Größe: 90 B |
Binäre Datei nicht angezeigt.
Vorher Breite: | Höhe: | Größe: 112 B |
|
@ -1,30 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* File:
|
||||
* config.autoloader.php
|
||||
*
|
||||
* @package Plugins
|
||||
* @subpackage Newsletter
|
||||
* @version $Rev$
|
||||
* @since 2.0
|
||||
* @author Ortwin Pinke <o.pinke@conlite.org>
|
||||
* @copyright 2015 CL-Team
|
||||
* @link http://www.conlite.org
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
if(!defined('CON_FRAMEWORK')) {
|
||||
die('Illegal call');
|
||||
}
|
||||
|
||||
$sAutoloadClassPath = 'conlite/plugins/content_allocation/classes/';
|
||||
return array(
|
||||
'pApiContentAllocation' => $sAutoloadClassPath.'class.content_allocation.php',
|
||||
'pApiContentAllocationArticle' => $sAutoloadClassPath.'class.content_allocation_article.php',
|
||||
'pApiContentAllocationComplexList' => $sAutoloadClassPath.'class.content_allocation_complexlist.php',
|
||||
'pApiContentAllocationSelectBox' => $sAutoloadClassPath.'class.content_allocation_selectbox.php',
|
||||
'pApiTree' => $sAutoloadClassPath.'class.content_allocation_tree.php',
|
||||
'pApiContentAllocationTreeView' => $sAutoloadClassPath.'class.content_allocation_treeview.php'
|
||||
);
|
||||
?>
|
|
@ -1,65 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* Project:
|
||||
* Contenido Content Management System
|
||||
*
|
||||
* Description:
|
||||
* Config file for Content Allocation plugin
|
||||
*
|
||||
* Requirements:
|
||||
* @con_php_req 5.0
|
||||
*
|
||||
*
|
||||
* @package Contenido Backend plugins
|
||||
* @version 1.0.1
|
||||
* @author unknown
|
||||
* @copyright four for business AG <www.4fb.de>
|
||||
* @license http://www.contenido.org/license/LIZENZ.txt
|
||||
* @link http://www.4fb.de
|
||||
* @link http://www.contenido.org
|
||||
* @since file available since contenido release <= 4.6
|
||||
*
|
||||
* {@internal
|
||||
* created unknown
|
||||
* modified 2008-07-02, Frederic Schneider, add security fix
|
||||
*
|
||||
* $Id$:
|
||||
* }}
|
||||
*
|
||||
*/
|
||||
|
||||
if(!defined('CON_FRAMEWORK')) {
|
||||
die('Illegal call');
|
||||
}
|
||||
|
||||
|
||||
// plugin includes
|
||||
plugin_include('content_allocation', 'classes/class.content_allocation_tree.php');
|
||||
plugin_include('content_allocation', 'classes/class.content_allocation_treeview.php');
|
||||
plugin_include('content_allocation', 'classes/class.content_allocation_article.php');
|
||||
plugin_include('content_allocation', 'classes/class.content_allocation.php');
|
||||
plugin_include('content_allocation', 'classes/class.content_allocation_complexlist.php');
|
||||
|
||||
// plugin_variables
|
||||
$cfg['tab']['pica_alloc'] = $cfg['sql']['sqlprefix'].'_pica_alloc';
|
||||
$cfg['tab']['pica_alloc_con'] = $cfg['sql']['sqlprefix'].'_pica_alloc_con';
|
||||
$cfg['tab']['pica_lang'] = $cfg['sql']['sqlprefix'].'_pica_lang';
|
||||
|
||||
$cfg['pica']['logpath'] = $cfg['path']['contenido'] . $cfg['path']['plugins'] . 'repository/log/data/';
|
||||
$cfg['pica']['loglevel'] = 'warn';
|
||||
$cfg['pica']['treetemplate'] = $cfg['path']['contenido'] . $cfg['path']['plugins'] . 'content_allocation/templates/template.tree_structure.html';
|
||||
$cfg['pica']['treetemplate_article'] = $cfg['path']['contenido'] . $cfg['path']['plugins'] . 'content_allocation/templates/template.tree_article.html';
|
||||
$cfg['pica']['treetemplate_complexlist'] = $cfg['path']['contenido'] . $cfg['path']['plugins'] . 'content_allocation/templates/template.tree_complexlist.html';
|
||||
|
||||
$cfg['pica']['style_complexlist'] = $cfg['path']['contenido_fullhtml'] . $cfg['path']['plugins'] . 'content_allocation/style/complexlist.css';
|
||||
$cfg['pica']['script_complexlist'] = $cfg['path']['contenido_fullhtml'] . $cfg['path']['plugins'] . 'content_allocation/scripts/complexlist.js';
|
||||
|
||||
// administration > users > area translations
|
||||
global $lngAct, $_cecRegistry;
|
||||
$lngAct['con_contentallocation']['storeallocation'] = i18n("Store content allocations", "content_allocation");
|
||||
|
||||
plugin_include('content_allocation', 'includes/functions.chains.php');
|
||||
|
||||
$_cecRegistry->addChainFunction("Contenido.Article.RegisterCustomTab", "pica_RegisterCustomTab");
|
||||
$_cecRegistry->addChainFunction("Contenido.Article.GetCustomTabProperties", "pica_GetCustomTabProperties");
|
||||
?>
|
|
@ -1,67 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* Project:
|
||||
* Contenido Content Management System
|
||||
*
|
||||
* Description:
|
||||
* Chains for Content Allocation
|
||||
*
|
||||
* Requirements:
|
||||
* @con_php_req 5.0
|
||||
*
|
||||
*
|
||||
* @package Contenido Backend plugins
|
||||
* @version 1.0.1
|
||||
* @author unknown
|
||||
* @copyright four for business AG <www.4fb.de>
|
||||
* @license http://www.contenido.org/license/LIZENZ.txt
|
||||
* @link http://www.4fb.de
|
||||
* @link http://www.contenido.org
|
||||
* @since file available since contenido release <= 4.6
|
||||
*
|
||||
* {@internal
|
||||
* created unknown
|
||||
* modified 2008-07-02, Frederic Schneider, add security fix
|
||||
*
|
||||
* $Id$:
|
||||
* }}
|
||||
*
|
||||
*/
|
||||
|
||||
if(!defined('CON_FRAMEWORK')) {
|
||||
die('Illegal call');
|
||||
}
|
||||
|
||||
function pica_RegisterCustomTab ()
|
||||
{
|
||||
return array("con_contentallocation");
|
||||
}
|
||||
|
||||
function pica_GetCustomTabProperties ($sIntName)
|
||||
{
|
||||
if ($sIntName == "con_contentallocation")
|
||||
{
|
||||
return array("con_contentallocation", "con_edit", "");
|
||||
}
|
||||
}
|
||||
|
||||
function pica_ArticleListActions ($aActions)
|
||||
{
|
||||
$aTmpActions["con_contentallocation"] = "con_contentallocation";
|
||||
|
||||
return $aTmpActions + $aActions;
|
||||
}
|
||||
|
||||
function pica_RenderArticleAction ($idcat, $idart, $idartlang, $actionkey)
|
||||
{
|
||||
global $sess;
|
||||
|
||||
if ($actionkey == "con_contentallocation")
|
||||
{
|
||||
return '<a title="'.i18n("Content Allocation", "content_allocation").'" alt="'. i18n("Content Allocation", "content_allocation").'" href="'.$sess->url('main.php?area=con_contentallocation&action=con_edit&idart='.$idart.'&idartlang='.$idartlang.'&idcat='.$idcat.'&frame=4').'"><img src="plugins/content_allocation/images/call_contentallocation.gif"></a>';
|
||||
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
?>
|
|
@ -1,132 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Project:
|
||||
* Contenido Content Management System
|
||||
*
|
||||
* Description:
|
||||
* Content Allocation Articles
|
||||
*
|
||||
* Requirements:
|
||||
* @con_php_req 5.0
|
||||
*
|
||||
*
|
||||
* @package Contenido Backend plugins
|
||||
* @version 1.0.1
|
||||
* @author unknown
|
||||
* @copyright four for business AG <www.4fb.de>
|
||||
* @license http://www.contenido.org/license/LIZENZ.txt
|
||||
* @link http://www.4fb.de
|
||||
* @link http://www.contenido.org
|
||||
* @since file available since contenido release <= 4.6
|
||||
*
|
||||
* {@internal
|
||||
* created unknown
|
||||
* modified 2008-07-02, Frederic Schneider, add security fix
|
||||
*
|
||||
* $Id$:
|
||||
* }}
|
||||
*
|
||||
*/
|
||||
if (!defined('CON_FRAMEWORK')) {
|
||||
die('Illegal call');
|
||||
}
|
||||
|
||||
// check requests
|
||||
Contenido_Security::checkRequests();
|
||||
|
||||
if (!($perm->have_perm_area_action($area, "storeallocation") || $perm->have_perm_area_action_item($area, "storeallocation", $idcat))) {
|
||||
$notification->displayNotification("error", i18n("Permission denied", "content_allocation"));
|
||||
return;
|
||||
}
|
||||
|
||||
cInclude("includes", "functions.pathresolver.php");
|
||||
|
||||
function str_replace_recursive($array) {
|
||||
if (!is_array($array))
|
||||
return false;
|
||||
|
||||
$result = array();
|
||||
|
||||
foreach ($array as $value) {
|
||||
$result[] = str_replace("e", "", $value);
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
// fetch idartlang for idart
|
||||
$sql = "SELECT idartlang FROM " . $cfg['tab']['art_lang'] . " WHERE idart=" . Contenido_Security::toInteger($idart) . " AND idlang=" . Contenido_Security::toInteger($lang);
|
||||
$db->query($sql);
|
||||
$db->next_record();
|
||||
$this_idartlang = $db->f('idartlang');
|
||||
|
||||
$oPage = new cPage;
|
||||
$oPage->setMargin(10);
|
||||
|
||||
$oTree = new pApiContentAllocationComplexList('06bd456d-fe76-40cb-b041-b9ba90dc400a');
|
||||
$oAlloc = new pApiContentAllocation;
|
||||
|
||||
if ($_POST['action'] == 'storeallocation') {
|
||||
$oAlloc->storeAllocations($this_idartlang, $_POST['allocation']);
|
||||
}
|
||||
if ($_GET['step'] == 'collapse') {
|
||||
$oTree->setTreeStatus($_GET['idpica_alloc']);
|
||||
}
|
||||
|
||||
#build category path
|
||||
$catString = '';
|
||||
prCreateURLNameLocationString($idcat, '/', $catString);
|
||||
$oArticle = new Article($idart, $client, $lang);
|
||||
$sArticleTitle = $oArticle->getField('title');
|
||||
|
||||
$sLocationString = "<div class=\"categorypath\">" . $catString . '/' . clHtmlSpecialChars($sArticleTitle) . "</div>";
|
||||
|
||||
// load allocations
|
||||
$loadedAllocations = $oAlloc->loadAllocations($this_idartlang);
|
||||
|
||||
$oTree->setChecked($loadedAllocations);
|
||||
$result = $oTree->renderTree(true);
|
||||
|
||||
if ($result == false) {
|
||||
$result = $notification->returnNotification("warning", i18n('There is no Content Allocation tree.', "content_allocation"));
|
||||
} else {
|
||||
if (!is_object($tpl)) {
|
||||
$tpl = new Template;
|
||||
}
|
||||
$hiddenfields = '<input type="hidden" name="action" value="storeallocation">
|
||||
<input type="hidden" name="idart" value="' . $idart . '">
|
||||
<input type="hidden" name="contenido" value="' . $sess->id . '">
|
||||
<input type="hidden" name="area" value="' . $area . '">
|
||||
<input type="hidden" name="frame" value="' . $frame . '">
|
||||
<input type="hidden" name="idcat" value="' . $idcat . '">';
|
||||
$tpl->set('s', 'HIDDENFIELDS', $hiddenfields);
|
||||
|
||||
|
||||
if (sizeof($loadedAllocations) > 0) {
|
||||
$tpl->set('s', 'ARRAY_CHECKED_BOXES', 'var checkedBoxes = [' . implode(',', $loadedAllocations) . '];');
|
||||
} else {
|
||||
$tpl->set('s', 'ARRAY_CHECKED_BOXES', 'var checkedBoxes = [];');
|
||||
}
|
||||
|
||||
$oDiv = new cHTMLDiv;
|
||||
$oDiv->updateAttributes(array('style' => 'text-align: right; padding: 5px; width: 730px; border: 1px #B3B3B3 solid; background-color: #FFFFFF;'));
|
||||
$oDiv->setContent('<input type="image" src="images/but_ok.gif" />');
|
||||
$tpl->set('s', 'DIV', '<br>' . $oDiv->render());
|
||||
|
||||
$tpl->set('s', 'TREE', $result);
|
||||
|
||||
$tpl->set('s', 'REMOVE_ALL', i18n("Remove all", "content_allocation"));
|
||||
$tpl->set('s', 'REMOVE', i18n("Remove", "content_allocation"));
|
||||
|
||||
$result = $tpl->generate($cfg['pica']['treetemplate_complexlist'], true);
|
||||
|
||||
$script = '<link rel="stylesheet" type="text/css" href="' . $cfg['pica']['style_complexlist'] . '"/>
|
||||
<script language="javascript" src="' . $cfg['pica']['script_complexlist'] . '"></script>';
|
||||
$oPage->addScript('style', $script);
|
||||
}
|
||||
|
||||
|
||||
$oPage->setContent($sLocationString . $result . markSubMenuItem(5, true));
|
||||
$oPage->render();
|
||||
?>
|
|
@ -1,22 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
*
|
||||
* @package Plugins
|
||||
* @subpackage ContentAllocation
|
||||
* @version $Rev$
|
||||
* @since 2.0
|
||||
* @author Ortwin Pinke <o.pinke@conlite.org>
|
||||
* @copyright 2017 CL-Team
|
||||
* @link http://www.conlite.org
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
if(!defined('CON_FRAMEWORK')) {
|
||||
die('Illegal call');
|
||||
}
|
||||
|
||||
$oPage = new cPage();
|
||||
$oPage->setHtml5();
|
||||
|
||||
$oPage->render();
|
|
@ -1,39 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* Project:
|
||||
* Contenido Content Management System
|
||||
*
|
||||
* Description:
|
||||
* Rendering left_top frame
|
||||
*
|
||||
* Requirements:
|
||||
* @con_php_req 5.0
|
||||
*
|
||||
*
|
||||
* @package Contenido Backend plugins
|
||||
* @version 1.0.1
|
||||
* @author unknown
|
||||
* @copyright four for business AG <www.4fb.de>
|
||||
* @license http://www.contenido.org/license/LIZENZ.txt
|
||||
* @link http://www.4fb.de
|
||||
* @link http://www.contenido.org
|
||||
* @since file available since contenido release <= 4.6
|
||||
*
|
||||
* {@internal
|
||||
* created unknown
|
||||
* modified 2008-07-02, Frederic Schneider, add security fix
|
||||
*
|
||||
* $Id$:
|
||||
* }}
|
||||
*
|
||||
*/
|
||||
|
||||
if(!defined('CON_FRAMEWORK')) {
|
||||
die('Illegal call');
|
||||
}
|
||||
|
||||
$oPage = new UI_Left_Top;
|
||||
|
||||
$oPage->render();
|
||||
|
||||
?>
|
|
@ -1,164 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Project:
|
||||
* Contenido Content Management System
|
||||
*
|
||||
* Description:
|
||||
* right_bottom frame for Content Allocation
|
||||
*
|
||||
* Requirements:
|
||||
* @con_php_req 5.0
|
||||
*
|
||||
*
|
||||
* @package Contenido Backend plugins
|
||||
* @version 1.0.1
|
||||
* @author unknown
|
||||
* @copyright four for business AG <www.4fb.de>
|
||||
* @license http://www.contenido.org/license/LIZENZ.txt
|
||||
* @link http://www.4fb.de
|
||||
* @link http://www.contenido.org
|
||||
* @since file available since contenido release <= 4.6
|
||||
*
|
||||
* {@internal
|
||||
* created unknown
|
||||
* modified 2008-07-02, Frederic Schneider, add security fix
|
||||
*
|
||||
* $Id$:
|
||||
* }}
|
||||
*
|
||||
*/
|
||||
if (!defined('CON_FRAMEWORK')) {
|
||||
die('Illegal call');
|
||||
}
|
||||
|
||||
if (isset($_REQUEST['treeItem'])) {
|
||||
die('Illegal call!');
|
||||
}
|
||||
|
||||
#added 24.06.08 timo.trautmann security fix filter submitted treeItemPost array before insertion, name also changed according to security fix
|
||||
$aPostTreeItem = array();
|
||||
if (!is_object($db)) {
|
||||
$db = new DB_ConLite();
|
||||
}
|
||||
|
||||
if (isset($_REQUEST['treeItemPost']['idpica_alloc'])) {
|
||||
$aPostTreeItem['idpica_alloc'] = (int) $_REQUEST['treeItemPost']['idpica_alloc'];
|
||||
}
|
||||
|
||||
if (isset($_REQUEST['treeItemPost']['parentid'])) {
|
||||
$aPostTreeItem['parentid'] = (int) $_REQUEST['treeItemPost']['parentid'];
|
||||
}
|
||||
|
||||
if (isset($_REQUEST['treeItemPost']['name'])) {
|
||||
$sName = stripslashes($_REQUEST['treeItemPost']['name']);
|
||||
$sName = $db->escape($sName);
|
||||
$aPostTreeItem['name'] = $sName;
|
||||
}
|
||||
|
||||
$_GET['idpica_alloc'] = (int) $_GET['idpica_alloc'];
|
||||
#end added 24.06.08 timo.trautmann
|
||||
|
||||
$oPage = new cPage();
|
||||
$oPage->setMargin(10);
|
||||
$oPage->setMessageBox();
|
||||
$oTree = new pApiContentAllocationTreeView('f7771624-4874-4745-8b7e-21a49a71a447');
|
||||
|
||||
// store item
|
||||
if ($_POST['step'] == 'store') {
|
||||
$pNotify = '<div style="width:410px;margin-bottom:20px;">';
|
||||
$sMessage = sprintf(i18n("New Category %s successfully stored!", "content_allocation"), $treeItem['name']);
|
||||
$notification->displayNotification("info", $sMessage);
|
||||
$pNotify .= '</div>';
|
||||
$oTree->storeItem($aPostTreeItem);
|
||||
}
|
||||
// rename item
|
||||
if ($_POST['step'] == 'storeRename') {
|
||||
$pNotify = '<div style="width:410px;margin-bottom:20px;">';
|
||||
$sMessage = sprintf(i18n("Category %s successfully renamed!", "content_allocation"), $treeItem['name']);
|
||||
$notification->displayNotification("info", $sMessage);
|
||||
$pNotify .= '</div>';
|
||||
$oTree->storeItem($aPostTreeItem);
|
||||
}
|
||||
// rename item
|
||||
if ($_GET['step'] == 'moveup') {
|
||||
$oTree->itemMoveUp($_GET['idpica_alloc']);
|
||||
}
|
||||
|
||||
if ($_GET['step'] == 'deleteItem') { // delete item
|
||||
$pNotify = '<div style="width:410px;margin-bottom:20px;">';
|
||||
$sMessage = i18n("Category successfully deleted!", "content_allocation");
|
||||
$notification->displayNotification("info", $sMessage);
|
||||
$pNotify .= '</div>';
|
||||
$oTree->deleteItem($_GET['idpica_alloc']);
|
||||
}
|
||||
if ($_GET['step'] == 'collapse') {
|
||||
$oTree->setTreeStatus($_GET['idpica_alloc']);
|
||||
}
|
||||
if ($_GET['step'] == 'online') {
|
||||
$oTree->setOnline($_GET['idpica_alloc']);
|
||||
}
|
||||
if ($_GET['step'] == 'offline') {
|
||||
$oTree->setOffline($_GET['idpica_alloc']);
|
||||
}
|
||||
|
||||
$oDiv = new cHTMLDiv;
|
||||
$oDiv->updateAttributes(array('style' => 'padding: 5px; width: 400px; border: 1px #B3B3B3 solid; background-color: #FFFFFF;'));
|
||||
$sTemp = '';
|
||||
|
||||
if ($_GET['step'] == 'createRoot') { // create new root item
|
||||
$form = '
|
||||
<table cellspacing="0" cellpaddin="0" border="0">
|
||||
<form name="create" action="main.php" method="POST" onsubmit="return fieldCheck();">
|
||||
<input type="hidden" name="action" value="' . $action . '" />
|
||||
<input type="hidden" name="frame" value="' . intval($frame) . '" />
|
||||
<input type="hidden" name="contenido" value="' . $sess->id . '" />
|
||||
<input type="hidden" name="area" value="' . $area . '" />
|
||||
<input type="hidden" name="step" value="store" />
|
||||
<input type="hidden" name="treeItemPost[parentid]" value="root" />
|
||||
<tr><td colspan="2" class="text_medium">' . i18n("Create new tree", "content_allocation") . '</td></tr>
|
||||
<tr>
|
||||
<td class="text_medium"><input id="itemname" class="text_medium" type="text" name="treeItemPost[name]" value=""></td>
|
||||
<td> <a href="main.php?action=' . $action . '&frame=' . $frame . '&area=' . $area . '&contenido=' . $sess->id . '"><img src="images/but_cancel.gif" border="0" /></a>
|
||||
<input type="image" src="images/but_ok.gif" /></td>
|
||||
</tr>
|
||||
</form>
|
||||
</table>
|
||||
<script language="JavaScript">
|
||||
controller = document.getElementById("itemname");
|
||||
controller.focus();
|
||||
function fieldCheck() {
|
||||
if (controller.value == "") {
|
||||
alert("' . i18n("Please enter a category name.", "content_allocation") . '");
|
||||
controller.focus();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
</script>';
|
||||
$oDiv->setContent($form);
|
||||
$sTemp = $oDiv->render();
|
||||
} else {
|
||||
$newTree = '<a href="main.php?action=' . $action . '&step=createRoot&frame=' . $frame . '&area=' . $area . '&contenido=' . $sess->id . '"><img src="images/folder_new.gif" border="0" style="vertical-align: middle; margin-right: 5px;">' . i18n("Create new tree", "content_allocation") . '</a><div style="height:10px"></div>';
|
||||
}
|
||||
|
||||
$result = $oTree->renderTree(true);
|
||||
|
||||
if ($result === false) {
|
||||
$result = ' ';
|
||||
}
|
||||
|
||||
$js = '
|
||||
<script language="javascript">
|
||||
/* Function for deleting categories*/
|
||||
function deleteCategory(idpica_alloc) {
|
||||
var url = "main.php?area=' . $area . '&action=' . $action . '&step=deleteItem&idpica_alloc=" + idpica_alloc + "&frame=' . $frame . '&contenido=' . $sess->id . '";
|
||||
window.location.href = url;
|
||||
}
|
||||
</script>';
|
||||
|
||||
$oPage->addScript('deleteCategory', $js);
|
||||
|
||||
$oPage->setContent($pNotify . $newTree . $sTemp . '<br/>' . $result);
|
||||
$oPage->render();
|
||||
?>
|
|
@ -1,109 +0,0 @@
|
|||
# SOME DESCRIPTIVE TITLE.
|
||||
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
|
||||
# This file is distributed under the same license as the PACKAGE package.
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
||||
#
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2011-05-18 10:55+0200\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=CHARSET\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: includes/config.plugin.php:59
|
||||
msgid "Store content allocations"
|
||||
msgstr ""
|
||||
|
||||
#: includes/include.contentallocation_article.php:86
|
||||
msgid "There is no Content Allocation tree."
|
||||
msgstr ""
|
||||
|
||||
#: includes/include.contentallocation_article.php:111
|
||||
msgid "Remove all"
|
||||
msgstr ""
|
||||
|
||||
#: includes/include.contentallocation_article.php:112
|
||||
msgid "Remove"
|
||||
msgstr ""
|
||||
|
||||
#: includes/include.right_bottom.php:70
|
||||
#, php-format
|
||||
msgid "New Category %s successfully stored!"
|
||||
msgstr ""
|
||||
|
||||
#: includes/include.right_bottom.php:78
|
||||
#, php-format
|
||||
msgid "Category %s successfully renamed!"
|
||||
msgstr ""
|
||||
|
||||
#: includes/include.right_bottom.php:90
|
||||
msgid "Category successfully deleted!"
|
||||
msgstr ""
|
||||
|
||||
#: includes/include.right_bottom.php:119 includes/include.right_bottom.php:142
|
||||
msgid "Create new tree"
|
||||
msgstr ""
|
||||
|
||||
#: includes/include.right_bottom.php:132
|
||||
msgid "Please enter a category name."
|
||||
msgstr ""
|
||||
|
||||
#: includes/functions.chains.php:61
|
||||
msgid "Content Allocation"
|
||||
msgstr ""
|
||||
|
||||
#: classes/class.content_allocation_treeview.php:100
|
||||
#: classes/class.content_allocation_treeview.php:176
|
||||
msgid "Please enter a category name"
|
||||
msgstr ""
|
||||
|
||||
#: classes/class.content_allocation_treeview.php:124
|
||||
msgid "New category"
|
||||
msgstr ""
|
||||
|
||||
#: classes/class.content_allocation_treeview.php:126
|
||||
msgid "Rename category"
|
||||
msgstr ""
|
||||
|
||||
#: classes/class.content_allocation_treeview.php:127
|
||||
msgid "Move category up"
|
||||
msgstr ""
|
||||
|
||||
#: classes/class.content_allocation_treeview.php:128
|
||||
msgid "Move category down"
|
||||
msgstr ""
|
||||
|
||||
#: classes/class.content_allocation_treeview.php:132
|
||||
msgid "Set category offline"
|
||||
msgstr ""
|
||||
|
||||
#: classes/class.content_allocation_treeview.php:134
|
||||
msgid "Set category online"
|
||||
msgstr ""
|
||||
|
||||
#: classes/class.content_allocation_treeview.php:138
|
||||
msgid "One or more subcategories exist, unable to delete"
|
||||
msgstr ""
|
||||
|
||||
#: classes/class.content_allocation_treeview.php:140
|
||||
msgid "Delete category"
|
||||
msgstr ""
|
||||
|
||||
#: classes/class.content_allocation_treeview.php:140
|
||||
msgid "Are you sure to delete the following category"
|
||||
msgstr ""
|
||||
|
||||
#: classes/class.content_allocation_treeview.php:223
|
||||
#: classes/class.content_allocation_article.php:107
|
||||
msgid "Category"
|
||||
msgstr ""
|
||||
|
||||
#: classes/class.content_allocation_treeview.php:224
|
||||
msgid "Actions"
|
||||
msgstr ""
|
Binäre Datei nicht angezeigt.
|
@ -1,112 +0,0 @@
|
|||
# SOME DESCRIPTIVE TITLE.
|
||||
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
|
||||
# This file is distributed under the same license as the PACKAGE package.
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Contenido ContentAllocation\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2011-05-18 10:55+0200\n"
|
||||
"PO-Revision-Date: 2013-09-11 14:31+0100\n"
|
||||
"Last-Translator: Ortwin Pinke <translation@dceonline.de>\n"
|
||||
"Language-Team: Ortwin Pinke <o.pinke@php-backoffice.de>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=iso-8859-1\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Poedit-KeywordsList: i18n\n"
|
||||
"Language: de_DE\n"
|
||||
"X-Generator: Poedit 1.5.7\n"
|
||||
|
||||
#: includes/config.plugin.php:59
|
||||
msgid "Store content allocations"
|
||||
msgstr "Content Allocation speichern"
|
||||
|
||||
#: includes/include.contentallocation_article.php:86
|
||||
msgid "There is no Content Allocation tree."
|
||||
msgstr "Es existiert kein Content Allocation Baum"
|
||||
|
||||
#: includes/include.contentallocation_article.php:111
|
||||
msgid "Remove all"
|
||||
msgstr "Alle entfernen"
|
||||
|
||||
#: includes/include.contentallocation_article.php:112
|
||||
msgid "Remove"
|
||||
msgstr "Entfernen"
|
||||
|
||||
#: includes/include.right_bottom.php:70
|
||||
#, php-format
|
||||
msgid "New Category %s successfully stored!"
|
||||
msgstr "Neue Kategorie %s gespeichert!"
|
||||
|
||||
#: includes/include.right_bottom.php:78
|
||||
#, php-format
|
||||
msgid "Category %s successfully renamed!"
|
||||
msgstr "Kategorie %s umbenannt!"
|
||||
|
||||
#: includes/include.right_bottom.php:90
|
||||
msgid "Category successfully deleted!"
|
||||
msgstr "Kategorie gelöscht!"
|
||||
|
||||
#: includes/include.right_bottom.php:119 includes/include.right_bottom.php:142
|
||||
msgid "Create new tree"
|
||||
msgstr "Neuen Baum erstellen"
|
||||
|
||||
#: includes/include.right_bottom.php:132
|
||||
msgid "Please enter a category name."
|
||||
msgstr "Bitte geben Sie einen Kategorienamen ein."
|
||||
|
||||
#: includes/functions.chains.php:61
|
||||
msgid "Content Allocation"
|
||||
msgstr "Content Allocation"
|
||||
|
||||
#: classes/class.content_allocation_treeview.php:100
|
||||
#: classes/class.content_allocation_treeview.php:176
|
||||
msgid "Please enter a category name"
|
||||
msgstr "Bitte geben Sie einen Kategorienamen ein"
|
||||
|
||||
#: classes/class.content_allocation_treeview.php:124
|
||||
msgid "New category"
|
||||
msgstr "Neue Kategorie"
|
||||
|
||||
#: classes/class.content_allocation_treeview.php:126
|
||||
msgid "Rename category"
|
||||
msgstr "Kategorie umbenennen"
|
||||
|
||||
#: classes/class.content_allocation_treeview.php:127
|
||||
msgid "Move category up"
|
||||
msgstr "Kategorie aufwärts bewegen"
|
||||
|
||||
#: classes/class.content_allocation_treeview.php:128
|
||||
msgid "Move category down"
|
||||
msgstr "Kategorie abwärts bewegen"
|
||||
|
||||
#: classes/class.content_allocation_treeview.php:132
|
||||
msgid "Set category offline"
|
||||
msgstr "Kategorie offline schalten"
|
||||
|
||||
#: classes/class.content_allocation_treeview.php:134
|
||||
msgid "Set category online"
|
||||
msgstr "Kategorie online schalten"
|
||||
|
||||
#: classes/class.content_allocation_treeview.php:138
|
||||
msgid "One or more subcategories exist, unable to delete"
|
||||
msgstr ""
|
||||
"Es gibt eine oder mehrer Unterkategorien, Löschen nicht möglich"
|
||||
|
||||
#: classes/class.content_allocation_treeview.php:140
|
||||
msgid "Delete category"
|
||||
msgstr "Lösche Kategorie"
|
||||
|
||||
#: classes/class.content_allocation_treeview.php:140
|
||||
msgid "Are you sure to delete the following category"
|
||||
msgstr "Wollen Sie folgende Kategorien wirklich l&oeschen?"
|
||||
|
||||
#: classes/class.content_allocation_treeview.php:223
|
||||
#: classes/class.content_allocation_article.php:107
|
||||
msgid "Category"
|
||||
msgstr "Kategorie"
|
||||
|
||||
#: classes/class.content_allocation_treeview.php:224
|
||||
msgid "Actions"
|
||||
msgstr "Aktionen"
|
|
@ -1,15 +0,0 @@
|
|||
./includes/config.plugin.php
|
||||
./includes/include.left_bottom.php
|
||||
./includes/include.left_top.php
|
||||
./includes/include.contentallocation_article.php
|
||||
./includes/include.right_bottom.php
|
||||
./includes/functions.chains.php
|
||||
./templates/template.tree_structure.html
|
||||
./templates/template.tree_complexlist.html
|
||||
./templates/template.tree_article.html
|
||||
./classes/class.content_allocation_tree.php
|
||||
./classes/class.content_allocation_treeview.php
|
||||
./classes/class.content_allocation.php
|
||||
./classes/class.content_allocation_article.php
|
||||
./classes/class.content_allocation_complexlist.php
|
||||
./classes/class.content_allocation_selectbox.php
|
|
@ -1 +0,0 @@
|
|||
|
|
@ -1,133 +0,0 @@
|
|||
/*
|
||||
* ul2finder
|
||||
* written by Christian Heilmann (http://icant.co.uk)
|
||||
* turns the nested list with the ID "finder" into a dynamic list
|
||||
* uses the CSS classes defined in the variables
|
||||
*/
|
||||
function ul2finder()
|
||||
{
|
||||
// Define variables used and classes to be applied/removed
|
||||
var i,uls,als,finder;
|
||||
var parentClass='parent';
|
||||
var showClass='shown';
|
||||
var hideClass='hidden';
|
||||
var openClass='open';
|
||||
|
||||
// check if our finder list exists, if not, stop all activities
|
||||
finder=document.getElementById('finder');
|
||||
if(!finder){return;}
|
||||
|
||||
// add the class domenabled to the body
|
||||
cssjs('add',document.body,'domenabled')
|
||||
|
||||
// loop through all lists inside finder, position and hide them
|
||||
// by applying the class hidden
|
||||
uls=document.getElementById('finder').getElementsByTagName('ul');
|
||||
for(i=0;i<uls.length;i++)
|
||||
{
|
||||
cssjs('add',uls[i],hideClass);
|
||||
}
|
||||
|
||||
// loop through all links of inside finder
|
||||
lis=document.getElementById('finder').getElementsByTagName('li');
|
||||
for(i=0;i<lis.length;i++)
|
||||
{
|
||||
var styleBgColor = lis[i].attributes["baseClass"].value
|
||||
|
||||
// if the li containing the link has no nested list, skip this one
|
||||
if(!lis[i].getElementsByTagName('ul')[0])
|
||||
{
|
||||
//lis[i].className = "bright";
|
||||
//cssjs('add',lis[i],styleBgColor);
|
||||
lis[i].className = styleBgColor;
|
||||
continue;
|
||||
}
|
||||
|
||||
var newa=document.createElement('a');
|
||||
newa.href='#';
|
||||
|
||||
newa.appendChild(document.createTextNode(lis[i].firstChild.nextSibling.nodeValue));
|
||||
lis[i].replaceChild(newa,lis[i].firstChild.nextSibling);
|
||||
// otherwise apply the parent class
|
||||
//alert(lis[i].innerHTML);
|
||||
cssjs('add',newa,styleBgColor);
|
||||
|
||||
// if the user clicks on the link
|
||||
lis[i].getElementsByTagName('a')[0].onclick=function()
|
||||
{
|
||||
// loop through all lists inside finder
|
||||
for(var i=0;i<uls.length;i++)
|
||||
{
|
||||
// avoid the list connected to this link
|
||||
var found=false;
|
||||
for(j=0;j<uls[i].getElementsByTagName('ul').length;j++)
|
||||
{
|
||||
if(uls[i].getElementsByTagName('ul')[j] ==
|
||||
this.parentNode.getElementsByTagName('ul')[0])
|
||||
{
|
||||
found=true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// and hide all others
|
||||
if(!found)
|
||||
{
|
||||
cssjs('add',uls[i],hideClass)
|
||||
cssjs('remove',uls[i],showClass)
|
||||
cssjs('remove',uls[i].parentNode.getElementsByTagName('a')[0],openClass)
|
||||
cssjs('add',uls[i].parentNode.getElementsByTagName('a')[0],parentClass)
|
||||
// remove all old "open" elements
|
||||
styleColor = uls[i].parentNode.getElementsByTagName('a')[0].style.backgroundColor;
|
||||
if (styleColor == "#E2E2E2" || styleColor == "rgb(226, 226, 226)") {
|
||||
uls[i].parentNode.getElementsByTagName('a')[0].style.backgroundColor = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// change the current link from parent to open
|
||||
cssjs('swap',this,parentClass,openClass)
|
||||
this.style.backgroundColor = "#E2E2E2";
|
||||
|
||||
// show the current nested list
|
||||
cssjs('add',this.parentNode.getElementsByTagName('ul')[0],showClass)
|
||||
|
||||
// don't follow the real HREF of the link
|
||||
return false;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* cssjs
|
||||
* written by Christian Heilmann (http://icant.co.uk)
|
||||
* eases the dynamic application of CSS classes via DOM
|
||||
* parameters: action a, object o and class names c1 and c2 (c2 optional)
|
||||
* actions: swap exchanges c1 and c2 in object o
|
||||
* add adds class c1 to object o
|
||||
* remove removes class c1 from object o
|
||||
* check tests if class c1 is applied to object o
|
||||
* example: cssjs('swap',document.getElementById('foo'),'bar','baz');
|
||||
*/
|
||||
function cssjs(a,o,c1,c2)
|
||||
{
|
||||
switch (a){
|
||||
case 'swap':
|
||||
o.className=!cssjs('check',o,c1)?o.className.replace(c2,c1):o.className.replace(c1,c2);
|
||||
break;
|
||||
case 'add':
|
||||
if(!cssjs('check',o,c1)){o.className+=o.className?' '+c1:c1;}
|
||||
break;
|
||||
case 'remove':
|
||||
var rep=o.className.match(' '+c1)?' '+c1:c1;
|
||||
o.className=o.className.replace(rep,'');
|
||||
break;
|
||||
case 'check':
|
||||
return new RegExp('\\b'+c1+'\\b').test(o.className)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Check if the browser supports DOM, and start the script if it does.
|
||||
if(document.getElementById && document.createTextNode)
|
||||
{
|
||||
window.onload=ul2finder;
|
||||
}
|
|
@ -1,105 +0,0 @@
|
|||
.domenabled #finderparent {
|
||||
border: 0px solid #000;
|
||||
position: relative;
|
||||
/*min-height: 250px;*/
|
||||
height: 360px;
|
||||
width: 730px;
|
||||
overflow: auto;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.domenabled #finder {
|
||||
/*position:absolute;
|
||||
top:1em;
|
||||
left:1em;*/
|
||||
}
|
||||
|
||||
.domenabled ul#finder,
|
||||
.domenabled ul#finder li,
|
||||
.domenabled ul#finder ul {
|
||||
width: 180px;
|
||||
list-style-type: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
line-height: 20px;
|
||||
}
|
||||
|
||||
.domenabled ul#finder ul.hidden {
|
||||
top: 0px;
|
||||
left: -1px;
|
||||
position: absolute;
|
||||
/*display: none;*/
|
||||
visibility: hidden;
|
||||
border-left: 5px #fff solid;
|
||||
}
|
||||
|
||||
.domenabled ul#finder ul.shown {
|
||||
top: 0px;
|
||||
left: 185px;
|
||||
position: absolute;
|
||||
float: left;
|
||||
/*border-left: 5px #fff solid;*/
|
||||
/*display: block;*/
|
||||
visibility: visible;
|
||||
}
|
||||
|
||||
.domenabled #finder a.open {
|
||||
background: url(../images/arrow.gif) no-repeat #CCCCCC 140px 50%;
|
||||
padding-right: 16px;
|
||||
padding-left: 0px;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.domenabled ul#finder li a {
|
||||
color: #000;
|
||||
background: url(../images/normal.gif) no-repeat transparent 0 50%;
|
||||
/*adding-left: 16px;*/
|
||||
text-decoration: none;
|
||||
padding-right: 16px;
|
||||
padding-left: 0px;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.domenabled ul#finder li a.dark {
|
||||
background: url(../images/arrow.gif) no-repeat #fff 170px 50%;
|
||||
}
|
||||
|
||||
.domenabled ul#finder li.dark,
|
||||
.domenabled ul#finder li a.dark {
|
||||
background-color: #E2E2E2;
|
||||
}
|
||||
|
||||
.domenabled ul#finder li a.bright {
|
||||
background: url(../images/arrow.gif) no-repeat #ddd 170px 50%;
|
||||
}
|
||||
|
||||
.domenabled ul#finder li.bright,
|
||||
.domenabled ul#finder li a.bright {
|
||||
background-color: #F4F4F7;
|
||||
}
|
||||
|
||||
.domenabled ul#finder li,
|
||||
.domenabled ul#finder ul.hidden li,
|
||||
.domenabled ul#finder ul.shown li {
|
||||
border: 1px #B3B3B3 solid;
|
||||
border-bottom: 0px;
|
||||
}
|
||||
|
||||
.domenabled ul#finder input {
|
||||
float: left;
|
||||
}
|
||||
|
||||
#choosenList {
|
||||
border: 1px #B3B3B3 solid;
|
||||
background-color: #E2E2E2;
|
||||
width: 730px;
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
#choosenList ul {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
#choosenList li {
|
||||
list-style-type: square;
|
||||
}
|
|
@ -1,17 +0,0 @@
|
|||
<form method="post" action="main.php" name="contentallocation">
|
||||
{HIDDENFIELDS}
|
||||
<table border="0" cellpadding="2" cellspacing="0" width="500" style="border:0px; border-left:1px; border-bottom: 1px;border-color: #B3B3B3; border-style: solid;">
|
||||
<tr class="text_medium" style="font-weight:bold; background-color: #E2E2E2;">
|
||||
<td width="450" class="textg_medium" style="border: 0px; border-top:1px; border-right:1px; border-color: #B3B3B3; border-style: solid">{CATEGORY}</td>
|
||||
<td width="50" class="textg_medium" style="border: 0px; border-top:1px; border-right:1px; border-color: #B3B3B3; border-style: solid"> </td>
|
||||
</tr>
|
||||
|
||||
<!-- BEGIN:BLOCK -->
|
||||
<tr style="background-color: {BACKGROUND_COLOR};" onmouseover="row.over(this)" onmouseout="row.out(this)" onclick="row.click(this)">
|
||||
<td style="border: 0px; border-top:1px; border-right:1px;border-color: #B3B3B3; border-style: solid; padding-left: {ITEMINDENT} ;">{ITEMNAME}</td>
|
||||
<td style="border: 0px; border-top:1px; border-right:1px; border-color: #B3B3B3; border-style: solid;">{CHECKBOX}</td>
|
||||
</tr>
|
||||
<!-- END:BLOCK -->
|
||||
</table>
|
||||
{DIV}
|
||||
</form>
|
|
@ -1,76 +0,0 @@
|
|||
<form method="post" action="main.php" name="contentallocation">
|
||||
{HIDDENFIELDS}
|
||||
<div id="finderparent">
|
||||
{TREE}
|
||||
</div>
|
||||
<div id="choosenList">
|
||||
<ul id="choosenValues">
|
||||
</ul>
|
||||
<br /><a href="javascript:removeAll();">{REMOVE_ALL}</a>
|
||||
</div>
|
||||
{DIV}
|
||||
</form>
|
||||
|
||||
<script language="javascript">
|
||||
function addToList(obj) {
|
||||
var list = document.getElementById("choosenValues");
|
||||
var elmId = obj.attributes["id"].value;
|
||||
elmId = elmId.replace(/e/, "");
|
||||
|
||||
if (obj.checked == false) {
|
||||
removeFromList(elmId);
|
||||
} else {
|
||||
if (obj.nextSibling.innerHTML == undefined) {
|
||||
text = obj.nextSibling.data;
|
||||
} else {
|
||||
text = obj.nextSibling.innerHTML;
|
||||
}
|
||||
|
||||
var removeLink = "<a href=\"javascript:removeFromList("+elmId+")\">[{REMOVE}]</a> " + text;
|
||||
|
||||
listelm = document.createElement("LI");
|
||||
listelm.innerHTML = removeLink;
|
||||
listelm.id = "rl" + elmId;
|
||||
|
||||
//list.appendChild(listelm);
|
||||
list.appendChild(listelm);
|
||||
}
|
||||
}
|
||||
|
||||
function removeFromList (id) {
|
||||
var list = document.getElementById("choosenValues");
|
||||
var remElm = document.getElementById("rl" + id);
|
||||
|
||||
if (remElm != null) {
|
||||
list.removeChild(remElm);
|
||||
var uncheckElm = document.getElementById("e" + id);
|
||||
uncheckElm.checked = false;
|
||||
}
|
||||
}
|
||||
|
||||
function removeAll () {
|
||||
var list = document.getElementById("choosenValues");
|
||||
|
||||
formElms = document.forms["contentallocation"].elements;
|
||||
|
||||
for (i = 0; i < formElms.length; i++) {
|
||||
if (formElms[i].type == "checkbox") {
|
||||
formElms[i].checked = false;
|
||||
}
|
||||
}
|
||||
list.innerHTML = '';
|
||||
}
|
||||
|
||||
{ARRAY_CHECKED_BOXES}
|
||||
|
||||
function listAllCheckedBoxes () {
|
||||
if (checkedBoxes.length == 0) return false;
|
||||
|
||||
for (i = 0; i < checkedBoxes.length; i++) {
|
||||
obj = document.getElementById("e" + checkedBoxes[i]);
|
||||
addToList(obj);
|
||||
}
|
||||
}
|
||||
listAllCheckedBoxes();
|
||||
|
||||
</script>
|
|
@ -1,13 +0,0 @@
|
|||
<table border="0" cellpadding="2" cellspacing="0" width="800" style="border:0px; border-left:1px; border-bottom: 1px;border-color: #B3B3B3; border-style: solid;">
|
||||
<tr class="text_medium" style="font-weight:bold; background-color: #E2E2E2;">
|
||||
<td width="600" class="textg_medium" style="border: 0px; border-top:1px; border-right:1px; border-color: #B3B3B3; border-style: solid">{CATEGORY}</td>
|
||||
<td width="200" class="textg_medium" style="border: 0px; border-top:1px; border-right:1px; border-color: #B3B3B3; border-style: solid">{ACTIONS}</td>
|
||||
</tr>
|
||||
|
||||
<!-- BEGIN:BLOCK -->
|
||||
<tr style="background-color: {BACKGROUND_COLOR};" onmouseover="row.over(this)" onmouseout="row.out(this)" onclick="row.click(this)">
|
||||
<td style="border: 0px; border-top:0px; border-right:1px;border-color: #B3B3B3; border-style: solid; padding-left: {ITEMINDENT} ;">{ITEMNAME}</td>
|
||||
<td style="border: 0px; border-top:0px; border-right:1px; border-color: #B3B3B3; border-style: solid;">{ACTION_CREATE} {ACTION_RENAME} {ACTION_ONOFFLINE} {ACTION_MOVE_UP} {ACTION_MOVE_DOWN} {ACTION_DELETE}</td>
|
||||
</tr>
|
||||
<!-- END:BLOCK -->
|
||||
</table>
|
|
@ -1,12 +0,0 @@
|
|||
<xml version="1.0" encoding="UTF-8">
|
||||
<plugin>
|
||||
<main>Content Allocation</main>
|
||||
<content_allocation></content_allocation>
|
||||
|
||||
|
||||
<contenido>
|
||||
<article>
|
||||
<content_allocation>Content Allocation</content_allocation>
|
||||
</article>
|
||||
</contenido>
|
||||
</plugin>
|
|
@ -1,11 +0,0 @@
|
|||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<!-- Contenido XML language file -->
|
||||
<language>
|
||||
<navigation>
|
||||
<extra>
|
||||
<content_allocation>
|
||||
<main>Content Allocation</main>
|
||||
</content_allocation>
|
||||
</extra>
|
||||
</navigation>
|
||||
</language>
|
|
@ -1,11 +0,0 @@
|
|||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<!-- Contenido XML language file -->
|
||||
<language>
|
||||
<navigation>
|
||||
<extra>
|
||||
<content_allocation>
|
||||
<main>Content Allocation</main>
|
||||
</content_allocation>
|
||||
</extra>
|
||||
</navigation>
|
||||
</language>
|
|
@ -1,11 +0,0 @@
|
|||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<!-- Contenido XML language file -->
|
||||
<language>
|
||||
<navigation>
|
||||
<extra>
|
||||
<content_allocation>
|
||||
<main>Content Allocation</main>
|
||||
</content_allocation>
|
||||
</extra>
|
||||
</navigation>
|
||||
</language>
|
|
@ -1,47 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* Project:
|
||||
* Contenido Content Management System
|
||||
*
|
||||
* Description:
|
||||
* Config file for the plugin linkchecker
|
||||
*
|
||||
* Requirements:
|
||||
* @con_php_req 5.0
|
||||
*
|
||||
*
|
||||
* @package Contenido Backend plugins
|
||||
* @version 2.0.1
|
||||
* @author Frederic Schneider
|
||||
* @copyright four for business AG <www.4fb.de>
|
||||
* @license http://www.contenido.org/license/LIZENZ.txt
|
||||
* @link http://www.4fb.de
|
||||
* @link http://www.contenido.org
|
||||
* @since file available since contenido release 4.8.7
|
||||
*
|
||||
* {@internal
|
||||
* created 2007-08-08
|
||||
* modified 2007-12-13, 2008-05-15
|
||||
*
|
||||
* $Id$:
|
||||
* }}
|
||||
*
|
||||
*/
|
||||
|
||||
if(!defined('CON_FRAMEWORK')) {
|
||||
die('Illegal call');
|
||||
}
|
||||
|
||||
$plugin_name = "linkchecker";
|
||||
$cfg['plugins']['linkchecker'] = $cfg['path']['contenido'] . "plugins/" . $plugin_name . "/";
|
||||
$cfg['tab']['whitelist'] = $cfg['sql']['sqlprefix'] . '_pi_linkwhitelist';
|
||||
|
||||
// Templates
|
||||
$cfg['templates']['linkchecker_test'] = $cfg['plugins']['linkchecker'] . "templates/standard/template.linkchecker_test.html";
|
||||
$cfg['templates']['linkchecker_test_errors'] = $cfg['plugins']['linkchecker'] . "templates/standard/template.linkchecker_test_errors.html";
|
||||
$cfg['templates']['linkchecker_test_errors_cat'] = $cfg['plugins']['linkchecker'] . "templates/standard/template.linkchecker_test_errors_cat.html";
|
||||
$cfg['templates']['linkchecker_test_nothing'] = $cfg['plugins']['linkchecker'] . "templates/standard/template.linkchecker_test_nothing.html";
|
||||
$cfg['templates']['linkchecker_noerrors'] = $cfg['plugins']['linkchecker'] . "templates/standard/template.linkchecker_noerrors.html";
|
||||
$cfg['templates']['linkchecker_whitelist'] = $cfg['plugins']['linkchecker'] . "templates/standard/template.linkchecker_whitelist.html";
|
||||
$cfg['templates']['linkchecker_whitelist_urls'] = $cfg['plugins']['linkchecker'] . "templates/standard/template.linkchecker_whitelist_urls.html";
|
||||
?>
|
|
@ -1,89 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* Project:
|
||||
* Contenido Content Management System
|
||||
*
|
||||
* Description:
|
||||
* Checks userrights for cats
|
||||
*
|
||||
* Requirements:
|
||||
* @con_php_req 5.0
|
||||
*
|
||||
*
|
||||
* @package Contenido Backend plugins
|
||||
* @version 1.0.1
|
||||
* @author Mario Diaz
|
||||
* @copyright four for business AG <www.4fb.de>
|
||||
* @license http://www.contenido.org/license/LIZENZ.txt
|
||||
* @link http://www.4fb.de
|
||||
* @link http://www.contenido.org
|
||||
* @since file available since contenido release 4.8.7
|
||||
*
|
||||
* {@internal
|
||||
* created 2006-06-08
|
||||
* modified 2007-11-07, Frederic Schneider, Linkchecker-Edition
|
||||
* modified 2008-02-08, Andreas Lindner, Performance enhancements
|
||||
* modified 2008-07-02, Frederic Schneider, add security fix
|
||||
*
|
||||
* $Id$:
|
||||
* }}
|
||||
*
|
||||
*/
|
||||
|
||||
if(!defined('CON_FRAMEWORK')) {
|
||||
die('Illegal call');
|
||||
}
|
||||
|
||||
function cCatPerm($widcat, $db = null)
|
||||
{
|
||||
global $cfg, $sess, $auth, $group_id, $_arrCatIDs_cCP;
|
||||
|
||||
if (strpos($auth->auth['perm'], 'admin') !== FALSE) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (is_null($db) || !is_object($db)) {
|
||||
$db = new DB_ConLite;
|
||||
}
|
||||
|
||||
$group_ids = getGroupIDs($db);
|
||||
$group_ids[] = Contenido_Security::escapeDB($auth->auth['uid'], $db);
|
||||
|
||||
if (!is_array($_arrCatIDs_cCP)) {
|
||||
$_arrCatIDs_cCP = array();
|
||||
|
||||
$sql_inc = " user_id='";
|
||||
$sql_inc .= implode("' OR user_id='", $group_ids) . "' ";
|
||||
$sql = "SELECT idcat FROM ".$cfg['tab']['rights']."
|
||||
WHERE idarea=6 AND idaction=359 AND ($sql_inc)";
|
||||
|
||||
$db->query($sql);
|
||||
|
||||
while ($db->next_record()) {
|
||||
$_arrCatIDs_cCP[$db->f('idcat')] = '';
|
||||
}
|
||||
}
|
||||
|
||||
return array_key_exists($widcat, $_arrCatIDs_cCP);
|
||||
}
|
||||
|
||||
function getGroupIDs(&$db)
|
||||
{
|
||||
global $cfg, $sess, $auth, $group_id, $_arrGroupIDs_gGI;
|
||||
|
||||
if (is_array($_arrGroupIDs_gGI)) {
|
||||
return $_arrGroupIDs_gGI;
|
||||
}
|
||||
|
||||
$sql = "SELECT group_id FROM ".$cfg["tab"]["groupmembers"]." WHERE user_id='".Contenido_Security::escapeDB($auth->auth["uid"], $db)."'";
|
||||
$db->query($sql);
|
||||
|
||||
$_arrGroupIDs_gGI = array();
|
||||
|
||||
while ($db->next_record())
|
||||
$_arrGroupIDs_gGI[] = $db->f('group_id');
|
||||
|
||||
return $_arrGroupIDs_gGI;
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,413 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* Project:
|
||||
* Contenido Content Management System
|
||||
*
|
||||
* Description:
|
||||
* Main file for the plugin linkchecker
|
||||
*
|
||||
* Requirements:
|
||||
* @con_php_req 5.0
|
||||
*
|
||||
*
|
||||
* @package Contenido Backend plugins
|
||||
* @version 2.0.1
|
||||
* @author Frederic Schneider
|
||||
* @copyright four for business AG <www.4fb.de>
|
||||
* @license http://www.contenido.org/license/LIZENZ.txt
|
||||
* @link http://www.4fb.de
|
||||
* @link http://www.contenido.org
|
||||
* @since file available since contenido release 4.8.7
|
||||
*
|
||||
* {@internal
|
||||
* created 2007-08-08
|
||||
* modified 2008-02-08, Andread Lindner, performance enhancements
|
||||
* modified 2008-04-05, Holger Librenz, fixed wrong include-path for
|
||||
* PEAR cache module
|
||||
* modified 2008-05-14, Frederic Schneider, new version
|
||||
* modified 2008-06-21, Frederic Schneider, array initalization
|
||||
* modified 2008-07-02, Frederic Schneider, add security fix
|
||||
* modified 2008-07-07, Frederic Schneider, fixed wrong language var
|
||||
*
|
||||
* $Id$:
|
||||
* }}
|
||||
*
|
||||
*/
|
||||
|
||||
if(!defined('CON_FRAMEWORK')) {
|
||||
die('Illegal call');
|
||||
}
|
||||
|
||||
$plugin_name = "linkchecker";
|
||||
global $cfg;
|
||||
|
||||
if(!$perm->have_perm_area_action($plugin_name, $plugin_name) && $cronjob != true) {
|
||||
exit;
|
||||
}
|
||||
|
||||
if((int) $client == 0 && $cronjob != true) {
|
||||
$notification->displayNotification("error", i18n("No Client selected"));
|
||||
exit;
|
||||
}
|
||||
|
||||
// If no mode defined, use mode three
|
||||
if(empty($_GET['mode'])) {
|
||||
$_GET['mode'] = 3;
|
||||
}
|
||||
|
||||
// If no action definied
|
||||
if(empty($_GET['action'])) {
|
||||
$_GET['action'] = 'linkchecker';
|
||||
$action = "linkchecker";
|
||||
}
|
||||
|
||||
plugin_include('linkchecker', 'includes/config.plugin.php');
|
||||
plugin_include('linkchecker', 'includes/include.checkperms.php');
|
||||
plugin_include('linkchecker', 'includes/include.linkchecker_tests.php');
|
||||
cInclude('pear', 'PEAR.php');
|
||||
cInclude('pear', 'Cache/Lite.php');
|
||||
|
||||
|
||||
// Initialization
|
||||
$actionID = 500;
|
||||
$aCats = array();
|
||||
$aSearchIDInfosArt = array();
|
||||
$aSearchIDInfosCatArt = array();
|
||||
$aSearchIDInfosNonID = array();
|
||||
$iWhitelist_timeout = 2592000; // 30 days
|
||||
|
||||
// Var initialization
|
||||
$aUrl = array('cms' => $cfgClient[$client]['path']['htmlpath'], 'contenido' => $cfg['path']['contenido_fullhtml']);
|
||||
|
||||
// Template- and languagevars
|
||||
if($cronjob != true) {
|
||||
$tpl->set('s', 'FULLHTML', $aUrl['contenido']);
|
||||
$tpl->set('s', 'MODE', intval($_GET['mode']));
|
||||
$tpl->set('s', 'URL', $aUrl['contenido']);
|
||||
$tpl->set('s', 'SID', $sess->id);
|
||||
}
|
||||
|
||||
// Fill Subnav I
|
||||
$sLink = $sess->url("main.php?area=linkchecker&frame=4&action=linkchecker") . '&mode=';
|
||||
|
||||
// Fill Subnav II
|
||||
$tpl->set('s', 'INTERNS_HREF', $sLink . '1');
|
||||
$tpl->set('s', 'INTERNS_LABEL', i18n("Interns"));
|
||||
$tpl->set('s', 'EXTERNS_HREF', $sLink . '2');
|
||||
$tpl->set('s', 'EXTERNS_LABEL', i18n("Externs"));
|
||||
$tpl->set('s', 'INTERNS_EXTERNS_HREF', $sLink . '3');
|
||||
$tpl->set('s', 'INTERNS_EXTERNS_LABEL', i18n("Intern/extern Links"));
|
||||
|
||||
// Fill Subnav III
|
||||
$tpl->set('s', 'UPDATE_HREF', $sLink . intval($_GET['mode']) . '&live=1');
|
||||
|
||||
// Cache options
|
||||
$aCacheName = array('errors' => $sess->id, 'errorscount' => $aCacheName['errors'] . "ErrorsCountChecked");
|
||||
$oCache = new Cache_Lite(array('cacheDir' => $cfgClient[$client]['path']['frontend'] . "cache/", 'caching' => true, 'lifeTime' => 1209600, 'automaticCleaningFactor' => 1));
|
||||
|
||||
/* *********
|
||||
Program code
|
||||
********* */
|
||||
|
||||
/* function linksort */
|
||||
function linksort($sErrors) {
|
||||
|
||||
if($_GET['sort'] == "nameart") {
|
||||
|
||||
foreach($sErrors as $key => $aRow) {
|
||||
$aNameart[$key] = $aRow['nameart'];
|
||||
}
|
||||
|
||||
array_multisort($sErrors, SORT_ASC, SORT_STRING, $aNameart);
|
||||
|
||||
} elseif($_GET['sort'] == "namecat") {
|
||||
|
||||
foreach($sErrors as $key => $aRow) {
|
||||
$aNamecat[$key] = $aRow['namecat'];
|
||||
}
|
||||
|
||||
array_multisort($sErrors, SORT_ASC, SORT_STRING, $aNamecat);
|
||||
|
||||
} elseif($_GET['sort'] == "wronglink") {
|
||||
|
||||
foreach($sErrors as $key => $aRow) {
|
||||
$aWronglink[$key] = $aRow['url'];
|
||||
}
|
||||
|
||||
array_multisort($sErrors, SORT_ASC, SORT_STRING, $aWronglink);
|
||||
|
||||
} elseif($_GET['sort'] == "error_type") {
|
||||
|
||||
foreach($sErrors as $key => $aRow) {
|
||||
$aError_type[$key] = $aRow['error_type'];
|
||||
}
|
||||
|
||||
array_multisort($sErrors, SORT_ASC, SORT_STRING, $aError_type);
|
||||
|
||||
}
|
||||
|
||||
return $sErrors;
|
||||
|
||||
}
|
||||
|
||||
// function url_is_image
|
||||
function url_is_image($sUrl) {
|
||||
|
||||
if(substr($sUrl, -3, 3) == "gif"
|
||||
|| substr($sUrl, -3, 3) == "jpg"
|
||||
|| substr($sUrl, -4, 4) == "jpeg"
|
||||
|| substr($sUrl, -3, 3) == "png"
|
||||
|| substr($sUrl, -3, 3) == "tif"
|
||||
|| substr($sUrl, -3, 3) == "psd"
|
||||
|| substr($sUrl, -3, 3) == "bmp") {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// function url_is_uri
|
||||
function url_is_uri($sUrl) {
|
||||
|
||||
if(substr($sUrl, 0, 4) == "file"
|
||||
|| substr($sUrl, 0, 3) == "ftp"
|
||||
|| substr($sUrl, 0, 4) == "http"
|
||||
|| substr($sUrl, 0, 2) == "ww") {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* Check: Changes after last check? */
|
||||
$sql = "SELECT lastmodified FROM " . $cfg['tab']['content'] . " content
|
||||
LEFT JOIN " . $cfg['tab']['art_lang'] . " art ON (art.idartlang = content.idartlang)
|
||||
WHERE art.online = '1'";
|
||||
|
||||
/* Whitelist: Add */
|
||||
if(!empty($_GET['whitelist'])) {
|
||||
$sql = "INSERT INTO " . $cfg['tab']['whitelist'] . " VALUES ('" . Contenido_Security::escapeDB(base64_decode($_GET['whitelist']), $db) . "', '" . time() . "')";
|
||||
$db->query($sql);
|
||||
}
|
||||
|
||||
/* Whitelist: Get */
|
||||
$sql = "SELECT url FROM " . $cfg['tab']['whitelist'] . " WHERE lastview < " . (time() + $iWhitelist_timeout) . "
|
||||
AND lastview > " . (time() - $iWhitelist_timeout);
|
||||
$db->query($sql);
|
||||
|
||||
$aWhitelist = array();
|
||||
while($db->next_record()) {
|
||||
$aWhitelist[] = $db->f("url");
|
||||
}
|
||||
|
||||
/* Get all links */
|
||||
// Cache errors
|
||||
$sCache_errors = $oCache->get($aCacheName['errors'], intval($_GET['mode']));
|
||||
|
||||
// Search if cache doesn't exist or we're in live mode
|
||||
if($sCache_errors && $_GET['live'] != 1) {
|
||||
$aErrors = unserialize($sCache_errors);
|
||||
} else { // If no cache exists
|
||||
|
||||
// Select all categorys
|
||||
$sql = "SELECT idcat FROM " . $cfg['tab']['cat'] . " GROUP BY idcat";
|
||||
$db->query($sql);
|
||||
|
||||
while($db->next_record()) {
|
||||
|
||||
if($cronjob != true) { // Check userrights, if no cronjob
|
||||
|
||||
$iCheck = cCatPerm($db->f("idcat"), $db2);
|
||||
|
||||
if($iCheck == true) {
|
||||
$aCats[] = Contenido_Security::toInteger($db->f("idcat"));
|
||||
}
|
||||
|
||||
} else {
|
||||
$aCats[] = Contenido_Security::toInteger($db->f("idcat"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Use SQL-WHERE if lang is not zero
|
||||
if($langart != 0) {
|
||||
$sLang_where = "AND art.idlang = '" . Contenido_Security::toInteger($langart) . "' AND catName.idlang = '" . Contenido_Security::toInteger($langart) . "'";
|
||||
} elseif(!isset($langart)) {
|
||||
$sLang_where = "AND art.idlang = '" . Contenido_Security::toInteger($lang) . "' AND catName.idlang = '" . Contenido_Security::toInteger($lang) . "'";
|
||||
}
|
||||
if(!empty($aCats)) {
|
||||
// How many articles exists? [Text]
|
||||
$sql = "SELECT art.title, art.idlang, cat.idart, cat.idcat, catName.name AS namecat, con.value FROM " . $cfg['tab']['cat_art'] . " cat
|
||||
LEFT JOIN " . $cfg['tab']['art_lang'] . " art ON (art.idart = cat.idart)
|
||||
LEFT JOIN " . $cfg['tab']['cat_lang'] . " catName ON (catName.idcat = cat.idcat)
|
||||
LEFT JOIN " . $cfg['tab']['content'] . " con ON (con.idartlang = art.idartlang)
|
||||
WHERE (con.value LIKE '%action%' OR con.value LIKE '%data%' OR con.value LIKE '%href%' OR con.value LIKE '%src%')
|
||||
AND cat.idcat IN (0, " . join(", ", $aCats) . ") AND cat.idcat != '0' " . $sLang_where . "
|
||||
AND art.online = '1' AND art.redirect = '0'";
|
||||
$db->query($sql);
|
||||
|
||||
while($db->next_record()) {
|
||||
|
||||
// Text decode
|
||||
$value = urldecode($db->f("value"));
|
||||
|
||||
// Search the text
|
||||
searchLinks($value, $db->f("idart"), $db->f("title"), $db->f("idcat"), $db->f("namecat"), $db->f("idlang"));
|
||||
|
||||
// Search front_content.php-links
|
||||
if($_GET['mode'] != 2) {
|
||||
searchFrontContentLinks($value, $db->f("idart"), $db->f("title"), $db->f("idcat"), $db->f("namecat"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// How many articles exists? [Redirects]
|
||||
$sql = "SELECT art.title, art.redirect_url, art.idlang, cat.idart, cat.idcat, catName.name AS namecat FROM " . $cfg['tab']['cat_art'] . " cat
|
||||
LEFT JOIN " . $cfg['tab']['art_lang'] . " art ON (art.idart = cat.idart)
|
||||
LEFT JOIN " . $cfg['tab']['cat_lang'] . " catName ON (catName.idcat = cat.idcat)
|
||||
WHERE cat.idcat IN (0, " . join(", ", $aCats) . ") AND cat.idcat != '0' " . $sLang_where . "
|
||||
AND art.online = '1' AND art.redirect = '1'";
|
||||
$db->query($sql);
|
||||
|
||||
while($db->next_record()) {
|
||||
|
||||
// Search links
|
||||
searchLinks($db->f("redirect_url"), $db->f("idart"), $db->f("title"), $db->f("idcat"), $db->f("namecat"), $db->f("idlang"), "Redirect");
|
||||
|
||||
// Search front_content.php-links
|
||||
if($_GET['mode'] != 2) {
|
||||
searchFrontContentLinks($db->f("redirect_url"), $db->f("idart"), $db->f("title"), $db->f("idcat"), $db->f("namecat"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Check the links
|
||||
checkLinks();
|
||||
}
|
||||
}
|
||||
|
||||
/* Analysis of the errors */
|
||||
// Templateset
|
||||
if($cronjob != true) {
|
||||
$tpl->set('s', 'TITLE', i18n('Link analysis from ', $plugin_name) . strftime(i18n('%Y-%m-%d', $plugin_name), time()));
|
||||
}
|
||||
|
||||
// If no errors found, say that
|
||||
if(empty($aErrors) && $cronjob != true) {
|
||||
$tpl->set('s', 'NO_ERRORS', i18n("<strong>No errors</strong> were found.", $plugin_name));
|
||||
$tpl->generate($cfg['templates']['linkchecker_noerrors']);
|
||||
} elseif(!empty($aErrors) && $cronjob != true) {
|
||||
|
||||
$tpl->set('s', 'ERRORS_HEADLINE', i18n("Total checked links", $plugin_name));
|
||||
$tpl->set('s', 'ERRORS_HEADLINE_ARTID', i18n("idart", $plugin_name));
|
||||
$tpl->set('s', 'ERRORS_HEADLINE_ARTICLE', i18n("Article", $plugin_name));
|
||||
$tpl->set('s', 'ERRORS_HEADLINE_CATID', i18n("idcat", $plugin_name));
|
||||
$tpl->set('s', 'ERRORS_HEADLINE_CATNAME', i18n("Category", $plugin_name));
|
||||
$tpl->set('s', 'ERRORS_HEADLINE_DESCRIPTION', i18n("Description", $plugin_name));
|
||||
$tpl->set('s', 'ERRORS_HEADLINE_LINK', i18n("Linkerror", $plugin_name));
|
||||
$tpl->set('s', 'ERRORS_HEADLINE_LINKS_ARTICLES', i18n("Links to articles", $plugin_name));
|
||||
$tpl->set('s', 'ERRORS_HEADLINE_LINKS_CATEGORYS', i18n("Links to categories", $plugin_name));
|
||||
$tpl->set('s', 'ERRORS_HEADLINE_LINKS_DOCIMAGES', i18n("Links to documents and images", $plugin_name));
|
||||
$tpl->set('s', 'ERRORS_HEADLINE_OTHERS', i18n("Links to extern sites and not defined links", $plugin_name));
|
||||
$tpl->set('s', 'ERRORS_HEADLINE_WHITELIST', "Whitelist");
|
||||
$tpl->set('s', 'ERRORS_HELP_ERRORS', i18n("Wrong links", $plugin_name));
|
||||
|
||||
// error_output initialization
|
||||
$aError_output = array('art' => '', 'cat' => '', 'docimages' => '', 'others' => '');
|
||||
|
||||
foreach($aErrors as $sKey => $aRow) {
|
||||
|
||||
$aRow = linksort($aRow);
|
||||
|
||||
for($i = 0; $i < count($aRow); $i++) {
|
||||
|
||||
$tpl2 = new Template;
|
||||
$tpl2->reset();
|
||||
|
||||
$tpl2->set('s', 'ERRORS_ERROR_TYPE', $aRow[$i]['error_type']);
|
||||
$tpl2->set('s', 'ERRORS_ARTID', $aRow[$i]['idart']);
|
||||
$tpl2->set('s', 'ERRORS_ARTICLE', $aRow[$i]['nameart']);
|
||||
$tpl2->set('s', 'ERRORS_ARTICLE_SHORT', substr($aRow[$i]['nameart'], 0, 20) . ((strlen($aRow[$i]['nameart']) > 20) ? ' ...' : ''));
|
||||
$tpl2->set('s', 'ERRORS_CATID', $aRow[$i]['idcat']);
|
||||
$tpl2->set('s', 'ERRORS_LINK', $aRow[$i]['url']);
|
||||
$tpl2->set('s', 'ERRORS_LINK_ENCODE', base64_encode($aRow[$i]['url']));
|
||||
$tpl2->set('s', 'ERRORS_LINK_SHORT', substr($aRow[$i]['url'], 0, 55) . ((strlen($aRow[$i]['url']) > 55) ? ' ...' : ''));
|
||||
$tpl2->set('s', 'ERRORS_CATNAME', $aRow[$i]['namecat']);
|
||||
$tpl2->set('s', 'ERRORS_CATNAME_SHORT', substr($aRow[$i]['namecat'], 0, 20) . ((strlen($aRow[$i]['namecat']) > 20) ? ' ...' : ''));
|
||||
$tpl2->set('s', 'MODE', $_GET['mode']);
|
||||
$tpl2->set('s', 'URL', $aUrl['contenido']);
|
||||
$tpl2->set('s', 'SID', $sess->id);
|
||||
|
||||
if($aRow[$i]['error_type'] == "unknown") {
|
||||
$tpl2->set('s', 'ERRORS_ERROR_TYPE_HELP', i18n("Unknown: articles, documents etc. do not exist.", $plugin_name));
|
||||
} elseif($aRow[$i]['error_type'] == "offline") {
|
||||
$tpl2->set('s', 'ERRORS_ERROR_TYPE_HELP', i18n("Offline: article or category is offline.", $plugin_name));
|
||||
} elseif($aRow[$i]['error_type'] == "startart") {
|
||||
$tpl2->set('s', 'ERRORS_ERROR_TYPE_HELP', i18n("Offline: article or category is offline.", $plugin_name));
|
||||
} elseif($aRow[$i]['error_type'] == "dbfs") {
|
||||
$tpl2->set('s', 'ERRORS_ERROR_TYPE_HELP', i18n("dbfs: no matches found in the dbfs database.", $plugin_name));
|
||||
}
|
||||
|
||||
if($sKey != "cat") {
|
||||
$aError_output[$sKey] .= $tpl2->generate($cfg['templates']['linkchecker_test_errors'], 1);
|
||||
} else {
|
||||
$aError_output[$sKey] .= $tpl2->generate($cfg['templates']['linkchecker_test_errors_cat'], 1); // special template for idcats
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* Counter */
|
||||
if($iCounter = $oCache->get($aCacheName['errorscount'], intval($_GET['mode']))) { // Cache exists?
|
||||
$iErrors_count_checked = $iCounter;
|
||||
} else { // Count searched links: idarts + idcats + idcatarts + others
|
||||
$iErrors_count_checked = count($aSearchIDInfosArt) + count($aSearchIDInfosCat) + count($aSearchIDInfosCatArt) + count($aSearchIDInfosNonID);
|
||||
}
|
||||
|
||||
// Count errors
|
||||
foreach($aErrors as $sKey => $aRow) {
|
||||
$iErrors_counted += count($aErrors[$sKey]);
|
||||
}
|
||||
|
||||
$tpl->set('s', 'ERRORS_COUNT_CHECKED', $iErrors_count_checked);
|
||||
$tpl->set('s', 'ERRORS_COUNT_ERRORS', $iErrors_counted);
|
||||
$tpl->set('s', 'ERRORS_COUNT_ERRORS_PERCENT', round(($iErrors_counted * 100) / $iErrors_count_checked, 2));
|
||||
|
||||
/* Template output */
|
||||
foreach($aError_output as $sKey => $sValue) {
|
||||
|
||||
if(empty($aError_output[$sKey])) { // Errors for this type?
|
||||
$tpl2->set('s', 'ERRORS_NOTHING', i18n("No errors for this type.", $plugin_name));
|
||||
$aError_output[$sKey] = $tpl2->generate($cfg['templates']['linkchecker_test_nothing'], 1);
|
||||
}
|
||||
|
||||
$tpl->set('s', 'ERRORS_SHOW_' . strtoupper($sKey), $aError_output[$sKey]);
|
||||
|
||||
if(count($aErrors[$sKey]) > 0) {
|
||||
$tpl->set('s', 'ERRORS_COUNT_ERRORS_' . strtoupper($sKey), '<span style="color: #FF0000;">' . count($aErrors[$sKey]) . '</span>');
|
||||
} else {
|
||||
$tpl->set('s', 'ERRORS_COUNT_ERRORS_' . strtoupper($sKey), count($aErrors[$key]));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$tpl->generate($cfg['templates']['linkchecker_test']);
|
||||
|
||||
/* Cache */
|
||||
// Remove older cache
|
||||
$oCache->remove($aCacheName['errors'], intval($_GET['mode']));
|
||||
|
||||
// Build new cache
|
||||
$oCache->save(serialize($aErrors), $aCacheName['errors'], intval($_GET['mode']));
|
||||
$oCache->save($iErrors_count_checked, $aCacheName['errorscount'], intval($_GET['mode']));
|
||||
|
||||
}
|
||||
|
||||
// Log
|
||||
if($cronjob != true) {
|
||||
$backend->log(0, 0, $client, $lang, $action);
|
||||
}
|
||||
?>
|
|
@ -1,316 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* Project:
|
||||
* Contenido Content Management System
|
||||
*
|
||||
* Description:
|
||||
* Some linktests for the Linkchecker
|
||||
*
|
||||
* Requirements:
|
||||
* @con_php_req 5.0
|
||||
*
|
||||
*
|
||||
* @package Contenido Backend plugins
|
||||
* @version 2.0.2
|
||||
* @author Frederic Schneider
|
||||
* @copyright four for business AG <www.4fb.de>
|
||||
* @license http://www.contenido.org/license/LIZENZ.txt
|
||||
* @link http://www.4fb.de
|
||||
* @link http://www.contenido.org
|
||||
* @since file available since contenido release 4.8.7
|
||||
*
|
||||
* {@internal
|
||||
* created 2008-02-28
|
||||
* modified 2008-06-05, Frederic Schneider
|
||||
* modified 2008-06-26, Frederic Schneider, add security fix
|
||||
* modified 2009-11-06, Murat Purc, replaced deprecated functions (PHP 5.3 ready)
|
||||
* modified 2010-01-07, Murat Purc, fixed usage of wrong variable, see [#CON-292]
|
||||
* modified 2010-11-26, Dominik Ziegler, resetten array with redefinition of empty array instead of unsetting the variable [#CON-369]
|
||||
*
|
||||
* $Id$:
|
||||
* }}
|
||||
*
|
||||
*/
|
||||
|
||||
if(!defined('CON_FRAMEWORK')) {
|
||||
die('Illegal call');
|
||||
}
|
||||
|
||||
// Checks all links without front_content.php
|
||||
function checkLinks() {
|
||||
global $auth, $cfgClient, $client, $cfg, $cronjob, $db, $aErrors, $lang, $langart, $whitelist;
|
||||
global $aSearchIDInfosArt, $aSearchIDInfosCat, $aSearchIDInfosCatArt, $aSearchIDInfosNonID;
|
||||
|
||||
if(count($aSearchIDInfosArt) > 0) { // Checks idarts
|
||||
|
||||
for($i = 0; $i < count($aSearchIDInfosArt); $i++) {
|
||||
|
||||
if($i == 0) {
|
||||
$sSearch = Contenido_Security::toInteger($aSearchIDInfosArt[$i]['id']);
|
||||
} else {
|
||||
$sSearch .= ", " . Contenido_Security::toInteger($aSearchIDInfosArt[$i]['id']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Check articles
|
||||
$aFind = array();
|
||||
$sql = "SELECT idart, online FROM " . $cfg['tab']['art_lang'] . " WHERE idart IN (" . $sSearch . ")";
|
||||
$db->query($sql);
|
||||
|
||||
while($db->next_record()) {
|
||||
$aFind[$db->f("idart")] = array("online" => $db->f("online"));
|
||||
}
|
||||
|
||||
for($i = 0; $i < count($aSearchIDInfosArt); $i++) {
|
||||
|
||||
if(isset($aFind[$aSearchIDInfosArt[$i]['id']]) && $aFind[$aSearchIDInfosArt[$i]['id']]['online'] == 0) {
|
||||
$aErrors['art'][] = array_merge($aSearchIDInfosArt[$i], array("error_type" => "offline"));
|
||||
} elseif(!isset($aFind[$aSearchIDInfosArt[$i]['id']])) {
|
||||
$aErrors['art'][] = array_merge($aSearchIDInfosArt[$i], array("error_type" => "unknown"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$int_cnt_aSearchIDInfosCat = 0;
|
||||
|
||||
if(is_countable($aSearchIDInfosCat)) {
|
||||
$int_cnt_aSearchIDInfosCat = count($aSearchIDInfosCat);
|
||||
}
|
||||
|
||||
if($int_cnt_aSearchIDInfosCat > 0) { // Checks idcats
|
||||
|
||||
for($i = 0; $i < $int_cnt_aSearchIDInfosCat; $i++) {
|
||||
|
||||
if($i == 0) {
|
||||
$sSearch = $aSearchIDInfosCat[$i]['id'];
|
||||
} else {
|
||||
$sSearch .= ", " . $aSearchIDInfosCat[$i]['id'];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Check categorys
|
||||
$aFind = array();
|
||||
$sql = "SELECT idcat, startidartlang, visible FROM " . $cfg['tab']['cat_lang'] . " WHERE idcat IN (" . $sSearch . ") AND idlang = '" . Contenido_Security::toInteger($lang) . "'";
|
||||
$db->query($sql);
|
||||
|
||||
while($db->next_record()) {
|
||||
$aFind[$db->f("idcat")] = array("online" => $db->f("visible"), "startidart" => $db->f("startidartlang"));
|
||||
}
|
||||
|
||||
for($i = 0; $i < count($aSearchIDInfosCat); $i++) {
|
||||
|
||||
if(is_array($aFind[$aSearchIDInfosCat[$i]['id']]) && $aFind[$aSearchIDInfosCat[$i]['id']]['startidart'] == 0) {
|
||||
$aErrors['cat'][] = array_merge($aSearchIDInfosCat[$i], array("error_type" => "startart"));
|
||||
} elseif(is_array($aFind[$aSearchIDInfosCat[$i]['id']]) && $aFind[$aSearchIDInfosCat[$i]['id']]['online'] == 0) {
|
||||
$aErrors['cat'][] = array_merge($aSearchIDInfosCat[$i], array("error_type" => "offline"));
|
||||
} elseif(!is_array($aFind[$aSearchIDInfosCat[$i]['id']])) {
|
||||
$aErrors['cat'][] = array_merge($aSearchIDInfosCat[$i], array("error_type" => "unknown"));
|
||||
}
|
||||
|
||||
if(is_array($aFind[$aSearchIDInfosCat[$i]['id']]) && $aFind[$aSearchIDInfosCat[$i]['id']]['startidart'] != 0) {
|
||||
|
||||
$sql = "SELECT idart FROM " . $cfg['tab']['art_lang'] . " WHERE idartlang = '" . $aFind[$aSearchIDInfosCat[$i]['id']]['startidart'] . "' AND online = '1'";
|
||||
$db->query($sql);
|
||||
|
||||
if($db->num_rows() == 0) {
|
||||
$aErrors['cat'][] = array_merge($aSearchIDInfosCat[$i], array("error_type" => "startart"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(count($aSearchIDInfosCatArt) > 0) { // Checks idcatarts
|
||||
|
||||
for($i = 0; $i < count($aSearchIDInfosCatArt); $i++) {
|
||||
|
||||
if($i == 0) {
|
||||
$sSearch = Contenido_Security::toInteger($aSearchIDInfosCatArt[$i]['id']);
|
||||
} else {
|
||||
$sSearch .= ", " . Contenido_Security::toInteger($aSearchIDInfosCatArt[$i]['id']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Check articles
|
||||
$aFind = array();
|
||||
$sql = "SELECT idcatart FROM " . $cfg['tab']['cat_art'] . " WHERE idcatart IN (" . $sSearch . ")";
|
||||
$db->query($sql);
|
||||
|
||||
while($db->next_record()) {
|
||||
$aFind[] = $db->f("idcatart");
|
||||
}
|
||||
|
||||
for($i = 0; $i < count($aSearchIDInfosCatArt); $i++) {
|
||||
|
||||
if(!in_array($aSearchIDInfosCatArt[$i]['id'], $aFind)) {
|
||||
$aErrors['art'][] = array_merge($aSearchIDInfosCatArt[$i], array("error_type" => "unknown"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(count($aSearchIDInfosNonID) != 0) { // Checks other links (e. g. http, www, dfbs)
|
||||
|
||||
// Select userrights (is the user admin or sysadmin?)
|
||||
$sql = "SELECT username FROM " . $cfg['tab']['phplib_auth_user_md5'] . " WHERE user_id='" . Contenido_Security::escapeDB($auth->auth['uid'], $db) . "' AND perms LIKE '%admin%'";
|
||||
$db->query($sql);
|
||||
|
||||
if($db->num_rows() > 0 || $cronjob == true) { // User is admin when he is or when he run the cronjob
|
||||
$iAdmin = true;
|
||||
}
|
||||
|
||||
for($i = 0; $i < count($aSearchIDInfosNonID); $i++) {
|
||||
|
||||
if(url_is_uri($aSearchIDInfosNonID[$i]['url'])) {
|
||||
|
||||
if(substr($aSearchIDInfosNonID[$i]['url'], 0, strlen($aSearchIDInfosNonID[$i]['url'])) == $cfgClient[$client]['path']['htmlpath']) {
|
||||
$iPing = @file_exists(str_replace($cfgClient[$client]['path']['htmlpath'], $cfgClient[$client]['path']['frontend'], $aSearchIDInfosNonID[$i]['url']));
|
||||
} else {
|
||||
$iPing = @fopen($aSearchIDInfosNonID[$i]['url'], 'r');
|
||||
}
|
||||
|
||||
if(!$iPing) {
|
||||
|
||||
if(url_is_image($aSearchIDInfosNonID[$i]['url'])) {
|
||||
$aErrors['docimages'][] = array_merge($aSearchIDInfosNonID[$i], array("error_type" => "unknown"));
|
||||
} else {
|
||||
$aErrors['others'][] = array_merge($aSearchIDInfosNonID[$i], array("error_type" => "unknown"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} elseif(substr($aSearchIDInfosNonID[$i]['url'], strlen($aSearchIDInfosNonID[$i]['url'])-5, 5) == ".html") {
|
||||
|
||||
$iPing = @file_exists($cfgClient[$client]['path']['htmlpath'] . $aSearchIDInfosNonID[$i]['url']);
|
||||
|
||||
if(!$iPing) {
|
||||
$aErrors['art'][] = array_merge($aSearchIDInfosNonID[$i], array("error_type" => "unknown"));
|
||||
}
|
||||
|
||||
} elseif(substr($aSearchIDInfosNonID[$i]['url'], 0, 20) == "dbfs.php?file=dbfs:/") {
|
||||
|
||||
$sDBurl = substr($aSearchIDInfosNonID[$i]['url'], 20, strlen($aSearchIDInfosNonID[$i]['url']));
|
||||
|
||||
$iPos = strrpos($sDBurl, '/');
|
||||
$sDirname = substr($sDBurl, 0, $iPos);
|
||||
$sFilename = substr($sDBurl, $iPos + 1);
|
||||
|
||||
// Check categorys
|
||||
$sql = "SELECT iddbfs FROM " . $cfg['tab']['dbfs'] . " WHERE dirname IN('" . $sDirname . "', '" . clHtmlEntityDecode($sDirname) . "', '" . urldecode($sDirname) . "') AND filename = '" . $sFilename . "'";
|
||||
$db->query($sql);
|
||||
|
||||
if($db->num_rows() == 0) {
|
||||
$aErrors['docimages'][] = array_merge($aSearchIDInfosNonID[$i], array("error_type" => "dbfs"));
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
if(!file_exists($cfgClient[$client]['path']['frontend'] . $aSearchIDInfosNonID[$i]['url'])) {
|
||||
|
||||
if(url_is_image($aSearchIDInfosNonID[$i]['url'])) {
|
||||
$aErrors['docimages'][] = array_merge($aSearchIDInfosNonID[$i], array("error_type" => "unknown"));
|
||||
} else {
|
||||
$aErrors['others'][] = array_merge($aSearchIDInfosNonID[$i], array("error_type" => "unknown"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $aErrors;
|
||||
|
||||
}
|
||||
|
||||
// Searchs front_content.php-links
|
||||
function searchFrontContentLinks($sValue, $iArt, $sArt, $iCat, $sCat) {
|
||||
global $aSearchIDInfosArt, $aSearchIDInfosCat, $aSearchIDInfosCatArt, $aWhitelist;
|
||||
|
||||
// detect urls with parameter idart
|
||||
$matches = array();
|
||||
if (preg_match_all('/(?!file|ftp|http|ww)front_content.php\?idart=([0-9]*)/i', $sValue, $matches)) {
|
||||
for ($i = 0; $i < count($matches[0]); $i++) {
|
||||
if (!in_array($matches[0][$i], $aWhitelist)) {
|
||||
$aSearchIDInfosArt[] = array(
|
||||
"id" => $matches[1][$i], "url" => $matches[0][$i], "idart" => $iArt, "nameart" => $sArt, "idcat" => $iCat, "namecat" => $sCat, "urltype" => "intern"
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// detect urls with parameter idcat
|
||||
$matches = array();
|
||||
if (preg_match_all('/(?!file|ftp|http|ww)front_content.php\?idcat=([0-9]*)/i', $sValue, $matches)) {
|
||||
for ($i = 0; $i < count($matches[0]); $i++) {
|
||||
if (!in_array($matches[0][$i], $aWhitelist)) {
|
||||
$aSearchIDInfosCat[] = array(
|
||||
"id" => $matches[1][$i], "url" => $matches[0][$i], "idart" => $iArt, "nameart" => $sArt, "idcat" => $iCat, "namecat" => $sCat, "urltype" => "intern"
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// detect urls with parameter idcatart
|
||||
$matches = array();
|
||||
if (preg_match_all('/(?!file|ftp|http|ww)front_content.php\?idcatart=([0-9]*)/i', $sValue, $matches)) { // idcatart
|
||||
for ($i = 0; $i < count($matches[0]); $i++) {
|
||||
if (!in_array($matches[0][$i], $aWhitelist)) {
|
||||
$aSearchIDInfosCatArt[] = array(
|
||||
"id" => $matches[1][$i], "url" => $matches[0][$i], "idart" => $iArt, "nameart" => $sArt, "idcat" => $iCat, "namecat" => $sCat, "urltype" => "intern"
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Searchs extern and intern links
|
||||
function searchLinks($sValue, $iArt, $sArt, $iCat, $sCat, $iLang, $sFromtype = "") {
|
||||
global $aUrl, $aSearchIDInfosNonID, $aWhitelist;
|
||||
|
||||
// Extern URL
|
||||
if(preg_match_all('~(?:(?:action|data|href|src)=["\']((?:file|ftp|http|ww)[^\s]*)["\'])~i', $sValue, $aMatches) && $_GET['mode'] != 1) {
|
||||
|
||||
for($i = 0; $i < count($aMatches[1]); $i++) {
|
||||
|
||||
if(!in_array($aMatches[1][$i], $aWhitelist)) {
|
||||
$aSearchIDInfosNonID[] = array("url" => $aMatches[1][$i], "idart" => $iArt, "nameart" => $sArt, "idcat" => $iCat, "namecat" => $sCat, "lang" => $iLang, "urltype" => "extern");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Redirect
|
||||
if($sFromtype == "Redirect" && (preg_match('!(' . preg_quote($aUrl['cms']) . '[^\s]*)!i', $sValue, $aMatches)
|
||||
|| (preg_match('~(?:file|ftp|http|ww)[^\s]*~i', $sValue, $aMatches) && $_GET['mode'] != 1))
|
||||
&& (stripos($sValue, 'front_content.php') === false)
|
||||
&& !in_array($aMatches[0], $aWhitelist)) {
|
||||
$aSearchIDInfosNonID[] = array("url" => $aMatches[0], "idart" => $iArt, "nameart" => $sArt, "idcat" => $iCat, "namecat" => $sCat, "lang" => $iLang, "urltype" => "unknown");
|
||||
}
|
||||
|
||||
// Intern URL
|
||||
if(preg_match_all('~(?:(?:action|data|href|src)=["\'])(?!file://)(?!ftp://)(?!http://)(?!https://)(?!ww)(?!mailto)(?!\#)(?!/\#)([^"\']+)(?:["\'])~i', $sValue, $aMatches) && $_GET['mode'] != 2) {
|
||||
|
||||
for($i = 0; $i < count($aMatches[1]); $i++) {
|
||||
|
||||
if(strpos($aMatches[1][$i], "front_content.php") === false && !in_array($aMatches[1][$i], $aWhitelist)) {
|
||||
$aSearchIDInfosNonID[] = array("url" => $aMatches[1][$i], "idart" => $iArt, "nameart" => $sArt, "idcat" => $iCat, "namecat" => $sCat, "lang" => $iLang, "urltype" => "intern");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
|
@ -1,85 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* Project:
|
||||
* Contenido Content Management System
|
||||
*
|
||||
* Description:
|
||||
* Whitelist for the Linkchecker
|
||||
*
|
||||
* Requirements:
|
||||
* @con_php_req 5.0
|
||||
*
|
||||
*
|
||||
* @package Contenido Backend plugins
|
||||
* @version 2.0.1
|
||||
* @author Frederic Schneider
|
||||
* @copyright four for business AG <www.4fb.de>
|
||||
* @license http://www.contenido.org/license/LIZENZ.txt
|
||||
* @link http://www.4fb.de
|
||||
* @link http://www.contenido.org
|
||||
* @since file available since contenido release 4.8.7
|
||||
*
|
||||
* {@internal
|
||||
* created 2007-11-02
|
||||
* modified 2007-12-13, 2008-05-09, 2008-05-15, Frederic Schneider
|
||||
* modified 2008-06-02, Frederic Schneider, add security fix
|
||||
*
|
||||
* $Id$:
|
||||
* }}
|
||||
*
|
||||
*/
|
||||
|
||||
if(!defined('CON_FRAMEWORK')) {
|
||||
die('Illegal call');
|
||||
}
|
||||
|
||||
$plugin_name = "linkchecker";
|
||||
$iWhitelist_timeout = 2592000; // 30 days
|
||||
global $perm;
|
||||
|
||||
if(!$perm->have_perm_area_action($plugin_name, $plugin_name)) {
|
||||
exit;
|
||||
}
|
||||
|
||||
// Template-definition
|
||||
$tpl->set('s', 'CONTENIDO_URL', $cfg['path']['contenido_fullhtml']);
|
||||
$tpl->set('s', 'SID', $sess->id);
|
||||
|
||||
/* Whitelist: Delete */
|
||||
if(!empty($_GET['url_to_delete'])) {
|
||||
$sql = "DELETE FROM " . $cfg['tab']['whitelist'] . " WHERE url = '" . Contenido_Security::escapeDB(base64_decode($_GET['url_to_delete']), $db) . "'";
|
||||
$db->query($sql);
|
||||
}
|
||||
|
||||
// Get whitelist
|
||||
$sql = "SELECT url, lastview FROM " . $cfg['tab']['whitelist'] . " WHERE lastview < " . (time() + $iWhitelist_timeout) . "
|
||||
AND lastview > " . (time() - $iWhitelist_timeout) . " ORDER BY lastview DESC";
|
||||
$db->query($sql);
|
||||
|
||||
while($db->next_record()) {
|
||||
|
||||
$tpl2 = new Template;
|
||||
$tpl2->reset();
|
||||
|
||||
$tpl2->set('s', 'CONTENIDO_URL', $cfg['path']['contenido_fullhtml']);
|
||||
$tpl2->set('s', 'SID', $sess->id);
|
||||
$tpl2->set('s', 'URL', $db->f("url"));
|
||||
$tpl2->set('s', 'URL_ENCODE', base64_encode($db->f("url")));
|
||||
$tpl2->set('s', 'ENTRY', strftime(i18n('%Y-%m-%d, %I:%M%S %p', $plugin_name), $db->f("lastview")));
|
||||
|
||||
$aWhitelist .= $tpl2->generate($cfg['templates']['linkchecker_whitelist_urls'], 1);
|
||||
|
||||
}
|
||||
|
||||
// Template- and languagevars
|
||||
$tpl->set('s', 'HEADLINE', i18n("Links at whitelist", $plugin_name));
|
||||
$tpl->set('s', 'HEADLINE_DELETE', i18n("Delete", $plugin_name));
|
||||
$tpl->set('s', 'HEADLINE_ENTRY', i18n("Entry", $plugin_name));
|
||||
$tpl->set('s', 'HEADLINE_URLS', i18n("URLs", $plugin_name));
|
||||
$tpl->set('s', 'HELP', i18n("This links are on the whitelist. Whitelist-links won't be check at linkchecker.", $plugin_name));
|
||||
$tpl->set('s', 'TITLE', "Whitelist");
|
||||
$tpl->set('s', 'WHITELIST', $aWhitelist);
|
||||
$tpl->set('s', 'WHITELIST_COUNT', $db->num_rows());
|
||||
|
||||
$tpl->generate($cfg['templates']['linkchecker_whitelist']);
|
||||
?>
|
Binäre Datei nicht angezeigt.
|
@ -1,122 +0,0 @@
|
|||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Contenido Linkchecker\n"
|
||||
"POT-Creation-Date: \n"
|
||||
"PO-Revision-Date: 2008-02-27 10:16+0100\n"
|
||||
"Last-Translator: Frederic Schneider <frederic.schneider@4fb.de>\n"
|
||||
"Language-Team: Frederic Schneider <frederic.schneider@4fb.de>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=iso-8859-1\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Poedit-Language: German\n"
|
||||
"X-Poedit-Country: GERMANY\n"
|
||||
"X-Poedit-Basepath: H:\\frederic.schneider\\\n"
|
||||
"X-Poedit-KeywordsList: i18n\n"
|
||||
"X-Poedit-SearchPath-0: H:\\frederic.schneider\\contenido\\plugins\\linkchecker\\includes\n"
|
||||
|
||||
# H:\frederic.schneider\contenido\plugins\linkchecker\includes/include.linkchecker.php:196
|
||||
#, fuzzy
|
||||
msgid "Link analysis from "
|
||||
msgstr "Link-Analyse vom "
|
||||
|
||||
# H:\frederic.schneider\contenido\plugins\linkchecker\includes/include.linkchecker.php:196
|
||||
msgid "%Y-%m-%d"
|
||||
msgstr "%d.%m.%Y"
|
||||
|
||||
# H:\frederic.schneider\contenido\plugins\linkchecker\includes/include.linkchecker_tests.php:42
|
||||
msgid "<strong>No errors</strong> were found."
|
||||
msgstr "Es wurden <strong>keine Fehler</strong> gefunden."
|
||||
|
||||
# H:\frederic.schneider\contenido\plugins\linkchecker\includes/include.linkchecker.php:227
|
||||
#, fuzzy
|
||||
msgid "Total checked links"
|
||||
msgstr "Insgesamt geprüfte Links"
|
||||
|
||||
# H:\frederic.schneider\contenido\plugins\linkchecker\includes/include.linkchecker_tests.php:24
|
||||
msgid "idart"
|
||||
msgstr "idart"
|
||||
|
||||
# H:\frederic.schneider\contenido\plugins\linkchecker\includes/include.linkchecker_tests.php:30
|
||||
msgid "Article"
|
||||
msgstr "Artikel"
|
||||
|
||||
# H:\frederic.schneider\contenido\plugins\linkchecker\includes/include.linkchecker_tests.php:26
|
||||
msgid "idcat"
|
||||
msgstr "idcat"
|
||||
|
||||
# H:\frederic.schneider\contenido\plugins\linkchecker\includes/include.linkchecker_tests.php:31
|
||||
msgid "Category"
|
||||
msgstr "Kategorie"
|
||||
|
||||
# H:\frederic.schneider\contenido\plugins\linkchecker\includes/include.linkchecker.php:47
|
||||
msgid "Description"
|
||||
msgstr "Beschreibung"
|
||||
|
||||
# H:\frederic.schneider\contenido\plugins\linkchecker\includes/include.linkchecker_tests.php:31
|
||||
msgid "Linkerror"
|
||||
msgstr "Linkfehler"
|
||||
|
||||
# H:\frederic.schneider\contenido\plugins\linkchecker\includes/include.linkchecker_whitelist.php:40
|
||||
msgid "Links to articles"
|
||||
msgstr "Links auf Artikel"
|
||||
|
||||
# H:\frederic.schneider\contenido\plugins\linkchecker\includes/include.linkchecker_whitelist.php:40
|
||||
msgid "Links to categories"
|
||||
msgstr "Links auf Kategorien"
|
||||
|
||||
# H:\frederic.schneider\contenido\plugins\linkchecker\includes/include.linkchecker.php:51
|
||||
msgid "Links to documents and images"
|
||||
msgstr "Links auf Bilder und Dokumente"
|
||||
|
||||
# H:\frederic.schneider\contenido\plugins\linkchecker\includes/include.linkchecker.php:237
|
||||
#, fuzzy
|
||||
msgid "Links to extern sites and not defined links"
|
||||
msgstr "Links auf externe Quellen und nicht zugewiesene Links"
|
||||
|
||||
# H:\frederic.schneider\contenido\plugins\linkchecker\includes/include.linkchecker_tests.php:46
|
||||
msgid "Wrong links"
|
||||
msgstr "Fehlerhafte Links"
|
||||
|
||||
# H:\frederic.schneider\contenido\plugins\linkchecker\includes/include.linkchecker.php:271
|
||||
msgid "Unknown: articles, documents etc. do not exist."
|
||||
msgstr "Unknown: Artikel, Dokumente et cetera existieren nicht."
|
||||
|
||||
# H:\frederic.schneider\contenido\plugins\linkchecker\includes/include.linkchecker.php:273
|
||||
# H:\frederic.schneider\contenido\plugins\linkchecker\includes/include.linkchecker.php:275
|
||||
msgid "Offline: article or category is offline."
|
||||
msgstr "Offline: Artikel oder Kategorie ist offline."
|
||||
|
||||
# H:\frederic.schneider\contenido\plugins\linkchecker\includes/include.linkchecker.php:277
|
||||
msgid "dbfs: no matches found in the dbfs database."
|
||||
msgstr "dbfs: In der dbfs-Datenbank ist die gesuchte Datei nicht vorhanden."
|
||||
|
||||
# H:\frederic.schneider\contenido\plugins\linkchecker\includes/include.linkchecker_tests.php:67
|
||||
msgid "No errors for this type."
|
||||
msgstr "Es wurden für diesen Linktyp keine Fehler gefunden."
|
||||
|
||||
# H:\frederic.schneider\contenido\plugins\linkchecker\includes/include.linkchecker.php:196
|
||||
msgid "%Y-%m-%d, %I:%M%S %p"
|
||||
msgstr "%d.%m.%Y, %H:%M:%S"
|
||||
|
||||
# H:\frederic.schneider\contenido\plugins\linkchecker\includes/include.linkchecker_whitelist.php:40
|
||||
msgid "Links at whitelist"
|
||||
msgstr "Links auf der weißen Liste"
|
||||
|
||||
# H:\frederic.schneider\contenido\plugins\linkchecker\includes/include.linkchecker_whitelist.php:41
|
||||
msgid "Delete"
|
||||
msgstr "Entfernen"
|
||||
|
||||
# H:\frederic.schneider\contenido\plugins\linkchecker\includes/include.linkchecker_whitelist.php:42
|
||||
msgid "Entry"
|
||||
msgstr "Eintragung"
|
||||
|
||||
# H:\frederic.schneider\contenido\plugins\linkchecker\includes/include.linkchecker_whitelist.php:43
|
||||
msgid "URLs"
|
||||
msgstr "Links"
|
||||
|
||||
# H:\frederic.schneider\contenido\plugins\linkchecker\includes/include.linkchecker_whitelist.php:45
|
||||
msgid "This links are on the whitelist. Whitelist-links won't be check at linkchecker."
|
||||
msgstr "Diese Links befinden sich auf der weißen Liste und werden nicht vom Linkchecker überprüft."
|
||||
|
||||
msgid "View whitelist"
|
||||
msgstr "Whitelist anzeigen"
|
|
@ -1,135 +0,0 @@
|
|||
# SOME DESCRIPTIVE TITLE.
|
||||
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
|
||||
# This file is distributed under the same license as the PACKAGE package.
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
||||
#
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2011-05-18 10:59+0200\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=CHARSET\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: includes/include.linkchecker.php:49
|
||||
msgid "No Client selected"
|
||||
msgstr ""
|
||||
|
||||
#: includes/include.linkchecker.php:95
|
||||
msgid "Interns"
|
||||
msgstr ""
|
||||
|
||||
#: includes/include.linkchecker.php:97
|
||||
msgid "Externs"
|
||||
msgstr ""
|
||||
|
||||
#: includes/include.linkchecker.php:99
|
||||
msgid "Intern/extern Links"
|
||||
msgstr ""
|
||||
|
||||
#: includes/include.linkchecker.php:294
|
||||
msgid "Link analysis from "
|
||||
msgstr ""
|
||||
|
||||
#: includes/include.linkchecker.php:294
|
||||
msgid "%Y-%m-%d"
|
||||
msgstr ""
|
||||
|
||||
#: includes/include.linkchecker.php:299
|
||||
msgid "<strong>No errors</strong> were found."
|
||||
msgstr ""
|
||||
|
||||
#: includes/include.linkchecker.php:303
|
||||
msgid "Total checked links"
|
||||
msgstr ""
|
||||
|
||||
#: includes/include.linkchecker.php:304
|
||||
msgid "idart"
|
||||
msgstr ""
|
||||
|
||||
#: includes/include.linkchecker.php:305
|
||||
msgid "Article"
|
||||
msgstr ""
|
||||
|
||||
#: includes/include.linkchecker.php:306
|
||||
msgid "idcat"
|
||||
msgstr ""
|
||||
|
||||
#: includes/include.linkchecker.php:307
|
||||
msgid "Category"
|
||||
msgstr ""
|
||||
|
||||
#: includes/include.linkchecker.php:308
|
||||
msgid "Description"
|
||||
msgstr ""
|
||||
|
||||
#: includes/include.linkchecker.php:309
|
||||
msgid "Linkerror"
|
||||
msgstr ""
|
||||
|
||||
#: includes/include.linkchecker.php:310
|
||||
msgid "Links to articles"
|
||||
msgstr ""
|
||||
|
||||
#: includes/include.linkchecker.php:311
|
||||
msgid "Links to categories"
|
||||
msgstr ""
|
||||
|
||||
#: includes/include.linkchecker.php:312
|
||||
msgid "Links to documents and images"
|
||||
msgstr ""
|
||||
|
||||
#: includes/include.linkchecker.php:313
|
||||
msgid "Links to extern sites and not defined links"
|
||||
msgstr ""
|
||||
|
||||
#: includes/include.linkchecker.php:315
|
||||
msgid "Wrong links"
|
||||
msgstr ""
|
||||
|
||||
#: includes/include.linkchecker.php:344
|
||||
msgid "Unknown: articles, documents etc. do not exist."
|
||||
msgstr ""
|
||||
|
||||
#: includes/include.linkchecker.php:346 includes/include.linkchecker.php:348
|
||||
msgid "Offline: article or category is offline."
|
||||
msgstr ""
|
||||
|
||||
#: includes/include.linkchecker.php:350
|
||||
msgid "dbfs: no matches found in the dbfs database."
|
||||
msgstr ""
|
||||
|
||||
#: includes/include.linkchecker.php:383
|
||||
msgid "No errors for this type."
|
||||
msgstr ""
|
||||
|
||||
#: includes/include.linkchecker_whitelist.php:68
|
||||
msgid "%Y-%m-%d, %I:%M%S %p"
|
||||
msgstr ""
|
||||
|
||||
#: includes/include.linkchecker_whitelist.php:75
|
||||
msgid "Links at whitelist"
|
||||
msgstr ""
|
||||
|
||||
#: includes/include.linkchecker_whitelist.php:76
|
||||
msgid "Delete"
|
||||
msgstr ""
|
||||
|
||||
#: includes/include.linkchecker_whitelist.php:77
|
||||
msgid "Entry"
|
||||
msgstr ""
|
||||
|
||||
#: includes/include.linkchecker_whitelist.php:78
|
||||
msgid "URLs"
|
||||
msgstr ""
|
||||
|
||||
#: includes/include.linkchecker_whitelist.php:79
|
||||
msgid ""
|
||||
"This links are on the whitelist. Whitelist-links won't be check at "
|
||||
"linkchecker."
|
||||
msgstr ""
|
|
@ -1,12 +0,0 @@
|
|||
./includes/include.checkperms.php
|
||||
./includes/include.linkchecker.php
|
||||
./includes/config.plugin.php
|
||||
./includes/include.linkchecker_tests.php
|
||||
./includes/include.linkchecker_whitelist.php
|
||||
./templates/standard/template.linkchecker_test_errors_cat.html
|
||||
./templates/standard/template.linkchecker_whitelist.html
|
||||
./templates/standard/template.linkchecker_noerrors.html
|
||||
./templates/standard/template.linkchecker_test_errors.html
|
||||
./templates/standard/template.linkchecker_test.html
|
||||
./templates/standard/template.linkchecker_test_nothing.html
|
||||
./templates/standard/template.linkchecker_whitelist_urls.html
|
|
@ -1 +0,0 @@
|
|||
|
|
@ -1,36 +0,0 @@
|
|||
<html>
|
||||
|
||||
<head>
|
||||
<title>Linkchecker</title>
|
||||
<link rel="stylesheet" type="text/css" href="styles/contenido.css" />
|
||||
</head>
|
||||
|
||||
<body style="margin:10px">
|
||||
|
||||
<table width="100%" style="border: 1px solid #B5B5B5;" cellspacing="0" cellpadding="3" border="0">
|
||||
<tr class="text_medium" style="height:25px;">
|
||||
<td style="background-color: #E2E2E2; colspan="3">
|
||||
<a href="{INTERNS_HREF}" alt="{INTERNS_LABEL}" title="{INTERNS_LABEL}" style="margin-left:10px;">{INTERNS_LABEL}<img style="vertical-align:middle; margin-left:5px;" src="images/submit.gif" border="0"></a>
|
||||
<a href="{EXTERNS_HREF}" alt="{EXTERNS_LABEL}" title="{EXTERNS_LABEL}" style="margin-left:15px;">{EXTERNS_LABEL}<img style="vertical-align:middle; margin-left:5px;" src="images/submit.gif" border="0"></a>
|
||||
<a href="{INTERNS_EXTERNS_HREF}" alt="{INTERNS_EXTERNS_LABEL}" title="{INTERNS_EXTERNS_LABEL}" style="margin-left:15px;">{INTERNS_EXTERNS_LABEL}<img style="vertical-align:middle; margin-left:5px;" src="images/submit.gif" border="0"></a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<div style="padding-top:10px;"></div>
|
||||
|
||||
<table cellspacing="0" cellpadding="2" border="0">
|
||||
<tr valign="middle">
|
||||
<td><h2>{TITLE}</h2></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding-top:5px; padding-bottom:15px; vertical-align:middle;">
|
||||
<a href="{UPDATE_HREF}"><img src="images/but_refresh.gif" style="margin-right:3px; vertical-align:middle;" title="i18n('Refresh')" alt="i18n('Refresh')"></a>
|
||||
<a href="{UPDATE_HREF}">i18n('Refresh')</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="middle">
|
||||
<td class="text_medium">{NO_ERRORS}</td>
|
||||
</tr>
|
||||
</table>
|
||||
</body></html>
|
|
@ -1,202 +0,0 @@
|
|||
<html>
|
||||
|
||||
<head>
|
||||
<title>Linkchecker</title>
|
||||
<link rel="stylesheet" type="text/css" href="styles/contenido.css" />
|
||||
<link rel="stylesheet" type="text/css" href="styles/tip_balloon.css" />
|
||||
<script type="text/javascript" src="scripts/rowMark.js"></script>
|
||||
<script type="text/javascript" src="scripts/general.js"></script>
|
||||
<script type="text/javascript" src="scripts/browserCheck.js"></script>
|
||||
<script type="text/javascript" src="scripts/cfoldingrow.js"></script>
|
||||
<script type="text/javascript" src="scripts/jquery/jquery.js"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
function toggleTableBody(tableId)
|
||||
{
|
||||
|
||||
var collapseButton = 'images/close_all.gif';
|
||||
var expandButton = 'images/open_all.gif';
|
||||
var curTable = document.getElementById(tableId);
|
||||
var curButton = document.getElementById(tableId+'_img');
|
||||
|
||||
if(curTable.style.display == "inline" || curTable.style.display == "")
|
||||
{
|
||||
curTable.style.display = "none";
|
||||
curButton.src = expandButton;
|
||||
}
|
||||
else if(curTable.style.display == "none")
|
||||
{
|
||||
curTable.style.display = "inline";
|
||||
curButton.src = collapseButton;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body style="margin: 10px">
|
||||
|
||||
<script type="text/javascript" src="scripts/wz_tooltip.js"></script>
|
||||
<script type="text/javascript" src="scripts/tip_balloon.js"></script>
|
||||
|
||||
<a href="javascript:location.reload()" accesskey="s"></a>
|
||||
|
||||
<table width="100%" style="border: 1px solid #B5B5B5;" cellspacing="0" cellpadding="3" border="0">
|
||||
<tr class="text_medium" style="height:25px;line-height:25px;">
|
||||
<td style="background-color: #E2E2E2; colspan="3">
|
||||
<a href="{INTERNS_HREF}" alt="{INTERNS_LABEL}" title="{INTERNS_LABEL}" style="margin-left:10px;">{INTERNS_LABEL}<img style="vertical-align:middle; margin-left:5px;" src="images/submit.gif" border="0"></a>
|
||||
<a href="{EXTERNS_HREF}" alt="{EXTERNS_LABEL}" title="{EXTERNS_LABEL}" style="margin-left:15px;">{EXTERNS_LABEL}<img style="vertical-align:middle; margin-left:5px;" src="images/submit.gif" border="0"></a>
|
||||
<a href="{INTERNS_EXTERNS_HREF}" alt="{INTERNS_EXTERNS_LABEL}" title="{INTERNS_EXTERNS_LABEL}" style="margin-left:15px;">{INTERNS_EXTERNS_LABEL}<img style="vertical-align:middle; margin-left:5px;" src="images/submit.gif" border="0"></a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<div style="padding-top:10px;"></div>
|
||||
|
||||
<table cellspacing="0" cellpadding="2" border="0">
|
||||
<tr valign="middle">
|
||||
<td><h2>{TITLE}</h2></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding-top:5px; padding-bottom:15px; vertical-align:middle;">
|
||||
<a href="{UPDATE_HREF}"><img src="images/but_refresh.gif" style="margin-right:3px; vertical-align:middle;" title="i18n('Refresh')" alt="i18n('Refresh')"></a>
|
||||
<a href="{UPDATE_HREF}">i18n('Refresh')</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<table width="100%" style="border-left: 1px solid #B5B5B5;" cellspacing="0" cellpadding="3" border="0">
|
||||
<tr class="text_medium">
|
||||
<td style="background-color: #CCCCCC; border: 1px solid #B5B5B5; border-left: 0px; width: 20%;">{ERRORS_HEADLINE}:</td>
|
||||
<td style="background-color: #E2E2E2; border: 1px solid #B5B5B5; border-left: 0px; border-right: 0px; width: 10%;">{ERRORS_COUNT_CHECKED}
|
||||
<td style="background-color: #E2E2E2; border: 1px solid #B5B5B5; border-left: 0px; width: 70%;">{ERRORS_HELP_ERRORS}: <span style="color: #FF0000;">{ERRORS_COUNT_ERRORS} ({ERRORS_COUNT_ERRORS_PERCENT} %)</span></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
||||
<div style="margin-top: 20px"></div>
|
||||
|
||||
|
||||
<table width="100%" style="border-left: 1px solid #B5B5B5;" cellspacing="0" cellpadding="3" border="0">
|
||||
<tr class="text_medium" style="background-color: #E2E2E2;">
|
||||
<td nowrap="nowrap" valign="top" style="color: #666666; border: 1px solid #B5B5B5; border-left: 0px; white-space:nowrap; width: 20%;"><a style="color: #666666;" href="{URL}main.php?area=linkchecker&frame=4&contenido={SID}&action=linkchecker&mode={MODE}&sort=nameart">{ERRORS_HEADLINE_ARTICLE}</a> (ID)</td>
|
||||
<td nowrap="nowrap" valign="top" style="color: #666666; border: 1px solid #B5B5B5; border-left: 0px; white-space:nowrap; width: 20%;"><a style="color: #666666;" href="{URL}main.php?area=linkchecker&frame=4&contenido={SID}&action=linkchecker&mode={MODE}&sort=namecat">{ERRORS_HEADLINE_CATNAME}</a> (ID)</td>
|
||||
<td nowrap="nowrap" valign="top" style="color: #666666; border: 1px solid #B5B5B5; border-left: 0px; white-space:nowrap; width: 40%;"><a style="color: #666666;" href="{URL}main.php?area=linkchecker&frame=4&contenido={SID}&action=linkchecker&mode={MODE}&sort=wronglink">{ERRORS_HEADLINE_LINK}</a></td>
|
||||
<td nowrap="nowrap" valign="top" style="color: #666666; border: 1px solid #B5B5B5; border-left: 0px; white-space:nowrap; width: 10%;"><a style="color: #666666;" href="{URL}main.php?area=linkchecker&frame=4&contenido={SID}&action=linkchecker&mode={MODE}&sort=error_type">{ERRORS_HEADLINE_DESCRIPTION}</a></td>
|
||||
<td nowrap="nowrap" valign="top" style="color: #666666; border: 1px solid #B5B5B5; border-left: 0px; white-space:nowrap; text-align: center; width: 10%;">{ERRORS_HEADLINE_WHITELIST}</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
||||
<div style="margin-top: 10px"></div>
|
||||
|
||||
|
||||
<!-- ######################### -->
|
||||
<!-- ### Links to Articles ### -->
|
||||
<!-- ######################### -->
|
||||
<div style="margin-bottom: 10px">
|
||||
<!-- Table Head -->
|
||||
<table width="100%" style="border: 1px solid #B5B5B5;background-color: #F1F1F1;">
|
||||
<tr>
|
||||
<td>
|
||||
<strong>{ERRORS_HEADLINE_LINKS_ARTICLES}</strong> ({ERRORS_COUNT_ERRORS_ART})
|
||||
</td>
|
||||
<td align="center" style="padding:0;width:22px;">
|
||||
<a href="#" onclick="javascript:toggleTableBody('{ID_LINKS_ARTICLES}')" style="height:1em;line-height:1em;width:100%;height:100%;display:block;"><img style="padding-top:5px" src="images/close_all.gif" id = "{ID_LINKS_ARTICLES}_img"></a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<!-- Table Body -->
|
||||
<div id="{ID_LINKS_ARTICLES}">
|
||||
<table width="100%" style="border: 1px solid #B5B5B5;border-top:none;" cellspacing="0" cellpadding="3" border="0">
|
||||
{ERRORS_SHOW_ART}
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- ##################################### -->
|
||||
<!-- ### Links to Documents and Images ### -->
|
||||
<!-- ##################################### -->
|
||||
<div style="margin-bottom: 10px">
|
||||
<!-- Table Head -->
|
||||
<table width="100%" style="border: 1px solid #B5B5B5;background-color: #F1F1F1;">
|
||||
<tr >
|
||||
<td>
|
||||
<strong>{ERRORS_HEADLINE_LINKS_DOCIMAGES}</strong> ({ERRORS_COUNT_ERRORS_DOCIMAGES})
|
||||
</td>
|
||||
<td align="center" style="padding:0;width:22px;">
|
||||
<a href="#" onclick="javascript:toggleTableBody('{ID_LINKS_DOCSIMGS}')" style="height:1em;line-height:1em;width:100%;height:100%;display:block;"><img style="padding-top:5px" src="images/close_all.gif" id = "{ID_LINKS_DOCSIMGS}_img"></a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<!-- Table Body -->
|
||||
<div id="{ID_LINKS_DOCSIMGS}">
|
||||
<table width="100%" style="border: 1px solid #B5B5B5;border-top:none;" cellspacing="0" cellpadding="3" border="0">
|
||||
{ERRORS_SHOW_DOCIMAGES}
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- ############################### -->
|
||||
<!-- ### Links to external sites ### -->
|
||||
<!-- ############################### -->
|
||||
<div style="margin-bottom: 20px">
|
||||
<!-- Table Head -->
|
||||
<table width="100%" style="border: 1px solid #B5B5B5;background-color: #F1F1F1;">
|
||||
<tr >
|
||||
<td>
|
||||
<strong>{ERRORS_HEADLINE_OTHERS}</strong> ({ERRORS_COUNT_ERRORS_OTHERS})
|
||||
</td>
|
||||
<td align="center" style="padding:0;width:22px;">
|
||||
<a href="#" onclick="javascript:toggleTableBody('{ID_LINKS_EXTERNAL}')" style="height:1em;line-height:1em;width:100%;height:100%;display:block;"><img style="padding-top:5px" src="images/close_all.gif" id = "{ID_LINKS_EXTERNAL}_img"></a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<!-- Table Body -->
|
||||
<div id="{ID_LINKS_EXTERNAL}">
|
||||
<table width="100%" style="border: 1px solid #B5B5B5;border-top:none;" cellspacing="0" cellpadding="3" border="0">
|
||||
{ERRORS_SHOW_OTHERS}
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<table width="100%" style="border-left: 1px solid #B5B5B5;" cellspacing="0" cellpadding="3" border="0">
|
||||
<tr class="text_medium" style="background-color: #E2E2E2;">
|
||||
<td nowrap="nowrap" valign="top" style="color: #666666; border: 1px solid #B5B5B5; border-left: 0px; white-space:nowrap; width: 20%;"><a style="color: #666666;" href="{URL}main.php?area=linkchecker&frame=4&contenido={SID}&action=linkchecker&mode={MODE}&sort=namecat">{ERRORS_HEADLINE_CATNAME}</a> (ID)</td>
|
||||
<td nowrap="nowrap" valign="top" style="color: #666666; border: 1px solid #B5B5B5; border-left: 0px; white-space:nowrap; width: 20%;"><a style="color: #666666;" href="{URL}main.php?area=linkchecker&frame=4&contenido={SID}&action=linkchecker&mode={MODE}&sort=nameart">{ERRORS_HEADLINE_ARTICLE}</a> (ID)</td>
|
||||
<td nowrap="nowrap" valign="top" style="color: #666666; border: 1px solid #B5B5B5; border-left: 0px; white-space:nowrap; width: 40%;"><a style="color: #666666;" href="{URL}main.php?area=linkchecker&frame=4&contenido={SID}&action=linkchecker&mode={MODE}&sort=wronglink">{ERRORS_HEADLINE_LINK}</a></td>
|
||||
<td nowrap="nowrap" valign="top" style="color: #666666; border: 1px solid #B5B5B5; border-left: 0px; white-space:nowrap; width: 10%;"><a style="color: #666666;" href="{URL}main.php?area=linkchecker&frame=4&contenido={SID}&action=linkchecker&mode={MODE}&sort=error_type">{ERRORS_HEADLINE_DESCRIPTION}</a></td>
|
||||
<td nowrap="nowrap" valign="top" style="color: #666666; border: 1px solid #B5B5B5; border-left: 0px; white-space:nowrap; text-align: center; width: 10%;">{ERRORS_HEADLINE_WHITELIST}</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
||||
<!-- ########################### -->
|
||||
<!-- ### Links to Categories ### -->
|
||||
<!-- ########################### -->
|
||||
<div style="margin-top: 10px; margin-bottom: 10px;">
|
||||
<!-- Table Head -->
|
||||
<table width="100%" style="border: 1px solid #B5B5B5;background-color: #F1F1F1;">
|
||||
<tr >
|
||||
<td>
|
||||
<strong>{ERRORS_HEADLINE_LINKS_CATEGORYS}</strong> ({ERRORS_COUNT_ERRORS_CAT})
|
||||
</td>
|
||||
<td align="center" style="padding:0;width:22px;">
|
||||
<a href="#" onclick="javascript:toggleTableBody('{ID_LINKS_CATEGORIES}')" style="height:1em;line-height:1em;width:100%;height:100%;display:block;"><img style="padding-top:5px" src="images/close_all.gif" id = "{ID_LINKS_CATEGORIES}_img"></a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<!-- Table Body -->
|
||||
<div id="{ID_LINKS_CATEGORIES}">
|
||||
<table width="100%" style="border: 1px solid #B5B5B5;border-top:none;" cellspacing="0" cellpadding="3" border="0">
|
||||
{ERRORS_SHOW_CAT}
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Print Button -->
|
||||
<a style="margin-left:3px;" href="javascript:print()"><img src="{URL}images/print.gif" alt="" border="0"></a>
|
||||
|
||||
</body></html>
|
|
@ -1,7 +0,0 @@
|
|||
<tr class="text_medium" style="background-color: #FFFFFF;" onmouseover="row.over(this)" onmouseout="row.out(this)" onclick="row.click(this)">
|
||||
<td valign="top" style="border: 0px; border-right: 1px; border-color: #B5B5B5; border-style: solid; width: 20%;" onmouseover="Tip('{ERRORS_ARTICLE}', BALLOON, true, ABOVE, true);"><a href="javascript://" onclick="javascript:conMultiLink('right_top', 'main.php?area=con&frame=3&idcat={ERRORS_CATID}&idtpl=1&contenido={SID}', 'right_bottom', 'main.php?area=con_editcontent&action=con_editart&frame=4&idart={ERRORS_ARTID}&idcat={ERRORS_CATID}&idtpl=1&contenido={SID}', 'simpleFrame')">{ERRORS_ARTICLE_SHORT}</a> ({ERRORS_ARTID})</td>
|
||||
<td valign="top" style="border: 0px; border-right: 1px; border-color: #B5B5B5; border-style: solid; width: 20%;" onmouseover="Tip('{ERRORS_CATNAME}', BALLOON, true, ABOVE, true);">{ERRORS_CATNAME_SHORT} ({ERRORS_CATID})</td>
|
||||
<td valign="top" style="border: 0px; border-right: 1px; border-color: #B5B5B5; border-style: solid; width: 40%;" onmouseover="Tip('{ERRORS_LINK}', BALLOON, true, ABOVE, true);">{ERRORS_LINK_SHORT}</td>
|
||||
<td valign="top" style="border: 0px; border-right: 1px; border-color: #B5B5B5; border-style: solid; width: 10%;" onmouseover="Tip('{ERRORS_ERROR_TYPE_HELP}', BALLOON, true, ABOVE, true);">{ERRORS_ERROR_TYPE}</td>
|
||||
<td valign="top" style="border: 0px; border-right: 0px; border-color: #B5B5B5; border-style: solid; padding-right:5px; text-align: right; width: 10%;"><a href="{URL}main.php?area=linkchecker&frame=4&contenido={SID}&action=linkchecker&mode={MODE}&whitelist={ERRORS_LINK_ENCODE}"><img src="{URL}images/folder_new.gif" alt="" border="0" /></a></td>
|
||||
</tr>
|
|
@ -1,7 +0,0 @@
|
|||
<tr class="text_medium" style="background-color: #FFFFFF;" onmouseover="row.over(this)" onmouseout="row.out(this)" onclick="row.click(this)">
|
||||
<td valign="top" style="border: 0px; border-right: 1px; border-color: #B5B5B5; border-style: solid; width: 20%;" onmouseover="Tip('{ERRORS_CATNAME}', BALLOON, true, ABOVE, true);"><a href="javascript://" onclick="javascript:conMultiLink('right_top', 'main.php?area=con&frame=3&idcat={ERRORS_CATID}&idtpl=1&contenido={SID}', 'right_bottom', 'main.php?area=con&frame=4&idcat={ERRORS_CATID}&idtpl=1&contenido={SID}', 'simpleFrame')">{ERRORS_CATNAME_SHORT}</a> ({ERRORS_CATID})</td>
|
||||
<td valign="top" style="border: 0px; border-right: 1px; border-color: #B5B5B5; border-style: solid; width: 20%;" onmouseover="Tip('{ERRORS_ARTICLE}', BALLOON, true, ABOVE, true);">{ERRORS_ARTICLE_SHORT} ({ERRORS_ARTID})</td>
|
||||
<td valign="top" style="border: 0px; border-right: 1px; border-color: #B5B5B5; border-style: solid; width: 40%;" onmouseover="Tip('{ERRORS_LINK}', BALLOON, true, ABOVE, true);">{ERRORS_LINK_SHORT}</td>
|
||||
<td valign="top" style="border: 0px; border-right: 1px; border-color: #B5B5B5; border-style: solid; width: 10%;" onmouseover="Tip('{ERRORS_ERROR_TYPE_HELP}', BALLOON, true, ABOVE, true);">{ERRORS_ERROR_TYPE}</td>
|
||||
<td valign="top" style="border: 0px; border-right: 0px; border-color: #B5B5B5; border-style: solid; padding-right: 5px; text-align: right; width: 10%;"><a href="{URL}main.php?area=linkchecker&frame=4&contenido={SID}&mode={MODE}&whitelist={ERRORS_LINK_ENCODE}"><img src="{URL}images/folder_new.gif" alt="" border="0" /></a></td>
|
||||
</tr>
|
|
@ -1,3 +0,0 @@
|
|||
<tr class="text_medium" style="background-color: #FFFFFF;">
|
||||
<td colspan="6" valign="top" style="border: 0px; border-right: 0px; border-color: #B3B3B3; border-style: solid;">{ERRORS_NOTHING}</td>
|
||||
</tr>
|
|
@ -1,51 +0,0 @@
|
|||
<html>
|
||||
|
||||
<head>
|
||||
<title>Linkchecker</title>
|
||||
<link rel="stylesheet" type="text/css" href="styles/contenido.css" />
|
||||
<script type="text/javascript" src="scripts/rowMark.js"></script>
|
||||
<script type="text/javascript" src="scripts/general.js"></script>
|
||||
</head>
|
||||
|
||||
<body style="margin: 10px">
|
||||
|
||||
<a href="javascript:location.reload()" accesskey="s"></a>
|
||||
|
||||
<table cellspacing="0" cellpadding="2" border="0">
|
||||
<tr valign="middle">
|
||||
<td><h2>{TITLE}</h2></td>
|
||||
</tr>
|
||||
<tr valign="middle">
|
||||
<td class="text_medium">{HELP}</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<div style="margin-top: 5px"></div>
|
||||
|
||||
<table width="100%" style="border-left: 1px solid #B5B5B5;" cellspacing="0" cellpadding="3" border="0">
|
||||
|
||||
<tr class="text_medium" style="background-color: #E2E2E2;">
|
||||
<td nowrap="nowrap" valign="top" style="border: 1px solid #B5B5B5; border-left: 0px; white-space:nowrap; width: 75%;"><strong>{HEADLINE_URLS}</strong> ({WHITELIST_COUNT})</td>
|
||||
<td nowrap="nowrap" valign="top" style="border: 1px solid #B5B5B5; border-left: 0px; white-space:nowrap; width: 15%; text-align: center;"><strong>{HEADLINE_ENTRY}</strong></td>
|
||||
<td nowrap="nowrap" valign="top" style="border: 1px solid #B5B5B5; border-left: 0px; white-space:nowrap; width: 10%;"><strong>{HEADLINE_DELETE}</strong></td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
<div style="margin-top: 10px"></div>
|
||||
|
||||
<table width="100%" style="border: 1px solid #B5B5B5; border-top: 0px;" cellspacing="0" cellpadding="3" border="0">
|
||||
|
||||
{WHITELIST}
|
||||
|
||||
</table>
|
||||
|
||||
<div style="margin-top: 10px"></div>
|
||||
|
||||
<table width="100%" cellspacing="0" cellpadding="3" border="0">
|
||||
<tr>
|
||||
<td style="text-align: left;"><a href="javascript:print()"><img src="{CONTENIDO_URL}images/print.gif" alt="" border="0"></a></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</body></html>
|
|
@ -1,5 +0,0 @@
|
|||
<tr class="text_medium" style="background-color: #FFFFFF;" onmouseover="row.over(this)" onmouseout="row.out(this)" onclick="row.click(this)">
|
||||
<td valign="top" style="border: 0px; border-top: 1px; border-right: 1px; border-color: #B5B5B5; border-style: solid; width: 75%;">{URL}</td>
|
||||
<td valign="top" style="border: 0px; border-top: 1px; border-right: 1px; border-color: #B5B5B5; border-style: solid; width: 15%; text-align: center;">{ENTRY}</td>
|
||||
<td valign="top" style="border: 0px; border-top: 1px; border-right: 0px; border-color: #B5B5B5; border-style: solid; width: 10%; text-align: right;"><a href="{CONTENIDO_URL}main.php?area=lc_whitelist&frame=4&contenido={SID}&action=linkchecker&url_to_delete={URL_ENCODE}"><img src="{CONTENIDO_URL}images/delete_over.gif" alt="" border="0"></a></td>
|
||||
</tr>
|
|
@ -1,14 +0,0 @@
|
|||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<!-- Contenido XML language file -->
|
||||
<language>
|
||||
<navigation>
|
||||
<content>
|
||||
<linkchecker>
|
||||
<main>Linkchecker</main>
|
||||
<test>Linkanalyse</test>
|
||||
<whitelist>Whitelist</whitelist>
|
||||
<overview>Übersicht</overview>
|
||||
</linkchecker>
|
||||
</content>
|
||||
</navigation>
|
||||
</language>
|
|
@ -1,14 +0,0 @@
|
|||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<!-- Contenido XML language file -->
|
||||
<language>
|
||||
<navigation>
|
||||
<content>
|
||||
<linkchecker>
|
||||
<main>Linkchecker</main>
|
||||
<test>Link Analysis</test>
|
||||
<whitelist>Whitelist</whitelist>
|
||||
<overview>Overview</overview>
|
||||
</linkchecker>
|
||||
</content>
|
||||
</navigation>
|
||||
</language>
|
|
@ -1,14 +0,0 @@
|
|||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<!-- Contenido XML language file -->
|
||||
<language>
|
||||
<navigation>
|
||||
<content>
|
||||
<linkchecker>
|
||||
<main>Linkchecker</main>
|
||||
<test>Link Analysis</test>
|
||||
<whitelist>Whitelist</whitelist>
|
||||
<overview>Overview</overview>
|
||||
</linkchecker>
|
||||
</content>
|
||||
</navigation>
|
||||
</language>
|
Datei-Diff unterdrückt, da er zu groß ist
Diff laden
|
@ -1,87 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* AMR base Mod Rewrite class
|
||||
*
|
||||
* @package plugin
|
||||
* @subpackage Mod Rewrite
|
||||
* @version SVN Revision $Rev$
|
||||
* @id $Id$:
|
||||
* @author Murat Purc <murat@purc.de>
|
||||
* @copyright four for business AG <www.4fb.de>
|
||||
* @license http://www.contenido.org/license/LIZENZ.txt
|
||||
* @link http://www.4fb.de
|
||||
* @link http://www.contenido.org
|
||||
*/
|
||||
|
||||
if (!defined('CON_FRAMEWORK')) {
|
||||
die('Illegal call');
|
||||
}
|
||||
|
||||
/**
|
||||
* Abstract base mod rewrite class.
|
||||
*
|
||||
* Provides some common features such as common debugging, globals/configuration
|
||||
* access for childs.
|
||||
*
|
||||
* @author Murat Purc <murat@purc.de>
|
||||
* @package plugin
|
||||
* @subpackage Mod Rewrite
|
||||
*/
|
||||
abstract class ModRewriteBase {
|
||||
|
||||
/**
|
||||
* Initialization, is to call at least once by an child.
|
||||
* @deprecated
|
||||
*/
|
||||
protected static function initialize($clientId) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns enabled state of mod rewrite plugin
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function isEnabled() {
|
||||
return (self::getConfig('use', 0) == 1) ? true : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the enabled state of mod rewrite plugin
|
||||
*
|
||||
* @param bool $bEnabled
|
||||
*/
|
||||
public static function setEnabled($bEnabled) {
|
||||
self::setConfig('use', (bool) $bEnabled);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns configuration of mod rewrite, content of gobal $cfg['mod_rewrite']
|
||||
*
|
||||
* @param string $key Name of configuration key
|
||||
* @param mixed $default Default value to return as a fallback
|
||||
* @return mixed Desired value mr configuration, either the full configuration
|
||||
* or one of the desired subpart
|
||||
*/
|
||||
public static function getConfig($key = null, $default = null) {
|
||||
global $cfg;
|
||||
if ($key == null) {
|
||||
return $cfg['mod_rewrite'];
|
||||
} elseif ((string) $key !== '') {
|
||||
return (isset($cfg['mod_rewrite'][$key])) ? $cfg['mod_rewrite'][$key] : $default;
|
||||
} else {
|
||||
return $default;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the configuration of mod rewrite, content of gobal $cfg['mod_rewrite']
|
||||
*
|
||||
* @param string $key Name of configuration key
|
||||
* @param mixed $value The value to set
|
||||
*/
|
||||
public static function setConfig($key, $value) {
|
||||
global $cfg;
|
||||
$cfg['mod_rewrite'][$key] = $value;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,678 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* AMR controller class
|
||||
*
|
||||
* @package plugin
|
||||
* @subpackage Mod Rewrite
|
||||
* @version SVN Revision $Rev$
|
||||
* @id $Id$:
|
||||
* @author Murat Purc <murat@purc.de>
|
||||
* @copyright four for business AG <www.4fb.de>
|
||||
* @license http://www.contenido.org/license/LIZENZ.txt
|
||||
* @link http://www.4fb.de
|
||||
* @link http://www.contenido.org
|
||||
*/
|
||||
|
||||
if (!defined('CON_FRAMEWORK')) {
|
||||
die('Illegal call');
|
||||
}
|
||||
|
||||
/**
|
||||
* Mod Rewrite controller class. Extracts url parts and sets some necessary globals like:
|
||||
* - $idart
|
||||
* - $idcat
|
||||
* - $client
|
||||
* - $changeclient
|
||||
* - $lang
|
||||
* - $changelang
|
||||
*
|
||||
* @author Murat Purc <murat@purc.de>
|
||||
* @package plugin
|
||||
* @subpackage Mod Rewrite
|
||||
*/
|
||||
class ModRewriteController extends ModRewriteBase {
|
||||
// Error constants
|
||||
|
||||
const ERROR_CLIENT = 1;
|
||||
const ERROR_LANGUAGE = 2;
|
||||
const ERROR_CATEGORY = 3;
|
||||
const ERROR_ARTICLE = 4;
|
||||
const ERROR_POST_VALIDATION = 5;
|
||||
const FRONT_CONTENT = 'front_content.php';
|
||||
|
||||
/**
|
||||
* Extracted request uri path parts by path separator '/'
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $_aParts;
|
||||
|
||||
/**
|
||||
* Extracted article name from request uri
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_sArtName;
|
||||
|
||||
/**
|
||||
* Remaining path for path resolver (see $GLOBALS['path'])
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_sPath;
|
||||
|
||||
/**
|
||||
* Incomming URL
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_sIncommingUrl;
|
||||
|
||||
/**
|
||||
* Resolved URL
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_sResolvedUrl;
|
||||
|
||||
/**
|
||||
* Client id used by this class
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private $_iClientMR;
|
||||
|
||||
/**
|
||||
* Language id used by this class
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private $_iLangMR;
|
||||
|
||||
/**
|
||||
* Flag about occured errors
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
private $_bError = false;
|
||||
|
||||
/**
|
||||
* One of ERROR_* constants or 0
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private $_iError = 0;
|
||||
|
||||
/**
|
||||
* Flag about found routing definition
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
private $_bRoutingFound = false;
|
||||
|
||||
/**
|
||||
* Constructor, sets several properties.
|
||||
*
|
||||
* @param string $incommingUrl Incomming URL
|
||||
*/
|
||||
public function __construct($incommingUrl) {
|
||||
|
||||
// CON-1266 make incomming URL lowercase if option "URLS to
|
||||
// lowercase" is set
|
||||
if (1 == $this->getConfig('use_lowercase_uri')) {
|
||||
$incommingUrl = strtolower($incommingUrl);
|
||||
}
|
||||
|
||||
$this->_sIncommingUrl = $incommingUrl;
|
||||
$this->_aParts = array();
|
||||
$this->_sArtName = '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for overwritten client id (see $GLOBALS['client'])
|
||||
*
|
||||
* @return int Client id
|
||||
*/
|
||||
public function getClient() {
|
||||
return $GLOBALS['client'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for overwritten change client id (see $GLOBALS['changeclient'])
|
||||
*
|
||||
* @return int Change client id
|
||||
*/
|
||||
public function getChangeClient() {
|
||||
return $GLOBALS['changeclient'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for article id (see $GLOBALS['idart'])
|
||||
*
|
||||
* @return int Article id
|
||||
*/
|
||||
public function getIdArt() {
|
||||
return $GLOBALS['idart'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for category id (see $GLOBALS['idcat'])
|
||||
*
|
||||
* @return int Category id
|
||||
*/
|
||||
public function getIdCat() {
|
||||
return $GLOBALS['idcat'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for language id (see $GLOBALS['lang'])
|
||||
*
|
||||
* @return int Language id
|
||||
*/
|
||||
public function getLang() {
|
||||
return $GLOBALS['lang'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for change language id (see $GLOBALS['changelang'])
|
||||
*
|
||||
* @return int Change language id
|
||||
*/
|
||||
public function getChangeLang() {
|
||||
return $GLOBALS['changelang'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for path (see $GLOBALS['path'])
|
||||
*
|
||||
* @return string Path, used by path resolver
|
||||
*/
|
||||
public function getPath() {
|
||||
return $this->_sPath;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for resolved url
|
||||
*
|
||||
* @return string Resolved url
|
||||
*/
|
||||
public function getResolvedUrl() {
|
||||
return $this->_sResolvedUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a flag about found routing definition
|
||||
*
|
||||
* return bool Flag about found routing
|
||||
*/
|
||||
public function getRoutingFoundState() {
|
||||
return $this->_bRoutingFound;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for occured error state
|
||||
*
|
||||
* @return bool Flag for occured error
|
||||
*/
|
||||
public function errorOccured() {
|
||||
return $this->_bError;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for occured error state
|
||||
*
|
||||
* @return int Numeric error code
|
||||
*/
|
||||
public function getError() {
|
||||
return $this->_iError;
|
||||
}
|
||||
|
||||
/**
|
||||
* Main function to call for mod rewrite related preprocessing jobs.
|
||||
*
|
||||
* Executes some private functions to extract request URI and to set needed membervariables
|
||||
* (client, language, article id, category id, etc.)
|
||||
*/
|
||||
public function execute() {
|
||||
if (parent::isEnabled() == false) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->_extractRequestUri();
|
||||
|
||||
$this->_initializeClientId();
|
||||
|
||||
$this->_setClientId();
|
||||
|
||||
mr_loadConfiguration($this->_iClientMR);
|
||||
|
||||
$this->_setLanguageId();
|
||||
|
||||
// second call after setting client and language
|
||||
$this->_extractRequestUri(true);
|
||||
|
||||
$this->_setPathresolverSetting();
|
||||
|
||||
$this->_setIdart();
|
||||
|
||||
ModRewriteDebugger::add($this->_aParts, 'ModRewriteController::execute() _setIdart');
|
||||
|
||||
$this->_postValidation();
|
||||
}
|
||||
|
||||
/**
|
||||
* Extracts request URI and sets member variables $this->_sArtName and $this->_aParts
|
||||
*
|
||||
* @param bool $secondCall Flag about second call of this function, is needed
|
||||
* to re extract url if a routing definition was found
|
||||
*/
|
||||
private function _extractRequestUri($secondCall = false) {
|
||||
global $client;
|
||||
|
||||
// get REQUEST_URI
|
||||
$requestUri = $_SERVER['REQUEST_URI'];
|
||||
// CON-1266 make request URL lowercase if option "URLS to
|
||||
// lowercase" is set
|
||||
if (1 == $this->getConfig('use_lowercase_uri')) {
|
||||
$requestUri = strtolower($requestUri);
|
||||
}
|
||||
|
||||
// check for defined rootdir
|
||||
if (parent::getConfig('rootdir') !== '/' && strpos($requestUri, $this->_sIncommingUrl) === 0) {
|
||||
$this->_sIncommingUrl = str_replace(parent::getConfig('rootdir'), '/', $this->_sIncommingUrl);
|
||||
}
|
||||
|
||||
$aUrlComponents = $this->_parseUrl($this->_sIncommingUrl);
|
||||
if (isset($aUrlComponents['path'])) {
|
||||
if (parent::getConfig('rootdir') !== '/' && strpos($aUrlComponents['path'], parent::getConfig('rootdir')) === 0) {
|
||||
$aUrlComponents['path'] = str_replace(parent::getConfig('rootdir'), '/', $aUrlComponents['path']);
|
||||
}
|
||||
|
||||
if ($secondCall == true) {
|
||||
|
||||
// @todo: implement real redirect of old front_content.php style urls
|
||||
// check for routing definition
|
||||
$routings = parent::getConfig('routing');
|
||||
if (is_array($routings) && isset($routings[$aUrlComponents['path']])) {
|
||||
$aUrlComponents['path'] = $routings[$aUrlComponents['path']];
|
||||
if (strpos($aUrlComponents['path'], self::FRONT_CONTENT) !== false) {
|
||||
// routing destination contains front_content.php
|
||||
|
||||
$this->_bRoutingFound = true;
|
||||
|
||||
// set client language, if not set before
|
||||
mr_setClientLanguageId($client);
|
||||
|
||||
//rebuild URL
|
||||
$url = mr_buildNewUrl($aUrlComponents['path']);
|
||||
|
||||
$aUrlComponents = $this->_parseUrl($url);
|
||||
|
||||
// add query parameter to superglobal _GET
|
||||
if (isset($aUrlComponents['query'])) {
|
||||
$vars = null;
|
||||
parse_str($aUrlComponents['query'], $vars);
|
||||
$_GET = array_merge($_GET, $vars);
|
||||
}
|
||||
|
||||
$this->_aParts = array();
|
||||
}
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
$aPaths = explode('/', $aUrlComponents['path']);
|
||||
foreach ($aPaths as $p => $item) {
|
||||
if (!empty($item)) {
|
||||
// pathinfo would also work
|
||||
$arr = explode('.', $item);
|
||||
$count = count($arr);
|
||||
if ($count > 0 && '.' . strtolower($arr[$count - 1]) == parent::getConfig('file_extension')) {
|
||||
array_pop($arr);
|
||||
$this->_sArtName = trim(implode('.', $arr));
|
||||
} else {
|
||||
$this->_aParts[] = $item;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($secondCall == true) {
|
||||
// reprocess extracting client and language
|
||||
$this->_setClientId();
|
||||
mr_loadConfiguration($this->_iClientMR);
|
||||
$this->_setLanguageId();
|
||||
}
|
||||
}
|
||||
ModRewriteDebugger::add($this->_aParts, 'ModRewriteController::_extractRequestUri() $this->_aParts');
|
||||
|
||||
// loop parts array and remove existing 'front_content.php'
|
||||
if ($this->_hasPartArrayItems()) {
|
||||
foreach ($this->_aParts as $p => $item) {
|
||||
if ($item == self::FRONT_CONTENT) {
|
||||
unset($this->_aParts[$p]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Tries to initialize the client id.
|
||||
* This is required to load the proper plugin configuration for current client.
|
||||
*/
|
||||
private function _initializeClientId() {
|
||||
global $client, $changeclient, $load_client;
|
||||
|
||||
$iClient = (isset($client) && (int) $client > 0) ? $client : 0;
|
||||
$iChangeClient = (isset($changeclient) && (int) $changeclient > 0) ? $changeclient : 0;
|
||||
$iLoadClient = (isset($load_client) && (int) $load_client > 0) ? $load_client : 0;
|
||||
|
||||
$this->_iClientMR = 0;
|
||||
if ($iClient > 0 && $iChangeClient == 0) {
|
||||
$this->_iClientMR = $iClient;
|
||||
} elseif ($iChangeClient > 0) {
|
||||
$this->_iClientMR = $iChangeClient;
|
||||
} else {
|
||||
$this->_iClientMR = $iLoadClient;
|
||||
}
|
||||
|
||||
if ((int) $this->_iClientMR > 0) {
|
||||
// set global client variable
|
||||
$client = (int) $this->_iClientMR;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Tries to initialize the language id.
|
||||
*/
|
||||
private function _initializeLanguageId() {
|
||||
global $lang, $changelang, $load_lang;
|
||||
|
||||
$iLang = (isset($lang) && (int) $lang > 0) ? $lang : 0;
|
||||
$iChangeLang = (isset($changelang) && (int) $changelang > 0) ? $changelang : 0;
|
||||
$iLoadLang = (isset($load_lang) && (int) $load_lang > 0) ? $load_lang : 0;
|
||||
|
||||
$this->_iLangMR = 0;
|
||||
if ($iLang > 0 && $iChangeLang == 0) {
|
||||
$this->_iLangMR = $iLang;
|
||||
} elseif ($iChangeLang > 0) {
|
||||
$this->_iLangMR = $iChangeLang;
|
||||
} else {
|
||||
$this->_iLangMR = $iLoadLang;
|
||||
}
|
||||
|
||||
if ((int) $this->_iLangMR > 0) {
|
||||
// set global lang variable
|
||||
$lang = (int) $this->_iLangMR;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Detects client id from given url
|
||||
*/
|
||||
private function _setClientId() {
|
||||
global $client;
|
||||
|
||||
if ($this->_bError) {
|
||||
return;
|
||||
} elseif ($this->_isRootRequest()) {
|
||||
// request to root
|
||||
return;
|
||||
} elseif (parent::getConfig('use_client') !== 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (parent::getConfig('use_client_name') == 1) {
|
||||
$detectedClientId = (int) ModRewrite::getClientId(array_shift($this->_aParts));
|
||||
} else {
|
||||
$detectedClientId = (int) array_shift($this->_aParts);
|
||||
if ($detectedClientId > 0 && !ModRewrite::languageIdExists($detectedClientId)) {
|
||||
$detectedClientId = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if ($detectedClientId > 0) {
|
||||
// overwrite existing client variables
|
||||
$this->_iClientMR = $detectedClientId;
|
||||
$client = $detectedClientId;
|
||||
} else {
|
||||
$this->_setError(self::ERROR_CLIENT);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets language id
|
||||
*/
|
||||
private function _setLanguageId() {
|
||||
global $lang;
|
||||
|
||||
if ($this->_bError) {
|
||||
return;
|
||||
} elseif ($this->_isRootRequest()) {
|
||||
// request to root
|
||||
return;
|
||||
} elseif (parent::getConfig('use_language') !== 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (parent::getConfig('use_language_name') == 1) {
|
||||
// thanks to Nicolas Dickinson for multi Client/Language BugFix
|
||||
$languageName = array_shift($this->_aParts);
|
||||
$detectedLanguageId = (int) ModRewrite::getLanguageId($languageName, $this->_iClientMR);
|
||||
} else {
|
||||
$detectedLanguageId = (int) array_shift($this->_aParts);
|
||||
if ($detectedLanguageId > 0 && !ModRewrite::clientIdExists($detectedLanguageId)) {
|
||||
$detectedLanguageId = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if ($detectedLanguageId > 0) {
|
||||
// overwrite existing language variables
|
||||
$this->_iLangMR = $detectedLanguageId;
|
||||
$lang = $detectedLanguageId;
|
||||
} else {
|
||||
$this->_setError(self::ERROR_LANGUAGE);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets path resolver and category id
|
||||
*/
|
||||
private function _setPathresolverSetting() {
|
||||
global $client, $lang, $load_lang, $idcat;
|
||||
|
||||
if ($this->_bError) {
|
||||
return;
|
||||
} elseif (!$this->_hasPartArrayItems()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->_sPath = '/' . implode('/', $this->_aParts) . '/';
|
||||
|
||||
if (!isset($lang) || (int) $lang <= 0) {
|
||||
if ((int) $load_lang > 0) {
|
||||
// load_client is set in frontend/config.php
|
||||
$lang = (int) $load_lang;
|
||||
} else {
|
||||
// get client id from table
|
||||
cInclude('classes', 'contenido/class.clientslang.php');
|
||||
$clCol = new cApiClientLanguageCollection();
|
||||
$clCol->setWhere('idclient', $client);
|
||||
$clCol->query();
|
||||
if ($clItem = $clCol->next()) {
|
||||
$lang = $clItem->get('idlang');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$idcat = (int) ModRewrite::getCatIdByUrlPath($this->_sPath);
|
||||
|
||||
if ($idcat == 0) {
|
||||
// category couldn't resolved
|
||||
$this->_setError(self::ERROR_CATEGORY);
|
||||
$idcat = null;
|
||||
} else {
|
||||
// unset $this->_sPath if $idcat could set, otherwhise it would be resolved again.
|
||||
unset($this->_sPath);
|
||||
}
|
||||
|
||||
ModRewriteDebugger::add($idcat, 'ModRewriteController->_setPathresolverSetting $idcat');
|
||||
ModRewriteDebugger::add($this->_sPath, 'ModRewriteController->_setPathresolverSetting $this->_sPath');
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets article id
|
||||
*/
|
||||
private function _setIdart() {
|
||||
global $idcat, $idart, $lang;
|
||||
|
||||
if ($this->_bError) {
|
||||
return;
|
||||
} else if ($this->_isRootRequest()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$iIdCat = (isset($idcat) && (int) $idcat > 0) ? $idcat : 0;
|
||||
$iIdArt = (isset($idart) && (int) $idart > 0) ? $idart : 0;
|
||||
$detectedIdart = 0;
|
||||
$defaultStartArtName = parent::getConfig('default_startart_name');
|
||||
$currArtName = $this->_sArtName;
|
||||
|
||||
// startarticle name in url
|
||||
if (parent::getConfig('add_startart_name_to_url') && !empty($currArtName)) {
|
||||
if ($currArtName == $defaultStartArtName) {
|
||||
// stored articlename is the default one, remove it ModRewrite::getArtIdByWebsafeName()
|
||||
// will find the real article name
|
||||
$currArtName = '';
|
||||
}
|
||||
}
|
||||
|
||||
// Last check, before detecting article id
|
||||
if ($iIdCat == 0 && $iIdArt == 0 && empty($currArtName)) {
|
||||
// no idcat, idart and article name
|
||||
// must be a request to root or with language name and/or client name part!
|
||||
return;
|
||||
}
|
||||
|
||||
if ($iIdCat > 0 && $iIdArt == 0 && !empty($currArtName)) {
|
||||
// existing idcat with no idart and with article name
|
||||
$detectedIdart = (int) ModRewrite::getArtIdByWebsafeName($currArtName, $iIdCat, $lang);
|
||||
} elseif ($iIdCat > 0 && $iIdArt == 0 && empty($currArtName)) {
|
||||
if (parent::getConfig('add_startart_name_to_url') && ($currArtName == '' || $defaultStartArtName == '' || $defaultStartArtName == $this->_sArtName)) {
|
||||
// existing idcat without idart and without article name or with default start article name
|
||||
cInclude('classes', 'class.article.php');
|
||||
$artColl = new ArticleCollection(array('idcat' => $idcat, 'start' => 1));
|
||||
if ($artItem = $artColl->startArticle()) {
|
||||
$detectedIdart = (int) $artItem->get('idart');
|
||||
}
|
||||
}
|
||||
} elseif ($iIdCat == 0 && $iIdArt == 0 && !empty($currArtName)) {
|
||||
// no idcat and idart but article name
|
||||
$detectedIdart = (int) ModRewrite::getArtIdByWebsafeName($currArtName, $iIdCat, $lang);
|
||||
}
|
||||
|
||||
if ($detectedIdart > 0) {
|
||||
$idart = $detectedIdart;
|
||||
} elseif (!empty($currArtName)) {
|
||||
$this->_setError(self::ERROR_ARTICLE);
|
||||
}
|
||||
|
||||
ModRewriteDebugger::add($detectedIdart, 'ModRewriteController->_setIdart $detectedIdart');
|
||||
}
|
||||
|
||||
/**
|
||||
* Does post validation of the extracted data.
|
||||
*
|
||||
* One main goal of this function is to prevent duplicated content, which could happen, if
|
||||
* the configuration 'startfromroot' is activated.
|
||||
*/
|
||||
private function _postValidation() {
|
||||
global $idcat, $idart, $client;
|
||||
|
||||
if ($this->_bError || $this->_bRoutingFound || !$this->_hasPartArrayItems()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (parent::getConfig('startfromroot') == 1 && parent::getConfig('prevent_duplicated_content') == 1) {
|
||||
|
||||
// prevention of duplicated content if '/firstcat/' is directly requested!
|
||||
|
||||
$idcat = (isset($idcat) && (int) $idcat > 0) ? $idcat : null;
|
||||
$idart = (isset($idart) && (int) $idart > 0) ? $idart : null;
|
||||
|
||||
// compose new parameter
|
||||
$param = '';
|
||||
if ($idcat) {
|
||||
$param .= 'idcat=' . (int) $idcat;
|
||||
}
|
||||
if ($idart) {
|
||||
$param .= ($param !== '') ? '&idart=' . (int) $idart : 'idart=' . (int) $idart;
|
||||
}
|
||||
|
||||
if ($param == '') {
|
||||
return;
|
||||
}
|
||||
|
||||
// set client language, if not set before
|
||||
mr_setClientLanguageId($client);
|
||||
|
||||
//rebuild url
|
||||
$url = mr_buildNewUrl(self::FRONT_CONTENT . '?' . $param);
|
||||
|
||||
$aUrlComponents = @parse_url($this->_sIncommingUrl);
|
||||
$incommingUrl = (isset($aUrlComponents['path'])) ? $aUrlComponents['path'] : '';
|
||||
|
||||
ModRewriteDebugger::add($url, 'ModRewriteController->_postValidation validate url');
|
||||
ModRewriteDebugger::add($incommingUrl, 'ModRewriteController->_postValidation incommingUrl');
|
||||
|
||||
// now the new generated uri should be identical with the request uri
|
||||
if ($incommingUrl !== $url) {
|
||||
$this->_setError(self::ERROR_POST_VALIDATION);
|
||||
$idcat = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses the url using defined separators
|
||||
*
|
||||
* @param string $url Incoming url
|
||||
* @return string Parsed url
|
||||
*/
|
||||
private function _parseUrl($url) {
|
||||
$this->_sResolvedUrl = $url;
|
||||
|
||||
$oMrUrlUtil = ModRewriteUrlUtil::getInstance();
|
||||
$url = $oMrUrlUtil->toContenidoUrl($url);
|
||||
|
||||
return @parse_url($url);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns state of parts property.
|
||||
*
|
||||
* @return bool True if $this->_aParts propery contains items
|
||||
*/
|
||||
private function _hasPartArrayItems() {
|
||||
return (!empty($this->_aParts));
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if current request was a root request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
private function _isRootRequest() {
|
||||
return ($this->_sIncommingUrl == '/' || $this->_sIncommingUrl == '');
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets error code and error flag (everything greater than 0 is an error)
|
||||
* @param int $errCode
|
||||
*/
|
||||
private function _setError($errCode) {
|
||||
$this->_iError = (int) $errCode;
|
||||
$this->_bError = ((int) $errCode > 0);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,88 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* AMR debugger class
|
||||
*
|
||||
* @package plugin
|
||||
* @subpackage Mod Rewrite
|
||||
* @version SVN Revision $Rev$
|
||||
* @id $Id$:
|
||||
* @author Murat Purc <murat@purc.de>
|
||||
* @copyright four for business AG <www.4fb.de>
|
||||
* @license http://www.contenido.org/license/LIZENZ.txt
|
||||
* @link http://www.4fb.de
|
||||
* @link http://www.contenido.org
|
||||
*/
|
||||
|
||||
if (!defined('CON_FRAMEWORK')) {
|
||||
die('Illegal call');
|
||||
}
|
||||
|
||||
/**
|
||||
* Mod rewrite debugger class.
|
||||
*
|
||||
* @author Murat Purc <murat@purc.de>
|
||||
* @package plugin
|
||||
* @subpackage Mod Rewrite
|
||||
*/
|
||||
class ModRewriteDebugger {
|
||||
|
||||
/**
|
||||
* Flag to enable debugger
|
||||
* @var bool
|
||||
*/
|
||||
protected static $_bEnabled = false;
|
||||
|
||||
/**
|
||||
* Enable debugger setter.
|
||||
* @param bool $bEnabled
|
||||
*/
|
||||
public static function setEnabled($bEnabled) {
|
||||
self::$_bEnabled = (bool) $bEnabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds variable to debugger.
|
||||
* Wrapper for <code>DebuggerFactory::getDebugger('visible_adv')</code>.
|
||||
*
|
||||
* @param mixed $mVar The variable to dump
|
||||
* @param string $sLabel Describtion for passed $mVar
|
||||
*/
|
||||
public static function add($mVar, $sLabel = '') {
|
||||
if (!self::$_bEnabled) {
|
||||
return;
|
||||
}
|
||||
DebuggerFactory::getDebugger('visible_adv')->add($mVar, $sLabel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns output of all added variables to debug.
|
||||
* @return string
|
||||
*/
|
||||
public static function getAll() {
|
||||
if (!self::$_bEnabled) {
|
||||
return '';
|
||||
}
|
||||
|
||||
ob_start();
|
||||
DebuggerFactory::getDebugger('visible_adv')->showAll();
|
||||
$output = ob_get_contents();
|
||||
ob_end_clean();
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Logs variable to debugger.
|
||||
* Wrapper for <code>cDebug::getDebugger(cDebug::DEBUGGER_FILE)</code>.
|
||||
*
|
||||
* @param mixed $mVar The variable to log the contents
|
||||
* @param string $sLabel Describtion for passed $mVar
|
||||
*/
|
||||
public static function log($mVar, $sLabel = '') {
|
||||
if (!self::$_bEnabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
DebuggerFactory::getDebugger('file')->show($mVar, $sLabel);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,300 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* AMR test class
|
||||
*
|
||||
* @package plugin
|
||||
* @subpackage Mod Rewrite
|
||||
* @version SVN Revision $Rev$
|
||||
* @id $Id$:
|
||||
* @author Murat Purc <murat@purc.de>
|
||||
* @copyright four for business AG <www.4fb.de>
|
||||
* @license http://www.contenido.org/license/LIZENZ.txt
|
||||
* @link http://www.4fb.de
|
||||
* @link http://www.contenido.org
|
||||
*/
|
||||
|
||||
if (!defined('CON_FRAMEWORK')) {
|
||||
die('Illegal call');
|
||||
}
|
||||
|
||||
/**
|
||||
* Mod rewrite test class.
|
||||
*
|
||||
* @author Murat Purc <murat@purc.de>
|
||||
* @package plugin
|
||||
* @subpackage Mod Rewrite
|
||||
*/
|
||||
class ModRewriteTest {
|
||||
|
||||
/**
|
||||
* Global $cfg array
|
||||
* @var array
|
||||
*/
|
||||
protected $_aCfg;
|
||||
|
||||
/**
|
||||
* Global $cfg['tab'] array
|
||||
* @var array
|
||||
*/
|
||||
protected $_aCfgTab;
|
||||
|
||||
/**
|
||||
* Max items to process
|
||||
* @var int
|
||||
*/
|
||||
protected $_iMaxItems;
|
||||
|
||||
/**
|
||||
* Actual resolved url
|
||||
* @var string
|
||||
*/
|
||||
protected $_sResolvedUrl;
|
||||
|
||||
/**
|
||||
* Routing found flag
|
||||
* @var bool
|
||||
*/
|
||||
protected $_bRoutingFound = false;
|
||||
|
||||
/**
|
||||
* Constuctor
|
||||
* @param int $maxItems Max items (urls to articles/categories) to process
|
||||
*/
|
||||
public function __construct($maxItems) {
|
||||
global $cfg;
|
||||
$this->_aCfg = & $cfg;
|
||||
$this->_aCfgTab = & $cfg['tab'];
|
||||
$this->_iMaxItems = $maxItems;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns resolved URL
|
||||
*
|
||||
* @return bool Resolved URL
|
||||
*/
|
||||
public function getResolvedUrl() {
|
||||
return $this->_sResolvedUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns flagz about found routing
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function getRoutingFoundState() {
|
||||
return $this->_bRoutingFound;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetchs full structure of the installation (categories and articles) and returns it back.
|
||||
*
|
||||
* @param int $idclient Client id
|
||||
* @param int $idlang Language id
|
||||
* @return array Full structure as follows
|
||||
* <code>
|
||||
* $arr[idcat] = Category dataset
|
||||
* $arr[idcat]['articles'][idart] = Article dataset
|
||||
* </code>
|
||||
*/
|
||||
public function fetchFullStructure($idclient = null, $idlang = null) {
|
||||
global $client, $lang;
|
||||
|
||||
$db = new DB_Contenido();
|
||||
$db2 = new DB_Contenido();
|
||||
|
||||
if (!$idclient || (int) $idclient == 0) {
|
||||
$idclient = $client;
|
||||
}
|
||||
if (!$idlang || (int) $idlang == 0) {
|
||||
$idlang = $lang;
|
||||
}
|
||||
|
||||
$aTab = $this->_aCfgTab;
|
||||
|
||||
$aStruct = array();
|
||||
|
||||
$sql = "SELECT
|
||||
*
|
||||
FROM
|
||||
" . $aTab['cat_tree'] . " AS a,
|
||||
" . $aTab['cat_lang'] . " AS b,
|
||||
" . $aTab['cat'] . " AS c
|
||||
WHERE
|
||||
a.idcat = b.idcat AND
|
||||
c.idcat = a.idcat AND
|
||||
c.idclient = '" . $idclient . "' AND
|
||||
b.idlang = '" . $idlang . "'
|
||||
ORDER BY
|
||||
a.idtree";
|
||||
|
||||
$db->query($sql);
|
||||
|
||||
$counter = 0;
|
||||
|
||||
while ($db->next_record()) {
|
||||
|
||||
if (++$counter == $this->_iMaxItems) {
|
||||
break; // break this loop
|
||||
}
|
||||
|
||||
$idcat = $db->f('idcat');
|
||||
$aStruct[$idcat] = $db->Record;
|
||||
$aStruct[$idcat]['articles'] = array();
|
||||
|
||||
$sql2 = "SELECT
|
||||
*
|
||||
FROM
|
||||
" . $aTab['cat_art'] . " AS a,
|
||||
" . $aTab['art'] . " AS b,
|
||||
" . $aTab['art_lang'] . " AS c
|
||||
WHERE
|
||||
a.idcat = '" . $idcat . "' AND
|
||||
b.idart = a.idart AND
|
||||
c.idart = a.idart AND
|
||||
c.idlang = '" . $idlang . "' AND
|
||||
b.idclient = '" . $idclient . "'
|
||||
ORDER BY
|
||||
c.title ASC";
|
||||
|
||||
$db2->query($sql2);
|
||||
|
||||
while ($db2->next_record()) {
|
||||
$idart = $db2->f('idart');
|
||||
$aStruct[$idcat]['articles'][$idart] = $db2->Record;
|
||||
if (++$counter == $this->_iMaxItems) {
|
||||
break 2; // break this and also superior loop
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $aStruct;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an URL using passed data.
|
||||
*
|
||||
* The result is used to generate seo urls...
|
||||
*
|
||||
* @param array $arr Assoziative array with some data as follows:
|
||||
* <code>
|
||||
* $arr['idcat']
|
||||
* $arr['idart']
|
||||
* $arr['idcatart']
|
||||
* $arr['idartlang']
|
||||
* </code>
|
||||
* @param string $type Either 'c' or 'a' (category or article). If set to
|
||||
* 'c' only the parameter idcat will be added to the URL
|
||||
*/
|
||||
public function composeURL($arr, $type) {
|
||||
$type = ($type == 'a') ? 'a' : 'c';
|
||||
|
||||
$param = array();
|
||||
|
||||
if ($type == 'c') {
|
||||
$param[] = 'idcat=' . $arr['idcat'];
|
||||
} else {
|
||||
if (mr_getRequest('idart')) {
|
||||
$param[] = 'idart=' . $arr['idart'];
|
||||
}
|
||||
if (mr_getRequest('idcat')) {
|
||||
$param[] = 'idcat=' . $arr['idcat'];
|
||||
}
|
||||
if (mr_getRequest('idcatart')) {
|
||||
$param[] = 'idcatart=' . $arr['idcatart'];
|
||||
}
|
||||
if (mr_getRequest('idartlang')) {
|
||||
$param[] = 'idartlang=' . $arr['idartlang'];
|
||||
}
|
||||
}
|
||||
$param[] = 'foo=bar';
|
||||
return 'front_content.php?' . implode('&', $param);
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolves variables of an page (idcat, idart, idclient, idlang, etc.) by
|
||||
* processing passed url using ModRewriteController
|
||||
*
|
||||
* @param string $url Url to resolve
|
||||
* @return array Assoziative array with resolved data
|
||||
*/
|
||||
public function resolveUrl($url) {
|
||||
// some globals to reset
|
||||
$aGlobs = array(
|
||||
'mr_preprocessedPageError', 'idart', 'idcat'
|
||||
);
|
||||
foreach ($aGlobs as $p => $k) {
|
||||
if (isset($GLOBALS[$k])) {
|
||||
unset($GLOBALS[$k]);
|
||||
}
|
||||
}
|
||||
|
||||
$aReturn = array();
|
||||
|
||||
// create an mod rewrite controller instance and execute processing
|
||||
$oMRController = new ModRewriteController($url);
|
||||
$oMRController->execute();
|
||||
|
||||
if ($oMRController->errorOccured()) {
|
||||
|
||||
// an error occured (idcat and or idart couldn't catched by controller)
|
||||
$aReturn['mr_preprocessedPageError'] = 1;
|
||||
$aReturn['error'] = $oMRController->getError();
|
||||
|
||||
$this->_sResolvedUrl = '';
|
||||
$this->_bRoutingFound = false;
|
||||
} else {
|
||||
|
||||
// set some global variables
|
||||
|
||||
$this->_sResolvedUrl = $oMRController->getResolvedUrl();
|
||||
$this->_bRoutingFound = $oMRController->getRoutingFoundState();
|
||||
|
||||
if ($oMRController->getClient()) {
|
||||
$aReturn['client'] = $oMRController->getClient();
|
||||
}
|
||||
|
||||
if ($oMRController->getChangeClient()) {
|
||||
$aReturn['changeclient'] = $oMRController->getChangeClient();
|
||||
}
|
||||
|
||||
if ($oMRController->getLang()) {
|
||||
$aReturn['lang'] = $oMRController->getLang();
|
||||
}
|
||||
|
||||
if ($oMRController->getChangeLang()) {
|
||||
$aReturn['changelang'] = $oMRController->getChangeLang();
|
||||
}
|
||||
|
||||
if ($oMRController->getIdArt()) {
|
||||
$aReturn['idart'] = $oMRController->getIdArt();
|
||||
}
|
||||
|
||||
if ($oMRController->getIdCat()) {
|
||||
$aReturn['idcat'] = $oMRController->getIdCat();
|
||||
}
|
||||
|
||||
if ($oMRController->getPath()) {
|
||||
$aReturn['path'] = $oMRController->getPath();
|
||||
}
|
||||
}
|
||||
|
||||
return $aReturn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a readable string from passed resolved data array.
|
||||
*
|
||||
* @param array Assoziative array with resolved data
|
||||
* @return string Readable resolved data
|
||||
*/
|
||||
public function getReadableResolvedData(array $data) {
|
||||
// compose resolved string
|
||||
$ret = '';
|
||||
foreach ($data as $k => $v) {
|
||||
$ret .= $k . '=' . $v . '; ';
|
||||
}
|
||||
$ret = substr($ret, 0, strlen($ret) - 2);
|
||||
return $ret;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,314 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* AMR url stack class
|
||||
*
|
||||
* @package plugin
|
||||
* @subpackage Mod Rewrite
|
||||
* @version SVN Revision $Rev$
|
||||
* @id $Id$:
|
||||
* @author Murat Purc <murat@purc.de>
|
||||
* @copyright four for business AG <www.4fb.de>
|
||||
* @license http://www.contenido.org/license/LIZENZ.txt
|
||||
* @link http://www.4fb.de
|
||||
* @link http://www.contenido.org
|
||||
*/
|
||||
|
||||
if (!defined('CON_FRAMEWORK')) {
|
||||
die('Illegal call');
|
||||
}
|
||||
|
||||
/**
|
||||
* Mod rewrite url stack class. Provides features to collect urls and to get the
|
||||
* pretty path and names of categories/articles at one go.
|
||||
*
|
||||
* Main goal of this class is to collect urls and to get the urlpath and urlname
|
||||
* of the related categories/articles at one go. This will reduce the queries
|
||||
* against the database.
|
||||
* Therefore the full advantage will be taken by rewriting the urls at codeoutput
|
||||
* in front_content.php, where you will be able to collect all urls at once...
|
||||
*
|
||||
* Usage:
|
||||
* <code>
|
||||
* // get the instance
|
||||
* $oMRUrlStack = ModRewriteUrlStack::getInstance();
|
||||
*
|
||||
* // add several urls to fill the stack
|
||||
* $oMRUrlStack->add('front_content.php?idcat=123');
|
||||
* $oMRUrlStack->add('front_content.php?idart=321');
|
||||
* $oMRUrlStack->add('front_content.php?idcatart=213');
|
||||
* $oMRUrlStack->add('front_content.php?idcatlang=213');
|
||||
* $oMRUrlStack->add('front_content.php?idartlang=312');
|
||||
*
|
||||
* // now the first call will get the pretty path and names from database at one go
|
||||
* $aPrettyParts = $oMRUrlStack->getPrettyUrlParts('front_content.php?idcat=123');
|
||||
* echo $aPrettyParts['urlpath']; // something like 'Main-category-name/Category-name/Another-category-name/'
|
||||
* echo $aPrettyParts['urlname']; // something like 'Name-of-an-article'
|
||||
* </code>
|
||||
*
|
||||
* @author Murat Purc <murat@purc.de>
|
||||
* @package plugin
|
||||
* @subpackage Mod Rewrite
|
||||
*/
|
||||
class ModRewriteUrlStack {
|
||||
|
||||
/**
|
||||
* Self instance
|
||||
*
|
||||
* @var ModRewriteUrlStack
|
||||
*/
|
||||
private static $_instance;
|
||||
|
||||
/**
|
||||
* Database object
|
||||
*
|
||||
* @var DB_Contenido
|
||||
*/
|
||||
private $_oDb;
|
||||
|
||||
/**
|
||||
* Array for urls
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $_aUrls = array();
|
||||
|
||||
/**
|
||||
* Url stack array
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $_aStack = array();
|
||||
|
||||
/**
|
||||
* CONTENIDO related parameter array
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $_aConParams = array(
|
||||
'idcat' => 1, 'idart' => 1, 'lang' => 1, 'idcatlang' => 1, 'idcatart' => 1, 'idartlang' => 1
|
||||
);
|
||||
|
||||
/**
|
||||
* Database tables array
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $_aTab;
|
||||
|
||||
/**
|
||||
* Language id
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private $_idLang;
|
||||
|
||||
/**
|
||||
* Constructor, sets some properties.
|
||||
*/
|
||||
private function __construct() {
|
||||
global $cfg, $lang;
|
||||
$this->_oDb = new DB_Contenido();
|
||||
$this->_aTab = $cfg['tab'];
|
||||
$this->_idLang = $lang;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a instance of ModRewriteUrlStack (singleton implementation)
|
||||
*
|
||||
* @return ModRewriteUrlStack
|
||||
*/
|
||||
public static function getInstance() {
|
||||
if (self::$_instance == null) {
|
||||
self::$_instance = new ModRewriteUrlStack();
|
||||
}
|
||||
return self::$_instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds an url to the stack
|
||||
*
|
||||
* @param string Url, like front_content.php?idcat=123...
|
||||
*/
|
||||
public function add($url) {
|
||||
$url = ModRewrite::urlPreClean($url);
|
||||
if (isset($this->_aUrls[$url])) {
|
||||
return;
|
||||
}
|
||||
|
||||
$aUrl = $this->_extractUrl($url);
|
||||
|
||||
// cleanup parameter
|
||||
foreach ($aUrl['params'] as $p => $v) {
|
||||
if (!isset($this->_aConParams[$p])) {
|
||||
unset($aUrl['params'][$p]);
|
||||
} else {
|
||||
$aUrl['params'][$p] = (int) $v;
|
||||
}
|
||||
}
|
||||
|
||||
// add language id, if not available
|
||||
if ((int) mr_arrayValue($aUrl['params'], 'lang') == 0) {
|
||||
$aUrl['params']['lang'] = $this->_idLang;
|
||||
}
|
||||
|
||||
$sStackId = $this->_makeStackId($aUrl['params']);
|
||||
$this->_aUrls[$url] = $sStackId;
|
||||
$this->_aStack[$sStackId] = array('params' => $aUrl['params']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the pretty urlparts (only category path an article name) of the
|
||||
* desired url.
|
||||
*
|
||||
* @param string Url, like front_content.php?idcat=123...
|
||||
* @return array Assoziative array like
|
||||
* <code>
|
||||
* $arr['urlpath']
|
||||
* $arr['urlname']
|
||||
* </code>
|
||||
*/
|
||||
public function getPrettyUrlParts($url) {
|
||||
$url = ModRewrite::urlPreClean($url);
|
||||
if (!isset($this->_aUrls[$url])) {
|
||||
$this->add($url);
|
||||
}
|
||||
|
||||
$sStackId = $this->_aUrls[$url];
|
||||
if (!isset($this->_aStack[$sStackId]['urlpath'])) {
|
||||
$this->_chunkSetPrettyUrlParts();
|
||||
}
|
||||
$aPretty = array(
|
||||
'urlpath' => $this->_aStack[$sStackId]['urlpath'],
|
||||
'urlname' => $this->_aStack[$sStackId]['urlname']
|
||||
);
|
||||
return $aPretty;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extracts passed url using parse_urla and adds also the 'params' array to it
|
||||
*
|
||||
* @param string Url, like front_content.php?idcat=123...
|
||||
* @return array Components containing result of parse_url with additional
|
||||
* 'params' array
|
||||
*/
|
||||
private function _extractUrl($url) {
|
||||
$aUrl = @parse_url($url);
|
||||
if (isset($aUrl['query'])) {
|
||||
$aUrl['query'] = str_replace('&', '&', $aUrl['query']);
|
||||
parse_str($aUrl['query'], $aUrl['params']);
|
||||
}
|
||||
if (!isset($aUrl['params']) && !is_array($aUrl['params'])) {
|
||||
$aUrl['params'] = array();
|
||||
}
|
||||
return $aUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extracts article or category related parameter from passed params array
|
||||
* and generates an identifier.
|
||||
*
|
||||
* @param array $aParams Parameter array
|
||||
* @return string Composed stack id
|
||||
*/
|
||||
private function _makeStackId(array $aParams) {
|
||||
# idcatart
|
||||
if ((int) mr_arrayValue($aParams, 'idart') > 0) {
|
||||
$sStackId = 'idart_' . $aParams['idart'] . '_lang_' . $aParams['lang'];
|
||||
} elseif ((int) mr_arrayValue($aParams, 'idartlang') > 0) {
|
||||
$sStackId = 'idartlang_' . $aParams['idartlang'];
|
||||
} elseif ((int) mr_arrayValue($aParams, 'idcatart') > 0) {
|
||||
$sStackId = 'idcatart_' . $aParams['idcatart'] . '_lang_' . $aParams['lang'];
|
||||
} elseif ((int) mr_arrayValue($aParams, 'idcat') > 0) {
|
||||
$sStackId = 'idcat_' . $aParams['idcat'] . '_lang_' . $aParams['lang'];
|
||||
} elseif ((int) mr_arrayValue($aParams, 'idcatlang') > 0) {
|
||||
$sStackId = 'idcatlang_' . $aParams['idcatlang'];
|
||||
} else {
|
||||
$sStackId = 'lang_' . $aParams['lang'];
|
||||
}
|
||||
return $sStackId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Main function to get the urlparts of urls.
|
||||
*
|
||||
* Composes the query by looping thru stored but non processed urls, executes
|
||||
* the query and adds the (urlpath and urlname) result to the stack.
|
||||
*/
|
||||
private function _chunkSetPrettyUrlParts() {
|
||||
// collect stack parameter to get urlpath and urlname
|
||||
$aStack = array();
|
||||
foreach ($this->_aStack as $stackId => $item) {
|
||||
if (!isset($item['urlpath'])) {
|
||||
// pretty url is to create
|
||||
$aStack[$stackId] = $item;
|
||||
}
|
||||
}
|
||||
|
||||
// now, it's time to compose the where clause of the query
|
||||
$sWhere = '';
|
||||
foreach ($aStack as $stackId => $item) {
|
||||
$aP = $item['params'];
|
||||
if ((int) mr_arrayValue($aP, 'idart') > 0) {
|
||||
$sWhere .= '(al.idart = ' . $aP['idart'] . ' AND al.idlang = ' . $aP['lang'] . ') OR ';
|
||||
} elseif ((int) mr_arrayValue($aP, 'idartlang') > 0) {
|
||||
$sWhere .= '(al.idartlang = ' . $aP['idartlang'] . ') OR ';
|
||||
} elseif ((int) mr_arrayValue($aP, 'idcat') > 0) {
|
||||
$sWhere .= '(cl.idcat = ' . $aP['idcat'] . ' AND cl.idlang = ' . $aP['lang'] . ' AND cl.startidartlang = al.idartlang) OR ';
|
||||
} elseif ((int) mr_arrayValue($aP, 'idcatart') > 0) {
|
||||
$sWhere .= '(ca.idcatart = ' . $aP['idcatart'] . ' AND ca.idart = al.idart AND al.idlang = ' . $aP['lang'] . ') OR ';
|
||||
} elseif ((int) mr_arrayValue($aP, 'idcatlang') > 0) {
|
||||
$sWhere .= '(cl.idcatlang = ' . $aP['idcatlang'] . ' AND cl.startidartlang = al.idartlang) OR ';
|
||||
}
|
||||
}
|
||||
if ($sWhere == '') {
|
||||
return;
|
||||
}
|
||||
$sWhere = substr($sWhere, 0, -4);
|
||||
$sWhere = str_replace(' OR ', " OR \n", $sWhere);
|
||||
|
||||
// compose query and execute it
|
||||
$sql = <<<SQL
|
||||
SELECT
|
||||
al.idartlang, al.idart, al.idlang as lang, al.urlname, cl.idcatlang, cl.idcat,
|
||||
cl.urlpath, ca.idcatart
|
||||
FROM
|
||||
{$this->_aTab['art_lang']} AS al, {$this->_aTab['cat_lang']} AS cl, {$this->_aTab['cat_art']} AS ca
|
||||
WHERE
|
||||
al.idart = ca.idart AND
|
||||
ca.idcat = cl.idcat AND
|
||||
al.idlang = cl.idlang AND
|
||||
( $sWhere )
|
||||
SQL;
|
||||
ModRewriteDebugger::add($sql, 'ModRewriteUrlStack->_chunkSetPrettyUrlParts() $sql');
|
||||
|
||||
$aNewStack = array();
|
||||
|
||||
// create array of fields, which are to reduce step by step from record set below
|
||||
$aFields = array('', 'idart', 'idartlang', 'idcatart', 'idcat');
|
||||
|
||||
$this->_oDb->query($sql);
|
||||
while ($this->_oDb->next_record()) {
|
||||
$aRS = $this->_oDb->Record;
|
||||
|
||||
// loop thru fields array
|
||||
foreach ($aFields as $field) {
|
||||
if (isset($aRS[$field])) {
|
||||
// reduce existing field
|
||||
unset($aRS[$field]);
|
||||
}
|
||||
$rsStackID = $this->_makeStackId($aRS);
|
||||
if (isset($aStack[$rsStackID])) {
|
||||
// matching stack entry found, add urlpath and urlname to the new stack
|
||||
$aNewStack[$rsStackID]['urlpath'] = $aRS['urlpath'];
|
||||
$aNewStack[$rsStackID]['urlname'] = $aRS['urlname'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
ModRewriteDebugger::add($aNewStack, 'ModRewriteUrlStack->_chunkSetPrettyUrlParts() $aNewStack');
|
||||
|
||||
// merge stack data
|
||||
$this->_aStack = array_merge($this->_aStack, $aNewStack);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,306 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* AMR url utility class
|
||||
*
|
||||
* @package plugin
|
||||
* @subpackage Mod Rewrite
|
||||
* @version SVN Revision $Rev$
|
||||
* @id $Id$:
|
||||
* @author Murat Purc <murat@purc.de>
|
||||
* @copyright four for business AG <www.4fb.de>
|
||||
* @license http://www.contenido.org/license/LIZENZ.txt
|
||||
* @link http://www.4fb.de
|
||||
* @link http://www.contenido.org
|
||||
*/
|
||||
|
||||
if (!defined('CON_FRAMEWORK')) {
|
||||
die('Illegal call');
|
||||
}
|
||||
|
||||
/**
|
||||
* Mod Rewrite url utility class. Handles convertion of Urls from CONTENIDO core
|
||||
* based url composition pattern to AMR (Advanced Mod Rewrite) url composition
|
||||
* pattern and vice versa.
|
||||
*
|
||||
* @author Murat Purc <murat@purc.de>
|
||||
* @package plugin
|
||||
* @subpackage Mod Rewrite
|
||||
*/
|
||||
class ModRewriteUrlUtil extends ModRewriteBase {
|
||||
|
||||
/**
|
||||
* Self instance (singleton implementation)
|
||||
* @var ModRewriteUrlUtil
|
||||
*/
|
||||
private static $_instance;
|
||||
|
||||
/**
|
||||
* CONTENIDO category word separator
|
||||
* @var string
|
||||
*/
|
||||
private $_catWordSep = '-';
|
||||
|
||||
/**
|
||||
* AMR category word separator
|
||||
* @var string
|
||||
*/
|
||||
private $_mrCatWordSep;
|
||||
|
||||
/**
|
||||
* CONTENIDO category separator
|
||||
* @var string
|
||||
*/
|
||||
private $_catSep = '/';
|
||||
|
||||
/**
|
||||
* AMR category separator
|
||||
* @var string
|
||||
*/
|
||||
private $_mrCatSep;
|
||||
|
||||
/**
|
||||
* CONTENIDO article separator
|
||||
* @var string
|
||||
*/
|
||||
private $_artSep = '/';
|
||||
|
||||
/**
|
||||
* AMR article separator
|
||||
* @var string
|
||||
*/
|
||||
private $_mrArtSep;
|
||||
|
||||
/**
|
||||
* CONTENIDO article word separator
|
||||
* @var string
|
||||
*/
|
||||
private $_artWordSep = '-';
|
||||
|
||||
/**
|
||||
* AMR article word separator
|
||||
* @var string
|
||||
*/
|
||||
private $_mrArtWordSep;
|
||||
|
||||
/**
|
||||
* AMR extension used for articlenames (e. g. .html)
|
||||
* @var string
|
||||
*/
|
||||
private $_mrExt;
|
||||
|
||||
/**
|
||||
* Constructor, sets some AMR configuration related properties
|
||||
*/
|
||||
private function __construct() {
|
||||
$aCfg = parent::getConfig();
|
||||
$this->_mrCatWordSep = $aCfg['category_word_seperator'];
|
||||
$this->_mrCatSep = $aCfg['category_seperator'];
|
||||
$this->_mrArtSep = $aCfg['article_seperator'];
|
||||
$this->_mrArtWordSep = $aCfg['article_word_seperator'];
|
||||
$this->_mrExt = $aCfg['file_extension'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Prevent cloning
|
||||
*/
|
||||
private function __clone() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns self instance (singleton pattern)
|
||||
* @return ModRewriteUrlUtil
|
||||
*/
|
||||
public static function getInstance() {
|
||||
if (self::$_instance == null) {
|
||||
self::$_instance = new ModRewriteUrlUtil();
|
||||
}
|
||||
return self::$_instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts passed AMR url path to CONTENIDO url path.
|
||||
*
|
||||
* @param string $urlPath AMR url path
|
||||
* @return string CONTENIDO url path
|
||||
*/
|
||||
public function toContenidoUrlPath($urlPath) {
|
||||
$newUrlPath = $this->_toUrlPath(
|
||||
$urlPath, $this->_mrCatSep, $this->_catSep, $this->_mrCatWordSep, $this->_catWordSep, $this->_mrArtSep, $this->_artSep
|
||||
);
|
||||
return $newUrlPath;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts passed CONTENIDO url path to AMR url path.
|
||||
*
|
||||
* @param string $urlPath CONTENIDO url path
|
||||
* @return string AMR url path
|
||||
*/
|
||||
public function toModRewriteUrlPath($urlPath) {
|
||||
$newUrlPath = $this->_toUrlPath(
|
||||
$urlPath, $this->_catSep, $this->_mrCatSep, $this->_catWordSep, $this->_mrCatWordSep, $this->_artSep, $this->_mrArtSep
|
||||
);
|
||||
return $newUrlPath;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts passed url path to a another url path (CONTENIDO to AMR and vice versa).
|
||||
*
|
||||
* @param string $urlPath Source url path
|
||||
* @param string $fromCatSep Source category seperator
|
||||
* @param string $toCatSep Destination category seperator
|
||||
* @param string $fromCatWordSep Source category word seperator
|
||||
* @param string $toCatWordSep Destination category word seperator
|
||||
* @param string $fromArtSep Source article seperator
|
||||
* @param string $toArtSep Destination article seperator
|
||||
* @return string Destination url path
|
||||
*/
|
||||
private function _toUrlPath($urlPath, $fromCatSep, $toCatSep, $fromCatWordSep, $toCatWordSep, $fromArtSep, $toArtSep) {
|
||||
if ((string) $urlPath == '') {
|
||||
return $urlPath;
|
||||
}
|
||||
|
||||
if (substr($urlPath, -1) == $fromArtSep) {
|
||||
$urlPath = substr($urlPath, 0, -1) . '{TAS}';
|
||||
}
|
||||
|
||||
// pre replace category word seperator and category seperator
|
||||
$urlPath = str_replace($fromCatWordSep, '{CWS}', $urlPath);
|
||||
$urlPath = str_replace($fromCatSep, '{CS}', $urlPath);
|
||||
|
||||
// replace category word seperator
|
||||
$urlPath = str_replace('{CWS}', $toCatWordSep, $urlPath);
|
||||
$urlPath = str_replace('{CS}', $toCatSep, $urlPath);
|
||||
|
||||
$urlPath = str_replace('{TAS}', $toArtSep, $urlPath);
|
||||
|
||||
return $urlPath;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts passed AMR url name to CONTENIDO url name.
|
||||
*
|
||||
* @param string $urlName AMR url name
|
||||
* @return string CONTENIDO url name
|
||||
*/
|
||||
public function toContenidoUrlName($urlName) {
|
||||
$newUrlName = $this->_toUrlName($urlName, $this->_mrArtWordSep, $this->_artWordSep);
|
||||
return $newUrlName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts passed CONTENIDO url name to AMR url name.
|
||||
*
|
||||
* @param string $urlName CONTENIDO url name
|
||||
* @return string AMR url name
|
||||
*/
|
||||
public function toModRewriteUrlName($urlName) {
|
||||
$newUrlName = $this->_toUrlName($urlName, $this->_artWordSep, $this->_mrArtWordSep);
|
||||
return $newUrlName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts passed url name to a another url name (CONTENIDO to AMR and vice versa).
|
||||
*
|
||||
* @param string $urlName Source url name
|
||||
* @param string $fromArtWordSep Source article word seperator
|
||||
* @param string $toArtWordSep Destination article word seperator
|
||||
* @return string Destination url name
|
||||
*/
|
||||
private function _toUrlName($urlName, $fromArtWordSep, $toArtWordSep) {
|
||||
if ((string) $urlName == '') {
|
||||
return $urlName;
|
||||
}
|
||||
|
||||
$urlName = str_replace($this->_mrExt, '{EXT}', $urlName);
|
||||
|
||||
// replace article word seperator
|
||||
$urlName = str_replace($fromArtWordSep, $toArtWordSep, $urlName);
|
||||
|
||||
$urlName = str_replace('{EXT}', $this->_mrExt, $urlName);
|
||||
|
||||
return $urlName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts passed AMR url to CONTENIDO url.
|
||||
*
|
||||
* @param string $url AMR url
|
||||
* @return string CONTENIDO url
|
||||
*/
|
||||
public function toContenidoUrl($url) {
|
||||
if (strpos($url, $this->_mrExt) === false) {
|
||||
$newUrl = $this->toContenidoUrlPath($url);
|
||||
} else {
|
||||
// replace category word and article word seperator
|
||||
$path = substr($url, 0, strrpos($url, $this->_mrArtSep) + 1);
|
||||
$name = substr($url, strrpos($url, $this->_mrArtSep) + 1);
|
||||
$newUrl = $this->toContenidoUrlPath($path) . $this->toContenidoUrlName($name);
|
||||
}
|
||||
return $newUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts passed AMR url to CONTENIDO url.
|
||||
*
|
||||
* @param string $url AMR url
|
||||
* @return string CONTENIDO url
|
||||
*/
|
||||
public function toModRewriteUrl($url) {
|
||||
if (strpos($url, $this->_mrExt) === false) {
|
||||
$newUrl = $this->toModRewriteUrlPath($url);
|
||||
} else {
|
||||
// replace category word and article word seperator
|
||||
$path = substr($url, 0, strrpos($url, $this->_artSep) + 1);
|
||||
$name = substr($url, strrpos($url, $this->_artSep) + 1);
|
||||
$newUrl = $this->toModRewriteUrlPath($path) . $this->toModRewriteUrlName($name);
|
||||
}
|
||||
return $newUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts passed url to a another url (CONTENIDO to AMR and vice versa).
|
||||
*
|
||||
* @param string $url Source url
|
||||
* @param string $fromCatSep Source category seperator
|
||||
* @param string $toCatSep Destination category seperator
|
||||
* @param string $fromCatWordSep Source category word seperator
|
||||
* @param string $toCatWordSep Destination category word seperator
|
||||
* @param string $fromArtSep Source article seperator
|
||||
* @param string $toArtSep Destination article seperator
|
||||
* @param string $fromArtWordSep Source article word seperator
|
||||
* @param string $toArtWordSep Destination article word seperator
|
||||
* @return string Destination url
|
||||
*
|
||||
* @deprecated No more used, is to delete
|
||||
*/
|
||||
private function _toUrl($url, $fromCatSep, $toCatSep, $fromCatWordSep, $toCatWordSep, $fromArtSep, $toArtSep, $fromArtWordSep, $toArtWordSep) {
|
||||
if ((string) $url == '') {
|
||||
return $url;
|
||||
}
|
||||
|
||||
$url = str_replace($this->_mrExt, '{EXT}', $url);
|
||||
|
||||
// replace category seperator
|
||||
$url = str_replace($fromCatSep, $toCatSep, $url);
|
||||
|
||||
// replace article seperator
|
||||
$url = str_replace($fromArtSep, $toArtSep, $url);
|
||||
|
||||
$url = str_replace('{EXT}', $this->_mrExt, $url);
|
||||
|
||||
if (strpos($url, $this->_mrExt) === false) {
|
||||
// no articlename, replace category word seperator
|
||||
$url = str_replace($fromCatWordSep, $toCatWordSep, $url);
|
||||
} else {
|
||||
// replace category word and article word seperator
|
||||
$path = str_replace($fromCatWordSep, $toCatWordSep, substr($url, 0, strrpos($url, $toArtSep) + 1));
|
||||
$file = str_replace($fromArtWordSep, $toArtWordSep, substr($url, strrpos($url, $toArtSep) + 1));
|
||||
$url = $path . $file;
|
||||
}
|
||||
|
||||
return $url;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,426 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* AMR Content controller class
|
||||
*
|
||||
* @package plugin
|
||||
* @subpackage Mod Rewrite
|
||||
* @version SVN Revision $Rev$
|
||||
* @id $Id$:
|
||||
* @author Murat Purc <murat@purc.de>
|
||||
* @copyright four for business AG <www.4fb.de>
|
||||
* @license http://www.contenido.org/license/LIZENZ.txt
|
||||
* @link http://www.4fb.de
|
||||
* @link http://www.contenido.org
|
||||
*/
|
||||
|
||||
if (!defined('CON_FRAMEWORK')) {
|
||||
die('Illegal call');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Content controller for general settings.
|
||||
*
|
||||
* @author Murat Purc <murat@purc.de>
|
||||
* @package plugin
|
||||
* @subpackage Mod Rewrite
|
||||
*/
|
||||
class ModRewrite_ContentController extends ModRewrite_ControllerAbstract {
|
||||
|
||||
/**
|
||||
* Index action
|
||||
*/
|
||||
public function indexAction() {
|
||||
// donut
|
||||
$this->_doChecks();
|
||||
}
|
||||
|
||||
/**
|
||||
* Save settings action
|
||||
*/
|
||||
public function saveAction() {
|
||||
$bDebug = $this->getProperty('bDebug');
|
||||
$aSeparator = $this->getProperty('aSeparator');
|
||||
$aWordSeparator = $this->getProperty('aWordSeparator');
|
||||
$routingSeparator = $this->getProperty('routingSeparator');
|
||||
|
||||
$bError = false;
|
||||
$aMR = array();
|
||||
|
||||
$request = (count($_POST) > 0) ? $_POST : $_GET;
|
||||
mr_requestCleanup($request);
|
||||
|
||||
// use mod_rewrite
|
||||
if (mr_arrayValue($request, 'use') == 1) {
|
||||
$this->_oView->use_chk = ' checked="checked"';
|
||||
$aMR['mod_rewrite']['use'] = 1;
|
||||
} else {
|
||||
$this->_oView->use_chk = '';
|
||||
$aMR['mod_rewrite']['use'] = 0;
|
||||
}
|
||||
|
||||
// root dir
|
||||
if (mr_arrayValue($request, 'rootdir', '') !== '') {
|
||||
if (!preg_match('/^[a-zA-Z0-9\-_\/\.]*$/', $request['rootdir'])) {
|
||||
$sMsg = i18n("The root directory has a invalid format, alowed are the chars [a-zA-Z0-9\-_\/\.]", "mod_rewrite");
|
||||
$this->_oView->rootdir_error = $this->_notifyBox('error', $sMsg);
|
||||
$bError = true;
|
||||
} elseif (!is_dir($_SERVER['DOCUMENT_ROOT'] . $request['rootdir'])) {
|
||||
|
||||
if (mr_arrayValue($request, 'checkrootdir') == 1) {
|
||||
// root dir check is enabled, this results in error
|
||||
$sMsg = i18n("The specified directory '%s' does not exists", "mod_rewrite");
|
||||
$sMsg = sprintf($sMsg, $_SERVER['DOCUMENT_ROOT'] . $request['rootdir']);
|
||||
$this->_oView->rootdir_error = $this->_notifyBox('error', $sMsg);
|
||||
$bError = true;
|
||||
} else {
|
||||
// root dir check ist disabled, take over the setting and
|
||||
// output a warning.
|
||||
$sMsg = i18n("The specified directory '%s' does not exists in DOCUMENT_ROOT '%s'. This could happen, if clients DOCUMENT_ROOT differs from CONTENIDO backends DOCUMENT_ROOT. However, the setting will be taken over because of disabled check.", "mod_rewrite");
|
||||
$sMsg = sprintf($sMsg, $request['rootdir'], $_SERVER['DOCUMENT_ROOT']);
|
||||
$this->_oView->rootdir_error = $this->_notifyBox('warning', $sMsg);
|
||||
}
|
||||
}
|
||||
$this->_oView->rootdir = conHtmlentities($request['rootdir']);
|
||||
$aMR['mod_rewrite']['rootdir'] = $request['rootdir'];
|
||||
}
|
||||
|
||||
// root dir check
|
||||
if (mr_arrayValue($request, 'checkrootdir') == 1) {
|
||||
$this->_oView->checkrootdir_chk = ' checked="checked"';
|
||||
$aMR['mod_rewrite']['checkrootdir'] = 1;
|
||||
} else {
|
||||
$this->_oView->checkrootdir_chk = '';
|
||||
$aMR['mod_rewrite']['checkrootdir'] = 0;
|
||||
}
|
||||
|
||||
// start from root
|
||||
if (mr_arrayValue($request, 'startfromroot') == 1) {
|
||||
$this->_oView->startfromroot_chk = ' checked="checked"';
|
||||
$aMR['mod_rewrite']['startfromroot'] = 1;
|
||||
} else {
|
||||
$this->_oView->startfromroot_chk = '';
|
||||
$aMR['mod_rewrite']['startfromroot'] = 0;
|
||||
}
|
||||
|
||||
// prevent duplicated content
|
||||
if (mr_arrayValue($request, 'prevent_duplicated_content') == 1) {
|
||||
$this->_oView->prevent_duplicated_content_chk = ' checked="checked"';
|
||||
$aMR['mod_rewrite']['prevent_duplicated_content'] = 1;
|
||||
} else {
|
||||
$this->_oView->prevent_duplicated_content_chk = '';
|
||||
$aMR['mod_rewrite']['prevent_duplicated_content'] = 0;
|
||||
}
|
||||
|
||||
// language settings
|
||||
if (mr_arrayValue($request, 'use_language') == 1) {
|
||||
$this->_oView->use_language_chk = ' checked="checked"';
|
||||
$this->_oView->use_language_name_disabled = '';
|
||||
$aMR['mod_rewrite']['use_language'] = 1;
|
||||
if (mr_arrayValue($request, 'use_language_name') == 1) {
|
||||
$this->_oView->use_language_name_chk = ' checked="checked"';
|
||||
$aMR['mod_rewrite']['use_language_name'] = 1;
|
||||
} else {
|
||||
$this->_oView->use_language_name_chk = '';
|
||||
$aMR['mod_rewrite']['use_language_name'] = 0;
|
||||
}
|
||||
} else {
|
||||
$this->_oView->use_language_chk = '';
|
||||
$this->_oView->use_language_name_chk = '';
|
||||
$this->_oView->use_language_name_disabled = ' disabled="disabled"';
|
||||
$aMR['mod_rewrite']['use_language'] = 0;
|
||||
$aMR['mod_rewrite']['use_language_name'] = 0;
|
||||
}
|
||||
|
||||
// client settings
|
||||
if (mr_arrayValue($request, 'use_client') == 1) {
|
||||
$this->_oView->use_client_chk = ' checked="checked"';
|
||||
$this->_oView->use_client_name_disabled = '';
|
||||
$aMR['mod_rewrite']['use_client'] = 1;
|
||||
if (mr_arrayValue($request, 'use_client_name') == 1) {
|
||||
$this->_oView->use_client_name_chk = ' checked="checked"';
|
||||
$aMR['mod_rewrite']['use_client_name'] = 1;
|
||||
} else {
|
||||
$this->_oView->use_client_name_chk = '';
|
||||
$aMR['mod_rewrite']['use_client_name'] = 0;
|
||||
}
|
||||
} else {
|
||||
$this->_oView->use_client_chk = '';
|
||||
$this->_oView->use_client_name_chk = '';
|
||||
$this->_oView->use_client_name_disabled = ' disabled="disabled"';
|
||||
$aMR['mod_rewrite']['use_client'] = 0;
|
||||
$aMR['mod_rewrite']['use_client_name'] = 0;
|
||||
}
|
||||
|
||||
// use lowercase uri
|
||||
if (mr_arrayValue($request, 'use_lowercase_uri') == 1) {
|
||||
$this->_oView->use_lowercase_uri_chk = ' checked="checked"';
|
||||
$aMR['mod_rewrite']['use_lowercase_uri'] = 1;
|
||||
} else {
|
||||
$this->_oView->use_lowercase_uri_chk = '';
|
||||
$aMR['mod_rewrite']['use_lowercase_uri'] = 0;
|
||||
}
|
||||
|
||||
$this->_oView->category_separator_attrib = '';
|
||||
$this->_oView->category_word_separator_attrib = '';
|
||||
$this->_oView->article_separator_attrib = '';
|
||||
$this->_oView->article_word_separator_attrib = '';
|
||||
|
||||
$separatorPattern = $aSeparator['pattern'];
|
||||
$separatorInfo = $aSeparator['info'];
|
||||
|
||||
$wordSeparatorPattern = $aSeparator['pattern'];
|
||||
$wordSeparatorInfo = $aSeparator['info'];
|
||||
|
||||
$categorySeperator = mr_arrayValue($request, 'category_seperator', '');
|
||||
$categoryWordSeperator = mr_arrayValue($request, 'category_word_seperator', '');
|
||||
$articleSeperator = mr_arrayValue($request, 'article_seperator', '');
|
||||
$articleWordSeperator = mr_arrayValue($request, 'article_word_seperator', '');
|
||||
|
||||
// category seperator
|
||||
if ($categorySeperator == '') {
|
||||
$sMsg = i18n("Please specify separator (%s) for category", "mod_rewrite");
|
||||
$sMsg = sprintf($sMsg, $separatorInfo);
|
||||
$this->_oView->category_separator_error = $this->_notifyBox('error', $sMsg);
|
||||
$bError = true;
|
||||
} elseif (!preg_match($separatorPattern, $categorySeperator)) {
|
||||
$sMsg = i18n("Invalid separator for category, allowed one of following characters: %s", "mod_rewrite");
|
||||
$sMsg = sprintf($sMsg, $separatorInfo);
|
||||
$this->_oView->category_separator_error = $this->_notifyBox('error', $sMsg);
|
||||
$bError = true;
|
||||
|
||||
// category word seperator
|
||||
} elseif ($categoryWordSeperator == '') {
|
||||
$sMsg = i18n("Please specify separator (%s) for category words", "mod_rewrite");
|
||||
$sMsg = sprintf($sMsg, $wordSeparatorInfo);
|
||||
$this->_oView->category_word_separator_error = $this->_notifyBox('error', $sMsg);
|
||||
$bError = true;
|
||||
} elseif (!preg_match($wordSeparatorPattern, $categoryWordSeperator)) {
|
||||
$sMsg = i18n("Invalid separator for category words, allowed one of following characters: %s", "mod_rewrite");
|
||||
$sMsg = sprintf($sMsg, $wordSeparatorInfo);
|
||||
$this->_oView->category_word_separator_error = $this->_notifyBox('error', $sMsg);
|
||||
$bError = true;
|
||||
|
||||
// article seperator
|
||||
} elseif ($articleSeperator == '') {
|
||||
$sMsg = i18n("Please specify separator (%s) for article", "mod_rewrite");
|
||||
$sMsg = sprintf($sMsg, $separatorInfo);
|
||||
$this->_oView->article_separator_error = $this->_notifyBox('error', $sMsg);
|
||||
$bError = true;
|
||||
} elseif (!preg_match($separatorPattern, $articleSeperator)) {
|
||||
$sMsg = i18n("Invalid separator for article, allowed is one of following characters: %s", "mod_rewrite");
|
||||
$sMsg = sprintf($sMsg, $separatorInfo);
|
||||
$this->_oView->article_separator_error = $this->_notifyBox('error', $sMsg);
|
||||
$bError = true;
|
||||
|
||||
// article word seperator
|
||||
} elseif ($articleWordSeperator == '') {
|
||||
$sMsg = i18n("Please specify separator (%s) for article words", "mod_rewrite");
|
||||
$sMsg = sprintf($sMsg, $wordSeparatorInfo);
|
||||
$this->_oView->article_word_separator_error = $this->_notifyBox('error', $sMsg);
|
||||
$bError = true;
|
||||
} elseif (!preg_match($wordSeparatorPattern, $articleWordSeperator)) {
|
||||
$sMsg = i18n("Invalid separator for article words, allowed is one of following characters: %s", "mod_rewrite");
|
||||
$sMsg = sprintf($sMsg, $wordSeparatorInfo);
|
||||
$this->_oView->article_word_separator_error = $this->_notifyBox('error', $sMsg);
|
||||
$bError = true;
|
||||
|
||||
// category_seperator - category_word_seperator
|
||||
} elseif ($categorySeperator == $categoryWordSeperator) {
|
||||
$sMsg = i18n("Separator for category and category words must not be identical", "mod_rewrite");
|
||||
$this->_oView->category_separator_error = $this->_notifyBox('error', $sMsg);
|
||||
$bError = true;
|
||||
// category_seperator - article_word_seperator
|
||||
} elseif ($categorySeperator == $articleWordSeperator) {
|
||||
$sMsg = i18n("Separator for category and article words must not be identical", "mod_rewrite");
|
||||
$this->_oView->category_separator_error = $this->_notifyBox('error', $sMsg);
|
||||
$bError = true;
|
||||
// article_seperator - article_word_seperator
|
||||
} elseif ($articleSeperator == $articleWordSeperator) {
|
||||
$sMsg = i18n("Separator for category-article and article words must not be identical", "mod_rewrite");
|
||||
$this->_oView->article_separator_error = $this->_notifyBox('error', $sMsg);
|
||||
$bError = true;
|
||||
}
|
||||
|
||||
$this->_oView->category_separator = conHtmlentities($categorySeperator);
|
||||
$aMR['mod_rewrite']['category_seperator'] = $categorySeperator;
|
||||
$this->_oView->category_word_separator = conHtmlentities($categoryWordSeperator);
|
||||
$aMR['mod_rewrite']['category_word_seperator'] = $categoryWordSeperator;
|
||||
$this->_oView->article_separator = conHtmlentities($articleSeperator);
|
||||
$aMR['mod_rewrite']['article_seperator'] = $articleSeperator;
|
||||
$this->_oView->article_word_separator = conHtmlentities($articleWordSeperator);
|
||||
$aMR['mod_rewrite']['article_word_seperator'] = $articleWordSeperator;
|
||||
|
||||
// file extension
|
||||
if (mr_arrayValue($request, 'file_extension', '') !== '') {
|
||||
if (!preg_match('/^\.([a-zA-Z0-9\-_\/])*$/', $request['file_extension'])) {
|
||||
$sMsg = i18n("The file extension has a invalid format, allowed are the chars \.([a-zA-Z0-9\-_\/])", "mod_rewrite");
|
||||
$this->_oView->file_extension_error = $this->_notifyBox('error', $sMsg);
|
||||
$bError = true;
|
||||
}
|
||||
$this->_oView->file_extension = conHtmlentities($request['file_extension']);
|
||||
$aMR['mod_rewrite']['file_extension'] = $request['file_extension'];
|
||||
} else {
|
||||
$this->_oView->file_extension = '.html';
|
||||
$aMR['mod_rewrite']['file_extension'] = '.html';
|
||||
}
|
||||
|
||||
// category resolve min percentage
|
||||
if (isset($request['category_resolve_min_percentage'])) {
|
||||
if (!is_numeric($request['category_resolve_min_percentage'])) {
|
||||
$sMsg = i18n("Value has to be numeric.", "mod_rewrite");
|
||||
$this->_oView->category_resolve_min_percentage_error = $this->_notifyBox('error', $sMsg);
|
||||
$bError = true;
|
||||
} elseif ($request['category_resolve_min_percentage'] < 0 || $request['category_resolve_min_percentage'] > 100) {
|
||||
$sMsg = i18n("Value has to be between 0 an 100.", "mod_rewrite");
|
||||
$this->_oView->category_resolve_min_percentage_error = $this->_notifyBox('error', $sMsg);
|
||||
$bError = true;
|
||||
}
|
||||
$this->_oView->category_resolve_min_percentage = $request['category_resolve_min_percentage'];
|
||||
$aMR['mod_rewrite']['category_resolve_min_percentage'] = $request['category_resolve_min_percentage'];
|
||||
} else {
|
||||
$this->_oView->category_resolve_min_percentage = '75';
|
||||
$aMR['mod_rewrite']['category_resolve_min_percentage'] = '75';
|
||||
}
|
||||
|
||||
// add start article name to url
|
||||
if (mr_arrayValue($request, 'add_startart_name_to_url') == 1) {
|
||||
$this->_oView->add_startart_name_to_url_chk = ' checked="checked"';
|
||||
$aMR['mod_rewrite']['add_startart_name_to_url'] = 1;
|
||||
if (mr_arrayValue($request, 'add_startart_name_to_url', '') !== '') {
|
||||
if (!preg_match('/^[a-zA-Z0-9\-_\/\.]*$/', $request['default_startart_name'])) {
|
||||
$sMsg = i18n("The article name has a invalid format, allowed are the chars /^[a-zA-Z0-9\-_\/\.]*$/", "mod_rewrite");
|
||||
$this->_oView->add_startart_name_to_url_error = $this->_notifyBox('error', $sMsg);
|
||||
$bError = true;
|
||||
}
|
||||
$this->_oView->default_startart_name = conHtmlentities($request['default_startart_name']);
|
||||
$aMR['mod_rewrite']['default_startart_name'] = $request['default_startart_name'];
|
||||
} else {
|
||||
$this->_oView->default_startart_name = '';
|
||||
$aMR['mod_rewrite']['default_startart_name'] = '';
|
||||
}
|
||||
} else {
|
||||
$this->_oView->add_startart_name_to_url_chk = '';
|
||||
$aMR['mod_rewrite']['add_startart_name_to_url'] = 0;
|
||||
$this->_oView->default_startart_name = '';
|
||||
$aMR['mod_rewrite']['default_startart_name'] = '';
|
||||
}
|
||||
|
||||
// rewrite urls at
|
||||
if (mr_arrayValue($request, 'rewrite_urls_at') == 'congeneratecode') {
|
||||
$this->_oView->rewrite_urls_at_congeneratecode_chk = ' checked="checked"';
|
||||
$this->_oView->rewrite_urls_at_front_content_output_chk = '';
|
||||
$aMR['mod_rewrite']['rewrite_urls_at_congeneratecode'] = 1;
|
||||
$aMR['mod_rewrite']['rewrite_urls_at_front_content_output'] = 0;
|
||||
} else {
|
||||
$this->_oView->rewrite_urls_at_congeneratecode_chk = '';
|
||||
$this->_oView->rewrite_urls_at_front_content_output_chk = ' checked="checked"';
|
||||
$aMR['mod_rewrite']['rewrite_urls_at_congeneratecode'] = 0;
|
||||
$aMR['mod_rewrite']['rewrite_urls_at_front_content_output'] = 1;
|
||||
}
|
||||
|
||||
// routing
|
||||
if (isset($request['rewrite_routing'])) {
|
||||
$aRouting = array();
|
||||
$items = explode("\n", $request['rewrite_routing']);
|
||||
foreach ($items as $p => $v) {
|
||||
$routingDef = explode($routingSeparator, $v);
|
||||
if (count($routingDef) !== 2) {
|
||||
continue;
|
||||
}
|
||||
$routingDef[0] = trim($routingDef[0]);
|
||||
$routingDef[1] = trim($routingDef[1]);
|
||||
if ($routingDef[0] == '') {
|
||||
continue;
|
||||
}
|
||||
$aRouting[$routingDef[0]] = $routingDef[1];
|
||||
}
|
||||
$this->_oView->rewrite_routing = conHtmlentities($request['rewrite_routing']);
|
||||
$aMR['mod_rewrite']['routing'] = $aRouting;
|
||||
} else {
|
||||
$this->_oView->rewrite_routing = '';
|
||||
$aMR['mod_rewrite']['routing'] = array();
|
||||
}
|
||||
|
||||
// redirect invalid article to errorsite
|
||||
if (isset($request['redirect_invalid_article_to_errorsite'])) {
|
||||
$this->_oView->redirect_invalid_article_to_errorsite_chk = ' checked="checked"';
|
||||
$aMR['mod_rewrite']['redirect_invalid_article_to_errorsite'] = 1;
|
||||
} else {
|
||||
$this->_oView->redirect_invalid_article_to_errorsite_chk = '';
|
||||
$aMR['mod_rewrite']['redirect_invalid_article_to_errorsite'] = 0;
|
||||
}
|
||||
|
||||
if ($bError) {
|
||||
$sMsg = i18n("Please check your input", "mod_rewrite");
|
||||
$this->_oView->content_before .= $this->_notifyBox('error', $sMsg);
|
||||
return;
|
||||
}
|
||||
|
||||
if ($bDebug == true) {
|
||||
echo $this->_notifyBox('info', 'Debug');
|
||||
echo '<pre class="example">';
|
||||
print_r($aMR['mod_rewrite']);
|
||||
echo '</pre>';
|
||||
$sMsg = i18n("Configuration has <b>not</b> been saved, because of enabled debugging", "mod_rewrite");
|
||||
echo $this->_notifyBox('info', $sMsg);
|
||||
return;
|
||||
}
|
||||
|
||||
$bSeparatorModified = $this->_separatorModified($aMR['mod_rewrite']);
|
||||
|
||||
if (mr_setConfiguration($this->_client, $aMR)) {
|
||||
$sMsg = i18n("Configuration has been saved", "mod_rewrite");
|
||||
if ($bSeparatorModified) {
|
||||
mr_loadConfiguration($this->_client, true);
|
||||
}
|
||||
$this->_oView->content_before .= $this->_notifyBox('info', $sMsg);
|
||||
} else {
|
||||
$sMsg = i18n("Configuration could not saved. Please check write permissions for %s ", "mod_rewrite");
|
||||
$sMsg = sprintf($sMsg, $options['key']);
|
||||
$this->_oView->content_before .= $this->_notifyBox('error', $sMsg);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks, if any sseparators setting is modified or not
|
||||
* @param array $aNewCfg New configuration send by requests.
|
||||
* @return bool
|
||||
*/
|
||||
protected function _separatorModified($aNewCfg) {
|
||||
$aCfg = ModRewrite::getConfig();
|
||||
|
||||
if ($aCfg['category_seperator'] != $aNewCfg['category_seperator']) {
|
||||
return true;
|
||||
} elseif ($aCfg['category_word_seperator'] != $aNewCfg['category_word_seperator']) {
|
||||
return true;
|
||||
} elseif ($aCfg['article_seperator'] != $aNewCfg['article_seperator']) {
|
||||
return true;
|
||||
} elseif ($aCfg['article_word_seperator'] != $aNewCfg['article_word_seperator']) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Does some checks like 'is_start_compatible' check.
|
||||
* Adds notifications, if something will went wrong...
|
||||
*/
|
||||
protected function _doChecks() {
|
||||
// Check for not supported '$cfg["is_start_compatible"] = true;' mode
|
||||
if (!empty($this->_cfg['is_start_compatible']) && true === $this->_cfg['is_start_compatible']) {
|
||||
$sMsg = i18n("Your Contenido installation runs with the setting 'is_start_compatible'. This plugin will not work properly in this mode.<br />Please check following topic in Contenido forum to change this:<br /><br /><a href='http://forum.contenido.org/viewtopic.php?t=32530' class='blue' target='_blank'>is_start_compatible auf neue Version umstellen</a>", "mod_rewrite");
|
||||
$this->_oView->content_before .= $this->_notifyBox('warning', $sMsg);
|
||||
}
|
||||
|
||||
// Check for empty urlpath entries in cat_lang table
|
||||
$db = new DB_Contenido();
|
||||
$sql = "SELECT idcatlang FROM " . $this->_cfg['tab']['cat_lang'] . " WHERE urlpath = ''";
|
||||
if ($db->query($sql) && $db->next_record()) {
|
||||
$sMsg = i18n("It seems as if some categories don't have a set 'urlpath' entry in the database. Please reset empty aliases in %sFunctions%s area.", "mod_rewrite");
|
||||
$sMsg = sprintf($sMsg, '<a href="main.php?area=mod_rewrite_expert&frame=4&contenido=' . $this->_oView->sessid . '&idclient=' . $this->_client . '" onclick="parent.right_top.sub.clicked(parent.right_top.document.getElementById(\'c_1\').firstChild);">', '</a>');
|
||||
$this->_oView->content_before .= $this->_notifyBox('warning', $sMsg);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -1,143 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* AMR Content expert controller class
|
||||
*
|
||||
* @package plugin
|
||||
* @subpackage Mod Rewrite
|
||||
* @version SVN Revision $Rev$
|
||||
* @id $Id$:
|
||||
* @author Murat Purc <murat@purc.de>
|
||||
* @copyright four for business AG <www.4fb.de>
|
||||
* @license http://www.contenido.org/license/LIZENZ.txt
|
||||
* @link http://www.4fb.de
|
||||
* @link http://www.contenido.org
|
||||
*/
|
||||
|
||||
if (!defined('CON_FRAMEWORK')) {
|
||||
die('Illegal call');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Content expert controller for expert settings/actions.
|
||||
*
|
||||
* @author Murat Purc <murat@purc.de>
|
||||
* @package plugin
|
||||
* @subpackage Mod Rewrite
|
||||
*/
|
||||
class ModRewrite_ContentExpertController extends ModRewrite_ControllerAbstract {
|
||||
|
||||
/**
|
||||
* Path to restrictive htaccess file
|
||||
* @var string
|
||||
*/
|
||||
protected $_htaccessRestrictive = '';
|
||||
|
||||
/**
|
||||
* Path to simple htaccess file
|
||||
* @var string
|
||||
*/
|
||||
protected $_htaccessSimple = '';
|
||||
|
||||
/**
|
||||
* Initializer method, sets the paths to htaccess files
|
||||
*/
|
||||
public function init() {
|
||||
$this->_oView->content_before = '';
|
||||
|
||||
$pluginPath = $this->_cfg['path']['contenido'] . $this->_cfg['path']['plugins'] . 'mod_rewrite/';
|
||||
$this->_htaccessRestrictive = $pluginPath . 'files/htaccess_restrictive.txt';
|
||||
$this->_htaccessSimple = $pluginPath . 'files/htaccess_simple.txt';
|
||||
}
|
||||
|
||||
/**
|
||||
* Index action
|
||||
*/
|
||||
public function indexAction() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy htaccess action
|
||||
*/
|
||||
public function copyHtaccessAction() {
|
||||
$type = $this->_getParam('htaccesstype');
|
||||
$copy = $this->_getParam('copy');
|
||||
|
||||
if ($type != 'restrictive' && $type != 'simple') {
|
||||
return;
|
||||
} elseif ($copy != 'contenido' && $copy != 'cms') {
|
||||
return;
|
||||
}
|
||||
|
||||
$aInfo = $this->getProperty('htaccessInfo');
|
||||
|
||||
if ($aInfo['has_htaccess']) {
|
||||
$this->_oView->content_before = $this->_notifyBox('info', 'Die .htaccess existiert bereits im Contenido-/ oder Mandantenverzeichnis, daher wird es nicht kopiert');
|
||||
return;
|
||||
}
|
||||
|
||||
if ($type == 'restrictive') {
|
||||
$source = $this->_htaccessRestrictive;
|
||||
} else {
|
||||
$source = $this->_htaccessSimple;
|
||||
}
|
||||
|
||||
if ($copy == 'contenido') {
|
||||
$dest = $aInfo['contenido_full_path'] . '.htaccess';
|
||||
} else {
|
||||
$dest = $aInfo['client_full_path'] . '.htaccess';
|
||||
}
|
||||
|
||||
if (!$result = @copy($source, $dest)) {
|
||||
$this->_oView->content_before = $this->_notifyBox('info', 'Die .htaccess konnte nicht von ' . $source . ' nach ' . $dest . ' kopiert werden!');
|
||||
return;
|
||||
}
|
||||
|
||||
$msg = 'Die .htaccess wurde erfolgreich nach ' . str_replace('.htaccess', '', $dest) . ' kopiert';
|
||||
$this->_oView->content_before = $this->_notifyBox('info', $msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* Download htaccess action
|
||||
*/
|
||||
public function downloadHtaccessAction() {
|
||||
$type = $this->_getParam('htaccesstype');
|
||||
|
||||
if ($type != 'restrictive' && $type != 'simple') {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($type == 'restrictive') {
|
||||
$source = $this->_htaccessRestrictive;
|
||||
} else {
|
||||
$source = $this->_htaccessSimple;
|
||||
}
|
||||
|
||||
$this->_oView->content = file_get_contents($source);
|
||||
|
||||
header('Content-Type: text/plain');
|
||||
header('Etag: ' . md5(mt_rand()));
|
||||
header('Content-Disposition: attachment; filename="' . $type . '.htaccess"');
|
||||
$this->render('{CONTENT}');
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset aliases action
|
||||
*/
|
||||
public function resetAction() {
|
||||
// recreate all aliases
|
||||
ModRewrite::recreateAliases(false);
|
||||
$this->_oView->content_before = $this->_notifyBox('info', 'Alle Aliase wurden zurückgesetzt');
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset only empty aliases action
|
||||
*/
|
||||
public function resetEmptyAction() {
|
||||
// recreate only empty aliases
|
||||
ModRewrite::recreateAliases(true);
|
||||
$this->_oView->content_before = $this->_notifyBox('info', 'Nur leere Aliase wurden zurückgesetzt');
|
||||
}
|
||||
|
||||
}
|
|
@ -1,176 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* AMR test controller
|
||||
*
|
||||
* @package plugin
|
||||
* @subpackage Mod Rewrite
|
||||
* @version SVN Revision $Rev$
|
||||
* @id $Id$:
|
||||
* @author Murat Purc <murat@purc.de>
|
||||
* @copyright four for business AG <www.4fb.de>
|
||||
* @license http://www.contenido.org/license/LIZENZ.txt
|
||||
* @link http://www.4fb.de
|
||||
* @link http://www.contenido.org
|
||||
*/
|
||||
|
||||
if (!defined('CON_FRAMEWORK')) {
|
||||
die('Illegal call');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Content controller to run tests.
|
||||
*
|
||||
* @author Murat Purc <murat@purc.de>
|
||||
* @package plugin
|
||||
* @subpackage Mod Rewrite
|
||||
*/
|
||||
class ModRewrite_ContentTestController extends ModRewrite_ControllerAbstract {
|
||||
|
||||
/**
|
||||
* Number of max items to process
|
||||
* @var int
|
||||
*/
|
||||
protected $_iMaxItems = 0;
|
||||
|
||||
/**
|
||||
* Initializer method, sets some view variables
|
||||
*/
|
||||
public function init() {
|
||||
$this->_oView->content = '';
|
||||
$this->_oView->form_idart_chk = ($this->_getParam('idart')) ? ' checked="checked"' : '';
|
||||
$this->_oView->form_idcat_chk = ($this->_getParam('idcat')) ? ' checked="checked"' : '';
|
||||
$this->_oView->form_idcatart_chk = ($this->_getParam('idcatart')) ? ' checked="checked"' : '';
|
||||
$this->_oView->form_idartlang_chk = ($this->_getParam('idartlang')) ? ' checked="checked"' : '';
|
||||
$this->_oView->form_maxitems = (int) $this->_getParam('maxitems', 200);
|
||||
$this->_iMaxItems = $this->_oView->form_maxitems;
|
||||
}
|
||||
|
||||
/**
|
||||
* Index action
|
||||
*/
|
||||
public function indexAction() {
|
||||
$this->_oView->content = '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Test action
|
||||
*/
|
||||
public function testAction() {
|
||||
$this->_oView->content = '';
|
||||
|
||||
// Array for testcases
|
||||
$aTests = array();
|
||||
|
||||
// Instance of mr test
|
||||
$oMRTest = new ModRewriteTest($this->_iMaxItems);
|
||||
|
||||
$startTime = getmicrotime();
|
||||
|
||||
// Fetch complete CONTENIDO page structure
|
||||
$aStruct = $oMRTest->fetchFullStructure();
|
||||
ModRewriteDebugger::add($aStruct, 'mr_test.php $aStruct');
|
||||
|
||||
// Loop through the structure and compose testcases
|
||||
foreach ($aStruct as $idcat => $aCat) {
|
||||
// category
|
||||
$aTests[] = array(
|
||||
'url' => $oMRTest->composeURL($aCat, 'c'),
|
||||
'level' => $aCat['level'],
|
||||
'name' => $aCat['name']
|
||||
);
|
||||
|
||||
foreach ($aCat['articles'] as $idart => $aArt) {
|
||||
// articles
|
||||
$aTests[] = array(
|
||||
'url' => $oMRTest->composeURL($aArt, 'a'),
|
||||
'level' => $aCat['level'],
|
||||
'name' => $aCat['name'] . ' :: ' . $aArt['title']
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// compose content
|
||||
$this->_oView->content = '<pre>';
|
||||
|
||||
$oMRUrlStack = ModRewriteUrlStack::getInstance();
|
||||
|
||||
// first loop to add urls to mr url stack
|
||||
foreach ($aTests as $p => $v) {
|
||||
$oMRUrlStack->add($v['url']);
|
||||
}
|
||||
|
||||
$successCounter = 0;
|
||||
$failCounter = 0;
|
||||
|
||||
// second loop to do the rest
|
||||
foreach ($aTests as $p => $v) {
|
||||
$url = mr_buildNewUrl($v['url']);
|
||||
$arr = $oMRTest->resolveUrl($url);
|
||||
$error = '';
|
||||
$resUrl = $oMRTest->getResolvedUrl();
|
||||
$color = 'green';
|
||||
|
||||
if ($url !== $resUrl) {
|
||||
if ($oMRTest->getRoutingFoundState()) {
|
||||
$successCounter++;
|
||||
$resUrl = 'route to -> ' . $resUrl;
|
||||
} else {
|
||||
$color = 'red';
|
||||
$failCounter++;
|
||||
}
|
||||
} else {
|
||||
$successCounter++;
|
||||
}
|
||||
|
||||
// @todo: translate
|
||||
if (isset($arr['error'])) {
|
||||
switch ($arr['error']) {
|
||||
case ModRewriteController::ERROR_CLIENT:
|
||||
$error = 'client';
|
||||
break;
|
||||
case ModRewriteController::ERROR_LANGUAGE:
|
||||
$error = 'language';
|
||||
break;
|
||||
case ModRewriteController::ERROR_CATEGORY:
|
||||
$error = 'category';
|
||||
break;
|
||||
case ModRewriteController::ERROR_ARTICLE:
|
||||
$error = 'article';
|
||||
break;
|
||||
case ModRewriteController::ERROR_POST_VALIDATION:
|
||||
$error = 'validation';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$pref = str_repeat(' ', $v['level']);
|
||||
|
||||
// render resolve information for current item
|
||||
$itemTpl = $this->_oView->lng_result_item_tpl;
|
||||
$itemTpl = str_replace('{pref}', $pref, $itemTpl);
|
||||
$itemTpl = str_replace('{name}', $v['name'], $itemTpl);
|
||||
$itemTpl = str_replace('{url_in}', $v['url'], $itemTpl);
|
||||
$itemTpl = str_replace('{url_out}', $url, $itemTpl);
|
||||
$itemTpl = str_replace('{color}', $color, $itemTpl);
|
||||
$itemTpl = str_replace('{url_res}', $resUrl, $itemTpl);
|
||||
$itemTpl = str_replace('{err}', $error, $itemTpl);
|
||||
$itemTpl = str_replace('{data}', $oMRTest->getReadableResolvedData($arr), $itemTpl);
|
||||
|
||||
$this->_oView->content .= "\n" . $itemTpl . "\n";
|
||||
}
|
||||
$this->_oView->content .= '</pre>';
|
||||
|
||||
$totalTime = sprintf('%.4f', (getmicrotime() - $startTime));
|
||||
|
||||
// render information about current test
|
||||
$msg = $this->_oView->lng_result_message_tpl;
|
||||
$msg = str_replace('{time}', $totalTime, $msg);
|
||||
$msg = str_replace('{num_urls}', ($successCounter + $failCounter), $msg);
|
||||
$msg = str_replace('{num_success}', $successCounter, $msg);
|
||||
$msg = str_replace('{num_fail}', $failCounter, $msg);
|
||||
|
||||
$this->_oView->content = $msg . $this->_oView->content;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,226 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* AMR abstract controller class
|
||||
*
|
||||
* @package plugin
|
||||
* @subpackage Mod Rewrite
|
||||
* @version SVN Revision $Rev$
|
||||
* @id $Id$:
|
||||
* @author Murat Purc <murat@purc.de>
|
||||
* @copyright four for business AG <www.4fb.de>
|
||||
* @license http://www.contenido.org/license/LIZENZ.txt
|
||||
* @link http://www.4fb.de
|
||||
* @link http://www.contenido.org
|
||||
*/
|
||||
|
||||
if (!defined('CON_FRAMEWORK')) {
|
||||
die('Illegal call');
|
||||
}
|
||||
|
||||
/**
|
||||
* Abstract controller for all concrete mod_rewrite controller implementations.
|
||||
*
|
||||
* @author Murat Purc <murat@purc.de>
|
||||
* @package plugin
|
||||
* @subpackage Mod Rewrite
|
||||
*/
|
||||
abstract class ModRewrite_ControllerAbstract {
|
||||
|
||||
/**
|
||||
* View object, holds all view variables
|
||||
* @var stdClass
|
||||
*/
|
||||
protected $_oView;
|
||||
|
||||
/**
|
||||
* Global CONTENIDO $cfg variable
|
||||
* @var array
|
||||
*/
|
||||
protected $_cfg;
|
||||
|
||||
/**
|
||||
* Global CONTENIDO $client variable (client id)
|
||||
* @var int
|
||||
*/
|
||||
protected $_client;
|
||||
|
||||
/**
|
||||
* Global CONTENIDO $area variable (area name/id)
|
||||
* @var int|string
|
||||
*/
|
||||
protected $_area;
|
||||
|
||||
/**
|
||||
* Global CONTENIDO $action variable (send by request)
|
||||
* @var string
|
||||
*/
|
||||
protected $_action;
|
||||
|
||||
/**
|
||||
* Global CONTENIDO $frame variable (current frame in backend)
|
||||
* @var int
|
||||
*/
|
||||
protected $_frame;
|
||||
|
||||
/**
|
||||
* Global CONTENIDO $contenido variable (session id)
|
||||
* @var string
|
||||
*/
|
||||
protected $_contenido;
|
||||
|
||||
/**
|
||||
* Template file or template string to render
|
||||
* @var string
|
||||
*/
|
||||
protected $_template = null;
|
||||
|
||||
/**
|
||||
* Additional properties list
|
||||
* @var array
|
||||
*/
|
||||
protected $_properties = array();
|
||||
|
||||
/**
|
||||
* Debug flag
|
||||
* @var bool
|
||||
*/
|
||||
protected $_debug = false;
|
||||
|
||||
/**
|
||||
* Constructor, sets some properties by assigning global variables to them.
|
||||
*/
|
||||
public function __construct() {
|
||||
global $cfg, $client, $area, $action, $frame, $contenido, $sess;
|
||||
|
||||
$this->_oView = new stdClass();
|
||||
$this->_cfg = $cfg;
|
||||
$this->_area = $area;
|
||||
$this->_action = $action;
|
||||
$this->_frame = $frame;
|
||||
$this->_client = $client;
|
||||
$this->_contenido = $contenido;
|
||||
|
||||
$this->_oView->area = $this->_area;
|
||||
$this->_oView->frame = $this->_frame;
|
||||
$this->_oView->contenido = $this->_contenido;
|
||||
$this->_oView->sessid = $sess->id;
|
||||
$this->_oView->lng_more_informations = i18n("More informations", "mod_rewrite");
|
||||
|
||||
$this->init();
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializer method, could be overwritten by childs.
|
||||
* This method will be invoked in constructor of ModRewrite_ControllerAbstract.
|
||||
*/
|
||||
public function init() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* View property setter.
|
||||
* @param object $oView
|
||||
*/
|
||||
public function setView($oView) {
|
||||
if (is_object($oView)) {
|
||||
$this->_oView = $oView;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* View property getter.
|
||||
* @return object
|
||||
*/
|
||||
public function getView() {
|
||||
return $this->_oView;
|
||||
}
|
||||
|
||||
/**
|
||||
* Property setter.
|
||||
* @param string $key
|
||||
* @param mixed $value
|
||||
*/
|
||||
public function setProperty($key, $value) {
|
||||
$this->_properties[$key] = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Property getter.
|
||||
* @param string $key
|
||||
* @param mixed $default
|
||||
* @return mixed
|
||||
*/
|
||||
public function getProperty($key, $default = null) {
|
||||
return (isset($this->_properties[$key])) ? $this->_properties[$key] : $default;
|
||||
}
|
||||
|
||||
/**
|
||||
* Template setter.
|
||||
* @param string $sTemplate Either full path and name of template file or a template string.
|
||||
*/
|
||||
public function setTemplate($sTemplate) {
|
||||
$this->_template = $sTemplate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Template getter.
|
||||
* @return string
|
||||
*/
|
||||
public function getTemplate() {
|
||||
return $this->_template;
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders template by replacing all view variables in template.
|
||||
* @param string Either full path and name of template file or a template string.
|
||||
* If not passed, previous set template will be used.
|
||||
* @throws Exception if no template is set
|
||||
* @return string
|
||||
*/
|
||||
public function render($template = null) {
|
||||
if ($template == null) {
|
||||
$template = $this->_template;
|
||||
}
|
||||
|
||||
if ($template == null) {
|
||||
throw new Exception('Missing template to render.');
|
||||
}
|
||||
|
||||
$oTpl = new Template();
|
||||
foreach ($this->_oView as $k => $v) {
|
||||
$oTpl->set('s', strtoupper($k), $v);
|
||||
}
|
||||
$oTpl->generate($template, 0, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns parameter from request, the order is:
|
||||
* - Return from $_GET, if found
|
||||
* - Return from $_POST, if found
|
||||
*
|
||||
* @param string $key
|
||||
* @param mixed $default The default value
|
||||
* @return mixed
|
||||
*/
|
||||
protected function _getParam($key, $default = null) {
|
||||
if (isset($_GET[$key])) {
|
||||
return $_GET[$key];
|
||||
} elseif (isset($_POST[$key])) {
|
||||
return $_POST[$key];
|
||||
} else {
|
||||
return $default;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns rendered notification markup by using global $notification variable.
|
||||
* @param string $type One of cGuiNotification::LEVEL_* constants
|
||||
* @param string $msg The message to display
|
||||
* @return string
|
||||
*/
|
||||
protected function _notifyBox($type, $msg) {
|
||||
global $notification;
|
||||
return $notification->returnNotification($type, $msg) . '<br>';
|
||||
}
|
||||
|
||||
}
|
|
@ -1,43 +0,0 @@
|
|||
/*
|
||||
Node structure
|
||||
--------------
|
||||
.aToolTip
|
||||
.aToolTipInner
|
||||
.aToolTipContent
|
||||
.aToolTipCloseBtn
|
||||
|
||||
*/
|
||||
|
||||
.aToolTip { margin:2px 0 0 2px; }
|
||||
|
||||
.aToolTipInner {
|
||||
border-left:1px solid #b3b3b3;
|
||||
border-top:1px solid #666;
|
||||
border-right:2px solid #b3b3b3;
|
||||
border-bottom:2px solid #b3b3b3;
|
||||
background:#f1f1f1;
|
||||
color:#000;
|
||||
margin:0;
|
||||
padding:4px 12px 6px 24px;
|
||||
margin:-2px 0 0 -2px;
|
||||
}
|
||||
|
||||
.aToolTipInner .aToolTipContent {
|
||||
position:relative;
|
||||
margin:0;
|
||||
padding:0;
|
||||
}
|
||||
|
||||
a.aToolTipCloseBtn {
|
||||
display:block;
|
||||
height:16px;
|
||||
width:16px;
|
||||
background:url(../images/infoBtn.gif) no-repeat;
|
||||
text-indent:-9999px;
|
||||
outline:none;
|
||||
position:absolute;
|
||||
top:1px;
|
||||
left:1px;
|
||||
margin:1px 2px 2px 1px;
|
||||
padding:0px;
|
||||
}
|
|
@ -1,174 +0,0 @@
|
|||
/* Eric Meyer's Reset Reloaded */
|
||||
/* http://meyerweb.com/eric/thoughts/2007/05/01/reset-reloaded/ */
|
||||
html, body, div, span, applet, object, iframe,
|
||||
h1, h2, h3, h4, h5, h6, p, blockquote, a, abbr, acronym, address, big, cite, code,del, dfn, em,
|
||||
font, img, ins, kbd, q, s, samp,small, strike, strong, sub,
|
||||
sup, tt, var,b, u, i, center,dl, dt, dd, ol, ul, li,
|
||||
fieldset, form, label, legend,table, caption, tbody, tfoot,
|
||||
thead, tr, th, td {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
outline: 0;
|
||||
font-size: 100%;
|
||||
vertical-align: baseline;
|
||||
background: transparent;
|
||||
}
|
||||
ol, ul {list-style: none;}
|
||||
blockquote, q {quotes: none;}
|
||||
table {border-collapse: collapse;border-spacing: 0;}
|
||||
|
||||
.clearfix:after {content: ".";display: block;height: 0;clear: both;visibility: hidden;}
|
||||
/* IE6 */
|
||||
* html .clearfix {height: 1%;}
|
||||
/* IE7 */
|
||||
*:first-child+html .clearfix {min-height: 1px;}
|
||||
|
||||
|
||||
body {
|
||||
background: #282828 url(../images/bg.png) repeat-x;
|
||||
color: #999999;
|
||||
font-size: 12px;
|
||||
line-height: 20px;
|
||||
font-family: Arial, helvetica;
|
||||
}
|
||||
|
||||
a,
|
||||
a:link,
|
||||
a:visited {
|
||||
color: #FEC92C;
|
||||
text-decoration: none;
|
||||
|
||||
}
|
||||
|
||||
a:hover,
|
||||
a:active,
|
||||
a:focus {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
|
||||
a.exampleTip {
|
||||
color: #FEC92C;
|
||||
}
|
||||
|
||||
a.exampleTip:hover{
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.section {
|
||||
text-align: left;
|
||||
padding-bottom: 18px;
|
||||
border-bottom: 1px solid #333;
|
||||
margin-bottom: 18px;
|
||||
}
|
||||
|
||||
p {
|
||||
margin: 0 0 18px;
|
||||
}
|
||||
|
||||
h2 {
|
||||
color: #fff;
|
||||
font-size: 22px;
|
||||
line-height: 24px;
|
||||
margin: 0 0 24px;
|
||||
padding: 0;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
h3{
|
||||
color: #ddd;
|
||||
font-size: 14px;
|
||||
line-height: 18px;
|
||||
margin: 0 0 18px;
|
||||
}
|
||||
|
||||
|
||||
h1.logo {
|
||||
display: block;
|
||||
height: 80px;
|
||||
width: 260px;
|
||||
margin: 40px auto 0;
|
||||
}
|
||||
|
||||
h1.logo a{
|
||||
display: block;
|
||||
height: 80px;
|
||||
width: 260px;
|
||||
text-indent: -9999px;
|
||||
background: url(../images/logo.png) no-repeat;
|
||||
}
|
||||
|
||||
|
||||
ul.demos {
|
||||
list-style-type: none;
|
||||
|
||||
}
|
||||
|
||||
ul.demos li{
|
||||
margin: 0 0 10px 0;
|
||||
}
|
||||
|
||||
|
||||
.primaryWrapper {
|
||||
margin: 0 auto;
|
||||
width: 960px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.branding{
|
||||
text-align: center;
|
||||
display: block;
|
||||
height: 120px;
|
||||
}
|
||||
|
||||
|
||||
.ctaBtns {border: none; text-align: center;}
|
||||
|
||||
.ctaBtns p {
|
||||
width: 263px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
|
||||
.ctaBtns a{
|
||||
display: block;
|
||||
height: 37px;
|
||||
width: 122px;
|
||||
text-indent: -9999px;
|
||||
}
|
||||
|
||||
a.dloadBtn {
|
||||
background: url(../images/dload-btn.png) no-repeat top left;
|
||||
float: left;
|
||||
margin-right: 18px;
|
||||
}
|
||||
|
||||
a.demoBtn {
|
||||
background: url(../images/demo-btn.png) no-repeat top left;
|
||||
float: left;
|
||||
}
|
||||
|
||||
a.dloadBtn:hover,
|
||||
a.demoBtn:hover {
|
||||
background-position: bottom left;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.usage p {
|
||||
margin-bottom: 2px;
|
||||
}
|
||||
|
||||
ul.quickFacts {
|
||||
list-style-position: inside;
|
||||
list-style-type: disc;
|
||||
}
|
||||
|
||||
p.license,
|
||||
p.copyright {
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1,81 +0,0 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
|
||||
<title>aToolTip Demos</title>
|
||||
|
||||
<!-- CSS -->
|
||||
<link type="text/css" href="css/style.css" rel="stylesheet" media="screen">
|
||||
|
||||
<!-- aToolTip css -->
|
||||
<link type="text/css" href="css/atooltip.css" rel="stylesheet" media="screen">
|
||||
|
||||
|
||||
<!-- Scripts -->
|
||||
<script type="text/javascript" src="js/jquery.min.js"></script>
|
||||
|
||||
<!-- aToolTip js -->
|
||||
<script type="text/javascript" src="js/atooltip.min.jquery.js"></script>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
$('a.normalTip').aToolTip();
|
||||
|
||||
|
||||
$('a.fixedTip').aToolTip({
|
||||
fixed: true
|
||||
});
|
||||
|
||||
$('a.clickTip').aToolTip({
|
||||
clickIt: true,
|
||||
tipContent: 'Hello I am aToolTip with content from the "tipContent" param'
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="primaryWrapper">
|
||||
|
||||
<div class="branding">
|
||||
<h1 class="logo"><a href="#">aToolTip</a></h1>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<!-- DEMOS -->
|
||||
|
||||
<div class="section" id="demos">
|
||||
<h2>Demos</h2>
|
||||
|
||||
<ul class="demos">
|
||||
<li><a href="#" class="normalTip exampleTip" title="Hello, I am aToolTip">Normal Tooltip</a> - This is a normal tooltip with default settings.</li>
|
||||
<li><a href="#" class="fixedTip exampleTip" title="Hello, I am aToolTip">Fixed Tooltip</a> - This is a fixed tooltip that doesnt follow the mouse.</li>
|
||||
<li><a href="#" class="clickTip exampleTip" >On Click Tooltip</a> - This is a click activated tooltip with content passed in from 'tipContent' param</li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- END DEMOS -->
|
||||
|
||||
|
||||
<p class="copyright">
|
||||
Copyright © 2009 Ara Abcarians. aToolTip was built for use with <a href="http://jquery.com">jQuery</a> by <a href="http://ara-abcarians.com/"> Ara Abcarians.</a>
|
||||
</p>
|
||||
|
||||
<p class="license">
|
||||
<a rel="license" href="http://creativecommons.org/licenses/by/3.0/"><img alt="Creative Commons License" style="border-width:0" src="http://creativecommons.org/images/public/somerights20.png"></a><br>This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by/3.0/">Creative Commons Attribution 3.0 Unported License</a>.
|
||||
</p>
|
||||
|
||||
|
||||
</div> <!-- /primaryWrapper -->
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
Binäre Datei nicht angezeigt.
Vorher Breite: | Höhe: | Größe: 1.2 KiB |
Binäre Datei nicht angezeigt.
Vorher Breite: | Höhe: | Größe: 90 B |
Einige Dateien werden nicht angezeigt, da zu viele Dateien in diesem Diff geändert wurden Mehr anzeigen
Laden…
In neuem Issue referenzieren