Index: branches/2.8.x/CHANGELOG
===================================================================
--- branches/2.8.x/CHANGELOG	(revision 1890)
+++ branches/2.8.x/CHANGELOG	(revision 1891)
@@ -13,6 +13,8 @@
 
 
 
+19 Mar-2013 Build 1891 Dietmar Woellbrink (Luisehahne)
+! update captcha_control module set version to 1.2.1 
 19 Mar-2013 Build 1890 Dietmar Woellbrink (Luisehahne)
 # bugfix and update form module set version to 2.9.1 
 ! update code module set version to 2.8.4 
Index: branches/2.8.x/wb/upgrade-script.php
===================================================================
--- branches/2.8.x/wb/upgrade-script.php	(revision 1890)
+++ branches/2.8.x/wb/upgrade-script.php	(revision 1891)
@@ -763,7 +763,6 @@
         if($oUser = $database->query($sql)){
             $iTotalUsers = $oUser->numRows();
             while($Users = $oUser->fetchRow(MYSQL_ASSOC)) {
-
                 $aUsers[$Users['user_id']]['groups_id'] = $Users['groups_id'];
                 $aUsers[$Users['user_id']]['display_name'] = $Users['display_name'];
             }
@@ -770,7 +769,6 @@
         } else {
             $aDebugMessage[] = $database->is_error()==false ? " $OK<br />" : " $FAIL!<br />";
         }
-
         foreach($aUsers AS $user_id => $value){
                 // choose group_id from groups_id - workaround for still remaining calls to group_id (to be cleaned-up)
                 $aGroups_id = explode(',', $aUsers[$user_id]['groups_id']);
@@ -778,13 +776,11 @@
                 $group_id = 0;
                 //if user is in administrator-group, get this group else just get the first one
                 if($admin->is_group_match($aGroups_id,'1')) { $group_id = 1; $groups_id = '1'; } else { $group_id = intval($aGroups_id[0]); }
-
                 $sMessage = "<span>Updating group_id ".$TEXT['DISPLAY_NAME']." " .$aUsers[$user_id]['display_name']."</span>";
                 $sql  = 'UPDATE `'.TABLE_PREFIX.'users` ';
                 $sql .= 'SET `group_id`  = '.$group_id.', ';
                 $sql .=     '`groups_id` = \''.$groups_id.'\' ';
                 $sql .= 'WHERE `user_id` = '.intval($user_id);
-
                 if($oRes = $database->query($sql)){  }
                 $aDebugMessage[] = $database->is_error()==false ? $sMessage." $OK<br />" : $sMessage." $FAIL!<br />";
         }
@@ -969,8 +965,7 @@
 	 * upgrade modules if newer version is available
 	 * $aModuleList list of proofed modules
 	 */
