/** * standard constructor * @param string $headline Headline, to be displayed in the form * @param string $icon Icon, to be displayed in the form. Name of the file, stored in images folder. * @param string $name Name of the form. Will be used in HTML. * @param string $action Next script, that shall be called when submitting. Empty if self. * @param string $method POST or GET for sending the form. POST is default and strongly recommended * @param string $enctype Specify the enctype for the form. Use only when submitting files as multipart. */ function ObjectForm($headline, $icon = "", $name = "form1", $action = "", $method = "POST", $enctype = "") { Form::Form($headline, $icon, $name, $action, $method, $enctype); // initialize with values. global $oid, $action, $variation, $changevariation; $this->oid = $oid; $this->externalAction = $action; $this->title = getDBCell("content", "NAME", "CID = $oid"); $this->headline .= ": " . $this->title; // get current variation! if (isset($variation) && isset($changevariation)) pushVar("variation", $variation); $this->variation = getVar("variation"); if ($this->variation == 0) $this->variation = 1; // set to standard. $this->populateVariations(); // get current edit-scheme (META or CONTENT) global $changeeditor, $lang, $processing, $page_state; if (isset($changeeditor)) { pushVar("schemeEditor", $changeeditor); $processing = ""; // enable database loading if switched. $page_state = "START"; } $this->editor = getVar("schemeEditor"); if ($this->editor == "") $this->editor = $lang->get("ed_content"); // prepare the form drawing. // check, if variation is defined or not. if (count($this->variations) > 0) { // define sniplets. $this->draw_jobButton(); $this->draw_variationSelector(); $this->draw_myBody(); $this->draw_config(); } else { global $lang; $this->addToTopText($lang->get("no_variations")); $this->setTopStyle($this->errorstyle); } }
/** * standard constructor. */ function cmsmenu() { global $mid, $auth; $temp_menu = ""; if (!isset($mid)) { $temp_menu = getVar("menu"); } else { $temp_menu = $mid; } if ($temp_menu != "") { //process the menu id (mid) now. // it has Form: <menu>x<submenu> $msplit = explode("x", $temp_menu); $this->selectedMenu = $msplit[0]; $this->selectedSubmenu = $msplit[1]; } pushVar("menu", $temp_menu); }
/** * standard constructor. */ function TabBar($tabid = 'menu', $id = "mmid") { $this->id = $id; $temp_menu = $_GET[$this->id]; if ($temp_menu == '') { $temp_menu = $_POST[$this->id]; } if ($temp_menu == '') { $temp_menu = getVar($tabid); } $this->selectedMenu = 1; $this->selectedSubmenu = 0; if ($temp_menu != "") { //process the menu id (mid) now. // it has Form: <menu>x<submenu> $msplit = explode("x", $temp_menu); $this->selectedMenu = $msplit[0]; $this->selectedSubmenu = $msplit[1]; } pushVar($tabid, $temp_menu); $this->doc = $_SERVER['REQUEST_URI']; }
/** * @param string db-table, on which you want to filter * @param string primary key of the table */ function Filter($table, $pk) { global $lang; $this->table = $table; $this->pk = $pk; $this->icon = "li_standard.gif"; // 14x11 pixels. $this->type_name = "Records"; // get the action template to use. $temp = explode("?", $_SERVER["REQUEST_URI"]); $temp2 = explode("/", $temp[0]); $this->link_action = $temp2[count($temp2) - 1]; $this->new_action = $this->link_action; $this->newLabel = $lang->get("new"); // check and initialize filter variables. $filter_rule = parseSQL(value("filter_rule", "", "")); $filter_column = value("filter_column", "NOSPACES"); $filter_page = value("filter_page"); if ($filter_rule != "0") { pushVar($this->link_action . "filter_rule", value("filter_rule", "", "")); pushVar($this->link_action . "filter_page", 1); } if ($filter_column != "0") { pushVar($this->link_action . "filter_column", value("filter_column")); pushVar($this->link_action . "filter_page", 1); } if ($filter_page != "0") pushVar($this->link_action . "filter_page", value("filter_page")); $this->filter_rule = getVar($this->link_action . "filter_rule"); $this->filter_column = getVar($this->link_action . "filter_column"); }
$view = value("view", "NUMERIC"); if ($clt != "") pushVar("clt", $clt); if ($clnid == 0) $clnid = $oid; if ($oid == 0) $oid = $clnid; if ($action == "0" || $action=="") $action = value("acstate"); if (value("saction") != "0") { if ($view == "0") $view = 1; $action = getVar("lastaction"); } pushVar("lastaction", $action); $browser = new Clustermenu($lang->get("m_clb", "Library")); $browser->action = $c["docroot"] . "modules/cluster/clusterbrowser.php"; $browser->tipp = $lang->get("help_clb", "Cluster is a collection of dynamic content placeholders, which are to be filled in by an editor of a webpage. The structure-definition within N/X is done with data clusters."); $page->addMenu($browser); if ($action == $lang->get("del_folder") || $action == $lang->get("edit_folder") || $action == $lang->get("new_folder") || $action == $lang->get("edit_access")) { require_once $c["path"] . "modules/common/folder_logic.inc.php"; } else { require_once $c["path"] . "modules/cluster/cluster_logic.inc.php"; } $page->draw(); $db->close(); echo $errors;
$query = new query($db, $sql1); $query->getrow(); $amount += $query->field("ANZ"); $query = new query($db, $sql2); $query->getrow(); $amount += $query->field("ANZ"); $query = new query($db, $sql3); $query->getrow(); $amount += $query->field("ANZ"); if ($amount == 0) { if (value("decision") == $lang->get("yes")) { // set new folder-id. $parentId = getDBCell("categories", "PARENT_CATEGORY_ID", "CATEGORY_ID = " . $oid); pushVar("pnode", $parentId); // delete folder. $delhandler->addDBAction("DELETE FROM categories WHERE CATEGORY_ID = $oid"); $delhandler->process("deletefolder"); // set new id. $oid = $pnode = $parentId; } else if (value("decision") != $lang->get("no")) { $title = getDBCell("categories", "CATEGORY_NAME", "CATEGORY_ID = " . $oid); $form = new YesNoForm($lang->get("r_deletefolder"). " $title", $lang->get("folder_delmes", "Do you really want to delete this folder?")); $form->add(new Hidden("action", $lang->get("del_folder"))); $form->add(new Hidden("pnode", $pnode)); $page->add($form); $handled = true; }
$tmp = getDBCell("categories", "PARENT_CATEGORY_ID", "CATEGORY_ID = $tmp"); } $str = $str_base . $str; $form->add(new Spacer(2)); $form->add(new Label("lbl", getBoxedText($str, 'headergrey', '100%'), "", 2)); $form->add(new Spacer(2)); // add contents if ($filter != "0") { pushVar("filter", $filter); } else { $filter = getVar("filter"); } if ($linkset != "0") { pushVar("linkset", $linkset); } else { $linkset = getVar("linkset"); if ($linkset == "") { $linkset = "LIB"; } } if (strlen($linkset) > 3) $disableMenu = true; $filtersql = ""; if ($filter != "") { $modules[0] = $filter; if (count($modules) > 0) { $f = 0;
function _PHP_FUNC_foreach($obj) { /* (foreach lyst item (do_something_with item)) */ global $LISP_BREAK, $LISP_BREAK_VALUE, $_LISP_VARS, $_LISP_VAR_TOP; $ret = 'sym:nil'; $list = _LISP_evalobject($obj[1]); if ($list == 'sym:nil') { $list = array(); } if (!is_array($list)) { report_error("(foreach ...) expected a list [{$list}]."); } $holdvarstacktop = $_LISP_VAR_TOP; $sym = _LISP_get_symbol($obj, 2, 0); $savebreak = $LISP_BREAK; // push any existing BREAK... $savebreakvalue = $LISP_BREAK_VALUE; $LISP_BREAK = 0; // ... and zero it. pushVar($sym); // push old value of our symbol.. foreach ($list as $item) { $_LISP_VARS[$sym] = $item; // bind new value for ($i = 3; $i < sizeof($obj); $i++) { $ret = _LISP_evalobject($obj[$i]); // evaluate expressions if ($LISP_BREAK) { $ret = $LISP_BREAK_VALUE; break 2; } } } popVars($holdvarstacktop); $LISP_BREAK = $savebreak; // pop old BREAK $LISP_BREAK_VALUE = $savebreakvalue; return $ret; }
} if ($linkset != "0") { pushVar("linkset", $linkset); } else { $linkset = getVar("linkset"); if ($linkset == "") { $linkset = "LIB"; } } if (strlen($linkset) > 3) $disableMenu = true; if ($sname != "0") { pushVar("sname", $sname); } else { $sname = getVar("sname"); } $filtersql = ""; if ($filter != "") { $modules[0] = $filter; if (count($modules) > 0) { $f = 0; $module_id = getDBCell("modules", "MODULE_ID", "UPPER(MODULE_NAME) = '" . $modules[$f] . "'"); $filtersql = " AND (MODULE_ID = $module_id ";
<? /********************************************************************** * @module Application **********************************************************************/ require_once "../../config.inc.php"; $auth = new auth("OBJECT_BROWSER"); if (value("resetfilter") == '1') { delVar ("filter"); delVar ("sname"); pushVar("linkset", ''); } $page = new page("Object Browser"); $page->setJS("TREE"); $page->setJS("FCKLIB"); // Reset Filter // initialize variables $action = value("action"); $handled = false; $pnode = initValueEx("pnode", "pnode", "0", "NUMERIC"); //// ACL Check //// $aclf = aclFactory($pnode, "folder"); $aclf->load(); if (! $aclf->hasAccess($auth->userId)) { delVar("pnode"); $pnode="0"; $aclf = aclFactory(0, "folder"); $aclf->load(); if (! $aclf->hasAccess($auth->userId))
/** * Checks, whether the keys variation and changevariation are set and changes * the selected variations. Returns always the selected or standard variation. */ function translation() { if (value("translation") != "0" && value("translation") != "-1" && value("changetranslation") != "0" && value("changetranslation") != "") { pushVar("translation", value("translation", "NUMERIC")); } $result = getVar("translation"); if ($result == "") { global $c; $result = 0; } if ($result > 0) { return $result; } else { return 0; } }
/** * get the allowed variations of a channel * @param integer id of the channel */ function getChannelVariations($channelId) { global $db, $c, $variation; $variation = variation(); $isInVariations = false; $result = array(); $sql = "SELECT v.NAME AS NAM, v.VARIATION_ID AS VAR FROM variations v, sitepage_variations s WHERE s.SPM_ID = {$channelId} AND s.VARIATION_ID = v.VARIATION_ID"; $query = new query($db, $sql); while ($query->getrow()) { $ar[0] = $query->field("NAM"); $ar[1] = $query->field("VAR"); $result[] = $ar; if ($ar[1] == $variation) { $isInVariations = true; } } if (!$isInVariations) { pushVar("variation", $result[0][1]); $variation = $result[0][1]; if ($variation == "") { $variation = $c["stdvariation"]; } } return $result; }
<?php require_once "../../config.inc.php"; $auth = new auth("CHANNEL_EDIT"); $aclf = $auth; // no acls present yet. $page = new Page("Edit Channels"); require_once $c["path"] . "modules/channels/article_select_form.php"; $oid = value("oid", "NUMERIC"); $clnid = $oid; $action = value("action"); if (value("setch", "NUMERIC") != "0") { pushVar("chsel", value("setch", "NUMERIC")); } $chid = getVar("chsel"); $variation = variation(); if (value("laction") == $lang->get("ar_launch") && $auth->checkAccessToFunction("CHANNEL_LAUNCH")) { launchArticle($oid, 10, $variation); } else { if (value("laction") == $lang->get("ar_expire") && $auth->checkAccessToFunction("CHANNEL_LAUNCH")) { expireArticle($oid, 10, $variation); } } if ($action == "createarticle") { $go = "CREATE"; $page_action = "INSERT"; $form = new stdEDForm($lang->get("create_article", "Create new Article in channel") . " " . getDBCell("channels", "NAME", "CHID = " . $chid), ""); $cond = $form->setPK("channel_articles", "ARTICLE_ID"); $oname = new TextInput($lang->get("name"), "channel_articles", "TITLE", $cond, "type:text,width:300,size:64", "MANDATORY"); $form->add($oname); $form->add(new SelectOneInput($lang->get("template"), "channel_articles", "CLT_ID", "cluster_templates, channel_cluster_templates", "NAME", "channel_cluster_templates.CLT_ID AS CLT", "cluster_templates.CLT_ID = channel_cluster_templates.CLT_ID AND channel_cluster_templates.CHID = {$chid} ORDER BY POSITION ASC", $cond, "TYPE:DROPDOWN", "MANDATORY"));
/** * Gets all available variations for a sitepage from the database. * @param integer $spid Sitepage-ID where to determine variations from. * @param integer $clnid Cluster-Node-ID where to determine the variations from * @param integer $variation Currently set variation. */ function populateSPVariations($spid, $clnid, &$variation) { global $db; $spm = getDBCell("sitepage", "SPM_ID", "SPID = $spid"); $vars = createDBCArray("sitepage_variations", "VARIATION_ID", "SPM_ID = $spm"); if (count($vars) > 1) { $cvars = implode(", ", $vars); } else { $cvars = $vars[0]; } $isInVariations = false; $variations = null; $sql = "SELECT v.NAME AS NAM, v.VARIATION_ID AS VARI FROM variations v, cluster_variations c WHERE c.CLNID = " . $clnid . " AND c.DELETED=0 AND c.VARIATION_ID = v.VARIATION_ID AND v.DELETED = 0 AND v.VARIATION_ID IN ($cvars) ORDER BY v.NAME"; $query = new query($db, $sql); while ($query->getrow()) { $nextId = count($variations); $variations[$nextId][0] = $query->field("NAM"); $variations[$nextId][1] = $query->field("VARI"); if ($variation == $variations[$nextId][1]) $isInVariations = true; } // set another variation, as standard variation is not available! if (!$isInVariations) { global $c; pushVar("variation", $variations[0][1]); $variation = $variations[0][1]; if ($variation == "") $variation = $c["stdvariation"]; } return $variations; }