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