<?php
/**
 * YANA library
 *
 * definition of constants
 *
 * @package yana
 * @licence http://creativecommons.org/licenses/by-nc-sa/2.5/
 */

/* When debugging, make sure error reporting is at maximum. */
if (error_reporting() > 0) {
    error_reporting(E_ALL);
}

$cfgDir = 'config/';
$tmpDir = 'cache/';

/**#@+
 * Yana - Constant
 */
if (!defined('YANA_ESCAPE_NONE'))            define('YANA_ESCAPE_NONE', 0);
if (!defined('YANA_ESCAPE_SLASHED'))         define('YANA_ESCAPE_SLASHED', 1);
if (!defined('YANA_ESCAPE_TOKEN'))           define('YANA_ESCAPE_TOKEN', 2);
if (!defined('YANA_ESCAPE_CODED'))           define('YANA_ESCAPE_CODED', 3);
if (!defined('YANA_ESCAPE_LINEBREAK'))       define('YANA_ESCAPE_LINEBREAK', 4);
if (!defined('YANA_ESCAPE_USERTEXT'))        define('YANA_ESCAPE_USERTEXT', 5);
if (!defined('YANA_COUNTER_USE_IP'))         define('YANA_COUNTER_USE_IP', 0);
if (!defined('YANA_COUNTER_IGNORE_IP'))      define('YANA_COUNTER_IGNORE_IP', 1);
/**
 * turn error reporting off
 *
 * Use this in any production environment to prevent information leak to
 * possible attackers.
 */
if (!defined('YANA_ERROR_OFF'))              define('YANA_ERROR_OFF', 'off');
/**
 * turn error reporting on
 *
 * Use this to debug your scripts.
 */
if (!defined('YANA_ERROR_ON'))               define('YANA_ERROR_ON',  'on');
/**
 * send errors to a log file
 *
 * Write all reported messages to 'cache/error.log'.
 * Use this for testing.
 */
if (!defined('YANA_ERROR_LOG'))              define('YANA_ERROR_LOG', 'log');

/**#@-*/
/**#@+
 * @ignore
 */

if (!defined('YANA_DATABASE_FAILURE'))       define('YANA_DATABASE_FAILURE', -1);
if (!defined('YANA_DATABASE_NOT_AVAILABLE')) define('YANA_DATABASE_NOT_AVAILABLE', 0);
if (!defined('YANA_DATABASE_NO_FILE'))       define('YANA_DATABASE_NO_FILE', 1);
if (!defined('YANA_DATABASE_OK'))            define('YANA_DATABASE_OK', 2);
if (!defined('YANA_CACHE_ACTIVE'))           define("YANA_CACHE_ACTIVE", false);
if (!defined('YANA_UNI_DELIMITER'))          define('YANA_UNI_DELIMITER', '%');
if (!defined('YANA_LEFT_DELIMITER'))         define('YANA_LEFT_DELIMITER', '['.YANA_UNI_DELIMITER);
if (!defined('YANA_RIGHT_DELIMITER'))        define('YANA_RIGHT_DELIMITER', YANA_UNI_DELIMITER.']');
if (!defined('YANA_INSTANCE_ID'))            define("YANA_INSTANCE_ID", md5(getcwd().$_SERVER['REMOTE_ADDR']));
if (!defined('YANA_REG_WORD'))               define('YANA_REG_WORD', '\$?[\w_\.]');
if (!defined('E_USER_ASSERT'))               define('E_USER_ASSERT', 10);
if (!defined('E_UNKNOWN_ERROR'))             define('E_UNKNOWN_ERROR', -1);

if (!is_writeable($tmpDir) || !is_writeable($cfgDir)) {
    echo "<h1>Configuration error</h1>";
    echo "<p>Set access rights for directories $tmpDir and $cfgDir to 777 including all subdirectories and files.</p>";
    echo "<p>Setzen sie die Zugriffsrechte für die Verzeichnisse $tmpDir und $cfgDir auf 777 inklusive aller Unterverzeichnisse und Dateien.</p>";
}

/* [SMARTY] */

if (!class_exists('Smarty')) {
    require_once('engine/libs/Smarty.class.php');
}

/* [DATABASE SETTINGS] */

include_once($cfgDir.'dbconfig.php');
unset($cfgDir);unset($tmpDir);

/* [Tools] */

require_once('includes/config.php');
require_once('includes/toolbox.php');

/* [Class-Files] */

require_once('includes/class_layout.php');
require_once('includes/class_string_type.php');
require_once('includes/class_hashtable.php');
require_once('includes/class_serializeableobject.php');
require_once('includes/class_singleton.php');
require_once('includes/class_inputstream.php');
require_once('includes/class_secureinputstream.php');
require_once('includes/class_securefilestream.php');
require_once('includes/class_blockfile.php');
require_once('includes/class_floodfile.php');
require_once('includes/class_configfile.php');
require_once('includes/class_smlfile.php');
require_once('includes/class_datfile.php');
require_once('includes/class_textfile.php');
require_once('includes/class_dirstream.php');
require_once('includes/class_vdrive.php');
require_once('includes/class_vdrive_mountpoint.php');
require_once('includes/class_registry.php');
require_once('includes/class_formmailer.php');
require_once('includes/class_executeable.php');
require_once('includes/class_plugin.php');
require_once('includes/class_language.php');
require_once('includes/class_skin.php');
require_once('includes/class_pluginmanager.php');
require_once('includes/class_yana.php');
require_once('includes/class_view.php');
require_once('includes/class_sessionmanager.php');
require_once('includes/class_dbserver.php');
require_once('includes/class_buffereddbstream.php');
require_once('includes/class_structurefile.php');
require_once('includes/class_filedb.php');
require_once('includes/class_filedb_connection.php');
require_once('includes/class_filedb_result.php');
require_once('includes/class_smarttemplate.php');
require_once('includes/class_mailer.php');
require_once('includes/class_counter.php');
require_once('includes/class_yana_log.php');
require_once('includes/class_displayutility.php');
require_once('includes/class_errorutility.php');

/* [Main Class] */

require_once('includes/class_index.php');

/**#@-*/
?>