@@ -207,7 +207,9 @@ discard block |
||
207 | 207 | */ |
208 | 208 | if (!isset($_GET['type'])) { |
209 | 209 | $sOutput = '{'; |
210 | - if (isset($_GET['sEcho'])) $sOutput .= '"sEcho": '.intval($_GET['sEcho']).', '; |
|
210 | + if (isset($_GET['sEcho'])) { |
|
211 | + $sOutput .= '"sEcho": '.intval($_GET['sEcho']).', '; |
|
212 | + } |
|
211 | 213 | $sOutput .= '"iTotalRecords": '.$iFilteredTotal.', '; |
212 | 214 | $sOutput .= '"iTotalDisplayRecords": '.$iTotal.', '; |
213 | 215 | $sOutput .= '"aaData": [ '; |
@@ -295,10 +297,11 @@ discard block |
||
295 | 297 | $sOutputItem .= '"'.htmlspecialchars(stripslashes($record['tags']), ENT_QUOTES).'", '; |
296 | 298 | |
297 | 299 | // col6 - URL |
298 | - if ($record['url'] != "0") |
|
299 | - $sOutputItem .= '"'.htmlspecialchars(stripslashes($record['url']), ENT_QUOTES).'", '; |
|
300 | - else |
|
301 | - $sOutputItem .= '"", '; |
|
300 | + if ($record['url'] != "0") { |
|
301 | + $sOutputItem .= '"'.htmlspecialchars(stripslashes($record['url']), ENT_QUOTES).'", '; |
|
302 | + } else { |
|
303 | + $sOutputItem .= '"", '; |
|
304 | + } |
|
302 | 305 | |
303 | 306 | //col7 - Prepare the Treegrid |
304 | 307 | $sOutputItem .= '"'.htmlspecialchars(stripslashes($record['folder']), ENT_QUOTES).'"'; |
@@ -164,8 +164,11 @@ |
||
164 | 164 | } |
165 | 165 | |
166 | 166 | // prepare json return for current node |
167 | - if ($node->parent_id == 0) $parent = "#"; |
|
168 | - else $parent = "li_".$node->parent_id; |
|
167 | + if ($node->parent_id == 0) { |
|
168 | + $parent = "#"; |
|
169 | + } else { |
|
170 | + $parent = "li_".$node->parent_id; |
|
171 | + } |
|
169 | 172 | |
170 | 173 | // special case for READ-ONLY folder |
171 | 174 | if ($_SESSION['user_read_only'] === true && !in_array($node->id, $_SESSION['personal_folders'])) { |
@@ -1330,12 +1330,24 @@ discard block |
||
1330 | 1330 | $pwgen = new Encryption\PwGen\pwgen(); |
1331 | 1331 | |
1332 | 1332 | // init |
1333 | - if (!empty($size)) $pwgen->setLength($size); |
|
1334 | - if (!empty($secure)) $pwgen->setSecure($secure); |
|
1335 | - if (!empty($numerals)) $pwgen->setNumerals($numerals); |
|
1336 | - if (!empty($capitalize)) $pwgen->setCapitalize($capitalize); |
|
1337 | - if (!empty($ambiguous)) $pwgen->setAmbiguous($ambiguous); |
|
1338 | - if (!empty($symbols)) $pwgen->setSymbols($symbols); |
|
1333 | + if (!empty($size)) { |
|
1334 | + $pwgen->setLength($size); |
|
1335 | + } |
|
1336 | + if (!empty($secure)) { |
|
1337 | + $pwgen->setSecure($secure); |
|
1338 | + } |
|
1339 | + if (!empty($numerals)) { |
|
1340 | + $pwgen->setNumerals($numerals); |
|
1341 | + } |
|
1342 | + if (!empty($capitalize)) { |
|
1343 | + $pwgen->setCapitalize($capitalize); |
|
1344 | + } |
|
1345 | + if (!empty($ambiguous)) { |
|
1346 | + $pwgen->setAmbiguous($ambiguous); |
|
1347 | + } |
|
1348 | + if (!empty($symbols)) { |
|
1349 | + $pwgen->setSymbols($symbols); |
|
1350 | + } |
|
1339 | 1351 | |
1340 | 1352 | // generate and send back |
1341 | 1353 | return $pwgen->generate(); |
@@ -1446,20 +1458,21 @@ discard block |
||
1446 | 1458 | */ |
1447 | 1459 | function get_client_ip_server() { |
1448 | 1460 | $ipaddress = ''; |
1449 | - if (getenv('HTTP_CLIENT_IP')) |
|
1450 | - $ipaddress = getenv('HTTP_CLIENT_IP'); |
|
1451 | - else if (getenv('HTTP_X_FORWARDED_FOR')) |
|
1452 | - $ipaddress = getenv('HTTP_X_FORWARDED_FOR'); |
|
1453 | - else if (getenv('HTTP_X_FORWARDED')) |
|
1454 | - $ipaddress = getenv('HTTP_X_FORWARDED'); |
|
1455 | - else if (getenv('HTTP_FORWARDED_FOR')) |
|
1456 | - $ipaddress = getenv('HTTP_FORWARDED_FOR'); |
|
1457 | - else if (getenv('HTTP_FORWARDED')) |
|
1458 | - $ipaddress = getenv('HTTP_FORWARDED'); |
|
1459 | - else if (getenv('REMOTE_ADDR')) |
|
1460 | - $ipaddress = getenv('REMOTE_ADDR'); |
|
1461 | - else |
|
1462 | - $ipaddress = 'UNKNOWN'; |
|
1461 | + if (getenv('HTTP_CLIENT_IP')) { |
|
1462 | + $ipaddress = getenv('HTTP_CLIENT_IP'); |
|
1463 | + } else if (getenv('HTTP_X_FORWARDED_FOR')) { |
|
1464 | + $ipaddress = getenv('HTTP_X_FORWARDED_FOR'); |
|
1465 | + } else if (getenv('HTTP_X_FORWARDED')) { |
|
1466 | + $ipaddress = getenv('HTTP_X_FORWARDED'); |
|
1467 | + } else if (getenv('HTTP_FORWARDED_FOR')) { |
|
1468 | + $ipaddress = getenv('HTTP_FORWARDED_FOR'); |
|
1469 | + } else if (getenv('HTTP_FORWARDED')) { |
|
1470 | + $ipaddress = getenv('HTTP_FORWARDED'); |
|
1471 | + } else if (getenv('REMOTE_ADDR')) { |
|
1472 | + $ipaddress = getenv('REMOTE_ADDR'); |
|
1473 | + } else { |
|
1474 | + $ipaddress = 'UNKNOWN'; |
|
1475 | + } |
|
1463 | 1476 | |
1464 | 1477 | return $ipaddress; |
1465 | 1478 | } |
@@ -1526,7 +1539,9 @@ discard block |
||
1526 | 1539 | $x = 0; |
1527 | 1540 | $bFound = false; |
1528 | 1541 | foreach ($data as $line) { |
1529 | - if (stristr($line, ");")) break; |
|
1542 | + if (stristr($line, ");")) { |
|
1543 | + break; |
|
1544 | + } |
|
1530 | 1545 | if (stristr($line, "'".$field."' => '")) { |
1531 | 1546 | $data[$x] = " '".$field."' => '".$value."',\n"; |
1532 | 1547 | $bFound = true; |
@@ -581,8 +581,7 @@ |
||
581 | 581 | $prev_level = $t->nlevel; |
582 | 582 | } |
583 | 583 | } |
584 | - } |
|
585 | - else { |
|
584 | + } else { |
|
586 | 585 | $error = $LANG['error_not_allowed_to']; |
587 | 586 | } |
588 | 587 | } |
@@ -191,8 +191,11 @@ discard block |
||
191 | 191 | //-------- |
192 | 192 | |
193 | 193 | // increment counter of login attempts |
194 | - if (empty($_SESSION["pwd_attempts"])) $_SESSION["pwd_attempts"] = 1; |
|
195 | - else $_SESSION["pwd_attempts"]++; |
|
194 | + if (empty($_SESSION["pwd_attempts"])) { |
|
195 | + $_SESSION["pwd_attempts"] = 1; |
|
196 | + } else { |
|
197 | + $_SESSION["pwd_attempts"]++; |
|
198 | + } |
|
196 | 199 | |
197 | 200 | // manage brute force |
198 | 201 | if ($_SESSION["pwd_attempts"] <= 3) { |
@@ -336,8 +339,7 @@ discard block |
||
336 | 339 | foreach (explode(",", $_SESSION['settings']['ldap_domain_controler']) as $domainControler) { |
337 | 340 | if ($_SESSION['settings']['ldap_ssl'] == 1) { |
338 | 341 | $ldapURIs .= "ldaps://".$domainControler.":".$_SESSION['settings']['ldap_port']." "; |
339 | - } |
|
340 | - else { |
|
342 | + } else { |
|
341 | 343 | $ldapURIs .= "ldap://".$domainControler.":".$_SESSION['settings']['ldap_port']." "; |
342 | 344 | } |
343 | 345 | } |
@@ -420,8 +422,7 @@ discard block |
||
420 | 422 | // Posix style LDAP handles user searches a bit differently |
421 | 423 | if ($_SESSION['settings']['ldap_type'] == 'posix') { |
422 | 424 | $ldap_suffix = ','.$_SESSION['settings']['ldap_suffix'].','.$_SESSION['settings']['ldap_domain_dn']; |
423 | - } |
|
424 | - elseif ($_SESSION['settings']['ldap_type'] == 'windows' and $ldap_suffix == '') { //Multiple Domain Names |
|
425 | + } elseif ($_SESSION['settings']['ldap_type'] == 'windows' and $ldap_suffix == '') { //Multiple Domain Names |
|
425 | 426 | $ldap_suffix = $_SESSION['settings']['ldap_suffix']; |
426 | 427 | } |
427 | 428 | $adldap = new adLDAP\adLDAP( |
@@ -840,7 +841,9 @@ discard block |
||
840 | 841 | $_SESSION['user_avatar_thumb'] = $data['avatar_thumb']; |
841 | 842 | $_SESSION['user_upgrade_needed'] = $data['upgrade_needed']; |
842 | 843 | // get personal settings |
843 | - if (!isset($data['treeloadstrategy']) || empty($data['treeloadstrategy'])) $data['treeloadstrategy'] = "full"; |
|
844 | + if (!isset($data['treeloadstrategy']) || empty($data['treeloadstrategy'])) { |
|
845 | + $data['treeloadstrategy'] = "full"; |
|
846 | + } |
|
844 | 847 | $_SESSION['user_settings']['treeloadstrategy'] = $data['treeloadstrategy']; |
845 | 848 | $_SESSION['user_settings']['agses-usercardid'] = $data['agses-usercardid']; |
846 | 849 | $_SESSION['user_settings']['user_language'] = $data['user_language']; |
@@ -1745,7 +1745,12 @@ discard block |
||
1745 | 1745 | } |
1746 | 1746 | |
1747 | 1747 | if ( |
1748 | - $("#hid_cat").val() == "<?php if (isset($_SESSION['personal_folders'][0])) echo $_SESSION['personal_folders'][0]; else echo ""; ?>") { |
|
1748 | + $("#hid_cat").val() == "<?php if (isset($_SESSION['personal_folders'][0])) { |
|
1749 | + echo $_SESSION['personal_folders'][0]; |
|
1750 | +} else { |
|
1751 | + echo ""; |
|
1752 | +} |
|
1753 | +?>") { |
|
1749 | 1754 | displayMessage("<i class='fa fa-warning'></i> <?php echo $LANG['error_not_allowed_to']; ?>"); |
1750 | 1755 | return false; |
1751 | 1756 | } |
@@ -3848,7 +3853,12 @@ discard block |
||
3848 | 3853 | $(".tip").tooltipster({multiple: true}); |
3849 | 3854 | $(".mini_login, .mini_pw").css("cursor", "pointer"); |
3850 | 3855 | |
3851 | - var restricted_to_roles = <?php if (isset($_SESSION['settings']['restricted_to_roles']) && $_SESSION['settings']['restricted_to_roles'] == 1) echo 1; else echo 0; ?>; |
|
3856 | + var restricted_to_roles = <?php if (isset($_SESSION['settings']['restricted_to_roles']) && $_SESSION['settings']['restricted_to_roles'] == 1) { |
|
3857 | + echo 1; |
|
3858 | +} else { |
|
3859 | + echo 0; |
|
3860 | +} |
|
3861 | +?>; |
|
3852 | 3862 | |
3853 | 3863 | // refine users list to the related roles |
3854 | 3864 | $.post( |
@@ -37,7 +37,9 @@ discard block |
||
37 | 37 | $state = self::addRoundKey($state, $w, $Nr, $Nb); |
38 | 38 | |
39 | 39 | $output = array(4*$Nb); // convert state to 1-d array before returning [é3.4] |
40 | - for ($i=0; $i<4*$Nb; $i++) $output[$i] = $state[$i%4][floor($i/4)]; |
|
40 | + for ($i=0; $i<4*$Nb; $i++) { |
|
41 | + $output[$i] = $state[$i%4][floor($i/4)]; |
|
42 | + } |
|
41 | 43 | |
42 | 44 | return $output; |
43 | 45 | } |
@@ -48,7 +50,9 @@ discard block |
||
48 | 50 | */ |
49 | 51 | private static function addRoundKey($state, $w, $rnd, $Nb) { // xor Round Key into state S [é5.1.4] |
50 | 52 | for ($r=0; $r<4; $r++) { |
51 | - for ($c=0; $c<$Nb; $c++) $state[$r][$c] ^= $w[$rnd*4+$c][$r]; |
|
53 | + for ($c=0; $c<$Nb; $c++) { |
|
54 | + $state[$r][$c] ^= $w[$rnd*4+$c][$r]; |
|
55 | + } |
|
52 | 56 | } |
53 | 57 | |
54 | 58 | return $state; |
@@ -128,28 +132,38 @@ discard block |
||
128 | 132 | |
129 | 133 | for ($i=$Nk; $i<($Nb*($Nr+1)); $i++) { |
130 | 134 | $w[$i] = array(); |
131 | - for ($t=0; $t<4; $t++) $temp[$t] = $w[$i-1][$t]; |
|
135 | + for ($t=0; $t<4; $t++) { |
|
136 | + $temp[$t] = $w[$i-1][$t]; |
|
137 | + } |
|
132 | 138 | if ($i % $Nk == 0) { |
133 | 139 | $temp = self::subWord(self::rotWord($temp)); |
134 | - for ($t=0; $t<4; $t++) $temp[$t] ^= self::$rCon[$i/$Nk][$t]; |
|
140 | + for ($t=0; $t<4; $t++) { |
|
141 | + $temp[$t] ^= self::$rCon[$i/$Nk][$t]; |
|
142 | + } |
|
135 | 143 | } elseif ($Nk > 6 && $i%$Nk == 4) { |
136 | 144 | $temp = self::subWord($temp); |
137 | 145 | } |
138 | - for ($t=0; $t<4; $t++) $w[$i][$t] = $w[$i-$Nk][$t] ^ $temp[$t]; |
|
146 | + for ($t=0; $t<4; $t++) { |
|
147 | + $w[$i][$t] = $w[$i-$Nk][$t] ^ $temp[$t]; |
|
148 | + } |
|
139 | 149 | } |
140 | 150 | |
141 | 151 | return $w; |
142 | 152 | } |
143 | 153 | |
144 | 154 | private static function subWord($w) { // apply SBox to 4-byte word w |
145 | - for ($i=0; $i<4; $i++) $w[$i] = self::$sBox[$w[$i]]; |
|
155 | + for ($i=0; $i<4; $i++) { |
|
156 | + $w[$i] = self::$sBox[$w[$i]]; |
|
157 | + } |
|
146 | 158 | |
147 | 159 | return $w; |
148 | 160 | } |
149 | 161 | |
150 | 162 | private static function rotWord($w) { // rotate 4-byte word w left by one byte |
151 | 163 | $tmp = $w[0]; |
152 | - for ($i=0; $i<3; $i++) $w[$i] = $w[$i+1]; |
|
164 | + for ($i=0; $i<3; $i++) { |
|
165 | + $w[$i] = $w[$i+1]; |
|
166 | + } |
|
153 | 167 | $w[3] = $tmp; |
154 | 168 | |
155 | 169 | return $w; |
@@ -66,8 +66,12 @@ discard block |
||
66 | 66 | for ($b=0; $b<$blockCount; $b++) { |
67 | 67 | // set counter (block #) in last 8 bytes of counter block (leaving nonce in 1st 8 bytes) |
68 | 68 | // done in two stages for 32-bit ops: using two words allows us to go past 2^32 blocks (68GB) |
69 | - for ($c=0; $c<4; $c++) $counterBlock[15-$c] = self::urs($b, $c*8) & 0xff; |
|
70 | - for ($c=0; $c<4; $c++) $counterBlock[15-$c-4] = self::urs($b/0x100000000, $c*8); |
|
69 | + for ($c=0; $c<4; $c++) { |
|
70 | + $counterBlock[15-$c] = self::urs($b, $c*8) & 0xff; |
|
71 | + } |
|
72 | + for ($c=0; $c<4; $c++) { |
|
73 | + $counterBlock[15-$c-4] = self::urs($b/0x100000000, $c*8); |
|
74 | + } |
|
71 | 75 | |
72 | 76 | $cipherCntr = Aes::cipher($counterBlock, $keySchedule); // -- encrypt counter block -- |
73 | 77 | |
@@ -138,8 +142,12 @@ discard block |
||
138 | 142 | |
139 | 143 | for ($b=0; $b<$nBlocks; $b++) { |
140 | 144 | // set counter (block #) in last 8 bytes of counter block (leaving nonce in 1st 8 bytes) |
141 | - for ($c=0; $c<4; $c++) $counterBlock[15-$c] = self::urs($b, $c*8) & 0xff; |
|
142 | - for ($c=0; $c<4; $c++) $counterBlock[15-$c-4] = self::urs(($b+1)/0x100000000-1, $c*8) & 0xff; |
|
145 | + for ($c=0; $c<4; $c++) { |
|
146 | + $counterBlock[15-$c] = self::urs($b, $c*8) & 0xff; |
|
147 | + } |
|
148 | + for ($c=0; $c<4; $c++) { |
|
149 | + $counterBlock[15-$c-4] = self::urs(($b+1)/0x100000000-1, $c*8) & 0xff; |
|
150 | + } |
|
143 | 151 | |
144 | 152 | $cipherCntr = Aes::cipher($counterBlock, $keySchedule); // encrypt counter block |
145 | 153 |
@@ -23,14 +23,16 @@ discard block |
||
23 | 23 | $dp = opendir($dir); |
24 | 24 | $res = true; |
25 | 25 | while ($file = readdir($dp)) { |
26 | - if (($file == ".") || ($file == "..")) |
|
27 | - continue; |
|
26 | + if (($file == ".") || ($file == "..")) { |
|
27 | + continue; |
|
28 | + } |
|
28 | 29 | |
29 | 30 | $fullPath = $dir."/".$file; |
30 | 31 | |
31 | 32 | if (is_dir($fullPath)) { |
32 | - if ($res = @chmod($fullPath, $dirPermissions)) |
|
33 | - $res = @chmod_r($fullPath, $dirPermissions, $filePermissions); |
|
33 | + if ($res = @chmod($fullPath, $dirPermissions)) { |
|
34 | + $res = @chmod_r($fullPath, $dirPermissions, $filePermissions); |
|
35 | + } |
|
34 | 36 | } else { |
35 | 37 | $res = chmod($fullPath, $filePermissions); |
36 | 38 | } |
@@ -997,10 +999,12 @@ discard block |
||
997 | 999 | if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') { |
998 | 1000 | // Change directory permissions |
999 | 1001 | $result = chmod_r($_SESSION['abspath'], 0770, 0740); |
1000 | - if ($result) |
|
1001 | - $result = chmod_r($_SESSION['abspath'].'/files', 0770, 0770); |
|
1002 | - if ($result) |
|
1003 | - $result = chmod_r($_SESSION['abspath'].'/upload', 0770, 0770); |
|
1002 | + if ($result) { |
|
1003 | + $result = chmod_r($_SESSION['abspath'].'/files', 0770, 0770); |
|
1004 | + } |
|
1005 | + if ($result) { |
|
1006 | + $result = chmod_r($_SESSION['abspath'].'/upload', 0770, 0770); |
|
1007 | + } |
|
1004 | 1008 | } |
1005 | 1009 | |
1006 | 1010 | if ($result === false) { |