Location: PHPKode > projects > Basic Announce > Basic Announce Version 4.0/inc/settings.inc.php
<?php

    require_once("config.inc.php");
    require_once("classes/database.class.php");
    require_once("functions.inc.php");

	//------------------------------------------------------------------------------
	// definition of tables constants
	define("TABLE_ADMINS", 			 	_DB_PREFIX."admins");
	define("TABLE_CALENDAR", 			_DB_PREFIX."calendar");
	define("TABLE_COUNTRIES", 		 	_DB_PREFIX."countries");
	define("TABLE_DATAGRID_PAGES", 	 	_DB_PREFIX."datagrid_pages");
	define("TABLE_DG_WIZARD_FIELDS", 	_DB_PREFIX."dg_wizard_fields");
	define("TABLE_DG_WIZARD_FILTERING", _DB_PREFIX."dg_wizard_filtering");
	define("TABLE_DG_WIZARD_FOREIGN_KEYS", _DB_PREFIX."dg_wizard_foreign_keys");
	define("TABLE_DG_WIZARD_SETTINGS", 	_DB_PREFIX."dg_wizard_settings");
	define("TABLE_DYNAMIC_PAGES", 		_DB_PREFIX."dynamic_pages");
	define("TABLE_EMAIL_TEMPLATES", 	_DB_PREFIX."email_templates");
	define("TABLE_EVENTS", 	            _DB_PREFIX."events");
	define("TABLE_FILE_TYPES", 			_DB_PREFIX."file_types");
	define("TABLE_GALLERY_ALBUMS", 		_DB_PREFIX."gallery_albums");
	define("TABLE_GALLERY_IMAGES", 		_DB_PREFIX."gallery_images");
	define("TABLE_MENU", 				_DB_PREFIX."menu");
	define("TABLE_MENU_ACCESS_RIGHTS", 	_DB_PREFIX."menu_access_rights");
	define("TABLE_MODULES", 			_DB_PREFIX."modules");
	define("TABLE_NEWS", 				_DB_PREFIX."news");
	define("TABLE_SETTINGS", 			_DB_PREFIX."settings");	
	define("TABLE_STATIC_PAGES", 		_DB_PREFIX."static_pages");
	define("TABLE_SYSTEM_LOGS", 		_DB_PREFIX."system_logs");
	define("TABLE_TEST", 				_DB_PREFIX."test");
	define("TABLE_TEST_1", 				_DB_PREFIX."test_1");
	define("TABLE_TEST_COUNTRIES", 		_DB_PREFIX."test_countries");
	define("TABLE_USERS", 				_DB_PREFIX."users");
	define("TABLE_USERS_GROUPS", 		_DB_PREFIX."users_groups");

	//------------------------------------------------------------------------------
    // prepare panel settings
	$db = Database::GetInstance();
    $db->SetEncoding();
	
	//------------------------------------------------------------------------------
	// prepare information about panel
    $sql = "SELECT * FROM ".TABLE_SETTINGS;			
    $db->Query($sql);	
    $row = $db->FetchAssoc();
	
	$SETTINGS['panel_name']		           = _PANEL_NAME;
	$SETTINGS['site_name']		           = isset($row['site_name']) ? $row['site_name'] : _SITE_NAME;
	$SETTINGS['site_address'] 	           = isset($row['site_address']) ? $row['site_address'] : _SITE_ADDRESS;
	$SETTINGS['database_type'] 	           = isset($row['database_type']) ? $row['database_type'] : _DB_TYPE;
	$SETTINGS['header_text'] 	           = isset($row['header_text']) ? $row['header_text'] : _PANEL_NAME;
	$SETTINGS['css_style'] 		           = isset($row['css_style']) ? $row['css_style'] : _CSS_STYLE;
	$SETTINGS['admin_email'] 	           = isset($row['admin_email']) ? $row['admin_email'] : _ADMIN_EMAIL;
	$SETTINGS['mailer'] 	               = isset($row['mailer']) ? $row['mailer'] : _MAILER;
	$SETTINGS['smtp_address'] 	           = isset($row['smtp_address']) ? $row['smtp_address'] : "";
	$SETTINGS['smtp_port'] 	           	   = isset($row['smtp_port']) ? $row['smtp_port'] : "";
	$SETTINGS['smtp_username'] 	           = isset($row['smtp_username']) ? $row['smtp_username'] : "";
	$SETTINGS['smtp_password'] 	           = isset($row['smtp_password']) ? $row['smtp_password'] : "";	
	$SETTINGS['datagrid_css_style']        = isset($row['datagrid_css_style']) ? $row['datagrid_css_style'] : _DATAGRID_CSS_STYLE;
	$SETTINGS['menu_style'] 	           = isset($row['menu_style']) ? $row['menu_style'] : _MENU_STYLE;
	$SETTINGS['left_panel_scrolling']      = isset($row['left_panel_scrolling']) ? $row['left_panel_scrolling'] : _SIDE_PANEL_SCROLLING;
	$SETTINGS['alert_panel_status']        = isset($row['alert_panel_status']) ? $row['alert_panel_status'] : _ALERT_PANEL_STATUS;
	$SETTINGS['home_panel_status'] 	       = isset($row['home_panel_status']) ? $row['home_panel_status'] : _HOME_PANEL_STATUS;
	$SETTINGS['dashboard_icons']           = isset($row['dashboard_icons']) ? $row['dashboard_icons'] : _DASHBOARD_ICONS;
	$SETTINGS['allow_breadcrumbs']         = isset($row['allow_breadcrumbs']) ? $row['allow_breadcrumbs'] : _SHOW_BREADCRUMBS;
	$SETTINGS['allow_password_recovery']   = isset($row['allow_password_recovery']) ? $row['allow_password_recovery'] : _PASSWORD_RECOVERY;
	$SETTINGS['excessive_logins_timeout']  = isset($row['excessive_logins_timeout']) ? $row['excessive_logins_timeout'] : _EXCESSIVE_LOGINS_TIMEOUT;
	$SETTINGS['user_password_editing']     = isset($row['user_password_editing']) ? $row['user_password_editing'] : _USER_PASSWORD_EDITING;
	$SETTINGS['user_excessive_logins']     = isset($row['user_excessive_logins']) ? $row['user_excessive_logins'] : _USER_EXCESSIVE_LOGINS;
	$SETTINGS['admin_password_editing']    = isset($row['admin_password_editing']) ? $row['admin_password_editing'] : _ADMIN_PASSWORD_EDITING;
	$SETTINGS['admin_excessive_logins']    = isset($row['admin_excessive_logins']) ? $row['admin_excessive_logins'] : _ADMIN_EXCESSIVE_LOGINS;
	$SETTINGS['smtp_address'] 	           = isset($row['smtp_address']) ? $row['smtp_address'] : "";
	$SETTINGS['smtp_port'] 		           = isset($row['smtp_port']) ? $row['smtp_port'] : "";
	$SETTINGS['smtp_username'] 	           = isset($row['smtp_username']) ? $row['smtp_username'] : "";
	$SETTINGS['smtp_password'] 	           = isset($row['smtp_password']) ? $row['smtp_password'] : "";
	$SETTINGS['session_timeout'] 		   = isset($row['session_timeout']) ? $row['session_timeout'] : _SESSION_TIMEOUT;
	$SETTINGS['passwords_encryption_type'] = isset($row['passwords_encryption_type']) ? $row['passwords_encryption_type'] : _PASSWORDS_ENCRYPTION_TYPE;
	$SETTINGS['passwords_encryption'] 	   = isset($row['passwords_encryption']) ? $row['passwords_encryption'] :  _PASSWORDS_ENCRYPTION;
	$SETTINGS['passwords_encrypt_key'] 	   = _PASSWORDS_ENCRYPT_KEY;
	$SETTINGS['allow_remember_me'] 		   = isset($row['allow_remember_me']) ? $row['allow_remember_me'] : _ALLOW_REMEMBER_ME;
	$SETTINGS['force_https_protocol'] 	   = isset($row['force_https_protocol']) ? $row['force_https_protocol'] : _FORCE_HTTPS_PROTOCOL;
	$SETTINGS['time_zone_name'] 		   = isset($row['time_zone_name']) ? $row['time_zone_name'] : _TIME_ZONE_NAME;

	// language
	if(isset($_SESSION['adm_logged']) && isset($_SESSION['preferred_language']) && $_SESSION['preferred_language'] != ""){
		$SETTINGS['site_language'] = $_SESSION['preferred_language'];
	}else{
		$SETTINGS['site_language'] = isset($row['site_language']) ? $row['site_language'] : _SITE_LANGUAGE;		
	}
	// language direction
	if($SETTINGS['site_language'] == "ar" || $SETTINGS['site_language'] == "he" || $SETTINGS['site_language'] == "ja_utf8"){
		$SETTINGS['language_dir'] = "rtl";	
	}else{
		$SETTINGS['language_dir'] = "ltr";
	}
	

	//------------------------------------------------------------------------------
	// prepare information about modules
	$MODULES = array();
    $sql="SELECT id, module_code, is_installed FROM ".TABLE_MODULES;			
    $db->Query($sql);	
    while($row = @$db->FetchAssoc()){
		$MODULES[$row['module_code']] = $row['is_installed'];		
	}

	date_default_timezone_set($SETTINGS['time_zone_name']);
?>
Return current item: Basic Announce