Thread Rating:
  • 3 Vote(s) - 4.33 Average
  • 1
  • 2
  • 3
  • 4
  • 5
PlugIn Contact Form Getsimple
Hi Cumbe

Contact Form version 5.2.8.3.

This is an additional problem to the problems listed in my previous post of 2015-01-19 22:08:51

Setup :
I am wanting to use your Contact Form plugin in a multilanguage site, where I have a language switcher list of links on each frontend page, At the moment I have English and German, eg :
<a href="<?php echo htmlspecialchars(return_i18n_setlang_url('en')); ?>">English</a>
<a href="<?php echo htmlspecialchars(return_i18n_setlang_url('de')); ?>">Deutsch</a>

And I have all pages defined in the both languages

Problem :
In the frontend I open the website, and when I choose a different page via the website menu, the pages chosen remain in the chosen language .. for example language 1 .. this is good.
If I then choose another language - language 2 - with the language switcher, then the current page changes to language 2 .. this is also good.
But, then I choose another page with the website menu - the website shows this new page, BUT in the ORIGINAL language, here language 1 … It should remain with language 2 !
Note – I do NOT need to open the Contact Form page, to see this problem !

What I have noticed :
With define('GSDEBUG', TRUE); in gsconfig.php I get the following 2 warnings :

Notice: Undefined index: cbcontact/CONTACT in C:\xampp\htdocs\getsimple_tests\getsimple_test_contact_form\plugins\cbcontact_form.php on line 43

Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at C:\xampp\htdocs\getsimple_tests\getsimple_test_contact_form\plugins\cbcontact_form.php:43) in C:\xampp\htdocs\getsimple_tests\getsimple_test_contact_form\plugins\cbcontact_form.php on line 55


My Solution :
On cbcontact_form.php, line 43 (the admin add_action() call ) :
Change array 2nd param (the Contact Form Admin side menu label text ? )
from : $i18n['cbcontact/CONTACT']
to : i18n_r('cbcontact/CONTACT')
So we have : add_action('pages-sidebar','createSideMenu',array('cbcontact_form', i18n_r('cbcontact/CONTACT') ) );

With this solution, my problem above is solved / has gone / is no more / has ceased to be / it's all good !

What do you say ?

Cheers Aldebaran
Reply
Hello cumbe!
I want to use your plugin, but it not working. I see form and after click on "send" button - I see just half-loaded page and nothing received on email.

I use this code on a page which I created. This is the only content on the page.
(% cbcontact admin,true,false,'','email@mail.com' %)
Also if I use false for captcha - it anyway work...

Below is my dir structure
-public_html
--admin
--backups
--data
--plugins
---cbcontact
---PHPMailer_v5.1
---cbcontact_form.php

Thank you for any idea and sorry for bad english Smile
Reply
(2015-02-12, 21:17:35)smilesk Wrote: Hello cumbe!
I want to use your plugin, but it not working. I see form and after click on "send" button - I see just half-loaded page and nothing received on email.

I use this code on a page which I created. This is the only content on the page.
(% cbcontact admin,true,false,'','email@mail.com' %)
Also if I use false for captcha - it anyway work...

Hi smilesk, Cumbe

This would be a nice contact form plugin, with just the 4 simple fields : name, from email, subject, message, and an optional Captcha. But unfortuanately it has a few bugs. It would be good if Cumbe could correct these … and then we would have a super contact form !

I see you are setting fn param sendphpmail = false, which causes the plugin to use the php mail() fn to send a mail. I am using the plugin with param sendphpmail = true, so that class PHPmailer is used. I need this because my hoster requires a SMTP username/password. So I have not tested the php mail() fn.

But on the PHPMailer side, I got the got the plugin to work, BUT I first also needed to correct some bugs before it worked (I corrected the Captch disable bug, but there were other bugs).. I have informed Cumbe about these problems in a previous post.

It would be good, if Cumbe as author, could coordinate these bug corrections .. please ?

Regards Aldebaran
Reply
(2015-02-01, 21:00:10)aldebaran Wrote: My Solution :
On cbcontact_form.php, line 43 (the admin add_action() call ) :
Change array 2nd param (the Contact Form Admin side menu label text ? )
from : $i18n['cbcontact/CONTACT']
to : i18n_r('cbcontact/CONTACT')
So we have : add_action('pages-sidebar','createSideMenu',array('cbcontact_form', i18n_r('cbcontact/CONTACT') ) );

Thank you for posting a solution to the warnings. I will have to try it out. Unfortunately, I am still unable to move past version 5.7, as the contact form stops working. I tried again with Contact Form 5.8.2.3 yesterday after updating the site to GetSimple 3.3.5. If I get more time, I will try a few things with my site configuration to troubleshoot.
Reply
I had time to try disabling the various special options I was using in my installation. It turns out that sending mail does not work when canonical redirect is enabled in gsconfig.php.

# Enable Canonical Redirects?
#define('GSCANONICAL', 1);

I like having this option turned on because otherwise, duplicate content becomes available at different URLs on the site.

/contact/?&tp=contact redirects to /contact/ and probably loses the tp=contact value in the process.
Reply
Tried to hack around this... I got the form to work with canonical redirects by doing my best to remove the query string. I'm not very clear on what the point of it was though, so please review. As far as I can tell, the plugin is still functional without it.

Changes to cbcontact_form.php:

- Comment out Lines 254 - 256
PHP Code:
//    if ($PRETTYURLS !='') {
//        $idpret = $idpret.'?';
//    } 

- Remove query string from form action Line 369
-- Original:
PHP Code:
    $cbcontactform '<form id="cbform" class="" action="'.    $idpret.'&amp;tp=contact" method="post">'
-- Edited:
PHP Code:
    $cbcontactform '<form id="cbform" class="" action="'.    $idpret.'" method="post">'


Changes to comprueba.php:

- Comment out if clause that checks for query string.
Line 32, open:
PHP Code:
//    if (@$_GET['tp'] == 'contact') { 
Line 216, close:
PHP Code:
//    } 
Reply
Hi Cumbe and everyone

Re .. Bugs fixed, Here is an edited version of v5823

I am using this contact form plugin from Cumbe, but on downloading the latest version v5823, I had some bugs. I have fixed all the bugs that I have seen, and the contact form is now working well. Also, I added a little extra functionality to v5823, but this does NOT affect the original functionality.

So the reason for this post is that I offer you my bug fixed version and also the added functionality. … but I am not the original author, just trying to help. The edited files are included below.

First a important note : I have only ever used the PHPmailer class. In the contact form there are 2 send methods, which you can choose with function param ‘sendphpmail’ : false : use php mail() fn, true : use the PHPMailer class. In testing my bug fixes and functionality changes, I have only ever used/tested the PHPMailer class, and never the php mail() fn ... So if there any problems on he php mail() side them I have not look at these. But I have not touched the code for the actual send process using the other php mail() function … so I hope I have not broken that side … apologies if I have !

Indyana : I have not included your possible mod to possible problem, in you last post re canonical redirects.

... So all mods are relative to version 5823 :

1. Bugs fixed - general
a. Captcha validation enable / disable : If function param ‘captcha’ is set false, then now NO captcha validation is done AND the captcha fields are not shown in the contact form
b. Moved the add_action('pages-sidebar', …) fn in cbcontact_form.php to inside the if (basename($_SERVER, …)) {.. } block. .. otherwise had language switching problems (I have a multilanguage site) … a Cumbe mod, but not in v5823

2. Bugs fixed – PHPMailer
a. Put PHPMailer send() and some add email address fns in a try/catch, to catch otherwise uncaught exceptions when have send problems.
b. v5823 : $message->FromName = $from = > Changed to : Mail->fromEmail = $from .. otherwsie have problems

3. Functional changes – General
a. Add the following 2 boolean configs .. in my edited cbcontact_form.php, line 322 and 329 .. to change their true/false values change them directly in the code. (I did not want to change the cbcontact_page() fn param list) :

b. $display_jsalert_boolean
i. true => Display success/error message on send in a javascript alert box (as v5823)
ii. false => Display success/error message on send in the html at the top of the re-output contact form , colour blue = success, red = error

c. $required_fields_all_boolean
i. true => All four contact form textfields are required
ii. false => Only the fields 'Name' and 'Subject' are required (as v5823)

d. input param $usu - the GS admin username, used to look up his email address in the GS admin => This can now also be directly an email address and will be accepted as such, exactly in the same way as the ‘other users’ $usus

e. Tidy code : Since I was doing a number of changes, I generally tidied some code here and there, to make it clearer to understand, at least for me, but functionality not changed because of this.


4. General PHPMailer setup
a. In my edited comprueba.php file I have all the PHPMailer params setup for my needs as follows
b. Note the API description for PHPMiler is at : http://phpmailer.github.io/PHPMailer/cla...ailer.html

