|
Securityimage dans smartpartner |
|
Xoops accro
Inscrit: 16/08/2005 19:46
De Nanterre
|
Bonjour, Je souhaiterai intégrer sécurityimage de Dugris dans ce module, J'ai essayer dans le fichier joint, sans succès. Merci pour me donner l'astuce. Bonne soirée
Posté le : 04/02/2008 19:50
|
eparcyl... tranquille.
|
|
Re: Securityimage dans smartpartner |
|
Xoops accro
Inscrit: 16/08/2005 19:46
De Nanterre
|
Posté le : 10/06/2008 20:35
|
eparcyl... tranquille.
|
|
Re: Securityimage dans smartpartner |
|
Xoops accro
Inscrit: 16/08/2005 19:46
De Nanterre
|
un petit up svp Bonne jounée
Posté le : 03/07/2008 06:16
|
eparcyl... tranquille.
|
|
Re: Securityimage dans smartpartner |
|
Xoops accro
Inscrit: 25/02/2004 00:20
De Région parisienne
|
Et si tu nous montrais le code que tu as modifié !?
Posté le : 03/07/2008 09:11
|
|
|
Re: Securityimage dans smartpartner |
|
Xoops accro
Inscrit: 16/08/2005 19:46
De Nanterre
|
Bonsoir, Rien à faire, c'est pas faute d'avoir essayer. Voici les fichiers dont je pense sont a modifier. templates/smartpartner_join.html
<!-- Thank you for keeping this line in the template :-) //-->
<div style="display: none;"><{$ref_smartpartner}></div>
<div class="smartpartner_infotitle"><{$lang_intro_title}></div>
<div class="smartpartner_infotext"><{$lang_intro_text}></div>
<{$joinform.javascript}>
<form name="<{$joinform.name}>" action="<{$joinform.action}>" method="<{$joinform.method}>" <{$joinform.extra}>>
<table class="outer" cellspacing="1">
<tr>
<th colspan="2"><{$joinform.title}></th>
</tr>
<!-- start of form elements loop -->
<{foreach item=element from=$joinform.elements}>
<{if $element.hidden != true}>
<tr>
<td class="head"><{$element.caption}>
<{if $element.description}>
<div style="font-weight: normal"><{$element.description}></div>
<{/if}>
</td>
<td class="<{cycle values="even,odd"}>"><{$element.body}></td>
</tr>
<{else}>
<{$element.body}>
<{/if}>
<{/foreach}>
<!-- end of form elements loop -->
</table>
</form>
Join.php
<?php
/**
* $Id: join.php,v 1.2 2007/09/18 14:00:55 marcan Exp $
* Module: SmartPartner
* Author: The SmartFactory <www.smartfactory.ca>
* Licence: GNU
*/
include "header.php";
$xoopsOption['template_main'] = 'smartpartner_join.html';
include XOOPS_ROOT_PATH."/header.php";
include "footer.php";
$myts =& MyTextSanitizer::getInstance();
$op = isset($_POST['op']) ? $_POST['op'] : 'form';
switch ($op) {
case "submitPartner" :
include XOOPS_ROOT_PATH."/class/xoopsmailer.php";
$partnerObj = $smartpartner_partner_handler->create();
// Uploading the logo, if any
// Retreive the filename to be uploaded
if ( $_FILES['logo_file']['name'] != "" ) {
$filename = $_POST["xoops_upload_file"][0] ;
if( !empty( $filename ) || $filename != "" ) {
global $xoopsModuleConfig;
$max_size = 10000000;
$max_imgwidth = $xoopsModuleConfig['img_max_width'];
$max_imgheight = $xoopsModuleConfig['img_max_height'];
$allowed_mimetypes = smartpartner_getAllowedImagesTypes();
include_once(XOOPS_ROOT_PATH."/class/uploader.php");
if( $_FILES[$filename]['tmp_name'] == "" || ! is_readable( $_FILES[$filename]['tmp_name'] ) ) {
redirect_header( 'javascript:history.go(-1)' , 2, _CO_SPARTNER_FILE_UPLOAD_ERROR ) ;
exit ;
}
$uploader = new XoopsMediaUploader(smartpartner_getImageDir(), $allowed_mimetypes, $max_size, $max_imgwidth, $max_imgheight);
if( $uploader->fetchMedia( $filename ) && $uploader->upload() ) {
$partnerObj->setVar('image', $uploader->getSavedFileName());
} else {
redirect_header( 'javascript:history.go(-1)' , 2, _CO_SPARTNER_FILE_UPLOAD_ERROR . $uploader->getErrors() ) ;
exit ;
}
}
}
// Putting the values in the partner object
$partnerObj->setVar('id', (isset($_POST['id'])) ? intval($_POST['id']) : 0);
$partnerObj->setVar('title', $_POST['title']);
$partnerObj->setVar('summary', $_POST['summary']);
$partnerObj->setVar('description', $_POST['description']);
$partnerObj->setVar('contact_name', $_POST['contact_name']);
$partnerObj->setVar('contact_email', $_POST['contact_email']);
$partnerObj->setVar('contact_phone', $_POST['contact_phone']);
$partnerObj->setVar('adress', $_POST['adress']);
$partnerObj->setVar('url', $_POST['url']);
$partnerObj->setVar('image_url', $_POST['image_url']);
$partnerObj->setVar('weight', (isset($_POST['weight'])) ? intval($_POST['weight']) : 0);
$partnerObj->setVar('status', _SPARTNER_STATUS_SUBMITTED);
$partnerObj->setVar('email_priv', (isset($_POST['email_priv'])) ? intval($_POST['email_priv']) : 0);
$partnerObj->setVar('phone_priv', (isset($_POST['phone_priv'])) ? intval($_POST['phone_priv']) : 0);
$partnerObj->setVar('adress_priv', (isset($_POST['adress_priv'])) ? intval($_POST['adress_priv']) : 0);
if ($xoopsModuleConfig['autoapprove_submitted']) {
$partnerObj->setVar('status', _SPARTNER_STATUS_ACTIVE);
} else {
$partnerObj->setVar('status', _SPARTNER_STATUS_SUBMITTED);
}
// Storing the partner
If ( !$partnerObj->store() ) {
redirect_header("javascript:history.go(-1)", 3, _MD_SPARTNER_SUBMIT_ERROR . smartpartner_formatErrors($partnerObj->getErrors()));
exit;
}
if (isset($_POST['notifypub']) && $_POST['notifypub'] == 1) {
include_once XOOPS_ROOT_PATH . '/include/notification_constants.php';
$notification_handler = &xoops_gethandler('notification');
$notification_handler->subscribe('partner', $partnerObj->id(), 'approved', XOOPS_NOTIFICATION_MODE_SENDONCETHENDELETE);
}
$partnerObj->sendNotifications(array(_SPARTNER_NOT_PARTNER_SUBMITTED));
redirect_header("index.php", 3, _MD_SPARTNER_SUBMIT_SUCCESS);
exit;
break;
case "form" :
If (($xoopsModuleConfig['allowsubmit'] != 1) || (!$xoopsUser) && $xoopsModuleConfig['anonpost'] != 1) {
redirect_header("index.php",2,_NOPERM);
}
include XOOPS_ROOT_PATH."/class/xoopsformloader.php";
include XOOPS_ROOT_PATH."/modules/smartobject/class/form/elements/smartformhidden.php";
$form = new XoopsThemeForm(_MD_SPARTNER_JOIN, "joinform", "join.php");
$form->setExtra('enctype="multipart/form-data"');
// TITLE
$title_text = new XoopsFormText(_CO_SPARTNER_TITLE, 'title', 50, 255, '');
$title_text->setDescription(_CO_SPARTNER_TITLE_DSC);
$form->addElement($title_text, true);
// LOGO UPLOAD
$max_size = 5000000;
$file_box = new XoopsFormFile(_CO_SPARTNER_LOGO_UPLOAD, "logo_file", $max_size);
$file_box->setExtra( "size ='45'") ;
$file_box->setDescription(sprintf(_CO_SPARTNER_LOGO_UPLOAD_DSC,$xoopsModuleConfig['img_max_width'],$xoopsModuleConfig['img_max_height']));
$form->addElement($file_box);
// IMAGE_URL
$image_url_text = new XoopsFormText(_CO_SPARTNER_IMAGE_URL, 'image_url', 50, 255, '');
$image_url_text->setDescription(_CO_SPARTNER_IMAGE_URL_DSC);
$form->addElement($image_url_text, false);
// URL
$url_text = new XoopsFormText(_CO_SPARTNER_URL, 'url', 50, 255, '');
$url_text->setDescription(_CO_SPARTNER_URL_DSC);
$form->addElement($url_text, false);
// SUMMARY
$summary_text = new XoopsFormTextArea(_CO_SPARTNER_SUMMARY, 'summary', '', 7, 60);
$summary_text->setDescription(_CO_SPARTNER_SUMMARY_DSC);
$form->addElement($summary_text, true);
// DESCRIPTION
$description_text = new XoopsFormDhtmlTextArea(_CO_SPARTNER_DESCRIPTION, 'description', '', 15, 60);
$description_text->setDescription(_CO_SPARTNER_DESCRIPTION_DSC);
$form->addElement($description_text, false);
// CONTACT_NAME
$contact_name_text = new XoopsFormText(_CO_SPARTNER_CONTACT_NAME, 'contact_name', 50, 255, '');
$contact_name_text->setDescription(_CO_SPARTNER_CONTACT_NAME_DSC);
$form->addElement($contact_name_text, false);
// CONTACT_EMAIL
$contact_email_text = new XoopsFormText(_CO_SPARTNER_CONTACT_EMAIL, 'contact_email', 50, 255, '');
$contact_email_text->setDescription(_CO_SPARTNER_CONTACT_EMAIL_DSC);
$form->addElement($contact_email_text, false);
// EMAIL_PRIV
$email_priv_radio = new XoopsFormRadioYN(_CO_SPARTNER_CONTACT_EMAILPRIV, 'email_priv', 0);
$email_priv_radio->setDescription(_CO_SPARTNER_CONTACT_EMAILPRIV_DSC);
$form->addElement($email_priv_radio);
// CONTACT_PHONE
$contact_phone_text = new XoopsFormText(_CO_SPARTNER_CONTACT_PHONE, 'contact_phone', 50, 255, '');
$contact_phone_text->setDescription(_CO_SPARTNER_CONTACT_PHONE_DSC);
$form->addElement($contact_phone_text, false);
// PHONE_PRIV
$phone_priv_radio = new XoopsFormRadioYN(_CO_SPARTNER_CONTACT_PHONEPRIV, 'phone_priv', 0);
$phone_priv_radio->setDescription(_CO_SPARTNER_CONTACT_PHONEPRIV_DSC);
$form -> addElement($phone_priv_radio);
// ADRESS
$adress_text = new XoopsFormTextArea(_CO_SPARTNER_ADRESS, 'adress', '', 4, 60);
$adress_text->setDescription(_CO_SPARTNER_ADRESS_DSC);
$form->addElement($adress_text, false);
// ADRESS_PRIV
$adress_priv_radio = new XoopsFormRadioYN(_CO_SPARTNER_CONTACT_ADRESSPRIV, 'adress_priv', 0);
$adress_priv_radio->setDescription(_CO_SPARTNER_CONTACT_ADRESSPRIV_DSC);
$form -> addElement($adress_priv_radio);
// NOTIFY ON PUBLISH
if (is_object($xoopsUser)&& ($xoopsModuleConfig['autoapprove_submitted'] != 1)) {
$notify_checkbox = new XoopsFormCheckBox('', 'notifypub', 1);
$notify_checkbox->addOption(1, _MD_SPARTNER_NOTIFY);
$form->addElement($notify_checkbox);
}
$form->addElement(new SmartFormHidden('partial_view', $xoopsModuleConfig['default_part_view']));
$form->addElement(new SmartFormHidden('full_view', $xoopsModuleConfig['default_full_view']));
// BUTTONS
$button_tray = new XoopsFormElementTray('', '');
$hidden = new XoopsFormHidden('op', 'submitPartner');
$button_tray->addElement($hidden);
$butt_create = new XoopsFormButton('', '', _CO_SPARTNER_SUBMIT, 'submit');
$butt_create->setExtra('onclick="this.form.elements.op.value='submitPartner'"');
$button_tray->addElement($butt_create);
$butt_clear = new XoopsFormButton('', '', _CO_SPARTNER_CLEAR, 'reset');
$button_tray->addElement($butt_clear);
$butt_cancel = new XoopsFormButton('', '', _CO_SPARTNER_CANCEL, 'button');
$butt_cancel->setExtra('onclick="history.go(-1)"');
$button_tray->addElement($butt_cancel);
$form->addElement($button_tray, true);
$form->assign($xoopsTpl);
$xoopsTpl->assign(array("lang_main_partner" => _MD_SPARTNER_PARTNERS, "lang_join" => _MD_SPARTNER_JOIN));
$xoopsTpl->assign('lang_intro_title', _MD_SPARTNER_JOIN);
$xoopsTpl->assign('lang_intro_text', sprintf(_MD_SPARTNER_INTRO_JOIN, $xoopsConfig['sitename']));
$xoopsTpl->assign('xoops_pagetitle', $myts->makeTboxData4Show($xoopsModule->name()) . ' - ' . _MD_SPARTNER_JOIN);
break;
}
include_once XOOPS_ROOT_PATH.'/footer.php';
?>
Si quelqu'un y arrive... moi, j'abandonne Bonne soirée
Posté le : 03/07/2008 20:15
|
eparcyl... tranquille.
|
|
Re: Securityimage dans smartpartner |
|
Xoops accro
Inscrit: 20/02/2008 20:27
De Belgium
|
comme en formulaire.php: Apres
include "footer.php";
// If security image is installed .. include the class
if (file_exists (XOOPS_ROOT_PATH."/class/xoopsform/securityimage.php")) {
include_once XOOPS_ROOT_PATH.'/class/xoopsform/securityimage.php';
} elseif (file_exists (XOOPS_ROOT_PATH."/Frameworks/captcha/formcaptcha.php")) {
include_once XOOPS_ROOT_PATH.'/Frameworks/captcha/formcaptcha.php';
$framework = true;
}
Avant
// BUTTONS
// SecurityImage by DuGris
if (defined('SECURITYIMAGE_INCLUDED')) {
$security_image = new SecurityImage( _SECURITYIMAGE_GETCODE );
if ($security_image->render()) {
$form->addElement($security_image, true);
}
} elseif(!empty($framework)) {
$form->addElement(new XoopsFormCaptcha('', 'xoopscaptcha', true, 4, 12, 12, 0,0),true);
}
// SecurityImage by DuGris
Apres
case "submitPartner" :
// SecurityImage by DuGris
include_once(XOOPS_ROOT_PATH . "/class/xoopsformloader.php");
if ( defined('SECURITYIMAGE_INCLUDED') && !SecurityImage::CheckSecurityImage() ) {
$redirect = XOOPS_URL . "/modules/" . $modversion["dirname"] . "/formulaire.php?id=" . $_GET['id'] . "&qcm=" . $_GET['qcm'];
redirect_header( $redirect , 5, _SECURITYIMAGE_ERROR ) ;
exit();
} elseif(!empty($framework)) {
include_once XOOPS_ROOT_PATH.'/Frameworks/captcha/captcha.php';
$security = new XoopsCaptcha();
if (!$security->verify(true)) {
if (!empty($_POST['pical_eventid'])) {
$redirect = XOOPS_URL . "/modules/piCal/?event_id=".intval($_POST['pical_eventid']);
} else {
$redirect = XOOPS_URL . "/modules/" . $modversion["dirname"] . "/formulaire.php?id=" . $_GET['id'] . "&qcm=" . $_GET['qcm'];
}
redirect_header( $redirect , 5, XOOPS_CAPTCHA_INVALID_CODE ) ;
exit();
}
}
// SecurityImage by DuGris
Bonne chance!
Posté le : 03/07/2008 20:47
|
|
|
Re: Securityimage dans smartpartner |
|
Xoops accro
Inscrit: 16/08/2005 19:46
De Nanterre
|
Merci Gérard, Malheureusement, cela ne fonctionne pas chez moi. Mais je vais exploiter les emplacement pour voir... mais quelqu'un en à un tout près... en échange, je l'accepterai dans ma tribu sur xoops communauté
Posté le : 04/07/2008 08:22
|
eparcyl... tranquille.
|
|
Re: Securityimage dans smartpartner |
|
Xoops accro
Inscrit: 20/02/2008 20:27
De Belgium
|
Chez moi ca marche avec le Frameworks/captcha.
Pour le dernier bloc du code, il faut modifiee les liens pour la redirection. Ca pointe vers la module d'origine formulaire, mais ca doit etre quelque chose comme modules/smartpartner/join.php .
Il faut voir aussi que tous les fichiers et bibliotheques (comme GD) necessaire (ils sont inclus ou referee par ces fichiers) sont present.
Posté le : 04/07/2008 09:30
|
|
|
Re: Securityimage dans smartpartner |
|
Xoops accro
Inscrit: 25/02/2004 00:20
De Région parisienne
|
Il n'est pas possible de reprendre une portion de code d'un module pour l'appliquer à un autre module, si c'était si simple !!! Pour Smartpartner version 1.2, c'est sur mon site dans la rubrique Utilisation de la class SecurityImage avecEn démo sur mon site : Devenir partenaire (accès membre uniquement) Pour les utilisateurs de Smartpartner version 1.2, il y a une correction à apporter pour php 5dans le fichier smartpartner/class/partner.php Remplacer la ligne 673
$sql = sprintf("INSERT INTO %s (id, categoryid, weight, hits, hits_page, url, image, image_url, title, summary, description, contact_name, contact_email, contact_phone, adress, `status`) VALUES ('', %u,%u, %u, %u, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %u)", $this->_db->prefix($this->_dbtable), $categoryid, $weight, $hits, $hits_page, $this->_db->quoteString($url), $this->_db->quoteString($image), $this->_db->quoteString($image_url), $this->_db->quoteString($title), $this->_db->quoteString($summary), $this->_db->quoteString($description), $this->_db->quoteString($contact_name), $this->_db->quoteString($contact_email), $this->_db->quoteString($contact_phone), $this->_db->quoteString($adress), $status);
par
$sql = sprintf("INSERT INTO %s (id, categoryid, weight, hits, hits_page, url, image, image_url, title, summary, description, contact_name, contact_email, contact_phone, adress, `status`) VALUES (0, %u,%u, %u, %u, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %u)", $this->_db->prefix($this->_dbtable), $categoryid, $weight, $hits, $hits_page, $this->_db->quoteString($url), $this->_db->quoteString($image), $this->_db->quoteString($image_url), $this->_db->quoteString($title), $this->_db->quoteString($summary), $this->_db->quoteString($description), $this->_db->quoteString($contact_name), $this->_db->quoteString($contact_email), $this->_db->quoteString($contact_phone), $this->_db->quoteString($adress), $status);
Posté le : 04/07/2008 10:47
|
|
|
Re: Securityimage dans smartpartner |
|
Xoops accro
Inscrit: 16/08/2005 19:46
De Nanterre
|
Monseigneur Dugris, Au nom des Nullos de Xoops French... je te déclare membre d'honneur de la tribu d'eparcyl92 . En tout cas... je te remercie beaucoup Pour info, j'avais presque trouvé mais il y a un détail qui ne me permettait pas de vérifier correctement les codes... J'avais regler de cache du module à 1 heure et cela à créer des problèmes pour l'actualisation. En tout cas ... merci à tous les deux Post ouvert le 04/02 19:50:40 post résolu le 04/07/2008 11:31
Posté le : 04/07/2008 11:30
|
eparcyl... tranquille.
|
Vous pouvez voir les sujets.
Vous ne pouvez pas débuter de nouveaux sujets.
Vous ne pouvez pas répondre aux contributions.
Vous ne pouvez pas éditer vos contributions.
Vous ne pouvez pas effacez vos contributions.
Vous ne pouvez pas ajouter de nouveaux sondages.
Vous ne pouvez pas voter en sondage.
Vous ne pouvez pas attacher des fichiers à vos contributions.
Vous ne pouvez pas poster sans approbation.
|