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