Index: branches/2.8.x/CHANGELOG
===================================================================
--- branches/2.8.x/CHANGELOG	(revision 1756)
+++ branches/2.8.x/CHANGELOG	(revision 1757)
@@ -13,6 +13,11 @@
 
 
 
+16 Sep-2012 Build 1757 Dietmar Woellbrink (Luisehahne)
+# 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
 15 Sep-2012 Build 1756 Dietmar Woellbrink (Luisehahne)
 ! update wysiwyg install.php, now using methode SqlImport from WBDatabase
 15 Sep-2012 Build 1755 Dietmar Woellbrink (Luisehahne)
Index: branches/2.8.x/wb/admin/interface/version.php
===================================================================
--- branches/2.8.x/wb/admin/interface/version.php	(revision 1756)
+++ branches/2.8.x/wb/admin/interface/version.php	(revision 1757)
@@ -51,5 +51,5 @@
 
 // check if defined to avoid errors during installation (redirect to admin panel fails if PHP error/warnings are enabled)
 if(!defined('VERSION')) define('VERSION', '2.8.3');
-if(!defined('REVISION')) define('REVISION', '1756');
+if(!defined('REVISION')) define('REVISION', '1757');
 if(!defined('SP')) define('SP', '');
Index: branches/2.8.x/wb/modules/form/modify_field.php
===================================================================
--- branches/2.8.x/wb/modules/form/modify_field.php	(revision 1756)
+++ branches/2.8.x/wb/modules/form/modify_field.php	(revision 1757)
@@ -23,7 +23,7 @@
 // Include WB admin wrapper script
 require(WB_PATH.'/modules/admin.php');
 
-$sec_anchor = (defined( 'SEC_ANCHOR' ) && ( SEC_ANCHOR != '' )  ? '#'.SEC_ANCHOR.$section['section_id'] : '' );
+$sec_anchor = (defined( 'SEC_ANCHOR' ) && ( SEC_ANCHOR != '' )  ? '#'.SEC_ANCHOR.$section['section_id'] : 'section_'.$section_id );
 /* */
 // Get id
 $field_id = intval($admin->checkIDKEY('field_id', false, 'GET'));
Index: branches/2.8.x/wb/modules/form/save_field.php
===================================================================
--- branches/2.8.x/wb/modules/form/save_field.php	(revision 1756)
+++ branches/2.8.x/wb/modules/form/save_field.php	(revision 1757)
@@ -25,7 +25,7 @@
 require(WB_PATH.'/modules/admin.php');
 /* */
 
-$sec_anchor = (defined( 'SEC_ANCHOR' ) && ( SEC_ANCHOR != '' )  ? '#'.SEC_ANCHOR.$section['section_id'] : '' );
+$sec_anchor = (defined( 'SEC_ANCHOR' ) && ( SEC_ANCHOR != '' )  ? '#'.SEC_ANCHOR.$section['section_id'] : 'section_'.$section_id );
 
 // check FTAN
 if (!$admin->checkFTAN())
Index: branches/2.8.x/wb/modules/form/install.php
===================================================================
--- branches/2.8.x/wb/modules/form/install.php	(revision 1756)
+++ branches/2.8.x/wb/modules/form/install.php	(revision 1757)
@@ -14,92 +14,15 @@
  * @lastmodified    $Date$
  *
  */
