aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Web/CheckJS.php
blob: 3ad5fc1ed79abe8eb536a5e7866e8e77fdc06340 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php

namespace Zotlabs\Web;


class CheckJS {

	private static $jsdisabled = 0;

	function __construct($test = 0) {
		if(intval($_REQUEST['jsdisabled']))
			$this->jsdisabled = 1;
		if(intval($_COOKIE['jsdisabled']))
			$this->jsdisabled = 1;

		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";
			}
			else {
				\App::$page['htmlhead'] .= "\r\n" . '<noscript><meta http-equiv="refresh" content="0; url=' . z_root() . '/nojs?f=&redir=' . $page . '"></noscript>' . "\r\n";
			}
		}

	}

	function disabled() {
		return self::$jsdisabled;
	}


}