Advertisement
Guest User

Untitled

a guest
Aug 5th, 2015
206
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.30 KB | None | 0 0
  1. <?php
  2. /**
  3. *
  4. * @ This file is created by deZender.Net
  5. * @ deZender (PHP5 Decoder for ionCube Loader)
  6. *
  7. * @ Version : 2.0.0.3
  8. * @ Author : DeZender
  9. * @ Release on : 06.05.2013
  10. * @ Official site : http://DeZender.Net
  11. *
  12. */
  13.  
  14. function config() {
  15. $args = func_get_args();
  16. foreach ($args as $arg) {
  17. if (file_exists(APP . "Config" . DS . $arg . ".php")) {
  18. include_once(APP . "Config" . DS . $arg . ".php");
  19. if (!(count($args) == 1)) {
  20. continue;
  21. }
  22. return true;
  23. }
  24. if (!(count($args) == 1)) {
  25. continue;
  26. }
  27. return false;
  28. }
  29. return true;
  30. }
  31.  
  32. function debug($var = false, $showHtml = null, $showFrom = true) {
  33. if (0 < Configure::read("debug")) {
  34. App::uses("Debugger", "Utility");
  35. $file = "";
  36. $line = "";
  37. $lineInfo = "";
  38. if ($showFrom) {
  39. $trace = Debugger::trace(array("start" => 1, "depth" => 2, "format" => "array"));
  40. $file = str_replace(array(CAKE_CORE_INCLUDE_PATH, ROOT), "", $trace[0]["file"]);
  41. $line = $trace[0]["line"];
  42. }
  43. $html = "<div class=\"cake-debug-output\">\x0d\x0a%s\x0d\x0a<pre class=\"cake-debug\">\x0d\x0a%s\x0d\x0a</pre>\x0d\x0a</div>";
  44. $text = "%s\x0d\x0a########## DEBUG ##########\x0d\x0a%s\x0d\x0a###########################";
  45. $template = $html;
  46. if (php_sapi_name() == "cli" || $showHtml === false) {
  47. $template = $text;
  48. if ($showFrom) {
  49. $lineInfo = sprintf("%s (line %s)", $file, $line);
  50. }
  51. }
  52. if ($showHtml === null && $template !== $text) {
  53. $showHtml = true;
  54. }
  55. $var = Debugger::exportVar($var, 25);
  56. if ($showHtml) {
  57. $template = $html;
  58. $var = h($var);
  59. if ($showFrom) {
  60. $lineInfo = sprintf("<span><strong>%s</strong> (line <strong>%s</strong>)</span>", $file, $line);
  61. }
  62. }
  63. printf($template, $lineInfo, $var);
  64. }
  65. }
  66.  
  67. function h($text, $double = true, $charset = null) {
  68. if (is_array($text)) {
  69. $texts = array();
  70. foreach ($text as $k => $t) {
  71. $texts[$k] = h($t, $double, $charset);
  72. }
  73. return $texts;
  74. }
  75. if (is_object($text)) {
  76. if (method_exists($text, "__toString")) {
  77. $text = (string)$text;
  78. }
  79. else {
  80. $text = "(object)" . get_class($text);
  81. }
  82. }
  83. static $defaultCharset;
  84. if ($defaultCharset === false) {
  85. $defaultCharset = Configure::read("App.encoding");
  86. if ($defaultCharset === null) {
  87. $defaultCharset = "UTF-8";
  88. }
  89. }
  90. if (is_string($double)) {
  91. $charset = $double;
  92. }
  93. return htmlspecialchars($text, ENT_QUOTES, $charset ? $charset : $defaultCharset, $double);
  94. }
  95.  
  96. function pluginSplit($name, $dotAppend = false, $plugin = null) {
  97. if (strpos($name, ".") !== false) {
  98. $parts = explode(".", $name, 2);
  99. if ($dotAppend) {
  100. $parts[0] .= ".";
  101. }
  102. return $parts;
  103. }
  104. return array($plugin, $name);
  105. }
  106.  
  107. function pr($var) {
  108. if (0 < Configure::read("debug")) {
  109. echo("<pre>");
  110. print_r($var);
  111. echo("</pre>");
  112. }
  113. }
  114.  
  115. function am() {
  116. $r = array();
  117. $args = func_get_args();
  118. foreach ($args as $a) {
  119. if (!(is_array($a))) {
  120. $a = array($a);
  121. }
  122. $r = array_merge($r, $a);
  123. }
  124. return $r;
  125. }
  126.  
  127. function env($key) {
  128. if ($key === "HTTPS") {
  129. if (isset($_SERVER["HTTPS"])) {
  130. return !(empty($_SERVER["HTTPS"])) && $_SERVER["HTTPS"] !== "off";
  131. }
  132. return strpos(env("SCRIPT_URI"), "https://") === 0;
  133. }
  134. if ($key === "SCRIPT_NAME") {
  135. if (env("CGI_MODE") && isset($_ENV["SCRIPT_URL"])) {
  136. $key = "SCRIPT_URL";
  137. }
  138. }
  139. $val = null;
  140. if (isset($_SERVER[$key])) {
  141. $val = $_SERVER[$key];
  142. }
  143. else {
  144. if (isset($_ENV[$key])) {
  145. $val = $_ENV[$key];
  146. }
  147. else {
  148. if (getenv($key) !== false) {
  149. $val = getenv($key);
  150. }
  151. }
  152. }
  153. if ($key === "REMOTE_ADDR" && $val === env("SERVER_ADDR")) {
  154. $addr = env("HTTP_PC_REMOTE_ADDR");
  155. if ($addr !== null) {
  156. $val = $addr;
  157. }
  158. }
  159. if ($val !== null) {
  160. return $val;
  161. }
  162. switch ($key) {
  163. case "SCRIPT_FILENAME":
  164. if (defined("SERVER_IIS") && SERVER_IIS === true) {
  165. return str_replace("\\\\", "\\", env("PATH_TRANSLATED"));
  166. }
  167. break;
  168.  
  169. case "DOCUMENT_ROOT":
  170. $name = env("SCRIPT_NAME");
  171. $filename = env("SCRIPT_FILENAME");
  172. $offset = 0;
  173. if (!(strpos($name, ".php"))) {
  174. $offset = 4;
  175. }
  176. return substr($filename, 0, 0 - (strlen($name) + $offset));
  177.  
  178. case "PHP_SELF":
  179. return str_replace(env("DOCUMENT_ROOT"), "", env("SCRIPT_FILENAME"));
  180.  
  181. case "CGI_MODE":
  182. return PHP_SAPI === "cgi";
  183.  
  184. case "HTTP_BASE":
  185. $host = env("HTTP_HOST");
  186. $parts = explode(".", $host);
  187. $count = count($parts);
  188. if ($count === 1) {
  189. return "." . $host;
  190. }
  191. if ($count === 2) {
  192. return "." . $host;
  193. }
  194. if ($count === 3) {
  195. $gTLD = array("aero", "asia", "biz", "cat", "com", "coop", "edu", "gov", "info", "int", "jobs", "mil", "mobi", "museum", "name", "net", "org", "pro", "tel", "travel", "xxx");
  196. if (in_array($parts[1], $gTLD)) {
  197. return "." . $host;
  198. }
  199. }
  200. array_shift($parts);
  201. return "." . implode(".", $parts);
  202.  
  203. }
  204. }
  205.  
  206. function cache($path, $data = null, $expires = "+1 day", $target = "cache") {
  207. if (Configure::read("Cache.disable")) {
  208. return null;
  209. }
  210. $now = time();
  211. if (!(is_numeric($expires))) {
  212. $expires = strtotime($expires, $now);
  213. }
  214. switch (strtolower($target)) {
  215. case "cache":
  216. $filename = CACHE . $path;
  217. ....................................................................
  218. .................................
  219. .............
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement