0) { $_SESSION['id'] = $olivecms_user['id']; $_SESSION['level'] = $olivecms_user['level']; $_SESSION['username'] = $olivecms_user['username']; $_SESSION['olivecms_taskbar_switch'] = 'block'; }else{ $FEHLER['login'] = 1; } } $OLIVECMS['my']['id'] = $_SESSION['id']; $OLIVECMS['my']['level'] = $_SESSION['level']; $OLIVECMS['my']['username'] = $_SESSION['username']; //FACEBOOK & ACCOUNTPRÜFUNG // --------------------------------------------------------------------- function get_facebook_cookie($app_id, $application_secret) { $args = array(); parse_str(trim($_COOKIE['fbs_' . $app_id], '\\"'), $args); ksort($args); $payload = ''; foreach ($args as $key => $value) { if ($key != 'sig') { $payload .= $key . '=' . $value; } } if (md5($payload . $application_secret) != $args['sig']) { return null; } return $args; } $fb = get_facebook_cookie($OLIVECMS['facebook']['appid'], $OLIVECMS['facebook']['secret']); if($fb) { $url = 'https://graph.facebook.com/me?access_token=' . $fb['access_token']; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $fb_user = json_decode(curl_exec($ch)); curl_close($ch); $sql = "SELECT * FROM ". $OLIVECMS['db']['fb_users'] ." WHERE id = '". $fb_user->id ."'"; $result = mysql_query($sql); $olivecms_fb_user = mysql_fetch_assoc($result); if(mysql_num_rows($result) > 0) {}else{ $sql = "INSERT INTO ". $OLIVECMS['db']['fb_users'] ." (id,first_name,last_name,time) VALUES ('". $fb_user->id ."','". $fb_user->first_name ."','". $fb_user->last_name ."','". time() ."')"; mysql_query($sql)or die(mysql_error()); $sql = "SELECT * FROM ". $OLIVECMS['db']['fb_users'] ." WHERE id = '". $fb_user->id ."'"; $result = mysql_query($sql); $olivecms_fb_user = mysql_fetch_assoc($result); } } //SEITE & TEMPLATE LADEN // --------------------------------------------------------------------- if($OLIVECMS['request']['0'] == 'admin') { // Adminseite laden include_once('olivecms/admin.php'); }else{ // Wenn Seite nicht "admin" ist if($OLIVECMS['request']['0']) { // Wenn eine Alias angegeben wurde $sql = "SELECT * FROM ". $OLIVECMS['db']['site_content'] ." WHERE lang = '". $OLIVECMS['lang'] ."'"; $result = mysql_query($sql); while($CONTENT = mysql_fetch_array($result)) { $ALIAS = preg_split('/,/', $CONTENT['alias'], -1, PREG_SPLIT_NO_EMPTY); if(in_array($OLIVECMS['request']['0'],$ALIAS)) { $sql2 = "SELECT * FROM ". $OLIVECMS['db']['sites'] ." WHERE id = '". $CONTENT['site_id'] ."' LIMIT 1"; $result2 = mysql_query($sql2); $SITE = mysql_fetch_array($result2); break; } } if($SITE['id'] > 0) {}else{ // Wenn kein Treffer zur Alias gefunden wurde, Startseite ermitteln $sql = "SELECT * FROM ". $OLIVECMS['db']['sites'] ." WHERE index_site = '1' LIMIT 1"; $result = mysql_query($sql); $SITE = mysql_fetch_array($result); if($SITE['id'] > 0) { // Wenn Startseite gefunden wurde $sql = "SELECT * FROM ". $OLIVECMS['db']['site_content'] ." WHERE site_id = '". $SITE['id'] ."' && lang = '". $OLIVECMS['lang'] ."' LIMIT 1"; $result = mysql_query($sql); $CONTENT = mysql_fetch_array($result); $ALIAS = preg_split('/,/', $CONTENT['alias'], -1, PREG_SPLIT_NO_EMPTY); $OLIVECMS['request']['0'] = $ALIAS['0']; }else{ // Wenn keine Startseite gefunden wurde $OLIVECMS['fehler']['site'] = 'Keine Seite zum laden gefunden'; } } }else{ // Wenn keine Alias angegeben wurde, Startseite ermitteln $sql = "SELECT * FROM ". $OLIVECMS['db']['sites'] ." WHERE index_site = '1' LIMIT 1"; $result = mysql_query($sql); $SITE = mysql_fetch_array($result); if($SITE['id'] > 0) { // Wenn Startseite gefunden wurde $sql = "SELECT * FROM ". $OLIVECMS['db']['site_content'] ." WHERE site_id = '". $SITE['id'] ."' && lang = '". $OLIVECMS['lang'] ."' LIMIT 1"; $result = mysql_query($sql); $CONTENT = mysql_fetch_array($result); $ALIAS = preg_split('/,/', $CONTENT['alias'], -1, PREG_SPLIT_NO_EMPTY); $OLIVECMS['request']['0'] = $ALIAS['0']; }else{ // Wenn keine Startseite gefunden wurde $OLIVECMS['fehler']['site'] = 'Keine Seite zum laden gefunden'; } } if($SITE['id'] > 0 && $CONTENT['id'] > 0) { // Wenn Seite und Content dazu bestehen $sql = "SELECT * FROM ". $OLIVECMS['db']['templates'] ." WHERE id = '". $SITE['template_id'] ."'LIMIT 1"; $result = mysql_query($sql); $TEMPLATE = mysql_fetch_array($result); if($TEMPLATE['id'] > 0 && file_exists($OLIVECMS['dir']['templates'] ."/". $TEMPLATE['id'] .".php") && file_exists($OLIVECMS['dir']['sites'] ."/". $SITE['id'] ."_". $OLIVECMS['lang'] .".php")) { $sql = "SELECT id, navigation_id, url, lang FROM ". $OLIVECMS['db']['navigation_content'] ." WHERE url = '[". $ALIAS['0'] ."]' && lang = '". $OLIVECMS['lang'] ."' LIMIT 0,1"; //Navigation Informationen laden $result = mysql_query($sql); $check = mysql_fetch_array($result); if(mysql_num_rows($result) > 0) { // Wenn der Navigationspunkt wirklich vorhanden ist $sql = "SELECT * FROM ". $OLIVECMS['db']['navigation_points'] ." WHERE id = '$check[navigation_id]' LIMIT 0,1"; $result = mysql_query($sql); $check_navigation = mysql_fetch_array($result); if($check_navigation['subnavigation_id'] > 0) { // Wenn der Navigationspunkt eine Subnavigation ist $sql = "SELECT * FROM ". $OLIVECMS['db']['navigation_points'] ." WHERE id = '$check_navigation[subnavigation_id]' LIMIT 0,1"; $result = mysql_query($sql); $check2 = mysql_fetch_array($result); if($check2['subnavigation_id'] > 0) { // Wenn der Navigationspunkt eine Sub-Subnavigation ist $sql = "SELECT * FROM ". $OLIVECMS['db']['navigation_points'] ." WHERE subnavigation_id = '$check2[id]' LIMIT 0,1"; $result = mysql_query($sql); $check3 = mysql_fetch_array($result); $OLIVECMS['navigation']['id'] = $check2['subnavigation_id']; $OLIVECMS['navigation']['subnavigation'] = $check2['id']; $OLIVECMS['navigation']['subsubnavigation'] = $check3['id']; }else{ // Wenn der Navigationspunkt effektiv ein Subnavigationspunkt ist $OLIVECMS['navigation']['id'] = $check2['id']; $OLIVECMS['navigation']['subnavigation'] = $check_navigation['id']; $OLIVECMS['navigation']['subsubnavigation'] = 0; } }else{ // Wenn der Navigationspunkt keine Subnavigation ist $OLIVECMS['navigation']['id'] = $check_navigation['id']; $OLIVECMS['navigation']['subnavigation'] = 0; $OLIVECMS['navigation']['subsubnavigation'] = 0; } } ob_start(); include_once($OLIVECMS['dir']['sites'] ."/". $SITE['id'] ."_". $OLIVECMS['lang'] .".php"); $OLIVECMS['content'] = BBCode(ob_get_contents()); ob_end_clean(); ob_start(); include_once($OLIVECMS['dir']['templates'] ."/". $TEMPLATE['id'] .".php"); $OLIVECMS['template'] = BBCode(ob_get_contents()); ob_end_clean(); include_once('index_header.php'); // Header laden mit Informationen aus den Metadaten der SITE print($OLIVECMS['template'] . "\n"); // Template ausgeben }else{ include_once('olivecms/admin.php'); // wenn Seite und Conten nicht besteht, Adminbereich laden } }else{ // Wenn Seite und Content nicht bestehen, Adminbereich laden include_once('olivecms/admin.php'); } } if($OLIVECMS['my']['level'] > 0) { include_once('olivecms/olivecms_taskbar.php'); } include_once('index_footer.php'); mysql_close($connect_db); ?>