Changeset 957 in subversion
- Timestamp:
- Jan 27, 2008 1:45:44 PM (5 years ago)
- Location:
- branches/devel-vnext
- Files:
-
- 1 added
- 1 deleted
- 22 edited
-
CHANGELOG (modified) (1 diff)
-
INSTALL (modified) (4 diffs)
-
SQL/mssql.initial.sql (modified) (1 diff)
-
SQL/mysql.initial.sql (modified) (2 diffs)
-
SQL/mysql.update-0.1a.sql (deleted)
-
SQL/mysql.update.sql (modified) (2 diffs)
-
SQL/mysql5.initial.sql (modified) (2 diffs)
-
SQL/postgres.initial.sql (modified) (1 diff)
-
SQL/postgres.update.sql (modified) (1 diff)
-
SQL/sqlite.initial.sql (modified) (1 diff)
-
UPGRADING (modified) (3 diffs)
-
config/db.inc.php.dist (modified) (3 diffs)
-
config/main.inc.php.dist (modified) (7 diffs)
-
program/include/bootstrap.php (modified) (5 diffs)
-
program/include/globals.php (modified) (31 diffs)
-
program/include/rcube.php (modified) (3 diffs)
-
program/include/rcube_contacts.php (modified) (5 diffs)
-
program/include/rcube_error.php (modified) (1 diff)
-
program/include/rcube_ldap.php (modified) (7 diffs)
-
program/include/rcube_smtp.php (modified) (2 diffs)
-
program/include/rcube_sqlite.inc (modified) (2 diffs)
-
program/include/rcube_template.php (modified) (54 diffs)
-
program/include/rcube_user.php (added)
-
program/include/session.inc (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/devel-vnext/CHANGELOG
r916 r957 2 2 --------------------------- 3 3 4 2007/11/12 (tomekp) 5 - MFH: ar, ca, de_DE, en_GB, en_US, eu, fa, fr, ja, lt, ru, se, sk, sl localizations 4 2008/01/08 (tomekp) 5 ---------- 6 - add he (Hebrew) localization (#1484713) 7 8 9 2008/01/08 (tomekp) 10 ---------- 11 - update fr localization 12 13 14 2008/01/04 (tomekp) 15 - purge kur_KU because it has no messages translation 16 - bump copyright for all localization files 17 18 19 2007/12/31 (tomekp) 20 ---------- 21 - update es localization 22 23 24 2007/12/28 (tomekp) 25 ---------- 26 - update mk localization 27 28 29 2007/12/27 (tomekp) 30 ---------- 31 - update se localization 32 33 34 2007/12/13 (robin) 35 ---------- 36 - Add Received header on outgoing mail 37 38 39 2007/12/10 (estadtherr) 40 ---------- 41 - Upgrade to TinyMCE 2.1.3 42 - Allow inserting image attachments into HTML messages while composing (#1484557) 43 44 45 2007/12/10 (thomasb) 46 ---------- 47 - Delegate user-stuff to new class rcube_user 48 - Implement Message-Disposition-Notification (Receipts) 49 50 51 2007/12/05 (tomekp) 52 ---------- 53 - update bg, uk localization 54 55 56 2007/12/04 (tomekp) 57 ---------- 58 - update bg localization 59 60 61 2007/11/25 (thomasb) 62 ---------- 63 - Applied UID fetch patch by Glen Ogilvie 64 - Applied patch for correct Postgres instructions from ticket #1484674 65 - Fix overriding of session vars when register_globals is on (#1484670) 66 - Fix wrong Postgres setup instructions in INSTALL (#1484674) 67 - Fix bug with case-sensitive folder names (#1484245) 68 - Don't create default folders by default 69 - Added Georgian localization by Zaza Zviadadze 70 - Updated Russian localization 71 - Fixed some potential security risks (audited by Andris) 72 - Only show new messages if they match the current search (#1484176) 73 74 75 2007/11/20 (tomekp) 76 ---------- 77 - add Korean (kr) localization 78 79 80 2007/11/14 (tomekp) 81 ---------- 82 - update id_ID localization 83 84 85 2007/11/06 (thomasb) 86 ---------- 87 - Switch to/from when searcing in Sent folder (#1484555) 88 - Correctly read the References header (#1484646) 89 - Unset old cookie in before sending a new value (#1484639) 90 - Correctly decode attachments when downloading them (#1484645 and #1484642) 91 6 92 7 93 2007/10/22 (tomekp) 8 - MFH: da, eo, gl, hu, ru localizations 9 10 2007/10/17 (tomekp) 11 - MFH: update ca, cz, es, it, pt_BR, pt_PT localizations 12 13 2007/10/05 14 - MFH: add Esperanto localization 15 - MFH: update German localization 16 17 2007/10/04 (tomekp) 18 ---------- 19 - MFH: all localizations 94 ---------- 95 - update ru, eo localizations 96 97 98 2007/10/17 (thomasb) 99 ---------- 100 - Make message listing less error prone 101 102 103 2007/10/10 (thomasb) 104 ---------- 105 - Suppress IE errors when clearing attachments form (#1484356) 106 - Set preferences field in user table to NULL (#1484386) 107 - Log error when login fails due to auto_create_user turned off 108 - Update UPGRADING instructions 109 110 111 2007/10/05 (tomekp) 112 ---------- 113 - Add Esperanto localization 114 115 116 +2007/10/04 (Stiwi) 117 ---------- 118 - Updated German localization 119 120 121 2007/10/04 (yllar) 122 ---------- 123 - Added Malay localization 124 - Updated Lithuanian localization 125 20 126 21 127 2007/09/27 (tomekp) 22 128 ---------- 129 - Update dutch localization (closes #1484588) 130 131 132 2007/09/29 (thomasb) 133 ---------- 134 - Filter linked/imported CSS files (closes #1484056) 135 136 137 2007/09/27 (tomekp) 138 ---------- 23 139 - Update brazilian portuguese localization (#1484580) 24 140 141 142 2007/09/26 (thomasb) 143 ---------- 144 - Improve message compose screen (closes #1484383) 145 - Select next row after removing one from list (#1484387) 146 147 25 148 2007/09/26 (tomekp) 26 149 ---------- 150 - Add polish labels for changes in r816. 27 151 - Update polish localization (#1484579) 28 152 - Update thai localization (#1484578) 29 153 154 155 2007/09/25 (robin) 156 ---------- 157 - Enable drag-/dropping of folders to a new parent folder (#1457344) 158 159 160 2007/09/24 (robin) 161 ---------- 162 - Fix preview pane size for Safari & Konqueror (#1484187) 163 164 165 2007/09/20 (robin) 166 ---------- 167 - Make smtp HELO/EHLO hostname configurable (#1484067) 168 169 170 2007/09/19 (thomasb) 171 ---------- 172 - IPv6 Compatability (#1484322), Patch #1484373 173 - Unlock interface when message sending fails (#1484570) 174 - Eval PHP code in template includes (if configured) 175 - Show message when folder is empty. Mo more static text in table (#1484395) 176 - Only display unread count in page title when new messages arrived 177 - Show mailbox name in page title 178 179 180 2007/09/09 (thomasb) 181 ---------- 182 - Fixed wrong delete button tooltip (#1483965) 183 - Fixed charset encoding bug (#1484429) 184 - Applied patch for LDAP version (#1484552) 185 - Improved XHTML validation 186 187 188 2007/09/05 (thomasb) 189 ---------- 190 - Fix message list selection (#1484550) 191 - Better fix lowercased usernames (#1484473) 192 - Update pngbehavior Script as suggested in #1484490 193 194 195 2007/08/29 (richs) 196 ---------- 197 - Fixed moving/deleting messages when more than 1 is selected 198 199 200 2007/08/15 (thomasb) 201 ---------- 202 - Applied patch for LDAP contacts listing by Glen Ogilvie 203 - Applied patch for more address fields in LDAP contacts (#1484402) 204 - Close LDAP connections on script shutdown 205 206 207 2007/08/13 (thomasb) 208 ---------- 209 - Add alternative for getallheaders() (fix #1484508) 210 - Revert changes for mbstring usage (fix #1484509) 211 212 213 2007/08/10 (thomasb) 214 ---------- 215 - Identify mailboxes case-sensitive 216 - Sort mailbox list case-insensitive (closes #1484338) 217 - Fix display of multipart messages from Apple Mail (closes #1484027) 218 - Protect AJAX request from being fetched by a foreign site (XSS) 219 - Make autocomplete for loginform configurable by the skin template 220 - Fix compose function from address book (closes #1484426) 221 - Added //IGNORE to iconv call (patch #1484420, closes #1484023) 222 - Check if mbstring supports charset (#1484290 and #1484292) 223 - Prefer iconv over mbstring (as suggested in #1484292) 224 - Check filesize of template includes (#1484409) 225 - Updated Simplified Chinese localization 226 - Added Ukrainian translation 227 228 229 2007/08/09 (richs) 230 ---------- 231 - Fixed bug with buttons not dimming/enabling properly after switching folders 232 - Fixed compose window becoming unresponsive after saving a draft (#1484487) 233 - Re-enabled "Back" button in compose window now that bug #1484487 is fixed 234 - Fixed unresponsive interface issue when downloading attachments (#1484496) 235 - Lowered status message time from 5 to 3 seconds to improve responsiveness 236 - Added note to INSTALL about .htaccess limiting upload_max_filesize 237 - Raised .htaccess upload_max_filesize from 2M to 5M to differ from default php.ini 238 - Increased "mailboxcontrols" mail.css width from 160 to 170px to fix non-english languages (#1484499) 239 - Fixed empty-message sending with TinyMCE plain-text mode, or if it's not installed 240 241 242 2007/07/03 (thomasb) 243 ---------- 244 - Added Macedonian (Slavic FYROM) localization 245 - Fix status message bug #1484464 with regard to #1484353 246 - Fix address adding bug reported by David Koblas 247 - Applied socket error patch by Thomas Mangin 248 249 250 2007/06/28 (tomekp) 251 ---------- 252 - fix typos in Polish localization (Janusz Zamecki) 253 254 255 2007/06/27 (tomekp) 256 ---------- 257 - Update Polish (Janusz Zamecki), Croatian (Svebor Prstacic) localization 258 259 260 2007/06/12 (thomasb) 261 ---------- 262 - Updated Turkish, Polish, Finnish/Suomi, Japanese, Hungarian, Greek, Euskara localization 263 - Added Irish/Gaelic translation 264 - Little correction in Swedish translation 265 - Quote username for virtuser_query 266 - Pass-by-reference workarround for PHP5 in sendmail.inc 267 268 269 2007/06/04 (estadtherr) 270 ---------- 271 - Fixed bug in HTML->Plain editor toggling 272 273 274 2007/05/28 (thomasb) 275 --------- 276 - Fixed buggy imap_root settings (closes #1484379) 277 - Prevent default events on subject links (#1484399) 278 - Typo in rcube_smtp.inc 279 280 281 2007/05/23 (estadtherr) 282 ---------- 283 - Upgrade to TinyMCE v2.1.1.1 284 285 30 286 2007/05/18 (thomasb) 31 287 ---------- 288 - Enable drag-&-dropping of folders to a new parent and allow to create subfolders (#1457344) 289 - Suppress IE errors when clearing attachments form (#1484356) 290 - Set preferences field in user table to NULL (#1484386) 291 - Log error when login fails due to auto_create_user turned off 292 - Filter linked/imported CSS files (closes #1484056) 293 - Improve message compose screen (closes #1484383) 294 - Select next row after removing one from list (#1484387) 295 - Make smtp HELO/EHLO hostname configurable (#1484067) 296 - IPv6 Compatability (#1484322), Patch #1484373 297 - Unlock interface when message sending fails (#1484570) 298 - Eval PHP code in template includes (if configured) 299 - Show message when folder is empty. Mo more static text in table (#1484395) 300 - Only display unread count in page title when new messages arrived 301 - Fixed wrong delete button tooltip (#1483965) 302 - Fixed charset encoding bug (#1484429) 303 - Applied patch for LDAP version (#1484552) 304 - Improved XHTML validation 305 - Fix message list selection (#1484550) 306 - Better fix lowercased usernames (#1484473) 307 - Update pngbehavior Script as suggested in #1484490 308 - Fixed moving/deleting messages when more than 1 is selected 309 - Applied patch for LDAP contacts listing by Glen Ogilvie 310 - Applied patch for more address fields in LDAP contacts (#1484402) 311 - Add alternative for getallheaders() (fix #1484508) 312 - Identify mailboxes case-sensitive 313 - Sort mailbox list case-insensitive (closes #1484338) 314 - Fix display of multipart messages from Apple Mail (closes #1484027) 315 - Protect AJAX request from being fetched by a foreign site (XSS) 316 - Make autocomplete for loginform configurable by the skin template 317 - Fix compose function from address book (closes #1484426) 318 - Added //IGNORE to iconv call (patch #1484420, closes #1484023) 319 - Check if mbstring supports charset (#1484290 and #1484292) 320 - Prefer iconv over mbstring (as suggested in #1484292) 321 - Check filesize of template includes (#1484409) 322 - Fixed bug with buttons not dimming/enabling properly after switching folders 323 - Fixed compose window becoming unresponsive after saving a draft (#1484487) 324 - Re-enabled "Back" button in compose window now that bug #1484487 is fixed 325 - Fixed unresponsive interface issue when downloading attachments (#1484496) 326 - Lowered status message time from 5 to 3 seconds to improve responsiveness 327 - Raised .htaccess upload_max_filesize from 2M to 5M to differ from default php.ini 328 - Increased "mailboxcontrols" mail.css width from 160 to 170px to fix non-english languages (#1484499) 329 - Fix status message bug #1484464 with regard to #1484353 330 - Fix address adding bug reported by David Koblas 331 - Applied socket error patch by Thomas Mangin 332 - Pass-by-reference workarround for PHP5 in sendmail.inc 333 - Fixed buggy imap_root settings (closes #1484379) 334 - Prevent default events on subject links (#1484399) 32 335 - Use HTTP-POST requests for actions that change state 33 336 337 338 RELEASE 0.1.-RC1 34 339 35 340 2007/05/17 (thomasb) -
branches/devel-vnext/INSTALL
r589 r957 1 INTRODUCTION 2 ============ 3 4 This file describes the basic steps to install RoundCube Webmail on your 5 web server. For additional information, please also consult the project's 6 wiki page at 7 8 http://trac.roundcube.net/wiki 9 1 10 2 11 REQUIREMENTS 3 12 ============ 4 13 5 * The Apache Webserver14 * The Apache or Lighttpd Webserver 6 15 * .htaccess support allowing overrides for DirectoryIndex 7 * PHP Version 4.3.1 or greater 8 * PCRE (perl compatible regular expression) installed with PHP 16 * PHP Version 4.3.1 or greater including 17 - PCRE (perl compatible regular expression) 18 - libiconv (recommended) 19 - mbstring (optional) 9 20 * php.ini options: 10 21 - error_reporting E_ALL & ~E_NOTICE (or lower) 11 22 - file_uploads on (for attachment upload features) 12 23 - memory_limit (increase as suitable to support large attachments) 24 * PHP compiled with Open SSL to connect to IMAPS and to use the spell checker 13 25 * A MySQL or PostgreSQL database engine or the SQLite extension for PHP 14 * A database with permission to create tables 26 * One of the above databases with permission to create tables 27 * An SMTP server or PHP configured for mail delivery 15 28 16 29 … … 81 94 * PostgreSQL 82 95 ------------ 83 To use RoundCube with PostgreSQL support you have to follow the next 84 simple steps, which have to be done with the postgres system user (or 96 97 To use RoundCube with PostgreSQL support you have to follow these 98 simple steps, which have to be done as the postgres system user (or 85 99 which ever is the database superuser): 86 100 87 $ createuser roundcube mail88 $ createdb -O roundcube mailroundcubemail101 $ createuser roundcube 102 $ createdb -O roundcube roundcubemail 89 103 $ psql roundcubemail 90 104 91 105 roundcubemail =# ALTER USER roundcube WITH PASSWORD 'the_new_password'; 92 roundcubemail =# \c - roundcube mail106 roundcubemail =# \c - roundcube 93 107 roundcubemail => \i SQL/postgres.initial.sql 94 108 95 All this has been tested with PostgreSQL 8. 0.x and 7.4.x. Older109 All this has been tested with PostgreSQL 8.x and 7.4.x. Older 96 110 versions don't have a -O option for the createdb, so if you are 97 111 using that version you'll have to change ownership of the DB later. … … 101 115 ============= 102 116 103 Change the files in config/* according your to environment and your needs. 104 Details about the config parameters can be found in the config files 105 or in the wiki: http://trac.roundcube.net/trac.cgi/wiki/Howto_Config 117 First of all, rename the files config/*.inc.php.dist to config/*.inc.php. 118 You can then change these files according to your environment and your needs. 119 Details about the config parameters can be found in the config files. 120 121 You can also modify the default .htaccess file. This is necessary to 122 increase the allowed size of file attachments, for example: 123 php_value upload_max_filesize 2M 106 124 107 125 … … 112 130 please refer to the instructions in UPGRADING guide. 113 131 114 -
branches/devel-vnext/SQL/mssql.initial.sql
r589 r957 59 59 [created] [datetime] NOT NULL , 60 60 [changed] [datetime] NULL , 61 [ip] [varchar] ( 15) COLLATE Latin1_General_CI_AI NOT NULL ,61 [ip] [varchar] (40) COLLATE Latin1_General_CI_AI NOT NULL , 62 62 [vars] [text] COLLATE Latin1_General_CI_AI NOT NULL 63 63 ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] -
branches/devel-vnext/SQL/mysql.initial.sql
r589 r957 74 74 `created` datetime NOT NULL default '0000-00-00 00:00:00', 75 75 `changed` datetime NOT NULL default '0000-00-00 00:00:00', 76 `ip` VARCHAR( 15) NOT NULL default '',76 `ip` VARCHAR(40) NOT NULL default '', 77 77 `vars` text NOT NULL, 78 78 PRIMARY KEY (`sess_id`) … … 93 93 `last_login` datetime NOT NULL default '0000-00-00 00:00:00', 94 94 `language` varchar(5) NOT NULL default 'en', 95 `preferences` text NOT NULL default '',95 `preferences` text, 96 96 PRIMARY KEY (`user_id`) 97 97 ); -
branches/devel-vnext/SQL/mysql.update.sql
r589 r957 1 1 -- RoundCube Webmail update script for MySQL databases 2 2 -- Updates from version 0.1-beta and 0.1-beta2 3 4 TRUNCATE TABLE `messages`; 3 5 4 6 ALTER TABLE `messages` … … 11 13 ADD `html_signature` tinyint(1) default 0 NOT NULL; 12 14 15 ALTER TABLE `session` CHANGE `ip` `ip` VARCHAR(40); 16 13 17 -- Uncomment these lines if you're using MySQL 4.1 or higher 14 18 -- ALTER TABLE `users` -
branches/devel-vnext/SQL/mysql5.initial.sql
r630 r957 13 13 `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', 14 14 `changed` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', 15 `ip` varchar( 15) NOT NULL,15 `ip` varchar(40) NOT NULL, 16 16 `vars` text NOT NULL, 17 17 PRIMARY KEY(`sess_id`) … … 29 29 `last_login` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', 30 30 `language` varchar(5) NOT NULL DEFAULT 'en', 31 `preferences` text NOT NULL DEFAULT '',31 `preferences` text, 32 32 PRIMARY KEY(`user_id`) 33 33 ) TYPE=MYISAM CHARACTER SET utf8 COLLATE utf8_general_ci; -
branches/devel-vnext/SQL/postgres.initial.sql
r589 r957 37 37 created timestamp with time zone DEFAULT now() NOT NULL, 38 38 changed timestamp with time zone DEFAULT now() NOT NULL, 39 ip character varying( 16) NOT NULL,39 ip character varying(41) NOT NULL, 40 40 vars text NOT NULL 41 41 ); -
branches/devel-vnext/SQL/postgres.update.sql
r589 r957 6 6 ALTER TABLE "messages" ADD UNIQUE (user_id, cache_key, uid); 7 7 8 ALTER TABLE "identities" ADD html_signature integer DEFAULT 0 NOT NULL; 9 8 ALTER TABLE "identities" ADD html_signature INTEGER; 9 ALTER TABLE "identities" ALTER html_signature SET DEFAULT 0; 10 UPDATE identities SET html_signature = 0; 11 ALTER TABLE "identities" ALTER html_signature SET NOT NULL; -
branches/devel-vnext/SQL/sqlite.initial.sql
r589 r957 94 94 created datetime NOT NULL default '0000-00-00 00:00:00', 95 95 changed datetime NOT NULL default '0000-00-00 00:00:00', 96 ip varchar( 15) NOT NULL default '',96 ip varchar(40) NOT NULL default '', 97 97 vars text NOT NULL 98 98 ); -
branches/devel-vnext/UPGRADING
r589 r957 5 5 of RoundCube Webmail. 6 6 7 from version 0.1-rc 8 ---------------------------------------- 9 * replace index.php 10 * replace all files in folder /program/ 11 * replace all files in folder /skins/default/ 12 * If you have LDAP servers configured you should re-configure 13 the config entries using the template given in /config/main.inc.php.dist 7 14 8 15 from version 1.0-beta2 … … 11 18 * replace all files in folder /program/ 12 19 * replace all files in folder /skins/default/ 13 * run all commands in SQL/*.update.sql or re-initalize database with *.initial.sql 20 * run all commands in SQL/[yourdbtype].update.sql or 21 re-initalize the database with [yourdbtype].initial.sql 14 22 * add these lines to /config/main.inc.php 15 $rcmail_config['draft_autosave'] = 300; 16 $rcmail_config['date_today'] = 'H:i'; 17 * If you have LDAP servers configured, change prop key 'mail_field' 18 to 'email_field' for each server confgured in /config/main.inc.php 19 23 $rcmail_config['draft_autosave'] = 300; 24 $rcmail_config['date_today'] = 'H:i'; 25 * If you have LDAP servers configured you should re-configure 26 the config entries using the template given in /config/main.inc.php.dist 20 27 21 28 form version 0.1-beta … … 24 31 * replace all files in folder /program/ 25 32 * replace all files in folder /skins/default/ 26 * run all commands in SQL/*.update.sql or re-initalize database with *.initial.sql 27 * add these line to /config/db.inc.php 28 $rcmail_config['db_persistent'] = TRUE; 33 * run all commands in SQL/[yourdbtype].update.sql or 34 re-initalize the database with [yourdbtype].initial.sql 35 * add this line to /config/db.inc.php 36 $rcmail_config['db_persistent'] = false; 29 37 * add these lines to /config/main.inc.php 30 $rcmail_config['drafts_mbox'] = 'Drafts'; 31 $rcmail_config['junk_mbox'] = 'Junk'; 32 $rcmail_config['product_name'] = 'RoundCube Webmail'; 33 $rcmail_config['read_when_deleted'] = TRUE; 34 $rcmail_config['enable_spellcheck'] = TRUE; 35 $rcmail_config['protect_default_folders'] = TRUE; 36 $rcmail_config['draft_autosave'] = 300; 37 $rcmail_config['date_today'] = 'H:i'; 38 $rcmail_config['drafts_mbox'] = 'Drafts'; 39 $rcmail_config['junk_mbox'] = 'Junk'; 40 $rcmail_config['product_name'] = 'RoundCube Webmail'; 41 $rcmail_config['read_when_deleted'] = false; 42 $rcmail_config['enable_spellcheck'] = false; 43 $rcmail_config['protect_default_folders'] = false; 38 44 * replace the following line from /config/main.inc.php 39 45 @include($_SERVER['HTTP_HOST'].'.inc.php'); 40 with 41 $rcmail_config['include_host_config'] = TRUE; 42 43 44 45 from version 0.1-20051021 46 ---------------------------------------- 47 * replace index.php 48 * replace all files in folder /program/ 49 * replace all files in folder /skins/default/ 50 * run all commands in SQL/*.update-0.1a.sql or re-initalize database with *.initial.sql 51 * add these lines to /config/main.inc.php 52 $rcmail_config['skip_deleted'] = FALSE; 53 $rcmail_config['message_sort_col'] = 'date'; 54 $rcmail_config['message_sort_order'] = 'DESC'; 55 $rcmail_config['log_dir'] = 'logs/'; 56 $rcmail_config['temp_dir'] = 'temp/'; 57 $rcmail_config['message_cache_lifetime'] = '10d'; 58 $rcmail_config['drafts_mbox'] = 'Drafts'; 59 $rcmail_config['product_name'] = 'RoundCube Webmail'; 60 $rcmail_config['read_when_deleted'] = TRUE; 61 $rcmail_config['enable_spellcheck'] = TRUE; 62 * add these lines to /config/db.inc.php 63 $rcmail_config['db_max_length'] = 512000; 64 $rcmail_config['db_sequence_user_ids'] = 'user_ids'; 65 $rcmail_config['db_sequence_identity_ids'] = 'identity_ids'; 66 $rcmail_config['db_sequence_contact_ids'] = 'contact_ids'; 67 $rcmail_config['db_sequence_cache_ids'] = 'cache_ids'; 68 $rcmail_config['db_sequence_message_ids'] = 'message_ids'; 69 $rcmail_config['db_persistent'] = TRUE; 70 71 72 73 from version 0.1-20051007 74 ---------------------------------------- 75 * replace index.php 76 * replace all files in folder /program/ 77 * replace all files in folder /skins/default/ 78 * run all commands in SQL/*.update-0.1a.sql or re-initalize database with *.initial.sql 79 * add these lines to /config/main.inc.php 80 $rcmail_config['smtp_auth_type'] = ''; // if you need to specify an auth method for SMTP 81 $rcmail_config['session_lifetime'] = 20; // to specify the session lifetime in minutes 82 $rcmail_config['skip_deleted'] = FALSE; 83 $rcmail_config['message_sort_col'] = 'date'; 84 $rcmail_config['message_sort_order'] = 'DESC'; 85 $rcmail_config['log_dir'] = 'logs/'; 86 $rcmail_config['temp_dir'] = 'temp/'; 87 $rcmail_config['message_cache_lifetime'] = '10d'; 88 $rcmail_config['drafts_mbox'] = 'Drafts'; 89 $rcmail_config['product_name'] = 'RoundCube Webmail'; 90 $rcmail_config['read_when_deleted'] = TRUE; 91 $rcmail_config['enable_spellcheck'] = TRUE; 92 * add these lines to /config/db.inc.php 93 $rcmail_config['db_max_length'] = 512000; 94 $rcmail_config['db_sequence_user_ids'] = 'user_ids'; 95 $rcmail_config['db_sequence_identity_ids'] = 'identity_ids'; 96 $rcmail_config['db_sequence_contact_ids'] = 'contact_ids'; 97 $rcmail_config['db_sequence_cache_ids'] = 'cache_ids'; 98 $rcmail_config['db_sequence_message_ids'] = 'message_ids'; 99 $rcmail_config['db_persistent'] = TRUE; 100 101 102 103 from version 0.1-20050820 104 ---------------------------------------- 105 * replace index.php 106 * replace all files in folder /program/ 107 * replace all files in folder /skins/default/ 108 * run all commands in SQL/*.update-0.1a.sql or re-initalize database with *.initial.sql 109 * add these line to /config/main.inc.php 110 $rcmail_config['prettydate'] = TRUE; 111 $rcmail_config['smtp_port'] = 25; 112 $rcmail_config['default_port'] = 143; 113 $rcmail_config['session_lifetime'] = 20; 114 $rcmail_config['skip_deleted'] = FALSE; 115 $rcmail_config['message_sort_col'] = 'date'; 116 $rcmail_config['message_sort_order'] = 'DESC'; 117 $rcmail_config['log_dir'] = 'logs/'; 118 $rcmail_config['temp_dir'] = 'temp/'; 119 $rcmail_config['message_cache_lifetime'] = '10d'; 120 * replace database properties (db_type, db_host, db_user, db_pass, $d_name) 121 in /config/db.inc.php with the following line: 122 $rcmail_config['db_dsnw'] = 'mysql://roundcube:pass@localhost/roundcubemail'; 123 * add these lines to /config/db.inc.php 124 $rcmail_config['db_max_length'] = 512000; 125 126 127 128 from versions 0.1-alpha and 0.1-20050811 129 ---------------------------------------- 130 * replace index.php 131 * replace all files in folder /program/ 132 * replace all files in folder /skins/default/ 133 * run all commands in SQL/*.update-0.1a.sql or re-initalize database with *.initial.sql 134 * add these line to /config/main.inc.php 135 $rcmail_config['trash_mbox'] = 'Trash'; 136 $rcmail_config['default_imap_folders'] = array('INBOX', 'Drafts', 'Sent', 'Junk', 'Trash'); 137 $rcmail_config['prefer_html'] = TRUE; 138 $rcmail_config['prettydate'] = TRUE; 139 $rcmail_config['smtp_port'] = 25; 140 $rcmail_config['default_port'] = 143; 141 $rcmail_config['session_lifetime'] = 20; 142 $rcmail_config['skip_deleted'] = FALSE; 143 $rcmail_config['message_sort_col'] = 'date'; 144 $rcmail_config['message_sort_order'] = 'DESC'; 145 $rcmail_config['log_dir'] = 'logs/'; 146 $rcmail_config['temp_dir'] = 'temp/'; 147 $rcmail_config['message_cache_lifetime'] = '10d'; 148 * replace database properties (db_type, db_host, db_user, db_pass, $d_name) 149 in /config/db.inc.php with the following line: 150 $rcmail_config['db_dsnw'] = 'mysql://roundcube:pass@localhost/roundcubemail'; 151 * add these lines to /config/db.inc.php 152 $rcmail_config['db_max_length'] = 512000; 153 46 with 47 $rcmail_config['include_host_config'] = false; -
branches/devel-vnext/config/db.inc.php.dist
r784 r957 17 17 // PEAR database DSN for read/write operations 18 18 // format is db_provider://user:password@host/databse 19 // current yl suported db_providers: mysql, sqlite19 // currently supported db_providers: mysql, mysqli, pgsql, sqlite, mssql 20 20 21 21 $rcmail_config['db_dsnw'] = 'mysql://roundcube:pass@localhost/roundcubemail'; … … 34 34 35 35 // use persistent db-connections 36 // beware this will not "always" work as expected 37 // see: http://www.php.net/manual/en/features.persistent-connections.php 36 38 $rcmail_config['db_persistent'] = FALSE; 37 38 39 39 40 // you can define specific table names used to store webmail data … … 62 63 $rcmail_config['db_sequence_messages'] = 'message_ids'; 63 64 65 // end db config file 64 66 65 // end db config file66 67 ?> -
branches/devel-vnext/config/main.inc.php.dist
r769 r957 78 78 $rcmail_config['smtp_auth_type'] = ''; 79 79 80 // SMTP HELO host 81 // Hostname to give to the remote server for SMTP 'HELO' or 'EHLO' messages 82 // Leave this blank and you will get the server variable 'server_name' or 83 // localhost if that isn't defined. 84 $rcmail_config['smtp_helo_host'] = ''; 85 80 86 // Log sent messages 81 87 $rcmail_config['smtp_log'] = TRUE; … … 87 93 // relative path to the skin folder 88 94 $rcmail_config['skin_path'] = 'skins/default/'; 95 96 // includes should be interpreted as PHP files 97 $rcmail_config['skin_include_php'] = FALSE; 89 98 90 99 // use this folder to store temp files (must be writebale for apache user) … … 149 158 $rcmail_config['default_imap_folders'] = array('INBOX', 'Drafts', 'Sent', 'Junk', 'Trash'); 150 159 160 // automatically create the above listed default folders on login 161 $rcmail_config['create_default_folders'] = FALSE; 162 151 163 // protect the default folders from renames, deletes, and subscription changes 152 164 $rcmail_config['protect_default_folders'] = TRUE; … … 166 178 167 179 // Make use of the built-in spell checker. It is based on GoogieSpell. 180 // Since Google only accepts connections over https your PHP installatation 181 // requires to be compiled with Open SSL support 168 182 $rcmail_config['enable_spellcheck'] = TRUE; 169 183 … … 200 214 * 'bind_dn' => '', 201 215 * 'bind_pass' => '', 216 * 'ldap_version' => 3, // using LDAPv3 202 217 * 'search_fields' => array('mail', 'cn'), // fields to search in 203 218 * 'name_field' => 'cn', // this field represents the contact's name 204 219 * 'email_field' => 'mail', // this field represents the contact's e-mail 220 * 'surname_field' => 'sn', // this field represents the contact's last name 221 * 'firstname_field' => 'gn', // this field represents the contact's first name 205 222 * 'scope' => 'sub', // search mode: sub|base|list 206 * 'filter' => '', // will be &'d with search fieldex: (status=act)223 * 'filter' => '', // used for basic listing (if not empty) and will be &'d with search queries. ex: (status=act) 207 224 * 'fuzzy_search' => true); // server allows wildcard search 208 225 */ 226 227 // enable composing html formatted messages (experimental) 228 $rcmail_config['enable_htmleditor'] = FALSE; 209 229 210 230 // addressbook plugin? ;-) … … 234 254 235 255 // use this timezone to display date/time 236 $rcmail_config['timezone'] = 1;237 238 // daylight savings are On239 $rcmail_config['dst_active'] = TRUE;256 $rcmail_config['timezone'] = intval(date('O'))/100 - date('I'); 257 258 // is daylight saving On? 259 $rcmail_config['dst_active'] = (bool)date('I'); 240 260 241 261 // prefer displaying HTML messages … … 256 276 // save compose message every 300 seconds (5min) 257 277 $rcmail_config['draft_autosave'] = 300; 278 279 // default setting if preview pane is enabled 280 $rcmail_config['preview_pane'] = FALSE; 281 282 // don't let users set pagesize to more than this value if set 283 $rcmail_config['max_pagesize'] = 200; 258 284 259 285 // default setting if preview pane is enabled -
branches/devel-vnext/program/include/bootstrap.php
r806 r957 51 51 ini_set('session.gc_maxlifetime', 21600); 52 52 ini_set('session.gc_divisor', 500); 53 ini_set('error_reporting', E_ALL &~E_NOTICE);53 ini_set('error_reporting', E_ALL|E_STRICT); 54 54 set_magic_quotes_runtime(0); 55 55 … … 57 57 // (does not work in safe mode) 58 58 if (!ini_get('safe_mode')) { 59 @set_time_limit(120);59 set_time_limit(120); 60 60 } 61 62 61 63 62 /** 64 63 * Use PHP5 autoload for dynamic class loading 65 64 */ 66 function __autoload($classname) 67 { 65 function __autoload($classname) { 68 66 $filename = preg_replace( 69 67 array('/MDB2_(.+)/', '/Mail_(.+)/', '/^html_.+/'), … … 72 70 ); 73 71 74 @include_once($filename. ".php");72 include_once $filename. '.php'; 75 73 } 76 77 74 78 75 // include global functions 79 76 require_once 'globals.php'; 80 77 81 82 78 /** 83 79 * Local callback function for PEAR errors 84 80 */ 85 function rcube_pear_error($err) 86 { 81 function rcube_pear_error($err) { 87 82 error_log(sprintf("%s (%s): %s", 88 83 $err->getMessage(), … … 91 86 } 92 87 93 94 88 // set PEAR error handling 95 89 PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, 'rcube_pear_error'); 96 97 90 98 91 // create registry and set some global properties … … 101 94 102 95 96 ?> -
branches/devel-vnext/program/include/globals.php
r806 r957 16 16 +-----------------------------------------------------------------------+ 17 17 18 $Id :$19 20 */18 $Id$ 19 20 */ 21 21 22 22 /** 23 23 * RoundCube global functions 24 * 24 * 25 25 * @package Core 26 26 */ … … 32 32 * @see rcube::rep_specialchars_output() 33 33 */ 34 function Q($str, $mode='strict', $newlines=TRUE) 35 { 34 function Q($str, $mode = 'strict', $newlines = TRUE) { 36 35 return rcube::rep_specialchars_output($str, 'html', $mode, $newlines); 37 36 } … … 42 41 * @see rcube::rep_specialchars_output() 43 42 */ 44 function JQ($str) 45 { 43 function JQ($str) { 46 44 return rcube::rep_specialchars_output($str, 'js'); 47 45 } … … 54 52 * @return string Dequoted string 55 53 */ 56 function strip_quotes($str) 57 { 54 function strip_quotes($str) { 58 55 return preg_replace('/[\'"]/', '', $str); 59 56 } … … 65 62 * @return string Stripped string 66 63 */ 67 function strip_newlines($str) 68 { 64 function strip_newlines($str) { 69 65 return preg_replace('/[\r\n]/', '', $str); 70 66 } … … 74 70 * Send HTTP headers to prevent caching this page 75 71 */ 76 function send_nocacheing_headers() 77 { 72 function send_nocacheing_headers() { 78 73 if (headers_sent()) { 79 74 return; … … 91 86 * @param int Expiration time in seconds 92 87 */ 93 function send_future_expire_header($offset = 2600000) 94 {95 if (headers_sent())96 return;97 98 header("Expires: ".gmdate("D, d M Y H:i:s", mktime()+$offset)." GMT");99 header("Cache-Control: max-age=$offset");100 header("Pragma: ");101 }88 function send_future_expire_header($offset = 2600000) { 89 if (headers_sent()) { 90 return; 91 } 92 93 header('Expires: '.gmdate('D, d M Y H:i:s', mktime()+$offset).' GMT'); 94 header('Cache-Control: max-age='.$offset); 95 header('Pragma: '); 96 } 102 97 103 98 … … 108 103 * @param int Modified date as unix timestamp 109 104 * @param string Etag value for caching 110 */ 111 function send_modified_header($mdate, $etag=null) 112 { 105 */ 106 function send_modified_header($mdate, $etag = null) { 113 107 if (headers_sent()) { 114 108 return; 115 109 } 116 110 $iscached = false; 117 if ( 118 $_SERVER['HTTP_IF_MODIFIED_SINCE'] 119 && strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']) >= $mdate 120 ) { 111 if ($_SERVER['HTTP_IF_MODIFIED_SINCE'] && strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']) >= $mdate) { 121 112 $iscached = true; 122 113 } 123 114 124 $etag = $etag ? "\"$etag\"": null;115 $etag = $etag ? '"'.$etag.'"' : null; 125 116 if ($etag && $_SERVER['HTTP_IF_NONE_MATCH'] == $etag) { 126 117 $iscached = true; 127 118 } 128 119 if ($iscached) { 129 header("HTTP/1.x 304 Not Modified"); 130 } 131 else { 132 header("Last-Modified: ".gmdate("D, d M Y H:i:s", $mdate)." GMT"); 133 } 134 header("Cache-Control: max-age=0"); 135 header("Expires: "); 136 header("Pragma: "); 120 header('HTTP/1.x 304 Not Modified'); 121 } else { 122 header('Last-Modified: '.gmdate('D, d M Y H:i:s', $mdate).' GMT'); 123 } 124 header('Cache-Control: max-age=0'); 125 header('Expires: '); 126 header('Pragma: '); 137 127 138 128 if ($etag) { … … 152 142 * @return string Serialized JSON string 153 143 */ 154 function json_serialize($var) 155 { 144 function json_serialize($var) { 156 145 if (is_object($var)) { 157 146 $var = get_object_vars($var); … … 161 150 if (!sizeof($var)) { 162 151 return '[]'; 163 } 164 else { 152 } else { 165 153 $keys_arr = array_keys($var); 166 154 $is_assoc = $have_numeric = 0; … … 183 171 foreach ($var as $key => $value) { 184 172 // enclose key with quotes if it is not variable-name conform 185 if (!ereg( "^[_a-zA-Z]{1}[_a-zA-Z0-9]*$", $key) /* || is_js_reserved_word($key) */)186 $key = "'$key'";187 188 $pairs[] = sprintf("%s%s", $is_assoc ? "$key:": '', json_serialize($value));173 if (!ereg('^[_a-zA-Z]{1}[_a-zA-Z0-9]*$', $key) /* || is_js_reserved_word($key) */) 174 $key = "'$key'"; 175 176 $pairs[] = sprintf("%s%s", $is_assoc ? $key.':' : '', json_serialize($value)); 189 177 } 190 178 return $brackets{0} . implode(',', $pairs) . $brackets{1}; 191 179 } 192 } 193 else if (is_numeric($var) && strval(intval($var)) === strval($var)) { 180 } else if (is_numeric($var) && strval(intval($var)) === strval($var)) { 194 181 return $var; 195 } 196 else if (is_bool($var)) { 182 } else if (is_bool($var)) { 197 183 return $var ? '1' : '0'; 198 } 199 else { 184 } else { 200 185 return "'" . JQ($var) . "'"; 201 186 } … … 207 192 * @deprecated 208 193 */ 209 function array2js($arr, $type='') 210 {194 // TODO is it really not used? rcmail_compose line 368 195 function array2js($arr, $type='') { 211 196 return json_serialize($arr); 212 197 } … … 220 205 * @return boolean True if found, False if not 221 206 */ 222 function in_array_nocase($needle, $haystack) 223 { 207 function in_array_nocase($needle, $haystack) { 224 208 foreach ($haystack as $value) { 225 if (strtolower($needle) ===strtolower($value)) {209 if (strtolower($needle) === strtolower($value)) { 226 210 return TRUE; 227 211 } … … 237 221 * @return boolean Imagine what! 238 222 */ 239 function get_boolean($str) 240 { 223 function get_boolean($str) { 241 224 $str = strtolower($str); 242 225 if(in_array($str, array('false', '0', 'no', 'nein', ''), TRUE)) { 243 226 return FALSE; 244 } 245 else { 227 } else { 246 228 return TRUE; 247 229 } … … 255 237 * @return int Number of bytes 256 238 */ 257 function parse_bytes($str) 258 { 259 if (is_numeric($str)) 239 function parse_bytes($str) { 240 if (is_numeric($str)) { 260 241 return intval($str); 242 } 261 243 262 244 if (preg_match('/([0-9]+)([a-z])/i', $str, $regs)) { 263 245 $bytes = floatval($regs[1]); 264 246 switch (strtolower($regs[2])) { 265 case 'g':266 $bytes *= 1073741824;267 break;268 case 'm':269 $bytes *= 1048576;270 break;271 case 'k':272 $bytes *= 1024;273 break;247 case 'g': 248 $bytes *= 1073741824; 249 break; 250 case 'm': 251 $bytes *= 1048576; 252 break; 253 case 'k': 254 $bytes *= 1024; 255 break; 274 256 } 275 257 } … … 279 261 280 262 281 /** 282 * Create a human readable string for a number of bytes 283 * 284 * @param int Number of bytes 285 * @return string Byte string 286 */ 287 function show_bytes($bytes) 288 { 263 /** 264 * Create a human readable string for a number of bytes 265 * 266 * @param int Number of bytes 267 * @return string Byte string 268 */ 269 function show_bytes($bytes) { 289 270 if ($bytes > 1073741824) { 290 271 $gb = $bytes/1073741824; 291 272 $str = sprintf($gb>=10 ? "%d GB" : "%.1f GB", $gb); 292 } 293 else if ($bytes > 1048576) { 273 } else if ($bytes > 1048576) { 294 274 $mb = $bytes/1048576; 295 275 $str = sprintf($mb>=10 ? "%d MB" : "%.1f MB", $mb); 296 } 297 else if ($bytes > 1024) 276 } else if ($bytes > 1024) { 298 277 $str = sprintf("%d KB", round($bytes/1024)); 299 else278 } else { 300 279 $str = sprintf('%d B', $bytes); 301 280 } 302 281 return $str; 303 282 } … … 311 290 * @return string Absolute URL 312 291 */ 313 function make_absolute_url($path, $base_url) 314 { 292 function make_absolute_url($path, $base_url) { 315 293 $host_url = $base_url; 316 294 $abs_path = $path; 317 295 318 296 // cut base_url to the last directory 319 if (strpos($base_url, '/') >7) {297 if (strpos($base_url, '/') > 7) { 320 298 $host_url = substr($base_url, 0, strpos($base_url, '/')); 321 299 $base_url = substr($base_url, 0, strrpos($base_url, '/')); … … 323 301 324 302 // $path is absolute 325 if ($path{0} =='/')303 if ($path{0} == '/') { 326 304 $abs_path = $host_url.$path; 327 else {305 } else { 328 306 // strip './' because its the same as '' 329 307 $path = preg_replace('/^\.\//', '', $path); 330 308 331 if (preg_match_all('/\.\.\//', $path, $matches, PREG_SET_ORDER))332 foreach($matches as $a_match) {333 if (strrpos($base_url, '/'))334 $base_url = substr($base_url, 0, strrpos($base_url, '/'));335 336 $path = substr($path, 3);337 }338 309 if (preg_match_all('/\.\.\//', $path, $matches, PREG_SET_ORDER)) { 310 foreach($matches as $a_match) { 311 if (strrpos($base_url, '/')) { 312 $base_url = substr($base_url, 0, strrpos($base_url, '/')); 313 } 314 $path = substr($path, 3); 315 } 316 } 339 317 $abs_path = $base_url.'/'.$path; 340 318 } 341 342 319 return $abs_path; 343 320 } … … 347 324 * Wrapper function for strlen 348 325 */ 349 function rc_strlen($str) 350 { 351 if (function_exists('mb_strlen')) 326 function rc_strlen($str) { 327 if (function_exists('mb_strlen')) { 352 328 return mb_strlen($str); 353 else329 } else { 354 330 return strlen($str); 331 } 355 332 } 356 333 … … 358 335 * Wrapper function for strtolower 359 336 */ 360 function rc_strtolower($str) 361 { 362 if (function_exists('mb_strtolower')) 337 function rc_strtolower($str) { 338 if (function_exists('mb_strtolower')) { 363 339 return mb_strtolower($str); 364 else340 } else { 365 341 return strtolower($str); 342 } 366 343 } 367 344 … … 369 346 * Wrapper function for substr 370 347 */ 371 function rc_substr($str, $start, $len=null) 372 { 373 if (function_exists('mb_substr')) 348 function rc_substr($str, $start, $len = null) { 349 if (function_exists('mb_substr')) { 374 350 return mb_substr($str, $start, $len); 375 else351 } else { 376 352 return substr($str, $start, $len); 353 } 377 354 } 378 355 … … 380 357 * Wrapper function for strpos 381 358 */ 382 function rc_strpos($haystack, $needle, $offset=0) 383 { 384 if (function_exists('mb_strpos')) 359 function rc_strpos($haystack, $needle, $offset = 0) { 360 if (function_exists('mb_strpos')) { 385 361 return mb_strpos($haystack, $needle, $offset); 386 else362 } else { 387 363 return strpos($haystack, $needle, $offset); 364 } 388 365 } 389 366 … … 391 368 * Wrapper function for strrpos 392 369 */ 393 function rc_strrpos($haystack, $needle, $offset=0) 394 { 395 if (function_exists('mb_strrpos')) 370 function rc_strrpos($haystack, $needle, $offset = 0) { 371 if (function_exists('mb_strrpos')) { 396 372 return mb_strrpos($haystack, $needle, $offset); 397 else373 } else { 398 374 return strrpos($haystack, $needle, $offset); 375 } 399 376 } 400 377 … … 409 386 * @return string Abbrevated string 410 387 */ 411 function abbrevate_string($str, $maxlength, $place_holder='...') 412 { 388 function abbrevate_string($str, $maxlength, $place_holder = '...') { 413 389 $length = rc_strlen($str); 414 390 $first_part_length = floor($maxlength/2) - rc_strlen($place_holder); … … 426 402 * Make sure the string ends with a slash 427 403 */ 428 function slashify($str) 429 { 404 function slashify($str) { 430 405 return unslashify($str).'/'; 431 406 } … … 435 410 * Remove slash at the end of the string 436 411 */ 437 function unslashify($str) 438 { 412 function unslashify($str) { 439 413 return preg_replace('/\/$/', '', $str); 440 414 } … … 447 421 * @return boolean True on success, False if directory was not found 448 422 */ 449 function clear_directory($dir_path) 450 { 451 $dir = @opendir($dir_path); 452 if (!$dir) 423 function clear_directory($dir_path) { 424 $dir = opendir($dir_path); 425 if (!$dir) { 453 426 return false; 454 455 while ($file = readdir($dir)) 456 if (strlen($file) > 2) 427 } 428 429 while ($file = readdir($dir)) { 430 if (strlen($file) > 2) { 457 431 unlink("$dir_path/$file"); 432 } 433 } 458 434 459 435 closedir($dir); … … 469 445 * @return int Unix timestamp 470 446 */ 471 function get_offset_time($offset_str, $factor=1) 472 { 447 function get_offset_time($offset_str, $factor = 1) { 473 448 if (preg_match('/^([0-9]+)\s*([smhdw])/i', $offset_str, $regs)) { 474 449 $amount = (int)$regs[1]; 475 450 $unit = strtolower($regs[2]); 476 } 477 else { 451 } else { 478 452 $amount = (int)$offset_str; 479 453 $unit = 's'; … … 482 456 $ts = mktime(); 483 457 switch ($unit) { 484 case 'w':485 $amount *= 7;486 case 'd':487 $amount *= 24;488 case 'h':489 $amount *= 60;490 case 'm':491 $amount *= 60;492 case 's':493 $ts += $amount * $factor;458 case 'w': 459 $amount *= 7; 460 case 'd': 461 $amount *= 24; 462 case 'h': 463 $amount *= 60; 464 case 'm': 465 $amount *= 60; 466 case 's': 467 $ts += $amount * $factor; 494 468 } 495 469 … … 505 479 * @return index of needle within haystack, or false if not found 506 480 */ 507 function strrstr($haystack, $needle) 508 { 481 function strrstr($haystack, $needle) { 509 482 $pver = phpversion(); 510 483 if ($pver[0] >= 5) { 511 484 return strrpos($haystack, $needle); 512 } 513 else { 485 } else { 514 486 $index = strpos(strrev($haystack), strrev($needle)); 515 487 if ($index === false) { … … 521 493 } 522 494 523 495 ?> -
branches/devel-vnext/program/include/rcube.php
r954 r957 25 25 require_once 'lib/utf8.class.php'; 26 26 27 28 27 /** 29 28 * rcube … … 38 37 * @since 0.1-rc1 39 38 */ 40 class rcube 41 { 39 class rcube { 42 40 const INPUT_GET = 0x0101; 43 41 const INPUT_POST = 0x0102; … … 53 51 * @return void 54 52 */ 55 static function startup($task = 'mail') 56 { 53 static function startup($task = 'mail') { 57 54 $registry = rcube_registry::get_instance(); 58 55 $registry->set('task', $task, 'core'); -
branches/devel-vnext/program/include/rcube_contacts.php
r806 r957 115 115 } 116 116 117 /** 118 * Close connection to source 119 * Called on script shutdown 120 */ 121 function close() {} 117 122 118 123 /** … … 120 125 * 121 126 * @param array List of cols to show 127 * @param int Only return this number of records, use negative values for tail 122 128 * @return array Indexed list of contact records, each a hash array 123 129 */ … … 167 173 * @return Indexed list of contact records and 'count' value 168 174 */ 169 function search($fields, $value, $s elect=true)175 function search($fields, $value, $strict = false, $select = true) 170 176 { 171 177 if (!is_array($fields)) { … … 177 183 $ids = !is_array($value) ? split(',', $value) : $value; 178 184 $add_where[] = $this->primary_key." IN (".join(',', $ids).")"; 185 } 186 elseif ($strict) { 187 $add_where[] = $this->db->quoteIdentifier($col)."=".$this->db->quote($value); 179 188 } 180 189 else { … … 279 288 280 289 if ($check) { 281 $existing = $this->search('email', $save_data['email'], false);290 $existing = $this->search('email', $save_data['email'], true, false); 282 291 } 283 292 $a_insert_cols = $a_insert_values = array(); -
branches/devel-vnext/program/include/rcube_error.php
r806 r957 5 5 | | 6 6 | This file is part of the RoundCube Webmail client | 7 | Copyright (C) 2005-200 7, RoundCube Dev, - Switzerland |7 | Copyright (C) 2005-2008, RoundCube Dev, - Switzerland | 8 8 | Licensed under the GNU GPL | 9 9 | | -
branches/devel-vnext/program/include/rcube_ldap.php
r806 r957 6 6 | | 7 7 | This file is part of the RoundCube Webmail client | 8 | Copyright (C) 2006-200 7, RoundCube Dev. - Switzerland |8 | Copyright (C) 2006-2008, RoundCube Dev. - Switzerland | 9 9 | Licensed under the GNU GPL | 10 10 | | … … 18 18 $Id: rcube_ldap.inc 563 2007-05-17 15:58:51Z thomasb $ 19 19 20 */20 */ 21 21 22 22 /** … … 25 25 * @package Addressbook 26 26 */ 27 class rcube_ldap 28 { 29 var $conn; 30 var $prop = array(); 31 var $fieldmap = array(); 32 33 var $filter = ''; 34 var $result = null; 35 var $ldap_result = null; 36 var $sort_col = ''; 37 38 /** public properties */ 39 var $primary_key = 'ID'; 40 var $readonly = true; 41 var $list_page = 1; 42 var $page_size = 10; 43 var $ready = false; 44 45 46 /** 47 * Object constructor 48 * 49 * @param array LDAP connection properties 50 * @param integer User-ID 51 */ 52 function __construct($p) 53 { 54 $this->prop = $p; 55 56 foreach ($p as $prop => $value) 57 if (preg_match('/^(.+)_field$/', $prop, $matches)) 27 class rcube_ldap { 28 var $conn; 29 var $prop = array(); 30 var $fieldmap = array(); 31 32 var $filter = ''; 33 var $result = null; 34 var $ldap_result = null; 35 var $sort_col = ''; 36 37 /** public properties */ 38 var $primary_key = 'ID'; 39 var $readonly = true; 40 var $list_page = 1; 41 var $page_size = 10; 42 var $ready = false; 43 44 45 /** 46 * Object constructor 47 * 48 * @param array LDAP connection properties 49 * @param integer User-ID 50 */ 51 public function __construct($p) { 52 $this->prop = $p; 53 54 foreach ($p as $prop => $value) 55 if (preg_match('/^(.+)_field$/', $prop, $matches)) 58 56 $this->fieldmap[$matches[1]] = $value; 59 60 // $this->filter = "(dn=*)"; 61 $this->connect(); 62 } 63 64 /** 65 * PHP 4 object constructor 66 * 67 * @see rcube_ldap::__construct 68 */ 69 function rcube_ldap($p) 70 { 71 $this->__construct($p); 72 } 73 74 75 /** 76 * Establish a connection to the LDAP server 77 */ 78 function connect() 79 { 80 if (!function_exists('ldap_connect')) 81 rcube_error::raise(array('type' => 'ldap', 'message' => "No ldap support in this installation of PHP"), true); 82 83 if (is_resource($this->conn)) 84 return true; 85 86 if (!is_array($this->prop['hosts'])) 87 $this->prop['hosts'] = array($this->prop['hosts']); 88 89 foreach ($this->prop['hosts'] as $host) 90 { 91 if ($lc = @ldap_connect($host, $this->prop['port'])) 92 { 93 ldap_set_option($lc, LDAP_OPT_PROTOCOL_VERSION, $this->prop['port']); 94 $this->prop['host'] = $host; 95 $this->conn = $lc; 96 break; 97 } 98 } 99 100 if (is_resource($this->conn)) 101 { 102 $this->ready = true; 103 if (!empty($this->prop['bind_dn']) && !empty($this->prop['bind_pass'])) 104 $this->ready = $this->bind($this->prop['bind_dn'], $this->prop['bind_pass']); 105 } 106 else 107 rcube_error::raise(array('type' => 'ldap', 'message' => "Could not connect to any LDAP server, tried $host:{$this->prop[port]} last"), true); 108 } 109 110 111 /** 112 * Bind connection with DN and password 113 */ 114 function bind($dn, $pass) 115 { 116 if (!$this->conn) 117 return false; 118 119 if (@ldap_bind($this->conn, $dn, $pass)) 120 return true; 121 else 122 { 123 rcube_error::raise(array( 124 'code' => ldap_errno($this->conn), 125 'type' => 'ldap', 126 'message' => "Bind failed for dn=$dn: ".ldap_error($this->conn)), 127 true); 128 } 129 130 return false; 131 } 132 133 134 /** 135 * Close connection to LDAP server 136 */ 137 function close() 138 { 139 if ($this->conn) 140 @ldap_unbind($this->conn); 141 } 142 143 144 /** 145 * Set internal list page 146 * 147 * @param number Page number to list 148 * @access public 149 */ 150 function set_page($page) 151 { 152 $this->list_page = (int)$page; 153 } 154 155 156 /** 157 * Set internal page size 158 * 159 * @param number Number of messages to display on one page 160 * @access public 161 */ 162 function set_pagesize($size) 163 { 164 $this->page_size = (int)$size; 165 } 166 167 168 /** 169 * Save a search string for future listings 170 * 171 * @param string ?? 172 */ 173 function set_search_set($filter) 174 { 175 $this->filter = $filter; 176 } 177 178 57 58 $this->connect(); 59 } 60 61 /** 62 * Establish a connection to the LDAP server 63 */ 64 function connect() { 65 if (!function_exists('ldap_connect')) { 66 rcube_error::raise(array('type' => 'ldap', 'message' => "No ldap support in this installation of PHP"), true); 67 } 68 69 if (is_resource($this->conn)) { 70 return true; 71 } 72 73 if (!is_array($this->prop['hosts'])) { 74 $this->prop['hosts'] = array($this->prop['hosts']); 75 } 76 77 if (empty($this->prop['ldap_version'])) { 78 $this->prop['ldap_version'] = 3; 79 } 80 81 foreach ($this->prop['hosts'] as $host) { 82 if ($lc = ldap_connect($host, $this->prop['port'])) { 83 ldap_set_option($lc, LDAP_OPT_PROTOCOL_VERSION, $this->prop['ldap_version']); 84 $this->prop['host'] = $host; 85 $this->conn = $lc; 86 break; 87 } 88 } 89 90 if (is_resource($this->conn)) { 91 $this->ready = true; 92 if (!empty($this->prop['bind_dn']) && !empty($this->prop['bind_pass'])) { 93 $this->ready = $this->bind($this->prop['bind_dn'], $this->prop['bind_pass']); 94 } 95 } else { 96 rcube_error::raise(array('type' => 'ldap', 'message' => 'Could not connect to any LDAP server, tried '.$host.':'.$this->prop['port'].' last'), true); 97 } 98 } 99 100 101 /** 102 * Bind connection with DN and password 103 */ 104 function bind($dn, $pass) { 105 if (!$this->conn) { 106 return false; 107 } 108 109 if (ldap_bind($this->conn, $dn, $pass)) { 110 return true; 111 } else { 112 rcube_error::raise( 113 array( 114 'code' => ldap_errno($this->conn), 115 'type' => 'ldap', 116 'message' => 'Bind failed for dn='.$dn.': '.ldap_error($this->conn)), 117 true); 118 return false; 119 } 120 } 121 122 123 /** 124 * Close connection to LDAP server 125 */ 126 function close() { 127 if ($this->conn) { 128 ldap_unbind($this->conn); 129 $this->conn = null; 130 } 131 } 132 133 134 /** 135 * Set internal list page 136 * 137 * @param number Page number to list 138 * @access public 139 */ 140 function set_page($page) { 141 $this->list_page = (int)$page; 142 } 143 144 145 /** 146 * Set internal page size 147 * 148 * @param number Number of messages to display on one page 149 * @access public 150 */ 151 function set_pagesize($size) { 152 $this->page_size = (int)$size; 153 } 154 155 156 /** 157 * Save a search string for future listings 158 * 159 * @param string Filter string 160 */ 161 function set_search_set($filter) { 162 $this->filter = $filter; 163 } 164 165 179 166 /** 180 167 * Getter for saved search properties … … 182 169 * @return mixed Search properties used by this class 183 170 */ 184 function get_search_set() 185 { 171 function get_search_set() { 186 172 return $this->filter; 187 173 } … … 191 177 * Reset all saved results and search parameters 192 178 */ 193 function reset() 194 { 179 function reset() { 195 180 $this->result = null; 196 181 $this->ldap_result = null; 197 182 $this->filter = ''; 198 183 } 199 184 200 185 /** 201 186 * List the current set of contact records 202 187 * 203 188 * @param array List of cols to show 189 * @param int Only return this number of records (not implemented) 204 190 * @return array Indexed list of contact records, each a hash array 205 191 */ 206 function list_records($cols=null, $subset=0) 207 { 192 function list_records($cols=null, $subset=0) { 208 193 // add general filter to query 209 194 if (!empty($this->prop['filter'])) { 210 195 $filter = $this->prop['filter']; 211 }212 $this->set_search_set($filter);196 $this->set_search_set($filter); 197 } 213 198 214 199 // exec LDAP search if no result resource is stored … … 219 204 // count contacts for this user 220 205 $this->result = $this->count(); 221 206 222 207 // we have a search result resource 223 208 if ($this->ldap_result && $this->result->count > 0) { 224 209 if ($this->sort_col && $this->prop['scope'] !== "base") { 225 @ldap_sort($this->conn, $this->ldap_result, $this->sort_col);210 ldap_sort($this->conn, $this->ldap_result, $this->sort_col); 226 211 } 227 212 … … 235 220 236 221 237 /** 238 * Search contacts 239 * 240 * @param array List of fields to search in 241 * @param string Search value 242 * @param boolean True if results are requested, False if count only 243 * @return Indexed list of contact records and 'count' value 244 */ 245 function search($fields, $value, $select=true) 246 { 247 // special treatment for ID-based search 248 if ($fields == 'ID' || $fields == $this->primary_key) 249 { 250 $ids = explode(',', $value); 251 $result = new rcube_result_set(); 252 foreach ($ids as $id) 253 if ($rec = $this->get_record($id, true)) 254 { 255 $result->add($rec); 256 $result->count++; 257 } 258 259 return $result; 260 } 261 262 $filter = '(|'; 263 $wc = $this->prop['fuzzy_search'] ? '*' : ''; 264 if (is_array($this->prop['search_fields'])) 265 { 266 foreach ($this->prop['search_fields'] as $k => $field) 267 $filter .= "($field=$wc" . rcube_ldap::quote_string($value) . "$wc)"; 268 } 269 else 270 { 271 foreach ((array)$fields as $field) 272 if ($f = $this->_map_field($field)) 273 $filter .= "($f=$wc" . rcube_ldap::quote_string($value) . "$wc)"; 274 } 275 $filter .= ')'; 276 277 // add general filter to query 278 if (!empty($this->prop['filter'])) 279 $filter = '(&'.$this->prop['filter'] . $filter . ')'; 280 281 // set filter string and execute search 282 $this->set_search_set($filter); 283 $this->_exec_search(); 284 285 if ($select) 286 $this->list_records(); 287 else 288 $this->result = $this->count(); 289 290 return $this->result; 291 } 292 293 294 /** 295 * Count number of available contacts in database 296 * 297 * @return Result array with values for 'count' and 'first' 298 */ 299 function count() 300 { 301 $count = 0; 302 if ($this->conn && $this->ldap_result) 303 $count = ldap_count_entries($this->conn, $this->ldap_result); 304 305 return new rcube_result_set($count, ($this->list_page-1) * $this->page_size); 306 } 307 308 309 /** 310 * Return the last result set 311 * 312 * @return Result array or NULL if nothing selected yet 313 */ 314 function get_result() 315 { 316 return $this->result; 317 } 318 319 320 /** 321 * Get a specific contact record 322 * 323 * @param mixed record identifier 324 * @return Hash array with all record fields or False if not found 325 */ 326 function get_record($dn, $assoc=false) 327 { 328 $res = null; 329 if ($this->conn && $dn) 330 { 331 $this->ldap_result = @ldap_read($this->conn, base64_decode($dn), "(objectclass=*)", array_values($this->fieldmap)); 332 $entry = @ldap_first_entry($this->conn, $this->ldap_result); 333 334 if ($entry && ($rec = ldap_get_attributes($this->conn, $entry))) 335 { 336 $res = $this->_ldap2result($rec); 337 $this->result = new rcube_result_set(1); 338 $this->result->add($res); 339 } 340 } 341 342 return $assoc ? $res : $this->result; 343 } 344 345 346 /** 347 * Create a new contact record 348 * 349 * @param array Assoziative array with save data 350 * @return The create record ID on success, False on error 351 */ 352 function insert($save_cols) 353 { 354 // TODO 355 return false; 356 } 357 358 359 /** 360 * Update a specific contact record 361 * 362 * @param mixed Record identifier 363 * @param array Assoziative array with save data 364 * @return True on success, False on error 365 */ 366 function update($id, $save_cols) 367 { 368 // TODO 369 return false; 370 } 371 372 373 /** 374 * Mark one or more contact records as deleted 375 * 376 * @param array Record identifiers 377 */ 378 function delete($ids) 379 { 380 // TODO 381 return false; 382 } 383 384 385 /** 386 * Execute the LDAP search based on the stored credentials 387 * 388 * @private 389 */ 390 function _exec_search() 391 { 392 if ($this->conn && $this->filter) 393 { 394 $function = $this->prop['scope'] == 'sub' ? 'ldap_search' : ($this->prop['scope'] == 'base' ? 'ldap_read' : 'ldap_list'); 395 $this->ldap_result = $function($this->conn, $this->prop['base_dn'], $this->filter, array_values($this->fieldmap), 0, 0); 396 return true; 397 } 398 else 399 return false; 400 } 401 402 403 /** 404 * @private 405 */ 406 function _ldap2result($rec) 407 { 408 $out = array(); 409 410 if ($rec['dn']) 411 $out[$this->primary_key] = base64_encode($rec['dn']); 412 413 foreach ($this->fieldmap as $rf => $lf) 414 { 415 if ($rec[$lf]['count']) 416 $out[$rf] = $rec[$lf][0]; 417 } 418 419 return $out; 420 } 421 422 423 /** 424 * @private 425 */ 426 function _map_field($field) 427 { 428 return $this->fieldmap[$field]; 429 } 430 431 432 /** 433 * @static 434 */ 435 function quote_string($str) 436 { 437 return strtr($str, array('*'=>'\2a', '('=>'\28', ')'=>'\29', '\\'=>'\5c')); 438 } 439 440 222 /** 223 * Search contacts 224 * 225 * @param array List of fields to search in 226 * @param string Search value 227 * @param boolean True if results are requested, False if count only 228 * @return array Indexed list of contact records and 'count' value 229 */ 230 function search($fields, $value, $strict=false, $select=true) { 231 // special treatment for ID-based search 232 if ($fields == 'ID' || $fields == $this->primary_key) { 233 $ids = explode(',', $value); 234 $result = new rcube_result_set(); 235 foreach ($ids as $id) { 236 if ($rec = $this->get_record($id, true)) { 237 $result->add($rec); 238 $result->count++; 239 } 240 } 241 return $result; 242 } 243 244 $filter = '(|'; 245 $wc = !$strict && $this->prop['fuzzy_search'] ? '*' : ''; 246 if (is_array($this->prop['search_fields'])) { 247 foreach ($this->prop['search_fields'] as $k => $field) { 248 $filter .= "($field=$wc" . rcube_ldap::quote_string($value) . "$wc)"; 249 } 250 } else { 251 foreach ((array)$fields as $field) { 252 if ($f = $this->_map_field($field)) { 253 $filter .= "($f=$wc" . rcube_ldap::quote_string($value) . "$wc)"; 254 } 255 } 256 } 257 $filter .= ')'; 258 259 // add general filter to query 260 if (!empty($this->prop['filter'])) { 261 $filter = '(&'.$this->prop['filter'] . $filter . ')'; 262 } 263 264 // set filter string and execute search 265 $this->set_search_set($filter); 266 $this->_exec_search(); 267 268 if ($select) { 269 $this->list_records(); 270 } else { 271 $this->result = $this->count(); 272 } 273 274 return $this->result; 275 } 276 277 278 /** 279 * Count number of available contacts in database 280 * 281 * @return object rcube_result_set Resultset with values for 'count' and 'first' 282 */ 283 function count() { 284 $count = 0; 285 if ($this->conn && $this->ldap_result) { 286 $count = ldap_count_entries($this->conn, $this->ldap_result); 287 } 288 289 return new rcube_result_set($count, ($this->list_page-1) * $this->page_size); 290 } 291 292 293 /** 294 * Return the last result set 295 * 296 * @return object rcube_result_set Current resultset or NULL if nothing selected yet 297 */ 298 function get_result() { 299 return $this->result; 300 } 301 302 303 /** 304 * Get a specific contact record 305 * 306 * @param mixed Record identifier 307 * @param boolean Return as associative array 308 * @return mixed Hash array or rcube_result_set with all record fields 309 */ 310 function get_record($dn, $assoc=false) { 311 $res = null; 312 if ($this->conn && $dn) { 313 $this->ldap_result = ldap_read($this->conn, base64_decode($dn), "(objectclass=*)", array_values($this->fieldmap)); 314 $entry = ldap_first_entry($this->conn, $this->ldap_result); 315 316 if ($entry && ($rec = ldap_get_attributes($this->conn, $entry))) { 317 $res = $this->_ldap2result($rec); 318 $this->result = new rcube_result_set(1); 319 $this->result->add($res); 320 } 321 } 322 323 return $assoc ? $res : $this->result; 324 } 325 326 327 /** 328 * Create a new contact record 329 * 330 * @param array Hash array with save data 331 * @return boolean The create record ID on success, False on error 332 */ 333 function insert($save_cols) { 334 // TODO 335 return false; 336 } 337 338 339 /** 340 * Update a specific contact record 341 * 342 * @param mixed Record identifier 343 * @param array Hash array with save data 344 * @return boolean True on success, False on error 345 */ 346 function update($id, $save_cols) { 347 // TODO 348 return false; 349 } 350 351 352 /** 353 * Mark one or more contact records as deleted 354 * 355 * @return boolean True on success, False on error 356 */ 357 function delete($ids) { 358 // TODO 359 return false; 360 } 361 362 363 /** 364 * Execute the LDAP search based on the stored credentials 365 * 366 * @return boolean true on success, false on error 367 */ 368 private function _exec_search() { 369 if ($this->conn && $this->filter) { 370 $function = $this->prop['scope'] == 'sub' ? 'ldap_search' : ($this->prop['scope'] == 'base' ? 'ldap_read' : 'ldap_list'); 371 $this->ldap_result = $function($this->conn, $this->prop['base_dn'], $this->filter, array_values($this->fieldmap), 0, 0); 372 return true; 373 } else { 374 return false; 375 } 376 } 377 378 379 /** 380 * ldap2result 381 * 382 * @param array 383 * @return array 384 */ 385 private function _ldap2result($rec) { 386 $out = array(); 387 388 if ($rec['dn']) { 389 $out[$this->primary_key] = base64_encode($rec['dn']); 390 } 391 392 foreach ($this->fieldmap as $rf => $lf) { 393 if ($rec[$lf]['count']) { 394 $out[$rf] = $rec[$lf][0]; 395 } 396 } 397 398 return $out; 399 } 400 401 402 /** 403 * map field 404 * @param string field 405 * @return string returns mapped field 406 */ 407 private function _map_field($field) { 408 return $this->fieldmap[$field]; 409 } 410 411 412 /** 413 * translate char2hex 414 * @param string char 415 * @return string hex 416 */ 417 private static function quote_string($str) { 418 return strtr($str, array('*'=>'\2a', '('=>'\28', ')'=>'\29', '\\'=>'\5c')); 419 } 441 420 } 442 421 -
branches/devel-vnext/program/include/rcube_smtp.php
r806 r957 6 6 | | 7 7 | This file is part of the RoundCube Webmail client | 8 | Copyright (C) 200 5-2007, RoundCube Dev. - Switzerland |8 | Copyright (C) 2006-2008, RoundCube Dev. - Switzerland | 9 9 | Licensed under the GNU GPL | 10 10 | | … … 70 70 // create Net_SMTP object and connect to server 71 71 if (!is_object($smtp_conn)) { 72 $helo_host = !empty($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : 'localhost';72 $helo_host = empty($CONFIG['smtp_helo_host']) ? ((empty($_SERVER['SERVER_NAME']) ? 'localhost' : $_SERVER['SERVER_NAME'])) : $CONFIG['smtp_helo_host']; 73 73 $SMTP_CONN = new Net_SMTP($smtp_host, $smtp_port, $helo_host); 74 74 -
branches/devel-vnext/program/include/rcube_sqlite.inc
r806 r957 6 6 | | 7 7 | This file is part of the RoundCube Webmail client | 8 | Copyright (C) 200 5, RoundCube Dev. - Switzerland|8 | Copyright (C) 2006-2008, RoundCube Dev. - Switzerland | 9 9 | Licensed under the GNU GPL | 10 10 | | … … 22 22 23 23 24 function rcube_sqlite_from_unixtime($timestamp) 25 { 26 $timestamp = trim($timestamp); 27 if (!preg_match("/^[0-9]+$/is", $timestamp)) 28 $ret = strtotime($timestamp); 29 else 30 $ret = $timestamp; 31 32 $ret = date("Y-m-d H:i:s", $ret); 33 rcube_sqlite_debug("FROM_UNIXTIME ($timestamp) = $ret"); 34 return $ret; 35 } 24 function rcube_sqlite_from_unixtime($timestamp) { 25 $timestamp = trim($timestamp); 26 if (!preg_match('/^[0-9]+$/is', $timestamp)) { 27 $ret = strtotime($timestamp); 28 } else { 29 $ret = $timestamp; 30 } 31 $ret = date('Y-m-d H:i:s', $ret); 32 rcube_sqlite_debug("FROM_UNIXTIME ($timestamp) = $ret"); 33 return $ret; 34 } 36 35 37 36 38 function rcube_sqlite_unix_timestamp($timestamp ="")39 {40 $timestamp = trim($timestamp); 41 if (!$timestamp) 42 $ret = time(); 43 else if (!preg_match("/^[0-9]+$/is", $timestamp)) 44 $ret = strtotime($timestamp); 45 else 46 $ret = $timestamp; 37 function rcube_sqlite_unix_timestamp($timestamp = '') { 38 $timestamp = trim($timestamp); 39 if (!$timestamp) { 40 $ret = time(); 41 } else if (!preg_match('/^[0-9]+$/is', $timestamp)) { 42 $ret = strtotime($timestamp); 43 } else { 44 $ret = $timestamp; 45 } 47 46 48 rcube_sqlite_debug("UNIX_TIMESTAMP ($timestamp) = $ret");49 return $ret;50 }47 rcube_sqlite_debug("UNIX_TIMESTAMP ($timestamp) = $ret"); 48 return $ret; 49 } 51 50 52 51 53 function rcube_sqlite_now() 54 { 55 rcube_sqlite_debug("NOW() = ".date("Y-m-d H:i:s")); 56 return date("Y-m-d H:i:s"); 57 } 52 function rcube_sqlite_now() { 53 rcube_sqlite_debug("NOW() = ".date('Y-m-d H:i:s')); 54 return date('Y-m-d H:i:s'); 55 } 58 56 59 57 60 function rcube_sqlite_md5($str) 61 { 62 return md5($str); 63 } 58 function rcube_sqlite_md5($str) { 59 return md5($str); 60 } 64 61 65 62 66 function rcube_sqlite_debug($str) 67 { 63 function rcube_sqlite_debug($str) { 68 64 //rcube::console($str); 69 }65 } 70 66 71 67 ?> -
branches/devel-vnext/program/include/rcube_template.php
r953 r957 6 6 | | 7 7 | This file is part of the RoundCube Webmail client | 8 | Copyright (C) 200 7, RoundCube Dev. - Switzerland|8 | Copyright (C) 2006-2008, RoundCube Dev. - Switzerland | 9 9 | Licensed under the GNU GPL | 10 10 | | … … 17 17 +-----------------------------------------------------------------------+ 18 18 19 $Id :$20 21 */19 $Id$ 20 21 */ 22 22 23 23 … … 48 48 * @todo Use jQuery's $(document).ready() here. 49 49 */ 50 public function __construct() 51 { 50 public function __construct() { 52 51 parent::__construct(); 53 52 54 53 $registry = rcube_registry::get_instance(); 55 54 $this->task = $registry->get('task', 'core'); 56 55 $this->config = $registry->get_all('config'); 57 56 58 57 // add common javascripts 59 $javascript = "var ".JS_OBJECT_NAME." = new rcube_webmail();";58 $javascript = 'var '.JS_OBJECT_NAME.' = new rcube_webmail();'; 60 59 61 60 // don't wait for page onload. Call init at the bottom of the page (delayed) … … 68 67 $this->include_script('common.js'); 69 68 $this->include_script('app.js'); 70 69 71 70 // register common UI objects 72 71 $this->add_handlers(array( … … 85 84 * @param boolean True if this property should be added to client environment 86 85 */ 87 public function set_env($name, $value, $addtojs=true) 88 { 86 public function set_env($name, $value, $addtojs = true) { 89 87 $this->env[$name] = $value; 90 88 if ($addtojs || isset($this->js_env[$name])) { … … 97 95 * Set page title variable 98 96 */ 99 public function set_pagetitle($title) 100 { 97 public function set_pagetitle($title) { 101 98 $this->pagetitle = $title; 102 99 } … … 110 107 * @return void 111 108 */ 112 public function add_handler($obj, $func) 113 { 109 public function add_handler($obj, $func) { 114 110 $this->object_handlers[$obj] = $func; 115 111 } … … 121 117 * @return void 122 118 */ 123 public function add_handlers($arr) 124 { 119 public function add_handlers($arr) { 125 120 $this->object_handlers = array_merge($this->object_handlers, $arr); 126 121 } … … 133 128 * @return void 134 129 */ 135 public function add_gui_object($obj, $id) 136 { 130 public function add_gui_object($obj, $id) { 137 131 $this->add_script(JS_OBJECT_NAME.".gui_object('$obj', '$id');"); 138 132 } … … 144 138 * @param ... Additional arguments 145 139 */ 146 public function command() 147 { 140 public function command() { 148 141 $this->js_commands[] = func_get_args(); 149 142 } 150 151 143 144 152 145 /** 153 146 * Add a localized label to the client environment 154 147 */ 155 public function add_label() 156 { 148 public function add_label() { 157 149 $arg_list = func_get_args(); 158 150 foreach ($arg_list as $i => $name) { … … 160 152 } 161 153 } 162 154 163 155 164 156 /** … … 170 162 * @uses self::command() 171 163 */ 172 public function show_message($message, $type='notice', $vars=NULL) 173 { 164 public function show_message($message, $type='notice', $vars=NULL) { 174 165 $this->command( 175 166 'display_message', 176 rcube::gettext(array('name' => $message, 'vars' => $vars)),177 $type167 rcube::gettext(array('name' => $message, 'vars' => $vars)), 168 $type 178 169 ); 179 170 } … … 190 181 * @uses self::$object_handlers 191 182 */ 192 public public function reset() 193 { 183 public public function reset() { 194 184 $this->env = array(); 195 185 $this->js_env = array(); … … 207 197 * @param boolean True if script should terminate (default) 208 198 */ 209 public function send($templ=null, $exit=true) 210 { 199 public function send($templ = null, $exit = true) { 211 200 if ($templ != 'iframe') { 212 201 //rcube::tfk_debug("/Parsing $templ"); 213 202 $this->parse($templ, false); 214 } 215 else { 203 } else { 216 204 $this->framed = $templ == 'iframe' ? true : $this->framed; 217 205 $this->write(); … … 230 218 * @override 231 219 */ 232 public function write($template='') 233 { 220 public function write($template = '') { 221 // unlock interface after iframe load 222 if ($this->framed) { 223 array_unshift($this->js_commands, array('set_busy', false)); 224 } 234 225 // write all env variables to client 235 226 $js = $this->framed ? "if(window.parent) {\n" : ''; … … 251 242 * @link http://php.net/manual/en/function.exit.php 252 243 */ 253 private function parse($name='main', $exit=true) 254 { 244 private function parse($name = 'main', $exit = true) { 255 245 $skin_path = $this->config['skin_path']; 256 246 … … 261 251 $path = "$skin_path/templates/$name.html"; 262 252 263 if (($fp = @fopen($path, 'r')) === false) {253 if (($fp = fopen($path, 'r')) === false) { 264 254 $message = ''; 265 255 ob_start(); … … 268 258 ob_end_clean(); 269 259 rcube_error::raise( 270 array(271 'code' => 501,272 'type' => 'php',273 'line' => __LINE__,274 'file' => __FILE__,275 'message' => "Error loading template for '$name': $message"276 ),277 TRUE,278 TRUE260 array( 261 'code' => 501, 262 'type' => 'php', 263 'line' => __LINE__, 264 'file' => __FILE__, 265 'message' => 'Error loading template for '.$name.': '.$message 266 ), 267 TRUE, 268 TRUE 279 269 ); 280 270 return FALSE; 281 271 } 282 272 $templ = fread($fp, filesize($path)); 283 @fclose($fp);273 fclose($fp); 284 274 285 275 //rcube::tfk_debug("// parsed: $path"); … … 294 284 <a href="#toggle" onclick="con=document.getElementById(\'dbgconsole\');con.style.display=(con.style.display==\'none\'?\'block\':\'none\');return false">console</a> 295 285 <form action="/" name="debugform"><textarea name="console" id="dbgconsole" rows="20" cols="40" wrap="off" style="display:none;width:400px;border:none;font-size:x-small"></textarea></form></div>' 296 );286 ); 297 287 } 298 288 $output = $this->parse_with_globals($output); … … 309 299 * @return string $out 310 300 */ 311 private function get_js_commands() 312 { 301 private function get_js_commands() { 313 302 $out = ''; 314 303 if (!$this->framed && !empty($this->js_env)) { … … 323 312 $out .= sprintf( 324 313 "%s.%s(%s);\n", 325 ($parent ? 'parent.' : '') . JS_OBJECT_NAME, 326 preg_replace('/^parent\./', '', $method), 327 implode(',', $args) 314 ($parent ? 'parent.' : '') . JS_OBJECT_NAME, 315 preg_replace('/^parent\./', '', $method), 316 implode(',', $args) 317 ); 318 } 319 // add command to set page title 320 if ($this->ajax_call && !empty($this->pagetitle)) { 321 $out .= sprintf( 322 "this.set_pagetitle('%s');\n", 323 JQ((!empty($this->config['product_name']) ? $this->config['product_name'].' :: ' : '') . $this->pagetitle) 328 324 ); 329 325 } … … 338 334 * @return string 339 335 */ 340 public function abs_url($str) 341 { 336 private function abs_url($str) { 342 337 return preg_replace('/^\//', $this->config['skin_path'].'/', $str); 343 338 } 344 339 345 346 347 340 /***** Template parsing methods *****/ 348 341 349 342 /** 350 * Replace all strings ($varname) with the content 351 * of the according global variable. 352 */ 353 private function parse_with_globals($input) 354 { 343 * Replace all strings ($varname) 344 * with the content of the according global variable. 345 */ 346 private function parse_with_globals($input) { 355 347 $registry = rcube_registry::get_instance(); 356 348 $COMM_PATH = $registry->get('COMM_PATH', 'core'); 357 349 358 $GLOBALS['__comm_path'] = $COMM_PATH;350 $GLOBALS['__comm_path'] = urlencode($COMM_PATH); 359 351 return preg_replace('/\$(__[a-z0-9_\-]+)/e', '$GLOBALS["\\1"]', $input); 360 352 } … … 368 360 * @since 0.1-rc1 369 361 */ 370 public function just_parse($input) 371 { 362 public function just_parse($input) { 372 363 return $this->parse_xml($input); 373 364 } … … 379 370 * @return string 380 371 */ 381 private function parse_conditions($input) 382 { 372 private function parse_conditions($input) { 383 373 $matches = preg_split( 384 374 '/<roundcube:(if|elseif|else|endif)\s+([^>]+)>/is', 385 $input,386 2,387 PREG_SPLIT_DELIM_CAPTURE375 $input, 376 2, 377 PREG_SPLIT_DELIM_CAPTURE 388 378 ); 389 if ($matches && count($matches) ==4) {379 if ($matches && count($matches) == 4) { 390 380 if (preg_match('/^(else|endif)$/i', $matches[1])) { 391 381 return $matches[0] . $this->parse_conditions($matches[3]); … … 396 386 $submatches = preg_split( 397 387 '/<roundcube:(elseif|else|endif)\s+([^>]+)>/is', 398 $matches[3],399 2,400 PREG_SPLIT_DELIM_CAPTURE388 $matches[3], 389 2, 390 PREG_SPLIT_DELIM_CAPTURE 401 391 ); 402 392 if ($condmet) { 403 393 $result = $submatches[0]; 404 394 $result.= ($submatches[1] != 'endif' ? preg_replace('/.*<roundcube:endif\s+[^>]+>/Uis', '', $submatches[3], 1) : $submatches[3]); 405 } 406 else { 395 } else { 407 396 $result = "<roundcube:$submatches[1] $submatches[2]>" . $submatches[3]; 408 397 } … … 410 399 } 411 400 rcube_error::raise( 412 array(401 array( 413 402 'code' => 500, 414 403 'type' => 'php', … … 416 405 'file' => __FILE__, 417 406 'message' => "Unable to parse conditional tag " . $matches[2] 418 ),419 TRUE,420 FALSE407 ), 408 TRUE, 409 FALSE 421 410 ); 422 411 } … … 433 422 * @return boolean True if condition is met, False is not 434 423 */ 435 private function check_condition($condition) 436 { 424 private function check_condition($condition) { 437 425 $condition = preg_replace( 438 array(426 array( 439 427 '/session:([a-z0-9_]+)/i', 440 428 '/config:([a-z0-9_]+)/i', 441 429 '/env:([a-z0-9_]+)/i', 442 430 '/request:([a-z0-9_]+)/ie' 443 ),444 array(431 ), 432 array( 445 433 "\$_SESSION['\\1']", 446 434 "\$this->config['\\1']", 447 435 "\$this->env['\\1']", 448 436 "rcube::get_input_value('\\1', rcube::INPUT_GPC)" 449 ), 450 $condition 451 ); 452 return @eval("return (".$condition.");"); 453 } 454 455 456 /** 457 * Search for special tags in input and replace them 458 * with the appropriate content 459 * 460 * @param string Input string to parse 461 * @return string Altered input string 462 * @todo Maybe a cache. 463 */ 464 private function parse_xml($input) 465 { 437 ), 438 $condition 439 ); 440 return eval("return (".$condition.");"); 441 } 442 443 444 /** 445 * Search for special tags in input and replace them 446 * with the appropriate content 447 * 448 * @param string Input string to parse 449 * @return string Altered input string 450 * @todo Maybe a cache. 451 */ 452 private function parse_xml($input) { 466 453 return preg_replace('/<roundcube:([-_a-z]+)\s+([^>]+)>/Uie', "\$this->xml_command('\\1', '\\2')", $input); 467 }454 } 468 455 469 456 … … 475 462 * @return string Tag/Object content 476 463 */ 477 private function xml_command($command, $str_attrib, $add_attrib=array()) 478 { 464 private function xml_command($command, $str_attrib, $add_attrib = array()) { 479 465 $command = strtolower($command); 480 466 $attrib = rcube::parse_attrib_string($str_attrib) + $add_attrib; … … 499 485 break; 500 486 501 // show a label487 // show a label 502 488 case 'label': 503 489 if ($attrib['name'] || $attrib['command']) { … … 506 492 break; 507 493 508 // include a file494 // include a file 509 495 case 'include': 510 496 $path = realpath($this->config['skin_path'].$attrib['file']); … … 516 502 return $this->parse_xml(''); 517 503 } 518 if ($fp = @fopen($path, 'r')) { 504 if ($this->config['skin_include_php']) { 505 $incl = $this->include_php($path); 506 } else if ($fp = fopen($path, 'r')) { 519 507 $incl = fread($fp, $tpl_filesize); 520 508 fclose($fp); 521 return $this->parse_xml($incl);522 }509 } 510 return $this->parse_xml($incl); 523 511 break; 524 512 … … 540 528 break; 541 529 542 // return code for a specific application object530 // return code for a specific application object 543 531 case 'object': 544 532 $object = strtolower($attrib['name']); … … 547 535 if (($handler = $this->object_handlers[$object]) && is_array($handler)) { 548 536 if ((is_object($handler[0]) && method_exists($handler[0], $handler[1])) || 549 (is_string($handler[0]) && class_exists($handler[0]))) 550 return call_user_func($handler, $attrib); 551 } 552 // execute object handler function 553 else if (function_exists($handler)) 537 (is_string($handler[0]) && class_exists($handler[0]))) 554 538 return call_user_func($handler, $attrib); 539 } else if (function_exists($handler)) { 540 // execute object handler function 541 return call_user_func($handler, $attrib); 542 } 555 543 556 544 if ($object=='productname') { … … 565 553 $title = !empty($this->config['product_name']) ? $this->config['product_name'].' :: ' : ''; 566 554 567 if (!empty($this->pagetitle)) 555 if (!empty($this->pagetitle)) { 568 556 $title .= $this->pagetitle; 569 else if ($task == 'login')557 } else if ($task == 'login') { 570 558 $title = rcube::gettext(array('name' => 'welcome', 'vars' => array('product' => $this->config['product_name']))); 571 else559 } else { 572 560 $title .= ucfirst($task); 561 } 573 562 574 563 return Q($title); 575 564 } 576 565 break; 566 // return variable 567 case 'var': 568 $var = explode(':', $attrib['name']); 569 $name = $var[1]; 570 $value = ''; 571 572 switch ($var[0]) { 573 case 'env': 574 $value = $this->env[$name]; 575 break; 576 case 'config': 577 $value = $this->config[$name]; 578 if (is_array($value) && $value[$_SESSION['imap_host']]) { 579 $value = $value[$_SESSION['imap_host']]; 580 } 581 break; 582 case 'request': 583 $value = get_input_value($name, RCUBE_INPUT_GPC); 584 break; 585 case 'session': 586 $value = $_SESSION[$name]; 587 break; 588 } 589 590 if (is_array($value)) { 591 $value = implode(', ', $value); 592 } 593 594 return Q($value); 595 break; 577 596 } 578 597 return ''; 598 } 599 600 /** 601 * Include a specific file and return it's contents 602 * 603 * @param string File path 604 * @return string Contents of the processed file 605 */ 606 private function include_php($file) { 607 ob_start(); 608 // TODO i'm not sure but i think this can be require_once 609 include $file; 610 $out = ob_get_contents(); 611 ob_end_clean(); 612 613 return $out; 579 614 } 580 615 … … 588 623 * @todo Remove all sprintf()'s - they are pretty, but also slow. 589 624 */ 590 public function button($attrib) 591 { 625 private function button($attrib) { 592 626 static $sa_buttons = array(); 593 627 static $s_button_count = 100; 594 628 595 629 $browser = new rcube_browser(); 596 630 $MAIN_TASKS = rcube_registry::get_instance()->get('MAIN_TASKS', 'core'); … … 608 642 if ($attrib['type']) { 609 643 $attrib['type'] = strtolower($attrib['type']); 610 } 611 else { 644 } else { 612 645 $attrib['type'] = ($attrib['image'] || $attrib['imagepas'] || $attrib['imageact']) ? 'image' : 'link'; 613 646 } … … 615 648 616 649 // take the button from the stack 617 if ($attrib['name'] && $sa_buttons[$attrib['name']]) {650 if ($attrib['name'] && $sa_buttons[$attrib['name']]) { 618 651 $attrib = $sa_buttons[$attrib['name']]; 619 } 620 // add button to button stack 621 else if($attrib['image'] || $attrib['imageact'] || $attrib['imagepas'] || $attrib['class']) 622 { 652 } else if($attrib['image'] || $attrib['imageact'] || $attrib['imagepas'] || $attrib['class']) { 653 // add button to button stack 623 654 if (!$attrib['name']) { 624 655 $attrib['name'] = $command; … … 628 659 } 629 660 $sa_buttons[$attrib['name']] = $attrib; 630 } 631 632 // get saved button for this command/name 633 else if ($command && $sa_buttons[$command]) { 661 } else if ($command && $sa_buttons[$command]) { 662 // get saved button for this command/name 634 663 $attrib = $sa_buttons[$command]; 635 664 } 636 //else637 // return '';638 639 665 640 666 // set border to 0 because of the link arround the button … … 667 693 668 694 // register button in the system 669 if ($attrib['command']) 670 { 695 if ($attrib['command']) { 671 696 $this->add_script( 672 sprintf(697 sprintf( 673 698 "%s.register_button('%s', '%s', '%s', '%s', '%s', '%s');", 674 JS_OBJECT_NAME,675 $command,676 $attrib['id'],677 $attrib['type'],678 $attrib['imageact'] ? $skin_path.$attrib['imageact'] : $attrib['classact'],679 $attrib['imagesel'] ? $skin_path.$attrib['imagesel'] : $attrib['classsel'],680 $attrib['imageover'] ? $skin_path.$attrib['imageover'] : ''681 )699 JS_OBJECT_NAME, 700 $command, 701 $attrib['id'], 702 $attrib['type'], 703 $attrib['imageact'] ? $skin_path.$attrib['imageact'] : $attrib['classact'], 704 $attrib['imagesel'] ? $skin_path.$attrib['imagesel'] : $attrib['classsel'], 705 $attrib['imageover'] ? $skin_path.$attrib['imageover'] : '' 706 ) 682 707 ); 683 708 … … 685 710 if (in_array($attrib['command'], $MAIN_TASKS)) { 686 711 $attrib['href'] = Q(rcube::url(null, null, $attrib['command'])); 687 } 688 else if (in_array($attrib['command'], $a_static_commands)) { 712 } else if (in_array($attrib['command'], $a_static_commands)) { 689 713 $attrib['href'] = Q(rcube::url($attrib['command'])); 690 714 } … … 698 722 $attrib['onclick'] = sprintf( 699 723 "return %s.command('%s','%s',this)", 700 JS_OBJECT_NAME,701 $command,702 $attrib['prop']724 JS_OBJECT_NAME, 725 $command, 726 $attrib['prop'] 703 727 ); 704 728 } … … 706 730 $attrib['onmouseover'] = sprintf( 707 731 "return %s.button_over('%s','%s')", 708 JS_OBJECT_NAME,709 $command,710 $attrib['id']732 JS_OBJECT_NAME, 733 $command, 734 $attrib['id'] 711 735 ); 712 736 $attrib['onmouseout'] = sprintf( 713 737 "return %s.button_out('%s','%s')", 714 JS_OBJECT_NAME,715 $command,716 $attrib['id']738 JS_OBJECT_NAME, 739 $command, 740 $attrib['id'] 717 741 ); 718 742 } … … 721 745 $attrib['onmousedown'] = sprintf( 722 746 "return %s.button_sel('%s','%s')", 723 JS_OBJECT_NAME,724 $command,725 $attrib['id']747 JS_OBJECT_NAME, 748 $command, 749 $attrib['id'] 726 750 ); 727 751 $attrib['onmouseup'] = sprintf( 728 752 "return %s.button_out('%s','%s')", 729 JS_OBJECT_NAME,730 $command,731 $attrib['id']753 JS_OBJECT_NAME, 754 $command, 755 $attrib['id'] 732 756 ); 733 757 } … … 738 762 if ($attrib['type']=='image') { 739 763 $attrib_str = rcube::create_attrib_string( 740 $attrib,741 array(764 $attrib, 765 array( 742 766 'style', 'class', 'id', 'width', 743 767 'height', 'border', 'hspace', 744 768 'vspace', 'align', 'alt', 745 )769 ) 746 770 ); 747 771 $img_tag = sprintf('<img src="%%s"%s />', $attrib_str); … … 751 775 } 752 776 $link_attrib = array('href', 'onclick', 'onmouseover', 'onmouseout', 'onmousedown', 'onmouseup', 'title'); 753 } 754 else if ($attrib['type']=='link') { 777 } else if ($attrib['type']=='link') { 755 778 $btn_content = $attrib['label'] ? $attrib['label'] : $attrib['command']; 756 779 $link_attrib = array('href', 'onclick', 'title', 'id', 'class', 'style'); 757 } 758 else if ($attrib['type']=='input') { 780 } else if ($attrib['type']=='input') { 759 781 $attrib['type'] = 'button'; 760 782 761 if ($attrib['label']) 783 if ($attrib['label']) { 762 784 $attrib['value'] = $attrib['label']; 785 } 763 786 764 787 $attrib_str = rcube::create_attrib_string( 765 $attrib,766 array(788 $attrib, 789 array( 767 790 'type', 'value', 'onclick', 768 791 'id', 'class', 'style' 769 )770 );771 $out = sprintf('<input%s disabled="disabled" />', $attrib_str);792 ) 793 ); 794 $out = sprintf('<input%s disabled="disabled" />', $attrib_str); 772 795 } 773 796 … … 780 803 return $out; 781 804 } 782 783 805 806 784 807 /* ************* common functions delivering gui objects ************** */ 785 786 808 809 787 810 /** 788 811 * GUI object 'username' … … 809 832 $_query.= " AND del<>1"; 810 833 $sql_result = $DB->query( 811 $_query,812 $_SESSION['user_id']834 $_query, 835 $_SESSION['user_id'] 813 836 ); 814 837 … … 823 846 $username = $_SESSION['username'].'@'.$_SESSION['imap_host']; 824 847 } 825 848 826 849 $registry->set('username', $username, 'core'); 827 850 return $username; … … 867 890 $form_name = !empty($attrib['form']) ? $attrib['form'] : 'form'; 868 891 $this->add_gui_object('loginform', $form_name); 869 892 870 893 // create HTML table with two cols 871 894 $table = new html_table(array('cols' => 2)); 872 895 873 896 $table->add('title', html::label('rcmloginuser', Q(rcube::gettext('username')))); 874 897 $table->add(null, $input_user->show(rcube::get_input_value('_user', rcube::INPUT_POST))); … … 876 899 $table->add('title', html::label('rcmloginpwd', Q(rcube::gettext('password')))); 877 900 $table->add(null, $input_pass->show()); 878 901 879 902 // add host selection row 880 903 if (is_object($input_host)) { … … 886 909 $out .= $input_action->show(); 887 910 $out .= $table->show(); 888 911 889 912 if (empty($attrib['form'])) 890 $out = html::tag(913 $out = html::tag( 891 914 'form', 892 array(915 array( 893 916 'name' => $form_name, 894 917 'action' => $registry->get('BASE_URI', $BASE_URI), 895 918 'method' => "post" 896 ),897 $out);898 899 return $out;919 ), 920 $out); 921 922 return $out; 900 923 } 901 924 … … 933 956 'onsubmit' => JS_OBJECT_NAME . ".command('search');return false;", 934 957 'style' => "display:inline", 935 ),936 $out937 ); 938 } 939 958 ), 959 $out 960 ); 961 } 962 940 963 return $out; 941 964 } … … 991 1014 'Windows-1257' => 'Windows-1257 (Baltic)', 992 1015 'UTF-8' => 'UTF-8' 993 );994 995 $select = new html_select($field_attrib);996 $select->add(array_values($charsets), array_keys($charsets));997 998 $set = $_POST['_charset'] ? $_POST['_charset'] : $this->get_charset();999 return $select->show($set);1016 ); 1017 1018 $select = new html_select($field_attrib); 1019 $select->add(array_values($charsets), array_keys($charsets)); 1020 1021 $set = $_POST['_charset'] ? $_POST['_charset'] : $this->get_charset(); 1022 return $select->show($set); 1000 1023 } 1001 1024 -
branches/devel-vnext/program/include/session.inc
r806 r957 6 6 | | 7 7 | This file is part of the RoundCube Webmail client | 8 | Copyright (C) 200 5-2007, RoundCube Dev,- Switzerland |8 | Copyright (C) 2006-2008, RoundCube Dev. - Switzerland | 9 9 | Licensed under the GNU GPL | 10 10 | | … … 21 21 22 22 23 function sess_open($save_path, $session_name) 24 { 23 function sess_open($save_path, $session_name) { 25 24 return true; 26 25 } 27 26 28 27 29 function sess_close() 30 { 28 function sess_close() { 31 29 return true; 32 30 } … … 34 32 35 33 // read session data 36 function sess_read($key) 37 { 34 function sess_read($key) { 38 35 $registry = rcube_registry::get_instance(); 39 36 $DB = $registry->get('DB', 'core'); … … 66 63 67 64 // save session data 68 function sess_write($key, $vars) 69 { 65 function sess_write($key, $vars) { 70 66 $DB = rcube_registry::get_instance()->get('DB', 'core'); 71 67 72 if (!is_object($DB) || $DB->is_error()) 68 if (!is_object($DB) || $DB->is_error()) { 73 69 return false; 70 } 74 71 75 72 $sql_result = $DB->query( … … 88 85 $vars, 89 86 $key); 90 } 91 else { 87 } else { 92 88 $DB->query( 93 89 "INSERT INTO " . rcube::get_table_name('session') . " … … 104 100 105 101 // handler for session_destroy() 106 function sess_destroy($key) 107 { 102 function sess_destroy($key) { 108 103 $DB = rcube_registry::get_instance()->get('DB', 'core'); 109 104 … … 127 122 128 123 // garbage collecting function 129 function sess_gc($maxlifetime) 130 { 124 function sess_gc($maxlifetime) { 131 125 $DB = rcube_registry::get_instance()->get('DB', 'core'); 132 126 … … 165 159 166 160 167 function sess_regenerate_id() 168 { 161 function sess_regenerate_id() { 169 162 $randlen = 32; 170 163 $randval = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; … … 183 176 $cookie = session_get_cookie_params(); 184 177 setcookie(session_name(), $random, $cookie['lifetime'], $cookie['path']); 178 setcookie(session_name(), '', time() - 3600); 179 setcookie(session_name(), $random, $cookie['lifetime'] ? time() + $cookie['lifetime'] : 0, $cookie['path']); 185 180 186 181 return true;
Note: See TracChangeset
for help on using the changeset viewer.
