diff --git a/checkin_notes b/checkin_notes index 797320d06f..8cffb0b3bb 100644 --- a/checkin_notes +++ b/checkin_notes @@ -10254,3 +10254,17 @@ Rom 17 Dec 2009 clientgui/ Events.h + +David 17 Dec 2009 + - web: some fixes that arose from converting BOINC's news + to forum format. + + html/ + inc/ + text_transform.inc + forum.inc + news.inc + ops/ + news_convert.php + user/ + forum_forum.php diff --git a/doc/addon_item.php b/doc/addon_item.php index 7731b09d54..981a630f81 100644 --- a/doc/addon_item.php +++ b/doc/addon_item.php @@ -54,7 +54,7 @@ if ($platform == 'win') { } else if ($platform == 'web') { $x = $web; } else { - error_page('bad name'); + boinc_error_page('bad name'); } $found = false; @@ -66,7 +66,7 @@ foreach ($x as $y) { } } if (!$found) { - error_page('bad item'); + boinc_error_page('bad item'); } ?> diff --git a/doc/boinc_news.php b/doc/boinc_news.php index 64f91ffa52..9182a25077 100644 --- a/doc/boinc_news.php +++ b/doc/boinc_news.php @@ -1,4 +1,4 @@ - +"; -} - -function end_table() { - echo "\n"; -} - function list_start($attrs = 'width="100%"') { echo "
\n";
}
-function error_page($x) {
+function boinc_error_page($x) {
page_head("Error");
echo $x;
page_tail();
@@ -214,31 +208,8 @@ function block_end() {
";
}
-function get_str($name) {
- if (isset($_GET[$name])) {
- $x = $_GET[$name];
- $x = trim($x);
- return mysql_real_escape_string($x);
- }
- return null;
-}
-
function show_link($url) {
echo "
$url";
}
-function parse_element($xml, $tag) {
- $element = null;
- $closetag = "" . substr($tag,1);
- $x = strstr($xml, $tag);
- if ($x) {
- if (strstr($tag, "/>")) return $tag;
- $y = substr($x, strlen($tag));
- $n = strpos($y, $closetag);
- if ($n) {
- $element = substr($y, 0, $n);
- }
- }
- return trim($element);
-}
?>
diff --git a/doc/download_all.php b/doc/download_all.php
index 051a4ba7d9..2a6311d152 100644
--- a/doc/download_all.php
+++ b/doc/download_all.php
@@ -146,7 +146,7 @@ function show_platform_xml($short_name, $p, $dev) {
if ($pname && $version) {
$p = $platforms[$pname];
if (!$p) {
- error_page("platform not found");
+ boinc_error_page("platform not found");
}
$long_name = $p["name"];
$va = $p["versions"];
@@ -158,7 +158,7 @@ if ($pname && $version) {
exit();
}
}
- error_page( "version not found\n");
+ boinc_error_page( "version not found\n");
}
if ($xml) {
diff --git a/doc/help_vol.php b/doc/help_vol.php
index 73f608c988..3fc96f1b14 100644
--- a/doc/help_vol.php
+++ b/doc/help_vol.php
@@ -118,16 +118,16 @@ if ($send_email) {
$subject = stripslashes($_GET['subject']);
$vol = vol_lookup($volid);
if (!$vol || $vol->hide) {
- error_page("No such volunteer $volid");
+ boinc_error_page("No such volunteer $volid");
}
$msg = stripslashes($_GET['message']);
if (!$msg) {
- error_page("You must supply a message");
+ boinc_error_page("You must supply a message");
}
$body = "The following message was sent by a BOINC Help user.\n";
$email_addr = $_GET['email_addr'];
if (!is_valid_email_addr($email_addr)) {
- error_page("You must specify a valid email address");
+ boinc_error_page("You must specify a valid email address");
}
$reply = "\r\nreply-to: $email_addr";
$body .= "\n\n";
@@ -141,15 +141,15 @@ if ($send_email) {
$volid = $_GET['volid'];
$vol = vol_lookup($volid);
if (!$vol) {
- error_page("No such volunteer $volid");
+ boinc_error_page("No such volunteer $volid");
}
$x = $_GET['rating'];
if ($x==null) {
- error_page("no rating given");
+ boinc_error_page("no rating given");
}
$rating = (int) $x;
if ($rating < 0 || $rating > 5) {
- error_page("bad rating");
+ boinc_error_page("bad rating");
}
$comment = stripslashes($_GET['comment']);
$r = null;
@@ -173,7 +173,7 @@ if ($send_email) {
}
if (!$retval) {
echo mysql_error();
- error_page("database error");
+ boinc_error_page("database error");
}
page_head("Feedback recorded");
echo "Your feedback has been recorded. Thanks.
diff --git a/doc/help_vol_edit.php b/doc/help_vol_edit.php
index 1ec2cee689..f6ea6ecc6f 100644
--- a/doc/help_vol_edit.php
+++ b/doc/help_vol_edit.php
@@ -79,27 +79,27 @@ function print_form($vol, $action_name) {
function get_form_data() {
$vol->name = stripslashes($_GET['volname']);
- if (!$vol->name) error_page("Name must not be blank");
- if (strstr($vol->name, "<")) error_page("No < allowed");
+ if (!$vol->name) boinc_error_page("Name must not be blank");
+ if (strstr($vol->name, "<")) boinc_error_page("No < allowed");
$vol->password = stripslashes($_GET['password']);
- if (!$vol->password) error_page("Password must not be blank");
+ if (!$vol->password) boinc_error_page("Password must not be blank");
$vol->email_addr = stripslashes($_GET['email_addr']);
- if (!$vol->email_addr) error_page("Email address must not be blank");
+ if (!$vol->email_addr) boinc_error_page("Email address must not be blank");
$vol->skypeid = stripslashes($_GET['skypeid']);
- if (!$vol->skypeid) error_page("Skype ID must not be blank");
+ if (!$vol->skypeid) boinc_error_page("Skype ID must not be blank");
$vol->lang1 = stripslashes($_GET['lang1']);
- if (!$vol->lang1) error_page("Primary language must not be blank");
- if (!is_spoken_language($vol->lang1)) error_page("Not a language");
+ if (!$vol->lang1) boinc_error_page("Primary language must not be blank");
+ if (!is_spoken_language($vol->lang1)) boinc_error_page("Not a language");
$vol->lang2 = stripslashes($_GET['lang2']);
- if (!is_spoken_language($vol->lang2)) error_page("Not a language");
+ if (!is_spoken_language($vol->lang2)) boinc_error_page("Not a language");
$vol->country = stripslashes($_GET['country']);
- if (!is_valid_country($vol->country)) error_page("Bad country");
+ if (!is_valid_country($vol->country)) boinc_error_page("Bad country");
$vol->specialties = stripslashes($_GET['specialties']);
- if (strstr($vol->specialties, "<")) error_page("No < allowed");
+ if (strstr($vol->specialties, "<")) boinc_error_page("No < allowed");
$vol->projects = stripslashes($_GET['projects']);
- if (strstr($vol->projects, "<")) error_page("No < allowed");
+ if (strstr($vol->projects, "<")) boinc_error_page("No < allowed");
$vol->availability = stripslashes($_GET['availability']);
- if (strstr($vol->availability, "<")) error_page("No < allowed");
+ if (strstr($vol->availability, "<")) boinc_error_page("No < allowed");
$vol->voice_ok = $_GET['voice_ok']?1:0;
$vol->text_ok = $_GET['text_ok']?1:0;
$vol->hide = $_GET['hide']?1:0;
@@ -125,11 +125,11 @@ if ($create == 'OK') {
$vol2 = vol_lookup_name($vol->name);
if ($vol2) {
- error_page("That name is already taken");
+ boinc_error_page("That name is already taken");
}
$vol2 = vol_lookup_email($vol->email_addr);
if ($vol2) {
- error_page("There's already an account with email address $vol->email_addr");
+ boinc_error_page("There's already an account with email address $vol->email_addr");
}
$retval = vol_insert($vol);
if (!$retval) {
@@ -168,14 +168,14 @@ if ($create == 'OK') {
$password = stripslashes($_GET['password']);
$vol = vol_lookup_email($email_addr);
if (!$vol) {
- error_page("Bad email address $email_addr");
+ boinc_error_page("Bad email address $email_addr");
}
if (!$password) {
email_password($vol);
exit();
}
if ($password != $vol->password) {
- error_page("Bad password");
+ boinc_error_page("Bad password");
}
page_head("Edit your Help Volunteer Account");
echo "
@@ -191,10 +191,10 @@ if ($create == 'OK') {
$old_password = stripslashes($_GET['old_password']);
$vol = vol_lookup_email($old_email_addr);
if (!$vol) {
- error_page("Bad email address $old_email_addr");
+ boinc_error_page("Bad email address $old_email_addr");
}
if ($old_password != $vol->password) {
- error_page("Bad password");
+ boinc_error_page("Bad password");
}
$vol2 = get_form_data();
$vol2->timezone = $vol->timezone;
diff --git a/doc/index.php b/doc/index.php
index 372ac337a0..d80f0432d3 100644
--- a/doc/index.php
+++ b/doc/index.php
@@ -57,8 +57,8 @@ function show_totals() {
}
function show_news_items() {
- require_once("boinc_news.php");
require_once("../html/inc/news.inc");
+ require_once("../html/inc/forum.inc");
echo "
@@ -66,15 +66,8 @@ function show_news_items() {
".tra("News")."
";
- $nnews_items = 6;
- show_news($project_news, $nnews_items);
- if (count($project_news) > $nnews_items) {
- echo "".tra("... more")."\n";
- }
-
- echo " "; - printf(tra('News is available as an %sRSS feed%s'), '', ''); - echo " + show_news(0, 5); + echo " |
diff --git a/html/inc/text_transform.inc b/html/inc/text_transform.inc index b6e17d43a7..bb0154949e 100644 --- a/html/inc/text_transform.inc +++ b/html/inc/text_transform.inc @@ -41,7 +41,7 @@ class output_options { $this->images_as_links = 0; $this->link_popup = 0; $this->nl2br = 1; - $this->htmlitems = 1; + $this->htmlitems = 0; $this->htmlscrub = 0; $this->highlight_terms = 0; return true; @@ -114,12 +114,12 @@ function bb2html($text, $export=false) { "@\[b\](.*?)\[/b\]@is", "@\[i\](.*?)\[/i\]@is", "@\[u\](.*?)\[/u\]@is", - "@\[url=$httpsregex\](.*?)\[/url\]@i", - "@\[url\]$httpsregex\[/url\]@i", - "@\[link=$urlregex\](.*?)\[/link\]@i", - "@\[link\]$urlregex\[/link\]@i", - "@\[url=$urlregex\](.*?)\[/url\]@i", - "@\[url\]$urlregex\[/url\]@i", + "@\[url=$httpsregex\](.*?)\[/url\]@is", + "@\[url\]$httpsregex\[/url\]@is", + "@\[link=$urlregex\](.*?)\[/link\]@is", + "@\[link\]$urlregex\[/link\]@is", + "@\[url=$urlregex\](.*?)\[/url\]@is", + "@\[url\]$urlregex\[/url\]@is", "@\[quote=(.*?)\](.*?)\[/quote\]@is", "@\[quote\](.*?)\[/quote\]@is", "@\[list\](.*?)\[/list\]@is", diff --git a/html/ops/news_convert.php b/html/ops/news_convert.php index c0cd1e75c3..8547fbbb53 100755 --- a/html/ops/news_convert.php +++ b/html/ops/news_convert.php @@ -86,8 +86,10 @@ foreach (array_reverse($project_news) as $item) { } $when = strtotime($item[0]); $title = html_to_bbcode($title); + $title = str_replace("\n", " ", $title); $title = mysql_real_escape_string($title); $content = html_to_bbcode($content); + $content = str_replace("\n", " ", $content); $content = mysql_real_escape_string($content); $thread_id = BoincThread::insert("(forum, owner, title, create_time, timestamp, replies) values ($forum_id, $user->id, '$title', $when, $when, 0)"); diff --git a/html/user/forum_forum.php b/html/user/forum_forum.php index 0d3c23be2c..260e28df6c 100644 --- a/html/user/forum_forum.php +++ b/html/user/forum_forum.php @@ -193,12 +193,11 @@ function show_forum($forum, $start, $sort_style, $user) { echo ""; $titlelength = 48; - $title = strip_tags(bb2html($thread->title)); + $title = cleanup_title($thread->title); if (strlen($title) > $titlelength) { - $title = substr($title,0,$titlelength)."..."; + $title = substr($title, 0, $titlelength)."..."; } - $title = cleanup_title($title); - echo '