Guest User

Untitled

a guest
Oct 13th, 2016
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.12 KB | None | 0 0
  1. <?php
  2. /**
  3. *
  4. * @ This file is created by deZender.Net
  5. * @ deZender (PHP5 Decoder for Zend Encoder/SafeGuard & PhpExpress)
  6. *
  7. * @ Version : 2.0.0.4
  8. * @ Author : DeZender
  9. * @ Release on : 21.10.2015
  10. * @ Official site : http://DeZender.Net
  11. *
  12. */
  13.  
  14. class Util {
  15.  
  16.  
  17. public $timeparts = null;
  18. public $starttime = null;
  19.  
  20. public static function replace_constant($text = null) {
  21. $procesados = array();
  22. $patron_constante = "@;([A-Za-z_0-9 ]+);@";
  23. $l_tmp = "";
  24. $ret = preg_match_all($patron_constante, $text, $out);
  25. if ($ret < 1) {
  26. return $text;
  27. }
  28. $l_array = &$out[1];
  29. $l_cnt = count($l_array);
  30. $l_i = 0;
  31. for (/**/; $l_i < $l_cnt; ++$l_i) {
  32. if (in_array($l_array[$l_i], $procesados)) {
  33. continue;
  34. }
  35. if (defined($l_array[$l_i])) {
  36. $text = str_replace("@;" . $l_array[$l_i] . ";@", constant($l_array[$l_i]), $text);
  37. }
  38. $procesados[] = $l_array[$l_i];
  39. continue;
  40. }
  41. return $text;
  42. }
  43.  
  44. public static function replace_constant_PABORRAR($text = null) {
  45. if (trim($text) == "") {
  46. return $text;
  47. }
  48. $guindando_local = 0;
  49. $guindando_global = 0;
  50. $patron_constante = "(@;[A-Za-z_0-9 ]*;@)";
  51. $patron_contenido = "/@;([A-Za-z_0-9]*);@/";
  52. $l_tmp = "";
  53. $ret = preg_match_all($patron_constante, $text, $out);
  54. while (0 < $ret) {
  55. foreach ($out[0] as $l_const) {
  56. if (preg_match($patron_contenido, $l_const, $out2)) {
  57. if (defined($out2[1])) {
  58. $text = Util::replace($text, $out2[0], constant($out2[1]));
  59. }
  60. else {
  61. $guindando_local = 1;
  62. $guindando_global = 1;
  63. $l_tmp = Util::replace($l_const, "@;", "@_;");
  64. $l_tmp = Util::replace($l_tmp, ";@", ";_@");
  65. }
  66. }
  67. else {
  68. $guindando_local = 1;
  69. $guindando_global = 1;
  70. $l_tmp = Util::replace($l_const, "@;", "@_;");
  71. $l_tmp = Util::replace($l_tmp, ";@", ";_@");
  72. }
  73. if (!$guindando_local == 1) {
  74. continue;
  75. }
  76. $text = Util::replace($text, $l_const, $l_tmp);
  77. $guindando_local = 0;
  78. continue;
  79. }
  80. unset($out);
  81. $ret = preg_match_all($patron_constante, $text, $out);
  82. continue;
  83. }
  84. if ($guindando_global == 1) {
  85. $text = Util::replace($text, "@_;", "@;");
  86. $text = Util::replace($text, ";_@", ";@");
  87. }
  88. return $text;
  89. }
  90.  
  91. public static function decode_return_xfmurl($text = null) {
  92. if (strlen($text) == 0) {
  93. return $text;
  94. }
  95. $text = str_replace("_@_", " ", $text);
  96. $arr1 = split(" ", $text);
  97. $result = "";
  98. $tmp_hex = "";
  99. $tmp_ascii = "";
  100. $cnt = count($arr1);
  101. if ($cnt == 1) {
  102. $result = $arr1[0] . "();";
  103. }
  104. else {
  105. $result = $arr1[0] . "(";
  106. $i = 1;
  107. for (/**/; $i < $cnt; ++$i) {
  108. if ($i == 1) {
  109. $result = $result . "'" . $arr1[$i] . "'";
  110. continue;
  111. }
  112. $result = $result . ",'" . $arr1[$i] . "'";
  113. continue;
  114. }
  115. $result .= ");";
  116. }
  117. $pos = strpos($result, "\\u");
  118. $pos2 = 0;
  119. if ($pos === false) {
  120. $pos2 = -1;
  121. }
  122. else {
  123. $pos2 = $pos;
  124. }
  125. while (0 <= $pos2) {
  126. $tmp_hex = substr($result, $pos - 1, 7);
  127. $tmp_ascii = chr((string)hexdec($tmp_hex));
  128. $result = str_replace($tmp_hex, $tmp_ascii, $result);
  129. $pos = strpos($result, "\\u");
  130. if ($pos === false) {
  131. $pos2 = -1;
  132. continue;
  133. }
  134. $pos2 = $pos;
  135. continue;
  136. }
  137. return $result;
  138. }
  139.  
  140. public static function replace($text = null, $from = null, $to = null) {
  141. return str_replace($from, $to, $text);
  142. }
  143.  
  144. public static function SQLReplace($text = null, $from = null, $to = null) {
  145. $tmpTo = trim($to);
  146. $l_formato = array("string", "number", "date", "datetime", "datetimebegin", "datetimeend", "like", "rlike", "llike", "flike");
  147. $l_posIni = strpos($from, "[");
  148. if ($l_posIni === false) {
  149. if ($tmpTo == "") {
  150. $text = Util::replace($text, "@" . $from . "@", "null");
  151. return $text;
  152. }
  153. $text = Util::replace($text, "@" . $from . "@", (string)$to);
  154. return $text;
  155. }
  156. $l_value = "";
  157. $l_tmpFrom = substr($from, 0, $l_posIni);
  158. $l_tmp = substr($from, $l_posIni + 1, strlen($from) - $l_posIni - 2);
  159. $l_posIni = strpos($l_tmp, ":");
  160. if ($l_posIni === false) {
  161. if (in_array(strtolower($l_tmp), $l_formato)) {
  162. $to = Util::sqlreplaceext($to, strtolower($l_tmp));
  163. $text = Util::replace($text, "@" . $l_tmpFrom . "@", $to);
  164. return $text;
  165. }
  166. if ($tmpTo == "") {
  167. $text = Util::replace($text, "@" . $l_tmpFrom . "@", $l_tmp);
  168. return $text;
  169. }
  170. $text = Util::replace($text, "@" . $l_tmpFrom . "@", $to);
  171. return $text;
  172. }
  173. $l_tmp2 = substr($l_tmp, 0, $l_posIni);
  174. if (in_array(strtolower($l_tmp2), $l_formato)) {
  175. $to = Util::sqlreplaceext($to, strtolower($l_tmp2), substr($l_tmp, $l_posIni + 1));
  176. $text = Util::replace($text, "@" . $l_tmpFrom . "@", $to);
  177. return $text;
  178. }
  179. if ($tmpTo == "") {
  180. $text = Util::replace($text, "@" . $l_tmpFrom . "@", $l_tmp);
  181. return $text;
  182. }
  183. $text = Util::replace($text, "@" . $l_tmpFrom . "@", $to);
  184. return $text;
  185. }
  186.  
  187. public static function SQLReplaceExt($to = null, $format = null, $nullValue = null) {
  188. $l_tmp = "";
  189. $l_tmp2 = "";
  190. if (trim($to) == "") {
  191. return $nullValue;
  192. }
  193. switch (strtolower($format)) {
  194. case "string": {
  195. return "'" . $to . "'";
  196. }
  197. case "like": {
  198. return "'%" . $to . "%'";
  199. }
  200. case "rlike": {
  201. return "'" . $to . "%'";
  202. }
  203. case "llike": {
  204. return "'%" . $to . "'";
  205. }
  206. case "flike": {
  207. $l_tmp = preg_replace("/\\s+/", "%", $to);
  208. return "'%" . $l_tmp . "%'";
  209. }
  210. case "number": {
  211. return str_replace(",", ".", str_replace(".", "", $to));
  212. }
  213. case "date": {
  214. $l_tmp = $to;
  215. $l_tmp2 = "";
  216. $l_pos = strpos($l_tmp, " ");
  217. if ($l_pos !== false) {
  218. $l_tmp = substr($l_tmp, 0, $l_pos);
  219. }
  220. return "'" . Util::dbdate($l_tmp) . "'";
  221. }
  222. case "datetime": {
  223. $l_tmp = $to;
  224. $l_tmp2 = "";
  225. $l_pos = strpos($l_tmp, " ");
  226. if ($l_pos !== false) {
  227. $l_tmp2 = substr($l_tmp, $l_pos);
  228. ...............................................................................................
  229. .......................................................................
  230. .....................
Advertisement
Add Comment
Please, Sign In to add comment