Changeset 10a69975 in github
- Timestamp:
- Nov 6, 2005 2:26:45 PM (8 years ago)
- Branches:
- master, HEAD, courier-fix, dev-browser-capabilities, pdo, release-0.6, release-0.7, release-0.8
- Children:
- e66f5b4
- Parents:
- e0ddd4e
- Files:
-
- 18 edited
-
CHANGELOG (modified) (2 diffs)
-
INSTALL (modified) (1 diff)
-
program/include/main.inc (modified) (3 diffs)
-
program/include/rcube_db.inc (modified) (2 diffs)
-
program/include/rcube_mdb2.inc (modified) (5 diffs)
-
program/js/app.js (modified) (7 diffs)
-
program/js/common.js (modified) (2 diffs)
-
program/localization/de/labels.inc (modified) (1 diff)
-
program/localization/de/messages.inc (modified) (2 diffs)
-
program/localization/en/labels.inc (modified) (1 diff)
-
program/localization/en/messages.inc (modified) (2 diffs)
-
program/steps/addressbook/edit.inc (modified) (2 diffs)
-
program/steps/addressbook/save.inc (modified) (7 diffs)
-
program/steps/mail/compose.inc (modified) (1 diff)
-
program/steps/mail/sendmail.inc (modified) (3 diffs)
-
program/steps/settings/edit_identity.inc (modified) (1 diff)
-
program/steps/settings/func.inc (modified) (1 diff)
-
program/steps/settings/save_identity.inc (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
CHANGELOG
re0ddd4e r10a69975 61 61 62 62 63 2005/11/0 263 2005/11/06 64 64 ---------- 65 65 - Added Finnish, Romanian and Chinese translation … … 72 72 - Added more XSS protection (Bug #1308236) 73 73 - Added tab indexes for compose form 74 74 - Added 'changed' col to contacts table 75 - Support for 160-bit session hashes 76 - Added input check for contacts and identities (Patch #1346523) 77 - Added messages/warning to compose step (Patch #1323895) -
INSTALL
r7cc38e0 r10a69975 4 4 5 5 1. Decompress and put this folder somewhere inside your document root 6 2. Make sure that the following directories are writable by the webserver 6 2. Make sure that the following directories (and the files within) 7 are writable by the webserver 7 8 - /temp 8 9 - /logs 9 3. Create a new database and a database user for RoundCube 10 3. Create a new database and a database user for RoundCube (see DATABASE SETUP) 10 11 4. Create database tables using the queries in file 'SQL/*.initial.sql' 12 (* stands for your database type) 11 13 5. Rename the files config/*.inc.php.dist to config/*.inc.php 12 14 6. Modify the files in config/* to suit your local environment 13 15 7. Done! 16 17 18 DATABASE SETUP 19 ============== 20 21 * MySQL 22 ------- 23 Setting up the mysql database can be done by creating an empty database, 24 importing the table layout and granting the proper permissions to the 25 roundcube user. Here is an example of that procedure: 26 27 # mysql 28 > create database 'roundcubemail'; 29 > GRANT ALL PRIVILEGES ON roundcubemail.* TO roundcube@localhost 30 IDENTIFIED BY 'password'; 31 > quit 32 # mysql roundcubemail < SQL/mysql.initial.sql 33 34 * SQLite 35 -------- 36 Sqlite requires specifically php5 (sqlite in php4 currently doesn't 37 work with roundcube), and you need sqlite 2 (preferably 2.8) to setup 38 the sqlite db (sqlite 3.x also doesn't work at the moment). Here is 39 an example how you can setup the sqlite.db for roundcube: 40 41 # sqlite -init SQL/sqlite.initial.sql sqlite.db 42 43 Make sure your configuration points to the sqlite.db file and that the 44 webserver can write to the file. 14 45 15 46 -
program/include/main.inc
r36df57c r10a69975 249 249 else 250 250 rcmail_set_locale($sess_user_lang); 251 252 // add some basic label to client 253 rcube_add_label('loading'); 251 254 } 252 255 … … 402 405 403 406 407 // overwrite action variable 408 function rcmail_overwrite_action($action) 409 { 410 global $OUTPUT, $JS_OBJECT_NAME; 411 $GLOBALS['_action'] = $action; 412 413 $OUTPUT->add_script(sprintf("\n%s.set_env('action', '%s');", $JS_OBJECT_NAME, $action)); 414 } 415 416 404 417 function show_message($message, $type='notice') 405 418 { … … 488 501 489 502 return $sa_languages; 503 } 504 505 506 // add a localized label to the client environment 507 function rcube_add_label() 508 { 509 global $OUTPUT, $JS_OBJECT_NAME; 510 511 $arg_list = func_get_args(); 512 foreach ($arg_list as $i => $name) 513 $OUTPUT->add_script(sprintf("%s.add_label('%s', '%s');", 514 $JS_OBJECT_NAME, 515 $name, 516 rep_specialchars_output(rcube_label($name), 'js'))); 490 517 } 491 518 -
program/include/rcube_db.inc
rccfda89 r10a69975 221 221 } 222 222 223 function quoteIdentifier ( $str ) 223 224 function quote($input, $type=null) 225 { 226 if (!$this->db_handle) 227 $this->db_connect('r'); 228 229 return $this->db_handle->quote($input); 230 } 231 232 233 function quoteIdentifier($str) 224 234 { 225 235 if (!$this->db_handle) … … 228 238 return $this->db_handle->quoteIdentifier($str); 229 239 } 240 241 function quote_identifier($str) 242 { 243 return $this->quoteIdentifier($str); 244 } 245 230 246 231 247 function unixtimestamp($field) -
program/include/rcube_mdb2.inc
r36df57c r10a69975 103 103 104 104 // Query database 105 106 105 function query() 107 108 { 109 106 { 110 107 $params = func_get_args(); 111 112 108 $query = array_shift($params); 113 109 114 115 116 110 return $this->_query($query, 0, 0, $params); 117 118 } 119 120 111 } 112 121 113 122 114 function limitquery() 123 124 115 { 125 116 126 117 $params = func_get_args(); 127 128 118 $query = array_shift($params); 129 130 119 $offset = array_shift($params); 131 132 120 $numrows = array_shift($params); 133 121 134 135 136 122 return $this->_query($query, $offset, $numrows, $params); 137 138 123 } 139 124 … … 169 154 } 170 155 156 171 157 function num_rows($res_id=NULL) 172 158 { … … 182 168 } 183 169 170 184 171 function affected_rows($res_id=NULL) 185 172 { … … 189 176 return $this->db_handle->affectedRows(); 190 177 } 178 191 179 192 180 function insert_id($sequence = '') … … 213 201 } 214 202 215 function quoteIdentifier ( $str ) 216 203 204 function quote($input, $type=null) 205 { 206 if (!$this->db_handle) 207 $this->db_connect('r'); 208 209 return $this->db_handle->quote($input, $type); 210 } 211 212 213 function quoteIdentifier($str) 217 214 { 218 219 215 if (!$this->db_handle) 220 221 216 $this->db_connect('r'); 222 217 223 224 225 218 return $this->db_handle->quoteIdentifier($str); 226 227 219 } 228 220 221 function quote_identifier($str) 222 { 223 return $this->quoteIdentifier($str); 224 } 225 226 229 227 function unixtimestamp($field) 230 231 228 { 232 233 229 switch($this->db_provider) 234 235 230 { 236 237 231 case 'pgsql': 238 239 232 return "EXTRACT (EPOCH FROM $field)"; 240 241 233 break; 242 234 243 235 default: 244 245 236 return "UNIX_TIMESTAMP($field)"; 246 247 237 } 248 249 238 } 250 239 240 251 241 function _add_result($res, $query) 252 242 { -
program/js/app.js
r6a35c82 r10a69975 7 7 | Licensed under the GNU GPL | 8 8 | | 9 | Modified: 2005/11/0 1(roundcube) |9 | Modified: 2005/11/06 (roundcube) | 10 10 | | 11 11 +-----------------------------------------------------------------------+ … … 20 20 { 21 21 this.env = new Object(); 22 this.labels = new Object(); 22 23 this.buttons = new Object(); 23 24 this.gui_objects = new Object(); … … 49 50 this.env[name] = value; 50 51 }; 52 53 54 // add a localized label to the client environment 55 this.add_label = function(key, value) 56 { 57 this.labels[key] = value; 58 }; 59 51 60 52 61 // add a button to the button list … … 514 523 case 'save': 515 524 if (this.gui_objects.editform) 525 { 526 var input_pagesize = rcube_find_object('_pagesize'); 527 var input_name = rcube_find_object('_name'); 528 var input_email = rcube_find_object('_email'); 529 530 // user prefs 531 if (input_pagesize && input_pagesize.value == '') 532 { 533 alert(this.get_label('nopagesizewarning')); 534 input_pagesize.focus(); 535 break; 536 } 537 // contacts/identities 538 else 539 { 540 if (input_name && input_name.value == '') 541 { 542 alert(this.get_label('nonamewarning')); 543 input_name.focus(); 544 break; 545 } 546 else if (input_email && !rcube_check_email(input_email.value)) 547 { 548 alert(this.get_label('noemailwarning')); 549 input_email.focus(); 550 break; 551 } 552 } 553 516 554 this.gui_objects.editform.submit(); 555 } 517 556 break; 518 557 … … 640 679 var input_subject = rcube_find_object('_subject'); 641 680 var input_message = rcube_find_object('_message'); 642 643 if (input_to.value!='' && input_message.value!='') 681 682 // check for empty recipient 683 if (input_to && !rcube_check_email(input_to.value, true)) 644 684 { 645 this.set_busy(true, 'sendingmessage');646 var form = this.gui_objects.messageform;647 form.submit();685 alert(this.get_label('norecipientwarning')); 686 input_to.focus(); 687 break; 648 688 } 649 689 690 // display localized warning for missing subject 691 if (input_subject && input_subject.value == '') 692 { 693 var subject = prompt(this.get_label('nosubjectwarning'), this.get_label('nosubject')); 694 695 // user hit cancel, so don't send 696 if (!subject && subject !== '') 697 { 698 input_subject.focus(); 699 break; 700 } 701 else 702 { 703 input_subject.value = subject ? subject : this.get_label('nosubject'); 704 } 705 } 706 707 // check for empty body 708 if (input_message.value=='') 709 { 710 if (!confirm(this.get_label('nobodywarning'))) 711 { 712 input_message.focus(); 713 break; 714 } 715 } 716 717 // all checks passed, send message 718 this.set_busy(true, 'sendingmessage'); 719 var form = this.gui_objects.messageform; 720 form.submit(); 650 721 break; 651 722 … … 761 832 { 762 833 if (a && message) 763 this.display_message('Loading...', 'loading', true); 834 { 835 var msg = this.get_label(message); 836 if (msg==message) 837 msg = 'Loading...'; 838 839 this.display_message(msg, 'loading', true); 840 } 764 841 else if (!a && this.busy) 765 842 this.hide_message(); … … 781 858 782 859 860 // return a localized string 861 this.get_label = function(name) 862 { 863 if (this.labels[name]) 864 return this.labels[name]; 865 else 866 return name; 867 }; 868 869 870 // switch to another application task 783 871 this.switch_task = function(task) 784 872 { -
program/js/common.js
ra95e0e1 r10a69975 7 7 | Licensed under the GNU GPL | 8 8 | | 9 | Modified:2005/1 0/21(roundcube) |9 | Modified:2005/11/06 (roundcube) | 10 10 | | 11 11 +-----------------------------------------------------------------------+ … … 265 265 266 266 267 // check if input is a valid email address 268 function rcube_check_email(input, inline) 269 { 270 if (input && window.RegExp) 271 { 272 var reg_str = '([a-z0-9][-a-z0-9\.\+_]*)\@([a-z0-9]([-a-z0-9][\.]?)*[a-z0-9]\.[a-z]{2,9})'; 273 var reg1 = inline ? new RegExp(reg_str, 'i') : new RegExp('^'+reg_str+'$', 'i'); 274 var reg2 = /[\._\-\@]{2}/; 275 return reg1.test(input) && !reg2.test(input) ? true : false; 276 } 277 return false; 278 } 279 267 280 268 281 // find a value in a specific array and returns the index -
program/localization/de/labels.inc
rb076a46 r10a69975 120 120 $labels['highest'] = 'Höchste'; 121 121 122 $labels['nosubject'] = '(kein Betreff)'; 123 122 124 $labels['showimages'] = 'Bilder anzeigen'; 123 125 -
program/localization/de/messages.inc
ra95e0e1 r10a69975 33 33 $messages['mailboxempty'] = 'Ordner ist leer'; 34 34 35 $messages['loadingdata'] = 'Daten werden geladen...'; 35 $messages['loading'] = $messages['loadingdata'] = 'Daten werden geladen...'; 36 37 $messages['sendingmessage'] = 'Nachricht wird gesendet...'; 36 38 37 39 $messages['messagesent'] = 'Nachricht erfolgreich gesendet'; … … 53 55 $messages['errorsaving'] = 'Beim Speichern ist ein Fehler aufgetreten'; 54 56 57 $messages['formincomplete'] = 'Das Formular wurde nicht vollständig ausgefüllt'; 58 59 $messages['noemailwarning'] = 'Bitte geben Sie eine gültige E-Mail-Adresse ein'; 60 61 $messages['nonamewarning'] = 'Bitte geben Sie einen Namen ein'; 62 63 $messages['nopagesizewarning'] = 'Bitte geben Sie eine Einträge pro Seite ein'; 64 65 $messages['norecipientwarning'] = 'Bitte geben Sie mindestens einen Empfänger an'; 66 67 $messages['nosubjectwarning'] = 'Die Betreffzeile ist leer. Möchten Sie jetzt einen Betreff eingeben?'; 68 69 $messages['nobodywarning'] = 'Diese Nachricht ohne Inhalt senden?'; 55 70 56 71 ?> -
program/localization/en/labels.inc
rb076a46 r10a69975 120 120 $labels['highest'] = 'Highest'; 121 121 122 $labels['nosubject'] = '(no subject)'; 123 122 124 $labels['showimages'] = 'Display images'; 123 125 -
program/localization/en/messages.inc
r09941ea r10a69975 33 33 $messages['mailboxempty'] = 'Mailbox is empty'; 34 34 35 $messages['loading'] = 'Loading...'; 36 35 37 $messages['loadingdata'] = 'Loading data...'; 38 39 $messages['sendingmessage'] = 'Sending message...'; 36 40 37 41 $messages['messagesent'] = 'Message sent successfully'; … … 57 61 $messages['errordeleting'] = 'Could not delete the message'; 58 62 63 $messages['errordeleting'] = 'Could not delete the message'; 64 65 $messages['formincomplete'] = 'The form was not completely filled out'; 66 67 $messages['noemailwarning'] = 'Please enter a valid email address'; 68 69 $messages['nonamewarning'] = 'Please enter a name'; 70 71 $messages['nopagesizewarning'] = 'Please enter a page size'; 72 73 $messages['norecipientwarning'] = 'Please enter at least one recipient'; 74 75 $messages['nosubjectwarning'] = 'The "Subject" field is empty. Would you like to enter one now?'; 76 77 $messages['nobodywarning'] = 'Send this message without text?'; 78 59 79 60 80 ?> -
program/steps/addressbook/edit.inc
rd7cb774 r10a69975 32 32 33 33 $CONTACT_RECORD = $DB->fetch_assoc(); 34 34 35 35 if (is_array($CONTACT_RECORD)) 36 36 $OUTPUT->add_script(sprintf("%s.set_env('cid', '%s');", $JS_OBJECT_NAME, $CONTACT_RECORD['contact_id'])); … … 45 45 if (!$CONTACT_RECORD && $GLOBALS['_action']!='add') 46 46 return rcube_label('contactnotfound'); 47 48 // add some labels to client 49 rcube_add_label('noemailwarning'); 50 rcube_add_label('nonamewarning'); 47 51 48 52 list($form_start, $form_end) = get_form_tags($attrib); -
program/steps/addressbook/save.inc
re0ddd4e r10a69975 24 24 25 25 26 // check input 27 if (empty($_POST['_name']) || empty($_POST['_email'])) 28 { 29 show_message('formincomplete', 'warning'); 30 rcmail_overwrite_action($_POST['_cid'] ? 'show' : 'add'); 31 return; 32 } 33 34 26 35 // update an existing contact 27 36 if ($_POST['_cid']) … … 35 44 continue; 36 45 37 $a_write_sql[] = sprintf("%s= '%s'", $col, addslashes(strip_tags($_POST[$fname])));46 $a_write_sql[] = sprintf("%s=%s", $DB->quoteIdentifier($col), $DB->quote(strip_tags($_POST[$fname]))); 38 47 } 39 48 … … 88 97 // show error message 89 98 show_message('errorsaving', 'error'); 90 $_action = 'show';99 rcmail_overwrite_action('show'); 91 100 } 92 101 } … … 96 105 { 97 106 $a_insert_cols = $a_insert_values = array(); 107 108 // check for existing contacts 109 $sql_result = $DB->query("SELECT 1 FROM ".get_table_name('contacts')." 110 WHERE user_id=? 111 AND email=? 112 AND del<>'1'", 113 $_SESSION['user_id'], 114 $_POST['_email']); 115 116 // show warning message 117 if ($DB->num_rows($sql_result)) 118 { 119 show_message('contactexists', 'warning'); 120 $_action = 'add'; 121 return; 122 } 98 123 99 124 foreach ($a_save_cols as $col) … … 104 129 105 130 $a_insert_cols[] = $col; 106 $a_insert_values[] = sprintf("'%s'", addslashes(strip_tags($_POST[$fname])));131 $a_insert_values[] = $DB->quote(strip_tags($_POST[$fname])); 107 132 } 108 133 … … 110 135 { 111 136 $DB->query("INSERT INTO ".get_table_name('contacts')." 112 (user_id, changed m".join(', ', $a_insert_cols).")137 (user_id, changed, ".join(', ', $a_insert_cols).") 113 138 VALUES (?, now(), ".join(', ', $a_insert_values).")", 114 139 $_SESSION['user_id']); … … 154 179 // show error message 155 180 show_message('errorsaving', 'error'); 156 $_action = 'add';181 rcmail_overwrite_action('add'); 157 182 } 158 183 } -
program/steps/mail/compose.inc
r317219d r10a69975 31 31 if (!is_array($_SESSION['compose'])) 32 32 $_SESSION['compose'] = array('id' => uniqid(rand())); 33 34 35 // add some labels to client 36 rcube_add_label('nosubject', 'norecipientwarning', 'nosubjectwarning', 'nobodywarning', 'sendingmessage'); 33 37 34 38 -
program/steps/mail/sendmail.inc
r6a35c82 r10a69975 29 29 if (!isset($_SESSION['compose']['id'])) 30 30 { 31 $_action = 'list';31 rcmail_overwrite_action('list'); 32 32 return; 33 33 } … … 66 66 67 67 68 if (empty($_POST['_to']) && empty($_POST['_subject']) && $_POST['_message']) 69 { 70 show_message("sendingfailed", 'error'); 71 rcmail_overwrite_action('compose'); 72 return; 73 } 74 75 68 76 $mailto_regexp = array('/,\s*[\r\n]+/', '/[\r\n]+/', '/,\s*$/m'); 69 77 $mailto_replace = array(' ', ', ', ''); … … 207 215 if (!$sent) 208 216 { 209 $_action = 'compose';210 $OUTPUT->add_script(sprintf("\n%s.set_env('action', '%s');", $JS_OBJECT_NAME, $_action));211 217 show_message("sendingfailed", 'error'); 218 rcmail_overwrite_action('compose'); 212 219 return; 213 220 } -
program/steps/settings/edit_identity.inc
rd7cb774 r10a69975 48 48 if (!$IDENTITY_RECORD && $GLOBALS['_action']!='add-identity') 49 49 return rcube_label('notfound'); 50 51 // add some labels to client 52 rcube_add_label('noemailwarning'); 53 rcube_add_label('nonamewarning'); 54 50 55 51 56 list($form_start, $form_end) = get_form_tags($attrib, 'save-identity', array('name' => '_iid', 'value' => $IDENTITY_RECORD['identity_id'])); -
program/steps/settings/func.inc
rd7cb774 r10a69975 35 35 global $DB, $CONFIG, $sess_user_lang; 36 36 37 // add some labels to client 38 rcube_add_label('nopagesizewarning'); 39 37 40 list($form_start, $form_end) = get_form_tags($attrib, 'save-prefs'); 38 41 unset($attrib['form']); -
program/steps/settings/save_identity.inc
rdba5f7c r10a69975 23 23 24 24 25 // check input 26 if (empty($_POST['_name']) || empty($_POST['_email'])) 27 { 28 show_message('formincomplete', 'warning'); 29 rcmail_overwrite_action('edit-identitiy'); 30 return; 31 } 32 33 25 34 // update an existing contact 26 35 if ($_POST['_iid']) … … 34 43 continue; 35 44 36 $a_write_sql[] = sprintf(" `%s`='%s'", $col, addslashes(strip_tags($_POST[$fname])));45 $a_write_sql[] = sprintf("%s=%s", $DB->quoteIdentifier($col), $DB->quote(strip_tags($_POST[$fname]))); 37 46 } 38 47 … … 57 66 $DB->query("UPDATE ".get_table_name('identities')." 58 67 SET ".$DB->quoteIdentifier('default')."='0' 59 WHERE identity_id!=?60 AND user_id=?68 WHERE user_id=? 69 AND identity_id<>? 61 70 AND del<>'1'", 62 $_ POST['_iid'],63 $_ SESSION['user_id']);71 $_SESSION['user_id'], 72 $_POST['_iid']); 64 73 65 74 if ($_POST['_framed']) … … 72 81 { 73 82 // show error message 74 83 show_message('errorsaving', 'error'); 84 rcmail_overwrite_action('edit-identitiy'); 75 85 } 76 86 } … … 88 98 89 99 $a_insert_cols[] = $DB->quoteIdentifier($col); 90 $a_insert_values[] = sprintf("'%s'", addslashes(strip_tags($_POST[$fname])));100 $a_insert_values[] = $DB->quote(strip_tags($_POST[$fname])); 91 101 } 92 102 … … 114 124 { 115 125 // show error message 126 show_message('errorsaving', 'error'); 127 rcmail_overwrite_action('edit-identitiy'); 116 128 } 117 129 } … … 119 131 120 132 // go to next step 121 if ($_POST['_framed']) 122 $_action = 'edit-identitiy'; 123 else 124 $_action = 'identities'; 125 126 127 // overwrite action variable 128 $OUTPUT->add_script(sprintf("\n%s.set_env('action', '%s');", $JS_OBJECT_NAME, $_action)); 133 rcmail_overwrite_action($_POST['_framed'] ? 'edit-identitiy' : 'identities'); 129 134 130 135 ?>
Note: See TracChangeset
for help on using the changeset viewer.
