summaryrefslogtreecommitdiff
path: root/program/include/main.inc
blob: 791e657b4fd8199060f618102e9cde9d3d8201cd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
<?php

/*
 +-----------------------------------------------------------------------+
 | program/include/main.inc                                              |
 |                                                                       |
 | This file is part of the Roundcube Webmail client                     |
 | Copyright (C) 2005-2012, The Roundcube Dev Team                       |
 |                                                                       |
 | Licensed under the GNU General Public License version 3 or            |
 | any later version with exceptions for skins & plugins.                |
 | See the README file for a full license statement.                     |
 |                                                                       |
 | PURPOSE:                                                              |
 |   Provide deprecated functions aliases for backward compatibility     |
 |                                                                       |
 +-----------------------------------------------------------------------+
 | Author: Thomas Bruederli <roundcube@gmail.com>                        |
 +-----------------------------------------------------------------------+

 $Id$

*/

/**
 * Roundcube Webmail deprecated functions
 *
 * @package Core
 * @author Thomas Bruederli <roundcube@gmail.com>
 */

// constants for input reading
define('RCUBE_INPUT_GET',  rcube_ui::INPUT_GET);
define('RCUBE_INPUT_POST', rcube_ui::INPUT_POST);
define('RCUBE_INPUT_GPC',  rcube_ui::INPUT_GPC);


function get_table_name($table)
{
    return rcmail::get_instance()->db->table_name($table);
}

function get_sequence_name($sequence)
{
    return rcmail::get_instance()->db->sequence_name($sequence);
}

function rcube_label($p, $domain=null)
{
    return rcmail::get_instance()->gettext($p, $domain);
}

function rcube_label_exists($name, $domain=null, &$ref_domain = null)
{
    return rcmail::get_instance()->text_exists($name, $domain, $ref_domain);
}

function rcmail_overwrite_action($action)
{
    rcmail::get_instance()->overwrite_action($action);
}

function rcmail_url($action, $p=array(), $task=null)
{
    return rcube_ui::url($action, $p, $task);
}

function rcmail_temp_gc()
{
  $rcmail = rcmail::get_instance()->temp_gc();
}

function rcube_charset_convert($str, $from, $to=NULL)
{
    return rcube_charset::convert($str, $from, $to);
}

function rc_detect_encoding($string, $failover='')
{
    return rcube_charset::detect($string, $failover);
}

function rc_utf8_clean($input)
{
    return rcube_charset::clean($input);
}

function json_serialize($input)
{
    return rcube_output::json_serialize($input);
}

function rep_specialchars_output($str, $enctype='', $mode='', $newlines=TRUE)
{
    return rcube_ui::rep_specialchars_output($str, $enctype, $mode, $newlines);
}

function Q($str, $mode='strict', $newlines=TRUE)
{
    return rcube_ui::Q($str, $mode, $newlines);
}

function JQ($str)
{
    return rcube_ui::JQ($str);
}

function get_input_value($fname, $source, $allow_html=FALSE, $charset=NULL)
{
    return rcube_ui::get_input_value($fname, $source, $allow_html, $charset);
}

function parse_input_value($value, $allow_html=FALSE, $charset=NULL)
{
    return rcube_ui::parse_input_value($value, $allow_html, $charset);
}

function request2param($mode = RCUBE_INPUT_GPC, $ignore = 'task|action')
{
    return rcube_ui::request2param($mode, $ignore);
}

function html_identifier($str, $encode=false)
{
    return rcube_ui::html_identifier($str, $encode);
}

function rcube_table_output($attrib, $table_data, $a_show_cols, $id_col)
{
    return rcube_ui::table_output($attrib, $table_data, $a_show_cols, $id_col);
}

function rcmail_get_edit_field($col, $value, $attrib, $type='text')
{
  return rcube_ui::get_edit_field($col, $value, $attrib, $type);
}

function rcmail_mod_css_styles($source, $container_id, $allow_remote=false)
{
    return rcube_ui::mod_css_styles($source, $container_id, $allow_remote);
}

function rcmail_xss_entity_decode($content)
{
    return rcube_ui::xss_entity_decode($content);
}

