Changeset 929a508 in github
- Timestamp:
- Mar 1, 2010 2:04:34 PM (3 years ago)
- Branches:
- master, HEAD, courier-fix, dev-browser-capabilities, pdo, release-0.6, release-0.7, release-0.8
- Children:
- 0c4d3fd
- Parents:
- a72ad65
- Files:
-
- 1 added
- 11 edited
-
CHANGELOG (modified) (1 diff)
-
index.php (modified) (1 diff)
-
plugins/managesieve/managesieve.php (modified) (2 diffs)
-
plugins/new_user_dialog/new_user_dialog.php (modified) (1 diff)
-
program/include/iniset.php (modified) (1 diff)
-
program/include/main.inc (modified) (1 diff)
-
program/include/rcmail.php (modified) (11 diffs)
-
program/include/rcube_plugin_api.php (modified) (1 diff)
-
program/include/rcube_session.php (added)
-
program/include/rcube_template.php (modified) (1 diff)
-
program/include/rcube_user.php (modified) (2 diffs)
-
program/steps/mail/func.inc (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
CHANGELOG
ra72ad65 r929a508 2 2 =========================== 3 3 4 - Improve performance by avoiding unnecessary updates to the session table (#1486325) 4 5 - Fix invalid font tags which cause HTML message rendering problems (#1486521) 5 6 - Fix CVE-2010-0464: Disable DNS prefetching (#1486449) -
index.php
r64608bf r929a508 97 97 $RCMAIL->login($auth['user'], $auth['pass'], $auth['host'])) { 98 98 // create new session ID 99 rcube_sess_unset('temp');100 rcube_sess_regenerate_id();99 $RCMAIL->session->remove('temp'); 100 $RCMAIL->session->regenerate_id(); 101 101 102 102 // send auth cookie if necessary -
plugins/managesieve/managesieve.php
r47d8d39 r929a508 222 222 $this->rc->output->show_message('managesieve.setdeleted', 'confirmation'); 223 223 $this->rc->output->command('managesieve_reload'); 224 rcube_sess_unset('managesieve_current');224 $this->rc->session->remove('managesieve_current'); 225 225 } else { 226 226 $this->rc->output->show_message('managesieve.setdeleteerror', 'error'); … … 271 271 $this->rc->output->show_message('managesieve.setcreated', 'confirmation'); 272 272 $this->rc->output->command('parent.managesieve_reload', $name); 273 // rcube_sess_unset('managesieve_current');273 // $this->rc->session->remove('managesieve_current'); 274 274 } else { 275 275 $this->rc->output->show_message($error, 'error'); -
plugins/new_user_dialog/new_user_dialog.php
rfb915a7 r929a508 99 99 if (!empty($save_data['name']) && !empty($save_data['email'])) { 100 100 $rcmail->user->update_identity($identity['identity_id'], $save_data); 101 rcube_sess_unset('plugin.newuserdialog');101 $rcmail->session->remove('plugin.newuserdialog'); 102 102 } 103 103 -
program/include/iniset.php
r2b35c5d r929a508 53 53 54 54 ini_set('error_reporting', E_ALL&~E_NOTICE); 55 if (!empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) != 'off') {56 ini_set('session.cookie_secure', 1);57 } else {58 ini_set('session.cookie_secure', 0);59 }60 ini_set('session.name', 'roundcube_sessid');61 ini_set('session.use_cookies', 1);62 ini_set('session.use_only_cookies', 1);63 ini_set('session.serialize_handler', 'php');64 55 65 56 // increase maximum execution time for php scripts -
program/include/main.inc
r72b140d r929a508 1488 1488 if ($port && $_SERVER['SERVER_PORT'] == $port) 1489 1489 return true; 1490 if ($use_https && $RCMAIL->config->get('use_https'))1490 if ($use_https && isset($RCMAIL) && $RCMAIL->config->get('use_https')) 1491 1491 return true; 1492 1492 1493 1493 return false; 1494 } 1495 1496 // for backward compatibility 1497 function rcube_sess_unset($var_name=null) 1498 { 1499 global $RCMAIL; 1500 1501 $RCMAIL->session->remove($var_name); 1494 1502 } 1495 1503 -
program/include/rcmail.php
r47d8d39 r929a508 36 36 public $user; 37 37 public $db; 38 public $session; 38 39 public $smtp; 39 40 public $imap; … … 83 84 private function startup() 84 85 { 85 $config_all = $this->config->all();86 87 86 // initialize syslog 88 87 if ($this->config->get('log_driver') == 'syslog') { … … 95 94 $GLOBALS['DB'] = $this->get_dbh(); 96 95 97 // use database for storing session data 98 include_once('include/session.inc'); 99 100 // set session domain 101 if (!empty($config_all['session_domain'])) { 102 ini_set('session.cookie_domain', $config_all['session_domain']); 103 } 104 // set session garbage collecting time according to session_lifetime 105 if (!empty($config_all['session_lifetime'])) { 106 ini_set('session.gc_maxlifetime', ($config_all['session_lifetime']) * 120); 107 } 108 109 // start PHP session (if not in CLI mode) 110 if ($_SERVER['REMOTE_ADDR']) 111 session_start(); 112 113 // set initial session vars 114 if (!isset($_SESSION['auth_time'])) { 115 $_SESSION['auth_time'] = time(); 116 $_SESSION['temp'] = true; 117 } 96 // start session 97 $this->session_init(); 118 98 119 99 // create user object 120 100 $this->set_user(new rcube_user($_SESSION['user_id'])); 101 102 // configure session (after user config merge!) 103 $this->session_configure(); 121 104 122 105 // set task and action properties … … 126 109 // reset some session parameters when changing task 127 110 if ($_SESSION['task'] != $this->task) 128 rcube_sess_unset('page');111 $this->session->remove('page'); 129 112 130 113 // set current task to session … … 133 116 // init output class 134 117 if (!empty($_REQUEST['_remote'])) 135 $GLOBALS['OUTPUT'] = $this-> init_json();118 $GLOBALS['OUTPUT'] = $this->json_init(); 136 119 else 137 120 $GLOBALS['OUTPUT'] = $this->load_gui(!empty($_REQUEST['_framed'])); … … 315 298 316 299 // set keep-alive/check-recent interval 317 if ($keep_alive = $this->config->get('keep_alive')) { 318 // be sure that it's less than session lifetime 319 if ($session_lifetime = $this->config->get('session_lifetime')) 320 $keep_alive = min($keep_alive, $session_lifetime * 60 - 30); 321 $this->output->set_env('keep_alive', max(60, $keep_alive)); 300 if ($keep_alive = $this->session->get_keep_alive()) { 301 $this->output->set_env('keep_alive', $keep_alive); 322 302 } 323 303 … … 344 324 * @return object rcube_json_output Reference to JSON output object 345 325 */ 346 public function init_json()326 public function json_init() 347 327 { 348 328 if (!($this->output instanceof rcube_json_output)) … … 441 421 442 422 return $conn; 423 } 424 425 426 /** 427 * Create session object and start the session. 428 */ 429 public function session_init() 430 { 431 $lifetime = $this->config->get('session_lifetime', 0) * 60; 432 433 // set session domain 434 if ($domain = $this->config->get('session_domain')) { 435 ini_set('session.cookie_domain', $domain); 436 } 437 // set session garbage collecting time according to session_lifetime 438 if ($lifetime) { 439 ini_set('session.gc_maxlifetime', $lifetime * 2); 440 } 441 442 ini_set('session.cookie_secure', rcube_https_check()); 443 ini_set('session.name', 'roundcube_sessid'); 444 ini_set('session.use_cookies', 1); 445 ini_set('session.use_only_cookies', 1); 446 ini_set('session.serialize_handler', 'php'); 447 448 // use database for storing session data 449 $this->session = new rcube_session($this->get_dbh(), $lifetime); 450 451 $this->session->register_gc_handler('rcmail_temp_gc'); 452 if ($this->config->get('enable_caching')) 453 $this->session->register_gc_handler('rcmail_cache_gc'); 454 455 // start PHP session (if not in CLI mode) 456 if ($_SERVER['REMOTE_ADDR']) 457 session_start(); 458 459 // set initial session vars 460 if (!isset($_SESSION['auth_time'])) { 461 $_SESSION['auth_time'] = time(); 462 $_SESSION['temp'] = true; 463 } 464 } 465 466 467 /** 468 * Configure session object internals 469 */ 470 public function session_configure() 471 { 472 $lifetime = $this->config->get('session_lifetime', 0) * 60; 473 474 // set keep-alive/check-recent interval 475 if ($keep_alive = $this->config->get('keep_alive')) { 476 // be sure that it's less than session lifetime 477 if ($lifetime) 478 $keep_alive = min($keep_alive, $lifetime - 30); 479 $keep_alive = max(60, $keep_alive); 480 $this->session->set_keep_alive($keep_alive); 481 } 443 482 } 444 483 … … 795 834 function authenticate_session() 796 835 { 797 global $SESS_CLIENT_IP, $SESS_CHANGED;798 799 836 // advanced session authentication 800 837 if ($this->config->get('double_auth')) { … … 811 848 } 812 849 else { 813 $valid = $this->config->get('ip_check') ? $_SERVER['REMOTE_ADDR'] == $ SESS_CLIENT_IP: true;850 $valid = $this->config->get('ip_check') ? $_SERVER['REMOTE_ADDR'] == $this->session->get_ip() : true; 814 851 } 815 852 816 853 // check session filetime 817 854 $lifetime = $this->config->get('session_lifetime'); 818 if (!empty($lifetime) && isset($SESS_CHANGED) && $SESS_CHANGED + $lifetime*60 < time()) { 855 $sess_ts = $this->session->get_ts(); 856 if (!empty($lifetime) && !empty($sess_ts) && $sess_ts + $lifetime*60 < time()) { 819 857 $valid = false; 820 858 } … … 831 869 $this->plugins->exec_hook('kill_session'); 832 870 833 rcube_sess_unset();871 $this->session->remove(); 834 872 $_SESSION = array('language' => $this->user->language, 'auth_time' => time(), 'temp' => true); 835 873 rcmail::setcookie('sessauth', '-del-', time() - 60); -
program/include/rcube_plugin_api.php
r48bc52e r929a508 70 70 * Load and init all enabled plugins 71 71 * 72 * This has to be done after rcmail::load_gui() or rcmail:: init_json()72 * This has to be done after rcmail::load_gui() or rcmail::json_init() 73 73 * was called because plugins need to have access to rcmail->output 74 74 */ -
program/include/rcube_template.php
r030db5b r929a508 987 987 } 988 988 989 // get e-mail address f orm default identity989 // get e-mail address from default identity 990 990 if ($sql_arr = $this->app->user->get_identity()) { 991 991 $username = $sql_arr['email']; -
program/include/rcube_user.php
r333c48c r929a508 48 48 if ($id && !$sql_arr) 49 49 { 50 $sql_result = $this->db->query("SELECT * FROM ".get_table_name('users')." WHERE user_id=?", $id);50 $sql_result = $this->db->query("SELECT * FROM ".get_table_name('users')." WHERE user_id=?", $id); 51 51 $sql_arr = $this->db->fetch_assoc($sql_result); 52 52 } … … 155 155 $sql_result = $this->db->query( 156 156 "SELECT * FROM ".get_table_name('identities')." 157 WHERE del<>1 158 AND user_id=? 157 WHERE del<>1 AND user_id=? 159 158 $sql_add 160 159 ORDER BY ".$this->db->quoteIdentifier('standard')." DESC, name ASC, identity_id ASC", -
program/steps/mail/func.inc
r47d8d39 r929a508 1326 1326 return; 1327 1327 1328 rcmail::get_instance()->plugins->exec_hook('cleanup_attachments',array());1329 1330 rcube_sess_unset('compose');1328 $rcmail = rcmail::get_instance(); 1329 $rcmail->plugins->exec_hook('cleanup_attachments',array()); 1330 $rcmail->session->remove('compose'); 1331 1331 } 1332 1332
Note: See TracChangeset
for help on using the changeset viewer.
