vela vecí nove more
This commit is contained in:
		
							
								
								
									
										24
									
								
								index.php
									
									
									
									
									
								
							
							
						
						
									
										24
									
								
								index.php
									
									
									
									
									
								
							@@ -16,18 +16,28 @@ if (!isset($_SESSION['user_id'])) {
 | 
				
			|||||||
    $page = basename($_SERVER['QUERY_STRING']);
 | 
					    $page = basename($_SERVER['QUERY_STRING']);
 | 
				
			||||||
    $nav = file_get_contents("$template_dir/navigation.html");
 | 
					    $nav = file_get_contents("$template_dir/navigation.html");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if(empty($page)){
 | 
					    $paths_to_check = array();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    $paths_to_check[] = "pages/global";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if ($user['isAdmin'] == 1) {
 | 
					    if ($user['isAdmin'] == 1) {
 | 
				
			||||||
           $page = 'index_admin'; // Custom HTML for Admin
 | 
					        $paths_to_check[] = "pages/admin";
 | 
				
			||||||
        } else {
 | 
					 | 
				
			||||||
            $page = 'index_user'; // Custom HTML for regular user
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    $page_file = "$page_dir/$page.html";
 | 
					    $paths_to_check[] = "pages/user";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if(empty($page)){
 | 
				
			||||||
 | 
					        $page = 'index';
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!file_exists($page_file)) {
 | 
					 | 
				
			||||||
    $page_file = "$template_dir/404.html";
 | 
					    $page_file = "$template_dir/404.html";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    foreach($paths_to_check as $page_dir){
 | 
				
			||||||
 | 
					        $page_file_tmp = "$page_dir/$page.html";
 | 
				
			||||||
 | 
					        if(file_exists($page_file_tmp)){
 | 
				
			||||||
 | 
					            $page_file = $page_file_tmp;
 | 
				
			||||||
 | 
					            break;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    ob_start();
 | 
					    ob_start();
 | 
				
			||||||
    include $page_file;
 | 
					    include $page_file;
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user