<?php
defined("cmr_online") or die("hacking attempt, application is not online, click <a href=\"index.php?cmr_mode=login\" > Here </a> to login before continue ");
/**
* common_begin.php
* --------
* begin : July 2005 - July 2009
* copyright : Camaroes Ver 2.0.3 (C) 2005-2009 T.E.H
* www : http://sourceforge.net/projects/camaroes/
*/
/*=================================================================*/
// vim
// set expandtab
// set shiftwidth=4
// set softtabstop=4
// set tabstop=4
// 80 char / line
// * @package cmr
// * @copyright Copyright (C) 2005 Open Source Matters. All rights reserved.
// * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL,
// * This version may have been modified pursuant
// * to the GNU General Public License, and as distributed it includes or
// * is derivative of works licensed under the GNU General Public License or
// * other free or open source software licenses.
// */
#the first configuration file is ./config.inc.php
#the general dynamic configuration file is ./conf.d/conf.ini
#the group configuration file is ./home/groups/{group_name}/config.ini
#the user configuration file is ./home/groups/{user_name}/config.ini
#to configure the interface (module windows position) for all user, see ./page/page.ini or ./themes/themes.ini or ./css/camaroes.css
#to configure the interface (module windows position) for a group, see ./home/{group_name}/page.ini or ./home/{user_name}/page.ini
#the language file is ./languages/language.ini or ./language/lang_to_use/language.ini
#the default windows themes configuration file ./themes/themes.ini or ./themes/{themes_folder}/themes.ini
#the database connection configuation can_be ./conf.d/conf.ini or ./config.inc.php or ./conf.d/conf.ini or ./home/{group_name}/login_rc.php or ./home/{group_name}/config.ini or ./home/{user_name}/config.ini (the default one is in ./conf.d/conf.ini )
# the database connection configuation is in ./home/{group}/connect.php (the default one is in config.inc.php, ./conf.d/conf.ini )
/*
=================================================================
**/
$cmr = new camaroes();
// $cmr->show();
// print_r($cmr);
// exit;
/*==================*/
/*==================*/
include_once(dirname(__FILE__) . "/control.php"); //to control access in the module
if(file_exists(dirname(__FILE__) . "/config.inc.php")){
include_once(dirname(__FILE__) . "/config.inc.php");
}else{
$cmr->config["cmr_main_config"]=dirname(__FILE__) . "/conf.d/conf.ini"; // conf_file_exist($cmr->get_conf("cmr_main_config"));
}
/*==================*/
/*==================*/
include_once(dirname(__FILE__) . "/system/function.php");
/*==================*/
/*==================*/
$cmr->config = $cmr->include_conf($cmr->get_conf("cmr_main_config"), $cmr->config, "var");
$cmr->config = $cmr->preload_config();
/*==================*/
/*==================*/
if(empty($cmr->config["cmr_path"])) $cmr->config["cmr_path"] = realpath("./");
$cmr->config["cmr_path"] = realpath($cmr->config["cmr_path"]) . "/";
/*==================*/
/*==================*/
$cmr->action["to_load"] = $cmr->get_conf("cmr_preload_func");
include($cmr->get_path("index") . "system/loader/loader_function.php");
$cmr->action["to_load"] = $cmr->get_conf("cmr_preload_class");
include($cmr->get_path("index") . "system/loader/loader_class.php");
/*==================*/
/*==================*/
// if(cmr_cli()) $cmr->post_var=$cmr->get_param();
/*==================*/
/*==================*/
$cmr->load_session_mode();
session_start();/* start the session */
/*==================*/
// $cmr->debug_print();exit;
/*==================*/
if(empty($cmr->session["type"])) $cmr->session["type"]="normal"; //read_only
/*==================*/
// $cmr->language = auto_language($cmr->config, $cmr->language, $cmr->db_connection); //__automatic create language traduction
$cmr->language = $cmr->include_conf($cmr->get_conf("cmr_begin_lang_file"), $cmr->language, "var");
$cmr->page = $cmr->include_conf($cmr->get_conf("cmr_begin_pager_file"), $cmr->page, "var");// =========== default config ==================
$cmr->themes = $cmr->include_conf($cmr->get_conf("cmr_begin_theme_file"), $cmr->themes, "var");
$cmr->language = $cmr->include_conf($cmr->get_path("lang") . "languages/". $cmr->get_conf("cmr_default_lang"). "/" . $cmr->get_conf("cmr_lang_config"), $cmr->language, "var");
$cmr->themes = $cmr->include_conf($cmr->get_path("theme") . "themes/". $cmr->get_conf("cmr_default_theme") . "/" . $cmr->get_conf("cmr_themes_config"), $cmr->themes, "var");
$cmr->page = $cmr->include_conf($cmr->get_path("tab") . "page/". $cmr->get_conf("cmr_default_pager") . "/" . $cmr->get_conf("cmr_page_config"), $cmr->page, "var");// =========== default config ==================
/*==================*/
/*==================*/
include($cmr->get_path("index") . "system/select_mode.php");//login, logout, forget_id, inscription, ..etc
/*==================*/
/*==================*/
cmr_init_mode($cmr->config, trim($cmr->translate("cmr_charset")));
empty($cmr->config["cmr_output_buffering"]) or ob_start(); // start output buffering// ob_start('cmr_callback');
include_once($cmr->get_path("index") . "adodb/adodb.inc.php");
include_once($cmr->get_path("func") . "function/func_mysql.php");
$cmr->db_connection = $cmr->connect();//or $cmr->config["cmr_guest_mode"]=0; //-----database connection------
$conn = $cmr->db_connection;
if (empty($cmr->db_connection)) $cmr->config["cmr_guest_mode"]=1;
/*==================*/
/*==================*/
if (empty($cmr->config["cmr_guest_mode"])&&(get_post("cmr_mode")!="guest_mode")) {
if (cmr_new_login($cmr->config, $cmr->user)) {// ======================get authentificazione first==================
include_once($cmr->get_path("lib") . "lib/lib_login.php");
include($cmr->get_path("index") . "system/load_user_data.php");
// $cmr->debug_print();exit;
@ include_once(($cmr->user["auth_group_path"]."login_rc.php"));// ===============file group login script================
@ include_once(($cmr->user["auth_user_path"]."login_rc.php"));// ===============file login user script=================
@ eval($cmr->user["auth_group_script"]);// ===============database login group script================
@ eval($cmr->user["auth_user_script"]);// ===============database login user script=================
$cmr->config = $cmr->include_conf($cmr->user["auth_group_path"] . $cmr->get_conf("cmr_home_config"), $cmr->config, "var");
$cmr->config = $cmr->include_conf($cmr->user["auth_user_path"] . $cmr->get_conf("cmr_home_config"), $cmr->config, "var");
$cmr->page = $cmr->include_conf($cmr->user["auth_group_path"] . $cmr->get_conf("cmr_page_config"), $cmr->page, "var");
$cmr->page = $cmr->include_conf($cmr->user["auth_user_path"] . $cmr->get_conf("cmr_page_config"), $cmr->page, "var");
$cmr->themes = $cmr->include_conf($cmr->get_path("theme") . "themes/".$cmr->user["auth_theme"] . "/" . $cmr->get_conf("cmr_themes_config"), $cmr->themes, "var");
$cmr->language = $cmr->include_conf($cmr->get_path("lang") . "languages/". $cmr->user["auth_lang"]. "/" . $cmr->get_conf("cmr_lang_config"), $cmr->language, "var");
$cmr->language = $cmr->include_conf($cmr->get_path("lang") . "languages/". $cmr->page["language"]. "/" . $cmr->get_conf("cmr_lang_config"), $cmr->language, "var");
if(!empty($cmr->action["next_lang"])) $cmr->language = $cmr->include_conf($cmr->get_conf("cmr_begin_lang_file"), $cmr->language, "var");
if(!empty($cmr->action["next_theme"])) $cmr->themes = $cmr->include_conf($cmr->get_conf("cmr_begin_theme_file"), $cmr->themes, "var");
if(!empty($cmr->action["next_page"])) $cmr->page = $cmr->include_conf($cmr->get_conf("cmr_begin_pager_file"), $cmr->page, "var");// =========== default config ==================
include($cmr->get_path("index") . "system/loader/login_to.php");
}else{
$cmr->user=cmr_load_session("user", $cmr->config);
$cmr->session=cmr_load_session("session", $cmr->config);
$cmr->db=cmr_load_session("db", $cmr->config);
if(!empty($cmr->db[0]["db_host"])) $cmr->db_connection = connect_to_db($cmr->config, $cmr->db[0]);
$conn = $cmr->db_connection;
include_once($cmr->get_path("func") . "system/control_session.php");
$cmr->load_session();
// $cmr->debug_print();exit;
}
include($cmr->get_path("index") . "system/get_send_data.php");
// $cmr->debug_print();exit;
update_messages($cmr->config, $cmr->db_connection); //Update ripetitive Message
}
/*==================*/
/*==================*/
if (!empty($cmr->config["cmr_guest_mode"])||(get_post("cmr_mode")=="guest_mode")) {
if (cmr_new_login($cmr->config, $cmr->user)) {// ======================get authentificazione first==================
$_SESSION["cmr_id"]=session_id();
include($cmr->get_path("index") . "system/load_guest_mode.php");
include_once(($cmr->user["auth_group_path"]."login_rc.php"));// ===============file group login script================
include_once(($cmr->user["auth_user_path"]."login_rc.php"));// ===============file login user script=================
$cmr->config = $cmr->include_conf($cmr->user["auth_group_path"] . $cmr->get_conf("cmr_home_config"), $cmr->config, "var");
$cmr->config = $cmr->include_conf($cmr->user["auth_user_path"] . $cmr->get_conf("cmr_home_config"), $cmr->config, "var");
$cmr->page = $cmr->include_conf($cmr->user["auth_group_path"] . $cmr->get_conf("cmr_page_config"), array(), "var");
$cmr->page = $cmr->include_conf($cmr->user["auth_user_path"] . $cmr->get_conf("cmr_page_config"), $cmr->page, "var");
$cmr->themes = $cmr->include_conf($cmr->get_path("theme") . "themes/".$cmr->page["auth_theme"] . "/" . $cmr->get_conf("cmr_themes_config"), $cmr->themes, "var");
$cmr->language = $cmr->include_conf($cmr->get_path("lang") . "languages/". $cmr->page["language"]. "/" . $cmr->get_conf("cmr_lang_config"), $cmr->language, "var");
include($cmr->get_path("index") . "system/get_send_data.php");
}else{
$cmr->load_session();
}
};
/*==================*/
/*==================*/
$cmr->post_var["cmr_module"] = get_post("cmr_module");
$cmr->post_var["cmr_lib"] = get_post("cmr_lib");
if ((!empty($cmr->post_var["cmr_module"]))||(!empty($cmr->post_var["cmr_lib"]))) {
// $cmr->post_files=get_post_files($cmr->config, $cmr->user, $cmr->post_files);
include_once($cmr->get_path("index") . "system/loader/loader_lib.php");
}
/*==================*/
/*==================*/
$cmr->session["pre_match"] = "";//$code1="1";
$cmr->page=layers_init($cmr->page, 1, $cmr->post_var["cmr_module"]);// print("head=$cmr->page["head_num_mod"];left=$cmr->page["left_num_mod"];middle=$cmr->page["middle_num_mod"];right=$cmr->page["right_num_mod"];foot=$cmr->page["foot_num_mod"]");
/*==================*/
?>