diff --git a/____HISTORY.txt b/____HISTORY.txt index fda3faf..ed57271 100644 --- a/____HISTORY.txt +++ b/____HISTORY.txt @@ -2,7 +2,7 @@ ===================================================================================== License: ===================================================================================== - Copyright 2007, 2008, 2009 OLIVER SEIDEL (email : oliver.seidel @ deliciousdays.com) + Copyright 2007-2011 OLIVER SEIDEL (email : oliver.seidel @ deliciousdays.com) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, @@ -15,7 +15,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . - ===================================================================================== Donation Page: ===================================================================================== @@ -26,6 +25,17 @@ Version History: ===================================================================================== + +PLEASE NOTE: BEFORE INSTALLING V11.8 MAKE A BACKUP OF YOUR CFORMS.JS FILE, AS THE PATH +INFORMATION & DECLARATION HAS CHANGED! + + +WHAT's NEW in cformsII - v11.8 +*) bugfix: fixing PHP's issue with uksort() +*) bugfix: upload fields in forms could cause hang ups when submitted from iphone/ipad +*) other: enhanced path determination in cforms.js, should help to avoid issues going forward +*) other: session check in cforms.php to better support existing sessions (shopping carts etc) + WHAT's NEW in cformsII - v11.7.3 *) bugfix: stalling of upload forms fixed (or ones with alternative form action) diff --git a/____LICENSE_CREDITS.txt b/____LICENSE_CREDITS.txt index ab3771a..15b7955 100644 --- a/____LICENSE_CREDITS.txt +++ b/____LICENSE_CREDITS.txt @@ -2,7 +2,7 @@ ====================================================================================== License: ====================================================================================== - Copyright 2007, 2008, 2009 OLIVER SEIDEL (email : oliver.seidel @ deliciousdays.com) + Copyright 2007-2011 OLIVER SEIDEL (email : oliver.seidel @ deliciousdays.com) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, diff --git a/cforms.php b/cforms.php index 6847504..5938e09 100644 --- a/cforms.php +++ b/cforms.php @@ -19,7 +19,7 @@ Plugin URI: http://www.deliciousdays.com/cforms-plugin Description: cformsII offers unparalleled flexibility in deploying contact forms across your blog. Features include: comprehensive SPAM protection, Ajax support, Backup & Restore, Multi-Recipients, Role Manager support, Database tracking and many more. Please see ____HISTORY.txt for what's new and current bugfixes. Author: Oliver Seidel -Version: 11.7.3 +Version: 11.8 Author URI: http://www.deliciousdays.com @@ -27,7 +27,7 @@ */ global $localversion; -$localversion = '11.7.3'; +$localversion = '11.8'; ### debug messages $cfdebug = false; @@ -102,11 +102,20 @@ function cforms_scripts_corrupted(){ ### session control for multi-page form add_action('template_redirect', 'start_cforms_session'); +/* function start_cforms_session() { @session_cache_limiter('private, must-revalidate'); @session_cache_expire(0); @session_start(); } +*/ +function start_cforms_session() { + @session_cache_limiter('private, must-revalidate'); + @session_cache_expire(0); + if (!isset($_SESSION)){ + @session_start(); + } +} diff --git a/js/cforms.js b/js/cforms.js index 7a8931a..7869a93 100644 --- a/js/cforms.js +++ b/js/cforms.js @@ -1,5 +1,5 @@ /* -Copyright 2007, 2008, 2009 OLIVER SEIDEL (email : oliver.seidel @ deliciousdays.com) +Copyright 2007-2011 OLIVER SEIDEL (email : oliver.seidel @ deliciousdays.com) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, @@ -16,9 +16,15 @@ Copyright 2007, 2008, 2009 OLIVER SEIDEL (email : oliver.seidel @ deliciousdays // ONLY in case AJAX DOESN'T work you may want to double-check this path: // If you do change this setting: CLEAR your BROWSER CACHE & RESTART you BROWSER! -var sajax_uri = '/wp-content/plugins/cforms/lib_ajax.php'; +// OLD SETTING: var sajax_uri = '/wp-content/plugins/cforms/lib_ajax.php'; + +// DYNAMIC NEW SETTING, if the below doesn't work, please try the above +var sajax_uri = window.location.protocol + "//" + window.location.host+'/wp-content/plugins/cforms/lib_ajax.php'; + + + // No need to change anything here: var sajax_debug_mode = false; var sajax_request_type = 'POST'; diff --git a/lib_aux.php b/lib_aux.php index cdd46fe..26da478 100644 --- a/lib_aux.php +++ b/lib_aux.php @@ -600,18 +600,32 @@ function outputRSS() { global $cfdata, $cfsort, $cfsortdir; function get_cforms_entries($fname=false,$from=false,$to=false,$s=false,$limit=false,$sd='asc') { - global $wpdb, $cformsSettings, $cfdata, $cfsort, $cfsortdir; + global $wpdb, $cformsSettings, $cfdataTMP, $cfsort, $cfsortdir; + + //unify + if( $s=='date' || $s=='timestamp' ) + $s = 'sub_date'; - if( $s=='date' ) - $s = 'timestamp'; + //set limit + $limit = ($limit && $limit<>'')?'LIMIT 0,'.$limit:''; - $cfdata = array(); - $cfsort=$s; - $cfsortdir=$sd; + + $ORDER_1 = $cfsort = ''; + if( in_array($s,array('id','form','timestamp','email','ip')) ) + $ORDER_1 = "ORDER BY " . $s . ' ' . $sd; + else{ + $ORDER_1 = "ORDER BY id DESC"; + $cfsort = $s; + } - $fname_in = ''; + //SORT + $cfdata = array(); + $cfsortdir = $sd; + + //GENERAL WHERE $where = false; + $fname_in = ''; for ($i=1; $i <= $cformsSettings['global']['cforms_formcount']; $i++){ $n = ( $i==1 )?'':$i; $fnames[$i]=stripslashes($cformsSettings['form'.$n]['cforms'.$n.'_fname']); @@ -624,13 +638,19 @@ function get_cforms_entries($fname=false,$from=false,$to=false,$s=false,$limit=f $where .= $from?($where?' AND':'')." sub_date > '$from'":''; $where .= $to?($where?' AND':'')." sub_date < '$to'":''; $where = $where?'WHERE'.$where:''; - - $limit = ($limit && $limit<>'')?'LIMIT 0,'.$limit:''; - + // + $in = ''; - $sql = "SELECT *, UNIX_TIMESTAMP(sub_date) as rawdate FROM {$wpdb->cformssubmissions} $where $limit"; + + $sql = "SELECT *, UNIX_TIMESTAMP(sub_date) as rawdate FROM {$wpdb->cformssubmissions} $where $ORDER_1 $limit"; $all = $wpdb->get_results($sql); +/* + echo '
>>'.$sql; + echo '
'.print_r($all,1).'
'; + die(); +*/ + foreach ( $all as $d ){ $in = $in . $d->id . ','; $n = ( $d->form_id=='' )?1:$d->form_id; @@ -649,7 +669,6 @@ function get_cforms_entries($fname=false,$from=false,$to=false,$s=false,$limit=f $sql = "SELECT * FROM {$wpdb->cformsdata} WHERE $where"; $all = $wpdb->get_results($sql); - $offsets = array(); foreach ( $all as $d ){ @@ -666,31 +685,32 @@ function get_cforms_entries($fname=false,$from=false,$to=false,$s=false,$limit=f } - if ( $cfsort <> '' ) + if ( $cfsort <> '' ){ + $cfdataTMP = $cfdata; uksort ($cfdata, "cf_sort"); - + } return $cfdata; } function cf_sort( $a,$b ){ - global $cfdata, $cfsort, $cfsortdir; - + global $cfdataTMP, $cfsort, $cfsortdir; if (!is_array($a) && !is_array($b)){ - - if( $cfdata[$a][$cfsort]<>'' && $cfdata[$b][$cfsort]<>'' ){ - $na = $cfdata[$a][$cfsort]; - $nb = $cfdata[$b][$cfsort]; - }else if ( $cfdata[$a]['data'][$cfsort]<>'' && $cfdata[$b]['data'][$cfsort]<>'' ){ - $na = $cfdata[$a]['data'][$cfsort]; - $nb = $cfdata[$b]['data'][$cfsort]; - } - else - return 0; - + + $na = ($cfdataTMP[$a]['data'][$cfsort]<>'') ? $cfdataTMP[$a]['data'][$cfsort]:false; + $nb = ($cfdataTMP[$b]['data'][$cfsort]<>'') ? $cfdataTMP[$b]['data'][$cfsort]:false; + + if ( !($na && $nb) ){ + //echo "err: ($a=$naD) :: ($b=$nbD)
"; + if ( !$na ) return 1; + if ( !$nb ) return -1; + return 0; + } } + + //echo "($a=$na) :: ($b=$nb)
"; $tmpA=(int)trim($na); $tmpB=(int)trim($nb); diff --git a/lib_functions.php b/lib_functions.php index 5666b8d..3f53998 100644 --- a/lib_functions.php +++ b/lib_functions.php @@ -162,6 +162,7 @@ function cforms_init() { } ### try to adjust cforms.js automatically + /* $jsContent = $jsContentNew = ''; if ( $fhandle = fopen(dirname(__FILE__).'/js/cforms.js', "r") ) { $jsContent = fread($fhandle, filesize(dirname(__FILE__).'/js/cforms.js')); @@ -185,7 +186,7 @@ function cforms_init() { fwrite($fhandle, $jsContentNew); fclose($fhandle); } - + */ ### save ABSPATH for ajax routines if ( defined('ABSPATH') && ($fhandle = fopen(dirname(__FILE__).$sep.'abspath.php', "w")) ) { fwrite($fhandle, "\n"); diff --git a/lib_nonajax.php b/lib_nonajax.php index a8d1ef6..2bde698 100644 --- a/lib_nonajax.php +++ b/lib_nonajax.php @@ -171,8 +171,12 @@ } else if ( $field_type == "upload" ){ - ### $fsize = $file['size'][$filefield]/1000; - $value = str_replace(' ','_',$file['name'][$filefield++]); + if ( is_array($file) && is_array($file['name']) ) { + ### $fsize = $file['size'][$filefield]/1000; + $value = str_replace(' ','_',$file['name'][$filefield++]); + }else{ + $value = ''; + } } else if ( $field_type == "multiselectbox" || $field_type == "checkboxgroup"){