diff --git a/html/inc/bbcode_html.inc b/html/inc/bbcode_html.inc index a5bf352815d..f1118fe9403 100644 --- a/html/inc/bbcode_html.inc +++ b/html/inc/bbcode_html.inc @@ -5,47 +5,44 @@ require_once("../inc/util.inc"); $bbcode_js = ""; $bbcode_html = ' - - - - - - - - - - - - - - - - -  '.tra("Font color").': - -  '.tra("Font size").': - -   - '.tra("Close Tags").' - - +

+ + + + + + + + + + +

+  '.tra("Font color").': + +  '.tra("Font size").': + +   + '.tra("Close Tags").' +

'; + +?> diff --git a/html/inc/forum.inc b/html/inc/forum.inc index 674ac440762..7f2f1138846 100644 --- a/html/inc/forum.inc +++ b/html/inc/forum.inc @@ -24,6 +24,7 @@ require_once("../inc/news.inc"); require_once("../inc/text_transform.inc"); define('THREADS_PER_PAGE', 50); +define('FORUM_LH_PCT', '25%'); // width of LH column $forum_error = ""; // for functions that return null on error, @@ -59,8 +60,10 @@ define('AVATAR_HEIGHT',100); define('ST_NEW_TIME', 1209600); //3600*24*14 - 14 days define('ST_NEW', 'New member'); -define('MAXIMUM_EDIT_TIME',3600); - // allow edits of forums posts up till one hour after posting. +if (!defined('MAXIMUM_EDIT_TIME')) { + define('MAXIMUM_EDIT_TIME', 3600); + // allow edits of forums posts up till one hour after posting. +} define('MAX_FORUM_LOGGING_TIME', 2419200); //3600*24*28 - 28 days define('NO_CONTROLS', 0); @@ -192,11 +195,11 @@ function forum_title($category, $forum, $thread, $link_thread=false) { $forum->title ); } else if ($forum && $thread) { - $x .= sprintf('%s :', + $x .= sprintf('%s : ', $top_url, $where ); - $x .= sprintf('%s :', + $x .= sprintf('%s : ', $forum->id, $forum->title ); @@ -781,30 +784,29 @@ function show_post_and_context($post, $thread, $forum, $options, $n) { } else { $deleted = ""; } - echo " - - - $n) - "; switch ($forum->parent_type) { case 0: $category = BoincCategory::lookup_id($forum->category); - echo forum_title($category, $forum, $thread, true); + $title= forum_title($category, $forum, $thread, true); break; case 1: - echo team_forum_title($forum); + $title= team_forum_title($forum); break; } - echo " - (id."&postid=".$post->id."\">".tra("Message %1", $post->id).") -
- ".tra("Posted %1 by %2", $when, user_links($user))." $deleted -
- Post: -


