Project

General

Profile

« Previous | Next » 

Revision 1757

Added by Dietmar about 12 years ago

  1. fixed mysql_fetch_array() expects parameter 1 to be resource, boolean given
    by adding a new form on page,
    ! refactroring form/install.php to SqlImport, add a form sql dump
    ! correcting some SEC_ANCHOR in form

View differences:

branches/2.8.x/CHANGELOG
13 13

  
14 14

  
15 15

  
16
16 Sep-2012 Build 1757 Dietmar Woellbrink (Luisehahne)
17
# fixed mysql_fetch_array() expects parameter 1 to be resource, boolean given
18
  by adding a new form on page, 
19
! refactroring form/install.php to SqlImport, add a form sql dump
20
! correcting some SEC_ANCHOR in form
16 21
15 Sep-2012 Build 1756 Dietmar Woellbrink (Luisehahne)
17 22
! update wysiwyg install.php, now using methode SqlImport from WBDatabase
18 23
15 Sep-2012 Build 1755 Dietmar Woellbrink (Luisehahne)
branches/2.8.x/wb/admin/interface/version.php
51 51

  
52 52
// check if defined to avoid errors during installation (redirect to admin panel fails if PHP error/warnings are enabled)
53 53
if(!defined('VERSION')) define('VERSION', '2.8.3');
54
if(!defined('REVISION')) define('REVISION', '1756');
54
if(!defined('REVISION')) define('REVISION', '1757');
55 55
if(!defined('SP')) define('SP', '');
branches/2.8.x/wb/modules/form/modify_field.php
23 23
// Include WB admin wrapper script
24 24
require(WB_PATH.'/modules/admin.php');
25 25

  
26
$sec_anchor = (defined( 'SEC_ANCHOR' ) && ( SEC_ANCHOR != '' )  ? '#'.SEC_ANCHOR.$section['section_id'] : '' );
26
$sec_anchor = (defined( 'SEC_ANCHOR' ) && ( SEC_ANCHOR != '' )  ? '#'.SEC_ANCHOR.$section['section_id'] : 'section_'.$section_id );
27 27
/* */
28 28
// Get id
29 29
$field_id = intval($admin->checkIDKEY('field_id', false, 'GET'));
branches/2.8.x/wb/modules/form/save_field.php
25 25
require(WB_PATH.'/modules/admin.php');
26 26
/* */
27 27

  
28
$sec_anchor = (defined( 'SEC_ANCHOR' ) && ( SEC_ANCHOR != '' )  ? '#'.SEC_ANCHOR.$section['section_id'] : '' );
28
$sec_anchor = (defined( 'SEC_ANCHOR' ) && ( SEC_ANCHOR != '' )  ? '#'.SEC_ANCHOR.$section['section_id'] : 'section_'.$section_id );
29 29

  
30 30
// check FTAN
31 31
if (!$admin->checkFTAN())
branches/2.8.x/wb/modules/form/install.php
14 14
 * @lastmodified    $Date$
15 15
 *
16 16
 */
