Visualizzazione dei risultati da 1 a 5 su 5
  1. #1

    Inserire checkbox privacy in questo script

    Salve a tutti,

    mi sono iscritto in questo forum nella speranza che qualcuno possa darmi una mano anche se da molto segue le vostre discussioni (molto utili)

    Ho questo plugin di Joomla al quale dovrei aggiungere una checkbox da spuntare obbligatoriamente prima dell'invio del form con il classico testo della privacy ma dopo tutte le prove che ho fatto mi da sempre errore...

    Codice PHP:
    if($this->params->get('use_recaptcha') == && stripos($buffer'{nomeplugin}')) {            $app JFactory::getApplication();            $lang   $this->_getLanguage();            $pubkey $this->params->get('public_key''');                $server 'https://www.google.com/recaptcha/api';                $output .= '<script src="'$server '/js/recaptcha_ajax.js"></script>';            $output .= '<script>jQuery(document).ready(function() {Recaptcha.create("' $pubkey '", "dynamic_recaptcha_1", {theme: "clean",' $lang 'tabindex: 0});});</script>';        }        // output the main wrapper        $output .= '<div class="nomepluginForm">';                    //        // output the form        //        // get the current page URL        $cur_url = ((!empty($_SERVER['HTTPS'])) && ($_SERVER['HTTPS']!='off')) ? "https://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'] : "http://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];        $cur_url = preg_replace('@%[0-9A-Fa-f]{1,2}@mi', '', htmlspecialchars($cur_url, ENT_QUOTES, 'UTF-8'));        //        $output .= '<form action="'.$cur_url.'" method="post">';            if(                $this->params->get('date_field') == 1 ||                $this->params->get('time_field') == 1 ||                $this->params->get('size_field') == 1            ) {                $output .= '<div class="nomeplugin-party-details">';            }                         if($this->params->get('date_field') == 1) {                $output .= '<div class="nomeplugin-date"><input type="text" class="auto-kal required" placeholder="'.JText::_('PLG_nomeplugin_DATE_PLACEHOLDER').'" name="nomeplugin-date" /></div>';            }                        if($this->params->get('time_field') == 1) {                $output .= '<div class="nomeplugin-time"><input type="text" class="required" placeholder="'.JText::_('PLG_nomeplugin_TIME_PLACEHOLDER').'" name="nomeplugin-time" /></div>';            }                        if($this->params->get('size_field') == 1) {                $output .= '<input type="text" class="required" placeholder="'.JText::_('PLG_nomeplugin_SIZE_PLACEHOLDER').'" name="nomeplugin-size" />';            }                        if(                $this->params->get('date_field') == 1 ||                $this->params->get('time_field') == 1 ||                $this->params->get('size_field') == 1            ) {                $output .= '</div>';            }             
                
    $output .= '<div class="nomeplugin-party-info">';                        if($this->params->get('name_field') == 1) {                $output .= '<input type="text" class="required" placeholder="'.JText::_('PLG_nomeplugin_NAME_PLACEHOLDER').'" name="nomeplugin-name" />';            }                        if($this->params->get('email_field') == 1) {                $output .= '<input type="email" class="required" placeholder="'.JText::_('PLG_nomeplugin_EMAIL_PLACEHOLDER').'" name="nomeplugin-email" />';            }                        if($this->params->get('phone_field') == 1) {                $output .= '<input type="text" class="required" placeholder="'.JText::_('PLG_nomeplugin_PHONE_PLACEHOLDER').'" name="nomeplugin-phone" />';            }                        if($this->params->get('text_field') == 1) {                $output .= '<textarea name="nomeplugin-text" class="required" placeholder="'.JText::_('PLG_nomeplugin_TEXT_PLACEHOLDER').'"></textarea>';            }                    if($this->params->get('additional_text') != '') {                $output .= '<small>'.$this->params->get('additional_text').'</small>';            }                                if($this->params->get('use_recaptcha') == 1) {                $output .= '<div id="dynamic_recaptcha_1"></div>';            }                        $output .= '<p><input type="submit" value="'.JText::_('PLG_nomeplugin_SEND_BTN').'" class="submit button-border" /></p>';
                
    $output .= '</div>';                            $output .= '<input type="hidden" value="'.$cur_url.'" name="return" />';            $output .= JHtml::_'form.token' );        $output .= '</form>';        // close the main wrapper        $output .= '</div>';        // replace the {nomeplugin} string with the generated output        $buffer = str_replace('{nomeplugin}', $output, $buffer);        // save the changes in the buffer        JResponse::setBody($buffer);                return true;    }    // Prepare the form    function onAfterInitialise() {            $post = JRequest::get('post');                   if(isset($post['nomeplugin-text'])) {               $app = JFactory::getApplication();            // if reCaptcha is enabled            if($this->params->get('use_recaptcha') == 1) {                JPluginHelper::importPlugin('captcha');                $dispatcher = JDispatcher::getInstance();                $res = $dispatcher->trigger('onCheckAnswer', $post['recaptcha_response_field']);                                if(!$res[0]){                    $app->redirect($post['return'],JText::_('PLG_nomeplugin_RECAPTCHA_ERROR'),"error");                }            }            // check the token            JSession::checkToken() or die( 'Invalid Token' );            // if the reCaptcha and token are correct - check the mail data:                        // get the mailing api            $mailer = JFactory::getMailer();                        // set the sender            $config = JFactory::getConfig();            $sender = array(                 $config->get('config.mailfrom'),                $config->get('config.fromname')             );                         $mailer->setSender($sender);                        // set the recipient            if(trim($this->params->get('emails')) != '') {                $mailer->addRecipient(explode(',', $this->params->get('emails')));                                // use XSS filters                $filter = JFilterInput::getInstance();                                 // Fields                $name = $this->params->get('name_field') == 1 ? $filter->clean($post['nomeplugin-name']) : '';                $email = $this->params->get('email_field') == 1 ? $filter->clean($post['nomeplugin-email']) : '';                $phone = $this->params->get('phone_field') == 1 ? $filter->clean($post['nomeplugin-phone']) : '';                    $date = $this->params->get('date_field') == 1 ? $filter->clean($post['nomeplugin-date']) : '';                $time = $this->params->get('time_field') == 1 ? $filter->clean($post['nomeplugin-time']) : '';                $size = $this->params->get('size_field') == 1 ? $filter->clean($post['nomeplugin-size']) : '';                $text = trim($filter->clean($post['nomeplugin-text']));                $title = JText::_('PLG_nomeplugin_STANDARD_SUBJECT') . $config->get('config.sitename');                                if(                    ($this->params->get('name_field') == 0 || ($this->params->get('name_field') == 1 && $name != '')) &&                    ($this->params->get('email_field') == 0 || ($this->params->get('email_field') == 1 && $email != '')) &&                    ($this->params->get('phone_field') == 0 || ($this->params->get('phone_field') == 1 && $phone != '')) &&                    ($this->params->get('date_field') == 0 || ($this->params->get('date_field') == 1 && $date != '')) &&                    ($this->params->get('time_field') == 0 || ($this->params->get('time_field') == 1 && $time != '')) &&                    ($this->params->get('size_field') == 0 || ($this->params->get('size_field') == 1 && $size != ''))                ) { 
    Grazie

  2. #2
    Utente di HTML.it L'avatar di badaze
    Registrato dal
    Jun 2002
    residenza
    Lyon
    Messaggi
    5,360
    Con uno script cosi male indentato, poche chance che qualcuno ti aiuti.
    Ridatemi i miei 1000 posts persi !!!!
    Non serve a nulla ottimizzare qualcosa che non funziona.
    Cerco il manuale dell'Olivetti LOGOS 80B - www.emmella.fr

  3. #3
    Quote Originariamente inviata da badaze Visualizza il messaggio
    Con uno script cosi male indentato, poche chance che qualcuno ti aiuti.
    Non so come farlo meglio... è il copia ed incolla da notepad++

  4. #4
    Utente di HTML.it L'avatar di brodik
    Registrato dal
    Jan 2009
    Messaggi
    764
    Che prove hai fatto?
    Che errore ti restituisce?
    Sei sicuro che il codice che hai copiato sia completo? Io non penso visto che riporti solo metà della funzione onAfterInitialise()
    eXvision

  5. #5
    Quote Originariamente inviata da brodik Visualizza il messaggio
    Che prove hai fatto?
    Che errore ti restituisce?
    Sei sicuro che il codice che hai copiato sia completo? Io non penso visto che riporti solo metà della funzione onAfterInitialise()
    Tutto il codice mi dice che il post contiene troppi caratteri, comunque ho provato ad inserire questo codice che solitamente uso in altri moduli

    Codice PHP:
    <input class="inputbox required " id="privacy" type="checkbox" name="privacy" /> * <colspan="2" height="40"><label id="privacymsg" for="privacy">
    <?php echo JText::_'Acconsento al trattamento dei miei dati personali come da D.Lgs 196/2003.' ); ?> <a class="condizioni" href="privacy-policy.html" target="_blank"><?php echo JText::_'Privacy Policy' ); ?></a>
    ma dove lo metto lo metto da sempre errore non capisco il motivo...

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.