c. In general, for your particular setup you need to assign some or all of the following
i. $mail->IsSMTP() / isMail() / isSendmail()
ii. $mail->SMTPSecure = "" / "ssl" / "tls"
iii. $mail->Host = "my.server.name"; // specify SMTP Server name
iv. $mail->Port = 25; // specify SMTP Server port nr, default = 25
v. $mail->SMTPAuth = true/false ; // turn on/off SMTP authentication
vi. $mail->Username = "me@myusername.com"; // SMTP username
vii. $mail->Password = "mypassword"; // SMTP password

d. As an example, for my needs I have => I am sending over SMTP to my website hoster’s smtp mail server, which has the same server name as my hoster, so smtp server is localhost, and authentication is required :
i. $mail->IsSMTP(); // send mail over SMTP
ii. // $mail->SMTPSecure = xx // no ssl/tls required (at the moment), default = “” = not secure
iii. $mail->Host = "localhost"; // smtp server is same as my hoster
iv. $mail->Port = 25; // This is the default anyway
v. $mail->SMTPAuth = true; // Require SMTP username / password to send
vi. $mail->Username = "me@myusername.com"; // SMTP username (dummy)
vii. $mail->Password = "mypassword"; // SMTP password (dummy)
.
5. So here are the files … use them all together, just replace the original with these. Not, the css file is not necessary, but I just changed it a bit so looked better for me. PS to everyone .. is there a better place in the future to upload whole files ? , as I think code tags are really only meant for code snippets.

6. Tell me if it has improved things for you

7. Cumbe, if you have time can you check through these mods and see what you think, and maybe you can include the mods in an updated version of the proper online version, that would be great

Regards Aldebaran

cbcontact_form.php :
PHP Code:
<?php

/*****************************************************/
/* Aldebaran Edited Version 1.0                      */
/* - An edit of Cumbe's plugin 'Contact Form' v5823  */
/*****************************************************/

/*
Name: Simple Cumbe contact form
Description: It is a simple contact form
Version: 5.8.2.3
Author: Cumbe (Miguel Embuena Lance)
Author URI: http://www.cumbe.es/contact/
*/

// Relative
$relative '../';
$path $relative'data/other/';

# get correct id for plugin
$thisfile=basename(__FILE__".php");

# register plugin
register_plugin(
    
$thisfile,
    
'Cumbe_contact',
    
'5.8.2.3',
    
'Cumbe',
    
'http://www.cumbe.es/contact/',
    
'Description:  Getsimple contactform.',
    
'pages'//page type
    
'vermensajes'
);

//set internationalization
global $LANG;
if (
basename($_SERVER['PHP_SELF']) != 'index.php') { // backend only
  
i18n_merge('cbcontact'$LANG);
  
i18n_merge('cbcontact''en_US');
  
// New Cumbe Mod 
  // add to sidebar of admin > pages
  
add_action('pages-sidebar','createSideMenu',array('cbcontact_form'$i18n['cbcontact/CONTACT']));
}

//add css to head
add_action('theme-header','cbcontact_css');

//check $_SESSION
add_action('index-pretemplate''cbcontact_session');

// New Cumbe Mod  .. moved to above  
// add_action('pages-sidebar','createSideMenu',array('cbcontact_form', $i18n['cbcontact/CONTACT']));

//filter $content
add_filter('content','cbcontact_content');

function 
cbcontact_css(){
   global 
$SITEURL;
   echo 
'<link href="'.$SITEURL.'plugins/cbcontact/form/cbcontact.css" rel="stylesheet" type="text/css" />';
}

function 
cbcontact_session(){
   if( !isset(
$_SESSION)){
         
session_start();
   }
}


