From ef04c83592f8e83ff27c570a2bd295b9d49391c9 Mon Sep 17 00:00:00 2001 From: Hash Borgir Date: Mon, 22 Mar 2021 05:39:06 -0600 Subject: [PATCH] path problem resolved on windows --- _pdo.php | 89 ---------------------------------- blenc_encode.php | 40 ---------------- blenc_myscript.php | 5 -- cookies.php | 24 ---------- download.php | 27 ----------- env-variables.php | 10 ---- error-404.php | 20 -------- error-500.php | 17 ------- execute-command.php | 42 ---------------- forms.php | 26 ---------- google.php | 8 ---- html5-video.php | 18 ------- iframe.php | 11 ----- javascript-api.php | 24 ---------- loading-error.php | 19 -------- mouse-cursor-loading.php | 11 ----- no-cache.php | 35 -------------- open-folder-in-explorer.php | 26 ---------- php-error.php | 16 ------- phpinfo.php | 6 --- popup.php | 24 ---------- pretty-urls.php | 96 ------------------------------------- request-quota.php | 26 ---------- session.php | 34 ------------- speech-recognition.php | 20 -------- sqlite.php | 45 ----------------- src/config.php | 7 +-- temp-dir.php | 29 ----------- upload.php | 58 ---------------------- 29 files changed, 4 insertions(+), 809 deletions(-) delete mode 100644 _pdo.php delete mode 100644 blenc_encode.php delete mode 100644 blenc_myscript.php delete mode 100644 cookies.php delete mode 100644 download.php delete mode 100644 env-variables.php delete mode 100644 error-404.php delete mode 100644 error-500.php delete mode 100644 execute-command.php delete mode 100644 forms.php delete mode 100644 google.php delete mode 100644 html5-video.php delete mode 100644 iframe.php delete mode 100644 javascript-api.php delete mode 100644 loading-error.php delete mode 100644 mouse-cursor-loading.php delete mode 100644 no-cache.php delete mode 100644 open-folder-in-explorer.php delete mode 100644 php-error.php delete mode 100644 phpinfo.php delete mode 100644 popup.php delete mode 100644 pretty-urls.php delete mode 100644 request-quota.php delete mode 100644 session.php delete mode 100644 speech-recognition.php delete mode 100644 sqlite.php delete mode 100644 temp-dir.php delete mode 100644 upload.php diff --git a/_pdo.php b/_pdo.php deleted file mode 100644 index 6321b6d..0000000 --- a/_pdo.php +++ /dev/null @@ -1,89 +0,0 @@ -setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING); -} -function PDO_FetchOne($query, $params=null) -{ - global $PDO; - if (isset($params)) { - $stmt = $PDO->prepare($query); - $stmt->execute($params); - } else { - $stmt = $PDO->query($query); - } - $row = $stmt->fetch(PDO::FETCH_NUM); - if ($row) { - return $row[0]; - } else { - return false; - } -} -function PDO_FetchRow($query, $params=null) -{ - global $PDO; - if (isset($params)) { - $stmt = $PDO->prepare($query); - $stmt->execute($params); - } else { - $stmt = $PDO->query($query); - } - return $stmt->fetch(PDO::FETCH_ASSOC); -} -function PDO_FetchAll($query, $params=null) -{ - global $PDO; - if (isset($params)) { - $stmt = $PDO->prepare($query); - $stmt->execute($params); - } else { - $stmt = $PDO->query($query); - } - return $stmt->fetchAll(PDO::FETCH_ASSOC); -} -function PDO_FetchAssoc($query, $params=null) -{ - global $PDO; - if (isset($params)) { - $stmt = $PDO->prepare($query); - $stmt->execute($params); - } else { - $stmt = $PDO->query($query); - } - $rows = $stmt->fetchAll(PDO::FETCH_NUM); - $assoc = array(); - foreach ($rows as $row) { - $assoc[$row[0]] = $row[1]; - } - return $assoc; -} -function PDO_Execute($query, $params=null) -{ - global $PDO; - if (isset($params)) { - $stmt = $PDO->prepare($query); - $stmt->execute($params); - return $stmt; - } else { - return $PDO->query($query); - } -} -function PDO_LastInsertId() -{ - global $PDO; - return $PDO->lastInsertId(); -} -function PDO_ErrorInfo() -{ - global $PDO; - return $PDO->errorInfo(); -} - -?> diff --git a/blenc_encode.php b/blenc_encode.php deleted file mode 100644 index 7374b54..0000000 --- a/blenc_encode.php +++ /dev/null @@ -1,40 +0,0 @@ -@import url("style.css");'); -print("Go back
"); -if (!extension_loaded("blenc")) { - $link = "https://github.com/cztomczak/phpdesktop/wiki/" . - "Source-code-protection#blenc-encoder"; - printf("ERROR: blenc extension not loaded.

