<?php if(!defined('master_script')) die();

/**
 * Settings
 *
 * @category   Module (comments)
 * @author     Nico Wenig <nico.wenig@yellowgreen.de>
 * @version	   2009-12-07
 */

	$modules['comments']['version'] = '1.1';
	$modules['comments']['author'] = 'Nico Wenig';
	$modules['comments']['support'] = 'mailto:nico.wenig@yellowgreen.de';
	$modules['comments']['pagemap version'] = '0.4';
	$modules['comments']['for'] = 'all';
	$modules['comments']['key'] = 'comments';
	$modules['comments']['path'] = $system_data['folder']['modules'] . $modules['comments']['key'] . '/';
	$modules['comments']['languages'] = $system_data['folder']['modules'] . $modules['comments']['key'] . '/languages/';
	$modules['comments']['protected'] = 0;
	$modules['comments']['preview'] = 1;

	include_txt($modules['comments']['key'], $modules['comments']['languages']);

/**
 * Save module to page
 *
 * @category   Module (comments)
 * @author     Nico Wenig <nico.wenig@yellowgreen.de>
 * @version	   2009-05-29
 */

	if(isset($_POST['save_comments'])) {
		// Parse data
		$_POST['email_notification'] = isset($_POST['email_notification']) ? 1 : 0;
		$_POST['close_comments'] = isset($_POST['close_comments']) ? 1 : 0;
		$_POST['embedded'] = isset($_POST['embedded']) ? 1 : 0;
		
		// Create module section
		$module_content_to_save = '
			<!-- MODULE: comments -->

			<?php
				$module_settings["comments"] = array(
					"language" => "' . clean_string($_POST['language'], true) . '",
					"margin top" => ' . intval($_POST['margin_top']) . ',
					"margin left" => ' . intval($_POST['margin_left']) . ',
					"css class" => "' . clean_string($_POST['css_class'], true) . '",
					"css id" => "' . clean_string($_POST['css_id'], true) . '",
					
					"email notification" => ' . $_POST['email_notification'] . ',
					"closed" => ' . $_POST['close_comments'] . ',
					"embedded" => ' . $_POST['embedded'] . '
				);
				
				' . connector('comments backend save') . '
				include_module("comments", false);
			?>
		';
	}

?>