diff options
-rw-r--r-- | boot.php | 16 | ||||
-rw-r--r-- | index.php | 4 | ||||
-rw-r--r-- | mod/profile.php | 2 | ||||
-rw-r--r-- | mod/toggle_mobile.php | 17 | ||||
-rw-r--r-- | version.inc | 2 | ||||
-rw-r--r-- | view/tpl/toggle_mobile_footer.tpl | 2 |
6 files changed, 39 insertions, 4 deletions
@@ -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; +} @@ -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, diff --git a/mod/profile.php b/mod/profile.php index 1865d69fc..549536931 100644 --- a/mod/profile.php +++ b/mod/profile.php @@ -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) { diff --git a/mod/toggle_mobile.php b/mod/toggle_mobile.php new file mode 100644 index 000000000..00991e44c --- /dev/null +++ b/mod/toggle_mobile.php @@ -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); +} + diff --git a/version.inc b/version.inc index f3645eb72..46bcb3bea 100644 --- a/version.inc +++ b/version.inc @@ -1 +1 @@ -2013-01-02.188 +2013-01-03.189 diff --git a/view/tpl/toggle_mobile_footer.tpl b/view/tpl/toggle_mobile_footer.tpl new file mode 100644 index 000000000..58695f4df --- /dev/null +++ b/view/tpl/toggle_mobile_footer.tpl @@ -0,0 +1,2 @@ +<a id="toggle_mobile_link" href="$toggle_link">$toggle_text</a> + |