]> git.mxchange.org Git - friendica.git/blob - view/theme/frio/php/frio_boot.php
Merge pull request #3464 from beardyunixer/nginx
[friendica.git] / view / theme / frio / php / frio_boot.php
1 <?php
2
3 /**
4  * @file view/theme/frio/php/frio_boot.php
5  *
6  * @brief This file contains functions for page construction
7  *
8  */
9
10 use Friendica\App;
11
12 /**
13  * @brief Load page template in dependence of the template mode
14  *
15  * @todo Check if this is really needed.
16  */
17 function load_page(App $a) {
18         if(isset($_GET["mode"]) AND ($_GET["mode"] == "minimal")) {
19                 require "view/theme/frio/minimal.php";
20         } elseif((isset($_GET["mode"]) AND ($_GET["mode"] == "none"))) {
21                 require "view/theme/frio/none.php";
22         } else {
23                 $template = 'view/theme/' . current_theme() . '/'
24                         . ((x($a->page,'template')) ? $a->page['template'] : 'default' ) . '.php';
25                 if(file_exists($template))
26                         require_once($template);
27                 else
28                         require_once(str_replace('theme/' . current_theme() . '/', '', $template));
29         }
30
31
32 }
33
34
35 /**
36  * @brief Check if page is a modal page
37  *
38  * This function checks if $_REQUEST['pagename'] is
39  * a defined in a $modalpages
40  *
41  * @return bool
42  */
43 function is_modal() {
44         $is_modal = false;
45         $modalpages = get_modalpage_list();
46
47         foreach ($modalpages as $r => $value) {
48                 if(strpos($_REQUEST['pagename'],$value) !== false) {
49                         $is_modal = true;
50                 }
51         }
52
53         return $is_modal;
54 }
55
56 /**
57  * @brief Array with modalpages
58  *
59  * The array contains the page names of the pages
60  * which should displayed as modals
61  *
62  * @return array Pagenames as path
63  */
64 function get_modalpage_list() {
65         //Arry of pages wich getting bootstrap modal dialogs
66         $modalpages = array('poke/',
67                         'message/new',
68                         'settings/oauth/add',
69                         'events/new',
70 //                      'fbrowser/image/'
71         );
72
73         return $modalpages;
74 }
75
76 /**
77  * @brief Array with standard pages
78  *
79  * The array contains the page names of the pages
80  * which should displayed as standard-page
81  *
82  * @return array Pagenames as path
83  */
84 function get_standard_page_list() {
85         //Arry of pages wich getting the standard page template
86         $standardpages = array(//'profile',
87 //                      'fbrowser/image/'
88         );
89
90         return $standardpages;
91 }
92
93 /**
94  * @brief Check if page is standard page
95  *
96  * This function checks if $_REQUEST['pagename'] is
97  * a defined $standardpages
98  *
99  * @param string $pagetitle Title of the actual page
100  * @return bool
101  */
102 function is_standard_page($pagetitle) {
103         $is_standard_page = false;
104         $standardpages = get_standard_page_list();
105
106         foreach ($standardpages as $r => $value) {
107                 if(strpos($pagetitle,$value) !== false) {
108                         $is_standard_page = true;
109                 }
110         }
111
112         return $is_standard_page;
113 }
114 /**
115  * @brief Get the typ of the page
116  *
117  * @param type $pagetitle
118  * @return string
119  */
120 function get_page_type($pagetitle) {
121         $page_type = "";
122
123         if(is_modal())
124                 $page_type = "modal";
125
126         if(is_standard_page($pagetitle))
127                 $page_type = "standard_page";
128
129         if($page_type)
130                 return $page_type;
131
132 }