diff -r 9bcc185dc151 -r 85f91037cd4f plugins/PrivateMessages.php --- a/plugins/PrivateMessages.php Tue Jan 29 17:29:08 2008 -0500 +++ b/plugins/PrivateMessages.php Tue Jan 29 23:15:44 2008 -0500 @@ -719,14 +719,14 @@ $r = $db->fetchrow(); $db->free_result(); $q = $db->sql_query('INSERT INTO '.table_prefix.'buddies(user_id,buddy_user_id,is_friend) VALUES('.$session->user_id.', '.$r['user_id'].', 1);'); - if(!$q) echo '

Warning:

Buddy could not be added: '.mysql_error().'

'; + if(!$q) echo '

Warning:

Buddy could not be added: '.$db->get_error().'

'; $db->free_result(); } } elseif($argv[1] == 'Remove' && preg_match('#^([0-9]+)$#', $argv[2])) { // Using WHERE user_id prevents users from deleting others' buddies $q = $db->sql_query('DELETE FROM '.table_prefix.'buddies WHERE user_id='.$session->user_id.' AND buddy_id='.$argv[2].';'); $db->free_result(); - if(!$q) echo '

Warning:

Buddy could not be deleted: '.mysql_error().'

'; + if(!$q) echo '

Warning:

Buddy could not be deleted: '.$db->get_error().'

'; if(mysql_affected_rows() < 1) echo '

Warning:

No rows were affected. Either the selected buddy ID does not exist or you tried to delete someone else\'s buddy.

'; } $template->header(); @@ -736,15 +736,15 @@
- - - - - - - - - + + + + + + + + +
Private messages
Inbox
Outbox
Sent Items
Drafts
Archive
Buddies
Friend list
Foe list
get('privmsgs_sidebar_th_privmsgs'); ?>
get('privmsgs_folder_inbox'); ?>
get('privmsgs_folder_outbox'); ?>
get('privmsgs_folder_sent'); ?>
get('privmsgs_folder_drafts'); ?>
get('privmsgs_folder_archive'); ?>
get('privmsgs_sidebar_th_buddies'); ?>
get('privmsgs_sidebar_friend_list'); ?>
get('privmsgs_sidebar_foe_list'); ?>
@@ -754,26 +754,26 @@ else { $allbuds = ''; - echo '
'; - if($db->numrows() < 1) echo ''; + echo '
Buddy list for '.$session->username.'
No buddies in your list.
'; + if($db->numrows() < 1) echo ''; $cls = 'row2'; while ( $row = $db->fetchrow() ) { if($cls=='row2') $cls = 'row1'; else $cls = 'row2'; - echo ''; + echo ''; $allbuds .= str_replace(' ', '_', $row['username']).','; } $db->free_result(); $allbuds = substr($allbuds, 0, strlen($allbuds)-1); if($cls=='row2') $cls = 'row1'; else $cls = 'row2'; - echo ''; + echo ''; echo '
' . $lang->get('privmsgs_th_buddy_list', array('username' => htmlspecialchars($session->username))) . '
' . $lang->get('privmsgs_msg_no_buddies') . '
nslist['User'].str_replace(' ', '_', $row['username'])) ? '' : 'class="wikilink-nonexistent" ' ) .'>'.$row['username'].'Send private messageRemove
nslist['User'].str_replace(' ', '_', $row['username'])) ? '' : 'class="wikilink-nonexistent" ' ) .'>'.$row['username'].'' . $lang->get('privmsgs_btn_buddy_send_pm') . '' . $lang->get('privmsgs_btn_buddy_remove') . '
Send a PM to all buddies
' . $lang->get('privmsgs_btn_pm_all_buddies') . '
'; } echo '
-

Add a new friend

'; - echo '

Username: '.$template->username_field('buddyname').'

'; +

' . $lang->get('privmsgs_heading_add_buddy') . '

'; + echo '

' . $lang->get('privmsgs_lbl_username') . ' '.$template->username_field('buddyname').'

'; echo '
'; ?> @@ -791,61 +791,60 @@ { $r = $db->fetchrow(); $q = $db->sql_query('INSERT INTO '.table_prefix.'buddies(user_id,buddy_user_id,is_friend) VALUES('.$session->user_id.', '.$r['user_id'].', 0);'); - if(!$q) echo '

Warning:

Buddy could not be added: '.mysql_error().'

'; + if(!$q) echo '

Warning:

Buddy could not be added: '.$db->get_error().'

'; } $db->free_result(); } elseif($argv[1] == 'Remove' && preg_match('#^([0-9]+)$#', $argv[2])) { // Using WHERE user_id prevents users from deleting others' buddies $q = $db->sql_query('DELETE FROM '.table_prefix.'buddies WHERE user_id='.$session->user_id.' AND buddy_id='.$argv[2].';'); $db->free_result(); - if(!$q) echo '

Warning:

Buddy could not be deleted: '.mysql_error().'

'; + if(!$q) echo '

Warning:

Buddy could not be deleted: '.$db->get_error().'

'; if(mysql_affected_rows() < 1) echo '

Warning:

No rows were affected. Either the selected buddy ID does not exist or you tried to delete someone else\'s buddy.

'; } $template->header(); userprefs_show_menu(); ?> - - - -
-
- - - - - - - - - -
Private messages
Inbox
Outbox
Sent Items
Drafts
Archive
Buddies
Friend list
Foe list
-
+ + + +
+ + sql_query('SELECT u.username,b.buddy_id FROM '.table_prefix.'buddies AS b LEFT JOIN '.table_prefix.'users AS u ON ( u.user_id=b.buddy_user_id ) WHERE b.user_id='.$session->user_id.' AND is_friend=0;'); if(!$q) $db->_die('The buddy list could not be selected.'); else { $allbuds = ''; - echo '
'; - if($db->numrows() < 1) echo ''; + echo '
Foe list for '.$session->username.'
No foes in your list.
'; + if($db->numrows() < 1) echo ''; $cls = 'row2'; while ( $row = $db->fetchrow() ) { if($cls=='row2') $cls = 'row1'; else $cls = 'row2'; - echo ''; + echo ''; $allbuds .= str_replace(' ', '_', $row['username']).','; } + $db->free_result(); $allbuds = substr($allbuds, 0, strlen($allbuds)-1); if($cls=='row2') $cls = 'row1'; else $cls = 'row2'; - //echo ''; echo '
' . $lang->get('privmsgs_th_foe_list', array('username' => htmlspecialchars($session->username))) . '
' . $lang->get('privmsgs_msg_no_foes') . '
nslist['User'].str_replace(' ', '_', $row['username'])) ? '' : 'class="wikilink-nonexistent" ' ) .'>'.$row['username'].'Send private messageRemove
nslist['User'].str_replace(' ', '_', $row['username'])) ? '' : 'class="wikilink-nonexistent" ' ) .'>'.$row['username'].'' . $lang->get('privmsgs_btn_buddy_send_pm') . '' . $lang->get('privmsgs_btn_buddy_remove') . '
Send a PM to all buddies
'; } - $db->free_result(); echo '
-

Add a new foe

'; - echo '

Username: '.$template->username_field('buddyname').'

'; +

' . $lang->get('privmsgs_heading_add_foe') . '

'; + echo '

' . $lang->get('privmsgs_lbl_username') . ' '.$template->username_field('buddyname').'

'; echo '
'; ?>