@@ -116,7 +116,7 @@ discard block |
||
| 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 |
||
| 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) { |
@@ -233,13 +233,13 @@ discard block |
||
| 233 | 233 | |
| 234 | 234 | public function getWindowState($window_id) |
| 235 | 235 | { |
| 236 | - $state = @$this->querySingle('SELECT state FROM window WHERE win_id="'.$window_id.'"'); |
|
| 236 | + $state = @$this->querySingle('SELECT state FROM window WHERE win_id="' . $window_id . '"'); |
|
| 237 | 237 | return $state; |
| 238 | 238 | } |
| 239 | 239 | |
| 240 | 240 | public function setWindowState($window_id, $state) |
| 241 | 241 | { |
| 242 | - $this->exec('UPDATE window SET state="'.$state.'" WHERE win_id="'.$window_id.'"'); |
|
| 242 | + $this->exec('UPDATE window SET state="' . $state . '" WHERE win_id="' . $window_id . '"'); |
|
| 243 | 243 | } |
| 244 | 244 | |
| 245 | 245 | public function insertWindow($window) |
@@ -257,7 +257,7 @@ discard block |
||
| 257 | 257 | |
| 258 | 258 | public function deleteWindow($window_id) |
| 259 | 259 | { |
| 260 | - $this->exec('DELETE FROM window WHERE win_id="'.$window_id.'"'); |
|
| 260 | + $this->exec('DELETE FROM window WHERE win_id="' . $window_id . '"'); |
|
| 261 | 261 | } |
| 262 | 262 | |
| 263 | 263 | /* |
@@ -268,12 +268,12 @@ discard block |
||
| 268 | 268 | |
| 269 | 269 | public function deleteDebug($table, $id, $gt) |
| 270 | 270 | { |
| 271 | - $this->exec('DELETE FROM '.$table.' WHERE '.$id.' >"'.$gt.'"'); |
|
| 271 | + $this->exec('DELETE FROM ' . $table . ' WHERE ' . $id . ' >"' . $gt . '"'); |
|
| 272 | 272 | } |
| 273 | 273 | |
| 274 | 274 | public function updateWindow($window_id, $field, $value) |
| 275 | 275 | { |
| 276 | - $this->exec('UPDATE window SET '.$field.'="'.$value.'" WHERE win_id="'.$window_id.'"'); |
|
| 276 | + $this->exec('UPDATE window SET ' . $field . '="' . $value . '" WHERE win_id="' . $window_id . '"'); |
|
| 277 | 277 | } |
| 278 | 278 | } |
| 279 | 279 | |
@@ -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 | |
| 88 | 88 | // add client |
| 89 | 89 | $this->addClient($client["ip"], $client["hostname"]); |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | } |
| 103 | 103 | } |
| 104 | 104 | |
| 105 | - $halt=$this->_CONNECTIONS; |
|
| 105 | + $halt = $this->_CONNECTIONS; |
|
| 106 | 106 | |
| 107 | 107 | if ($halt == -1) { |
| 108 | 108 | exit(0); |
@@ -121,13 +121,13 @@ discard block |
||
| 121 | 121 | $ip = ""; |
| 122 | 122 | $line = $buffer; |
| 123 | 123 | if (strpos($line, "Reverse VNC connection from IP")) { |
| 124 | - $line=trim($line); |
|
| 125 | - $item=explode(":", $line); |
|
| 126 | - $ip=trim($item[1]); |
|
| 127 | - $ip=preg_replace('/\W\W\d{4}\/\d{2}\/\d{2} \d{2}/', '', $ip); |
|
| 124 | + $line = trim($line); |
|
| 125 | + $item = explode(":", $line); |
|
| 126 | + $ip = trim($item[1]); |
|
| 127 | + $ip = preg_replace('/\W\W\d{4}\/\d{2}\/\d{2} \d{2}/', '', $ip); |
|
| 128 | 128 | } |
| 129 | 129 | |
| 130 | - if ($ip!="") { |
|
| 130 | + if ($ip != "") { |
|
| 131 | 131 | print("\nFOUND IP: " . $ip . "\n"); |
| 132 | 132 | } |
| 133 | 133 | |
@@ -139,13 +139,13 @@ discard block |
||
| 139 | 139 | $hostname = ""; |
| 140 | 140 | $line = $buffer; |
| 141 | 141 | if (strpos($line, "Hostname")) { |
| 142 | - $line=trim($line); |
|
| 143 | - $item=explode(":", $line); |
|
| 144 | - $hostname=trim($item[1]); |
|
| 145 | - $hostname=preg_replace('/\.uni\-mannheim\.de/', '', $hostname); |
|
| 142 | + $line = trim($line); |
|
| 143 | + $item = explode(":", $line); |
|
| 144 | + $hostname = trim($item[1]); |
|
| 145 | + $hostname = preg_replace('/\.uni\-mannheim\.de/', '', $hostname); |
|
| 146 | 146 | } |
| 147 | 147 | |
| 148 | - if ($hostname!="") { |
|
| 148 | + if ($hostname != "") { |
|
| 149 | 149 | print("\nFOUND HOSTNAME: " . $hostname . "\n"); |
| 150 | 150 | } |
| 151 | 151 | |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | $exit = 1; |
| 160 | 160 | } |
| 161 | 161 | |
| 162 | - if ($exit!=0) { |
|
| 162 | + if ($exit != 0) { |
|
| 163 | 163 | print("\nCLIENT HAS DISCONNECTED " . $exit . "\n"); |
| 164 | 164 | } |
| 165 | 165 | |
@@ -175,9 +175,9 @@ discard block |
||
| 175 | 175 | "exit" => 0 |
| 176 | 176 | ); |
| 177 | 177 | if (count($this->_VNC_CLIENTS) == 0) { |
| 178 | - $id=1; |
|
| 178 | + $id = 1; |
|
| 179 | 179 | } else { |
| 180 | - $id=count($this->_VNC_CLIENTS) + 1; |
|
| 180 | + $id = count($this->_VNC_CLIENTS)+1; |
|
| 181 | 181 | } |
| 182 | 182 | |
| 183 | 183 | $this->_VNC_CLIENTS[$id] = $vncclient; |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | |
| 192 | 192 | $this->_CONNECTIONS++; |
| 193 | 193 | |
| 194 | - print("\n active connections: ".$this->_CONNECTIONS+1); |
|
| 194 | + print("\n active connections: " . $this->_CONNECTIONS+1); |
|
| 195 | 195 | print("\n all saved clients: " . serialize($this->_VNC_CLIENTS)); |
| 196 | 196 | |
| 197 | 197 | } |
@@ -303,7 +303,7 @@ discard block |
||
| 303 | 303 | |
| 304 | 304 | foreach ($inactive_vnc_window_ids as $inactive_win_id) { |
| 305 | 305 | // define vnc-id |
| 306 | - $inactive_vnc_id = $db->querySingle("SELECT file FROM window WHERE win_id='".$inactive_win_id."'"); |
|
| 306 | + $inactive_vnc_id = $db->querySingle("SELECT file FROM window WHERE win_id='" . $inactive_win_id . "'"); |
|
| 307 | 307 | |
| 308 | 308 | // delete from database (send to control.php) |
| 309 | 309 | $curl = curl_init(); |
@@ -92,7 +92,7 @@ |
||
| 92 | 92 | if (is_dir($pictures)) { |
| 93 | 93 | $filelist = scandir($pictures); |
| 94 | 94 | sort($filelist, SORT_NATURAL); |
| 95 | - foreach($filelist as $file) { |
|
| 95 | + foreach ($filelist as $file) { |
|
| 96 | 96 | $picture = "$pictures/$file"; |
| 97 | 97 | if (is_file($picture)) { |
| 98 | 98 | echo("<li style=\"background-image: url('$picture'); background-repeat: no-repeat\"></li>\n"); |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | |
| 90 | 90 | // Shortcuts for combinations of controls. |
| 91 | 91 | const CURSOR = 15; // UP | DOWN | LEFT | RIGHT |
| 92 | - const ZOOM = 48; // ZOOMIN | ZOOMOUT |
|
| 92 | + const ZOOM = 48; // ZOOMIN | ZOOMOUT |
|
| 93 | 93 | const ALL = 2047; |
| 94 | 94 | |
| 95 | 95 | // up down left right zoomin zoomout home end prior next download |
@@ -108,27 +108,27 @@ discard block |
||
| 108 | 108 | // $params; |
| 109 | 109 | // echo $ftype; |
| 110 | 110 | if ($ftype === 'pdf') { |
| 111 | - $fhandler='/usr/bin/zathura'; |
|
| 111 | + $fhandler = '/usr/bin/zathura'; |
|
| 112 | 112 | |
| 113 | 113 | } elseif ($ftype === 'gif' || $ftype === 'jpg' || $ftype === 'png') { |
| 114 | - $fhandler='/usr/bin/eog'; |
|
| 114 | + $fhandler = '/usr/bin/eog'; |
|
| 115 | 115 | |
| 116 | 116 | } elseif ($ftype === 'doc' || $ftype === 'docx' || $ftype === 'odt' || $ftype === 'txt') { |
| 117 | - $fhandler='/usr/bin/libreoffice --writer -o -n --nologo --norestore --view'; |
|
| 117 | + $fhandler = '/usr/bin/libreoffice --writer -o -n --nologo --norestore --view'; |
|
| 118 | 118 | |
| 119 | 119 | } elseif ($ftype === 'ppt' || $ftype === 'pptx' || $ftype === 'pps' || $ftype === 'ppsx' || $ftype === 'odp') { |
| 120 | 120 | // optional --show (presentation mode) |
| 121 | - $fhandler='/usr/bin/libreoffice --impress -o -n --nologo --norestore --view'; |
|
| 121 | + $fhandler = '/usr/bin/libreoffice --impress -o -n --nologo --norestore --view'; |
|
| 122 | 122 | |
| 123 | 123 | } elseif ($ftype === 'xls' || $ftype === 'xlsx' || $ftype === 'ods') { |
| 124 | - $fhandler='/usr/bin/libreoffice --calc -o -n --nologo --norestore --view'; |
|
| 124 | + $fhandler = '/usr/bin/libreoffice --calc -o -n --nologo --norestore --view'; |
|
| 125 | 125 | |
| 126 | 126 | } elseif ($ftype === 'html' || $ftype === 'url') { |
| 127 | - $fhandler='/usr/bin/dwb --override-restore'; |
|
| 127 | + $fhandler = '/usr/bin/dwb --override-restore'; |
|
| 128 | 128 | |
| 129 | 129 | } elseif ($ftype === 'mpg' || $ftype === 'mpeg' || $ftype === 'avi' || |
| 130 | 130 | $ftype === 'mp3' || $ftype === 'mp4') { |
| 131 | - $fhandler='/usr/bin/cvlc --no-audio'; |
|
| 131 | + $fhandler = '/usr/bin/cvlc --no-audio'; |
|
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | /* |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | $section = $w['section']; |
| 191 | 191 | if ($section >= 1 && $section <= $maxSection && $enabled) { |
| 192 | 192 | // Show window, set size and position. |
| 193 | - $wi = $section - 1; |
|
| 193 | + $wi = $section-1; |
|
| 194 | 194 | $dx = $screenWidth / $dim[$wi][2]; |
| 195 | 195 | $dy = $screenHeight / $dim[$wi][3]; |
| 196 | 196 | $x = $dim[$wi][0] * $dx; |
@@ -325,7 +325,7 @@ discard block |
||
| 325 | 325 | if ($windownumber != 'vncwin') { |
| 326 | 326 | // This is the normal case. |
| 327 | 327 | // Special handling is needed when called with window=vncwin, see below. |
| 328 | - $window = $windownumber - 1; |
|
| 328 | + $window = $windownumber-1; |
|
| 329 | 329 | |
| 330 | 330 | $win_id = $db->getWindowIDBySection($windownumber); |
| 331 | 331 | $windowlist = windowList(); |
@@ -388,7 +388,7 @@ discard block |
||
| 388 | 388 | trace("+++ DELETE VNC Client FROM DAEMON +++"); |
| 389 | 389 | // call via daemon: ?window=vncwin&delete=VNC&vncid=123 |
| 390 | 390 | trace("vnc delete in control"); |
| 391 | - $win_id = $_REQUEST['vncid']; // = hexWindow in database, but not on screen |
|
| 391 | + $win_id = $_REQUEST['vncid']; // = hexWindow in database, but not on screen |
|
| 392 | 392 | trace("VNC cia Daemon ... id=$win_id"); |
| 393 | 393 | |
| 394 | 394 | } elseif (strstr($delete, "http")) { |