]> git.mxchange.org Git - friendica.git/blob - view/theme/frio/php/default.php
[frio] Add a <section> tag to the home page default template
[friendica.git] / view / theme / frio / php / default.php
1 <?php
2 /**
3  * @copyright Copyright (C) 2010-2023, the Friendica project
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/theme.php';
31 require_once 'view/theme/frio/php/frio_boot.php';
32
33 //      $minimal = is_modal();
34 if (!isset($minimal)) {
35         $minimal = false;
36 }
37
38 $basepath = DI::baseUrl()->getPath() ? "/" . DI::baseUrl()->getPath() . "/" : "/";
39 $frio = "view/theme/frio";
40 $view_mode_class = (DI::mode()->isMobile() || DI::mode()->isMobile()) ? 'mobile-view' : 'desktop-view';
41 $is_singleuser = DI::config()->get('system', 'singleuser');
42 $is_singleuser_class = $is_singleuser ? "is-singleuser" : "is-not-singleuser";
43 ?>
44 <html>
45         <head>
46                 <title><?php if (!empty($page['title'])) echo $page['title'] ?></title>
47                 <meta request="<?php echo htmlspecialchars($_REQUEST['pagename'] ?? '') ?>">
48                 <script  type="text/javascript">var baseurl = "<?php echo (string)DI::baseUrl(); ?>";</script>
49                 <script type="text/javascript">var frio = "<?php echo 'view/theme/frio'; ?>";</script>
50 <?php
51                 // Because we use minimal for modals the header and the included js stuff should be only loaded
52                 // if the page is an standard page (so we don't have it twice for modals)
53                 //
54                 /// @todo Think about to move js stuff in the footer
55                 if (!$minimal && !empty($page['htmlhead'])) {
56                         echo $page['htmlhead'];
57                 }
58
59                 // Add the theme color meta
60                 // It makes mobile Chrome UI match Frio's top bar color.
61                 $uid = Profile::getThemeUid($a);
62                 $scheme = DI::pConfig()->get($uid, 'frio', 'scheme', DI::pConfig()->get($uid, 'frio', 'schema'));
63                 if ($scheme && is_string($scheme) && $scheme != '---') {
64                         if (file_exists('view/theme/frio/scheme/' . $scheme . '.php')) {
65                                 $schemefile = 'view/theme/frio/scheme/' . $scheme . '.php';
66                                 $scheme_accent =
67                                         DI::pConfig()->get($uid, 'frio', 'scheme_accent') ?:
68                                                 DI::config()->get('frio', 'scheme_accent') ?: FRIO_SCHEME_ACCENT_BLUE;
69
70                                 require_once $schemefile;
71                         }
72                 }
73
74                 $nav_bg = $nav_bg ?? DI::pConfig()->get($uid, 'frio', 'nav_bg', DI::config()->get('frio', 'nav_bg', '#708fa0'));
75
76                 echo '<meta name="theme-color" content="' . $nav_bg . '" />';
77 ?>
78         </head>
79
80         <body id="top" class="mod-<?php echo $page['module'] . " " . $is_singleuser_class . " " . $view_mode_class;?>">
81                 <a href="#content" class="sr-only sr-only-focusable"><?php echo DI::l10n()->t('Skip to main content'); ?></a>
82 <?php
83         if (!empty($page['nav']) && !$minimal) {
84                 echo str_replace(
85                         "~config.sitename~",
86                         DI::config()->get('config', 'sitename'),
87                         str_replace(
88                                 "~system.banner~",
89                                 DI::config()->get('system', 'banner'),
90                                 $page['nav']
91                         )
92                 );
93         };
94
95         // special minimal style for modal dialogs
96         if ($minimal) {
97 ?>
98                 <!-- <?php echo __FILE__ ?> -->
99                 <section class="minimal">
100                         <?php if (!empty($page['content'])) echo $page['content']; ?>
101                         <div id="page-footer"></div>
102                 </section>
103 <?php
104         } else {
105                 // the style for all other pages
106 ?>
107                 <main>
108                         <div class="container">
109                                 <div class="row">
110 <?php
111                                 if ((empty($_REQUEST['pagename']) || $_REQUEST['pagename'] != "lostpass") && ($_SERVER['REQUEST_URI'] != $basepath)) {
112                                         echo '
113                                         <aside class="col-lg-3 col-md-3 offcanvas-sm offcanvas-xs">';
114
115                                                 if (!empty($page['aside'])) {
116                                                         echo $page['aside'];
117                                                 }
118
119                                                 if (!empty($page['right_aside'])) {
120                                                         echo $page['right_aside'];
121                                                 }
122
123                                                 echo '
124                                         </aside>
125
126                                         <div class="col-lg-7 col-md-7 col-sm-12 col-xs-12" id="content">
127                                                 <section class="sectiontop ';
128                                                         echo $page['section'] ?? '';
129                                                         echo '-content-wrapper">';
130                                                         if (!empty($page['content'])) {
131                                                                 echo $page['content'];
132                                                         }
133                                                         echo '
134                                                         <div id="pause"></div> <!-- The pause/resume Ajax indicator -->
135                                                 </section>
136                                         </div>
137                                                 ';
138                                 } else {
139                                         echo '
140                                         <section class="col-lg-12 col-md-12 col-sm-12 col-xs-12" id="content" style="margin-top:50px;">';
141                                                 if (!empty($page['content'])) {
142                                                         echo $page['content'];
143                                                 }
144                                                 echo '
145                                         </section>
146                                         ';
147                                 }
148 ?>
149                                 </div><!--row-->
150                         </div><!-- container -->
151
152                         <div id="back-to-top" title="<?php echo DI::l10n()->t('Back to top')?>">⇧</div>
153                 </main>
154
155                 <footer>
156                         <?php echo $page['footer'] ?? ''; ?>
157                 </footer>
158 <?php } ?> <!-- End of condition if $minimal else the rest -->
159         </body>