@@ -55,15 +55,15 @@ |
||
55 | 55 | return $value; |
56 | 56 | } |
57 | 57 | |
58 | - throw new \InvalidArgumentException('value is invalid: ' . var_export($value, 1)); |
|
58 | + throw new \InvalidArgumentException('value is invalid: '.var_export($value, 1)); |
|
59 | 59 | }, $line); |
60 | 60 | |
61 | 61 | $prepare = array_map(function() { |
62 | 62 | return '?'; |
63 | 63 | }, $line); |
64 | 64 | |
65 | - $sql = 'INSERT INTO ' . $this->table . '(' . join(', ', $this->columns) . ')' . |
|
66 | - ' VALUES(' . join(',', $prepare) . ')'; |
|
65 | + $sql = 'INSERT INTO '.$this->table.'('.join(', ', $this->columns).')'. |
|
66 | + ' VALUES('.join(',', $prepare).')'; |
|
67 | 67 | |
68 | 68 | $stmt = $this->pdo->prepare($sql); |
69 | 69 | $stmt->execute($line); |
@@ -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'])) { |
@@ -48,20 +48,20 @@ |
||
48 | 48 | //Paging |
49 | 49 | $sLimit = ""; |
50 | 50 | if (isset($_GET['iDisplayStart']) && $_GET['iDisplayLength'] != '-1') { |
51 | - $sLimit = "LIMIT ". filter_var($_GET['iDisplayStart'], FILTER_SANITIZE_NUMBER_INT) .", ". filter_var($_GET['iDisplayLength'], FILTER_SANITIZE_NUMBER_INT).""; |
|
51 | + $sLimit = "LIMIT ".filter_var($_GET['iDisplayStart'], FILTER_SANITIZE_NUMBER_INT).", ".filter_var($_GET['iDisplayLength'], FILTER_SANITIZE_NUMBER_INT).""; |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | //Ordering |
55 | 55 | |
56 | 56 | if (isset($_GET['iSortCol_0']) && in_array($_GET['iSortCol_0'], $aSortTypes)) { |
57 | 57 | $sOrder = "ORDER BY "; |
58 | - for ($i=0; $i<intval($_GET['iSortingCols']); $i++) { |
|
58 | + for ($i = 0; $i < intval($_GET['iSortingCols']); $i++) { |
|
59 | 59 | if ( |
60 | - $_GET[ 'bSortable_'.filter_var($_GET['iSortCol_'.$i], FILTER_SANITIZE_NUMBER_INT)] == "true" && |
|
60 | + $_GET['bSortable_'.filter_var($_GET['iSortCol_'.$i], FILTER_SANITIZE_NUMBER_INT)] == "true" && |
|
61 | 61 | preg_match("#^(asc|desc)\$#i", $_GET['sSortDir_'.$i]) |
62 | 62 | ) { |
63 | - $sOrder .= "".$aColumns[ filter_var($_GET['iSortCol_'.$i], FILTER_SANITIZE_NUMBER_INT) ]." " |
|
64 | - .mysqli_escape_string($link, $_GET['sSortDir_'.$i]) .", "; |
|
63 | + $sOrder .= "".$aColumns[filter_var($_GET['iSortCol_'.$i], FILTER_SANITIZE_NUMBER_INT)]." " |
|
64 | + .mysqli_escape_string($link, $_GET['sSortDir_'.$i]).", "; |
|
65 | 65 | } |
66 | 66 | } |
67 | 67 |
@@ -1347,11 +1347,11 @@ |
||
1347 | 1347 | /** |
1348 | 1348 | * @param string $message |
1349 | 1349 | */ |
1350 | -function send_syslog($message, $component = "teampass", $program = "php", $host , $port) |
|
1350 | +function send_syslog($message, $component = "teampass", $program = "php", $host, $port) |
|
1351 | 1351 | { |
1352 | 1352 | $sock = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP); |
1353 | 1353 | //$syslog_message = "<123>" . date('M d H:i:s ') . " " .$host . " " . $component . ": " . $message; |
1354 | - $syslog_message = "<123>" . date('M d H:i:s ') . $component . ": " . $message; |
|
1354 | + $syslog_message = "<123>".date('M d H:i:s ').$component.": ".$message; |
|
1355 | 1355 | socket_sendto($sock, $syslog_message, strlen($syslog_message), 0, $host, $port); |
1356 | 1356 | socket_close($sock); |
1357 | 1357 | } |
@@ -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; |
@@ -2048,31 +2048,31 @@ |
||
2048 | 2048 | ldap_start_tls($ldapconn); |
2049 | 2049 | } |
2050 | 2050 | |
2051 | - $debug_ldap .= "LDAP connection : " . ($ldapconn ? "Connected" : "Failed") . "<br/>"; |
|
2051 | + $debug_ldap .= "LDAP connection : ".($ldapconn ? "Connected" : "Failed")."<br/>"; |
|
2052 | 2052 | |
2053 | 2053 | ldap_set_option($ldapconn, LDAP_OPT_PROTOCOL_VERSION, 3); |
2054 | 2054 | if ($ldapconn) { |
2055 | 2055 | $ldapbind = @ldap_bind($ldapconn, $dataReceived[0]['ldap_bind_dn'], $dataReceived[0]['ldap_bind_passwd']); |
2056 | 2056 | |
2057 | - $debug_ldap .= "LDAP bind : " . ($ldapbind ? "Bound" : "Failed") . "<br/>"; |
|
2057 | + $debug_ldap .= "LDAP bind : ".($ldapbind ? "Bound" : "Failed")."<br/>"; |
|
2058 | 2058 | |
2059 | 2059 | if ($ldapbind) { |
2060 | - $filter="(&(" . $dataReceived[0]['ldap_user_attribute']. "=$username)(objectClass=" . $dataReceived[0]['ldap_object_class'] ."))"; |
|
2061 | - $result=ldap_search($ldapconn, $dataReceived[0]['ldap_search_base'], $filter, array('dn','mail','givenname','sn')); |
|
2060 | + $filter = "(&(".$dataReceived[0]['ldap_user_attribute']."=$username)(objectClass=".$dataReceived[0]['ldap_object_class']."))"; |
|
2061 | + $result = ldap_search($ldapconn, $dataReceived[0]['ldap_search_base'], $filter, array('dn', 'mail', 'givenname', 'sn')); |
|
2062 | 2062 | if (isset($dataReceived[0]['ldap_usergroup'])) { |
2063 | 2063 | $filter_group = "memberUid=".$username; |
2064 | - $result_group = ldap_search($ldapconn, $dataReceived[0]['ldap_usergroup'],$filter_group, array('dn')); |
|
2064 | + $result_group = ldap_search($ldapconn, $dataReceived[0]['ldap_usergroup'], $filter_group, array('dn')); |
|
2065 | 2065 | |
2066 | - $debug_ldap .= 'Search filter (group): ' . $filter_group . "<br/>" . |
|
2067 | - 'Results : ' . print_r(ldap_get_entries($ldapconn, $result_group), true) . "<br/>"; |
|
2066 | + $debug_ldap .= 'Search filter (group): '.$filter_group."<br/>". |
|
2067 | + 'Results : '.print_r(ldap_get_entries($ldapconn, $result_group), true)."<br/>"; |
|
2068 | 2068 | |
2069 | 2069 | if (!ldap_count_entries($ldapconn, $result_group)) { |
2070 | 2070 | $ldapConnection = "Error - No entries found"; |
2071 | 2071 | } |
2072 | 2072 | } |
2073 | 2073 | |
2074 | - $debug_ldap .= 'Search filter : ' . $filter . "<br/>" . |
|
2075 | - 'Results : ' . print_r(ldap_get_entries($ldapconn, $result), true) . "<br/>"; |
|
2074 | + $debug_ldap .= 'Search filter : '.$filter."<br/>". |
|
2075 | + 'Results : '.print_r(ldap_get_entries($ldapconn, $result), true)."<br/>"; |
|
2076 | 2076 | |
2077 | 2077 | if (ldap_count_entries($ldapconn, $result)) { |
2078 | 2078 | // try auth |
@@ -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 | } |
@@ -350,25 +350,25 @@ |
||
350 | 350 | ldap_start_tls($ldapconn); |
351 | 351 | } |
352 | 352 | if ($debugLdap == 1) { |
353 | - fputs($dbgLdap, "LDAP connection : " . ($ldapconn ? "Connected" : "Failed") . "\n"); |
|
353 | + fputs($dbgLdap, "LDAP connection : ".($ldapconn ? "Connected" : "Failed")."\n"); |
|
354 | 354 | } |
355 | 355 | ldap_set_option($ldapconn, LDAP_OPT_PROTOCOL_VERSION, 3); |
356 | 356 | if ($ldapconn) { |
357 | 357 | $ldapbind = ldap_bind($ldapconn, $_SESSION['settings']['ldap_bind_dn'], $_SESSION['settings']['ldap_bind_passwd']); |
358 | 358 | if ($debugLdap == 1) { |
359 | - fputs($dbgLdap, "LDAP bind : " . ($ldapbind ? "Bound" : "Failed") . "\n"); |
|
359 | + fputs($dbgLdap, "LDAP bind : ".($ldapbind ? "Bound" : "Failed")."\n"); |
|
360 | 360 | } |
361 | 361 | if ($ldapbind) { |
362 | - $filter="(&(" . $_SESSION['settings']['ldap_user_attribute']. "=$username)(objectClass=" . $_SESSION['settings']['ldap_object_class'] ."))"; |
|
363 | - $result=ldap_search($ldapconn, $_SESSION['settings']['ldap_search_base'], $filter, array('dn','mail','givenname','sn')); |
|
362 | + $filter = "(&(".$_SESSION['settings']['ldap_user_attribute']."=$username)(objectClass=".$_SESSION['settings']['ldap_object_class']."))"; |
|
363 | + $result = ldap_search($ldapconn, $_SESSION['settings']['ldap_search_base'], $filter, array('dn', 'mail', 'givenname', 'sn')); |
|
364 | 364 | if (isset($_SESSION['settings']['ldap_usergroup'])) { |
365 | 365 | $filter_group = "memberUid=".$username; |
366 | - $result_group = ldap_search($ldapconn, $_SESSION['settings']['ldap_usergroup'],$filter_group, array('dn')); |
|
366 | + $result_group = ldap_search($ldapconn, $_SESSION['settings']['ldap_usergroup'], $filter_group, array('dn')); |
|
367 | 367 | if ($debugLdap == 1) { |
368 | 368 | fputs( |
369 | 369 | $dbgLdap, |
370 | - 'Search filter (group): ' . $filter_group . "\n" . |
|
371 | - 'Results : ' . print_r(ldap_get_entries($ldapconn, $result_group), true) . "\n" |
|
370 | + 'Search filter (group): '.$filter_group."\n". |
|
371 | + 'Results : '.print_r(ldap_get_entries($ldapconn, $result_group), true)."\n" |
|
372 | 372 | ); |
373 | 373 | } |
374 | 374 | if (!ldap_count_entries($ldapconn, $result_group)) { |
@@ -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( |