Erbureth

yatee demo -- PHP part

May 17th, 2012
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.37 KB | None | 0 0
  1. <?php
  2. declare(encoding='UTF-8');
  3.  
  4. $title = "Administrace";
  5. $ecode = 200;
  6.  
  7. session_start();
  8.  
  9.  
  10. include_once("modules/user.inc");
  11. $currentUser = new user($db);
  12.  
  13. require_once("libs/yatee/yatee.php");
  14. $yatee = new yatee\main();
  15.  
  16.  
  17.  
  18. if( $currentUser->WebLogged() || $currentUser->CustomerLogged() || $currentUser->AdminLogged() ) {
  19.     $mainpage = $yatee->AddSection("main", array(), "templates/admin.tpl");
  20.     $mainpage->AddVariable("web_logged", $currentUser->WebLogged());
  21.     $mainpage->AddVariable("customer_logged", $currentUser->CustomerLogged());
  22.     $mainpage->AddVariable("admin_logged", $currentUser->AdminLogged());
  23.     $mainpage->AddVariable("customer_logout", "?action=customerlogout");
  24.     $mainpage->AddVariable("web_logout", "?action=weblogout");
  25.     $mainpage->AddVariable("logout_url", "?action=logout");
  26.     $mainpage->AddVariable("title", $title);
  27.  
  28.     if ($currentUser->AdminLogged()){
  29.         $mainpage->AddVariable("admin_name", $currentUser->GetAdminName());
  30.         $menutype = "admin";
  31.     }
  32.     if ($currentUser->CustomerLogged()){
  33.         $mainpage->AddVariable("customer_name", $currentUser->GetCustomerName());
  34.         $menutype = "customer";
  35.     }
  36.     if ($currentUser->WebLogged()) {
  37.         $mainpage->AddVariable("web_name", $currentUser->GetWebName());
  38.         $menutype = "web";
  39.     }
  40.  
  41.     $menu = new menu(1, array($menutype), "menuitem", $yatee, true);
  42.     $mainpage->AddVariable("menutype", $menutype);
  43.     $mainpage->AddVariable("menutitle", $menu->GetPartialTitle(2, 3));
  44.     if (is_file($menu->GetFolderName()."index.inc")) {
  45.         include($menu->GetFolderName()."index.inc");
  46.         $main = new main($yatee, $currentUser, $db, $menu->GetURL());
  47.         //$main->Render($panel->GetPart(2), $currentUser, $db, $menu->GetURL());
  48.     }
  49.     else {
  50.         $content = $yatee->AddSection("content", array(), "templates/404.tpl");
  51.         $content->AddVariable("file", $menu->GetFolderName()."index.inc");
  52.     }
  53. }
  54. else {
  55.     $page = $yatee->AddSection("main", array(), "templates/login.tpl");
  56.     $page->AddVariable("title", $title);
  57.     $page->AddVariable("login_url", "?action=login");
  58. }
  59.  
  60. $response = new response();
  61. $response->AddHeader(200, "Strict-Transport-Security: max-age=".(31*86400));
  62. $page = $response->GetPage(200);
  63. $page->SetNaked(true);
  64. $cnt = $page->GetContent();
  65. $cnt->Replace($yatee->render());
  66. $response->Render();
Advertisement
Add Comment
Please, Sign In to add comment