athlon1600 / php-proxy Goto Github PK
View Code? Open in Web Editor NEWA web proxy script written in PHP and built as an alternative to Glype.
Home Page: https://www.php-proxy.com
License: MIT License
A web proxy script written in PHP and built as an alternative to Glype.
Home Page: https://www.php-proxy.com
License: MIT License
Hello,
I come back again with different issue 😄
203.6.148.243/proxy
when i access proquest, and springer link it said "failed to load javascript".
What cause that problems?
can it solved by this proxy?
i hope you can help me 😄
Please add to configuration CURLOPT_PROXY support.
Explanation:
I have i2p && tor onto my VPS
I have configured privoxy to route *.onion to tor and to route *.i2p to i2p
Now I just set CURLOPT_PROXY=>'127.0.01:8118' and got perfect online proxy with tor/i2p support
there is issue to play new links of youtube. please check example
https://www.youtube.com/watch?v=ijLZ9-rlEhg
this is not working in your proxy... can you please fix this..
When loading some sites like twitter, there is a content security policy error
However, on the live version (unblockvideos.com) it seems to work. (unsafe inline is not working for facebook on both live version, and my test version)
How can this be fixed.
I have a default installation of php-proxy, which includes "Cookies" plugin, but when i try to login to gmail then i get "Oops! Your browser seems to have cookies disabled. Make sure cookies are enabled or try opening a new browser window."
Is there a way to fix it?
Thanx
I do not want the remote site to be able to detect a proxy visiting the site. I want it to appear to be a browser.
I've noticed certain headers are passed on to the remote site. How can I stop the following header information being passed on?
HTTP_PHP_AUTH_USER, HTTP_PHP_AUTH_PW, HTTP_REFERER, HTTP_AUTHORIZATION
Thanks.
i would like to add new sites for my wonts.
but from the youtube code i didn't know how to exactly implement new sites
do you have any help?
I typed this URL in unblockvideos.com:
http://mangafox.me/manga/bleach/vTBD/c686/1.html
And it generates a web page with strange characters, see the screenshot:
Here are the headers:
[headers] => Proxy\Http\ParamStore Object
(
[data:protected] => Array
(
[content-type] => text/html; charset=utf-8
[content-disposition] => filename="1.html"
[cache-control] => no-cache, no-store, must-revalidate
[pragma] => no-cache
[expires] => 0
)
With Glype it works fine:
If a proxied server responses with chunked content the header misleads the browser cause the content you get by cURL is already unchunked but you still send the transfer-encoding: chunked header to the client (which now expects chunked content). You have to get the raw content from cURL or remove the transfer-encoding header.
I'm trying to run the application it won't load due to a fatal error:
PHP message: PHP Fatal error: Cannot redeclare request_from_globals() in src/helpers.php on line 6" while reading response header from upstream
Could you please help?
hi,the script is not Compatible with DailyMotion & Twitter, please check.
I get an error on every site I try and go to. (6) name lookup timed out. not sure what I need to do to fix this.
Hi,
i have trouble with a few websites.
Because there is no Access-Control-Allow-Origin Header that allow the access to cross origin resource.
has been blocked from loading by Cross-Origin Resource Sharing policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://...' is therefore not allowed access.
In the HeaderRewritePlugin.php i have set
$response->headers->set('Access-Control-Allow-Origin', '*');
$response->headers->set('Access-Control-Allow-Credentials', 'true');
$response->headers->set('Access-Control-Allow-Methods', 'GET, POST, OPTIONS');
$response->headers->set('Access-Control-Allow-Headers', 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type');
after loop to remove certain response headers...
i mean after this part:
// we need content-encoding (in case server refuses to serve it in plain text)
$forward_headers = array('content-type', 'content-length', 'accept-ranges', 'content-range', 'content-disposition', 'location', 'set-cookie');
foreach($response->headers->all() as $name => $value){
// is this one of the headers we wish to forward back to the client?
if(!in_array($name, $forward_headers)){
$response->headers->remove($name);
}
}
I put this header also at the beginning of the index.php...
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Credentials: true');
header('Access-Control-Allow-Methods: GET, POST, OPTIONS');
header('Access-Control-Allow-Headers: DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type');
When i am call a website with the proxy the header looks okay: (chrome plugin "HTTP HEADERS')
Response Headers
access-control-allow-credentials
true
access-control-allow-headers
DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type
access-control-allow-methods
GET, POST, OPTIONS
access-control-allow-origin
*
but the croos origin resource errors are still there :-/
have you got a tip for me?
I was testing a few sites and noticed that if I browse with the proxy porntube.com or baidu.com then the addressbar of the web browser is changed to the proxied website (i.e baidu.com). Looks like an anti-proxy js script or similar. Seems like if it "jumps" outside the proxy.
We already had the same error once back :)
I updated my page with your proxy and realized that It stoped working (YouTube): http://i.imgur.com/AOP3zBM.jpg
Hello!
I downloaded your script from php-proxy.com and installed it to localhost. It works OK.
But when i upload it to shared hosting, it doesn't work.
host/ and host/index.php is opening successfully. But after entering any address and pressing the button i see an error "You don't have permission to access /index.php on this server."
Just for test I tried to run index.php with q=1 parameter, it loads the page (with errors about undefined host and scheme, of course).
I am confused what could be the problem here.
When I request youtube.com from the proxy, I get a 'Error accessing resource: 429 - Too Many Requests' error. I checked that I correctly loaded in the YouTube plugin however while other sites work, youtube doesn't. I also tried changing the youtube-dl options to 'youtube-dl --force-ipv4 url' but that doesn't work. Any suggestions?
When I call a YT Site i get this error
Warning: exec() has been disabled for security reasons in /home/..../src/Plugin/YoutubePlugin.php on line 27
Warning: Invalid argument supplied for foreach() in /home/..../src/Plugin/YoutubePlugin.php on line 38
How can I repair this ?
If the HTML-Form POST value is an array if got an:
PHP Notice: Array to string conversion in /srv/www/htdocs/vendor/src/Http/Request.php on line 258
It´s within the following part of request.php:
// can be $_POST and $_FILES
public static function buildPostBody($fields, $files, $boundary = null)
{
...
foreach($fields as $name => $value){
$body .= sprintf($part_field, $boundary, $name, $value);
$body .= "{$value}\r\n";
}
One example could be:
<form action="" method="POST">
<input type="text" name="first_name">
<input type="text" name="last_name">
<input type="submit">
</form>
// Result of $_POST (PHP):
// array(
// 'first_name' => ''
// 'last_name' => ''
// )
Hi,
Dropbox and GDrive fails with the proxy. Has anyone a plugin or a fix for this sites? There are scripting errors - CORS issues because of different origins.
Some sites I have noticed redirect back to the proxy with a query parameter like so, for example if I am running the proxy here http://local.com/app_dev.php/proxy-url
Then the redirect s to
URL decoding that results in this garbage
���թmcf����ؕ��ۨ�ƣ���ҝ`tר�����թXgxUd|Y�z��ɤ��c�ߣו������^���
This only happens on certain sites and I cannot see why its happening nor find a pattern.
It load up the the http://www.google.com front page fine but when I type anything into the search bar it gives:
"405. That’s an error.
The request method POST is inappropriate for the URL /search. That’s all we know."
Hello,
I visited some website with this proxy. Some work normal, and the other has redirect loop. I've search some forum and i've no answer yet.
http://203.6.148.243/proxy/
(Proquest and Scopus link. That webpage has a redirect loop).
can you please take a look? And help me to solve this problems?
thank you
I am trying to add this to a Symfony 3 project, but it fails due the event dispatcher dep with this error
Problem 1
- Installation request for athlon1600/php-proxy ^5.0 -> satisfiable by athlon1600/php-proxy[v5.0.1].
- Conclusion: remove symfony/event-dispatcher v3.2.6
- Conclusion: don't install symfony/event-dispatcher v3.2.6
- athlon1600/php-proxy v5.0.1 requires symfony/event-dispatcher ~2.6 -> satisfiable by symfony/event-dispatcher[v2.6.0, v2.6.1, v2.6.10, v2.6.11, v2.6.12, v2.6.13, v2.6.2, v2.6.3, v2.6.4, v2.6.5, v2.6.6, v2.6.7, v2.6.8, v2.6.9, v2.7.0, v2.7.1, v2.7.10, v2.7.11, v2.7.12, v2.7.13, v2.7.14, v2.7.15, v2.7.16, v2.7.17, v2.7.18, v2.7.19, v2.7.2, v2.7.20, v2.7.21, v2.7.22, v2.7.23, v2.7.24, v2.7.25, v2.7.3, v2.7.4, v2.7.5, v2.7.6, v2.7.7, v2.7.8, v2.7.9, v2.8.0, v2.8.1, v2.8.10, v2.8.11, v2.8.12, v2.8.13, v2.8.14, v2.8.15, v2.8.16, v2.8.17, v2.8.18, v2.8.2, v2.8.3, v2.8.4, v2.8.5, v2.8.6, v2.8.7, v2.8.8, v2.8.9].
Are there any workarounds? Or plans to upgrade this requirement?
The address is just encoded with base64, and address may be logged by gateways or firewalls it passed, which may be an unexpected privacy leak.
Some firewalls now already have the function to filter the base64(or something else) content in url parameters, so it is not just a guess.
I know that we can deploy it with SSL, but it will be surely better if it is safe everywhere
The methods Event::setDispatcher(), Event::getDispatcher(), Event::setName() and Event::getName() have been removed. The event dispatcher and the event name are passed to the listener call.
Causes error like
Fatal error: Call to undefined method Proxy\Event\ProxyEvent::getName() in /home/acz13/php-proxy-app/vendor/athlon1600/php-proxy/src/Plugin/AbstractPlugin.php on line 47
Nice job man (sorry for the english) !
On your demo site https://unblockvideos.com/ I found a SSRF failure. I don't know if it is the good place to share this but if you type http://localhost/server-status you can see the problem...
Filtering requested URLs through the proxy and disable Apache mod_status from localhost could be a good idea.
And with str_rot_pass() function in https://github.com/Athlon1600/php-proxy/blob/master/src/helpers.php, an attacker could compare a plain text request with the corresponding cyphertext returned by the proxy, and retrieving secret key (by substracting each chars). With this key he can create custom queries, for example launch a port scanning on localhost. You can for example append a HTAG in the proxied URLs.
With PR #47 now baidu.com works fine, but there is a strange issue when clicking on search results.
For example, if I search for "php-proxy" and I click on the first link found, the content of the HTML page that contains two redirects (one via location.replace() and one via meta refresh) is not filtered via ProxifyPlugin. It looks like if it is ignored or if it is too early that OnCompleted() event can't catch it. See this image:
Hello
I've been testing your script and its seems when you preform a google search it returns the below
Error accessing resource: 405 - Method Not Allowed
Tested locally on my host and at https://unblockvideos.com/
So, I've installed it. Sorry, not too familiar with composer; how do I run it or such to use it?
Thanks,
rydens
Is it easy to list the prerequisites and requirements that are necessary before you can install PHP-Proxy just by a plain upload of all of the PHP files? (And maybe add this to the Readme in a future release.)
I have a host with CentOS 5.8 which comes with PHP 5.1.6 pre-installed. I assume PHP-Proxy requires at least PHP 5.3 because of the "use" lines? But actually if PHP-Proxy uses Symfony, then according to this page:
http://symfony.com/doc/current/book/installation.html
Symfony requires PHP 5.4 or higher, so I need PHP 5.4?
And do I need to install Symfony as well? The page at
http://symfony.com/doc/current/book/installation.html
actually gives instructions for "installing the Symfony installer", but I assume that's not all that's necessary in order for lines like
use Symfony\Component\HttpFoundation\Request;
to work correctly. What else would I have to do to my system in order to add the support that PHP-Proxy needs?
Have you installed it on CentOS 5.x at all? Would it be easier just to get a CentOS 6 box?
Hi,
i have a problem with a response-header-location change:
I use the HeaderRewritePlugin and change there at script-end the response-header-location [only in a given case].
The proxy continues [hourglass] and the new page is called only very much delayed [one minute]. The second time || call, the same response-header-location change happens immediately.
If I exit the response-header-location change [the HeaderRewritePlugin] with an exit you only get a blank site. [and no header location change anymore].
Can i and how can i exit the proxy call, when a file-download [and my header location change] starts?
Is there a function implement for break // exit the proxy call?
I use composer to install the proxy app and i tried to proxy this url
https://i.ytimg.com/vi/L7YrTk-Y0a0/hqdefault.jpg?sqp=-oaymwEWCMQBEG5IWvKriqkDCQgBFQAAiEIYAQ==&rs=AOn4CLCTNoPqAxat4TbMLLn0dSWb6jVrRA
I got 404 not found as an error so to dig deeper i added var_dump($options[CURLOPT_URL]);
after line
$options[CURLOPT_URL] = $this->request->getUri();
Notice that Q==
becomes Q
Hi,
I just realized that not all relative urls set correctly.
Some relative urls are then hung on the 'Proxy URL'.
For example: [call the website http://bild.de via an instance of php-proxy]
404 error => http://[proxy-url.de]/community/static/ajax/numcoms/47270604:47289584
this file must be call via http://bild.de/community/static/ajax/numcoms/47270604:47289584
Can this be because "HeaderRewritePlugin.php" explicitly asks if there is a value for header->location set and only when set sets a "proxify_url"?
HeaderRewritePlugin.php
// proxify header location value
if($response->headers->has('location')){
$location = $response->headers->get('location');
// just in case this is a relative url like: /en
$response->headers->set('location', proxify_url($location, $request_url));
}
ProxifyPlugin.php
public function onCompleted(ProxyEvent $event){
// to be used when proxifying all the relative links
$this->base_url = $event['request']->getUri();
Hello,
Is there any particular configuration for php-proxy script?
I'm installing it on my dedicated server and it doesn't work for facebook.com saying that the cookie isn't enabled. I suspect that's something to do with cookie handling on the script.
Btw:
somebody that want to install the script should be aware that the templates is using php short-tag. I need to change it to php long tag to make it work.
I have download your plugin. And configure it on my localhost and on live server as well. but when i try to visit a page url. It trim the page from the end
on your demo site it is loading fine
https://kc.unblockvideos.com/index.php?q=aHR0cDovL21wai1leHByZXNzLm9yZy9wYXBlcnMuaHRtbA
but when i load the same on my server. the html go trim
i try to debug and found something
in index.php on line 74
you are calling this method $response = $proxy->execute($request);
and i print the response. and all html was there
so after calling $response->sendHeaders(); on line 80
you called $output = $response->getContent(); on line 83
the html got trim. not sure why
can you help me with this.
thanks!
The script apparently doesn't proxy links of the form
<a href="filename.html">xyz</a>
or
<a href="/directory/filename.html">xyz</a>
so if a page contains a link in that format, the link won't be changed by the proxy (which means the link will be broken on the proxified page). The script apparently only proxifies links which begin with http://.
Example:
[Edit: Apparently the script doesn't proxify links that do begin with http:// , either. I thought the script was proxifying the link to http://www.google.com/ on my test page, but apparently not. So the title of this issue is misleading but I can't change it.]
This is the information.
Problem 1 - Conclusion: remove symfony/event-dispatcher v3.0.4 - Conclusion: don't install symfony/event-dispatcher v2.8.4 - Installation request for athlon1600/php-proxy ^3.0 -> satisfiable by athlon1600/php-proxy[3.0.0]. - Conclusion: don't install symfony/event-dispatcher v3.0.4 - athlon1600/php-proxy 3.0.0 requires symfony/event-dispatcher ~2.6 -> satisfiable by symfony/event-dispatcher[v2.6.0, v2.6.1, v2.6.10, v2.6.11, v2.6.12, v2.6.13, v2.6.2, v2.6.3, v2.6.4, v2.6.5, v2.6.6, v2.6.7, v2.6.8, v2.6.9, v2.7.0, v2.7.1, v2.7.10, v2.7.11, v2.7.2, v2.7.3, v2.7.4, v2.7.5, v2.7.6, v2.7.7, v2.7.8, v2.7.9, v2.8.0, v2.8.1, v2.8.2, v2.8.3, v2.8.4]. - Can only install one of: symfony/event-dispatcher[v2.6.10, v3.0.4]. - Can only install one of: symfony/event-dispatcher[v2.6.11, v3.0.4]. - Can only install one of: symfony/event-dispatcher[v2.6.12, v3.0.4]. - Can only install one of: symfony/event-dispatcher[v2.6.13, v3.0.4]. - Can only install one of: symfony/event-dispatcher[v2.6.7, v3.0.4]. - Can only install one of: symfony/event-dispatcher[v2.6.8, v3.0.4]. - Can only install one of: symfony/event-dispatcher[v2.6.9, v3.0.4]. - Can only install one of: symfony/event-dispatcher[v2.7.0, v3.0.4]. - Can only install one of: symfony/event-dispatcher[v2.7.1, v3.0.4]. - Can only install one of: symfony/event-dispatcher[v2.7.10, v3.0.4]. - Can only install one of: symfony/event-dispatcher[v2.7.11, v3.0.4]. - Can only install one of: symfony/event-dispatcher[v2.7.2, v3.0.4]. - Can only install one of: symfony/event-dispatcher[v2.7.3, v3.0.4]. - Can only install one of: symfony/event-dispatcher[v2.7.4, v3.0.4]. - Can only install one of: symfony/event-dispatcher[v2.7.5, v3.0.4]. - Can only install one of: symfony/event-dispatcher[v2.7.6, v3.0.4]. - Can only install one of: symfony/event-dispatcher[v2.7.7, v3.0.4]. - Can only install one of: symfony/event-dispatcher[v2.7.8, v3.0.4]. - Can only install one of: symfony/event-dispatcher[v2.7.9, v3.0.4]. - Can only install one of: symfony/event-dispatcher[v2.8.0, v3.0.4]. - Can only install one of: symfony/event-dispatcher[v2.8.1, v3.0.4]. - Can only install one of: symfony/event-dispatcher[v2.8.2, v3.0.4]. - Can only install one of: symfony/event-dispatcher[v2.8.3, v3.0.4]. - Can only install one of: symfony/event-dispatcher[v2.6.0, v3.0.4]. - Can only install one of: symfony/event-dispatcher[v2.6.1, v3.0.4]. - Can only install one of: symfony/event-dispatcher[v2.6.2, v3.0.4]. - Can only install one of: symfony/event-dispatcher[v2.6.3, v3.0.4]. - Can only install one of: symfony/event-dispatcher[v2.6.4, v3.0.4]. - Can only install one of: symfony/event-dispatcher[v2.6.5, v3.0.4]. - Can only install one of: symfony/event-dispatcher[v2.6.6, v3.0.4]. - Installation request for symfony/event-dispatcher == 3.0.4.0 -> satisfiable by symfony/event-dispatcher[v3.0.4].
In the video page of youtube such as this one: https://www.youtube.com/watch?v=GeoUELDgyM4
The images on the right of the page are not proxified, such as this one:
https://i.ytimg.com/vi/Q6dsRpVyyWs/hqdefault.jpg?custom=true&w=168&h=94&stc=true&jpg444=true&jpgq=90&sp=68&sigh=CdrLZ13uW2VKmznBKnQypFadBcI
In some places, ytimg.com
is blocked too. Then those images can't be shown.
Could you please fix it?
This malformed href= is not correctly parsed:
<a href=/1233fffdc0d1537bb0046c316ca0385c967a906f>
On Glype it is parsed correctly using this regex:
#(?><[A-Z0-9]{1,15})(?>\s+[^>\s]+)*?\s*(?>(href|src|background|poster)\s*=(?!\\\\)\s*)(?>([\\\'"])?)((?(2)(?(?<=")[^"]{1,2048}|[^\\\']{1,2048})|[^ >]{1,2048}))(?(2)\\2|)#i
Tested here: http://www.phpliveregex.com/p/j63
Hi,
I installed the "pre-installed" version of the proxy, downloaded at www.php-proxy.com/download/php-proxy.zip, on my shared hosting. I tried using it to logon to gmail.com and when I try to push the "next" button after inserting my email address, nothing happens, as if it was not submitting the form.
Is this a bug or am I missing something in my installation, like an extra plugin or something, if so, what should I install and how.
Thank you
PS: Great script BTW
When posting a file and an additional field that holds an array, the Request::buildPostBody()
function will fail as line 244 will fail.
$body .= "{$value}\r\n";
This leads to an error.
<b>Notice</b>: Array to string conversion in <b>/var/www/project/vendor/athlon1600/php-proxy/src/Http/Request.php</b> on line <b>245</b><br />
I can provide a pull request, if that helps.
The helper function are in the global namespace and generate conflicts both with project and other packages. It's generally a good practice to isolate the scopes to avoid such conflicts.
The problem I'm currently having is with mockery/mockery
and athlon1600/php-proxy
in the same project.
Including php-proxy
fails as follows:
app@0f9027110502:/var/www# php composer.phar require athlon1600/php-proxy
Using version ^4.0 for athlon1600/php-proxy
./composer.json has been updated
> php artisan clear-compiled
Loading composer repositories with package information
Updating dependencies (including require-dev)
- Installing athlon1600/php-proxy (4.0.2)
Loading from cache
athlon1600/php-proxy suggests installing predis/predis (For caching purposes)
Writing lock file
Generating autoload files
> php artisan optimize
PHP Fatal error: Cannot redeclare contains() (previously declared in /var/www/server/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest.php:104) in /var/www/server/vendor/athlon1600/php-proxy/src/helpers.php on line 16
Script php artisan optimize handling the post-update-cmd event returned with an error
Installation failed, reverting ./composer.json to its original content.
[RuntimeException]
Error Output: PHP Fatal error: Cannot redeclare contains() (previously declared in /var/www/server/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest.php:104) in /var/www/server/vendor/athlon1600/php-proxy/src/helpers.php on line 16
require [--dev] [--prefer-source] [--prefer-dist] [--no-progress] [--no-update] [--update-no-dev] [--update-with-dependencies] [--ignore-platform-reqs] [--sort-packages] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--] [<packages>]...
Note that hamcrest
in this scenario is a dependency installed by mockery
.
Hi, first of all thanks for building the proxy!
Well, I am running the latest proxy uptodate but as it says in the title it doesn't work with iPads (tested out on many) it gives me this error: http://i.imgur.com/9LuEgC4.jpg . I'm asking since my friends like your proxy more than glypes one and yours did run on an older version that I don't have anymore
I'm running it on a Raspberry Pi B+:
Link: colesinbloqueo.wtf.im/lol3/ That link is temporarly.
Thanks :3
Just installed the proxy via git clone (compuser install and composer update) on my debian 8 machine with php 5.6.5-1 installed.
When I post a URL in the "adress-bar" of the index site and then klick on GO!, my browser shows me a a white blank page. All sites are ending in this issue, even if there is nothing in the textfield.
Idea:
I have firewalld installed, which blocks all ports. Are more ports than the port 80 needed?
Webserver: Apache
Instead of doing all the checks for magnet:
or data:
inside each function on ProxifyPlugin.php
:
private function html_src($matches){
if(stripos(trim($matches[2]), 'data:') === 0){
return $matches[0];
}
return str_replace($matches[2], proxify_url($matches[2], $this->base_url), $matches[0]);
}
private function css_url($matches){
$url = trim($matches[1]);
if(stripos($url, 'data:') === 0){
return $matches[0];
}
return str_replace($matches[1], proxify_url($matches[1], $this->base_url), $matches[0]);
}
We could integrate all of them directly inside proxify_url()
function, example taken from Glype:
function proxyURL($url, $givenFlag = false) {
global $CONFIG, $options, $bitfield, $flag;
# Remove excess whitespace
$url = trim($url);
# check for binary images
if (stripos($url,'data:image')===0) {
return $url;
}
# handle javascript
if (stripos($url,'javascript:')===0 || stripos($url,'livescript:')===0) {
return '';
}
# Validate the input
if ( empty($url) || $url[0]=='#' || $url=='about:' || stripos($url,'data:')===0 || stripos($url,'file:')===0 || stripos($url,'res:')===0 || stripos($url,'C:')===0 || strpos($url, GLYPE_BROWSE)===0 ) {
return '';
}
# Extract any #anchor since we don't want to encode that
if ( $tmp = strpos($url, '#') ) {
$anchor = substr($url, $tmp);
$url = substr($url, 0, $tmp);
} else {
$anchor = '';
}
# Convert to absolute URL (if not already)
$url = absoluteURL($url);
# Add encoding
if ( $options['encodeURL'] ) {
# Part of our encoding is to remove HTTP (saves space and helps avoid detection)
$url = substr($url, 4);
# Encrypt
if ( isset($GLOBALS['unique_salt']) ) {
$url = arcfour('encrypt',$GLOBALS['unique_salt'],$url);
}
}
# Protect chars that have other meaning in URLs
$url = rawurlencode($url);
# Determine flag to use - $givenFlag is passed into function, $flag
# is global flag currently in use (used here for persisting the frame state)
$addFlag = $givenFlag ? $givenFlag : ( $flag == 'frame' ? 'frame' : '' );
# Return in path info format (only when encoding is on)
if ( $CONFIG['path_info_urls'] && $options['encodeURL'] ) {
return GLYPE_BROWSE . '/' . str_replace('%', '_', chunk_split($url, 8, '/')) . 'b' . $bitfield . '/' . ( $addFlag ? 'f' . $addFlag : '') . $anchor;
}
# Otherwise, return in 'normal' (query string) format
return GLYPE_BROWSE . '?u=' . $url . '&b=' . $bitfield . ( $addFlag ? '&f=' . $addFlag : '' ) . $anchor;
}
So then we would rewrite our functions like this (much simpler):
private function css_url($matches){
return str_replace($matches[1], proxify_url($matches[1], $this->base_url), $matches[0]);
}
private function html_src($matches){
return str_replace($matches[2], proxify_url($matches[2], $this->base_url), $matches[0]);
}
What do you think?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.