Example #1
0
 /**
  * Order the tree recursivly after generating the
  * rawdata.  
  * @param integer $parent 
  * @param integer $level
  * @return boolean Returns TRUE on success, otherwise returns FALSE.
  */
 protected function _treeOrder($parent, $level = 0, $parent_replace = FALSE)
 {
     if ($level > $this->data['level_max']) {
         $this->data['level_max'] = $level;
     }
     if (is_array($this->data['rawdata'][$parent])) {
         foreach ($this->data['rawdata'][$parent] as $index => $id) {
             $perm_ok = TRUE;
             if ($this->treecfg['perm']['active']) {
                 $perm_ok = $this->cfg->perm()->have_perm($this->treecfg['perm']['nr'], $this->treecfg['perm']['type'], $id);
             }
             if ($perm_ok) {
                 $this->data['items_levelorder'][] = $id;
                 $this->_incrementLevelCount($level);
                 $this->data['items_level'][$id] = $level;
                 $this->data['items_sortindex'][$id] = $sortindex;
                 if (is_array($this->data['rawdata'][$id])) {
                     $this->_treeOrder($id, $level + 1);
                 }
             } else {
                 if (is_array($this->data['rawdata'][$id])) {
                     $this->_treeOrder($id, $level);
                 }
                 unset($this->data['rawdata'][$parent][$index]);
                 unset($this->data['parents'][$id]);
             }
         }
         array_push($this->data['last_items'], $id);
     }
     return TRUE;
 }
Example #2
0
 /**
  * (non-PHPdoc)
  * @see API/INTERFACES/SF_INTERFACE_View#loadTemplatefile($filename, $remove_unknown_variables, $remove_empty_blocks)
  */
 public function loadTemplatefile($filename, $remove_unknown_variables = TRUE, $remove_empty_blocks = TRUE)
 {
     $path = $this->cfg->env('path_backend') . $this->templatevars['common']['SKINPATH'] . $filename;
     if ($filename == '' || !file_exists($path)) {
         return FALSE;
     }
     return $this->tpl->loadTemplatefile($filename, $remove_unknown_variables, $remove_empty_blocks);
 }
Example #3
0
 /**
  * Retrieves all events from the database and stores
  * them to {$events} array.
  * @return boolean Returns TRUE on success or FALSE on failure.
  */
 protected function _loadEvents()
 {
     $evtcol = sf_api('MODEL', 'EventSqlCollection');
     $evtcol->setIdclient($this->cfg->env('idclient'));
     $evtcol->setIdlang($this->cfg->env('idlang'));
     $evtcol->setOrder('name');
     $evtcol->setOrder('sortindex');
     $success = $evtcol->generate();
     $this->events = $evtcol->getItemsAsArray();
     return $success;
 }
 protected function _updateSideLangAndCodestatus($idsidelang)
 {
     // update lastmodified
     $sql = "UPDATE \r\n\t\t\t\t" . $this->dbnames['side_lang'] . " \r\n\t\t\tSET \r\n\t\t\t\tlastmodified='" . time() . "', \r\n\t\t\t\tauthor='" . $this->cfg->auth('uid') . "' \r\n\t\t\tWHERE \r\n\t\t\t\tidsidelang='{$idsidelang}'";
     $this->db->query($sql);
     // look up for clonepages
     $sql = "SELECT \r\n\t\t\t\t\tidcatside \r\n\t\t\t\tFROM \r\n\t\t\t\t\t" . $this->dbnames['side_lang'] . " A \r\n\t\t\t\t\tLEFT JOIN " . $this->dbnames['cat_side'] . " B USING(idside) \r\n\t\t\t\tWHERE \r\n\t\t\t\t\tA.idsidelang='{$idsidelang}'";
     $this->db->query($sql);
     while ($this->db->next_record()) {
         $list[] = $this->db->f('idcatside');
     }
     // change code status
     change_code_status($list, '1', 'idcatside');
 }
Example #5
0
 /**
  * Retrieves the $value from the session object by given $key.
  * Use $group if the variable is stored in a specific group.
  * If you want to clear all variables of the given group,
  * set $cleargroup to TRUE. 
  * @param string $key
  * @param string $group
  * @param boolean $cleargroup
  * @return boolean|mixed Returns the stored value or FALSE on failure.
  */
 protected function _getVarFromSession($key, $group = 'default', $cleargroup = FALSE)
 {
     global $GLOBALS;
     $varname = $this->controller_cfg['session_variable_name'];
     $group = $group === '' ? 'default' : $group;
     if ($this->cfg->sess()->is_registered($varname) !== FALSE && array_key_exists($group, $GLOBALS[$varname]) === TRUE && array_key_exists($key, $GLOBALS[$varname][$group]) === TRUE) {
         $value = $GLOBALS[$varname][$group][$key];
         if ($cleargroup == TRUE) {
             $this->_clearGroupFromSession($group);
         }
         return $value;
     } else {
         return FALSE;
     }
 }
