99 lines
		
	
	
		
			2.2 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			99 lines
		
	
	
		
			2.2 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
<?php
 | 
						|
// Main page
 | 
						|
 | 
						|
 | 
						|
 | 
						|
$IS_FRONTEND = true;
 | 
						|
 | 
						|
// Includes
 | 
						|
require_once("api/_auth.php");
 | 
						|
require_once("api/user/index.php");
 | 
						|
require_once("front/notifications.php");
 | 
						|
 | 
						|
 | 
						|
 | 
						|
$PAGE_TITLE = null; // String that will be showed as "E949: $PAGE_TITLE"
 | 
						|
$PAGE_STYLE = null; // Path to file with style that will be included
 | 
						|
$PAGE_FILE  = null; // Path to main body file that will be included
 | 
						|
 | 
						|
 | 
						|
 | 
						|
$PICKED_PAGE = null;
 | 
						|
if (isset($_GET["do"]))
 | 
						|
	$PICKED_PAGE = $_GET["do"];
 | 
						|
else
 | 
						|
	$PICKED_PAGE = "";
 | 
						|
 | 
						|
// Picking current page
 | 
						|
switch ($PICKED_PAGE) {
 | 
						|
	// Direct-link pages
 | 
						|
	// Post viewing page
 | 
						|
	case "view_post":
 | 
						|
		$PAGE_TITLE = "Post #" . $_GET["id"]; // NOTICE: not good
 | 
						|
		$PAGE_STYLE = "front/styles/main.css";
 | 
						|
		$PAGE_FILE  = "front/pages/view_post/page.php";
 | 
						|
		break;
 | 
						|
	// Available-on-login pages
 | 
						|
	// Post creation page
 | 
						|
	case "new_post":
 | 
						|
		$PAGE_TITLE = "Create new post";
 | 
						|
		$PAGE_STYLE = "front/styles/main.css";
 | 
						|
		$PAGE_FILE  = "front/pages/new_post/page.php";
 | 
						|
		break;
 | 
						|
	// Navigable pages
 | 
						|
	// Common instance statistics
 | 
						|
	case "view_stats":
 | 
						|
		$PAGE_TITLE = "Instance statistics";
 | 
						|
		$PAGE_STYLE = "front/styles/main.css";
 | 
						|
		$PAGE_FILE  = "front/pages/stats/page.php";
 | 
						|
		break;
 | 
						|
	// Approved tags viewer
 | 
						|
	case "view_tags":
 | 
						|
		$PAGE_TITLE = "Approved tags list";
 | 
						|
		$PAGE_STYLE = "front/styles/main.css";
 | 
						|
		$PAGE_FILE  = "front/pages/tags_viewer/page.php";
 | 
						|
		break;
 | 
						|
	// Posts viewer
 | 
						|
	case "search_posts":
 | 
						|
		$PAGE_TITLE = "Search posts";
 | 
						|
		$PAGE_STYLE = "front/styles/main.css";
 | 
						|
		$PAGE_FILE  = "front/pages/search_posts/page.php";
 | 
						|
		break;
 | 
						|
	// Registration page
 | 
						|
	case "register":
 | 
						|
		$PAGE_TITLE = "Register";
 | 
						|
		$PAGE_STYLE = "front/styles/main.css";
 | 
						|
		$PAGE_FILE  = "front/pages/register/page.php";
 | 
						|
		break;
 | 
						|
	// Login page
 | 
						|
	case "login":
 | 
						|
		$PAGE_TITLE = "Login";
 | 
						|
		$PAGE_STYLE = "front/styles/main.css";
 | 
						|
		$PAGE_FILE  = "front/pages/login/page.php";
 | 
						|
		break;
 | 
						|
	// Main page
 | 
						|
	case "index":
 | 
						|
	case "main":
 | 
						|
	default:
 | 
						|
		$PAGE_TITLE = "Index";
 | 
						|
		$PAGE_STYLE = "front/styles/index.css";
 | 
						|
		$PAGE_FILE  = "front/pages/index/page.php";
 | 
						|
}
 | 
						|
 | 
						|
 | 
						|
 | 
						|
?>
 | 
						|
<!DOCTYPE html>
 | 
						|
<html lang="en">
 | 
						|
<head>
 | 
						|
	<?php require_once("front/head.php"); ?>
 | 
						|
</head>
 | 
						|
<body>
 | 
						|
	<div class="wrapper">
 | 
						|
		<?php
 | 
						|
			require_once($PAGE_FILE);
 | 
						|
			require_once("front/footer.php");
 | 
						|
		?>
 | 
						|
	</div>
 | 
						|
</body>
 | 
						|
</html>
 |