/* ***************************************************** */
/* Function  vermensajes()  =>  list_email_log()         */ 
/* This is called in the backend/admin  to display the   */
/* contact form pa<ge showing the list of email sent     */
/* ***************************************************** */ 
function vermensajes(){
    global 
$i18n

    
$log_name 'cbcontactform.log';
    
$log_path GSDATAOTHERPATH.'logs/';
    
$log_file $log_path $log_name;

?>
    <script type="text/javascript">
        <!--
    function confirmar(formObj,count,msge,bck) {
        if(!confirm(msge)) { 
                   return false; 
            } else {
                   if (bck == 'log'){
                       if (count =='n'){
                           window.location="load.php?id=cbcontact_form&action=delete";
                       } else {   
                           window.location="load.php?id=cbcontact_form&n_del=" + count + "";
                       }
                   } 
                   return false;
            }    
        }

        -->
    </script> 
<?php

    
if(file_exists($log_file)) {
        
$log_data getXML($log_file);
        if (@
$_GET['action'] == 'delete' && strlen($log_name)>0) {
            
unlink($log_file);
            
exec_action('logfile_delete');
?>
                    <label>Log <?php echo $log_name;?> <?php echo $i18n['MSG_HAS_BEEN_CLR']; ?>            
                </div>
            </div>
            <div id="sidebar" >
                <?php include('template/sidebar-pages.php'); ?>
            </div>    
            <div class="clear"></div>
            </div>
            <?php get_template('footer'); ?>
<?php
            
exit;
        }

        
//delete one register:entry
        
if (@$_GET['n_del'] != ''){
            
$domDocument = new DomDocument();
            
$domDocument->preserveWhiteSpace FALSE
            
$domDocument->load($log_file);
            
$domNodeList $domDocument->documentElement;
            
$domNodeList $domDocument->getElementsByTagname('entry');
            
$ndel = @$_GET['n_del'];
            
$ndL $domNodeList ->item($ndel)->parentNode;
            
$ndL -> removeChild($domNodeList ->item($ndel));

            
//sase again modified document
            
$domDocument->save($log_file);
        }     

        
//load data of xml
        
$log_data getXML($log_file);
        
//END delete one register

?>

        <label><?php echo $i18n['VIEWING'];?>&nbsp;<?php echo $i18n['LOG_FILE'];?>: &lsquo;<em><?php echo @$log_name?></em>&rsquo;</label>
        <div class="edit-nav" >
<?php
            
echo '<a href="load.php?id=cbcontact_form&action=delete" accesskey="c" title="'.$i18n['CLEAR_ALL_DATA'].' '.$log_name.'" onClick="return confirmar(this,&quot;n&quot;,&quot;'.$i18n['CLEAR_ALL_DATA'].' '.$log_file.'. '.$i18n['cbcontact/delsure'].'&quot;,&quot;log&quot;)" />'.$i18n['CLEAR_THIS_LOG'].'</a>';
            echo 
'<div class="clear"></div>';
        echo 
'</div>';
        echo 
'<ol class="more" >';
            
$count 0;

            foreach (
$log_data as $log) {
                echo 
'<li><p style="font-size:11px;line-height:15px;" ><b style="line-height:20px;" >'.$i18n['LOG_FILE_ENTRY'].':'.$count.'</b><a style="padding-left: 50px;" title="'.$i18n['cbcontact/ndel'].'" href="load.php?id=cbcontact_form" onClick="return confirmar(this,&quot;'.$count.'&quot;,&quot;'.$i18n['cbcontact/ndelc'].$count.'. '.$i18n['cbcontact/delsure'].'&quot;,&quot;log&quot;)"><b>X</b></a><br />';
;
                foreach(
$log->children() as $child) {
                    
$name $child->getName();
                    echo 
'<b>'stripslashes(ucwords($name)) .'</b>: ';      
                    
$d $log->$name;
                    
$n strtolower($child->getName());
                    
$ip_regex '/^(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:[.](?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}$/';
                    
$url_regex = @"((https?|ftp|gopher|telnet|file|notes|ms-help):((//)|(\\\\))+[\w\d:#@%/;$()~_?\+-=\\\.&]*)";
                      
                      
                    
//check if its an url address
                    
if (do_reg($d$url_regex)) {
                        
$d '<a href="'$d .'" target="_blank" >'.$d.'</a>';
                    }
                      
                    
//check if its an ip address
                    
if (do_reg($d$ip_regex)) {
                        if (
$d == $_SERVER['REMOTE_ADDR']) {
                            
$d $i18n['THIS_COMPUTER'].' (<a href="http://www.geobytes.com/IpLocator.htm?GetLocation&IpAddress='$d.'" target="_blank" >'.$d.'</a>)';
                        } else {
                            
$d '<a href="http://www.geobytes.com/IpLocator.htm?GetLocation&IpAddress='$d.'" target="_blank" >'.$d.'</a>';
                        }
                    }
                      
                    
//check if there is an email address
                    
if (check_email_address($d)) {
                        
$d '<a href="mailto:'.$d.'">'.$d.'</a>';
                    }
                      
                    
//check if its a date
                    
if ($n === 'date') {
                        
$d lngDate($d);
                    }
                          
                    echo 
stripslashes(html_entity_decode($d));
                    echo 
' <br />';
                }
                echo 
"</p></li>";
                
$count++;
            }                
                
?>
        </ol>
        
<?php
    
//END if file_exists
    
else
    {   
//If file does not exist
?>
        <label><?php echo $i18n['MISSING_FILE']; ?>: &lsquo;<em><?php echo @$log_name?></em>&rsquo;</label>
<?php
    
}

}  
// END vermensajes


/* ********************************************** */
/*  Function  cbcontact_content($content)         */ 
/*                                                */
/* ********************************************** */ 
function cbcontact_content($content){
  
////////////////////////////////////////////////////////////////////  
  //         filter content of page searching $cbcontact 
  ////////////////////////////////////////////////////////////////////  

   /*
   echo ' <br>At the very START of function cbcontact_content <br><br>';
   echo '\$content at start  = '.$content.'<br><br>';
   */
  
    
if ( preg_match("/\(%\s*(cbcontact)(\s+(?:%[^%\)]|[^%])+)?\s*%\)/"$content$coinc)){
        
$array_coinc explode(','$coinc[2]);
        
$cuantos count($array_coinc);

        
array_filter($array_coinc'trim_value');
        
$array_coinc str_replace("'","",$array_coinc); 
        
$array_coinc str_replace(" ","",$array_coinc); 

        if (
array_key_exists ('1'$array_coinc) === false) {
            
$array_coinc[1] = 'true';
        } else {
            
$array_coinc[1] = trim($array_coinc[1]);
        }  
        if (
array_key_exists ('2'$array_coinc) === false) {
            
$array_coinc[2] = 'false';
        } else {
            
$array_coinc[2] = trim($array_coinc[2]);
        } 

        
$usus '';   
        for (
$q 4$q $cuantos$q++ ){
            
$usus[$q] = $array_coinc[$q];
        }  
        
$usus str_replace("'","",$usus); 
        
$usus str_replace(" ","",$usus); 
        


      
$content_cbcontact cbcontact_page (trim($array_coinc[0]), $array_coinc[1], $array_coinc[2], false,  $usus);
      
        
$content str_replace($coinc[0], $content_cbcontact$content);
    } 
   
   return 
$content;
}   


/* *************************************************************************************************** */ 
/*  cbcontact_page()  : Main function to output the Contact form, and  send the form data as an email  */  
/*                                                                                                     */
/*      1st para : $usu, String, user name of GetSimple admin, or the user's email addr.               */ 
/*      2nd para : $captcha, Boolean,  true = Use Captcha, false = Don’t use Captcha,                  */ 
/*      3rd para : $sendphpmail, Boolean, true = send mail with PHPMailer class,                       */
/*                                       false = with the php fn  mail()                               */ 
/*      4th para : $echocontact, Boolean, true = echo the HTML code for the contact form,              */
/*                                       false = return the HTML code                                  */ 
/*      5th para : $usus .. A String array of users / users' emails                                    */ 
/* *************************************************************************************************** */  
function cbcontact_page($usu$captcha=true$sendphpmail=false$echocontact=true$usus='') {

    global 
$admin_user_email
    global 
$SITEURL;
    global 
$SITENAME;
    global 
$LANG;
    global 
$PRETTYURLS;
    global 
$i18n;
    global 
$language;
   
  
/* ------------------------------------------------------------------------------------- */ 
  /* Convert passed boolean/strings $captcha, $sendphpmail and $echocontact                */
  /* to definite booleans. ... These passed in params can be either boolan or string  ..   */ 
  /* .. So converting to ONLY booleans makes any 'if' code where they are used clearer AND BUG free !*/ 
  /* ------------------------------------------------------------------------------------- */
  // Convert $captcha to $captchaboolean
  // $captcha -> $captchabool :  "1" ->T, "true"->T, "TRUE"->T, "0"->F, "false"->F, "FALSE"->F, ""->F, "Any"->T, true->T, false->F
  
$captchaboolean  false;  
  if ((
$captcha == false)  or  (strtolower($captcha) == "false"))
  { 
$captchaboolean false; }                          
  else 
  { 
$captchaboolean true; }
    
    
  
// Convert $sendphpmail to $sendphpmailboolean
  // $sendphpmail -> $sendphpmailboolean :  "1" ->T, "true"->T, "TRUE"->T, "0"->F, "false"->F, "FALSE"->F, ""->F, "Any"->T, true->T, false->F
  
$sendphpmailboolean  false;  
  if ((
$sendphpmail == false)  or  (strtolower($sendphpmail) == "false"))
  { 
$sendphpmailboolean false; }                          
  else 
  { 
$sendphpmailboolean true; }
 
    
  
// Convert $echocontact to $echocontactboolean
  // $echocontact -> $echocontactbool :  "1" ->T, "true"->T, "TRUE"->T, "0"->F, "false"->F, "FALSE"->F, ""->F, "Any"->T, true->T, false->F
  
$echocontactboolean  false;  
  if ((
$echocontact == false)  or  (strtolower($echocontact) == "false"))
  { 
$echocontactboolean false; }                          
  else 
  { 
$echocontactboolean true; }

  
/* ---------------------------------------- */ 
  /*    Define some additional local booleans   */
  /* ---------------------------------------- */
  
   // -----------------------------------------
   //  Display success/error message on send, either
   //  $display_jsalert_boolean = true  => In a javascript alert box,  or  
   //  $display_jsalert_boolean = false => In the html at the top of the re-output contact form  
   // -----------------------------------------
   
$display_jsalert_boolean true;
          
   
// -----------------------------------------
   //  Define the fields that are required/mandatory/obligatory  ..
   //  $required_fields_all_boolean = true  => All contact form fields are required
   //  $required_fields_all_boolean = false => Only the fields 'Name' and 'Subject' are required  
   // -----------------------------------------
   
$required_fields_all_boolean false;
          

    
$log_name 'cbcontactform.log';
    
$log_path GSDATAOTHERPATH.'logs/';
    
$log_file $log_path $log_name;
    
$fich return_page_slug();
    
$idpret find_url($fich,'');
    if (
$PRETTYURLS !='') {
        
$idpret $idpret.'?';
    }

    if (
file_exists('gsconfig.php')) {
        include_once(
'gsconfig.php');
    }

    
// Debugging
    
if (defined('GSDEBUG')){
        
error_reporting(E_ALL E_STRICT);
        
ini_set('display_errors'1);
    } else {
        
error_reporting(0);
        @
ini_set('display_errors'0);
    }

    
//Check session: important for captcha and contact form    
    
if (!isset($_SESSION)) { session_start(); }

   
   
// Get the Email address and language defined in the GS admin for the admin user 
   
if (!check_email_address($usu)){ 
      if (
file_exists(GSDATAPATH.'users/'.$usu.'.xml')) {
         
$data getXML(GSDATAPATH.'users/'.$usu.'.xml');  
         
$admin_user_email $data->EMAIL;
         
$LANG $data->LANG;
      }    
   } 
   else {
      
// $value is already/directly a valid email => so assign directly 
      // to admin_user_email   
      
$admin_user_email $usu;
      
$LANG 'en_US'// Just a basic default if don't know anything else 
   
}

    
// i18n compatible
    
if (isset($_GET['setlang'])){
        
$LANG $_GET['setlang']. '_'.strtoupper($_GET['setlang']);
    }
    if (isset(
$language)){
        switch (
$language) {
            case 
'en':
                
$LANG $language'_US';
                break;
            default:
              
$LANG $language'_'.strtoupper($language);
               break;
        }
    }
    
// i18n lang  
    
i18n_merge('cbcontact'$LANG);     

   
   
// Get the email address of the other users, defined in fn array param $usus
   // For each value of $usus if it is an email address, then assign it directly
   // to output array $other_user_emails, else assume it is a user name, so get this user's
   // email address from the GS admin, and then assign this to $other_user_emails. Note,
   // this may not actually be a valid email addr, but assign it anyway .. will
   // get an error on send (probably) to highlight the problem .. and the admin 
   // can correct the email entry in GS admin 
   
   // Note, if cbcontact_page() is called from add_filter function cbcontact_content(),
   // then if array $usus exists, its first key value is 4, and NOT 0    
   
   // Note, the output array other_user_emails will not be created at all, if have no valid email
   // directly in usus and none can be found in GS admin.  ... so when use other_user_emails 
   // afterwards test if it first exists with if (isset($other_user_emails))    

   // $usus is the array (or poss single var) of other users or emails passed to the fn 
    
if ($usus != ''){
      
// If usus is a single variable, then make into an array .. so can check it also below 
      
if (!(is_array($usus))){
         
$temp =  $usus;
         unset(
$usus);
         
$usus[4] = $temp;         
        }
      if (
is_array($usus)) {
         foreach (
$usus as $key=> $value) {   
            if (!
check_email_address(trim($value))){ 
               if (
file_exists(GSDATAPATH.'users/'.trim($value).'.xml')) {
                  
$data getXML(GSDATAPATH.'users/'.trim($value).'.xml');  
                  
$other_user_emails[$key] = $data->EMAIL;  
               }    
            } 
            else {
               
// $value is already/directly a valid email => so assign directly 
               // to other_user_emails 
               
$other_user_emails[$key] = trim($value);
            }
         } 
// end for each
      
}
    } 
 
   
// Initialise error flag/string and message output string
   
$err '';
   
$msgshw '';

   
// Define an assoc array fields[] to temporarily hold the user entered textfield values.
   // Also used to to re-output textfield for the next displayed HTML contact form.
   
global $fields;
    
$fields = array(
        
i18n_r('cbcontact/Nb') =>  '',  // 'Name',
        
i18n_r('cbcontact/Em') =>  '',  // 'Email',
        
i18n_r('cbcontact/Sub') => '',  // 'Subject',
        
i18n_r('cbcontact/Ms') =>  '',  // 'Message', 
    
);
 
   
// If we come here becuse the contact form was already displayed and the user hit the 
   // submit button, then insert the validate fields/send mail script 
   // Else This is the first time display of the contact form, so just continue ...    
    
if (isset($_POST['contact-submit'])) {
   
        include (
GSPLUGINPATH."cbcontact/comprueba.php");
    }
   

?>
    <script type="text/javascript">
    <!--
        function rec_cpt(id,ourl){
            var aleat = Math.random();
            var mf = document.getElementById(id);
            mf.src = ourl + "/cbcontact/&" + aleat;
        }
    -->
    </script>

<?php

    
//control uri
    
$request_uri getenv ("REQUEST_URI");       // Requested URI

    //Show in page   
    
$mGSPLUGINPATH str_replace("\\""/"GSPLUGINPATH);
    
$mGSPLUGINPATH substr($mGSPLUGINPATH0, -1);

    
// -------------------------
   // Set up the actual Form HTML 
   // -----------------------
  
    
$cbcontactform '<form id="cbform" class="" action="'.    $idpret.'&amp;tp=contact" method="post">';
   
   
// Aldebaran : If option selected, add in a message after a send, will be a success or error message.
   
if ($display_jsalert_boolean === false) {
      if (
$msgshw != ''$cbcontactform .= '<div class = "msgshw" >'.$msgshw.'</div>';
      else 
$cbcontactform .= '<div class = "msgshw" >&nbsp;</div>';
   }

   
// Call script to include the main body of he form  
    
include  (GSPLUGINPATH.'cbcontact/form/cbcontact.php');

    
// add in hidden fields
    
$cbcontactform .= "\r\n\t".'<input type="hidden" name="contact[q_uri]" value="'.$request_uri.'">';
    
$cbcontactform .= "\r\n\t".'<input type="hidden" name="contact[leaveblank]" value="">';
    
$cbcontactform .= "\r\n\t".'<input type="hidden" name="contact[leaveso]" value="leaveso">';
    
$cbcontactform .= "\r\n".'</form>'."\r\n\t";

   
// ---------------------------------------------------------------------------------------------
   // Echo or return the contact form html 
   //    
   // $echocontact is passed in as FALSE when cbcontact_page() is called from cbcontact_content() 
   // so that we return HTML content of $cbcontactform to cbcontact_content() where it is then
   // added to $content .. so we replace the page editer entered (% %) syntax with the form code.   
   // 
   // $echocontact is passed in as TRUE when we just want to echo the HTML content of $cbcontactform,
   // eg when we directly call cbcontact_page() from a template file.   
   // ----------------------------------------------------------------------------                                                                   ------------------
   
if ($echocontactboolean === true){
        echo 
$cbcontactform;
    } else {
        return 
$cbcontactform;
    } 

}

function 
trim_value(&$value){
    
$value trim($value); 
}
 
?>

cbcontact/comprueba.php :
PHP Code:
<?php

/*****************************************************/
/* Aldebaran Edited Version 1.0                      */
/* - An edit of Cumbe's plugin 'Contact Form' v5823  */
/*****************************************************/

//-----------------------------------------------------------------//
//--- comprueba.php:  action if form is submit                     //
//-----------------------------------------------------------------//
if (!isset($_SESSION)) { session_start(); }

  if (
$captchaboolean === true) {  
    
$imagenCadena $_SESSION["imagencadena"]; 
    
$pot trim(strtolower($imagenCadena));
  }
  
  
$server_name getenv ("SERVER_NAME");       // Server Name
  
$request_uri getenv ("REQUEST_URI");       // Requested UR

// check antispam 
if (isset($_POST['contact-submit'])) {
    if (
$_POST['contact']['leaveso'] != 'leaveso' or $_POST['contact']['leaveblank']!=''){
       echo 
'<html>';
       echo 
'<head>';
       echo 
'</head>';
       echo 
'<body>';
       echo 
'<div style="padding: 20px; border: 4px double; margin: 20%;">';
       echo 
i18n_r('cbcontact/spam').'<br />';
       echo 
'<a href="'.$idpret.'">'.i18n_r('cbcontact/back').'</a>';
       echo 
'</div>';
       echo 
'</body>';
       echo 
'</html>';   
       exit; 
    }  
}

//------------------------
//START CONTACT
//------------------------
    
if (@$_GET['tp'] == 'contact') { 
        if (isset(
$_POST['contact-submit'])) {
      
          
// Assign the Forms POST params to the local array $fields[ ]
         // Note $_POST['contact'] is an array of all the field values 
         
$fields $_POST['contact'];  
         
         
// Just remove any leading/trailing spaces, so if a field just 
         // contains spaces it is completely emptied, so validated correctly     
         
foreach ( $fields as $key => $value ) {
                     
$fields[$key] = trim($value);
            }
         
         
// ------------------------------------------ //
         //  Do field validation                       //
         // ------------------------------------------ // 
         
$err '';
            
         
// Check captcha - mandatory, if enabled. Note $pot = value of $imagenCadena     
         
if ($captchaboolean === true)  {

                if ( 
$pot != trim(strtolower($fields['pot']))) {

                    
$err i18n_r('cbcontact/MSG_CAPTCHA_FAILED');  
               
$err .= ' Captcha code: '.$pot.', Code wrote: '.$fields['pot'];                 
                }
            }
         
         
// if err != '' due to Captca err then don't do any more validating 
         
if ($err == '') { 
         
            
// Check all fields, mandatory or not   .. 
            // Check in reverse order so first see the error message of top most field 
            // ------------------------------------------------------
       
            // Check MESSAGE - If empty, label, (*)label then empty, and (Is mandatory) so then set err msg    
            
if ( ($fields[i18n_r('cbcontact/Ms')] == '' )  or 
                 (
$fields[i18n_r('cbcontact/Ms')] == '(*)'.i18n_r('cbcontact/Ms'))  or 
                     (
$fields[i18n_r('cbcontact/Ms')] == i18n_r('cbcontact/Ms')) 
               ) 
            {
               
$fields[i18n_r('cbcontact/Ms')] = '';
               
$err i18n_r('cbcontact/Ms'). ' : *** '.i18n_r('cbcontact/Co').' ***';
            }

            
// Check SUBJECT  - If empty, label, (*)label then empty, and If mandatory then set err msg   
            
if ( ($fields[i18n_r('cbcontact/Sub')] == '' )  or 
                 (
$fields[i18n_r('cbcontact/Sub')] == '(*)'.i18n_r('cbcontact/Sub'))  or 
                 (
$fields[i18n_r('cbcontact/Sub')] == i18n_r('cbcontact/Sub')) 
               ) 
             {
                
$fields[i18n_r('cbcontact/Sub')] = '';
                if (
$required_fields_all_boolean === true) { $err i18n_r('cbcontact/Sub'). ' : *** '.i18n_r('cbcontact/Co').' ***'; }
             }
           
     
            
// Check EMAIL - If empty, label, (*)label then empty, and (Is mandatory) so then set err msg   
            
if ( ($fields[i18n_r('cbcontact/Em')] == '' )  or 
                 (
$fields[i18n_r('cbcontact/Em')] == '(*)'.i18n_r('cbcontact/Em'))  or 
                     (
$fields[i18n_r('cbcontact/Em')] == i18n_r('cbcontact/Em')) 
               ) 
            {
               
$fields[i18n_r('cbcontact/Em')] = '';
               
$err i18n_r('cbcontact/Em'). ' : *** '.i18n_r('cbcontact/Co').' ***';
            }
            
            
// Check NAME  - If empty, label, (*)label then empty, andIf mandatory then set err msg   
            
if ( ($fields[i18n_r('cbcontact/Nb')] == '' )  or 
                 (
$fields[i18n_r('cbcontact/Nb')] == '(*)'.i18n_r('cbcontact/Nb'))  or 
                 (
$fields[i18n_r('cbcontact/Nb')] == i18n_r('cbcontact/Nb')) 
               ) 
            {
                
$fields[i18n_r('cbcontact/Nb')] = '';
                if (
$required_fields_all_boolean === true) { $err i18n_r('cbcontact/Nb'). ' : *** '.i18n_r('cbcontact/Co').' ***'; }
            }

         }  
//  END check the 4 text fields 

         // Validate done .. If $err still empty, then all OK, else $err contains the err msg  
         // Also, for any field, mandatory or not, if they had a reminder label in them
         // then these should now be empty (if had no captach error)    

         // Also just assign the 4 main fields to simple local variables, just for convenience  
         
$field_fromName  stripslashes(html_entity_decode($fields[i18n_r('cbcontact/Nb')]));
         
$field_fromEmail stripslashes(html_entity_decode($fields[i18n_r('cbcontact/Em')]));
         
$field_subject   stripslashes(html_entity_decode($fields[i18n_r('cbcontact/Sub')]));
         
$field_message   stripslashes(html_entity_decode($fields[i18n_r('cbcontact/Ms')]));
  
         
// If No error then prepare mail for send  ...    
            
if ($err == '') {

            
// Build the Body of  the mail from the 4 contact form fields, ´plus ip address etc
            // ----------------------------------------------            
                
$body '"'.$field_subject.'": <a href="'.substr($idpret,0,-1).'">'.substr($idpret,0,-1).'</a>';
                
$body .= "<hr><br />";

                if ( ! 
file_exists($log_file) ) {
                    
$xml = new SimpleXMLExtended('<channel></channel>');
                } else {
                    
$xmldata file_get_contents($log_file);
                    
$xml = new SimpleXMLExtended($xmldata);
                }

                
$thislog $xml->addChild('entry');
                
$thislog->addChild('date'date('r'));
                
$cdata $thislog->addChild('captcha');
                
$cdata->addCData($captcha);
                
$cdata $thislog->addChild('ip_address');
                
$ip getenv("REMOTE_ADDR"); 
                
$cdata->addCData(htmlentities($ipENT_QUOTES'UTF-8'));
                
$body .= "Ip: "$ip ."<br />"
            
            unset(
$fields['pot']);
               unset(
$fields['contact-submit']);
               unset(
$fields['submit']);
               unset(
$fields['leaveso']);
               unset(
$fields['leaveblank']);
                foreach ( 
$fields as $key => $value ) {
                    if (
substr($key02) != 'q_') {
                        
$body .= ucfirst($key) .": "stripslashes(html_entity_decode($valueENT_QUOTES'UTF-8')) ."<br />";
                        
$cdata $thislog->addChild(clean_url($key));
                        
$cdata->addCData(stripslashes(html_entity_decode($valueENT_QUOTES'UTF-8')));
                    }
                }
            
                
XMLsave($xml$log_file);
            
            
            
// *************************************************************** //
            //  Send the mail .. with the PHP mail() fn or the PHPMailer class //
            // *************************************************************** //
          
            
if ($sendphpmailboolean === false)
            {
               
// ****************************************** //
               //  Send the mail .. with the PHP mail() fn   //
               // ****************************************** //
               
               
$headers "From: ".$field_fromEmail."\r\n";
               
$headers .= "Return-Path: ".$field_fromEmail."\r\n";
               
$headers .= "Content-type: text/html; charset=UTF-8 \r\n";

                
$result mail($admin_user_email$field_subject$body$headers);
               if (
$result == false) { $err "".i18n_r('cbcontact/MSG_guestERR')." <br>";}
                   if (isset(
$other_user_emails))  {
                  foreach (
$other_user_emails as $key=>$value){
                            
$result =  mail($value$field_subject$body$headers);
                     if (
$result == false) { $err "".i18n_r('cbcontact/MSG_guestERR')." <br>";}
                  }
                    }
          
            }
            else  
// $sendphpmailboolean = true
            
{      
               
// ****************************************** //
               //  Send the mail .. with PHPMailer           //
               // ****************************************** //

               
if (is_dir(GSPLUGINPATH.'PHPMailer_v5.1') and file_exists(GSPLUGINPATH.'PHPMailer_v5.1/class.phpmailer.php')){
               
                  require(
GSPLUGINPATH.'PHPMailer_v5.1/class.phpmailer.php');   
               
                  
$mail = new PHPMailer(true); // the true param means it will throw exceptions on errors, which we need to catch
                             
                  
$mail->CharSet "utf-8"
                  
$mail->SMTPDebug false;    // enables SMTP debug information (for testing)
                                                        // false = disabled debug
                                                        // 1 = errors and messages
                                                        // 2 = messages only
                  // set mailer to use SMTP
                  
$mail->IsSMTP();

                  
// Uncomment this if you need ssl
                  
$mail->SMTPSecure ""// "ssl";   

                  // As this email.php script lives on the same server as our email server
                  // we are setting the HOST to localhost

                  
$mail->Host "localhost";   // specify SMTP Server name
                  
$mail->Port 25;            // specify SMTP Server port number, default 25  
                  
$mail->SMTPAuth true;    // turn on SMTP authentication

                  // When sending email using PHPMailer, you need to use a valid email address 
                  // - username/password
                  
$mail->Username "me@myusername.com";  // SMTP username (dummy)
                  
$mail->Password "mypassword"// SMTP password (dummy)

                  // set word wrap to 50 characters
                  
$mail->WordWrap 50;

                  
// set email format to HTML
                  
$mail->IsHTML(true);

                  
// Set the From email address
                  
$mail->From $field_fromEmail;  //  The From email address - Form field 'Email'   
                  
$mail->FromName $field_fromName;  // Form field 'Name' => The name seen outside the < > of the From email address 

                  
$mail->Subject $field_subject// Form field 'Subject' 
                  
                  // Assign the email body $body, created above 
                  
$myBody $body;
                  
$mail->Body $myBody;  // Form field 'Message'
                  
$mail->AltBody $myBody;  // Body for non-HTML mail clients .. so should be in plain text, here not  

                  
$ex null;
                  try {
                     
// Add the TO email address of the GS admin user, and the
                     // TO email addresses $other_user_emails of the passed in users $usus   
        
                    
$mail->AddAddress($admin_user_email,"");
                     
// echo "Email added : ".$admin_user_email."<br/>";
                     
if (isset($other_user_emails))  {
                        foreach (
$other_user_emails as $key=>$value){
                            
$mail->AddAddress($value,""); 
                            
// echo "Email added : ".$value."<br/>"; 
                        
}
                     }

                    
// Add a ReplyTo email address  
                    
$mail->addReplyTo($field_fromEmail$field_fromName); 
                    
                    
// Actually send the email  
                    
$mail->Send();

                  }
                  catch (
phpmailerException   $ex){ 
                     
$err "".i18n_r('cbcontact/MSG_guestERR')." <br>";
                     
$err .= "Mailer Error: "$mail->ErrorInfo;
                  }
                  catch (
Exception   $ex){ 
                     
$err "".i18n_r('cbcontact/MSG_guestERR')." <br>";
                     
$err .= "Mailer Error: "$mail->ErrorInfo;
                  }

               }  
// End else if dir PHPMailer_v5.1 exists etc  
               
else {
                  
//  Developer/ plugin user message  ..   Folder PHPMailer_v5.1 does not exist  
                  
$err strtoupper(i18n_r('cbcontact/errphphmail'))."<br/>";   
               }

            } 
//  End if (validation) ($err == '') 

            // ----------------------------------------- //
            //  END Send the mail with PHP mailer         //
            // ----------------------------------------- //
          
         
}  //  End if/else sendphpmailboolean         

         
         //  Display success/error message on send, either as a js alert or directly in contact form 
         
if  ($display_jsalert_boolean === true) {
         
            if  (
$err == '')  { $msgshw i18n_r('cbcontact/MSG_CONTACTSUC');  } //  success 
            
else { $msgshw $err;  }
            
?>
               <script type="text/javascript">
            <!--
                  alert ("<?php echo $msgshw?>");
            -->
               </script>
            <?php
         
         

         else { 
// Display inline above contact form ( $msgshw output in form html at bottom of cbcontact_form.php) 

            // If a success message colour text blue,
            // if an error message color text red 
            
if  ($err == '')  { 
                
$msgshw '<div style="color:blue">'.i18n_r('cbcontact/MSG_CONTACTSUC').'</div>'//  success 
            
}
            else { 
                
$msgshw '<div style="color:red">'.$err.'</div>';
            }
         }
         
         
// Re-assign array $fields[] as necessary  ... $fields[] is used to reassign the text fields
         // of the next displayed HTML contact form. So  ...
         
         // If $err empty, then we had no validation error nor send error, and msg should have been sent => 
         // So then assign $fields[] empty, ready so user can send another message  
         // Note, a form textfield is shown with the label text, as a reminder, but this
         // is done directly in the final form creation script cbcontact.php, and not in the variable fields[] 
         
         // IF $err is NOT empty, then we had a validation error or had a send problem  => 
         // So then just leave $fields[] with the values already entered by User, 
         //  .. .. so user does not have to re-enter  the good fields, and can 
         // correct the (poss) erroneous fields  
         
if($err == '') {
            
$fields[i18n_r('cbcontact/Nb')]  = ''// 'Name'
            
$fields[i18n_r('cbcontact/Em')]  = ''// 'Email'
            
$fields[i18n_r('cbcontact/Sub')] = ''// 'Subject'
            
$fields[i18n_r('cbcontact/Ms')]  = ''// 'Message'
         
}

      }
    }
   
?>

cbcontact/form/cbcontact.php :
PHP Code:
<?php

/*****************************************************/
/* Aldebaran Edited Version 1.0                      */
/* - An edit of Cumbe's plugin 'Contact Form' v5823  */
/*****************************************************/

   // NAME Input field    
   // ------------------
   
if ($required_fields_all_boolean === true) {
   
      
$cbcontactform .= '<input class="cbrightV" type="text" onblur="if (this.value == &quot;&quot;) {this.value = &quot;(*)'.i18n_r('cbcontact/Nb').'&quot;}" onfocus="if(this.value == &quot;(*)'.i18n_r('cbcontact/Nb').'&quot;) {this.value = &quot;&quot;}" value="';
      if (
$fields[i18n_r('cbcontact/Nb')] != "") {
          
$cbcontactform .= $fields[i18n_r('cbcontact/Nb')];
      } else {
          
$cbcontactform .= '(*)'.i18n_r('cbcontact/Nb');
      }
      
$cbcontactform .= '" name="contact['.i18n_r('cbcontact/Nb').']">';
   }
   else {
      
$cbcontactform .= '<input class="cbrightV" type="text" onblur="if (this.value == &quot;&quot;) {this.value = &quot;'.i18n_r('cbcontact/Nb').'&quot;}" onfocus="if(this.value == &quot;'.i18n_r('cbcontact/Nb').'&quot;) {this.value = &quot;&quot;}" value="';
      if (
$fields[i18n_r('cbcontact/Nb')] != "") {
          
$cbcontactform .= $fields[i18n_r('cbcontact/Nb')];
      } else {
          
$cbcontactform .= i18n_r('cbcontact/Nb');
      }
      
$cbcontactform .= '" name="contact['.i18n_r('cbcontact/Nb').']">';
   }
                       

   
// EMAIL Input field    
   // -------------------
   
$cbcontactform .= '<input class="cbrightV" type="text" onblur="if (this.value == &quot;&quot;) {this.value = &quot;(*)'.i18n_r('cbcontact/Em').'&quot;}" onfocus="if(this.value == &quot;(*)'.i18n_r('cbcontact/Em').'&quot;) {this.value = &quot;&quot;}" value="';
   if (
$fields[i18n_r('cbcontact/Em')] != "") {
       
$cbcontactform .= $fields[i18n_r('cbcontact/Em')];
   } else {
       
$cbcontactform .= '(*)'.i18n_r('cbcontact/Em');
   }
   
$cbcontactform .= '" name="contact['.i18n_r('cbcontact/Em').']">';

   
   
// SUBJECT Input field    
   // ---------------------
   
if ($required_fields_all_boolean === true) {
      
      
$cbcontactform .= '<input class="cbrightV" type="text" onblur="if (this.value == &quot;&quot;) {this.value = &quot;(*)'.i18n_r('cbcontact/Sub').'&quot;}" onfocus="if(this.value == &quot;(*)'.i18n_r('cbcontact/Sub').'&quot;) {this.value = &quot;&quot;}" value="';
      if (
$fields[i18n_r('cbcontact/Sub')] != "") {
          
$cbcontactform .= $fields[i18n_r('cbcontact/Sub')];
      } else {
          
$cbcontactform .= '(*)'.i18n_r('cbcontact/Sub');
      }
      
$cbcontactform .= '" name="contact['.i18n_r('cbcontact/Sub').']">';

   }
   else {
      
$cbcontactform .= '<input class="cbrightV" type="text" onblur="if (this.value == &quot;&quot;) {this.value = &quot;'.i18n_r('cbcontact/Sub').'&quot;}" onfocus="if(this.value == &quot;'.i18n_r('cbcontact/Sub').'&quot;) {this.value = &quot;&quot;}" value="';
      if (
$fields[i18n_r('cbcontact/Sub')] != "") {
          
$cbcontactform .= $fields[i18n_r('cbcontact/Sub')];
      } else {
          
$cbcontactform .= i18n_r('cbcontact/Sub');
      }
      
$cbcontactform .= '" name="contact['.i18n_r('cbcontact/Sub').']">';
   }

   
// MESSAGE Input field    
   // ---------------------- 
   
$cbcontactform .= '<textarea class="cbrightV" onblur="if (this.value == &quot;&quot;) {this.value = &quot;(*)'.i18n_r('cbcontact/Ms').'&quot;}" onfocus="if(this.value == &quot;(*)'.i18n_r('cbcontact/Ms').'&quot;) {this.value = &quot;&quot;}" name="contact['.i18n_r('cbcontact/Ms').']">';
   if (
$fields[i18n_r('cbcontact/Ms')] != "") {
       
$cbcontactform .= $fields[i18n_r('cbcontact/Ms')];
   } else {
       
$cbcontactform .= '(*)'.i18n_r('cbcontact/Ms');
   }
   
$cbcontactform .= '</textarea>';


   
// system captcha - mandatory, if enabled.     
   // -------------------------------------
   
if ($captchaboolean === true)  {
      
// This block  a) text /rl = 'If you can\'t see the code clearly click Reload'
      //             b) captch image
      //             c) reload button 
      
$cbcontactform .= '<div class="cbcaptcha">';
         
$cbcontactform .= '<div class="cbcaptcha_label">'.i18n_r('cbcontact/veri').' <span class="cbreload_label"> '.i18n_r('cbcontact/rl').'</span></div>';
         
$cbcontactform .= '<div>';
            
$cbcontactform .= '<img id="captcha" class="cbcaptchaimg" src="'.$SITEURL.'plugins/cbcontact/img_cpt.php?url='.GSPLUGINPATH.'cbcontact/" alt=" " />';
            
$cbcontactform .= '<input class="cbreload" type="button" value="'.i18n_r('cbcontact/rl_but').'" onClick="javascript:rec_cpt(&quot;captcha&quot;,&quot;'.$SITEURL.'plugins/cbcontact/img_cpt.php?url='.$mGSPLUGINPATH.'&quot;)" />';
         
$cbcontactform .= '</div>';
      
$cbcontactform .= '</div>';


      
// This block  a) text (*) + text /Cpt = 'Copy the CAPTCHA Code','
      //             b) input field captcha  name="contact[pot]" 
      //             c) send button 
      //             d) text (*) + text /Rf = 'Required fields',
      
$cbcontactform .= '<div class="cbpadleft">';  
         
$cbcontactform .= '<div class="cbcaptcha_write"> (*)'.i18n_r('cbcontact/Cpt').'</div>'
         
$cbcontactform .= '<input class="cbcaptcha_input" type="text" value="" name="contact[pot]" />';                           
         
$cbcontactform .= '<input class="cbsend" type="submit" value="'.i18n_r('cbcontact/Ev').'" id="contact-submit" name="contact-submit" />';
         
$cbcontactform .= '<div class="cbreload_label">(*) '.i18n_r('cbcontact/Rf').'</div>';
      
$cbcontactform .= '</div>';

   }  
// End if ($captchaboolean === true)  
   
   
else {  //  Else $captchaboolean is false

      // This block a) send button 
      //            b) text (*) + text /Rf =  'Required fields',
      
$cbcontactform .= '<div class="cbpadleft">';                         
         
$cbcontactform .= '<input class="cbsend" type="submit" value="'.i18n_r('cbcontact/Ev').'" id="contact-submit" name="contact-submit" />';
         
$cbcontactform .= '<div class="cbreload_label">(*) '.i18n_r('cbcontact/Rf').'</div>';
      
$cbcontactform .= '</div>';                        
   
   } 
// End if ELSE ($captchaboolean === true)  
   

?>

cbcontact/form/cbcontact.css
(not really necessary, just to improve display ) :
PHP Code:
/*****************************************************/
/* Aldebaran Edited Version 1.0                      */
/* - An edit of Cumbe's plugin 'Contact Form' v5823  */
/*****************************************************/

#cbform {
      
color#555555; 
      
font-familyArial,Helvetica,sans-serif;
      
width100%; 
}

#cbform .noshow { display: none;  }

#cbform .cbright { 
         
border-radius6px;
         -
moz-border-radius:6px;
         -
khtml-border-radius:6px;
         -
webkit-border-radius:6px;
         
/*-o-border-radius:6px;*/
         
border-styleinset;
         
font-size14px
         
margin-bottom6px;
         
margin-left5px
         
padding5px
         
width400px
     }

#cbform .cbrightV { 
         
border-radius6px
         -
moz-border-radius:6px;
         -
khtml-border-radius:6px;
         -
webkit-border-radius:6px;
         
/*-o-border-radius:6px;*/
         
border-styleinset
         
color#555555; 
         
font-familyArial,Helvetica,sans-serif
         
font-size14px
         
margin-bottom6px
         
margin-left0px;  /* Aldebaran : was 90px */ 
         
padding5px;
         
width300px/* Aldebaran : was 400px */ 
        
         
border:1px solid  #808080;  /* Aldebaran : new */    
   
}

