diff options
author | redmatrix <git@macgirvin.com> | 2016-04-20 22:10:00 -0700 |
---|---|---|
committer | redmatrix <git@macgirvin.com> | 2016-04-20 22:10:00 -0700 |
commit | 2b0a04ea9e91196e2966844be0f6b673bd87f032 (patch) | |
tree | 990e011709cbe2dc18cf3c3c756e50e6e15b5c43 /Zotlabs/Web/CheckJS.php | |
parent | f00a701ad104737fd3a25eabec88ec47b9ce8a32 (diff) | |
download | volse-hubzilla-2b0a04ea9e91196e2966844be0f6b673bd87f032.tar.gz volse-hubzilla-2b0a04ea9e91196e2966844be0f6b673bd87f032.tar.bz2 volse-hubzilla-2b0a04ea9e91196e2966844be0f6b673bd87f032.zip |
revert the reversal of checkjs logic, but still restrict the behaviour scope to just those urls that require it
Diffstat (limited to 'Zotlabs/Web/CheckJS.php')
-rw-r--r-- | Zotlabs/Web/CheckJS.php | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/Zotlabs/Web/CheckJS.php b/Zotlabs/Web/CheckJS.php index 3ad5fc1ed..50af34a40 100644 --- a/Zotlabs/Web/CheckJS.php +++ b/Zotlabs/Web/CheckJS.php @@ -10,14 +10,27 @@ class CheckJS { function __construct($test = 0) { if(intval($_REQUEST['jsdisabled'])) $this->jsdisabled = 1; + else + $this->jsdisabled = 0; if(intval($_COOKIE['jsdisabled'])) $this->jsdisabled = 1; + else + $this->jsdisabled = 0; if(! $this->jsdisabled) { $page = urlencode(\App::$query_string); if($test) { - \App::$page['htmlhead'] .= "\r\n" . '<meta http-equiv="refresh" content="0; url=' . z_root() . '/nojs?f=&redir=' . $page . '">' . "\r\n"; + + logger('page=' . $page); + + if($_COOKIE['jsdisabled'] == 0) { + \App::$page['htmlhead'] .= "\r\n" . '<script>document.cookie="jsdisabled=0; path=/"; var jsMatch = /\&jsdisabled=0/; if (!jsMatch.exec(location.href)) { location.href = "' . z_root() . '/nojs/0?f=&redir=' . $page . '" ; }</script>' . "\r\n"; + /* emulate JS cookie if cookies are not accepted */ + if ($_GET['jsdisabled'] == 0) { + $_COOKIE['jsdisabled'] = 0; + } + } } else { \App::$page['htmlhead'] .= "\r\n" . '<noscript><meta http-equiv="refresh" content="0; url=' . z_root() . '/nojs?f=&redir=' . $page . '"></noscript>' . "\r\n"; |