-//	$aModuleList = array('wysiwyg','news','form','captcha_control','output_filter');
-	$aModuleList = array('wysiwyg','form','code');
+	$aModuleList = array('wysiwyg','form','code','captcha_control');
 	if(sizeof($aModuleList)) 
 	{
 		echo '<h3>Step '.(++$stepID).': Upgrade proofed modules</h3>';
Index: branches/2.8.x/wb/admin/interface/version.php
===================================================================
--- branches/2.8.x/wb/admin/interface/version.php	(revision 1890)
+++ branches/2.8.x/wb/admin/interface/version.php	(revision 1891)
@@ -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', '1890');
+if(!defined('REVISION')) define('REVISION', '1891');
 if(!defined('SP')) define('SP', '');
Index: branches/2.8.x/wb/modules/captcha_control/sql/mod_captcha_control.sql
===================================================================
--- branches/2.8.x/wb/modules/captcha_control/sql/mod_captcha_control.sql	(nonexistent)
+++ branches/2.8.x/wb/modules/captcha_control/sql/mod_captcha_control.sql	(revision 1891)
@@ -0,0 +1,25 @@
+-- phpMyAdmin SQL Dump
+-- Erstellungszeit: 15. Mrz 2013 um 18:21
+-- Server-Version: 5.5.27
+SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
+SET time_zone = "+00:00";
+-- --------------------------------------------------------
+-- Database structure for WebsiteBaker core
+--
+-- Replacements: {TABLE_PREFIX}, {TABLE_ENGINE}, {TABLE_COLLATION}
+--
+-- --------------------------------------------------------
+--
+-- Tabellenstruktur für Tabelle `mod_captcha_control`
+--
+DROP TABLE IF EXISTS `{TABLE_PREFIX}mod_captcha_control`;
+CREATE TABLE IF NOT EXISTS `{TABLE_PREFIX}mod_captcha_control` (
+  `enabled_captcha` int(11) NOT NULL DEFAULT '1',
+  `enabled_asp` int(11) NOT NULL DEFAULT '1',
+  `captcha_type` varchar(255){TABLE_COLLATION} NOT NULL DEFAULT 'calc_text',
+  `asp_session_min_age` int(11) NOT NULL DEFAULT '20',
+  `asp_view_min_age` int(11) NOT NULL DEFAULT '10',
+  `asp_input_min_age` int(11) NOT NULL DEFAULT '5',
+  `ct_text` longtext{TABLE_COLLATION} NOT NULL
+) {TABLE_ENGINE};
+-- EndOfFile
\ No newline at end of file
Index: branches/2.8.x/wb/modules/captcha_control/sql/data_captcha_control.sql
===================================================================
--- branches/2.8.x/wb/modules/captcha_control/sql/data_captcha_control.sql	(nonexistent)
+++ branches/2.8.x/wb/modules/captcha_control/sql/data_captcha_control.sql	(revision 1891)
@@ -0,0 +1,18 @@
+-- phpMyAdmin SQL Dump
+-- Erstellungszeit: 18. Mrz 2013 um 04:21
+-- Server-Version: 5.5.27
+--
+SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
+SET time_zone = "+00:00";
+-- --------------------------------------------------------
+-- Database structure for WebsiteBaker core
+--
+-- Replacements: {TABLE_PREFIX}, {TABLE_ENGINE}, {TABLE_COLLATION}
+--
+-- --------------------------------------------------------
+--
+-- Daten für Tabelle `mod_captcha_control`
+--
+
+INSERT INTO `{TABLE_PREFIX}mod_captcha_control` VALUES(1, '1', 'calc_ttf_image', 20, 10, 5, '');
+-- EndOfFile
\ No newline at end of file
Index: branches/2.8.x/wb/modules/captcha_control/info.php
===================================================================
--- branches/2.8.x/wb/modules/captcha_control/info.php	(revision 1890)
+++ branches/2.8.x/wb/modules/captcha_control/info.php	(revision 1891)
@@ -24,10 +24,10 @@
 }
 /* -------------------------------------------------------- */
 $module_directory 	= 'captcha_control';
-$module_name        = 'Spam-Protection Control';
+$module_name        = 'CAPTCHA SPAM-Protection Control';
 $module_function    = 'tool';
-$module_version     = '1.2.0';
-$module_platform    = '2.7 | 2.8.x';
+$module_version     = '1.2.1';
+$module_platform    = '2.8.4';
 $module_author      = 'Thomas Hornik (thorn)';
 $module_license     = 'GNU General Public License';
 $module_description = 'Admin-Tool to control CAPTCHA and ASP';
Index: branches/2.8.x/wb/modules/captcha_control/tool.php
===================================================================
--- branches/2.8.x/wb/modules/captcha_control/tool.php	(revision 1890)
+++ branches/2.8.x/wb/modules/captcha_control/tool.php	(revision 1891)
@@ -4,7 +4,7 @@
  * @category        modules
  * @package         captcha_control
  * @author          WebsiteBaker Project
- * @copyright       2009-2011, Website Baker Org. e.V.
+ * @copyright       2009-2012, WebsiteBaker Org. e.V.
  * @link            http://www.websitebaker2.org/
  * @license         http://www.gnu.org/licenses/gpl.html
  * @platform        WebsiteBaker 2.8.x
@@ -59,9 +59,8 @@
 	}
 
 
-	// update database settings
-
-    $sql  = 'UPDATE '.$table.' ';
+// update/insert database settings
+	$sql  = 'UPDATE `'.$table.'` ';
     $sql .= 'SET `enabled_captcha` = \''.$enabled_captcha.'\', ';
     $sql .=     '`enabled_asp` = \''.$enabled_asp.'\', ';
     $sql .=     '`captcha_type` = \''.$captcha_type.'\', ';
