Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

bc.php 13KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512
  1. <?php
  2. /*
  3. +-----------------------------------------------------------------------+
  4. | program/include/bc.php |
  5. | |
  6. | This file is part of the Roundcube Webmail client |
  7. | Copyright (C) 2005-2012, The Roundcube Dev Team |
  8. | |
  9. | Licensed under the GNU General Public License version 3 or |
  10. | any later version with exceptions for skins & plugins. |
  11. | See the README file for a full license statement. |
  12. | |
  13. | PURPOSE: |
  14. | Provide deprecated functions aliases for backward compatibility |
  15. | |
  16. +-----------------------------------------------------------------------+
  17. | Author: Thomas Bruederli <roundcube@gmail.com> |
  18. +-----------------------------------------------------------------------+
  19. */
  20. /**
  21. * Roundcube Webmail deprecated functions
  22. *
  23. * @package Webmail
  24. * @subpackage Legacy
  25. * @author Thomas Bruederli <roundcube@gmail.com>
  26. */
  27. // constants for input reading
  28. define('RCUBE_INPUT_GET', rcube_utils::INPUT_GET);
  29. define('RCUBE_INPUT_POST', rcube_utils::INPUT_POST);
  30. define('RCUBE_INPUT_GPC', rcube_utils::INPUT_GPC);
  31. define('JS_OBJECT_NAME', rcmail_output::JS_OBJECT_NAME);
  32. define('RCMAIL_CHARSET', RCUBE_CHARSET);
  33. function get_table_name($table)
  34. {
  35. _deprecation_warning(__FUNCTION__);
  36. return rcmail::get_instance()->db->table_name($table);
  37. }
  38. function rcube_label($p, $domain=null)
  39. {
  40. _deprecation_warning(__FUNCTION__);
  41. return rcmail::get_instance()->gettext($p, $domain);
  42. }
  43. function rcube_label_exists($name, $domain=null, &$ref_domain = null)
  44. {
  45. _deprecation_warning(__FUNCTION__);
  46. return rcmail::get_instance()->text_exists($name, $domain, $ref_domain);
  47. }
  48. function rcmail_overwrite_action($action)
  49. {
  50. _deprecation_warning(__FUNCTION__);
  51. rcmail::get_instance()->overwrite_action($action);
  52. }
  53. function rcmail_url($action, $p=array(), $task=null)
  54. {
  55. _deprecation_warning(__FUNCTION__);
  56. return rcmail::get_instance()->url((array)$p + array('_action' => $action, 'task' => $task));
  57. }
  58. function rcmail_temp_gc()
  59. {
  60. _deprecation_warning(__FUNCTION__);
  61. rcmail::get_instance()->gc_temp();
  62. }
  63. function rcube_charset_convert($str, $from, $to=NULL)
  64. {
  65. _deprecation_warning(__FUNCTION__);
  66. return rcube_charset::convert($str, $from, $to);
  67. }
  68. function rc_detect_encoding($string, $failover='')
  69. {
  70. _deprecation_warning(__FUNCTION__);
  71. return rcube_charset::detect($string, $failover);
  72. }
  73. function rc_utf8_clean($input)
  74. {
  75. _deprecation_warning(__FUNCTION__);
  76. return rcube_charset::clean($input);
  77. }
  78. function json_serialize($input)
  79. {
  80. _deprecation_warning(__FUNCTION__);
  81. return rcube_output::json_serialize($input);
  82. }
  83. function rep_specialchars_output($str, $enctype='', $mode='', $newlines=true)
  84. {
  85. _deprecation_warning(__FUNCTION__);
  86. return rcube_utils::rep_specialchars_output($str, $enctype, $mode, $newlines);
  87. }
  88. function Q($str, $mode='strict', $newlines=true)
  89. {
  90. _deprecation_warning(__FUNCTION__);
  91. return rcube_utils::rep_specialchars_output($str, 'html', $mode, $newlines);
  92. }
  93. function JQ($str)
  94. {
  95. _deprecation_warning(__FUNCTION__);
  96. return rcube_utils::rep_specialchars_output($str, 'js');
  97. }
  98. function get_input_value($fname, $source, $allow_html=FALSE, $charset=NULL)
  99. {
  100. _deprecation_warning(__FUNCTION__);
  101. return rcube_utils::get_input_value($fname, $source, $allow_html, $charset);
  102. }
  103. function parse_input_value($value, $allow_html=FALSE, $charset=NULL)
  104. {
  105. _deprecation_warning(__FUNCTION__);
  106. return rcube_utils::parse_input_value($value, $allow_html, $charset);
  107. }
  108. function request2param($mode = RCUBE_INPUT_GPC, $ignore = 'task|action')
  109. {
  110. _deprecation_warning(__FUNCTION__);
  111. return rcube_utils::request2param($mode, $ignore);
  112. }
  113. function html_identifier($str, $encode=false)
  114. {
  115. _deprecation_warning(__FUNCTION__);
  116. return rcube_utils::html_identifier($str, $encode);
  117. }
  118. function rcube_table_output($attrib, $table_data, $a_show_cols, $id_col)
  119. {
  120. _deprecation_warning(__FUNCTION__);
  121. return rcmail::get_instance()->table_output($attrib, $table_data, $a_show_cols, $id_col);
  122. }
  123. function rcmail_get_edit_field($col, $value, $attrib, $type='text')
  124. {
  125. _deprecation_warning(__FUNCTION__);
  126. return rcube_output::get_edit_field($col, $value, $attrib, $type);
  127. }
  128. function rcmail_mod_css_styles($source, $container_id, $allow_remote=false)
  129. {
  130. _deprecation_warning(__FUNCTION__);
  131. return rcube_utils::mod_css_styles($source, $container_id, $allow_remote);
  132. }
  133. function rcmail_xss_entity_decode($content)
  134. {
  135. _deprecation_warning(__FUNCTION__);
  136. return rcube_utils::xss_entity_decode($content);
  137. }
  138. function create_attrib_string($attrib, $allowed_attribs=array('id', 'class', 'style'))
  139. {
  140. _deprecation_warning(__FUNCTION__);
  141. return html::attrib_string($attrib, $allowed_attribs);
  142. }
  143. function parse_attrib_string($str)
  144. {
  145. _deprecation_warning(__FUNCTION__);
  146. return html::parse_attrib_string($str);
  147. }
  148. function format_date($date, $format=NULL, $convert=true)
  149. {
  150. _deprecation_warning(__FUNCTION__);
  151. return rcmail::get_instance()->format_date($date, $format, $convert);
  152. }
  153. function rcmail_mailbox_list($attrib)
  154. {
  155. _deprecation_warning(__FUNCTION__);
  156. return rcmail::get_instance()->folder_list($attrib);
  157. }
  158. function rcmail_mailbox_select($attrib = array())
  159. {
  160. _deprecation_warning(__FUNCTION__);
  161. return rcmail::get_instance()->folder_selector($attrib);
  162. }
  163. function rcmail_render_folder_tree_html(&$arrFolders, &$mbox_name, &$jslist, $attrib, $nestLevel = 0)
  164. {
  165. _deprecation_warning(__FUNCTION__);
  166. return rcmail::get_instance()->render_folder_tree_html($arrFolders, $mbox_name, $jslist, $attrib, $nestLevel);
  167. }
  168. function rcmail_render_folder_tree_select(&$arrFolders, &$mbox_name, $maxlength, &$select, $realnames = false, $nestLevel = 0, $opts = array())
  169. {
  170. _deprecation_warning(__FUNCTION__);
  171. return rcmail::get_instance()->render_folder_tree_select($arrFolders, $mbox_name, $maxlength, $select, $realnames, $nestLevel, $opts);
  172. }
  173. function rcmail_build_folder_tree(&$arrFolders, $folder, $delm = '/', $path = '')
  174. {
  175. _deprecation_warning(__FUNCTION__);
  176. return rcmail::get_instance()->build_folder_tree($arrFolders, $folder, $delm, $path);
  177. }
  178. function rcmail_folder_classname($folder_id)
  179. {
  180. _deprecation_warning(__FUNCTION__);
  181. return rcmail::get_instance()->folder_classname($folder_id);
  182. }
  183. function rcmail_localize_foldername($name)
  184. {
  185. _deprecation_warning(__FUNCTION__);
  186. return rcmail::get_instance()->localize_foldername($name);
  187. }
  188. function rcmail_localize_folderpath($path)
  189. {
  190. _deprecation_warning(__FUNCTION__);
  191. return rcmail::get_instance()->localize_folderpath($path);
  192. }
  193. function rcmail_quota_display($attrib)
  194. {
  195. _deprecation_warning(__FUNCTION__);
  196. return rcmail::get_instance()->quota_display($attrib);
  197. }
  198. function rcmail_quota_content($attrib = null)
  199. {
  200. _deprecation_warning(__FUNCTION__);
  201. return rcmail::get_instance()->quota_content($attrib);
  202. }
  203. function rcmail_display_server_error($fallback=null, $fallback_args=null, $suffix='')
  204. {
  205. _deprecation_warning(__FUNCTION__);
  206. rcmail::get_instance()->display_server_error($fallback, $fallback_args, $suffix);
  207. }
  208. function rcmail_filetype2classname($mimetype, $filename)
  209. {
  210. _deprecation_warning(__FUNCTION__);
  211. return rcube_utils::file2class($mimetype, $filename);
  212. }
  213. function rcube_html_editor($mode='')
  214. {
  215. _deprecation_warning(__FUNCTION__);
  216. rcmail::get_instance()->html_editor($mode);
  217. }
  218. function rcmail_replace_emoticons($html)
  219. {
  220. _deprecation_warning(__FUNCTION__);
  221. return rcmail::get_instance()->replace_emoticons($html);
  222. }
  223. function rcmail_deliver_message(&$message, $from, $mailto, &$smtp_error, &$body_file=null, $smtp_opts=null)
  224. {
  225. _deprecation_warning(__FUNCTION__);
  226. return rcmail::get_instance()->deliver_message($message, $from, $mailto, $smtp_error, $body_file, $smtp_opts);
  227. }
  228. function rcmail_gen_message_id()
  229. {
  230. _deprecation_warning(__FUNCTION__);
  231. return rcmail::get_instance()->gen_message_id();
  232. }
  233. function rcmail_user_date()
  234. {
  235. _deprecation_warning(__FUNCTION__);
  236. return rcmail::get_instance()->user_date();
  237. }
  238. function rcmail_mem_check($need)
  239. {
  240. _deprecation_warning(__FUNCTION__);
  241. return rcube_utils::mem_check($need);
  242. }
  243. function rcube_https_check($port=null, $use_https=true)
  244. {
  245. _deprecation_warning(__FUNCTION__);
  246. return rcube_utils::https_check($port, $use_https);
  247. }
  248. function rcube_sess_unset($var_name=null)
  249. {
  250. _deprecation_warning(__FUNCTION__);
  251. rcmail::get_instance()->session->remove($var_name);
  252. }
  253. function rcube_parse_host($name, $host='')
  254. {
  255. _deprecation_warning(__FUNCTION__);
  256. return rcube_utils::parse_host($name, $host);
  257. }
  258. function check_email($email, $dns_check=true)
  259. {
  260. _deprecation_warning(__FUNCTION__);
  261. return rcube_utils::check_email($email, $dns_check);
  262. }
  263. function console()
  264. {
  265. _deprecation_warning(__FUNCTION__);
  266. call_user_func_array(array('rcmail', 'console'), func_get_args());
  267. }
  268. function write_log($name, $line)
  269. {
  270. _deprecation_warning(__FUNCTION__);
  271. return rcmail::write_log($name, $line);
  272. }
  273. function rcmail_log_login()
  274. {
  275. _deprecation_warning(__FUNCTION__);
  276. return rcmail::get_instance()->log_login();
  277. }
  278. function rcmail_remote_ip()
  279. {
  280. _deprecation_warning(__FUNCTION__);
  281. return rcube_utils::remote_ip();
  282. }
  283. function rcube_check_referer()
  284. {
  285. _deprecation_warning(__FUNCTION__);
  286. return rcube_utils::check_referer();
  287. }
  288. function rcube_timer()
  289. {
  290. _deprecation_warning(__FUNCTION__);
  291. return rcmail::timer();
  292. }
  293. function rcube_print_time($timer, $label='Timer', $dest='console')
  294. {
  295. _deprecation_warning(__FUNCTION__);
  296. rcmail::print_timer($timer, $label, $dest);
  297. }
  298. function raise_error($arg=array(), $log=false, $terminate=false)
  299. {
  300. _deprecation_warning(__FUNCTION__);
  301. rcmail::raise_error($arg, $log, $terminate);
  302. }
  303. function rcube_log_bug($arg_arr)
  304. {
  305. _deprecation_warning(__FUNCTION__);
  306. rcmail::log_bug($arg_arr);
  307. }
  308. function rcube_upload_progress()
  309. {
  310. _deprecation_warning(__FUNCTION__);
  311. rcmail::get_instance()->upload_progress();
  312. }
  313. function rcube_upload_init()
  314. {
  315. _deprecation_warning(__FUNCTION__);
  316. return rcmail::get_instance()->upload_init();
  317. }
  318. function rcube_autocomplete_init()
  319. {
  320. _deprecation_warning(__FUNCTION__);
  321. rcmail::get_instance()->autocomplete_init();
  322. }
  323. function rcube_fontdefs($font = null)
  324. {
  325. _deprecation_warning(__FUNCTION__);
  326. return rcmail::font_defs($font);
  327. }
  328. function send_nocacheing_headers()
  329. {
  330. _deprecation_warning(__FUNCTION__);
  331. return rcmail::get_instance()->output->nocacheing_headers();
  332. }
  333. function show_bytes($bytes)
  334. {
  335. _deprecation_warning(__FUNCTION__);
  336. return rcmail::get_instance()->show_bytes($bytes);
  337. }
  338. function rc_wordwrap($string, $width=75, $break="\n", $cut=false, $charset=null)
  339. {
  340. _deprecation_warning(__FUNCTION__);
  341. return rcube_mime::wordwrap($string, $width, $break, $cut, $charset);
  342. }
  343. function rc_request_header($name)
  344. {
  345. _deprecation_warning(__FUNCTION__);
  346. return rcube_utils::request_header($name);
  347. }
  348. function rcube_explode_quoted_string($delimiter, $string)
  349. {
  350. _deprecation_warning(__FUNCTION__);
  351. return rcube_utils::explode_quoted_string($delimiter, $string);
  352. }
  353. function rc_mime_content_type($path, $name, $failover = 'application/octet-stream', $is_stream=false)
  354. {
  355. _deprecation_warning(__FUNCTION__);
  356. return rcube_mime::file_content_type($path, $name, $failover, $is_stream);
  357. }
  358. function rc_image_content_type($data)
  359. {
  360. _deprecation_warning(__FUNCTION__);
  361. return rcube_mime::image_content_type($data);
  362. }
  363. function rcube_strtotime($date)
  364. {
  365. _deprecation_warning(__FUNCTION__);
  366. return rcube_utils::strtotime($date);
  367. }
  368. function rcube_idn_to_ascii($str)
  369. {
  370. _deprecation_warning(__FUNCTION__);
  371. return rcube_utils::idn_to_ascii($str);
  372. }
  373. function rcube_idn_to_utf8($str)
  374. {
  375. _deprecation_warning(__FUNCTION__);
  376. return rcube_utils::idn_to_utf8($str);
  377. }
  378. function send_future_expire_header($offset = 2600000)
  379. {
  380. _deprecation_warning(__FUNCTION__);
  381. return rcmail::get_instance()->output->future_expire_header($offset);
  382. }
  383. function get_opt($aliases = array())
  384. {
  385. _deprecation_warning(__FUNCTION__);
  386. return rcube_utils::get_opt($aliases);
  387. }
  388. function prompt_silent($prompt = 'Password:')
  389. {
  390. _deprecation_warning(__FUNCTION__);
  391. return rcube_utils::prompt_silent($prompt);
  392. }
  393. function get_boolean($str)
  394. {
  395. _deprecation_warning(__FUNCTION__);
  396. return rcube_utils::get_boolean($str);
  397. }
  398. function enriched_to_html($data)
  399. {
  400. _deprecation_warning(__FUNCTION__);
  401. return rcube_enriched::to_html($data);
  402. }
  403. function strip_quotes($str)
  404. {
  405. _deprecation_warning(__FUNCTION__);
  406. return str_replace(array("'", '"'), '', $str);
  407. }
  408. function strip_newlines($str)
  409. {
  410. _deprecation_warning(__FUNCTION__);
  411. return preg_replace('/[\r\n]/', '', $str);
  412. }
  413. function _deprecation_warning($func)
  414. {
  415. static $warnings = array();
  416. if (!$warnings[$func]++) // only log once
  417. rcmail::write_log('errors', "Warning: Call to deprecated function $func(); See bc.inc for replacement");
  418. }
  419. class rcube_html_page extends rcmail_html_page
  420. {
  421. }
  422. class washtml extends rcube_washtml
  423. {
  424. }
  425. class html2text extends rcube_html2text
  426. {
  427. }