gforge/www/themes/gforge/images/ic/forum_add.gif -text
gforge/www/themes/gforge/images/ic/forum_delete.gif -text
gforge/www/themes/gforge/images/ic/forum_edit.gif -text
+gforge/www/themes/gforge/images/ic/forum_move.gif -text svneol=unset#unset
gforge/www/themes/gforge/images/ic/ftp16b.png -text
gforge/www/themes/gforge/images/ic/halfcheck.png -text
gforge/www/themes/gforge/images/ic/home16b.png -text
support for Arch, Bazaar, Darcs, Git, Mercurial.
* Mediawiki plugin: mostly rewritten. Now creates independent wikis
for projects, allowing different sets of permissions.
+* Forums: New 'move' option to move a thread from one forum to another (Alcatel-Lucent).
FusionForge-4.8.2:
* Maintenance release, security and bugfixes.
* @return The HTML output
*/
- function PrintAdminMessageOptions($msg_id,$group_id,$thread_id=0,$forum_id=0) {
+ function PrintAdminMessageOptions($msg_id,$group_id,$thread_id=0,$forum_id=0,$return_to_message=0) {
global $HTML;
- $return = '<a href="admin/index.php?editmsg=' . $msg_id . '&group_id=' . $group_id . '&thread_id=' . $thread_id. '&forum_id=' . $forum_id . '">' . html_image('ic/forum_edit.gif','37','15',array('alt'=>_("Edit"))) . "</a>";
- $return .= ' <a href="admin/index.php?deletemsg=' . $msg_id . '&group_id=' . $group_id . '&thread_id=' . $thread_id. '&forum_id=' . $forum_id . '">' . html_image('ic/forum_delete.gif','16','18',array('alt'=>_("Delete"))) . "</a>";
- $return .= "<br>";
+ $return = '<a href="admin/index.php?movethread=' . $thread_id . '&msg_id=' . $msg_id . '&group_id=' . $group_id . '&forum_id=' . $forum_id .
+ '&return_to_message=' . $return_to_message . '">' . html_image('ic/forum_move.gif','37','15',array('alt'=>_('Move thread'))). "</a>";
+
+ // Following code (if ...) is to keep old implementation but need to be cleaned
+ if ($return_to_message) {
+ $thread_id = 0;
+ }
+
+ $return .= ' <a href="admin/index.php?editmsg=' . $msg_id . '&group_id=' . $group_id . '&thread_id=' . $thread_id. '&forum_id=' . $forum_id . '">' . html_image('ic/forum_edit.gif','37','15',array('alt'=>_("Edit"))) . "</a>";
+ $return .= ' <a href="admin/index.php?deletemsg=' . $msg_id . '&group_id=' . $group_id . '&thread_id=' . $thread_id. '&forum_id=' . $forum_id . '">' . html_image('ic/forum_delete.gif','16','18',array('alt'=>_("Delete"))) . "</a>";
+ // $return .= "<br />";
return $return;
}
echo "
<tr" . $HTML->boxGetAltRowStyle($i++). ">
<td>$onemsg[forum_name]</td>
- <td><a href=\"#\" OnClick=\"window.open('pendingmsgdetail.php?msg_id=$onemsg[msg_id]&forum_id=$onemsg[group_forum_id]&group_id=$group_id','PendingMessageDetail','width=800,height=600,status=no,resizable=yes');\">$onemsg[subject]</a></td>
+ <td><a href=\"#\" OnClick=\"window.open('pendingmsgdetail.php?msg_id=$onemsg[msg_id]&forum_id=$onemsg[group_forum_id]&group_id=$group_id','PendingMessageDetail','width=800,height=600,status=no,resizable=yes');\">$onemsg[subject]</a></td>
<td><div align=\"right\">" . html_build_select_box_from_assoc($options,"doaction[]",1) . "</div></td>
</tr>";
}
if (!form_key_is_valid(getStringFromRequest('form_key'))) {
exit_form_double_submit();
}
- $fa = new ForumAdmin($group_id);
- $feedback .= $fa->ExecuteAction("add_forum");
+
+ if (check_email_available($g, $g->getUnixName() . '-' . getStringFromRequest('forum_name'), $error_msg)) {
+ $fa = new ForumAdmin($group_id);
+ $feedback .= $fa->ExecuteAction("add_forum");
+ }
} else if (getStringFromRequest('change_status')) {
$fa = new ForumAdmin($group_id);
$feedback .= $fa->ExecuteAction("change_status");
exit_permission_denied();
}
}
+ } elseif (getStringFromRequest("movethread")) {
+ $thread_id = getIntFromRequest("movethread");
+ $msg_id = getStringFromRequest("msg_id");
+ $forum_id = getIntFromRequest("forum_id");
+ $return_to_message = getIntFromRequest("return_to_message");
+ $new_forum_id = getIntFromRequest("new_forum_id");
+ $fa = new ForumAdmin();
+ if ($fa->Authorized($group_id)) {
+ if ($fa->isForumAdmin($forum_id)) {
+ if (getStringFromRequest("ok")) {
+ if ($forum_id == $new_forum_id) {
+ $feedback .= _('Thread not moved');
+ }
+ else {
+ // Move message in another forum
+ $f_from = new Forum ($fa->GetGroupObject(),$forum_id);
+ if (!$f_from || !is_object($f_from)) {
+ exit_error('Error','Could Not Get Forum Object');
+ } elseif ($f_from->isError()) {
+ exit_error('Error',$f_from->getErrorMessage());
+ }
+ $f_to = new Forum ($fa->GetGroupObject(),$new_forum_id);
+ if (!$f_to || !is_object($f_to)) {
+ exit_error('Error','Could Not Get Forum Object');
+ } elseif ($f_to->isError()) {
+ exit_error('Error',$f_to->getErrorMessage());
+ }
+
+ $ff = new ForumFactory($g);
+ if (!$ff || !is_object($ff) || $ff->isError()) {
+ exit_error(_('Error'),$ff->getErrorMessage());
+ }
+
+ if ($ff->moveThread($new_forum_id,$thread_id,$forum_id)) {
+ $feedback .= sprintf(_('Thread successfully moved from %1$s forum to %2$s forum'), $f_from->getName(),$f_to->getName());
+ } else {
+ $feedback .= $ff->getErrorMessage();
+ }
+ }
+
+ forum_header(array('title'=>_('Edit a Message')));
+ echo '<p><a href="/forum/forum.php?forum_id=' . $new_forum_id . '">Return to the forum</a></p>';
+ echo '<p><a href="/forum/forum.php?thread_id='.$thread_id.'&forum_id=' . $new_forum_id . '">Return to the thread</a></p>';
+ forum_footer(array());
+ } elseif (getStringFromRequest("cancel")) {
+ // the user cancelled the request, go back to forum
+ if ($return_to_message) {
+ header("Location: /forum/message.php?msg_id=$msg_id");
+ } else {
+ header("Location: /forum/forum.php?thread_id=$thread_id&forum_id=$forum_id");
+ }
+ exit;
+ } else {
+ // Display select box to select new forum
+
+ forum_header(array('title'=>_('Forums: Administration')));
+
+ $ff = new ForumFactory($g);
+ if (!$ff || !is_object($ff) || $ff->isError()) {
+ exit_error(_("Error"),$ff->getErrorMessage());
+ }
+
+ $farr =& $ff->getForums();
+
+ if ($ff->isError()) {
+ echo '<h1>'.sprintf(_('No Forums Found For %s'), $g->getPublicName()) .'</h1>';
+ echo $ff->getErrorMessage();
+ forum_footer(array());
+ exit;
+ }
+
+ /*
+ List the existing forums so they can be edited.
+ */
+
+ $forums = array();
+ for ($j = 0; $j < count($farr); $j++) {
+ if (!is_object($farr[$j])) {
+ //just skip it - this object should never have been placed here
+ } elseif ($farr[$j]->isError()) {
+ echo $farr[$j]->getErrorMessage();
+ } else {
+ $forums[$farr[$j]->getID()] = $farr[$j]->getName();
+ }
+ }
+
+ $f_from = new Forum ($fa->GetGroupObject(),$forum_id);
+ if (!$f_from || !is_object($f_from)) {
+ exit_error('Error','Could Not Get Forum Object');
+ } elseif ($f_from->isError()) {
+ exit_error('Error',$f_from->getErrorMessage());
+ }
+
+ echo '<center>
+ <form action="'.getStringFromServer('PHP_SELF').'" method="post">
+ <h3>' . sprintf(_('Move thread from %s forum to the following forum:'), $f_from->getName()) . '</h3>
+ <p>
+ <input type="hidden" name="movethread" value="'.$thread_id.'" />
+ <input type="hidden" name="group_id" value="'.$group_id.'" />
+ <input type="hidden" name="forum_id" value="'.$forum_id.'" />
+ <input type="hidden" name="msg_id" value="'.$msg_id.'" />
+ <input type="hidden" name="return_to_message" value="'.$return_to_message.'" />' .
+ html_build_select_box_from_assoc($forums,'new_forum_id',$forum_id) .
+ '<br /><br />
+ <input type="submit" name="ok" value="' . _("Submit") . '" />
+ <input type="submit" name="cancel" value="' . _("Cancel") . '" />
+ </p>
+ </form>
+ </center>';
+
+ forum_footer(array());
+ }
+ } else {
+ exit_permission_denied();
+ }
+ } else {
+ //manage auth errors
+ if ($fa->isGroupIdError()) {
+ exit_no_group();
+ }
+ elseif ($fa->isPermissionDeniedError()) {
+ exit_permission_denied();
+ }
+ }
+
+
+
+
} else {
/*
Show main page for choosing
require_once $gfwww.'include/pre.php';
require_once $gfwww.'forum/include/ForumHTML.class.php';
-if (!session_loggedin()) {
- exit_not_logged_in();
-}
/**
* goodbye - Just prints a message and a close button.
}
if ($delete == "yes") {
- if ( ! session_loggedin() ) {
- exit_not_logged_in();//only logged users can delete attachments
+ if (!$f->userCanPost()) {
+ exit_permission_denied();
}
+
//only the user that created the attach or forum admin can delete it (safecheck)
if (!$pending) { //pending messages aren't deleted from this page
$res = db_query_params ('SELECT userid FROM forum_attachment WHERE attachmentid=$1',
if ($edit=="yes") {
- if ( ! session_loggedin() ) {
- exit_not_logged_in();//only logged users can edit attachments
+ if (!$f->userCanPost()) {
+ exit_permission_denied();
}
+
//only the user that created the attach or forum admin can edit it (safecheck)
if (!$pending) { //pending messages aren't deleted from this page
$res = db_query_params ('SELECT filename FROM forum_attachment WHERE attachmentid=$1',
$ret_val .= '<tr '. $GLOBALS['HTML']->boxGetAltRowStyle($total_rows) .'>
<td><a href="'.util_make_url ('/forum/message.php?msg_id='.$msg->getID().
- '&group_id='.$group_id).'">'.
- html_image('ic/msg.png',"10","12",array("border"=>"0"));
+ '&group_id='.$group_id).'&reply=0">'.
+ html_image('ic/msg.png',"10","12",array("border"=>"0")).' ';
/*
See if this message is new or not
If so, highlite it in bold
show the subject and poster
*/
$ret_val .= $bold_begin.$msg->getSubject() .$bold_end.'</a></td>'.
- '<td>'. $msg->getPosterRealName() .'</td>'.
+ '<td><a href="/users/'.$msg->getPosterName().'/">'.$msg->getPosterRealName().'</a></td>'.
'<td>'. date(_('Y-m-d H:i'),$msg->getPostDate()) .'</td></tr>';
if ($msg->hasFollowups()) {
show the subject and poster
*/
$ret_val .= $bold_begin.$row['subject'] .$bold_end.'</a></td>'.
- '<td>'. $row['realname'] .'</td>'.
+ '<td><a href="/users/'.$row['user_name'].'/">'.$row['realname'].'</a></td>'.
'<td>'. $row['followups'] .'</td>'.
'<td>'.date(_('Y-m-d H:i'),$row['recent']).'</td></tr>';
$i++;
if ($msg->isPending()) {
$res = db_query_params ('SELECT attachmentid,filename,userid,counter FROM forum_pending_attachment where msg_id=$1',
array ($msg_id));
- $pend = "&pending=yes";
+ $pend = "&pending=yes";
} else {
$res = db_query_params ('SELECT attachmentid,filename,userid,counter FROM forum_attachment where msg_id=$1',
array ($msg_id));
}
if ($attachid) {
$attach = "<br/>
- <a href=\"javascript:manageattachments('".util_make_url("/forum/attachment.php?attachid=$attachid&group_id=$group_id&forum_id=$forum_id$pend")."','no');\">" . html_image('ic/cfolder15.png',"15","13",array("border"=>"0")) . db_result($res,0,'filename') . "</a> (" . db_result($res,0,'counter') . ") downloads";
+ <a href=\"javascript:manageattachments('".util_make_url("/forum/attachment.php?attachid=$attachid&group_id=$group_id&forum_id=$forum_id$pend")."','no');\">" . html_image('ic/cfolder15.png',"15","13",array("border"=>"0")) . db_result($res,0,'filename') . "</a> (" . db_result($res,0,'counter') . ") downloads";
$attach_userid = db_result($res,0,'userid');
$f = $msg->getForum();
exit_error('Error', _('Could Not Get Forum Object'));
} else {
if ( ((user_getid() == $attach_userid) || ($f->userIsAdmin())) && (!$msg->isPending()) ) { //only permit the user who created the attach to delete it, or an admin
- $attach .= " <a href=\"javascript:manageattachments('".util_make_url ("/forum/attachment.php?attachid=$attachid&group_id=$group_id&forum_id=$forum_id&msg_id=$msg_id&edit=yes")."','no');\">" . "<font size=\"-3\">" . html_image('ic/forum_edit.gif','37','15',array('alt'=>_("Edit"))) . "</font></a>";
- $attach .= " <a href=\"javascript:manageattachments('".util_make_url("/forum/attachment.php?attachid=$attachid&group_id=$group_id&forum_id=$forum_id&delete=yes")."','yes');\">" . "<font size=\"-3\">" . html_image('ic/forum_delete.gif','16','18',array('alt'=>_("Delete"))) . "</font></a>";
+ $attach .= " <a href=\"javascript:manageattachments('/forum/attachment.php?attachid=$attachid&group_id=$group_id&forum_id=$forum_id&msg_id=$msg_id&edit=yes','no');\">" . "<font size=\"-3\">" . html_image('ic/forum_edit.gif','37','15',array('alt'=>_("Edit"))) . "</font></a>";
+ $attach .= " <a href=\"javascript:manageattachments('/forum/attachment.php?attachid=$attachid&group_id=$group_id&forum_id=$forum_id&delete=yes','yes');\">" . "<font size=\"-3\">" . html_image('ic/forum_delete.gif','16','18',array('alt'=>_("Delete"))) . "</font></a>";
}
}
} else {
if (!$f || !is_object($f)) {
exit_error('Error','Could Not Get Forum Object');
} else {
- $attach = html_image('ic/cfolder15.png',"15","13",array("border"=>"0")) . _('No attachment found');
+// $attach = html_image('ic/cfolder15.png',"15","13",array("border"=>"0")) . _('No attachment found');
+ $attach = '';
if ( ((user_getid() == $msg->getPosterID()) || ($f->userIsAdmin())) && (!$msg->isPending()) ) { //only permit an admin or the user who created the message to insert an attach
- $attach .= " <a href=\"javascript:manageattachments('".util_make_url ("/forum/attachment.php?attachid=0&group_id=$group_id&forum_id=$forum_id&msg_id=$msg_id&edit=yes")."','no');\">" . "<font size=\"-3\">" . html_image('ic/forum_add.gif','37','15',array('alt'=>_("Add"))) . "</font></a>";
+ $attach .= " <a href=\"javascript:manageattachments('".util_make_url ("/forum/attachment.php?attachid=0&group_id=$group_id&forum_id=$forum_id&msg_id=$msg_id&edit=yes")."','no');\">" . "<font size=\"-3\">" . html_image('ic/forum_add.gif','37','15',array('alt'=>_("Add"))) . "</font></a>";
}
}
}
require_once $gfwww.'forum/include/AttachManager.class.php';
function forum_header($params) {
- global $HTML,$group_id,$forum_name,$forum_id,$sys_news_group,$f,$sys_use_forum,$group_forum_id;
+ global $HTML,$group_id,$forum_name,$forum_id,$sys_news_group,$f,$sys_use_forum,$sys_use_trove,$group_forum_id;
if ($group_forum_id) {
$forum_id=$group_forum_id;
<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,
+ 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 />
<p>
- '. (util_make_links(nl2br(db_result($result,0,'details'))));
+ ';
+ $body = db_result($result,0,'details');
+ $sanitizer = new TextSanitizer();
+ $body = $sanitizer->purify($body);
+ if (!strstr($body,'<')) {
+ //backwards compatibility for non html messages
+ echo util_make_links(nl2br($body));
+ } else {
+ echo util_make_links($body);
+ }
echo '</p>';
+
+ // display classification
+ if ($params['group'] == $sys_news_group) {
+ print stripslashes(trove_news_getcatlisting(db_result($result,0,'forum_id'),0,1));
+ } elseif ($sys_use_trove) {
+ print stripslashes(trove_getcatlisting($params['group'],0,1));
+ }
}
echo '</td><td valign="top" width="35%">';
echo $HTML->boxTop(_('Latest News'));
$menu_links=array();
if ($f){
- if ($f->userIsAdmin()) {
- $menu_text[]=_('Admin');
- $menu_links[]='/forum/admin/?group_id='.$group_id;
- }
if ($forum_id) {
$menu_text[]=_('Discussion Forums:') .' '. $f->getName();
$menu_links[]='/forum/forum.php?forum_id='.$forum_id;
}
+ if ($f->userIsAdmin()) {
+ $menu_text[]=_('Admin');
+ $menu_links[]='/forum/admin/?group_id='.$group_id;
+ }
} else {
$gg=&group_get_object($group_id);
$perm =& $gg->getPermission( session_get_user() );
echo util_make_link ('/forum/save.php?forum_id='.$forum_id.'&group_id='.$group_id,
html_image('ic/save.png','24','24',array()) .' '._('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',array()).' '._('Monitor Forum').'</a> | ';
}
if ($f && $forum_id) {
$ret_val .= '
<table border="0">
<tr>
- <td class="tablecontent" nowrap="nowrap">'._('By:').
+ <td class="tablecontent" style="white-space: nowrap;">'._('By:').
$msg->getPosterRealName().
'<br />
';
$am = new AttachManager();
$fa = new ForumAdmin();
$msgforum =& $msg->getForum();
- $ret_val = '
- <table border="0">
+ $url = util_make_url('/forum/message.php?msg_id='. $msg->getID() .'&group_id='.$group_id);
+ $ret_val =
+ '<table border="0" width="100%" cellspacing="0">
<tr>
- <td class="tablecontent" nowrap="nowrap">';
+ <td class="tablecontent" style="white-space: nowrap;" valign="top">';
+ $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 .= '<a href="'.$url.'">[forum:'.$msg->getID().']</a><br/>';
if ($msgforum->userIsAdmin()) {
$ret_val .= $fa->PrintAdminMessageOptions($msg->getID(),$group_id,$msg->getThreadID(),$msgforum->getID());
}
- $ret_val .= _('By:').' '.util_make_link_u ($msg->getPosterName(),$msg->getPosterID(),$msg->getPosterRealName()).'<br />
-';
- $ret_val .= $am->PrintAttachLink($msg,$group_id,$msgforum->getID()) . '
- <br />'.util_make_link ('/forum/message.php?msg_id='.$msg->getID() .'&group_id='.$group_id,
- html_image('ic/msg.png',"10","12",array("border"=>"0")) .
- $bold_begin. $msg->getSubject() .' [ '._('reply').' ]'. $bold_end) .' '.
- '<br />'. date(_('Y-m-d H:i'),$msg->getPostDate()) .'
+ $ret_val .= $am->PrintAttachLink($msg,$group_id,$msgforum->getID());
+ $ret_val .= '
</td>
</tr>
<tr>
- <td>
+ <td colspan="2">
';
- if (!strstr($msg->getBody(),'<')) {
+ if (strpos($msg->getBody(),'<') === false) {
$ret_val .= nl2br($msg->getBody()); //backwards compatibility for non html messages
} else {
$ret_val .= $msg->getBody();
function LinkAttachEditForm($filename,$group_id,$forum_id,$attachid,$msg_id) {
$return_val = '
- <p>
<form action="' . getStringFromServer('PHP_SELF') . '" method="post" enctype="multipart/form-data">
<table>
<tr>
$total_rows++;
$ret_val .= '
- <tr '. $GLOBALS['HTML']->boxGetAltRowStyle($total_rows) .'><td nowrap="nowrap">';
+ <tr '. $GLOBALS['HTML']->boxGetAltRowStyle($total_rows) .'><td style="white-space: nowrap;">';
/*
How far should it indent?
*/
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).'">';
+ $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",array("border"=>"0"));
+ html_image('ic/msg.png',"10","12",array("border"=>"0")).' ';
/*
See if this message is new or not
*/
echo notepad_func();
?>
<div align="center">
- <form 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;?>">
+ <form 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>
+ <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="70" /> <br>
- <br>
+ <input type="text" name="subject" value="<?php echo $subject; ?>" size="80" maxlength="80" />
+ <br /><br />
<strong><?php echo _('Message:'); ?></strong><?php echo notepad_button('document.forms[1].body') ?><?php echo utils_requiredField(); ?><br />
<?php
$GLOBALS['editor_was_set_up']=false;
echo '<textarea name="body" rows="10" cols="70">' . $body . '</textarea>';
}
unset($GLOBALS['editor_was_set_up']);
- ?> <br>
- <br>
+ ?>
+ <br /><br />
- <p><?php //$this->LinkAttachForm();?>
-
-
- <p><?php
- ?> <br />
+ <p>
+ <?php //$this->LinkAttachForm();?>
+ <p>
- <center><input type="submit" name="ok"
- value="<?php echo _('Update'); ?>" /> <input type="submit"
- name="cancel" value="<?php echo _('Cancel'); ?>" /></center>
+ <?php
+ ?>
+ <br />
+ <center><input type="submit" name="ok" value="<?php echo _('Update'); ?>" />
+ <input type="submit" name="cancel" value="<?php echo _('Cancel'); ?>" />
+ </center>
</p>
- </td>
- </tr>
-</table>
-</fieldset>
+ </td></tr></table></fieldset>
</form>
</div>
<?php
echo notepad_func();
?>
<div align="center">
-<form "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>
+<form 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="70" /> <br>
- <br>
+ <input type="text" name="subject" value="<?php echo $subject; ?>" size="80" maxlength="80" />
+ <br /><br />
<strong><?php echo _('Message:'); ?></strong><?php echo notepad_button('document.forms[1].body') ?><?php echo utils_requiredField(); ?><br />
<?php
} elseif ($this->Forum->allowAnonymous()) {
echo '<span class="error">';
printf(_('You could post if you were <a href="%1$s">logged in</a>.'), util_make_url ('/account/login.php?return_to='.urlencode(getStringFromServer('REQUEST_URI'))));
+ echo '</span>';
} elseif (!session_loggedin()) {
- echo '
- <span class="error">'.sprintf(_('Please <a href="%1$s">log in</a>'), util_make_url('/account/login.php?return_to='.urlencode(getStringFromServer('REQUEST_URI')))).'</span><br/></p>';
+ echo '<span class="error">';
+ printf(_('Please <a href="%1$s">log in</a>'), util_make_url('/account/login.php?return_to='.urlencode(getStringFromServer('REQUEST_URI'))));
+ echo '</span><br/></p>';
} else {
//do nothing
}
$msg_id = getIntFromRequest('msg_id');
$total_rows = getIntFromRequest('total_rows');
$ret_val = getIntFromRequest('ret_val');
+$reply = getIntFromRequest('reply', 1);
+
if ($msg_id) {
/*
exit_error(_('Error'),$fh->getErrorMessage());
}
+ if ($reply && !$f->userCanPost()) {
+ exit_permission_denied();
+ }
+
forum_header(array('title'=>$fm->getSubject(),'forum_id'=>$forum_id));
- $title_arr=array();
- $title_arr[]=_('Message').': '.$msg_id;
+// $title_arr=array();
+// $title_arr[]=_('Message').': '.$msg_id;
- echo $GLOBALS['HTML']->listTableTop ($title_arr);
+// echo $GLOBALS['HTML']->listTableTop ($title_arr);
- echo "<tr class=\"tablecontent\"><td>\n";
+ $url = util_make_url('/forum/message.php?msg_id='. $msg_id .'&group_id='.$group_id);
+
+ echo '<br /><br /><table border="0" width="100%" cellspacing="0">';
+ echo '<tr class="tablecontent"><td valign="top">'."\n";
+ echo '<strong>'.$fm->getSubject() .'</strong>';
+ if (!$reply) {
+ echo ' <a href="'.$url.'&reply=1">[ '._("reply").' ]</a>';
+ }
+ echo '<br />';
+ echo _("By:").' '. util_make_link_u($fm->getPosterName(), $fm->getPosterID(), $fm->getPosterRealName());
+ echo ' on '. date(_('Y-m-d H:i'), $fm->getPostDate()) .'</td><td align="right">';
+ echo '<a href="'.$url.'">[forum:'.$msg_id.']</a><br/>';
$fa = new ForumAdmin();
if ($f->userIsAdmin()) {
echo $fa->PrintAdminMessageOptions($msg_id,$group_id,0,$forum_id); // 0 in thread id because that tells us to go back to message.php instead of forum.php
}
- echo _('BY').': '. $fm->getPosterRealName() .' ('.util_make_link_u($fm->getPosterName(),$fm->getPosterID(),$fm->getPosterName()) .')<br />';
- echo _('DATE').': '. date(_('Y-m-d H:i'), $fm->getPostDate()) .'<br />';
$am = new AttachManager();
echo $am->PrintHelperFunctions();
- echo $am->PrintAttachLink($fm,$group_id,$forum_id) . '<br/>';
+ echo $am->PrintAttachLink($fm,$group_id,$forum_id) . '</td></tr><tr><td colspan="2"><br/><br />';
- echo _('SUBJECT').': '. $fm->getSubject() .'<p> </p>';
- if (!strstr('<',$fm->getBody())) {
- echo nl2br($fm->getBody()); //backwards compatibility for non html messages
+ if (strpos($fm->getBody(), '>') === false) {
+ echo util_make_links(nl2br($fm->getBody())); //backwards compatibility for non html messages
} else {
- echo $fm->getBody();
+ echo util_make_links($fm->getBody());
}
- echo "</td></tr>";
+ echo '</td></tr></table>';
- echo $GLOBALS['HTML']->listTableBottom();
+// echo $GLOBALS['HTML']->listTableBottom();
/*
}
$ret_val .= '<tr '. $GLOBALS['HTML']->boxGetAltRowStyle($total_rows) .'>
<td>'. $ah_begin .
- html_image('ic/msg.png',"10","12",array("border"=>"0"));
+ html_image('ic/msg.png',"10","12",array("border"=>"0")).' ';
/*
See if this message is new or not
If so, highlite it in bold
show the subject and poster
*/
$ret_val .= $bold_begin . $msg->getSubject() . $bold_end.$ah_end.'</td>'.
- '<td>'. $msg->getPosterRealName() .'</td>'.
+ '<td><a href="/users/'.$msg->getPosterName().'">'. $msg->getPosterRealName() .'</a></td>'.
'<td>'. date(_('Y-m-d H:i'),$msg->getPostDate()) .'</td></tr>';
if ($msg->hasFollowups()) {
echo $ret_val;
- /*
- Show post followup form
- */
-
-// echo '<p> <p>';
- echo '<div align="center"><h3>'._('Post a followup to this message').'</h3></div>';
-
- $fh->showPostForm($fm->getThreadID(), $msg_id, $fm->getSubject());
+ if ($reply) {
+ /*
+ Show post followup form
+ */
+ echo '<div align="center"><h3>'._('Post a followup to this message').'</h3></div>';
+ $fh->showPostForm($fm->getThreadID(), $msg_id, $fm->getSubject());
+ }
} else {
forum_header(array('title'=>_('Must Choose A Message First')));
}
if (getStringFromRequest('stop')) {
+ $confirm = getStringFromRequest('confirm');
+ $cancel = getStringFromRequest('cancel');
+ if ($cancel) {
+ header ("Location: /forum/forum.php?forum_id=$forum_id&group_id=$group_id");
+ exit;
+ }
+ if (!$confirm) {
+ forum_header(array('title'=>_('My Monitored Forums')));
+ echo $HTML->confirmBox('You are about to stop monitoring the '.$f->getName().
+ ' forum.<br/><br/>Do you really want to unsubscribe ?',
+ array('group_id' => $group_id, 'forum_id' => $forum_id, 'stop' => 1),
+ array('confirm' => 'Unsubscribe', 'cancel' => 'Cancel') );
+ forum_footer(array());
+ exit;
+ }
if (!$f->stopMonitor()) {
exit_error('Error',$f->getErrorMessage());
} else {
$user_id = user_getid();
$group_id = getIntFromRequest("group_id");
+
+// If the link comes from the project, display the project header. If it comes from the user page, display the normal site header
+if ($group_id) {
+ forum_header(array('title'=>_('My Monitored Forums')));
+} else {
+ site_header(array('title'=>_('My Monitored Forums'), 'user_id' => $user_id));
+}
+
+echo "<h1>" . _('My Monitored Forums') . "</h1>";
+
//get the user monitored forums
$result = db_query_params ('SELECT mon.forum_id, fg.group_id FROM forum_monitored_forums mon,forum_group_list fg where mon.user_id=$1 and fg.group_forum_id=mon.forum_id',
array ($user_id));
$monitored_forums[$i] = db_fetch_array($result);
}
-//if the link comes from the project, display the project header. If it comes from the user page, display the normal site header
-if ($group_id) {
- forum_header(array('title'=>_('My Monitored Forums')));
-} else {
- site_header(array('title'=>_('My Monitored Forums'), 'user_id' => $user_id));
-}
-
-echo "<h4>" . _('My Monitored Forums') . "</h4>";
$tablearr=array(_('Project'),_('Forum'),
_('Description'),_('Threads'),
_('Posts'), _('Last Post'), _('New Content?'));
$i = 0;
-
$f = array();
//CHECK : if we won't ever be needing to store each forum/fmf, etc for each pass, don't use an array and use the same variable like $fmf instead of $fmf[$i], etc
for($i=0;$i<sizeof($monitored_forums);$i++) {
return $ret;
}
+ function confirmBox($msg, $params, $buttons, $image='*none*') {
+ if ($image == '*none*') {
+ $image = html_image('stop.png','48','48',array());
+ }
+
+ foreach ($params as $b => $v) {
+ $prms[] = '<input type="hidden" name="'.$b.'" value="'.$v.'" />'."\n";
+ }
+ $prm = join(' ', $prms);
+
+ foreach ($buttons as $b => $v) {
+ $btns[] = '<input type="submit" name="'.$b.'" value="'.$v.'" />'."\n";
+ }
+ $btn = join(' '."\n ", $btns);
+
+ return '
+ <div id="infobox" style="margin-top: 15%; margin-left: 15%; margin-right: 15%; text-align: center;">
+ <table align="center">
+ <tr>
+ <td>'.$image.'</td>
+ <td>'.$msg.'<br/></td>
+ </tr>
+ <tr>
+ <td colspan="2" align="center">
+ <br />
+ <form action="' . getStringFromServer('PHP_SELF') . '" method="get" >
+ '.$prm.'
+ '.$btn.'
+ </form>
+ </td>
+ </tr>
+ </table>
+ </div>
+ ';
+ }
}
// Local Variables:
<table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
- <td class="mainCanvas"> <!-- main body area -->
+ <td id="main" class="mainCanvas"> <!-- main body area -->
<?php
}
font-family: courier, sans-serif
}
-td {
- text-align: left
-}
-
/* the style of the label on a box title */
.titlebar {
text-decoration: none;
{
function testSimplePost()
{
- $this->createProject('ProjectA');
-
// Create the first message (Message1/Text1).
- $this->open( BASE );
- $this->click("link=ProjectA");
- $this->waitForPageToLoad("30000");
+ $this->init();
$this->click("link=Forums");
$this->waitForPageToLoad("30000");
$this->assertFalse($this->isTextPresent("Permission denied."));
$this->waitForPageToLoad("30000");
$this->assertTrue($this->isTextPresent("Message1"));
}
+
+ /*
+ * Simulate a click on the link from a mail.
+ * As the forum is private, the users should be
+ * redirected to the login prompt saying that he has
+ * to login to get access to the message. Once logged,
+ * he should be redirected to the given forum.
+ */
+ function testSimpleAccessWhenPrivate()
+ {
+ $this->init();
+ $this->logout();
+
+ $this->open( ROOT.'/forum/message.php?msg_id=3' );
+ $this->waitForPageToLoad("30000");
+ $this->type("form_loginname", 'admin');
+ $this->type("form_pw", 'myadmin');
+ $this->click("login");
+ $this->waitForPageToLoad("30000");
+ $this->assertTrue($this->isTextPresent("Welcome to Developers"));
+ }
+
+ /*
+ * Simulate a user non logged that will reply
+ * to a message in a forum. He will be redirected
+ * to the login page, then will reply and then
+ * we check that his reply is present in the thread.
+ */
+ function testReplyToMessage()
+ {
+ $this->init();
+ $this->logout();
+
+ $this->open("/projects/projecta/");
+ $this->click("link=Forums");
+ $this->waitForPageToLoad("30000");
+ $this->click("link=open-discussion");
+ $this->waitForPageToLoad("30000");
+ $this->click("link=Welcome to Open-Discussion");
+ $this->waitForPageToLoad("30000");
+ $this->click("link=[ reply ]");
+ $this->waitForPageToLoad("30000");
+ $this->assertTrue($this->isTextPresent("Cookies must be enabled past this point."));
+// $this->assertEquals("ACOS Forge - Login", $this->getTitle());
+ $this->type("form_loginname", "admin");
+ $this->type("form_pw", 'myadmin');
+ $this->click("login");
+ $this->waitForPageToLoad("30000");
+ $this->type("body", "Here is my 19823 reply");
+ $this->click("submit");
+ $this->waitForPageToLoad("30000");
+ $this->assertTrue($this->isTextPresent("Message Posted Successfully"));
+ $this->click("link=Welcome to Open-Discussion");
+ $this->waitForPageToLoad("30000");
+ $this->assertTrue($this->isTextPresent("Here is my 19823 reply"));
+
+ }
+
+ /*
+ * Verify that it is imposible to use name already used by a mailing list
+ */
+ function testEmailAddressNotAlreadyUsed() {
+ $this->init();
+ $this->click("link=Mailing Lists");
+ $this->waitForPageToLoad("30000");
+ $this->click("//td[@id='main']/p[1]/strong/a");
+ $this->waitForPageToLoad("30000");
+ $this->click("link=Add Mailing List");
+ $this->waitForPageToLoad("30000");
+ $this->type("list_name", "toto");
+ $this->type("description", "Toto mailing list");
+ $this->click("submit");
+ $this->waitForPageToLoad("30000");
+ $this->assertTrue($this->isTextPresent("List Added"));
+ $this->click("link=Forums");
+ $this->waitForPageToLoad("30000");
+ $this->click("link=open-discussion");
+ $this->waitForPageToLoad("30000");
+ $this->click("//td[@id='main']/p[1]/strong/a[2]");
+ $this->waitForPageToLoad("30000");
+ $this->click("link=Add forum");
+ $this->waitForPageToLoad("30000");
+ $this->type("forum_name", "toto");
+ $this->type("description", "Toto forum");
+ $this->click("submit");
+ $this->waitForPageToLoad("30000");
+ $this->assertTrue($this->isTextPresent("Error: a mailing list with the same email address already exists"));
+ }
}
?>
// $this->test->assertFalse($this->isTextPresent("Warning: Missing argument"));
// }
+ protected function init() {
+ $this->createProject('ProjectA');
+
+ $this->open( BASE );
+ $this->click("link=ProjectA");
+ $this->waitForPageToLoad("30000");
+ }
+
protected function login($username)
{
if ($username == 'admin') {