-
-if(defined('WB_URL'))
-{
-
-	// $database->query("DROP TABLE IF EXISTS `".TABLE_PREFIX."mod_form_fields`");
-	// $database->query("DROP TABLE IF EXISTS `".TABLE_PREFIX."mod_form_submissions`");
-	// $database->query("DROP TABLE IF EXISTS `".TABLE_PREFIX."mod_form_settings`");
-
+/* -------------------------------------------------------- */
+// Must include code to stop this file being accessed directly
+if(!defined('WB_PATH')) {
+	require_once(dirname(dirname(dirname(__FILE__))).'/framework/globalExceptionHandler.php');
+	throw new IllegalFileException();
+} else {
 	// Create tables
-	$mod_form = 'CREATE TABLE IF NOT EXISTS `'.TABLE_PREFIX.'mod_form_fields` ( `field_id` INT NOT NULL AUTO_INCREMENT,'
-		. ' `section_id` INT NOT NULL DEFAULT \'0\' ,'
-		. ' `page_id` INT NOT NULL DEFAULT \'0\' ,'
-		. ' `position` INT NOT NULL DEFAULT \'0\' ,'
-		. ' `title` VARCHAR(255) NOT NULL DEFAULT \'\' ,'
-		. ' `type` VARCHAR(255) NOT NULL DEFAULT \'\' ,'
-		. ' `required` INT NOT NULL DEFAULT \'0\' ,'
-		. ' `value` TEXT NOT NULL ,'
-		. ' `extra` TEXT NOT NULL ,'
-		. ' PRIMARY KEY ( `field_id` ) '
-		. ' ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci';
-	$database->query($mod_form);
 
-	$mod_form = 'CREATE TABLE IF NOT EXISTS `'.TABLE_PREFIX.'mod_form_settings` ('
-		. ' `section_id` INT NOT NULL DEFAULT \'0\' ,'
-		. ' `page_id` INT NOT NULL DEFAULT \'0\' ,'
-		. ' `header` TEXT NOT NULL ,'
-		. ' `field_loop` TEXT NOT NULL ,'
-		. ' `footer` TEXT NOT NULL ,'
-		. ' `email_to` TEXT NOT NULL ,'
-		. ' `email_from` VARCHAR(255) NOT NULL DEFAULT \'\' ,'
-		. ' `email_fromname` VARCHAR(255) NOT NULL DEFAULT \'\' ,'
-		. ' `email_subject` VARCHAR(255) NOT NULL DEFAULT \'\' ,'
-		. ' `success_page` TEXT NOT NULL ,'
-		. ' `success_email_to` TEXT NOT NULL ,'
-		. ' `success_email_from` VARCHAR(255) NOT NULL DEFAULT \'\' ,'
-		. ' `success_email_fromname` VARCHAR(255) NOT NULL DEFAULT \'\' ,'
-		. ' `success_email_text` TEXT NOT NULL ,'
-		. ' `success_email_subject` VARCHAR(255) NOT NULL DEFAULT \'\' ,'
-		. ' `stored_submissions` INT NOT NULL DEFAULT \'0\' ,'
-		. ' `max_submissions` INT NOT NULL DEFAULT \'0\' ,'
-		. ' `perpage_submissions` INT NOT NULL DEFAULT \'10\' ,'
-		. ' `use_captcha` INT NOT NULL DEFAULT \'0\' ,'
-		. ' PRIMARY KEY ( `section_id` ) '
-		. ' ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci';
-	$database->query($mod_form);
+$database->SqlImport(dirname(__FILE__).'/sql/form284db.sql',TABLE_PREFIX,false);
 
-	$mod_form = 'CREATE TABLE IF NOT EXISTS `'.TABLE_PREFIX.'mod_form_submissions` ( `submission_id` INT NOT NULL AUTO_INCREMENT,'
-		. ' `section_id` INT NOT NULL DEFAULT \'0\' ,'
-		. ' `page_id` INT NOT NULL DEFAULT \'0\' ,'
-		. ' `submitted_when` INT NOT NULL DEFAULT \'0\' ,'
-		. ' `submitted_by` INT NOT NULL DEFAULT \'0\','
-		. ' `body` TEXT NOT NULL,'
-		. ' PRIMARY KEY ( `submission_id` ) '
-		. ' ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci';
-	$database->query($mod_form);
-
-    $mod_search = "SELECT * FROM ".TABLE_PREFIX."search  WHERE value = 'form'";
-    $insert_search = $database->query($mod_search);
-    if( $insert_search->numRows() == 0 )
-    {
-    	// Insert info into the search table
-    	// Module query info
-    	$field_info = array();
-    	$field_info['page_id'] = 'page_id';
-    	$field_info['title'] = 'page_title';
-    	$field_info['link'] = 'link';
-    	$field_info['description'] = 'description';
-    	$field_info['modified_when'] = 'modified_when';
-    	$field_info['modified_by'] = 'modified_by';
-    	$field_info = serialize($field_info);
-    	$database->query("INSERT INTO ".TABLE_PREFIX."search (name,value,extra) VALUES ('module', 'form', '$field_info')");
-    	// Query start
-    	$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 ";
-    	$database->query("INSERT INTO ".TABLE_PREFIX."search (name,value,extra) VALUES ('query_start', '$query_start_code', 'form')");
-    	// Query body
-    	$query_body_code = " [TP]pages.page_id = [TP]mod_form_settings.page_id AND [TP]mod_form_settings.header LIKE \'%[STRING]%\'
-    	OR [TP]pages.page_id = [TP]mod_form_settings.page_id AND [TP]mod_form_settings.footer LIKE \'%[STRING]%\'
-    	OR [TP]pages.page_id = [TP]mod_form_fields.page_id AND [TP]mod_form_fields.title LIKE \'%[STRING]%\' ";
-    	$database->query("INSERT INTO ".TABLE_PREFIX."search (name,value,extra) VALUES ('query_body', '$query_body_code', 'form')");
-    	// Query end
-    	$query_end_code = "";
-    	$database->query("INSERT INTO ".TABLE_PREFIX."search (name,value,extra) VALUES ('query_end', '$query_end_code', 'form')");
-
-    	// Insert blank row (there needs to be at least on row for the search to work)
-    	$database->query("INSERT INTO ".TABLE_PREFIX."mod_form_fields (page_id,section_id) VALUES ('0','0')");
-    	$database->query("INSERT INTO ".TABLE_PREFIX."mod_form_settings (page_id,section_id) VALUES ('0','0')");
-
-    }
+// remove old version of search (deprecated)
 }
Index: branches/2.8.x/wb/modules/form/modify_settings.php
===================================================================
--- branches/2.8.x/wb/modules/form/modify_settings.php	(revision 1756)
+++ branches/2.8.x/wb/modules/form/modify_settings.php	(revision 1757)
@@ -38,7 +38,7 @@
 	$database->field_add($table_name, $field_name, $description);
 }
 
