Pour une autre méthode de protection, notamment pour les envoi par "send e-cards", suivez ce lien.
Sinon, avec le module Securityimage de Dugris, c'est comme cela.
ATTENTION!! N'OUBLIEZ PAS D'ENLEVER LES ESPACES DU MOT:j a v a s c r i p tDans le fichier public-upload.php
$permHandler = ExtgalleryPublicPermHandler::getHandler();
if(count($permHandler->getAuthorizedPublicCat($xoopsUser, 'public_upload')) < 1) {
redirect_header("index.php", 3, _MD_EXTGALLERY_NOPERM);
exit;
}
switch($step) {
case 'enreg':
// Hack SecurityImage de Dugris
include_once(XOOPS_ROOT_PATH . "/class/xoopsformloader.php");
if ( defined('SECURITYIMAGE_INCLUDED') && !SecurityImage::CheckSecurityImage() ) {
redirect_header( 'j a v a s c r i p t:history.go(-1)', 2, _SECURITYIMAGE_ERROR ) ;
exit();
}
// Hack SecurityImage de Dugris
$photoHandler = xoops_getmodulehandler('publicphoto', 'extgallery');
$result = $photoHandler->postPhotoTraitement('photo_file', false);
if($result == 2) {
Et enfin, ceci
$plugin = xoops_getmodulehandler('plugin', 'extgallery');
$plugin->triggerEvent('photoForm', $form);
$form->addElement(new XoopsFormHidden("step", 'enreg'));
// Hack SecurityImage de Dugris
if (defined('SECURITYIMAGE_INCLUDED')) {
$security_image = new SecurityImage( _SECURITYIMAGE_GETCODE );
if ($security_image->render()) {
$form->addElement($security_image, true);
}
}
// Hack SecurityImage de Dugris
$form->addElement(new XoopsFormButton("", "submit", _SUBMIT, "submit"));
$form->display();
include(XOOPS_ROOT_PATH."/footer.php");
break;
===================================
Pour le send e-cards, vous pouvez faire ceci:
Ouvrez le fichier public-sendecard.php
REMPLACER EXACTEMENT CECI
include_once XOOPS_ROOT_PATH.'/modules/extgallery/class/php-captcha.inc.php';
// Enable captcha only if GD is Used
if($xoopsModuleConfig['graphic_lib'] == 'GD') {
if (!PhpCaptcha::Validate($_POST['captcha'])) {
redirect_header("public-photo.php?photoId=".$photoId."#photoNav", 3, _MD_EXTGALLERY_CAPTCHA_ERROR);
exit;
}
}
PAR CELA:
// Hack SecurityImage de Dugris
include_once(XOOPS_ROOT_PATH . "/class/xoopsformloader.php");
if ( defined('SECURITYIMAGE_INCLUDED') && !SecurityImage::CheckSecurityImage() ) {
redirect_header( 'j a v a s c r i p t:history.go(-1)', 2, _SECURITYIMAGE_ERROR ) ;
exit();
}
// Hack SecurityImage de Dugris
ET ENFIN, REMPLACER EXACTEMENT CECI
// Enable captcha only if GD is Used
if($xoopsModuleConfig['graphic_lib'] == 'GD') {
$form->addElement(new XoopsFormText(_MD_EXTGALLERY_SECURITY, 'captcha', '10', '5', ''),false);
}
PAR CELA:
// Hack SecurityImage de Dugris
if (defined('SECURITYIMAGE_INCLUDED')) {
$security_image = new SecurityImage( _SECURITYIMAGE_GETCODE );
if ($security_image->render()) {
$form->addElement($security_image, true);
}
}
// Hack SecurityImage de Dugris
Et voila
Pour les nullos,
voici les 2 fichiers zippés dans ce forumA+++