Changeset 235 for branches/fuze/components/users/messages.php
- Timestamp:
- 07/23/10 10:18:02 (22 months ago)
- File:
-
- 1 edited
-
branches/fuze/components/users/messages.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/fuze/components/users/messages.php
r181 r235 8 8 // // 9 9 /*********************************************************************************************/ 10 function pageSelect($records, $current, $perpage){ 11 $html = ''; 12 global $_LANG; 13 if ($records){ 14 $pages = ceil($records / $perpage); 15 16 if($pages>1){ 17 $html .= '<td width="60"><strong>'.$_LANG['PAGE'].': </strong></span></td>'; 18 $html .= '<td width="60" align="center"><form style="margin:0px;padding:0px" action="" name="pageform" method="POST">'; 19 $html .= '<select style="width:60px" name="cpage" onchange="document.pageform.submit()">'; 20 for ($p=1; $p<=$pages; $p++){ 21 if ($p != $current) { 22 $html .= '<option value="'.$p.'">'.$p.'</option>'; 23 } else { 24 $html .= '<option value="'.$p.'" selected>'.$p.'</option>'; 25 } 26 } 27 $html .= '</select></form></td>'; 28 $html .= '<td width="30"> èç <strong>'.$pages.'</strong><td>'; 29 } 30 } 31 return $html; 32 } 33 10 $inPage->backButton(false); 34 11 $opt = $inCore->request('opt', 'str', 'in'); 35 12 $with_id = $inCore->request('with_id', 'int', 0); … … 37 14 if (usrCheckAuth()){ 38 15 global $_LANG; 39 echo '<div class="con_heading" style="margin-bottom:25px">'.$_LANG['MY_MESS'].'</div>';40 16 //current page 41 17 $perpage = 15; 42 if (isset($_POST['cpage'])) { $page = $_REQUEST['cpage']; } else { $page = 1; }18 $page = $inCore->request('cpage', 'int', 1); 43 19 44 20 if ($opt=='in'){ … … 85 61 } 86 62 87 $result = $inDB->query($sql) or die(mysql_error().'<br/><br/>'.$sql);63 $result = $inDB->query($sql); 88 64 89 echo '<div style="margin-bottom:10px">';90 65 if ($opt=='in'){ 91 66 $inPage->addPathway($_LANG['INBOX']); 92 echo '<span class="usr_msgmenu_active in_span">'.$_LANG['INBOX'].'</span> ';93 echo '<a class="usr_msgmenu_link out_link" href="/users/'.$id.'/messages-sent.html">'.$_LANG['SENT'].'</a>';94 echo '<a class="usr_msgmenu_link new_link" href="/users/'.$id.'/messages-new.html">'.$_LANG['WRITE'].'</a>';95 67 } elseif ($opt=='out') { 96 68 $inPage->addPathway($_LANG['SENT']); 97 echo '<a class="usr_msgmenu_link in_link" href="/users/'.$id.'/messages.html">'.$_LANG['INBOX'].'</a> ';98 echo '<span class="usr_msgmenu_active out_span">'.$_LANG['SENT'].'</span>';99 echo '<a class="usr_msgmenu_link new_link" href="/users/'.$id.'/messages-new.html">'.$_LANG['WRITE'].'</a>';100 69 } elseif ($opt=='new') { 101 70 $inPage->addPathway($_LANG['NEW_MESS']); 102 echo '<a class="usr_msgmenu_link in_link" href="/users/'.$id.'/messages.html">'.$_LANG['INBOX'].'</a> ';103 echo '<a class="usr_msgmenu_link out_link" href="/users/'.$id.'/messages-sent.html">'.$_LANG['SENT'].'</a>';104 echo '<span class="usr_msgmenu_active new_span">'.$_LANG['WRITE'].'</span>';105 71 } elseif ($opt=='history') { 106 72 $inPage->addPathway($_LANG['MESSEN_WITH'].' '.$with_name, $_SERVER['REQUEST_URI']); 107 echo '<a class="usr_msgmenu_link in_link" href="/users/'.$id.'/messages.html">'.$_LANG['INBOX'].'</a> ';108 echo '<a class="usr_msgmenu_link out_link" href="/users/'.$id.'/messages-sent.html">'.$_LANG['SENT'].'</a>';109 echo '<a class="usr_msgmenu_link new_link" href="/users/'.$id.'/messages-new.html">'.$_LANG['WRITE'].'</a>';110 echo '<span class="usr_msgmenu_active history_span">'.$_LANG['MESSEN'].' → '.$with_name.'</span>';111 73 } 112 echo '</div>';113 74 114 75 if ($opt=='in' || $opt=='out' || $opt=='history'){ 115 116 echo '<table class="usr_msgmenu_bar" width="100%" height="30" border="0" cellpadding="5" cellspacing="0"><tr>'; 117 118 echo '<td><strong>'.$_LANG['MESS_INBOX'].':</strong> '.$msg_count.'</td>'; 76 77 if ($msg_count > $perpage){ 78 if ($opt=='in'){ 79 $pagebar = cmsPage::getPagebar($msg_count, $page, $perpage, '/users/%user_id%/messages%page%.html', array('user_id'=>$id)); 80 } elseif ($opt=='out') { 81 $pagebar = cmsPage::getPagebar($msg_count, $page, $perpage, '/users/%user_id%/messages-sent%page%.html', array('user_id'=>$id)); 82 } elseif ($opt=='history') { 83 $pagebar = cmsPage::getPagebar($msg_count, $page, $perpage, '/users/%user_id%/messages-history%to_id%-%page%.html', array('user_id'=>$id, 'to_id'=>$with_id)); 84 } 85 } 119 86 120 if ($opt=='out'){ 121 echo '<td align="center"><span style="color:gray">'.$_LANG['SENT_TEXT'].'</span></td>'; 122 } 123 124 if ($msg_count > $perpage){ 125 echo pageSelect($msg_count, $page, $perpage); 126 } 127 128 if ($opt=='in' && $msg_count>0){ 129 echo '<td width="100" align="right"><a href="/users/'.$id.'/delmessages.html">'.$_LANG['CLEAN_CAT'].'</a></td>'; 130 } 131 132 echo '</tr></table>'; 133 87 $is_mes = false; 134 88 if ($inDB->num_rows($result)){ 135 echo '<div>'; 89 $is_mes = true; 90 $records = array(); 136 91 while($record = $inDB->fetch_assoc($result)){ 137 92 138 93 if($record['sender_id']>0){ 139 $ authorlink= '<a href="'.cmsUser::getProfileURL($record['author_login']).'">'.$record['author'].'</a>';94 $record['authorlink'] = '<a href="'.cmsUser::getProfileURL($record['author_login']).'">'.$record['author'].'</a>'; 140 95 } else { 141 96 if ($record['sender_id']==USER_UPDATER){ 142 $ authorlink= $_LANG['SERVICE_UPDATE'];97 $record['authorlink'] = $_LANG['SERVICE_UPDATE']; 143 98 } 144 99 if ($record['sender_id']==USER_MASSMAIL){ 145 $ authorlink= $_LANG['SERVICE_MAILING'];100 $record['authorlink'] = $_LANG['SERVICE_MAILING']; 146 101 } 147 102 } 148 149 echo '<table style="width:100%" cellspacing="0">'; 150 echo '<tr>'; 151 echo '<td class="usr_msg_title" width=""><strong>'.$authorlink.'</strong>, '.$record['fpubdate'].'</td>'; 152 if ($record['is_new']){ 153 if ($opt=='in'){ 154 //erase new mark 155 $inDB->query("UPDATE cms_user_msg SET is_new = 0 WHERE id = ".$record['id']); 156 echo '<td class="usr_msg_title" width="14" align="right"><img src="/components/users/images/warning.gif" /></td>'; 157 echo '<td class="usr_msg_title" width="20" align="right"><span style="color: red">'.$_LANG['NEW'].'!</span></td>'; 158 } else { 159 echo '<td class="usr_msg_title" width="90" align="right"><a class="msg_delete" href="/users/delmsg'.$record['id'].'.html">'.$_LANG['CANCEL_MESS'].'</a></td>'; 160 } 161 } else { 162 echo '<td class="usr_msg_title" width="14" align="right"> </td>'; 163 echo '<td class="usr_msg_title" width="20" align="right"> </td>'; 164 } 103 104 $record['fpubdate'] = $inCore->dateFormat($record['fpubdate'], true, true, true); 105 if ($record['is_new']){ 165 106 if ($opt=='in'){ 166 if ($record['sender_id']>0){ 167 echo '<td class="usr_msg_title" width="80" align="right"><a class="msg_reply" href="/users/'.$record['from_id'].'/reply'.$record['id'].'.html">'.$_LANG['REPLY'].'</a></td>'; 168 echo '<td class="usr_msg_title" width="80" align="right"><a class="msg_history" href="/users/'.$id.'/messages-history'.$record['from_id'].'.html">'.$_LANG['HISTORY'].'</a></td>'; 169 } 170 } 171 if ($opt=='in' || $record['to_id']==$inUser->id){ 172 echo '<td class="usr_msg_title" width="70" align="right"><a class="msg_delete" href="/users/delmsg'.$record['id'].'.html">'.$_LANG['DELETE'].'</a></td>'; 173 } 174 echo '</tr>'; 175 echo '</table>'; 176 echo '<table style="width:100%; margin-bottom:8px; padding-bottom:10px;background-color:#FFFFFF; border-bottom:dashed 1px #666;" cellspacing="4">'; 177 178 $text = $record['message'];// nl2br(); 179 $text = $inCore->parseSmiles($text, true); 180 $text = str_replace('>', '>', $text); 181 $text = str_replace('<', '<', $text); 182 $text = str_replace('&', '&', $text); 183 $text = strip_tags($text, '<img><br><a><b><u><i><table><tr><td><th><h1><h2><h3><div><span><pre>'); 107 //erase new mark 108 $inDB->query("UPDATE cms_user_msg SET is_new = 0 WHERE id = ".$record['id']); 109 } 110 } 111 $record['message'] = $inCore->parseSmiles($record['message'], true); 112 $record['message'] = str_replace('>', '>', $record['message']); 113 $record['message'] = str_replace('<', '<', $record['message']); 114 $record['message'] = str_replace('&', '&', $record['message']); 115 $record['message'] = strip_tags($record['message'], '<img><br><a><b><u><i><table><tr><td><th><h1><h2><h3><div><span><pre>'); 184 116 185 117 if ($record['sender_id']>0){ 186 $ user_img= '<a href="'.cmsUser::getProfileURL($record['author_login']).'">'.usrImageNOdb($record['sender_id'], 'small', $record['imageurl'], $record['is_deleted'], $record['author_login']).'</a>';118 $record['user_img'] = '<a href="'.cmsUser::getProfileURL($record['author_login']).'">'.usrImageNOdb($record['sender_id'], 'small', $record['imageurl'], $record['is_deleted'], $record['author_login']).'</a>'; 187 119 } else { 188 $ user_img= usrImageNOdb($record['sender_id'], 'small', $record['imageurl'], $record['is_deleted'], $record['author_login']);120 $record['user_img'] = usrImageNOdb($record['sender_id'], 'small', $record['imageurl'], $record['is_deleted'], $record['author_login']); 189 121 } 190 191 echo '<tr>'; 192 echo '<td width="70" height="70" valign="middle" align="center" style="border:solid 1px silver">'.$user_img.'</td>'; 193 echo '<td width="" valign="top"><div style="padding:6px">'.$text.'</div></td>'; 194 echo '</tr>'; 195 echo '</table>'; 122 $records[] = $record; 196 123 } 197 echo '</div>'; 198 } else { echo '<p>'.$_LANG['NOT_MESS_IN_CAT'].'</p>'; } 124 } 199 125 200 126 } … … 202 128 if ($opt=='new'){ 203 129 $inPage->addHeadJS('components/users/js/newmessage.js'); 204 205 echo '<form action="" id="newmessage" method="POST" name="msgform">'; 206 echo '<table class="usr_msgmenu_bar" width="100%" height="30" border="0" cellpadding="5" cellspacing="0"><tr>'; 207 echo '<tr>'; 208 echo '<td width="40"><strong>'.$_LANG['SEND_TO'].':</strong> </td>'; 209 echo '<td width="160"><select name="id" id="to_id" style="width:150px">'.cmsUser::getFriendsList($inUser->id).'</select></td>'; 210 if ($inUser->is_admin){ 211 echo '<td width="10"><input name="massmail" type="checkbox" value="1" /></td>'; 212 echo '<td width="">'.$_LANG['SEND_TO_ALL'].'</td>'; 213 } else { 214 echo '<td> </td>'; 215 } 216 echo '</tr>'; 217 echo '</table>'; 218 219 echo '<div>'; 220 echo '<input type="hidden" name="gosend" value="1"/>'; 221 echo '<div class="usr_msg_bbcodebox">'; 222 echo cmsPage::getBBCodeToolbar('message'); 223 echo '</div>'; 224 echo cmsPage::getSmilesPanel('message'); 225 echo '<textarea style="font-size:18px;border:solid 1px gray;width:100%;height:200px;" name="message" id="message"></textarea>'; 226 echo '<div style="margin-top:6px;"><input type="button" id="gosend" value="'.$_LANG['SEND'].'" onclick="sendMessage()" style="font-size:18px"/></div>'; 227 echo '</div>'; 228 echo '</form>'; 130 $user_opt = cmsUser::getFriendsList($inUser->id); 131 $bb_toolbar = cmsPage::getBBCodeToolbar('message'); 132 $bb_smiles = cmsPage::getSmilesPanel('message'); 229 133 } 134 $smarty = $inCore->initSmarty('components', 'com_users_messages.tpl'); 135 $smarty->assign('opt', $opt); 136 $smarty->assign('is_mes', $is_mes); 137 $smarty->assign('id', $id); 138 $smarty->assign('with_name', $with_name); 139 $smarty->assign('msg_count', $msg_count); 140 $smarty->assign('pagebar', $pagebar); 141 $smarty->assign('perpage', $perpage); 142 $smarty->assign('user_opt', $user_opt); 143 $smarty->assign('is_admin', $inUser->is_admin); 144 $smarty->assign('bb_toolbar', $bb_toolbar); 145 $smarty->assign('bb_smiles', $bb_smiles); 146 $smarty->assign('usr_id', $inUser->id); 147 $smarty->assign('records', $records); 148 $smarty->display('com_users_messages.tpl'); 230 149 } 231 150
Note: See TracChangeset
for help on using the changeset viewer.