#cbform .cbradio  {
      
margin-left15px;
       
vertical-alignmiddle;       
}

#cbform .cbcheck {
      
margin-left15px;
      
vertical-alignmiddle;   
}

#cbform textarea {
      
border-radius6px
       -
moz-border-radius:6px;
       -
khtml-border-radius:6px;
       -
webkit-border-radius:6px;
      
height100px;
   }

#cbform .cbcaptcha {
      
padding-left0px;  /* Aldebaran : was 90px */ 
      
width300px;  /* Aldebaran : was 400px */ 
   
}
#cbform .cbcaptcha .cbcaptchaimg { 
      
border2px outset #CCCCCC;
      
margin0 15px 10px 0
      
vertical-alignmiddle
   }

#cbform .cbcaptcha_label { 
   
font-size16px;
   
width390px;
   
margin-top5px;
 }

#cbform .cbcaptcha_input { 
   
border-radius6px;
    -
moz-border-radius6px;
    -
khtml-border-radius6px;
     -
webkit-border-radius6px;
    
border-styleinset;
    
font-size:20px;
    
margin0 15px 0 0;
    
padding5px;
    
text-aligncenter;
    
vertical-alignmiddle;
    
width164px;
    
    
border:1px solid  #808080;  /* Aldebaran : new */    
}

