<?php

/**
 * This file is part of an ADDON for use with LEPTON Core.
 * This ADDON is released under the GNU GPL.
 * Additional license terms can be seen in the info.php of this module.
 *
 *
 *	@module			captcha_control
 *	@version		see info.php of this module
 *	@authors		LEPTON Project, W. Studer
 *	@copyright		2010-2026 LEPTON Project
 *	@link			https://lepton-cms.org
 *	@license		https://gnu.org/licenses/gpl.html
 *	@license_terms	please see info.php of this module
 *	@platform		see info.php of this module
 *
 *
 */

// include secure.php to protect this file and the whole CMS!
if(!defined("SEC_FILE")){define("SEC_FILE",'/framework/secure.php' );}
if (defined('LEPTON_PATH')) {	
	include LEPTON_PATH.SEC_FILE;
} else {
	$oneback = "../";
	$root = $oneback;
	$level = 1;
	while (($level < 10) && (!file_exists($root.SEC_FILE))) {
		$root .= $oneback;
		$level += 1;
	}
	if (file_exists($root.SEC_FILE)) { 
		include $root.SEC_FILE;   
	} else {
		trigger_error(sprintf("[ <b>%s</b> ] Can't include secure.php!", $_SERVER['SCRIPT_NAME']), E_USER_ERROR);
	}
}
// end include secure file


// create new table
$table_fields ="
	`id` int(1) NOT NULL AUTO_INCREMENT,
	`enabled_captcha` int(1) NOT NULL DEFAULT 0,
	`enabled_asp` int(1) NOT NULL DEFAULT 0,
	`captcha_type` VARCHAR(255) NOT NULL DEFAULT 'calc_image',
	`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` TEXT NOT NULL,
	 PRIMARY KEY ( `id` )
";

LEPTON_handle::install_table('mod_captcha_control', $table_fields);

// add new row using the table default values defined above
$field_values ="
	(NULL,1,0,'calc_text',20,10,5,'')
";
LEPTON_handle::insert_values('mod_captcha_control', $field_values);
