Changeset 1408 in ExiteCMS for branches/PLi-Fusion/pm.php
- Timestamp:
- 05/15/08 22:25:54 (4 years ago)
- File:
-
- 1 edited
-
branches/PLi-Fusion/pm.php (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/PLi-Fusion/pm.php
r1227 r1408 300 300 301 301 // check if we need to make room in the outbox of the sender 302 if ($totals['outbox'] >= $global_options['pm_sentbox']) { 303 $limit = $totals['outbox'] - $global_options['pm_sentbox'] + 1; 304 $result = dbquery( 305 "SELECT * FROM ".$db_prefix."pm m, ".$db_prefix."pm_index i 306 WHERE m.pm_id = i.pm_id AND i.pmindex_user_id = '".$userdata['user_id']."' AND i.pmindex_folder = '1' 307 ORDER BY m.pm_datestamp LIMIT ".$limit 308 ); 309 while ($data = dbarray($result)) { 310 deletemessage($data['pmindex_id'], $userdata['user_id']); 302 if (!$global_options['pm_sentbox_group']) { 303 if ($totals['outbox'] >= $global_options['pm_sentbox']) { 304 $limit = $totals['outbox'] - $global_options['pm_sentbox'] + 1; 305 $result = dbquery( 306 "SELECT * FROM ".$db_prefix."pm m, ".$db_prefix."pm_index i 307 WHERE m.pm_id = i.pm_id AND i.pmindex_user_id = '".$userdata['user_id']."' AND i.pmindex_folder = '1' 308 ORDER BY m.pm_datestamp LIMIT ".$limit 309 ); 310 while ($data = dbarray($result)) { 311 deletemessage($data['pmindex_id'], $userdata['user_id']); 312 } 311 313 } 312 314 } … … 383 385 foreach($message['user_ids'] as $user) { 384 386 // check if this recipient has room in his inbox. If not, create it 385 $inbox_total = dbcount("(pmindex_id)", "pm_index", "pmindex_user_id = '".$user['user_id']."' AND pmindex_folder = '0'"); 386 if ($inbox_total >= $global_options['pm_inbox']) { 387 $limit = $inbox_total - $global_options['pm_inbox'] + 1; 388 $result = dbquery( 389 "SELECT * FROM ".$db_prefix."pm m, ".$db_prefix."pm_index i 390 WHERE m.pm_id = i.pm_id AND i.pmindex_user_id = '".$user['user_id']."' AND i.pmindex_folder = '0' 391 ORDER BY m.pm_datestamp LIMIT ".$limit 392 ); 393 while ($data = dbarray($result)) { 394 deletemessage($data['pmindex_id'], $user['user_id']); 387 if (!$global_options['pm_inbox_group']) { 388 $inbox_total = dbcount("(pmindex_id)", "pm_index", "pmindex_user_id = '".$user['user_id']."' AND pmindex_folder = '0'"); 389 if ($inbox_total >= $global_options['pm_inbox']) { 390 $limit = $inbox_total - $global_options['pm_inbox'] + 1; 391 $result = dbquery( 392 "SELECT * FROM ".$db_prefix."pm m, ".$db_prefix."pm_index i 393 WHERE m.pm_id = i.pm_id AND i.pmindex_user_id = '".$user['user_id']."' AND i.pmindex_folder = '0' 394 ORDER BY m.pm_datestamp LIMIT ".$limit 395 ); 396 while ($data = dbarray($result)) { 397 deletemessage($data['pmindex_id'], $user['user_id']); 398 } 395 399 } 396 400 } … … 455 459 $global_options['pm_sentbox'] = $settings['pm_sentbox']; 456 460 $global_options['pm_savebox'] = $settings['pm_savebox']; 461 $global_options['pm_inbox_group'] = ($settings['pm_inbox_group'] && checkgroup($settings['pm_inbox_group'])); 462 $global_options['pm_sentbox_group'] = ($settings['pm_sentbox_group'] && checkgroup($settings['pm_sentbox_group'])); 463 $global_options['pm_savebox_group'] = ($settings['pm_savebox_group'] && checkgroup($settings['pm_savebox_group'])); 457 464 $global_options['pm_send2group'] = $settings['pm_send2group']; 458 465 $global_options['pm_hide_rcpts'] = $settings['pm_hide_rcpts']; … … 609 616 // move the selected messages to the arhive folder 610 617 if ($msg_ids && $check_count > 0) { 611 if ($global_options['pm_savebox'] == "0" || ($totals['archive'] + $check_count) <= $global_options['pm_savebox'] ) {618 if ($global_options['pm_savebox'] == "0" || ($totals['archive'] + $check_count) <= $global_options['pm_savebox'] || $global_options['pm_savebox_group']) { 612 619 $result = dbquery("UPDATE ".$db_prefix."pm_index SET pmindex_folder='2' WHERE pmindex_id IN(".$msg_ids.") AND pmindex_user_id='".$userdata['user_id']."' AND pmindex_read_datestamp != '0'"); 613 620 } else { … … 628 635 if ($data['pmindex_user_id'] == $data['pmindex_to_id']) { 629 636 // restore to inbox 630 if ($global_options['pm_inbox'] == "0" || $totals['inbox'] < $global_options['pm_inbox'] ) {637 if ($global_options['pm_inbox'] == "0" || $totals['inbox'] < $global_options['pm_inbox'] || $global_options['pm_inbox_group']) { 631 638 $result = dbquery("UPDATE ".$db_prefix."pm_index SET pmindex_folder='0' WHERE pmindex_id = '".$msg_id."' AND pmindex_user_id='".$userdata['user_id']."'"); 632 639 $totals['inbox'] = dbcount("(pmindex_id)", "pm_index", "pmindex_user_id = '".$userdata['user_id']."' AND pmindex_folder = '0'"); … … 637 644 } else { 638 645 // restore to outbox 639 if ($global_options['pm_sentbox'] == "0" || $totals['outbox'] < $global_options['pm_sentbox'] ) {646 if ($global_options['pm_sentbox'] == "0" || $totals['outbox'] < $global_options['pm_sentbox'] || $global_options['pm_sentbox_group']) { 640 647 $result = dbquery("UPDATE ".$db_prefix."pm_index SET pmindex_folder='1' WHERE pmindex_id = '".$msg_id."' AND pmindex_user_id='".$userdata['user_id']."'"); 641 648 $totals['outbox'] = dbcount("(pmindex_id)", "pm_index", "pmindex_user_id = '".$userdata['user_id']."' AND pmindex_folder = '1'"); … … 699 706 } elseif ($action == "archive") { 700 707 701 if ($global_options['pm_savebox'] == "0" || $totals['archive'] < $global_options['pm_savebox'] ) {708 if ($global_options['pm_savebox'] == "0" || $totals['archive'] < $global_options['pm_savebox'] || $global_options['pm_savebox_group']) { 702 709 $result = dbquery("UPDATE ".$db_prefix."pm_index SET pmindex_folder='2' WHERE pmindex_id = '".$msg_id."' AND pmindex_user_id='".$userdata['user_id']."'"); 703 710 } else { … … 713 720 if ($data['pmindex_user_id'] == $data['pmindex_to_id']) { 714 721 // restore to inbox 715 if ($global_options['pm_inbox'] == "0" || $totals['inbox'] < $global_options['pm_inbox'] ) {722 if ($global_options['pm_inbox'] == "0" || $totals['inbox'] < $global_options['pm_inbox'] || $global_options['pm_inbox_group']) { 716 723 $result = dbquery("UPDATE ".$db_prefix."pm_index SET pmindex_folder='0' WHERE pmindex_id = '".$msg_id."' AND pmindex_user_id='".$userdata['user_id']."'"); 717 724 } else { … … 720 727 } else { 721 728 // restore to outbox 722 if ($global_options['pm_sentbox'] == "0" || $totals['outbox'] < $global_options['pm_sentbox'] ) {729 if ($global_options['pm_sentbox'] == "0" || $totals['outbox'] < $global_options['pm_sentbox'] || $global_options['pm_sentbox_group']) { 723 730 $result = dbquery("UPDATE ".$db_prefix."pm_index SET pmindex_folder='1' WHERE pmindex_id = '".$msg_id."' AND pmindex_user_id='".$userdata['user_id']."'"); 724 731 } else {
Note: See TracChangeset
for help on using the changeset viewer.
