diff options
Diffstat (limited to 'mod')
-rw-r--r-- | mod/channel.php | 11 | ||||
-rw-r--r-- | mod/display.php | 16 | ||||
-rw-r--r-- | mod/network.php | 2 | ||||
-rw-r--r-- | mod/nojs.php | 10 |
4 files changed, 27 insertions, 12 deletions
diff --git a/mod/channel.php b/mod/channel.php index 2ef911bbb..9bc7332dc 100644 --- a/mod/channel.php +++ b/mod/channel.php @@ -54,6 +54,7 @@ function channel_content(&$a, $update = 0, $load = false) { if($load) $_SESSION['loadtime'] = datetime_convert(); + $checkjs = new Zotlabs\Web\CheckJS(); $category = $datequery = $datequery2 = ''; @@ -209,7 +210,7 @@ function channel_content(&$a, $update = 0, $load = false) { App::set_pager_itemspage(((intval($itemspage)) ? $itemspage : 20)); $pager_sql = sprintf(" LIMIT %d OFFSET %d ", intval(App::$pager['itemspage']), intval(App::$pager['start'])); - if($load || ($_COOKIE['jsAvailable'] != 1)) { + if($load || ($checkjs->disabled())) { if ($mid) { $r = q("SELECT parent AS item_id from item where mid = '%s' and uid = %d $item_normal AND item_wall = 1 $sql_extra limit 1", @@ -338,13 +339,13 @@ function channel_content(&$a, $update = 0, $load = false) { } - if($_COOKIE['jsAvailable'] == 1) { - $o .= conversation($a,$items,'channel',$update,$page_mode); - } else { + if($checkjs->disabled()) { $o .= conversation($a,$items,'channel',$update,'traditional'); + } else { + $o .= conversation($a,$items,'channel',$update,$page_mode); } - if((! $update) || ($_COOKIE['jsAvailable'] != 1)) { + if((! $update) || ($checkjs->disabled())) { $o .= alt_pager($a,count($items)); if ($mid && $items[0]['title']) App::$page['title'] = $items[0]['title'] . " - " . App::$page['title']; diff --git a/mod/display.php b/mod/display.php index ef140d454..2844a1205 100644 --- a/mod/display.php +++ b/mod/display.php @@ -5,6 +5,10 @@ function display_content(&$a, $update = 0, $load = false) { // logger("mod-display: update = $update load = $load"); + + $checkjs = new Zotlabs\Web\CheckJS(); + + if($load) $_SESSION['loadtime'] = datetime_convert(); @@ -168,13 +172,13 @@ function display_content(&$a, $update = 0, $load = false) { $sql_extra = public_permissions_sql($observer_hash); - if(($update && $load) || ($_COOKIE['jsAvailable'] != 1)) { + if(($update && $load) || ($checkjs->disabled())) { $updateable = false; $pager_sql = sprintf(" LIMIT %d OFFSET %d ", intval(App::$pager['itemspage']),intval(App::$pager['start'])); - if($load || ($_COOKIE['jsAvailable'] != 1)) { + if($load || ($checkjs->disabled())) { $r = null; require_once('include/identity.php'); @@ -290,13 +294,13 @@ function display_content(&$a, $update = 0, $load = false) { } - if ($_COOKIE['jsAvailable'] == 1) { - $o .= conversation($a, $items, 'display', $update, 'client'); - } else { + if ($checkjs->disabled()) { $o .= conversation($a, $items, 'display', $update, 'traditional'); if ($items[0]['title']) App::$page['title'] = $items[0]['title'] . " - " . App::$page['title']; - + } + else { + $o .= conversation($a, $items, 'display', $update, 'client'); } if($updateable) { diff --git a/mod/network.php b/mod/network.php index 5465cd064..e6d02f572 100644 --- a/mod/network.php +++ b/mod/network.php @@ -13,7 +13,7 @@ function network_init(&$a) { return; } - if((count($_GET) < 2) || (count($_GET) < 3 && $_GET['JS'])) { + if(count($_GET) < 2) { $network_options = get_pconfig(local_channel(),'system','network_page_default'); if($network_options) goaway('network' . '?f=&' . $network_options); diff --git a/mod/nojs.php b/mod/nojs.php new file mode 100644 index 000000000..c6e04a72b --- /dev/null +++ b/mod/nojs.php @@ -0,0 +1,10 @@ +<?php + +function nojs_init(&$a) { + + setcookie('jsdisabled', 1, 0); + $p = $_GET['query']; + $hasq = strpos($p,'?'); + goaway(z_root() . (($p) ? '/' . $p : '') . (($hasq) ? '' : '?f=' ) . '&jsdisabled=1'); + +}
\ No newline at end of file |