$value) if ($key != 'ID' && !is_numeric($key)) $group[$key] = $value; $GROUPS[$row['ID']] = $group; } mysql_free_result ($sql); # #frontend / backend # $ADMIN = FALSE; foreach ($QUERY as $key => $value) { if (!empty($value) && $value!=$_SESSION['lang']) { if ($value == "admin") $ADMIN = TRUE; break; } } # #create document # $PAGE = new HTMLDocument(); # #frontend # if (!$ADMIN) { //if (!empty($_POST)) // foreach ($_POST as $key=>$val) // $_POST[$key] = public_post($val); array_apply_recursive($_POST, 'public_post'); # #get all the MENUS from the content # $sql = sql_query ("SELECT `ID`,`url`,`parent`,`default` FROM `".$conf['sql']['prefix']."contents_".$_SESSION['lang']."`",$SQL); for ($i=0;$i $value) { if ((strlen($value)>0) && $value!=$_SESSION['lang'] && in_array($value,$MENUS['url'])) { $possible_ids = array_keys($MENUS['url'],$value); if (sizeof($MENUIDS)==0) { foreach ($possible_ids as $key => $value) if ($MENUS['parent'][$value] == 0) $MENUIDS[] = $MENUS['ID'][$value]; } else { foreach ($possible_ids as $key => $value) if ($MENUS['parent'][$value] == end($MENUIDS)) $MENUIDS[] = $MENUS['ID'][$value]; } } } # #default menu, if nothing found # $err = false; if (sizeof($MENUIDS)==0) { $MENUIDS[] = $MENUS['default']; $test = $QUERY; foreach ($test as $key => $value) if (empty($value) || $value==$_SESSION['lang']) unset ($test[$key]); if (!empty($test)) $err = true; } $MENU = sql_fetch_array (sql_query("SELECT * FROM `".$conf['sql']['prefix']."contents_".$_SESSION['lang']."` WHERE `ID`='".end($MENUIDS)."'",$SQL)); if ($err) { $MENU['title'] = error_404_title; $MENU['description'] = error_404_desc; $MENU['keywords'] = ''; $MENU['text'] = error_404_text; $MENU['type'] = ''; header("HTTP/1.0 404 Not Found"); header("Status: 404 Not Found"); } else { menu_defaults(); } include_once ('frontend.php'); if (end($QUERY)=='rss') { if (is_file("mod/".$MENU['type']."/".$MENU['type'].".rss.php")) { include_once "mod/".$MENU['type']."/".$MENU['type'].".rss.php"; $AJAX = true; } } else { if (is_file("mod/".$MENU['type']."/".$MENU['type'].".php")) include_once "mod/".$MENU['type']."/".$MENU['type'].".php"; } } # #admin # else { if (!empty($_POST)) foreach ($_POST as $key=>$val) $_POST[$key] = to_sql($val); $PRIVILEGES = array( 1 => admin_menu_rights_privileges_user, 2 => admin_menu_rights_privileges_group, 3 => admin_menu_rights_privileges_all ); include_once "lib/zip/pclzip.lib.php"; include_once "adm/inc/func.admin.php"; //include_once "lib/ini/ini.php"; include_once ('adm/backend.php'); include_once "adm/index.php"; } mysql_close ($SQL); if ($refresh) refresh_page(); if (!$AJAX && !$ADMIN) { echo rewrite(replace_specials($PAGE->render())); /* $out = rewrite(replace_specials($PAGE->render())); $f = iconv('utf-8','iso-8859-2','cache/'.$PAGE->get_title().'.html'); if (!is_file($f)) file_put_contents ($f,$out); echo $out; */ } elseif (!$AJAX && $ADMIN) echo rewrite($PAGE->render()); elseif ($OUTAJAX) echo replace_specials($OUTAJAX); ?>