#cbform .cbcaptcha_write { 
font-size12px;
 
font-styleitalic;
 
margin-top: -5px;
 }

#cbform  .cbreload, .cbsend { 
background-color#DEDEDE; 
border-radius6px
         -
moz-border-radius:6px;
         -
khtml-border-radius:6px;
         -
webkit-border-radius:6px;
            
border-styleoutset
            
color#444444; 
            
font-size18px
            
padding3px 0
            
vertical-aligntop
            
width100px; }

#cbform  .cbreload:hover, .cbsend:hover {   
    
background-color#EEEEEE;
    
border-styleinset
    }

#cbform .cbreload_label { 
font-size11px
font-styleitalic; }

#cbform .cbpadleft { 
padding-left0px/*was 90px */
 
}

/* Aldebaran new  */
#cbform .msgshw { 
   
padding-bottom10px;

Reply
Hi aldebaran, Indiana.

A lot of thanks for your time in improving the plugin.

There are some bugs that I think that they are fixed in the new version, problems with booleans variables.

Other things I will see, like Enable Canonical Redirects...

In this moment I have not time, but I will try upload the new version this week.

Regards.
Reply
Typo error in above posted file cbcontact_form.php

Hi all

I have just seen an typo error in my uploaded edited cbcontact_form.php, in the comment description of the boolean $required_fields_all_boolean (oops !) - I have just posted this on the public forum :

