14 if (!defined(
'IN_PEEL')) {
42 $font =
$GLOBALS[
'dirroot'] .
"/modules/captcha/security_codes/bkant.ttf";
43 if($noise_level === null) {
50 $image = imagecreatetruecolor($imageWidth, $imageHeight);
52 $colorWhite = imagecolorallocate($image, 255, 255, 255);
53 $colorBlack = imagecolorallocate($image, 0, 0, 0);
55 imagefill($image, 0, 0, $colorWhite);
60 $x_rand = mt_rand(32, 37) *
$i + 20;
61 $y_rand = mt_rand(35, 55);
62 $f_rand = mt_rand(-30, 30);
63 $color = imagecolorallocate($image, mt_rand(30, 100), mt_rand(30, 100), mt_rand(30, 100));
64 imagettftext ($image, $fontSize, $f_rand, $x_rand, $y_rand, $color, $font, $code{
$i});
66 for(
$i = 1;
$i <= $noise_level;
$i++) {
68 $x = mt_rand(0, $imageWidth);
69 $y = mt_rand(0, $imageHeight);
70 $color = imagecolorallocate($image, mt_rand(0, 180), mt_rand(0, 180), mt_rand(0, 180));
72 imagesetpixel($image, $x, $y, $color);
74 $size = rand(1, $noise_max_size);
75 imagefilledarc($image, $x, $y, $size, $size, 0, 360, $color, IMG_ARC_PIE);
79 imagepng($image, $fileName);
93 $codeSecurityPath =
'/modules/captcha/security_codes/' .
'%s.png';
94 $generateNewCode =
false;
96 if (empty(
$frm[
'code_id'])) {
97 $generateNewCode =
true;
98 }
elseif (isset(
$frm[
'form_regenerate_code']) &&
$frm[
'form_regenerate_code'] ==
'1') {
99 $generateNewCode =
true;
101 $test = sprintf(
$GLOBALS[
'dirroot'] . $codeSecurityPath,
$frm[
'code_id']);
102 if (!file_exists($test)) {
103 $generateNewCode =
true;
105 $code_id =
$frm[
'code_id'];
106 $codeSecurityPath = sprintf($codeSecurityPath, $code_id);
110 if ($generateNewCode ===
true) {
114 while ($code < 10000) {
116 if ($n != 1 && $n != 7 && ($code !==
'' || $n != 0)) {
121 query(
'INSERT INTO peel_security_codes
124 $codeSecurityPath = sprintf($codeSecurityPath, $code_id);
128 $output .=
'<img src="' .
$GLOBALS[
'wwwroot'] . $codeSecurityPath .
'" alt="Captcha" class="well" style="padding:0px; margin-bottom:0px" /><input type="hidden" name="code_id" value="' . intval($code_id) .
'" />';
140 $q_code =
query(
'SELECT COUNT(*)
141 FROM peel_security_codes
156 $codeSecurityPath =
$GLOBALS[
'dirroot'] .
'/modules/captcha/security_codes/' . $form_object_id .
'.png';
159 FROM peel_security_codes
161 @unlink($codeSecurityPath);
173 query(
'DELETE FROM peel_security_codes
174 WHERE time<="' . intval(time() - 3600 * $older_than_hours) .
'"');
175 $dir =
$GLOBALS[
'dirroot'] .
'/modules/captcha/security_codes/';
177 if ($handle = opendir($dir)) {
178 while (
false !== ($file = readdir($handle))) {
180 if ($file !=
'.' && $file !=
'..' && $file[0] !=
'.' &&
String::strpos($file,
'.ttf') ===
false && filemtime($dir . $file) < time() - 3600 * $older_than_hours) {
181 @unlink($dir . $file);
186 if (!empty(
$GLOBALS[
'contentMail'])) {
187 $GLOBALS[
'contentMail'] .=
'Suppression des fichiers de plus de ' . $older_than_hours .
' heures dans le dossier ' . $dir .
' : ';
188 $GLOBALS[
'contentMail'] .=
'Ok - ' .
$i .
' fichiers supprimés' .
"\r\n\r\n";
fetch_row($query_result)
fetch_row()
if(!empty($GLOBALS['site_parameters']['order_specific_field_titles'])) if(check_if_module_active('socolissimo')&&!empty($_REQUEST)&&!empty($_REQUEST['PUDOFOID'])&&!empty($_REQUEST['CEEMAIL'])&&!empty($_REQUEST['SIGNATURE'])&&!empty($_REQUEST['ORDERID'])) elseif(!empty($_POST)) elseif(check_if_module_active('socolissimo')&&!empty($_SESSION['session_commande']['is_socolissimo_order'])) foreach(array('bill'=> 1, 'ship'=> 2) as $address_type=> $session_commande_address_id) $frm['societe1']
static strpos($haystack, $needle, $offset=0)
Returns the numeric position of the first occurrence of needle in the haystack string.
get_captcha_inside_form(&$frm)
get_captcha_inside_form()
check_captcha($code, $id)
if(!defined('IN_PEEL')) captcha_hook_close_page_generation($params)
Traitement de la fin de la génération d'une page.
delete_captcha($form_object_id)
insert_id($database_object=null)
insert_id()
static strlen($string)
Returns the length of the given string.
nohtml_real_escape_string($value, $allowed_tags=null)
Protège les données pour insertion dans MySQL ET supprime les tags HTML pour protéger de toute sorte ...
if(!defined('IN_PEEL')) $GLOBALS['page_types_array']
clean_security_codes($older_than_hours=4)
clean_security_codes()
query($query, $die_if_error=false, $database_object=null, $silent_if_error=false, $security_sql_filter=true)
The query() function is meant to be called anywhere you want to make a query.
if(strlen($date2)== '10') if($type== 'users-by-age'&&a_priv('admin_users', true)) elseif($type== 'forums-count'&&a_priv('admin_content', true)) elseif($type== 'forums-categories'&&a_priv('admin_content', true)) elseif($type== 'users-count'&&a_priv('admin_users', true)) elseif($type== 'product-categories'&&a_priv('admin_products', true)) elseif($type== 'users-by-sex'&&a_priv('admin_users', true)) elseif($type== 'users-by-country'&&a_priv('admin_users', true)) elseif($type== 'sales'&&a_priv('admin_sales', true))
securityCodeCreate($code, $fileName, $noise_level=null, $noise_max_size=3)
securityCodeCreate()
check_if_module_active($module_name, $specific_file_name=null)
Renvoie si un module est présent et activé ou non - Peut être appelé avant ou après le chargement d'u...