Example #6
0
 /**
  * Generates the output of the items in the items stack
  * @global cfg_cms
  * @return String output
  */
 public function show()
 {
     $output = '';
     $area_name = $this->config['area_name'];
     $lng_messages = $this->lng->get($area_name . '_messages', $area_name);
     $output .= '<table id="sf_debug">' . "\n";
     $output .= '<caption>' . $this->lng->get($area_name . '_screen', $area_name) . '</caption>' . "\n";
     $output .= '<thead>' . "\n";
     $output .= '<tr>' . "\n";
     if (in_array('counter', $this->config['hide_column']) === FALSE) {
         $output .= '<th style="width:25px">#</th>' . "\n";
     }
     if (in_array('created', $this->config['hide_column']) === FALSE) {
         $output .= '<th style="width:160px">' . $this->lng->get($area_name . '_created', $area_name) . '</th>' . "\n";
     }
     if (in_array('priority', $this->config['hide_column']) === FALSE) {
         $output .= '<th style="width:80px">' . $this->lng->get($area_name . '_priority', $area_name) . '</th>' . "\n";
     }
     if (in_array('type', $this->config['hide_column']) === FALSE) {
         $output .= '<th style="width:120px">' . $this->lng->get($area_name . '_type', $area_name) . '</th>' . "\n";
     }
     if (in_array('message', $this->config['hide_column']) === FALSE) {
         $output .= '<th>' . $this->lng->get($area_name . '_message', $area_name) . '</th>' . "\n";
     }
     if (in_array('author', $this->config['hide_column']) === FALSE) {
         $output .= '<th>' . $this->lng->get($area_name . '_author', $area_name) . '</th>' . "\n";
     }
     if (in_array('idclient', $this->config['hide_column']) === FALSE) {
         $output .= '<th>' . $this->lng->get($area_name . '_client', $area_name) . '</th>' . "\n";
     }
     $output .= '</tr>' . "\n";
     $output .= '</thead>' . "\n";
     $output .= '<tbody>' . "\n";
     // loop through stack and output each item
     $counter = 0;
     foreach ($this->items as $item) {
         // increase counter
         $counter++;
         // want to colorize table?
         if ($this->config['colorize'] == TRUE) {
             switch ($item->getField('priorityname')) {
                 case "fatal":
                     $color = "#FFB3B3";
                     break;
                 case "error":
                     $color = "#FFCCCC";
                     break;
                 case "warning":
                     $color = "#FFE6CC";
                     break;
                 case "notice":
                     $color = "#FFF7CE";
                     break;
                 case "info":
                     $color = "#F0F8FF";
                     break;
                 case "debug":
                     $color = "#F8F8F8";
                     break;
                 default:
                     $color = "#FFFFFF";
                     break;
             }
             $output .= '<tr style="background-color:' . $color . ';">' . "\n";
         } else {
             //$color = "#FFFFFF";
             $output .= '<tr>' . "\n";
         }
         if (in_array('counter', $this->config['hide_column']) === FALSE) {
             $output .= '<td>' . $counter . '</td>' . "\n";
         }
         if (in_array('created', $this->config['hide_column']) === FALSE) {
             $date = $this->cfg->cms('format_date');
             $time = strpos($this->cfg->cms('format_time'), "s") === FALSE ? $this->cfg->cms('FormatTime') . ':s' : $this->cfg->cms('FormatTime');
             $output .= '<td>' . date($date . " - " . $time, htmlentities($item->getField('created'), ENT_COMPAT, 'UTF-8')) . '</td>' . "\n";
         }
         if (in_array('priority', $this->config['hide_column']) === FALSE) {
             $output .= '<td>' . htmlentities($item->getField('priorityname'), ENT_COMPAT, 'UTF-8') . '</td>' . "\n";
         }
         if (in_array('type', $this->config['hide_column']) === FALSE) {
             $output .= '<td>' . htmlentities($item->getField('type'), ENT_COMPAT, 'UTF-8') . '</td>' . "\n";
         }
         if (in_array('message', $this->config['hide_column']) === FALSE) {
             $param = $item->getField('param');
             $message_raw = $item->getField('message');
             $message = htmlentities($item->getField('message'), ENT_COMPAT, 'UTF-8');
             // message as langkey exists
             if (isset($lng_messages[$message_raw])) {
                 // has parameters?
                 if (empty($param) === FALSE) {
                     $param2 = array();
                     foreach ($param as $key => $val) {
                         $param2["{" . $key . "}"] = $val;
                     }
                     $msg = str_replace(array_keys($param2), array_values($param2), $lng_messages[$message_raw]);
                 } else {
                     $msg = $lng_messages[$message_raw];
                 }
             } else {
                 //wrap long messages
                 $msg = wordwrap($message, 50, "<br />\n", TRUE);
                 // has parameters?
                 if (empty($param) === FALSE) {
                     $msg .= '<br /><pre class="params"><code>' . htmlentities(print_r($param, TRUE), ENT_COMPAT, 'UTF-8') . '</code></pre>';
                 }
             }
             $output .= '<td class="left">' . $msg . '</td>' . "\n";
         }
         if (in_array('author', $this->config['hide_column']) === FALSE) {
             $author = htmlentities($item->getField('created_author'), ENT_COMPAT, 'UTF-8');
             if (empty($author) === TRUE) {
                 $author = $this->lng->get($area_name . '_noauthor', $area_name);
             }
             $output .= '<td>' . $author . '</td>' . "\n";
         }
         if (in_array('idclient', $this->config['hide_column']) === FALSE) {
             if ($item->getField('is_backend') === TRUE) {
                 $output .= '<td>' . $this->lng->get($area_name . '_backend', $area_name) . '</td>' . "\n";
             } else {
                 $output .= '<td>' . htmlentities($item->getField('idclient'), ENT_COMPAT, 'UTF-8') . '</td>' . "\n";
             }
         }
         $output .= '</tr>' . "\n";
     }
     $output .= '</tbody>' . "\n";
     $output .= '</table>' . "\n";
     return $output;
 }
 /**
  * Generate a SQL statement to set the perm limits
  * @return string Returns the piece of the SQL statement.
  * If an error occurs it returns an empty string.
  */
 protected function _getSqlPerms()
 {
     static $sql_perms = '';
     //perms are allready generated, return the string
     if ($sql_perms != '') {
         return $sql_perms;
     }
     //init perms with nothing
     $sql_perms = ' ';
     //Check if permcheck is enabled
     if (!$this->colcfg['perm_check_active']) {
         return $sql_perms;
     }
     //TODO make it for other clients/langs work
     if (TRUE) {
         $perm = $this->cfg->perm();
     } else {
         //TODO $client, $lang
         $perm = new cms_perms($client, $lang, TRUE, $this->cfg->perm()->get_group());
     }
     //admin has all perms, no more actions are needed
     if ($perm->is_admin()) {
         return $sql_perms;
     }
     $fielditem = $this->colcfg['perm_dbfield_id'];
     $fieldparent = $this->colcfg['perm_dbfield_parent'] != '' ? $this->colcfg['perm_dbfield_parent'] : NULL;
     $tablename = $this->tables[0];
     $clientlang = $this->_getSqlClientLang($this->colcfg['client'], $this->colcfg['lang'], array('client' => 'idclient', 'lang' => 'idlang'));
     $timestamp = $this->_getSqlTimestamp('created', $this->colcfg['timestamp_from'], $this->colcfg['timestamp_to']);
     $freefilter = $this->_getSqlFreefilter($this->colcfg['freefilter']);
     $search = $this->_getSqlSearch($this->colcfg['searchterm'], $this->colcfg['fulltextsearchfileds']);
     $item = sf_api($this->colcfg['model_path'], $this->colcfg['model']);
     $idfield = $item->mapFieldToRow('id', $this->tables[0]);
     $sql = $this->_getPermcheckSql($fielditem, $fieldparent, $tablename, $clientlang, $timestamp, $freefilter, $search);
     if ($sql === FALSE) {
         return $sql_perms;
     }
     $rs = $this->db->Execute($sql);
     if ($rs === FALSE || $rs->EOF) {
         return $sql_perms;
     }
     $positives = array();
     $negatives = array();
     //perms with dependancy
     if ($this->colcfg['perm_dbfield_parent'] != NULL) {
         while (!$rs->EOF) {
             if ($perm->have_perm($this->colcfg['perm_nr'], $this->colcfg['perm_type'], $rs->fields['iditem'], $rs->fields['idparent'])) {
                 array_push($positives, $rs->fields['iditem']);
             } else {
                 array_push($negatives, $rs->fields['iditem']);
             }
             $rs->MoveNext();
         }
     } else {
         while (!$rs->EOF) {
             if ($perm->have_perm($this->colcfg['perm_nr'], $this->colcfg['perm_type'], $rs->fields['iditem'])) {
                 array_push($positives, $rs->fields['iditem']);
             } else {
                 array_push($negatives, $rs->fields['iditem']);
             }
             $rs->MoveNext();
         }
     }
     $rs->Close();
     $count_pos = count($positives);
     $count_neg = count($negatives);
     if ($count_pos == 0 && $count_neg == 0) {
         return $sql_perms;
     } else {
         if ($count_pos < $count_neg && $count_pos > 0) {
             $sql_perms = 'AND ' . $this->colcfg['perm_dbfield_id'] . ' IN (' . implode(',', $positives) . ') ';
         } else {
             if ($count_neg > 0) {
                 $sql_perms = 'AND ' . $this->colcfg['perm_dbfield_id'] . ' NOT IN (' . implode(',', $negatives) . ') ';
             }
         }
     }
     return $sql_perms;
 }
