import the toggle_mobile stuff to shut up some warnings

This commit is contained in:
friendica 2013-01-03 15:52:05 -08:00
parent 7df33bb963
commit f8bd476b88
6 changed files with 39 additions and 4 deletions

View File

@ -1924,3 +1924,19 @@ function dba_timer() {
return microtime(true);
}
/**
* 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;
}

View File

@ -389,10 +389,10 @@ if(count($arr)) {
if($a->is_mobile || $a->is_tablet) {
if(isset($_SESSION['show-mobile']) && !$_SESSION['show-mobile']) {
$link = $a->get_baseurl() . '/toggle_mobile?address=' . curPageURL();
$link = $a->get_baseurl() . '/toggle_mobile?f=&address=' . curPageURL();
}
else {
$link = $a->get_baseurl() . '/toggle_mobile?off=1&address=' . curPageURL();
$link = $a->get_baseurl() . '/toggle_mobile?f=&off=1&address=' . curPageURL();
}
$a->page['footer'] .= replace_macros(get_markup_template("toggle_mobile_footer.tpl"), array(
'$toggle_link' => $link,

View File

@ -29,7 +29,7 @@ function profile_aside(&$a) {
}
$x = q("select uid as profile_uid from channel where address = '%s' limit 1",
$x = q("select channel_id as profile_uid from channel where channel_address = '%s' limit 1",
dbesc(argv(1))
);
if($x) {

17
mod/toggle_mobile.php Normal file
View 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);
}

View File

@ -1 +1 @@
2013-01-02.188
2013-01-03.189

View File

@ -0,0 +1,2 @@
<a id="toggle_mobile_link" href="$toggle_link">$toggle_text</a>