| @@ -23,7 +23,7 @@ | ||
| 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 | 
| @@ -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) { | 
| @@ -235,13 +235,13 @@ discard block | ||
| 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 | ||
| 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 | ||
| 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 | |
| @@ -111,10 +111,10 @@ | ||
| 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 | 
| @@ -54,18 +54,18 @@ | ||
| 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\">"); | 
| @@ -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 +++"); | 
| @@ -148,7 +148,7 @@ | ||
| 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'); | 
| @@ -13,10 +13,10 @@ discard block | ||
| 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 | ||
| 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 | } | 
| @@ -1391,11 +1391,11 @@ | ||
| 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 --> | 
| @@ -22,7 +22,7 @@ discard block | ||
| 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 | ||
| 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 | } | 
| @@ -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 { |