function create_attrib_string($attrib, $allowed_attribs=array('id', 'class', 'style'))
{
    return html::attrib_string($attrib, $allowed_attribs);
}

function parse_attrib_string($str)
{
    return html::parse_attrib_string($str);
}

function format_date($date, $format=NULL, $convert=true)
{
    return rcube_ui::format_date($date, $format, $convert);
}

function rcmail_mailbox_list($attrib)
{
    return rcube_ui::folder_list($attrib);
}

function rcmail_mailbox_select($attrib = array())
{
    return rcube_ui::folder_selector($attrib);
}

function rcmail_localize_foldername($name)
{
    return rcube_ui::localize_foldername($name);
}

function rcmail_localize_folderpath($path)
{
    return rcube_ui::localize_folderpath($path);
}

function rcmail_quota_display($attrib)
{
    return rcube_ui::quota_display($attrib);
}

function rcmail_quota_content($attrib = null)
{
    return rcube_ui::quota_content($attrib);
}

function rcmail_display_server_error($fallback=null, $fallback_args=null)
{
    rcube_ui::display_server_error($fallback, $fallback_args);
}

function rcmail_filetype2classname($mimetype, $filename)
{
    return rcube_ui::file2class($mimetype, $filename);
}

function rcube_html_editor($mode='')
{
    rcube_ui::html_editor($mode);
}

function rcmail_replace_emoticons($html)
{
    return rcube_ui::replace_emoticons($html);
}

function rcmail_deliver_message(&$message, $from, $mailto, &$smtp_error, &$body_file=null, $smtp_opts=null)
{
    return rcmail::get_instance()->deliver_message($message, $from, $mailto, $smtp_error, $body_file, $smtp_opts);
}

function rcmail_gen_message_id()
{
    return rcmail::get_instance()->gen_message_id();
}

function rcmail_user_date()
{
    return rcmail::get_instance()->user_date();
}

function rcmail_mem_check($need)
{
    return rcube_ui::mem_check($need);
}

function rcube_https_check($port=null, $use_https=true)
{
    return rcube_ui::https_check($port, $use_https);
}

function rcube_sess_unset($var_name=null)
{
    rcmail::get_instance()->session->remove($var_name);
}

function rcube_parse_host($name, $host='')
{
    return rcmail::parse_host($name, $host);
}

function check_email($email, $dns_check=true)
{
    return rcmail::get_instance()->check_email($email, $dns_check);
}

function console()
{
    call_user_func_array(array('rcmail', 'console'), func_get_args());
}

function write_log($name, $line)
{
    return rcmail::write_log($name, $line);
}

function rcmail_log_login()
{
    return rcmail::get_instance()->log_login();
}

function rcmail_remote_ip()
{
    return rcmail::remote_ip();
}

function rcube_check_referer()
{
    return rcmail::check_referer();
}

function rcube_timer()
{
    return rcmail::timer();
}

function rcube_print_time($timer, $label='Timer', $dest='console')
{
    rcmail::print_timer($timer, $label, $dest);
}

function raise_error($arg=array(), $log=false, $terminate=false)
{
    rcmail::raise_error($arg, $log, $terminate);
}

function rcube_log_bug($arg_arr)
{
    rcmail::log_bug($arg_arr);
}

function rcube_upload_progress()
{
    rcube_ui::upload_progress();
}

function rcube_upload_init()
{
    return rcube_ui::upload_init();
}

function rcube_autocomplete_init()
{
    rcube_ui::autocomplete_init();
}

function rcube_fontdefs($font = null)
{
    return rcube_ui::font_defs($font);
}

function send_nocacheing_headers()
{
    return rcmail::get_instance()->output->nocacheing_headers();
}

function show_bytes($bytes)
{
    return rcube_ui::show_bytes($bytes);
}

function rc_wordwrap($string, $width=75, $break="\n", $cut=false)
{
    return rcube_mime::wordwrap($string, $width, $break, $cut);
}

function rc_request_header($name)
{
    return rcube_request_header($name);
}

function rc_mime_content_type($path, $name, $failover = 'application/octet-stream', $is_stream=false)
{
    return rcube_mime::file_content_type($path, $name, $failover, $is_stream);
}

function rc_image_content_type($data)
{
    return rcube_mime::image_content_type($data);
}