17

  
18
if(defined('WB_URL'))
19
{
20

  
21
	// $database->query("DROP TABLE IF EXISTS `".TABLE_PREFIX."mod_form_fields`");
22
	// $database->query("DROP TABLE IF EXISTS `".TABLE_PREFIX."mod_form_submissions`");
23
	// $database->query("DROP TABLE IF EXISTS `".TABLE_PREFIX."mod_form_settings`");
24

  
17
/* -------------------------------------------------------- */
18
// Must include code to stop this file being accessed directly
19
if(!defined('WB_PATH')) {
20
	require_once(dirname(dirname(dirname(__FILE__))).'/framework/globalExceptionHandler.php');
21
	throw new IllegalFileException();
22
} else {
25 23
	// Create tables
26
	$mod_form = 'CREATE TABLE IF NOT EXISTS `'.TABLE_PREFIX.'mod_form_fields` ( `field_id` INT NOT NULL AUTO_INCREMENT,'
27
		. ' `section_id` INT NOT NULL DEFAULT \'0\' ,'
28
		. ' `page_id` INT NOT NULL DEFAULT \'0\' ,'
29
		. ' `position` INT NOT NULL DEFAULT \'0\' ,'
30
		. ' `title` VARCHAR(255) NOT NULL DEFAULT \'\' ,'
31
		. ' `type` VARCHAR(255) NOT NULL DEFAULT \'\' ,'
32
		. ' `required` INT NOT NULL DEFAULT \'0\' ,'
33
		. ' `value` TEXT NOT NULL ,'
34
		. ' `extra` TEXT NOT NULL ,'
35
		. ' PRIMARY KEY ( `field_id` ) '
36
		. ' ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci';
37
	$database->query($mod_form);
38 24

  
39
	$mod_form = 'CREATE TABLE IF NOT EXISTS `'.TABLE_PREFIX.'mod_form_settings` ('
40
		. ' `section_id` INT NOT NULL DEFAULT \'0\' ,'
41
		. ' `page_id` INT NOT NULL DEFAULT \'0\' ,'
42
		. ' `header` TEXT NOT NULL ,'
43
		. ' `field_loop` TEXT NOT NULL ,'
44
		. ' `footer` TEXT NOT NULL ,'
45
		. ' `email_to` TEXT NOT NULL ,'
46
		. ' `email_from` VARCHAR(255) NOT NULL DEFAULT \'\' ,'
47
		. ' `email_fromname` VARCHAR(255) NOT NULL DEFAULT \'\' ,'
48
		. ' `email_subject` VARCHAR(255) NOT NULL DEFAULT \'\' ,'
49
		. ' `success_page` TEXT NOT NULL ,'
50
		. ' `success_email_to` TEXT NOT NULL ,'
51
		. ' `success_email_from` VARCHAR(255) NOT NULL DEFAULT \'\' ,'
52
		. ' `success_email_fromname` VARCHAR(255) NOT NULL DEFAULT \'\' ,'
53
		. ' `success_email_text` TEXT NOT NULL ,'
54
		. ' `success_email_subject` VARCHAR(255) NOT NULL DEFAULT \'\' ,'
55
		. ' `stored_submissions` INT NOT NULL DEFAULT \'0\' ,'
56
		. ' `max_submissions` INT NOT NULL DEFAULT \'0\' ,'
57
		. ' `perpage_submissions` INT NOT NULL DEFAULT \'10\' ,'
58
		. ' `use_captcha` INT NOT NULL DEFAULT \'0\' ,'
59
		. ' PRIMARY KEY ( `section_id` ) '
60
		. ' ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci';
61
	$database->query($mod_form);
25
$database->SqlImport(dirname(__FILE__).'/sql/form284db.sql',TABLE_PREFIX,false);
62 26

  
63
	$mod_form = 'CREATE TABLE IF NOT EXISTS `'.TABLE_PREFIX.'mod_form_submissions` ( `submission_id` INT NOT NULL AUTO_INCREMENT,'
64
		. ' `section_id` INT NOT NULL DEFAULT \'0\' ,'
65
		. ' `page_id` INT NOT NULL DEFAULT \'0\' ,'
66
		. ' `submitted_when` INT NOT NULL DEFAULT \'0\' ,'
67
		. ' `submitted_by` INT NOT NULL DEFAULT \'0\','
68
		. ' `body` TEXT NOT NULL,'
69
		. ' PRIMARY KEY ( `submission_id` ) '
70
		. ' ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci';
71
	$database->query($mod_form);
72

  
73
    $mod_search = "SELECT * FROM ".TABLE_PREFIX."search  WHERE value = 'form'";
74
    $insert_search = $database->query($mod_search);
75
    if( $insert_search->numRows() == 0 )
76
    {
77
    	// Insert info into the search table
78
    	// Module query info
79
    	$field_info = array();
80
    	$field_info['page_id'] = 'page_id';
81
    	$field_info['title'] = 'page_title';
82
    	$field_info['link'] = 'link';
83
    	$field_info['description'] = 'description';
84
    	$field_info['modified_when'] = 'modified_when';
85
    	$field_info['modified_by'] = 'modified_by';
86
    	$field_info = serialize($field_info);
87
    	$database->query("INSERT INTO ".TABLE_PREFIX."search (name,value,extra) VALUES ('module', 'form', '$field_info')");
88
    	// Query start
89
    	$query_start_code = "SELECT [TP]pages.page_id, [TP]pages.page_title,	[TP]pages.link, [TP]pages.description, [TP]pages.modified_when, [TP]pages.modified_by	FROM [TP]mod_form_fields, [TP]mod_form_settings, [TP]pages WHERE ";
90
    	$database->query("INSERT INTO ".TABLE_PREFIX."search (name,value,extra) VALUES ('query_start', '$query_start_code', 'form')");
91
    	// Query body
92
    	$query_body_code = " [TP]pages.page_id = [TP]mod_form_settings.page_id AND [TP]mod_form_settings.header LIKE \'%[STRING]%\'
93
    	OR [TP]pages.page_id = [TP]mod_form_settings.page_id AND [TP]mod_form_settings.footer LIKE \'%[STRING]%\'
94
    	OR [TP]pages.page_id = [TP]mod_form_fields.page_id AND [TP]mod_form_fields.title LIKE \'%[STRING]%\' ";
95
    	$database->query("INSERT INTO ".TABLE_PREFIX."search (name,value,extra) VALUES ('query_body', '$query_body_code', 'form')");
96
    	// Query end
97
    	$query_end_code = "";
98
    	$database->query("INSERT INTO ".TABLE_PREFIX."search (name,value,extra) VALUES ('query_end', '$query_end_code', 'form')");
99

  
100
    	// Insert blank row (there needs to be at least on row for the search to work)
101
    	$database->query("INSERT INTO ".TABLE_PREFIX."mod_form_fields (page_id,section_id) VALUES ('0','0')");
102
    	$database->query("INSERT INTO ".TABLE_PREFIX."mod_form_settings (page_id,section_id) VALUES ('0','0')");
103

  
104
    }
27
// remove old version of search (deprecated)
105 28
}
branches/2.8.x/wb/modules/form/modify_settings.php
38 38
	$database->field_add($table_name, $field_name, $description);
39 39
}
40 40

  
41
$sec_anchor = (defined( 'SEC_ANCHOR' ) && ( SEC_ANCHOR != '' )  ? '#'.SEC_ANCHOR.$section['section_id'] : '' );
41
$sec_anchor = (defined( 'SEC_ANCHOR' ) && ( SEC_ANCHOR != '' )  ? '#'.SEC_ANCHOR.$section['section_id'] : 'section_'.$section_id );
42 42

  
43 43
if (!function_exists('emailAdmin')) {
44 44
	function emailAdmin() {
branches/2.8.x/wb/modules/form/sql/form284db.sql
1
-- phpMyAdmin SQL Dump
2
-- version 3.4.5
3
-- http://www.phpmyadmin.net
4
--
5
-- Host: localhost
6
-- Erstellungszeit: 16. Sep 2012 um 03:20
7
-- Server Version: 5.5.16
8
-- PHP-Version: 5.3.8
9
-- $Id$
10

  
11
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
12
SET time_zone = "+00:00";
13

  
14

  
15
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
16
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
17
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
18
/*!40101 SET NAMES utf8 */;
19

  
20
--
21
-- Datenbank: ``
22
--
23

  
24
-- --------------------------------------------------------
25

  
26
--
27
-- Tabellenstruktur für Tabelle `mod_form_fields`
28
--
29

  
30
DROP TABLE IF EXISTS `{TABLE_PREFIX}mod_form_fields`;
31
CREATE TABLE IF NOT EXISTS `{TABLE_PREFIX}mod_form_fields` (
32
  `field_id` int(11) NOT NULL AUTO_INCREMENT,
33
  `section_id` int(11) NOT NULL DEFAULT '0',
34
  `page_id` int(11) NOT NULL DEFAULT '0',
35
  `position` int(11) NOT NULL DEFAULT '0',
36
  `title` varchar(255) NOT NULL DEFAULT '',
37
  `type` varchar(255) NOT NULL DEFAULT '',
38
  `required` int(11) NOT NULL DEFAULT '0',
39
  `value` text NOT NULL,
40
  `extra` text NOT NULL,
41
  PRIMARY KEY (`field_id`)
42
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ;
43

  
44
-- --------------------------------------------------------
45

  
46
--
47
-- Tabellenstruktur für Tabelle `mod_form_settings`
48
--
49

  
50
DROP TABLE IF EXISTS `{TABLE_PREFIX}mod_form_settings`;
51
CREATE TABLE IF NOT EXISTS `{TABLE_PREFIX}mod_form_settings` (
52
  `section_id` int(11) NOT NULL DEFAULT '0',
53
  `page_id` int(11) NOT NULL DEFAULT '0',
54
  `header` text NOT NULL,
55
  `field_loop` text NOT NULL,
56
  `footer` text NOT NULL,
57
  `email_to` text NOT NULL,
58
  `email_from` varchar(255) NOT NULL DEFAULT '',
59
  `email_fromname` varchar(255) NOT NULL DEFAULT '',
60
  `email_subject` varchar(255) NOT NULL DEFAULT '',
61
  `success_page` text NOT NULL,
62
  `success_email_to` text NOT NULL,
63
  `success_email_from` varchar(255) NOT NULL DEFAULT '',
64
  `success_email_fromname` varchar(255) NOT NULL DEFAULT '',
65
  `success_email_text` text NOT NULL,
66
  `success_email_subject` varchar(255) NOT NULL DEFAULT '',
67
  `stored_submissions` int(11) NOT NULL DEFAULT '0',
68
  `max_submissions` int(11) NOT NULL DEFAULT '0',
69
  `perpage_submissions` int(11) NOT NULL DEFAULT '10',
70
  `use_captcha` int(11) NOT NULL DEFAULT '0',
71
  PRIMARY KEY (`section_id`)
72
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ;
73

  
74
-- --------------------------------------------------------
75

  
76
--
77
-- Tabellenstruktur für Tabelle `mod_form_submissions`
78
--
79

  
80
DROP TABLE IF EXISTS `{TABLE_PREFIX}mod_form_submissions`;
81
CREATE TABLE IF NOT EXISTS `{TABLE_PREFIX}mod_form_submissions` (
82
  `submission_id` int(11) NOT NULL AUTO_INCREMENT,
83
  `section_id` int(11) NOT NULL DEFAULT '0',
84
  `page_id` int(11) NOT NULL DEFAULT '0',
85
  `submitted_when` int(11) NOT NULL DEFAULT '0',
86
  `submitted_by` int(11) NOT NULL DEFAULT '0',
87
  `body` text NOT NULL,
88
  PRIMARY KEY (`submission_id`)
89
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci
90

  
91
-- --------------------------------------------------------
92

  
93
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
94
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
95
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
0 96

  
branches/2.8.x/wb/modules/form/save_field_new.php
26 26
require(WB_PATH.'/modules/admin.php');
27 27
/* */
28 28

  
29
$sec_anchor = (defined( 'SEC_ANCHOR' ) && ( SEC_ANCHOR != '' )  ? '#'.SEC_ANCHOR.$section['section_id'] : '' );
29
$sec_anchor = (defined( 'SEC_ANCHOR' ) && ( SEC_ANCHOR != '' )  ? '#'.SEC_ANCHOR.$section['section_id'] : 'section_'.$section_id );
30 30

  
31 31
// check FTAN
32 32
if (!$admin->checkFTAN())
branches/2.8.x/wb/modules/form/view.php
151 151
	}
152 152

  
153 153
// do not use sec_anchor, can destroy some layouts
154
$sec_anchor = (defined( 'SEC_ANCHOR' ) && ( SEC_ANCHOR != '' )  ? '#'.SEC_ANCHOR.$fetch_settings['section_id'] : '' );
154
$sec_anchor = (defined( 'SEC_ANCHOR' ) && ( SEC_ANCHOR != '' )  ? '#'.SEC_ANCHOR.$fetch_settings['section_id'] : 'section_'.$section_id );
155 155

  
156 156
	// Get list of fields
157 157
	$sql  = 'SELECT * FROM `'.TABLE_PREFIX.'mod_form_fields` ';
branches/2.8.x/wb/modules/form/save_settings.php
30 30
}
31 31
$admin->print_header();
32 32

  
33
$sec_anchor = (defined( 'SEC_ANCHOR' ) && ( SEC_ANCHOR != '' )  ? '#'.SEC_ANCHOR.$section['section_id'] : '' );
33
$sec_anchor = (defined( 'SEC_ANCHOR' ) && ( SEC_ANCHOR != '' )  ? '#'.SEC_ANCHOR.$section['section_id'] : 'section_'.$section_id );
34 34

  
35 35
if (!function_exists('emailAdmin')) {
36 36
	function emailAdmin() {
......
114 114
if($max_submissions > $stored_submissions) {
115 115
	$max_submissions = $stored_submissions;
116 116
}
117
$sec_anchor = (defined( 'SEC_ANCHOR' ) && ( SEC_ANCHOR != '' )  ? '#'.SEC_ANCHOR.$section['section_id'] : '' );
117
$sec_anchor = (defined( 'SEC_ANCHOR' ) && ( SEC_ANCHOR != '' )  ? '#'.SEC_ANCHOR.$section['section_id'] : 'section_'.$section_id );
118 118

  
119 119
// Update settings
120 120
$sql  = 'UPDATE `'.TABLE_PREFIX.'mod_form_settings` SET ';
branches/2.8.x/wb/modules/form/modify.php
35 35

  
36 36
include_once(WB_PATH.'/framework/functions.php');
37 37

  
38
$sec_anchor = (defined( 'SEC_ANCHOR' ) && ( SEC_ANCHOR != '' )  ? '#'.SEC_ANCHOR.$section['section_id'] : '' );
38
$sec_anchor = (defined( 'SEC_ANCHOR' ) && ( SEC_ANCHOR != '' )  ? '#'.SEC_ANCHOR.$section['section_id'] : 'section_'.$section['section_id'] );
39 39

  
40 40
//Delete all form fields with no title
41 41
$sql  = 'DELETE FROM `'.TABLE_PREFIX.'mod_form_fields` ';
......
46 46
// error msg
47 47
}
48 48

  
49

  
49
// later in upgrade.php
50
$table_name = TABLE_PREFIX.'mod_form_settings';
51
$field_name = 'perpage_submissions';
52
$description = "INT NOT NULL DEFAULT '10' AFTER `max_submissions`";
53
if(!$database->field_exists($table_name,$field_name)) {
54
	$database->field_add($table_name, $field_name, $description);
55
}
50 56
?>
51 57
<table summary="" width="100%" cellpadding="0" cellspacing="0" border="0">
52 58
<tr>
branches/2.8.x/wb/modules/form/add.php
25 25
/* -------------------------------------------------------- */
26 26

  
27 27
// load module language file
28
$lang = (dirname(__FILE__)) . '/languages/' . LANGUAGE . '.php';
29
require_once(!file_exists($lang) ? (dirname(__FILE__)) . '/languages/EN.php' : $lang );
28
//$lang = (dirname(__FILE__)) . '/languages/' . LANGUAGE . '.php';
29
//require_once(!file_exists($lang) ? (dirname(__FILE__)) . '/languages/EN.php' : $lang );
30 30

  
31
// ------------------------------------
32
$table_name = TABLE_PREFIX.'mod_form_settings';
33
$field_name = 'perpage_submissions';
34
$description = "INT NOT NULL DEFAULT '10' AFTER `max_submissions`";
35
if(!$database->field_exists($table_name,$field_name)) {
36
	$database->field_add($table_name, $field_name, $description);
37
}
38
// ------------------------------------
39

  
31 40
// Insert an extra rows into the database
32 41
$header = '<table class="frm-field_table" cellpadding=\"2\" cellspacing=\"0\" border=\"0\" summary=\"form\">';
33 42
$field_loop = '<tr>'.PHP_EOL.'<td class=\"frm-field_title\">{TITLE}{REQUIRED}:</td>'.PHP_EOL.'<td>{FIELD}</td>'.PHP_EOL.'</tr>';
......
50 59
$success_email_subject = '';
51 60
$max_submissions = 50;
52 61
$stored_submissions = 50;
62
$perpage_submissions = 10;
53 63
$use_captcha = true;
54 64

  
55 65
// $database->query("INSERT INTO ".TABLE_PREFIX."mod_form_settings (page_id,section_id,header,field_loop,footer,email_to,email_from,email_fromname,email_subject,success_page,success_email_to,success_email_from,success_email_fromname,success_email_text,success_email_subject,max_submissions,stored_submissions,use_captcha) VALUES ('$page_id','$section_id','$header','$field_loop','$footer','$email_to','$email_from','$email_fromname','$email_subject','$success_page','$success_email_to','$success_email_from','$success_email_fromname','$success_email_text','$success_email_subject','$max_submissions','$stored_submissions','$use_captcha')");
......
73 83
$sql .= '`success_email_subject` = \''.$success_email_subject.'\', ';
74 84
$sql .= '`max_submissions` = \''.$max_submissions.'\', ';
75 85
$sql .= '`stored_submissions` = \''.$stored_submissions.'\', ';
86
$sql .= '`perpage_submissions` = \''.$perpage_submissions.'\', ';
76 87
$sql .= '`use_captcha` = \''.$use_captcha.'\' ';
77 88
$sql .= '';
78 89
if($database->query($sql)) {

Also available in: Unified diff