-$sec_anchor = (defined( 'SEC_ANCHOR' ) && ( SEC_ANCHOR != '' )  ? '#'.SEC_ANCHOR.$section['section_id'] : '' );
+$sec_anchor = (defined( 'SEC_ANCHOR' ) && ( SEC_ANCHOR != '' )  ? '#'.SEC_ANCHOR.$section['section_id'] : 'section_'.$section_id );
 
 if (!function_exists('emailAdmin')) {
 	function emailAdmin() {
Index: branches/2.8.x/wb/modules/form/sql/form284db.sql
===================================================================
--- branches/2.8.x/wb/modules/form/sql/form284db.sql	(nonexistent)
+++ branches/2.8.x/wb/modules/form/sql/form284db.sql	(revision 1757)
@@ -0,0 +1,95 @@
+-- phpMyAdmin SQL Dump
+-- version 3.4.5
+-- http://www.phpmyadmin.net
+--
+-- Host: localhost
+-- Erstellungszeit: 16. Sep 2012 um 03:20
+-- Server Version: 5.5.16
+-- PHP-Version: 5.3.8
+-- $Id$
+
+SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
+SET time_zone = "+00:00";
+
+
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
+/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
+/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
+/*!40101 SET NAMES utf8 */;
+
+--
+-- Datenbank: ``
+--
+
+-- --------------------------------------------------------
+
+--
+-- Tabellenstruktur für Tabelle `mod_form_fields`
+--
+
+DROP TABLE IF EXISTS `{TABLE_PREFIX}mod_form_fields`;
+CREATE TABLE IF NOT EXISTS `{TABLE_PREFIX}mod_form_fields` (
+  `field_id` int(11) NOT NULL AUTO_INCREMENT,
+  `section_id` int(11) NOT NULL DEFAULT '0',
+  `page_id` int(11) NOT NULL DEFAULT '0',
+  `position` int(11) NOT NULL DEFAULT '0',
+  `title` varchar(255) NOT NULL DEFAULT '',
+  `type` varchar(255) NOT NULL DEFAULT '',
+  `required` int(11) NOT NULL DEFAULT '0',
+  `value` text NOT NULL,
+  `extra` text NOT NULL,
+  PRIMARY KEY (`field_id`)
+) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ;
+
+-- --------------------------------------------------------
+
+--
+-- Tabellenstruktur für Tabelle `mod_form_settings`
+--
+
+DROP TABLE IF EXISTS `{TABLE_PREFIX}mod_form_settings`;
+CREATE TABLE IF NOT EXISTS `{TABLE_PREFIX}mod_form_settings` (
+  `section_id` int(11) NOT NULL DEFAULT '0',
+  `page_id` int(11) NOT NULL DEFAULT '0',
+  `header` text NOT NULL,
+  `field_loop` text NOT NULL,
+  `footer` text NOT NULL,
+  `email_to` text NOT NULL,
+  `email_from` varchar(255) NOT NULL DEFAULT '',
+  `email_fromname` varchar(255) NOT NULL DEFAULT '',
+  `email_subject` varchar(255) NOT NULL DEFAULT '',
+  `success_page` text NOT NULL,
+  `success_email_to` text NOT NULL,
+  `success_email_from` varchar(255) NOT NULL DEFAULT '',
+  `success_email_fromname` varchar(255) NOT NULL DEFAULT '',
+  `success_email_text` text NOT NULL,
+  `success_email_subject` varchar(255) NOT NULL DEFAULT '',
+  `stored_submissions` int(11) NOT NULL DEFAULT '0',
+  `max_submissions` int(11) NOT NULL DEFAULT '0',
+  `perpage_submissions` int(11) NOT NULL DEFAULT '10',
+  `use_captcha` int(11) NOT NULL DEFAULT '0',
+  PRIMARY KEY (`section_id`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ;
+
+-- --------------------------------------------------------
+
+--
+-- Tabellenstruktur für Tabelle `mod_form_submissions`
+--
+
+DROP TABLE IF EXISTS `{TABLE_PREFIX}mod_form_submissions`;
+CREATE TABLE IF NOT EXISTS `{TABLE_PREFIX}mod_form_submissions` (
+  `submission_id` int(11) NOT NULL AUTO_INCREMENT,
+  `section_id` int(11) NOT NULL DEFAULT '0',
+  `page_id` int(11) NOT NULL DEFAULT '0',
+  `submitted_when` int(11) NOT NULL DEFAULT '0',
+  `submitted_by` int(11) NOT NULL DEFAULT '0',
+  `body` text NOT NULL,
+  PRIMARY KEY (`submission_id`)
+) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci
+
+-- --------------------------------------------------------
+
+/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
+/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
+/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;

Property changes on: branches/2.8.x/wb/modules/form/sql/form284db.sql
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+Date Author Id Revision HeadURL
\ No newline at end of property
Index: branches/2.8.x/wb/modules/form/sql
===================================================================
--- branches/2.8.x/wb/modules/form/sql	(nonexistent)
+++ branches/2.8.x/wb/modules/form/sql	(revision 1757)

Property changes on: branches/2.8.x/wb/modules/form/sql
___________________________________________________________________
Added: svn:ignore
## -0,0 +1,2 ##
+work284db.sql
+work28xdb120120916_032049.sql
Index: branches/2.8.x/wb/modules/form/save_field_new.php
===================================================================
--- branches/2.8.x/wb/modules/form/save_field_new.php	(revision 1756)
+++ branches/2.8.x/wb/modules/form/save_field_new.php	(revision 1757)
@@ -26,7 +26,7 @@
 require(WB_PATH.'/modules/admin.php');
 /* */
 
-$sec_anchor = (defined( 'SEC_ANCHOR' ) && ( SEC_ANCHOR != '' )  ? '#'.SEC_ANCHOR.$section['section_id'] : '' );
+$sec_anchor = (defined( 'SEC_ANCHOR' ) && ( SEC_ANCHOR != '' )  ? '#'.SEC_ANCHOR.$section['section_id'] : 'section_'.$section_id );
 
 // check FTAN
 if (!$admin->checkFTAN())
Index: branches/2.8.x/wb/modules/form/view.php
===================================================================
--- branches/2.8.x/wb/modules/form/view.php	(revision 1756)
+++ branches/2.8.x/wb/modules/form/view.php	(revision 1757)
@@ -151,7 +151,7 @@
 	}
 
 // do not use sec_anchor, can destroy some layouts
-$sec_anchor = (defined( 'SEC_ANCHOR' ) && ( SEC_ANCHOR != '' )  ? '#'.SEC_ANCHOR.$fetch_settings['section_id'] : '' );
+$sec_anchor = (defined( 'SEC_ANCHOR' ) && ( SEC_ANCHOR != '' )  ? '#'.SEC_ANCHOR.$fetch_settings['section_id'] : 'section_'.$section_id );
 
 	// Get list of fields
 	$sql  = 'SELECT * FROM `'.TABLE_PREFIX.'mod_form_fields` ';
Index: branches/2.8.x/wb/modules/form/save_settings.php
===================================================================
--- branches/2.8.x/wb/modules/form/save_settings.php	(revision 1756)
+++ branches/2.8.x/wb/modules/form/save_settings.php	(revision 1757)
@@ -30,7 +30,7 @@
 }
 $admin->print_header();
 
-$sec_anchor = (defined( 'SEC_ANCHOR' ) && ( SEC_ANCHOR != '' )  ? '#'.SEC_ANCHOR.$section['section_id'] : '' );
+$sec_anchor = (defined( 'SEC_ANCHOR' ) && ( SEC_ANCHOR != '' )  ? '#'.SEC_ANCHOR.$section['section_id'] : 'section_'.$section_id );
 
 if (!function_exists('emailAdmin')) {
 	function emailAdmin() {
@@ -114,7 +114,7 @@
 if($max_submissions > $stored_submissions) {
 	$max_submissions = $stored_submissions;
 }
-$sec_anchor = (defined( 'SEC_ANCHOR' ) && ( SEC_ANCHOR != '' )  ? '#'.SEC_ANCHOR.$section['section_id'] : '' );
+$sec_anchor = (defined( 'SEC_ANCHOR' ) && ( SEC_ANCHOR != '' )  ? '#'.SEC_ANCHOR.$section['section_id'] : 'section_'.$section_id );
 
 // Update settings
 $sql  = 'UPDATE `'.TABLE_PREFIX.'mod_form_settings` SET ';
Index: branches/2.8.x/wb/modules/form/modify.php
===================================================================
--- branches/2.8.x/wb/modules/form/modify.php	(revision 1756)
+++ branches/2.8.x/wb/modules/form/modify.php	(revision 1757)
@@ -35,7 +35,7 @@
 
 include_once(WB_PATH.'/framework/functions.php');
 
-$sec_anchor = (defined( 'SEC_ANCHOR' ) && ( SEC_ANCHOR != '' )  ? '#'.SEC_ANCHOR.$section['section_id'] : '' );
+$sec_anchor = (defined( 'SEC_ANCHOR' ) && ( SEC_ANCHOR != '' )  ? '#'.SEC_ANCHOR.$section['section_id'] : 'section_'.$section['section_id'] );
 
 //Delete all form fields with no title
 $sql  = 'DELETE FROM `'.TABLE_PREFIX.'mod_form_fields` ';
@@ -46,7 +46,13 @@
 // error msg
 }
 
-
+// later in upgrade.php
+$table_name = TABLE_PREFIX.'mod_form_settings';
+$field_name = 'perpage_submissions';
+$description = "INT NOT NULL DEFAULT '10' AFTER `max_submissions`";
+if(!$database->field_exists($table_name,$field_name)) {
+	$database->field_add($table_name, $field_name, $description);
+}
 ?>
 <table summary="" width="100%" cellpadding="0" cellspacing="0" border="0">
 <tr>
Index: branches/2.8.x/wb/modules/form/add.php
===================================================================
--- branches/2.8.x/wb/modules/form/add.php	(revision 1756)
+++ branches/2.8.x/wb/modules/form/add.php	(revision 1757)
@@ -25,9 +25,18 @@
 /* -------------------------------------------------------- */
 
 // load module language file
-$lang = (dirname(__FILE__)) . '/languages/' . LANGUAGE . '.php';
-require_once(!file_exists($lang) ? (dirname(__FILE__)) . '/languages/EN.php' : $lang );
+//$lang = (dirname(__FILE__)) . '/languages/' . LANGUAGE . '.php';
+//require_once(!file_exists($lang) ? (dirname(__FILE__)) . '/languages/EN.php' : $lang );
 
+// ------------------------------------
+$table_name = TABLE_PREFIX.'mod_form_settings';
+$field_name = 'perpage_submissions';
+$description = "INT NOT NULL DEFAULT '10' AFTER `max_submissions`";
+if(!$database->field_exists($table_name,$field_name)) {
+	$database->field_add($table_name, $field_name, $description);
+}
+// ------------------------------------
+
 // Insert an extra rows into the database
 $header = '<table class="frm-field_table" cellpadding=\"2\" cellspacing=\"0\" border=\"0\" summary=\"form\">';
 $field_loop = '<tr>'.PHP_EOL.'<td class=\"frm-field_title\">{TITLE}{REQUIRED}:</td>'.PHP_EOL.'<td>{FIELD}</td>'.PHP_EOL.'</tr>';
@@ -50,6 +59,7 @@
 $success_email_subject = '';
 $max_submissions = 50;
 $stored_submissions = 50;
+$perpage_submissions = 10;
 $use_captcha = true;
 
 // $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,6 +83,7 @@
 $sql .= '`success_email_subject` = \''.$success_email_subject.'\', ';
 $sql .= '`max_submissions` = \''.$max_submissions.'\', ';
 $sql .= '`stored_submissions` = \''.$stored_submissions.'\', ';
+$sql .= '`perpage_submissions` = \''.$perpage_submissions.'\', ';
 $sql .= '`use_captcha` = \''.$use_captcha.'\' ';
 $sql .= '';
 if($database->query($sql)) {
