Passed
Push — master ( 545bfd...abc97e )
by Stefan
02:21
created
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.
upload.php 2 patches
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.
Switch Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -54,18 +54,18 @@
 block discarded – undo
54 54
     $f = fopen($targetFile, 'w');
55 55
     if ($f) {
56 56
         switch ($error) {
57
-            case UPLOAD_ERR_INI_SIZE:
58
-                $message = addslashes(__("This file is too large."));
59
-                break;
60
-            case UPLOAD_ERR_FORM_SIZE:
61
-                $message = addslashes(__("Large files are not supported."));
62
-                break;
63
-            case UPLOAD_ERR_PARTIAL:
64
-                $message = addslashes(__("File was only partially uploaded."));
65
-                break;
66
-            default:
67
-                $message = sprintf(addslashes(__("Error code %s.")), $error);
68
-                break;
57
+        case UPLOAD_ERR_INI_SIZE:
58
+            $message = addslashes(__("This file is too large."));
59
+            break;
60
+        case UPLOAD_ERR_FORM_SIZE:
61
+            $message = addslashes(__("Large files are not supported."));
62
+            break;
63
+        case UPLOAD_ERR_PARTIAL:
64
+            $message = addslashes(__("File was only partially uploaded."));
65
+            break;
66
+        default:
67
+            $message = sprintf(addslashes(__("Error code %s.")), $error);
68
+            break;
69 69
         }
70 70
         fprintf($f, "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\"");
71 71
         fprintf($f, "\"http://www.w3.org/TR/html4/strict.dtd\">");
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.
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.
globals.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -13,10 +13,10 @@  discard block
 block discarded – undo
13 13
 function monitor($action)
14 14
 {
15 15
     if (!defined('CONFIG_MONITOR_URL')) {
16
-      //trace('CONFIG_MONITOR_URL is undefined');
16
+        //trace('CONFIG_MONITOR_URL is undefined');
17 17
         return;
18 18
     }
19
-  //trace("monitor $action");
19
+    //trace("monitor $action");
20 20
     $ch = curl_init();
21 21
     $url = CONFIG_MONITOR_URL;
22 22
   
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
                         CURLOPT_RETURNTRANSFER => 1,
25 25
                         CURLOPT_URL => CONFIG_MONITOR_URL . '/' . CONFIG_STATIONNAME . '/' . base64_encode($action),
26 26
                         CURLOPT_USERAGENT => 'PalMA cURL Request'
27
-                               ));
27
+                                ));
28 28
     $resp = curl_exec($ch);
29 29
     curl_close($ch);
30 30
 }
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
@@ -1391,11 +1391,11 @@
 block discarded – undo
1391 1391
 
1392 1392
 <div id="footer">
1393 1393
     <?php
1394
-      # Show authorized user name (and address) and allow logout.
1394
+        # Show authorized user name (and address) and allow logout.
1395 1395
     if ($user) {
1396 1396
         echo("<a href=\"logout.php\" title=\"" .
1397
-          addslashes(__('Disconnect the current user')) .
1398
-          "\">" . addslashes(__('Log out')) . "<i class=\"fa fa-sign-out\"></i></a>");
1397
+            addslashes(__('Disconnect the current user')) .
1398
+            "\">" . addslashes(__('Log out')) . "<i class=\"fa fa-sign-out\"></i></a>");
1399 1399
     }
1400 1400
     ?>
1401 1401
 </div> <!-- Footer -->
Please login to merge, or discard this patch.
control.php 2 patches
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -331,18 +331,18 @@  discard block
 block discarded – undo
331 331
   
332 332
     require_once('FileHandler.class.php');
333 333
     list ($handler, $targetFile) =
334
-      palma\FileHandler::getFileHandler($inFile);
334
+        palma\FileHandler::getFileHandler($inFile);
335 335
     trace("file is now $targetFile, its handler is $handler");
336 336
 
337 337
     $window = array(
338
-      "id" => "",
339
-      "win_id" => "",
340
-      "name" => "",
341
-      "state" => "",
342
-      "file" => $targetFile,
343
-      "handler" => $handler,
344
-      "userid" => "",
345
-      "date" => $w['date']);
338
+        "id" => "",
339
+        "win_id" => "",
340
+        "name" => "",
341
+        "state" => "",
342
+        "file" => $targetFile,
343
+        "handler" => $handler,
344
+        "userid" => "",
345
+        "date" => $w['date']);
346 346
   
347 347
     createNewWindow($db, $window);
348 348
 }
@@ -401,7 +401,7 @@  discard block
 block discarded – undo
401 401
 
402 402
             // trying mousemove and click for better vnc control
403 403
             displayCommand("xdotool mousemove --window $windowhex 100 100 " .
404
-                       "key $key");
404
+                        "key $key");
405 405
         }
406 406
 
407 407
         if ($windowname && array_key_exists('keydown', $_REQUEST)) {
@@ -416,7 +416,7 @@  discard block
 block discarded – undo
416 416
 
417 417
             // trying mousemove and click for better vnc control
418 418
             displayCommand("xdotool mousemove --window $windowhex 100 100 " .
419
-                       "key $key");
419
+                        "key $key");
420 420
             //~ displayCommand("xdotool windowfocus $windowhex keydown $key");
421 421
         }
422 422
 
@@ -566,7 +566,7 @@  discard block
 block discarded – undo
566 566
                 "section" => "",
567 567
                 "state" => "",
568 568
                 "file" => $openURL,
569
-		"handler" => "palma-browser",
569
+        "handler" => "palma-browser",
570 570
                 "userid" => "",
