Passed
Push — master ( eb69c9...fcad25 )
by Stefan
54s queued 10s
created
upload.php 2 patches
Switch Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -49,18 +49,18 @@
 block discarded – undo
49 49
     $f = fopen($targetFile, 'w');
50 50
     if ($f) {
51 51
         switch ($error) {
52
-            case UPLOAD_ERR_INI_SIZE:
53
-                $message = __("This file is too large.");
54
-                break;
55
-            case UPLOAD_ERR_FORM_SIZE:
56
-                $message = __("Large files are not supported.");
57
-                break;
58
-            case UPLOAD_ERR_PARTIAL:
59
-                $message = __("File was only partially uploaded.");
60
-                break;
61
-            default:
62
-                $message = sprintf(__("Error code %s."), $error);
63
-                break;
52
+        case UPLOAD_ERR_INI_SIZE:
53
+            $message = __("This file is too large.");
54
+            break;
55
+        case UPLOAD_ERR_FORM_SIZE:
56
+            $message = __("Large files are not supported.");
57
+            break;
58
+        case UPLOAD_ERR_PARTIAL:
59
+            $message = __("File was only partially uploaded.");
60
+            break;
61
+        default:
62
+            $message = sprintf(__("Error code %s."), $error);
63
+            break;
64 64
         }
65 65
         fprintf($f, "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\"");
66 66
         fprintf($f, "\"http://www.w3.org/TR/html4/strict.dtd\">");
Please login to merge, or discard this patch.
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -111,10 +111,10 @@
 block discarded – undo
111 111
 $curl = curl_init();
112 112
 // Set some options - we are passing in a useragent too here
113 113
 curl_setopt_array($curl, array(
114
-                      CURLOPT_RETURNTRANSFER => 1,
115
-                      CURLOPT_URL => CONFIG_CONTROL_FILE . '?newWindow=' . $sw,
116
-                      CURLOPT_USERAGENT => 'PalMA cURL Request'
117
-                               ));
114
+                        CURLOPT_RETURNTRANSFER => 1,
115
+                        CURLOPT_URL => CONFIG_CONTROL_FILE . '?newWindow=' . $sw,
116
+                        CURLOPT_USERAGENT => 'PalMA cURL Request'
117
+                                ));
118 118
 // Send the request & save response to $resp
119 119
 $resp = curl_exec($curl);
120 120
 // Close request to clear up some resources
Please login to merge, or discard this patch.
download.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@
 block discarded – undo
23 23
     // file exists: return file for download
24 24
     header('Content-Type: application/octet-stream');
25 25
     header('Content-Disposition: attachment; filename="' .
26
-           addslashes($filename) . '"');
26
+            addslashes($filename) . '"');
27 27
     readfile($filepath);
28 28
 } else {
29 29
     // file does not exist: 404 Not Found
Please login to merge, or discard this patch.
DBConnector.class.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
         if (count($next_ids) > 0) {
117 117
             $next = $next_ids[0];
118 118
         } else {
119
-            $next = $this->querySingle('SELECT MAX(id) FROM window') + 1;
119
+            $next = $this->querySingle('SELECT MAX(id) FROM window')+1;
120 120
         }
121 121
         return $next;
122 122
     }
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
         // TODO: Support more than one address for a given username.
141 141
         $this->exec("INSERT OR IGNORE INTO user VALUES (NULL, '$username', 1, 0)");
142 142
         $usercount = $this->querySingle("SELECT COUNT(*) FROM user");
143
-        $userid = $this->querySingle("SELECT userid from user where name='".$username."'");
143
+        $userid = $this->querySingle("SELECT userid from user where name='" . $username . "'");
144 144
         $this->exec("INSERT INTO address VALUES ('$userid', '$address', '$device')");
145 145
         trace("user $username connected with $device, $usercount user(s) now connected");
