etc.php 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504
  1. <?php
  2. ////////////////////////////////////////////////////////////////////////////////
  3. // Copyright (C) ReloadCMS Development Team //
  4. // http://reloadcms.sf.net //
  5. // //
  6. // This program is distributed in the hope that it will be useful, //
  7. // but WITHOUT ANY WARRANTY, without even the implied warranty of //
  8. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. //
  9. // //
  10. // This product released under GNU General Public License v2 //
  11. ////////////////////////////////////////////////////////////////////////////////
  12. /**
  13. * Misc ReloadCMS packages
  14. *
  15. * @author DruidVAV
  16. * @package ReloadCMS
  17. */
  18. /**
  19. * Function recursively check if $needle is present in $haystack
  20. *
  21. * @param mixed $needle
  22. * @param array $haystack
  23. * @return boolean
  24. */
  25. function rcms_in_array_recursive($needle, $haystack) {
  26. foreach ($haystack as $value) {
  27. if (is_array($value))
  28. return rcms_in_array_recursive($needle, $value);
  29. else
  30. return in_array($needle, $haystack);
  31. }
  32. }
  33. function in_array_i($needle, $haystack) {
  34. $needle = strtolower(htmlentities($needle));
  35. if (!is_array($haystack))
  36. return false;
  37. foreach ($haystack as $value) {
  38. $value = strtolower(htmlentities($value));
  39. if ($needle == $value)
  40. return true;
  41. }
  42. return false;
  43. }
  44. function rcms_htmlspecialchars_recursive($array) {
  45. foreach ($array as $key => $value) {
  46. if (is_array($value))
  47. $array[$key] = rcms_htmlspecialchars_recursive($value);
  48. else
  49. $array[$key] = htmlspecialchars($value);
  50. }
  51. return $array;
  52. }
  53. /**
  54. * Recursively stripslashes array.
  55. *
  56. * @param array $array
  57. * @return boolean
  58. */
  59. function stripslash_array(&$array) {
  60. foreach ($array as $key => $value) {
  61. if (is_array($array[$key]))
  62. stripslash_array($array[$key]);
  63. else
  64. $array[$key] = stripslashes($value);
  65. }
  66. return true;
  67. }
  68. /**
  69. * Shows redirection javascript.
  70. *
  71. * @param string $url
  72. */
  73. function rcms_redirect($url, $header = false) {
  74. if ($header) {
  75. @header('Location: ' . $url);
  76. } else {
  77. print('<script language="javascript">document.location.href="' . $url . '";</script>');
  78. }
  79. }
  80. /**
  81. * Sends e-mail.
  82. *
  83. * @param string $to
  84. * @param string $from
  85. * @param string $sender
  86. * @param string $encoding
  87. * @param string $subj
  88. * @param string $text
  89. * @return boolean
  90. */
  91. function rcms_send_mail($to, $from, $sender, $encoding, $subj, $text) {
  92. $headers = 'From: ' . $sender . ' <' . $from . ">\n";
  93. $headers .= "MIME-Version: 1.0\n";
  94. $headers .= 'Message-ID: <' . md5(uniqid(time())) . "@" . $sender . ">\n";
  95. $headers .= 'Date: ' . gmdate('D, d M Y H:i:s T', time()) . "\n";
  96. $headers .= "Content-type: text/plain; charset={$encoding}\n";
  97. $headers .= "Content-transfer-encoding: 8bit\n";
  98. $headers .= "X-Mailer: ReloadCMS\n";
  99. $headers .= "X-MimeOLE: ReloadCMS\n";
  100. return mail($to, $subj, $text, $headers);
  101. }
  102. /**
  103. * Returns random string with selected length
  104. *
  105. * @param integer $num_chars
  106. * @return string
  107. */
  108. function rcms_random_string($num_chars) {
  109. $chars = array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '1', '2', '3', '4', '5', '6', '7', '8', '9');
  110. list($usec, $sec) = explode(' ', microtime());
  111. mt_srand($sec * $usec);
  112. $max_chars = sizeof($chars) - 1;
  113. $rand_str = '';
  114. for ($i = 0; $i < $num_chars; $i++) {
  115. $rand_str .= $chars[mt_rand(0, $max_chars)];
  116. }
  117. return $rand_str;
  118. }
  119. /**
  120. * Just returns current time
  121. *
  122. * @return integer
  123. */
  124. function rcms_get_time() {
  125. return mktime();
  126. }
  127. /**
  128. * Function that formats date. Similar to date() function but
  129. * uses timezone and returns localised string
  130. *
  131. * @param string $format
  132. * @param integer $gmepoch
  133. * @param integer $tz
  134. * @return string
  135. */
  136. function rcms_format_time($format, $gmepoch, $tz = '') {
  137. global $lang, $system;
  138. if (empty($tz))
  139. $tz = $system->user['tz'];
  140. if ($system->language != 'english') {
  141. @reset($lang['datetime']);
  142. while (list($match, $replace) = @each($lang['datetime'])) {
  143. $translate[$match] = $replace;
  144. }
  145. }
  146. return (!empty($translate) ) ? strtr(@gmdate($format, $gmepoch + (3600 * $tz)), $translate) : @gmdate($format, $gmepoch + (3600 * $tz));
  147. }
  148. /**
  149. * Return localised date from string generated by date()
  150. *
  151. * @param string $string
  152. * @return string
  153. */
  154. function rcms_date_localise($string) {
  155. global $lang, $system;
  156. $result = $string;
  157. if ($system->language != 'english') {
  158. foreach ($lang['datetime'] as $orig => $replace) {
  159. $result = str_replace($orig, $replace, $result);
  160. }
  161. }
  162. return($result);
  163. }
  164. function rcms_parse_text_by_mode($str, $mode) {
  165. switch ($mode) {
  166. default:
  167. case 'check':
  168. return rcms_parse_text($str, false, false, false, false, false, false);
  169. break;
  170. case 'text':
  171. return rcms_parse_text($str, true, false, true, false, true, true);
  172. break;
  173. case 'text-safe':
  174. return rcms_parse_text($str, true, false, true, false, false, false);
  175. break;
  176. case 'html':
  177. return rcms_parse_text($str, false, true, false, false, true, true);
  178. break;
  179. case 'htmlbb':
  180. return rcms_parse_text($str, true, true, false, false, true, true);
  181. break;
  182. }
  183. }
  184. /**
  185. * Just a stub for backward compatibility.
  186. *
  187. * @param string $str
  188. * @param boolean $bbcode
  189. * @param boolean $html
  190. * @param boolean $nl2br
  191. * @param boolean $wordwrap
  192. * @param boolean $imgbbcode
  193. * @return string
  194. */
  195. function rcms_parse_text($str, $bbcode = true, $html = false, $nl2br = true, $wordwrap = false, $imgbbcode = false, $htmlbbcode = false) {
  196. $level = intval($bbcode);
  197. if ($imgbbcode && $bbcode && $level < 2)
  198. $level = 2;
  199. if ($htmlbbcode && $bbcode && $level < 3)
  200. $level = 3;
  201. $message = new message($str, $level, $html, $nl2br);
  202. $message->init_bbcodes();
  203. $message->parse();
  204. if ($wordwrap) {
  205. return '<div style="overflow: auto;">' . $message->str . '</div>';
  206. } else {
  207. return $message->str;
  208. }
  209. }
  210. /**
  211. * Validates e-mail
  212. *
  213. * @param string $text
  214. * @return boolean
  215. */
  216. function rcms_is_valid_email($text) {
  217. if (preg_match('/^(?!(?:(?:\x22?\x5C[\x00-\x7E]\x22?)|(?:\x22?[^\x5C\x22]\x22?)){255,})(?!(?:(?:\x22?\x5C[\x00-\x7E]\x22?)|(?:\x22?[^\x5C\x22]\x22?)){65,}@)(?:(?:[\x21\x23-\x27\x2A\x2B\x2D\x2F-\x39\x3D\x3F\x5E-\x7E]+)|(?:\x22(?:[\x01-\x08\x0B\x0C\x0E-\x1F\x21\x23-\x5B\x5D-\x7F]|(?:\x5C[\x00-\x7F]))*\x22))(?:\.(?:(?:[\x21\x23-\x27\x2A\x2B\x2D\x2F-\x39\x3D\x3F\x5E-\x7E]+)|(?:\x22(?:[\x01-\x08\x0B\x0C\x0E-\x1F\x21\x23-\x5B\x5D-\x7F]|(?:\x5C[\x00-\x7F]))*\x22)))*@(?:(?:(?!.*[^.]{64,})(?:(?:(?:xn--)?[a-z0-9]+(?:-[a-z0-9]+)*\.){1,126}){1,}(?:(?:[a-z][a-z0-9]*)|(?:(?:xn--)[a-z0-9]+))(?:-[a-z0-9]+)*)|(?:\[(?:(?:IPv6:(?:(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){7})|(?:(?!(?:.*[a-f0-9][:\]]){7,})(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,5})?::(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,5})?)))|(?:(?:IPv6:(?:(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){5}:)|(?:(?!(?:.*[a-f0-9]:){5,})(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,3})?::(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,3}:)?)))?(?:(?:25[0-5])|(?:2[0-4][0-9])|(?:1[0-9]{2})|(?:[1-9]?[0-9]))(?:\.(?:(?:25[0-5])|(?:2[0-4][0-9])|(?:1[0-9]{2})|(?:[1-9]?[0-9]))){3}))\]))$/iD', $text))
  218. return true;
  219. else
  220. return false;
  221. }
  222. /**
  223. * Returns bbcode panel code for selected textarea
  224. *
  225. * @param string $textarea
  226. * @return string
  227. */
  228. function rcms_show_bbcode_panel($textarea) {
  229. return rcms_parse_module_template('bbcodes-panel.tpl', array('textarea' => $textarea));
  230. }
  231. function get_animated_to_array() {
  232. $arr = rcms_scandir(SMILES_PATH);
  233. $arr2 = array();
  234. foreach ($arr as $key) {
  235. if (file_exists(SMILES_PATH . basename($key, ".gif") . ".gif")) {
  236. $arr2['#\[' . basename($key, ".gif") . '\]#is'] = '<img src="' . SMILES_PATH . $key . '" alt = "' . basename($key, ".gif") . '">';
  237. }
  238. }
  239. return $arr2;
  240. }
  241. function return_hidden_bb_text() {
  242. if (LOGGED_IN) {
  243. return '<div class="hidden">\\1</div>';
  244. } else {
  245. return '<div class="hidden">' . __('This block only for registered users') . '</div>';
  246. }
  247. }
  248. /**
  249. * Message parser class
  250. *
  251. * @package ReloadCMS
  252. */
  253. class message {
  254. /**
  255. * Message container
  256. *
  257. * @var string
  258. */
  259. var $str = '';
  260. /**
  261. * Level of bbcode security.
  262. *
  263. * @var integer
  264. */
  265. var $bbcode_level = 0; // 0 - no bbcode, 1 - save bbcodes, 2 - all bbcodes
  266. /**
  267. * Allow HTML in message
  268. *
  269. * @var boolean
  270. */
  271. var $html = false;
  272. /**
  273. * Perform nl2br in message
  274. *
  275. * @var boolean
  276. */
  277. var $nl2br = false;
  278. /**
  279. * Array of regexps for bbcodes
  280. *
  281. * @var array
  282. */
  283. var $regexp = array();
  284. var $sr_temp = array();
  285. /**
  286. * Class constructor
  287. *
  288. * @param string $message
  289. * @param integer $bbcode_level
  290. * @param boolean $html
  291. * @param boolean $nl2br
  292. * @return message
  293. */
  294. public function __construct($message, $bbcode_level = 0, $html = false, $nl2br = false) {
  295. $this->str = $message;
  296. $this->nl2br = $nl2br;
  297. $this->bbcode_level = $bbcode_level;
  298. $this->html = $html;
  299. }
  300. /**
  301. * BBCodes initialisation. Filling in message::regexp array
  302. *
  303. */
  304. function init_bbcodes() {
  305. $this->regexp[0] = array();
  306. $this->regexp[1] = array(
  307. "#\[b\](.*?)\[/b\]#is" => '<span style="font-weight: bold">\\1</span>',
  308. "#\[i\](.*?)\[/i\]#is" => '<span style="font-style: italic">\\1</span>',
  309. "#\[u\](.*?)\[/u\]#is" => '<span style="text-decoration: underline">\\1</span>',
  310. "#\[del\](.*?)\[/del\]#is" => '<span style="text-decoration: line-through">\\1</span>',
  311. "#\[url\][\s\n\r]*(((https?|ftp|ed2k|irc)://)[^ \"\n\r\t\<]*)[\s\n\r]*\[/url\]#is" => '<a href="\\1" target="_blank">\\1</a>',
  312. "#\[url\][\s\n\r]*(www\.[^ \"\n\r\t\<]*?)[\s\n\r]*\[/url\]#is" => '<a href="http://\\1" target="_blank">\\1</a>',
  313. "#\[url\][\s\n\r]*((ftp)\.[^ \"\n\r\t\<]*?)[\s\n\r]*\[/url\]#is" => '<a href="\\2://\\1" target="_blank">\\1</a>',
  314. "#\[url=(\"|&quot;|)(((https?|ftp|ed2k|irc)://)[^ \"\n\r\t\<]*?)(\"|&quot;|)\](.*?)\[/url\]#is" => '<a href="\\2" target="_blank">\\6</a>',
  315. "#\[url=(\"|&quot;|)(www\.[^ \"\n\r\t\<]*?)(\"|&quot;|)\](.*?)\[/url\]#is" => '<a href="http://\\2" target="_blank">\\4</a>',
  316. "#\[url=(\"|&quot;|)((ftp)\.[^ \"\n\r\t\<]*?)(\"|&quot;|)\](.*?)\[/url\]#is" => '<a href="\\3://\\2" target="_blank">\\5</a>',
  317. "#\[mailto\][\s\n\r]*([a-z0-9&\-_.]+?@[\w\-]+\.([\w\-\.]+\.)?[\w]+)[\s\n\r]*\[/mailto\]#is" => '<a href="mailto:\\1">\\1</a>',
  318. "#\[mailto=(\"|&quot;|)([a-z0-9&\-_.]+?@[\w\-]+\.([\w\-\.]+\.)?[\w]+)(\"|&quot;|)\](.*?)\[/mailto\]#is" => '<a href="mailto:\\2">\\5</a>',
  319. "#\[color=(\"|&quot;|)([\#\w]*)(\"|&quot;|)\](.*?)\[/color(.*?)\]#is" => '<span style="color:\\2">\\4</span>',
  320. "#\[size=(\"|&quot;|)([0-9]*)(\"|&quot;|)\](.*?)\[/size(.*?)\]#is" => '<span style="font-size: \\2pt">\\4</span>',
  321. "#\[align=(\"|&quot;|)(left|right|center|justify)(\"|&quot;|)\](.*?)\[/align(.*?)\]#is" => '<div style="text-align: \\2">\\4</span>',
  322. "#\[user\]([\d\w]*?)\[/user\]#is" => ' [ <a href="' . RCMS_ROOT_PATH . '?module=user.list&amp;user=\\1">\\1</a> ] ',
  323. "#\[user=([\d\w]*?)\](.*?)\[/user\]#is" => ' [ <a href="' . RCMS_ROOT_PATH . '?module=user.list&amp;user=\\1">\\2</a> ] ',
  324. "#\[hidden\](.*?)\[/hidden\]#is" => return_hidden_bb_text()
  325. );
  326. $this->regexp[1] = array_merge(get_animated_to_array(), $this->regexp[1]);
  327. $this->regexp[2] = array(
  328. "#[\s\n\r]*\[img\][\s\n\r]*([\w]+?://[^ \"\n\r\t<]*?)\.(gif|png|jpe?g)[\s\n\r]*\[/img\][\s\n\r]*#is" => '<br /><img src="\\1.\\2" alt="" /><br />',
  329. "#[\s\n\r]*\[img=(\"|&quot;|)(left|right)(\"|&quot;|)\][\s\n\r]*([\w]+?://[^ \"\n\r\t<]*?)\.(gif|png|jpe?g)[\s\n\r]*\[/img\][\s\n\r]*#is" => '<img src="\\4.\\5" alt="" align="\\2" />',
  330. );
  331. }
  332. /**
  333. * Main parse method. Parses message::str
  334. *
  335. */
  336. function parse() {
  337. $old = $this->str;
  338. if (!$this->html)
  339. $this->str = htmlspecialchars($this->str);
  340. if (!empty($this->bbcode_level)) {
  341. $this->str = preg_replace(array_keys($this->regexp[0]), array_values($this->regexp[0]), ' ' . $this->str . ' ');
  342. if ($this->bbcode_level > 0) {
  343. $this->parseCodeTag();
  344. $this->parseQuoteTag();
  345. $this->str = preg_replace_callback("#\[spoiler(=(\"|&quot;|)(.*?)(\"|&quot;|)|)\](.*?)\[/spoiler\]#is", 'rcms_spoiler_tag', $this->str);
  346. $this->str = preg_replace(array_keys($this->regexp[1]), array_values($this->regexp[1]), ' ' . $this->str . ' ');
  347. }
  348. if ($this->bbcode_level > 1) {
  349. $this->str = preg_replace(array_keys($this->regexp[2]), array_values($this->regexp[2]), ' ' . $this->str . ' ');
  350. }
  351. if ($this->bbcode_level > 2) {
  352. $this->str = preg_replace_callback("#\[html\](.*?)\[/html\]#is", 'rcms_html_tag', $this->str);
  353. }
  354. if ($this->nl2br) {
  355. $this->str = nl2br($this->str);
  356. }
  357. $this->parseUrls();
  358. }
  359. $this->str = str_replace(array_keys($this->sr_temp), array_values($this->sr_temp), $this->str);
  360. $this->result = $this->str;
  361. }
  362. /**
  363. * Parses message::str [qoute|quote="Who"]..[/qoute] bbtag
  364. *
  365. */
  366. function parseQuoteTag() {
  367. $this->str = preg_replace("#[\s\n\r]*\[quote\][\s\n\r]*(.*?)[\s\n\r]*\[/quote\][\s\n\r]*#is", '<div class="codetitle"><b>' . __('Quote') . ':</b></div><div class="codetext">\\1</div>', $this->str);
  368. $this->str = preg_replace("#[\s\n\r]*\[quote=(\"|&quot;|)(.*?)(\"|&quot;|)\][\s\n\r]*(.*?)[\s\n\r]*\[/quote\][\s\n\r]*#is", '<div class="codetitle"><b>\\2 ' . __('wrote') . ':</b></div><div class="codetext">\\4</div>', $this->str);
  369. }
  370. /**
  371. * Parses message::str [code]..[/code] bbtag
  372. *
  373. */
  374. function parseCodeTag() {
  375. preg_match_all("#[\s\n\r]*\[code\][\s\n\r]*(.*?)[\s\n\r]*\[/code\][\s\n\r]*#is", $this->str, $matches);
  376. foreach ($matches[1] as $oldpart) {
  377. $newpart = preg_replace("#[\n\r]+#", '', highlight_string(strtr($oldpart, array_flip(get_html_translation_table(HTML_SPECIALCHARS))), true));
  378. $newpart = preg_replace(array('#\[#', '#\]#'), array('&#91;', '&#93;'), $newpart);
  379. $tmp = '{SR:' . rcms_random_string(6) . '}';
  380. $this->sr_temp[$tmp] = $newpart;
  381. $this->str = str_replace($oldpart, $tmp, $this->str);
  382. }
  383. $this->str = preg_replace("#[\s\n\r]*\[code\][\s\n\r]*(.*?)[\s\n\r]*\[/code\][\s\n\r]*#is", '<div class="codetitle"><b>' . __('Code') . ':</b></div><div class="codetext" style="overflow: auto; white-space: nowrap;">\\1</div>', $this->str);
  384. }
  385. function parseUrls() {
  386. $this->str = $this->highlightUrls($this->str);
  387. return true;
  388. }
  389. function highlightUrls($string) {
  390. $string = ' ' . $string;
  391. $string = preg_replace_callback("#(^|[\n\s\r])((https?|ftp|ed2k|irc)://[^ \"\n\r\t<]*)#is", 'rcms_prc_link', $string);
  392. $string = preg_replace_callback("#(^|[\n\s\r])((www|ftp)\.[^ \"\t\n\r<]*)#is", 'rcms_prc_link_short', $string);
  393. $string = preg_replace_callback("#(^|[\n\s\r])([a-z0-9&\-_.]+?)@([\w\-]+\.([\w\-\.]+\.)*[\w]+)#i", 'rcms_prc_mail', $string);
  394. $string = substr($string, 1);
  395. return $string;
  396. }
  397. }
  398. /**
  399. * Callback for link replacement
  400. *
  401. * @param array $matches
  402. * @return string
  403. */
  404. function rcms_prc_link($matches) {
  405. if (strlen($matches[2]) > 25) {
  406. return ' <a href="' . $matches[2] . '" target="_blank">' . substr($matches[2], 0, 11) . '...' . substr($matches[2], -11) . '</a>';
  407. } else
  408. return ' <a href="' . $matches[2] . '" target="_blank">' . $matches[2] . '</a>';
  409. }
  410. /**
  411. * Callback for short link replacement
  412. *
  413. * @param array $matches
  414. * @return string
  415. */
  416. function rcms_prc_link_short($matches) {
  417. if (strlen($matches[2]) > 25) {
  418. return ' <a href="http://' . $matches[2] . '" target="_blank">' . substr($matches[2], 0, 11) . '...' . substr($matches[2], -11) . '</a>';
  419. } else
  420. return ' <a href="http://' . $matches[2] . '" target="_blank">' . $matches[2] . '</a>';
  421. }
  422. /**
  423. * Callback for e-mail replacement
  424. *
  425. * @param array $matches
  426. * @return string
  427. */
  428. function rcms_prc_mail($matches) {
  429. if (strlen($matches[2]) > 25) {
  430. return ' <a href="mailto:' . $matches[2] . '@' . $matches[3] . '" target="_blank">' . substr($matches[2], 0, 11) . '...' . substr($matches[2], -11) . '</a>';
  431. } else
  432. return ' <a href="mailto:' . $matches[2] . '@' . $matches[3] . '" target="_blank">' . $matches[2] . '</a>';
  433. }
  434. function rcms_spoiler_tag($matches) {
  435. $id1 = rcms_random_string('6');
  436. $id2 = rcms_random_string('6');
  437. if (!empty($matches[3]))
  438. $title = __('Spoiler') . ': ' . $matches[3];
  439. else
  440. $title = __('Spoiler') . ' (' . __('click to view') . ')';
  441. return '<div id="' . $id1 . '" class="codetitle"><a onClick="javascript:document.getElementById(\'' . $id2 . '\').style.display=\'block\';">' . $title . '</a></div><div id="' . $id2 . '" style="display: none;" class="codetext">' . $matches[5] . '</div>';
  442. }
  443. function rcms_html_tag($matches) {
  444. return str_replace(array('[', ']'), array('&#91', '&#93'), strtr($matches[1], array_flip(get_html_translation_table(HTML_SPECIALCHARS))));
  445. }
  446. function rcms_remove_index($key, &$array, $preserve_keys = false) {
  447. $temp_array = $array;
  448. $array = array();
  449. foreach ($temp_array as $ckey => $value) {
  450. if ($key != $ckey) {
  451. if ($preserve_keys) {
  452. $array[$ckey] = $value;
  453. } else {
  454. $array[] = $value;
  455. }
  456. }
  457. }
  458. }
  459. ?>