Example #1
0
             $tmp1 = preg_split("/&/", $mod_conf);
             $varstring = array();
             foreach ($tmp1 as $key1 => $value1) {
                 $tmp2 = explode('=', $value1);
                 foreach ($tmp2 as $key2 => $value2) {
                     $varstring["{$tmp2['0']}"] = $tmp2[1];
                 }
             }
             foreach ($varstring as $key3 => $value3) {
                 $cms_mod['value'][$key3] = cms_stripslashes(urldecode($value3));
             }
             //TODO - remove dedi backward compatibility
             $dedi_mod = $cms_mod;
             if (is_array($mod[${'c' . $value}])) {
                 foreach ($mod[${'c' . $value}] as $key4 => $value4) {
                     $cms_mod['info'][$key4] = cms_stripslashes(urldecode($value4));
                 }
             }
             $input = str_replace("MOD_VAR", "C" . $value . "MOD_VAR", $input);
             eval(' ?>' . $input);
             unset($cms_mod['value'], $dedi_mod['value'], $cms_mod['info'], $dedi_mod['info']);
         }
         echo $mod_tpl_end;
     }
 }
 // Outputbuffering wieder aufnehmen
 $temp_tpl_conf = ob_get_contents();
 ob_end_clean();
 ob_start();
 echo $temp_output_for_backend;
 unset($temp_output_for_backend);
     $tmp2 = explode('=', $value1);
     if ($tmp2['1'] != '') {
         // $mod_value Array schreiben
         $cms_mod['value'][$tmp2['0']] = cms_stripslashes(urldecode($tmp2['1']));
         // MOD_VALUE[x] ersetzen
         $code = str_replace('MOD_VALUE[' . $tmp2['0'] . ']', str_replace("\\'", "'", urldecode($tmp2['1'])), $code);
     }
     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 {
 /**
  * repository::_mod_import()
  *
  * { Description }
  *
  */
 function _mod_import($xml_array, $idclient)
 {
     $checked = ($err_i = $this->mod_test(cms_stripslashes($xml_array['input']), $idmod)) || ($err_0 = $this->mod_test(cms_stripslashes($xml_array['output']), $idmod)) ? '0' : '1';
     $sql = "INSERT INTO " . $this->_db_var['mod'] . " (idclient, " . implode(',', array_keys($xml_array)) . ", checked) VALUES({$idclient}, '" . implode("','", array_values($xml_array)) . "', '{$checked}')";
     if (!($insert = $this->_db->query($sql))) {
         return false;
     }
     $idmod = $this->_db->insert_id();
     return $idmod;
 }
Example #4
0
function js_import()
{
    global $fm, $client, $idjsfile, $idupl, $errno, $js_directory, $perm;
    if (!$perm->have_perm(13, 'area_js', '0')) {
        return '1701';
    }
    // keine ausreichenden Rechte
    $type = get_magic_quotes_gpc() == 0 ? 1 : 0;
    $tmp_upldata = $fm->get_file((int) $idupl, '', '', 0);
    $tmp_jsdata = get_jscontent_data($idjsfile, $type);
    $iddir = $fm->get_directory_id($js_directory, $client);
    if (empty($tmp_jsdata) || empty($tmp_upldata) || empty($iddir)) {
        return '1208';
    }
    // import failed
    // check if filename already exists
    if (is_duplicate_filename($client, $tmp_upldata['filename'], $js_directory, '0')) {
        return '1209';
    }
    // duplicated filename, no import
    // copy js-file from client 0 to current client
    // Erstelle Datei-Eintrag
    $idupl = $fm->insert_file((int) $client, $tmp_upldata['filename'], (int) $iddir, (int) $tmp_upldata['idfiletype'], (int) 5, $tmp_upldata['description']);
    if (empty($idupl)) {
        return '1207';
    }
    // copy js-content for client
    $idjsfile = insert_jscontent($idupl, $client, $tmp_jsdata['filecontent'], $tmp_jsdata['status']);
    if (empty($idjsfile)) {
        $fm->delete_file($idupl, $client, false, 'path');
        // ensure db integrity
        return '1207';
    }
    $perm->set_owner_rights('js_file', $idjsfile, 0x31b7);
    // set ownerrights for current language and user
    $fm->write_file_fs($js_directory, $tmp_upldata['filename'], cms_stripslashes($tmp_jsdata['filecontent']), 'path');
    return !empty($fm->errno) ? '1417' : '1210';
    // return errno if import failed, file could not be written, or success message
}
Example #5
0
function remove_magic_quotes_gpc(&$code)
{
    if (get_magic_quotes_gpc() != 0) {
        if (ini_get(magic_quotes_sybase) != 0) {
            $code = str_replace("\\", "\\\\", $code);
            $code = str_replace('"', '\\"', $code);
            $code = str_replace("''", "\\'", $code);
        }
        $code = cms_stripslashes($code);
    }
}
Example #6
0
function mod_save($idmod_in, $name, $verbose, $description, $modversion, $modcat, $input, $output, $idclient, $repid = '', $sql_install = '', $sql_uninstall = '', $sql_update = '', $mod_rebuild_sql = false, $source_id = '0', $mod_no_wedding = false, $stripe = false, $mod_config_takeover = false)
{
    global $db, $auth, $cms_db, $cfg_cms, $cms_lang, $cfg_client, $rep, $perm;
    global $idmod;
    //make global for header redirect
    $idmod = $idmod_in;
    // Eintrag in 'mod' Tabelle
    if (empty($name) || $name == '') {
        $name = $cms_lang['mod_defaultname'];
    }
    if (empty($modversion) || $modversion == '') {
        $modversion = '1.0';
    }
    if ($stripe == 1) {
        $name = make_string_dump($name);
        $verbose = make_string_dump($verbose);
        $description = make_string_dump($description);
        $modversion = make_string_dump($modversion);
        $modcat = make_string_dump($modcat);
        $input = make_string_dump($input);
        $output = make_string_dump($output);
    } elseif ($stripe != 2) {
        set_magic_quotes_gpc($name);
        set_magic_quotes_gpc($verbose);
        set_magic_quotes_gpc($description);
        set_magic_quotes_gpc($modversion);
        set_magic_quotes_gpc($modcat);
        set_magic_quotes_gpc($input);
        set_magic_quotes_gpc($output);
    }
    $checked = ($err_i = $rep->mod_test(cms_stripslashes($input), $idmod)) || ($err_0 = $rep->mod_test(cms_stripslashes($output), $idmod)) ? '0' : '1';
    $modverbose = $verbose == '-1' ? $name : $verbose;
    $mod_sql_uninstall = $sql_uninstall;
    $mod_sql_install = $sql_install;
    $sql_install = mysql_escape_string($rep->decode_sql($sql_install));
    $sql_uninstall = mysql_escape_string($rep->decode_sql($sql_uninstall));
    $sql_update = mysql_escape_string($rep->decode_sql($sql_update));
    if ($mod_no_wedding == true) {
        $source_id = 0;
        $repositoryid = $rep->gen_new_mod($name);
        $update_source = ", source_id='0'";
    } elseif ($source_id) {
        $repositoryid = $rep->gen_new_mod($name, true);
    } elseif ($repid == '') {
        $repositoryid = $rep->gen_new_mod($name);
        if ($errno = $rep->error(true)) {
            return $errno;
        }
    } else {
        $repositoryid = $rep->gen_new_mod($name, true);
    }
    if ($errno = $rep->error(true)) {
        return $errno;
    } elseif (empty($input) && empty($output)) {
        return '0424';
    }
    if (!$idmod) {
        // Modul existiert noch nicht
        $sql = "INSERT INTO\r\n\t\t\t\t" . $cms_db['mod'] . "\r\n\t\t\t\t(name, description, version, cat, input, output, idclient, author, created, lastmodified,\r\n\t\t\t\trepository_id, install_sql, uninstall_sql, update_sql, source_id, verbose, checked)\r\n\t\t\t\tVALUES\r\n\t\t\t\t('{$name}', '{$description}', '{$modversion}', '{$modcat}', '{$input}', '{$output}', '{$idclient}',\r\n\t\t\t\t'" . $auth->auth['uid'] . "', '" . time() . "', '" . time() . "', '{$repositoryid}', '{$sql_install}', '{$sql_uninstall}', '{$sql_update}', '{$source_id}', '{$modverbose}', '{$checked}')";
        $affect = $db->query($sql);
        if (!$affect || $affect < 1) {
            return '0400';
        }
        $idmod = $last_id = $db->insert_id();
        if ($mod_config_takeover == true) {
            $modul = $rep->mod_data($source_id, $idclient);
            mod_save_config($idmod, make_string_dump($modul['config']));
        }
        // Event
        fire_event('mod_new', array('idmod' => $idmod, 'name' => $name));
    } else {
        // hat sich das Modul geändert?
        $sql = "SELECT output FROM " . $cms_db['mod'] . " WHERE idmod='{$idmod}'";
        $db->query($sql);
        $db->next_record();
        $output_old = $db->f('output');
        set_magic_quotes_gpc($output_old);
        //don't change verbose name by sql update
        if ($verbose == '-2') {
            $sql_verbose_name = '';
        } else {
            $sql_verbose_name = "verbose = '{$modverbose}',";
        }
        if ($output != $output_old) {
            $sql = "UPDATE " . $cms_db['mod'] . "\r\n\t\t\t\t\tSET\r\n\t\t\t\t\tname='{$name}', description='{$description}', version = '{$modversion}', cat = '{$modcat}',\r\n\t\t\t\t\tinput='{$input}', output='{$output}', author='" . $auth->auth['uid'] . "', lastmodified='" . time() . "',\r\n\t\t\t\t\tinstall_sql ='{$sql_install}', uninstall_sql ='{$sql_uninstall}', update_sql ='{$sql_update}' {$update_source}, repository_id = '{$repositoryid}', {$sql_verbose_name} checked = '{$checked}'\r\n\t\t\t\t\tWHERE\r\n\t\t\t\t\tidmod='{$idmod}'";
            $db->query($sql);
            $change = 'true';
        } else {
            $sql = "UPDATE " . $cms_db['mod'] . "\r\n\t\t\t\t\tSET\r\n\t\t\t\t\tname='{$name}', description='{$description}', version = '{$modversion}', cat = '{$modcat}', input='{$input}',\r\n\t\t\t\t\tauthor='" . $auth->auth['uid'] . "', lastmodified='" . time() . "', install_sql='{$sql_install}',\r\n\t\t\t\t\tuninstall_sql='{$sql_uninstall}', update_sql='{$sql_update}' {$update_source}, repository_id = '{$repositoryid}', {$sql_verbose_name} checked = '{$checked}'\r\n\t\t\t\t\tWHERE\r\n\t\t\t\t\tidmod='{$idmod}'";
            $db->query($sql);
        }
        // Event
        fire_event('mod_edit', array('idmod' => $idmod, 'name' => $name));
    }
    if ($idclient > 0 && $mod_sql_install != '' && $mod_rebuild_sql == true) {
        if ($mod_sql_uninstall != '') {
            $error = $rep->bulk_sql($mod_sql_uninstall);
        }
        if (!$error) {
            $error = $rep->bulk_sql($mod_sql_install);
        }
        if (!$error) {
            $sql = "UPDATE " . $cms_db['mod'] . " SET is_install='1', lastmodified='" . time() . "' WHERE idmod='{$idmod}'";
            $db->query($sql);
        }
        // Event
        fire_event('mod_install_sql', array('idmod' => $idmod, 'name' => $name));
    }
    if ($change) {
        // Status der 'code' Tabelle ändern
        $list = get_idtplconf_by_using_type($idmod, 'mod');
        $list = get_idcode_by_idtplconf($list);
        change_code_status($list, '1');
        unset($list);
    }
    // Rechte setzen
    if ($perm->have_perm('6', 'mod', $idmod)) {
        global $cms_gruppenids, $cms_gruppenrechte, $cms_gruppenrechtegeerbt, $cms_gruppenrechteueberschreiben;
        $perm->set_group_rights('mod', $idmod, $cms_gruppenids, $cms_gruppenrechte, $cms_gruppenrechtegeerbt, $cms_gruppenrechteueberschreiben, '', 0xafd);
    }
    return !$error ? '0412' : $error;
}
Example #7
0
function search($options)
{
    global $db, $cms_db;
    // Anfrage vorbereiten
    $mod = '';
    $quot = '';
    $first = 1;
    $qfirst = 0;
    if (!$options['querystring'] || !$options['sql_tables'] || !$options['sql_fields']) {
        return false;
    }
    if (!$options['default_con']) {
        $def = 'AND';
    } else {
        $def = $options['default_con'];
    }
    if (!$options['get_fields']) {
        $options['get_fields'] = '*';
    }
    // Abfrage aufbauen
    $sql = 'SELECT ' . $options['get_fields'] . ' FROM ';
    $tables = explode(',', $options['sql_tables']);
    $sql .= implode(',', $tables) . ' WHERE ';
    if ($options['sql_where']) {
        $sql .= $options['sql_where'] . ' AND (';
    } else {
        $sql .= '(';
    }
    $search = cms_stripslashes($options['querystring']);
    $fields = explode(',', $options['sql_fields']);
    $searcharray = explode(' ', $search);
    if ($def != 'QUOT') {
        // Searchparser
        foreach ($searcharray as $word) {
            $ftoken = substr($word, 0, 1);
            if ($mod != 'GQUOT') {
                switch ($word) {
                    case 'AND':
                        $mod = 'AND';
                        $word = '_';
                        break;
                    case 'UND':
                        $mod = 'AND';
                        $word = '_';
                        break;
                    case '&&':
                        $mod = 'AND';
                        $word = '_';
                        break;
                    case 'OR':
                        $mod = 'OR';
                        $word = '_';
                        break;
                    case 'ODER':
                        $mod = 'OR';
                        $word = '_';
                        break;
                    case '||':
                        $mod = 'OR';
                        $word = '_';
                        break;
                    case 'NOT':
                        $mod = 'NOT';
                        $word = '_';
                        break;
                }
            }
            if ($word != '_' && $mod != 'GQUOT') {
                switch ($ftoken) {
                    case '+':
                        $mod = 'AND';
                        $word = substr($word, 1);
                        break;
                    case '-':
                        $mod = 'NOT';
                        $word = substr($word, 1);
                        break;
                    case '"':
                        if (substr_count($search, '"') > 1) {
                            $word = substr($word, 1);
                            $mod = 'QUOT';
                        } else {
                            $mod = $def;
                        }
                        break;
                    case "'":
                        if (substr_count($search, "'") > 1) {
                            $word = substr($word, 1);
                            $mod = 'QUOT';
                        } else {
                            $mod = $def;
                        }
                        break;
                }
            }
            if ((substr($word, -1, 1) == "'" or substr($word, -1, 1) == '"') and (substr_count($search, '"') > 1 or substr_count($search, "'") > 1)) {
                $word = substr($word, 0, -1);
                $mod = 'EQUOT';
            }
            if ($word != '_') {
                $word = addslashes($word);
                if ($first == 1) {
                    if ($mod == 'QUOT') {
                        $quot = $word;
                        $mod = 'GQUOT';
                        $qfirst = 1;
                    } elseif ($mod == 'NOT') {
                        $sql .= '(';
                        foreach ($fields as $field) {
                            $sql .= $field . " NOT LIKE '%" . $word . "%' AND ";
                        }
                        $sql = substr($sql, 0, -5) . ') ';
                        $mod = '';
                    } else {
                        $sql .= '(';
                        foreach ($fields as $field) {
                            $sql .= $field . " LIKE '%" . $word . "%' OR ";
                        }
                        $sql = substr($sql, 0, -4) . ') ';
                    }
                    $first = 0;
                } else {
                    switch ($mod) {
                        case 'QUOT':
                            $quot = $word;
                            $mod = 'GQUOT';
                            break;
                        case 'GQUOT':
                            $quot .= ' ' . $word;
                            break;
                        case 'EQUOT':
                            if ($qfirst == 1) {
                                $sql .= ' (';
                                $qfirst = 0;
                            } else {
                                $sql .= $def . ' (';
                            }
                            foreach ($fields as $field) {
                                $sql .= $field . " LIKE '%" . $quot . ' ' . $word . "%' OR ";
                            }
                            $sql = substr($sql, 0, -4) . ') ';
                            $quot = '';
                            $mod = '';
                            break;
                        case 'AND':
                            $sql .= 'AND (';
                            foreach ($fields as $field) {
                                $sql .= $field . " LIKE '%" . $word . "%' OR ";
                            }
                            $sql = substr($sql, 0, -4) . ') ';
                            $mod = '';
                            break;
                        case 'OR':
                            $sql .= 'OR (';
                            foreach ($fields as $field) {
                                $sql .= $field . " LIKE '%" . $word . "%' OR ";
                            }
                            $sql = substr($sql, 0, -4) . ') ';
                            $mod = '';
                            break;
                        case 'NOT':
                            foreach ($fields as $field) {
                                $sql .= 'AND ' . $field . " NOT LIKE '%" . $word . "%' ";
                            }
                            $mod = '';
                            break;
                        case '':
                            $sql .= $def . ' (';
                            foreach ($fields as $field) {
                                $sql .= $field . " LIKE '%" . $word . "%' OR ";
                            }
                            $sql = substr($sql, 0, -4) . ') ';
                            $mod = '';
                            break;
                    }
                }
            }
        }
    } else {
        foreach ($fields as $field) {
            $sql .= $field . " LIKE '%" . $search . "%' OR ";
        }
        $sql = substr($sql, 0, -4);
    }
    $sql .= ') ';
    if ($options['sql_group']) {
        $sql .= "GROUP BY " . $options['sql_group'] . ' ';
    }
    // Anzahl der Einträge finden
    eval("\$sql = \"{$sql}\";");
    $anz_rows = @$db->num_rows($db->query($sql));
    // Sortierung und Limit
    if ($options['sort_index']) {
        $sql .= 'ORDER BY ' . $options['sort_index'];
    }
    if ($options['result_limit'] > 0) {
        if ($options['result_start'] <= 0) {
            $options['result_start'] = '0';
        }
        $sql .= ' LIMIT ' . $options['result_start'] . ',' . $options['result_limit'];
    }
    // Abfrage ausführen und Ergebnis bereitstellen
    $db->query($sql);
    $result = array();
    if ($options['get_fields'] == '*') {
        $options['get_fields'] = '';
        foreach ($db->metadata() as $a) {
            $options['get_fields'] .= $a['name'] . ',';
        }
        $options['get_fields'] = substr($options['get_fields'], 0, -1);
    }
    while ($db->next_record()) {
        foreach (explode(',', $options['get_fields']) as $field) {
            if (preg_match("/ as (.*)\$/i", $field, $match)) {
                $field = $match[1];
            }
            if (preg_match("/\\.([^ ]*)/", $field, $match)) {
                $field = $match[1];
            }
            $fetch[$field] = $db->f($field);
        }
        array_push($result, $fetch);
    }
    return array('result' => $result, 'num_rows' => $anz_rows);
}
Example #8
0
        $sess->unregister('s_modul');
    }
}
if (is_array($modul)) {
    $modname = $modul['name'];
    $modverbose = $modul['verbose'];
    $modversion = $modul['version'];
    $modcat = $modul['cat'];
    $description = $modul['description'];
    $input = $modul['input'];
    $output = $modul['output'];
    $source = $modul['source_id'];
    $repository_id = $modul['repository_id'];
    $sql_install = cms_stripslashes($rep->encode_sql($modul['install_sql']));
    $sql_uninstall = cms_stripslashes($rep->encode_sql($modul['uninstall_sql']));
    $sql_update = cms_stripslashes($rep->encode_sql($modul['update_sql']));
}
if (!is_numeric($idmod) && is_array($modul)) {
    $errno = $errno ? $errno : '0400';
}
if ($err_i = $rep->mod_test($input, $idmod)) {
    $error = sprintf($cms_lang['err_0416'], 'Input', $err_i);
}
if ($err_o = $rep->mod_test($output, $idmod)) {
    $error = $error != '' ? $error . ';  ' . sprintf($cms_lang['err_0416'], 'Output', $err_o) : sprintf($cms_lang['err_0416'], 'Output', $err_o);
}
// Modul dublizieren
if ($action == 'duplicate') {
    $idmod_for_form = '';
    if ($idclient >= 1) {
        $modverbose = $cms_lang['tpl_copy_of'] . $modname;
Example #9
0
function extract_modconfig($in)
{
    $keyandvalues = preg_split("/&/", $in);
    foreach ($keyandvalues as $kandv) {
        $extracted_pairs = explode('=', $kandv);
        $key = $extracted_pairs['0'];
        $value = $extracted_pairs['1'];
        $out[$key] = urldecode($value);
        $out[$key] = cms_stripslashes($out[$key]);
    }
    return $out;
}
Example #10
0
    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;
    }