From 354ee921f9844e7334de3ae0ecc92b02d13ee42f Mon Sep 17 00:00:00 2001 From: Benji-Collins <34997963+Benji-Collins@users.noreply.github.com> Date: Sun, 24 Jun 2018 20:43:00 +0930 Subject: [PATCH 1/7] Update url_form.php --- templates/url_form.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/templates/url_form.php b/templates/url_form.php index 11bb6617..ee119daf 100644 --- a/templates/url_form.php +++ b/templates/url_form.php @@ -10,6 +10,7 @@ top:0; left:0; width: 100%; + transition: top 0.3s; margin:0; @@ -72,6 +73,20 @@ function smart_select(ele){ +// This part makes the top bar disappear when the user scrolls down the page. It shows again when they scroll up. + + From 1afc1b4ffd212127b282ebe641db4c10ebed2724 Mon Sep 17 00:00:00 2001 From: Benji-Collins <34997963+Benji-Collins@users.noreply.github.com> Date: Sun, 24 Jun 2018 20:51:35 +0930 Subject: [PATCH 2/7] Alternate style for url_form --- templates/url_form.php | 110 ++++++++++++++++++++++++++--------------- 1 file changed, 70 insertions(+), 40 deletions(-) diff --git a/templates/url_form.php b/templates/url_form.php index ee119daf..6d68bcd4 100644 --- a/templates/url_form.php +++ b/templates/url_form.php @@ -1,11 +1,8 @@ - -
- -
- -
- - - - -
+
+
+ + -
- + + +
-// This part makes the top bar disappear when the user scrolls down the page. It shows again when they scroll up. From 86e7c49e4e7fc5b816ea1179a585d6a33eacfcf6 Mon Sep 17 00:00:00 2001 From: Benji-Collins <34997963+Benji-Collins@users.noreply.github.com> Date: Sun, 24 Jun 2018 20:54:51 +0930 Subject: [PATCH 3/7] Alternate style for main --- templates/main.php | 111 +++++++++++++++++++++++++++++++-------------- 1 file changed, 76 insertions(+), 35 deletions(-) diff --git a/templates/main.php b/templates/main.php index 40bc4735..d92e34f0 100644 --- a/templates/main.php +++ b/templates/main.php @@ -2,44 +2,88 @@ -PHP-Proxy +Sneaky Sneaky @@ -48,10 +92,10 @@ -
+
-

PHP-Proxy

+

Sneaky Sneaky

@@ -66,9 +110,9 @@ -
- - + + +
-
-
- - +
+ +
+ + + + + + + - - - +
+
+// This part makes the top bar disappear when the user scrolls down the page. It shows again when they scroll up. From 5742c3f8e26e48e952b52bf369171f1ad811b503 Mon Sep 17 00:00:00 2001 From: Benji Collins Date: Thu, 22 Nov 2018 16:11:54 +1030 Subject: [PATCH 5/7] Cleanup --- .gitignore | 3 +- README.md | 26 +----- config.php | 84 +++++++----------- index.php | 247 +++++++++++++++++++++++++---------------------------- 4 files changed, 151 insertions(+), 209 deletions(-) diff --git a/.gitignore b/.gitignore index 88e88391..2c433d6e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ /vendor/* /storage/* composer.lock -.htaccess \ No newline at end of file +.htaccess +favicon.ico diff --git a/README.md b/README.md index 82ff893f..d986167b 100644 --- a/README.md +++ b/README.md @@ -3,23 +3,6 @@ Web Proxy Application built on [**php-proxy library**](https://github.com/Athlon ![alt text](http://i.imgur.com/KrtU5KE.png?1 "This is how PHP-Proxy looks when installed") -## To Do List - -As of **March 25**, 2018: - -* Plugin for facebook.com -* Plugin for dailymotion.com -* Better support/documentation for Plugin Development -* Better Javascript support - -## Web-Proxy vs Proxy Server - -Keep in mind that sites/pages that are too script-heavy or with too many "dynamic parts", may not work with this proxy script. -That is a known limitation of web proxies. For such sites, you should use an actual proxy server to route your browser's HTTP requests through: - -https://www.proxynova.com/proxy-software/ - - ## Installation Keep in mind that this is a **project** and not a library. Installing this via *require* would do you not good. @@ -29,10 +12,7 @@ A project such as this, should be installed straight into the public directory o composer create-project athlon1600/php-proxy-app:dev-master /var/www/ ``` -If you do not have composer or trying to host this application on a **shared hosting**, then download a pre-installed version of this app as a ZIP archive from [**www.php-proxy.com**](https://www.php-proxy.com/). - -**Direct Link:** -https://www.php-proxy.com/download/php-proxy.zip +If you do not have composer or trying to host this application on a **shared hosting**, then download a pre-installed version of this app as a ZIP archive from [**www.php-proxy.com**](https://www.php-proxy.com/) ## Keep it up-to-date @@ -48,8 +28,8 @@ This file will be loaded into the global Config class. #### /templates/ -This should have been named "views", but for historic purposes we keep it named as templates for now. +This should have been named "views", but for historic purposes we keep it as templates. What this is... #### /plugins/ -PHP-Proxy provides many of its own native plugins, but users are free to write their own custom plugins, which could then be automatically loaded from this very folder. See /plugins/TestPlugin.php for an example. +PHP-Proxy has many of its native plugins, but users are free to write their own which could then be loaded from this very folder. See /plugins/TestPlugin.php for an example. diff --git a/config.php b/config.php index 018e9bc2..21d37d55 100644 --- a/config.php +++ b/config.php @@ -1,55 +1,29 @@ - '', - // CURLOPT_CONNECTTIMEOUT => 5 -); - -//$config['replace_title'] = 'Google Search'; - -//$config['error_redirect'] = "https://unblockvideos.com/#error={error_msg}"; -//$config['index_redirect'] = 'https://unblockvideos.com/'; - -// $config['replace_icon'] = 'icon_url'; - -// this better be here other Config::load fails -return $config; - -?> \ No newline at end of file + diff --git a/index.php b/index.php index 85b53871..81cfa63b 100644 --- a/index.php +++ b/index.php @@ -1,130 +1,117 @@ - Proxy::VERSION)); - } - - exit; -} - -// decode q parameter to get the real URL -$url = url_decrypt($_GET['q']); - -$proxy = new Proxy(); - -// load plugins -foreach(Config::get('plugins', array()) as $plugin){ - - $plugin_class = $plugin.'Plugin'; - - if(file_exists('./plugins/'.$plugin_class.'.php')){ - - // use user plugin from /plugins/ - require_once('./plugins/'.$plugin_class.'.php'); - - } else if(class_exists('\\Proxy\\Plugin\\'.$plugin_class)){ - - // does the native plugin from php-proxy package with such name exist? - $plugin_class = '\\Proxy\\Plugin\\'.$plugin_class; - } - - // otherwise plugin_class better be loaded already through composer.json and match namespace exactly \\Vendor\\Plugin\\SuperPlugin - $proxy->getEventDispatcher()->addSubscriber(new $plugin_class()); -} - -try { - - // request sent to index.php - $request = Request::createFromGlobals(); - - // remove all GET parameters such as ?q= - $request->get->clear(); - - // forward it to some other URL - $response = $proxy->forward($request, $url); - - // if that was a streaming response, then everything was already sent and script will be killed before it even reaches this line - $response->send(); - -} catch (Exception $ex){ - - // if the site is on server2.proxy.com then you may wish to redirect it back to proxy.com - if(Config::get("error_redirect")){ - - $url = render_string(Config::get("error_redirect"), array( - 'error_msg' => rawurlencode($ex->getMessage()) - )); - - // Cannot modify header information - headers already sent - header("HTTP/1.1 302 Found"); - header("Location: {$url}"); - - } else { - - echo render_template("./templates/main.php", array( - 'url' => $url, - 'error_msg' => $ex->getMessage(), - 'version' => Proxy::VERSION - )); - - } -} - -?> \ No newline at end of file + Proxy::VERSION)); + } + exit; +} +// decode q parameter to get the real URL +$url = url_decrypt($_GET['q']); +$proxy = new Proxy(); +// load plugins +foreach(Config::get('plugins', array()) as $plugin){ + $plugin_class = $plugin.'Plugin'; + + if(file_exists('./plugins/'.$plugin_class.'.php')){ + + // use user plugin from /plugins/ + require_once('./plugins/'.$plugin_class.'.php'); + + } else if(class_exists('\\Proxy\\Plugin\\'.$plugin_class)){ + + // does the native plugin from php-proxy package with such name exist? + $plugin_class = '\\Proxy\\Plugin\\'.$plugin_class; + } + + // otherwise plugin_class better be loaded already through composer.json and match namespace exactly \\Vendor\\Plugin\\SuperPlugin + $proxy->getEventDispatcher()->addSubscriber(new $plugin_class()); +} +try { + // request sent to index.php + $request = Request::createFromGlobals(); + + // remove all GET parameters such as ?q= + $request->get->clear(); + + // forward it to some other URL + $response = $proxy->forward($request, $url); + + // if that was a streaming response, then everything was already sent and script will be killed before it even reaches this line + $response->send(); + +} catch (Exception $ex){ + // if the site is on server2.proxy.com then you may wish to redirect it back to proxy.com + if(Config::get("error_redirect")){ + + $url = render_string(Config::get("error_redirect"), array( + 'error_msg' => rawurlencode($ex->getMessage()) + )); + + // Cannot modify header information - headers already sent + header("HTTP/1.1 302 Found"); + header("Location: {$url}"); + + } else { + + echo render_template("./templates/main.php", array( + 'url' => $url, + 'error_msg' => $ex->getMessage(), + 'version' => Proxy::VERSION + )); + + } +} +?> From 6df1e1ac7d660a3b00325851713dda6f404058b2 Mon Sep 17 00:00:00 2001 From: Benji Collins Date: Thu, 22 Nov 2018 16:12:05 +1030 Subject: [PATCH 6/7] Easy key generation --- setup.php | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 setup.php diff --git a/setup.php b/setup.php new file mode 100644 index 00000000..107e25ed --- /dev/null +++ b/setup.php @@ -0,0 +1,34 @@ + \ No newline at end of file From a3cffb24837482c0bc1ee64b62fba622c72dfde0 Mon Sep 17 00:00:00 2001 From: Benji-Collins <34997963+Benji-Collins@users.noreply.github.com> Date: Thu, 22 Nov 2018 16:16:53 +1030 Subject: [PATCH 7/7] Update README.md --- README.md | 37 +++++-------------------------------- 1 file changed, 5 insertions(+), 32 deletions(-) diff --git a/README.md b/README.md index d986167b..d751f4ba 100644 --- a/README.md +++ b/README.md @@ -1,35 +1,8 @@ # php-proxy-app -Web Proxy Application built on [**php-proxy library**](https://github.com/Athlon1600/php-proxy) ready to be installed on your server +Web Proxy Application built on [**php-proxy library**](https://github.com/Athlon1600/php-proxy) ready to be installed on your server. This is my personal fork of this project. The original can be found [here](https://github.com/Athlon1600/php-proxy-app). -![alt text](http://i.imgur.com/KrtU5KE.png?1 "This is how PHP-Proxy looks when installed") +# Installation +Using this project is simple. Simply clone the repository in to your web root folder on your server, enable SSL (I use [Certbot](https://certbot.eff.org/)) and you're ready to go. If I was you I would change the page name, title and notice before making your version live. -## Installation - -Keep in mind that this is a **project** and not a library. Installing this via *require* would do you not good. -A project such as this, should be installed straight into the public directory of your web server. - -```bash -composer create-project athlon1600/php-proxy-app:dev-master /var/www/ -``` - -If you do not have composer or trying to host this application on a **shared hosting**, then download a pre-installed version of this app as a ZIP archive from [**www.php-proxy.com**](https://www.php-proxy.com/) - -## Keep it up-to-date - -Application itself rarely will change, vast majority of changes will be done to its requirement packages like php-proxy. Simply call this command once in a while to make sure your proxy is always using the latest versions. - -``` -composer update -``` - -#### config.php - -This file will be loaded into the global Config class. - -#### /templates/ - -This should have been named "views", but for historic purposes we keep it as templates. What this is... - -#### /plugins/ - -PHP-Proxy has many of its native plugins, but users are free to write their own which could then be loaded from this very folder. See /plugins/TestPlugin.php for an example. +# Issues +If there is an issue with the design of the proxy, make an issue here. If there is an issue with the proxy itself, head on over to Athlon1600's repo. This fork is (mostly) just a reskin.