add mobile toggle to frost mobile
This commit is contained in:
parent
3ea5001bb0
commit
e8acdb31bc
23
boot.php
23
boot.php
|
@ -1511,6 +1511,11 @@ if(! function_exists('current_theme')) {
|
|||
$is_mobile = $mobile_detect->isMobile() || $mobile_detect->isTablet();
|
||||
|
||||
if($is_mobile) {
|
||||
if(isset($_SESSION['show-mobile']) && !$_SESSION['show-mobile']) {
|
||||
$system_theme = '';
|
||||
$theme_name = '';
|
||||
}
|
||||
else {
|
||||
$system_theme = ((isset($a->config['system']['mobile-theme'])) ? $a->config['system']['mobile-theme'] : '');
|
||||
$theme_name = ((isset($_SESSION) && x($_SESSION,'mobile-theme')) ? $_SESSION['mobile-theme'] : $system_theme);
|
||||
|
||||
|
@ -1520,6 +1525,7 @@ if(! function_exists('current_theme')) {
|
|||
$theme_name = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!$is_mobile || ($system_theme === '' && $theme_name === '')) {
|
||||
$system_theme = ((isset($a->config['system']['theme'])) ? $a->config['system']['theme'] : '');
|
||||
$theme_name = ((isset($_SESSION) && x($_SESSION,'theme')) ? $_SESSION['theme'] : $system_theme);
|
||||
|
@ -1760,3 +1766,20 @@ function build_querystring($params, $name=null) {
|
|||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the complete URL of the current page, e.g.: http(s)://something.com/network
|
||||
*
|
||||
* Taken from http://webcheatsheet.com/php/get_current_page_url.php
|
||||
*/
|
||||
function curPageURL() {
|
||||
$pageURL = 'http';
|
||||
if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
|
||||
$pageURL .= "://";
|
||||
if ($_SERVER["SERVER_PORT"] != "80" && $_SERVER["SERVER_PORT"] != "443") {
|
||||
$pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
|
||||
} else {
|
||||
$pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
|
||||
}
|
||||
return $pageURL;
|
||||
}
|
||||
|
|
17
mod/toggle_mobile.php
Normal file
17
mod/toggle_mobile.php
Normal file
|
@ -0,0 +1,17 @@
|
|||
<?php
|
||||
|
||||
function toggle_mobile_init(&$a) {
|
||||
|
||||
if(isset($_GET['off']))
|
||||
$_SESSION['show-mobile'] = false;
|
||||
else
|
||||
$_SESSION['show-mobile'] = true;
|
||||
|
||||
if(isset($_GET['address']))
|
||||
$address = $_GET['address'];
|
||||
else
|
||||
$address = $a->get_baseurl();
|
||||
|
||||
goaway($address);
|
||||
}
|
||||
|
|
@ -21,6 +21,9 @@
|
|||
<section><?php if(x($page,'content')) echo $page['content']; ?>
|
||||
</section>
|
||||
</div>
|
||||
<footer>
|
||||
<a href="<?php echo $a->get_baseurl() ?>/toggle_mobile?off=1&address=<?php echo curPageURL() ?>">toggle mobile</a>
|
||||
</footer>
|
||||
|
||||
<?php } else { ?>
|
||||
<div class='main-container'>
|
||||
|
@ -33,7 +36,10 @@
|
|||
</div>
|
||||
<right_aside><?php if(x($page,'right_aside')) echo $page['right_aside']; ?></right_aside>
|
||||
<?php if( ($a->module === 'contacts') && x($page,'aside')) echo $page['aside']; ?>
|
||||
<footer><?php if(x($page,'footer')) echo $page['footer']; ?></footer>
|
||||
<footer>
|
||||
<a href="<?php echo $a->get_baseurl() ?>/toggle_mobile?off=1&address=<?php echo curPageURL() ?>">toggle mobile</a>
|
||||
<?php if(x($page,'footer')) echo $page['footer']; ?>
|
||||
</footer>
|
||||
<!-- </div>-->
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
|
|
@ -152,3 +152,9 @@ div.section-wrapper {
|
|||
#login-submit-wrapper {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
footer {
|
||||
text-align: center;
|
||||
padding-top: 3em;
|
||||
padding-bottom: 1em;
|
||||
}
|
||||
|
|
|
@ -393,8 +393,8 @@ section {
|
|||
|
||||
/* footer */
|
||||
footer {
|
||||
display: none;
|
||||
|
||||
text-align: center;
|
||||
padding-bottom: 1em;
|
||||
}
|
||||
|
||||
.birthday-today, .event-today {
|
||||
|
|
Loading…
Reference in a new issue