function import_cssrules($cssfile, $idcssfile, $idclient) { global $css_warnings, $cfg_client; if (!file_exists($cssfile)) { return '1115'; } // css-file is missing $errstatus = false; // get validator object $validate = get_validator('css_validator'); // get all lines and make a long string of it $rules_array = file($cssfile); // remove all html and c-style comments, all unneccessary whitespaces $rules = implode(' JB§BJ ', $rules_array); $rules = preg_replace('/(<\\!\\-\\-)|(\\-\\->)/', '', $rules); $rules = preg_replace('/\\n|\\r/s', '', $rules); $rules = preg_replace('/(\\/\\*.*?\\*\\/)|([^:]\\/\\/.*?JB§BJ)|\\t/s', '', $rules); $rules = preg_replace('/((\\/\\/)$)|(JB§BJ)/', '', $rules); $rules = preg_replace('/\\s{2,}/s', ' ', $rules); // // to do: // extract import-statements before rule-splitting // // split the rules-string into an array of rules, use } as split-character $rules_array = explode('}', $rules); // create for all rules an db record foreach ($rules_array as $key => $value) { // split into name and elements $cssrule = explode("{", trim($value)); $name = trim($cssrule[0]); $styles = trim($cssrule[1]); // normalize elements $styles = preg_replace('/ *?:/', ':', $styles); $styles = preg_replace('/: +/', ': ', $styles); $styles = preg_replace('/(( *?;) *)/', '; ', $styles); if (substr(trim($styles), -1) != ';') { $styles .= ';'; } // get ruletype and change rulename if neccessary $type = substr($name, 0, 1); switch ($type) { case '#': case '.': case '@': case ':': $name = substr($name, 1); break; default: $type = ''; break; } // ignore rules without names or styles - might be errors if (!$name || !$styles) { continue; } // check names and rules - mark possible errors with status 0 // jb - 04.09.2004 - addes checks for vendor-specific-css-rules // if name is vendor-specific the rule will always be okay, i.e. // vendor-specific css-rules will be ignored by the validator // CSS2.1-Spec: 4.1.2 $status = '1'; if (!$validate->cssrule_vendor_specific($name)) { if (!$validate->cssrule_name($name) || !$validate->css_elements($styles, $cfg_client["css_checking"])) { $status = '0'; $errstatus = true; } } // make db record and add rule to file, ignore errors while inserting ... // jb - 28.08.2004 - cms_addslashes hinzugefügt, wegen single quotes in CSS-Stilen $styles = cms_addslashes($styles); $id = insert_cssrule($idclient, $type, $name, '', $styles, $status, $css_warnings); if ($id) { add_cssrule_to_file($id, $idcssfile); } } // return import status return $errstatus ? '1117' : '1116'; }
$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)) { // CMS-TAG in Funktionsaufruf umwandeln foreach ($used_type as $value4) { // CMS-TAG Konfiguration auslesen $cms_type_config = '\''; foreach ($value4 as $key5 => $value5) { if ($key5 != 'type' && $key5 != 'id' && $key5 != 'full_tag') { $cms_type_config .= '\'' . $key5 . '\'=>\'' . str_replace('\\"', '"', cms_addslashes($value5)) . '\','; } } // letztes Komma entfernen $cms_type_config = substr($cms_type_config, 1, -1); if (!$value4['id']) { $value4['id'] = '0'; } if ($value4['addslashes'] == 'true') { $container_code = str_replace($value4['full_tag'], 'type_output_' . strtolower($value4['type']) . '(' . $cms_mod['container']['id'] . ', $cms_mod[\'modul\'][\'id\'], ' . $value4['id'] . ', array(' . $cms_type_config . '))', $container_code); } else { $container_code = str_replace($value4['full_tag'], '<?PHP echo type_output_' . strtolower($value4['type']) . '(' . $cms_mod['container']['id'] . ', $cms_mod[\'modul\'][\'id\'], ' . $value4['id'] . ', array(' . $cms_type_config . ')); ?>', $container_code); } } } // Modul cachen
function upload_jsfile($idclient, $filedir, $jsfilename, $filetype) { global $fm, $cfg_client, $idjsfile, $errno; // get the complete js-file content as string $functions = implode('', file($cfg_client['path'] . $filedir . $jsfilename)); if (get_magic_quotes_gpc() != 0) { $functions = cms_addslashes($functions); } // create or update db-record // get idjsfile for existing file $idupl = is_duplicate_filename($idclient, $jsfilename, $filedir, 0); if (!empty($idupl)) { // js-file is existing, so update it $idjsfile = get_jscontent_id($idupl, $idclient); $tmp_data = get_jscontent_data($idjsfile, 0); update_jscontent($idjsfile, $functions, $tmp_data['status']); // update js-file record $fm->update_file2($tmp_data['idupl'], $idclient, $jsfilename, $filedir, $filetype, 5, $tmp_data['description'], ''); return !empty($fm->errno); } else { // js-file is new, so create an entry in cms_upl $idupl = $fm->insert_file((int) $idclient, $jsfilename, $filedir, $filetype, (int) 5, ''); if (empty($idupl)) { return '0703'; } // insert js-file-content in cms_js $idjsfile = insert_jscontent($idupl, $idclient, $functions, 1, '', 0); if (empty($idjsfile)) { return '1217'; } } return 0; }
function dedi_addslashes($code) { return cms_addslashes($code); }
$sql .= ' AND idlang = ' . $lang; $db->query($sql); if ($db->next_record()) { // Update vorhandener Seite $sql = 'UPDATE ' . $cms_db['code'] . ' '; $sql .= 'SET'; $sql .= " code = '" . cms_addslashes($code) . "',"; $sql .= ' changed = 0 '; $sql .= 'WHERE idcatside = ' . $idcatside; $sql .= ' AND idlang = ' . $lang; } else { // Insert neue Seite $sql = 'INSERT INTO ' . $cms_db['code']; $sql .= ' (idlang, idcatside, code, changed) '; $sql .= 'VALUES'; $sql .= ' (' . $lang . ', ' . $idcatside . ", '" . cms_addslashes($code) . "', 0)"; } $db->query($sql); } } } } $deb->collect('File:' . __FILE__ . ' Line:' . __LINE__, 'mem'); // Seite ausgeben if ($code) { // Seite weiterleiten? if ($con_side[$idcatside]['meta_redirect'] == '1' && $con_side[$idcatside]['meta_redirect_url'] != '') { header('HTTP/1.1 302 Moved Temporarily'); $redirect = ''; if (is_numeric($con_side[$idcatside]['meta_redirect_url'])) { $con_side[$idcatside]['meta_redirect_url'] = $con_side[$con_side[$idcatside]['meta_redirect_url']]['link'];
/** * * @param arr $container * @param arr $cms_mod * @param arr $content * @param arr $backendcfg [int idcatside, str view] */ public function getContainerContent($container, $cms_mod, $content, $backendcfg = array()) { $output = ''; $cms_side_edit_var = ''; $sf_modinfostring_start = '$sf_modinfo = sf_api("LIB", "Modinfo");'; if (count($backendcfg) > 0) { if ($backendcfg['is_backend']) { // darf Modul bearbeitet werden? Seitencontent darf bearbeitet werden if ($container[$cms_mod['container']['id']]['2'] == '0' && $backendcfg['idcatside'] > 0 && $backendcfg['view'] == 'edit') { $cms_side_edit_var = '$this->cfg->setVal(\'env\', \'current_container_editable\', TRUE); '; $sf_modinfostring_start .= '$sf_modinfo->setVal("is_editiable", TRUE);'; } else { $cms_side_edit_var = '$this->cfg->setVal(\'env\', \'current_container_editable\', FALSE); '; $sf_modinfostring_start .= '$sf_modinfo->setVal("is_editiable", FALSE);'; } } } // darf Modul gesehen werden? if ($container[$cms_mod['container']['id']]['1'] == '0') { // Container konfigurieren $code = $container[$cms_mod['container']['id']]['4']; $config = preg_split('/&/', $container[$cms_mod['container']['id']]['0']); 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 $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 = $this->mapCMSPHPCACHEToPhp($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']])) { $output = ''; foreach ($content[$cms_mod['container']['id']] as $key3 => $value3) { $sf_modinfostring = $sf_modinfostring_start; // letztes Modul in diesem Container? $pre_container_code = ''; if (!$content[$cms_mod['container']['id']][$key3 + 1]) { $cms_mod['modul']['lastentry'] = 'true'; $pre_container_code = '<CMSPHP> $cms_mod[\'modul\'][\'lastentry\']=\'true\'; </CMSPHP>'; $sf_modinfostring .= '$sf_modinfo->setVal("is_last_entry", TRUE);'; } else { unset($cms_mod['modul']['lastentry']); $pre_container_code = '<CMSPHP> unset($cms_mod[\'modul\'][\'lastentry\']); </CMSPHP>'; $sf_modinfostring .= '$sf_modinfo->setVal("is_last_entry", FALSE);'; } $sf_modinfostring .= '$sf_modinfo->setVal("id_container", ' . $cms_mod['container']['id'] . ');'; $sf_modinfostring .= '$sf_modinfo->setVal("entry_nr", ' . $key3 . ');'; // erstes Modul generieren? if ($key3 == '1') { $container_code = $code; $sf_modinfostring .= '$sf_modinfo->setVal("is_first_entry", TRUE);'; if (is_array($used_type)) { // CMS-TAG in Funktionsaufruf umwandeln foreach ($used_type as $value4) { // CMS-TAG Konfiguration auslesen $cms_type_config = '\''; foreach ($value4 as $key5 => $value5) { if ($key5 != 'type' && $key5 != 'id' && $key5 != 'full_tag') { $cms_type_config .= '\'' . $key5 . '\'=>\'' . str_replace('\\"', '"', cms_addslashes($value5)) . '\','; } } // letztes Komma entfernen $cms_type_config = substr($cms_type_config, 1, -1); if (!$value4['id']) { $value4['id'] = '0'; } if ($value4['addslashes'] == 'true') { $container_code = str_replace($value4['full_tag'], 'type_output_' . strtolower($value4['type']) . '(' . $cms_mod['container']['id'] . ', ' . $key3 . ', ' . $value4['id'] . ', array(' . $cms_type_config . '))', $container_code); } else { $container_code = str_replace($value4['full_tag'], '<?PHP echo type_output_' . strtolower($value4['type']) . '(' . $cms_mod['container']['id'] . ', ' . $key3 . ', ' . $value4['id'] . ', array(' . $cms_type_config . ')); ?>', $container_code); } } } $cms_mod['modul']['id'] = $key3; $cms_mod['key'] = 'mod' . $cms_mod['container']['id'] . '_' . $key3 . '_'; $sf_modinfostring .= '$sf_modinfo->setVal("mod_values", $cms_mod["value"]);'; $sf_modinfostring .= '$sf_modinfo->setVal("container_id", $cms_mod["container"]["id"]);'; $sf_modinfostring .= '$sf_modinfo->setVal("container_title", $cms_mod["container"]["title"]);'; $sf_modinfostring .= '$sf_modinfo->setVal("container_tag", $cms_mod["container"]["full_tag"]);'; $sf_modinfostring .= '$sf_modinfo->setVal("mod_key", $cms_mod["key"]);'; $container_code_cachephp = '<?PHP ' . $cms_side_edit_var . ' $cms_mod = ' . var_export($cms_mod, TRUE) . '; ' . $sf_modinfostring . ' ?>' . $pre_container_code . $container_code; $output = '<CMSPHP> ' . $cms_side_edit_var . ' $cms_mod = ' . var_export($cms_mod, TRUE) . '; $cms_mod[\'modul\'][\'id\']=\'' . $key3 . '\';$cms_mod[\'key\'] = \'mod\'.$cms_mod[\'container\'][\'id\'].\'_' . $key3 . '_\'; ' . $sf_modinfostring . ' </CMSPHP>' . $container_code_cachephp; } else { $container_code = $code; $sf_modinfostring .= '$sf_modinfo->setVal("is_first_entry", FALSE);'; if (is_array($used_type)) { // CMS-TAG in Funktionsaufruf umwandeln foreach ($used_type as $value4) { /// CMS-TAG Konfiguration auslesen $cms_type_config = '\''; foreach ($value4 as $key5 => $value5) { if ($key5 != 'type' && $key5 != 'id' && $key5 != 'full_tag') { $cms_type_config .= '\'' . $key5 . '\'=>\'' . str_replace('\\"', '"', cms_addslashes($value5)) . '\','; } } // letztes Komma entfernen $cms_type_config = substr($cms_type_config, 1, -1); if (!$value4['id']) { $value4['id'] = '0'; } if ($value4['addslashes'] == 'true') { $container_code = str_replace($value4['full_tag'], 'type_output_' . strtolower($value4['type']) . '(' . $cms_mod['container']['id'] . ', ' . $key3 . ', ' . $value4['id'] . ', array(' . $cms_type_config . '))', $container_code); } else { $container_code = str_replace($value4['full_tag'], '<?PHP echo type_output_' . strtolower($value4['type']) . '(' . $cms_mod['container']['id'] . ', ' . $key3 . ', ' . $value4['id'] . ', array(' . $cms_type_config . ')); ?>', $container_code); } } } $sf_modinfostring .= '$sf_modinfo->setVal("mod_values", $cms_mod["value"]);'; $sf_modinfostring .= '$sf_modinfo->setVal("container_id", $cms_mod["container"]["id"]);'; $sf_modinfostring .= '$sf_modinfo->setVal("container_title", $cms_mod["container"]["title"]);'; $sf_modinfostring .= '$sf_modinfo->setVal("container_tag", $cms_mod["container"]["full_tag"]);'; $sf_modinfostring .= '$sf_modinfo->setVal("mod_key", $cms_mod["key"]);'; $container_code_cachephp = '<?PHP ' . $cms_side_edit_var . ' $cms_mod[\'modul\'][\'id\']=\'' . $key3 . '\'; ' . $sf_modinfostring . ' ?>' . $pre_container_code . $container_code; $output .= '<CMSPHP> ' . $cms_side_edit_var . ' $cms_mod[\'modul\'][\'id\']=\'' . $key3 . '\';$cms_mod[\'key\'] = \'mod\'.$cms_mod[\'container\'][\'id\'].\'_' . $key3 . '_\'; ' . $sf_modinfostring . ' </CMSPHP>' . $container_code_cachephp; } } } $output = '<!--START ' . $cms_mod['container']['id'] . '//--><CMSPHP> ' . $cms_side_edit_var . ' $cms_mod[\'container\'][\'id\']=\'' . $cms_mod['container']['id'] . '\'; </CMSPHP>' . $output . '<!--END ' . $cms_mod['container']['id'] . '//-->'; } return $output; }