<?php
/*
* @package LabCMS
* @copyright (c) 2006 Alexander Levin aka Loki (loki_angel@mail.ru)
* @support http://labcms.ru
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*/

function clean_magic_quotes()
{
	if (get_magic_quotes_gpc()) {
		$_POST = stripslashes_deep($_POST);
		$_GET = stripslashes_deep($_GET);
		$_COOKIE = stripslashes_deep($_COOKIE);
		$_REQUEST = stripslashes_deep($_REQUEST);
	}
}

/**
 *
 * @param string $className Class or Interface name automatically
 *			  passed to this function by the PHP Interpreter
 */
function autoLoader($className)
{
	$smarty_class=strtolower($className);
	if (substr($smarty_class, 0, 16) == 'smarty_internal_'
		|| in_array(
			$smarty_class,
			array(
				'smarty_config_source',
				'smarty_config_compiled',
				'smarty_security',
				'smarty_cacheresource',
				'smarty_cacheresource_custom',
				'smarty_cacheresource_keyvaluestore',
				'smarty_resource',
				'smarty_resource_custom',
				'smarty_resource_uncompiled',
				'smarty_resource_recompiled')
		)
	) {
		include SMARTY_SYSPLUGINS_DIR . $smarty_class . '.php';
		return;
	}

	include_once LAB_PATH_CLASSES.'/Factory.php';
	if (Factory::load($className)) return;
}