cbcontact_form.php, line 325 – 329 : Should be :
PHP Code:
// Define the fields that are required/mandatory/obligatory  ..
// $required_fields_all_boolean = true  => All contact form fields are required
// $required_fields_all_boolean = false => Only the fields 'Email' and 'Message' are required  
// -----------------------------------------
$required_fields_all_boolean false

Regards Aldebaran
Reply
Upload to extend new version of contact form v6.

The most important features is that:
- there is a setting file in /cbcontact/ (cbcontact_cfg.php) with 4 mains variables that uses the Contact form.
1) $cbfcaptcha, Boolean,
* true = Use Captcha,
* false = Don’t use Captcha,
2) $cbfsendphpmail, Boolean,
* true = send mail with PHPMailer class,
* false = with the php fn mail()
3) $cbfdisplay_jsalert, Boolean; after a send
* true = display an alert box with a message that will be a success or error message.
* false = display a message (success or error) before of contact form.
4) $cbfnotification, Boolean;
* true = display in contact form a check box if you want to receive a notification email
* false = Don't display check box in contact form

- The contact form must be called so:
* In content of a page with a short code:
(% cbcontact user or email,false,user or email,user or email %)
* in template with a php funtion:
< ?php cbcontact_page('nameofuser or email', true,'user or email', 'user or email'); ?>
without spaces between < and ?

