'1' ) $noDISP = $no = $_REQUEST['noSub']; $buffer .= SaveArray($cformsSettings['form'.$no]).$br; $filename = 'form-settings.txt'; }else{ $buffer .= SaveArray($cformsSettings).$br; $filename = 'all-cforms-settings.txt'; } header("Pragma: public"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Content-Type: application/force-download"); header("Content-Type: application/octet-stream"); header("Content-Type: application/download"); header("Content-Disposition: attachment; filename=\"$filename\""); header("Content-Transfer-Encoding: binary"); header("Content-Length: " .(string)(strlen($buffer)) ); print $buffer; exit(); } ### saving form settings } ### Save the array function SaveArray($vArray) { global $buffer; // Every array starts with chr(1)+"{" $buffer .= "\0{"; // Go through the given array reset($vArray); while (true) { $Current = current($vArray); $MyKey = addslashes(strval( key($vArray) )); if (is_array($Current)) { $buffer .= $MyKey."\0"; SaveArray($Current); $buffer .= "\0"; } else { $Current = addslashes($Current); $buffer .= "$MyKey\0$Current\0"; } ++$i; while (!next($vArray)) if (++$i > count($vArray)) break; if ($i > count($vArray)) break; } $buffer .= "\0}"; } ### Add cforms menu to admin function cforms_menu() { global $wpdb, $submenu; $cformsSettings = get_option('cforms_settings'); $tablesup = ($wpdb->get_var("show tables like '$wpdb->cformssubmissions'") == $wpdb->cformssubmissions)?true:false; if (function_exists('add_menu_page')) { add_menu_page(__('cformsII', 'cforms'), __('cformsII', 'cforms'), 'manage_cforms', $cformsSettings['global']['plugindir'].'/cforms-options.php'); } elseif (function_exists('add_management_page')) { add_management_page(__('cformsII', 'cforms'), __('cformsII', 'cforms'), 'manage_cforms', $cformsSettings['global']['plugindir'].'/cforms-options.php'); } if (function_exists('add_submenu_page')) { add_submenu_page($cformsSettings['global']['plugindir'].'/cforms-options.php', __('Global Settings', 'cforms'), __('Global Settings', 'cforms'), 'manage_cforms', $cformsSettings['global']['plugindir'].'/cforms-global-settings.php'); if ( ($tablesup || isset($_REQUEST['cforms_database'])) && !isset($_REQUEST['deletetables']) ) add_submenu_page($cformsSettings['global']['plugindir'].'/cforms-options.php', __('Tracking', 'cforms'), __('Tracking', 'cforms'), 'track_cforms', $cformsSettings['global']['plugindir'].'/cforms-database.php'); add_submenu_page($cformsSettings['global']['plugindir'].'/cforms-options.php', __('Styling', 'cforms'), __('Styling', 'cforms'), 'manage_cforms', $cformsSettings['global']['plugindir'].'/cforms-css.php'); add_submenu_page($cformsSettings['global']['plugindir'].'/cforms-options.php', __('Help!', 'cforms'), __('Help!', 'cforms'), 'manage_cforms', $cformsSettings['global']['plugindir'].'/cforms-help.php'); } } function cforms_init() { global $wpdb; $plugindir = basename(dirname(__FILE__)); $sep = strpos(dirname(__FILE__), '\\') !==false ? '\\' : '/'; $role = get_role('administrator'); if(!$role->has_cap('manage_cforms')) { $role->add_cap('manage_cforms'); } if(!$role->has_cap('track_cforms')) { $role->add_cap('track_cforms'); } ### alter tracking tables if needed $tables = $wpdb->get_col("SHOW TABLES FROM `" . DB_NAME . "` LIKE '$wpdb->cformssubmissions'",0); if( $tables[0]==$wpdb->cformssubmissions ) { $columns = $wpdb->get_results("SHOW COLUMNS FROM {$wpdb->cformssubmissions}"); if ( $columns[2]->Field == 'date' ) $result = $wpdb->query("ALTER TABLE `{$wpdb->cformssubmissions}` CHANGE `date` `sub_date` TIMESTAMP"); } ### 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')); fclose($fhandle); $URIprefix = get_option('siteurl'); $pathToAjax = $URIprefix . '/wp-content/plugins/cforms/lib_ajax.php'; if ( defined('WP_CONTENT_URL') ) $pathToAjax = $URIprefix.'/'.WP_CONTENT_URL.'/plugins/'.$plugindir. '/lib_ajax.php'; if ( defined('WP_PLUGIN_URL') ) $pathToAjax = $URIprefix.'/'.WP_PLUGIN_URL.'/'.$plugindir. '/lib_ajax.php'; if ( defined('PLUGINDIR') ) $pathToAjax = $URIprefix.'/'.PLUGINDIR.'/'.$plugindir. '/lib_ajax.php'; $jsContentNew = str_replace('\'/wp-content/plugins/cforms/lib_ajax.php\'',"'{$pathToAjax}'",$jsContent); } if ( $jsContentNew<>'' && $jsContentNew<>$jsContent && ($fhandle = fopen(dirname(__FILE__).$sep.'js'.$sep.'cforms.js', "w")) ) { fwrite($fhandle, $jsContentNew); fclose($fhandle); } ### save ABSPATH for ajax routines if ( defined('ABSPATH') && ($fhandle = fopen(dirname(__FILE__).$sep.'abspath.php', "w")) ) { fwrite($fhandle, "\n"); fclose($fhandle); } } ### check for abspath.php function abspath_check() { global $cformsSettings; if ( !file_exists( dirname(__FILE__).$cformsSettings['global']['cforms_IIS'].'abspath.php' ) ){ echo '
'. __('It appears that cforms was not able to create abspath.php in your cforms plugin folder. Please check file/folder permissions and re-activate cforms.', 'cforms'). '
'.
__('If the problem persists, please create abspath.php manually with the following content:', 'cforms').
'<?php $abspath = \''.ABSPATH.'\'; ?>
cforms ','') ?> check here.', 'cforms') ?>
Version v
Plugins tab and either disable the plugin, or toggle its status (disable/enable) to revive cforms!', 'cforms') ?>
don\'t select the checkbox for activation on the plugin page.', 'cforms') ?>