- Timestamp:
- 08/12/05 11:29:23 (7 years ago)
- Location:
- trunk/inc/messages
- Files:
-
- 3 modified
-
inbox.inc.php (modified) (2 diffs)
-
saved.inc.php (modified) (2 diffs)
-
sent.inc.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/inc/messages/inbox.inc.php
r15 r19 23 23 ******************** http://opensource.ikse.net/projects/dotnode ***/ 24 24 25 include_once(INCLUDESPATH.'/pager.inc.php'); 26 25 27 $_SMARTY['Title'] = 'Messages'; 26 28 27 /** Pagination ***************/ 28 $pagination['nb_elements'] = $db->getOne('SELECT COUNT(id) FROM message WHERE id=? AND box=?', array($_SESSION['my_id'], 'inbox') ); 29 $pagination['elmt_by_page'] = 20; 30 if($pagination['nb_elements'] > 0) 31 $pagination['nb_pages'] = ceil($pagination['nb_elements']/$pagination['elmt_by_page']); 32 else 33 $pagination['nb_pages'] = 1; 34 35 if(is_numeric($token[2]) && 36 $token[2] <= $pagination['nb_pages'] && 37 $token[2] > 0 ) 38 $pagination['current_page'] = $token[2]; 39 else 40 { 41 header('Location: /messages/inbox/1'); 42 exit(); 43 } 44 45 $pagination['pages'] = @array_fill(1,$pagination['nb_pages'], NULL); 46 47 $_SMARTY['pagination'] = $pagination; 48 /******************************/ 49 50 $messages_r = $db->query('SELECT id_mess, id_from, from_str, type, dest, subject, message, flag, date FROM message WHERE id=? AND box=? ORDER by date DESC LIMIT ?,?', array($_SESSION['my_id'],'inbox', ($pagination['current_page']-1)*$pagination['elmt_by_page'], $pagination['elmt_by_page'])); 29 $messages_r = $db->query('SELECT id_mess, id_from, from_str, type, dest, subject, message, flag, date FROM message WHERE id=? AND box=? ORDER by date DESC', array($_SESSION['my_id'],'inbox')); 51 30 52 31 if(!DB::isError($messages_r) ) … … 59 38 $_SESSION['nb_new_messages_timestamp'] = 1; 60 39 40 $pager =& Pager_dotnode::factory($messages); 61 41 62 $_SMARTY['messages'] = $messages; 42 $_SMARTY['pager'] = $pager->getLinks(); 43 44 // $pager->getPageData() return '' if no data element 45 // For smarty reason, i prefere an empty array to use foreach / foreachelse 46 if(!is_array($_SMARTY['messages'] = $pager->getPageData())) 47 $_SMARTY['messages'] = array(); 63 48 ?> -
trunk/inc/messages/saved.inc.php
r15 r19 23 23 ******************** http://opensource.ikse.net/projects/dotnode ***/ 24 24 25 include_once(INCLUDESPATH.'/pager.inc.php'); 26 25 27 $_SMARTY['Title'] = 'Messages'; 26 28 27 /** Pagination ***************/ 28 $pagination['nb_elements'] = $db->getOne('SELECT COUNT(id) FROM message WHERE id=? AND box=?', array($_SESSION['my_id'], 'save') ); 29 $pagination['elmt_by_page'] = 20; 30 31 if($pagination['nb_elements'] > 0) 32 $pagination['nb_pages'] = ceil($pagination['nb_elements']/$pagination['elmt_by_page']); 33 else 34 $pagination['nb_pages'] = 1; 35 36 if(is_numeric($token[2]) && 37 $token[2] <= $pagination['nb_pages'] && 38 $token[2] > 0 ) 39 $pagination['current_page'] = $token[2]; 40 else 41 { 42 header('Location: /messages/saved/1'); 43 exit(); 44 } 45 46 $pagination['pages'] = @array_fill(1,$pagination['nb_pages'], NULL); 47 48 $_SMARTY['pagination'] = $pagination; 49 /******************************/ 50 51 52 $messages_r = $db->query('SELECT id_mess, id_from, from_str, type, dest, subject, message, flag, date FROM message WHERE id=? AND box=? ORDER by date DESC LIMIT ?,?', array($_SESSION['my_id'],'save', ($pagination['current_page']-1)*$pagination['elmt_by_page'], $pagination['elmt_by_page']) ); 29 $messages_r = $db->query('SELECT id_mess, id_from, from_str, type, dest, subject, message, flag, date FROM message WHERE id=? AND box=? ORDER by date DESC', array($_SESSION['my_id'],'save') ); 53 30 54 31 if(!DB::isError($messages_r) ) … … 58 35 error_log($_SERVER['HTTP_HOST'].' | '.__FILE__.' | '.$messages_r->getUserInfo()); 59 36 60 $ _SMARTY['messages'] = $messages;37 $pager =& Pager_dotnode::factory($messages); 61 38 39 $_SMARTY['pager'] = $pager->getLinks(); 40 41 // $pager->getPageData() return '' if no data element 42 // For smarty reason, i prefere an empty array to use foreach / foreachelse 43 if(!is_array($_SMARTY['messages'] = $pager->getPageData())) 44 $_SMARTY['messages'] = array(); 62 45 ?> -
trunk/inc/messages/sent.inc.php
r15 r19 23 23 ******************** http://opensource.ikse.net/projects/dotnode ***/ 24 24 25 include_once(INCLUDESPATH.'/pager.inc.php'); 26 25 27 $_SMARTY['Title'] = 'Messages'; 26 28 27 /** Pagination ***************/ 28 $pagination['nb_elements'] = $db->getOne('SELECT COUNT(id_from) FROM message WHERE id_from=? AND box=?', array($_SESSION['my_id'], 'send') ); 29 $pagination['elmt_by_page'] = 20; 30 if($pagination['nb_elements'] > 0) 31 $pagination['nb_pages'] = ceil($pagination['nb_elements']/$pagination['elmt_by_page']); 32 else 33 $pagination['nb_pages'] = 1; 34 35 if(is_numeric($token[2]) && 36 $token[2] <= $pagination['nb_pages'] && 37 $token[2] > 0 ) 38 $pagination['current_page'] = $token[2]; 39 else 40 { 41 header('Location: /messages/sent/1'); 42 exit(); 43 } 44 45 $pagination['pages'] = @array_fill(1,$pagination['nb_pages'], NULL); 46 47 $_SMARTY['pagination'] = $pagination; 48 /******************************/ 49 50 $messages_r = $db->query('SELECT id, id_mess, id_from, from_str, type, dest, subject, message, flag, date FROM message WHERE id_from=? AND box=? ORDER by date DESC LIMIT ?,?', array($_SESSION['my_id'],'send', ($pagination['current_page']-1)*$pagination['elmt_by_page'], 51 $pagination['elmt_by_page'] )); 29 $messages_r = $db->query('SELECT id, id_mess, id_from, from_str, type, dest, subject, message, flag, date FROM message WHERE id_from=? AND box=? ORDER by date DESC', array($_SESSION['my_id'],'send') ); 52 30 53 31 $cache=array(); … … 72 50 error_log($_SERVER['HTTP_HOST'].' | '.__FILE__.' | '.$messages_r->getUserInfo()); 73 51 74 $ _SMARTY['messages'] = $messages;52 $pager =& Pager_dotnode::factory($messages); 75 53 54 $_SMARTY['pager'] = $pager->getLinks(); 55 56 // $pager->getPageData() return '' if no data element 57 // For smarty reason, i prefere an empty array to use foreach / foreachelse 58 if(!is_array($_SMARTY['messages'] = $pager->getPageData())) 59 $_SMARTY['messages'] = array(); 76 60 ?>
