Initial import.
[siap.git] / _system / core / System.php
CommitLineData
696f20d5
MS
1<?
2class System {
3 function System() {
4 log_message("[system] é instanciado.");
5 }
6
7 function formatConfig() {
8 global $cfg;
9
10 $cfg["folder_manager"] = (isset($cfg["folder_manager"])) ? $cfg["folder_manager"] : "manager";
11
12 if (!array_key_exists("database_connect", $cfg)) {
13 $cfg["database_connect"] = true;
14 }
15
16 if (!array_key_exists("system_sitelink", $cfg)) {
17 $cfg["system_sitelink"] = "/";
18 }
19
20 if (!array_key_exists("root", $cfg)) {
21 $cfg["root"] = "http://" . $_SERVER['HTTP_HOST'] . "/";
22 }
23
24 if (!array_key_exists("develop", $cfg)) {
25 $cfg["develop"] = false;
26 }
27 }
28
29 function testServer($tmp_server) {
30 if (str_replace($tmp_server, "", $_SERVER['HTTP_HOST']) != $_SERVER['HTTP_HOST']) {
31 return true;
32 } else {
33 return false;
34 }
35 }
36
37 function isManager() {
38 global $cfg;
39
40 return ((strpos($_SERVER["PHP_SELF"], "anager")) || (strpos($_SERVER["PHP_SELF"], $cfg["folder_manager"])));
41 }
42
43 function getFaviconHeader($cfg_page = "") {
44 global $cfg;
45
46 $path = "";
47
48 $root = "../../";
49 if ($cfg_page == "login") {
50 $root = "../../../";
51 }
52
53 $path_default = $root . $cfg["folder_manager"] . "/img/favicon.ico";
54 $path_custom = $root . "_config/exeptions/favicon.ico";
55
56 if (file_exists($path_custom)) {
57 $path = $path_custom;
58 } elseif (file_exists($path_default)) {
59 $path = $path_default;
60 }
61
62 if ($path != "") {
63 echo "<link rel=\"shortcut icon\" href=\"" . $path . "\" type=\"image/x-icon\" />";
64 }
65 }
66}
67?>