@@ -329,18 +329,18 @@ discard block |
||
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 |
||
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 |
||
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 |
@@ -33,7 +33,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 +++"); |
@@ -31,7 +31,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 { |
@@ -72,18 +72,18 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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(); |