author | Dan |
Fri, 15 May 2009 17:24:12 -0400 | |
changeset 987 | b13a42ebaefb |
parent 784 | 72df14a56a03 |
permissions | -rw-r--r-- |
784
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
1 |
<?php |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
2 |
/** |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
3 |
* general.php |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
4 |
* |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
5 |
* @package MCManager.includes |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
6 |
* @author Moxiecode |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
7 |
* @copyright Copyright © 2007, Moxiecode Systems AB, All rights reserved. |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
8 |
*/ |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
9 |
|
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
10 |
@error_reporting(E_ALL ^ E_NOTICE); |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
11 |
$config = array(); |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
12 |
|
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
13 |
require_once(dirname(__FILE__) . "/../classes/utils/Logger.php"); |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
14 |
require_once(dirname(__FILE__) . "/../classes/utils/JSON.php"); |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
15 |
require_once(dirname(__FILE__) . "/../config.php"); |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
16 |
require_once(dirname(__FILE__) . "/../classes/SpellChecker.php"); |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
17 |
|
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
18 |
if (isset($config['general.engine'])) |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
19 |
require_once(dirname(__FILE__) . "/../classes/" . $config["general.engine"] . ".php"); |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
20 |
|
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
21 |
/** |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
22 |
* Returns an request value by name without magic quoting. |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
23 |
* |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
24 |
* @param String $name Name of parameter to get. |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
25 |
* @param String $default_value Default value to return if value not found. |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
26 |
* @return String request value by name without magic quoting or default value. |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
27 |
*/ |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
28 |
function getRequestParam($name, $default_value = false, $sanitize = false) { |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
29 |
if (!isset($_REQUEST[$name])) |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
30 |
return $default_value; |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
31 |
|
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
32 |
if (is_array($_REQUEST[$name])) { |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
33 |
$newarray = array(); |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
34 |
|
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
35 |
foreach ($_REQUEST[$name] as $name => $value) |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
36 |
$newarray[formatParam($name, $sanitize)] = formatParam($value, $sanitize); |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
37 |
|
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
38 |
return $newarray; |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
39 |
} |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
40 |
|
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
41 |
return formatParam($_REQUEST[$name], $sanitize); |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
42 |
} |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
43 |
|
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
44 |
function &getLogger() { |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
45 |
global $mcLogger, $man; |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
46 |
|
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
47 |
if (isset($man)) |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
48 |
$mcLogger = $man->getLogger(); |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
49 |
|
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
50 |
if (!$mcLogger) { |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
51 |
$mcLogger = new Moxiecode_Logger(); |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
52 |
|
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
53 |
// Set logger options |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
54 |
$mcLogger->setPath(dirname(__FILE__) . "/../logs"); |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
55 |
$mcLogger->setMaxSize("100kb"); |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
56 |
$mcLogger->setMaxFiles("10"); |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
57 |
$mcLogger->setFormat("{time} - {message}"); |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
58 |
} |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
59 |
|
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
60 |
return $mcLogger; |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
61 |
} |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
62 |
|
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
63 |
function debug($msg) { |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
64 |
$args = func_get_args(); |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
65 |
|
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
66 |
$log = getLogger(); |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
67 |
$log->debug(implode(', ', $args)); |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
68 |
} |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
69 |
|
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
70 |
function info($msg) { |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
71 |
$args = func_get_args(); |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
72 |
|
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
73 |
$log = getLogger(); |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
74 |
$log->info(implode(', ', $args)); |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
75 |
} |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
76 |
|
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
77 |
function error($msg) { |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
78 |
$args = func_get_args(); |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
79 |
|
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
80 |
$log = getLogger(); |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
81 |
$log->error(implode(', ', $args)); |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
82 |
} |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
83 |
|
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
84 |
function warn($msg) { |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
85 |
$args = func_get_args(); |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
86 |
|
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
87 |
$log = getLogger(); |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
88 |
$log->warn(implode(', ', $args)); |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
89 |
} |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
90 |
|
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
91 |
function fatal($msg) { |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
92 |
$args = func_get_args(); |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
93 |
|
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
94 |
$log = getLogger(); |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
95 |
$log->fatal(implode(', ', $args)); |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
96 |
} |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
97 |
|
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
98 |
?> |