Minor CI Fixes
jdarwood007

jdarwood007 commited on 2019-12-24 16:26:23
Showing 2 changed files, with 31 additions and 14 deletions.

... ...
@@ -1,6 +1,3 @@
1
-filter:
2
-    excluded_paths:
3
-        - '*.min.js'
4 1
 checks:
5 2
     php:
6 3
         variable_existence: true
... ...
@@ -189,3 +186,5 @@ build:
189 186
 filter:
190 187
     dependency_paths:
191 188
         - smf/
189
+    excluded_paths:
190
+        - '*.min.js'
... ...
@@ -27,6 +26,7 @@ class SFS
27 26
 	 * @var string The URL for the admin page.
28 27
 	 */
29 28
 	private $adminPageURL = null;
29
+	private $adminLogURL = null;
30 30
 
31 31
 	/**
32 32
 	 * @var array Our settings information used on saving/changing settings.
... ...
@@ -39,6 +39,8 @@ class SFS
39 39
 	 */
40 40
 	private $search_params = array();
41 41
 	private $search_params_column = '';
42
+	private $search_params_string = null;
43
+	private $search_params_type = null;
42 44
 
43 45
 	/**
44 46
 	 * @var int How long we disable removing logs.
... ...
@@ -575,9 +577,9 @@ class SFS
575 577
 						'value' => '<input type="checkbox" name="all" class="input_check" onclick="invertAll(this, this.form);" />',
576 578
 					),
577 579
 					'data' => array(
578
-						'function' => create_function('$entry', '
579
-							return \'<input type="checkbox" class="input_check" name="delete[]" value="\' . $entry[\'id\'] . \'"\' . ($entry[\'editable\'] ? \'\' : \' disabled="disabled"\') . \' />\';
580
-						'),
580
+						'function' => function($entry) {
581
+							return '<input type="checkbox" class="input_check" name="delete[]" value="' . $entry['id'] . '"' . ($entry['editable'] ? '' : ' disabled="disabled"') . ' />';
582
+						},
581 583
 						'style' => 'text-align: center;',
582 584
 					),
583 585
 				),
... ...
@@ -664,6 +666,7 @@ class SFS
664 666
 			))
665 667
 		);
666 668
 
669
+		$entries = array();
667 670
 		while ($row = $smcFunc['db_fetch_assoc']($result))
668 671
 		{
669 672
 			$entries[$row['id_sfs']] = array(
... ...
@@ -696,7 +699,7 @@ class SFS
696 699
 			{
697 700
 				$entries[$row['id_sfs']]['checks'] = '';
698 701
 
699
-				foreach ($checksDecoded as $key => $vkey)
702
+				foreach ($checksDecoded as $ckey => $vkey)
700 703
 					foreach ($vkey as $key => $value)
701 704
 						$entries[$row['id_sfs']]['checks'] .= ucfirst($key) . ':' . $value . '<br>';					
702 705
 			}
... ...
@@ -1062,7 +1065,15 @@ class SFS
1062 1065
 			require_once($sourcedir . '/Subs-Package.php');
1063 1066
 		
1064 1067
 		// Now we have a URL, lets go get it.
1065
-		$response = $this->decodeJSON(fetch_web_data($requestURL));
1068
+		$result = fetch_web_data($requestURL);
1069
+		if ($result === false)
1070
+		{
1071
+			$this->logAllStats('error', $checks, 'failure');
1072
+			log_error($txt['sfs_request_failure'] . ':' . $requestURL, 'critical');
1073
+			return true;
1074
+		}
1075
+
1076
+		$response = $this->decodeJSON($result);
1066 1077
 
1067 1078
 		// No data received, log it and let them through.
1068 1079
 		if (empty($response))
... ...
@@ -1072,7 +1083,7 @@ class SFS
1072 1083
 			return true;
1073 1084
 		}
1074 1085
 
1075
-		$requestBlocked = false;
1086
+		$requestBlocked = '';
1076 1087
 
1077 1088
 		// Handle IPs only if we are supposed to, this is just a double check.
1078 1089
 		if (!empty($modSettings['sfs_ipcheck']) && !empty($response['ip']))
... ...
@@ -1286,7 +1297,7 @@ class SFS
1286 1297
 
1287 1298
 		// Do we have $smcFunc?  It handles errors and logs them as needed.
1288 1299
 		if (isset($smcFunc['json_decode']) && is_callable($smcFunc['json_decode']))
1289
-			return $smcFunc['json_decode']($request, true);
1300
+			return $smcFunc['json_decode']($requestData, true);
1290 1301
 		// Back to the basics.
1291 1302
 		else
1292 1303
 		{
... ...
@@ -1432,7 +1443,11 @@ class SFS
1432 1443
 		if (!empty($modSettings[$optionsKeyExtra]))
1433 1444
 		{
1434 1445
 			$this->extraVerificationOptions = explode(',', $modSettings[$optionsKeyExtra]);
1446
+
1447
+			if (is_array($options))
1435 1448
 				$options = array_merge($options, $this->extraVerificationOptions);
1449
+			else
1450
+				$options = $this->extraVerificationOptions;
1436 1451
 		}
1437 1452
 
1438 1453
 		return $options;
... ...
@@ -1485,6 +1500,8 @@ class SFS
1485 1500
 				$this->changedSettings[$key] = null;
1486 1501
 				$modSettings[$key] = $value;
1487 1502
 			}
1503
+
1504
+		return true;
1488 1505
 	}
1489 1506
 
1490 1507
 	/**
... ...
@@ -1562,7 +1579,7 @@ class SFS
1562 1579
 		if (!empty($_REQUEST['params']) && empty($_REQUEST['is_search']))
1563 1580
 		{
1564 1581
 			$this->search_params = base64_decode(strtr($_REQUEST['params'], array(' ' => '+')));
1565
-			$this->search_params = $this->JSONDecode($this->search_params);
1582
+			$this->search_params = $this->decodeJSON($this->search_params);
1566 1583
 		}
1567 1584
 
1568 1585
 		// What we can search.
... ...
@@ -1631,7 +1648,7 @@ class SFS
1631 1648
 		);
1632 1649
 		if ($smcFunc['db_num_rows']($request) == 1)
1633 1650
 		{
1634
-			$ban_data = $smcFunc['db_fetch_assoc']($result);
1651
+			$ban_data = $smcFunc['db_fetch_assoc']($request);
1635 1652
 			$smcFunc['db_free_result']($request);
1636 1653
 
1637 1654
 			if (!empty($ban_data['id_ban_group']))
... ...
@@ -1792,7 +1809,7 @@ class SFS
1792 1809
 				return false;
1793 1810
 			}
1794 1811
 
1795
-			$ban_triggers[] = array(
1812
+			$ban_triggers = array(array(
1796 1813
 				$modSettings['sfs_ipcheck_autoban_group'],
1797 1814
 				$ip_parts[0]['low'],
1798 1815
 				$ip_parts[0]['high'],
... ...
@@ -1805,7 +1822,7 @@ class SFS
1805 1822
 				'',
1806 1823
 				'',
1807 1824
 				0,
1808
-			);
1825
+			));
1809 1826
 
1810 1827
 			$smcFunc['db_insert']('',
1811 1828
 				'{db_prefix}ban_items',
1812 1829