![]() |
|---|
| [ Index ] |
Source Code Reference for V1.00 |
[Summary view] [Print] [Text view]
1 <?php /* $Id: viewer.php 102 2008-03-18 19:52:59Z pedroix $ $URL: https://web2project.svn.sourceforge.net/svnroot/web2project/trunk/modules/forums/viewer.php $ */ 2 if (!defined('W2P_BASE_DIR')) { 3 die('You should not access this file directly.'); 4 } 5 6 //view posts 7 $forum_id = isset($_GET['forum_id']) ? (int)w2PgetParam($_GET, 'forum_id', 0) : 0; 8 9 $message_id = isset($_GET['message_id']) ? (int)w2PgetParam($_GET, 'message_id', 0) : 0; 10 $post_message = isset($_GET['post_message']) ? w2PgetParam($_GET, 'post_message', 0) : 0; 11 $f = w2PgetParam($_POST, 'f', 0); 12 13 // check permissions 14 $perms = &$AppUI->acl(); 15 $canAuthor = $perms->checkModule('forums', 'add'); 16 $canDelete = $perms->checkModule('forums', 'delete'); 17 $canRead = $perms->checkModuleItem('forums', 'view', $forum_id); 18 $canEdit = $perms->checkModuleItem('forums', 'edit', $forum_id); 19 $canAdminEdit = $perms->checkModule('admin', 'edit'); 20 21 if (!$canRead || ($post_message && (!$canAuthor || !$canEdit))) { 22 $AppUI->redirect('m=public&a=access_denied'); 23 } 24 25 $df = $AppUI->getPref('SHDATEFORMAT'); 26 $tf = $AppUI->getPref('TIMEFORMAT'); 27 28 $q = new DBQuery; 29 $q->addTable('forums'); 30 $q->addTable('projects', 'p'); 31 $q->addTable('users', 'u'); 32 $q->addQuery('forum_id, forum_project, forum_description, forum_owner, forum_name, 33 forum_create_date, forum_last_date, forum_message_count, forum_moderated, 34 user_username, contact_first_name, contact_last_name, 35 project_name, project_color_identifier'); 36 $q->addJoin('contacts', 'con', 'contact_id = user_contact', 'inner'); 37 $q->addWhere('user_id = forum_owner'); 38 $q->addWhere('forum_id = ' . (int)$forum_id); 39 $q->addWhere('forum_project = project_id'); 40 $q->exec(ADODB_FETCH_ASSOC); 41 $forum = $q->fetchRow(); 42 $forum_name = $forum['forum_name']; 43 echo db_error(); 44 $q->clear(); 45 46 $start_date = intval($forum['forum_create_date']) ? new CDate($forum['forum_create_date']) : null; 47 48 // setup the title block 49 $titleBlock = new CTitleBlock('Forum', 'support.png', $m, $m . '.' . $a); 50 $titleBlock->addCell(arraySelect($filters, 'f', 'size="1" class="text" onchange="document.filterFrm.submit();"', $f, true), '', '<form action="?m=forums&a=viewer&forum_id=' . $forum_id . '" method="post" name="filterFrm">', '</form>'); 51 $titleBlock->show(); 52 ?> 53 <table width="100%" cellspacing="0" cellpadding="2" border="0" class="std"> 54 <tr> 55 <td height="20" colspan="3" style="border: outset #D1D1CD 1px;background-color:#<?php echo $forum['project_color_identifier']; ?>"> 56 <font size="2" color="<?php echo bestColor($forum["project_color_identifier"]); ?>"><strong><?php echo $forum['forum_name']; ?></strong></font> 57 </td> 58 </tr> 59 <tr> 60 <td align="left" nowrap="nowrap"><?php echo $AppUI->_('Related Project'); ?>:</td> 61 <td nowrap="nowrap"><strong><?php echo $forum['project_name']; ?></strong></td> 62 <td valign="top" width="50%" rowspan="99"> 63 <strong><?php echo $AppUI->_('Description'); ?>:</strong> 64 <br /><?php echo @str_replace(chr(13), ' <br />', $forum['forum_description']); ?> 65 </td> 66 </tr> 67 <tr> 68 <td align="left"><?php echo $AppUI->_('Owner'); ?>:</td> 69 <td nowrap="nowrap"><?php 70 echo $forum['contact_first_name'] . ' ' . $forum['contact_last_name']; 71 if (intval($forum['forum_id']) <> 0) { 72 echo ' (' . $AppUI->_('moderated') . ') '; 73 } ?> 74 </td> 75 </tr> 76 <tr> 77 <td align="left"><?php echo $AppUI->_('Created On'); ?>:</td> 78 <td nowrap="nowrap"><?php echo $start_date ? $start_date->format($df) : '-'; ?></td> 79 </tr> 80 </table> 81 <?php 82 if (function_exists('styleRenderBoxBottom')) { 83 echo styleRenderBoxBottom(); 84 } 85 if ($post_message) { 86 include (W2P_BASE_DIR . '/modules/forums/post_message.php'); 87 } else 88 if ($message_id == 0) { 89 include (W2P_BASE_DIR . '/modules/forums/view_topics.php'); 90 } else { 91 include (W2P_BASE_DIR . '/modules/forums/view_messages.php'); 92 } 93 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Fri Jan 9 03:00:02 2009 | Cross-referenced by PHPXref 0.7 |