diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index bdb0cab..0000000 --- a/.gitattributes +++ /dev/null @@ -1,17 +0,0 @@ -# Auto detect text files and perform LF normalization -* text=auto - -# Custom for Visual Studio -*.cs diff=csharp - -# Standard to msysgit -*.doc diff=astextplain -*.DOC diff=astextplain -*.docx diff=astextplain -*.DOCX diff=astextplain -*.dot diff=astextplain -*.DOT diff=astextplain -*.pdf diff=astextplain -*.PDF diff=astextplain -*.rtf diff=astextplain -*.RTF diff=astextplain diff --git a/.gitignore b/.gitignore index cd2946a..1071ddb 100644 --- a/.gitignore +++ b/.gitignore @@ -1,47 +1,4 @@ -# Windows image file caches -Thumbs.db -ehthumbs.db - -# Folder config file -Desktop.ini - -# Recycle Bin used on file shares -$RECYCLE.BIN/ - -# Windows Installer files -*.cab -*.msi -*.msm -*.msp - -# Windows shortcuts -*.lnk - -# ========================= -# Operating System Files -# ========================= - -# OSX -# ========================= - -.DS_Store -.AppleDouble -.LSOverride - -# Thumbnails -._* - -# Files that might appear in the root of a volume -.DocumentRevisions-V100 -.fseventsd -.Spotlight-V100 -.TemporaryItems -.Trashes -.VolumeIcon.icns - -# Directories potentially created on remote AFP share -.AppleDB -.AppleDesktop -Network Trash Folder -Temporary Items -.apdisk +*.log +obj +bin +.vscode \ No newline at end of file diff --git a/README.md b/README.md index 7010c34..bca6729 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,65 @@ -# PHPBrowserBox Support Package +# PHPBrowserBox -PHPBrowserBox is an open source project founded by Anthony Ogundipe -in 2013 to provide a way for developing native desktop GUI applications -using web technologies such as PHP, HTML5, JavaScript, MySQL and SQLite. -It was make use of google chrome internally and have support for NODE.JS module as well. +Table of contents: -![3 ](https://user-images.githubusercontent.com/948100/221455215-802497e3-051d-415f-b109-4e3ed24b1bae.png) +- [Introduction](#introduction) +- [Installation](#installation) +- [Downloads](#downloads) +- [Support](#support) +- [Seeking sponsors](#sponsors) -Earlier versions were built with CPP, even NODE Webkit, but this latest verson as 2023 release is built on Electron JS and it actually allows you to package just HTML app alone, Apache/PHP is optional, MySQL is optional. These configurations are made so to allow for flexible. +## Introduction -![php-8 2](https://user-images.githubusercontent.com/948100/221455117-641db17a-557f-4319-8b9e-cd77da7ead03.png) +PHPBrowserBox is an open source project founded by Anthony Ogundipe in the year 2013 to provide a way for developing native desktop GUI applications using web technologies such as PHP, HTML5, JavaScript, MySQL, SQLite and Google Chrome. -It is a convenient tool for converting PHP web apps and PHP CLI tools to desktop applications with little effort. +\ +![bbwebkit](https://user-images.githubusercontent.com/948100/230798579-46094938-3ee3-4c5c-8673-98d343455043.png) -Learn more about [PHPBrowserBox Support Packages](https://github.com/dhtml/phpbrowserbox/wiki/Support-packages). +It is a an excellent software for converting web applications written with HTML/PHP web apps and PHP into desktop applications with little effort. + +In a certain sense phpbrowserbox acts differently from a PHP to EXE compiler. It embeds a web browser, a multi-threaded web server and a PHP interpreter. +All embedded into a single application, a portable folder that you can easily distribute to end users by packing it to zip archive or by making an [installer for your application](../../wiki/Knowledge-Base#application-installer). + +It has been tested with the following php versions : 5.5, 5.6, 7.0, 7.1, 7.2, 7.3, 7.4, 8.0, 8.1 and 8.2 on Windows 7, 8, 10 and Windows 11, 64 bits architecture. + +All popular PHP frameworks are supported, see the [PHP frameworks support](../../wiki/PHP-frameworks-support) wiki page. + +You can create a standalone executable for distribution with the help of the [Inno Setup installer](../../wiki/Knowledge-Base#application-installer). + +PHPBrowserBox is released under non-restrictive license, thus it is [free for commercial use](../../wiki/Knowledge-Base#can-i-use-php-desktop-in-a-commercial-closed-sourced-project). + +Lots of other useful information can be found on the +[Knowledge Base](../../wiki/Knowledge-Base) wiki page and on the +[PHPBrowserBox Website](https://phpbrowserbox.com). + +## Installation + +![bbcpanel](https://user-images.githubusercontent.com/948100/230798630-a267ef9e-411a-47ff-a5ea-ef1e14363744.png) + +#### Installation Requirements + +The minimum requirements is Windows 7 x64. + +## Downloads + +- PHPBrowserBox Binary distribution - [PHPBrowserBox latest release for Windows](https://github.com/dhtml/phpbrowserbox/releases/latest) + + +## Support + +- Documentation is on the [Wiki Pages](../../wiki). Start with the + [Knowledge Base](../../wiki/Knowledge-Base), and [Tweaks](../../wiki/Tweaks) + wiki pages. +- Ask questions and report problems on the + [PHPBrowserBox Support Page](https://web.facebook.com/phpbrowserbox) + +## Sponsors + +PHPBrowserBox is seeking companies to sponsor further development of the project. + +If your company would like to sponsor PHPBrowserBox development efforts +then please contact [Anthony](https://www.linkedin.com/in/anthonyogundipe/). + +Long term sponsorships are welcome and Anthony is open to ideas about the project. +He would love to spend more time on developing this project, but he can't afford doing so in his free time. diff --git a/app.rc b/app.rc new file mode 100644 index 0000000..3ed160e --- /dev/null +++ b/app.rc @@ -0,0 +1,59 @@ + +////////////////////////////////////////////////////////////////////////////// +// +// Archivo Manifest genérico para Windows XP/Vista +// + +#if !defined(wxUSE_NO_MANIFEST) || (wxUSE_NO_MANIFEST == 0) +#if !defined(WX_MSC_FULL_VER) || WX_MSC_FULL_VER < 140040130 + +// ver la página sobre "isolated applications" en MSDN +# +#ifdef ISOLATION_AWARE_ENABLED +#define APP_MANIFEST 2 +#else +#define APP_MANIFEST 1 +#endif + +#define RT_MANIFEST 24 + +APP_MANIFEST RT_MANIFEST phpbrowserbox.exe.Manifest + +#endif // !defined(WX_MSC_FULL_VER) || WX_MSC_FULL_VER < 140040130 +#endif // !defined(wxUSE_NO_MANIFEST) || (wxUSE_NO_MANIFEST == 0) + +#include // include for version info constants + + +A ICON "icon.ico" + + +// +// TO CHANGE VERSION INFORMATION, EDIT PROJECT OPTIONS... +// +1 VERSIONINFO +FILEVERSION 6,0,0,0 +PRODUCTVERSION 6,0 +FILETYPE VFT_APP +{ + BLOCK "StringFileInfo" + { + BLOCK "040904E4" + { + VALUE "FileDescription", "PHPBrowserBox" + VALUE "Type", "Application" + VALUE "FileVersion", "6.0.0.0" + VALUE "ProductName", "PHPBrowserBox" + VALUE "WebsiteName", "phpbrowserbox.com" + VALUE "ProductVersion", "6.0" + VALUE "LegalCopyright", "Copyright 2023 Africoders Network" + VALUE "LegalTrademarks", "Copyright 2023 Africoders Network" + VALUE "InternalName", "PHPBrowserBox" + VALUE "OriginalFilename", "phpbrowserbox.exe" + } + } + BLOCK "VarFileInfo" + { + VALUE "Translation", 0x0409, 1252 + } +} diff --git a/icon.ico b/icon.ico new file mode 100644 index 0000000..509ff1f Binary files /dev/null and b/icon.ico differ diff --git a/main.cpp b/main.cpp new file mode 100644 index 0000000..dec1676 --- /dev/null +++ b/main.cpp @@ -0,0 +1,88 @@ +#if defined(UNICODE) && !defined(_UNICODE) +#define _UNICODE +#elif defined(_UNICODE) && !defined(UNICODE) +#define UNICODE +#endif + +#include +#include +#include +#include +#include +#include +#include + +#ifdef _WIN32 +#include +// MSDN recommends against using getcwd & chdir names +#define cwd _getcwd +#define cd _chdir +#else +#include "unistd.h" +#define cwd getcwd +#define cd chdir +#endif + +#include "vcredist.h" + +using namespace std; + +void getEXEPath(char *&exePath, + const char *szFileName) +{ + // Get the last position of '/' + std::string aux(szFileName); + +// get '/' or '\\' depending on unix/mac or windows. +#if defined(_WIN32) || defined(WIN32) + int pos = aux.rfind('\\'); +#else + int pos = aux.rfind('/'); +#endif + + // Get the path and the name + std::string path = aux.substr(0, pos + 1); + + char *path_array = new char[path.length() + 1]; + strcpy(path_array, path.c_str()); + + exePath = path_array; +} + + +int WINAPI WinMain(HINSTANCE hThisInstance, + HINSTANCE hPrevInstance, + LPSTR lpszArgument, + int nCmdShow) +{ + + // get full EXEpath + TCHAR szFileName[MAX_PATH]; + GetModuleFileName(NULL, szFileName, MAX_PATH); + + /* + get basepath e.g. e:/phpbb/ + */ + char *basePath = NULL; + getEXEPath(basePath, szFileName); + + cd(basePath); + cd("bin\\bbwebkit"); + + STARTUPINFO info = { + sizeof(info)}; + PROCESS_INFORMATION processInfo; + + if (DoesVCRedistNeedUpdate()) + { + TCHAR szVcRedistPath[MAX_PATH]; + sprintf(szVcRedistPath, "%s\\bin\\vc_redist\\VC_redist.x64.exe", basePath); + UpdateVCRedist(szVcRedistPath); + } + + if(!CreateProcess("bbwebkit.exe", NULL, NULL, NULL, TRUE, 0, NULL, NULL, &info, &processInfo)) { + MessageBoxA(NULL, "Unable to launch application", "Startup Failure", MB_OK | MB_ICONERROR); + } + + return 0; +} diff --git a/phpbrowserbox.cbp b/phpbrowserbox.cbp new file mode 100644 index 0000000..aa932dc --- /dev/null +++ b/phpbrowserbox.cbp @@ -0,0 +1,72 @@ + + + + + + diff --git a/phpbrowserbox.depend b/phpbrowserbox.depend new file mode 100644 index 0000000..87e5b09 --- /dev/null +++ b/phpbrowserbox.depend @@ -0,0 +1,269 @@ +# depslib dependency file v1.0 +1679165557 source:e:\phpbb\source\phpbrowserbox\main.cpp + + + + + + + + "resource.h" + + + "funcs.h" + + + +1679165364 source:e:\phpbb\source\phpbrowserbox\app.rc + + "resource.h" + +1679165381 e:\phpbb\source\phpbrowserbox\resource.h + +1679156863 source:e:\phpbb\source\phpbrowserbox\func.cpp + + + + + + + + "resource.h" + + + "funcs.h" + + "RSJparser.tcc" + + +1679165519 e:\phpbb\source\phpbrowserbox\funcs.h + +1627987526 e:\phpbb\source\phpbrowserbox\rsjparser.tcc + + + + + + + + + + +1679178656 source:e:\php box\repo\phpbrowserboxv6.0\cpp\app.rc + + "resource.h" + +1679178640 e:\php box\repo\phpbrowserboxv6.0\cpp\resource.h + +1679178720 source:e:\php box\repo\phpbrowserboxv6.0\cpp\main.cpp + + + + + + + + "resource.h" + + + "funcs.h" + + + +1679166108 e:\php box\repo\phpbrowserboxv6.0\cpp\funcs.h + +1679181269 source:e:\php box\repo\phpbrowserboxv6.0\cpp\func.cpp + + + + + + + + "resource.h" + + + "funcs.h" + + "RSJparser.tcc" + + +1627987526 e:\php box\repo\phpbrowserboxv6.0\cpp\rsjparser.tcc + + + + + + + + + + +1679230710 source:e:\php box\repo\phpbrowserboxv6.0\core\app.rc + + "resource.h" + +1679230694 e:\php box\repo\phpbrowserboxv6.0\core\resource.h + +1679238690 source:e:\php box\repo\phpbrowserboxv6.0\core\main.cpp + + + + + + + + "resource.h" + + + "funcs.h" + + + +1679166108 e:\php box\repo\phpbrowserboxv6.0\core\funcs.h + +1679233308 source:e:\php box\repo\phpbrowserboxv6.0\core\func.cpp + + + + + + + + "resource.h" + + + "funcs.h" + + "RSJparser.tcc" + + +1627987526 e:\php box\repo\phpbrowserboxv6.0\core\rsjparser.tcc + + + + + + + + + + +1679434791 source:e:\php box\source\core\app.rc + + "resource.h" + +1679230694 e:\php box\source\core\resource.h + +1679751090 source:e:\php box\source\core\func.cpp + + + + + + + + "resource.h" + + + "funcs.h" + + + +1679745044 e:\php box\source\core\funcs.h + +1627987526 e:\php box\source\core\rsjparser.tcc + + + + + + + + + + +1679750250 source:e:\php box\source\core\main.cpp + + + + + + + + + + "resource.h" + + + + + "funcs.h" + +1680963841 source:e:\phpbrowserbo x\source\phpbrowserbox\app.rc + + +1679230694 e:\phpbrowserbo x\source\phpbrowserbox\resource.h + +1679751090 source:e:\phpbrowserbo x\source\phpbrowserbox\func.cpp + + + + + + + + "resource.h" + + + "funcs.h" + + + +1680401108 e:\phpbrowserbo x\source\phpbrowserbox\funcs.h + +1680963841 source:e:\phpbrowserbo x\source\phpbrowserbox6\app.rc + + +1680963831 source:e:\phpbrowserbo x\source\phpbrowserbox6\main.cpp + + + + + + + + + "unistd.h" + +1681123189 source:e:\phpbrowserbo x\source\phpbrowserbox\vcredist.cpp + + + + + + + + + + + + "vcredist.h" + +1681123257 e:\phpbrowserbo x\source\phpbrowserbox\vcredist.h + + + + +1681123281 source:e:\phpbrowserbo x\source\phpbrowserbox\main.cpp + + + + + + + + + "unistd.h" + "vcredist.h" + diff --git a/phpbrowserbox.exe.Manifest b/phpbrowserbox.exe.Manifest new file mode 100644 index 0000000..295b9a7 --- /dev/null +++ b/phpbrowserbox.exe.Manifest @@ -0,0 +1,18 @@ + + + +elevate execution level + + + + + + + + diff --git a/phpbrowserbox.layout b/phpbrowserbox.layout new file mode 100644 index 0000000..b8dfd65 --- /dev/null +++ b/phpbrowserbox.layout @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/vcredist.cpp b/vcredist.cpp new file mode 100644 index 0000000..a7ec7fd --- /dev/null +++ b/vcredist.cpp @@ -0,0 +1,90 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "vcredist.h" + +using namespace std; + + +// registry check +BOOL DoesVCRedistNeedUpdate() +{ + BOOL requireUpdate = true; + + CHAR message[MAX_PATH]; + CHAR requiredVal[MAX_PATH] = "14.34.31938"; + CHAR currentVal[MAX_PATH]; + + DWORD dataSize = MAXWORD; + + // Computer\HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\VisualStudio\14.0\VC\Runtimes\X64 + // Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Installer\Dependencies\Microsoft.VS.VC_RuntimeAdditionalVSU_amd64,v14 + // norm - v14.34.31938.00 + LONG result = RegGetValueA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Classes\\Installer\\Dependencies\\Microsoft.VS.VC_RuntimeAdditionalVSU_amd64,v14", "Version", RRF_RT_REG_SZ, nullptr, ¤tVal, &dataSize); + if (result != ERROR_SUCCESS) + { + requireUpdate = true; + strcpy(message, "No VCRedist Found"); + } + else + { + // compare version + std::string str_inp1(requiredVal); + std::string str_inp2(currentVal); + + int res = str_inp1.compare(str_inp2); + + if (res == 0) + { + strcpy(message, "Exact match Found"); + requireUpdate = false; + } + else if (res < 0) + { + strcpy(message, "More up to date than required"); + requireUpdate = false; + } + else + { + strcpy(message, "Not up to date at all"); + requireUpdate = true; + } + } + //cout << "VC Redistributable test : " << message << "\n"; + return requireUpdate; +} + + +void UpdateVCRedist(TCHAR path[]) +{ + STARTUPINFO info = { + sizeof(info)}; + PROCESS_INFORMATION processInfo; + + // char cmdArgs[] = "VC_redist.x64.exe /Q /norestart"; + char cmdArgs[] = "VC_redist.x64.exe /passive /norestart"; + + //MessageBoxA(NULL, szVcRedistrMessage, szVcRedistrTitle, MB_OK); + + if (CreateProcess(path, cmdArgs, NULL, NULL, TRUE, 0, NULL, NULL, &info, &processInfo)) + { + WaitForSingleObject(processInfo.hProcess, INFINITE); + CloseHandle(processInfo.hProcess); + CloseHandle(processInfo.hThread); + + //MessageBoxA(NULL, path, "Update Complete", MB_OK | MB_ICONERROR); + } + else + { + // MessageBoxA(NULL, path, "Update Failed", MB_OK | MB_ICONERROR); + } +} diff --git a/vcredist.h b/vcredist.h new file mode 100644 index 0000000..8e3c1af --- /dev/null +++ b/vcredist.h @@ -0,0 +1,8 @@ +#include +#include +#include + +using namespace std; + +BOOL DoesVCRedistNeedUpdate(); +void UpdateVCRedist(TCHAR path[]);