- BLENC encoder is a PECL extension that permits to protect - PHP source scripts. - This extension is not distributed by default with - phpdesktop binaries. - See instructions on how to use BLENC encoder with - phpdesktop on the SourceCodeProtection wiki page:
- %s", $link, $link); - exit(); -} -$source_code = file_get_contents("blenc_myscript.php"); -// The encoded source passed to blenc_encrypt() cannot contain -// any php tags. We are removing php tags at the beginning and -// end of file. Also checking that there are no other php tag -// openings/closings. -$source_code = preg_replace('#^<'.'\?php\s+#', '', $source_code); -$source_code = preg_replace('#\s+\?'.'>\s*$#', '', $source_code); -if (preg_match('#<'.'\?#', $source_code) - || preg_match('#\?'.'>#', $source_code)) { - print("Script to be encoded can only contain PHP code."); - print(" Only a single php opening tag at the beginning of file"); - print(" and a single php closing tag at the end of file are allowed."); - print(" This is a limitation as of BENC encoder 1.1.4b."); - exit(); -} -$redist_key = blenc_encrypt($source_code, "blenc_myscript_encoded.php", - BLENC_ENCRYPTION_KEY); -$key_file = ini_get('blenc.key_file'); -file_put_contents($key_file, $redist_key); -print("DONE. See"); -print(" blenc_myscript_encoded.php"); -?> \ No newline at end of file diff --git a/blenc_myscript.php b/blenc_myscript.php deleted file mode 100644 index 222f0ba..0000000 --- a/blenc_myscript.php +++ /dev/null @@ -1,5 +0,0 @@ -@import url("style.css");'); -print("Go back
"); -print("Printing a secret string: XuXuXaaa"); -?> \ No newline at end of file diff --git a/cookies.php b/cookies.php deleted file mode 100644 index 74c43da..0000000 --- a/cookies.php +++ /dev/null @@ -1,24 +0,0 @@ - - - -Go back to index -| ">Refresh - - -

Cookies

- -

Create a random cookie

- -

Total cookies:

- -
diff --git a/download.php b/download.php deleted file mode 100644 index 1d1000a..0000000 --- a/download.php +++ /dev/null @@ -1,27 +0,0 @@ - - - -Go back to index -| ">Refresh - - -

Download

- -

You can disable ability to download files by setting -the "enable_downloads" option to false in settings.json.

- -

- Download file: - phpdesktop.txt -

diff --git a/env-variables.php b/env-variables.php deleted file mode 100644 index c2f835e..0000000 --- a/env-variables.php +++ /dev/null @@ -1,10 +0,0 @@ - -Go back to index -| ">Refresh - -Environment variables -

Environment variables

- -
-
-
\ No newline at end of file diff --git a/error-404.php b/error-404.php deleted file mode 100644 index c3667c2..0000000 --- a/error-404.php +++ /dev/null @@ -1,20 +0,0 @@ - -Go back to index -| ">Refresh - -Error 404 -

Error 404

- -

- Cick the non-existing url below. If ["web_server"]["404_handler"] - is set in settings.json file then clicking the link below - will forward you to "/pretty-urls.php/foo.html". You can then - access the "/foo.html" url using $_SERVER["PATH_INFO"] or - $_SERVER["REQUEST_URI"]. -

-

Try it: -

-

diff --git a/error-500.php b/error-500.php deleted file mode 100644 index 7ff0643..0000000 --- a/error-500.php +++ /dev/null @@ -1,17 +0,0 @@ - - - -Go back to index -| ">Refresh - -Error 500 -

Error 500

- -

- Sent header: 500 Internal Server Error.
- If you're seeing this then all is OK. -

diff --git a/execute-command.php b/execute-command.php deleted file mode 100644 index 92895b3..0000000 --- a/execute-command.php +++ /dev/null @@ -1,42 +0,0 @@ - -Go back to index -| ">Refresh - - -Execute command -

Execute command

- -
-// Execution of commands may hang on Windows XP for some programs,
-// wmic.exe is one of them. The solution is to use a command like
-// this "echo | command...". See Issue 124:
-// https://code.google.com/p/phpdesktop/issues/detail?id=124
-
-$output = shell_exec("echo | {$_ENV['SYSTEMROOT']}\System32\wbem\wmic.exe path win32_computersystemproduct get uuid");
-
-if ($output) {
-    echo "Command executed successfully.<br>";
-    echo "Output: $output";
-} else {
-    echo "Command failed.";
-}
-
- -"; - echo "Output: $output"; -} else { - echo "Command failed."; -} - -?> - diff --git a/forms.php b/forms.php deleted file mode 100644 index 067eafc..0000000 --- a/forms.php +++ /dev/null @@ -1,26 +0,0 @@ - -Go back to index -| ">Refresh - -Forms -

Forms

- -

Input

- -type=text:
-type=(empty)
-type=password:
-type=checkbox:
-type=submit:
-type=button:
- -

Textarea

- - - -

Select

- - \ No newline at end of file diff --git a/google.php b/google.php deleted file mode 100644 index 0152365..0000000 --- a/google.php +++ /dev/null @@ -1,8 +0,0 @@ - -Go back to index -| ">Refresh - -Google -

Google

- -https://www.google.com/ diff --git a/html5-video.php b/html5-video.php deleted file mode 100644 index dac31f1..0000000 --- a/html5-video.php +++ /dev/null @@ -1,18 +0,0 @@ - -Go back to index -| ">Refresh - -HTML 5 Video and accelerated content -

HTML 5 Video and accelerated content

- -

Use the "Back" option in the right mouse context menu -to go back to this page, after clicking on the links below.

- - -HTML 5 video
- - -Accelerated canvas
- - -Accelerated layers
diff --git a/iframe.php b/iframe.php deleted file mode 100644 index 17fbf7b..0000000 --- a/iframe.php +++ /dev/null @@ -1,11 +0,0 @@ - -Go back to index -| ">Refresh - -

IFrame

- -

To test whether a new option "Open frame in external browser" - appears when showing the mouse context menu.

- - diff --git a/javascript-api.php b/javascript-api.php deleted file mode 100644 index 38e7a5d..0000000 --- a/javascript-api.php +++ /dev/null @@ -1,24 +0,0 @@ - -Go back to index -| ">Refresh - -

Javascript API

- -

PHP Desktop exposes its API through the javascript "phpdesktop" -object that is binded to the window object.

- - - phpdesktop.GetVersion() - -

Get the PHP Desktop version. This value is taken from the version -info embedded in the phpdesktop executable.

- - - phpdesktop.ToggleFullscreen() - -

To go into fullscreen mode or exit fullscreen mode.

- - - phpdesktop.IsFullscreen() - -

Whether in fullscreen mode.

diff --git a/loading-error.php b/loading-error.php deleted file mode 100644 index 25a6a47..0000000 --- a/loading-error.php +++ /dev/null @@ -1,19 +0,0 @@ - -Go back to index -| ">Refresh - - -

Loading error

- -

- Try loading a non-existent url. This is an http protocol - so it will be handled by the web server: - non-existent.html -

- -

- A custom scheme loading error will be handled by Chrome: - asd://non-existent.html
- In a popup window: - asd://non-existent.html -

\ No newline at end of file diff --git a/mouse-cursor-loading.php b/mouse-cursor-loading.php deleted file mode 100644 index 7b9e14d..0000000 --- a/mouse-cursor-loading.php +++ /dev/null @@ -1,11 +0,0 @@ - - - -Go back to index -| ">Refresh - -

