]> git.mxchange.org Git - friendica.git/blob - view/theme/frio/php/default.php
Merge pull request #8271 from MrPetovan/bug/8229-frio-mobile-back-to-top
[friendica.git] / view / theme / frio / php / default.php
1 <?php
2 /**
3  * @copyright Copyright (C) 2020, Friendica
4  *
5  * @license GNU AGPL version 3 or any later version
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU Affero General Public License as
9  * published by the Free Software Foundation, either version 3 of the
10  * License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU Affero General Public License for more details.
16  *
17  * You should have received a copy of the GNU Affero General Public License
18  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
19  *
20  * The default site template
21  */
22
23 ?>
24 <!DOCTYPE html >
25 <?php
26
27 use Friendica\DI;
28 use Friendica\Model\Profile;
29
30 require_once 'view/theme/frio/php/frio_boot.php';
31
32 //      $minimal = is_modal();
33 if (!isset($minimal)) {
34         $minimal = false;
35 }
36
37 $basepath = DI::baseUrl()->getUrlPath() ? "/" . DI::baseUrl()->getUrlPath() . "/" : "/";
38 $frio = "view/theme/frio";
39 $view_mode_class = (DI::mode()->isMobile() || DI::mode()->isMobile()) ? 'mobile-view' : 'desktop-view';
40 $is_singleuser = DI::config()->get('system', 'singleuser');
41 $is_singleuser_class = $is_singleuser ? "is-singleuser" : "is-not-singleuser";
42 ?>
43 <html>
44         <head>
45                 <title><?php if (!empty($page['title'])) echo $page['title'] ?></title>
46                 <meta request="<?php echo htmlspecialchars($_REQUEST['pagename'] ?? '') ?>">
47                 <script  type="text/javascript">var baseurl = "<?php echo DI::baseUrl(); ?>";</script>
48                 <script type="text/javascript">var frio = "<?php echo 'view/theme/frio'; ?>";</script>
49 <?php
50                 // Because we use minimal for modals the header and the included js stuff should be only loaded
51                 // if the page is an standard page (so we don't have it twice for modals)
52                 //
53                 /// @todo Think about to move js stuff in the footer
54                 if (!$minimal && !empty($page['htmlhead'])) {
55                         echo $page['htmlhead'];
56                 }
57
58                 // Add the theme color meta
59                 // It makes mobile Chrome UI match Frio's top bar color.
60                 $uid = Profile::getThemeUid($a);
61                 $scheme = DI::pConfig()->get($uid, 'frio', 'scheme', DI::pConfig()->get($uid, 'frio', 'schema'));
62                 if ($scheme && is_string($scheme) && $scheme != '---') {
63                         if (file_exists('view/theme/frio/scheme/' . $scheme . '.php')) {
64                                 $schemefile = 'view/theme/frio/scheme/' . $scheme . '.php';
65                                 require_once $schemefile;
66                         }
67                 } else {
68                         $nav_bg = DI::pConfig()->get($uid, 'frio', 'nav_bg');
69                 }
70
71                 if (empty($nav_bg)) {
72                         $nav_bg = DI::config()->get('frio', 'nav_bg');
73                 }
74
75                 if (empty($nav_bg) || !is_string($nav_bg)) {
76                         $nav_bg = "#708fa0";
77                 }
78
79                 echo '<meta name="theme-color" content="' . $nav_bg . '" />';
80 ?>
81         </head>
82
83         <body id="top" class="mod-<?php echo DI::module()->getName() . " " . $is_singleuser_class . " " . $view_mode_class;?>">
84                 <a href="#content" class="sr-only sr-only-focusable"><?php echo DI::l10n()->t('Skip to main content'); ?></a>
85 <?php
86         if (!empty($page['nav']) && !$minimal) {
87                 echo str_replace(
88                         "~config.sitename~",
89                         DI::config()->get('config', 'sitename'),
90                         str_replace(
91                                 "~system.banner~",
92                                 DI::config()->get('system', 'banner'),
93                                 $page['nav']
94                         )
95                 );
96         };
97
98         // special minimal style for modal dialogs
99         if ($minimal) {
100 ?>
101                 <!-- <?php echo __FILE__ ?> -->
102                 <section class="minimal">
103                         <?php if (!empty($page['content'])) echo $page['content']; ?>
104                         <div id="page-footer"></div>
105                 </section>
106 <?php
107         } else {
108                 // the style for all other pages
109 ?>
110                 <main>
111                         <div class="container">
112                                 <div class="row">
113 <?php
114                                 if ((empty($_REQUEST['pagename']) || $_REQUEST['pagename'] != "lostpass") && ($_SERVER['REQUEST_URI'] != $basepath)) {
115                                         echo '
116                                         <aside class="col-lg-3 col-md-3 offcanvas-sm offcanvas-xs">';
117
118                                                 if (!empty($page['aside'])) {
119                                                         echo $page['aside'];
120                                                 }
121
122                                                 if (!empty($page['right_aside'])) {
123                                                         echo $page['right_aside'];
124                                                 }
125
126                                                 echo '
127                                         </aside>
128
129                                         <div class="col-lg-7 col-md-7 col-sm-12 col-xs-12" id="content">
130                                                 <section class="sectiontop ';
131                                                         echo $a->argv[0];
132                                                         echo '-content-wrapper">';
133                                                         if (!empty($page['content'])) {
134                                                                 echo $page['content'];
135                                                         }
136                                                         echo '
137                                                         <div id="pause"></div> <!-- The pause/resume Ajax indicator -->
138                                                 </section>
139                                         </div>
140                                                 ';
141                                 } else {
142                                         echo '
143                                         <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12" id="content" style="margin-top:50px;">';
144                                                 if (!empty($page['content'])) {
145                                                         echo $page['content'];
146                                                 }
147                                                 echo '
148                                         </div>
149                                         ';
150                                 }
151 ?>
152                                 </div><!--row-->
153                         </div><!-- container -->
154
155                         <div id="back-to-top" title="back to top">&#8679;</div>
156                 </main>
157
158                 <footer>
159                         <?php echo $page['footer'] ?? ''; ?>
160                 </footer>
161 <?php } ?> <!-- End of condition if $minimal else the rest -->
162         </body>