Advertisement
Guest User

Untitled

a guest
Mar 20th, 2017
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.81 KB | None | 0 0
  1. <?php
  2.  
  3. class skytemplate_withdaddy {
  4.  
  5.  
  6. var $tplRoot;
  7. var $webRoot;
  8. var $debug;
  9. var $tplRewrite;
  10. var $preFilter;
  11. var $postFilter;
  12. var $version;
  13. var $timeOffset;
  14. var $File;
  15. var $Src;
  16. var $Code;
  17. var $Target;
  18.  
  19. public function skytemplate_withdaddy($obj = null) {
  20. $this->tplRoot = $Template_Config["Config"]["tplRoot"];
  21. $this->webRoot = $Template_Config["Config"]["webRoot"];
  22. $this->debug = $Template_Config["Config"]["debug"];
  23. if ($obj) {
  24. $this->setinfo($obj);
  25. }
  26. return;
  27. }
  28.  
  29. public function setinfo($obj) {
  30. if (is_object($obj)) {
  31. $this->tplRoot = $obj->tplRoot;
  32. $this->webRoot = $obj->webRoot;
  33. $this->debug = $obj->debug;
  34. $this->tplRewrite = $obj->tplRewrite;
  35. $this->preFilter = $obj->preFilter;
  36. $this->postFilter = $obj->postFilter;
  37. $this->version = $obj->version;
  38. $this->timeOffset = $obj->timeOffset;
  39. }
  40. else {
  41. $this->error("setInfo : No SkyTemplate Object!!", true);
  42. exit();
  43. }
  44. if (!is_dir($this->tplRoot) || $this->makedir($dir)) {
  45. $this->error("setInfo : Directory Not Exists! (" . $dir . ")", true);
  46. exit();
  47. }
  48. return;
  49. }
  50.  
  51. public function compile($var, $file, $cfile) {
  52. if ($this->File[$var]) {
  53. return true;
  54. }
  55. if ($fp = fopen($file, "r")) {
  56. $this->Src[$var] = "";
  57. $this->Src[$var] .= fread($fp, 100000);
  58. if (!feof($fp)) {
  59. continue;
  60. }
  61. fclose($fp);
  62. if ($Template_Config["SourceCheck"]["use"] === true || 0 < sizeof($Template_Config["SourceCheck"]["filter"])) {
  63. foreach ($Template_Config["SourceCheck"]["filter"] as $filter => $changeText) {
  64. if (!strpos($this->Src[$var], $filter) !== false) {
  65. continue;
  66. }
  67. $this->Src[$var] = str_replace($filter, $changeText, $this->Src[$var]);
  68. if (!$Template_Config["SourceCheck"]["log_use"] === true) {
  69. continue;
  70. }
  71. $HackOption = $Template_Config["HackCheckLog"];
  72. $HackOption["log_type"] = $Template_Config["SourceCheck"]["log_type"];
  73. hack_check_log($HackOption);
  74. continue;
  75. }
  76. }
  77. $this->File[$var] = $file;
  78. $this->Target[$var] = $cfile;
  79. if ($this->preFilter) {
  80. $this->filter($var, "pre");
  81. }
  82. if ($this->tplRewrite) {
  83. $this->tplrewrite($var);
  84. }
  85. $this->comment($var);
  86. $this->parse($var);
  87. if ($this->postFilter) {
  88. $this->filter($var, "post");
  89. }
  90. return $this->save($var, filemtime($file) + $this->timeOffset);
  91. }
  92. return $this->error("compile : File Not Exists! (" . $file . ")", true);
  93. }
  94.  
  95. public function filter($var, $mode) {
  96. static $filters;
  97. static $filterList;
  98. if (!is_array($filters)) {
  99. $filters = parse_ini_file(dirname("/var/www/html/decoding/fc7/60b/fc760bb2a7d04f61acc9615ffc045e72-22209.txt") . "/SkyTpl/plugin.ini.masterFilter.php", false);
  100. $filters["pre"] .= trim($this->preFilter);
  101. $filters["post"] .= trim($this->postFilter);
  102. }
  103. if ($filterList[$mode]) {
  104. foreach ($filterList[$mode] as $func => $args) {
  105. $args[1] = $var;
  106. call_user_func_array($func, $args);
  107. continue;
  108. }
  109. return;
  110. }
  111. $tmp1 = $this->parsequote(trim($filters[$mode]), false, false);
  112. $tmp = array();
  113. $z = 0;
  114. $i = 0;
  115. $c1 = count($tmp1);
  116. for (/**/; $i < $c1; $i += 2) {
  117. $tmp2 = preg_split("/([,\\(\\);])/i", $tmp1[$i], -1, PREG_SPLIT_DELIM_CAPTURE);
  118. $j = 0;
  119. $c2 = count($tmp2);
  120. for (/**/; $j < $c2; ++$j) {
  121. $tmp2[$j] = trim($tmp2[$j]);
  122. if (!$tmp2[$j] != "") {
  123. continue;
  124. }
  125. if ($tmp2[$j] == ";") {
  126. ++$z;
  127. continue;
  128. }
  129. $this[$tmp[$z]] = $tmp2[$j];
  130. continue;
  131. }
  132. !isset($tmp1[$i + 1]) ? true : null {
  133. continue;
  134. }
  135. $this[$tmp[$z]] = $tmp1[$i + 1];
  136. continue;
  137. }
  138. $filterList[$mode] = array();
  139. $i = 0;
  140. .........................................................................
  141. ...............................
  142. .......
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement