function browse_layout_for_containers($idlay) { global $db, $cms_db; $sql = "SELECT code FROM {$cms_db['lay']} WHERE idlay='{$idlay}'"; $db->query($sql); $db->next_record(); $list_tmp = extract_cms_tags($db->f('code')); if (is_array($list_tmp)) { // Container sortieren foreach ($list_tmp as $container) { if ($container['id']) { $list['id'][] = $container['id']; if ($container['title']) { $list[$container['id']]['title'] = $container['title']; } } } } return $list; }
unset($tmp2); } // nicht benutzte Variablen strippen $code = preg_replace('/MOD_VALUE\\[\\d*\\]/', '', $code); $code = str_replace('<CMSPHP:CACHE>', '<?PHP ', $code); $code = str_replace('</CMSPHP:CACHE>', ' ?>', $code); if (stristr($code, '<cms:mod constant="tagmode" />')) { $code = str_replace('<cms:mod constant="tagmode" />', '', $code); $code = cms_stripslashes($code); } // Das Modul existiert noch nicht in der Datenbank if (!is_array($content[$cms_mod['container']['id']])) { $content[$cms_mod['container']['id']]['1'] = 'neu'; } // Alle MOD_TAGS[] im Container ersetzen $used_type = extract_cms_tags($code); // alle Module in einem Container generieren if (is_array($content[$cms_mod['container']['id']])) { foreach ($content[$cms_mod['container']['id']] as $key3 => $value3) { // letztes Modul in diesem Container? if (!$content[$cms_mod['container']['id']][$key3 + 1]) { $cms_mod['modul']['lastentry'] = 'true'; $pre_container_code = '<CMSPHP> $cms_mod[\'modul\'][\'lastentry\']=\'true\'; </CMSPHP>'; } else { unset($cms_mod['modul']['lastentry']); $pre_container_code = '<CMSPHP> unset($cms_mod[\'modul\'][\'lastentry\']); </CMSPHP>'; } // erstes Modul generieren? if ($key3 == '1') { $container_code = $code; if (is_array($used_type)) {
public function getBackendEditForm($cms_path, $lang_charset, $cfg_cms, $idcatside, $lang, $sess, $cfg_client, $con_tree, $con_side, $cms_lang, $idside) { //echo "$cms_path, $lang_charset, $cfg_cms, $idcatside, $lang, $sess, $cfg_client, $con_tree, $con_side, $cms_lang, $idside";exit; $cfg = sf_api('LIB', 'Config'); $this->cfg->setVal('env', 'current_container_editable', TRUE); $enable_code_editor = (bool) $this->cfg->cms('enable_code_editor'); // Formularelemente includieren include_once $cms_path . 'inc/fnc.type_forms.php'; $code .= '<head>' . "\n"; $code .= '<title>Sefrengo | Edit-Mode</title>' . "\n"; $code .= '<meta http-equiv="content-type" content="text/html; charset=' . $lang_charset . '" />' . "\n"; $code .= '<link rel="stylesheet" type="text/css" href="' . $cfg_cms['path_base_http'] . $cfg_cms['path_backend_rel'] . 'tpl/' . $cfg_cms['skin'] . '/css/sefrengo-theme/jquery-ui.custom.css" />' . "\n"; $code .= '<link rel="stylesheet" type="text/css" href="' . $cfg_cms['path_base_http'] . $cfg_cms['path_backend_rel'] . 'tpl/' . $cfg_cms['skin'] . '/css/styles.css" />' . "\n"; if ($enable_code_editor) { $code .= '<link rel="stylesheet" type="text/css" href="' . $cfg_cms['path_base_http'] . $cfg_cms['path_backend_rel'] . 'tpl/' . $cfg_cms['skin'] . '/js/editor/codemirror/lib/codemirror.css" />' . "\n"; $code .= '<link rel="stylesheet" type="text/css" href="' . $cfg_cms['path_base_http'] . $cfg_cms['path_backend_rel'] . 'tpl/' . $cfg_cms['skin'] . '/js/editor/codemirror/theme/default.css" />' . "\n"; $code .= '<link rel="stylesheet" type="text/css" href="' . $cfg_cms['path_base_http'] . $cfg_cms['path_backend_rel'] . 'tpl/' . $cfg_cms['skin'] . '/js/editor/codemirror/sefrengo/sf_codemirror.css" />' . "\n"; } $code .= '<script type="text/javascript" src="' . $cfg_cms['path_base_http'] . $cfg_cms['path_backend_rel'] . 'tpl/' . $cfg_cms['skin'] . '/js/init.sefrengo.js"></script>' . "\n"; $code .= '<script type="text/javascript" src="' . $cfg_cms['path_base_http'] . $cfg_cms['path_backend_rel'] . 'tpl/' . $cfg_cms['skin'] . '/js/lib/jquery.min.js"></script>' . "\n"; $code .= '<script type="text/javascript" src="' . $cfg_cms['path_base_http'] . $cfg_cms['path_backend_rel'] . 'tpl/' . $cfg_cms['skin'] . '/js/lib/jquery-ui.custom.min.js"></script>' . "\n"; $code .= "<script type=\"text/javascript\">/* <![CDATA[ */\n\t\t\t\t\tvar \$jqsf = jQuery;\n\t\t\t\t\t//var \$jqsf = \$.noConflict(true); // currently the jQuery plugins won\\'t work in this mode \n\t\t\t\t\t\n\t\t\t\t\tSF.Config.debug = false;\n\t\t\t\t\tSF.Config.backend_dir = '" . $cfg_cms['path_base_http'] . $cfg_cms['path_backend_rel'] . "'; // e.g. /backend/\n\t\t\t\t\tSF.Config.js_dir = SF.Config.backend_dir + 'tpl/" . $cfg_cms['skin'] . "/js/';\n\t\t\t\t\tSF.Config.css_dir = SF.Config.backend_dir + 'tpl/" . $cfg_cms['skin'] . "/css/';\n\t\t\t\t\tSF.Config.img_dir = SF.Config.backend_dir + 'tpl/" . $cfg_cms['skin'] . "/img/';\n\t\t\t\t/* ]]> */</script>"; if ($enable_code_editor) { $code .= '<script type="text/javascript" src="' . $cfg_cms['path_base_http'] . $cfg_cms['path_backend_rel'] . 'tpl/' . $cfg_cms['skin'] . '/js/jquery.frontend.js"></script>' . "\n"; $code .= '<script type="text/javascript" src="' . $cfg_cms['path_base_http'] . $cfg_cms['path_backend_rel'] . 'tpl/' . $cfg_cms['skin'] . '/js/editor/codemirror/lib/codemirror-compressed.js"></script>' . "\n"; $code .= '<script type="text/javascript" src="' . $cfg_cms['path_base_http'] . $cfg_cms['path_backend_rel'] . 'tpl/' . $cfg_cms['skin'] . '/js/editor/codemirror/sefrengo/jquery.sf_codemirror.js"></script>' . "\n"; } //disable selector content sync $copycontent_disabled = true; $code .= '<script type="text/javascript"> try { window.parent.con_nav.sf_setCurrentIdcatside(' . $idcatside . ', ' . $copycontent_disabled . ', ' . $lang . ') } catch (e) { } </script>'; $code .= '</head>' . "\n"; $code .= '<body id="con-edit2">' . "\n"; $code .= '<!-- inc.con_edit.php -->' . "\n"; $code .= '<div id="main">' . "\n"; $code .= " <form name=\"editcontent\" method=\"post\" action=\"" . $sess->url($cfg_client['contentfile']) . "\">\n"; $code .= " <input type=\"hidden\" name=\"view\" value=\"edit\" />\n"; $code .= " <input type=\"hidden\" name=\"lang\" value=\"{$lang}\" />\n"; $code .= " <input type=\"hidden\" name=\"action\" value=\"save\" />\n"; $code .= " <input type=\"hidden\" name=\"entry\" value=\"" . $_REQUEST['entry'] . "\" />\n"; $code .= " <input type=\"hidden\" name=\"idcatside\" value=\"{$idcatside}\" />\n"; $code .= " <input type=\"hidden\" name=\"content\" value=\"" . $_REQUEST['content'] . "\" />\n"; $code .= " <table class=\"config\" cellspacing=\"1\">\n"; $con_type['1'] = array('type' => 'text', 'descr' => $cms_lang['type_text'], 'input' => 'type_form_text'); $con_type['2'] = array('type' => 'wysiwyg', 'descr' => $cms_lang['type_wysiwyg'], 'input' => 'type_form_wysiwyg'); $con_type['3'] = array('type' => 'textarea', 'descr' => $cms_lang['type_textarea'], 'input' => 'type_form_textarea'); $con_type['4'] = array('type' => 'image', 'descr' => $cms_lang['type_image'], 'input' => 'type_form_img'); $con_type['5'] = array('type' => 'imgdescr', 'descr' => $cms_lang['type_image_desc'], 'input' => 'type_form_imgdescr'); $con_type['6'] = array('type' => 'link', 'descr' => $cms_lang['type_link'], 'input' => 'type_form_link'); $con_type['7'] = array('type' => 'linkdescr', 'descr' => $cms_lang['type_link_name'], 'input' => 'type_form_linkdescr'); $con_type['8'] = array('type' => 'linktarget', 'descr' => $cms_lang['type_link_target'], 'input' => 'type_form_linktarget'); $con_type['9'] = array('type' => 'sourcecode', 'descr' => $cms_lang['type_sourcecode'], 'input' => 'type_form_sourcecode'); $con_type['10'] = array('type' => 'file', 'descr' => $cms_lang['type_file'], 'input' => 'type_form_file'); $con_type['11'] = array('type' => 'filedescr', 'descr' => $cms_lang['type_file_desc'], 'input' => 'type_form_filedescr'); $con_type['12'] = array('type' => 'filetarget', 'descr' => $cms_lang['type_file_target'], 'input' => 'type_form_filetarget'); $con_type['13'] = array('type' => 'wysiwyg2', 'descr' => $cms_lang['type_wysiwyg'], 'input' => 'type_form_wysiwyg2'); $con_type['14'] = array('type' => 'select', 'descr' => $cms_lang['type_select'], 'input' => 'type_form_select'); $con_type['15'] = array('type' => 'hidden', 'descr' => $cms_lang['type_hidden'], 'input' => 'type_form_hidden'); $con_type['16'] = array('type' => 'checkbox', 'descr' => $cms_lang['type_checkbox'], 'input' => 'type_form_checkbox'); $con_type['17'] = array('type' => 'radio', 'descr' => $cms_lang['type_radio'], 'input' => 'type_form_radio'); $con_type['18'] = array('type' => 'date', 'descr' => $cms_lang['type_date'], 'input' => 'type_form_date'); $con_type['20'] = array('type' => 'checkboxsave', 'descr' => $cms_lang['type_checkbox'], 'input' => 'type_form_checkboxsave'); // Content-Array erstellen $sql = "SELECT\n\t\t\t\t\tA.idcontent, container, number, idtype, typenumber, value\n\t\t\t\tFROM\n\t\t\t\t\t{$this->dbnames[content]} A\n\t\t\t\t\tLEFT JOIN {$this->dbnames[side_lang]} B USING(idsidelang)\n\t\t\t\tWHERE\n\t\t\t\t\tB.idside='{$idside}'\n\t\t\t\t\tAND B.idlang='{$lang}'"; $this->db->query($sql); while ($this->db->next_record()) { $content_array[$this->db->f('container')][$this->db->f('number')][$this->db->f('idtype')][$this->db->f('typenumber')] = array($this->db->f('idcontent'), htmlentities($this->db->f('value'), ENT_COMPAT, 'UTF-8')); } // Module finden $idtplconf = $con_side[$idcatside]['idtplconf']; if ($con_side[$idcatside]['idtplconf'] == '0') { $idtplconf = $con_tree[$con_side[$idcatside]['idcat']]['idtplconf']; } $modlist = browse_template_for_module('0', $idtplconf); // Containernamen suchen $sql = "SELECT idlay FROM {$this->dbnames[tpl_conf]} A LEFT JOIN {$this->dbnames[tpl]} B USING(idtpl) WHERE A.idtplconf='{$idtplconf}'"; $this->db->query($sql); $this->db->next_record(); $idlay = $this->db->f('idlay'); $list = browse_layout_for_containers($idlay); // Bearbeitungsarray erstellen $content = $_REQUEST['content']; //TODO $con_content = explode(';', $content); unset($content); // Einzelne Container auflisten foreach ($con_content as $value) { // Konfiguration einlesen $con_config = explode('.', $value); $con_container = $con_config['0']; $con_contnbr = explode(',', $con_config[1]); $con_content_type = explode(',', $con_config[2]); // Konfigurationsparameter mod_values extahieren und aufbereiten $sql = "SELECT\n\t\t\t\t\t\tcontainer_conf.config\n\t\t\t\t\tFROM\n\t\t\t\t\t\t" . $this->dbnames['container_conf'] . " container_conf\n\t\t\t\t\t\tLEFT JOIN " . $this->dbnames['tpl_conf'] . " tpl_conf USING(idtplconf)\n\t\t\t\t\t\tLEFT JOIN " . $this->dbnames['container'] . " container USING(idtpl)\n\t\t\t\t\tWHERE\n\t\t\t\t\t\tcontainer_conf.idtplconf = {$idtplconf}\n\t\t\t\t\t\tAND container = {$con_container}\n\t\t\t\t\t\tAND container_conf.idcontainer = container.idcontainer"; $this->db->query($sql); $this->db->next_record(); $tpl_config_vars = $this->db->f('config'); // mod_values aus Container ersetzen $container = $modlist[$con_container]['output']; $config = preg_split('/&/', $tpl_config_vars); foreach ($config as $key1 => $value1) { $tmp2 = explode('=', $value1); if ($tmp2['1'] != '') { // $mod_value Array schreiben $cms_mod['value'][$tmp2['0']] = cms_stripslashes(urldecode($tmp2['1'])); // MOD_VALUE[x] ersetzen $container = str_replace('MOD_VALUE[' . $tmp2['0'] . ']', str_replace("\\'", "'", urldecode($tmp2['1'])), $container); //' } unset($tmp2); } // nicht benutzte Variablen strippen $container = preg_replace('/MOD_VALUE\\[\\d*\\]/', '', $container); if (stristr($container, '<cms:mod constant="tagmode" />')) { $container = str_replace('<cms:mod constant="tagmode" />', '', $container); $container = cms_stripslashes($container); //todo: 2remove } elseif (stristr($container, '<dedi:mod constant="tagmode" />')) { $container = str_replace('<dedi:mod constant="tagmode" />', '', $container); $container = cms_stripslashes($container); } // Moduloutput simulieren, zum generieren der CMS-Tag Informationen $sefrengotag_config = extract_cms_tags($container, 'type'); // Rowspan für Containertabelle berechnen $rowspan = 1; foreach ($con_contnbr as $con_containernumber) { $rowspan++; foreach ($con_content_type as $value3) { $rowspan++; $rowspan++; } } $code .= " <tr>\n"; // Containername $code .= " <td class=\"head\" width=\"110\" rowspan=\"{$rowspan}\"><p>"; if (!empty($list[$con_container]['title'])) { $code .= $list[$con_container]['title']; } else { $code .= "{$con_container}. " . $cms_lang['tpl_container']; } $code .= "</p></td>\n"; unset($rowspan); foreach ($con_contnbr as $con_containernumber) { // neues Modul erstellen? if ($con_containernumber == '-1') { $print_containernumber = ''; } else { $print_containernumber = $con_containernumber . '. '; } // Modulname $modname = ($modlist[$con_container]['verbose'] != '' ? $modlist[$con_container]['verbose'] : $modlist[$con_container]['modname']) . (empty($modlist[$con_container]['version']) ? '' : ' (' . $modlist[$con_container]['version'] . ')'); $code .= " <td class=\"header\"><!-- {$print_containernumber} -->" . $modname . "</td>\n"; $code .= " </tr>\n"; foreach ($con_content_type as $value3) { $value3 = explode('-', $value3); $con_contype = $value3['0']; $con_typenumber = $value3['1']; // Name f�r Eingabefeld // Nicht anzeigen bei Dateilink, wenn hidetarget auf true gesetzt ist if ($GLOBALS['filetarget_is_hidden'] == 'true' && $con_contype == 12) { $code .= " <td></td>\n"; $code .= " </tr>\n"; $code .= " <tr>\n"; // } elseif ($con_contype == 15) { // $code .=""; } elseif ($con_contype == 20) { $code .= " <td height=\"0\">"; $code .= " </td>\n"; $code .= " </tr>\n"; $code .= " <tr>\n"; } else { if (in_array($con_contype, array(1, 2, 3, 4, 6, 9, 10, 13, 14, 15, 16, 17, 18))) { $code .= " <tr class=\"fomrstitle\">\n"; } else { $code .= " <tr>\n"; } $code .= " <td>"; if (!empty($sefrengotag_config[$con_type[$con_contype]['type']][$con_typenumber]['title'])) { $code .= $sefrengotag_config[$con_type[$con_contype]['type']][$con_typenumber]['title']; } else { $code .= $con_type[$con_contype]['descr']; } $code .= ":</td>\n"; $code .= " </tr>\n"; $code .= " <tr>\n"; } // Name des Formularfeldes $formname = 'content_' . $con_container . '_' . $con_containernumber . '_' . $con_contype . '_' . $con_typenumber; // Variable f�r den Content $content = $content_array[$con_container][$con_containernumber][$con_contype][$con_typenumber]['1']; $type_config = $sefrengotag_config[$con_type[$con_contype]['type']][$con_typenumber]; if ($con_contype == '16') { $type_config['saved'] = $content_array[$con_container][$con_containernumber]['20'][$con_typenumber]['1']; } //make element $code .= $con_type[$con_contype]['input']($formname, $content, $type_config); unset($content); unset($formname); $code .= " </tr>\n"; } } } $code .= " <tr>\n"; $code .= " <td class='content7' colspan='2' style='text-align:right'>\n"; $code .= " <input type='submit' value='" . $cms_lang['gen_save'] . "' class=\"sf_buttonAction\" />\n"; $code .= " <input type='submit' value='" . $cms_lang['gen_apply'] . "' class=\"sf_buttonAction\" onclick=\"document.editcontent.action.value='saveedit'\" />\n"; $code .= " <input type='button' value='" . $cms_lang['gen_cancel'] . "' class=\"sf_buttonActionCancel\" onclick=\"window.location='" . $sess->url("" . $cfg_client['contentfile'] . "?lang={$lang}&action=abort&view=edit&idcatside={$idcatside}") . "'\" />\n"; $code .= " </tr>\n"; $code .= " </table>\n"; $code .= " </form>\n"; $code .= '</div>' . "\n"; $code .= '</body>' . "\n"; $code .= '</html>' . "\n"; return $code; }