From 287feac024fbe6e19f1580ef5429614f36da0a88 Mon Sep 17 00:00:00 2001 From: "Paul S. Owen" Date: Sun, 22 Jul 2001 19:53:08 +0000 Subject: Yet another faked if loop git-svn-id: file:///svn/phpbb/trunk@727 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/privmsg.php | 66 ++++++++++++++++++++++++++++++++----------------------- 1 file changed, 39 insertions(+), 27 deletions(-) (limited to 'phpBB/privmsg.php') diff --git a/phpBB/privmsg.php b/phpBB/privmsg.php index 45e388cca2..b1ce1074e4 100644 --- a/phpBB/privmsg.php +++ b/phpBB/privmsg.php @@ -1209,50 +1209,62 @@ if(!$pm_status = $db->sql_query($sql)) message_die(GENERAL_ERROR, "Could not query private messages.", "", __LINE__, __FILE__, $sql); } $pm_total = $db->sql_numrows($pm_tot_status); +$pm_count = $db->sql_numrows($pm_status); $pm_list = $db->sql_fetchrowset($pm_status); // // Okay, let's build the correct folder // -for($i = 0; $i < count($pm_list); $i++) +if($pm_count) { - $privmsg_id = $pm_list[$i]['privmsgs_id']; + for($i = 0; $i < $pm_count; $i++) + { + $privmsg_id = $pm_list[$i]['privmsgs_id']; - $flag = $pm_list[$i]['privmsgs_type']; - $icon_flag = ($flag == PRIVMSGS_READ_MAIL || $flag == PRIVMSGS_SAVED_MAIL || $flag == PRIVMSGS_SENT_MAIL) ? "" : ""; + $flag = $pm_list[$i]['privmsgs_type']; + $icon_flag = ($flag == PRIVMSGS_READ_MAIL || $flag == PRIVMSGS_SAVED_MAIL || $flag == PRIVMSGS_SENT_MAIL) ? "" : ""; - $msg_userid = $pm_list[$i]['user_id']; - $msg_username = stripslashes($pm_list[$i]['username']); + $msg_userid = $pm_list[$i]['user_id']; + $msg_username = stripslashes($pm_list[$i]['username']); - $u_from_user_profile = append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=$msg_userid"); + $u_from_user_profile = append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=$msg_userid"); - $msg_subject = stripslashes($pm_list[$i]['privmsgs_subject']); - $u_subject = append_sid("privmsg.$phpEx?folder=$folder&mode=read&" . POST_POST_URL . "=$privmsg_id"); + $msg_subject = stripslashes($pm_list[$i]['privmsgs_subject']); + $u_subject = append_sid("privmsg.$phpEx?folder=$folder&mode=read&" . POST_POST_URL . "=$privmsg_id"); - $msg_date = create_date($board_config['default_dateformat'], $pm_list[$i]['privmsgs_date'], $board_config['default_timezone']); + $msg_date = create_date($board_config['default_dateformat'], $pm_list[$i]['privmsgs_date'], $board_config['default_timezone']); - if($flag == PRIVMSGS_NEW_MAIL && $folder == "inbox") - { - $msg_subject = "" . $msg_subject . ""; - $msg_date = "" . $msg_date . ""; - $msg_username = "" . $msg_username . ""; - } + if($flag == PRIVMSGS_NEW_MAIL && $folder == "inbox") + { + $msg_subject = "" . $msg_subject . ""; + $msg_date = "" . $msg_date . ""; + $msg_username = "" . $msg_username . ""; + } - $row_color = (!($i % 2)) ? "#".$theme['td_color1'] : "#".$theme['td_color2']; + $row_color = (!($i % 2)) ? "#".$theme['td_color1'] : "#".$theme['td_color2']; - $template->assign_block_vars("listrow", array( - "ICON_FLAG_IMG" => $icon_flag, - "FROM" => $msg_username, - "SUBJECT" => $msg_subject, - "DATE" => $msg_date, - "ROW_COLOR" => $row_color, + $template->assign_block_vars("listrow", array( + "ICON_FLAG_IMG" => $icon_flag, + "FROM" => $msg_username, + "SUBJECT" => $msg_subject, + "DATE" => $msg_date, + "ROW_COLOR" => $row_color, - "S_DEL_CHECKBOX" => "", + "S_DEL_CHECKBOX" => "", - "U_READ" => $u_subject, - "U_FROM_USER_PROFILE" => $u_from_user_profile) + "U_READ" => $u_subject, + "U_FROM_USER_PROFILE" => $u_from_user_profile) + ); + } // for ... +} +else +{ + $template->assign_vars(array( + "L_NO_MESSAGES" => $lang['No_messages_folder']) ); -} // for ... + + $template->assign_block_vars("nomessages", array() ); +} $template->assign_vars(array( "PAGINATION" => generate_pagination("privmsg.$phpEx?folder=$folder", $pm_total, $board_config['topics_per_page'], $start), -- cgit v1.2.1