VERSION HISTORY for what's new and current bugfixes. Author: Oliver Seidel Version: 9.0b Author URI: http://www.deliciousdays.com */ /* Copyright 2006-2008 Oliver Seidel (email : oliver.seidel@deliciousdays.com) WHAT's NEW in cformsII - v9.0b README: v9.0 introduces a completely new method of storing its settings, ***** please make a WP database backup first (!) ***** and then migrate your settings (cforms will guide you!) *) bugfix: a couple of custom variables were broken, e.g. {Form Name} *) bugfix: fixed lib_WPcomment path issues *) bugfix: fixed include path in lib_ajax.php *) bugfix: now migrates successfully forms 10-... from pre v9 versions *) other: added warning message in case abspath.php could not be created *) other: made some missing text translatable */ $localversion = '9.0b'; load_plugin_textdomain('cforms'); ### db settings global $wpdb; $wpdb->cformssubmissions = $wpdb->prefix . 'cformssubmissions'; $wpdb->cformsdata = $wpdb->prefix . 'cformsdata'; ### button stuff if( !class_exists('buttonsnap') ) require_once (dirname(__FILE__) . '/buttonsnap.php'); global $cformsSettings; require_once (dirname(__FILE__) . '/lib_aux.php'); require_once (dirname(__FILE__) . '/editor.php'); ### http://trac.wordpress.org/ticket/3002 $plugindir = $cformsSettings['global']['plugindir']; $cforms_root = $cformsSettings['global']['cforms_root']; ### need this for captchas add_action('template_redirect', 'start_cforms_session'); function start_cforms_session() { @session_cache_limiter('private, must-revalidate'); @session_cache_expire(0); @session_start(); } ### do a couple of things necessary as part of plugin activation $dummy = __('Please go to the cforms admin page and run the update process.', 'cforms'); add_action('admin_notices', create_function('', 'global $plugindir, $cformsSettings; if ($cformsSettings[\'global\'][\'update\']) echo \'
\' . sprintf( __(\'Please go to the cforms admin page and run the update process.\', \'cforms\') ,\'admin.php?page=\'.$plugindir.\'/cforms-global-settings.php\') . \'
cforms contact form by delicious:days
'; ### either show message above or below $usermessage_text = check_default_vars($usermessage_text,$no); $usermessage_text = check_cust_vars($usermessage_text,$track,$no); if( substr($cformsSettings['form'.$no]['cforms'.$no.'_showpos'],1,1)=='y' && !($success&&$cformsSettings['form'.$no]['cforms'.$no.'_redirect']==2)) $content .= $tt . '' . $nl; return $content; } ### some css for positioning the form elements function cforms_style() { global $wp_query, $cforms_root, $localversion, $cformsSettings; ### add content actions and filters $page_obj = $wp_query->get_queried_object(); $onPages = str_replace(' ','',stripslashes(htmlspecialchars( $cformsSettings['global']['cforms_include'] ))); $onPagesA = explode(',', $onPages); if( $onPages=='' || in_array($page_obj->ID,$onPagesA) ){ echo "\n\n"; if( $cformsSettings['global']['cforms_no_css']<>'1' ) echo ''."\n"; echo ''."\n"; if( $cformsSettings['global']['cforms_datepicker']=='1' ){ $nav = $cformsSettings['global']['cforms_dp_nav']; $dformat = str_replace(array('M','EE','E'),array('m','dddd','ddd'),stripslashes($cformsSettings['global']['cforms_dp_date'])); echo ''."\n"; echo ''."\n"; } echo ''."\n\n"; } } function findlast( $haystack,$needle,$offset=NULL ){ if( ($pos = strpos( strrev($haystack) , strrev($needle) , $offset)) === false ) return false; return strlen($haystack) - $pos - strlen($needle); } ### replace placeholder by generated code function cforms_insert( $content ) { global $post, $cformsSettings; $newcontent=''; $last=0; if ( ($a=strpos($content,'',$a); $Fid = substr($content,$a+10,($b-$a-10)); $Fname = ''; if ( ($fQ=strpos($Fid,'"'))!==false ) $Fname = sanitize_title_with_dashes(substr( $Fid, $fQ+1, strpos($Fid,'"',$fQ+1)-$fQ-1 )); $newcontent .= substr($content,$last,$p_offset-$last); if( $Fname !== '' ) $newcontent .= cforms('',$fns[$Fname]); else $newcontent .= cforms('',$Fid); $p_open_after = strpos($content,'',$b); $p_close_after = strpos($content,'
',$b); ### wrapped in? $b = ($p_close_after < $p_open_after || ($p_close_after!==false && $p_open_after===false)) ? $p_close_after+1 : $b; //add'l +3 covered by $last = $b+3; !! :-) $a = strpos($content,'