<?php
defined("cmr_online") or define("cmr_online",1);
/**
* cmr_class.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 tabstop=4 shiftwidth=4: */
/*
Copyright (c) 2009, Tchouamou Eric Herve <tchouamou@gmail.com>
All rights reserved.
camaroes_class.php, 2009-Feb-Tue 0:12:13
*/
if (!(function_exists("cmr_load_session_mode"))) {
function cmr_load_session_mode($cmr_config=array()) // --constructor--
{
if (empty($cmr_config)) $cmr_config = $GLOBALS["cmr"]->config;
if (!(empty($cmr_config["cmr_save_session"]))) {
switch($cmr_config["cmr_save_session"]){
case "database":break;
case "cookies":break;
case "files":
session_save_path(cmr_get_path("session"));// for good session work
break;
case "normal":
default:
break;
}
}
/* set the cache limiter to 'nocache' */
session_cache_limiter($cmr_config["cmr_session_cache"]);
/* set the cache expire to 300 minutes */
session_cache_expire(intval($cmr_config["cmr_cache_expire"]));
return true;
}
}
/*=================================================================*/
/*=================================================================*/
/*==================*/
// ___ __ __ ____ ____
// / __)( ) / _\ / ___)/ ___)
// ( (__ / (_/\/ \\___ \\___ \
// \___)\____/\_/\_/(____/(____/
/**
* Class PhpExplorator
*
* @package
* @author Tchouamou Eric Herve (tchouamou@gmail.com)
* @copyright Copyright (c) 2009
* @version $Id$
* @access public
*/
//0000000000000000000000000000000000000000000000000000000000000000000000000000
//00000000000000000000000000 Camaroes 000000000000000000000000000000
//0000000000000000000000000000000000000000000000000000000000000000000000000000
class camaroes {
/*==================*/
var $buffer = array(); //buffer html content
var $query=array(); //alll current sql query
var $db_connection; //database connection
var $input = array(); //all input array()
var $output = array(); //all output array()
var $config = array(); //config array()
var $themes = array(); //themes array()
var $page = array(); //page array()
var $language = array(); //language array()
var $help = array(); //help array()
var $label = array(); //label array()
var $report = array(); //report array()
var $others = array(); //others array()
var $user = array() ; //user array()
var $group = array() ; //group array()
var $db = array() ; //db array()
var $post_files = array() ; //post_files array()
var $post_var = array() ; //post_var array()
var $session = array() ; //session array()
var $cookies = array() ; //cookies array()
var $email = array() ; //email array()
var $imap = array() ; //imap array()
var $notify = array() ; //notify array()
var $event = array() ; //event array()
var $prints = array() ; //prints array()
var $debug = array() ; //debug array()
var $action = array() ; //action array()
var $object = array() ; //action array()
var $module = array() ; //module array()
var $alink = array() ; //alink array()
var $ahref = array() ; //ahref array()
//00000000000000000000000000
//00000000000000000000000000
function camaroes($cmr_global = array()) // --constructor--
{
if(!empty($cmr_global)){
$this->config = $cmr_global["config"];//config array()
$this->themes = $cmr_global["themes"];//themes array()
$this->page = $cmr_global["page"];//page array()
$this->language = $cmr_global["language"];//language array()
$this->help = $cmr_global["help"];//help array()
$this->label = $cmr_global["label"];//label array()
$this->buffer = $cmr_global["buffer"]; //buffer html content
$this->db_connection = $cmr_global["db_connection"]; ; //database connection
$this->db = $cmr_global["db"];//db array()
$this->user = $cmr_global["user"];//user array()
$this->group = $cmr_global["group"];//group array()
$this->report = $cmr_global["report"];//report array()
$this->others = $cmr_global["others"];//others array()
$this->post_files = $cmr_global["post_files"];//post_files array()
$this->post_var = $cmr_global["post_var"];//post_var array()
$this->session = $cmr_global["session"];//session array()
$this->cookies = $cmr_global["cookies"];//cookies array()
$this->imap = $cmr_global["imap"];//email array()
$this->email = $cmr_global["email"];//email array()
$this->notify = $cmr_global["notify"];//email array()
$this->event = $cmr_global["event"];//event array()
$this->prints = $cmr_global["prints"];//event array()
$this->debug = $cmr_global["debug"];//event array()
$this->action = $cmr_global["action"];//action array()
$this->module = $cmr_global["module"];//module array()
$this->alink = $cmr_global["alink"];//alink array()
$this->ahref = $cmr_global["ahref"];//ahref array()
}
return $this;
}
//00000000000000000000000000
//00000000000000000000000000
/*==================*/
function load_session_mode()
{
cmr_load_session_mode($this->config);
return true;
}
/*==================*/
function save_session()
{
cmr_save_session($this->config,$this->themes,$this->page,$this->language,$this->db,$this->email,$this->user,$this->group,$this->post_var,$this->session,$this->others);
return true;
}
/*==================*/
function load_session()
{
$this->config=cmr_load_session("config", $this->config);
$this->themes=cmr_load_session("themes", $this->config);
$this->page=cmr_load_session("page", $this->config);
$this->language=cmr_load_session("language", $this->config);
$this->db=cmr_load_session("db", $this->config);
$this->imap=cmr_load_session("imap", $this->config);
$this->user=cmr_load_session("user", $this->config);
$this->group=cmr_load_session("group", $this->config);
$this->post_var=cmr_load_session("post_var", $this->config);
$this->session=cmr_load_session("session", $this->config);
$this->others=cmr_load_session("others", $this->config);
return true;
}
/*==================*/
function get_param($arg = "")
{
$param = cmr_get_param($arg);
return $param;
}
/*==================*/
/*==================*/
function cli()
{
$param = cmr_cli();
return $param;
}
/*==================*/
function translate($text)
{
if(empty($this->page["language"])) $this->page["language"] = "english";
$param = cmr_translate($text, "english", $this->page["language"], $this->language);
return $param;
}
/*==================*/
function gener_code($cmr_code)
{
$cmr_img_code = substr((base64_encode(md5(date("s") . $cmr_code . rand()))), 5, 5);
if (!function_exists("imagecreate")) {
$cmr_img_code = (rand(1, 5) > 3)?"2NhM2":"GUyYz";
}
return $cmr_img_code;
}
/*==================*/
function connect()
{
$this->db_connection = connect_to_db($this->config, $this->db);
return $this->db_connection;
}
/*==================*/
function run_query($sql_query)
{
if(!empty($sql_query)){
$this->output[] = &$conn->Execute($sql_query, $this->db_connection) or print($conn->ErrorMsg());
}else{
foreach($this->query as $key=>$val){
$this->output[] = &$conn->Execute($val, $this->db_connection) or print($conn->ErrorMsg());
}
}
return $this->output;
}
/*==================*/
function send_email($email=array())
{
if(!empty($email)){
$this->output[]=mail($email["recipient"], $email["subject"], $email["body"], $email["headers_all"]);
}else{
$this->output[]=mail($this->email["recipient"], $this->email["subject"], $this->email["body"], $this->email["headers_all"]);
}
return $this->output;
}
/*==================*/
function conf_exist($cmr_conf_file="config.inc.php")
{
return cmr_conf_exist($cmr_conf_file);
}
/*==================*/
/*==================*/
function include_conf($file_name, $cmr_array = array(), $action = "const")
{
return cmr_include_conf($this->config, $file_name, $cmr_array, $action);
}
/*==================*/
function preload_config($list_conf = "")
{
return cmr_preload_config($this->config, $list_conf);
}
/*==================*/
/*==================*/
function load_template($file_tpl, $limit_tpl = "")
{
return cmr_load_template($file_tpl, $limit_tpl, $this->prints);
}
/*==================*/
/*==================*/
function pure_mod_name($cmrmodule="user.php")
{
return cmr_pure_mod_name($this->config, $cmrmodule);
}
/*==================*/
function load_lang_need($cmrmodule="user.php")
{
return cmr_load_lang_need($this->config, $this->language, $this->page, $cmrmodule);
}
/*==================*/
function load_conf_need($cmrmodule="user.php")
{
return cmr_load_conf_need($this->config, $cmrmodule);
}
/*==================*/
function load_help_need($cmrmodule="user.php")
{
return cmr_load_help_need($this->config, $this->help, $cmrmodule);
}
/*==================*/
function load_module_need()
{
return cmr_load_module_need($this->config, $this->language, $this->page, $this->module);
}
/*==================*/
function load_notify($subject_templates = "")
{
$pattern_templates = cmr_get_path("notify") . "templates/notify/format_notify.xml";
return cmr_load_notify($this->config, $this->user, $subject_templates, $pattern_templates);
}
/*==================*/
function secure_all()
{
if (isset($this->config["cmr_secure_mode"])) { /*======================BLOCK HACKING==============================*/
include_once(cmr_get_path("index") . "control.php");
secure_all_var();
}
return true;
}
/*==================*/
function load_cookie()
{
return cmr_load_cookie($this->config);
}
/*==================*/
function debug_print()
{
if(!isset($this->user["authorisation"]) || (intval($this->user["authorisation"]) >= intval($this->config["cmr_admin_level"]))){
cmr_debug_print($this->debug, $this->module, $this->config, $this->themes, $this->page,$this->db,$this->user,$this->group,$this->post_var,$this->post_files,$this->session,$this->query,$this->language);
}else{
echo "<br />".$this->translate("User not allow") . "<br />" . $this->translate("current level")."=".$this->user["auth_level"]."<br />";
echo "" . $this->translate("need level") . "=" . $this->config["cmr_admin_level"] . "<br />";
}
return $this;
}
/*==================*/
function run_event()
{
return cmr_run_event($this->config, $this->session, $this->event);
}
/*==================*/
/*==================*/
function down_file($the_file)
{
return download_file($this->config, $the_file);
}
/*==================*/
/*==================*/
function download_data($data="\n", $the_file)
{
return export($this->config, $data, substr($the_file, strrpos($the_file, ".")), $the_file);
}
/*==================*/
function module_icon($module, $size = "16")
{
return cmr_module_icon($this->config, $module, $size = "16");
}
/*==================*/
function module_link($module, $image = "", $text = "", $img_heigth = "20", $img_right = "90", $link_layer = "middle1", $other_a_link = "", $other_img = "")
{
return code_link($this->config, $this->page, $this->language, $module, $image, $text, $img_heigth, $img_right, $link_layer, $other_a_link, $other_img);
}
/*==================*/
function module_href($module, $cod = 1, $param = "", $keys = "", $vals = "", $link_layer = "middle1")
{
return code_href($this->config, $this->page, $module, $cod = 1, $param, $keys, $vals, $link_layer);
}
/*==================*/
function echo_select($table = "cmr_user", $column = "name", $action = "type", $db_name = "mysql", $col_id = "", $limit = "1000", $order = "id", $width = "100")
{
return echo_select($this->config, $this->language, $this->db_connection, $table, $column , $action , $db_name, $col_id, $limit, $order, $width);
}
/*==================*/
/*==================*/
function cmr_where_query()
{
return cmr_where_query($this->config,$this->user,$this->action,$this->db_connection);
}
/*==================*/
/*==================*/
/*====== GET =======*/
/*==================*/
/*==================*/
function get_path($param = "")
{
if($param == "index") return $this->config["cmr_path"];
return $this->config["cmr_" . $param . "_path"];
} // function to get the config value of the key ($param).
function get_ext($param = "")
{
return $this->config["cmr_" . $param . "_ext"];
} // function to get the config value of the key ($param).
function get_conf($param = "")
{
return $this->config[$param];
} // function to get the config value of the key ($param).
function get_theme($param = "")
{
return $this->themes[$param];
} // function to get the themes value of the key ($param).
function get_page($param = "")
{
return $this->page[$param];
} // function to get the page value of the key ($param).
function get_language($param = "")
{
return $this->language[$param];
} // function to get the language value of the key ($param).
function get_help($param = "")
{
return $this->help[$param];
} // function to get the help value of the key ($param).
function get_label($param = "")
{
return $this->label[$param];
} // function to get the label value of the key ($param).
function get_buffer($param = "")
{
return $this->buffer[$param];
} // function to get the buffer html content of the key ($param).
function get_db_connection()
{
return $this->db_connection;
} // function to get the database connection
function get_db($param = "")
{
return $this->db[$param];
} // function to get the db value of the key ($param).
function get_user($param = "")
{
return $this->user[$param];
} // function to get the user value of the key ($param).
function get_group($param = "")
{
return $this->group[$param];
} // function to get the group value of the key ($param).
function get_report($param = "")
{
return $this->report[$param];
} // function to get the report value of the key ($param).
function get_others($param = "")
{
return $this->others[$param];
} // function to get the help value of the key ($param).
function get_post_files($param = "")
{
return $this->post_files[$param];
} // function to get the post_files value of the key ($param).
function get_post_var($param = "")
{
return $this->post_var[$param];
} // function to get the post_var value of the key ($param).
function get_session($param = "")
{
return $this->session[$param];
} // function to get the session value of the key ($param).
function get_cookies($param = "")
{
return $this->cookies[$param];
} // function to get the cookies value of the key ($param).
function get_imap($param = "")
{
return $this->imap[$param];
} // function to get the imap value of the key ($param).
function get_email($param = "")
{
return $this->email[$param];
} // function to get the email value of the key ($param).
function get_notify($param = "")
{
return $this->notify[$param];
} // function to get the email value of the key ($param).
function get_event($param = "")
{
return $this->event[$param];
} // function to get the event value of the key ($param).
function get_prints($param = "")
{
return $this->prints[$param];
} // function to get the event value of the key ($param).
function get_action($param = "")
{
return $this->action[$param];
} // function to get the action value of the key ($param).
function get_module($param = "")
{
return $this->module[$param];
} // function to get the module value of the key ($param).
function get_alink($param = "")
{
return $this->alink[$param];
} // function to get the alink value of the key ($param).
function get_ahref($param = "")
{
return $this->ahref[$param];
} // function to get the ahref value of the key ($param).
/*==================*/
/*==================*/
/*====== SET =======*/
/*==================*/
/*==================*/
function set_config($param, $value = "")
{
return ($this->config[$param]=$value);
} // function to set $this->config[$param] with the value ($value).
function set_themes($param, $value = "")
{
return ($this->themes[$param]=$value);
} // function to set $this->themes[$param] with the value ($value).
function set_page($param, $value = "")
{
return ($this->page[$param]=$value);
} // function to set $this->page[$param] with the value ($value).
function set_language($param, $value = "")
{
return ($this->language[$param]=$value);
} // function to set $this->language[$param] with the value ($value).
function set_help($param, $value = "")
{
return ($this->help[$param]=$value);
} // function to set $this->help[$param] with the value ($value).
function set_label($param, $value = "")
{
return ($this->label[$param]=$value);
} // function to set $this->label[$param] with the value ($value).
function set_buffer($param, $value = "")
{
return ($this->buffer[$param]=$value);
} // function to set $this->buffer html content
function set_db_connection($value = "")
{
return ($this->db_connection=$value);
} // function to set $this->database connection
function set_db($param, $value = "")
{
return ($this->db[$param]=$value);
} // function to set $this->db[$param] with the value ($value).
function set_user($param, $value = "")
{
return ($this->user[$param]=$value);
} // function to set $this->user[$param] with the value ($value).
function set_group($param, $value = "")
{
return ($this->group[$param]=$value);
} // function to set $this->group[$param] with the value ($value).
function set_report($param, $value = "")
{
return ($this->report[$param]=$value);
} // function to set $this->report[$param] with the value ($value).
function set_others($param, $value = "")
{
return ($this->others[$param]=$value);
} // function to set $this-others[$param] with the value ($value).
function set_post_files($param, $value = "")
{
return ($this->post_files[$param]=$value);
} // function to set $this->post_files[$param] with the value ($value).
function set_post_var($param, $value = "")
{
return ($this->post_var[$param]=$value);
} // function to set $this->post_var[$param] with the value ($value).
function set_session($param, $value = "")
{
return ($this->session[$param]=$value);
} // function to set $this->session[$param] with the value ($value).
function set_cookies($param, $value = "")
{
return ($this->cookies[$param]=$value);
} // function to set $this->cookies[$param] with the value ($value).
function set_imap($param, $value = "")
{
return ($this->imap[$param]=$value);
} // function to set $this->imap[$param] with the value ($value).
function set_email($param, $value = "")
{
return ($this->email[$param]=$value);
} // function to set $this->email[$param] with the value ($value).
function set_notify($param, $value = "")
{
return ($this->notify[$param]=$value);
} // function to set $this->email[$param] with the value ($value).
function set_event($param, $value = "")
{
return ($this->event[$param]=$value);
} // function to set $this->event[$param] with the value ($value).
function set_prints($param, $value = "")
{
return ($this->prints[$param]=$value);
} // function to set $this->event[$param] with the value ($value).
function set_action($param, $value = "")
{
return ($this->action[$param]=$value);
} // function to set $this->action[$param] with the value ($value).
function set_module($param, $value = "")
{
return ($this->module[$param]=$value);
} // function to set $this->module[$param] with the value ($value).
function set_alink($param, $value = "")
{
return ($this->alink[$param]=$value);
} // function to set $this->alink[$param] with the value ($value).
function set_ahref($param, $value = "")
{
return ($this->ahref[$param]=$value);
} // function to set $this->ahref[$param] with the value ($value).
/*==================*/
/*==================*/
/*==================*/
//00000000000000000000000000
function show()
{
cmr_print_r(get_declared_classes());
cmr_print_r(get_object_vars('camaroes'));
cmr_print_r(get_class_methods('camaroes'));
$this->debug_print();
return true;
}
//00000000000000000000000000
}
//0000000000000000000000000000000000000000000000000000000000000000000000000000
//000000000000000000000000000 End 000000000000000000000000000000
//0000000000000000000000000000000000000000000000000000000000000000000000000000
?>