Example #8
0
 /**
  * Creates a LogItem and decides where to save (database or file) or show directly
  * @param int $priority
  * @param string $type
  * @param string $message
  * @param array $param
  * @return boolean Returns TRUE on success or FALSE on failure.
  */
 protected function _handleLog($priority, $type, $message, $param)
 {
     // priority must be a number and type is required
     if (!is_numeric($priority) || strlen($type) < 0) {
         return FALSE;
     }
     $priokey = array_search($priority, $this->priorities);
     $merged = array();
     // add defined type and priority
     if (array_key_exists($type, $this->config['storage']) && is_array($this->config['storage'][$type][$priokey])) {
         $merged = array_merge($merged, $this->config['storage'][$type][$priokey]);
     }
     // add wildcard type for defined priority
     if (array_key_exists('*', $this->config['storage']) && is_array($this->config['storage']['*'][$priokey])) {
         $merged = array_merge($merged, $this->config['storage']['*'][$priokey]);
     }
     // add wildcard priority for defined type
     if (array_key_exists($type, $this->config['storage']) && is_array($this->config['storage'][$type]['*'])) {
         $merged = array_merge($merged, $this->config['storage'][$type]['*']);
     }
     // add wildcard priority and type
     if (array_key_exists('*', $this->config['storage']) && is_array($this->config['storage']['*']['*'])) {
         $merged = array_merge($merged, $this->config['storage']['*']['*']);
     }
     // remove duplicate entries
     $unique = array_unique($merged);
     // is there any output medium to log
     if (count($unique) > 0) {
         // create logitem
         $logitem = sf_api('MODEL', 'LogSqlItem');
         $logitem->setField('is_backend', $this->config['is_backend']);
         $logitem->setField('idclient', $this->config['idclient']);
         $logitem->setField('idlang', $this->config['idlang']);
         $logitem->setField('priority', $priority);
         $logitem->setField('priorityname', $priokey);
         $logitem->setField('type', $type);
         $logitem->setField('message', $message);
         $logitem->setField('created', time());
         $logitem->setField('created_author', $this->cfg->auth('uname'));
         if (!empty($param)) {
             $logitem->setField('param', $param);
         }
         // print_r($logitem);
         foreach ($unique as $outputmedium) {
             // do not add defined type and priority listed in the substract array -> continue to next item
             if (is_array($this->config['storage_substract'][$type][$priokey]) && in_array($outputmedium, $this->config['storage_substract'][$type][$priokey])) {
                 // echo 'do not add: '.$type.' - '.$priokey.' - '.$outputmedium.'<br />\n';
                 continue;
             } else {
                 if (is_array($this->config['storage_substract']['*'][$priokey]) && in_array($outputmedium, $this->config['storage_substract']['*'][$priokey])) {
                     // echo 'do not add: '.$type.' - '.$priokey.' - '.$outputmedium.'<br />\n';
                     continue;
                 } else {
                     if (is_array($this->config['storage_substract'][$type]['*']) && in_array($outputmedium, $this->config['storage_substract'][$type]['*'])) {
                         // echo 'do not add: '.$type.' - '.$priokey.' - '.$outputmedium.'<br />\n';
                         continue;
                     } else {
                         if (is_array($this->config['storage_substract']['*']['*']) && in_array($outputmedium, $this->config['storage_substract']['*']['*'])) {
                             // echo 'do not add: '.$type.' - '.$priokey.' - '.$outputmedium.'<br />\n';
                             continue;
                         } else {
                             // echo 'add: '.$type.' - '.$priokey.' - '.$outputmedium.'<br />\n';
                             // switch where to storage the item
                             switch ($outputmedium) {
                                 case 'database':
                                     $return = $this->_saveLogItemToDB($logitem);
                                     break;
                                 case 'logfile':
                                     $return = $this->_saveLogItemToFile($logitem);
                                     break;
                                 case 'screen':
                                     $return = $this->_displayLogItem($logitem);
                                     break;
                             }
                         }
                     }
                 }
             }
         }
     } else {
         $return = FALSE;
     }
     return $return;
 }
Example #9
0
 /**
  * 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']);
     }
 }
Example #10
0
 /**
  * Deletes all rights for the item.
  * @return boolean Returns TRUE on success or FALSE on failure.
  */
 public function deleteAllPerms()
 {
     return $this->cfg->perm()->delete_perms($this->getId(), $this->objperm['default']['type'], 0, 0, 0, TRUE);
 }