[go: up one dir, main page]

Menu

[c6da1b]: / camaroes_class.php  Maximize  Restore  History

Download this file

641 lines (579 with data), 21.9 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
<?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
?>