* Copyright 1999-2001, Tim Perdue - Sourceforge
* Copyright 2002, Tim Perdue - GForge, LLC
* Copyright 2010 (c) Franck Villaume - Capgemini
+ * Copyright (C) 2010-2011 Alain Peyrat - Alcatel-Lucent
* http://fusionforge.org
*
* This file is part of FusionForge. FusionForge is free software;
require_once $gfcommon.'forum/AttachManager.class.php';
function forum_header($params) {
- global $HTML,$group_id,$forum_name,$forum_id,$f,$group_forum_id;
+ global $HTML, $group_id, $forum_name, $forum_id, $f, $group_forum_id;
if ($group_forum_id) {
- $forum_id=$group_forum_id;
+ $forum_id = $group_forum_id;
}
if (!forge_get_config('use_forum')) {
exit_disabled();
}
- $params['group']=$group_id;
- $params['toptab']='forums';
+ $params['group'] = $group_id;
+ $params['toptab'] = 'forums';
- /*
- bastardization for news
- Show icon bar unless it's a news forum
- */
- if ($group_id == forge_get_config('news_group')) {
- //this is a news item, not a regular forum
- if ($forum_id) {
- // Show this news item at the top of the page
- $result = db_query_params ('SELECT submitted_by, post_date, group_id, forum_id, summary, details FROM news_bytes WHERE forum_id=$1',
- array ($forum_id));
+ if ($forum_id) {
+ // Check if this is a news item, to display it at the top of the page
+ $result = db_query_params('SELECT submitted_by, post_date, group_id, forum_id, summary, details FROM news_bytes WHERE forum_id=$1',
+ array ($forum_id));
+
+ if (db_numrows($result) == 1) {
// checks which group the news item belongs to
- $params['group']=db_result($result,0,'group_id');
- $params['toptab']='news';
+ $params['group'] = db_result($result, 0, 'group_id');
+ $params['toptab'] = 'news';
+ $params['title'] = _('Forum: ') . db_result($result,0,'summary');
$HTML->header($params);
- echo '<h1>' . $params['title'] . '</h1>';
echo '<table><tr><td valign="top">';
- if (!$result || db_numrows($result) < 1) {
- echo '<p class="error">'._('Error - this news item was not found').'</p>';
- } else {
- $user = user_get_object(db_result($result,0,'submitted_by'));
- $group = group_get_object($params['group']);
- if (!$group || !is_object($group) || $group->isError()) {
- exit_no_group();
- }
- echo '<p>
+ $user = user_get_object(db_result($result,0,'submitted_by'));
+ $group = group_get_object($params['group']);
+ if (!$group || !is_object($group) || $group->isError()) {
+ exit_no_group();
+ }
+ echo '<p>
<strong>'._('Posted by').':</strong> '.$user->getRealName().'<br />
<strong>'._('Date').':</strong> '. date(_('Y-m-d H:i'),db_result($result,0,'post_date')).'<br />
<strong>'._('Summary').':</strong>'.
- util_make_link ('/forum/forum.php?forum_id='.db_result($result,0,'forum_id').'&group_id='.$group_id,
- db_result($result,0,'summary')).'<br/>
+ util_make_link('/forum/forum.php?forum_id='.db_result($result, 0, 'forum_id').'&group_id='.$group_id,
+ db_result($result, 0, 'summary')).'<br/>
<strong>'._('Project').':</strong>'.
- util_make_link_g ($group->getUnixName(),db_result($result,0,'group_id'),$group->getPublicName()).'<br />
+ util_make_link_g($group->getUnixName(),db_result($result, 0, 'group_id'),$group->getPublicName()).'<br />
</p>
';
- $body = db_result($result,0,'details');
- $body = TextSanitizer::purify($body);
- if (!strstr($body,'<')) {
- //backwards compatibility for non html messages
- echo util_make_links(nl2br($body));
- } else {
- echo util_make_links($body);
- }
+ $body = db_result($result,0,'details');
+ $body = TextSanitizer::purify($body);
+ if (!strstr($body,'<')) {
+ //backwards compatibility for non html messages
+ echo util_make_links(nl2br($body));
+ } else {
+ echo util_make_links($body);
+ }
- // display classification
- if ($params['group'] == forge_get_config('news_group')) {
- print stripslashes(trove_news_getcatlisting(db_result($result,0,'forum_id'),0,1));
- } elseif (forge_get_config('use_trove')) {
- print stripslashes(trove_getcatlisting($params['group'],0,1));
- }
+ // display classification
+ if ($params['group'] == forge_get_config('news_group')) {
+ print stripslashes(trove_news_getcatlisting(db_result($result,0,'forum_id'),0,1));
+ } elseif (forge_get_config('use_trove')) {
+ print stripslashes(trove_getcatlisting($params['group'],0,1));
}
echo '</td><td valign="top" width="35%">';
echo $HTML->boxTop(_('Latest News'));
echo $HTML->boxBottom();
echo '</td></tr></table>';
} else {
- site_project_header($params);
- echo '<h1>' . $params['title'] . '</h1>';
+ $HTML->header($params);
}
} else {
- site_project_header($params);
- echo '<h1>' . $params['title'] . '</h1>';
- }
+ $menu_text = array();
+ $menu_links = array();
- $menu_text=array();
- $menu_links=array();
+ $menu_text[] = _('View Forums');
+ $menu_links[] = '/forum/?group_id='.$group_id;
- if ($f){
- if ($forum_id) {
- $menu_text[]=_('Discussion Forums:') .' '. $f->getName();
- $menu_links[]='/forum/forum.php?forum_id='.$forum_id;
- }
- if (forge_check_perm ('forum_admin', $f->Group->getID())) {
- $menu_text[]=_('Admin');
- $menu_links[]='/forum/admin/?group_id='.$group_id;
- }
- } else {
- $gg=&group_get_object($group_id);
+ if ($f){
+ if ($forum_id) {
+ $menu_text[]=_('Discussion Forums:') .' '. $f->getName();
+ $menu_links[]='/forum/forum.php?forum_id='.$forum_id;
+ }
+ if (forge_check_perm ('forum_admin', $f->Group->getID())) {
+ $menu_text[]=_('Administration');
+ $menu_links[]='/forum/admin/?group_id='.$group_id;
+ }
+ } else {
+ $gg=group_get_object($group_id);
if (forge_check_perm ('forum_admin', $group_id)) {
- $menu_text[]=_('Admin');
+ $menu_text[]=_('Administration');
$menu_links[]='/forum/admin/?group_id='.$group_id;
}
- }
- if (count($menu_text) > 0) {
- echo $HTML->subMenu(
- $menu_text,
- $menu_links
- );
+ }
+ if (count($menu_text) > 0) {
+ $params['submenu'] =$HTML->subMenu($menu_text,$menu_links);
+ }
+
+ site_project_header($params);
}
$pluginManager = plugin_manager_get_object();
if ($f && $pluginManager->PluginIsInstalled('blocks') && plugin_hook ("blocks", "forum_".$f->getName()))
echo '<br />';
-
+
if (session_loggedin() ) {
if ($f) {
if ($f->isMonitoring()) {
echo util_make_link ('/forum/monitor.php?forum_id='.$forum_id.'&group_id='.$group_id.'&stop=1',
- html_image('ic/xmail16w.png','20','20').' '._('Stop Monitoring')).' | ';
+ html_image('ic/xmail16w.png').' '._('Stop Monitoring')).' | ';
} else {
echo util_make_link ('/forum/monitor.php?forum_id='.$forum_id.'&group_id='.$group_id.'&start=1',
- html_image('ic/mail16w.png','20','20').' '._('Monitor Forum')).' | ';
+ html_image('ic/mail16w.png').' '._('Monitor Forum')).' | ';
}
echo util_make_link ('/forum/save.php?forum_id='.$forum_id.'&group_id='.$group_id,
- html_image('ic/save.png','24','24') .' '._('Save Place')).' | ';
+ html_image('ic/save.png') .' '._('Save Place')).' | ';
}
} elseif ($f) {
echo '<a href="/forum/monitor.php?forum_id='.$forum_id.'&group_id='.$group_id.'&start=1">' .
- html_image('ic/mail16w.png','20','20').' '._('Monitor Forum').'</a> | ';
+ html_image('ic/mail16w.png').' '._('Monitor Forum').'</a> | ';
}
if ($f && $forum_id) {
$ret_val .= $am->PrintAttachLink($msg,$group_id,$msgforum->getID()) . '
<br />
'.
- html_image('ic/msg.png',"10","12") .
+ html_image('ic/msg.png') .
$bold_begin. $msg->getSubject() . $bold_end .' '.
'<br />'. date(_('Y-m-d H:i'),$msg->getPostDate()) .'
</td>
$am = new AttachManager();
$msgforum =& $msg->getForum();
$fa = new ForumAdmin($msgforum->Group->getID());
- $url = util_make_url('/forum/message.php?msg_id='. $msg->getID() .'&group_id='.$group_id);
- $ret_val =
+ $url = util_make_uri('/forum/message.php?msg_id='. $msg->getID() .'&group_id='.$group_id);
+ $ret_val =
'<table border="0" width="100%" cellspacing="0">
<tr>
- <td class="tablecontent" style="white-space: nowrap;" valign="top">';
+ <td class="tablecontent" style="white-space: nowrap;" valign="top">';
$params = array('user_id' => $msg->getPosterID(), 'size' => 's', 'content' => '');
plugin_hook_by_reference("user_logo", $params);
$ret_val .= '<a href="'.$url.'">[forum:'.$msg->getID().']</a><br/>';
if (forge_check_perm ('forum_admin', $msgforum->Group->getID())) {
$ret_val .= $fa->PrintAdminMessageOptions($msg->getID(),$group_id,$msg->getThreadID(),$msgforum->getID());
- }
+ }
$ret_val .= $am->PrintAttachLink($msg,$group_id,$msgforum->getID());
$ret_val .= '
</td>
</tr>
<tr>
<td colspan="2">
- ';
+ ';
if (strpos($msg->getBody(),'<') === false) {
$ret_val .= nl2br($msg->getBody()); //backwards compatibility for non html messages
} else {
function LinkAttachEditForm($filename,$group_id,$forum_id,$attachid,$msg_id) {
$return_val = '
-
+
<form action="' . getStringFromServer('PHP_SELF') . '" method="post" enctype="multipart/form-data">
<table>
<tr>
<td>' . _('Current File') . ": <span class=\"selected\">" . $filename . '</span></td>
</tr>
</table>
-
+
<fieldset class=\"fieldset\">
<table>
-
+
<tr>
<td>' . _('Use the "Browse" button to find the file you want to attach') . '</td>
</tr>
<td>' . _('File to upload') . ': <input type="file" name="attachment1"/></td>
</tr>
<tr>
- <td class="warning">' . _('Warning: Current file will be deleted permanently') . '</td>
+ <td class="warning">' . _('Warning: Uploaded file will replace current file') . '</td>
</tr>
</table>
- <input type="submit" name="go" value="'._('Update').'">
+ <input type="submit" name="go" value="'._('Update').'" />
<input type="hidden" name="doedit" value="1"/>
<input type="hidden" name="edit" value="yes"/>
<input type="hidden" name="forum_id" value="'.$forum_id.'"/>
<input type="hidden" name="group_id" value="'.$group_id.'"/>
<input type="hidden" name="attachid" value="'.$attachid.'"/>
<input type="hidden" name="msg_id" value="'.$msg_id.'"/>
- </fieldset></form><p>';
+ </fieldset>
+ </form>
+ <p/>';
return $return_val;
}
<td>" . _('File to upload') . ": <input type=\"file\" name=\"attachment1\"/></td>
</tr>
</table>
-
- </fieldset>";
+
+ </fieldset>";
}
/*
If it this is the message being displayed, don't show a link to it
*/
- if ($current_message != $msg_arr["$msg_id"][$i]->getID()) {
- $ah_begin='<a href="'.util_make_url ('/forum/message.php?msg_id='. $msg_arr["$msg_id"][$i]->getID() .'&group_id='.$group_id).'">';
+ if ($current_message != $msg_arr[$msg_id][$i]->getID()) {
+ $ah_begin='<a href="'.util_make_url ('/forum/message.php?msg_id='. $msg_arr[$msg_id][$i]->getID() .'&group_id='.$group_id).'">';
$ah_end='</a>';
} else {
$ah_begin='';
}
$ret_val .= $ah_begin .
- html_image('ic/msg.png',"10","12").' ';
+ html_image('ic/msg.png').' ';
/*
See if this message is new or not
*/
- if ($this->Forum->getSavedDate() < $msg_arr["$msg_id"][$i]->getPostDate()) {
+ if ($this->Forum->getSavedDate() < $msg_arr[$msg_id][$i]->getPostDate()) {
$bold_begin='<strong>';
$bold_end='</strong>';
} else {
$bold_end='';
}
- $ret_val .= $bold_begin.$msg_arr["$msg_id"][$i]->getSubject() .$bold_end.$ah_end.'</td>'.
- '<td>'.util_make_link_u ($msg_arr["$msg_id"][$i]->getPosterName(),$msg_arr["$msg_id"][$i]->getPosterID(),$msg_arr["$msg_id"][$i]->getPosterRealName()) .'</td>'.
- '<td>'.date(_('Y-m-d H:i'), $msg_arr["$msg_id"][$i]->getPostDate() ).'</td></tr>';
+ $ret_val .= $bold_begin.$msg_arr[$msg_id][$i]->getSubject() .$bold_end.$ah_end.'</td>'.
+ '<td>'.util_display_user($msg_arr[$msg_id][$i]->getPosterName(),$msg_arr[$msg_id][$i]->getPosterID(),$msg_arr[$msg_id][$i]->getPosterRealName()) .'</td>'.
+ '<td>'.date(_('Y-m-d H:i'), $msg_arr[$msg_id][$i]->getPostDate() ).'</td></tr>';
- if ($msg_arr["$msg_id"][$i]->hasFollowups() > 0) {
+ if ($msg_arr[$msg_id][$i]->hasFollowups() > 0) {
/*
Call yourself, incrementing the level
*/
- $ret_val .= $this->showSubmessages($msg_arr,$msg_arr["$msg_id"][$i]->getID(),($level+1));
+ $ret_val .= $this->showSubmessages($msg_arr,$msg_arr[$msg_id][$i]->getID(),($level+1));
}
}
}
}
unset($GLOBALS['editor_was_set_up']);
?>
- <br /><br />
+ <br /><br />
<p>
<?php //$this->LinkAttachForm();?>
<p>
-
-
+
+
<?php
?>
<br />
global $group_id;
$body = '';
-
+
if (forge_check_perm ('forum', $this->Forum->getID(), 'post')) {
if ($subject) {
//if this is a followup, put a RE: before it if needed
plugin_hook("text_editor",$params);
if (!$GLOBALS['editor_was_set_up']) {
//if we don't have any plugin for text editor, display a simple textarea edit box
- echo '<textarea name="body" rows="10" cols="70" wrap="soft">' . $body . '</textarea>';
+ echo '<textarea name="body" rows="10" cols="70">' . $body . '</textarea>';
}
unset($GLOBALS['editor_was_set_up']);
?> <?php //$text_support->displayTextField('body'); ?> <br>
<br>
<!-- <span class="selected"><?php echo _('HTML tags will display in your post as text'); ?></span> -->
<p><?php $this->LinkAttachForm();?>
-
-
+
+
<p><?php
if (!session_loggedin()) {
echo '<span class="highlight">';
} else {
//do nothing
}
-
}
-
}
// Local Variables:
// mode: php