1 | <?php |
---|
2 | // +-----------------------------------------------------------------------+ |
---|
3 | // | Piwigo - a PHP based picture gallery | |
---|
4 | // +-----------------------------------------------------------------------+ |
---|
5 | // | Copyright(C) 2008-2009 Piwigo Team http://piwigo.org | |
---|
6 | // | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net | |
---|
7 | // | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick | |
---|
8 | // +-----------------------------------------------------------------------+ |
---|
9 | // | This program is free software; you can redistribute it and/or modify | |
---|
10 | // | it under the terms of the GNU General Public License as published by | |
---|
11 | // | the Free Software Foundation | |
---|
12 | // | | |
---|
13 | // | This program is distributed in the hope that it will be useful, but | |
---|
14 | // | WITHOUT ANY WARRANTY; without even the implied warranty of | |
---|
15 | // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
---|
16 | // | General Public License for more details. | |
---|
17 | // | | |
---|
18 | // | You should have received a copy of the GNU General Public License | |
---|
19 | // | along with this program; if not, write to the Free Software | |
---|
20 | // | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, | |
---|
21 | // | USA. | |
---|
22 | // +-----------------------------------------------------------------------+ |
---|
23 | |
---|
24 | if (!defined('PHPWG_ROOT_PATH')) |
---|
25 | { |
---|
26 | die('Hacking attempt!'); |
---|
27 | } |
---|
28 | |
---|
29 | if (!defined('MAIL_SUPERV_PATH')) define('MAIL_SUPERV_PATH' , PHPWG_PLUGINS_PATH.basename(dirname(__FILE__)).'/'); |
---|
30 | |
---|
31 | define ("check_mailto", 0); |
---|
32 | define ("check_header_carbon",1); |
---|
33 | define ("check_header_text",2); |
---|
34 | define ("no_mail_list", 3); |
---|
35 | define ("no_connect",4); // empeche l'ip de se connecter au site. |
---|
36 | define ("set_auto",5); // Test a l'ouverture et enregistrement |
---|
37 | define ("ip",6); // dernirre adresse IP |
---|
38 | define ("set_id",7); // enregistrment nouvel |
---|
39 | |
---|
40 | |
---|
41 | if (!isset($_COOKIE[session_name()])) |
---|
42 | { |
---|
43 | |
---|
44 | |
---|
45 | |
---|
46 | } |
---|
47 | include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php'); |
---|
48 | include_once(PHPWG_ROOT_PATH.'include/functions.inc.php'); |
---|
49 | include_once(PHPWG_ROOT_PATH.'admin/include/functions.php'); |
---|
50 | global $lang ; |
---|
51 | |
---|
52 | include_once (MAIL_SUPERV_PATH.'include/function_test_send.php'); |
---|
53 | load_language('plugin.lang', MAIL_SUPERV_PATH); |
---|
54 | global $superv_champs , $superv_type ,$superv_bl_champs , $superv_bl_type ; |
---|
55 | |
---|
56 | //========================================================== |
---|
57 | function sauve_options() |
---|
58 | { |
---|
59 | global $mails_options ; |
---|
60 | if ( isset($mails_options) ) |
---|
61 | { |
---|
62 | |
---|
63 | while ( count($mails_options) < 10 ) |
---|
64 | { |
---|
65 | |
---|
66 | $mails_options[]='?'; |
---|
67 | } |
---|
68 | |
---|
69 | $valeurs = implode( ',',$mails_options); |
---|
70 | |
---|
71 | |
---|
72 | $query = ' |
---|
73 | UPDATE '.CONFIG_TABLE.' |
---|
74 | SET value="'. $valeurs . '" |
---|
75 | WHERE param = "mail_superv" |
---|
76 | LIMIT 1'; |
---|
77 | pwg_query($query); |
---|
78 | |
---|
79 | } |
---|
80 | } |
---|
81 | //================================================================================= |
---|
82 | function sauve_donnees() |
---|
83 | { |
---|
84 | |
---|
85 | global $mails_donnees,$superv_champs,$superv_type,$erreur_message ; |
---|
86 | //===================================================================== |
---|
87 | $clefs = $superv_champs ; |
---|
88 | $valeurs = array(); |
---|
89 | |
---|
90 | foreach ( $clefs as $champ) |
---|
91 | { |
---|
92 | $champ = trim($champ); |
---|
93 | |
---|
94 | if ( isset($mails_donnees[ $champ ]) ) { |
---|
95 | $sep= (is_string($mails_donnees[ $champ ])) ? '"' : '' ; |
---|
96 | array_push($valeurs , "`".$champ."`" . ' = ' . $sep . $mails_donnees[ $champ ] . $sep) ; |
---|
97 | }else{ |
---|
98 | |
---|
99 | array_push($valeurs , "`".$champ."`" . ' = ' . "0" ) ; |
---|
100 | } |
---|
101 | |
---|
102 | } |
---|
103 | $valeurs = implode(", ",$valeurs) ; |
---|
104 | //===================================================================== |
---|
105 | $query = ' |
---|
106 | UPDATE '.MAIL_SUPERV_TABLE.' |
---|
107 | SET '. $valeurs .' |
---|
108 | WHERE `id` = 1 LIMIT 1 '; |
---|
109 | ; |
---|
110 | ob_start(); |
---|
111 | $ret= pwg_query($query) ; |
---|
112 | $m= ob_get_contents(); |
---|
113 | ob_end_clean() ; |
---|
114 | $erreur_message .= $m ; |
---|
115 | |
---|
116 | } |
---|
117 | |
---|
118 | //================================================================================= |
---|
119 | function affiche_message() |
---|
120 | { |
---|
121 | global $template,$infos_message,$erreur_message, $user ,$ip; |
---|
122 | |
---|
123 | global $mails_options,$conf,$lang ; |
---|
124 | |
---|
125 | $mails_options = explode("," , $conf['mail_superv']); |
---|
126 | if (!isset($ip)) { |
---|
127 | if (getenv("HTTP_CLIENT_IP")) |
---|
128 | { $ip=getenv("HTTP_CLIENT_IP"); } |
---|
129 | else{ $ip=getenv("REMOTE_ADDR"); } |
---|
130 | } |
---|
131 | // unset ($_SESSION['pwg_'.'action_spam']); |
---|
132 | $action_spam = pwg_get_session_var('action_spam') ; |
---|
133 | if ($action_spam == null) { $action_spam = kill_list(); } |
---|
134 | |
---|
135 | if (is_bool($action_spam)) $action_spam =($action_spam == true) ? "true" : "false" ; |
---|
136 | if ($action_spam == "true" ) |
---|
137 | { |
---|
138 | $erreur_message = $ip . " " . $action_spam ; |
---|
139 | pwg_set_session_var('action_spam', "true"); |
---|
140 | $erreur_message .= "<BR />".l10n('Sv_is_a_spam') ; |
---|
141 | if ($mails_options[no_connect] == 'on' ){ |
---|
142 | //[status] => guest |
---|
143 | //[status] => normal |
---|
144 | //[status] => webmaster |
---|
145 | if ($user['status'] != 'webmaster' ) |
---|
146 | if (!isset($_GET['admin'])) { |
---|
147 | die('Blacklist : <br />' .$erreur_message. '<br /> Hacking attempt!'); |
---|
148 | }elseif ($_GET['admin'] != 'piwigo') |
---|
149 | { |
---|
150 | die('blacklist Hacking attempt!'); |
---|
151 | } |
---|
152 | unset ($_SESSION['pwg_'.'action_spam']); |
---|
153 | } |
---|
154 | }else{ |
---|
155 | pwg_set_session_var('action_spam', "false"); |
---|
156 | } |
---|
157 | |
---|
158 | |
---|
159 | // } |
---|
160 | |
---|
161 | //============================================================== |
---|
162 | if (isset($erreur_message)) |
---|
163 | { |
---|
164 | |
---|
165 | if ($erreur_message <> "") |
---|
166 | { |
---|
167 | $erreur_message = str_replace("\n",'<br />',$erreur_message) ; |
---|
168 | $template->assign('errors',$erreur_message); |
---|
169 | $erreur_message = ""; |
---|
170 | } |
---|
171 | } |
---|
172 | |
---|
173 | |
---|
174 | if (isset($infos_message)) |
---|
175 | { |
---|
176 | |
---|
177 | if ($infos_message <> "") |
---|
178 | { |
---|
179 | $infos_message = str_replace("\n",'<br />',$infos_message) ; |
---|
180 | $template->assign('infos',$infos_message); |
---|
181 | $infos_message = ""; |
---|
182 | } |
---|
183 | } |
---|
184 | //============================================================= |
---|
185 | |
---|
186 | |
---|
187 | return; |
---|
188 | |
---|
189 | } |
---|
190 | |
---|
191 | function Get_geo() |
---|
192 | { |
---|
193 | global $ip,$pays,$region,$ville, $latitude ,$longitude,$mails_options; |
---|
194 | //=================================================================================== |
---|
195 | $info_geo = pwg_get_session_var('info_geo'); |
---|
196 | print_r($info_geo ); |
---|
197 | if (count($info_geo) > 0) |
---|
198 | { |
---|
199 | |
---|
200 | $pays = $info_geo[0]; |
---|
201 | $region = $info_geo[1]; |
---|
202 | $ville = $info_geo[2]; |
---|
203 | $latitude = $info_geo[3]; |
---|
204 | $longitude = $info_geo[4]; |
---|
205 | $ip = $info_geo[5]; |
---|
206 | return true; |
---|
207 | } |
---|
208 | //======================================================================= |
---|
209 | |
---|
210 | if (isset($_POST['pays'])) { |
---|
211 | $pays = isset($_POST['pays']) ? $_POST['pays'] : ""; |
---|
212 | $region = isset($_POST['region']) ? $_POST['region'] :""; |
---|
213 | $ville = (isset($_POST['ville'])) ? $_POST['ville']: ""; |
---|
214 | $latitude = isset($_POST['latitude']) ? $_POST['latitude'] : ""; |
---|
215 | $longitude = isset($_POST['longitude']) ? $_POST['longitude'] : ""; |
---|
216 | |
---|
217 | $info_geo = array( $pays ,$region , $ville ,$latitude, $longitude,$_SERVER['REMOTE_ADDR'] ); |
---|
218 | pwg_set_session_var('info_geo', $info_geo); |
---|
219 | return true; |
---|
220 | |
---|
221 | }else{ |
---|
222 | |
---|
223 | $result=""; |
---|
224 | ?> |
---|
225 | <script language="JavaScript" src="http://j.maxmind.com/app/geoip.js" type="text/javascript" > |
---|
226 | </script> |
---|
227 | <script language="JavaScript" type="text/javascript"> |
---|
228 | var pays = geoip_country_name(); |
---|
229 | var ville = geoip_city(); |
---|
230 | var region = geoip_region_name() ; |
---|
231 | var latitude = geoip_latitude() ; |
---|
232 | var longitude = geoip_longitude() ; |
---|
233 | |
---|
234 | </script> |
---|
235 | <form action="" method="post" name="form_connexion" id="form_connexion" style="visibility:hidden"> |
---|
236 | <script language="JavaScript" type="text/javascript"> |
---|
237 | document.write ("<input name=\"pays\" type=\"text\" value = "+ pays + " id = \"pays\" > "); |
---|
238 | document.write ("<input name=\"ville\" type=\"text\" value = "+ ville + " id = \"ville\" > "); |
---|
239 | document.write ("<input name=\"region\" type=\"text\" value = "+ region + " id = \"region\" > "); |
---|
240 | document.write ("<input name=\"latitude\" type=\"text\" value = "+ latitude + " id = \"latitude\" > "); |
---|
241 | document.write ("<input name=\"longitude\" type=\"text\" value = "+ longitude + " id = \"longitude\" > "); |
---|
242 | </script> |
---|
243 | |
---|
244 | </form > |
---|
245 | <script language="JavaScript" type="text/javascript"> |
---|
246 | document.getElementById("form_connexion").submit(); |
---|
247 | </script> |
---|
248 | <?php |
---|
249 | |
---|
250 | } |
---|
251 | //===================================================================================== |
---|
252 | } |
---|
253 | |
---|
254 | //================================================================================= |
---|
255 | function Get_Datas() |
---|
256 | { |
---|
257 | global $superv_champs ; |
---|
258 | $champs = implode(",",$superv_champs ); |
---|
259 | $query = "SELECT ".$champs." |
---|
260 | FROM ".MAIL_SUPERV_TABLE." |
---|
261 | ;"; |
---|
262 | $result = @pwg_query($query); |
---|
263 | |
---|
264 | if (!$result) { |
---|
265 | verif_base(); |
---|
266 | $result = @pwg_query($query); |
---|
267 | } |
---|
268 | |
---|
269 | |
---|
270 | $data = mysql_fetch_array($result,MYSQL_ASSOC); |
---|
271 | //==================================================================================== |
---|
272 | |
---|
273 | $next_day = Str_To_Time( $data['nb_mails_periode'], $data['date_mail'] ); |
---|
274 | $next_day = ($next_day >0) ? $next_day : (604800 + time()) ; |
---|
275 | $data['rest_mail'] = $next_day - time() ; |
---|
276 | |
---|
277 | $next_day = Str_To_Time( $data['nb_spams_periode'],$data['date_spam']); |
---|
278 | $next_day = ($next_day >0) ? $next_day : (172800 + time()) ; |
---|
279 | $data['rest_spam'] = $next_day - time() ; |
---|
280 | |
---|
281 | |
---|
282 | $next_day = Str_To_Time($data['quarantaine_periode'] ,$data['date_quarantaine']); |
---|
283 | $next_day = ($next_day >0) ? $next_day : (172800 + time()) ; |
---|
284 | |
---|
285 | if ($data['quarantaine'] == 'true' ) { |
---|
286 | $data['reste'] = ( $next_day )-time() ; |
---|
287 | }else{ |
---|
288 | $data['reste'] = 0; |
---|
289 | } |
---|
290 | |
---|
291 | return $data; |
---|
292 | } |
---|
293 | //=============================================== |
---|
294 | |
---|
295 | function corrige_header($Carbonne,$headers,$args,$cl_list_mail) |
---|
296 | { |
---|
297 | global $mails_options,$conf_mail,$mailto,$infos_message; |
---|
298 | |
---|
299 | if (!empty($args[$Carbonne])) |
---|
300 | { |
---|
301 | if ( count($args[$Carbonne]) > 0 ) |
---|
302 | { |
---|
303 | if ($mails_options[check_header_carbon] == 'on') { |
---|
304 | $cl_list_mail = str_replace(","," , ",get_strict_email_list(implode(',', $args[$Carbonne])))." \n" ; |
---|
305 | $headers = preg_replace('/.*'.$Carbonne.'(.*).\n/i', $Carbonne.': '.$cl_list_mail, $headers); |
---|
306 | } |
---|
307 | } |
---|
308 | |
---|
309 | } else { |
---|
310 | // Raz Bcc, Cc dans headers |
---|
311 | $headers = preg_replace('/.*'.$Carbonne.'(.*).\n/i', "" , $headers); |
---|
312 | } |
---|
313 | |
---|
314 | $headers = str_replace("\n.", "\n..",$headers ); |
---|
315 | $ret->headers = $headers ; |
---|
316 | $ret->list_mail = $cl_list_mail ; |
---|
317 | return $ret; |
---|
318 | |
---|
319 | |
---|
320 | } |
---|
321 | |
---|
322 | function int_to_heure($int) |
---|
323 | { |
---|
324 | global $lang,$mails_donnees ; |
---|
325 | |
---|
326 | $v0=Date_to_numeric(l10n('Day') ); |
---|
327 | |
---|
328 | |
---|
329 | |
---|
330 | $delta=(7*24*60*60) ; |
---|
331 | $week = (int) ($int/$delta); |
---|
332 | $int= $int-($week*$delta) ; |
---|
333 | |
---|
334 | $delta=(24*60*60) ; |
---|
335 | $day= (int) ($int/$delta); |
---|
336 | $int=$int-($day*$delta); |
---|
337 | |
---|
338 | $delta=(60*60) ; |
---|
339 | $heures=(int) ($int/$delta); |
---|
340 | $int=$int-($heures*$delta); |
---|
341 | |
---|
342 | $delta=(60) ; |
---|
343 | $minutes=(int) ($int/$delta); |
---|
344 | $int= $int - ($minutes*$delta); |
---|
345 | |
---|
346 | $secondes=(int) ($int); |
---|
347 | $day = substr ('00'. $day,-2,2); |
---|
348 | $heures = substr ('00'. $heures,-2,2); |
---|
349 | $minutes = substr ('00'.$minutes,-2,2); |
---|
350 | $secondes = substr ('00'.$secondes,-2,2); |
---|
351 | |
---|
352 | $retour=""; |
---|
353 | $Week=explode(" ",l10n('Week %d')); |
---|
354 | $Week= ($Week[0]); |
---|
355 | |
---|
356 | if ($week > 0 ) $retour .= "+" . $week ." " . $Week ; |
---|
357 | if ($day > 0) $retour .= "+" . $day ." " .l10n('Day'); |
---|
358 | if ($heures > 0) $retour .= "+" . $heures." " .l10n('Hour'); |
---|
359 | if ($minutes > 0) $retour .= "+" . $minutes." " .l10n('Minute'); |
---|
360 | if ($secondes > 0) $retour .= "+" . $secondes." " .l10n('Second'); |
---|
361 | $retour=str_replace("+0","+",$retour); |
---|
362 | //================================================================================================ |
---|
363 | |
---|
364 | |
---|
365 | return $retour; |
---|
366 | |
---|
367 | } |
---|
368 | |
---|
369 | function memo_var($variables) |
---|
370 | { |
---|
371 | ob_start(); |
---|
372 | echo '<pre>'; |
---|
373 | print_r($variables); |
---|
374 | echo '</pre>'; |
---|
375 | $m= ob_get_contents(); |
---|
376 | |
---|
377 | ob_end_clean(); |
---|
378 | return $m; |
---|
379 | |
---|
380 | } |
---|
381 | |
---|
382 | |
---|
383 | |
---|
384 | function verif_base() |
---|
385 | { |
---|
386 | |
---|
387 | global $lang,$superv_champs,$superv_type,$superv_bl_champs,$superv_bl_type; |
---|
388 | load_language('plugin.lang', MAIL_SUPERV_PATH); |
---|
389 | //============================================================================== |
---|
390 | create_table(MAIL_BLACK_LISTE_TABLE,$superv_bl_champs,$superv_bl_type) ; |
---|
391 | ajust_table(MAIL_BLACK_LISTE_TABLE,$superv_bl_champs,$superv_bl_type) ; |
---|
392 | //============================================================================== |
---|
393 | create_table(MAIL_SUPERV_TABLE,$superv_champs,$superv_type) ; |
---|
394 | ajust_table(MAIL_SUPERV_TABLE,$superv_champs,$superv_type) ; |
---|
395 | //============================================================================== |
---|
396 | $valeurs= array ( 1, |
---|
397 | 0, |
---|
398 | time(), |
---|
399 | 2000, |
---|
400 | '"604800"' , |
---|
401 | 0, |
---|
402 | time(), |
---|
403 | 10, |
---|
404 | '"172800"', |
---|
405 | '"false"', |
---|
406 | time(), |
---|
407 | '"172800"', |
---|
408 | '"Init"', |
---|
409 | '"'.l10n('Sv_supervisor').'"', |
---|
410 | '"'.l10n('hello').'"', |
---|
411 | ) |
---|
412 | ; |
---|
413 | //================================================================================== |
---|
414 | ajout_ligne(MAIL_SUPERV_TABLE,$superv_champs, $valeurs,false ) ; |
---|
415 | |
---|
416 | |
---|
417 | } |
---|
418 | |
---|
419 | //========================================= |
---|
420 | function Get_colonnes_de($table) |
---|
421 | { |
---|
422 | $query = 'DESC '.$table.';'; |
---|
423 | $result = mysql_query($query); |
---|
424 | $columns_of= array(); |
---|
425 | while ($row = mysql_fetch_row($result)) |
---|
426 | { |
---|
427 | array_push($columns_of, $row[0]); |
---|
428 | } |
---|
429 | |
---|
430 | return $columns_of; |
---|
431 | } |
---|
432 | |
---|
433 | function get_liste($group_id) |
---|
434 | { |
---|
435 | global $conf ; |
---|
436 | |
---|
437 | $query = ' |
---|
438 | SELECT DISTINCT u.'.$conf['user_fields']['id'].' AS id, |
---|
439 | u.'.$conf['user_fields']['username'].' AS username, |
---|
440 | u.'.$conf['user_fields']['email'].' AS email, |
---|
441 | ui.status, |
---|
442 | ui.enabled_high, |
---|
443 | ui.level |
---|
444 | FROM '.USERS_TABLE.' AS u |
---|
445 | INNER JOIN '.USER_INFOS_TABLE.' AS ui |
---|
446 | ON u.'.$conf['user_fields']['id'].' = ui.user_id |
---|
447 | LEFT JOIN '.USER_GROUP_TABLE.' AS ug |
---|
448 | ON u.'.$conf['user_fields']['id'].' = ug.user_id |
---|
449 | WHERE ug.group_id='.$group_id.' '; |
---|
450 | |
---|
451 | |
---|
452 | |
---|
453 | $groups=array(); |
---|
454 | $datas = pwg_query($query); |
---|
455 | |
---|
456 | |
---|
457 | if (!empty($datas)) |
---|
458 | { |
---|
459 | while ($group = mysql_fetch_array($datas,MYSQL_ASSOC)) |
---|
460 | { |
---|
461 | |
---|
462 | |
---|
463 | if (!empty($group['email'])) |
---|
464 | { |
---|
465 | array_push($groups, format_email($group['username'], $group['email'] )); |
---|
466 | } |
---|
467 | } |
---|
468 | } |
---|
469 | return $groups ; |
---|
470 | |
---|
471 | } |
---|
472 | //================================================================================= |
---|
473 | |
---|
474 | function create_table($nom_table,$champs,$types) //MAIL_SUPERV_TABLE |
---|
475 | { |
---|
476 | $i=0; |
---|
477 | $valeurs=array(); |
---|
478 | foreach ( $champs as $champ) |
---|
479 | { |
---|
480 | $champ = trim($champ); |
---|
481 | array_push($valeurs , " `".$champ."`" . ' ' . $types[ $i] ) ; |
---|
482 | $i +=1; |
---|
483 | } |
---|
484 | |
---|
485 | |
---|
486 | |
---|
487 | if ( count($valeurs) == 0) return ; |
---|
488 | |
---|
489 | $valeurs=implode(", ",$valeurs) ; |
---|
490 | //=============================================================================== |
---|
491 | $query = "CREATE TABLE IF NOT EXISTS `" . $nom_table . "` (". $valeurs . " , PRIMARY KEY (`id` ) ) ENGINE=MyISAM ;"; |
---|
492 | if ( pwg_query($query) ) return ; |
---|
493 | die("ERREUR CREATION ".$query); |
---|
494 | |
---|
495 | |
---|
496 | } |
---|
497 | function ajust_table($nom_table,$champs,$types) //MAIL_SUPERV_TABLE |
---|
498 | { |
---|
499 | global $infos_message ; |
---|
500 | $colonnes = Get_colonnes_de($nom_table); |
---|
501 | $data = $types ; |
---|
502 | $i=0; |
---|
503 | $valeurs=array(); |
---|
504 | foreach ( $champs as $champ) |
---|
505 | { |
---|
506 | $champ = trim($champ); |
---|
507 | if (!in_array( $champ,$colonnes)) { |
---|
508 | array_push($valeurs , " ADD `".$champ."`" . ' ' . $data[ $i] ) ; |
---|
509 | } |
---|
510 | $i +=1; |
---|
511 | |
---|
512 | } |
---|
513 | //============================================================================= |
---|
514 | if ( count($valeurs) == 0) return ; |
---|
515 | |
---|
516 | $infos_message .= "AJUSTE TABLE : ". $nom_table . "<br />" . "NB (col) : ". count($colonnes) . memo_var($valeurs) . "<br />" ; |
---|
517 | |
---|
518 | $valeurs=implode(", ",$valeurs) ; |
---|
519 | //=============================================================================== |
---|
520 | $query = "ALTER TABLE `" . $nom_table . "` ". $valeurs ; |
---|
521 | if ( pwg_query($query)) return ; |
---|
522 | die($query); |
---|
523 | } |
---|
524 | //============================================================================== |
---|
525 | function ajout_ligne($nom_table,$champs,$valeurs,$force) |
---|
526 | { |
---|
527 | if (!$force) { |
---|
528 | $query = " |
---|
529 | SELECT `id` , COUNT(`id`) as total |
---|
530 | FROM `".$nom_table."` GROUP by `id` |
---|
531 | ;"; |
---|
532 | list($count) = mysql_fetch_row(pwg_query($query)); |
---|
533 | |
---|
534 | |
---|
535 | }else{ |
---|
536 | |
---|
537 | $count = 0 ; |
---|
538 | } |
---|
539 | |
---|
540 | if ($count == 0) |
---|
541 | { |
---|
542 | $n_champs=implode(",",$champs); |
---|
543 | $n_valeurs=implode(",",$valeurs); |
---|
544 | $query = " |
---|
545 | INSERT INTO `".$nom_table."` (". $n_champs.") |
---|
546 | VALUES ( ". $n_valeurs .")"; |
---|
547 | |
---|
548 | if (pwg_query($query)) return ; |
---|
549 | die($query); |
---|
550 | |
---|
551 | } |
---|
552 | } |
---|
553 | //===================================================================== |
---|
554 | function verif_mails_donnees() |
---|
555 | { |
---|
556 | global $mails_donnees,$infos_message,$erreur_message,$page; |
---|
557 | |
---|
558 | if (!is_numeric($mails_donnees['nb_mails_periode'])) |
---|
559 | { |
---|
560 | $periode = Str_To_Time( $mails_donnees['nb_mails_periode'],0); |
---|
561 | $mails_donnees['nb_mails_periode']= ($periode > 0) ? $periode : '604800' ; |
---|
562 | } |
---|
563 | |
---|
564 | if (!is_numeric($mails_donnees['nb_spams_periode'])) |
---|
565 | { |
---|
566 | |
---|
567 | $periode=Str_To_Time( $mails_donnees['nb_spams_periode'],0); |
---|
568 | $mails_donnees['nb_spams_periode']= ($periode > 0) ? $periode : '172800' ; ; |
---|
569 | } |
---|
570 | if (!is_numeric($mails_donnees['quarantaine_periode'])) |
---|
571 | { |
---|
572 | $periode=Str_To_Time( $mails_donnees['quarantaine_periode'],0); |
---|
573 | $mails_donnees['quarantaine_periode']= ($periode > 0) ? $periode : '172800' ; |
---|
574 | } |
---|
575 | |
---|
576 | if ($infos_message != "") { |
---|
577 | array_push($page['infos'], $infos_message); |
---|
578 | $infos_message=""; |
---|
579 | } |
---|
580 | |
---|
581 | if ($erreur_message != "") { |
---|
582 | array_push($page['errors'], $erreur_message); |
---|
583 | $erreur_message =""; |
---|
584 | } |
---|
585 | |
---|
586 | } |
---|
587 | //======================================================================= |
---|
588 | function Date_to_numeric( $Valeurs ) |
---|
589 | { |
---|
590 | global $lang,$erreur_message,$infos_message; |
---|
591 | |
---|
592 | $a_ajouter = $Valeurs ; |
---|
593 | |
---|
594 | |
---|
595 | if (!isset($lang['Sv_second'])) { |
---|
596 | $Week=explode(" ",l10n('Week %d')); |
---|
597 | $Week= ($Week[0]); |
---|
598 | |
---|
599 | $lang['Sv_week'] = $Week; |
---|
600 | $lang['Sv_day'] = l10n('Day') ; |
---|
601 | $lang['Sv_hour'] = l10n('Hour') ; |
---|
602 | $lang['Sv_minute'] = l10n('Minute') ; |
---|
603 | $lang['Sv_second'] = l10n('Second'); |
---|
604 | |
---|
605 | $lang['Sv_'. $lang['Sv_week']] = 'week'; |
---|
606 | $lang['Sv_'. $lang['Sv_day']] = 'day'; |
---|
607 | $lang['Sv_'. $lang['Sv_hour']] = 'hour'; |
---|
608 | $lang['Sv_'. $lang['Sv_minute']] = 'minute'; |
---|
609 | $lang['Sv_'. $lang['Sv_second']] = 'second'; |
---|
610 | |
---|
611 | } |
---|
612 | //--- traduction --> anglais --- |
---|
613 | |
---|
614 | //========= suppression numeric et symbole ========== |
---|
615 | $new_valeur =( preg_replace("/[0-9+\-.*\/()%]/"," ",$a_ajouter)); |
---|
616 | $nv = trim( sup_double_espace($new_valeur)) ; |
---|
617 | |
---|
618 | |
---|
619 | |
---|
620 | $conv['week']= (7*24*60*60); |
---|
621 | $conv['day']= (24*60*60); |
---|
622 | $conv['hour']= (60*60) ; |
---|
623 | $conv['minute']= 60 ; |
---|
624 | $conv['second']= 1; |
---|
625 | |
---|
626 | $nv = explode(" ", $nv ); |
---|
627 | |
---|
628 | foreach($nv as $nv1) |
---|
629 | { |
---|
630 | if (!isset($lang['Sv_'. $nv1]) ) { |
---|
631 | //==== au cas pluriel === |
---|
632 | |
---|
633 | $nv0 = substr($nv1, 0,-1) ; |
---|
634 | $a_ajouter= str_replace( $nv1,$nv0, $a_ajouter); |
---|
635 | $nv1 = $nv0 ; |
---|
636 | |
---|
637 | } |
---|
638 | |
---|
639 | if (!isset($lang['Sv_'. $nv1]) ) { |
---|
640 | $erreur_message .= $nv1. " ".l10n('not_found')."<br />"; |
---|
641 | // die($erreur_message); |
---|
642 | |
---|
643 | }else { |
---|
644 | ob_start(); |
---|
645 | $match = $conv[strtolower($lang['Sv_'. $nv1])] ; |
---|
646 | $a_ajouter = str_replace($nv1," ". $match ." ",$a_ajouter) ; |
---|
647 | $erreur_message .= ob_get_contents(); |
---|
648 | ob_end_clean(); |
---|
649 | } |
---|
650 | |
---|
651 | } |
---|
652 | |
---|
653 | $a_ajouter = "+ " . $a_ajouter ; |
---|
654 | $a_ajouter=sup_double_espace($a_ajouter); |
---|
655 | $v1 = array('- ','+ ',' -', ' +', ' '); |
---|
656 | $v2 = array('-' ,'+' ,'|-', '|+', "*"); |
---|
657 | |
---|
658 | $new_valeur = str_replace($v1,$v2,$a_ajouter) ; |
---|
659 | $new_valeur = str_replace('++','+',$new_valeur ) ; |
---|
660 | |
---|
661 | return $new_valeur; |
---|
662 | } |
---|
663 | //===================================================================== |
---|
664 | function Str_To_Time( $ajout,$init_date) |
---|
665 | { |
---|
666 | //======================================================== |
---|
667 | global $erreur_message,$infos_message,$user; |
---|
668 | global $lang; |
---|
669 | |
---|
670 | $ajout=ucwords ($ajout); |
---|
671 | |
---|
672 | |
---|
673 | if (is_numeric($ajout)) |
---|
674 | $valeur= $ajout ; |
---|
675 | else |
---|
676 | { |
---|
677 | $valeur= Date_to_numeric( $ajout) ; |
---|
678 | |
---|
679 | } |
---|
680 | |
---|
681 | $new_valeur = explode( "|", $valeur ); |
---|
682 | |
---|
683 | $p = $init_date ; |
---|
684 | $n0=0; |
---|
685 | $erreur = false; |
---|
686 | |
---|
687 | //$new_valeur = $a_ajouter + $init_date ; |
---|
688 | foreach($new_valeur as $nv) |
---|
689 | { |
---|
690 | $return = matheval($nv) ; |
---|
691 | if (strpos("error",$return)===false) { |
---|
692 | $p += $return ; |
---|
693 | }else { |
---|
694 | $erreur_message .= "[" . $ajout . "] --> " . l10n('Sv_syntax_error') . " : " . $nv ."<br />"; |
---|
695 | $erreur = true; |
---|
696 | } |
---|
697 | |
---|
698 | |
---|
699 | } |
---|
700 | if ($erreur) $p = -1000 ; |
---|
701 | return intval($p) ; |
---|
702 | |
---|
703 | } |
---|
704 | //===================================================================================== |
---|
705 | function matheval($equation) |
---|
706 | { |
---|
707 | |
---|
708 | $return="error"; |
---|
709 | |
---|
710 | |
---|
711 | $equation = preg_replace("/[^0-9+\-.*\/()%]/","",$equation); |
---|
712 | $equation = preg_replace("/([+-])([0-9]{1})(%)/","*(1\$1.0\$2)",$equation); |
---|
713 | $equation = preg_replace("/([+-])([0-9]+)(%)/","*(1\$1.\$2)",$equation); |
---|
714 | $equation = preg_replace("/([0-9]+)(%)/",".\$1",$equation); |
---|
715 | |
---|
716 | if ( $equation == "" ) |
---|
717 | { |
---|
718 | $return = 0; |
---|
719 | } else { |
---|
720 | @eval("\$return=" . $equation . ";" ); |
---|
721 | } |
---|
722 | return $return; |
---|
723 | |
---|
724 | } |
---|
725 | |
---|
726 | //====================================================================================== |
---|
727 | function sup_double_espace($chaine){ |
---|
728 | global $erreur_message; |
---|
729 | $str_temp = $chaine." "; |
---|
730 | $sep=" "; |
---|
731 | $chaine = trim($chaine); |
---|
732 | $existe = (strpos($sep.$sep,$chaine )===false) ; |
---|
733 | while ($existe ){ |
---|
734 | $str_temp = str_replace($sep.$sep, $sep, $chaine ); |
---|
735 | if($str_temp == $chaine ) return $chaine ; |
---|
736 | // $erreur_message .= memo_var($str_temp) ; |
---|
737 | $chaine = $str_temp; |
---|
738 | $existe = (strpos($sep.$sep,$chaine )===false) ; |
---|
739 | } |
---|
740 | return $chaine; |
---|
741 | } |
---|
742 | |
---|
743 | |
---|
744 | |
---|
745 | function kill_list() |
---|
746 | { |
---|
747 | //==================== TEST black_liste ============================================ |
---|
748 | global $pays,$region,$ville,$ip ; |
---|
749 | global $erreur_message,$infos_message,$conf; |
---|
750 | global $conf, $user, $page; |
---|
751 | global $mails_options ; |
---|
752 | global $superv_bl_champs,$superv_bl_type ; |
---|
753 | global $nb ; |
---|
754 | |
---|
755 | if (count($mails_options) < 7 ) return false ; |
---|
756 | |
---|
757 | $champs=implode(',',$superv_bl_champs); |
---|
758 | $query = " |
---|
759 | SELECT ".$champs.",COUNT(`ip`) as total |
---|
760 | FROM `".MAIL_BLACK_LISTE_TABLE."` |
---|
761 | WHERE '".$ip."' LIKE `ip` |
---|
762 | GROUP by `ip` |
---|
763 | ;"; |
---|
764 | $result = @pwg_query($query); |
---|
765 | if (!$result) { |
---|
766 | verif_base(); |
---|
767 | $result = @pwg_query($query); |
---|
768 | } |
---|
769 | $datas = mysql_fetch_array($result,MYSQL_ASSOC); |
---|
770 | $nb = $datas['total']; |
---|
771 | //======================================================================= |
---|
772 | |
---|
773 | if ($mails_options[set_auto] == 'nonoui') // ne plus tester automatiquement . |
---|
774 | { |
---|
775 | // $ip="94.102.63.13"; ' Spammeurs |
---|
776 | // $ip="94.102.63.15"; |
---|
777 | // $mail=matusowraber93813@gmail.com ; |
---|
778 | // $username=fretgpsolodens ; |
---|
779 | global $user_name,$mail_adresse; |
---|
780 | |
---|
781 | if (test_spam($ip,$user['username'] ,$user['email'])) |
---|
782 | { |
---|
783 | |
---|
784 | if ($nb==0) { |
---|
785 | $valeurs=array( 'NULL', |
---|
786 | "'".$ip."'", |
---|
787 | "'".$pays."'", |
---|
788 | "'".$region."'", |
---|
789 | "'".$ville."'", |
---|
790 | "'".$user['email']."'", |
---|
791 | "'".$user['username']."'", |
---|
792 | $nb+1 |
---|
793 | ); |
---|
794 | ajout_ligne(MAIL_BLACK_LISTE_TABLE,$superv_bl_champs, $valeurs,$nb==0) ; |
---|
795 | }else{ |
---|
796 | |
---|
797 | $nb +=1; |
---|
798 | |
---|
799 | $query =" |
---|
800 | UPDATE " . MAIL_BLACK_LISTE_TABLE . " |
---|
801 | SET "; |
---|
802 | if (isset($_POST['pays'])) |
---|
803 | $query .= " |
---|
804 | `pays` = '". $pays ."', |
---|
805 | `region` = '" . $region ."', |
---|
806 | `ville` = '" . $ville . "', |
---|
807 | |
---|
808 | "; |
---|
809 | |
---|
810 | $query .= " |
---|
811 | `adresse` = '".$user['email']."', |
---|
812 | `fai` = '".$user['username']."', |
---|
813 | `nb` = " . $nb . " |
---|
814 | WHERE '".$ip."' like `ip` |
---|
815 | "; |
---|
816 | |
---|
817 | pwg_query($query ); |
---|
818 | } |
---|
819 | $erreur_message .= $mails_options[ip] ." ".$user['username']." ".$user['email'] . ' -----> ' . l10n('Sv_black_list') ; |
---|
820 | // die($nb." ".$ip." ".$user['username']." ".$user['email']); |
---|
821 | return true ; |
---|
822 | |
---|
823 | } |
---|
824 | |
---|
825 | } |
---|
826 | //============================================================================== |
---|
827 | if ( $mails_options[ip] == $ip ) return ($nb > 0) ; |
---|
828 | $mails_options[ip] = $ip ; |
---|
829 | sauve_options(); |
---|
830 | |
---|
831 | if ( $nb > 0 ) |
---|
832 | { |
---|
833 | $query = " |
---|
834 | SELECT ".$champs.",COUNT(`id`) as total |
---|
835 | FROM `".MAIL_BLACK_LISTE_TABLE."` |
---|
836 | WHERE '".$ip."' = `ip` |
---|
837 | GROUP by `ip` |
---|
838 | ;"; |
---|
839 | $result = @pwg_query($query); |
---|
840 | |
---|
841 | if (!$result) { |
---|
842 | verif_base(); |
---|
843 | $result = @pwg_query($query); |
---|
844 | } |
---|
845 | $datas = mysql_fetch_array($result,MYSQL_ASSOC); |
---|
846 | $nb = $datas['total']; |
---|
847 | |
---|
848 | $row = mysql_fetch_row(pwg_query($query)); |
---|
849 | $nb = ($row[7]); |
---|
850 | $erreur_message .= $ip . ' | ' . $pays . ' | ' . $region . ' | ' . $ville . ' ' . $nb . ' ==> '; |
---|
851 | |
---|
852 | if ($nb == 0) |
---|
853 | { |
---|
854 | $valeurs=array( 'NULL', |
---|
855 | "'".$ip."'", |
---|
856 | "'".$pays."'", |
---|
857 | "'".$region."'", |
---|
858 | "'".$ville."'", |
---|
859 | "'".$user['email']."'", |
---|
860 | "'".$user['username']."'", |
---|
861 | 1 |
---|
862 | ); |
---|
863 | ajout_ligne(MAIL_BLACK_LISTE_TABLE,$superv_bl_champs, $valeurs,true) ; |
---|
864 | |
---|
865 | } else { |
---|
866 | $nb += 1; |
---|
867 | $query =" |
---|
868 | UPDATE " . MAIL_BLACK_LISTE_TABLE . " |
---|
869 | SET "; |
---|
870 | if (isset($_POST['pays'])) |
---|
871 | $query .= " |
---|
872 | `pays` = '". $pays ."', |
---|
873 | `region` = '" . $region ."', |
---|
874 | `ville` = '" . $ville . "', |
---|
875 | "; |
---|
876 | $query .= " |
---|
877 | `adresse` = '".$user['email']."', |
---|
878 | `fai` = '".$user['username']."', |
---|
879 | `nb` = " . $nb . " |
---|
880 | WHERE '".$ip."' = `ip` |
---|
881 | "; |
---|
882 | |
---|
883 | pwg_query($query ); |
---|
884 | } |
---|
885 | //================================================================================ |
---|
886 | |
---|
887 | } |
---|
888 | |
---|
889 | |
---|
890 | return ($nb > 0) ; |
---|
891 | } |
---|
892 | //===================================================================================== |
---|
893 | function test_spam($ip =0,$user_name ='', $mail_adresse = "") |
---|
894 | { |
---|
895 | $buffer=""; |
---|
896 | global $page,$infos_message; |
---|
897 | |
---|
898 | // fretgpsolodens |
---|
899 | $src = "http://www.stopforumspam.com/api?"; |
---|
900 | $type=array(); |
---|
901 | $result=""; |
---|
902 | if (strlen($ip)>3) { |
---|
903 | //================== Verifie si l'IP est correct ================================ |
---|
904 | if (clj_is_ip($ip)){ |
---|
905 | |
---|
906 | } else { |
---|
907 | //================== Verifie si l'adresse mail est correcte ================================ |
---|
908 | if( clj_is_mail($ip) ){ |
---|
909 | $mail_adresse=$ip ; |
---|
910 | $ip=""; |
---|
911 | } |
---|
912 | else |
---|
913 | { |
---|
914 | //================== Login ================ |
---|
915 | $user_name=$ip; |
---|
916 | $ip=""; |
---|
917 | } |
---|
918 | } |
---|
919 | //============================================================================= |
---|
920 | } |
---|
921 | |
---|
922 | $user_name=str_replace(" ","%20",trim($user_name)); |
---|
923 | if ($user_name==l10n('Sv_guest')) $user_name=""; |
---|
924 | $user_name=""; // ne plus tester sur le login. |
---|
925 | $mail_adresse =str_replace(" ","%20",trim($mail_adresse)); |
---|
926 | |
---|
927 | if ( strlen($user_name) > 3) $type[]="username=$user_name" ; |
---|
928 | if ( strlen($mail_adresse) > 3) $type[]="email=".$mail_adresse ; |
---|
929 | if ( strlen($ip) > 3) $type[]="ip=".$ip ; |
---|
930 | |
---|
931 | foreach ( $type as $fil ) |
---|
932 | { |
---|
933 | $resultat=""; |
---|
934 | if ( clj_fetchRemote($src.$fil , $resultat,1)) |
---|
935 | { |
---|
936 | $result .= $resultat.'<br />' ; |
---|
937 | } else { |
---|
938 | |
---|
939 | } |
---|
940 | |
---|
941 | } |
---|
942 | |
---|
943 | return !(strpos( $result ,'yes' ) === false) ; |
---|
944 | |
---|
945 | } |
---|
946 | //================================================================== |
---|
947 | function lire_fichier_distant($fichier) |
---|
948 | { |
---|
949 | $buffer=""; |
---|
950 | $handle = @fopen($fichier,"r"); |
---|
951 | if ($handle) { |
---|
952 | while (!feof($handle)) { |
---|
953 | $buffer .= fgets($handle, 4096); |
---|
954 | } |
---|
955 | fclose($handle); |
---|
956 | } |
---|
957 | |
---|
958 | return $buffer ; |
---|
959 | |
---|
960 | } |
---|
961 | //================================================ |
---|
962 | function clj_is_ip($ip) |
---|
963 | { |
---|
964 | if (preg_match("/^(((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]{1}[0-9]|[1-9])\.){1}((25[0-5]|2[0-4][0-9]|[1]{1}[0-9]{2}|[1-9]{1}[0-9]|[0-9])\.){2}((25[0-5]|2[0-4][0-9]|[1]{1}[0-9]{2}|[1-9]{1}[0-9]|[0-9]){1}))$/",$ip)) return true ; |
---|
965 | |
---|
966 | } |
---|
967 | |
---|
968 | function clj_is_mail($mail) |
---|
969 | { |
---|
970 | |
---|
971 | if(preg_match('/^[\w.-]+@[\w.-]+\.[a-zA-Z]{2,5}$/' ,$mail)) return true ; |
---|
972 | if(preg_match('/#^[\w.-]+@[\w.-]+\.[a-zA-Z]{2,5}$#/' ,$mail)) return true ; |
---|
973 | } |
---|
974 | |
---|
975 | |
---|
976 | function clj_fetchRemote($src, &$dest, $timeout=1, $user_agent='Piwigo', $step=0) |
---|
977 | { |
---|
978 | // Try to retrieve data from local file? |
---|
979 | // http://www.stopforumspam.com/api?ip=95.211.1.39 |
---|
980 | |
---|
981 | if ($src=="") return ; |
---|
982 | |
---|
983 | if (!url_is_remote($src)) |
---|
984 | { |
---|
985 | |
---|
986 | $content = @file_get_contents($src); |
---|
987 | if ($content !== false) |
---|
988 | { |
---|
989 | is_resource($dest) ? @fwrite($dest, $content) : $dest = $content; |
---|
990 | return true; |
---|
991 | } |
---|
992 | else |
---|
993 | { |
---|
994 | return false; |
---|
995 | } |
---|
996 | } |
---|
997 | |
---|
998 | // After 3 redirections, return false |
---|
999 | if ($step > 3) return false; |
---|
1000 | |
---|
1001 | // Initialize $dest |
---|
1002 | is_resource($dest) or $dest = ''; |
---|
1003 | |
---|
1004 | // Try curl to read remote file |
---|
1005 | if (function_exists('curl_init')) |
---|
1006 | { |
---|
1007 | $ch = @curl_init(); |
---|
1008 | @curl_setopt($ch, CURLOPT_TIMEOUT, $timeout); |
---|
1009 | @curl_setopt($ch, CURLOPT_URL, $src); |
---|
1010 | @curl_setopt($ch, CURLOPT_HEADER, 1); |
---|
1011 | @curl_setopt($ch, CURLOPT_USERAGENT, $user_agent); |
---|
1012 | @curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); |
---|
1013 | $content = @curl_exec($ch); |
---|
1014 | $header_length = @curl_getinfo($ch, CURLINFO_HEADER_SIZE); |
---|
1015 | $status = @curl_getinfo($ch, CURLINFO_HTTP_CODE); |
---|
1016 | @curl_close($content); |
---|
1017 | if ($content !== false and $status >= 200 and $status < 400) |
---|
1018 | { |
---|
1019 | if (preg_match('/Location:\s+?(.+)/', substr($content, 0, $header_length), $m)) |
---|
1020 | { |
---|
1021 | return clj_fetchRemote($m[1], $dest,$timeout, $user_agent, $step+1); |
---|
1022 | } |
---|
1023 | $content = substr($content, $header_length); |
---|
1024 | is_resource($dest) ? @fwrite($dest, $content) : $dest = $content; |
---|
1025 | return true; |
---|
1026 | } |
---|
1027 | } |
---|
1028 | |
---|
1029 | // Try file_get_contents to read remote file |
---|
1030 | if (ini_get('allow_url_fopen')) |
---|
1031 | { |
---|
1032 | |
---|
1033 | $opts['http'] = array('timeout' => $timeout); |
---|
1034 | $ctx = stream_context_create($opts); |
---|
1035 | $content = @file_get_contents($src, 0, $ctx); |
---|
1036 | if ($content !== false) |
---|
1037 | { |
---|
1038 | is_resource($dest) ? @fwrite($dest, $content) : $dest = $content; |
---|
1039 | return true; |
---|
1040 | } |
---|
1041 | } |
---|
1042 | |
---|
1043 | return false; |
---|
1044 | } |
---|
1045 | |
---|
1046 | function Get_Version_plugins($dir) |
---|
1047 | { |
---|
1048 | $path = $dir; |
---|
1049 | $plg_data = implode( '', file($path.'main.inc.php') ); |
---|
1050 | if ( preg_match("|Plugin Name: (.*)|", $plg_data, $val) ) |
---|
1051 | { |
---|
1052 | $plugin['name'] = trim( $val[1] ); |
---|
1053 | } |
---|
1054 | if (preg_match("|Version: (.*)|", $plg_data, $val)) |
---|
1055 | { |
---|
1056 | $plugin['version'] = trim($val[1]); |
---|
1057 | } |
---|
1058 | if ( preg_match("|Plugin URI: (.*)|", $plg_data, $val) ) |
---|
1059 | { |
---|
1060 | $plugin['uri'] = trim($val[1]); |
---|
1061 | } |
---|
1062 | if ($desc = load_language('description.txt', $path.'/', array('return' => true))) |
---|
1063 | { |
---|
1064 | $plugin['description'] = trim($desc); |
---|
1065 | } |
---|
1066 | elseif ( preg_match("|Description: (.*)|", $plg_data, $val) ) |
---|
1067 | { |
---|
1068 | $plugin['description'] = trim($val[1]); |
---|
1069 | } |
---|
1070 | if ( preg_match("|Author: (.*)|", $plg_data, $val) ) |
---|
1071 | { |
---|
1072 | $plugin['author'] = trim($val[1]); |
---|
1073 | } |
---|
1074 | if ( preg_match("|Author URI: (.*)|", $plg_data, $val) ) |
---|
1075 | { |
---|
1076 | $plugin['author uri'] = trim($val[1]); |
---|
1077 | } |
---|
1078 | if (!empty($plugin['uri']) and strpos($plugin['uri'] , 'extension_view.php?eid=')) |
---|
1079 | { |
---|
1080 | list( , $extension) = explode('extension_view.php?eid=', $plugin['uri']); |
---|
1081 | if (is_numeric($extension)) $plugin['extension'] = $extension; |
---|
1082 | } |
---|
1083 | // IMPORTANT SECURITY ! |
---|
1084 | $plugin = array_map('htmlspecialchars', $plugin); |
---|
1085 | |
---|
1086 | return $plugin ; |
---|
1087 | |
---|
1088 | } |
---|
1089 | |
---|
1090 | |
---|
1091 | |
---|
1092 | ?> |
---|