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..d751f4ba 100644 --- a/README.md +++ b/README.md @@ -1,55 +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. -## 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. -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/). - -**Direct Link:** -https://www.php-proxy.com/download/php-proxy.zip - -## 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 named as templates for now. - -#### /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. +# 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. 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 + )); + + } +} +?> 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 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. + +