Changeset 623 in subversion
- Timestamp:
- Jun 20, 2007 11:22:40 AM (6 years ago)
- Location:
- branches/devel-vnext
- Files:
-
- 4 added
- 35 edited
-
index.php (modified) (5 diffs)
-
program/include/bugs.inc (modified) (2 diffs)
-
program/include/cache.inc (modified) (1 diff)
-
program/include/main.inc (modified) (17 diffs)
-
program/include/rcmail_template.inc (modified) (8 diffs)
-
program/include/rcube/base_form_element.php (added)
-
program/include/rcube/css.php (added)
-
program/include/rcube/form_elements.php (added)
-
program/include/rcube/html_page.php (added)
-
program/include/rcube/rcmail_compose.php (modified) (28 diffs)
-
program/include/rcube/rcmail_send.php (modified) (4 diffs)
-
program/include/rcube_contacts.inc (modified) (19 diffs)
-
program/include/rcube_imap.inc (modified) (6 diffs)
-
program/include/rcube_shared.inc (modified) (2 diffs)
-
program/include/rcube_smtp.inc (modified) (7 diffs)
-
program/include/session.inc (modified) (2 diffs)
-
program/js/app.js (modified) (2 diffs)
-
program/steps/addressbook/edit.inc (modified) (2 diffs)
-
program/steps/addressbook/func.inc (modified) (5 diffs)
-
program/steps/addressbook/mailto.inc (modified) (1 diff)
-
program/steps/mail/check_recent.inc (modified) (1 diff)
-
program/steps/mail/compose.inc (modified) (8 diffs)
-
program/steps/mail/folders.inc (modified) (3 diffs)
-
program/steps/mail/func.inc (modified) (25 diffs)
-
program/steps/mail/get.inc (modified) (1 diff)
-
program/steps/mail/getunread.inc (modified) (1 diff)
-
program/steps/mail/list.inc (modified) (1 diff)
-
program/steps/mail/mark.inc (modified) (1 diff)
-
program/steps/mail/move_del.inc (modified) (2 diffs)
-
program/steps/mail/quotadisplay.inc (modified) (1 diff)
-
program/steps/mail/search.inc (modified) (3 diffs)
-
program/steps/mail/sendmail.inc (modified) (8 diffs)
-
program/steps/mail/show.inc (modified) (1 diff)
-
program/steps/mail/spell.inc (modified) (1 diff)
-
program/steps/mail/upload.inc (modified) (2 diffs)
-
program/steps/mail/viewsource.inc (modified) (1 diff)
-
program/steps/settings/func.inc (modified) (3 diffs)
-
program/steps/settings/identities.inc (modified) (1 diff)
-
program/steps/settings/manage_folders.inc (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/devel-vnext/index.php
r622 r623 56 56 $registry->set('s_mbstring_loaded', null, 'core'); 57 57 $registry->set('sa_languages', null, 'core'); 58 $registry->set('MAIN_TASKS', $MAIN_TASKS, 'core'); 58 59 59 60 /** … … 224 225 225 226 $IMAP = $registry->get('IMAP', 'core'); 226 rc_main::tfk_debug(var_export($IMAP, true) . "\n\nIMAP LOADED.");227 //rc_main::tfk_debug(var_export($IMAP, true) . "\n\nIMAP LOADED."); 227 228 228 229 // log in to imap server … … 294 295 $_name = ''; 295 296 297 rc_main::tfk_debug("testing: $_task / $_action"); 298 296 299 // include task specific files 297 300 if ($_task == 'mail') { … … 340 343 // make sure the message count is refreshed 341 344 $IMAP->messagecount($_SESSION['mbox'], 'ALL', TRUE); 345 $registry->set('IMAP', $IMAP, 'core'); 342 346 } 343 347 … … 401 405 } 402 406 } 407 408 rc_main::tfk_debug('We included?'); 403 409 404 410 // parse main template -
branches/devel-vnext/program/include/bugs.inc
r589 r623 23 23 // throw system error and show error page 24 24 function raise_error($arg=array(), $log=FALSE, $terminate=FALSE) 25 { 26 global $__page_content, $CONFIG, $OUTPUT, $ERROR_CODE, $ERROR_MESSAGE; 25 { 26 $registry = rc_registry::getInstance(); 27 $__page_content = $registry->get('registry', 'core'); 28 $CONFIG = $registry->get('CONFIG', 'core'); 29 $OUTPUT = $registry->get('OUTPUT', 'core'); 30 $ERROR_CODE = $registry->get('ERROR_CODE', 'core'); 31 $ERROR_MESSAGE = $registry->get('ERROR_MESSAGE', 'core'); 27 32 28 33 /* $arg keys: … … 34 39 */ 35 40 36 // report bug (if not incompatible browser) 37 if ($log && $arg['type'] && $arg['message']) 38 log_bug($arg); 41 // report bug (if not incompatible browser) 42 if ($log && $arg['type'] && $arg['message']) { 43 log_bug($arg); 44 } 45 // display error page and terminate script 46 if ($terminate) { 47 $ERROR_CODE = $arg['code']; 48 $ERROR_MESSAGE = $arg['message']; 39 49 40 // display error page and terminate script 41 if ($terminate) 42 { 43 $ERROR_CODE = $arg['code']; 44 $ERROR_MESSAGE = $arg['message']; 45 include("program/steps/error.inc"); 46 exit; 50 $registry->set('ERROR_CODE', $ERROR_CODE, 'core'); 51 $registry->set('ERROR_MESSAGE', $ERROR_MESSAGE, 'core'); 52 53 include 'program/steps/error.inc'; 54 exit; 47 55 } 48 }56 } 49 57 50 58 51 59 // report error 52 60 function log_bug($arg_arr) 53 { 54 global $CONFIG, $INSTALL_PATH; 55 $program = $arg_arr['type']=='xpath' ? 'XPath' : strtoupper($arg_arr['type']); 61 { 62 $registry = rc_registry::getInstance(); 63 $CONFIG = $registry->get('CONFIG', 'core'); 64 $INSTALL_PATH = $registry->get('INSTALL_PATH', 'core'); 56 65 57 // write error to local log file 58 if ($CONFIG['debug_level'] & 1) 59 { 60 $log_entry = sprintf("[%s] %s Error: %s in %s on line %d\n", 61 date("d-M-Y H:i:s O", mktime()), 62 $program, 63 $arg_arr['message'], 64 $arg_arr['file'], 65 $arg_arr['line']); 66 $program = $arg_arr['type']=='xpath' ? 'XPath' : strtoupper($arg_arr['type']); 67 68 // write error to local log file 69 if ($CONFIG['debug_level'] & 1) { 70 $log_entry = sprintf( 71 "[%s] %s Error: %s in %s on line %d\n", 72 date('d-M-Y H:i:s O'), 73 $program, 74 $arg_arr['message'], 75 $arg_arr['file'], 76 $arg_arr['line'] 77 ); 66 78 67 if (empty($CONFIG['log_dir'])) 68 $CONFIG['log_dir'] = $INSTALL_PATH.'logs'; 69 70 // try to open specific log file for writing 71 if ($fp = @fopen($CONFIG['log_dir'].'/errors', 'a')) 72 73 { 74 fwrite($fp, $log_entry); 75 fclose($fp); 76 } 77 else 78 { 79 // send error to PHPs error handler 80 trigger_error($arg_arr['message']); 81 } 79 if (empty($CONFIG['log_dir'])) { 80 $CONFIG['log_dir'] = $INSTALL_PATH.'logs'; 81 $registry->set('CONFIG', $CONFIG, 'core'); 82 } 83 84 // try to open specific log file for writing 85 if ($fp = @fopen($CONFIG['log_dir'].'/errors', 'a')) { 86 fwrite($fp, $log_entry); 87 fclose($fp); 88 } 89 else { 90 // send error to PHPs error handler 91 trigger_error($arg_arr['message']); 92 } 82 93 } 83 94 84 /* 85 // resport the bug to the global bug reporting system 86 if ($CONFIG['debug_level'] & 2) 87 { 88 $delm = '%AC'; 89 http_request(sprintf('http://roundcube.net/log/bug.php?_type=%s&_domain=%s&_server_ip=%s&_client_ip=%s&_useragent=%s&_url=%s%%3A//%s&_errors=%s%s%s%s%s', 90 $arg_arr['type'], 91 $GLOBALS['HTTP_HOST'], 92 $GLOBALS['SERVER_ADDR'], 93 $GLOBALS['REMOTE_ADDR'], 94 rawurlencode($GLOBALS['HTTP_USER_AGENT']), 95 $GLOBALS['SERVER_PORT']==43 ? 'https' : 'http', 96 $GLOBALS['HTTP_HOST'].$GLOBALS['REQUEST_URI'], 97 $arg_arr['file'], $delm, 98 $arg_arr['line'], $delm, 99 rawurlencode($arg_arr['message']))); 95 /* 96 // resport the bug to the global bug reporting system 97 if ($CONFIG['debug_level'] & 2) { 98 $delm = '%AC'; 99 http_request( 100 sprintf( 101 'http://roundcube.net/log/bug.php?_type=%s&_domain=%s&_server_ip=%s&_client_ip=%s&_useragent=%s&_url=%s%%3A//%s&_errors=%s%s%s%s%s', 102 $arg_arr['type'], 103 $GLOBALS['HTTP_HOST'], 104 $GLOBALS['SERVER_ADDR'], 105 $GLOBALS['REMOTE_ADDR'], 106 rawurlencode($GLOBALS['HTTP_USER_AGENT']), 107 $GLOBALS['SERVER_PORT']==43 ? 'https' : 'http', 108 $GLOBALS['HTTP_HOST'].$GLOBALS['REQUEST_URI'], 109 $arg_arr['file'], $delm, 110 $arg_arr['line'], $delm, 111 rawurlencode($arg_arr['message']) 112 ) 113 ); 100 114 } 101 */115 */ 102 116 103 // show error if debug_mode is on 104 if ($CONFIG['debug_level'] & 4) 105 { 106 print "<b>$program Error"; 117 // show error if debug_mode is on 118 if ($CONFIG['debug_level'] & 4) { 119 echo "<b>$program Error"; 107 120 108 if (!empty($arg_arr['file']) && !empty($arg_arr['line'])) 109 print " in $arg_arr[file] ($arg_arr[line])"; 121 if (!empty($arg_arr['file']) && !empty($arg_arr['line'])) { 122 echo " in {$arg_arr['file']} ({$arg_arr['line']})"; 123 } 110 124 111 print ":</b> ";112 printnl2br($arg_arr['message']);113 print'<br />';114 flush();125 echo ':</b> '; 126 echo nl2br($arg_arr['message']); 127 echo '<br />'; 128 flush(); 115 129 } 116 } 117 130 } 118 131 ?> -
branches/devel-vnext/program/include/cache.inc
r589 r623 22 22 23 23 function rcube_read_cache($key) 24 { 25 global $DB, $CACHE_KEYS; 26 27 // query db 28 $sql_result = $DB->query("SELECT cache_id, data 29 FROM ".get_table_name('cache')." 30 WHERE user_id=? 31 AND cache_key=?", 32 $_SESSION['user_id'], 33 $key); 24 { 25 $registry = rc_registry::getInstance(); 26 $DB = $registry->get('DB', 'core'); 27 $CACHE_KEYS = $registry->get('CACHE_KEYS', 'core'); 34 28 35 // get cached data 36 if ($sql_arr = $DB->fetch_assoc($sql_result)) 37 { 38 $data = $sql_arr['data']; 39 $CACHE_KEYS[$key] = $sql_arr['cache_id']; 29 // query db 30 $_query = "SELECT cache_id, data"; 31 $_query.= " FROM " . rc_main::get_table_name('cache'); 32 $_query.= " WHERE user_id=?"; 33 $_query.= " AND cache_key=?"; 34 $sql_result = $DB->query($_query, $_SESSION['user_id'], $key); 35 36 // get cached data 37 if ($sql_arr = $DB->fetch_assoc($sql_result)) { 38 $data = $sql_arr['data']; 39 $CACHE_KEYS[$key] = $sql_arr['cache_id']; 40 40 } 41 else 42 $data = FALSE; 43 44 return $data; 45 } 41 else { 42 $data = FALSE; 43 } 44 $registry->set('CACHE_KEYS', $CACHE_KEYS, 'core'); 45 return $data; 46 } 46 47 47 48 48 49 function rcube_write_cache($key, $data, $session_cache=FALSE) 49 { 50 global $DB, $CACHE_KEYS, $sess_id; 51 52 // check if we already have a cache entry for this key 53 if (!isset($CACHE_KEYS[$key])) 54 { 55 $sql_result = $DB->query("SELECT cache_id 56 FROM ".get_table_name('cache')." 57 WHERE user_id=? 58 AND cache_key=?", 59 $_SESSION['user_id'], 60 $key); 61 62 if ($sql_arr = $DB->fetch_assoc($sql_result)) 63 $CACHE_KEYS[$key] = $sql_arr['cache_id']; 64 else 65 $CACHE_KEYS[$key] = FALSE; 50 { 51 $registry = rc_registry::getInstance(); 52 $DB = $registry->get('DB', 'core'); 53 $CACHE_KEYS = $registry->get('CACHE_KEYS', 'core'); 54 $sess_id = $registry->get('sess_id', 'core'); 55 56 // check if we already have a cache entry for this key 57 if (!isset($CACHE_KEYS[$key])) { 58 $_query = "SELECT cache_id"; 59 $_query.= " FROM " . rc_main::get_table_name('cache'); 60 $_query.= " WHERE user_id=?"; 61 $_query.= " AND cache_key=?"; 62 $sql_result = $DB->query($_query, $_SESSION['user_id'], $key); 63 64 if ($sql_arr = $DB->fetch_assoc($sql_result)) { 65 $CACHE_KEYS[$key] = $sql_arr['cache_id']; 66 } 67 else { 68 $CACHE_KEYS[$key] = FALSE; 69 } 70 $registry->set('CACHE_KEYS', $CACHE_KEYS, 'core'); 66 71 } 67 72 68 // update existing cache record 69 if ($CACHE_KEYS[$key]) 70 { 71 $DB->query("UPDATE ".get_table_name('cache')." 72 SET created=now(), 73 data=? 74 WHERE user_id=? 75 AND cache_key=?", 76 $data, 77 $_SESSION['user_id'], 78 $key); 73 // update existing cache record 74 if ($CACHE_KEYS[$key]) { 75 $_query = "UPDATE " . rc_main::get_table_name('cache'); 76 $_query.= " SET created=now(),"; 77 $_query.= " data=?"; 78 $_query.= " WHERE user_id=?"; 79 $_query.= " AND cache_key=?"; 80 $DB->query($_query, $data, $_SESSION['user_id'], $key); 79 81 } 80 // add new cache record 81 else 82 { 83 $DB->query("INSERT INTO ".get_table_name('cache')." 84 (created, user_id, session_id, cache_key, data) 85 VALUES (now(), ?, ?, ?, ?)", 82 // add new cache record 83 else { 84 $_query = "INSERT INTO " . rc_main::get_table_name('cache'); 85 $_query.= " (created, user_id, session_id, cache_key, data)"; 86 $_query.= " VALUES (now(), ?, ?, ?, ?)"; 87 $DB->query( 88 $_query, 86 89 $_SESSION['user_id'], 87 90 $session_cache ? $sess_id : 'NULL', 88 91 $key, 89 $data); 92 $data 93 ); 90 94 } 91 }95 } 92 96 93 97 94 98 function rcube_clear_cache($key) 95 { 96 global $DB; 99 { 100 $registry = rc_registry::getInstance(); 101 $DB = $registry->get('DB', 'core'); 97 102 98 $DB->query("DELETE FROM ".get_table_name('cache')." 99 WHERE user_id=? 100 AND cache_key=?", 101 $_SESSION['user_id'], 102 $key); 103 } 104 105 103 $_query = "DELETE FROM " . rc_main::get_table_name('cache'); 104 $_query.= " WHERE user_id=?"; 105 $_query.= " AND cache_key=?"; 106 $DB->query($_query, $_SESSION['user_id'], $key); 107 } 106 108 ?> -
branches/devel-vnext/program/include/main.inc
r622 r623 64 64 static function rcmail_startup($task = 'mail') 65 65 { 66 //global $sess_id, $sess_user_lang;67 //global $CONFIG, $INSTALL_PATH, $BROWSER, $OUTPUT, $_SESSION, $IMAP, $DB;68 69 66 $registry = rc_registry::getInstance(); 70 67 $INSTALL_PATH = $registry->get('INSTALL_PATH', 'core'); … … 74 71 // check client 75 72 $BROWSER = rcube_browser(); 73 $registry->set('BROWSER', $BROWSER, 'core'); 76 74 77 75 self::tfk_debug('// load browser'); … … 104 102 session_start(); 105 103 $sess_id = session_id(); 104 $registry->set('sess_id', $sess_id, 'core'); 106 105 107 106 // create session and set session vars … … 114 113 // set session vars global 115 114 $sess_user_lang = self::rcube_language_prop($_SESSION['user_lang']); 116 115 $registry->set('sess_user_lang', $sess_user_lang, 'core'); 117 116 118 117 // overwrite config with user preferences … … 120 119 $CONFIG = array_merge($CONFIG, $_SESSION['user_prefs']); 121 120 } 121 $registry->set('CONFIG', $CONFIG, 'core'); 122 122 123 123 // reset some session parameters when changing task … … 141 141 } 142 142 register_shutdown_function(array('rc_main', 'rcmail_shutdown')); 143 144 $registry->set('sess_id', $sess_id, 'core');145 $registry->set('sess_user_lang', $sess_user_lang, 'core');146 $registry->set('CONFIG', $CONFIG, 'core');147 $registry->set('BROWSER', $BROWSER, 'core');148 149 //global $OUTPUT, $IMAP150 143 } 151 144 … … 205 198 $fname = preg_replace('/[^a-z0-9\.\-_]/i', '', $_SERVER['HTTP_HOST']) . '.inc.php'; 206 199 } 207 if ($fname && is_file('config/' .$fname)) {208 include('config/' .$fname);200 if ($fname && is_file('config/' . $fname)) { 201 include('config/' . $fname); 209 202 $config = array_merge($config, $rcmail_config); 210 203 } … … 386 379 387 380 // return table name if configured 388 $config_key = 'db_table_' .$table;381 $config_key = 'db_table_' . $table; 389 382 390 383 if (strlen($CONFIG[$config_key])) { … … 403 396 404 397 // return table name if configured 405 $config_key = 'db_sequence_' .$sequence;398 $config_key = 'db_sequence_' . $sequence; 406 399 407 400 if (strlen($CONFIG[$config_key])) { … … 534 527 535 528 536 // auto-select IMAP host based on the posted login information 529 /** 530 * auto-select IMAP host based on the posted login information 531 * 532 * @access static 533 * @link ./index.php 534 * @todo Remove reference to $_POST superglobal. 535 */ 537 536 static function rcmail_autoselect_host() 538 537 { … … 540 539 $CONFIG = $registry->get('CONFIG', 'core'); 541 540 542 $host = isset($_POST['_host']) ? self::get_input_value('_host', RCUBE_INPUT_POST) : $CONFIG['default_host']; 541 $host = ''; 542 if (isset($_POST['_host']) && empty($_POST['_host']) === false) { 543 $host .= self::get_input_value('_host', RCUBE_INPUT_POST); 544 } 545 else { 546 $host .= $CONFIG['default_host']; 547 } 548 //self::tfk_debug('/ POST: ' . $_POST['_host']); 549 //self::tfk_debug('/ default host: ' . var_export($CONFIG['default_host'], true)); 550 543 551 if (is_array($host)) { 544 552 list($user, $domain) = explode('@', self::get_input_value('_user', RCUBE_INPUT_POST)); … … 557 565 } 558 566 } 567 self::tfk_debug($host); 559 568 return $host; 560 569 } … … 1180 1189 // encode for HTML output 1181 1190 if ($enctype=='html') { 1182 if (is_null($html_encode_arr)) { 1191 1192 //self::tfk_debug('/ html :-)'); 1193 1194 if (empty($html_encode_arr)) { 1183 1195 $html_encode_arr = get_html_translation_table(HTML_SPECIALCHARS); 1184 1196 unset($html_encode_arr['?']); 1185 $registry->set('html_encode_arr', $html_encode_arr, 'core'); 1197 $registry->set( 1198 'html_encode_arr', 1199 $html_encode_arr, 1200 'core' 1201 ); 1186 1202 } 1187 1203 1188 1204 $ltpos = strpos($str, '<'); 1189 1205 $encode_arr = $html_encode_arr; 1206 1207 //self::tfk_debug(var_export($encode_arr, true)); 1190 1208 1191 1209 // don't replace quotes and html tags … … 1216 1234 } 1217 1235 // if the replace tables for XML and JS are not yet defined 1218 if ( is_null($js_rep_table)) {1236 if (empty($js_rep_table)) { 1219 1237 $js_rep_table = $xml_rep_table = array(); 1220 1238 $xml_rep_table['&'] = '&'; … … 1293 1311 $registry = rc_registry::getInstance(); 1294 1312 $OUTPUT = $registry->get('OUTPUT', 'core'); 1295 $value = NULL;1313 $value = NULL; 1296 1314 1297 1315 if ($source == RCUBE_INPUT_GET && isset($_GET[$fname])) { … … 1302 1320 } 1303 1321 else if ($source == RCUBE_INPUT_GPC) { 1304 if (isset($_POST[$fname])) 1322 if (isset($_POST[$fname])) { 1305 1323 $value = $_POST[$fname]; 1306 else if (isset($_GET[$fname])) 1324 } 1325 else if (isset($_GET[$fname])) { 1307 1326 $value = $_GET[$fname]; 1308 else if (isset($_COOKIE[$fname])) 1327 } 1328 else if (isset($_COOKIE[$fname])) { 1309 1329 $value = $_COOKIE[$fname]; 1330 } 1310 1331 } 1311 1332 … … 1323 1344 } 1324 1345 return $value; 1325 }1346 } 1326 1347 1327 1348 /** -
branches/devel-vnext/program/include/rcmail_template.inc
r622 r623 76 76 } 77 77 78 /*79 // PHP 4 compatibility80 function rcmail_template(&$config, $task)81 {82 $this->__construct($config, $task);83 }*/84 85 86 78 /** 87 79 * Set environment variable … … 221 213 222 214 // send response code 223 printrcube_charset_convert($this->get_js_commands() . $add, RCMAIL_CHARSET, $this->get_charset());215 echo rc_main::rcube_charset_convert($this->get_js_commands() . $add, RCMAIL_CHARSET, $this->get_charset()); 224 216 225 217 if ($flush) // flush the output buffer … … 348 340 function parse_with_globals($input) 349 341 { 350 $GLOBALS['__comm_path'] = $GLOBALS['COMM_PATH']; 342 $registry = rc_registry::getInstance(); 343 $COMM_PATH = $registry->get('COMM_PATH', 'core'); 344 345 $GLOBALS['__comm_path'] = $COMM_PATH; 351 346 return preg_replace('/\$(__[a-z0-9_\-]+)/e', '$GLOBALS["\\1"]', $input); 352 347 } … … 516 511 function button($attrib) 517 512 { 518 global $CONFIG, $OUTPUT, $BROWSER, $MAIN_TASKS; 513 $registry = rc_registry::getInstance(); 514 $CONFIG = $registry->get('CONFIG', 'core'); 515 $OUTPUT = $registry->get('OUTPUT', 'core'); 516 $BROWSER = $registry->get('BROWSER', 'core'); 517 $MAIN_TASKS = $registry->get('MAIN_TASKS', 'core'); 518 519 519 static $sa_buttons = array(); 520 520 static $s_button_count = 100; … … 607 607 // make valid href to specific buttons 608 608 if (in_array($attrib['command'], $MAIN_TASKS)) { 609 $attrib['href'] = rc_main::Q(rc mail_url(null, null, $attrib['command']));609 $attrib['href'] = rc_main::Q(rc_main::rcmail_url(null, null, $attrib['command'])); 610 610 } 611 611 else if (in_array($attrib['command'], $a_static_commands)) { 612 $attrib['href'] = rc_main::Q(rc mail_url($attrib['command']));612 $attrib['href'] = rc_main::Q(rc_main::rcmail_url($attrib['command'])); 613 613 } 614 614 } … … 660 660 // generate image tag 661 661 if ($attrib['type']=='image') { 662 $attrib_str = create_attrib_string($attrib, array('style', 'class', 'id', 'width', 'height', 'border', 'hspace', 'vspace', 'align', 'alt')); 662 $attrib_str = rc_main::create_attrib_string( 663 $attrib, 664 array( 665 'style', 'class', 'id', 'width', 666 'height', 'border', 'hspace', 667 'vspace', 'align', 'alt' 668 ) 669 ); 663 670 $img_tag = sprintf('<img src="%%s"%s />', $attrib_str); 664 671 $btn_content = sprintf($img_tag, $skin_path.$attrib['image']); … … 678 685 $attrib['value'] = $attrib['label']; 679 686 680 $attrib_str = create_attrib_string($attrib, array('type', 'value', 'onclick', 'id', 'class', 'style')); 687 $attrib_str = rc_main::create_attrib_string( 688 $attrib, 689 array( 690 'type', 'value', 'onclick', 691 'id', 'class', 'style' 692 ) 693 ); 681 694 $out = sprintf('<input%s disabled="disabled" />', $attrib_str); 682 695 } … … 684 697 // generate html code for button 685 698 if ($btn_content) { 686 $attrib_str = create_attrib_string($attrib, $link_attrib);699 $attrib_str = rc_main::create_attrib_string($attrib, $link_attrib); 687 700 $out = sprintf('<a%s>%s</a>', $attrib_str, $btn_content); 688 701 } -
branches/devel-vnext/program/include/rcube/rcmail_compose.php
r606 r623 2 2 /** 3 3 * @todo Create a class. 4 * @todo Get rid off globals.5 4 * @ignore 6 5 */ … … 8 7 function rcmail_compose_headers($attrib) 9 8 { 10 global $IMAP, $MESSAGE, $DB, $compose_mode; 11 static $sa_recipients = array(); 9 $registry = rc_registry::getInstance(); 10 $IMAP = $registry->get('IMAP', 'core'); 11 $MESSAGE = $registry->get('MESSAGE', 'core'); 12 $DB = $registry->get('DB', 'core'); 13 $compose_mode = $registry->get('compose_mode', 'core'); 14 $sa_recipients = $registry->get('sa_recipients', 'core'); 15 16 if (is_null($sa_recipients)) { 17 $sa_recipients = array(); 18 } 12 19 13 20 list($form_start, $form_end) = get_form_tags($attrib); … … 25 32 26 33 // we have a set of recipients stored is session 27 if (($mailto_id = get_input_value('_mailto', RCUBE_INPUT_GET)) && $_SESSION['mailto'][$mailto_id]) {34 if (($mailto_id = rc_main::get_input_value('_mailto', RCUBE_INPUT_GET)) && $_SESSION['mailto'][$mailto_id]) { 28 35 $fvalue = $_SESSION['mailto'][$mailto_id]; 29 36 } 30 37 elseif (!empty($_GET['_to'])) { 31 $fvalue = get_input_value('_to', RCUBE_INPUT_GET);38 $fvalue = rc_main::get_input_value('_to', RCUBE_INPUT_GET); 32 39 } 33 40 … … 65 72 66 73 if ($fname && !empty($_POST[$fname])) { 67 $fvalue = get_input_value($fname, RCUBE_INPUT_POST, TRUE);74 $fvalue = rc_main::get_input_value($fname, RCUBE_INPUT_POST, TRUE); 68 75 } 69 76 else if ($header && $compose_mode == RCUBE_COMPOSE_REPLY) { … … 127 134 $out = $form_start.$out; 128 135 } 136 137 $registry->set('sa_recipients', $sa_recipients, 'core'); 138 129 139 return $out; 130 140 } … … 132 142 133 143 134 function rcmail_compose_header_from($attrib) { 135 global $IMAP, $MESSAGE, $DB, $OUTPUT, $compose_mode; 144 function rcmail_compose_header_from($attrib) 145 { 146 $registry = rc_registry::getInstance(); 147 $MESSAGE = $registry->get('MESSAGE', 'core'); 148 $DB = $registry->get('DB', 'core'); 149 $compose_mode = $registry->get('compose_mode', 'core'); 150 $OUTPUT = $registry->get('OUTPUT', 'core'); 136 151 137 152 // pass the following attributes to the form class … … 166 181 // get this user's identities 167 182 $_query = "SELECT identity_id, name, email, signature, html_signature"; 168 $_query.= " FROM " . get_table_name('identities');183 $_query.= " FROM " . rc_main::get_table_name('identities'); 169 184 $_query.= " WHERE user_id=?"; 170 185 $_query.= " AND del<>1"; … … 193 208 while ($sql_arr = $DB->fetch_assoc($sql_result)) { 194 209 $identity_id = $sql_arr['identity_id']; 195 $select_from->add( format_email_recipient($sql_arr['email'], $sql_arr['name']), $identity_id);210 $select_from->add(rc_main::format_email_recipient($sql_arr['email'], $sql_arr['name']), $identity_id); 196 211 197 212 // add signature to array … … 220 235 // overwrite identity selection with post parameter 221 236 if (isset($_POST['_from'])) { 222 $from_id = get_input_value('_from', RCUBE_INPUT_POST);237 $from_id = rc_main::get_input_value('_from', RCUBE_INPUT_POST); 223 238 } 224 239 $out = $select_from->show($from_id); … … 235 250 236 251 237 function rcmail_compose_body($attrib) { 238 global $CONFIG, $OUTPUT, $MESSAGE, $compose_mode; 252 function rcmail_compose_body($attrib) 253 { 254 $registry = rc_registry::getInstance(); 255 $CONFIG = $registry->get('CONFIG', 'core'); 256 $MESSAGE = $registry->get('MESSAGE', 'core'); 257 $OUTPUT = $registry->get('OUTPUT', 'core'); 258 $compose_mode = $registry->get('compose_mode', 'core'); 259 $COMM_PATH = $registry->get('COMM_PATH', 'core'); 239 260 240 261 list($form_start, $form_end) = get_form_tags($attrib); … … 256 277 // use posted message body 257 278 if (!empty($_POST['_message'])) { 258 $body = get_input_value('_message', RCUBE_INPUT_POST, TRUE);279 $body = rc_main::get_input_value('_message', RCUBE_INPUT_POST, TRUE); 259 280 } 260 281 // compose reply-body … … 291 312 } 292 313 else { 293 $body = rcmail_first_text_part($MESSAGE);314 $body = rcmail_first_text_part($MESSAGE); 294 315 $isHtml = false; 295 316 } … … 342 363 "googie.decorateTextarea('%s');\n". 343 364 "%s.set_env('spellcheck', googie);", 344 $ GLOBALS['COMM_PATH'],345 JQ(Q(rcube_label('checkspelling'))),346 JQ(Q(rcube_label('resumeediting'))),347 JQ(Q(rcube_label('close'))),348 JQ(Q(rcube_label('revertto'))),349 JQ(Q(rcube_label('nospellerrors'))),365 $COMM_PATH, 366 rc_main::JQ(rc_main::Q(rcube_label('checkspelling'))), 367 rc_main::JQ(rc_main::Q(rcube_label('resumeediting'))), 368 rc_main::JQ(rc_main::Q(rcube_label('close'))), 369 rc_main::JQ(rc_main::Q(rcube_label('revertto'))), 370 rc_main::JQ(rc_main::Q(rcube_label('nospellerrors'))), 350 371 $lang_set, 351 372 substr($_SESSION['user_lang'], 0, 2), … … 353 374 JS_OBJECT_NAME), 'foot' 354 375 ); 355 rc ube_add_label('checking');376 rc_main::rcube_add_label('checking'); 356 377 } 357 378 $out .= "\n".'<iframe name="savetarget" src="program/blank.gif" style="width:0;height:0;visibility:hidden;"></iframe>'; … … 370 391 function rcmail_create_reply_body($body, $bodyIsHtml) 371 392 { 372 global $IMAP, $MESSAGE; 393 $registry = rc_registry::getInstance(); 394 $IMAP = $registry->get('IMAP', 'core'); 395 $MESSAGE = $registry->get('MESSAGE', 'core'); 373 396 374 397 $_date = $MESSAGE['headers']->date; … … 428 451 function rcmail_create_forward_body($body, $bodyIsHtml) 429 452 { 430 global $IMAP, $MESSAGE; 453 $registry = rc_registry::getInstance(); 454 $IMAP = $registry->get('IMAP', 'core'); 455 $MESSAGE = $registry->get('MESSAGE', 'core'); 431 456 432 457 … … 474 499 function rcmail_create_draft_body($body, $bodyIsHtml) 475 500 { 476 global $IMAP, $MESSAGE; 501 $registry = rc_registry::getInstance(); 502 $IMAP = $registry->get('IMAP', 'core'); 503 $MESSAGE = $registry->get('MESSAGE', 'core'); 477 504 478 505 // add attachments … … 490 517 function rcmail_write_compose_attachments(&$message) 491 518 { 492 global $IMAP, $CONFIG; 519 $registry = rc_registry::getInstance(); 520 $CONFIG = $registry->get('CONFIG', 'core'); 521 $IMAP = $registry->get('IMAP', 'core'); 493 522 494 523 $temp_dir = unslashify($CONFIG['temp_dir']); … … 538 567 function rcmail_compose_subject($attrib) 539 568 { 540 global $CONFIG, $MESSAGE, $compose_mode; 569 $registry = rc_registry::getInstance(); 570 $CONFIG = $registry->get('CONFIG', 'core'); 571 $MESSAGE = $registry->get('MESSAGE', 'core'); 572 $compose_mode = $registry->get('compose_mode', 'core'); 541 573 542 574 list($form_start, $form_end) = get_form_tags($attrib); … … 552 584 // use subject from post 553 585 if (isset($_POST['_subject'])) { 554 $subject = get_input_value('_subject', RCUBE_INPUT_POST, TRUE);586 $subject = rc_main::get_input_value('_subject', RCUBE_INPUT_POST, TRUE); 555 587 } 556 588 // create a reply-subject … … 593 625 function rcmail_compose_attachment_list($attrib) 594 626 { 595 global $OUTPUT, $CONFIG; 627 $registry = rc_registry::getInstance(); 628 $CONFIG = $registry->get('CONFIG', 'core'); 629 $OUTPUT = $registry->get('OUTPUT', 'core'); 596 630 597 631 // add ID if not given … … 600 634 } 601 635 // allow the following attributes to be added to the <ul> tag 602 $attrib_str = create_attrib_string($attrib, array('id', 'class', 'style'));636 $attrib_str = rc_main::create_attrib_string($attrib, array('id', 'class', 'style')); 603 637 604 638 $out = '<ul'. $attrib_str . ">\n"; … … 642 676 function rcmail_compose_attachment_form($attrib) 643 677 { 644 global $OUTPUT, $SESS_HIDDEN_FIELD; 678 $registry = rc_registry::getInstance(); 679 $OUTPUT = $registry->get('OUTPUT', 'core'); 680 $SESS_HIDDEN_FIELD = $registry->get('SESS_HIDDEN_FIELD', 'core'); 645 681 646 682 // add ID if not given … … 649 685 } 650 686 // allow the following attributes to be added to the <div> tag 651 $attrib_str =create_attrib_string($attrib, array('id', 'class', 'style'));687 $attrib_str = rc_main::create_attrib_string($attrib, array('id', 'class', 'style')); 652 688 $input_field = rcmail_compose_attachment_field(array('style="height:15px;"')); 653 $label_send = rcube_label('upload');689 $label_send = rcube_label('upload'); 654 690 $label_close = rcube_label('close'); 655 691 $js_instance = JS_OBJECT_NAME; … … 680 716 { 681 717 // allow the following attributes to be added to the <input> tag 682 $attrib_str = create_attrib_string($attrib, array('id', 'class', 'style', 'size'));718 $attrib_str = rc_main::create_attrib_string($attrib, array('id', 'class', 'style', 'size')); 683 719 684 720 $out = '<input type="file" name="_attachments[]"'. $attrib_str . " />"; … … 734 770 function rcmail_editor_selector($attrib) 735 771 { 736 global $CONFIG, $MESSAGE, $compose_mode; 772 $registry = rc_registry::getInstance(); 773 $CONFIG = $registry->get('CONFIG', 'core'); 774 $MESSAGE = $registry->get('MESSAGE', 'core'); 775 $compose_mode = $registry->get('compose_mode', 'core'); 737 776 738 777 $choices = array( … … 782 821 function get_form_tags($attrib) 783 822 { 784 global $CONFIG, $OUTPUT, $MESSAGE_FORM, $SESS_HIDDEN_FIELD; 823 $registry = rc_registry::getInstance(); 824 $CONFIG = $registry->get('CONFIG', 'core'); 825 $MESSAGE_FORM = $registry->get('MESSAGE_FORM', 'core'); 826 $OUTPUT = $registry->get('OUTPUT', 'core'); 827 $SESS_HIDDEN_FIELD = $registry->get('SESS_HIDDEN_FIELD', 'core'); 785 828 786 829 $form_start = ''; … … 797 840 $form_name = !empty($attrib['form']) ? $attrib['form'] : 'form'; 798 841 799 if (!strlen($MESSAGE_FORM)) 842 if (!strlen($MESSAGE_FORM)) { 800 843 $OUTPUT->add_gui_object('messageform', $form_name); 801 844 } 802 845 $MESSAGE_FORM = $form_name; 803 846 847 $registry->set('MESSAGE_FORM', $MESSAGE_FORM, 'core'); 848 804 849 return array($form_start, $form_end); 805 850 } -
branches/devel-vnext/program/include/rcube/rcmail_send.php
r592 r623 17 17 function get_identity($id) 18 18 { 19 global $DB, $OUTPUT; 19 $registry = rc_registry::getInstance(); 20 $DB = $registry->get('DB', 'core'); 21 $OUTPUT = $registry->get('OUTPUT', 'core'); 20 22 21 23 // get identity record … … 26 28 $_query.= " AND del<>1"; 27 29 28 tfk_debug('Identity: ' . $_query);30 rc_main::tfk_debug('Identity: ' . $_query); 29 31 30 32 $sql_result = $DB->query($_query, $id, $_SESSION['user_id']); … … 38 40 $out['string'] = sprintf( 39 41 '%s <%s>', 40 rc ube_charset_convert($name, RCMAIL_CHARSET, $OUTPUT->get_charset()),42 rc_main::rcube_charset_convert($name, RCMAIL_CHARSET, $OUTPUT->get_charset()), 41 43 $sql_arr['mailto'] 42 44 ); … … 61 63 function attach_emoticons(&$mime_message) 62 64 { 63 global $CONFIG, $INSTALL_PATH; 65 $registry = rc_registry::getInstance(); 66 $INSTALL_PATH = $registry->get('INSTALL_PATH', 'core'); 67 $CONFIG = $registry->get('CONFIG', 'core'); 64 68 65 69 $htmlContents = $mime_message->getHtmlBody(); -
branches/devel-vnext/program/include/rcube_contacts.inc
r589 r623 22 22 class rcube_contacts 23 23 { 24 var $db = null;25 var $db_name = '';26 var $user_id = 0;27 var $filter = null;28 var $result = null;29 var $search_fields;30 var $search_string;31 var $table_cols = array('name', 'email', 'firstname', 'surname');32 33 /** public properties */34 var $primary_key = 'contact_id';35 var $readonly = false;36 var $list_page = 1;37 var $page_size = 10;38 var $ready = false;39 40 41 /**42 * Object constructor43 *44 * @param object Instance of the rcube_db class45 * @param integer User-ID46 */47 function __construct($dbconn, $user)48 {49 $this->db = $dbconn;50 $this->db_name =get_table_name('contacts');51 $this->user_id = $user;52 $this->ready = $this->db && !$this->db->is_error();53 }24 var $db = null; 25 var $db_name = ''; 26 var $user_id = 0; 27 var $filter = null; 28 var $result = null; 29 var $search_fields; 30 var $search_string; 31 var $table_cols = array('name', 'email', 'firstname', 'surname'); 32 33 /** public properties */ 34 var $primary_key = 'contact_id'; 35 var $readonly = false; 36 var $list_page = 1; 37 var $page_size = 10; 38 var $ready = false; 39 40 41 /** 42 * Object constructor 43 * 44 * @param object Instance of the rcube_db class 45 * @param integer User-ID 46 */ 47 function __construct($dbconn, $user) 48 { 49 $this->db = $dbconn; 50 $this->db_name = rc_main::get_table_name('contacts'); 51 $this->user_id = $user; 52 $this->ready = $this->db && !$this->db->is_error(); 53 } 54 54 55 55 /** … … 97 97 $this->filter = $filter; 98 98 } 99 100 99 100 101 101 /** 102 102 * Getter for saved search properties … … 120 120 $this->search_string = null; 121 121 } 122 123 122 123 124 124 /** 125 125 * List the current set of contact records … … 139 139 $start_row = $subset < 0 ? $this->result->first + $this->page_size + $subset : $this->result->first; 140 140 $length = $subset != 0 ? abs($subset) : $this->page_size; 141 141 142 142 $sql_result = $this->db->limitquery( 143 143 "SELECT * FROM ".$this->db_name." … … 150 150 $this->user_id); 151 151 } 152 152 153 153 while ($sql_result && ($sql_arr = $this->db->fetch_assoc($sql_result))) 154 154 { … … 159 159 $this->result->add($sql_arr); 160 160 } 161 161 162 162 return $this->result; 163 163 } … … 176 176 if (!is_array($fields)) 177 177 $fields = array($fields); 178 178 179 179 $add_where = array(); 180 180 foreach ($fields as $col) … … 188 188 $add_where[] = $this->db->quoteIdentifier($col)." LIKE ".$this->db->quote(strlen($value)>2 ? "%$value%" : "$value%"); 189 189 } 190 190 191 191 if (!empty($add_where)) 192 192 { … … 197 197 $this->result = $this->count(); 198 198 } 199 200 return $this->result; 199 200 return $this->result; 201 201 } 202 202 … … 232 232 return $this->result; 233 233 } 234 235 234 235 236 236 /** 237 237 * Get a specific contact record … … 245 245 if ($this->result && ($first = $this->result->first()) && $first[$this->primary_key] == $id) 246 246 return $assoc ? $first : $this->result; 247 247 248 248 $this->db->query( 249 249 "SELECT * FROM ".$this->db_name." … … 263 263 return $assoc && $sql_arr ? $sql_arr : $this->result; 264 264 } 265 266 265 266 267 267 /** 268 268 * Create a new contact record … … 271 271 * @return The created record ID on success, False on error 272 272 */ 273 function insert($save_data, $check=false) 274 { 275 if (is_object($save_data) && is_a($save_data, rcube_result_set)) 276 return $this->insert_recset($save_data, $check); 277 278 $insert_id = $existing = false; 279 280 if ($check) 281 $existing = $this->search('email', $save_data['email'], false); 282 283 $a_insert_cols = $a_insert_values = array(); 284 foreach ($this->table_cols as $col) 285 if (isset($save_data[$col])) 286 { 287 $a_insert_cols[] = $this->db->quoteIdentifier($col); 288 $a_insert_values[] = $this->db->quote($save_data[$col]); 289 } 290 291 if (!$existing->count && !empty($a_insert_cols)) 292 { 293 $this->db->query( 294 "INSERT INTO ".$this->db_name." 295 (user_id, changed, del, ".join(', ', $a_insert_cols).") 296 VALUES (?, ".$this->db->now().", 0, ".join(', ', $a_insert_values).")", 297 $this->user_id); 298 299 $insert_id = $this->db->insert_id(get_sequence_name('contacts')); 300 } 301 302 return $insert_id; 273 function insert($save_data, $check=false) 274 { 275 if (is_object($save_data) && is_a($save_data, rcube_result_set)) { 276 return $this->insert_recset($save_data, $check); 277 } 278 $insert_id = $existing = false; 279 280 if ($check) { 281 $existing = $this->search('email', $save_data['email'], false); 282 } 283 $a_insert_cols = $a_insert_values = array(); 284 foreach ($this->table_cols as $col) { 285 if (isset($save_data[$col])) { 286 $a_insert_cols[] = $this->db->quoteIdentifier($col); 287 $a_insert_values[] = $this->db->quote($save_data[$col]); 288 } 289 } 290 291 if (!$existing->count && !empty($a_insert_cols)) { 292 $_query = "INSERT INTO " . $this->db_name; 293 $_query.= " (user_id, changed, del, " . join(', ', $a_insert_cols).")"; 294 $_query.= " VALUES (?, " . $this->db->now() . ", 0, "; 295 $_query.= join(', ', $a_insert_values).")"; 296 $this->db->query($_query, $this->user_id); 297 298 $insert_id = $this->db->insert_id( 299 rc_main::get_sequence_name('contacts') 300 ); 301 } 302 303 return $insert_id; 303 304 } 304 305 … … 317 318 return $ids; 318 319 } 319 320 320 321 321 322 /** 322 323 * Update a specific contact record … … 347 348 $updated = $this->db->affected_rows(); 348 349 } 349 350 350 351 return $updated; 351 352 } 352 353 353 354 354 355 /** 355 356 * Mark one or more contact records as deleted … … 385 386 var $current = 0; 386 387 var $records = array(); 387 388 388 389 function __construct($c=0, $f=0) 389 390 { … … 391 392 $this->first = (int)$f; 392 393 } 393 394 394 395 function rcube_result_set($c=0, $f=0) 395 396 { 396 397 $this->__construct($c, $f); 397 398 } 398 399 399 400 function add($rec) 400 401 { 401 402 $this->records[] = $rec; 402 403 } 403 404 404 405 function iterate() 405 406 { 406 407 return $this->records[$this->current++]; 407 408 } 408 409 409 410 function first() 410 411 { … … 412 413 return $this->records[$this->current++]; 413 414 } 414 415 415 416 // alias 416 417 function next() … … 418 419 return $this->iterate(); 419 420 } 420 421 421 422 function seek($i) 422 423 { 423 424 $this->current = $i; 424 425 } 425 426 426 427 } 427 428 -
branches/devel-vnext/program/include/rcube_imap.inc
r622 r623 410 410 function _list_mailboxes($root='', $filter='*') 411 411 { 412 global $CONFIG; 412 $registry = rc_registry::getInstance(); 413 $CONFIG = $registry->get('CONFIG', 'core'); 413 414 414 415 $a_defaults = $a_out = array(); … … 941 942 $mbox_name, 942 943 $criteria, 943 rc ube_charset_convert($str, $charset, 'ISO-8859-1'),944 rc_main::rcube_charset_convert($str, $charset, 'ISO-8859-1'), 944 945 'ISO-8859-1' 945 946 ); … … 1278 1279 $o_part->charset = 'ISO-8859-1'; 1279 1280 1280 $body = rc ube_charset_convert($body, $o_part->charset);1281 $body = rc_main::rcube_charset_convert($body, $o_part->charset); 1281 1282 } 1282 1283 } … … 2247 2248 2248 2249 // no encoding information, use fallback 2249 return rc ube_charset_convert($input, !empty($fallback) ? $fallback : 'ISO-8859-1');2250 return rc_main::rcube_charset_convert($input, !empty($fallback) ? $fallback : 'ISO-8859-1'); 2250 2251 } 2251 2252 … … 2275 2276 } 2276 2277 2277 return rc ube_charset_convert($rest, $a[0]);2278 return rc_main::rcube_charset_convert($rest, $a[0]); 2278 2279 } 2279 2280 else … … 2326 2327 { 2327 2328 if (is_array($ctype_param) && !empty($ctype_param['charset'])) 2328 return rc ube_charset_convert($body, $ctype_param['charset']);2329 return rc_main::rcube_charset_convert($body, $ctype_param['charset']); 2329 2330 2330 2331 // defaults to what is specified in the class header 2331 return rc ube_charset_convert($body, 'ISO-8859-1');2332 return rc_main::rcube_charset_convert($body, 'ISO-8859-1'); 2332 2333 } 2333 2334 -
branches/devel-vnext/program/include/rcube_shared.inc
r622 r623 228 228 // send HTTP header for no-cacheing steps 229 229 function send_nocacheing_headers() 230 {231 if (headers_sent())232 return;233 234 header("Expires: ".gmdate("D, d M Y H:i:s")." GMT");235 header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");236 header("Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0");237 header("Pragma: no-cache");238 }230 { 231 if (headers_sent()) { 232 return; 233 } 234 header("Expires: ".gmdate("D, d M Y H:i:s")." GMT"); 235 header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); 236 header("Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0"); 237 header("Pragma: no-cache"); 238 } 239 239 240 240 … … 254 254 function send_modified_header($mdate, $etag=null) 255 255 { 256 if (headers_sent()) 257 return; 258 259 $iscached = false; 260 if ($_SERVER['HTTP_IF_MODIFIED_SINCE'] && strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']) >= $mdate) 261 $iscached = true; 262 263 $etag = $etag ? "\"$etag\"" : null; 264 if ($etag && $_SERVER['HTTP_IF_NONE_MATCH'] == $etag) 265 $iscached = true; 266 267 if ($iscached) 268 header("HTTP/1.x 304 Not Modified"); 269 else 270 header("Last-Modified: ".gmdate("D, d M Y H:i:s", $mdate)." GMT"); 271 272 header("Cache-Control: max-age=0"); 273 header("Expires: "); 274 header("Pragma: "); 275 276 if ($etag) 277 header("Etag: $etag"); 278 279 if ($iscached) 280 exit; 256 if (headers_sent()) { 257 rc_main::tfk_debug("/ Headerz sent?!"); 258 return; 259 } 260 $iscached = false; 261 if ( 262 $_SERVER['HTTP_IF_MODIFIED_SINCE'] 263 && strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']) >= $mdate 264 ) { 265 $iscached = true; 266 } 267 268 $etag = $etag ? "\"$etag\"" : null; 269 if ($etag && $_SERVER['HTTP_IF_NONE_MATCH'] == $etag) { 270 $iscached = true; 271 } 272 if ($iscached) { 273 header("HTTP/1.x 304 Not Modified"); 274 } 275 else { 276 header("Last-Modified: ".gmdate("D, d M Y H:i:s", $mdate)." GMT"); 277 } 278 header("Cache-Control: max-age=0"); 279 header("Expires: "); 280 header("Pragma: "); 281 282 if ($etag) { 283 header("Etag: $etag"); 284 } 285 $iscached = FALSE; 286 if ($iscached) { 287 rc_main::tfk_debug("/ serving from cache"); 288 exit; 289 } 281 290 } 282 291 -
branches/devel-vnext/program/include/rcube_smtp.inc
r589 r623 22 22 23 23 // include required PEAR classes 24 require_once ('Net/SMTP.php');24 require_once 'Net/SMTP.php'; 25 25 26 26 … … 28 28 define('SMTP_MIME_CRLF', "\r\n"); 29 29 30 $SMTP_CONN = null;30 $SMTP_CONN = $registry->set('SMTP_CONN', NULL, 'core'); 31 31 32 32 /** … … 51 51 */ 52 52 function smtp_mail($from, $recipients, &$headers, &$body, &$response) 53 { 54 global $SMTP_CONN, $CONFIG; 55 $smtp_timeout = null; 56 $smtp_host = $CONFIG['smtp_server']; 57 $smtp_port = is_numeric($CONFIG['smtp_port']) ? $CONFIG['smtp_port'] : 25; 58 $smtp_host_url = parse_url($CONFIG['smtp_server']); 59 60 // overwrite port 61 if ($smtp_host_url['host'] && $smtp_host_url['port']) 62 { 63 $smtp_host = $smtp_host_url['host']; 64 $smtp_port = $smtp_host_url['port']; 65 } 66 67 // re-write smtp host 68 if ($smtp_host_url['host'] && $smtp_host_url['scheme']) 69 $smtp_host = sprintf('%s://%s', $smtp_host_url['scheme'], $smtp_host_url['host']); 70 71 72 // create Net_SMTP object and connect to server 73 if (!is_object($smtp_conn)) 74 { 75 $helo_host = !empty($_SERVER['server_name']) ? $_SERVER['server_name'] : 'localhost'; 76 $SMTP_CONN = new Net_SMTP($smtp_host, $smtp_port, $helo_host); 77 78 // set debugging 79 if ($CONFIG['debug_level'] & 8) 80 $SMTP_CONN->setDebug(TRUE); 81 82 83 // try to connect to server and exit on failure 84 $result = $SMTP_CONN->connect($smtp_timeout); 85 if (PEAR::isError($result)) 86 { 87 $SMTP_CONN = null; 88 $response[] = "Connection failed: ".$result->getMessage(); 89 return FALSE; 90 } 91 92 // attempt to authenticate to the SMTP server 93 if ($CONFIG['smtp_user'] && $CONFIG['smtp_pass']) 94 { 95 if (strstr($CONFIG['smtp_user'], '%u')) 96 $smtp_user = str_replace('%u', $_SESSION['username'], $CONFIG['smtp_user']); 97 else 98 $smtp_user = $CONFIG['smtp_user']; 99 100 if (strstr($CONFIG['smtp_pass'], '%p')) 101 $smtp_pass = str_replace('%p', decrypt_passwd($_SESSION['password']), $CONFIG['smtp_pass']); 102 else 103 $smtp_pass = $CONFIG['smtp_pass']; 104 105 $smtp_auth_type = empty($CONFIG['smtp_auth_type']) ? NULL : $CONFIG['smtp_auth_type']; 106 $result = $SMTP_CONN->auth($smtp_user, $smtp_pass, $smtp_auth_type); 107 108 if (PEAR::isError($result)) 109 { 110 smtp_reset(); 111 $response[] .= "Authentication failure: ".$result->getMessage(); 112 return FALSE; 113 } 114 } 115 } 116 117 118 // prepare message headers as string 119 if (is_array($headers)) 120 { 121 $headerElements = smtp_prepare_headers($headers); 122 if (!$headerElements) 123 { 124 smtp_reset(); 125 return FALSE; 126 } 127 128 list($from, $text_headers) = $headerElements; 129 } 130 else if (is_string($headers)) 131 $text_headers = $headers; 132 else 133 { 134 smtp_reset(); 135 $response[] .= "Invalid message headers"; 136 return FALSE; 137 } 138 139 // exit if no from address is given 140 if (!isset($from)) 141 { 142 smtp_reset(); 143 $response[] .= "No From address has been provided"; 144 return FALSE; 145 } 146 147 148 // set From: address 149 if (PEAR::isError($SMTP_CONN->mailFrom($from))) 150 { 151 smtp_reset(); 152 $response[] .= "Failed to set sender '$from'"; 153 return FALSE; 154 } 155 156 157 // prepare list of recipients 158 $recipients = smtp_parse_rfc822($recipients); 159 if (PEAR::isError($recipients)) 160 { 161 smtp_reset(); 162 return FALSE; 163 } 164 165 166 // set mail recipients 167 foreach ($recipients as $recipient) 168 { 169 if (PEAR::isError($SMTP_CONN->rcptTo($recipient))) 170 { 171 smtp_reset(); 172 $response[] .= "Failed to add recipient '$recipient'"; 173 return FALSE; 174 } 175 } 176 177 178 // Concatenate headers and body so it can be passed by reference to SMTP_CONN->data 179 // so preg_replace in SMTP_CONN->quotedata will store a reference instead of a copy. 180 // We are still forced to make another copy here for a couple ticks so we don't really 181 // get to save a copy in the method call. 182 $data = $text_headers . "\r\n" . $body; 183 184 // unset old vars to save data and so we can pass into SMTP_CONN->data by reference. 185 unset($text_headers, $body); 186 187 // Send the message's headers and the body as SMTP data. 188 if (PEAR::isError($SMTP_CONN->data($data))) 189 { 190 smtp_reset(); 191 $response[] .= "Failed to send data"; 192 return FALSE; 193 } 194 195 $response[] = join(': ', $SMTP_CONN->getResponse()); 196 return TRUE; 197 } 53 { 54 $registry = rc_registry::getInstance(); 55 $SMTP_CONN = $registry->get('SMTP_CONN', 'core'); 56 $CONFIG = $registry->get('CONFIG', 'core'); 57 58 $smtp_timeout = null; 59 $smtp_host = $CONFIG['smtp_server']; 60 $smtp_port = is_numeric($CONFIG['smtp_port']) ? $CONFIG['smtp_port'] : 25; 61 $smtp_host_url = parse_url($CONFIG['smtp_server']); 62 63 // overwrite port 64 if ($smtp_host_url['host'] && $smtp_host_url['port']) { 65 $smtp_host = $smtp_host_url['host']; 66 $smtp_port = $smtp_host_url['port']; 67 } 68 69 // re-write smtp host 70 if ($smtp_host_url['host'] && $smtp_host_url['scheme']) { 71 $smtp_host = sprintf('%s://%s', $smtp_host_url['scheme'], $smtp_host_url['host']); 72 } 73 74 // create Net_SMTP object and connect to server 75 if (!is_object($smtp_conn)) { 76 $helo_host = !empty($_SERVER['server_name']) ? $_SERVER['server_name'] : 'localhost'; 77 $SMTP_CONN = new Net_SMTP($smtp_host, $smtp_port, $helo_host); 78 79 // set debugging 80 if ($CONFIG['debug_level'] & 8) { 81 $SMTP_CONN->setDebug(TRUE); 82 } 83 $registry->set('SMTP_CONN', $SMTP_CONN, 'core'); 84 85 // try to connect to server and exit on failure 86 $result = $SMTP_CONN->connect($smtp_timeout); 87 if (PEAR::isError($result)) { 88 $SMTP_CONN = $registry->set('SMTP_CONN', null, 'core'); 89 $response[] = "Connection failed: " . $result->getMessage(); 90 return FALSE; 91 } 92 93 // attempt to authenticate to the SMTP server 94 if ($CONFIG['smtp_user'] && $CONFIG['smtp_pass']) { 95 if (strstr($CONFIG['smtp_user'], '%u')) 96 $smtp_user = str_replace('%u', $_SESSION['username'], $CONFIG['smtp_user']); 97 else 98 $smtp_user = $CONFIG['smtp_user']; 99 100 if (strstr($CONFIG['smtp_pass'], '%p')) 101 $smtp_pass = str_replace('%p', decrypt_passwd($_SESSION['password']), $CONFIG['smtp_pass']); 102 else 103 $smtp_pass = $CONFIG['smtp_pass']; 104 105 $smtp_auth_type = empty($CONFIG['smtp_auth_type']) ? NULL : $CONFIG['smtp_auth_type']; 106 $result = $SMTP_CONN->auth($smtp_user, $smtp_pass, $smtp_auth_type); 107 $registry->set('SMTP_CONN', $SMTP_CONN, 'core'); 108 109 if (PEAR::isError($result)) { 110 smtp_reset(); 111 $response[] .= "Authentication failure: ".$result->getMessage(); 112 return FALSE; 113 } 114 } 115 } 116 117 118 // prepare message headers as string 119 if (is_array($headers)) { 120 $headerElements = smtp_prepare_headers($headers); 121 if (!$headerElements) { 122 smtp_reset(); 123 return FALSE; 124 } 125 list($from, $text_headers) = $headerElements; 126 } 127 else if (is_string($headers)) { 128 $text_headers = $headers; 129 } 130 else { 131 smtp_reset(); 132 $response[] .= "Invalid message headers"; 133 return FALSE; 134 } 135 136 // exit if no from address is given 137 if (!isset($from)) { 138 smtp_reset(); 139 $response[] .= "No From address has been provided"; 140 return FALSE; 141 } 142 143 144 // set From: address 145 if (PEAR::isError($SMTP_CONN->mailFrom($from))) { 146 smtp_reset(); 147 $response[] .= "Failed to set sender '$from'"; 148 return FALSE; 149 } 150 $registry->set('SMTP_CONN', $SMTP_CONN, 'core'); 151 152 // prepare list of recipients 153 $recipients = smtp_parse_rfc822($recipients); 154 if (PEAR::isError($recipients)) { 155 smtp_reset(); 156 return FALSE; 157 } 158 159 160 // set mail recipients 161 foreach ($recipients as $recipient) { 162 if (PEAR::isError($SMTP_CONN->rcptTo($recipient))) { 163 smtp_reset(); 164 $response[] .= "Failed to add recipient '$recipient'"; 165 return FALSE; 166 } 167 } 168 169 170 // Concatenate headers and body so it can be passed by reference to SMTP_CONN->data 171 // so preg_replace in SMTP_CONN->quotedata will store a reference instead of a copy. 172 // We are still forced to make another copy here for a couple ticks so we don't really 173 // get to save a copy in the method call. 174 $data = $text_headers . "\r\n" . $body; 175 176 // unset old vars to save data and so we can pass into SMTP_CONN->data by reference. 177 unset($text_headers, $body); 178 179 // Send the message's headers and the body as SMTP data. 180 if (PEAR::isError($SMTP_CONN->data($data))) { 181 smtp_reset(); 182 $response[] .= "Failed to send data"; 183 return FALSE; 184 } 185 186 $response[] = join(': ', $SMTP_CONN->getResponse()); 187 return TRUE; 188 } 198 189 199 190 … … 204 195 */ 205 196 function smtp_reset() 206 {207 global $SMTP_CONN;208 209 if (is_object($SMTP_CONN)) 210 {211 $SMTP_CONN->rset();212 smtp_disconnect();213 } 214 }197 { 198 $registry = rc_registry::getInstance(); 199 $SMTP_CONN = $registry->get('SMTP_CONN', 'core'); 200 201 if (is_object($SMTP_CONN)) { 202 $SMTP_CONN->reset(); 203 smtp_disconnect(); 204 } 205 } 215 206 216 207 … … 221 212 */ 222 213 function smtp_disconnect() 223 {224 global $SMTP_CONN;225 226 if (is_object($SMTP_CONN)) 227 {228 $SMTP_CONN->disconnect();229 $SMTP_CONN = null;230 } 231 }214 { 215 $registry = rc_registry::getInstance(); 216 $SMTP_CONN = $registry->get('SMTP_CONN', 'core'); 217 218 if (is_object($SMTP_CONN)) { 219 $SMTP_CONN->disconnect(); 220 $registry->set('SMTP_CONN', NULL, 'core'); 221 } 222 } 232 223 233 224 … … 249 240 */ 250 241 function smtp_prepare_headers($headers) 251 { 252 $lines = array(); 253 $from = null; 254 255 foreach ($headers as $key => $value) 256 { 257 if (strcasecmp($key, 'From') === 0) 258 { 259 $addresses = smtp_parse_rfc822($value); 260 261 if (is_array($addresses)) 262 $from = $addresses[0]; 263 264 // Reject envelope From: addresses with spaces. 265 if (strstr($from, ' ')) 266 return FALSE; 267 268 269 $lines[] = $key . ': ' . $value; 270 } 271 else if (strcasecmp($key, 'Received') === 0) 272 { 273 $received = array(); 274 if (is_array($value)) 275 { 276 foreach ($value as $line) 277 $received[] = $key . ': ' . $line; 278 } 279 else 280 { 281 $received[] = $key . ': ' . $value; 282 } 283 284 // Put Received: headers at the top. Spam detectors often 285 // flag messages with Received: headers after the Subject: 286 // as spam. 287 $lines = array_merge($received, $lines); 288 } 289 290 else 291 { 292 // If $value is an array (i.e., a list of addresses), convert 293 // it to a comma-delimited string of its elements (addresses). 294 if (is_array($value)) 295 $value = implode(', ', $value); 296 297 $lines[] = $key . ': ' . $value; 298 } 299 } 300 301 return array($from, join(SMTP_MIME_CRLF, $lines) . SMTP_MIME_CRLF); 302 } 242 { 243 $lines = array(); 244 $from = null; 245 246 foreach ($headers as $key => $value) { 247 if (strcasecmp($key, 'From') === 0) { 248 $addresses = smtp_parse_rfc822($value); 249 250 if (is_array($addresses)) { 251 $from = $addresses[0]; 252 } 253 // Reject envelope From: addresses with spaces. 254 if (strstr($from, ' ')) { 255 return FALSE; 256 } 257 $lines[] = $key . ': ' . $value; 258 } 259 else if (strcasecmp($key, 'Received') === 0) { 260 $received = array(); 261 if (is_array($value)) { 262 foreach ($value as $line) { 263 $received[] = $key . ': ' . $line; 264 } 265 } 266 else { 267 $received[] = $key . ': ' . $value; 268 } 269 270 // Put Received: headers at the top. Spam detectors often 271 // flag messages with Received: headers after the Subject: 272 // as spam. 273 $lines = array_merge($received, $lines); 274 } 275 else { 276 // If $value is an array (i.e., a list of addresses), convert 277 // it to a comma-delimited string of its elements (addresses). 278 if (is_array($value)) { 279 $value = implode(', ', $value); 280 } 281 $lines[] = $key . ': ' . $value; 282 } 283 } 284 return array($from, join(SMTP_MIME_CRLF, $lines) . SMTP_MIME_CRLF); 285 } 303 286 304 287 … … 317 300 */ 318 301 function smtp_parse_rfc822($recipients) 319 { 320 // if we're passed an array, assume addresses are valid and implode them before parsing. 321 if (is_array($recipients)) 322 $recipients = implode(', ', $recipients); 323 324 $addresses = array(); 325 $recipients = smtp_explode_quoted_str(",", $recipients); 326 327 reset($recipients); 328 while (list($k, $recipient) = each($recipients)) 329 { 330 $a = explode(" ", $recipient); 331 while (list($k2, $word) = each($a)) 332 { 333 if ((strpos($word, "@") > 0) && (strpos($word, "\"")===false)) 334 { 335 $word = ereg_replace('^<|>$', '', trim($word)); 336 if (in_array($word, $addresses)===false) 337 array_push($addresses, $word); 338 } 339 } 340 } 341 return $addresses; 342 } 302 { 303 // if we're passed an array, assume addresses are valid and implode them before parsing. 304 if (is_array($recipients)) 305 $recipients = implode(', ', $recipients); 306 307 $addresses = array(); 308 $recipients = smtp_explode_quoted_str(",", $recipients); 309 310 reset($recipients); 311 while (list($k, $recipient) = each($recipients)) { 312 $a = explode(" ", $recipient); 313 while (list($k2, $word) = each($a)) { 314 if ((strpos($word, "@") > 0) && (strpos($word, "\"")===false)) { 315 $word = ereg_replace('^<|>$', '', trim($word)); 316 if (in_array($word, $addresses) === FALSE) { 317 array_push($addresses, $word); 318 } 319 } 320 } 321 } 322 return $addresses; 323 } 343 324 344 325 345 326 function smtp_explode_quoted_str($delimiter, $string) 346 { 347 $quotes=explode("\"", $string); 348 while ( list($key, $val) = each($quotes)) 349 if (($key % 2) == 1) 350 $quotes[$key] = str_replace($delimiter, "_!@!_", $quotes[$key]); 327 { 328 $quotes=explode("\"", $string); 329 while ( list($key, $val) = each($quotes)) { 330 if (($key % 2) == 1) { 331 $quotes[$key] = str_replace($delimiter, "_!@!_", $quotes[$key]); 332 } 333 } 351 334 $string=implode("\"", $quotes); 352 335 353 336 $result=explode($delimiter, $string); 354 while (list($key, $val) = each($result)) 355 $result[$key] = str_replace("_!@!_", $delimiter, $result[$key]); 356 357 return $result; 358 } 359 360 337 while (list($key, $val) = each($result)) { 338 $result[$key] = str_replace("_!@!_", $delimiter, $result[$key]); 339 } 340 return $result; 341 } 361 342 ?> -
branches/devel-vnext/program/include/session.inc
r622 r623 42 42 $SESS_CLIENT_IP = $registry->get('SESS_CLIENT_IP', 'core'); 43 43 44 if ($DB->is_error()) 44 if ($DB->is_error()) { 45 45 return FALSE; 46 46 } 47 47 $_query = "SELECT vars, ip, ".$DB->unixtimestamp('changed')." AS changed"; 48 48 $_query.= " FROM " . rc_main::get_table_name('session'); … … 147 147 if (sizeof($a_exp_sessions)) { 148 148 // delete session cache records 149 $DB->query("DELETE FROM ".rc_main::get_table_name('cache')." 150 WHERE session_id IN ('".join("','", $a_exp_sessions)."')"); 149 $_query = "DELETE FROM " . rc_main::get_table_name('cache'); 150 $_query.= " WHERE session_id IN ('" . join("','", $a_exp_sessions) . "')"; 151 $DB->query($_query); 151 152 152 153 // delete session records 153 $DB->query("DELETE FROM ".rc_main::get_table_name('session')." 154 WHERE sess_id IN ('".join("','", $a_exp_sessions)."')"); 154 $_query = "DELETE FROM " . rc_main::get_table_name('session'); 155 $_query.= " WHERE sess_id IN ('" . join("','", $a_exp_sessions) . "')"; 156 $DB->query($_query); 155 157 } 156 158 157 159 // also run message cache GC 158 rcmail_message_cache_gc(); 159 rcmail_temp_gc(); 160 160 rc_main::rcmail_message_cache_gc(); 161 rc_main::rcmail_temp_gc(); 161 162 return TRUE; 162 163 } -
branches/devel-vnext/program/js/app.js
r602 r623 1483 1483 // mark all message rows as read/unread 1484 1484 var icn_src; 1485 if (typeof(this.message_list) == 'undefined') { 1486 return; 1487 } 1485 1488 var rows = this.message_list.rows; 1486 1489 for (var i=0; i<a_uids.length; i++) … … 1901 1904 $(form).attr('enctype', 'multipart/form-data'); 1902 1905 $(form).submit(); 1903 1906 1904 1907 // set reference to the form object 1905 1908 this.gui_objects.attachmentform = form; -
branches/devel-vnext/program/steps/addressbook/edit.inc
r589 r623 21 21 22 22 23 if (($cid = get_input_value('_cid', RCUBE_INPUT_GPC)) && ($record = $CONTACTS->get_record($cid, true)))24 $OUTPUT->set_env('cid', $record['ID']);25 23 if (($cid = rc_main::get_input_value('_cid', RCUBE_INPUT_GPC)) && ($record = $CONTACTS->get_record($cid, true))) { 24 $OUTPUT->set_env('cid', $record['ID']); 25 } 26 26 // adding not allowed here 27 if ($CONTACTS->readonly) 28 { 29 $OUTPUT->show_message('sourceisreadonly'); 30 rcmail_overwrite_action('show'); 31 return; 27 if ($CONTACTS->readonly) { 28 $OUTPUT->show_message('sourceisreadonly'); 29 rcmail_overwrite_action('show'); 30 return; 32 31 } 33 32 34 33 function rcmail_contact_editform($attrib) 35 34 { 36 global $CONTACTS, $OUTPUT; 35 $registry = rc_registry::getInstance(); 36 $CONTACTS = $registry->get('CONTACTS', 'core'); 37 $OUTPUT = $registry->get('OUTPUT', 'core'); 37 38 38 // check if we have a valid result39 if ($GLOBALS['_action'] != 'add' && !(($result = $CONTACTS->get_result()) && ($record = $result->first())))40 {41 $OUTPUT->show_message('contactnotfound');42 return false;43 }39 // check if we have a valid result 40 if ($GLOBALS['_action'] != 'add' && !(($result = $CONTACTS->get_result()) && ($record = $result->first()))) 41 { 42 $OUTPUT->show_message('contactnotfound'); 43 return false; 44 } 44 45 45 // add some labels to client46 rcube_add_label('noemailwarning');47 rcube_add_label('nonamewarning');46 // add some labels to client 47 rcube_add_label('noemailwarning'); 48 rcube_add_label('nonamewarning'); 48 49 49 list($form_start, $form_end) = get_form_tags($attrib);50 unset($attrib['form']);50 list($form_start, $form_end) = get_form_tags($attrib); 51 unset($attrib['form']); 51 52 52 // a specific part is requested 53 if ($attrib['part']) 54 { 55 $out = $form_start; 56 $out .= rcmail_get_edit_field($attrib['part'], $record[$attrib['part']], $attrib); 57 return $out; 58 } 53 // a specific part is requested 54 if ($attrib['part']) { 55 $out = $form_start; 56 $out .= rcmail_get_edit_field($attrib['part'], $record[$attrib['part']], $attrib); 57 return $out; 58 } 59 59 60 60 61 // return the complete address edit form as table62 $out = "$form_start<table>\n\n";61 // return the complete address edit form as table 62 $out = "$form_start<table>\n\n"; 63 63 64 $a_show_cols = array('name', 'firstname', 'surname', 'email');65 foreach ($a_show_cols as $col)66 {67 $attrib['id'] = 'rcmfd_'.$col;68 $value = rcmail_get_edit_field($col, $record[$col], $attrib);69 $out .= sprintf("<tr><td class=\"title\"><label for=\"%s\">%s</label></td><td>%s</td></tr>\n",64 $a_show_cols = array('name', 'firstname', 'surname', 'email'); 65 foreach ($a_show_cols as $col) { 66 $attrib['id'] = 'rcmfd_'.$col; 67 $value = rcmail_get_edit_field($col, $record[$col], $attrib); 68 $out .= sprintf( 69 "<tr><td class=\"title\"><label for=\"%s\">%s</label></td><td>%s</td></tr>\n", 70 70 $attrib['id'], 71 Q(rcube_label($col)), 72 $value); 73 } 74 75 $out .= "\n</table>$form_end"; 76 77 return $out; 71 rc_main::Q(rcube_label($col)), 72 $value 73 ); 74 } 75 $out .= "\n</table>$form_end"; 76 return $out; 78 77 } 79 78 … … 83 82 // similar function as in /steps/settings/edit_identity.inc 84 83 function get_form_tags($attrib) 85 { 86 global $CONTACTS, $OUTPUT, $EDIT_FORM, $SESS_HIDDEN_FIELD; 84 { 85 $registry = rc_registry::getInstance(); 86 $CONTACTS = $registry->get('CONTACTS', 'core'); 87 $OUTPUT = $registry->get('OUTPUT', 'core'); 88 $EDIT_FORM = $registry->get('EDIT_FORM', 'core'); 89 $SESS_HIDDEN_FIELD = $registry->get('SESS_HIDDEN_FIELD', 'core'); 87 90 88 $result = $CONTACTS->get_result(); 89 $form_start = ''; 90 if (!strlen($EDIT_FORM)) 91 { 92 $hiddenfields = new hiddenfield(array('name' => '_task', 'value' => $GLOBALS['_task'])); 93 $hiddenfields->add(array('name' => '_action', 'value' => 'save', 'source' => get_input_value('_source', RCUBE_INPUT_GPC))); 91 $result = $CONTACTS->get_result(); 92 $form_start = ''; 93 if (!strlen($EDIT_FORM)) { 94 $hiddenfields = new hiddenfield(array('name' => '_task', 'value' => $GLOBALS['_task'])); 95 $hiddenfields->add( 96 array( 97 'name' => '_action', 98 'value' => 'save', 99 'source' => rc_main::get_input_value('_source', RCUBE_INPUT_GPC) 100 ) 101 ); 94 102 95 if (($result = $CONTACTS->get_result()) && ($record = $result->first()))96 $hiddenfields->add(array('name' => '_cid', 'value' => $record['ID']));97 98 $form_start= !strlen($attrib['form']) ? '<form name="form" action="./" method="post">' : '';99 $form_start .= "\n$SESS_HIDDEN_FIELD\n";100 $form_start .= $hiddenfields->show();103 if (($result = $CONTACTS->get_result()) && ($record = $result->first())) { 104 $hiddenfields->add(array('name' => '_cid', 'value' => $record['ID'])); 105 } 106 $form_start = !strlen($attrib['form']) ? '<form name="form" action="./" method="post">' : ''; 107 $form_start .= "\n$SESS_HIDDEN_FIELD\n"; 108 $form_start .= $hiddenfields->show(); 101 109 } 102 110 103 $form_end= (strlen($EDIT_FORM) && !strlen($attrib['form'])) ? '</form>' : '';104 $form_name = strlen($attrib['form']) ? $attrib['form'] : 'form';111 $form_end = (strlen($EDIT_FORM) && !strlen($attrib['form'])) ? '</form>' : ''; 112 $form_name = strlen($attrib['form']) ? $attrib['form'] : 'form'; 105 113 106 if (!strlen($EDIT_FORM)) 107 $OUTPUT->add_gui_object('editform', $form_name); 108 109 $EDIT_FORM = $form_name; 114 if (!strlen($EDIT_FORM)) { 115 $OUTPUT->add_gui_object('editform', $form_name); 116 } 117 $EDIT_FORM = $form_name; 118 $registry->set('EDIT_FORM', $EDIT_FORM, 'core'); 110 119 111 return array($form_start, $form_end);112 }120 return array($form_start, $form_end); 121 } 113 122 114 123 115 124 116 if (!$CONTACTS->get_result() && template_exists('addcontact')) 117 parse_template('addcontact');118 125 if (!$CONTACTS->get_result() && template_exists('addcontact')) { 126 rc_main::parse_template('addcontact'); 127 } 119 128 // this will be executed if no template for addcontact exists 120 parse_template('editcontact');129 rc_main::parse_template('editcontact'); 121 130 ?> -
branches/devel-vnext/program/steps/addressbook/func.inc
r589 r623 20 20 */ 21 21 22 require_once ('include/rcube_contacts.inc');23 require_once ('include/rcube_ldap.inc');22 require_once 'include/rcube_contacts.inc'; 23 require_once 'include/rcube_ldap.inc'; 24 24 25 25 // instantiate a contacts object according to the given source … … 72 72 73 73 // allow the following attributes to be added to the <ul> tag 74 $out = '<ul' . create_attrib_string($attrib, array('style', 'class', 'id')) . ">\n";74 $out = '<ul' . rc_main::create_attrib_string($attrib, array('style', 'class', 'id')) . ">\n"; 75 75 $out .= sprintf($line_templ, 76 76 'rcmli'.$local_id, 77 77 !$current ? 'selected' : '', 78 Q(rcmail_url('list', array('_source' => 0))),78 rc_main::Q(rc_main::rcmail_url('list', array('_source' => 0))), 79 79 JS_OBJECT_NAME, 80 80 $local_id, … … 89 89 foreach ((array)$CONFIG['ldap_public'] as $id => $prop) 90 90 { 91 $js_id = JQ($id);91 $js_id = rc_main_::JQ($id); 92 92 $dom_id = preg_replace('/[^a-z0-9\-_]/i', '', $id); 93 93 $out .= sprintf($line_templ, 94 94 'rcmli'.$dom_id, 95 95 $current == $id ? 'selected' : '', 96 Q(rcmail_url('list', array('_source' => $id))),97 JS_OBJECT_NAME, 98 $js_id, 99 JS_OBJECT_NAME, 100 $js_id, 101 JS_OBJECT_NAME, 102 $js_id, 103 JS_OBJECT_NAME, 104 $js_id, 105 !empty($prop['name']) ? Q($prop['name']) :Q($id));96 rc_main::Q(rc_main::rcmail_url('list', array('_source' => $id))), 97 JS_OBJECT_NAME, 98 $js_id, 99 JS_OBJECT_NAME, 100 $js_id, 101 JS_OBJECT_NAME, 102 $js_id, 103 JS_OBJECT_NAME, 104 $js_id, 105 !empty($prop['name']) ? rc_main::Q($prop['name']) : rc_main::Q($id)); 106 106 } 107 107 … … 177 177 178 178 $attrib['name'] = $attrib['id']; 179 $attrib_str = create_attrib_string($attrib, array('name', 'id', 'class', 'style', 'src', 'width', 'height', 'frameborder'));179 $attrib_str = rc_main::create_attrib_string($attrib, array('name', 'id', 'class', 'style', 'src', 'width', 'height', 'frameborder')); 180 180 181 181 $OUTPUT->set_env('contentframe', $attrib['name']); … … 195 195 196 196 // allow the following attributes to be added to the <span> tag 197 $attrib_str = create_attrib_string($attrib, array('style', 'class', 'id'));197 $attrib_str = rc_main::create_attrib_string($attrib, array('style', 'class', 'id')); 198 198 199 199 $out = '<span' . $attrib_str . '>'; -
branches/devel-vnext/program/steps/addressbook/mailto.inc
r589 r623 20 20 */ 21 21 22 $cid =get_input_value('_cid', RCUBE_INPUT_GET);22 $cid = rc_main::get_input_value('_cid', RCUBE_INPUT_GET); 23 23 $recipients = null; 24 $mailto = array();24 $mailto = array(); 25 25 26 if ($cid && preg_match('/^[a-z0-9\-_=]+(,[a-z0-9\-_=]+)*$/i', $cid) && $CONTACTS->ready) 27 { 28 $recipients = $CONTACTS->search($CONTACTS->primary_key, $cid); 26 if ($cid && preg_match('/^[a-z0-9\-_=]+(,[a-z0-9\-_=]+)*$/i', $cid) && $CONTACTS->ready) { 27 $recipients = $CONTACTS->search($CONTACTS->primary_key, $cid); 29 28 30 while (is_object($recipients) && ($rec = $recipients->iterate())) 31 $mailto[] = format_email_recipient($rec['email'], $rec['name']); 29 while (is_object($recipients) && ($rec = $recipients->iterate())) { 30 $mailto[] = rc_main::format_email_recipient($rec['email'], $rec['name']); 31 } 32 32 } 33 33 34 if (!empty($mailto)) 35 { 36 $mailto_str = join(', ', $mailto); 37 $mailto_id = substr(md5($mailto_str), 0, 16); 38 $_SESSION['mailto'][$mailto_id] = $mailto_str; 39 $OUTPUT->command('redirect', rcmail_url('compose', array('_mailto' => $mailto_id), 'mail')); 34 if (!empty($mailto)) { 35 $mailto_str = join(', ', $mailto); 36 $mailto_id = substr(md5($mailto_str), 0, 16); 37 $_SESSION['mailto'][$mailto_id] = $mailto_str; 38 $OUTPUT->command('redirect', rc_main::rcmail_url('compose', array('_mailto' => $mailto_id), 'mail')); 40 39 } 41 else 42 $OUTPUT->show_message('nocontactsfound', 'warning'); 43 44 40 else { 41 $OUTPUT->show_message('nocontactsfound', 'warning'); 42 } 45 43 // send response 46 44 $OUTPUT->send(); 47 48 45 ?> -
branches/devel-vnext/program/steps/mail/check_recent.inc
r610 r623 20 20 */ 21 21 22 tfk_debug('About to get some mailboxes.');22 rc_main::tfk_debug('About to get some mailboxes.'); 23 23 24 24 $a_mailboxes = $IMAP->list_mailboxes(); 25 25 26 tfk_debug('Mailboxes: ' . var_export($a_mailboxes, true));26 rc_main::tfk_debug('Mailboxes: ' . var_export($a_mailboxes, true)); 27 27 28 28 foreach ($a_mailboxes as $mbox_name) { -
branches/devel-vnext/program/steps/mail/compose.inc
r592 r623 35 35 $status = @unlink($_SESSION['compose']['attachments'][$id]['path']); 36 36 if ($status === false) { 37 tfk_debug('Could not delete attachment.');37 rc_main::tfk_debug('Could not delete attachment.'); 38 38 } 39 39 $_SESSION['compose']['attachments'][$id] = NULL; … … 47 47 $CONFIG['htmleditor'] = false; 48 48 49 $MESSAGE_FORM = NULL;50 $MESSAGE = NULL;49 $MESSAGE_FORM = $registry->set('MESSAGE_FORM', NULL, 'core'); 50 $MESSAGE = $registry->set('MESSAGE', NULL, 'core'); 51 51 52 52 // Nothing below is called during message composition, only at "new/forward/reply/draft" initialization or … … 55 55 // compose when a "new/forward/reply/draft" is called - otherwise the old session attachments will appear 56 56 57 if (!is_array($_SESSION['compose']) || $_SESSION['compose']['id'] != get_input_value('_id', RCUBE_INPUT_GET)) { 57 if ( 58 !is_array($_SESSION['compose']) 59 || $_SESSION['compose']['id'] != rc_main::get_input_value('_id', RCUBE_INPUT_GET) 60 ) { 58 61 rcmail_compose_cleanup(); 59 62 $_SESSION['compose'] = array('id' => uniqid(rand())); … … 61 64 62 65 // add some labels to client 63 rc ube_add_label(66 rc_main::rcube_add_label( 64 67 'nosubject', 65 68 'norecipientwarning', … … 81 84 82 85 // get reference message and set compose mode 83 if ($msg_uid = get_input_value('_reply_uid', RCUBE_INPUT_GET)) {86 if ($msg_uid = rc_main::get_input_value('_reply_uid', RCUBE_INPUT_GET)) { 84 87 $compose_mode = RCUBE_COMPOSE_REPLY; 85 88 } 86 elseif ($msg_uid = get_input_value('_forward_uid', RCUBE_INPUT_GET)) {89 elseif ($msg_uid = rc_main::get_input_value('_forward_uid', RCUBE_INPUT_GET)) { 87 90 $compose_mode = RCUBE_COMPOSE_FORWARD; 88 91 } 89 elseif ($msg_uid = get_input_value('_draft_uid', RCUBE_INPUT_GET)) {92 elseif ($msg_uid = rc_main::get_input_value('_draft_uid', RCUBE_INPUT_GET)) { 90 93 $compose_mode = RCUBE_COMPOSE_DRAFT; 91 94 } 95 $registry->set('compose_mode', $compose_mode, 'core'); 92 96 93 97 if (empty($msg_uid) === false) { 94 98 95 tfk_debug('We got uid: ' . $msg_uid);96 tfk_debug('Compose mode: ' . $compose_mode);99 rc_main::tfk_debug('We got uid: ' . $msg_uid); 100 rc_main::tfk_debug('Compose mode: ' . $compose_mode); 97 101 98 102 // similar as in program/steps/mail/show.inc … … 104 108 105 109 106 tfk_debug('Reference message: ' . var_export($MESSAGE, true));110 rc_main::tfk_debug('Reference message: ' . var_export($MESSAGE, true)); 107 111 108 112 if ($compose_mode == RCUBE_COMPOSE_REPLY) { … … 124 128 } 125 129 } 130 $registry->set('MESSAGE', $MESSAGE, 'core'); 126 131 127 132 /****** compose mode functions ********/ 128 133 require_once 'include/rcube/rcmail_compose.php'; 129 134 130 tfk_debug('Passed require for rcmail_compose functions.');135 rc_main::tfk_debug('Passed require for rcmail_compose functions.'); 131 136 132 137 // register UI objects … … 155 160 while ($sql_arr = $result->iterate()) { 156 161 if ($sql_arr['email']) { 157 $a_contacts[] = format_email_recipient($sql_arr['email'], JQ($sql_arr['name'])); 162 $a_contacts[] = rc_main::format_email_recipient( 163 $sql_arr['email'], 164 rc_main::JQ($sql_arr['name']) 165 ); 158 166 } 159 167 } -
branches/devel-vnext/program/steps/mail/folders.inc
r608 r623 22 22 23 23 // send EXPUNGE command 24 if ($_action=='expunge' && ($mbox = get_input_value('_mbox', RCUBE_INPUT_POST))) {24 if ($_action=='expunge' && ($mbox = rc_main::get_input_value('_mbox', RCUBE_INPUT_POST))) { 25 25 $success = $IMAP->expunge($mbox); 26 26 27 tfk_debug('Expung: ' . $mbox);27 rc_main::tfk_debug('Expung: ' . $mbox); 28 28 29 29 // reload message list if current mailbox … … 32 32 $_action = 'list'; 33 33 34 tfk_debug('Trying to reload list.');34 rc_main::tfk_debug('Trying to reload list.'); 35 35 36 36 $_file = dirname(__FILE__); … … 47 47 } 48 48 // clear mailbox 49 elseif ($_action=='purge' && ($mbox = get_input_value('_mbox', RCUBE_INPUT_POST))) {49 elseif ($_action=='purge' && ($mbox = rc_main::get_input_value('_mbox', RCUBE_INPUT_POST))) { 50 50 $success = $IMAP->clear_mailbox($mbox); 51 51 -
branches/devel-vnext/program/steps/mail/func.inc
r622 r623 32 32 } 33 33 // set imap properties and session vars 34 if ($mbox = get_input_value('_mbox', RCUBE_INPUT_GPC)) {34 if ($mbox = rc_main::get_input_value('_mbox', RCUBE_INPUT_GPC)) { 35 35 $IMAP->set_mailbox($mbox); 36 36 $_SESSION['mbox'] = $mbox; … … 63 63 // define url for getting message parts 64 64 if (strlen($_GET['_uid'])) { 65 $GET_URL =rcmail_url(65 $GET_URL = rc_main::rcmail_url( 66 66 'get', 67 67 array( 68 68 '_mbox' => $IMAP->get_mailbox_name(), 69 '_uid' => get_input_value('_uid', RCUBE_INPUT_GET)69 '_uid' => rc_main::get_input_value('_uid', RCUBE_INPUT_GET) 70 70 ) 71 71 ); 72 $registry->set('GET_URL', $GET_URL, 'core'); 72 73 } 73 74 … … 86 87 } 87 88 if (!$OUTPUT->ajax_call) { 88 rc ube_add_label('checkingmail');89 rc_main::rcube_add_label('checkingmail'); 89 90 } 90 91 … … 106 107 107 108 // add some labels to client 108 rc ube_add_label('purgefolderconfirm');109 rc ube_add_label('deletemessagesconfirm');109 rc_main::rcube_add_label('purgefolderconfirm'); 110 rc_main::rcube_add_label('deletemessagesconfirm'); 110 111 111 112 // $mboxlist_start = rcube_timer(); … … 280 281 $unread_count ? ' unread' : '', 281 282 $folder['id']==$mbox_name ? ' selected' : '', 282 rc_main::Q(rc mail_url('', array('_mbox' => $folder['id']))),283 rc_main::Q(rc_main::rcmail_url('', array('_mbox' => $folder['id']))), 283 284 JS_OBJECT_NAME, 284 285 $js_name, … … 353 354 function rcmail_message_list($attrib) 354 355 { 355 global $IMAP, $CONFIG, $COMM_PATH, $OUTPUT; 356 $registry = rc_registry::getInstance(); 357 $IMAP = $registry->get('IMAP', 'core'); 358 $CONFIG = $registry->get('CONFIG', 'core'); 359 $COMM_PATH = $registry->get('COMM_PATH', 'core'); 360 $OUTPUT = $registry->get('OUTPUT', 'core'); 356 361 357 362 $skin_path = $CONFIG['skin_path']; … … 363 368 364 369 // add some labels to client 365 rc ube_add_label('from', 'to');370 rc_main::rcube_add_label('from', 'to'); 366 371 367 372 // get message headers … … 578 583 '<a href="%s" onclick="return false">%s</a>', 579 584 rc_main::Q( 580 rc mail_url(585 rc_main::rcmail_url( 581 586 $action, 582 587 array($uid_param=>$header->uid, '_mbox'=>$mbox) … … 592 597 else if ($col=='date') { 593 598 $cont_normalized.= @strtotime($header->date); 594 $cont = format_date($header->date);599 $cont = rc_main::format_date($header->date); 595 600 } 596 601 else { … … 689 694 function rcmail_js_message_list($a_headers, $insert_top=FALSE) 690 695 { 691 global $CONFIG, $IMAP, $OUTPUT; 696 $registry = rc_registry::getInstance(); 697 $CONFIG = $registry->get('CONFIG', 'core'); 698 $IMAP = $registry->get('IMAP', 'core'); 699 $OUTPUT = $registry->get('OUTPUT', 'core'); 692 700 693 701 $a_show_cols = is_array($CONFIG['list_cols']) ? $CONFIG['list_cols'] : array('subject'); … … 724 732 $cont = sprintf( 725 733 '<a href="%s" onclick="return false">%s</a>', 726 rc_main::Q(rcmail_url($action, array($uid_param=>$header->uid, '_mbox'=>$mbox))), 734 rc_main::Q( 735 rc_main::rcmail_url( 736 $action, 737 array($uid_param=>$header->uid, '_mbox'=>$mbox) 738 ) 739 ), 727 740 $cont 728 741 ); … … 732 745 } 733 746 elseif ($col=='date') { 734 $cont = format_date($header->date);747 $cont = rc_main::format_date($header->date); 735 748 } 736 749 else { … … 796 809 797 810 // allow the following attributes to be added to the <span> tag 798 $attrib_str = create_attrib_string($attrib, array('style', 'class', 'id'));811 $attrib_str = rc_main::create_attrib_string($attrib, array('style', 'class', 'id')); 799 812 800 813 … … 921 934 $body = preg_replace('/charset=[a-z0-9\-]+/i', '', $body); 922 935 923 if ($safe !== = false) {936 if ($safe !== FALSE) { 924 937 return rc_main::Q($body, 'show', FALSE); 925 938 } … … 949 962 if (preg_match($pattern, $body)) { 950 963 $REMOTE_OBJECTS = TRUE; 964 $registry->set('REMOTE_OBJECTS', true, 'core'); 951 965 break; 952 966 } … … 1027 1041 $rpl_count = $registry->get('rpl_count', 'core'); 1028 1042 1029 if ( is_null($rpl_count)) {1030 $rpl_count = 0;1043 if (empty($rpl_count)) { 1044 $rpl_count = (int) 0; 1031 1045 } 1032 1046 $rep[$rpl_count] = stripslashes($str); 1033 $resp = "##string_replacement{".($rpl_count++)."}##"; 1034 1047 $resp = "##string_replacement{" . $rpl_count . "}##"; 1048 //rc_main::tfk_debug("replace: $resp"); 1049 //rc_main::tfk_debug("/ str: $str, count: $rpl_count, total: " . var_export($rep, true)); 1050 1051 $rpl_count++; 1035 1052 $registry->set('rpl_count', $rpl_count, 'core'); 1036 1053 … … 1108 1125 } 1109 1126 // print html/plain part 1110 else if ( $html_part!==NULL && $prefer_html)1127 else if (is_null($html_part) !== TRUE && $prefer_html) { 1111 1128 $print_part = &$structure->parts[$html_part]; 1112 else if ($enriched_part!==NULL) 1129 } 1130 else if (is_null($enriched_part) !== TRUE) { 1113 1131 $print_part = &$structure->parts[$enriched_part]; 1114 else if ($plain_part!==NULL) 1132 } 1133 else if (is_null($plain_part) !== TRUE) { 1115 1134 $print_part = &$structure->parts[$plain_part]; 1116 1135 } 1117 1136 // show message body 1118 1137 if (is_object($print_part)) { … … 1192 1211 if ($message_ctype_secondary=='related' && $mail_part->headers['content-id']) 1193 1212 { 1194 $mail_part->content_id = preg_replace(array('/^</', '/>$/'), '', $mail_part->headers['content-id']); 1213 $mail_part->content_id = preg_replace( 1214 array('/^</', '/>$/'), 1215 '', 1216 $mail_part->headers['content-id'] 1217 ); 1195 1218 $sa_inline_objects[] = $mail_part; 1196 1219 } 1197 1220 // is regular attachment 1198 1221 else { 1199 if (!$mail_part->filename) 1200 $mail_part->filename = 'file_'.$mail_part->mime_id; 1222 if (!$mail_part->filename) { 1223 $mail_part->filename = 'file_' . $mail_part->mime_id; 1224 } 1201 1225 $a_attachments[] = $mail_part; 1202 1226 } … … 1209 1233 1210 1234 foreach ($sa_inline_objects as $inline_object) { 1211 $a_replaces['cid:'.$inline_object->content_id] = htmlspecialchars(sprintf($get_url, $inline_object->mime_id)); 1235 $a_replaces['cid:'.$inline_object->content_id] = htmlspecialchars( 1236 sprintf( 1237 $get_url, 1238 $inline_object->mime_id 1239 ) 1240 ); 1212 1241 } 1213 1242 // add replace array to each content part 1214 1243 // (will be applied later when part body is available) 1215 1244 for ($i=0; $i<count($a_return_parts); $i++) { 1216 if ($a_return_parts[$i]->type =='content') {1245 if ($a_return_parts[$i]->type == 'content') { 1217 1246 $a_return_parts[$i]->replaces = $a_replaces; 1218 1247 } … … 1225 1254 } 1226 1255 $registry->set('sa_inline_objects', $sa_inline_objects, 'core'); 1256 1227 1257 return array($a_return_parts, $a_attachments); 1228 1258 } … … 1278 1308 } 1279 1309 if ($hkey=='date' && empty($headers[$hkey]) === false) { 1280 $header_value = format_date(strtotime($headers[$hkey]));1310 $header_value = rc_main::format_date(strtotime($headers[$hkey])); 1281 1311 } 1282 1312 elseif(in_array($hkey, array('from', 'to', 'cc', 'bcc', 'reply-to'))) { 1283 $header_value = rc_main::Q(rcmail_address_string($headers[$hkey], NULL, $attrib['addicon']), 'show'); 1313 $header_value = rc_main::Q( 1314 rcmail_address_string( 1315 $headers[$hkey], 1316 NULL, 1317 $attrib['addicon'] 1318 ), 1319 'show' 1320 ); 1284 1321 } 1285 1322 else { 1286 $header_value = rc_main::Q(rcube_imap::decode_mime_string($headers[$hkey], $headers['charset'])); 1323 $header_value = rc_main::Q( 1324 rcube_imap::decode_mime_string( 1325 $headers[$hkey], 1326 $headers['charset'] 1327 ) 1328 ); 1287 1329 } 1288 1330 $out .= "\n<tr>\n"; 1289 $out .= '<td class="header-title">'.Q(rcube_label($hkey)).": </td>\n"; 1290 $out .= '<td class="'.$hkey.'" width="90%">'.$header_value."</td>\n</tr>"; 1331 $out .= '<td class="header-title">' . rc_main::Q(rcube_label($hkey)); 1332 $out .= ": </td>\n"; 1333 $out .= '<td class="' . $hkey . '" width="90%">' . $header_value; 1334 $out .= "</td>\n</tr>"; 1291 1335 $header_count++; 1292 1336 } … … 1311 1355 $REMOTE_OBJECTS = $registry->get('REMOTE_OBJECTS', 'core'); 1312 1356 1313 if (!is_array($MESSAGE['parts']) && !$MESSAGE['body']) 1357 if (!is_array($MESSAGE['parts']) && !$MESSAGE['body']) { 1314 1358 return ''; 1315 1316 if (!$attrib['id']) 1359 } 1360 if (!$attrib['id']) { 1317 1361 $attrib['id'] = 'rcmailMsgBody'; 1318 1362 } 1319 1363 $safe_mode = (bool)$_GET['_safe']; 1320 1364 $attrib_str = rc_main::create_attrib_string($attrib, array('style', 'class', 'id')); … … 1532 1576 // also replace body definition because we also stripped off the <body> tag 1533 1577 $styles = preg_replace( 1534 array('/(^\s*<!--)|(-->\s*$)/', '/(^\s*|,\s*|\}\s*)([a-z0-9\._][a-z0-9\.\-_]*)/im', '/<<str_replacement\[([0-9]+)\]>>/e', "/$container_id\s+body/i"), 1535 array('', "\\1#$container_id \\2", "\$a_css_values[\\1]", "$container_id div.rcmBody"), 1578 array( 1579 '/(^\s*<!--)|(-->\s*$)/', 1580 '/(^\s*|,\s*|\}\s*)([a-z0-9\._][a-z0-9\.\-_]*)/im', 1581 '/<<str_replacement\[([0-9]+)\]>>/e', 1582 "/$container_id\s+body/i" 1583 ), 1584 array( 1585 '', 1586 "\\1#$container_id \\2", 1587 "\$a_css_values[\\1]", 1588 "$container_id div.rcmBody" 1589 ), 1536 1590 $source 1537 1591 ); … … 1542 1596 function rcmail_has_html_part($message_parts) 1543 1597 { 1544 if (!is_array($message_parts)) 1598 if (!is_array($message_parts)) { 1545 1599 return FALSE; 1546 1600 } 1547 1601 // check all message parts 1548 1602 foreach ($message_parts as $pid => $part) … … 1643 1697 $j++; 1644 1698 if ($PRINT_MODE) { 1645 $out .= sprintf('%s <%s>', Q($part['name']), $part['mailto']);1699 $out .= sprintf('%s <%s>', rc_main::Q($part['name']), $part['mailto']); 1646 1700 } 1647 1701 elseif (preg_match($EMAIL_ADDRESS_PATTERN, $part['mailto'])) { -
branches/devel-vnext/program/steps/mail/get.inc
r589 r623 20 20 */ 21 21 22 require_once ('Mail/mimeDecode.php');22 require_once 'Mail/mimeDecode.php'; 23 23 24 $registry = rc_registry::getInstance(); 24 25 25 26 // show loading page 26 if ($_GET['_preload']) 27 { 28 $url = str_replace('&_preload=1', '', $_SERVER['REQUEST_URI']); 29 $message = rcube_label('loadingdata'); 27 if ($_GET['_preload']) { 28 $url = str_replace('&_preload=1', '', $_SERVER['REQUEST_URI']); 29 $message = rcube_label('loadingdata'); 30 30 31 print "<html>\n<head>\n" .32 '<meta http-equiv="refresh" content="0; url='.htmlspecialchars($url).'">' .33 "\n</head>\n<body>" .34 $message .35 "\n</body>\n</html>";36 exit;37 }31 echo "<html>\n<head>\n"; 32 echo '<meta http-equiv="refresh" content="0; url=' . htmlspecialchars($url).'">'; 33 echo "\n</head>\n<body>"; 34 echo $message; 35 echo "\n</body>\n</html>"; 36 exit; 37 } 38 38 39 39 40 40 // similar code as in program/steps/mail/show.inc 41 if ($_GET['_uid']) 42 {43 $MESSAGE = array('UID' => get_input_value('_uid', RCUBE_INPUT_GET));44 $MESSAGE['structure'] = $IMAP->get_structure($MESSAGE['UID']);45 $MESSAGE['parts'] = $IMAP->get_mime_numbers($MESSAGE['structure']);46 }41 if ($_GET['_uid']) { 42 $MESSAGE = array('UID' => rc_main::get_input_value('_uid', RCUBE_INPUT_GET)); 43 $MESSAGE['structure'] = $IMAP->get_structure($MESSAGE['UID']); 44 $MESSAGE['parts'] = $IMAP->get_mime_numbers($MESSAGE['structure']); 45 $registry->set('MESSAGE', $MESSAGE, 'core'); 46 } 47 47 48 48 49 49 // show part page 50 if ($_GET['_frame']) 51 { 52 parse_template('messagepart'); 53 exit; 54 } 50 if ($_GET['_frame']) { 51 parse_template('messagepart'); 52 exit; 53 } 54 else if ($pid = rc_main::get_input_value('_part', RCUBE_INPUT_GET)) { 55 if ($part = $MESSAGE['parts'][$pid]) { 56 $ctype_primary = strtolower($part->ctype_primary); 57 $ctype_secondary = strtolower($part->ctype_secondary); 58 $mimetype = sprintf('%s/%s', $ctype_primary, $ctype_secondary); 55 59 56 else if ($pid = get_input_value('_part', RCUBE_INPUT_GET)) 57 { 58 if ($part = $MESSAGE['parts'][$pid]); 59 { 60 $ctype_primary = strtolower($part->ctype_primary); 61 $ctype_secondary = strtolower($part->ctype_secondary); 60 header("Expires: 0"); 61 header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); 62 header("Cache-Control: private", false); 63 header("Content-Transfer-Encoding: binary"); 64 65 // send download headers 66 if ($_GET['_download']) { 67 header("Cache-Control: private", false); 68 header("Content-Type: application/octet-stream"); 69 } 70 else { 71 header("Content-Type: $mimetype"); 72 } 73 // We need to set the following headers to make downloads work using IE in HTTPS mode. 74 if (isset($_SERVER['HTTPS'])) { 75 header('Pragma: '); 76 header('Cache-Control: '); 77 } 78 79 // deliver part content 80 if ($ctype_primary=='text' && $ctype_secondary=='html') { 81 // we have to analyze the whole structure again to find inline objects 82 list($new_parts, $new_attachments) = 83 rcmail_parse_message( 84 $MESSAGE['structure'], 85 array( 86 'safe' => (bool)$_GET['_safe'], 87 'prefer_html' => TRUE, 88 'get_url' => $GET_URL.'&_part=%s' 89 ) 90 ); 91 92 $all_parts = array_merge($new_parts, $new_attachments); 93 for ($partix = 0; $partix < sizeof($all_parts); $partix++) { 94 if ($all_parts[$partix]->mime_id == $pid) { 95 $part = &$all_parts[$partix]; 96 } 97 } 98 99 // get part body if not available 100 if (!$part->body) { 101 $part->body = $IMAP->get_message_part($MESSAGE['UID'], $part->mime_id, $part); 102 } 103 $OUTPUT = new rcube_html_page(); 104 $OUTPUT->write(rcmail_print_body($part, (bool)$_GET['_safe'])); 105 } 106 else { 107 header( 108 sprintf( 109 'Content-Disposition: %s; filename="%s";', 110 $part->disposition ? $part->disposition : 'attachment', 111 $part->filename ? $part->filename : "roundcube.$ctype_secondary" 112 ) 113 ); 114 115 // turn off output buffering and print part content 116 $IMAP->get_message_part($MESSAGE['UID'], $part->mime_id, $part->encoding, true); 117 } 118 exit; 119 } 120 } 121 // print message 122 else { 123 $ctype_primary = strtolower($MESSAGE['structure']->ctype_primary); 124 $ctype_secondary = strtolower($MESSAGE['structure']->ctype_secondary); 62 125 $mimetype = sprintf('%s/%s', $ctype_primary, $ctype_secondary); 63 126 64 header("Expires: 0"); 65 header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); 66 header("Cache-Control: private", false); 67 header("Content-Transfer-Encoding: binary"); 127 // send correct headers for content type 128 header("Content-Type: text/html"); 68 129 69 // send download headers70 if ($_GET['_download'])71 {72 header("Cache-Control: private", false);73 header("Content-Type: application/octet-stream");74 }75 else76 header("Content-Type: $mimetype");130 $cont = ''; 131 list($MESSAGE['parts']) = rcmail_parse_message( 132 $MESSAGE['structure'], 133 array( 134 'safe' => (bool)$_GET['_safe'], 135 'get_url' => $GET_URL.'&_part=%s' 136 ) 137 ); 77 138 78 // We need to set the following headers to make downloads work using IE in HTTPS mode. 79 if (isset($_SERVER['HTTPS'])) 80 { 81 header('Pragma: '); 82 header('Cache-Control: '); 83 } 139 $cont = "<html>\n<head><title></title>\n</head>\n<body>"; 140 $cont .= rcmail_message_body(array()); 141 $cont .= "\n</body>\n</html>"; 84 142 85 // deliver part content 86 if ($ctype_primary=='text' && $ctype_secondary=='html') 87 { 88 // we have to analyze the whole structure again to find inline objects 89 list($new_parts, $new_attachments) = 90 rcmail_parse_message($MESSAGE['structure'], 91 array('safe' => (bool)$_GET['_safe'], 92 'prefer_html' => TRUE, 93 'get_url' => $GET_URL.'&_part=%s')); 94 95 $all_parts = array_merge($new_parts, $new_attachments); 96 for ($partix = 0; $partix < sizeof($all_parts); $partix++) 97 if ($all_parts[$partix]->mime_id == $pid) 98 $part = &$all_parts[$partix]; 99 100 // get part body if not available 101 if (!$part->body) 102 $part->body = $IMAP->get_message_part($MESSAGE['UID'], $part->mime_id, $part); 103 104 $OUTPUT = new rcube_html_page(); 105 $OUTPUT->write(rcmail_print_body($part, (bool)$_GET['_safe'])); 106 } 107 else 108 { 109 header(sprintf('Content-Disposition: %s; filename="%s";', 110 $part->disposition ? $part->disposition : 'attachment', 111 $part->filename ? $part->filename : "roundcube.$ctype_secondary")); 112 113 // turn off output buffering and print part content 114 $IMAP->get_message_part($MESSAGE['UID'], $part->mime_id, $part->encoding, true); 115 } 143 $OUTPUT = new rcube_html_page(); 144 $OUTPUT->write($cont); 116 145 117 146 exit; 118 } 119 } 120 121 // print message 122 else 123 { 124 $ctype_primary = strtolower($MESSAGE['structure']->ctype_primary); 125 $ctype_secondary = strtolower($MESSAGE['structure']->ctype_secondary); 126 $mimetype = sprintf('%s/%s', $ctype_primary, $ctype_secondary); 127 128 // send correct headers for content type 129 header("Content-Type: text/html"); 130 131 $cont = ''; 132 list($MESSAGE['parts']) = rcmail_parse_message($MESSAGE['structure'], 133 array('safe' => (bool)$_GET['_safe'], 134 'get_url' => $GET_URL.'&_part=%s')); 135 136 $cont = "<html>\n<head><title></title>\n</head>\n<body>"; 137 $cont .= rcmail_message_body(array()); 138 $cont .= "\n</body>\n</html>"; 139 140 $OUTPUT = new rcube_html_page(); 141 $OUTPUT->write($cont); 142 143 exit; 144 } 145 146 147 } 147 148 // if we arrive here, the requested part was not found 148 149 header('HTTP/1.1 404 Not Found'); 149 150 exit; 150 151 151 ?> -
branches/devel-vnext/program/steps/mail/getunread.inc
r589 r623 22 22 $a_folders = $IMAP->list_mailboxes(); 23 23 24 if (!empty($a_folders)) 25 {26 foreach ($a_folders as $mbox_row)27 $OUTPUT->command('set_unread_count', $mbox_row, $IMAP->messagecount($mbox_row, 'UNSEEN'));24 if (!empty($a_folders)) { 25 foreach ($a_folders as $mbox_row) { 26 $OUTPUT->command('set_unread_count', $mbox_row, $IMAP->messagecount($mbox_row, 'UNSEEN')); 27 } 28 28 } 29 29 -
branches/devel-vnext/program/steps/mail/list.inc
r592 r623 19 19 */ 20 20 21 $registry = rc_registry::getInstance(); 22 $OUTPUT = $registry->get('OUTPUT', 'core'); 23 $IMAP = $registry->get('IMAP', 'core'); 24 25 21 26 $OUTPUT_TYPE = 'js'; 27 $registry->set('OUTPUT_TYPE', $OUTPUT_TYPE, 'core'); 28 22 29 // is there a sort type for this request? 23 if ($sort = get_input_value('_sort', RCUBE_INPUT_GET)) {30 if ($sort = rc_main::get_input_value('_sort', RCUBE_INPUT_GET)) { 24 31 // yes, so set the sort vars 25 32 list($sort_col, $sort_order) = explode('_', $sort); -
branches/devel-vnext/program/steps/mail/mark.inc
r589 r623 20 20 21 21 $a_flags_map = array( 22 'undelete' => 'UNDELETED', 23 'delete' => 'DELETED', 24 'read' => 'SEEN', 25 'unread' => 'UNSEEN'); 22 'undelete' => 'UNDELETED', 23 'delete' => 'DELETED', 24 'read' => 'SEEN', 25 'unread' => 'UNSEEN' 26 ); 26 27 27 if (($uids = get_input_value('_uid', RCUBE_INPUT_POST)) && ($flag = get_input_value('_flag', RCUBE_INPUT_POST))) 28 { 29 $flag = $a_flags_map[$flag] ? $a_flags_map[$flag] : strtoupper($flag); 30 $marked = $IMAP->set_flag($uids, $flag); 28 if ( 29 ($uids = rc_main::get_input_value('_uid', RCUBE_INPUT_POST)) 30 && ($flag = rc_main::get_input_value('_flag', RCUBE_INPUT_POST)) 31 ) { 32 $flag = $a_flags_map[$flag] ? $a_flags_map[$flag] : strtoupper($flag); 33 $marked = $IMAP->set_flag($uids, $flag); 31 34 32 if ($marked != -1) 33 { 34 $mbox_name = $IMAP->get_mailbox_name(); 35 $OUTPUT->command('set_unread_count', $mbox_name, $IMAP->messagecount($mbox_name, 'UNSEEN')); 36 $OUTPUT->send(); 37 } 35 if ($marked != -1) { 36 $mbox_name = $IMAP->get_mailbox_name(); 37 $OUTPUT->command('set_unread_count', $mbox_name, $IMAP->messagecount($mbox_name, 'UNSEEN')); 38 $OUTPUT->send(); 39 } 38 40 } 39 40 41 exit; 41 42 ?> -
branches/devel-vnext/program/steps/mail/move_del.inc
r589 r623 21 21 22 22 // move messages 23 if ($_action=='moveto' && !empty($_POST['_uid']) && !empty($_POST['_target_mbox'])) 24 { 25 $count = sizeof(explode(',', ($uids = get_input_value('_uid', RCUBE_INPUT_POST)))); 26 $target = get_input_value('_target_mbox', RCUBE_INPUT_POST); 27 $moved = $IMAP->move_message($uids, $target, get_input_value('_mbox', RCUBE_INPUT_POST)); 28 29 if (!$moved) 30 { 31 // send error message 32 $OUTPUT->command('list_mailbox'); 33 $OUTPUT->show_message('errormoving', 'error'); 34 $OUTPUT->send(); 23 if ($_action=='moveto' && !empty($_POST['_uid']) && !empty($_POST['_target_mbox'])) { 24 $count = sizeof(explode(',', ($uids = rc_main::get_input_value('_uid', RCUBE_INPUT_POST)))); 25 $target = rc_main::get_input_value('_target_mbox', RCUBE_INPUT_POST); 26 $moved = $IMAP->move_message($uids, $target, rc_main::get_input_value('_mbox', RCUBE_INPUT_POST)); 27 28 if (!$moved) { 29 // send error message 30 $OUTPUT->command('list_mailbox'); 31 $OUTPUT->show_message('errormoving', 'error'); 32 $OUTPUT->send(); 33 exit; 34 } 35 } 36 // delete messages 37 else if ($_action=='delete' && !empty($_POST['_uid'])) { 38 $count = sizeof(explode(',', ($uids = rc_main::get_input_value('_uid', RCUBE_INPUT_POST)))); 39 $del = $IMAP->delete_message($uids, rc_main::get_input_value('_mbox', RCUBE_INPUT_POST)); 40 41 if (!$del) { 42 // send error message 43 $OUTPUT->command('list_mailbox'); 44 $OUTPUT->show_message('errordeleting', 'error'); 45 $OUTPUT->send(); 46 exit; 47 } 48 } 49 // unknown action or missing query param 50 else { 51 rc_main::tfk_debug('/ unknown action'); 35 52 exit; 36 }37 53 } 38 54 39 // delete messages 40 else if ($_action=='delete' && !empty($_POST['_uid'])) 41 { 42 $count = sizeof(explode(',', ($uids = get_input_value('_uid', RCUBE_INPUT_POST)))); 43 $del = $IMAP->delete_message($uids, get_input_value('_mbox', RCUBE_INPUT_POST)); 44 45 if (!$del) 46 { 47 // send error message 48 $OUTPUT->command('list_mailbox'); 49 $OUTPUT->show_message('errordeleting', 'error'); 50 $OUTPUT->send(); 51 exit; 52 } 55 // refresh saved seach set after moving some messages 56 if ( 57 ($search_request = rc_main::get_input_value('_search', RCUBE_INPUT_GPC)) 58 && $IMAP->search_set 59 ) { 60 $_SESSION['search'][$search_request] = $IMAP->refresh_search(); 53 61 } 54 55 // unknown action or missing query param56 else57 exit;58 59 // refresh saved seach set after moving some messages60 if (($search_request = get_input_value('_search', RCUBE_INPUT_GPC)) && $IMAP->search_set)61 $_SESSION['search'][$search_request] = $IMAP->refresh_search();62 63 62 64 63 // update message count display 65 64 $msg_count = $IMAP->messagecount(); 66 $pages = ceil($msg_count / $IMAP->page_size);65 $pages = ceil($msg_count / $IMAP->page_size); 67 66 $OUTPUT->set_env('pagecount', $pages); 68 67 $OUTPUT->command('set_rowcount', rcmail_get_messagecount_text($msg_count)); … … 73 72 $OUTPUT->command('set_unread_count', $mbox, $IMAP->messagecount($mbox, 'UNSEEN')); 74 73 75 if ($_action=='moveto' && $target) 76 $OUTPUT->command('set_unread_count', $target, $IMAP->messagecount($target, 'UNSEEN'));77 74 if ($_action=='moveto' && $target) { 75 $OUTPUT->command('set_unread_count', $target, $IMAP->messagecount($target, 'UNSEEN')); 76 } 78 77 $OUTPUT->command('set_quota', $IMAP->get_quota()); 79 78 80 79 // add new rows from next page (if any) 81 if ($_POST['_from']!='show' && $pages>1 && $IMAP->list_page < $pages) 82 { 83 $sort_col = isset($_SESSION['sort_col']) ? $_SESSION['sort_col'] : $CONFIG['message_sort_col']; 84 $sort_order = isset($_SESSION['sort_order']) ? $_SESSION['sort_order'] : $CONFIG['message_sort_order']; 85 86 $a_headers = $IMAP->list_headers($mbox, NULL, $sort_col, $sort_order); 87 $a_headers = array_slice($a_headers, -$count, $count); 80 if ($_POST['_from']!='show' && $pages>1 && $IMAP->list_page < $pages) { 81 $sort_col = isset($_SESSION['sort_col']) ? $_SESSION['sort_col'] : $CONFIG['message_sort_col']; 82 $sort_order = isset($_SESSION['sort_order']) ? $_SESSION['sort_order'] : $CONFIG['message_sort_order']; 88 83 89 rcmail_js_message_list($a_headers); 84 $a_headers = $IMAP->list_headers($mbox, NULL, $sort_col, $sort_order); 85 $a_headers = array_slice($a_headers, -$count, $count); 86 87 rcmail_js_message_list($a_headers); 90 88 } 91 92 89 93 90 // send response 94 91 $OUTPUT->send(); 95 96 92 ?> -
branches/devel-vnext/program/steps/mail/quotadisplay.inc
r589 r623 21 21 22 22 $display = isset($_GET['_display']) ? $_GET['_display'] : 'text'; 23 $id = isset($_GET['_id']) ? $_GET['_id'] : 'rcmquotadisplay';24 $quota = rcmail_quota_content($display);23 $id = isset($_GET['_id']) ? $_GET['_id'] : 'rcmquotadisplay'; 24 $quota = rcmail_quota_content($display); 25 25 $OUTPUT->remote_response(sprintf("this.gui_objects.%s.innerHTML = '%s';\n", $id, $quota)); 26 26 -
branches/devel-vnext/program/steps/mail/search.inc
r589 r623 14 14 */ 15 15 16 $REMOTE_REQUEST = TRUE;16 $REMOTE_REQUEST = $registry->set('REMOTE_REQUEST', TRUE, 'core'); 17 17 18 18 // reset list_page and old search results … … 26 26 27 27 // get search string 28 $str =get_input_value('_q', RCUBE_INPUT_GET);29 $mbox = get_input_value('_mbox', RCUBE_INPUT_GET);28 $str = rc_main::get_input_value('_q', RCUBE_INPUT_GET); 29 $mbox = rc_main::get_input_value('_mbox', RCUBE_INPUT_GET); 30 30 $search_request = md5($mbox.$str); 31 31 32 32 33 33 // Check the search string for type of search 34 if (preg_match("/^from:/i", $str)) 35 { 36 list(,$srch) = explode(":", $str); 37 $subject = "HEADER FROM"; 38 $search = trim($srch); 34 if (preg_match("/^from:/i", $str)) { 35 list(,$srch) = explode(":", $str); 36 $subject = "HEADER FROM"; 37 $search = trim($srch); 39 38 } 40 else if (preg_match("/^to:/i", $str)) 41 { 42 list(,$srch) = explode(":", $str); 43 $subject = "HEADER TO"; 44 $search = trim($srch); 39 else if (preg_match("/^to:/i", $str)) { 40 list(,$srch) = explode(":", $str); 41 $subject = "HEADER TO"; 42 $search = trim($srch); 45 43 } 46 else if (preg_match("/^cc:/i", $str)) 47 { 48 list(,$srch) = explode(":", $str); 49 $subject = "HEADER CC"; 50 $search = trim($srch); 44 else if (preg_match("/^cc:/i", $str)) { 45 list(,$srch) = explode(":", $str); 46 $subject = "HEADER CC"; 47 $search = trim($srch); 51 48 } 52 else if (preg_match("/^subject:/i", $str)) 53 { 54 list(,$srch) = explode(":", $str); 55 $subject = "HEADER SUBJECT"; 56 $search = trim($srch); 49 else if (preg_match("/^subject:/i", $str)) { 50 list(,$srch) = explode(":", $str); 51 $subject = "HEADER SUBJECT"; 52 $search = trim($srch); 57 53 } 58 else if (preg_match("/^body:/i", $str)) 59 { 60 list(,$srch) = explode(":", $str); 61 $subject = "TEXT"; 62 $search = trim($srch); 54 else if (preg_match("/^body:/i", $str)) { 55 list(,$srch) = explode(":", $str); 56 $subject = "TEXT"; 57 $search = trim($srch); 63 58 } 64 59 // search in subject and sender by default 65 else 66 { 67 $subject = array("HEADER SUBJECT", "HEADER FROM"); 68 $search = trim($str); 60 else { 61 $subject = array("HEADER SUBJECT", "HEADER FROM"); 62 $search = trim($str); 69 63 } 70 64 … … 73 67 $result = $IMAP->search($mbox, $subject, $search, $imap_charset); 74 68 $count = 0; 75 69 76 70 // Make sure our $result is legit.. 77 if (is_array($result) && $result[0] != '') 78 { 79 // Get the headers 80 $result_h = $IMAP->list_header_set($mbox, $result, 1, $_SESSION['sort_col'], $_SESSION['sort_order']); 81 $count = count($result_h); 71 if (is_array($result) && $result[0] != '') { 72 // Get the headers 73 $result_h = $IMAP->list_header_set($mbox, $result, 1, $_SESSION['sort_col'], $_SESSION['sort_order']); 74 $count = count($result_h); 82 75 83 // save search results in session 84 if (!is_array($_SESSION['search'])) 85 $_SESSION['search'] = array(); 86 87 // Make sure we got the headers 88 if ($result_h != NULL) 89 { 90 $_SESSION['search'][$search_request] = $IMAP->get_search_set(); 91 rcmail_js_message_list($result_h); 92 $OUTPUT->show_message('searchsuccessful', 'confirmation', array('nr' => $count)); 93 } 76 // save search results in session 77 if (!is_array($_SESSION['search'])) { 78 $_SESSION['search'] = array(); 79 } 80 // Make sure we got the headers 81 if ($result_h != NULL) { 82 $_SESSION['search'][$search_request] = $IMAP->get_search_set(); 83 rcmail_js_message_list($result_h); 84 $OUTPUT->show_message('searchsuccessful', 'confirmation', array('nr' => $count)); 85 } 94 86 } 95 else 96 { 97 $OUTPUT->show_message('searchnomatch', 'warning'); 98 $search_request = -1; 87 else { 88 $OUTPUT->show_message('searchnomatch', 'warning'); 89 $search_request = -1; 99 90 } 100 91 -
branches/devel-vnext/program/steps/mail/sendmail.inc
r595 r623 42 42 43 43 if (strlen($_POST['_draft_saveid']) > 3) { 44 $olddraftmessageid = get_input_value('_draft_saveid', RCUBE_INPUT_POST);44 $olddraftmessageid = rc_main::get_input_value('_draft_saveid', RCUBE_INPUT_POST); 45 45 } 46 46 $message_id = sprintf( … … 80 80 $mailto_regexp, 81 81 $mailto_replace, 82 get_input_value('_to', RCUBE_INPUT_POST, TRUE, $message_charset)82 rc_main::get_input_value('_to', RCUBE_INPUT_POST, TRUE, $message_charset) 83 83 ); 84 84 … … 107 107 $headers = array( 108 108 'Date' => date('D, j M Y H:i:s O'), 109 'From' => rc ube_charset_convert($identity_arr['string'], RCMAIL_CHARSET, $message_charset),109 'From' => rc_main::rcube_charset_convert($identity_arr['string'], RCMAIL_CHARSET, $message_charset), 110 110 'To' => $mailto 111 111 ); … … 116 116 $mailto_regexp, 117 117 $mailto_replace, 118 get_input_value(118 rc_main::get_input_value( 119 119 '_cc', 120 120 RCUBE_INPUT_POST, … … 126 126 $headers['Bcc'] = preg_replace( 127 127 $mailto_regexp, $mailto_replace, 128 get_input_value('_bcc', RCUBE_INPUT_POST, TRUE, $message_charset)128 rc_main::get_input_value('_bcc', RCUBE_INPUT_POST, TRUE, $message_charset) 129 129 ); 130 130 } 131 131 if (empty($identity_arr['bcc']) === false) { 132 $headers['Bcc'] = ($headers['Bcc'] ? $headers['Bcc'].', ' : '') . $identity_arr['bcc'];132 $headers['Bcc'] = ($headers['Bcc'] ? $headers['Bcc'].', ' : '') . $identity_arr['bcc']; 133 133 } 134 134 // add subject 135 $headers['Subject'] = trim( get_input_value('_subject', RCUBE_INPUT_POST, FALSE, $message_charset));135 $headers['Subject'] = trim(rc_main::get_input_value('_subject', RCUBE_INPUT_POST, FALSE, $message_charset)); 136 136 137 137 if (empty($identity_arr['organization']) === false) { … … 168 168 } 169 169 // fetch message body 170 $message_body = get_input_value('_message', RCUBE_INPUT_POST, TRUE, $message_charset);170 $message_body = rc_main::get_input_value('_message', RCUBE_INPUT_POST, TRUE, $message_charset); 171 171 172 172 // append generic footer to all messages … … 176 176 $content = fread($fp, filesize($file)); 177 177 fclose($fp); 178 $message_body .= "\r\n" . rcube_charset_convert($content, 'UTF-8', $message_charset); 178 $message_body .= "\r\n"; 179 $message_body .= rc_main::rcube_charset_convert($content, 'UTF-8', $message_charset); 179 180 } 180 181 } … … 195 196 } 196 197 197 $isHtmlVal = strtolower( get_input_value('_is_html', RCUBE_INPUT_POST));198 $isHtmlVal = strtolower(rc_main::get_input_value('_is_html', RCUBE_INPUT_POST)); 198 199 $isHtml = ($isHtmlVal == "1"); 199 200 -
branches/devel-vnext/program/steps/mail/show.inc
r589 r623 20 20 */ 21 21 22 require_once('Mail/mimeDecode.php'); 22 rc_main::tfk_debug('/ show :-)'); 23 24 require_once 'Mail/mimeDecode.php'; 23 25 24 26 $PRINT_MODE = $_action=='print' ? TRUE : FALSE; 27 $registry->set('PRINT_MODE', $PRINT_MODE, 'core'); 25 28 26 29 // similar code as in program/steps/mail/get.inc 27 if ($_GET['_uid']) 28 { 29 $MESSAGE = array('UID' => get_input_value('_uid', RCUBE_INPUT_GET)); 30 $MESSAGE['headers'] = $IMAP->get_headers($MESSAGE['UID']); 31 32 // go back to list if message not found (wrong UID) 33 if (!$MESSAGE['headers']) 34 { 35 $OUTPUT->show_message('messageopenerror', 'error'); 36 if ($_action=='preview' && template_exists('messagepreview')) 37 parse_template('messagepreview'); 38 else 39 { 40 $_action = 'list'; 41 return; 42 } 43 } 44 45 // calculate Etag for this request 46 $etag = md5($MESSAGE['UID'].$IMAP->get_mailbox_name().session_id().($PRINT_MODE?1:0)); 47 48 // allow caching, unless remote images are present 49 if ((bool)get_input_value('_safe', RCUBE_INPUT_GET)) 50 send_nocacheing_headers(); 51 else 52 send_modified_header($_SESSION['login_time'], $etag); 53 54 $MESSAGE['subject'] = rcube_imap::decode_mime_string($MESSAGE['headers']->subject, $MESSAGE['headers']->charset); 55 $OUTPUT->set_pagetitle($MESSAGE['subject']); 56 57 if ($MESSAGE['structure'] = $IMAP->get_structure($MESSAGE['UID'])) 58 list($MESSAGE['parts'], $MESSAGE['attachments']) = rcmail_parse_message( 59 $MESSAGE['structure'], 60 array('safe' => (bool)$_GET['_safe'], 61 'prefer_html' => $CONFIG['prefer_html'], 62 'get_url' => $GET_URL.'&_part=%s') 63 ); 64 else 65 $MESSAGE['body'] = $IMAP->get_body($MESSAGE['UID']); 66 67 68 // mark message as read 69 if (!$MESSAGE['headers']->seen && $_action != 'preview') 70 $IMAP->set_flag($MESSAGE['UID'], 'SEEN'); 71 72 // give message uid to the client 73 $OUTPUT->set_env('uid', $MESSAGE['UID']); 74 $OUTPUT->set_env('safemode', (bool)$_GET['_safe']); 75 76 $next = $prev = -1; 77 // get previous, first, next and last message UID 78 if (!($_SESSION['sort_col'] == 'date' && $_SESSION['sort_order'] == 'DESC') && 79 $IMAP->get_capability('sort')) 80 { 81 // Only if we use custom sorting 82 $a_msg_index = $IMAP->message_index(NULL, $_SESSION['sort_col'], $_SESSION['sort_order']); 83 84 $MESSAGE['index'] = array_search((string)$MESSAGE['UID'], $a_msg_index, TRUE); 85 $prev = isset($a_msg_index[$MESSAGE['index']-1]) ? $a_msg_index[$MESSAGE['index']-1] : -1 ; 86 $first = count($a_msg_index)>0 ? $a_msg_index[0] : -1; 87 $next = isset($a_msg_index[$MESSAGE['index']+1]) ? $a_msg_index[$MESSAGE['index']+1] : -1 ; 88 $last = count($a_msg_index)>0 ? $a_msg_index[count($a_msg_index)-1] : -1; 89 } 90 else 91 { 92 // this assumes that we are sorted by date_DESC 93 $seq = $IMAP->get_id($MESSAGE['UID']); 94 $prev = $IMAP->get_uid($seq + 1); 95 $first = $IMAP->get_uid($IMAP->messagecount()); 96 $next = $IMAP->get_uid($seq - 1); 97 $last = $IMAP->get_uid(1); 98 $MESSAGE['index'] = $IMAP->messagecount() - $seq; 99 } 100 101 if ($prev > 0) 102 $OUTPUT->set_env('prev_uid', $prev); 103 if ($first >0) 104 $OUTPUT->set_env('first_uid', $first); 105 if ($next > 0) 106 $OUTPUT->set_env('next_uid', $next); 107 if ($last >0) 108 $OUTPUT->set_env('last_uid', $last); 109 } 110 111 30 if ($_GET['_uid']) { 31 32 rc_main::tfk_debug("/ uid: {$_GET['_uid']}"); 33 34 $MESSAGE = array('UID' => rc_main::get_input_value('_uid', RCUBE_INPUT_GET)); 35 $MESSAGE['headers'] = $IMAP->get_headers($MESSAGE['UID']); 36 37 $registry->set('MESSAGE', $MESSAGE, 'core'); 38 39 //rc_main::tfk_debug(var_export($MESSAGE, true)); 40 41 // go back to list if message not found (wrong UID) 42 if (!$MESSAGE['headers']) { 43 $OUTPUT->show_message('messageopenerror', 'error'); 44 if ($_action=='preview' && template_exists('messagepreview')) { 45 rc_main::parse_template('messagepreview'); 46 } 47 else { 48 $_action = 'list'; 49 return; 50 } 51 } 52 53 // calculate Etag for this request 54 $etag = md5($MESSAGE['UID'] . $IMAP->get_mailbox_name() . session_id(). ($PRINT_MODE?1:0)); 55 56 rc_main::tfk_debug("/ etag: $etag"); 57 //rc_main::tfk_debug(var_export($MESSAGE, true)); 58 59 // allow caching, unless remote images are present 60 if ((bool)rc_main::get_input_value('_safe', RCUBE_INPUT_GET)) { 61 send_nocacheing_headers(); 62 } 63 else { 64 send_modified_header($_SESSION['login_time'], $etag); 65 } 66 67 rc_main::tfk_debug("/ send headerz"); 68 69 $MESSAGE['subject'] = rcube_imap::decode_mime_string( 70 $MESSAGE['headers']->subject, 71 $MESSAGE['headers']->charset 72 ); 73 $registry->set('MESSAGE', $MESSAGE, 'core'); 74 $OUTPUT->set_pagetitle($MESSAGE['subject']); 75 76 if ($MESSAGE['structure'] = $IMAP->get_structure($MESSAGE['UID'])) { 77 $_message_parts = rcmail_parse_message( 78 $MESSAGE['structure'], 79 array( 80 'safe' => (bool)$_GET['_safe'], 81 'prefer_html' => $CONFIG['prefer_html'], 82 'get_url' => $GET_URL.'&_part=%s' 83 ) 84 ); 85 list($MESSAGE['parts'], $MESSAGE['attachments']) = $_message_parts; 86 } 87 else { 88 $MESSAGE['body'] = $IMAP->get_body($MESSAGE['UID']); 89 } 90 $registry->set('MESSAGE', $MESSAGE, 'core'); 91 92 // mark message as read 93 if (!$MESSAGE['headers']->seen && $_action != 'preview') { 94 $IMAP->set_flag($MESSAGE['UID'], 'SEEN'); 95 } 96 // give message uid to the client 97 $OUTPUT->set_env('uid', $MESSAGE['UID']); 98 $OUTPUT->set_env('safemode', (bool)$_GET['_safe']); 99 100 $next = $prev = -1; 101 // get previous, first, next and last message UID 102 if ( 103 !( 104 $_SESSION['sort_col'] == 'date' 105 && $_SESSION['sort_order'] == 'DESC' 106 ) 107 && $IMAP->get_capability('sort') 108 ) { 109 // Only if we use custom sorting 110 $a_msg_index = $IMAP->message_index(NULL, $_SESSION['sort_col'], $_SESSION['sort_order']); 111 112 $MESSAGE['index'] = array_search((string)$MESSAGE['UID'], $a_msg_index, TRUE); 113 $prev = isset($a_msg_index[$MESSAGE['index']-1]) ? $a_msg_index[$MESSAGE['index']-1] : -1 ; 114 $first = count($a_msg_index)>0 ? $a_msg_index[0] : -1; 115 $next = isset($a_msg_index[$MESSAGE['index']+1]) ? $a_msg_index[$MESSAGE['index']+1] : -1 ; 116 $last = count($a_msg_index)>0 ? $a_msg_index[count($a_msg_index)-1] : -1; 117 } 118 else { 119 // this assumes that we are sorted by date_DESC 120 $seq = $IMAP->get_id($MESSAGE['UID']); 121 $prev = $IMAP->get_uid($seq + 1); 122 $first = $IMAP->get_uid($IMAP->messagecount()); 123 $next = $IMAP->get_uid($seq - 1); 124 $last = $IMAP->get_uid(1); 125 $MESSAGE['index'] = $IMAP->messagecount() - $seq; 126 } 127 $registry->set('MESSAGE', $MESSAGE, 'core'); 128 129 if ($prev > 0) { 130 $OUTPUT->set_env('prev_uid', $prev); 131 } 132 if ($first >0) { 133 $OUTPUT->set_env('first_uid', $first); 134 } 135 if ($next > 0) { 136 $OUTPUT->set_env('next_uid', $next); 137 } 138 if ($last >0) { 139 $OUTPUT->set_env('last_uid', $last); 140 } 141 } 142 143 rc_main::tfk_debug("/ hallo"); 112 144 113 145 function rcmail_message_attachments($attrib) 114 { 115 global $CONFIG, $OUTPUT, $PRINT_MODE, $MESSAGE, $GET_URL; 116 117 if (sizeof($MESSAGE['attachments'])) 118 { 119 // allow the following attributes to be added to the <ul> tag 120 $attrib_str = create_attrib_string($attrib, array('style', 'class', 'id')); 121 $out = '<ul' . $attrib_str . ">\n"; 122 123 foreach ($MESSAGE['attachments'] as $attach_prop) 124 { 125 if ($PRINT_MODE) 126 $out .= sprintf('<li>%s (%s)</li>'."\n", 127 $attach_prop->filename, 128 show_bytes($attach_prop->size)); 129 else 130 $out .= sprintf('<li><a href="%s&_part=%s" onclick="return %s.command(\'load-attachment\',{part:\'%s\', mimetype:\'%s\'},this)">%s</a></li>'."\n", 131 htmlspecialchars($GET_URL), 132 $attach_prop->mime_id, 133 JS_OBJECT_NAME, 134 $attach_prop->mime_id, 135 $attach_prop->mimetype, 136 $attach_prop->filename); 137 } 138 139 $out .= "</ul>"; 146 { 147 $registry = rc_registry::getInstance(); 148 $CONFIG = $registry->get('CONFIG', 'core'); 149 $OUTPUT = $registry->get('OUTPUT', 'core'); 150 $PRINT_MODE = $registry->get('PRINT_MODE', 'core'); 151 $MESSAGE = $registry->get('MESSAGE', 'core'); 152 $GET_URL = $registry->get('GET_URL', 'core'); 153 154 155 if (sizeof($MESSAGE['attachments'])) { 156 // allow the following attributes to be added to the <ul> tag 157 $attrib_str = rc_main::create_attrib_string( 158 $attrib, 159 array('style', 'class', 'id') 160 ); 161 $out = '<ul' . $attrib_str . ">\n"; 162 163 foreach ($MESSAGE['attachments'] as $attach_prop) { 164 if ($PRINT_MODE) { 165 $out .= sprintf( 166 '<li>%s (%s)</li>'."\n", 167 $attach_prop->filename, 168 show_bytes($attach_prop->size) 169 ); 170 } 171 else { 172 $out .= sprintf( 173 '<li><a href="%s&_part=%s" onclick="return %s.command(\'load-attachment\',{part:\'%s\', mimetype:\'%s\'},this)">%s</a></li>'."\n", 174 htmlspecialchars($GET_URL), 175 $attach_prop->mime_id, 176 JS_OBJECT_NAME, 177 $attach_prop->mime_id, 178 $attach_prop->mimetype, 179 $attach_prop->filename 180 ); 181 } 182 } 183 184 $out .= "</ul>"; 185 return $out; 186 } 187 } 188 189 190 191 function rcmail_remote_objects_msg($attrib) 192 { 193 $registry = rc_registry::getInstance(); 194 $CONFIG = $registry->get('CONFIG', 'core'); 195 $OUTPUT = $registry->get('OUTPUT', 'core'); 196 197 if (!$attrib['id']) { 198 $attrib['id'] = 'rcmremoteobjmsg'; 199 } 200 // allow the following attributes to be added to the <div> tag 201 $attrib_str = rc_main::create_attrib_string($attrib, array('style', 'class', 'id')); 202 $out = '<div' . $attrib_str . ">"; 203 204 $out .= sprintf( 205 '%s <a href="#loadimages" onclick="%s.command(\'load-images\')">%s</a>', 206 rc_main::Q(rcube_label('blockedimages')), 207 JS_OBJECT_NAME, 208 rc_main::Q(rcube_label('showimages')) 209 ); 210 211 $out .= '</div>'; 212 213 $OUTPUT->add_gui_object('remoteobjectsmsg', $attrib['id']); 140 214 return $out; 141 } 142 } 143 144 145 146 function rcmail_remote_objects_msg($attrib) 147 { 148 global $CONFIG, $OUTPUT; 149 150 if (!$attrib['id']) 151 $attrib['id'] = 'rcmremoteobjmsg'; 152 153 // allow the following attributes to be added to the <div> tag 154 $attrib_str = create_attrib_string($attrib, array('style', 'class', 'id')); 155 $out = '<div' . $attrib_str . ">"; 156 157 $out .= sprintf('%s <a href="#loadimages" onclick="%s.command(\'load-images\')">%s</a>', 158 Q(rcube_label('blockedimages')), 159 JS_OBJECT_NAME, 160 Q(rcube_label('showimages'))); 161 162 $out .= '</div>'; 163 164 $OUTPUT->add_gui_object('remoteobjectsmsg', $attrib['id']); 165 return $out; 166 } 167 168 169 $OUTPUT->add_handlers(array( 170 'messageattachments' => 'rcmail_message_attachments', 171 'blockedobjects' => 'rcmail_remote_objects_msg')); 172 173 174 if ($_action=='print' && template_exists('printmessage')) 175 parse_template('printmessage'); 176 else if ($_action=='preview' && template_exists('messagepreview')) 177 parse_template('messagepreview'); 178 else 179 parse_template('message'); 215 } 216 217 218 $OUTPUT->add_handlers( 219 array( 220 'messageattachments' => 'rcmail_message_attachments', 221 'blockedobjects' => 'rcmail_remote_objects_msg' 222 ) 223 ); 224 225 if ($_action=='print' && rc_main::template_exists('printmessage')) { 226 rc_main::parse_template('printmessage'); 227 } 228 elseif ($_action=='preview' && rc_main::template_exists('messagepreview')) { 229 rc_main::parse_template('messagepreview'); 230 } 231 else { 232 rc_main::parse_template('message'); 233 } 180 234 ?> -
branches/devel-vnext/program/steps/mail/spell.inc
r589 r623 23 23 */ 24 24 25 $REMOTE_REQUEST = TRUE; 25 $REMOTE_REQUEST = $registry->set('REMOTE_REQUEST', TRUE, 'core'); 26 $CONFIG = $registry->get('CONFIG', 'core'); 26 27 27 28 // default settings 28 29 $host = "ssl://www.google.com"; 29 30 $port = 443; 30 $lang = get_input_value('lang', RCUBE_INPUT_GET);31 $lang = rc_main::get_input_value('lang', RCUBE_INPUT_GET); 31 32 $path = "/tbproxy/spell?lang=$lang"; 32 33 33 34 // spell check uri is configured 34 if (!empty($CONFIG['spellcheck_uri'])) 35 { 36 $a_uri = parse_url($CONFIG['spellcheck_uri']); 37 $ssl = ($a_uri['scheme']=='https' || $a_uri['scheme']=='ssl'); 38 $port = $a_uri['port'] ? $a_uri['port'] : ($ssl ? 443 : 80); 39 $host = ($ssl ? 'ssl://' : '') . $a_uri['host']; 40 $path = $a_uri['path'] . ($a_uri['query'] ? '?'.$a_uri['query'] : '') . $lang; 41 } 35 if (!empty($CONFIG['spellcheck_uri'])) { 36 $a_uri = parse_url($CONFIG['spellcheck_uri']); 37 $ssl = ($a_uri['scheme']=='https' || $a_uri['scheme']=='ssl'); 38 $port = $a_uri['port'] ? $a_uri['port'] : ($ssl ? 443 : 80); 39 $host = ($ssl ? 'ssl://' : '') . $a_uri['host']; 40 $path = $a_uri['path'] . ($a_uri['query'] ? '?'.$a_uri['query'] : '') . $lang; 41 } 42 42 43 $data = file_get_contents('php://input');43 $data = file_get_contents('php://input'); 44 44 $store = ""; 45 45 46 if ($fp = fsockopen($host, $port, $errno, $errstr, 30)) 47 { 48 $out = "POST $path HTTP/1.0\r\n"; 49 $out .= "Host: $host\r\n"; 50 $out .= "Content-Length: " . strlen($data) . "\r\n"; 51 $out .= "Content-type: application/x-www-form-urlencoded\r\n"; 52 $out .= "Connection: Close\r\n\r\n"; 53 $out .= $data; 54 fwrite($fp, $out); 55 56 while (!feof($fp)) 57 $store .= fgets($fp, 128); 58 fclose($fp); 59 } 46 if ($fp = fsockopen($host, $port, $errno, $errstr, 30)) { 47 $out = "POST $path HTTP/1.0\r\n"; 48 $out .= "Host: $host\r\n"; 49 $out .= "Content-Length: " . strlen($data) . "\r\n"; 50 $out .= "Content-type: application/x-www-form-urlencoded\r\n"; 51 $out .= "Connection: Close\r\n\r\n"; 52 $out .= $data; 53 fwrite($fp, $out); 60 54 61 print $store; 55 while (!feof($fp)) { 56 $store .= fgets($fp, 128); 57 } 58 fclose($fp); 59 } 60 echo $store; 62 61 exit; 63 62 -
branches/devel-vnext/program/steps/mail/upload.inc
r589 r623 21 21 22 22 23 if (!$_SESSION['compose']) 24 { 25 exit; 26 } 27 23 if (!$_SESSION['compose']) { 24 exit; 25 } 28 26 29 27 // use common temp dir for file uploads 30 28 $temp_dir = unslashify($CONFIG['temp_dir']); 31 29 32 33 if (!is_array($_SESSION['compose']['attachments'])) 34 $_SESSION['compose']['attachments'] = array(); 35 30 if (!is_array($_SESSION['compose']['attachments'])) { 31 $_SESSION['compose']['attachments'] = array(); 32 } 36 33 37 34 $response = ''; 38 35 39 foreach ($_FILES['_attachments']['tmp_name'] as $i => $filepath) 40 { 41 $tmpfname = tempnam($temp_dir, 'rcmAttmnt'); 42 if (move_uploaded_file($filepath, $tmpfname)) 36 foreach ($_FILES['_attachments']['tmp_name'] as $i => $filepath) { 37 $tmpfname = tempnam($temp_dir, 'rcmAttmnt'); 38 if (move_uploaded_file($filepath, $tmpfname)) { 39 $id = count($_SESSION['compose']['attachments']); 40 $_SESSION['compose']['attachments'][] = array( 41 'name' => $_FILES['_attachments']['name'][$i], 42 'mimetype' => $_FILES['_attachments']['type'][$i], 43 'path' => $tmpfname 44 ); 45 46 if (is_file($CONFIG['skin_path'] . '/images/icons/remove-attachment.png')) { 47 $button = sprintf( 48 '<img src="%s/images/icons/remove-attachment.png" alt="%s" border="0" style="padding-right:2px;vertical-align:middle" />', 49 $CONFIG['skin_path'], 50 rc_main::Q(rcube_label('delete')) 51 ); 52 } 53 else { 54 $button = rc_main::Q(rcube_label('delete')); 55 } 56 $content = sprintf( 57 '<a href="#delete" onclick="return %s.command(\'remove-attachment\', \'rcmfile%d\', this)" title="%s">%s</a>%s', 58 JS_OBJECT_NAME, 59 $id, 60 rc_main::Q(rcube_label('delete')), 61 $button, 62 rc_main::Q($_FILES['_attachments']['name'][$i]) 63 ); 64 $OUTPUT->command('add2attachment_list', "rcmfile$id", $content); 65 } 66 else // upload failed 43 67 { 44 $id = count($_SESSION['compose']['attachments']); 45 $_SESSION['compose']['attachments'][] = array('name' => $_FILES['_attachments']['name'][$i], 46 'mimetype' => $_FILES['_attachments']['type'][$i], 47 'path' => $tmpfname); 48 49 if (is_file($CONFIG['skin_path'] . '/images/icons/remove-attachment.png')) 50 $button = sprintf( 51 '<img src="%s/images/icons/remove-attachment.png" alt="%s" border="0" style="padding-right:2px;vertical-align:middle" />', 52 $CONFIG['skin_path'], 53 Q(rcube_label('delete'))); 54 else 55 $button = Q(rcube_label('delete')); 56 57 $content = sprintf( 58 '<a href="#delete" onclick="return %s.command(\'remove-attachment\', \'rcmfile%d\', this)" title="%s">%s</a>%s', 59 JS_OBJECT_NAME, 60 $id, 61 Q(rcube_label('delete')), 62 $button, 63 Q($_FILES['_attachments']['name'][$i])); 64 65 $OUTPUT->command('add2attachment_list', "rcmfile$id", $content); 68 $err = $_FILES['_attachments']['error'][$i]; 69 if ($err == UPLOAD_ERR_INI_SIZE || $err == UPLOAD_ERR_FORM_SIZE) { 70 $msg = rcube_label(array('name' => 'filesizeerror', 'vars' => array('size' => show_bytes(parse_bytes(ini_get('upload_max_filesize')))))); 71 } 72 else { 73 $msg = rcube_label('fileuploaderror'); 74 } 75 $OUTPUT->command('display_message', $msg, 'error'); 66 76 } 67 else // upload failed 68 { 69 $err = $_FILES['_attachments']['error'][$i]; 70 if ($err == UPLOAD_ERR_INI_SIZE || $err == UPLOAD_ERR_FORM_SIZE) 71 $msg = rcube_label(array('name' => 'filesizeerror', 'vars' => array('size' => show_bytes(parse_bytes(ini_get('upload_max_filesize')))))); 72 else 73 $msg = rcube_label('fileuploaderror'); 74 75 $OUTPUT->command('display_message', $msg, 'error'); 76 } 77 } 78 77 } 79 78 80 79 // send html page with JS calls as response … … 82 81 $OUTPUT->command('auto_save_start', false); 83 82 $OUTPUT->send('iframe'); 84 85 83 ?> -
branches/devel-vnext/program/steps/mail/viewsource.inc
r589 r623 22 22 23 23 // similar code as in program/steps/mail/get.inc 24 if ($uid = get_input_value('_uid', RCUBE_INPUT_GET)) 25 { 26 header('Content-Type: text/plain'); 27 //@ob_end_clean(); 28 $IMAP->print_raw_body($uid); 29 } 30 else 31 { 32 raise_error(array('code' => 500, 33 'type' => 'php', 34 'message' => 'Message UID '.$uid.' not found'), 35 TRUE, 36 TRUE); 37 } 38 24 if ($uid = rc_main::get_input_value('_uid', RCUBE_INPUT_GET)) { 25 header('Content-Type: text/plain'); 26 //@ob_end_clean(); 27 $IMAP->print_raw_body($uid); 28 } 29 else { 30 raise_error( 31 array( 32 'code' => 500, 33 'type' => 'php', 34 'message' => 'Message UID '.$uid.' not found' 35 ), 36 TRUE, 37 TRUE 38 ); 39 } 39 40 exit; 40 41 ?> -
branches/devel-vnext/program/steps/settings/func.inc
r589 r623 22 22 23 23 // get user record 24 $sql_result = $DB->query("SELECT username, mail_host FROM ".get_table_name('users')." 25 WHERE user_id=?", 26 $_SESSION['user_id']); 27 28 if ($USER_DATA = $DB->fetch_assoc($sql_result)) 29 $OUTPUT->set_pagetitle(sprintf('%s %s@%s', rcube_label('settingsfor'), $USER_DATA['username'], $USER_DATA['mail_host'])); 30 24 $_query = "SELECT username, mail_host FROM " . rc_main::get_table_name('users'); 25 $_query.= " WHERE user_id=?"; 26 $sql_result = $DB->query($_query, $_SESSION['user_id']); 27 28 if ($USER_DATA = $DB->fetch_assoc($sql_result)) { 29 $OUTPUT->set_pagetitle( 30 sprintf( 31 '%s %s@%s', 32 rcube_label('settingsfor'), 33 $USER_DATA['username'], 34 $USER_DATA['mail_host'] 35 ) 36 ); 37 } 31 38 32 39 33 40 function rcmail_user_prefs_form($attrib) 34 { 35 global $DB, $CONFIG, $sess_user_lang; 36 37 $no_override = is_array($CONFIG['dont_override']) ? array_flip($CONFIG['dont_override']) : array(); 38 39 // add some labels to client 40 rcube_add_label('nopagesizewarning'); 41 42 list($form_start, $form_end) = get_form_tags($attrib, 'save-prefs'); 43 unset($attrib['form']); 44 45 // allow the following attributes to be added to the <table> tag 46 $attrib_str = create_attrib_string($attrib, array('style', 'class', 'id', 'cellpadding', 'cellspacing', 'border', 'summary')); 47 48 // return the complete edit form as table 49 $out = "$form_start<table" . $attrib_str . ">\n\n"; 50 51 // show language selection 52 if (!isset($no_override['language'])) 53 { 54 $a_lang = rcube_list_languages(); 55 asort($a_lang); 56 57 $field_id = 'rcmfd_lang'; 58 $select_lang = new select(array('name' => '_language', 'id' => $field_id)); 59 $select_lang->add(array_values($a_lang), array_keys($a_lang)); 60 61 $out .= sprintf("<tr><td class=\"title\"><label for=\"%s\">%s</label></td><td>%s</td></tr>\n", 62 $field_id, 63 Q(rcube_label('language')), 64 $select_lang->show($sess_user_lang)); 65 } 66 67 68 // show page size selection 69 if (!isset($no_override['timezone'])) 70 { 71 $field_id = 'rcmfd_timezone'; 72 $select_timezone = new select(array('name' => '_timezone', 'id' => $field_id)); 73 $select_timezone->add('(GMT -11:00) Midway Island, Samoa', '-11'); 74 $select_timezone->add('(GMT -10:00) Hawaii', '-10'); 75 $select_timezone->add('(GMT -9:00) Alaska', '-9'); 76 $select_timezone->add('(GMT -8:00) Pacific Time (US/Canada)', '-8'); 77 $select_timezone->add('(GMT -7:00) Mountain Time (US/Canada)', '-7'); 78 $select_timezone->add('(GMT -6:00) Central Time (US/Canada), Mexico City', '-6'); 79 $select_timezone->add('(GMT -5:00) Eastern Time (US/Canada), Bogota, Lima', '-5'); 80 $select_timezone->add('(GMT -4:00) Atlantic Time (Canada), Caracas, La Paz', '-4'); 81 $select_timezone->add('(GMT -3:00) Brazil, Buenos Aires, Georgetown', '-3'); 82 $select_timezone->add('(GMT -3:30) Nfld Time (Canada), Nfld, S. Labador', '-3.5'); 83 $select_timezone->add('(GMT -2:00) Mid-Atlantic', '-2'); 84 $select_timezone->add('(GMT -1:00) Azores, Cape Verde Islands', '-1'); 85 $select_timezone->add('(GMT) Western Europe, London, Lisbon, Casablanca', '0'); 86 $select_timezone->add('(GMT +1:00) Central European Time', '1'); 87 $select_timezone->add('(GMT +2:00) EET: Kaliningrad, South Africa', '2'); 88 $select_timezone->add('(GMT +3:00) Baghdad, Kuwait, Riyadh, Moscow, Nairobi', '3'); 89 $select_timezone->add('(GMT +3:30) Tehran', '3.5'); 90 $select_timezone->add('(GMT +4:00) Abu Dhabi, Muscat, Baku, Tbilisi', '4'); 91 $select_timezone->add('(GMT +4:30) Kabul', '4.5'); 92 $select_timezone->add('(GMT +5:00) Ekaterinburg, Islamabad, Karachi', '5'); 93 $select_timezone->add('(GMT +5:30) Chennai, Kolkata, Mumbai, New Delhi', '5.5'); 94 $select_timezone->add('(GMT +5:45) Kathmandu', '5.75'); 95 $select_timezone->add('(GMT +6:00) Almaty, Dhaka, Colombo', '6'); 96 $select_timezone->add('(GMT +7:00) Bangkok, Hanoi, Jakarta', '7'); 97 $select_timezone->add('(GMT +8:00) Beijing, Perth, Singapore, Taipei', '8'); 98 $select_timezone->add('(GMT +9:00) Tokyo, Seoul, Yakutsk', '9'); 99 $select_timezone->add('(GMT +9:30) Adelaide, Darwin', '9.5'); 100 $select_timezone->add('(GMT +10:00) EAST/AEST: Guam, Vladivostok', '10'); 101 $select_timezone->add('(GMT +11:00) Magadan, Solomon Islands', '11'); 102 $select_timezone->add('(GMT +12:00) Auckland, Wellington, Kamchatka', '12'); 103 $select_timezone->add('(GMT +13:00) Tonga, Pheonix Islands', '13'); 104 $select_timezone->add('(GMT +14:00) Kiribati', '14'); 105 106 107 $out .= sprintf("<tr><td class=\"title\"><label for=\"%s\">%s</label></td><td>%s</td></tr>\n", 108 $field_id, 109 Q(rcube_label('timezone')), 110 $select_timezone->show($CONFIG['timezone'])); 111 } 112 113 // daylight savings 114 if (!isset($no_override['dst_active'])) 115 { 116 $field_id = 'rcmfd_dst'; 117 $input_dst = new checkbox(array('name' => '_dst_active', 'id' => $field_id, 'value' => 1)); 118 $out .= sprintf("<tr><td class=\"title\"><label for=\"%s\">%s</label></td><td>%s</td></tr>\n", 119 $field_id, 120 Q(rcube_label('dstactive')), 121 $input_dst->show($CONFIG['dst_active'])); 122 } 123 124 // show page size selection 125 if (!isset($no_override['pagesize'])) 126 { 127 $field_id = 'rcmfd_pgsize'; 128 $input_pagesize = new textfield(array('name' => '_pagesize', 'id' => $field_id, 'size' => 5)); 129 130 $out .= sprintf("<tr><td class=\"title\"><label for=\"%s\">%s</label></td><td>%s</td></tr>\n", 131 $field_id, 132 Q(rcube_label('pagesize')), 133 $input_pagesize->show($CONFIG['pagesize'])); 134 } 135 136 // MM: Show checkbox for toggling 'pretty dates' 137 if (!isset($no_override['prettydate'])) 138 { 139 $field_id = 'rcmfd_prettydate'; 140 $input_prettydate = new checkbox(array('name' => '_pretty_date', 'id' => $field_id, 'value' => 1)); 141 142 $out .= sprintf("<tr><td class=\"title\"><label for=\"%s\">%s</label></td><td>%s</td></tr>\n", 143 $field_id, 144 Q(rcube_label('prettydate')), 145 $input_prettydate->show($CONFIG['prettydate']?1:0)); 146 } 147 148 // show checkbox for HTML/plaintext messages 149 if (!isset($no_override['prefer_html'])) 150 { 151 $field_id = 'rcmfd_htmlmsg'; 152 $input_pagesize = new checkbox(array('name' => '_prefer_html', 'id' => $field_id, 'value' => 1)); 153 154 $out .= sprintf("<tr><td class=\"title\"><label for=\"%s\">%s</label></td><td>%s</td></tr>\n", 155 $field_id, 156 Q(rcube_label('preferhtml')), 157 $input_pagesize->show($CONFIG['prefer_html']?1:0)); 158 } 159 160 // Show checkbox for HTML Editor 161 if (false && !isset($no_override['htmleditor'])) 162 { 163 $field_id = 'rcmfd_htmleditor'; 164 $input_htmleditor = new checkbox(array('name' => '_htmleditor', 'id' => $field_id, 'value' => 1)); 165 $out .= sprintf("<tr><td class=\"title\"><label for=\"%s\">%s</label></td><td>%s</td></tr>\n", 166 $field_id, 167 Q(rcube_label('htmleditor')), 168 $input_htmleditor->show($CONFIG['htmleditor']?1:0)); 169 } 170 171 // show config parameter for preview pane 172 if (false && !isset($no_override['preview_pane'])) 173 { 41 { 42 $registry = rc_registry::getInstance(); 43 $DB = $registry->get('DB', 'core'); 44 $CONFIG = $registry->get('CONFIG', 'core'); 45 $sess_user_lang = $registry->get('sess_user_lang', 'core'); 46 47 $no_override = is_array($CONFIG['dont_override']) ? array_flip($CONFIG['dont_override']) : array(); 48 49 // add some labels to client 50 rcube_add_label('nopagesizewarning'); 51 52 list($form_start, $form_end) = get_form_tags($attrib, 'save-prefs'); 53 unset($attrib['form']); 54 55 // allow the following attributes to be added to the <table> tag 56 $attrib_str = rc_main::create_attrib_string($attrib, array('style', 'class', 'id', 'cellpadding', 'cellspacing', 'border', 'summary')); 57 58 // return the complete edit form as table 59 $out = "$form_start<table" . $attrib_str . ">\n\n"; 60 61 // show language selection 62 if (!isset($no_override['language'])) { 63 $a_lang = rcube_list_languages(); 64 asort($a_lang); 65 66 $field_id = 'rcmfd_lang'; 67 $select_lang = new select(array('name' => '_language', 'id' => $field_id)); 68 $select_lang->add(array_values($a_lang), array_keys($a_lang)); 69 70 $out .= sprintf( 71 "<tr><td class=\"title\"><label for=\"%s\">%s</label></td><td>%s</td></tr>\n", 72 $field_id, 73 rc_main::Q(rcube_label('language')), 74 $select_lang->show($sess_user_lang) 75 ); 76 } 77 78 79 // show page size selection 80 if (!isset($no_override['timezone'])) { 81 $field_id = 'rcmfd_timezone'; 82 $select_timezone = new select(array('name' => '_timezone', 'id' => $field_id)); 83 $select_timezone->add('(GMT -11:00) Midway Island, Samoa', '-11'); 84 $select_timezone->add('(GMT -10:00) Hawaii', '-10'); 85 $select_timezone->add('(GMT -9:00) Alaska', '-9'); 86 $select_timezone->add('(GMT -8:00) Pacific Time (US/Canada)', '-8'); 87 $select_timezone->add('(GMT -7:00) Mountain Time (US/Canada)', '-7'); 88 $select_timezone->add('(GMT -6:00) Central Time (US/Canada), Mexico City', '-6'); 89 $select_timezone->add('(GMT -5:00) Eastern Time (US/Canada), Bogota, Lima', '-5'); 90 $select_timezone->add('(GMT -4:00) Atlantic Time (Canada), Caracas, La Paz', '-4'); 91 $select_timezone->add('(GMT -3:00) Brazil, Buenos Aires, Georgetown', '-3'); 92 $select_timezone->add('(GMT -3:30) Nfld Time (Canada), Nfld, S. Labador', '-3.5'); 93 $select_timezone->add('(GMT -2:00) Mid-Atlantic', '-2'); 94 $select_timezone->add('(GMT -1:00) Azores, Cape Verde Islands', '-1'); 95 $select_timezone->add('(GMT) Western Europe, London, Lisbon, Casablanca', '0'); 96 $select_timezone->add('(GMT +1:00) Central European Time', '1'); 97 $select_timezone->add('(GMT +2:00) EET: Kaliningrad, South Africa', '2'); 98 $select_timezone->add('(GMT +3:00) Baghdad, Kuwait, Riyadh, Moscow, Nairobi', '3'); 99 $select_timezone->add('(GMT +3:30) Tehran', '3.5'); 100 $select_timezone->add('(GMT +4:00) Abu Dhabi, Muscat, Baku, Tbilisi', '4'); 101 $select_timezone->add('(GMT +4:30) Kabul', '4.5'); 102 $select_timezone->add('(GMT +5:00) Ekaterinburg, Islamabad, Karachi', '5'); 103 $select_timezone->add('(GMT +5:30) Chennai, Kolkata, Mumbai, New Delhi', '5.5'); 104 $select_timezone->add('(GMT +5:45) Kathmandu', '5.75'); 105 $select_timezone->add('(GMT +6:00) Almaty, Dhaka, Colombo', '6'); 106 $select_timezone->add('(GMT +7:00) Bangkok, Hanoi, Jakarta', '7'); 107 $select_timezone->add('(GMT +8:00) Beijing, Perth, Singapore, Taipei', '8'); 108 $select_timezone->add('(GMT +9:00) Tokyo, Seoul, Yakutsk', '9'); 109 $select_timezone->add('(GMT +9:30) Adelaide, Darwin', '9.5'); 110 $select_timezone->add('(GMT +10:00) EAST/AEST: Guam, Vladivostok', '10'); 111 $select_timezone->add('(GMT +11:00) Magadan, Solomon Islands', '11'); 112 $select_timezone->add('(GMT +12:00) Auckland, Wellington, Kamchatka', '12'); 113 $select_timezone->add('(GMT +13:00) Tonga, Pheonix Islands', '13'); 114 $select_timezone->add('(GMT +14:00) Kiribati', '14'); 115 116 117 $out .= sprintf( 118 "<tr><td class=\"title\"><label for=\"%s\">%s</label></td><td>%s</td></tr>\n", 119 $field_id, 120 rc_main::Q(rcube_label('timezone')), 121 $select_timezone->show($CONFIG['timezone']) 122 ); 123 } 124 125 // daylight savings 126 if (!isset($no_override['dst_active'])) { 127 $field_id = 'rcmfd_dst'; 128 $input_dst = new checkbox(array('name' => '_dst_active', 'id' => $field_id, 'value' => 1)); 129 $out .= sprintf( 130 "<tr><td class=\"title\"><label for=\"%s\">%s</label></td><td>%s</td></tr>\n", 131 $field_id, 132 rc_main::Q(rcube_label('dstactive')), 133 $input_dst->show($CONFIG['dst_active']) 134 ); 135 } 136 137 // show page size selection 138 if (!isset($no_override['pagesize'])) { 139 $field_id = 'rcmfd_pgsize'; 140 $input_pagesize = new textfield(array('name' => '_pagesize', 'id' => $field_id, 'size' => 5)); 141 142 $out .= sprintf( 143 "<tr><td class=\"title\"><label for=\"%s\">%s</label></td><td>%s</td></tr>\n", 144 $field_id, 145 rc_main::Q(rcube_label('pagesize')), 146 $input_pagesize->show($CONFIG['pagesize']) 147 ); 148 } 149 150 // MM: Show checkbox for toggling 'pretty dates' 151 if (!isset($no_override['prettydate'])) { 152 $field_id = 'rcmfd_prettydate'; 153 $input_prettydate = new checkbox(array('name' => '_pretty_date', 'id' => $field_id, 'value' => 1)); 154 155 $out .= sprintf( 156 "<tr><td class=\"title\"><label for=\"%s\">%s</label></td><td>%s</td></tr>\n", 157 $field_id, 158 rc_main::Q(rcube_label('prettydate')), 159 $input_prettydate->show($CONFIG['prettydate']?1:0) 160 ); 161 } 162 163 // show checkbox for HTML/plaintext messages 164 if (!isset($no_override['prefer_html'])) { 165 $field_id = 'rcmfd_htmlmsg'; 166 $input_pagesize = new checkbox(array('name' => '_prefer_html', 'id' => $field_id, 'value' => 1)); 167 168 $out .= sprintf( 169 "<tr><td class=\"title\"><label for=\"%s\">%s</label></td><td>%s</td></tr>\n", 170 $field_id, 171 rc_main::Q(rcube_label('preferhtml')), 172 $input_pagesize->show($CONFIG['prefer_html']?1:0) 173 ); 174 } 175 176 // Show checkbox for HTML Editor 177 if (false && !isset($no_override['htmleditor'])) { 178 $field_id = 'rcmfd_htmleditor'; 179 $input_htmleditor = new checkbox(array('name' => '_htmleditor', 'id' => $field_id, 'value' => 1)); 180 $out .= sprintf( 181 "<tr><td class=\"title\"><label for=\"%s\">%s</label></td><td>%s</td></tr>\n", 182 $field_id, 183 rc_main::Q(rcube_label('htmleditor')), 184 $input_htmleditor->show($CONFIG['htmleditor']?1:0) 185 ); 186 } 187 188 // show config parameter for preview pane 189 if (false && !isset($no_override['preview_pane'])) { 174 190 $field_id = 'rcmfd_preview'; 175 191 $input_preview = new checkbox(array('name' => '_preview_pane', 'id' => $field_id, 'value' => 1)); … … 179 195 $input_preview->show($CONFIG['preview_pane']?1:0)); 180 196 } 181 182 if (!empty($CONFIG['drafts_mbox']) && !isset($no_override['draft_autosave'])) 183 { 184 $field_id = 'rcmfd_autosave'; 185 $select_autosave = new select(array('name' => '_draft_autosave', 'id' => $field_id)); 186 $select_autosave->add(rcube_label('never'), 0); 187 foreach (array(3, 5, 10) as $i => $min) 188 $select_autosave->add(rcube_label(array('name' => 'everynminutes', 'vars' => array('n' => $min))), $min*60); 189 190 $out .= sprintf("<tr><td class=\"title\"><label for=\"%s\">%s</label></td><td>%s</td></tr>\n", 191 $field_id, 192 Q(rcube_label('autosavedraft')), 193 $select_autosave->show($CONFIG['draft_autosave'])); 194 } 195 196 $out .= "\n</table>$form_end"; 197 198 return $out; 199 } 197 198 if (!empty($CONFIG['drafts_mbox']) && !isset($no_override['draft_autosave'])) { 199 $field_id = 'rcmfd_autosave'; 200 $select_autosave = new select(array('name' => '_draft_autosave', 'id' => $field_id)); 201 $select_autosave->add(rcube_label('never'), 0); 202 foreach (array(3, 5, 10) as $i => $min) { 203 $select_autosave->add( 204 rcube_label( 205 array( 206 'name' => 'everynminutes', 207 'vars' => array('n' => $min) 208 ) 209 ), 210 $min*60 211 ); 212 } 213 $out .= sprintf( 214 "<tr><td class=\"title\"><label for=\"%s\">%s</label></td><td>%s</td></tr>\n", 215 $field_id, 216 rc_main::Q(rcube_label('autosavedraft')), 217 $select_autosave->show($CONFIG['draft_autosave']) 218 ); 219 } 220 221 $out .= "\n</table>$form_end"; 222 223 return $out; 224 } 200 225 201 226 202 227 203 228 function rcmail_identities_list($attrib) 204 { 205 global $DB, $CONFIG, $OUTPUT; 206 207 208 // get contacts from DB 209 $sql_result = $DB->query("SELECT * FROM ".get_table_name('identities')." 210 WHERE del<>1 211 AND user_id=? 212 ORDER BY standard DESC, name ASC", 213 $_SESSION['user_id']); 214 215 216 // add id to message list table if not specified 217 if (!strlen($attrib['id'])) 218 $attrib['id'] = 'rcmIdentitiesList'; 219 220 // define list of cols to be displayed 221 $a_show_cols = array('name', 'email', 'organization', 'reply-to'); 222 223 // create XHTML table 224 $out = rcube_table_output($attrib, $sql_result, $a_show_cols, 'identity_id'); 225 226 // set client env 227 $OUTPUT->add_gui_object('identitieslist', $attrib['id']); 228 229 return $out; 230 } 229 { 230 $registry = rc_registry::getInstance(); 231 $DB = $registry->get('DB', 'core'); 232 $CONFIG = $registry->get('CONFIG', 'core'); 233 $OUTPUT = $registry->get('OUTPUT', 'core'); 234 235 236 // get contacts from DB 237 $_query = "SELECT * FROM " . rc_main::get_table_name('identities'); 238 $_query.= " WHERE del<>1"; 239 $_query.= " AND user_id=?"; 240 $_query.= " ORDER BY standard DESC, name ASC"; 241 $sql_result = $DB->query($_query, $_SESSION['user_id']); 242 243 // add id to message list table if not specified 244 if (!strlen($attrib['id'])) { 245 $attrib['id'] = 'rcmIdentitiesList'; 246 } 247 // define list of cols to be displayed 248 $a_show_cols = array('name', 'email', 'organization', 'reply-to'); 249 250 // create XHTML table 251 $out = rcube_table_output($attrib, $sql_result, $a_show_cols, 'identity_id'); 252 253 // set client env 254 $OUTPUT->add_gui_object('identitieslist', $attrib['id']); 255 256 return $out; 257 } 231 258 232 259 … … 234 261 // similar function as in /steps/addressbook/edit.inc 235 262 function get_form_tags($attrib, $action, $add_hidden=array()) 236 { 237 global $OUTPUT, $EDIT_FORM, $SESS_HIDDEN_FIELD; 238 239 $form_start = ''; 240 if (!strlen($EDIT_FORM)) 241 { 242 $hiddenfields = new hiddenfield(array('name' => '_task', 'value' => $GLOBALS['_task'])); 243 $hiddenfields->add(array('name' => '_action', 'value' => $action)); 244 245 if ($add_hidden) 246 $hiddenfields->add($add_hidden); 247 248 if ($_GET['_framed'] || $_POST['_framed']) 249 $hiddenfields->add(array('name' => '_framed', 'value' => 1)); 250 251 $form_start = !strlen($attrib['form']) ? '<form name="form" action="./" method="post">' : ''; 252 $form_start .= "\n$SESS_HIDDEN_FIELD\n"; 253 $form_start .= $hiddenfields->show(); 254 } 255 256 $form_end = (!strlen($EDIT_FORM) && !strlen($attrib['form'])) ? '</form>' : ''; 257 $form_name = strlen($attrib['form']) ? $attrib['form'] : 'form'; 258 259 if (!strlen($EDIT_FORM)) 260 $OUTPUT->add_gui_object('editform', $form_name); 261 262 $EDIT_FORM = $form_name; 263 264 return array($form_start, $form_end); 265 } 263 { 264 $registry = rc_registry::getInstance(); 265 $EDIT_FORM = $registry->get('EDIT_FORM', 'core'); 266 $SESS_HIDDEN_FIELD = $registry->get('SESS_HIDDEN_FIELD', 'core'); 267 $OUTPUT = $registry->get('OUTPUT', 'core'); 268 269 $form_start = ''; 270 if (!strlen($EDIT_FORM)) { 271 $hiddenfields = new hiddenfield(array('name' => '_task', 'value' => $GLOBALS['_task'])); 272 $hiddenfields->add(array('name' => '_action', 'value' => $action)); 273 274 if ($add_hidden) { 275 $hiddenfields->add($add_hidden); 276 } 277 if ($_GET['_framed'] || $_POST['_framed']) { 278 $hiddenfields->add(array('name' => '_framed', 'value' => 1)); 279 } 280 $form_start = !strlen($attrib['form']) ? '<form name="form" action="./" method="post">' : ''; 281 $form_start .= "\n$SESS_HIDDEN_FIELD\n"; 282 $form_start .= $hiddenfields->show(); 283 } 284 $form_end = (!strlen($EDIT_FORM) && !strlen($attrib['form'])) ? '</form>' : ''; 285 $form_name = strlen($attrib['form']) ? $attrib['form'] : 'form'; 286 287 if (!strlen($EDIT_FORM)) { 288 $OUTPUT->add_gui_object('editform', $form_name); 289 } 290 $EDIT_FORM = $form_name; 291 $registry->set('EDIT_FORM', $EDIT_FORM, 'core'); 292 293 return array($form_start, $form_end); 294 } 266 295 267 296 268 297 // register UI objects 269 298 $OUTPUT->add_handlers(array( 270 'userprefs' => 'rcmail_user_prefs_form',271 'itentitieslist' => 'rcmail_identities_list'299 'userprefs' => 'rcmail_user_prefs_form', 300 'itentitieslist' => 'rcmail_identities_list' 272 301 )); 273 274 275 302 ?> -
branches/devel-vnext/program/steps/settings/identities.inc
r606 r623 38 38 $OUTPUT->set_env('contentframe', $attrib['name']); 39 39 40 $attrib_str = create_attrib_string($attrib, array('name', 'id', 'class', 'style', 'src', 'width', 'height', 'frameborder'));40 $attrib_str = rc_main::create_attrib_string($attrib, array('name', 'id', 'class', 'style', 'src', 'width', 'height', 'frameborder')); 41 41 $out = '<iframe'. $attrib_str . '></iframe>'; 42 42 -
branches/devel-vnext/program/steps/settings/manage_folders.inc
r589 r623 109 109 // build table with all folders listed by server 110 110 function rcube_subscription_form($attrib) 111 {112 global $IMAP, $CONFIG, $OUTPUT;113 114 list($form_start, $form_end) = get_form_tags($attrib, 'folders');115 unset($attrib['form']);111 { 112 global $IMAP, $CONFIG, $OUTPUT; 113 114 list($form_start, $form_end) = get_form_tags($attrib, 'folders'); 115 unset($attrib['form']); 116 116 117 117 … … 120 120 121 121 // allow the following attributes to be added to the <table> tag 122 $attrib_str = create_attrib_string($attrib, array('style', 'class', 'id', 'cellpadding', 'cellspacing', 'border', 'summary'));122 $attrib_str = rc_main::create_attrib_string($attrib, array('style', 'class', 'id', 'cellpadding', 'cellspacing', 'border', 'summary')); 123 123 124 124 $out = "$form_start\n<table" . $attrib_str . ">\n";
Note: See TracChangeset
for help on using the changeset viewer.
