Changeset 626 in subversion
- Timestamp:
- Jun 22, 2007 12:51:22 PM (6 years ago)
- Location:
- branches/devel-vnext/program
- Files:
-
- 1 added
- 8 edited
-
include/main.inc (modified) (1 diff)
-
include/rcube/html_page.php (modified) (2 diffs)
-
include/rcube/rcmail_compose.php (modified) (10 diffs)
-
include/rcube/result_set.php (added)
-
include/rcube_contacts.inc (modified) (2 diffs)
-
steps/mail/addcontact.inc (modified) (1 diff)
-
steps/mail/compose.inc (modified) (5 diffs)
-
steps/mail/func.inc (modified) (1 diff)
-
steps/mail/sendmail.inc (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/devel-vnext/program/include/main.inc
r624 r626 1053 1053 $registry = rc_registry::getInstance(); 1054 1054 $CONFIG = $registry->get('CONFIG', 'core'); 1055 $tmp = self::unslashify($CONFIG['temp_dir']);1055 $tmp = unslashify($CONFIG['temp_dir']); 1056 1056 $expire = mktime() - 172800; // expire in 48 hours 1057 1057 -
branches/devel-vnext/program/include/rcube/html_page.php
r624 r626 130 130 // include meta tag with charset 131 131 if (!empty($this->charset)) { 132 header('Content-Type: text/html; charset='.$this->charset); 133 $__page_header = '<meta http-equiv="content-type" content="text/html; charset='.$this->charset.'" />'."\n"; 132 if (headers_sent() !== TRUE) { 133 header('Content-Type: text/html; charset=' . $this->charset); 134 } 135 $__page_header = '<meta http-equiv="content-type"'; 136 $__page_header.= ' content="text/html; charset='; 137 $__page_header.= $this->charset . '" />'."\n"; 134 138 } 135 139 … … 138 142 if (is_array($this->script_files['head'])) { 139 143 foreach ($this->script_files['head'] as $file) { 140 $__page_header .= sprintf($this->script_tag_file, $this->scripts_path, $file); 144 $__page_header .= sprintf( 145 $this->script_tag_file, 146 $this->scripts_path, 147 $file 148 ); 141 149 } 142 150 } -
branches/devel-vnext/program/include/rcube/rcmail_compose.php
r624 r626 32 32 33 33 // we have a set of recipients stored is session 34 if (($mailto_id = rc_main::get_input_value('_mailto', RCUBE_INPUT_GET)) && $_SESSION['mailto'][$mailto_id]) { 34 if ( 35 ($mailto_id = rc_main::get_input_value('_mailto', RCUBE_INPUT_GET)) 36 && $_SESSION['mailto'][$mailto_id] 37 ) { 35 38 $fvalue = $_SESSION['mailto'][$mailto_id]; 36 39 } … … 97 100 $fvalue = ''; 98 101 99 rc_main::tfk_debug("/ test: " . var_export($sa_recipients, true));102 //rc_main::tfk_debug("/ test: " . var_export($sa_recipients, true)); 100 103 101 104 foreach ($to_addresses as $addr_part) { … … 218 221 while ($sql_arr = $DB->fetch_assoc($sql_result)) { 219 222 $identity_id = $sql_arr['identity_id']; 220 $select_from->add(rc_main::format_email_recipient($sql_arr['email'], $sql_arr['name']), $identity_id); 223 $select_from->add( 224 rc_main::format_email_recipient( 225 $sql_arr['email'], 226 $sql_arr['name'] 227 ), 228 $identity_id 229 ); 221 230 222 231 // add signature to array … … 232 241 233 242 // set identity if it's one of the reply-message recipients 234 if (in_array($sql_arr['email'], $a_recipients)) 243 if (in_array($sql_arr['email'], $a_recipients)) { 235 244 $from_id = $sql_arr['identity_id']; 236 245 } 237 246 if ($compose_mode == RCUBE_COMPOSE_REPLY && is_array($MESSAGE['FROM'])) { 238 247 $MESSAGE['FROM'][] = $sql_arr['email']; … … 406 415 407 416 $_date = $MESSAGE['headers']->date; 408 $_from = $ MESSAGE['headers']->from;417 $_from = $IMAP->decode_header($MESSAGE['headers']->from); 409 418 410 419 //tfk_debug('From: ' . $_from); … … 492 501 "<tr><th align=\"right\" nowrap=\"nowrap\" valign=\"baseline\">To: </th><td>%s</td></tr>" . 493 502 "</tbody></table><br>", 494 Q($_subject),495 Q($_date),496 Q($IMAP->decode_header($_from)),497 Q($IMAP->decode_header($_to))503 rc_main::Q($_subject), 504 rc_main::Q($_date), 505 rc_main::Q($IMAP->decode_header($_from)), 506 rc_main::Q($IMAP->decode_header($_to)) 498 507 ); 499 508 } … … 581 590 $MESSAGE = $registry->get('MESSAGE', 'core'); 582 591 $compose_mode = $registry->get('compose_mode', 'core'); 592 $IMAP = $registry->get('IMAP', 'core'); 583 593 584 594 list($form_start, $form_end) = get_form_tags($attrib); … … 591 601 592 602 $_subject = $MESSAGE['headers']->subject; 603 $_subject = $IMAP->decode_mime_string($_subject); 593 604 594 605 // use subject from post … … 666 677 JS_OBJECT_NAME, 667 678 $id, 668 Q(rcube_label('delete')),679 rc_main::Q(rcube_label('delete')), 669 680 $button, 670 Q($a_prop['name'])681 rc_main::Q($a_prop['name']) 671 682 ); 672 683 } … … 741 752 $selector = new select($attrib); 742 753 743 $selector->add(array(rcube_label('lowest'), 744 rcube_label('low'), 745 rcube_label('normal'), 746 rcube_label('high'), 747 rcube_label('highest')), 748 array(5, 4, 0, 2, 1)); 754 $selector->add( 755 array( 756 rcube_label('lowest'), 757 rcube_label('low'), 758 rcube_label('normal'), 759 rcube_label('high'), 760 rcube_label('highest') 761 ), 762 array(5, 4, 0, 2, 1) 763 ); 749 764 750 765 $sel = isset($_POST['_priority']) ? $_POST['_priority'] : 0; -
branches/devel-vnext/program/include/rcube_contacts.inc
r623 r626 20 20 */ 21 21 22 /** 23 * Include rcube_result_set 24 * @ignore 25 */ 26 require_once dirname(__FILE__) . '/rcube/result_set.php'; 27 28 /** 29 * rcube_contacts 30 * 31 * @final 32 */ 22 33 class rcube_contacts 23 34 { 24 var$db = null;25 var$db_name = '';26 var$user_id = 0;27 var$filter = null;28 var$result = null;29 var$search_fields;30 var$search_string;31 var$table_cols = array('name', 'email', 'firstname', 'surname');35 protected $db = null; 36 protected $db_name = ''; 37 protected $user_id = 0; 38 protected $filter = null; 39 protected $result = null; 40 protected $search_fields; 41 protected $search_string; 42 protected $table_cols = array('name', 'email', 'firstname', 'surname'); 32 43 33 44 /** public properties */ 34 var $primary_key = 'contact_id'; 35 var $readonly = false; 36 var $list_page = 1; 37 var $page_size = 10; 38 var $ready = false; 39 45 public $primary_key = 'contact_id'; 46 public $readonly = false; 47 public $list_page = 1; 48 public $page_size = 10; 49 public $ready = false; 40 50 41 51 /** 42 52 * Object constructor 43 53 * 44 * @param object Instance of the rcube_db class 45 * @param integer User-ID 46 */ 47 function __construct($dbconn, $user) 48 { 49 $this->db = $dbconn; 54 * @access public 55 * @param object Instance of the rcube_db class 56 * @param integer User-ID 57 */ 58 public function __construct($dbconn, $user) 59 { 60 $this->db = $dbconn; 50 61 $this->db_name = rc_main::get_table_name('contacts'); 51 62 $this->user_id = $user; 52 $this->ready = $this->db && !$this->db->is_error(); 53 } 54 55 /** 56 * PHP 4 object constructor 57 * 58 * @see rcube_contacts::__construct 59 */ 60 function rcube_contacts($dbconn, $user) 61 { 62 $this->__construct($dbconn, $user); 63 } 64 65 66 /** 67 * Set internal list page 68 * 69 * @param number Page number to list 70 * @access public 71 */ 72 function set_page($page) 73 { 74 $this->list_page = (int)$page; 75 } 76 77 78 /** 79 * Set internal page size 80 * 81 * @param number Number of messages to display on one page 82 * @access public 83 */ 84 function set_pagesize($size) 85 { 86 $this->page_size = (int)$size; 87 } 88 89 90 /** 91 * Save a search string for future listings 92 * 93 * @param string SQL params to use in listing method 94 */ 95 function set_search_set($filter) 96 { 97 $this->filter = $filter; 98 } 99 100 101 /** 102 * Getter for saved search properties 103 * 104 * @return mixed Search properties used by this class 105 */ 106 function get_search_set() 107 { 108 return $this->filter; 109 } 110 111 112 /** 113 * Reset all saved results and search parameters 114 */ 115 function reset() 116 { 117 $this->result = null; 118 $this->filter = null; 119 $this->search_fields = null; 120 $this->search_string = null; 121 } 122 123 124 /** 125 * List the current set of contact records 126 * 127 * @param array List of cols to show 128 * @return array Indexed list of contact records, each a hash array 129 */ 130 function list_records($cols=null, $subset=0) 131 { 132 // count contacts for this user 133 $this->result = $this->count(); 134 $sql_result = NULL; 135 136 // get contacts from DB 137 if ($this->result->count) 138 { 139 $start_row = $subset < 0 ? $this->result->first + $this->page_size + $subset : $this->result->first; 140 $length = $subset != 0 ? abs($subset) : $this->page_size; 141 142 $sql_result = $this->db->limitquery( 143 "SELECT * FROM ".$this->db_name." 144 WHERE del<>1 145 AND user_id=?" . 146 ($this->filter ? " AND (".$this->filter.")" : "") . 147 " ORDER BY name", 148 $start_row, 149 $length, 150 $this->user_id); 151 } 152 153 while ($sql_result && ($sql_arr = $this->db->fetch_assoc($sql_result))) 154 { 155 $sql_arr['ID'] = $sql_arr[$this->primary_key]; 156 // make sure we have a name to display 157 if (empty($sql_arr['name'])) 158 $sql_arr['name'] = $sql_arr['email']; 159 $this->result->add($sql_arr); 160 } 161 162 return $this->result; 163 } 164 165 166 /** 167 * Search contacts 168 * 169 * @param array List of fields to search in 170 * @param string Search value 171 * @param boolean True if results are requested, False if count only 172 * @return Indexed list of contact records and 'count' value 173 */ 174 function search($fields, $value, $select=true) 175 { 176 if (!is_array($fields)) 177 $fields = array($fields); 178 179 $add_where = array(); 180 foreach ($fields as $col) 181 { 182 if ($col == 'ID' || $col == $this->primary_key) 183 { 184 $ids = !is_array($value) ? split(',', $value) : $value; 185 $add_where[] = $this->primary_key." IN (".join(',', $ids).")"; 186 } 187 else 188 $add_where[] = $this->db->quoteIdentifier($col)." LIKE ".$this->db->quote(strlen($value)>2 ? "%$value%" : "$value%"); 189 } 190 191 if (!empty($add_where)) 192 { 193 $this->set_search_set(join(' OR ', $add_where)); 194 if ($select) 195 $this->list_records(); 196 else 63 $this->ready = $this->db && !$this->db->is_error(); 64 } 65 66 /** 67 * Set internal list page 68 * 69 * @param number Page number to list 70 * @access public 71 */ 72 function set_page($page) 73 { 74 $this->list_page = (int)$page; 75 } 76 77 78 /** 79 * Set internal page size 80 * 81 * @param number Number of messages to display on one page 82 * @access public 83 */ 84 function set_pagesize($size) 85 { 86 $this->page_size = (int)$size; 87 } 88 89 90 /** 91 * Save a search string for future listings 92 * 93 * @param string SQL params to use in listing method 94 */ 95 function set_search_set($filter) 96 { 97 $this->filter = $filter; 98 } 99 100 101 /** 102 * Getter for saved search properties 103 * 104 * @return mixed Search properties used by this class 105 */ 106 function get_search_set() 107 { 108 return $this->filter; 109 } 110 111 112 /** 113 * Reset all saved results and search parameters 114 */ 115 function reset() 116 { 117 $this->result = null; 118 $this->filter = null; 119 $this->search_fields = null; 120 $this->search_string = null; 121 } 122 123 124 /** 125 * List the current set of contact records 126 * 127 * @param array List of cols to show 128 * @return array Indexed list of contact records, each a hash array 129 */ 130 function list_records($cols=null, $subset=0) 131 { 132 // count contacts for this user 197 133 $this->result = $this->count(); 198 } 199 200 return $this->result; 201 } 202 203 204 /** 205 * Count number of available contacts in database 206 * 207 * @return Result array with values for 'count' and 'first' 208 */ 209 function count() 210 { 211 // count contacts for this user 212 $sql_result = $this->db->query( 213 "SELECT COUNT(contact_id) AS rows 214 FROM ".$this->db_name." 215 WHERE del<>1 216 AND user_id=?". 217 ($this->filter ? " AND (".$this->filter.")" : ""), 218 $this->user_id); 219 220 $sql_arr = $this->db->fetch_assoc($sql_result); 221 return new rcube_result_set($sql_arr['rows'], ($this->list_page-1) * $this->page_size);; 222 } 223 224 225 /** 226 * Return the last result set 227 * 228 * @return Result array or NULL if nothing selected yet 229 */ 230 function get_result($as_res=true) 231 { 232 return $this->result; 233 } 234 235 236 /** 237 * Get a specific contact record 238 * 239 * @param mixed record identifier(s) 240 * @return Result object with all record fields or False if not found 241 */ 242 function get_record($id, $assoc=false) 243 { 244 // return cached result 245 if ($this->result && ($first = $this->result->first()) && $first[$this->primary_key] == $id) 246 return $assoc ? $first : $this->result; 247 248 $this->db->query( 249 "SELECT * FROM ".$this->db_name." 250 WHERE contact_id=? 251 AND user_id=? 252 AND del<>1", 253 $id, 254 $this->user_id); 255 256 if ($sql_arr = $this->db->fetch_assoc()) 257 { 258 $sql_arr['ID'] = $sql_arr[$this->primary_key]; 259 $this->result = new rcube_result_set(1); 260 $this->result->add($sql_arr); 261 } 262 263 return $assoc && $sql_arr ? $sql_arr : $this->result; 264 } 134 $sql_result = NULL; 135 136 // get contacts from DB 137 if ($this->result->count) { 138 $start_row = $subset < 0 ? $this->result->first + $this->page_size + $subset : $this->result->first; 139 $length = $subset != 0 ? abs($subset) : $this->page_size; 140 141 $_query = "SELECT * FROM " . $this->db_name; 142 $_query.= " WHERE del<>1"; 143 $_qiery.= " AND user_id=?"; 144 $_query.= ($this->filter ? " AND (".$this->filter.")" : ""); 145 $_query.= " ORDER BY name"; 146 147 $sql_result = $this->db->limitquery( 148 $_query, 149 $start_row, 150 $length, 151 $this->user_id 152 ); 153 } 154 155 while ($sql_result && ($sql_arr = $this->db->fetch_assoc($sql_result))) { 156 $sql_arr['ID'] = $sql_arr[$this->primary_key]; 157 // make sure we have a name to display 158 if (empty($sql_arr['name'])) { 159 $sql_arr['name'] = $sql_arr['email']; 160 } 161 $this->result->add($sql_arr); 162 } 163 return $this->result; 164 } 165 166 167 /** 168 * Search contacts 169 * 170 * @param array List of fields to search in 171 * @param string Search value 172 * @param boolean True if results are requested, False if count only 173 * @return Indexed list of contact records and 'count' value 174 */ 175 function search($fields, $value, $select=true) 176 { 177 if (!is_array($fields)) { 178 $fields = array($fields); 179 } 180 $add_where = array(); 181 foreach ($fields as $col) { 182 if ($col == 'ID' || $col == $this->primary_key) { 183 $ids = !is_array($value) ? split(',', $value) : $value; 184 $add_where[] = $this->primary_key." IN (".join(',', $ids).")"; 185 } 186 else { 187 $_where = $this->db->quoteIdentifier($col); 188 $_where.= " LIKE " . $this->db->quote(strlen($value)>2 ? "%$value%" : "$value%"); 189 $add_where[] = $_where; 190 } 191 } 192 193 if (!empty($add_where)) { 194 $this->set_search_set(join(' OR ', $add_where)); 195 if ($select) { 196 $this->list_records(); 197 } 198 else { 199 $this->result = $this->count(); 200 } 201 } 202 return $this->result; 203 } 204 205 206 /** 207 * Count number of available contacts in database 208 * 209 * @return Result array with values for 'count' and 'first' 210 */ 211 function count() 212 { 213 $_query = "SELECT COUNT(contact_id) AS rows"; 214 $_query.= " FROM " . $this->db_name; 215 $_query.= " WHERE del<>1"; 216 $_query.= " AND user_id=?"; 217 $_query.= ($this->filter ? " AND (".$this->filter.")" : ""); 218 219 // count contacts for this user 220 $sql_result = $this->db->query($_query, $this->user_id); 221 $sql_arr = $this->db->fetch_assoc($sql_result); 222 return new rcube_result_set( 223 $sql_arr['rows'], 224 ($this->list_page-1) * $this->page_size 225 ); 226 } 227 228 229 /** 230 * Return the last result set 231 * 232 * @return Result array or NULL if nothing selected yet 233 */ 234 function get_result($as_res=true) 235 { 236 return $this->result; 237 } 238 239 240 /** 241 * Get a specific contact record 242 * 243 * @param mixed record identifier(s) 244 * @return Result object with all record fields or False if not found 245 */ 246 function get_record($id, $assoc=false) 247 { 248 // return cached result 249 if ( 250 $this->result 251 && ($first = $this->result->first()) 252 && $first[$this->primary_key] == $id 253 ) { 254 return $assoc ? $first : $this->result; 255 } 256 257 $_query = "SELECT * FROM ".$this->db_name; 258 $_query.= " WHERE contact_id=?"; 259 $_query.= " AND user_id=?"; 260 $_query.= " AND del<>1"; 261 262 $this->db->query($_query, $id, $this->user_id); 263 264 if ($sql_arr = $this->db->fetch_assoc()) { 265 $sql_arr['ID'] = $sql_arr[$this->primary_key]; 266 $this->result = new rcube_result_set(1); 267 $this->result->add($sql_arr); 268 } 269 return $assoc && $sql_arr ? $sql_arr : $this->result; 270 } 265 271 266 272 … … 302 308 303 309 return $insert_id; 304 } 305 306 307 /** 308 * Insert new contacts for each row in set 309 */ 310 function insert_recset($result, $check=false) 311 { 312 $ids = array(); 313 while ($row = $result->next()) 314 { 315 if ($insert = $this->insert($row, $check)) 316 $ids[] = $insert; 317 } 318 return $ids; 319 } 320 321 322 /** 323 * Update a specific contact record 324 * 325 * @param mixed Record identifier 326 * @param array Assoziative array with save data 327 * @return True on success, False on error 328 */ 329 function update($id, $save_cols) 330 { 331 $updated = false; 332 $write_sql = array(); 333 foreach ($this->table_cols as $col) 334 if (isset($save_cols[$col])) 335 $write_sql[] = sprintf("%s=%s", $this->db->quoteIdentifier($col), $this->db->quote($save_cols[$col])); 336 337 if (!empty($write_sql)) 338 { 339 $this->db->query( 340 "UPDATE ".$this->db_name." 341 SET changed=".$this->db->now().", ".join(', ', $write_sql)." 342 WHERE contact_id=? 343 AND user_id=? 344 AND del<>1", 345 $id, 346 $this->user_id); 347 348 $updated = $this->db->affected_rows(); 349 } 350 351 return $updated; 352 } 353 354 355 /** 356 * Mark one or more contact records as deleted 357 * 358 * @param array Record identifiers 359 */ 360 function delete($ids) 361 { 362 if (is_array($ids)) 363 $ids = join(',', $ids); 364 365 $this->db->query( 366 "UPDATE ".$this->db_name." 367 SET del=1 368 WHERE user_id=? 369 AND contact_id IN (".$ids.")", 370 $this->user_id); 371 372 return $this->db->affected_rows(); 373 } 374 310 } 311 312 313 /** 314 * Insert new contacts for each row in set 315 */ 316 function insert_recset($result, $check=false) 317 { 318 $ids = array(); 319 while ($row = $result->next()) { 320 if ($insert = $this->insert($row, $check)) { 321 $ids[] = $insert; 322 } 323 } 324 return $ids; 325 } 326 327 328 /** 329 * Update a specific contact record 330 * 331 * @param mixed Record identifier 332 * @param array Assoziative array with save data 333 * @return True on success, False on error 334 */ 335 function update($id, $save_cols) 336 { 337 $updated = false; 338 $write_sql = array(); 339 foreach ($this->table_cols as $col) { 340 if (isset($save_cols[$col])) { 341 $write_sql[] = sprintf("%s=%s", $this->db->quoteIdentifier($col), $this->db->quote($save_cols[$col])); 342 } 343 } 344 if (!empty($write_sql)) { 345 $_query= "UPDATE " . $this->db_name; 346 $_query.= " SET changed=" . $this->db->now() . ","; 347 $_query.= " " . join(', ', $write_sql); 348 $_query.= " WHERE contact_id=?"; 349 $_query.= " AND user_id=?"; 350 $_query.= " AND del<>1"; 351 $this->db->query($_query, $id, $this->user_id); 352 353 $updated = $this->db->affected_rows(); 354 } 355 return $updated; 356 } 357 358 359 /** 360 * Mark one or more contact records as deleted 361 * 362 * @param array Record identifiers 363 */ 364 function delete($ids) 365 { 366 if (is_array($ids)) { 367 $ids = join(',', $ids); 368 } 369 $_query = 370 $this->db->query($_query, $this->user_id); 371 372 return $this->db->affected_rows(); 373 } 375 374 } 376 377 378 /**379 * RoundCube result set class.380 * Representing an address directory result set.381 */382 class rcube_result_set383 {384 var $count = 0;385 var $first = 0;386 var $current = 0;387 var $records = array();388 389 function __construct($c=0, $f=0)390 {391 $this->count = (int)$c;392 $this->first = (int)$f;393 }394 395 function rcube_result_set($c=0, $f=0)396 {397 $this->__construct($c, $f);398 }399 400 function add($rec)401 {402 $this->records[] = $rec;403 }404 405 function iterate()406 {407 return $this->records[$this->current++];408 }409 410 function first()411 {412 $this->current = 0;413 return $this->records[$this->current++];414 }415 416 // alias417 function next()418 {419 return $this->iterate();420 }421 422 function seek($i)423 {424 $this->current = $i;425 }426 427 }428 429 430 375 ?> -
branches/devel-vnext/program/steps/mail/addcontact.inc
r589 r626 20 20 */ 21 21 22 require_once('include/rcube_contacts.inc'); 22 require_once 'include/rcube_contacts.inc'; 23 24 $registry = rc_registry::getInstance(); 25 $IMAP = $registry->get('IMAP', 'core'); 26 $DB = $registry->get('DB', 'core'); 27 $OUTPUT = $registry->get('OUTPUT', 'core'); 23 28 24 29 $done = false; 25 30 26 if (!empty($_POST['_address'])) 27 { 28 $CONTACTS = new rcube_contacts($DB, $_SESSION['user_id']);29 $contact_arr = $IMAP->decode_address_list(get_input_value('_address', RCUBE_INPUT_POST, true), 1, false);30 31 if (!empty($contact_arr[1]['mailto']))32 {33 $contact = array(34 'email' => $contact_arr[1]['mailto'],35 'name' => $contact_arr[1]['name']31 if (!empty($_POST['_address'])) { 32 $CONTACTS = new rcube_contacts($DB, $_SESSION['user_id']); 33 $contact_arr = $IMAP->decode_address_list( 34 rc_main::get_input_value( 35 '_address', 36 RCUBE_INPUT_POST, 37 true 38 ), 39 1, 40 false 36 41 ); 37 38 // use email address part for name39 if (empty($contact['name']) || $contact['name'] == $contact['email'])40 $contact['name'] = ucfirst(preg_replace('/[\.\-]/', ' ', substr($contact['email'], 0, strpos($contact['email'], '@'))));41 42 42 // check for existing contacts 43 $existing = $CONTACTS->search('email', $contact['email'], false); 44 if ($done = $existing->count) 45 $OUTPUT->show_message('contactexists', 'warning'); 46 else if ($done = $CONTACTS->insert($contact)) 47 $OUTPUT->show_message('addedsuccessfully', 'confirmation'); 48 } 43 if (!empty($contact_arr[1]['mailto'])) { 44 $contact = array( 45 'email' => $contact_arr[1]['mailto'], 46 'name' => $contact_arr[1]['name'] 47 ); 48 49 // use email address part for name 50 if (empty($contact['name']) || $contact['name'] == $contact['email']) { 51 $contact['name'] = ucfirst( 52 preg_replace( 53 '/[\.\-]/', 54 ' ', 55 substr( 56 $contact['email'], 57 0, 58 strpos($contact['email'], '@') 59 ) 60 ) 61 ); 62 } 63 64 // check for existing contacts 65 $existing = $CONTACTS->search('email', $contact['email'], false); 66 if ($done = $existing->count) { 67 $OUTPUT->show_message('contactexists', 'warning'); 68 } 69 else if ($done = $CONTACTS->insert($contact)) { 70 $OUTPUT->show_message('addedsuccessfully', 'confirmation'); 71 } 72 } 49 73 } 50 74 51 if (!$done) 52 $OUTPUT->show_message('errorsavingcontact', 'warning');53 75 if (!$done) { 76 $OUTPUT->show_message('errorsavingcontact', 'warning'); 77 } 54 78 $OUTPUT->send(); 55 79 ?> -
branches/devel-vnext/program/steps/mail/compose.inc
r623 r626 28 28 define('RCUBE_COMPOSE_DRAFT', 0x0108); 29 29 30 $registry = rc_registry::getInstance(); 31 $CONFIG = $registry->get('CONFIG', 'core'); 30 32 31 33 // remove an attachment … … 46 48 // this version does not support HTML mails 47 49 $CONFIG['htmleditor'] = false; 50 $CONFIG = $registry->set('CONFIG', $CONFIG, 'core'); 51 48 52 49 53 $MESSAGE_FORM = $registry->set('MESSAGE_FORM', NULL, 'core'); … … 97 101 if (empty($msg_uid) === false) { 98 102 99 rc_main::tfk_debug('We got uid: ' . $msg_uid);100 rc_main::tfk_debug('Compose mode: ' . $compose_mode);103 //rc_main::tfk_debug('We got uid: ' . $msg_uid); 104 //rc_main::tfk_debug('Compose mode: ' . $compose_mode); 101 105 102 106 // similar as in program/steps/mail/show.inc … … 108 112 109 113 110 rc_main::tfk_debug('Reference message: ' . var_export($MESSAGE, true));114 //rc_main::tfk_debug('Reference message: ' . var_export($MESSAGE, true)); 111 115 112 116 if ($compose_mode == RCUBE_COMPOSE_REPLY) { … … 133 137 require_once 'include/rcube/rcmail_compose.php'; 134 138 135 rc_main::tfk_debug('Passed require for rcmail_compose functions.');139 //rc_main::tfk_debug('Passed require for rcmail_compose functions.'); 136 140 137 141 // register UI objects -
branches/devel-vnext/program/steps/mail/func.inc
r625 r626 1540 1540 { 1541 1541 $in = preg_replace('/=([^("|\'|\s)]+)(\s|$)/', '="\1"', $in); 1542 $attrib = parse_attrib_string($in);1542 $attrib = rc_main::parse_attrib_string($in); 1543 1543 1544 1544 if (stristr((string)$attrib['href'], 'mailto:')) { -
branches/devel-vnext/program/steps/mail/sendmail.inc
r624 r626 266 266 if (is_array($_SESSION['compose']['attachments'])) { 267 267 foreach ($_SESSION['compose']['attachments'] as $attachment) { 268 if (empty($attachment['path'])) { 269 continue; 270 } 268 271 $status = $MAIL_MIME->addAttachment( 269 272 $attachment['path'], … … 276 279 ); 277 280 if (PEAR::isError($status)) { 278 array_push($error_msg, $status->getMessage()); 281 array_push( 282 $error_msg, 283 $status->getMessage() . "\n" . var_export($attachment, true) 284 ); 279 285 } 280 286 } … … 293 299 ); 294 300 if (PEAR::isError($status)) { 295 array_push($error_msg, $status->getMessage()); 301 array_push( 302 $error_msg, 303 $status->getMessage() . "\n" . var_export($files, true) 304 ); 296 305 } 297 306 }
Note: See TracChangeset
for help on using the changeset viewer.
