Completed
Push — master ( 64efce...1ec187 )
by mains
02:46
created
php/jodel-web.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 
40 40
 function user_log($msg)
41 41
 {
42
-    $log  = $msg . PHP_EOL;
42
+    $log = $msg . PHP_EOL;
43 43
     file_put_contents(realpath(__DIR__ . '/..') . '/logs/user_log-' . date("j.n.Y") . '.txt', $log, FILE_APPEND);
44 44
 }
45 45
 
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 {
48 48
     preg_match('/bot|spider|google|twitter/i', $_SERVER['HTTP_USER_AGENT'], $matches);
49 49
 
50
-    return (isset($matches[0])) ? true : false;
50
+    return (isset($matches[0]))?true : false;
51 51
 }
52 52
 
53 53
 function configPropertyExists($config, $property)
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 }
64 64
 function isUserAdmin() {
65 65
 	global $config;
66
-	if (isset($_COOKIE['JodelAdminPassword']) && configPropertyExists($config, 'pw') && $config['pw'] == $_COOKIE['JodelAdminPassword'])
66
+	if(isset($_COOKIE['JodelAdminPassword']) && configPropertyExists($config, 'pw') && $config['pw'] == $_COOKIE['JodelAdminPassword'])
67 67
 	{
68 68
 		return TRUE;
69 69
 	}
@@ -76,9 +76,9 @@  discard block
 block discarded – undo
76 76
 function isDeviceUidInDatabase($deviceUid)
77 77
 {
78 78
     $db = new DatabaseConnect();  
79
-    $result = $db->query("SELECT * FROM accounts WHERE device_uid='" . $deviceUid  . "'");
79
+    $result = $db->query("SELECT * FROM accounts WHERE device_uid='" . $deviceUid . "'");
80 80
 
81
-    if ($result->num_rows > 0)
81
+    if($result->num_rows > 0)
82 82
     {
83 83
         return TRUE;
84 84
     }
@@ -100,8 +100,8 @@  discard block
 block discarded – undo
100 100
 		if(!isset($_COOKIE['JodelDeviceId']) || !isDeviceUidInDatabase($_COOKIE['JodelDeviceId']))
101 101
 		{
102 102
 			$jodelAccountForView = new JodelAccount();
103
-			setcookie('JodelDeviceId', $jodelAccountForView->deviceUid, time()+60*60*24*365*10);
104
-			user_log('Created account with JodelDeviceId:' . $jodelAccountForView->deviceUid .  ' for [' . $_SERVER ['HTTP_USER_AGENT'] . ']');
103
+			setcookie('JodelDeviceId', $jodelAccountForView->deviceUid, time() + 60 * 60 * 24 * 365 * 10);
104
+			user_log('Created account with JodelDeviceId:' . $jodelAccountForView->deviceUid . ' for [' . $_SERVER ['HTTP_USER_AGENT'] . ']');
105 105
 			
106 106
 		}
107 107
 		else
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 	if(isset($_GET['search']))
131 131
 	{
132 132
 
133
-		user_log('User with JodelDeviceId:' . $jodelAccountForView->deviceUid .  ' [' . $_SERVER['REMOTE_ADDR'] . '][' . $_SERVER ['HTTP_USER_AGENT'] . '] searched for ' . $_GET['search']);
133
+		user_log('User with JodelDeviceId:' . $jodelAccountForView->deviceUid . ' [' . $_SERVER['REMOTE_ADDR'] . '][' . $_SERVER ['HTTP_USER_AGENT'] . '] searched for ' . $_GET['search']);
134 134
 
135 135
 		if(substr($_GET['search'], 0, 1) === "#")
136 136
 		{
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
 	
186 186
 	if(isset($_GET['view']))
187 187
 	{
188
-		switch ($_GET['view']) {
188
+		switch($_GET['view']) {
189 189
 			case 'discussed':
190 190
 				$view = 'discussed';
191 191
 				break;
Please login to merge, or discard this patch.