home *** CD-ROM | disk | FTP | other *** search
/ Chip 2004 April / CMCD0404.ISO / Software / Freeware / Programare / dotproject / modules / forums / viewer.php < prev   
Encoding:
PHP Script  |  2003-05-08  |  2.9 KB  |  80 lines

  1. <?php /* $Id: viewer.php,v 1.20 2003/05/08 06:44:49 eddieajau Exp $ */
  2. //view posts
  3. $forum_id = isset($_GET["forum_id"]) ? $_GET["forum_id"] : 0;
  4. $message_id = isset($_GET["message_id"]) ? $_GET["message_id"] : 0;
  5. $post_message = isset($_GET["post_message"]) ? $_GET["post_message"] : 0;
  6. $f = dpGetParam( $_POST, 'f', 0 );
  7.  
  8. // check permissions
  9. $canRead = !getDenyRead( $m, $forum_id );
  10. $canEdit = !getDenyEdit( $m, $forum_id );
  11.  
  12. if (!$canRead || ($post_message & !$canEdit)) {
  13.     $AppUI->redirect( "m=public&a=access_denied" );
  14. }
  15.  
  16. $df = $AppUI->getPref('SHDATEFORMAT');
  17. $tf = $AppUI->getPref('TIMEFORMAT');
  18.  
  19. $sql = "
  20. SELECT forum_id, forum_project,    forum_description, forum_owner, forum_name,
  21.     forum_create_date, forum_last_date, forum_message_count, forum_moderated,
  22.     user_first_name, user_last_name,
  23.     project_name, project_color_identifier
  24. FROM forums, users, projects 
  25. WHERE user_id = forum_owner 
  26.     AND forum_id = $forum_id 
  27.     AND forum_project = project_id
  28. ";
  29. db_loadHash( $sql, $forum );
  30. $forum_name = $forum["forum_name"];
  31. echo db_error();
  32.  
  33. $start_date = intval( $forum["forum_create_date"] ) ? new CDate( $forum["forum_create_date"] ) : null;
  34.  
  35. // setup the title block
  36. $titleBlock = new CTitleBlock( 'Forum', 'support.png', $m, "$m.$a" );
  37. $titleBlock->addCell(
  38.     arraySelect( $filters, 'f', 'size="1" class="text" onchange="document.filterFrm.submit();"', $f , true), '',
  39.     '<form action="?m=forums&a=viewer&forum_id='.$forum_id.'" method="post" name="filterFrm">', '</form>'
  40. );
  41. $titleBlock->show();
  42. ?>
  43. <table width="100%" cellspacing="0" cellpadding="2" border="0" class="std">
  44. <tr>
  45.     <td height="20" colspan="3" style="border: outset #D1D1CD 1px;background-color:#<?php echo $forum["project_color_identifier"];?>">
  46.         <font size="2" color=<?php echo bestColor( $forum["project_color_identifier"] );?>><strong><?php echo @$forum["forum_name"];?></strong></font>
  47.     </td>
  48. </tr>
  49. <tr>
  50.     <td align="left" nowrap><?php echo $AppUI->_( 'Related Project' );?>:</td>
  51.     <td nowrap><strong><?php echo $forum["project_name"];?></strong></td>
  52.     <td valign="top" width="50%" rowspan="99">
  53.         <strong><?php echo $AppUI->_( 'Description' );?>:</strong>
  54.         <br /><?php echo @str_replace(chr(13), " <br />",$forum["forum_description"]);?>
  55.     </td>
  56. </tr>
  57. <tr>
  58.     <td align="left"><?php echo $AppUI->_( 'Owner' );?>:</td>
  59.     <td nowrap><?php
  60.         echo $forum["user_first_name"].' '.$forum["user_last_name"];
  61.         if (intval( $forum["forum_id"] ) <> 0) {
  62.             echo " (".$AppUI->_( 'moderated' ).") ";
  63.         }?>
  64.     </td>
  65. </tr>
  66. <tr>
  67.     <td align="left"><?php echo $AppUI->_( 'Created On' );?>:</td>
  68.     <td nowrap><?php echo $start_date ? $start_date->format( $df ) : '-';?></td>
  69. </tr>
  70. </table>
  71.  
  72. <?php
  73. if($post_message){
  74.     include("./modules/forums/post_message.php");
  75. } else if($message_id == 0) {
  76.     include("./modules/forums/view_topics.php");
  77. } else {
  78.     include("./modules/forums/view_messages.php");
  79. }
  80. ?>