Changeset 4025 in subversion
- Timestamp:
- Sep 30, 2010 9:24:33 AM (3 years ago)
- Location:
- trunk/roundcubemail
- Files:
-
- 9 edited
-
CHANGELOG (modified) (1 diff)
-
program/steps/addressbook/copy.inc (modified) (3 diffs)
-
program/steps/addressbook/delete.inc (modified) (2 diffs)
-
program/steps/addressbook/groups.inc (modified) (5 diffs)
-
program/steps/addressbook/import.inc (modified) (1 diff)
-
program/steps/addressbook/save.inc (modified) (5 diffs)
-
program/steps/mail/addcontact.inc (modified) (3 diffs)
-
program/steps/settings/delete_identity.inc (modified) (2 diffs)
-
program/steps/settings/save_identity.inc (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/roundcubemail/CHANGELOG
r4024 r4025 13 13 - Change reply prefix to display email address only if sender name doesn't exist (#1486550) 14 14 - Fix charset replacement in HTML message bodies (#1487021) 15 - Plugin API: improved 'abort' flag handling, added 'result' item in some hooks (#1486914) 15 16 16 17 RELEASE 0.4.1 -
trunk/roundcubemail/program/steps/addressbook/copy.inc
r3989 r4025 38 38 39 39 foreach ($arr_cids as $cid) { 40 $plugin = $RCMAIL->plugins->exec_hook('contact_create', array( 41 'record' => $CONTACTS->get_record($cid, true), 42 'source' => $target, 43 'group' => $target_group, 44 )); 45 $a_record = $plugin['record']; 40 $a_record = $CONTACTS->get_record($cid, true); 46 41 47 if (!$plugin['abort']) { 48 // check if contact exists, if so, we'll need it's ID 49 $result = $TARGET->search('email', $a_record['email'], true, true); 42 // check if contact exists, if so, we'll need it's ID 43 $result = $TARGET->search('email', $a_record['email'], true, true); 50 44 51 // insert contact record 52 if (!$result->count) { 45 // insert contact record 46 if (!$result->count) { 47 $plugin = $RCMAIL->plugins->exec_hook('contact_create', array( 48 'record' => $a_record, 'source' => $target, 'group' => $target_group)); 49 50 if (!$plugin['abort']) { 53 51 if ($insert_id = $TARGET->insert($a_record, false)) { 54 52 $ids[] = $insert_id; … … 56 54 } 57 55 } 58 else {59 $ record = $result->first();60 $ ids[] = $record['ID'];56 else if ($plugin['result']) { 57 $ids = array_merge($ids, $plugin['result']); 58 $success++; 61 59 } 60 } 61 else { 62 $record = $result->first(); 63 $ids[] = $record['ID']; 62 64 } 63 65 } … … 80 82 $success = $cnt; 81 83 } 84 else if ($plugin['result']) 85 $success = $plugin['result']; 82 86 } 83 87 } -
trunk/roundcubemail/program/steps/addressbook/delete.inc
r3989 r4025 24 24 preg_match('/^[a-zA-Z0-9\+\/=_-]+(,[a-zA-Z0-9\+\/=_-]+)*$/', $cid) 25 25 ) { 26 $plugin = $RCMAIL->plugins->exec_hook('contact_delete', array('id' => $cid, 'source' => get_input_value('_source', RCUBE_INPUT_GPC))); 26 $plugin = $RCMAIL->plugins->exec_hook('contact_delete', array( 27 'id' => $cid, 'source' => get_input_value('_source', RCUBE_INPUT_GPC))); 27 28 28 $deleted = !$plugin['abort'] ? $CONTACTS->delete($cid) : false;29 if (!$deleted) 30 {29 $deleted = !$plugin['abort'] ? $CONTACTS->delete($cid) : $plugin['result']; 30 31 if (!$deleted) { 31 32 // send error message 32 33 exit; 33 }34 } 34 35 35 36 // count contacts for this user … … 47 48 // send response 48 49 $OUTPUT->send(); 49 }50 } 50 51 51 52 exit; -
trunk/roundcubemail/program/steps/addressbook/groups.inc
r3989 r4025 34 34 $num2add = count(explode(',', $plugin['ids'])); 35 35 36 if (!$plugin['abort'] && ($maxnum = $RCMAIL->config->get('max_group_members', 0)) && ($CONTACTS->count()->count + $num2add > $maxnum)) 37 $OUTPUT->show_message('maxgroupmembersreached', 'warning', array('max' => $maxnum)); 38 else if (!$plugin['abort'] && $CONTACTS->add_to_group($gid, $plugin['ids'])) 36 if (!$plugin['abort']) { 37 if (($maxnum = $RCMAIL->config->get('max_group_members', 0)) && ($CONTACTS->count()->count + $num2add > $maxnum)) { 38 $OUTPUT->show_message('maxgroupmembersreached', 'warning', array('max' => $maxnum)); 39 $OUTPUT->send(); 40 } 41 $result = $CONTACTS->add_to_group($gid, $plugin['ids']); 42 } 43 else { 44 $result = $plugin['result']; 45 } 46 47 if ($result) 39 48 $OUTPUT->show_message('contactaddedtogroup'); 40 49 else if ($plugin['message']) … … 47 56 $plugin = $RCMAIL->plugins->exec_hook('group_delmembers', array('group_id' => $gid, 'ids' => $ids, 'source' => $source)); 48 57 49 if (!$plugin['abort'] && $CONTACTS->remove_from_group($gid, $plugin['ids'])) 58 if (!$plugin['abort']) 59 $result = $CONTACTS->remove_from_group($gid, $plugin['ids']); 60 else 61 $result = $plugin['result']; 62 63 if ($result) 50 64 $OUTPUT->show_message('contactremovedfromgroup'); 51 65 else if ($plugin['message']) … … 57 71 if ($name = trim(get_input_value('_name', RCUBE_INPUT_POST))) { 58 72 $plugin = $RCMAIL->plugins->exec_hook('group_create', array('name' => $name, 'source' => $source)); 73 59 74 if (!$plugin['abort']) 60 75 $created = $CONTACTS->create_group($plugin['name']); 76 else 77 $created = $plugin['result']; 61 78 } 62 79 … … 73 90 if (($gid = get_input_value('_gid', RCUBE_INPUT_POST)) && ($name = trim(get_input_value('_name', RCUBE_INPUT_POST)))) { 74 91 $plugin = $RCMAIL->plugins->exec_hook('group_rename', array('group_id' => $gid, 'name' => $name, 'source' => $source)); 92 75 93 if (!$plugin['abort']) 76 94 $newname = $CONTACTS->rename_group($gid, $plugin['name']); 95 else 96 $newname = $plugin['result']; 77 97 } 78 98 … … 86 106 if ($gid = get_input_value('_gid', RCUBE_INPUT_POST)) { 87 107 $plugin = $RCMAIL->plugins->exec_hook('group_delete', array('group_id' => $gid, 'source' => $source)); 108 88 109 if (!$plugin['abort']) 89 110 $deleted = $CONTACTS->delete_group($gid); 111 else 112 $deleted = $plugin['result']; 90 113 } 91 114 -
trunk/roundcubemail/program/steps/addressbook/import.inc
r3989 r4025 160 160 161 161 // insert record and send response 162 if (!$plugin['abort'] && ($success = $CONTACTS->insert($a_record))) { 162 if (!$plugin['abort']) 163 $success = $CONTACTS->insert($a_record); 164 else 165 $success = $plugin['result']; 166 167 if ($success) { 163 168 $IMPORT_STATS->inserted++; 164 169 $IMPORT_STATS->names[] = $vcard->displayname; -
trunk/roundcubemail/program/steps/addressbook/save.inc
r3989 r4025 59 59 $a_record = $plugin['record']; 60 60 61 if (!$plugin['abort'] && ($result = $CONTACTS->update($cid, $a_record))) 62 { 61 if (!$plugin['abort']) 62 $result = $CONTACTS->update($cid, $a_record); 63 else 64 $result = $plugin['result']; 65 66 if ($result) { 63 67 // LDAP DN change 64 68 if (is_string($result) && strlen($result)>1) { … … 82 86 rcmail_overwrite_action('show'); 83 87 } 84 else 85 { 88 else { 86 89 // show error message 87 $OUTPUT->show_message( 'errorsaving', 'error', null, false);90 $OUTPUT->show_message($plugin['message'] ? $plugin['message'] : 'errorsaving', 'error', null, false); 88 91 rcmail_overwrite_action('show'); 89 92 } … … 91 94 92 95 // insert a new contact 93 else 94 { 96 else { 95 97 // check for existing contacts 96 98 $existing = $CONTACTS->search('email', $a_record['email'], true, false); 97 99 98 100 // show warning message 99 if ($existing->count) 100 { 101 if ($existing->count) { 101 102 $OUTPUT->show_message('contactexists', 'warning', null, false); 102 103 rcmail_overwrite_action('add'); … … 104 105 } 105 106 106 $plugin = $RCMAIL->plugins->exec_hook('contact_create', array('record' => $a_record, 'source' => get_input_value('_source', RCUBE_INPUT_GPC))); 107 $plugin = $RCMAIL->plugins->exec_hook('contact_create', array( 108 'record' => $a_record, 'source' => get_input_value('_source', RCUBE_INPUT_GPC))); 107 109 $a_record = $plugin['record']; 108 110 109 111 // insert record and send response 110 if (!$plugin['abort'] && ($insert_id = $CONTACTS->insert($a_record))) 111 { 112 if (!$plugin['abort']) 113 $insert_id = $CONTACTS->insert($a_record); 114 else 115 $insert_id = $plugin['result']; 116 117 118 if ($insert_id) { 112 119 // add contact row or jump to the page where it should appear 113 120 $CONTACTS->reset(); … … 125 132 $OUTPUT->send('iframe'); 126 133 } 127 else 128 { 134 else { 129 135 // show error message 130 $OUTPUT->show_message( 'errorsaving', 'error', null, false);136 $OUTPUT->show_message($plugin['message'] ? $plugin['message'] : 'errorsaving', 'error', null, false); 131 137 rcmail_overwrite_action('add'); 132 138 } 133 139 } 134 135 -
trunk/roundcubemail/program/steps/mail/addcontact.inc
r4009 r4025 31 31 $contact_arr = $IMAP->decode_address_list(get_input_value('_address', RCUBE_INPUT_POST, true), 1, false); 32 32 33 if (!empty($contact_arr[1]['mailto'])) 34 { 33 if (!empty($contact_arr[1]['mailto'])) { 35 34 $contact = array( 36 35 'email' => $contact_arr[1]['mailto'], … … 46 45 // check for existing contacts 47 46 $existing = $CONTACTS->search('email', $contact['email'], true, false); 47 48 48 if ($done = $existing->count) 49 49 $OUTPUT->show_message('contactexists', 'warning'); 50 else 51 { 50 else { 52 51 $plugin = $RCMAIL->plugins->exec_hook('contact_create', array('record' => $contact, 'source' => null)); 53 52 $contact = $plugin['record']; 54 53 55 if (!$plugin['abort'] && ($done = $CONTACTS->insert($contact))) 54 $done = !$plugin['abort'] ? $CONTACTS->insert($contact) : $plugin['result']; 55 56 if ($done) 56 57 $OUTPUT->show_message('addedsuccessfully', 'confirmation'); 57 58 } … … 60 61 61 62 if (!$done) 62 $OUTPUT->show_message( 'errorsavingcontact', 'warning');63 $OUTPUT->show_message($plugin['message'] ? $plugin['message'] : 'errorsavingcontact', 'warning'); 63 64 64 65 $OUTPUT->send(); -
trunk/roundcubemail/program/steps/settings/delete_identity.inc
r3989 r4025 33 33 $plugin = $RCMAIL->plugins->exec_hook('identity_delete', array('id' => $iid)); 34 34 35 if (!$plugin['abort'] && $USER->delete_identity($iid)) { 35 $deleted = !$plugin['abort'] ? $USER->delete_identity($iid) : $plugin['result']; 36 37 if ($deleted) 36 38 $OUTPUT->show_message('deletedsuccessfully', 'confirmation', null, false); 37 } 38 else { 39 $OUTPUT->show_message('nodeletelastidentity', 'error', null, false); 40 } 39 else 40 $OUTPUT->show_message($plugin['message'] ? $plugin['message'] : 'nodeletelastidentity', 'error', null, false); 41 41 42 // send response 42 43 if ($OUTPUT->ajax_call) … … 49 50 // go to identities page 50 51 rcmail_overwrite_action('identities'); 51 52 -
trunk/roundcubemail/program/steps/settings/save_identity.inc
r4009 r4025 84 84 $save_data['reply-to'] = idn_to_ascii($save_data['reply-to']); 85 85 86 if (!$plugin['abort'] && ($updated = $USER->update_identity($iid, $save_data))) 87 { 86 if (!$plugin['abort']) 87 $updated = $USER->update_identity($iid, $save_data); 88 else 89 $updated = $plugin['result']; 90 91 if ($updated) { 88 92 $OUTPUT->show_message('successfullysaved', 'confirmation'); 89 93 90 94 if (!empty($_POST['_standard'])) 91 95 $default_id = get_input_value('_iid', RCUBE_INPUT_POST); 92 93 if ($_POST['_framed']) 94 { 96 97 if ($_POST['_framed']) { 95 98 // update the changed col in list 96 99 // ... 97 100 } 98 101 } 99 else if ($plugin['abort'] || $DB->is_error()) 100 { 102 else { 101 103 // show error message 102 $OUTPUT->show_message( 'errorsaving', 'error', null, false);104 $OUTPUT->show_message($plugin['message'] ? $plugin['message'] : 'errorsaving', 'error', null, false); 103 105 rcmail_overwrite_action('edit-identity'); 104 106 return; … … 119 121 $save_data['reply-to'] = idn_to_ascii($save_data['reply-to']); 120 122 121 if (!$plugin['abort'] && $save_data['email'] && ($insert_id = $USER->insert_identity($save_data))) 122 { 123 if (!$plugin['abort']) 124 $insert_id = $save_data['email'] ? $USER->insert_identity($save_data) : null; 125 else 126 $insert_id = $plugin['result']; 127 128 if ($insert_id) { 123 129 $OUTPUT->show_message('successfullysaved', 'confirmation', null, false); 124 130 … … 128 134 $default_id = $insert_id; 129 135 } 130 else 131 { 136 else { 132 137 // show error message 133 $OUTPUT->show_message( 'errorsaving', 'error', null, false);138 $OUTPUT->show_message($plugin['message'] ? $plugin['message'] : 'errorsaving', 'error', null, false); 134 139 rcmail_overwrite_action('edit-identity'); 135 140 return; … … 146 151 // go to next step 147 152 rcmail_overwrite_action('identities'); 148 149
Note: See TracChangeset
for help on using the changeset viewer.
