| 1 | <?
|
|---|
| 2 |
|
|---|
| 3 | /***************************************************************************
|
|---|
| 4 | * Dolphin Smart Community Builder
|
|---|
| 5 | * -----------------
|
|---|
| 6 | * begin : Mon Mar 23 2006
|
|---|
| 7 | * copyright : (C) 2006 BoonEx Group
|
|---|
| 8 | * website : http://www.boonex.com/
|
|---|
| 9 | * This file is part of Dolphin - Smart Community Builder
|
|---|
| 10 | *
|
|---|
| 11 | * Dolphin is free software. This work is licensed under a Creative Commons Attribution 3.0 License.
|
|---|
| 12 | * http://creativecommons.org/licenses/by/3.0/
|
|---|
| 13 | *
|
|---|
| 14 | * Dolphin is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
|---|
| 15 | * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|---|
| 16 | * See the Creative Commons Attribution 3.0 License for more details.
|
|---|
| 17 | * You should have received a copy of the Creative Commons Attribution 3.0 License along with Dolphin,
|
|---|
| 18 | * see license.txt file; if not, write to marketing@boonex.com
|
|---|
| 19 | ***************************************************************************/
|
|---|
| 20 |
|
|---|
| 21 | require_once( 'inc/header.inc.php' );
|
|---|
| 22 | require_once( BX_DIRECTORY_PATH_INC . 'design.inc.php' );
|
|---|
| 23 | require_once( BX_DIRECTORY_PATH_INC . 'profiles.inc.php' );
|
|---|
| 24 | require_once( BX_DIRECTORY_PATH_INC . 'utils.inc.php' );
|
|---|
| 25 |
|
|---|
| 26 | // --------------- page variables and login
|
|---|
| 27 |
|
|---|
| 28 | $_page['name_index'] = 45;
|
|---|
| 29 | $_page['css_name'] = 'compose.css';
|
|---|
| 30 |
|
|---|
| 31 | $logged['member'] = member_auth(0);
|
|---|
| 32 |
|
|---|
| 33 | $_page['header'] = 'Messages';
|
|---|
| 34 | $_page['header_text'] = _t( "_OUTBOX_H1" );
|
|---|
| 35 |
|
|---|
| 36 | // this is dynamic page - send headers to do not cache this page
|
|---|
| 37 | send_headers_page_changed();
|
|---|
| 38 |
|
|---|
| 39 | $preview_length = 45;
|
|---|
| 40 |
|
|---|
| 41 | // --------------- page components
|
|---|
| 42 |
|
|---|
| 43 | $_ni = $_page['name_index'];
|
|---|
| 44 |
|
|---|
| 45 | if($_GET['message'] != 0)
|
|---|
| 46 | {
|
|---|
| 47 | $_page_cont[$_ni]['page_main_code'] = DesignBoxContent( '', PageCompPageMainCode(), $oTemplConfig -> PageMessagesOutboxMainCode_db_num );
|
|---|
| 48 | }
|
|---|
| 49 | else
|
|---|
| 50 | {
|
|---|
| 51 | echo '<script type="text/javascript">location.href=\'mail.php?mode=outbox\';</script>';
|
|---|
| 52 | }
|
|---|
| 53 |
|
|---|
| 54 | // --------------- [END] page components
|
|---|
| 55 |
|
|---|
| 56 | PageCode();
|
|---|
| 57 |
|
|---|
| 58 | // --------------- page components functions
|
|---|
| 59 |
|
|---|
| 60 | /**
|
|---|
| 61 | * page code function
|
|---|
| 62 | */
|
|---|
| 63 | function PageCompPageMainCode()
|
|---|
| 64 | {
|
|---|
| 65 | global $site;
|
|---|
| 66 |
|
|---|
| 67 |
|
|---|
| 68 | $messageID = ((int)$_GET['message']);
|
|---|
| 69 | $memberID = ((int)$_COOKIE['memberID']);
|
|---|
| 70 | $sender_sql = "SELECT `Recipient` FROM `Messages` WHERE `Sender` = '$memberID' AND `ID` = '$messageID'";
|
|---|
| 71 | $sender_arr = db_arr( $sender_sql );
|
|---|
| 72 |
|
|---|
| 73 | if ($sender_arr) {
|
|---|
| 74 | $senderID = $sender_arr['Recipient'];
|
|---|
| 75 |
|
|---|
| 76 | $message_sql= "SELECT m.`Text`, m.`Subject`, DATE_FORMAT( m.`Date`, '%Y-%m-%d' ) AS `Date`, p.Status FROM `Messages` AS m LEFT JOIN Profiles AS p ON m.Recipient = p.ID WHERE m.`ID` = '$messageID'";// AND`Sender` = '$senderID'";
|
|---|
| 77 |
|
|---|
| 78 | $message_arr= db_arr($message_sql);
|
|---|
| 79 |
|
|---|
| 80 | $ret = '';
|
|---|
| 81 | $ret .= '<div class="profile_ditails_block">';
|
|---|
| 82 | $ret .= ProfileDetails( $senderID );
|
|---|
| 83 | $ret .= '<div class="clear_both"></div>';
|
|---|
| 84 | $ret .= '</div>';
|
|---|
| 85 | $ret .= '<div class="m_block">';
|
|---|
| 86 | $ret .= '<div class="m_subject_date">';
|
|---|
| 87 | $ret .= '<div class="name">';
|
|---|
| 88 | $ret .= _t('_Date').':';
|
|---|
| 89 | $ret .= '</div>';
|
|---|
| 90 |
|
|---|
| 91 | $ret .= '<div class="value">';
|
|---|
| 92 | $ret .= $message_arr['Date'];
|
|---|
| 93 | $ret .= '</div>';
|
|---|
| 94 |
|
|---|
| 95 | $ret .= '<div class="name">';
|
|---|
| 96 | $ret .= _t('_Subject').':';
|
|---|
| 97 | $ret .= '</div>';
|
|---|
| 98 |
|
|---|
| 99 | $ret .= '<div class="value">';
|
|---|
| 100 | $ret .= process_smiles( process_line_output($message_arr['Subject']) );
|
|---|
| 101 | $ret .= '</div>';
|
|---|
| 102 |
|
|---|
| 103 | $ret .= '</div>';
|
|---|
| 104 |
|
|---|
| 105 | $ret .= '<div class="m_text">';
|
|---|
| 106 | $ret .= process_html_output($message_arr['Text'], 80);
|
|---|
| 107 | $ret .= '</div>';
|
|---|
| 108 | $ret .= '<div class="clear_both"></div>';
|
|---|
| 109 | $ret .= '</div>';
|
|---|
| 110 |
|
|---|
| 111 | //$ret .= '<div class="reply_block">';
|
|---|
| 112 | if( $message_arr['Status'] == 'Active' )
|
|---|
| 113 | {
|
|---|
| 114 | $ret .= '<div class="reply">';
|
|---|
| 115 | $ret .= '<a href="' . $site['url'] . 'compose.php?ID=' . $senderID . '">'._t('_Write new Message').'</a>';
|
|---|
| 116 | $ret .= '</div>';
|
|---|
| 117 | $ret .= '<div class="clear_both"></div>';
|
|---|
| 118 | }
|
|---|
| 119 | else
|
|---|
| 120 | {
|
|---|
| 121 | $ret .= '';
|
|---|
| 122 | }
|
|---|
| 123 |
|
|---|
| 124 | //####################################################
|
|---|
| 125 |
|
|---|
| 126 | $ret .= '<div style="position:relative; height:20px;"></div>';
|
|---|
| 127 | $ret .= PageCorespondence( $memberID, $senderID );
|
|---|
| 128 | $ret .= '<div class="clear_both"></div>';
|
|---|
| 129 |
|
|---|
| 130 | } else {
|
|---|
| 131 | $ret = MsgBox(_t('_Access denied'));
|
|---|
| 132 | }
|
|---|
| 133 |
|
|---|
| 134 | return $ret;
|
|---|
| 135 | }
|
|---|
| 136 |
|
|---|
| 137 | function PageCorespondence( $memberID, $senderID )
|
|---|
| 138 | {
|
|---|
| 139 | global $site;
|
|---|
| 140 | global $date_format;
|
|---|
| 141 |
|
|---|
| 142 | $preview_leight = 25;
|
|---|
| 143 |
|
|---|
| 144 | $sender_nickname = getProfileInfo( $senderID ); //db_arr("SELECT `NickName` FROM `Profiles` WHERE `ID` = '$senderID'");
|
|---|
| 145 |
|
|---|
| 146 | $member_to_sender_query = "SELECT `Profiles`.`ID` AS pID, `Profiles`.`NickName`, `Messages`.`ID` AS mID, `New`, DATE_FORMAT( `Date`, '$date_format') as Date, `Subject`, LEFT( `Text`, {$preview_leight} ) AS Preview FROM `Messages` LEFT JOIN `Profiles` ON `Messages`.`Recipient` = `Profiles`.`ID` WHERE `Sender` = '$memberID' AND `Recipient` = '$senderID' ORDER BY `Date` DESC";
|
|---|
| 147 | $member_to_sender_res = db_res($member_to_sender_query);
|
|---|
| 148 |
|
|---|
| 149 | $member_to_sender_num = mysql_num_rows($member_to_sender_res);
|
|---|
| 150 |
|
|---|
| 151 | $sender_to_member_query = "SELECT `Messages`.`ID` AS mID, `New`, DATE_FORMAT( `Date`, '$date_format') as Date, `Subject`, LEFT( `Text`, {$preview_leight} ) AS Preview FROM `Messages` LEFT JOIN `Profiles` ON Messages.Sender = Profiles.ID WHERE `Sender` = '$senderID' AND `Recipient` = '$memberID' ORDER BY `Date` DESC";
|
|---|
| 152 | $sender_to_member_res = db_res($sender_to_member_query);
|
|---|
| 153 |
|
|---|
| 154 | $sender_to_member_num = mysql_num_rows($sender_to_member_res);
|
|---|
| 155 |
|
|---|
| 156 | $ret .= '<div class="member_to_sender">';
|
|---|
| 157 | $ret .= '<table cellpadding="0" cellspacing="0" border="0" width="100%">';
|
|---|
| 158 | $ret .= '<tr>';
|
|---|
| 159 | $ret .= '<td colspan="3" class="cor_title">';
|
|---|
| 160 | $ret .= _t('_messages_to', $sender_nickname['NickName']);
|
|---|
| 161 | $ret .= '</td>';
|
|---|
| 162 | $ret .= '</tr>';
|
|---|
| 163 | $ret .= '<tr>';
|
|---|
| 164 | $ret .= '<td width="17">';
|
|---|
| 165 | $ret .= '<img src="' . getTemplateIcon('convert.gif') . '" alt="" />';
|
|---|
| 166 | $ret .= '</td>';
|
|---|
| 167 | $ret .= '<td width="70">';
|
|---|
| 168 | $ret .= _t('_Date');
|
|---|
| 169 | $ret .= '</td>';
|
|---|
| 170 | $ret .= '<td>';
|
|---|
| 171 | $ret .= _t('_Subject');
|
|---|
| 172 | $ret .= '</td>';
|
|---|
| 173 | $ret .= '</tr>';
|
|---|
| 174 |
|
|---|
| 175 | $j_out = '0';
|
|---|
| 176 | while($member_to_sender_arr = mysql_fetch_assoc($member_to_sender_res))
|
|---|
| 177 | {
|
|---|
| 178 | if(strlen( $member_to_sender_arr['Subject'] ) == 0 )
|
|---|
| 179 | {
|
|---|
| 180 |
|
|---|
| 181 | $cor_subject_out = $member_to_sender_arr['Preview'];
|
|---|
| 182 | if ( strlen( $member_to_sender_arr['Preview'] ) >= $preview_length )
|
|---|
| 183 | {
|
|---|
| 184 | $cor_subject_out .= "...";
|
|---|
| 185 | }
|
|---|
| 186 | }
|
|---|
| 187 | else
|
|---|
| 188 | {
|
|---|
| 189 | $cor_subject_out = $member_to_sender_arr['Subject'];
|
|---|
| 190 | if ( strlen( $member_to_sender_arr['Subject'] ) >= $preview_length )
|
|---|
| 191 | {
|
|---|
| 192 | $cor_subject_out .= "...";
|
|---|
| 193 | }
|
|---|
| 194 | }
|
|---|
| 195 |
|
|---|
| 196 | if( $_GET['message'] == $member_to_sender_arr['mID'] )
|
|---|
| 197 | {
|
|---|
| 198 | $new_out = 'current_mes.png';
|
|---|
| 199 | $style_add_in = '';
|
|---|
| 200 | }
|
|---|
| 201 | else
|
|---|
| 202 | {
|
|---|
| 203 | if( '1' == $member_to_sender_arr['New'] )
|
|---|
| 204 | {
|
|---|
| 205 | $new_out = 'not_readed.gif';
|
|---|
| 206 | $style_add = 'style="font-weight:bold;"';
|
|---|
| 207 | }
|
|---|
| 208 | else
|
|---|
| 209 | {
|
|---|
| 210 | $new_out = 'readed.gif';
|
|---|
| 211 | $style_add = '';
|
|---|
| 212 | }
|
|---|
| 213 | }
|
|---|
| 214 |
|
|---|
| 215 | if( ($j_out%2) != '0')
|
|---|
| 216 | {
|
|---|
| 217 | $bgcolor = '#FFFFFF';
|
|---|
| 218 | }
|
|---|
| 219 | else
|
|---|
| 220 | {
|
|---|
| 221 | $bgcolor = '#EAF6C6';
|
|---|
| 222 | }
|
|---|
| 223 |
|
|---|
| 224 |
|
|---|
| 225 | $ret .= '<tr class="tr_hover" bgcolor="' . $bgcolor . '">';
|
|---|
| 226 | $ret .= '<td height="20">';
|
|---|
| 227 | $ret .= '<img src="' . getTemplateIcon($new_out) . '" alt="" />';
|
|---|
| 228 | $ret .= '</td>';
|
|---|
| 229 | $ret .= '<td ' . $style_add . '>';
|
|---|
| 230 | $ret .= $member_to_sender_arr['Date'];
|
|---|
| 231 | $ret .= '</td>';
|
|---|
| 232 | $ret .= '<td ' . $style_add . ' align="left">';
|
|---|
| 233 | $ret .= '<a href="' . $site['url'] . 'messages_outbox.php?message=' . $member_to_sender_arr['mID']. '">';
|
|---|
| 234 | $ret .= process_line_output(html2txt( $cor_subject_out ));
|
|---|
| 235 | $ret .= '</a>';
|
|---|
| 236 | $ret .= '</td>';
|
|---|
| 237 | $ret .= '</tr>';
|
|---|
| 238 | $j_out++;
|
|---|
| 239 | }
|
|---|
| 240 | $ret .= '</table>';
|
|---|
| 241 | $ret .= '</div>';
|
|---|
| 242 |
|
|---|
| 243 | //#################################################################################
|
|---|
| 244 |
|
|---|
| 245 | $ret .= '<div class="sender_to_member">';
|
|---|
| 246 | $ret .= '<table cellpadding="0" cellspacing="0" border="0" width="100%">';
|
|---|
| 247 | $ret .= '<tr>';
|
|---|
| 248 | $ret .= '<td colspan="3" class="cor_title">';
|
|---|
| 249 | $ret .= _t('_messages_from', $sender_nickname['NickName']);
|
|---|
| 250 | $ret .= '</td>';
|
|---|
| 251 | $ret .= '</tr>';
|
|---|
| 252 | $ret .= '<tr>';
|
|---|
| 253 | $ret .= '<td width="17">';
|
|---|
| 254 | $ret .= '<img src="' . getTemplateIcon('convert.gif') . '" alt="" />';
|
|---|
| 255 | $ret .= '</td>';
|
|---|
| 256 | $ret .= '<td width="70">';
|
|---|
| 257 | $ret .= _t('_Date');
|
|---|
| 258 | $ret .= '</td>';
|
|---|
| 259 | $ret .= '<td>';
|
|---|
| 260 | $ret .= _t('_Subject');
|
|---|
| 261 | $ret .= '</td>';
|
|---|
| 262 | $ret .= '</tr>';
|
|---|
| 263 |
|
|---|
| 264 | $j_in = '0';
|
|---|
| 265 | while ($sender_to_member_arr = mysql_fetch_assoc($sender_to_member_res))
|
|---|
| 266 | {
|
|---|
| 267 | if(strlen( $sender_to_member_arr['Subject'] ) == 0 )
|
|---|
| 268 | {
|
|---|
| 269 | $cor_subject_in = $sender_to_member_arr['Preview'];
|
|---|
| 270 | if ( strlen( $sender_to_member_arr['Preview'] ) >= $preview_length )
|
|---|
| 271 | {
|
|---|
| 272 | $cor_subject_in .= "...";
|
|---|
| 273 | }
|
|---|
| 274 | }
|
|---|
| 275 | else
|
|---|
| 276 | {
|
|---|
| 277 | $cor_subject_in = $sender_to_member_arr['Subject'];
|
|---|
| 278 | if ( strlen( $sender_to_member_arr['Subject'] ) >= $preview_length )
|
|---|
| 279 | {
|
|---|
| 280 | $cor_subject_in .= "...";
|
|---|
| 281 | }
|
|---|
| 282 | }
|
|---|
| 283 |
|
|---|
| 284 | if( '1' == $sender_to_member_arr['New'] )
|
|---|
| 285 | {
|
|---|
| 286 | $new_in = 'not_readed.gif';
|
|---|
| 287 | $style_add_in = 'style="font-weight:bold;"';
|
|---|
| 288 | }
|
|---|
| 289 | else
|
|---|
| 290 | {
|
|---|
| 291 | $new_in = 'readed.gif';
|
|---|
| 292 | $style_add_in = '';
|
|---|
| 293 | }
|
|---|
| 294 |
|
|---|
| 295 |
|
|---|
| 296 | if( ($j_in%2) != '0')
|
|---|
| 297 | {
|
|---|
| 298 | $bgcolor = '#FFFFFF';
|
|---|
| 299 | }
|
|---|
| 300 | else
|
|---|
| 301 | {
|
|---|
| 302 | $bgcolor = '#EAF6C6';
|
|---|
| 303 | }
|
|---|
| 304 |
|
|---|
| 305 | $ret .= '<tr class="tr_hover" bgcolor="' . $bgcolor . '">';
|
|---|
| 306 | $ret .= '<td height="20">';
|
|---|
| 307 | $ret .= '<img src="' . getTemplateIcon($new_in) . '" alt="" />';
|
|---|
| 308 | $ret .= '</td>';
|
|---|
| 309 | $ret .= '<td ' . $style_add_in . '>';
|
|---|
| 310 | $ret .= $sender_to_member_arr['Date'];
|
|---|
| 311 | $ret .= '</td>';
|
|---|
| 312 | $ret .= '<td ' . $style_add_in . ' align="left">';
|
|---|
| 313 | $ret .= '<a href="' . $site['url'] . 'messages_inbox.php?message=' . $sender_to_member_arr['mID'] . '">';
|
|---|
| 314 | $ret .= process_line_output(html2txt( $cor_subject_in ));
|
|---|
| 315 | $ret .= '</a>';
|
|---|
| 316 | $ret .= '</td>';
|
|---|
| 317 | $j_in++;
|
|---|
| 318 | }
|
|---|
| 319 |
|
|---|
| 320 | $ret .= '</table>';
|
|---|
| 321 | $ret .= '</div>';
|
|---|
| 322 |
|
|---|
| 323 |
|
|---|
| 324 | return $ret;
|
|---|
| 325 | }
|
|---|
| 326 |
|
|---|
| 327 | ?> |
|---|