146 146
         if ($usercount == 1) {
@@ -235,13 +235,13 @@  discard block
 block discarded – undo
235 235
 
236 236
     public function getWindowState($window_id)
237 237
     {
238
-        $state = @$this->querySingle('SELECT state FROM window WHERE win_id="'.$window_id.'"');
238
+        $state = @$this->querySingle('SELECT state FROM window WHERE win_id="' . $window_id . '"');
239 239
         return $state;
240 240
     }
241 241
 
242 242
     public function setWindowState($window_id, $state)
243 243
     {
244
-        $this->exec('UPDATE window SET state="'.$state.'" WHERE win_id="'.$window_id.'"');
244
+        $this->exec('UPDATE window SET state="' . $state . '" WHERE win_id="' . $window_id . '"');
245 245
     }
246 246
 
247 247
     public function insertWindow($window)
@@ -259,12 +259,12 @@  discard block
 block discarded – undo
259 259
 
260 260
     public function deleteWindow($window_id)
261 261
     {
262
-        $this->exec('DELETE FROM window WHERE win_id="'.$window_id.'"');
262
+        $this->exec('DELETE FROM window WHERE win_id="' . $window_id . '"');
263 263
     }
264 264
 
265 265
     public function deleteVNCWindow($userid)
266 266
     {
267
-        $winid = $this->querySingle('SELECT win_id FROM window WHERE handler="vnc" AND userid="'.$userid.'"');
267
+        $winid = $this->querySingle('SELECT win_id FROM window WHERE handler="vnc" AND userid="' . $userid . '"');
268 268
         require_once('control.php');
269 269
         wmClose($winid);
270 270
         $this->deleteWindow($winid);
@@ -273,12 +273,12 @@  discard block
 block discarded – undo
273 273
 
274 274
     public function deleteDebug($table, $id, $gt)
275 275
     {
276
-        $this->exec('DELETE FROM '.$table.' WHERE '.$id.' >"'.$gt.'"');
276
+        $this->exec('DELETE FROM ' . $table . ' WHERE ' . $id . ' >"' . $gt . '"');
277 277
     }
278 278
 
279 279
     public function updateWindow($window_id, $field, $value)
280 280
     {
281
-        $this->exec('UPDATE window SET '.$field.'="'.$value.'" WHERE win_id="'.$window_id.'"');
281
+        $this->exec('UPDATE window SET ' . $field . '="' . $value . '" WHERE win_id="' . $window_id . '"');
282 282
     }
283 283
 }
284 284
 
Please login to merge, or discard this patch.
index.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1392,11 +1392,11 @@
 block discarded – undo
1392 1392
 
1393 1393
 <div id="footer">
1394 1394
     <?php
1395
-      # Show authorized user name (and address) and allow logout.
1395
+        # Show authorized user name (and address) and allow logout.
1396 1396
     if ($user) {
1397 1397
         echo("<a href=\"logout.php\" title=\"" .
1398
-          __('Disconnect the current user') .
1399
-          "\">" . __('Log out') . "<i class=\"fa fa-sign-out\"></i></a>");
1398
+            __('Disconnect the current user') .
1399
+            "\">" . __('Log out') . "<i class=\"fa fa-sign-out\"></i></a>");
1400 1400
     }
1401 1401
     ?>
1402 1402
 </div> <!-- Footer -->
Please login to merge, or discard this patch.
FileHandler.class.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 
32 32
     // Shortcuts for combinations of controls.
33 33
     const CURSOR = 15; // UP | DOWN | LEFT | RIGHT
34
-    const ZOOM = 48;   // ZOOMIN | ZOOMOUT
34
+    const ZOOM = 48; // ZOOMIN | ZOOMOUT
35 35
     const ALL = 2047;
36 36
 
37 37
     // up down left right zoomin zoomout home end prior next download
@@ -62,14 +62,14 @@  discard block
 block discarded – undo
62 62
         // $params;
63 63
         // echo $ftype;