+ row_array([ + sprintf( + '%d) %s +
%s +
%s%s + ', + $n, $title, + $thread->id, $post->id, + tra("Message %1", $post->id), + tra("Posted %1 by %2", $when, user_links($user)), + $deleted + ), $content - - "; + ]); } function is_banished($user) { @@ -858,9 +860,7 @@ function post_rules() { } function post_warning($forum=null) { - $x = "

-
- "; + $x = '

'; // let projects add extra instructions in specific forums, // e.g. Questions and Problems @@ -873,7 +873,7 @@ function post_warning($forum=null) { ".post_rules()." -
+ "; return $x; } @@ -1005,7 +1005,6 @@ function create_thread($title, $content, $user, $forum, $signature, $export) { create_post($content, 0, $user, $forum, $thread, $signature); $forum->update("threads=threads+1"); notify_forum_subscribers($forum, $user); - exit; return $thread; } diff --git a/html/inc/pm.inc b/html/inc/pm.inc index 9d489ab1948..b20d6d3fe5c 100644 --- a/html/inc/pm.inc +++ b/html/inc/pm.inc @@ -20,6 +20,8 @@ require_once("boinc_db.inc"); require_once("sanitize_html.inc"); require_once("bbcode_html.inc"); +define('PM_LH_PCT', '30%'); + function pm_header() { echo "
\n"; echo " ".tra("Inbox")."\n"; @@ -29,7 +31,7 @@ function pm_header() { function pm_rules() { if (defined('PM_RULES')) return PM_RULES; - $x = "
"; + $x = '

'; $x .= tra("

  • Messages may not contain content that is obscene, hate-related, @@ -45,7 +47,7 @@ function pm_rules() {
  • If your account is suspended, don't create a new one.
"); - $x .= "
\n"; + $x .= ""; return $x; } @@ -82,25 +84,25 @@ function pm_team_form($user, $teamid, $error=null) { row2( tra("Subject"), "", - null, '20%' + null, PM_LH_PCT ); - row2_init(tra("Message")."".bbcode_info()."", '20%'); - start_table(); - echo $bbcode_html; - echo "\n"; - echo ""; - echo "\n"; - end_table(); - echo sprintf( - ' - - - - ', - button_style('blue'), - tra("Preview"), - button_style(), - tra("Send message") + row2( + tra("Message")."".bbcode_info()."", + $bbcode_html."", + null, PM_LH_PCT + ); + row2( + '', + sprintf( + ' + + ', + button_style('blue'), + tra("Preview"), + button_style(), + tra("Send message") + ), + null, PM_LH_PCT ); end_table(); page_tail(); @@ -174,24 +176,33 @@ function pm_form_page($replyto, $userid, $error = null) { '', $writeto ), - null, '20%' + null, PM_LH_PCT ); row2( tra("Subject"), - "", - null, '20%' + "", + null, PM_LH_PCT ); - row2_init( + row2( tra("Message")."".bbcode_info().pm_rules()."", - '20%' + sprintf( + '%s ', + $bbcode_html, + $content + ), + null, PM_LH_PCT + ); + row2( + '', + sprintf( + ' + + ', + tra("Preview"), + tra("Send message") + ), + null, PM_LH_PCT ); - start_table(); - echo $bbcode_html; - echo "\n"; - echo ""; - echo "\n"; - end_table(); - echo " \n"; end_table(); page_tail(); diff --git a/html/inc/text_transform.inc b/html/inc/text_transform.inc index 99e3d9e75f9..b208782064f 100644 --- a/html/inc/text_transform.inc +++ b/html/inc/text_transform.inc @@ -296,12 +296,12 @@ function externalize_links($text) { $linkpos=true; $out = ""; while (true){ - //Find a link + // Find a link // $linkpos=strpos($text, ". -// Using this page you can edit a post. -// First it displays a box to edit in, and when you submit the changes -// it will call the methods on the post to make the changes. -// +// Edit a post. +// The creator of the post can do this up to MAXIMUM_EDIT_TIME require_once('../inc/forum.inc'); require_once('../inc/bbcode_html.inc'); @@ -91,7 +89,6 @@ page_head(tra("Edit post"),'','','', $bbcode_js); -show_forum_header($logged_in_user); switch ($forum->parent_type) { case 0: $category = BoincCategory::lookup_id($forum->category); @@ -112,45 +109,59 @@ function() use($content) { ); } -echo "
id."\" method=\"POST\" name=\"post\" onsubmit=\"return checkForm(this)\">\n"; +echo sprintf( + '', + $post->id +); echo form_tokens($logged_in_user->authenticator); start_table(); row1(tra("Edit your message")); if ($can_edit_title) { - //If this is the user can edit the thread title display a way of doing so - if ($preview) { - row2( - tra("Title").bbcode_info(), - "" - ); - } else { - row2( - tra("Title").bbcode_info(), - '' - ); - } -}; - -if ($preview) { row2( - tra("Message").bbcode_info().post_warning(), - start_table_str().$bbcode_html.end_table_str()."" - ); -} else { - row2( - tra("Message").bbcode_info().post_warning(), - start_table_str().$bbcode_html.end_table_str().'' + tra("Title").bbcode_info(), + sprintf( + '', + 80, + htmlspecialchars($preview?$title:$thread->title) + ), + null, FORUM_LH_PCT ); } -if ($post->signature) { - $enable_signature="checked=\"true\""; -} else { - $enable_signature=""; -} -row2("", " - "); -row2("", " " +row2( + sprintf('%s %s %s', + tra("Message"), + bbcode_info(), + post_warning() + ), + sprintf( + '%s ', + $bbcode_html, + 12, + 80, + htmlspecialchars($preview?$content:$post->content) + ), + null, FORUM_LH_PCT +); + +row2("", + sprintf( + ' + + ', + $post->signature?'checked="true"':'', + tra("Add my signature to this post") + ), + null, FORUM_LH_PCT +); +row2("", + sprintf( + ' +   + ', + tra("Preview") + ), + null, FORUM_LH_PCT ); end_table(); diff --git a/html/user/forum_forum.php b/html/user/forum_forum.php index 3b0ab7ba866..234bc661145 100644 --- a/html/user/forum_forum.php +++ b/html/user/forum_forum.php @@ -67,11 +67,7 @@ function forum_page($forum, $user, $msg=null) { switch ($forum->parent_type) { case 0: $category = BoincCategory::lookup_id($forum->category); - if ($category->is_helpdesk) { - page_head(tra("Questions and Answers").' : '.$forum->title); - } else { - page_head(tra("Message boards").' : '.$forum->title); - } + page_head(sprintf("%s '%s'", tra("Forum"), $forum->title)); if ($msg) echo "

$msg

\n"; show_forum_header($user); echo forum_title($category, $forum, NULL); diff --git a/html/user/forum_post.php b/html/user/forum_post.php index 22bef9e12b6..45642127e2b 100644 --- a/html/user/forum_post.php +++ b/html/user/forum_post.php @@ -57,7 +57,7 @@ $warning = null; if ($content && $title && (!$preview)){ - if (post_str('add_signature', true) == "add_it"){ + if (post_str('add_signature', true)) { $add_signature = true; // set a flag and concatenate later } else { $add_signature = false; @@ -71,6 +71,9 @@ $title, $content, $logged_in_user, $forum, $add_signature, $export ); if ($thread) { + if (post_str('subscribe', true)) { + BoincSubscription::replace($logged_in_user->id, $thread->id); + } header('Location: forum_thread.php?id=' . $thread->id); } else { error_page("Can't create thread. $forum_error"); @@ -120,36 +123,71 @@ function() use($content, $title) { } if ($force_title && $title){ - row2(tra("Title"), htmlspecialchars($title).""); + row2( + tra("Title"), + sprintf( + '%s ', + htmlspecialchars($title), + htmlspecialchars($title) + ), + null, FORUM_LH_PCT + ); } else { - row2(tra("Title").$submit_help, + row2( + tra("Title").$submit_help, sprintf('', $title?htmlspecialchars($title):'' - ) + ), + null, FORUM_LH_PCT ); } -row2_init(tra("Message").bbcode_info().post_warning($forum).$body_help); -start_table(); -echo $bbcode_html; -end_table(); -echo sprintf('', - $content?htmlspecialchars($content):'' +row2( + tra("Message").bbcode_info().post_warning($forum).$body_help, + sprintf( + '%s ', + $bbcode_html, + $content?htmlspecialchars($content):'' + ), + null, FORUM_LH_PCT ); -echo ""; if (!$logged_in_user->prefs->no_signature_by_default) { - $enable_signature="checked=\"true\""; + $enable_signature = 'checked="true"'; } else { - $enable_signature=""; + $enable_signature=''; } if (is_news_forum($forum)) { - row2("", " ".tra("Show this item as a Notice in the BOINC Manager")."

".tra("Do so only for items likely to be of interest to all volunteers.")."

"); + row2("", + sprintf( + ' %s +

%s

', + tra("Show this item as a Notice in the BOINC Manager"), + tra("Do so only for items likely to be of interest to all volunteers.") + ), + null, FORUM_LH_PCT + ); } -row2("", " ".tra("Add my signature to this post")); -row2("", " "); +row2("", + sprintf( + ' + +     + + +     + + ', + tra("Preview"), + tra("OK"), + $enable_signature, + tra("Add my signature to this post"), + tra("Subscribe to the new thread") + ), + null, FORUM_LH_PCT +); end_table(); diff --git a/html/user/forum_reply.php b/html/user/forum_reply.php index 0449173fa86..8420f8fae5b 100644 --- a/html/user/forum_reply.php +++ b/html/user/forum_reply.php @@ -16,8 +16,11 @@ // You should have received a copy of the GNU Lesser General Public License // along with BOINC. If not, see . -// Post a reply to a thread. -// Both input (form) and action take place here. +// Post to a thread (possibly replying to an existing post). +// Both form and action are here. +// +// Note: the filename is confusing: +// we "reply" to a post, not a thread require_once('../inc/util.inc'); require_once('../inc/forum_email.inc'); @@ -69,21 +72,20 @@ $warning = null; if ($content && (!$preview)){ - if (post_str('add_signature',true)=="add_it"){ - $add_signature=true; // set a flag and concatenate later - } else { - $add_signature=false; - } check_tokens($logged_in_user->authenticator); if (!akismet_check($logged_in_user, $content)) { $warning = tra("Your post has been flagged as spam by the Akismet anti-spam system. Please modify your text and try again."); $preview = tra("Preview"); } else { + $add_signature = post_str('add_signature', true); $post_id = create_post( $content, $parent_post_id, $logged_in_user, $forum, $thread, $add_signature ); if ($post_id) { + if (post_str('subscribe', true)) { + BoincSubscription::replace($logged_in_user->id, $thread->id); + } header("Location: forum_thread.php?id=$thread->id&postid=$post_id"); } else { error_page("Can't create post. $forum_error"); @@ -91,9 +93,15 @@ } } -page_head(tra("Post to thread"),'','','', $bbcode_js); +page_head(tra("Post to thread")." '$thread->title'",'','','', $bbcode_js); -show_forum_header($logged_in_user); +if ($parent_post) { + echo sprintf( + '

Replying to message %d

', + $parent_post->id, + $parent_post->id + ); +} if ($warning) { echo "

$warning

"; @@ -144,9 +152,6 @@ function show_message_row($thread, $parent_post) { $x1 = tra("Message:").bbcode_info().post_warning(); $x2 = ""; - if ($parent_post) { - $x2 .=" ".tra("reply to %1 Message ID %2:", "id.">", " ".$parent_post->id.""); - } $x2 .= "id; if ($parent_post) { @@ -155,7 +160,7 @@ function show_message_row($thread, $parent_post) { $x2 .= " method=\"post\" name=\"post\" onsubmit=\"return checkForm(this)\">\n"; $x2 .= form_tokens($logged_in_user->authenticator); - $x2 .= start_table_str().$bbcode_html.end_table_str()."