571 571
                 "date" => $date
572 572
             );
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
     monitor("control.php: displayCommand $cmd");
34 34
 
35 35
     // add directories with palma-browser to PATH
36
-    $result = shell_exec('PATH=/usr/lib/palma:./scripts:$PATH '.$cmd);
36
+    $result = shell_exec('PATH=/usr/lib/palma:./scripts:$PATH ' . $cmd);
37 37
     trace("displayCommand $cmd, result=$result");
38 38
     return $result;
39 39
 }
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
     }
177 177
 
178 178
     // Make sure $layout is valid
179
-    if (!array_key_exists($layout, $geom)){
179
+    if (!array_key_exists($layout, $geom)) {
180 180
         trace("layout invalid!");
181 181
     } else {
182 182
         $db->exec("UPDATE setting SET value='$layout' WHERE key='layout'");
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
             $section = $w['section'];
206 206
             if ($section >= 1 && $section <= $maxSection && $enabled) {
207 207
                 // Show window, set size and position.
208
-                $wi = $section - 1;
208
+                $wi = $section-1;
209 209
                 $dx = $screenWidth / $dim[$wi][2];
210 210
                 $dy = $screenHeight / $dim[$wi][3];
211 211
                 $x = $dim[$wi][0] * $dx;
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
     // TODO: check how to insert the userid for all content, not just vnc.
300 300
     // Perhaps better add to array in upload.php ?
301 301
     $userid = "";
302
-    $queryid = $db->querySingle('SELECT user.userid FROM user WHERE user.name="' . $new['userid'] .'"');
302
+    $queryid = $db->querySingle('SELECT user.userid FROM user WHERE user.name="' . $new['userid'] . '"');
303 303
     if (!empty($queryid)) {
304 304
         $userid = $queryid;
305 305
     } else {
@@ -325,7 +325,7 @@  discard block
 block discarded – undo
325 325
 {
326 326
     $inFile = $w['file'];
327 327
     if (!file_exists($inFile)) {
328
-        trace("".escapeshellarg($inFile)." is not a file, aborting display");
328
+        trace("" . escapeshellarg($inFile) . " is not a file, aborting display");
329 329
         return;
330 330
     }
331 331
   
@@ -356,7 +356,7 @@  discard block
 block discarded – undo
356 356
     // TODO: use escapeshellarg() for filename.
357 357
     $filename = $w['file'];
358 358
 
359
-    $cmd = "$handler ".escapeshellarg($filename);
359
+    $cmd = "$handler " . escapeshellarg($filename);
360 360
     displayCommand("/usr/bin/nohup $cmd >/dev/null 2>&1 &");
361 361
 
362 362
     addNewWindow($db, $w);
@@ -378,7 +378,7 @@  discard block
 block discarded – undo
378 378
         if ($windownumber != 'vncwin') {
379 379
             // This is the normal case.
380 380
             // Special handling is needed when called with window=vncwin, see below.
381
-            $window = $windownumber - 1;
381
+            $window = $windownumber-1;
382 382
 
383 383
             $win_id = $db->getWindowIDBySection($windownumber);
384 384
             $windowlist = windowList();
@@ -439,7 +439,7 @@  discard block
 block discarded – undo
439 439
             $file_in_db = $db->querySingle("SELECT id FROM window WHERE file='$delete'");
440 440
             $delete = str_replace(" ", "\ ", $delete);
441 441
             trace("file in db: $file_in_db");
442
-            if ($file_in_db){
442
+            if ($file_in_db) {
443 443
                 if (file_exists($delete)) {
444 444
                     trace("+++ DELETE FILE FROM WEBINTERFACE +++");
445 445
                     unlink($delete);
@@ -447,7 +447,7 @@  discard block
 block discarded – undo
447 447
                     trace("+++ DELETE VNC Client FROM DAEMON +++");
448 448
                     // call via daemon: ?window=vncwin&delete=VNC&vncid=123
449 449
                     trace("vnc delete in control");
450
-                    $win_id = escapeshellcmd($_REQUEST['vncid']);   // = hexWindow in database, but not on screen
450
+                    $win_id = escapeshellcmd($_REQUEST['vncid']); // = hexWindow in database, but not on screen
451 451
                     trace("VNC via Daemon ... id=$win_id");
452 452
                 } elseif (strstr($delete, "http")) {
453 453
                     trace("+++ DELETE Browserwindow +++");
@@ -540,14 +540,14 @@  discard block
 block discarded – undo
540 540
 
541 541
         // If URL leads to pdf file, download it and treat as upload
542 542
         $headers = get_headers($openURL, 1);
543
-        if ($headers["Content-Type"] == "application/pdf"){
543
+        if ($headers["Content-Type"] == "application/pdf") {
544 544
             trace("url seems to lead to a pdf file, so downloading it...");
545 545
             $temp_name = basename($openURL);
546 546
             $temp_dir = "/tmp";
547 547
             file_put_contents("$temp_dir/$temp_name", file_get_contents($openURL));
548 548
             $mimetype = mime_content_type("$temp_dir/$temp_name");
549 549
             trace("mimetype is $mimetype");
550
-            if ($mimetype == "application/pdf"){
550
+            if ($mimetype == "application/pdf") {
551 551
                 $_FILES['file']['name'] = "$temp_name";
552 552
                 $_FILES['file']['tmp_name'] = "$temp_dir/$temp_name";
553 553
                 $_FILES['file']['error'] = "downloaded_from_url";
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' || $ftype === 'wmv') {
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.