- The form has a Notification system to whom sends the contact form.
- Fixed small bugs....

Regards.
Reply
hi
im new here and added the form

but in the fields i get this :

{cbcontact/Nb}:
{cbcontact/Em}:
{cbcontact/Sub}:
(*){cbcontact/Ms}:

also in the received email i get this ?
also the two buttons is showing strange code

a other thing is i use the my company template (responsive )
when i look on a small screen the form doesn't resize
EDIT : this i have solved to use cbcontact_timbow this one is responsive

but still strange characters in my form
any idea how to solve ?
[Image: screenshot_contactform.png]
many thanks
Mandy
Reply
Hi maco-nl;
What lang do you use?

Do you use a short code in content of page or a function in a template?

Check with a short code in content of page: (% cbcontact userofadmin or email,false %)

You must to create a lang file of contact form.

Regards.
Reply
(2015-04-13, 03:09:31)cumbe Wrote: Hi maco-nl;
What lang do you use?

Do you use a short code in content of page or a function in a template?

Check with a short code in content of page: (% cbcontact userofadmin or email,false %)

You must to create a lang file of contact form.

Regards.

Hi Cumbe
thanks for your reply
i use nl_NL i will check it 
will let you know

kind regards Mandy

Edit: was indeed a language problem ,, 
Reply
Hey, the form is displayed nicely but I don't get any mails eventhough everything seems to be configured correctly.
Is it possible, that the plugin doesn't work on a local machine with xampp? Blush
Reply
Hi stwneu,

On a local machine you need to install a email server for sending emails.

Regards.
Reply
Thanks! Smile
Reply
How to change default subjet on form?
Reply
Hi
I have a website for the Town of Cornwall using GetSimple:

http://www.cornwallct.org/minutes/index.php?id=home

Trying to set up search box the same way as seen here on this page, that is listing the past searches by popularity:

http://www.chattanooga.gov/

Is it possible to do with I18N Search ?


I am not very good with PHP, so could you give me a detailed answer if you have one


thanks


Lazlo
Reply
(2015-07-11, 00:32:29)lazlo Wrote: ... Is it possible to do with I18N Search ? ...

You posted in the wrong topic. You should post here:
http://get-simple.info/forums/showthread...56&page=24
Reply
Oh, I've just foud this plugin. I have a question: how does it work via smtp or phpmailer, if it does not require my user/password and smtp server for ssl connection?
Anyway, the form for some reason is not working - it basicaly reloads captcha after i press "send".
I call it like this:
Code:
(% cbcontact admin,false,my@mail.com,friend@mail.com %)

and my settings are like this:
Code:
$cbfcaptcha = true;
$cbfsendphpmail = true;
$cbfdisplay_jsalert = true;
$cbfnotification = false;
Reply
Hi Ozz,

You must to fill the data of smpt server in /cbcontact/checksubmit.php, in lines + -200....

Regards.
Reply
Thank you, cumble!

I've edited and uploaded that.. But still my form just reloads (only captcha changes) and i get no message:
http://cooperation.uz/kontakty/?setlang=en

my smtp settings should be correct, provided by mail.ru
Reply
Hello!


Installed this plugin - and it works, but doesn't send anything Smile I get half reloaded page and no mail send.

In debug mode turned on - I get:
Code:
Warning: simplexml_load_string() [function.simplexml-load-string]: Entity: line 2: parser error : StartTag: invalid element name in /var/www/neboQ8/mysite.com/admin/inc/basic.php on line 291

Warning: simplexml_load_string() [function.simplexml-load-string]: ><![CDATA[jcu2n]]></captcha><ip_address><![CDATA[1.1.1.1]]></ip_address>< in /var/www/neboQ8/mysite.com/admin/inc/basic.php on line 291

Warning: simplexml_load_string() [function.simplexml-load-string]: ^ in /var/www/neboQ8/mysite.com/admin/inc/basic.php on line 291

Warning: simplexml_load_string() [function.simplexml-load-string]: Entity: line 2: parser error : expected '>' in /var/www/neboQ8/mysite.com/admin/inc/basic.php on line 291

Warning: simplexml_load_string() [function.simplexml-load-string]: CDATA[1.1.1.1]]></ip_address><%D1%96%D0%BC%D1%8F><![CDATA[Петро]]></ in /var/www/neboQ8/mysite.com/admin/inc/basic.php on line 291

Warning: simplexml_load_string() [function.simplexml-load-string]: ^ in /var/www/neboQ8/mysite.com/admin/inc/basic.php on line 291

Warning: simplexml_load_string() [function.simplexml-load-string]: Entity: line 2: parser error : Opening and ending tag mismatch: entry line 2 and unparseable in /var/www/neboQ8/mysite.com/admin/inc/basic.php on line 291

Warning: simplexml_load_string() [function.simplexml-load-string]: CDATA[1.1.1.1]]></ip_address><%D1%96%D0%BC%D1%8F><![CDATA[Петро]]></ in /var/www/neboQ8/mysite.com/admin/inc/basic.php on line 291

Warning: simplexml_load_string() [function.simplexml-load-string]: ^ in /var/www/neboQ8/mysite.com/admin/inc/basic.php on line 291

Warning: simplexml_load_string() [function.simplexml-load-string]: Entity: line 2: parser error : StartTag: invalid element name in /var/www/neboQ8/mysite.com/admin/inc/basic.php on line 291

