/** * 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::create(); $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."&"; $sPath = Contenido_Url::getInstance()->build(array('idcatart' => $iIDCatArt, 'client' => $client, 'lang' => $lang), true); $sPath .= strpos($sPath, '?') === false ? '?' : '&'; $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; } }
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")); } } } if (count($aSearchIDInfosCat) > 0) { // Checks idcats for ($i = 0; $i < count($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 . "', '" . html_entity_decode($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; }
// 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", $plugin_name) . "--", 0); $oSelHTMLTemplateIDCat->addOptionElement(0, $oOptionTemplate); $oOptionNewsletter = new cHTMLOptionElement("--" . i18n("Please select", $plugin_name) . "--", 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);
/** * 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(); }
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; }
/** * Deletes all corresponding informations to this workflow and delegate call to parent * @param integer $idWorkflow - id of workflow to delete */ function delete($idWorkflow) { global $cfg; $oDb = new DB_Contenido(); $aItemIdsDelete = array(); $sSql = 'SELECT idworkflowitem FROM ' . $cfg["tab"]["workflow_items"] . ' WHERE idworkflow = ' . Contenido_Security::toInteger($idWorkflow) . ';'; $oDb->query($sSql); while ($oDb->next_record()) { array_push($aItemIdsDelete, Contenido_Security::escapeDB($oDb->f('idworkflowitem'), $oDb)); } $aUserSequencesDelete = array(); $sSql = 'SELECT idusersequence FROM ' . $cfg["tab"]["workflow_user_sequences"] . ' WHERE idworkflowitem in (' . implode(',', $aItemIdsDelete) . ');'; $oDb->query($sSql); while ($oDb->next_record()) { array_push($aUserSequencesDelete, Contenido_Security::escapeDB($oDb->f('idusersequence'), $oDb)); } $sSql = 'DELETE FROM ' . $cfg["tab"]["workflow_user_sequences"] . ' WHERE idworkflowitem in (' . implode(',', $aItemIdsDelete) . ');'; $oDb->query($sSql); $sSql = 'DELETE FROM ' . $cfg["tab"]["workflow_actions"] . ' WHERE idworkflowitem in (' . implode(',', $aItemIdsDelete) . ');'; $oDb->query($sSql); $sSql = 'DELETE FROM ' . $cfg["tab"]["workflow_items"] . ' WHERE idworkflow = ' . Contenido_Security::toInteger($idWorkflow) . ';'; $oDb->query($sSql); $sSql = 'DELETE FROM ' . $cfg["tab"]["workflow_allocation"] . ' WHERE idworkflow = ' . Contenido_Security::toInteger($idWorkflow) . ';'; $oDb->query($sSql); $sSql = 'DELETE FROM ' . $cfg["tab"]["workflow_art_allocation"] . ' WHERE idusersequence in (' . implode(',', $aUserSequencesDelete) . ');'; $oDb->query($sSql); parent::delete($idWorkflow); }
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\n LEFT JOIN " . $cfg['tab']['art_lang'] . " art ON (art.idart = cat.idart)\n LEFT JOIN " . $cfg['tab']['cat_lang'] . " catName ON (catName.idcat = cat.idcat)\n LEFT JOIN " . $cfg['tab']['content'] . " con ON (con.idartlang = art.idartlang)\n WHERE (con.value LIKE '%action%' OR con.value LIKE '%data%' OR con.value LIKE '%href%' OR con.value LIKE '%src%')\n AND cat.idcat IN (0, " . join(", ", $aCats) . ") AND cat.idcat != '0' " . $sLang_where . "\n 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")); } }
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; }
// check requests Contenido_Security::checkRequests(); 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 = '';
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); }
/** * 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; }
/** * 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; }
/** * setCatLang sets the idcatlang for the current item. Should * only be called by the create function. * @param int $idcatlang idcatlang to set. */ function setCatLang($idcatlang) { global $cfg; $allocations = new WorkflowAllocations(); $allocations->select("idcatlang = '{$idcatlang}'"); if ($allocations->next() !== false) { $this->lasterror = i18n("Category already has a workflow assigned", "workflow"); return false; } $db = new DB_Contenido(); $sql = "SELECT idcatlang FROM " . $cfg["tab"]["cat_lang"] . " WHERE idcatlang = '" . Contenido_Security::toInteger($idcatlang) . "'"; $db->query($sql); if (!$db->next_record()) { $this->lasterror = i18n("Category doesn't exist, assignment failed", "workflow"); return false; } parent::setField("idcatlang", $idcatlang); parent::store(); return true; }
$tpl->set('s', 'TH_TEMPLATE', i18n("Template")); $tpl->set('s', 'TH_ACTIONS', i18n("Actions")); $tpl->set('s', 'TH_TITLE', i18n("Title")); $tpl->set('s', 'TH_CHANGED', i18n("Changed")); $tpl->set('s', 'TH_PUBLISHED', i18n("Published")); $tpl->set('s', 'TH_WORKFLOW_STEP', i18n("Workflow Step", 'workflow')); $tpl->set('s', 'TH_WORKFLOW_ACTION', i18n("Workflow Action", 'workflow')); $tpl->set('s', 'TH_WORKFLOW_EDITOR', i18n("Workflow Editor", 'workflow')); $tpl->set('s', 'TH_LAST_STATUS', i18n("Last status", 'workflow')); $currentUserSequence = new WorkflowUserSequence(); if (is_array($isCurrent)) { foreach ($isCurrent as $key => $value) { if ($value == true) { $idartlang = Contenido_Security::toInteger($article[$key]); $lang = Contenido_Security::toInteger($lang); $client = Contenido_Security::toInteger($client); $sql = "SELECT B.idcat AS idcat, A.title AS title, A.created AS created, A.lastmodified AS changed, \n A.idart as idart, E.name as tpl_name, A.idartlang as idartlang, F.idcatlang as idcatlang,\n B.idcatart as idcatart, A.idlang as art_lang, F.startidartlang as startidartlang\n \t\t\tFROM (" . $cfg["tab"]["art_lang"] . " AS A,\n " . $cfg["tab"]["cat_art"] . " AS B,\n \t\t\t\t\t " . $cfg["tab"]["art"] . " AS C)\n LEFT JOIN " . $cfg['tab']['tpl_conf'] . " as D ON A.idtplcfg = D.idtplcfg\n LEFT JOIN " . $cfg['tab']['tpl'] . " as E ON D.idtpl = E.`idtpl`\n LEFT JOIN " . $cfg['tab']['cat_lang'] . " as F ON B.idcat = F.`idcat`\n\t\t\t\t\t WHERE A.idartlang = '{$idartlang}' AND\n\t\t\t\t\t\t A.idart = B.idart AND\n\t\t\t\t\t\t A.idart = C.idart AND\n\t\t\t\t\t\t A.idlang = '{$lang}' AND\n \t\t\t\t\t\t C.idclient = '{$client}';"; $db->query($sql); if ($db->next_record()) { global $area; //$area = "con"; $idcat = $db->f("idcat"); $idart = $db->f("idart"); # create javascript multilink $tmp_mstr = '<a href="javascript://" onclick="javascript:conMultiLink(\'%s\', \'%s\', \'%s\', \'%s\')" title="idart: ' . $db->f('idart') . ' idcatart: ' . $db->f('idcatart') . '" alt="idart: ' . $db->f('idart') . ' idcatart: ' . $db->f('idcatart') . '">%s</a>'; $mstr = sprintf($tmp_mstr, 'right_top', $sess->url("main.php?area=con&frame=3&idcat={$idcat}&idtpl={$idtpl}"), 'right_bottom', $sess->url("main.php?area=con_editart&action=con_edit&frame=4&idcat={$idcat}&idtpl={$idtpl}&idart={$idart}"), $db->f("title")); $laststatus = getLastWorkflowStatus($idartlang); $username = getGroupOrUserName($userids[$key]); $actionSelect = piworkflowRenderColumn($idcat, $idart, $db->f('idartlang'), 'wfaction'); $currentUserSequence->loadByPrimaryKey($usersequence[$key]); $workflowItem = $currentUserSequence->getWorkflowItem();