@@ -71,8 +70,6 @@
     $sql .=     '`ct_text` =\''.$ct_text.'\' ';
 
     if(!$database->query($sql)) {
-    //    print '<pre style="text-align: left;"><strong>function '.__FUNCTION__.'( '.''.' );</strong>  basename: '.basename(__FILE__).'  line: '.__LINE__.' -> <br />';
-    //    print_r( explode(',',$sql) ); print '</pre>'; // flush ();sleep(10); die();
     }
 
 	// check if there is a database error, otherwise say successful
Index: branches/2.8.x/wb/modules/captcha_control/install.php
===================================================================
--- branches/2.8.x/wb/modules/captcha_control/install.php	(revision 1890)
+++ branches/2.8.x/wb/modules/captcha_control/install.php	(revision 1891)
@@ -7,7 +7,7 @@
  * @copyright       2009-2012, WebsiteBaker Org. e.V.
  * @link            http://www.websitebaker2.org/
  * @license         http://www.gnu.org/licenses/gpl.html
- * @platform        WebsiteBaker 2.8.x
+ * @platform        WebsiteBaker 2.8.3
  * @requirements    PHP 5.2.2 and higher
  * @version         $Id$
  * @filesource      $HeadURL$
@@ -14,34 +14,19 @@
  * @lastmodified    $Date$
  *
  */
-
-// prevent this file from being accessed directly
 /* -------------------------------------------------------- */
-if(defined('WB_PATH') == false)
-{
-	// Stop this file being access directly
-		die('<h2 style="color:red;margin:3em auto;text-align:center;">Cannot access this file directly</h2>');
+// 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 {
+	$sError = array();
+	// Create table
+	if(!$database->SqlImport(dirname(__FILE__).'/sql/mod_captcha_control.sql','',false)){
+		$sError[] = $database->get_error();
+	}
+// Insert data
+	if(!$database->SqlImport(dirname(__FILE__).'/sql/data_captcha_control.sql','',false)){
+		$sError[] = $database->get_error();
+	}
 }
