Advertisement
Guest User

Untitled

a guest
Jun 22nd, 2019
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.23 KB | None | 0 0
  1. <?php
  2. /**
  3. *
  4. * @ This file is created by http://DeZender.Net
  5. * @ deZender (PHP7 Decoder for ionCube Encoder)
  6. *
  7. * @ Version : 4.0.8.9
  8. * @ Author : DeZender
  9. * @ Release on : 10.05.2019
  10. * @ Official site : http://DeZender.Net
  11. *
  12. */
  13.  
  14. class JieqiObject
  15. {
  16. public $vars = [];
  17. public $errors = [];
  18.  
  19. public function __construct()
  20. {
  21. }
  22.  
  23. static public function getInstance($classname = '', $valarray = '')
  24. {
  25. static $instance = null;
  26.  
  27. if (is_null($instance)) {
  28. if (empty($classname)) {
  29. $classname = get_called_class();
  30. }
  31.  
  32. if (class_exists($classname)) {
  33. if ($valarray == '') {
  34. $instance = new $classname();
  35. }
  36. else {
  37. $instance = new $classname($valarray);
  38. }
  39. }
  40. else {
  41. return false;
  42. }
  43. }
  44.  
  45. return $instance;
  46. }
  47.  
  48. public function getVar($key, $format = 's')
  49. {
  50. if (isset($this->vars[$key])) {
  51. if (is_string($this->vars[$key])) {
  52. switch (strtolower($format)) {
  53. case 's':
  54. return jieqi_htmlstr($this->vars[$key]);
  55. case 'e':
  56. return jieqi_htmlchars($this->vars[$key], ENT_QUOTES);
  57. case 'q':
  58. return jieqi_dbslashes($this->vars[$key]);
  59. case 'n':
  60. }
  61.  
  62. return $this->vars[$key];
  63. }
  64. else {
  65. return $this->vars[$key];
  66. }
  67. }
  68. else {
  69. return false;
  70. }
  71. }
  72.  
  73. public function getVars()
  74. {
  75. return $this->vars;
  76. }
  77.  
  78. public function setVar($key, $value)
  79. {
  80. $this->vars[$key] = $value;
  81. }
  82.  
  83. public function setVars($var_arr)
  84. {
  85. foreach ($var_arr as $key => $value) {
  86. $this->setVar($key, $value);
  87. }
  88. }
  89.  
  90. public function clearVars()
  91. {
  92. $this->vars = [];
  93. }
  94.  
  95. public function raiseError($message = 'unknown error!', $mode = JIEQI_ERROR_DIE)
  96. {
  97. switch ($mode) {
  98. case JIEQI_ERROR_DIE:
  99. jieqi_printfail($message);
  100. break;
  101. case JIEQI_ERROR_RETURN:
  102. case JIEQI_ERROR_PRINT:
  103. $this->errors[$mode][] = $message;
  104. break;
  105. default:
  106. $this->errors[JIEQI_ERROR_RETURN][] = $message;
  107. break;
  108. }
  109. }
  110.  
  111. public function isError($mode = 0)
  112. {
  113. if (($mode == 0) || (strlen($mode) == 0)) {
  114. return count($this->errors);
  115. }
  116. else {
  117. return jieqi_count($this->errors[$mode]);
  118. }
  119. }
  120.  
  121. public function getErrors($mode = 0)
  122. {
  123. if (($mode == 0) || (strlen($mode) == 0)) {
  124. return $this->errors;
  125. }
  126.  
  127. return $this->errors[$mode];
  128. }
  129.  
  130. public function clearErrors($mode = 0)
  131. {
  132. if (($mode == 0) || (strlen($mode) == 0)) {
  133. $this->errors = [];
  134. }
  135. else {
  136. $this->errors[$mode] = [];
  137. }
  138. }
  139. }
  140.  
  141. class JieqiBlock extends JieqiObject
  142. {
  143. public $blockvars = [];
  144. public $module = '';
  145. public $template = '';
  146. public $cachetype = 0;
  147. public $cachetime = JIEQI_CACHE_LIFETIME;
  148. public $vars = [];
  149. public $errors = [];
  150.  
  151. public function __construct(&$vars)
  152. {
  153. global $jieqiTpl;
  154. $this->blockvars = $vars;
  155.  
  156. if (empty($this->module)) {
  157. $this->module = (empty($this->blockvars['module']) ? 'system' : $this->blockvars['module']);
  158. }
  159.  
  160. if (empty($this->blockvars['template'])) {
  161. $this->blockvars['template'] = $this->template;
  162. }
  163.  
  164. if (!empty($this->blockvars['template'])) {
  165. $this->blockvars['tlpfile'] = jieqi_path_template('blocks/' . $this->blockvars['template'], $this->module);
  166. }
  167. else {
  168. $this->blockvars['tlpfile'] = '';
  169. }
  170.  
  171. if ($this->blockvars['template'] == '-') {
  172. $this->cachetype = 1;
  173. }
  174.  
  175. if ($this->cachetime == 0) {
  176. $this->cachetime = JIEQI_CACHE_LIFETIME;
  177. }
  178.  
  179. if (empty($this->blockvars['cachetime'])) {
  180. $this->blockvars['cachetime'] = $this->cachetime;
  181. }
  182.  
  183. if (empty($this->blockvars['overtime'])) {
  184. $this->blockvars['overtime'] = 0;
  185. }
  186.  
  187. if (empty($this->blockvars['cacheid'])) {
  188. $this->blockvars['cacheid'] = NULL;
  189. }
  190.  
  191. if (empty($this->blockvars['compileid'])) {
  192. $this->blockvars['compileid'] = NULL;
  193. }
  194.  
  195. if (!empty($this->blockvars['template'])) {
  196. $this->template = $this->blockvars['template'];
  197. }
  198. if (isset($this->blockvars['bid']) && !is_numeric($this->blockvars['bid'])) {
  199. $this->blockvars['bid'] = intval($this->blockvars['bid']);
  200. }
  201. if (!is_object($jieqiTpl) && !empty($this->blockvars['tlpfile'])) {
  202. $jieqiTpl = Container::get('template');
  203. }
  204.  
  205. $jieqiTpl->setCachType($this->cachetype);
  206. }
  207.  
  208. public function getTitle()
  209. {
  210. return isset($this->blockvars['title']) ? $this->blockvars['title'] : '';
  211. }
  212.  
  213. public function getContent()
  214. {
  215. global $jieqiApp;
  216.  
  217. if (JIEQI_USE_CACHE) {
  218. if ((0 < $this->blockvars['custom']) && !empty($this->blockvars['bid'])) {
  219. $templatefile = jieqi_path_template('blocks/block_custom' . $this->blockvars['bid'] . '.html', $this->module);
  220. $cachefile = str_replace(JIEQI_ROOT_PATH, JIEQI_CACHE_PATH, $templatefile);
  221.  
  222. if ($jieqiApp['cache']->iscached($cachefile)) {
  223. return $jieqiApp['cache']->get($cachefile);
  224. }
  225. }
  226. else if (!empty($this->blockvars['tlpfile']) && (0 < $this->blockvars['cachetime']) && $jieqiApp['template']->is_cached($this->blockvars['tlpfile'], $this->blockvars['cacheid'], $this->blockvars['compileid'], $this->blockvars['cachetime'], $this->blockvars['overtime'])) {
  227. $jieqiApp['template']->setCaching(1);
  228. $jieqiApp['template']->setCachType($this->cachetype);
  229. return $jieqiApp['template']->fetch($this->blockvars['tlpfile'], $this->blockvars['cacheid'], $this->blockvars['compileid'], $this->blockvars['cachetime'], $this->blockvars['overtime'], false);
  230. }
  231. }
  232.  
  233. return $this->updateContent(true);
  234. }
  235.  
  236. public function updateContent($isreturn = false)
  237. {
  238. global $jieqiApp;
  239. $this->setContent();
  240.  
  241. if (!empty($this->blockvars['tlpfile'])) {
  242. if (JIEQI_USE_CACHE && (0 < $this->blockvars['cachetime'])) {
  243. $jieqiApp['template']->setCaching(2);
  244. $jieqiApp['template']->setCachType($this->cachetype);
  245. }
  246. else {
  247. $jieqiApp['template']->setCaching(0);
  248. }
  249.  
  250. $tmpvar = $jieqiApp['template']->fetch($this->blockvars['tlpfile'], $this->blockvars['cacheid'], $this->blockvars['compileid'], $this->blockvars['cachetime'], $this->blockvars['overtime'], false);
  251.  
  252. if ($isreturn) {
  253. return $tmpvar;
  254. }
  255. }
  256. }
  257.  
  258. public function setContent($isreturn = false)
  259. {
  260. }
  261.  
  262. static public function getInstance($classname = '', $valarray = '')
  263. {
  264. static $instance = null;
  265.  
  266. if (is_null($instance)) {
  267. if (empty($classname)) {
  268. $classname = get_called_class();
  269. }
  270.  
  271. if (class_exists($classname)) {
  272. if ($valarray == '') {
  273. $instance = new $classname();
  274. }
  275. else {
  276. $instance = new $classname($valarray);
  277. }
  278. }
  279. else {
  280. return false;
  281. }
  282. }
  283.  
  284. return $instance;
  285. }
  286.  
  287. public function getVar($key, $format = 's')
  288. {
  289. if (isset($this->vars[$key])) {
  290. if (is_string($this->vars[$key])) {
  291. switch (strtolower($format)) {
  292. case 's':
  293. return jieqi_htmlstr($this->vars[$key]);
  294. case 'e':
  295. return jieqi_htmlchars($this->vars[$key], ENT_QUOTES);
  296. case 'q':
  297. return jieqi_dbslashes($this->vars[$key]);
  298. case 'n':
  299. }
  300.  
  301. return $this->vars[$key];
  302. }
  303. else {
  304. return $this->vars[$key];
  305. }
  306. }
  307. else {
  308. return false;
  309. }
  310. }
  311.  
  312. public function getVars()
  313. {
  314. return $this->vars;
  315. ......................................................................
  316. ..............................................
  317. ....................
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement