Passed
Pull Request — master (#223)
by
unknown
02:38
created
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.
db.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
     $oldJSON = $_REQUEST['json'];
23 23
     $oldJSONarr = json_decode($oldJSON, true);
24 24
     if ($oldJSONarr != null) {
25
-        array_walk_recursive($oldJSONarr, function (&$value, $key) {
25
+        array_walk_recursive($oldJSONarr, function(&$value, $key) {
26 26
             if (is_string($value) && preg_match('/^http/', $value)) {
27 27
                 $value = rawurlencode($value);
28 28
             }
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
     $database['window'] = $data;
75 75
 
76 76
     //~ $newJSON = json_encode($database, JSON_PRETTY_PRINT);
77
-    array_walk_recursive($database, function (&$value, $key) {
77
+    array_walk_recursive($database, function(&$value, $key) {
78 78
         if (is_string($value) && preg_match('/^http/', $value)) {
79 79
             $value = rawurlencode($value);
80 80
         }
Please login to merge, or discard this patch.
FileHandler.class.php 1 patch
Spacing   +7 added lines, -7 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
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
         $imageHandler = '/usr/bin/feh --scale-down';
58 58
         $webHandler = '/usr/bin/x-www-browser';
59 59
         foreach (["/usr/lib/palma", "./scripts"] as $dir) {
60
-            $palmaBrowser = $dir."/palma-browser";
60
+            $palmaBrowser = $dir . "/palma-browser";
61 61
             if (file_exists($palmaBrowser)) {
62 62
                 $webHandler = $palmaBrowser;
63 63
                 break;
@@ -69,14 +69,14 @@  discard block
 block discarded – undo
69 69
         // $params;
70 70
         // echo $ftype;
71 71
         if ($ftype === 'pdf') {
72
-            $fhandler=$pdfHandler;
72
+            $fhandler = $pdfHandler;
73 73
         } elseif ($ftype === 'gif' || $ftype === 'jpg' || $ftype === 'png') {
74
-            $fhandler=$imageHandler;
74
+            $fhandler = $imageHandler;
75 75
         } elseif ($ftype === 'html' || $ftype === 'url') {
76
-            $fhandler=$webHandler;
76
+            $fhandler = $webHandler;
77 77
         } elseif ($ftype === 'mpg' || $ftype === 'mpeg' || $ftype === 'avi' ||
78 78
                   $ftype === 'mp3' || $ftype === 'mp4' || $ftype === 'wmv') {
79
-            $fhandler=$avHandler;
79
+            $fhandler = $avHandler;
80 80
         } else {
81 81
             if ($ftype === 'doc' || $ftype === 'docx' || $ftype === 'odt' || $ftype === 'txt') {
82 82
                 $officeApp = "writer";
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 function convertOffice($inputFile, $office, $outputDir, $fileName)
115 115
 {
116 116
     shell_exec("/usr/bin/libreoffice --headless --convert-to pdf:'$office'_pdf_Export --outdir '$outputDir' '$inputFile' >/dev/null 2>&1");
117
-    $newFile=$outputDir . '/' . $fileName . '.pdf';
117
+    $newFile = $outputDir . '/' . $fileName . '.pdf';
118 118
     if (file_exists($newFile)) {
119 119
         return $newFile;
120 120
     } else {
Please login to merge, or discard this patch.
control.php 1 patch
Spacing   +7 added lines, -7 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
 }
@@ -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();
@@ -450,7 +450,7 @@  discard block
 block discarded – undo
450 450
                     trace("+++ DELETE VNC Client FROM DAEMON +++");
451 451
                     // call via daemon: ?window=vncwin&delete=VNC&vncid=123
452 452
                     trace("vnc delete in control");
453
-                    $win_id = escapeshellcmd($_REQUEST['vncid']);   // = hexWindow in database, but not on screen
453
+                    $win_id = escapeshellcmd($_REQUEST['vncid']); // = hexWindow in database, but not on screen
454 454
                     trace("VNC via Daemon ... id=$win_id");
455 455
                 } elseif (strstr($delete, "http")) {
456 456
                     trace("+++ DELETE Browserwindow +++");
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.