@@ -63,59 +63,59 @@ discard block |
||
63 | 63 | $rs = null; |
64 | 64 | |
65 | 65 | // Check parameter ranges |
66 | - if($symsize < 0 || $symsize > 8) { |
|
66 | + if ($symsize < 0 || $symsize > 8) { |
|
67 | 67 | return $rs; |
68 | 68 | } |
69 | - if($fcr < 0 || $fcr >= (1<<$symsize)) { |
|
69 | + if ($fcr < 0 || $fcr >= (1 << $symsize)) { |
|
70 | 70 | return $rs; |
71 | 71 | } |
72 | - if($prim <= 0 || $prim >= (1<<$symsize)) { |
|
72 | + if ($prim <= 0 || $prim >= (1 << $symsize)) { |
|
73 | 73 | return $rs; |
74 | 74 | } |
75 | - if($nroots < 0 || $nroots >= (1<<$symsize)) { |
|
75 | + if ($nroots < 0 || $nroots >= (1 << $symsize)) { |
|
76 | 76 | return $rs; |
77 | 77 | } |
78 | 78 | // Can't have more roots than symbol values! |
79 | - if($pad < 0 || $pad >= ((1<<$symsize) -1 - $nroots)) { |
|
79 | + if ($pad < 0 || $pad >= ((1 << $symsize) - 1 - $nroots)) { |
|
80 | 80 | return $rs; |
81 | 81 | } |
82 | 82 | // Too much padding |
83 | 83 | |
84 | 84 | $rs = new QRrsItem(); |
85 | 85 | $rs->mm = $symsize; |
86 | - $rs->nn = (1<<$symsize)-1; |
|
86 | + $rs->nn = (1 << $symsize) - 1; |
|
87 | 87 | $rs->pad = $pad; |
88 | 88 | |
89 | - $rs->alpha_to = array_fill(0, $rs->nn+1, 0); |
|
90 | - $rs->index_of = array_fill(0, $rs->nn+1, 0); |
|
89 | + $rs->alpha_to = array_fill(0, $rs->nn + 1, 0); |
|
90 | + $rs->index_of = array_fill(0, $rs->nn + 1, 0); |
|
91 | 91 | |
92 | 92 | // PHP style macro replacement ;) |
93 | - $NN =& $rs->nn; |
|
94 | - $A0 =& $NN; |
|
93 | + $NN = & $rs->nn; |
|
94 | + $A0 = & $NN; |
|
95 | 95 | |
96 | 96 | // Generate Galois field lookup tables |
97 | 97 | $rs->index_of[0] = $A0; // log(zero) = -inf |
98 | 98 | $rs->alpha_to[$A0] = 0; // alpha**-inf = 0 |
99 | 99 | $sr = 1; |
100 | 100 | |
101 | - for($i=0; $i<$rs->nn; $i++) { |
|
101 | + for ($i = 0; $i < $rs->nn; $i++) { |
|
102 | 102 | $rs->index_of[$sr] = $i; |
103 | 103 | $rs->alpha_to[$i] = $sr; |
104 | 104 | $sr <<= 1; |
105 | - if($sr & (1<<$symsize)) { |
|
105 | + if ($sr & (1 << $symsize)) { |
|
106 | 106 | $sr ^= $gfpoly; |
107 | 107 | } |
108 | 108 | $sr &= $rs->nn; |
109 | 109 | } |
110 | 110 | |
111 | - if($sr != 1){ |
|
111 | + if ($sr != 1) { |
|
112 | 112 | // field generator polynomial is not primitive! |
113 | 113 | $rs = null; |
114 | 114 | return $rs; |
115 | 115 | } |
116 | 116 | |
117 | 117 | /* Form RS code generator polynomial from its roots */ |
118 | - $rs->genpoly = array_fill(0, $nroots+1, 0); |
|
118 | + $rs->genpoly = array_fill(0, $nroots + 1, 0); |
|
119 | 119 | |
120 | 120 | $rs->fcr = $fcr; |
121 | 121 | $rs->prim = $prim; |
@@ -204,23 +204,23 @@ discard block |
||
204 | 204 | //---------------------------------------------------------------------- |
205 | 205 | public static function init_rs($symsize, $gfpoly, $fcr, $prim, $nroots, $pad) |
206 | 206 | { |
207 | - foreach(self::$items as $rs) { |
|
208 | - if($rs->pad != $pad) { |
|
207 | + foreach (self::$items as $rs) { |
|
208 | + if ($rs->pad != $pad) { |
|
209 | 209 | continue; |
210 | 210 | } |
211 | - if($rs->nroots != $nroots) { |
|
211 | + if ($rs->nroots != $nroots) { |
|
212 | 212 | continue; |
213 | 213 | } |
214 | - if($rs->mm != $symsize) { |
|
214 | + if ($rs->mm != $symsize) { |
|
215 | 215 | continue; |
216 | 216 | } |
217 | - if($rs->gfpoly != $gfpoly) { |
|
217 | + if ($rs->gfpoly != $gfpoly) { |
|
218 | 218 | continue; |
219 | 219 | } |
220 | - if($rs->fcr != $fcr) { |
|
220 | + if ($rs->fcr != $fcr) { |
|
221 | 221 | continue; |
222 | 222 | } |
223 | - if($rs->prim != $prim) { |
|
223 | + if ($rs->prim != $prim) { |
|
224 | 224 | continue; |
225 | 225 | } |
226 | 226 |
@@ -1,31 +1,31 @@ discard block |
||
1 | 1 | <?php |
2 | - if (file_exists("install") && !file_exists("config.php")) { |
|
3 | - header("Location: install/"); |
|
4 | - } |
|
2 | + if (file_exists("install") && !file_exists("config.php")) { |
|
3 | + header("Location: install/"); |
|
4 | + } |
|
5 | 5 | |
6 | - set_include_path(dirname(__FILE__)."/include".PATH_SEPARATOR. |
|
7 | - get_include_path()); |
|
6 | + set_include_path(dirname(__FILE__)."/include".PATH_SEPARATOR. |
|
7 | + get_include_path()); |
|
8 | 8 | |
9 | - if (!file_exists("config.php")) { |
|
10 | - print "<b>Fatal Error</b>: You forgot to copy |
|
9 | + if (!file_exists("config.php")) { |
|
10 | + print "<b>Fatal Error</b>: You forgot to copy |
|
11 | 11 | <b>config.php-dist</b> to <b>config.php</b> and edit it.\n"; |
12 | - exit; |
|
13 | - } |
|
12 | + exit; |
|
13 | + } |
|
14 | 14 | |
15 | - require_once "autoload.php"; |
|
16 | - require_once "sessions.php"; |
|
17 | - require_once "functions.php"; |
|
18 | - require_once "sanity_check.php"; |
|
19 | - require_once "config.php"; |
|
20 | - require_once "db-prefs.php"; |
|
15 | + require_once "autoload.php"; |
|
16 | + require_once "sessions.php"; |
|
17 | + require_once "functions.php"; |
|
18 | + require_once "sanity_check.php"; |
|
19 | + require_once "config.php"; |
|
20 | + require_once "db-prefs.php"; |
|
21 | 21 | |
22 | - if (!init_plugins()) { |
|
23 | - return; |
|
24 | - } |
|
22 | + if (!init_plugins()) { |
|
23 | + return; |
|
24 | + } |
|
25 | 25 | |
26 | - login_sequence(); |
|
26 | + login_sequence(); |
|
27 | 27 | |
28 | - header('Content-Type: text/html; charset=utf-8'); |
|
28 | + header('Content-Type: text/html; charset=utf-8'); |
|
29 | 29 | ?> |
30 | 30 | <!DOCTYPE html> |
31 | 31 | <html> |
@@ -34,12 +34,12 @@ discard block |
||
34 | 34 | <meta name="viewport" content="initial-scale=1,width=device-width" /> |
35 | 35 | |
36 | 36 | <?php if ($_SESSION["uid"]) { |
37 | - $theme = get_pref("USER_CSS_THEME", false, false); |
|
38 | - if ($theme && theme_exists("$theme")) { |
|
39 | - echo stylesheet_tag(get_theme_path($theme), 'theme_css'); |
|
40 | - } |
|
41 | - } |
|
42 | - ?> |
|
37 | + $theme = get_pref("USER_CSS_THEME", false, false); |
|
38 | + if ($theme && theme_exists("$theme")) { |
|
39 | + echo stylesheet_tag(get_theme_path($theme), 'theme_css'); |
|
40 | + } |
|
41 | + } |
|
42 | + ?> |
|
43 | 43 | |
44 | 44 | <?php print_user_stylesheet() ?> |
45 | 45 | |
@@ -58,17 +58,17 @@ discard block |
||
58 | 58 | </script> |
59 | 59 | |
60 | 60 | <?php |
61 | - foreach (array("lib/prototype.js", |
|
62 | - "lib/scriptaculous/scriptaculous.js?load=effects,controls", |
|
63 | - "lib/dojo/dojo.js", |
|
64 | - "lib/dojo/tt-rss-layer.js", |
|
65 | - "js/common.js", |
|
66 | - "js/prefs.js", |
|
67 | - "errors.php?mode=js") as $jsfile) { |
|
61 | + foreach (array("lib/prototype.js", |
|
62 | + "lib/scriptaculous/scriptaculous.js?load=effects,controls", |
|
63 | + "lib/dojo/dojo.js", |
|
64 | + "lib/dojo/tt-rss-layer.js", |
|
65 | + "js/common.js", |
|
66 | + "js/prefs.js", |
|
67 | + "errors.php?mode=js") as $jsfile) { |
|
68 | 68 | |
69 | - echo javascript_tag($jsfile); |
|
69 | + echo javascript_tag($jsfile); |
|
70 | 70 | |
71 | - } ?> |
|
71 | + } ?> |
|
72 | 72 | |
73 | 73 | <script type="text/javascript"> |
74 | 74 | require({cache:{}}); |
@@ -76,22 +76,22 @@ discard block |
||
76 | 76 | |
77 | 77 | <script type="text/javascript"> |
78 | 78 | <?php |
79 | - foreach (PluginHost::getInstance()->get_plugins() as $n => $p) { |
|
80 | - if (method_exists($p, "get_prefs_js")) { |
|
81 | - $script = $p->get_prefs_js(); |
|
79 | + foreach (PluginHost::getInstance()->get_plugins() as $n => $p) { |
|
80 | + if (method_exists($p, "get_prefs_js")) { |
|
81 | + $script = $p->get_prefs_js(); |
|
82 | 82 | |
83 | - if ($script) { |
|
84 | - echo "try { |
|
83 | + if ($script) { |
|
84 | + echo "try { |
|
85 | 85 | $script |
86 | 86 | } catch (e) { |
87 | 87 | console.warn('failed to initialize plugin JS: $n', e); |
88 | 88 | }"; |
89 | - } |
|
90 | - } |
|
91 | - } |
|
89 | + } |
|
90 | + } |
|
91 | + } |
|
92 | 92 | |
93 | - init_js_translations(); |
|
94 | - ?> |
|
93 | + init_js_translations(); |
|
94 | + ?> |
|
95 | 95 | </script> |
96 | 96 | |
97 | 97 | <style type="text/css"> |
@@ -14,4 +14,4 @@ |
||
14 | 14 | define('QR_DEFAULT_MASK', 2); // when QR_FIND_BEST_MASK === false |
15 | 15 | |
16 | 16 | define('QR_PNG_MAXIMUM_SIZE', 1024); // maximum allowed png image width (in pixels), tune to make sure GD and PHP can handle such big images |
17 | - |
|
18 | 17 | \ No newline at end of file |
18 | + |
|
19 | 19 | \ No newline at end of file |