-/* -------------------------------------------------------- */
-
-$table = TABLE_PREFIX.'mod_captcha_control';
-$database->query("DROP TABLE IF EXISTS `$table`");
-
-$database->query("CREATE TABLE IF NOT EXISTS `$table` (
-	`enabled_captcha` VARCHAR(1) NOT NULL DEFAULT '1',
-	`enabled_asp` VARCHAR(1) NOT NULL DEFAULT '0',
-	`captcha_type` VARCHAR(255) NOT NULL DEFAULT 'calc_text',
-	`asp_session_min_age` INT(11) NOT NULL DEFAULT '20',
-	`asp_view_min_age` INT(11) NOT NULL DEFAULT '10',
-	`asp_input_min_age` INT(11) NOT NULL DEFAULT '5',
-	`ct_text` LONGTEXT NOT NULL
-	) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci"
-);
-
-// add new row using the table default values defined above
-$database->query("
-	INSERT INTO `$table`
-		(`enabled_captcha`, `enabled_asp`, `captcha_type`)
-	VALUES
-		('1', '1', 'calc_text')
-");
Index: branches/2.8.x/wb/modules/captcha_control/upgrade.php
===================================================================
--- branches/2.8.x/wb/modules/captcha_control/upgrade.php	(revision 1890)
+++ branches/2.8.x/wb/modules/captcha_control/upgrade.php	(revision 1891)
@@ -14,24 +14,81 @@
  * @lastmodified    $Date$
  *
  */
-
-// prevent this file from being accessed directly
+// Must include code to stop this file being access directly
 /* -------------------------------------------------------- */
-if(defined('WB_PATH') == false)
-{
-	// Stop this file being access directly
-		die('<head><title>Access denied</title></head><body><h2 style="color:red;margin:3em auto;text-align:center;">Cannot access this file directly</h2></body></html>');
+// Must include code to stop this file being accessed directly
+if(!defined('WB_URL')) {
+	require_once(dirname(dirname(dirname(__FILE__))).'/framework/globalExceptionHandler.php');
+	throw new IllegalFileException();
 }
 /* -------------------------------------------------------- */
-$msg = '';
-$sTable = TABLE_PREFIX.'mod_captcha_control';
-if(($sOldType = $database->getTableEngine($sTable))) {
-	if(('myisam' != strtolower($sOldType))) {
-		if(!$database->query('ALTER TABLE `'.$sTable.'` Engine = \'MyISAM\' ')) {
-			$msg = $database->get_error();
+
+	function mod_captcha_control_upgrade($bDebug=false) {
+		global $OK ,$FAIL;
+		$database=WbDatabase::getInstance();
+		$msg = array();
+		$callingScript = $_SERVER["SCRIPT_NAME"];
+		// check if upgrade startet by upgrade-script to echo a message
+		$tmp = 'upgrade-script.php';
+		$globalStarted = substr_compare($callingScript, $tmp,(0-strlen($tmp)),strlen($tmp)) === 0;
+// check for missing tables, if true stop the upgrade
+		$aTable = array('mod_captcha_control');
+		$aPackage = UpgradeHelper::existsAllTables($aTable);
+		if( sizeof($aPackage) > 0){
+			$msg[] =  'TABLE '.implode(' missing! '.$FAIL.'<br />TABLE ',$aPackage).' missing! '.$FAIL;
+			$msg[] = 'Captcha control upgrade failed'." $FAIL";
+			if($globalStarted) {
+				echo '<strong>'.implode('<br />',$msg).'</strong><br />';
+			}
+			return ( ($globalStarted==true ) ? $globalStarted : $msg);
+		} else {
+			for($x=0; $x<sizeof($aTable);$x++) {
+				if(($sOldType = $database->getTableEngine($database->TablePrefix.$aTable[$x]))) {
+					if(('myisam' != strtolower($sOldType))) {
+						if(!$database->query('ALTER TABLE `'.$database->TablePrefix.$aTable[$x].'` Engine = \'MyISAM\' ')) {
+							$msg[] = $database->get_error();
+						} else{
+							$msg[] = 'TABLE `'.$database->TablePrefix.$aTable[$x].'` changed to Engine = \'MyISAM\''." $OK";
+						}
+					} else {
+						$msg[] = 'TABLE `'.$database->TablePrefix.$aTable[$x].'` has Engine = \'MyISAM\''." $OK";
+					}
+				} else {
+					$msg[] = $database->get_error();
+				}
+			}
+// change table structure
+			$sTable = $database->TablePrefix.'mod_captcha_control';
+			$sDescription = 'int(11) NOT NULL DEFAULT \'1\'';
+			$sFieldName = 'enabled_captcha';
+			if(!$database->field_modify($sTable,$sFieldName,$sDescription)) {
+				$msg[] = ''.$database->get_error();
+			} else {
+				$msg[] = 'Field ( `enabled_captcha` ) description has been changed successfully'." $OK";
+			}
+			$sFieldName = 'enabled_asp';
+			if(!$database->field_modify($sTable,$sFieldName,$sDescription)) {
+				$msg[] = ''.$database->get_error();
+			} else {
+				$msg[] = 'Field ( `enabled_asp` ) description has been changed successfully'." $OK";
+			}
+// only for upgrade-script
+			if($globalStarted) {
+				if($bDebug) {
+					echo '<strong>'.implode('<br />',$msg).'</strong><br />';
+				}
+			}
 		}
+		$msg[] = 'Captcha control upgrade successfull finished '." $OK";
+		if($globalStarted) {
+			echo "<strong>Captcha control upgrade successfull finished $OK</strong><br />";
+		}
+		return ( ($globalStarted==true ) ? $globalStarted : $msg);
 	}
-} else {
-	$msg = $database->get_error();
+// ------------------------------------
+
+$bDebugModus = ((isset($bDebugModus)) ? $bDebugModus : false);
+// Don't show the messages twice
+if( is_array($msg = mod_captcha_control_upgrade($bDebugModus)) ) {
+	echo '<strong>'.implode('<br />',$msg).'</strong><br />';
 }
-// ------------------------------------
\ No newline at end of file