Warning: simplexml_load_string() [function.simplexml-load-string]: [Петро]]></%D1%96%D0%BC%D1%8F><email><![CDATA[someemail@gmail.com]]></email>< in /var/www/neboQ8/mysite.com/admin/inc/basic.php on line 291

Warning: simplexml_load_string() [function.simplexml-load-string]: ^ in /var/www/neboQ8/mysite.com/admin/inc/basic.php on line 291

Warning: simplexml_load_string() [function.simplexml-load-string]: Entity: line 2: parser error : expected '>' in /var/www/neboQ8/mysite.com/admin/inc/basic.php on line 291

Warning: simplexml_load_string() [function.simplexml-load-string]: ATA[someemail@gmail.com]]></email><%D1%82%D0%B5%D0%BC%D0%B0><![CDATA[Тест]]></ in /var/www/neboQ8/mysite.com/admin/inc/basic.php on line 291

Warning: simplexml_load_string() [function.simplexml-load-string]: ^ in /var/www/neboQ8/mysite.com/admin/inc/basic.php on line 291

Warning: simplexml_load_string() [function.simplexml-load-string]: Entity: line 2: parser error : Opening and ending tag mismatch: channel line 2 and unparseable in /var/www/neboQ8/mysite.com/admin/inc/basic.php on line 291

Warning: simplexml_load_string() [function.simplexml-load-string]: ATA[someemail@gmail.com]]></email><%D1%82%D0%B5%D0%BC%D0%B0><![CDATA[Тест]]></ in /var/www/neboQ8/mysite.com/admin/inc/basic.php on line 291

Warning: simplexml_load_string() [function.simplexml-load-string]: ^ in /var/www/neboQ8/mysite.com/admin/inc/basic.php on line 291

Warning: simplexml_load_string() [function.simplexml-load-string]: Entity: line 2: parser error : Extra content at the end of the document in /var/www/neboQ8/mysite.com/admin/inc/basic.php on line 291

Warning: simplexml_load_string() [function.simplexml-load-string]: ATA[someemail@gmail.com]]></email><%D1%82%D0%B5%D0%BC%D0%B0><![CDATA[Тест]]></ in /var/www/neboQ8/mysite.com/admin/inc/basic.php on line 291

Warning: simplexml_load_string() [function.simplexml-load-string]: ^ in /var/www/neboQ8/mysite.com/admin/inc/basic.php on line 291

And:

Code:
/data/other/logs/cbcontactform.log
XML Invalid - Error!

On sending page:
Code:
Warning: SimpleXMLElement::__construct() [simplexmlelement.--construct]: Entity: line 2: parser error : Start tag expected, '<' not found in /var/www/neboQ8/mysite.com/plugins/cbcontact/checksubmit.php on line 114

Warning: SimpleXMLElement::__construct() [simplexmlelement.--construct]: in /var/www/neboQ8/mysite.com/plugins/cbcontact/checksubmit.php on line 114

Warning: SimpleXMLElement::__construct() [simplexmlelement.--construct]: ^ in /var/www/neboQ8/mysite.com/plugins/cbcontact/checksubmit.php on line 114

Fatal error: Uncaught exception 'Exception' with message 'String could not be parsed as XML' in /var/www/neboQ8/mysite.com/plugins/cbcontact/checksubmit.php:114 Stack trace: #0 /var/www/neboQ8/mysite.com/plugins/cbcontact/checksubmit.php(114): SimpleXMLElement->__construct('?') #1 /var/www/neboQ8/mysite.com/plugins/cbcontact_form.php(344): include('/var/www/neboQ8...') #2 /var/www/neboQ8/mysite.com/plugins/cbcontact_form.php(223): cbcontact_page('contact@mysite.com...', false, '') #3 [internal function]: cbcontact_content('<blockquote>???...') #4 /var/www/neboQ8/mysite.com/admin/inc/plugin_functions.php(404): call_user_func_array('cbcontact_conte...', Array) #5 /var/www/neboQ8/mysite.com/admin/inc/theme_functions.php(28): exec_filter('content', '<blockquote>???...') #6 /var/www/neboQ8/mysite.com/theme/Nebo/sidebar.php(89): get_page_content() #7 /var/www/neboQ8/mysite.com/index.php(134): include('/var/www/neboQ8...') #8 {main} thrown in /var/www/neboQ8/mysite.com/plugins/cbcontact/checksubmit.php on line 114
Reply
Hi ross104,

what file do you use of lang?
this is for I can check it...

Regards.
Reply
(2015-09-30, 04:40:13)cumbe Wrote: Hi ross104,

what file do you use of lang?
this is for I can check it...

Regards.

Get-Simple is set up to en_US, but I translated strings in plugin lang file en_US to my native Ukrainian language. Heres lang file content

Code:
<?php
//set internationalization
//Translate to english (Timbow)

    $i18n = array (
        "CONTACT" => 'View contactform.log',
        "MSG_CAPTCHA_FAILED" => 'Captcha failed, please try again.',
        "WHO" => 'from',
        "MSG_CONTACTSUC" => 'Your message has been sent, thank you.',
        "MSG_guestSUC" => 'Thank you for you comment.',
        "MSG_guestERR" => 'There was an error sending your message',
        "CONTACT_FORM_SUB" => 'Contact Form',
        "Nb" => 'Назва',
        "Em" => 'Email',
        "Cm" => 'Коментар',
        "Ms" => 'Кілька слів про осебе...',
        "Ev" => 'Надіслати',
        "Ps" => 'розміщено',
        "Rf" => 'Обов\'язкові поля',
        "Co" => 'Обов\'язкові поля не заповнено.',
        "Cpt" => 'Повторіть код CAPTCHA, який розміщено вище',
        "Sub" => 'Тема',
        "Ct" => 'Розміщення',
        "ndel" => 'Remove this register',
        "mf" => 'Відобразити/Приховати форму',
        "em_text" => '',
        "reload" => 'Перезавантажити',
        "rl" => 'Якщо ви не можете повторити код натисніть перезавантажити',
        "rl_but" => 'Перезавантажити',  
        "veri" => 'Код CAPTCHA',
        "back"  =>'Назад',
        "redir" => 'Перенаправлення через ',
        "redir1" => ' секунд. Якщо вас не було перенаправлено натисніть ',
        "ndel" => 'Remove this register',
        "ndelc" => 'Remove register nº ',
        "delsure" => 'Ви упевнені?',
        "errphphmail" => 'Folder PHPMailer_v5.1 does not exist inside folder PLUGINS or file class.phpmailer.php is missing.',
        "spam" => 'Ви спамер...?',
        "radio_title" => 'Оберіть варіант:',
        "radio" => 'чекбокс',
        "radio1" => 'Варіант 1',
        "radio2" => 'Варіант 2',
        "check_title" => 'Оберіть значення:',
        "check" => 'оберіть',
        "check1" => 'Значення1',
        "check2" => 'Значення2',
        "check3" => 'Значення3',
        "cbcheckNotifi" => 'Надіслати мені копію.',
        "cbnotifi" => 'Ви отримали даного листа, оскільки скористались контактною формою на сайті  ',
        "cberr_notifi" => 'Помилка під час надсилання форми'


    );

?>
UPD 1
Tried native en_US file still no luck:
Code:
Warning: SimpleXMLElement::__construct() [simplexmlelement.--construct]: Entity: line 2: parser error : Start tag expected, '<' not found in /var/www/neboQ8/mysite.com/plugins/cbcontact/checksubmit.php on line 114

Warning: SimpleXMLElement::__construct() [simplexmlelement.--construct]: in /var/www/neboQ8/mysite.com/plugins/cbcontact/checksubmit.php on line 114

Warning: SimpleXMLElement::__construct() [simplexmlelement.--construct]: ^ in /var/www/neboQ8/mysite.com/plugins/cbcontact/checksubmit.php on line 114

Fatal error: Uncaught exception 'Exception' with message 'String could not be parsed as XML' in /var/www/neboQ8/mysite.com/plugins/cbcontact/checksubmit.php:114 Stack trace: #0 /var/www/neboQ8/mysite.com/plugins/cbcontact/checksubmit.php(114): SimpleXMLElement->__construct('?') #1 /var/www/neboQ8/mysite.com/plugins/cbcontact_form.php(344): include('/var/www/neboQ8...') #2 /var/www/neboQ8/mysite.com/plugins/cbcontact_form.php(223): cbcontact_page('contact@nebo.com...', false, '') #3 [internal function]: cbcontact_content('<p>(% contact %...') #4 /var/www/neboQ8/mysite.com/admin/inc/plugin_functions.php(404): call_user_func_array('cbcontact_conte...', Array) #5 /var/www/neboQ8/mysite.com/admin/inc/theme_functions.php(28): exec_filter('content', '<p>(% contact %...') #6 /var/www/neboQ8/mysite.com/theme/Nebo/content.php(86): get_page_content() #7 /var/www/neboQ8/mysite.com/index.php(134): include('/var/www/neboQ8...') #8 {main} thrown in /var/www/neboQ8/mysite.com/plugins/cbcontact/checksubmit.php on line 114
Reply




Users browsing this thread: 3 Guest(s)