Mouse cursor loading

- -Testing mouse cursor indicator during long loading of a page. diff --git a/no-cache.php b/no-cache.php deleted file mode 100644 index 789a8a3..0000000 --- a/no-cache.php +++ /dev/null @@ -1,35 +0,0 @@ - - - -Go back to index -| ">Refresh - -No cache -

No cache

- -

This example uses PHP header() calls to set cache control.

- -Some random number: - - -

- Go back and forward using mouse context menu to see if this number changed, - if so the cache was disabled successfully. -

- -

- To avoid caching of static resources put some random query string - when including js/css files, see for example: -

- -
-<link href="css/style.css?r=<?php echo time(); ?>" rel="stylesheet" type="text/css" />
-
\ No newline at end of file diff --git a/open-folder-in-explorer.php b/open-folder-in-explorer.php deleted file mode 100644 index 24b6c51..0000000 --- a/open-folder-in-explorer.php +++ /dev/null @@ -1,26 +0,0 @@ - - - -Go back to index -| ">Refresh - -Open folder in Explorer -

Open folder in Explorer

- -
-$explorer = $_ENV["SYSTEMROOT"] . '\\explorer.exe';
-$folder_to_open = "C:\\Windows";
-// Using "system" function would cause a false/positive
-// by Bkav antivirus on virustotal.com. Using shell_exec
-// instead solves the issue.
-shell_exec("$explorer /n,/e,$folder_to_open");
-
diff --git a/php-error.php b/php-error.php deleted file mode 100644 index b35b615..0000000 --- a/php-error.php +++ /dev/null @@ -1,16 +0,0 @@ - -Go back to index -| ">Refresh - -PHP error -

PHP error

- -
-<?php
-echo $some;
-?>
-
- - diff --git a/phpinfo.php b/phpinfo.php deleted file mode 100644 index ad20531..0000000 --- a/phpinfo.php +++ /dev/null @@ -1,6 +0,0 @@ - -Go back to index -| ">Refresh -

- - \ No newline at end of file diff --git a/popup.php b/popup.php deleted file mode 100644 index 1ac6275..0000000 --- a/popup.php +++ /dev/null @@ -1,24 +0,0 @@ - -Go back to index -| ">Refresh - - -Popup -

Popup

- -

- When creating a window, the ["application"]["dpi_aware"] setting is taken - into account. If it's set to true, then application window will be resized - automatically using the current OS DPI settings. -

- -

- - window.open('index.php', '', 'width=800,height=600') - -

- -

-target="_blank" -

diff --git a/pretty-urls.php b/pretty-urls.php deleted file mode 100644 index c11aa4f..0000000 --- a/pretty-urls.php +++ /dev/null @@ -1,96 +0,0 @@ - -Go back to index -| ">Refresh - -Pretty urls -

Pretty urls

- -

$_SERVER

- - $v) { - if (is_array($v)) { - continue; - } - if (strpos($v, "pretty-urls.php") !== false - || strpos($v, "company") !== false - || strpos($v, "xyz") !== false - || strpos($v, "foo") !== false - || strpos($v, "bar") !== false - || $k == "REQUEST_METHOD" - || $k == "REQUEST_URI") { - $url_vars[$k] = $v; - } - } - print "
";
-    print_r($url_vars);
-    print "
"; -} -print_url_variables(); -?> - -

- Pretty urls can be handled by setting ["web_server"]["404_handler"] - option in settings.json file. This is how it works: -

-

-

- Test pretty urls: -

-

- -

- Test POST request to - -

- - -
-

- - -

POST data

-
-
-
- - -

- Other tests (these urls do not require 404_handler to be set): -

-

- - diff --git a/request-quota.php b/request-quota.php deleted file mode 100644 index f8fc22c..0000000 --- a/request-quota.php +++ /dev/null @@ -1,26 +0,0 @@ - -Go back to index -| ">Refresh - -Request quota -

Request quota

- -

Request quota for HTML 5 persistent storage.

- - - - - DoRequestQuota() diff --git a/session.php b/session.php deleted file mode 100644 index 37746b2..0000000 --- a/session.php +++ /dev/null @@ -1,34 +0,0 @@ - - - -Go back to index -| ">Refresh - -Session -

