Completed
Push — master ( 142619...64efce )
by mains
02:37
created
php/jodel-web.php 2 patches
Indentation   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -39,27 +39,27 @@  discard block
 block discarded – undo
39 39
 
40 40
 function user_log($msg)
41 41
 {
42
-    $log  = $msg . PHP_EOL;
43
-    file_put_contents(realpath(__DIR__ . '/..') . '/logs/user_log-' . date("j.n.Y") . '.txt', $log, FILE_APPEND);
42
+	$log  = $msg . PHP_EOL;
43
+	file_put_contents(realpath(__DIR__ . '/..') . '/logs/user_log-' . date("j.n.Y") . '.txt', $log, FILE_APPEND);
44 44
 }
45 45
 
46 46
 function isUserBot()
47 47
 {
48
-    preg_match('/bot|spider|google|twitter/i', $_SERVER['HTTP_USER_AGENT'], $matches);
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)
54 54
 {
55
-    if(!array_key_exists($property, $config) || !isset($config[$property]) || $config[$property] == '' || $config[$property] == 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx')
56
-    {
57
-        return FALSE;
58
-    }
59
-    else
60
-    {
61
-        return TRUE;
62
-    }
55
+	if(!array_key_exists($property, $config) || !isset($config[$property]) || $config[$property] == '' || $config[$property] == 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx')
56
+	{
57
+		return FALSE;
58
+	}
59
+	else
60
+	{
61
+		return TRUE;
62
+	}
63 63
 }
64 64
 function isUserAdmin() {
65 65
 	global $config;
@@ -75,17 +75,17 @@  discard block
 block discarded – undo
75 75
 
76 76
 function isDeviceUidInDatabase($deviceUid)
77 77
 {
78
-    $db = new DatabaseConnect();  
79
-    $result = $db->query("SELECT * FROM accounts WHERE device_uid='" . $deviceUid  . "'");
80
-
81
-    if ($result->num_rows > 0)
82
-    {
83
-        return TRUE;
84
-    }
85
-    else
86
-    {
87
-        return FALSE;
88
-    }
78
+	$db = new DatabaseConnect();  
79
+	$result = $db->query("SELECT * FROM accounts WHERE device_uid='" . $deviceUid  . "'");
80
+
81
+	if ($result->num_rows > 0)
82
+	{
83
+		return TRUE;
84
+	}
85
+	else
86
+	{
87
+		return FALSE;
88
+	}
89 89
 }
90 90
 
91 91
 	//Check if it's a Spider or Google Bot
@@ -112,14 +112,14 @@  discard block
 block discarded – undo
112 112
 	}
113 113
 	
114 114
 	if(configPropertyExists($config, 'karmaDeviceUid'))
115
-    {
116
-    	$jodelAccountForKarma = new JodelAccount($config['karmaDeviceUid']);
117
-    }
118
-    else
119
-    {
120
-    	error_log("No Karma deviceUid set in config file");
115
+	{
116
+		$jodelAccountForKarma = new JodelAccount($config['karmaDeviceUid']);
117
+	}
118
+	else
119
+	{
120
+		error_log("No Karma deviceUid set in config file");
121 121
 		$jodelAccountForKarma = new JodelAccount($deviceUid);
122
-    }
122
+	}
123 123
 
124 124
 	/*
125 125
 	 * Cunstruct View
@@ -229,14 +229,14 @@  discard block
 block discarded – undo
229 229
 	{
230 230
 		$jodelAccountForKarma->votePostId($_GET['postId'], $_GET['vote']);
231 231
 		if(isset($_GET['getPostDetails']) && isset($_GET['getPostDetails']))
232
-        {
233
-            header('Location: index.php?getPostDetails=true&postId=' . htmlspecialchars($_GET['postId_parent']) . '#postId-' . htmlspecialchars($_GET['postId']));
234
-        }
235
-        else
236
-        {
237
-            header("Location: index.php#postId-" . htmlspecialchars($_GET['postId']));
238
-        }   
239
-        die();
232
+		{
233
+			header('Location: index.php?getPostDetails=true&postId=' . htmlspecialchars($_GET['postId_parent']) . '#postId-' . htmlspecialchars($_GET['postId']));
234
+		}
235
+		else
236
+		{
237
+			header("Location: index.php#postId-" . htmlspecialchars($_GET['postId']));
238
+		}   
239
+		die();
240 240
 	}
241 241
 	
242 242
 	//SendJodel
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 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
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
 	
183 183
 	if(isset($_GET['view']))
184 184
 	{
185
-		switch ($_GET['view']) {
185
+		switch($_GET['view']) {
186 186
 			case 'discussed':
187 187
 				$view = 'discussed';
188 188
 				break;
Please login to merge, or discard this patch.