-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy path.gitignore
280 lines (265 loc) · 16 KB
/
.gitignore
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
<?php
clear_cache();// vire les thumbs de plus de trois minutes (THUMB_EXPIRE_DELAY)
define('REGEX_WEB','#(?<=<h3 class="r"><a href="/url\?q=)([^&]+).*?>(.*?)</a>.*?(?<=<span class="st">)(.*?)(?=</span>)#');
define('REGEX_PAGES','#&start=([0-9]+)|&start=([0-9]+)#');
define('REGEX_IMG','#(?<=imgurl=)(.*?)&imgrefurl=(.*?)&.*?h=([0-9]+)&w=([0-9]+)&sz=([0-9]+)|(?<=imgurl=)(.*?)&imgrefurl=(.*?)&.*?h=([0-9]+)&w=([0-9]+)&sz=([0-9]+)#');
define('REGEX_THMBS','#<img.*?height="([0-9]+)".*?width="([0-9]+)".*?src="([^"]+)"#');
define('TPL','<div class="result"><a href="#link"><h3 class="title">#title</h3>#link</a><p class="description">#description</p></div>');
define('TPLIMG','<div class="image" ><p><a href="#link" title="#link">#thumbs</a></p><p class="description">#W x #H (#SZ ko)<a class="source" href="#site" title="#site"> ►</a></p></div>');
define('LOGO1','<em class="g">G</em><em class="o1">o</em>');
define('LOGO2','<em class="o2">o</em><em class="g">g</em><em class="o1">o</em><em class="l">l</em>');
define('URL','https://www.google.fr/search?q=');
define('URLIMG','&tbm=isch&biw=1920&bih=1075&sei=v5ecUb6OG-2l0wW554GYBQ');
define('VERSION','v1.1');
define('LANGUAGE',lang());
define('THUMB_EXPIRE_DELAY',180);
define('RACINE','http://'.$_SERVER['SERVER_NAME']);
define('USE_GOOGLE_THUMBS',false);
// true = googol utilise les miniatures de google (c'est l'ip du visiteur que google verra mais c'est rapide et sans charge pour le servuer hébergeant googol)
// false = c'est le serveur googol qui télécharge les miniatures (ip user cachée à google, il ne verra que l'ip du serveur, mais c'est sensiblement plus lent)
if (!USE_GOOGLE_THUMBS){ // on va télécharger temporairement les miniatures pour cacher l'ip du visiteur à google
session_start();
if (!isset($_SESSION['ID'])){$_SESSION['ID']=uniqid();}
define('UNIQUE_THUMBS_PATH','thumbs/'.$_SESSION['ID']);
if (!is_dir('thumbs')){mkdir('thumbs');}// crée le dossier thumbs si nécessaire
}
$lang['fr']=array(
'previous'=>htmlentities('Page précédente', ENT_QUOTES, 'UTF-8'),
'next'=>'Page suivante',
'The thumbnails are temporarly stored in this server to hide your ip from Google...'=>htmlentities('les miniatures sont temporairement récupérées sur ce serveur, google n\'a pas votre IP...', ENT_QUOTES, 'UTF-8'),
'Search anonymously on Google (direct links, fake referer)'=>htmlentities('Rechercher anonymement sur Google (liens directs et referrer caché)', ENT_QUOTES, 'UTF-8'),
'Free and open source (please keep a link to warriordudimanche.net for the author ^^)'=>htmlentities('Libre et open source, merci de laisser un lien vers warriordudimanche.net pour citer l\'auteur ;)', ENT_QUOTES, 'UTF-8'),
'Googol - google without lies'=>'Googol - google sans mensonge',
'on GitHub'=>'sur GitHub',
'no results'=>htmlentities('pas de résultat', ENT_QUOTES, 'UTF-8'),
'by'=>'par',
'search '=>'recherche ',
'Search'=>'Rechercher',
);
function aff($a,$stop=true){echo 'Arret a la ligne '.__LINE__.' du fichier '.__FILE__.'<pre>';var_dump($a);echo '</pre>';if ($stop){exit();}}
function msg($m){global $lang;if(isset($lang[LANGUAGE][$m])){return $lang[LANGUAGE][$m];}else{return $m;}}
function lang($default='fr'){if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){$l=explode(',',$_SERVER['HTTP_ACCEPT_LANGUAGE']);return substr($l[0],0,2);}else{return $default;}}
function Random_referer(){
$rr=array(
'http://oudanstoncul.com.free.fr/',
'http://googlearretedenousfliquer.fr/',
'http://stopspyingme.fr/',
'http://spyyourassfuckinggoogle.fr/',
'http://dontfuckinglookatme.fr/',
'http://matemonculgoogle.fr/',
'http://auxarmescitoyens.fr/',
'http://jetlametsavecdugravier.con/',
'http://lesdeuxpiedsdanstagueule.fr/',
'http://moncoudedanstabouche.con/',
'http://monpieddanston.uk/',
'http://bienfaitpourvosgueul.es/',
'http://pandanstesdents.fr/',
'http://tupuessouslesbras.fr/',
);
shuffle($rr);
return $rr[0];
}
function file_curl_contents($url){
$ch = curl_init();
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, $url);
if (!ini_get("safe_mode") && !ini_get('open_basedir') ) {curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);}
curl_setopt($ch, CURLOPT_MAXREDIRS, 10);
curl_setopt($ch, CURLOPT_REFERER, random_referer());// notez le referer "custom"
$data = curl_exec($ch);
curl_close($ch);
return $data;
}
function add_search_engine(){
if(!is_file('googol.xml')){
file_put_contents('googol.xml', '<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/"
xmlns:moz="http://www.mozilla.org/2006/browser/search/">
<ShortName>Googole</ShortName>
<Description>'.msg('Googol - google without lies').'</Description>
<InputEncoding>UTF-8</InputEncoding>
<Image width="32" height="32">data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAABCFJREFUeNrEV21MW2UUfm7v7QcwWqj9YBQyEAdqwBGGY3xkQRlLRjLnsmnUOOOSJYsmxvhDo/7VRH+YaPxhYqLRiAkuccbh5jbFRZgR3IbpwphG0wxaSgOUXgot7W177/V9L/DDrLv3bcK2kzy97e15zz3vOc85573c4bfOY112ruNuyATBKP0iQNVufETwKu6ufElwTFBVtf0ePJzKiwQniQNoLmRVYyUHT5kNT3f7YLbatHtkE4gvr+LsWATT82kEoszm2gVFVZk0K+0qnulwoM7nAG82gxfM2n2OM5HfAjzeYhw76EIuk8HV6zP4engBYoozMmuhKTB8eJ0LeHlvGc74VzHwexyz8f//73NweNBnRU9rJWq3VaBzVwNqKkrwdv9NpHP6Thg6QHfe12TDO6dFiKv5dWaWVIIUhiYDeK4rhid7m+D2utDkm8blKUXXvommQA9HO4rw1Wgai0l9vQ2cGotBSiaQTafwz5xsqC+oOg4+QEIfJrtbTLCTtLyIQyqxjIGLIaZ1gqLcPgVVTko2CxQlxexAx3YbRv4M46cJtjW6HOA4DntaqiApPC5eEzEj6uezs94Kj8OCjy8sMTusG4EbYYlEQMChfU040C1BzmZJzed3wmTiwfE8hq8GYeVFpLKsDuiQIBgDBkcCOLyvEcX2MvC8QMNyW31VUdDbaSNlCbzRH2JMgaJfhv3DIubFcRx5rAZljhItLXkjQJyzFhVrTcphL4aRXaYUbMg5f5Jg0lDv2T0ezdFvfw1CYXaAsRWziN2SwXdDf+FHf2JzSJhPdtaYsbvBjrb6LWuVQsgXislaCn6biOLMeLwge0yzYENe6fPi8UercWUygte+CCK6osBVasKJ/T50tdaiurIcgYifVE+W2aaJMpcFT7U7sL/7ISQlBR9+P4OFeE67T6/vfjONqdA8vF433jvRgupyDqx2TQr5MIKzBDja97A2/3+4NIVEWr5FZ+DnAGQ5h1KnG4c6PGCxS2Gi5WKEtu0lsG0p1UK2nJDy6oz9TQaQlNac7GmrAYtdCiYOVDhthGQ8NnTzrUlKZLqRCNA+QQl5H+FodEVlaUSKoVIimdUeSjshdUZvjSzLWIonCTdkRhISw0b4N5wgRy0JJjIXdjVuzatTZFnrhlkphV/+mAaLXQqmKrgeTCOysKql4f7areh5xH6LTm9zuTaQZkNhnBqZZa4C3U74wfNubKtyacSyWbNYic5rUXj9hRZymhnHkH9t7O7d4cDxJ+oRCUfw5qfXMLcsM/cBrvnIZy+R6yesCw7udqK1wY0ddXbkshJlJObEDM5dmcPg5aVCu/f7AgqcBadHFzVslhTUiu+AZOh54OY9dOAGLcPzBJ+zls0m4izBSXLG0lJwnL4oEnTRxneHdx1bfzUfpD/+E2AAqmeV253DYKAAAAAASUVORK5CYII=</Image>
<Url type="text/html" method="get" template="'.RACINE.'">
<Param name="q" value="{searchTerms}"/>
</Url>
<moz:SearchForm>'.RACINE.'</moz:SearchForm>
</OpenSearchDescription>');
}
}
function parse_query($query,$start=0,$img=false){
if (!$img){ // web
$page=file_curl_contents(URL.str_replace(' ','+',$query).'&start='.$start);
if (!$page){return false;}
preg_match_all(REGEX_WEB, $page, $r);
preg_match_all(REGEX_PAGES,$page,$p);
$p=count($p[2]);
$retour=array(
'links'=>$r[1],
'titles'=>$r[2],
'descriptions'=>$r[3],
'nb_pages'=>$p,
'current_page'=>$start,
'query'=>htmlentities($query)
);
return $retour;
}else{ //images
$page=file_curl_contents(URL.str_replace(' ','+',$query).URLIMG.'&start='.$start);
if (!$page){return false;}
preg_match_all(REGEX_IMG,$page,$r);
preg_match_all(REGEX_PAGES,$page,$p);
preg_match_all(REGEX_THMBS,$page,$t);
$p=count($p[2]);
$retour=array(
'site'=>$r[2],
'links'=>$r[1],
'h'=>$r[3],
'w'=>$r[4],
'sz'=>$r[5],
'thumbs'=>$t[3],
'thumbs_w'=>$t[2],
'thumbs_h'=>$t[1],
'nb_pages'=>$p,
'current_page'=>$start,
'query'=>htmlentities($query)
);
return $retour;
}
}
function render_query($array){
global $start;
if (!is_array($array)||count($array)==0){return false;}
if (!isset($array['sz'][0])){
foreach ($array['links'] as $nb => $link){
$r=str_replace('#link',$link,TPL);
$r=str_replace('#title',$array['titles'][$nb],$r);
$d=str_replace('<br>','',$array['descriptions'][$nb]);
$d=str_replace('<br/>','',$d);
$r=str_replace('#description',$d,$r);
echo $r;
}
$img='';
}else{
foreach ($array['links'] as $nb => $link){
$r=str_replace('#link',$link,TPLIMG);
$r=str_replace('#SZ',$array['sz'][$nb],$r);
$r=str_replace('#H',$array['h'][$nb],$r);
$r=str_replace('#W',$array['w'][$nb],$r);
$r=str_replace('#site',$array['site'][$nb],$r);
if (!USE_GOOGLE_THUMBS){
$repl='<img src="'.grab_google_thumb($array['thumbs'][$nb]).'" width="'.$array['thumbs_w'][$nb].'" height="'.$array['thumbs_h'][$nb].'"/>';
}else if (USE_GOOGLE_THUMBS){
$repl='<img src="'.$array['thumbs'][$nb].'" width="'.$array['thumbs_w'][$nb].'" height="'.$array['thumbs_h'][$nb].'"/>';
}
$r=str_replace('#thumbs',$repl,$r);
$r=str_replace('#thumbs_h',$array['thumbs_h'][$nb],$r);
$r=str_replace('#thumbs_w',$array['thumbs_w'][$nb],$r);
echo $r;
}
$img='&img';
}
if($array['nb_pages'] != 0){
echo '<hr/><p class="footerlogo">'.LOGO1.str_repeat('<em class="o2">o</em>', $array['nb_pages']-1).LOGO2.'</p><div class="pagination">';
}
else{
echo '<div class="noresult"> '.msg('no results').' </div>';
}
if ($start>0){echo '<a class="previous" title="'.msg('previous').'" href="?q='.urlencode($array['query']).$img.'&start='.($start-10).'">◄</a>';}
for ($i=0;$i<$array['nb_pages']-1;$i++){
if ($i*10==$array['current_page']){echo '<em>'.($i+1).'</em>';}
else{echo '<a href="?q='.urlencode($array['query']).$img.'&start='.$i.'0">'.($i+1).'</a>';}
}
if ($start<($array['nb_pages']-2)*10){echo '<a class="next" title="'.msg('next').'" href="?q='.urlencode($array['query']).$img.'&start='.($start+10).'">►</a>';}
echo '</div>';
}
function grab_google_thumb($link){
if ($thumb=file_curl_contents($link)){
$local='thumbs/'.str_replace(array('?','/',':'),'',$link).'.jpg';
if (!is_file($local)){file_put_contents($local,$thumb);}
return $local;
}else{aff(2);
return $link;
}
}
function clear_cache(){$fs=glob('thumbs/*'); if(!empty($fs)){foreach ($fs as $file){if (@date('U')-@date(filemtime($file))>THUMB_EXPIRE_DELAY){unlink ($file);}}}}
// Gestion GET
if (isset($_GET['img'])){$img=true;}else{$img=false;}
if (isset($_GET['start'])){$start=$_GET['start'];}else{$start='';}
if (isset($_GET['q'])){$q=$_GET['q'];$title='Googol '.msg('search ').htmlentities($q);}else{$q='';$title=msg('Googol - google without lies');}
?>
<!DOCTYPE html>
<html dir="ltr" lang="fr">
<head>
<title><?php echo $title; ?> </title>
<style>
*{-webkit-box-sizing: border-box;-moz-box-sizing: border-box;box-sizing: border-box;}
body{padding:0;margin:0;}
aside{padding:0 25px 100px;}
a {text-decoration: none; }
hr{border:none;border-top:1px solid #aaa;}
form{margin-bottom:20px;padding:0;line-height:20px;}
header{text-align:center;width:auto;background-color:#eee;padding-bottom:20px;padding-top:30px;border-bottom:1px solid #ddd;}
header em{font-size:80px;font-style: normal;text-shadow:0 1px 2px #555;-webkit-touch-callout: none; -webkit-user-select: none; -khtml-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none;}
em.g{color:blue;}em.o1{color:red;}em.o2{color:orange;}em.l{color:green;}
header .mini{font-size:14px;padding:0 0 0 220px;margin:0;margin-top:-15px;text-shadow:0 0 3px red;}
header .msg{font-size:16px;color:#444;font-style:italic }
nav{padding-left:35px;background-color:white;border-bottom:1px solid #ccc;}
nav li{border-bottom:4px solid transparent;background-color:white; display:inline-block;list-style:none;width:100px;height:30px;font-size:18px;font-family: arial, sans-serif;text-align: center;}
nav li.active{color:red;font-weight: bold;border-bottom:4px solid red;}
nav li a{color:#666;}
nav li a:hover{color:#111;}
input[type=text]{font-size:16px;height:30px;width:30%;min-width:200px;border-radius: 3px; padding:3px;border:1px solid #ccc;box-shadow: inset 0 1px 2px #ddd}
input[type=text]:hover{border-color:#aaa;}
input[type=submit]{height:30px;width:40px;font-size:14px;background-color:#4a8cf7;border:1px solid #397be6;border-radius: 3px;color:#eee; box-shadow: 0 1px 2px #397be6}
input[type=submit]:hover{background-color:#397be6;border-color:#286ad5 }
input[type=submit]:active{background-color:#397be6;border-color:transparent;border-top:2px solid transparent;box-shadow: 0 0px 1px #397be6;}
.result{padding:0 10px ;margin:0;font-family:arial, sans-serif;border-radius:3px;word-wrap:break-word;overflow-wrap: break-word;-webkit-hyphens:auto;-moz-hyphens:auto;-ms-hyphens:auto;}
.result:hover,.image:hover{background-color:#EEE;}
.result a {color:#0B0;}
.result h3 {text-decoration: underline; color:#00B!important;}
.result .title{margin-bottom:0;}
.result .description{margin-top:3px;}
.image{display:inline-block;padding:5px; margin:5px;text-align: center;border-radius:3px;}
.image p{margin:0;padding: 0;}
.image .description{font-size: 12px;}
.image img{border:1px solid transparent;border-radius: 4px; box-shadow: 0 1px 2px #555}
.image img:hover{border:1px solid #333;}
.pagination{font-size:18px!important;text-align:center;width:auto;padding-top:5px;}
.pagination a{text-decoration: none;padding:5px;border-radius: 4px;display:inline-block;}
.pagination a:hover{background-color:#DDD;}
.pagination em{padding:5px;background-color:#CCC;border-radius: 4px;display:inline-block;}
.pagination .next,.pagination .previous{display:inline-block;width: 50px;}
.footerlogo{text-align:center;padding:0;margin:0;font-size:22px;font-weight:bold;user-select: none;-webkit-user-select: none;}
.footerlogo em{font-style: normal;display:inline-block;}
footer{position:fixed;bottom:0;left:0;right:0;height:auto;min-height:40px;border-top:solid 1px #ddd;margin-top:30px;background-color:#EEE;text-align: right;color:#555;line-height: 30px;padding-right:10px;padding-bottom:5px;}
footer a{color:#444;font-weight: bold;}
footer img{vertical-align: middle}
.noresult{text-align:center;margin-top:5px;}
</style>
<?php if (is_file('favicon.png')){echo '<link rel="shortcut icon" href="favicon.png" /> ';}?>
<link rel="search" type="application/opensearchdescription+xml" title="<?php echo msg('Googol - google without lies'); ?>" href="<?php echo RACINE;?>googol.xml">
<!--[if IE]><script> document.createElement("article");document.createElement("aside");document.createElement("section");document.createElement("footer");</script> <![endif]-->
</head>
<body>
<header>
<?php echo LOGO1.LOGO2; ?>
<p class="mini"><?php echo htmlentities(VERSION); ?></p><p class="msg"><?php echo msg('Search anonymously on Google (direct links, fake referer)'); if ($img){echo '<br/>'.msg('The thumbnails are temporarly stored in this server to hide your ip from Google...');} ?> </p>
<form action="" method="get" >
<input type="text" name="q" placeholder="<?php echo msg('Search'); ?>" value="<?php echo htmlentities($q); ?>"/><input type="submit" value="OK"/>
<?php if ($img){echo '<input type="hidden" name="img"/>';}?>
</form>
</header>
<nav>
<?php
if (!$img){echo '<li class="active">Web</li><li><a href="?q='.htmlentities($q).'&img">Images</a></li>';}
else{echo '<li><a href="?q='.htmlentities($q).'">Web</a></li><li class="active">Images</li>';}
?>
</nav>
<aside>
<?php if ($q!=''){render_query(parse_query($q,$start,$img));} ?>
</aside>
<footer><a href="<?php echo RACINE;?>">Googol</a> <?php echo msg('by');?> <a href="http://warriordudimanche.net">Bronco - warriordudimanche.net</a> <a href="#" title="<?php echo msg('Free and open source (please keep a link to warriordudimanche.net for the author ^^)');?>"><em>Licence</em></a> <a href="https://github.com/broncowdd/googol" title="<?php echo msg('on GitHub');?>"><img width="32" src="github.png" alt="logoGH"/></a> <a href="http://flattr.com/thing/1319925/broncowddSnippetVamp-on-GitHub" target="_blank"><img src="http://images.warriordudimanche.net/flattr.png" alt="Flattr this" title="Flattr this" border="0" /></a></footer>
<script type="text/javascript" src="http://api.mywot.com/widgets/ratings.js"></script>
</body>
</html>
<?php add_search_engine(); ?>