Session

- -

Temp directory:

- -

The code

-
-session_start();
-if (!isset($_SESSION['count'])) {
-    $_SESSION['count'] = 1;
-} else {
-    $_SESSION['count']++;
-}
-
- -

$_SESSION

-Refresh the page to see if counter increases. -
-
-
\ No newline at end of file diff --git a/speech-recognition.php b/speech-recognition.php deleted file mode 100644 index 384b283..0000000 --- a/speech-recognition.php +++ /dev/null @@ -1,20 +0,0 @@ - -Go back to index -| ">Refresh - - -

Speech recognition

- -You need to set the "enable-speech-input" flag in settings.json -for the speech recognition to work: - -
-"command_line_switches": {
-    "enable-speech-input": ""
-},
-
- -

After you've done that, restart application and visit this url:

- - - http://slides.html5rocks.com/#speech-input diff --git a/sqlite.php b/sqlite.php deleted file mode 100644 index 85c9d98..0000000 --- a/sqlite.php +++ /dev/null @@ -1,45 +0,0 @@ - -Go back to index -| ">Refresh - -

SQLite

- -"); -print("The database file: $db_file
"); - -$queries = <<< HTML -CREATE TABLE test (id int PRIMARY KEY, name varchar(50)); -INSERT INTO test VALUES (1, "Amelia"); -INSERT INTO test VALUES (2, "Beatrice"); -HTML; - -print("

Create table and insert exampe data

"); -print("
");
-$queries = explode(";", $queries);
-foreach ($queries as $query) {
-    $query = trim($query);
-    if (!$query) continue;
-    $stmt = @PDO_Execute($query);
-    if (!$stmt || ($stmt && $stmt->errorCode() != 0)) {
-        $error = PDO_ErrorInfo();
-        print_r($error[2]);
-        break;
-    }
-    print($query."\n");
-}
-print("
"); - -print("

Fetch data

"); -print("PDO_FetchAll('SELECT * FROM test')"); -print("
");
-$data = PDO_FetchAll("SELECT * FROM test");
-print_r($data);
-print("
"); - -?> \ No newline at end of file diff --git a/src/config.php b/src/config.php index 373cbca..c0970e3 100644 --- a/src/config.php +++ b/src/config.php @@ -3,8 +3,9 @@ if (!empty($_POST)) { // write the d2um.conf file and replace \ with \\ if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { - $path = str_replace('\\', '\\', $_POST['path']); - $path .= '\\data\\global\\excel\\'; + $path = rtrim($_POST['path'], "\\"); + $path = str_replace("\\", "\\\\", $path); + $path .= '\\\\data\\\\global\\\\excel\\\\'; file_put_contents("../d2um.conf", $path); } else { @@ -27,7 +28,7 @@ if (!empty($_POST)) {

Input path to D2 Mod Directory.

-
+ diff --git a/temp-dir.php b/temp-dir.php deleted file mode 100644 index 4812912..0000000 --- a/temp-dir.php +++ /dev/null @@ -1,29 +0,0 @@ - - - -Go back to index -| ">Refresh - - -

TMP directory

- -

-A few calls to putenv() overwrite the default directory, -call sys_get_temp_dir() to see it if was set successfully. -

- -

You can also set the temp directory using the "cgi_temp_dir" -option in the settings.json file.

- -

sys_get_temp_dir()

- -
-
-
diff --git a/upload.php b/upload.php deleted file mode 100644 index ce45316..0000000 --- a/upload.php +++ /dev/null @@ -1,58 +0,0 @@ - - - -Go back to index -| ">Refresh - -Upload -

Upload

- -

Temp directory:

- - - Max file size is set in php.ini
- Send this file: - -
- -

$_FILES

-
-
-
- - - - - -

Check the uploaded file

-
-is_file() = 
-
-is_readable() = 
-
-is_writable() = 
-
- -

Move the uploaded file

- - - - -

- The uploaded file () was moved to - the www/ directory using the move_uploaded_file() function. - See the listing of files by going to index.php -

- -

- move_uploaded_file() failed. -

- - - -