64 64
         if ($ftype === 'pdf') {
65
-            $fhandler=$pdfHandler;
65
+            $fhandler = $pdfHandler;
66 66
         } elseif ($ftype === 'gif' || $ftype === 'jpg' || $ftype === 'png') {
67
-            $fhandler=$imageHandler;
67
+            $fhandler = $imageHandler;
68 68
         } elseif ($ftype === 'html' || $ftype === 'url') {
69
-            $fhandler=$webHandler;
69
+            $fhandler = $webHandler;
70 70
         } elseif ($ftype === 'mpg' || $ftype === 'mpeg' || $ftype === 'avi' ||
71 71
                   $ftype === 'mp3' || $ftype === 'mp4') {
72
-            $fhandler=$avHandler;
72
+            $fhandler = $avHandler;
73 73
         } else {
74 74
             if ($ftype === 'doc' || $ftype === 'docx' || $ftype === 'odt' || $ftype === 'txt') {
75 75
                 $officeApp = "writer";
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 function convertOffice($inputFile, $office, $outputDir, $fileName)
106 106
 {
107 107
     shell_exec("/usr/bin/libreoffice --headless --convert-to pdf:'$office'_pdf_Export --outdir '$outputDir' '$inputFile' >/dev/null 2>&1");
108
-    $newFile=$outputDir . '/' . $fileName . '.pdf';
108
+    $newFile = $outputDir . '/' . $fileName . '.pdf';
109 109
     if (file_exists($newFile)) {
110 110
         return $newFile;
111 111
     } else {
Please login to merge, or discard this patch.
db.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 if (!empty($_REQUEST['json'])) {
22 22
     $oldJSON = $_REQUEST['json'];
23 23
     $oldJSONarr = json_decode($oldJSON, true);
24
-    array_walk_recursive($oldJSONarr, function (&$value, $key) {
24
+    array_walk_recursive($oldJSONarr, function(&$value, $key) {
25 25
         if (is_string($value) && preg_match('/^http/', $value)) {
26 26
             $value = rawurlencode($value);
27 27
         }
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
     $database['window'] = $data;
73 73
 
74 74
     //~ $newJSON = json_encode($database, JSON_PRETTY_PRINT);
75
-    array_walk_recursive($database, function (&$value, $key) {
75
+    array_walk_recursive($database, function(&$value, $key) {
76 76
         if (is_string($value) && preg_match('/^http/', $value)) {
77 77
             $value = rawurlencode($value);
78 78
         }
Please login to merge, or discard this patch.
SSVNCDaemon.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -72,18 +72,18 @@  discard block
 block discarded – undo
72 72
             $hostname = $this->parseHostname($buffer);
73 73
             $exit = $this->parseExit($buffer);
74 74
 
75
-            if ($ip!="") {
75
+            if ($ip != "") {
76 76
                 $client["ip"] = $ip;
77 77
             }
78
-            if ($hostname!="") {
78
+            if ($hostname != "") {
79 79
                 $client["hostname"] = $hostname;
80 80
             }
81
-            if ($exit!=0) {
81
+            if ($exit != 0) {
82 82
                 $client["exit"] = $exit;
83 83
             }
84 84
 
85 85
             if (strstr($buffer, 'create_image') && $client["ip"] != "" &&
86
-            $client["hostname"]!="" ) {
86
+            $client["hostname"] != "") {
87 87
                 // add client
88 88
                 $this->addClient($client["ip"], $client["hostname"]);
89 89
 
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
                 }
101 101
             }
102 102
 
103
-            $halt=$this->CONNECTIONS;
103
+            $halt = $this->CONNECTIONS;
104 104
 
105 105
             if ($halt == -1) {
106 106
                 exit(0);
@@ -117,13 +117,13 @@  discard block
 block discarded – undo
117 117
         $ip = "";
118 118
         $line = $buffer;
119 119
         if (strpos($line, "Reverse VNC connection from IP")) {
120
-            $line=trim($line);
121
-            $item=explode(":", $line);
122
-            $ip=trim($item[1]);
123
-            $ip=preg_replace('/\W\W\d{4}\/\d{2}\/\d{2} \d{2}/', '', $ip);
120
+            $line = trim($line);
121
+            $item = explode(":", $line);
122
+            $ip = trim($item[1]);
123
+            $ip = preg_replace('/\W\W\d{4}\/\d{2}\/\d{2} \d{2}/', '', $ip);
124 124
         }
125 125
 
126
-        if ($ip!="") {
126
+        if ($ip != "") {
127 127
             print("\nFOUND IP: " . $ip . "\n");
128 128
         }
129 129
 
@@ -135,13 +135,13 @@  discard block
 block discarded – undo
135 135
         $hostname = "";
136 136
         $line = $buffer;
137 137
         if (strpos($line, "Hostname")) {
138
-            $line=trim($line);
139
-            $item=explode(":", $line);
140
-            $hostname=trim($item[1]);
141
-            $hostname=preg_replace('/\.uni\-mannheim\.de/', '', $hostname);
138
+            $line = trim($line);
139
+            $item = explode(":", $line);
140
+            $hostname = trim($item[1]);
141
+            $hostname = preg_replace('/\.uni\-mannheim\.de/', '', $hostname);
142 142
         }
143 143
 
144
-        if ($hostname!="") {
144
+        if ($hostname != "") {
145 145
             print("\nFOUND HOSTNAME: " . $hostname . "\n");
146 146
         }
147 147
 
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
             $exit = 1;
156 156
         }
157 157
 
158
-        if ($exit!=0) {
158
+        if ($exit != 0) {
159 159
             print("\nCLIENT HAS DISCONNECTED " . $exit . "\n");
160 160
         }
161 161
 
@@ -171,9 +171,9 @@  discard block
 block discarded – undo
171 171
                         "exit" => 0
172 172
                         );
173 173
         if (count($this->VNC_CLIENTS) == 0) {
174
-            $id=1;
174
+            $id = 1;
175 175
         } else {
176
-            $id=count($this->VNC_CLIENTS) + 1;
176
+            $id = count($this->VNC_CLIENTS)+1;
177 177
         }
178 178
 
179 179
         $this->VNC_CLIENTS[$id] = $vncclient;
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 
188 188
         $this->CONNECTIONS++;
189 189
 
190
-        print("\n active connections: ".$this->CONNECTIONS+1);
190
+        print("\n active connections: " . $this->CONNECTIONS+1);
191 191
         print("\n all saved clients: " . serialize($this->VNC_CLIENTS));
192 192
     }
193 193
 
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
 
296 296
         foreach ($inactive_vnc_window_ids as $inactive_win_id) {
297 297
             // define vnc-id
298
-            $inactive_vnc_id = $db->querySingle("SELECT file FROM window WHERE win_id='".$inactive_win_id."'");
298
+            $inactive_vnc_id = $db->querySingle("SELECT file FROM window WHERE win_id='" . $inactive_win_id . "'");
299 299
 
300 300
             // delete from database (send to control.php)
301 301
             $curl = curl_init();
Please login to merge, or discard this patch.
control.php 2 patches
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -329,18 +329,18 @@  discard block
 block discarded – undo
329 329
   
330 330
     require_once('FileHandler.class.php');
331 331
     list ($handler, $targetFile) =
332
-      palma\FileHandler::getFileHandler($inFile);
332
+        palma\FileHandler::getFileHandler($inFile);
333 333
     trace("file is now $targetFile, its handler is $handler");
334 334
 
335 335
     $window = array(
336
-      "id" => "",
337
-      "win_id" => "",
338
-      "name" => "",
339
-      "state" => "",
340
-      "file" => $targetFile,
341
-      "handler" => $handler,
342
-      "userid" => "",
343
-      "date" => $w['date']);
336
+        "id" => "",
337
+        "win_id" => "",
338
+        "name" => "",
339
+        "state" => "",
340
+        "file" => $targetFile,
341
+        "handler" => $handler,
342
+        "userid" => "",
343
+        "date" => $w['date']);
344 344
   
345 345
     createNewWindow($db, $window);
346 346
 }
@@ -400,7 +400,7 @@  discard block
 block discarded – undo
400 400
 
401 401
             // trying mousemove and click for better vnc control
402 402
             displayCommand("xdotool mousemove --window $windowhex 100 100 " .
403
-                       "key $key");
403
+                        "key $key");
404 404
         }
405 405
 
406 406
         if ($windowname && array_key_exists('keydown', $_REQUEST)) {
@@ -415,7 +415,7 @@  discard block
 block discarded – undo
415 415
 
416 416
             // trying mousemove and click for better vnc control
417 417
             displayCommand("xdotool mousemove --window $windowhex 100 100 " .
418
-                       "key $key");
418
+                        "key $key");
419 419
             //~ displayCommand("xdotool windowfocus $windowhex keydown $key");
420 420
         }
421 421
 
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
         $section = $w['section'];
205 205
         if ($section >= 1 && $section <= $maxSection && $enabled) {
206 206
             // Show window, set size and position.
207
-            $wi = $section - 1;
207
+            $wi = $section-1;
208 208
             $dx = $screenWidth / $dim[$wi][2];
209 209
             $dy = $screenHeight / $dim[$wi][3];
210 210
             $x = $dim[$wi][0] * $dx;
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
     // TODO: check how to insert the userid for all content, not just vnc.
298 298
     // Perhaps better add to array in upload.php ?
299 299
     $userid = "";
300
-    $queryid = $db->querySingle('SELECT user.userid FROM user WHERE user.name="' . $new['userid'] .'"');
300
+    $queryid = $db->querySingle('SELECT user.userid FROM user WHERE user.name="' . $new['userid'] . '"');
301 301
     if (!empty($queryid)) {
302 302
         $userid = $queryid;
303 303
     } else {
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
 {
324 324
     $inFile = $w['file'];
325 325
     if (!file_exists($inFile)) {
326
-        trace("".escapeshellarg($inFile)." is not a file, aborting display");
326
+        trace("" . escapeshellarg($inFile) . " is not a file, aborting display");
327 327
         return;
328 328
     }
329 329
   
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
     // TODO: use escapeshellarg() for filename.
356 356
     $filename = $w['file'];
357 357
 
358
-    $cmd = "$handler ".escapeshellarg($filename);
358
+    $cmd = "$handler " . escapeshellarg($filename);
359 359
     displayCommand("/usr/bin/nohup $cmd >/dev/null 2>&1 &");
360 360
 
361 361
     addNewWindow($db, $w);
@@ -377,7 +377,7 @@  discard block
 block discarded – undo
377 377
         if ($windownumber != 'vncwin') {
378 378
             // This is the normal case.
379 379
             // Special handling is needed when called with window=vncwin, see below.
380
-            $window = $windownumber - 1;
380
+            $window = $windownumber-1;
381 381
 
382 382
             $win_id = $db->getWindowIDBySection($windownumber);
383 383
             $windowlist = windowList();
@@ -439,7 +439,7 @@  discard block
 block discarded – undo
439 439
                 trace("+++ DELETE VNC Client FROM DAEMON +++");
440 440
                 // call via daemon: ?window=vncwin&delete=VNC&vncid=123
441 441
                 trace("vnc delete in control");
442
-                $win_id = $_REQUEST['vncid'];   // = hexWindow in database, but not on screen
442
+                $win_id = $_REQUEST['vncid']; // = hexWindow in database, but not on screen
443 443
                 trace("VNC cia Daemon ... id=$win_id");
444 444
             } elseif (strstr($delete, "http")) {
445 445
                 trace("+++ DELETE Browserwindow +++");
Please login to merge, or discard this patch.
login.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -148,7 +148,7 @@
 block discarded – undo
148 148
         $_SESSION['monitor'] = CONFIG_STATIONNAME;
149 149
         $dbcon->addUser($username, $dbcon->ipAddress(), getDevice());
150 150
 
151
-       // Weiterleitung zur geschützten Startseite
151
+        // Weiterleitung zur geschützten Startseite
152 152
         if ($_SERVER['SERVER_PROTOCOL'] == 'HTTP/1.1') {
153 153
             if (php_sapi_name() == 'cgi') {
154 154
                 header('Status: 303 See Other');
Please login to merge, or discard this patch.