function con_config_side_save($idcat, $idside, $idtpl, $idtplconf, $idsidelang, $idcatside, $idcatnew, $author, $title, $meta_keywords, $summary, $online, $user_protected, $view, $created, $lastmodified, $startdate, $starttime, $enddate, $endtime, $meta_author, $meta_description, $meta_robots, $meta_redirect_time, $meta_redirect, $meta_redirect_url, $rewrite_use_automatic, $rewrite_url, $idlay, $use_redirect = true) { global $db, $client, $sess, $perm, $lang, $cms_db, $cfg_client, $cms_lang, $val_ct; global $idcatside, $idside; if (!(is_numeric($idtpl) || is_int($idtpl))) { return; } if (!(is_numeric($idtplconf) || is_int($idtplconf))) { return; } if (empty($title)) { $title = $cms_lang['con_defaulttitle']; } $rewrite_use_automatic = $rewrite_use_automatic > 0 ? 1 : 0; rewriteGenerateMapping(); if ($rewrite_use_automatic) { $rewrite_url = rewriteGenerateUrlString($title); $rewrite_url = rewriteMakeUniqueStringForLang('idcatside', $idcatside, $rewrite_url); } else { $rewrite_url = rewriteGenerateUrlString($rewrite_url, true); } // idcatside für rechte $idcatside_for_rights = $idcatside; $idcat_for_rights = $idcat; if (!is_array($idcatnew)) { $idcatnew['0'] = $idcat; } $start = createDate($startdate, $starttime); $end = createDate($enddate, $endtime); $meta_redirect = $meta_redirect == '1' ? '1' : '0'; $meta_redirect_url = $meta_redirect_url == 'http://' || $meta_redirect_url == '' ? '' : $meta_redirect_url; set_magic_quotes_gpc($title); set_magic_quotes_gpc($summary); set_magic_quotes_gpc($meta_author); set_magic_quotes_gpc($meta_description); set_magic_quotes_gpc($meta_keywords); set_magic_quotes_gpc($meta_robots); set_magic_quotes_gpc($meta_redirect_url); if (empty($idside)) { //echo "new page";exit; // Seite erstellen $sql = "INSERT INTO {$cms_db['side']} (idclient) VALUES ('{$client}')"; $db->query($sql); // neue idside suchen $idside = mysql_insert_id(); // Seite in alle Ordner einfügen foreach ($idcatnew as $value) { //sortindex suchen $sql = "SELECT MAX(sortindex) AS sortindex FROM " . $cms_db['cat_side'] . " WHERE idcat='{$value}'"; $db->query($sql); if ($db->next_record()) { $sortindex = $db->f('sortindex') + 1; } else { $sortindex = 1; } $sql = "SELECT * FROM {$cms_db['cat_side']} WHERE idcat='{$value}' AND is_start='1'"; $db->query($sql); $is_start = $db->next_record() ? '0' : '1'; $sql = "INSERT INTO {$cms_db['cat_side']} (idcat, idside, sortindex, is_start) VALUES ('{$value}', '{$idside}', '{$sortindex}', '{$is_start}')"; $db->query($sql); } // idcatside suchen $sql = "SELECT idcatside FROM {$cms_db['cat_side']} WHERE idside='{$idside}'"; $idcatside = array(); getIdList($sql, $idcatside, '', 'idcatside'); // für jede Sprache erstellen $a_languages = get_languages_by_client($client); foreach ($a_languages as $tmp_lang) { if ($tmp_lang == $lang) { $side_online = $online; $side_start = $start; $side_end = $end; } else { $side_online = 0; $side_start = time(); $side_end = time(); } //TODO Problems to update template in multilang pages $catobject =& sf_factoryGetObject('PAGE', 'Cat'); $catobject->loadByIdcatIdlang($idcatnew['0'], $tmp_lang); $cat_is_protected = $catobject->getIsProtected(); if ($cat_is_protected) { $side_online = $side_online | 0x4; } if ($tmp_lang == $lang) { $tmp_meta_description = $meta_description; $tmp_meta_keywords = $meta_keywords; $tmp_meta_robots = $meta_robots; } else { $cfg_lang = $val_ct->get_by_group('cfg_lang', $client, $tmp_lang); $tmp_meta_description = htmlentities($cfg_lang['meta_description'], ENT_COMPAT, 'UTF-8'); $tmp_meta_keywords = htmlentities($cfg_lang['meta_keywords'], ENT_COMPAT, 'UTF-8'); $tmp_meta_robots = htmlentities($cfg_lang['meta_robots'], ENT_COMPAT, 'UTF-8'); } $sql = 'INSERT INTO ' . $cms_db['side_lang']; $sql .= ' (idside, idlang, title, meta_keywords, summary, created, lastmodified, author, meta_redirect, meta_redirect_url,'; $sql .= ' user_protected, online, start, end, meta_author, meta_description, meta_robots, meta_redirect_time, rewrite_use_automatic, rewrite_url) '; $sql .= 'VALUES ('; $sql .= " '{$idside}', '{$tmp_lang}', '{$title}', '{$tmp_meta_keywords}', '{$summary}', '{$created}', '{$lastmodified}', '{$author}', "; $sql .= " '{$meta_redirect}', '{$meta_redirect_url}', '{$user_protected}', '{$side_online}', '{$side_start}', '{$side_end}', "; $sql .= " '{$meta_author}', '{$tmp_meta_description}', '{$tmp_meta_robots}', '{$meta_redirect_time}', '{$rewrite_use_automatic}', '{$rewrite_url}')"; $db->query($sql); } // idsidelang für die Templateerstellung raussuchen $sql = "SELECT idsidelang FROM " . $cms_db['side_lang'] . " WHERE idside='{$idside}'"; $tmp_idsidelang = array(); $affectedrows = getIdList($sql, $tmp_idsidelang, '', 'idsidelang'); //print_r($tmp_idsidelang);exit; // Template erstellen if ($affectedrows) { foreach ($tmp_idsidelang as $value) { con_config_tpl_save($idtpl, $idlay, '', $value, $idtplconf); } //exit; } // Seite für Frontend erzeugen if ($cfg_client['publish'] == '1') { foreach ($a_languages as $tmp_lang) { $sql = 'INSERT INTO ' . $cms_db['code'] . "(idlang, idcatside, changed) VALUES ('{$tmp_lang}', '" . $idcatside['0'] . "', '1')"; $db->query($sql); } } // Event fire_event('con_side_new', array('idside' => $idside, 'name' => $title)); // Content aus Cache löschen sf_factoryCallMethod('UTILS', 'DbCache', null, null, 'flushByGroup', array('frontend', 'content')); // Danach ins Frontend? // ermittle redirect-url if ($view) { $url_location = $sess->url($cfg_client['htmlpath'] . $cfg_client['contentfile'] . '?lang=' . $lang . '&idcatside=' . $idcatside['0'] . '&view=' . $view); } else { $url_location = $sess->url("main.php?area=con_editframe&idcatside=" . $idcatside['0']); } $idcatside = $idcatside['0']; } else { // handle $online-Angabe // 0 -> offline setzen // 1 -> online setzen // 2 -> zeitsteuerung setzen switch ((int) $online) { case 0: $change_online = 'online & 0xFC'; break; case 1: $change_online = '((online & 0xFC) | 0x01)'; break; case 2: $change_online = '((online & 0xFC) | 0x02)'; break; default: $change_online = '0'; break; } // update der 'side_lang' Tabelle $sql = 'UPDATE ' . $cms_db['side_lang'] . ' '; $sql .= 'SET'; $sql .= " title='{$title}', meta_keywords='{$meta_keywords}', summary='{$summary}', meta_redirect='{$meta_redirect}', "; $sql .= " meta_redirect_url='{$meta_redirect_url}', user_protected = '{$user_protected}', online = {$change_online}, start='{$start}', "; $sql .= " end='{$end}', meta_author='{$meta_author}', meta_description='{$meta_description}', meta_robots='{$meta_robots}', "; $sql .= " meta_redirect_time = '{$meta_redirect_time}', rewrite_use_automatic = '{$rewrite_use_automatic}', rewrite_url = '{$rewrite_url}' "; $sql .= 'WHERE idsidelang = ' . $idsidelang; $db->query($sql); // in welchem Ordner existiert die Seite? $sql = 'SELECT idcat FROM ' . $cms_db['cat_side'] . ' WHERE idside = ' . $idside; $tmp_idcat = array(); getIdList($sql, $tmp_idcat, 'idcat'); if (is_array($tmp_idcat)) { // Seite in neue Ordner einfügen foreach ($idcatnew as $value) { if (!in_array($value, $tmp_idcat)) { $sql = 'SELECT * FROM ' . $cms_db['cat_side'] . ' WHERE idcat = ' . $value . ' AND is_start = 1'; $db->query($sql); $is_start = $db->next_record() ? '0' : '1'; //sortindex suchen $sql = "SELECT MAX(sortindex) AS sortindex FROM " . $cms_db['cat_side'] . " WHERE idcat='{$value}'"; $db->query($sql); if ($db->next_record()) { $sortindex = $db->f('sortindex') + 1; } else { $sortindex = 1; } if ($value == $idcatnew['0'] && !in_array($idcat, $idcatnew)) { $sql = 'UPDATE ' . $cms_db['cat_side'] . ' '; $sql .= 'SET'; $sql .= ' idcat = ' . $value . ','; $sql .= ' sortindex = ' . $sortindex . ','; $sql .= ' is_start = ' . $is_start . ' '; $sql .= 'WHERE idcat = ' . $idcat; $sql .= ' AND idside = ' . $idside; $db->query($sql); if (in_array($idcat, $idcatnew)) { unset($tmp_idcat[$idcat]); } //alte kategorie neu sortieren if (!function_exists('con_reindex_page_sort')) { include_once 'inc/fnc.con.php'; } con_reindex_page_sort($idcat); } else { //sortindex suchen $sql = "SELECT MAX(sortindex) AS sortindex FROM " . $cms_db['cat_side'] . " WHERE idcat='{$value}'"; $db->query($sql); if ($db->next_record()) { $sortindex = $db->f('sortindex') + 1; } else { $sortindex = 1; } $sql = 'INSERT INTO ' . $cms_db['cat_side'] . ' '; $sql .= ' (idcat , idside , is_start, sortindex) '; $sql .= 'VALUES'; $sql .= " ({$value}, {$idside}, {$is_start}, {$sortindex}) "; $db->query($sql); } } } // Seite aus nicht benutzen Ordnern löschen // jb_todo: rechte löschen?? foreach ($tmp_idcat as $value) { if (!in_array($value, $idcatnew)) { // suche alle idcatsides, die nicht mehr existieren $sql = 'SELECT idcatside FROM ' . $cms_db['cat_side'] . " WHERE idcat='{$value}' AND idside='{$idside}'"; $db->query($sql); $db->next_record(); // lösche alte 'code' Einträge $sql = 'DELETE FROM ' . $cms_db['code'] . " WHERE idcatside='" . $db->f('idcatside') . "'"; $db->query($sql); // lösche alte 'cat_side' Einträge $sql = 'DELETE FROM ' . $cms_db['cat_side'] . " WHERE idside='{$idside}' AND idcat='{$value}'"; $db->query($sql); // falls kein Startartikel mehr vorhanden neuen setzen $sql = 'SELECT * FROM ' . $cms_db['cat_side'] . " WHERE idcat='{$value}' AND is_start='1'"; $db->query($sql); if (!$db->affected_rows()) { $sql = 'UPDATE ' . $cms_db['cat_side'] . " SET is_start = '1' WHERE idcat='{$value}' ORDER BY sortindex LIMIT 1"; $db->query($sql); } //sortindex neu sortieren if (!function_exists('con_reindex_page_sort')) { include_once 'inc/fnc.con.php'; } con_reindex_page_sort($value); // jb_todo: // lösche alte 'tpl_conf' Einträge // muß noch eingetragen werden //Event fire_event('get_unused_idcatside_by_save_side', array('idside' => $idside, 'idcat' => $value, 'idcatside' => $db->f('idcatside'))); } } } // Template konfigurieren $have_perm_save_configdata = $perm->have_perm(27, 'side', $idcatside_for_rights, $idcat_for_rights); // if ($idtplconf == '0' && $idtpl != '0') { // $sql = 'SELECT idsidelang FROM ' . $cms_db['side_lang'] . " WHERE idside = $idside"; // $tmp_idsidelang = array(); // $affected_rows = getIdList($sql, $tmp_idsidelang, '', 'idsidelang'); // //print_r($tmp_idsidelang);exit; // // // Template erstellen // if ($affected_rows) { // foreach ($tmp_idsidelang as $value) { // con_config_tpl_save($idtpl, $idlay, '', $value, $idtplconf, $have_perm_save_configdata); // } // } // } // else { con_config_tpl_save($idtpl, $idlay, '', $idsidelang, $idtplconf, $have_perm_save_configdata); // } // Rechte setzen if ($perm->have_perm(22, 'side', $idcatside_for_rights, $idcat_for_rights)) { global $backend_cms_gruppenids, $backend_cms_gruppenrechte, $backend_cms_gruppenrechtegeerbt, $backend_cms_gruppenrechteueberschreiben; $perm->set_group_rights('side', $idcatside_for_rights, $backend_cms_gruppenids, $backend_cms_gruppenrechte, $backend_cms_gruppenrechtegeerbt, $backend_cms_gruppenrechteueberschreiben, '', 0x7ffd0000, $idcat_for_rights, 0x7ffd0000); } if ($perm->have_perm(14, 'cat', $idcat_for_rights)) { global $frontend_cms_gruppenids, $frontend_cms_gruppenrechte, $frontend_cms_gruppenrechtegeerbt, $frontend_cms_gruppenrechteueberschreiben; $perm->set_group_rights('frontendpage', $idcatside_for_rights, $frontend_cms_gruppenids, $frontend_cms_gruppenrechte, $frontend_cms_gruppenrechtegeerbt, $frontend_cms_gruppenrechteueberschreiben, '', 68719476735.0, $idcat_for_rights, 4294967295.0); } // Codestatus ändern change_code_status($idcatside_for_rights, 1, 'idcatside'); // Event fire_event('con_side_edit', array('idside' => $idside, 'name' => $title)); // Content aus Cache löschen sf_factoryCallMethod('UTILS', 'DbCache', null, null, 'flushByGroup', array('frontend', 'content')); // ermittle redirect-url if ($view) { $url_location = $sess->url($cfg_client['htmlpath'] . $cfg_client['contentfile'] . '?lang=' . $lang . '&idcatside=' . $idcatside . '&view=' . $view); } else { $url_location = $sess->url('main.php?area=con'); } } // Cache-Group Frontend löschen sf_factoryCallMethod('UTILS', 'DbCache', null, null, 'flushByGroup', array('frontend')); if ($use_redirect) { redirect_page($url_location); } }
function lang_delete_language($idclient, $idlang) { global $db, $sess, $cms_db; //************ check if there are still sides online // change JB: Berücksichtigt auch die zeitgesteuerten Seiten $sql = "SELECT * FROM {$cms_db['side_lang']} A LEFT JOIN {$cms_db['side']} B USING(idside) WHERE B.idclient='{$idclient}' AND idlang!='0' AND idlang='{$idlang}' AND (online & 0x03) > 0x00"; $db->query($sql); if ($db->next_record()) { return "0802"; //Deleting not possible because of online sides or visible categories } //************ check if there are visible categories // change JB: Berücksichtigt auch die zeitgesteuerten Seiten $sql = "SELECT * FROM {$cms_db['cat_lang']} A LEFT JOIN {$cms_db['cat']} B USING(idcat) WHERE B.idclient='{$idclient}' AND idlang!='0' AND idlang='{$idlang}' AND (visible & 0x03) > 0x00"; $db->query($sql); if ($db->next_record()) { return "0802"; } //Deleting not possible because of online sides or visible categories // keine seiten oder kategorien online ... löschen // Event feuern fire_event('delete_lang', array('idclient' => $idclient, 'idlang' => $idlang)); //********* check if this is the clients last language to be deleted, if yes delete from side, cat, and cat_side as well ******* $last_language = 0; $sql = "SELECT COUNT(*) FROM {$cms_db['clients_lang']} WHERE idclient='{$idclient}'"; $db->query($sql); $db->next_record(); if ($db->f(0) == 1) { $lastlanguage = 1; } //********** delete from 'side_lang'-table ************* $sql = "SELECT idsidelang, A.idside FROM {$cms_db['side_lang']} A LEFT JOIN {$cms_db['side']} B USING(idside) WHERE B.idclient='{$idclient}' AND idlang!='0' AND idlang='{$idlang}'"; $db->query($sql); while ($db->next_record()) { $a_idsidelang[] = $db->f('idsidelang'); $a_idside[] = $db->f('idside'); } if (is_array($a_idsidelang)) { foreach ($a_idsidelang as $value) { $sql = "DELETE FROM {$cms_db['side_lang']} WHERE idsidelang='{$value}'"; $db->query($sql); $sql = "DELETE FROM {$cms_db['content']} WHERE idsidelang='{$value}'"; $db->query($sql); } } if ($lastlanguage == 1) { if (is_array($a_idside)) { foreach ($a_idside as $value) { $sql = "DELETE FROM {$cms_db['side']} WHERE idside='{$value}'"; $db->query($sql); $sql = "DELETE FROM {$cms_db['cat_side']} WHERE idside='{$value}'"; $db->query($sql); } } } //********** delete from 'cat_lang'-table ************* $sql = "SELECT idcatlang, A.idcat FROM {$cms_db['cat_lang']} A LEFT JOIN {$cms_db['cat']} B USING(idcat) WHERE B.idclient='{$idclient}' AND idlang!='0' AND idlang='{$idlang}'"; $db->query($sql); while ($db->next_record()) { $a_idcatlang[] = $db->f("idcatlang"); $a_idcat[] = $db->f("idcat"); } if (is_array($a_idcatlang)) { foreach ($a_idcatlang as $value) { $sql = "DELETE FROM {$cms_db['cat_lang']} WHERE idcatlang='{$value}'"; $db->query($sql); } } if ($lastlanguage == 1) { if (is_array($a_idcat)) { foreach ($a_idcat as $value) { $sql = "DELETE FROM {$cms_db['cat']} WHERE idcat='{$value}'"; $db->query($sql); } } } // Cache-Group Frontend löschen sf_factoryCallMethod('UTILS', 'DbCache', null, null, 'flushByGroup', array('frontend')); // delete cfg_lang entries from 'cms_values'-table $sql = "DELETE FROM " . $cms_db['values'] . " WHERE idlang='{$idlang}' AND group_name = 'cfg_lang'"; $db->query($sql); // delete from 'code'-table $sql = "DELETE FROM {$cms_db['code']} WHERE idlang='{$idlang}'"; $db->query($sql); // delete from 'clients_lang'-table $sql = "DELETE FROM {$cms_db['clients_lang']} WHERE idclient='{$idclient}' AND idlang='{$idlang}'"; $db->query($sql); // delete from 'lang'-table $sql = "DELETE FROM {$cms_db['lang']} WHERE idlang='{$idlang}'"; $db->query($sql); // delete from 'perm'-table $sql = "DELETE FROM {$cms_db['perms']} WHERE idlang='{$idlang}'"; $db->query($sql); }
function save() { global $cms_db; if (!$this->dirty) { return false; } //TODO change code status //Tabelle: side //- wenn neuer datensatz, idside anlegen //Tabelle: side_lang //- �ndern oder neu anlegen //- wenn neu: f�r alle sprachen anlegen, in anderen sprachen offline anlegen $current_time = time(); $catinfos = sf_factoryGetObjectCache('PAGE', 'Catinfos'); $catinfos->setIdlang($this->data['sql']['cat_lang']['idlang']); $catinfos->generate(); //print_r($this->data);exit; if ($this->data['sql']['cat']['parent'] < 1) { $this->data['sql']['cat']['parent'] = 0; $this->data['sql']['cat']['rootparent'] = $this->data['sql']['cat']['idcat']; } //new cat if ($this->data['sql']['cat']['idcat'] < 1) { //table cat //first run $record = $this->data['sql']['cat']; $record['idcat'] = false; $record['created'] = $current_time; $record['lastmodified'] = $current_time; $this->db->AutoExecute($cms_db['cat'], $record, 'INSERT'); $this->data['sql']['cat']['idcat'] = $this->db->Insert_ID(); $this->data['sql']['cat_lang']['idcat'] = $this->db->Insert_ID(); //echo $this->data['sql']['cat_lang']['idcat']; unset($record); //second run $record['idcat'] = $this->data['sql']['cat']['idcat']; $record['rootparent'] = $this->data['sql']['cat']['rootparent'] = $this->_getRootparent($this->data['sql']['cat']['parent']); $record['sortindex'] = $this->data['sql']['cat']['sortindex'] = $this->_getNextSortindex($this->data['sql']['cat']['parent']); $this->db->AutoExecute($cms_db['cat'], $record, 'UPDATE', "idcat = '" . $this->data['sql']['cat']['idcat'] . "'"); unset($record); // table cat_lang $record = $this->data['sql']['cat_lang']; //TODO title ist kopie von xy $arr = $this->_getLangInfoArray(); foreach ($arr['order'] as $current_lang) { $record['idcatlang'] = false; $record['idlang'] = $current_lang; if ($this->_set_langprefix_on_save_if_new) { if ($current_lang != $this->data['sql']['cat_lang']['idlang']) { $record['name'] .= ' (' . $arr[$current_lang]['name'] . ')'; } } $this->db->AutoExecute($cms_db['cat_lang'], $record, 'INSERT'); if ($current_lang == $this->data['sql']['cat_lang']['idlang']) { $this->data['sql']['cat_lang']['idcatlang'] = $this->db->Insert_ID(); } } unset($record); //TODO Event } else { //update page // table cat $record = $this->data['sql']['cat']; $this->db->AutoExecute($cms_db['cat'], $record, 'UPDATE', "idcat = '" . $this->data['sql']['cat']['idcat'] . "'"); unset($record); // table cat_lang $record = $this->data['sql']['cat_lang']; $record['lastmodified'] = $current_time; $this->db->AutoExecute($cms_db['cat_lang'], $record, 'UPDATE', "idcatlang = '" . $this->data['sql']['cat_lang']['idcatlang'] . "'"); unset($record); } // Content aus Cache l�schen sf_factoryCallMethod('UTILS', 'DbCache', null, null, 'flushByGroup', array('frontend')); $this->dirty = false; return true; }
/** * Frontend Controller Class * @return void */ public function index() { $cms_path = $this->controller_cfg['cms_path']; $cms_db = $GLOBALS['cms_db']; $cfg_cms = $GLOBALS['cfg_cms']; $cfg_client = $GLOBALS['cfg_client']; //vars from project config $idcatside = FALSE; $idcat = FALSE; $lang = FALSE; $client = FALSE; $sf_frontend_output = sf_api('LIB', 'FrontendOutput'); //set cfg db names $this->cfg->set('db', $cms_db); //lookup for backend view $view = $this->req->req('view'); //get backend or frontend session $sid = FALSE; $sefrengo = FALSE; list($sid, $sefrengo) = $this->ft->getSessionIdsFromRequest($view); //generate frontend/ backend boolean vars $is_onpage = TRUE; $is_frontend = $is_backend = $is_backend_preview = $is_backend_edit = FALSE; list($is_frontend, $is_backend, $is_backend_preview, $is_backend_edit) = $this->ft->getViewModes($view, $sefrengo); $this->_assignGlobals('is_frontend', $is_frontend); $this->_assignGlobals('is_backend', $is_backend); $this->cfg->setVal('env', 'sid', $sid); $this->cfg->setVal('env', 'sefrengo', $sefrengo); $this->cfg->setVal('env', 'is_onpage', $is_onpage); $this->cfg->setVal('env', 'is_frontend', $is_frontend); $this->cfg->setVal('env', 'is_backend', $is_backend); $this->cfg->setVal('env', 'is_backend_preview', $is_backend_preview); $this->cfg->setVal('env', 'is_backend_edit', $is_backend_edit); //init log $cms_log = $this->_initAndGetLog(); //init db $db = new DB_cms(); $this->_assignGlobals('db', $db); $this->ft->setDb($db); $this->ft->setDbNames($cms_db); //$val_ct = new values_ct(); //$this->_assignGlobals('val_ct', $val_ct); //$cfg_cms = array_merge($cfg_cms, $val_ct->get_cfg() ); $valcol = sf_api('MODEL', 'ValueSqlCollection'); $valcol->getByGroup('cfg'); $cfg_cms = array_merge($cfg_cms, $valcol->getAssocKeyArray()); $valcol->getByGroup('lang'); $cms_lang = $valcol->getAssocKeyArray(); $this->_assignGlobals('cfg_cms', $cfg_cms); $this->cfg->set('cms', $cfg_cms); $this->cfg->setVal('env', 'path_backend_http', $this->cfg->cms('path_base_http') . $this->cfg->cms('path_backend_rel')); $this->cfg->setVal('env', 'path_backend', $this->cfg->cms('path_base') . $this->cfg->cms('path_backend_rel')); $client = (int) $GLOBALS['client']; //idclient from projectconfig //$cfg_client = $val_ct->get_by_group('cfg_client', $client); $valcol->setIdclient($client); $valcol->getByGroup('cfg_client'); $cfg_client = $valcol->getAssocKeyArray(); $cfg_client['path_http'] = str_replace(array('{%http_host}', '{%request_uri}'), array($_SERVER['HTTP_HOST'], $_SERVER['QUERY_STRING']), $cfg_client['path_http']); $cfg_client['path_http_edit'] = str_replace(array('{%http_host}', '{%request_uri}'), array($_SERVER['HTTP_HOST'], $_SERVER['QUERY_STRING']), $cfg_client['path_http_edit']); unset($valcol); $this->_assignGlobals('cfg_client', $cfg_client); $this->cfg->set('client', $cfg_client); $sf_path_base = $this->cfg->cms('path_base'); $sf_path_http_frontend = $is_frontend ? $this->cfg->client('path_http') : $this->cfg->client('path_http_edit'); $this->cfg->setVal('env', 'path_frontend_http', $sf_path_http_frontend . $this->cfg->client('path_rel')); $this->cfg->setVal('env', 'path_frontend', $sf_path_base . $this->cfg->client('path_rel')); $this->cfg->setVal('env', 'path_frontend_fm_http', $sf_path_http_frontend . $this->cfg->client('path_rel') . $this->cfg->client('path_fm_rel')); $this->cfg->setVal('env', 'path_frontend_fm', $sf_path_base . $this->cfg->client('path_rel') . $this->cfg->client('path_fm_rel')); $this->cfg->setVal('env', 'path_frontend_css_http', $sf_path_http_frontend . $this->cfg->client('path_rel') . $this->cfg->client('path_css_rel')); $this->cfg->setVal('env', 'path_frontend_css', $sf_path_base . $this->cfg->client('path_rel') . $this->cfg->client('path_css_rel')); $this->cfg->setVal('env', 'path_frontend_js_http', $sf_path_http_frontend . $this->cfg->client('path_rel') . $this->cfg->client('path_js_rel')); $this->cfg->setVal('env', 'path_frontend_js', $sf_path_base . $this->cfg->client('path_rel') . $this->cfg->client('path_js_rel')); //init db cache $db->init_cache(); //init / found idlang $this->_initLang($db, $cms_db, $client); $sf_lang_stack = $this->controller_cfg['sf_lang_stack']; $lang_global_startlang = $this->controller_cfg['lang_global_startlang']; $langarray = $this->controller_cfg['langarray']; $startlang = $this->controller_cfg['startlang']; $this->_assignGlobals('sf_lang_stack', $sf_lang_stack); $this->_assignGlobals('lang_global_startlang', $lang_global_startlang); $this->_assignGlobals('langarray', $langarray); $this->_assignGlobals('startlang', $startlang); // init idactside, idcat, lang list($idcatside, $idcat, $lang) = $this->ft->getPageIdsFromRequest($startlang); $this->_assignGlobals('lang', $lang); $is_frontend_rewrite_no = $cfg_client['url_rewrite'] == '0' && $is_frontend; $is_frontend_rewrite1 = $cfg_client['url_rewrite'] == '1' && $is_frontend; $is_frontend_rewrite2 = $cfg_client['url_rewrite'] == '2' && $is_frontend; $this->cfg->setVal('env', 'is_frontend_rewrite_no', $is_frontend_rewrite_no); $this->cfg->setVal('env', 'is_frontend_rewrite1', $is_frontend_rewrite1); $this->cfg->setVal('env', 'is_frontend_rewrite2', $is_frontend_rewrite2); //extract idcatside/ idcat from frontend rewrite url $_sf_rewrite_session = FALSE; if ($is_frontend_rewrite2 && ($idcatside < 1 && $idcat < 1)) { include_once $cfg_cms['path_base'] . $cfg_cms['path_backend_rel'] . 'inc/fnc.mod_rewrite.php'; $_sf_rewrite_session = TRUE; $rewrite_lang = ''; //is not startpage if ($_REQUEST['sf_rewrite'] != '') { list($idcatside, $idcat, $rewrite_lang) = $this->_getIdcatsideIdcatLangByRewriteUrl($db, $cfg_cms, $cfg_client, $cms_db, $client, $sf_lang_stack, $startlang); $lang = (int) $rewrite_lang > 0 ? (int) $rewrite_lang : $lang; //idcatside and idcat can't be found if ($idcatside < 1 && $idcat < 1) { $idcatside = $this->ft->tryToRemapIdcatsideOrShow404(); } } } $this->cfg->setVal('env', 'idclient', $client); $this->cfg->setVal('env', 'idlang', $lang); $this->cfg->setVal('env', 'idstartlang', $startlang); $this->cfg->setVal('env', 'idcatside', $idcatside); $this->cfg->setVal('env', 'idpage', $idcatside); $this->cfg->setVal('env', 'idcat', $idcat); $this->_assignGlobals('idcatside', $idcatside); $this->_assignGlobals('_sf_rewrite_session', $_sf_rewrite_session); $this->_assignGlobals('idcat', $idcat); $this->_assignGlobals('lang', $lang); //start session and auth $this->ft->startSession(); $sess = $this->_getGlobal('sess'); $auth = $this->_getGlobal('auth'); $this->cfg->set('sess', $sess); $this->cfg->set('auth', $auth); // Sprache wechseln $sess->register('sid_idcatside'); $sid_idcatside = $idcatside; $this->_assignGlobals('sid_idcatside', $sid_idcatside); $perm = new cms_perms($client, $lang); $this->_assignGlobals('perm', $perm); $this->cfg->set('perm', $perm); //assign logger client settings $cms_log->setIdclient($client); $cms_log->setIdlang($lang); $cms_log->setStorage('screen', $cfg_client['logs_storage_screen']); $cms_log->setStorage('logfile', $cfg_client['logs_storage_logfile']); $cms_log->setStorage('database', $cfg_client['logs_storage_database']); //get cms_lang strings $lang_charset = $sf_lang_stack[$lang]['charset']; $lang_dir = $cms_path . 'lang/' . $cfg_cms['backend_lang'] . '/'; $cms_lang = $this->ft->getFrontendLangFile($lang_dir, $cms_path); $this->_assignGlobals('lang_charset', $lang_charset); $this->_assignGlobals('lang_dir', $lang_dir); $this->_assignGlobals('cms_lang', $cms_lang); // if idcatside not set found start idcat if ($idcatside < 1) { $idcatside = $this->ft->getStartIdcatside(); $this->_assignGlobals('idcatside', $idcatside); $this->_assignGlobals('idpage', $idcatside); $this->cfg->setVal('env', 'idcatside', $idcatside); } $this->cfg->setVal('env', 'is_https', sf_get_server_protocol() == 'https'); //register globals if ($this->controller_cfg['register_globals']) { $types_to_register = array('GET', 'POST'); foreach ($types_to_register as $global_type) { $arr = @${'_' . $global_type}; if (@count($arr) > 0) { extract($arr, EXTR_SKIP); } } } $code = ''; if ($is_backend) { //idcat is needed for have_perm()- call //wenn vom frontend aus eine Kategorie angelegt wird, ist noch keine $idcat vorhanden if ((int) $idcat < 1 && !empty($idcatside)) { $sql = "SELECT idcat FROM " . $cms_db['cat_side'] . " WHERE idcatside='" . (int) $idcatside . "'"; $db->query($sql); if ($db->next_record()) { $idcat = $db->f('idcat'); $GLOBALS['idcat'] =& $idcat; //todo } } // Modus einstellen: editieren/Vorschau/normal $sf_perm_edit_page = FALSE; if ($perm->have_perm(19, 'side', $idcatside, $idcat)) { $sf_perm_edit_page = TRUE; } $this->cfg->setVal('env', 'view', $view); $this->cfg->setVal('env', 'perm_edit_page', $sf_perm_edit_page); //Generate cat and page informations $SF_catinfos = sf_api('LIB', 'Catinfos'); $con_tree = $SF_catinfos->getCatinfoDataArray(); $tlo_tree = $SF_catinfos->getParentDependanceDataArray(); $this->_assignGlobals('SF_catinfos', $SF_catinfos); $this->_assignGlobals('con_tree', $con_tree); $this->_assignGlobals('tlo_tree', $tlo_tree); tree_level_order('0', 'catlist'); $catlist = $GLOBALS['catlist']; $catlist_level = $GLOBALS['catlist_level']; $SF_pageinfos = sf_api('LIB', 'Pageinfos'); $con_side = $SF_pageinfos->getPageinfoDataArray(); $this->_assignGlobals('SF_pageinfos', $SF_pageinfos); $this->_assignGlobals('con_side', $con_side); // idcatside prüfen, da der User auch in einer Kategorie sein kann, wo es noch keine seite // und damit idcatside gibt. //catch advanced pageinfos for cuurent page if (!empty($idcatside)) { $con_side[$idcatside]['meta_author'] = $SF_pageinfos->getMetaAuthor($idcatside); $con_side[$idcatside]['meta_description'] = $SF_pageinfos->getMetaDescription($idcatside); $con_side[$idcatside]['meta_keywords'] = $SF_pageinfos->getMetaKeywords($idcatside); $con_side[$idcatside]['meta_robots'] = $SF_pageinfos->getMetaRobots($idcatside); $con_side[$idcatside]['meta_redirect'] = $SF_pageinfos->getMetaRedirectIsActive($idcatside); $con_side[$idcatside]['meta_redirect_url'] = $SF_pageinfos->getMetaRedirectUrl($idcatside); $con_side[$idcatside]['summary'] = $SF_pageinfos->getSummary($idcatside); $con_side[$idcatside]['author'] = $SF_pageinfos->getAuthor($idcatside); $con_side[$idcatside]['created'] = $SF_pageinfos->getCreatedTimestamp($idcatside); $con_side[$idcatside]['lastmodified'] = $SF_pageinfos->getLastmodifiedTimestamp($idcatside); $con_side[$idcatside]['is_https'] = $SF_pageinfos->getIsHttps($idcatside); } $idcat = $SF_pageinfos->getIdcat($idcatside); $idside = $SF_pageinfos->getIdside($idcatside); $this->cfg->setVal('env', 'idcat', $idcat); $this->cfg->setVal('env', 'idcatside', $idcatside); $this->_assignGlobals('idcat', $idcat); $this->_assignGlobals('idside', $idside); $arr = $this->ft->getIdtplIdtplconf($idcat, $idside, $lang); $idlay = $this->ft->getIdlay($arr['idtpl']); $this->cfg->setVal('env', 'idtpl', $arr['idtpl']); $this->cfg->setVal('env', 'idtplconf', $arr['idtplconf']); $this->cfg->setVal('env', 'idlay', $idlay); // Inhalt erstellen zum editieren der Seite if ($this->cfg->env('view')) { // es existiert noch keine Seite in diesem Ordner if (!$idcatside) { $this->cfg->setVal('env', 'view', FALSE); } include $cms_path . 'inc/fnc.tpl.php'; include $cms_path . 'inc/fnc.type.php'; $sefrengotag_config = NULL; $GLOBALS['sefrengotag_config'] = $sefrengotag_config; $con_contype = NULL; $GLOBALS['con_contype'] = $con_contype; $con_typenumber = NULL; $GLOBALS['con_typenumber'] = $con_typenumber; $filetarget_is_hidden = NULL; $GLOBALS['filetarget_is_hidden'] = $filetarget_is_hidden; $type_container = NULL; $GLOBALS['con_typenumber'] = $type_container; $type_number = NULL; $GLOBALS['con_typenumber'] = $type_number; $type_typenumber = NULL; $GLOBALS['con_typenumber'] = $type_typenumber; $sf_content_manipulation = sf_api('LIB', 'FrontendPageContentManipulation'); $data = $this->req->req('data'); $action = array_key_exists('action', $_GET) ? $_GET['action'] : $_POST['action']; $idsidelang = $con_side[$idcatside]['idsidelang']; // Content speichern if ($action == 'save' || $action == 'saveedit') { //content f�r event (am Ende der if-Schleife) zwischenspeichern $entry = $this->req->req('entry', FALSE); /** * Aufbau str $content * idcontainer.idrepeat.idformfieldtype-idmodtag[,idformfieldtypeN-idmodtagN] * 520.2.14-2,13-1,4-1,5-1,1-2,14-3 - bearbeiten * 530.new.13-1 - neu einf�gen, Position wird �ber $entry bestimmt * */ $sf_content_string = $this->req->req('content', FALSE); $con_content = explode(';', $sf_content_string); foreach ($con_content as $value) { $con_config = explode('.', $value); $con_container = $con_config['0']; $con_containernumber = $con_config['1']; $con_content_type = explode(',', $con_config[2]); //add space for a "new" repeat container if (is_numeric($entry) || is_int($entry)) { $sf_content_manipulation->addNewRepeatContainer($con_container, $entry, $idsidelang); } foreach ($con_content_type as $value3) { $value3 = explode('-', $value3); $con_formtypenumber = $value3['0']; $con_idmodtag = $value3['1']; $sf_field_content = $this->req->req('content_' . $con_container . '_' . $con_containernumber . '_' . $con_formtypenumber . '_' . $con_idmodtag); $new_containernumber = is_numeric($entry) || is_int($entry) ? $entry + 1 : $con_containernumber; // $idcontainer, $idmodtag, $formtypenumber, $content, $idrepeat, $idsidelang $sf_content_manipulation->save($con_container, $con_idmodtag, $con_formtypenumber, $sf_field_content, $new_containernumber, $idsidelang); } // Modulverdopplung minimieren, wenn Content leer ist. $sf_content_manipulation->checkAndOptimizeRepeatContainer($con_container, $new_containernumber, $idsidelang); } // Event fire_event('con_edit', array('path' => $cms_path, 'idcatside' => $idcatside, 'content' => $sf_content_string)); } else { if ($action == 'delete' || $action == 'move_up' || $action == 'move_down') { $content = $this->req->req('content', FALSE); $con_content = explode(';', $content); foreach ($con_content as $value) { $con_config = explode('.', $value); $con_container = $con_config['0']; $con_contnbr = $con_config['1']; switch ($action) { case 'delete': $sf_content_manipulation->delete($con_container, $con_contnbr, $idsidelang); break; case 'move_up': $sf_content_manipulation->moveUp($con_container, $con_contnbr, $idsidelang); break; case 'move_down': $sf_content_manipulation->moveDown($con_container, $con_contnbr, $idsidelang); break; } } $this->ft->redirect($idcatside); } } //Content bearbeiten if ($action == 'edit' || $action == 'saveedit' || $action == 'new') { $this->sf_is_form_edit_mode = TRUE; $code = $this->ft->getBackendEditForm($cms_path, $lang_charset, $cfg_cms, $idcatside, $lang, $GLOBALS['sess'], $cfg_client, $con_tree, $con_side, $cms_lang, $idside); } else { // Template suchen $container = $this->ft->getTemplateConfig($idcat, $idside, $lang); $content = ''; if (count($container) > 0) { $idtpl = $container['idtpl']; $idtplconf = $container['idtplconf']; $GLOBALS['idtpl'] =& $idtpl; //TODO $GLOBALS['idtplconf'] =& $idtplconf; //TODO $GLOBALS['container'] =& $container; //TODO //Generate content array $content = $this->ft->getContentArray($idside, $lang); $GLOBALS['content'] =& $content; //TODO //Get layout $sf_layoutarray = $this->ft->getLayoutArray($idtpl); $layout = $sf_layoutarray['layout']; $sf_doctype = $sf_layoutarray['doctype']; $sf_doctype_autoinsert = $sf_layoutarray['doctype_autoinsert']; $sf_slash_closing_tag = $sf_layoutarray['doctype_required_tag_postfix']; $sf_frontend_output->setDoctype($sf_layoutarray['doctype']); $sf_frontend_output->setCharset($sf_lang_stack[$lang]['charset']); $sf_frontend_output->setMetaKeywords($con_side[$idcatside]['meta_keywords']); $sf_frontend_output->setMetaDescription($con_side[$idcatside]['meta_description']); $sf_frontend_output->setMetaAuthor($con_side[$idcatside]['meta_author']); $sf_frontend_output->setMetaRobots($con_side[$idcatside]['meta_robots']); $code = $this->ft->mapCMSPHPCACHEToPhp($layout); // Container generieren $list = $this->ft->extractCmsTags($code); $GLOBALS['cms_mod'] =& $cms_mod; //TODO if (is_array($list)) { $search = array(); $replace = array(); $sf_frontend_output->setCmsLayTags($list); foreach ($list as $cms_mod['container']) { $search[] = $cms_mod['container']['full_tag']; //Head-Container if ($cms_mod['container']['type'] == 'head') { $backendcfg = array('is_backend' => $is_backend, 'is_https' => $cfg_client['https'] == 1 && $con_side[$idcatside]['is_https'] == 1, 'cms_html_path' => $cfg_cms['path_base_http'] . $cfg_cms['path_backend_rel'], 'skin' => $cfg_cms['skin'], 'lang_gen_deletealert' => $cms_lang['gen_deletealert'], 'perm' => $perm, 'view' => $view, 'idcatside' => $idcatside, 'idcat' => $idcat, 'lang' => $lang); $replace[] = $this->ft->getContainerHead($idlay, $sf_slash_closing_tag, $lang_charset, $sf_doctype, $backendcfg); } else { if ($cms_mod['container']['type'] == 'config') { $replace[] = $this->ft->getContainerConfig($is_backend); } else { $backendcfg = array('is_backend' => $is_backend, 'idcatside' => $idcatside, 'view' => $this->cfg->env('view')); $replace[] = $this->ft->getContainerContent($container, $cms_mod, $content, $backendcfg); } } } foreach ($search as $key => $value) { $code = str_replace($value, $replace[$key], $code); } } } else { $code = $cms_lang['con_notemplate']; } //echo $code;exit; ob_start(); eval(' ?>' . $code); $code = ob_get_contents(); ob_end_clean(); $code = $this->ft->mapCMSPHPToPhp($code); } } // Seite ausgeben if ($code) { //redirect is active if ($SF_pageinfos->getMetaRedirectIsActive($idcatside) && $SF_pageinfos->getMetaRedirectUrl($idcatside) != '') { $this->ft->redirect($SF_pageinfos->getMetaRedirectUrl($idcatside)); } else { ob_start(); eval('?>' . $code); $code = ob_get_contents(); ob_end_clean(); } } else { $this->ft->show404(); } } else { $cfg_client['session_enabled'] = $this->ft->isSessionDisabledByUseragent() ? 0 : $cfg_client['session_enabled']; $cfg_client['session_enabled'] = $this->ft->isSessionDisabledByIp() ? 0 : $cfg_client['session_enabled']; $this->cfg->setVal('client', 'session_enabled', $cfg_client['session_enabled']); if ($_sf_rewrite_session) { if ($sess->mode == 'get') { $sess->mode = 'getrewrite'; } } //Generate cat and page informations $SF_catinfos = sf_api('LIB', 'Catinfos'); $con_tree = $SF_catinfos->getCatinfoDataArray(); $tlo_tree = $SF_catinfos->getParentDependanceDataArray(); $GLOBALS['SF_catinfos'] = $SF_catinfos; //todo $GLOBALS['con_tree'] = $con_tree; //todo $GLOBALS['tlo_tree'] = $tlo_tree; //todo tree_level_order('0', 'catlist'); $catlist = $GLOBALS['catlist']; $catlist_level = $GLOBALS['catlist_level']; if (is_array($con_tree)) { $SF_pageinfos = sf_api('LIB', 'Pageinfos'); $con_side = $SF_pageinfos->getPageinfoDataArray(); $GLOBALS['SF_pageinfos'] = $SF_pageinfos; //todo $GLOBALS['con_side'] = $con_side; //todo } // $idcat und $idside ermitteln if (empty($idcat)) { $idcat = $con_side[$idcatside]['idcat']; } if (empty($idside)) { $idside = $con_side[$idcatside]['idside']; } $GLOBALS['idcat'] = $idcat; //todo $GLOBALS['idside'] = $idside; //todo if ($cfg_client['url_rewrite'] == '2') { include_once $cfg_cms['path_base'] . $cfg_cms['path_backend_rel'] . 'inc/fnc.mod_rewrite.php'; rewriteGenerateMapping(); } // Ausgabe beenden, wenn Kategorie oder Seite nicht online if ($con_side[$idcatside]['online'] != 1 || $con_tree[$idcat]['visible'] != 1) { $idcatside = $this->ft->tryToRemapIdcatsideOrShow404(); $idcat = $SF_pageinfos->getIdcat($idcatside); $idside = $SF_pageinfos->getIdside($idcatside); } // get advanced sideinfos for this side // idcatside pr�fen, da der User auch in einer Kategorie sein kann, wo es noch keine seite // und damit idcatside gibt. // es gibt keine idsidelang, wenn der user nicht das recht hat, die seite zu sehen if (!empty($idcatside) && !empty($con_side[$idcatside]['idsidelang'])) { $con_side[$idcatside]['meta_author'] = $SF_pageinfos->getMetaAuthor($idcatside); $con_side[$idcatside]['meta_description'] = $SF_pageinfos->getMetaDescription($idcatside); $con_side[$idcatside]['meta_keywords'] = $SF_pageinfos->getMetaKeywords($idcatside); $con_side[$idcatside]['meta_robots'] = $SF_pageinfos->getMetaRobots($idcatside); $con_side[$idcatside]['meta_redirect'] = $SF_pageinfos->getMetaRedirectIsActive($idcatside); $con_side[$idcatside]['meta_redirect_url'] = $SF_pageinfos->getMetaRedirectUrl($idcatside); $con_side[$idcatside]['summary'] = $SF_pageinfos->getSummary($idcatside); $con_side[$idcatside]['author'] = $SF_pageinfos->getAuthor($idcatside); $con_side[$idcatside]['created'] = $SF_pageinfos->getCreatedTimestamp($idcatside); $con_side[$idcatside]['lastmodified'] = $SF_pageinfos->getLastmodifiedTimestamp($idcatside); $con_side[$idcatside]['is_https'] = $SF_pageinfos->getIsHttps($idcatside); $con_side[$idcatside]['protected'] = $SF_pageinfos->getIsProtected($idcatside); } $this->cfg->setVal('env', 'idcat', $idcat); $this->cfg->setVal('env', 'idcatside', $idcatside); $arr = $this->ft->getIdtplIdtplconf($idcat, $idside, $lang); $idlay = $this->ft->getIdlay($arr['idtpl']); $this->cfg->setVal('env', 'idtpl', $arr['idtpl']); $this->cfg->setVal('env', 'idtplconf', $arr['idtplconf']); $this->cfg->setVal('env', 'idlay', $idlay); // Inhalt aus der Datenbank suchen if ($auth->auth['uid'] != 'nobody' | ($con_tree[$idcat]['visible'] == '1' && !empty($con_side[$idcatside]['online']) && $con_side[$idcatside]['online'] != '0')) { if (!empty($con_tree[$con_side[$idcatside]['idcat']]['idcat'])) { $sf_item_code = sf_api('MODEL', 'CodeSqlItem'); $sf_item_code->loadByIdcatside($idcatside); $code = $sf_item_code->getField('code'); if ($sf_item_code->getField('changed') == 1) { // Seite generieren weil keine Daten gefunden oder Daten ver�ndert include $cms_path . 'inc/fnc.type.php'; $container = $this->ft->getTemplateConfig($idcat, $idside, $lang); if (count($container) > 0) { $idtpl = $container['idtpl']; $idtplconf = $container['idtplconf']; $GLOBALS['idtpl'] =& $idtpl; //TODO $GLOBALS['idtplconf'] =& $idtplconf; //TODO $GLOBALS['container'] =& $container; //TODO //Generate content array $content = $this->ft->getContentArray($idside, $lang); $GLOBALS['content'] = $content; //TODO //Get layout $sf_layoutarray = $this->ft->getLayoutArray($idtpl); $layout = $sf_layoutarray['layout']; $sf_doctype = $sf_layoutarray['doctype']; $sf_doctype_autoinsert = $sf_layoutarray['doctype_autoinsert']; $sf_slash_closing_tag = $sf_layoutarray['doctype_required_tag_postfix']; $sf_frontend_output->setDoctype($sf_layoutarray['doctype']); $sf_frontend_output->setCharset($sf_lang_stack[$lang]['charset']); $sf_frontend_output->setMetaKeywords($con_side[$idcatside]['meta_keywords']); $sf_frontend_output->setMetaDescription($con_side[$idcatside]['meta_description']); $sf_frontend_output->setMetaAuthor($con_side[$idcatside]['meta_author']); $sf_frontend_output->setMetaRobots($con_side[$idcatside]['meta_robots']); $layout = $this->ft->mapCMSPHPCACHEToPhp($layout); // Container generieren $list = $this->ft->extractCmsTags($layout); //TODO: 2REMOVE - DEDI BACKWARD COMPATIBILITY $GLOBALS['cms_mod'] =& $cms_mod; //TODO //parse containers $search = array(); $replace = array(); if (is_array($list)) { $sf_frontend_output->setCmsLayTags($list); //TODO DOES NOT WORK WITHOUT CACHE!!!! foreach ($list as $cms_mod['container']) { $search[] = $cms_mod['container']['full_tag']; //Head-Container if ($cms_mod['container']['type'] == 'head') { $replace[] = $this->ft->getContainerHead($idlay, $sf_slash_closing_tag, $lang_charset, $sf_layoutarray['doctype']); } else { if ($cms_mod['container']['type'] == 'config') { $replace[] = $this->ft->getContainerConfig($is_backend); } else { $replace[] = $this->ft->getContainerContent($container, $cms_mod, $content); } } } // Seite erstellen $code = $layout; foreach ($search as $key => $value) { $code = str_replace($value, $replace[$key], $code); } } else { $code = $layout; } //no template found } else { $code = $cms_lang['con_notemplate']; } //render cached php ob_start(); eval(' ?>' . $code); $code = ob_get_contents(); $sf_fo_export = $sf_frontend_output->_exportConfig(); $code = '<CMSPHP> $_sf_frontend_output_cfg_cache = ' . $sf_fo_export . '; </CMSPHP>' . $code; ob_end_clean(); $code = $this->ft->mapCMSPHPToPhp($code); // Delete Content Cache sf_factoryCallMethod('UTILS', 'DbCache', null, null, 'flushByGroup', array('frontend', 'content')); // Seite in die 'code'-Tabelle schreiben if ($this->cfg->client('cache') == '1') { $sf_item_code->setField('code', $code); $sf_item_code->setField('changed', '0'); $sf_item_code->save(); } } } } // Seite ausgeben if ($code) { // handle meta redirect //redirect is active if ($SF_pageinfos->getMetaRedirectIsActive($idcatside) && $SF_pageinfos->getMetaRedirectUrl($idcatside) != '') { $this->ft->redirect($SF_pageinfos->getMetaRedirectUrl($idcatside)); } else { ob_start(); eval('?>' . $code); $sf_frontend_output->_importConfig($_sf_frontend_output_cfg_cache); $code = ob_get_contents(); ob_end_clean(); if ($this->cfg->env('send_header_404')) { $sf_frontend_output->setHttpHeader('HTTP/1.1 404 Not Found'); $sf_frontend_output->setHttpHeader('Status: 404 Not Found'); } } } else { $this->ft->show404(); } } //$sf_frontend_output->addContentToHead('<script>alert("hello")</script>', $position = 'top'); //$sf_frontend_output->changeContainerVisibility(520, FALSE); //$sf_frontend_output->changeContainerVisibility(510, FALSE); $output = $sf_frontend_output->parse($code, TRUE); if (!$this->sf_is_form_edit_mode) { $output = $this->ft->getMappedCmsFileUrlsToNamedUrls($output); $output = $this->ft->getMappedCmsLinks($output); } // event to manipulate the output $event = fire_event('frontend_code_generated', array('output' => $output), array('output')); $output = $event['output']; unset($event); //Logs auf Screen ausgeben, wenn Logs vorhanden if (count($cms_log->getLogs()) > 0) { $log_output = sf_api('VIEW', 'LogOutput'); $log_output->addItemsArray($cms_log->getLogs()); $searches = array('</body>'); foreach ($searches as $search) { $pos = strpos($output, $search); if ($pos !== FALSE) { // replace the last occurence of $search $output = substr_replace($output, "\n" . $log_output->show() . "\n" . $search, $pos, strlen($search)); break; // exit } } } //handle charset - default is UTF-8 if ($sf_lang_stack[$lang]['charset'] == 'iso-8859-1') { $output = utf8_decode($output); } // Seite komprimieren und ausgeben if ($cfg_cms['gzip'] == '1') { // @ob_start('ob_gzhandler'); eval($cfg_client['manipulate_output']); // @ob_end_flush(); } else { eval($cfg_client['manipulate_output']); } }
function con_sort_cat($dir, $idcat, $sortindex, $parent, $idclient) { global $db, $cms_db, $sort; $sort = true; switch ($dir) { case 'up': if ($sortindex > 1) { $sql = "UPDATE {$cms_db['cat']} SET sortindex='{$sortindex}' WHERE parent='{$parent}' AND sortindex='" . ($sortindex - 1) . "' AND idclient=" . $idclient; $db->query($sql); $sql = "UPDATE {$cms_db['cat']} SET sortindex='" . ($sortindex - 1) . "' WHERE parent='{$parent}' AND idcat='{$idcat}' AND idclient=" . $idclient; $db->query($sql); } break; case 'down': $sql = "UPDATE {$cms_db['cat']} SET sortindex='{$sortindex}' WHERE parent='{$parent}' AND sortindex='" . ($sortindex + 1) . "' AND idclient=" . $idclient; if ($db->query($sql)) { $sql = "UPDATE {$cms_db['cat']} SET sortindex='" . ($sortindex + 1) . "' WHERE parent='{$parent}' AND idcat='{$idcat}' AND idclient=" . $idclient; $db->query($sql); } break; case 'top': $sql = "UPDATE {$cms_db['cat']} SET sortindex=sortindex+1 WHERE parent={$parent} AND sortindex BETWEEN 1 AND {$sortindex} AND idclient=" . $idclient; $db->query($sql); $sql = "UPDATE {$cms_db['cat']} SET sortindex=1 WHERE idcat={$idcat} AND idclient=" . $idclient; $db->query($sql); break; case 'bottom': // Endwert holen $db->query("SELECT MAX(sortindex) AS max FROM {$cms_db['cat']} WHERE parent={$parent} AND idclient=" . $idclient); $db->next_record(); $lastindex = $db->f('max'); // Alles eins höher legen $sql = "UPDATE {$cms_db['cat']} SET sortindex=sortindex-1 WHERE parent={$parent} AND sortindex > {$sortindex} AND idclient=" . $idclient; $db->query($sql); // Aktuelle Seite nach ganz unten $sql = "UPDATE {$cms_db['cat']} SET sortindex={$lastindex} WHERE idcat={$idcat} AND idclient=" . $idclient; $db->query($sql); break; } // Navigationstree aus Cache löschen sf_factoryCallMethod('UTILS', 'DbCache', null, null, 'flushByGroup', array('frontend', 'tree')); }
// Inhalt aus der Datenbank suchen if ($auth->auth['uid'] != 'nobody' | ($con_tree[$idcat]['visible'] == '1' && !empty($con_side[$idcatside]['online']) && $con_side[$idcatside]['online'] != '0')) { if (!empty($con_tree[$con_side[$idcatside]['idcat']]['idcat'])) { $sql = 'SELECT code, changed '; $sql .= 'FROM ' . $cms_db['code'] . ' '; $sql .= 'WHERE idcatside = ' . $idcatside; $sql .= ' AND idlang = ' . $lang; $db->query($sql); $db->next_record(); $code = $db->f('code'); $code_changed = $db->f('changed'); if ($code_changed == '' || $code_changed == '1') { // Seite generieren weil keine Daten gefunden oder Daten verändert include $cms_path . 'inc/inc.generate_code.php'; // Delete Content Cache sf_factoryCallMethod('UTILS', 'DbCache', null, null, 'flushByGroup', array('frontend', 'content')); //schauen, ob sich cmstags im dynamischen php (<CMSPHP>) befinden //wenn ja, nicht cachen $dynamic = strpos($code, 'echo type_output_'); if (is_int($dynamic)) { $cfg_client['cache'] = '0'; } // Seite in die 'code'-Tabelle schreiben if ($cfg_client['cache'] == '1') { $sql = 'SELECT * '; $sql .= 'FROM ' . $cms_db['code'] . ' '; $sql .= 'WHERE idcatside = ' . $idcatside; $sql .= ' AND idlang = ' . $lang; $db->query($sql); if ($db->next_record()) { // Update vorhandener Seite
protected function _deleteFrontendCache() { static $run_once = FALSE; if (!$run_once) { // Delete Content Cache sf_factoryCallMethod('UTILS', 'DbCache', null, null, 'flushByGroup', array('frontend')); $run_once = TRUE; } }
function reindex_sort() { global $ssort, $db, $cms_db, $reindex; foreach (array_keys($reindex) as $kat) { ksort($ssort[$kat]); $index = 0; foreach ($ssort[$kat] as $idcatside) { $index++; $sql = "UPDATE {$cms_db['cat_side']} SET sortindex={$index} WHERE idcatside = {$idcatside}"; $db->query($sql); } } // Navigationstree aus Cache l�schen sf_factoryCallMethod('UTILS', 'DbCache', null, null, 'flushByGroup', array('frontend', 'tree')); }