* 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
+ * Copyright (C) 2010-2012 Alain Peyrat - Alcatel-Lucent
+ * Copyright 2013, Franck Villaume - TrivialDev
+ * Copyright 2013, French Ministry of National Education
* http://fusionforge.org
*
* This file is part of FusionForge. FusionForge is free software;
// checks which group the news item belongs to
$params['group'] = db_result($result, 0, 'group_id');
$params['toptab'] = 'news';
- $params['title'] = _('Forum: ') . db_result($result,0,'summary');
+ $params['title'] = _('Forum')._(': ').db_result($result,0,'summary');
$HTML->header($params);
- echo '<table><tr><td valign="top">';
+ echo '<table><tr><td class="top">';
$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> '. relative_date(db_result($result,0,'post_date')).'<br />
- <strong>'._('Summary').':</strong>'.
+ <strong>'._('Posted by')._(': ').'</strong> '.$user->getRealName().'<br />
+ <strong>'._('Date')._(': ').'</strong> '. relative_date(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/>
- <strong>'._('Project').':</strong>'.
+ <strong>'._('Project')._(': ').'</strong>'.
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);
- }
// display classification
if ($params['group'] == forge_get_config('news_group')) {
} elseif (forge_get_config('use_trove')) {
print stripslashes(trove_getcatlisting($params['group'],0,1));
}
+
+ echo '<p><strong>'._('Content')._(':').'</strong></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);
+ }
echo '</td><td valign="top" width="35%">';
echo $HTML->boxTop(_('Latest News'));
echo news_show_latest($params['group'],5,false);
$menu_links[]='/forum/admin/?group_id='.$group_id;
}
} else {
- $gg=group_get_object($group_id);
+ $gg = group_get_object($group_id);
if (forge_check_perm ('forum_admin', $group_id)) {
$menu_text[]=_('Administration');
$menu_links[]='/forum/admin/?group_id='.$group_id;
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').' '._('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').' '._('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') .' '._('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">' .
if ($f && $forum_id) {
echo util_make_link ('/forum/new.php?forum_id='.$forum_id.'&group_id='.$group_id,
- html_image('ic/write16w.png','20','20',array('alt'=>_('Start New Thread'))) .' '.
- _('Start New Thread'));
+ html_image('ic/write16w.png','20','20',array('alt'=>_('Start New Thread'))) .' '.
+ _('Start New Thread'));
}
}
site_project_footer($params);
}
-
/**
Wrap many forum functions in this class
function ForumHTML(&$Forum) {
$this->Error();
if (!$Forum || !is_object($Forum)) {
- $this->setError('ForumMessage:: No Valid Forum Object');
+ $this->setError(_('Invalid Forum Object'));
return false;
}
if ($Forum->isError()) {
- $this->setError('ForumMessage:: '.$Forum->getErrorMessage());
+ $this->setError('ForumMessage: '.$Forum->getErrorMessage());
return false;
}
$this->Forum =& $Forum;
return true;
}
-
/**
* Function showPendingMessage
*
- * @param object The message.
+ * @param object $msg The message.
*
- * @return returns the html output
+ * @return string return the html output
*/
function showPendingMessage ( &$msg) {
global $HTML,$group_id;
$ret_val .= '
<table>
<tr>
- <td class="tablecontent" style="white-space: nowrap;">'._('By:').
- $msg->getPosterRealName().
- '<br />
+ <td class="tablecontent" style="white-space: nowrap;">'._('By')._(': ').
+ $msg->getPosterRealName().
+ '<br />
';
$msgforum =& $msg->getForum();
$ret_val .= $am->PrintAttachLink($msg,$group_id,$msgforum->getID()) . '
global $HTML,$group_id;
/*
See if this message is new or not
- If so, highlite it in bold
+ If so, highlight it in bold
*/
if ($this->Forum->getSavedDate() < $msg->getPostDate()) {
$bold_begin='<strong>';
$ret_val .= $params['content'];
}
- $ret_val .= $bold_begin. $msg->getSubject(). ' <a href="'.$url.'">[ '._("reply").' ]</a>'. $bold_end;
- $ret_val .= '<br/>'._('By:').' '.util_make_link_u ($msg->getPosterName(),$msg->getPosterID(),$msg->getPosterRealName());
+ $ret_val .= $bold_begin. $msg->getSubject(). ' <a href="'.$url.'">[ '._("Reply").' ]</a>'. $bold_end;
+ $ret_val .= '<br/>'._('By')._(': ').util_make_link_u ($msg->getPosterName(),$msg->getPosterID(),$msg->getPosterRealName());
$ret_val .= ' on '.date('Y-m-d H:i',$msg->getPostDate());
- $ret_val .= '</td><td class="tablecontent" align="right">';
+ $ret_val .= '</td><td class="tablecontent align-right">';
$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());
<td colspan="2">
';
if (strpos($msg->getBody(),'<') === false) {
- $ret_val .= nl2br($msg->getBody()); //backwards compatibility for non html messages
- } else {
- $ret_val .= $msg->getBody();
- }
- $ret_val .= '
+ $ret_val .= nl2br($msg->getBody()); //backwards compatibility for non html messages
+ } else {
+ $ret_val .= $msg->getBody();
+ }
+ $ret_val .= '
</td>
</tr>
</table>';
/**
* LinkAttachEditForm - Returns the link to the attach form for editing
*
- * @param string Filename
- * @param int group id
- * @param int forum id
- * @param int attach id
- * @param int msg id
+ * @param string $filename Filename
+ * @param int $group_id group id
+ * @param int $forum_id forum id
+ * @param int $attachid attach id
+ * @param int $msg_id msg id
*
- * @return The HTML output
+ * @return string The HTML output
*/
function LinkAttachEditForm($filename,$group_id,$forum_id,$attachid,$msg_id) {
<table>
<tr>
- <td>' . _('Use the "Browse" button to find the file you want to attach') . '</td>
+ <td>' . _('Use the “Browse” button to find the file you want to attach') . '</td>
</tr>
<tr>
<td>' . _('File to upload') . ': <input type="file" name="attachment1"/></td>
<tr>
<td class="warning">' . _('Warning: Uploaded file will replace current file') . '</td>
</tr>
- </table>
- <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.'"/>
+ </table>
+ <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/>';
/**
* LinkAttachForm - echoes the link to the attach form
- *
- * @return The HTML output echoed
*/
function LinkAttachForm() {
$poststarttime = time();
$posthash = md5($poststarttime . user_getid() );
- echo "
- <fieldset class=\"fieldset\">
+ echo '
+ <fieldset class="fieldset">
+ <legend>' . _('Attachments') . "</legend>
<table>
<tr>
- <td>" . _('Use the "Browse" button to find the file you want to attach') . "</td>
+ <td>" . _('Use the “Browse” button to find the file you want to attach') . "</td>
</tr>
<tr>
<td>" . _('File to upload') . ": <input type=\"file\" name=\"attachment1\"/></td>
</table>
</fieldset>";
-
}
-
+ /**
+ * @param string $msg_arr
+ * @param string $msg_id
+ * @return string
+ */
function showNestedMessages ( &$msg_arr, $msg_id ) {
global $total_rows;
return $ret_val;
}
+ /**
+ * @param $msg_arr
+ * @param $msg_id
+ * @param $level
+ * @return string
+ */
function showSubmessages(&$msg_arr, $msg_id, $level) {
/*
Recursive. Selects this message's id in this thread,
/**
* showEditForm - Prints the form to edit a message
*
- * @param int The Message
+ * @param int $msg The Message
* @return The HTML output echoed
*/
$is_followup_to = $msg->getParentID();
$has_followups = $msg->hasFollowups();
$most_recent_date = $msg->getMostRecentDate();
- $g =& $this->Forum->getGroup();
+ $g = $this->Forum->getGroup();
$group_id = $g->getID();
if (forge_check_perm ('forum', $this->Forum->getID(), 'post')) { // minor control, but anyways it should be an admin at this point
echo notepad_func();
?>
-<div align="center">
- <form id="ForumEditForm" enctype="multipart/form-data" action="<?php echo util_make_url ('/forum/admin/index.php') ?>" method="post">
- <?php $objid = $this->Forum->getID();?>
- <input type="hidden" name="thread_id" value="<?php echo $thread_id; ?>" />
- <input type="hidden" name="forum_id" value="<?php echo $objid; ?>" />
- <input type="hidden" name="editmsg" value="<?php echo $msg_id; ?>" />
- <input type="hidden" name="is_followup_to" value="<?php echo $is_followup_to; ?>" />
- <input type="hidden" name="form_key" value="<?php echo form_generate_key();?>">
- <input type="hidden" name="posted_by" value="<?php echo $posted_by;?>">
- <input type="hidden" name="post_date" value="<?php echo $post_date;?>">
- <input type="hidden" name="has_followups" value="<?php echo $has_followups;?>">
- <input type="hidden" name="most_recent_date" value="<?php echo $most_recent_date;?>">
- <input type="hidden" name="group_id" value="<?php echo $group_id;?>">
-<fieldset class="fieldset">
- <table><tr><td valign="top">
- </td><td valign="top">
- <br />
- <strong><?php echo _('Subject:'); ?></strong><?php echo utils_requiredField(); ?><br />
- <input type="text" name="subject" value="<?php echo $subject; ?>" size="80" maxlength="80" />
- <br />
- <strong><?php echo _('Message:'); ?></strong><?php echo notepad_button('document.forms.ForumEditForm.body') ?><?php echo utils_requiredField(); ?><br />
- <?php
- $GLOBALS['editor_was_set_up']=false;
- $params = array() ;
- $params['body'] = $body;
- $params['width'] = "800";
- $params['height'] = "500";
- $params['group'] = $group_id;
- 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">' . $body . '</textarea>';
- }
- unset($GLOBALS['editor_was_set_up']);
+ <div style="margin-left: auto; margin-right: auto;">
+ <form id="ForumEditForm" enctype="multipart/form-data" action="<?php echo util_make_url ('/forum/admin/index.php') ?>" method="post">
+ <?php $objid = $this->Forum->getID();?>
+ <input type="hidden" name="thread_id" value="<?php echo $thread_id; ?>" />
+ <input type="hidden" name="forum_id" value="<?php echo $objid; ?>" />
+ <input type="hidden" name="editmsg" value="<?php echo $msg_id; ?>" />
+ <input type="hidden" name="is_followup_to" value="<?php echo $is_followup_to; ?>" />
+ <input type="hidden" name="form_key" value="<?php echo form_generate_key();?>">
+ <input type="hidden" name="posted_by" value="<?php echo $posted_by;?>">
+ <input type="hidden" name="post_date" value="<?php echo $post_date;?>">
+ <input type="hidden" name="has_followups" value="<?php echo $has_followups;?>">
+ <input type="hidden" name="most_recent_date" value="<?php echo $most_recent_date;?>">
+ <input type="hidden" name="group_id" value="<?php echo $group_id;?>">
+ <fieldset class="fieldset">
+ <legend><?php echo _('Edit Message'); ?></legend>
+ <table><tr><td class="top">
+ </td><td class="top">
+ <p>
+ <strong><?php echo _('Subject')._(': '); ?></strong><?php echo utils_requiredField(); ?><br />
+ <input type="text" autofocus="autofocus" required="required" name="subject" value="<?php echo $subject; ?>" size="80" maxlength="80" />
+ </p>
+ <p>
+ <strong><?php echo _('Message')._(': '); ?></strong><?php echo notepad_button('document.forms.ForumEditForm.body') ?><?php echo utils_requiredField(); ?>
+ </p>
+ <?php
+ $GLOBALS['editor_was_set_up']=false;
+ $params = array() ;
+ $params['body'] = $body;
+ $params['width'] = "800";
+ $params['height'] = "500";
+ $params['group'] = $group_id;
+ 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 required="required" name="body" rows="10" cols="70">' . $body . '</textarea>';
+ }
+ unset($GLOBALS['editor_was_set_up']);
?>
- <br />
-
- <p>
- <?php //$this->LinkAttachForm();?>
- <p>
-
- <?php
- ?>
- <br />
- <center><input type="submit" name="ok" value="<?php echo _('Update'); ?>" />
- <input type="submit" name="cancel" value="<?php echo _('Cancel'); ?>" />
- </center>
- </p>
+ <p style="text-align: center">
+ <input type="submit" name="ok" value="<?php echo _('Update'); ?>" />
+ <input type="submit" name="cancel" value="<?php echo _('Cancel'); ?>" />
+ </p>
</td></tr></table></fieldset>
-</form>
-</div>
- <?php
-}
-}
+ </form>
+ </div>
+ <?php
+ }
+ }
-function showPostForm($thread_id=0, $is_followup_to=0, $subject="") {
- global $group_id;
+ /**
+ * @param int $thread_id
+ * @param int $is_followup_to
+ * @param string $subject
+ */
+ function showPostForm($thread_id=0, $is_followup_to=0, $subject="") {
+ global $group_id;
- $body = '';
+ $body = '';
- $rl = RoleLoggedIn::getInstance() ;
- if (forge_check_perm ('forum', $this->Forum->getID(), 'post')) {
- if ($subject) {
- //if this is a followup, put a RE: before it if needed
- if (!preg_match('/RE:/i',$subject,$test)) {
- $subject ='RE: '.$subject;
+ $rl = RoleLoggedIn::getInstance() ;
+ if (forge_check_perm ('forum', $this->Forum->getID(), 'post')) {
+ if ($subject) {
+ //if this is a followup, put a RE: before it if needed
+ if (!preg_match('/RE:/i',$subject,$test)) {
+ $subject ='RE: '.$subject;
+ }
}
- }
- echo notepad_func();
- ?>
-<div align="center">
+ echo notepad_func();
+ ?>
+ <div align="center">
<form id="ForumPostForm" enctype="multipart/form-data" action="<?php echo util_make_url ('/forum/forum.php?forum_id='.$this->Forum->getID().'&group_id='.$group_id); ?>" method="post">
- <?php $objid = $this->Forum->getID();?>
- <input type="hidden" name="post_message" value="y" />
- <input type="hidden" name="thread_id" value="<?php echo $thread_id; ?>" />
- <input type="hidden" name="msg_id" value="<?php echo $is_followup_to; ?>" />
- <input type="hidden" name="is_followup_to" value="<?php echo $is_followup_to; ?>" />
- <input type="hidden" name="form_key" value="<?php echo form_generate_key();?>" />
- <fieldset class="fieldset"><table><tr><td valign="top">
- </td><td valign="top">
- <br />
- <strong><?php echo _('Subject:'); ?></strong><?php echo utils_requiredField(); ?><br />
- <input type="text" name="subject" value="<?php echo $subject; ?>" size="80" maxlength="80" />
+ <?php $objid = $this->Forum->getID();?>
+ <input type="hidden" name="post_message" value="y" />
+ <input type="hidden" name="thread_id" value="<?php echo $thread_id; ?>" />
+ <input type="hidden" name="msg_id" value="<?php echo $is_followup_to; ?>" />
+ <input type="hidden" name="is_followup_to" value="<?php echo $is_followup_to; ?>" />
+ <input type="hidden" name="form_key" value="<?php echo form_generate_key();?>" />
+ <fieldset class="fieldset"><table><tr>
+ <td class="top">
+ </td>
+ <td class="top">
+ <strong><?php echo _('Subject')._(': '); ?></strong><?php echo utils_requiredField(); ?><br />
+ <input type="text" autofocus="autofocus" required="required" name="subject" value="<?php echo $subject; ?>" size="80" maxlength="80" />
<br />
- <strong><?php echo _('Message:'); ?></strong><?php echo notepad_button('document.forms.ForumPostForm.body') ?><?php echo utils_requiredField(); ?><br />
-
- <?php
- $GLOBALS['editor_was_set_up']=false;
- $params = array();
- $params['body'] = $body;
- $params['width'] = "800";
- $params['height'] = "500";
- $params['group'] = $group_id;
- 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">' . $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();?>
+ <strong><?php echo _('Message')._(': '); ?></strong><?php echo notepad_button('document.forms.ForumPostForm.body') ?><?php echo utils_requiredField(); ?><br />
+ <?php
+ $GLOBALS['editor_was_set_up']=false;
+ $params = array();
+ $params['body'] = $body;
+ $params['width'] = "800";
+ $params['height'] = "500";
+ $params['group'] = $group_id;
+ 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 required="required" name="body" rows="10" cols="70">' . $body . '</textarea>';
+ }
+ unset($GLOBALS['editor_was_set_up']);
+ //$text_support->displayTextField('body'); ?>
+ <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">';
- printf (_('You are posting anonymously because you are not <a href="%1$s">logged in</a>'),util_make_url ('/account/login.php?return_to='. urlencode(getStringFromServer('REQUEST_URI')))) .'</span>';
+ printf (_('You are posting anonymously because you are not <a href="%s">logged in</a>'),util_make_url ('/account/login.php?return_to='. urlencode(getStringFromServer('REQUEST_URI'))));
+ echo '</span>';
}
?> <br />
<input type="submit" name="submit"
value="<?php echo _('Post Comment'); echo ((!session_loggedin())?' '._('Anonymously'):''); ?>" /><?php
- echo ((session_loggedin()) ? ' <input type="checkbox" value="1" name="monitor" /> '._('Receive followups via email').'.' : ''); ?>
+ echo ((session_loggedin()) ? ' <input type="checkbox" value="1" name="monitor" /> '._('Receive comments via email').'.' : ''); ?>
</p>
</td>
</tr>
</div>
<?php
-} elseif ($rl->hasPermission('forum', $this->Forum->getID(), 'post')) {
- echo '<span class="error">';
- printf(_('You could post if you were <a href="%1$s">logged in</a>.'), util_make_uri('/account/login.php?return_to='.urlencode(getStringFromServer('REQUEST_URI'))));
- echo '</span>';
-} elseif (!session_loggedin()) {
- echo '<span class="error">';
- printf(_('Please <a href="%1$s">log in</a>'), util_make_uri('/account/login.php?return_to='.urlencode(getStringFromServer('REQUEST_URI'))));
- echo '</span><br/></p>';
-} else {
- //do nothing
-}
-}
+ } elseif ($rl->hasPermission('forum', $this->Forum->getID(), 'post')) {
+ echo '<span class="error">';
+ printf(_('You could post if you were <a href="%s">logged in</a>.'), util_make_uri('/account/login.php?return_to='.urlencode(getStringFromServer('REQUEST_URI'))));
+ echo '</span>';
+ } elseif (!session_loggedin()) {
+ echo '<span class="error">';
+ printf(_('Please <a href="%s">log in</a>'), util_make_uri('/account/login.php?return_to='.urlencode(getStringFromServer('REQUEST_URI'))));
+ echo '</span><br/></p>';
+ } else {
+ //do nothing
+ }
+ }
}
// Local Variables:
// mode: php
// c-file-style: "bsd"
// End:
-
-?>