profile picture verification

svn path=/trunk/boinc/; revision=8169
This commit is contained in:
David Anderson 2005-09-25 05:47:48 +00:00
parent 66ef4a6b49
commit 5d9e3a61fd
4 changed files with 75 additions and 40 deletions

View File

@ -11931,6 +11931,13 @@ Rom 20 Sept 2005 (staging)
- Tag for 5.1.4 release, all platforms
boinc_core_release_5.1.4
David 20 Sept 2005
- various fixes to bbcode_convert.php.
Ran it on SETI@Home message boards; seems to work OK
html/ops/
bbcode_convert.php
Charlie 20 Sept 2005
- Mac: Add BOINC library version number to backtrace.
@ -12096,3 +12103,12 @@ Jeff 23 Sept 2005
dir_hier_move.C
dir_hier_path.C
David 24 Sept 2005
- comment out profile picture verification stuff
html/
inc/
profile.inc
util.inc
ops/
bbconvert.php

View File

@ -19,6 +19,14 @@ define('MAX_DESC_LENGTH', 90);
define('GALLERY_WIDTH', 7);
define('GALLERY_HEIGHT', 4);
function profile_error_page($str) {
page_head("Profile error");
echo "$str<br>\n";
echo "<p>Click your browser's <b>Back</b> button to try again.\n<p>\n";
page_tail();
exit();
}
// output a select form item with the given name,
// from a list of newline-delineated items from the text file.
// If $selection is provided, and if it matches one of the entries in the file,
@ -116,6 +124,7 @@ function show_textarea($name, $text) {
// user the verification status of their profile.
//
function offensive_profile_warning($verify_flag) {
return;
if ($verify_flag == 0) {
return "
<font size='+2' color='33cc33'>
@ -258,7 +267,6 @@ function process_create_results($user, $profile) {
$result = mysql_query($query);
if (!$result) {
profile_error_page("Couldn't update profile: database error");
exit();
}
} else {
$query = 'INSERT INTO profile SET '
@ -271,7 +279,6 @@ function process_create_results($user, $profile) {
$result = mysql_query($query);
if (!$result) {
profile_error_page("Couldn't create profile: database error");
exit();
}
mysql_query("update user set has_profile=1 where id=$user->id");
}
@ -299,7 +306,6 @@ function getImages($fileName) {
break;
default:
profile_error_page("The format of your uploaded image is not supported by our system.");
exit();
}
$width = $size[0];
@ -403,7 +409,8 @@ function show_user_table($members, $offset, $numToDisplay, $cols) {
echo "<td class=bordered width=7% height=64><center>";
// Only link an image if the user has uploaded one.;
if ($profile->has_picture && $profile->verification==1) {
//if ($profile->has_picture && $profile->verification==1) {
if ($profile->has_picture) {
echo "<a href=\"", URL_BASE, "view_profile.php?userid={$members[$count]}\"><img src=\"", URL_BASE, IMAGE_URL, "{$members[$count]}_sm.jpg\"></a>";
} else {
@ -453,7 +460,6 @@ function show_profile($userid, $verify_mode = FALSE) {
if (!$user) {
profile_error_page("No user exists for that ID, or there was a database error.<p>");
exit();
}
$profile = get_profile($userid);
if (!$profile) {
@ -485,7 +491,8 @@ function show_profile($userid, $verify_mode = FALSE) {
// - user is viewing/editing it
// - profile has been approved by sysadmin
//
if ($profile->has_picture && ($verify_mode || $can_edit || $profile->verification==1)) {
//if ($profile->has_picture && ($verify_mode || $can_edit || $profile->verification==1)) {
if ($profile->has_picture) {
echo "
<tr><td colspan=2 align=center>
<img vspace=6 hspace=9 src=\"" , URL_BASE, IMAGE_URL , $user->id , '.jpg' . "\">
@ -497,9 +504,9 @@ function show_profile($userid, $verify_mode = FALSE) {
// yet verified. This will tell them if other users can't view it yet, or
// if there is a problem with it and they need to replace it.
//
if ($can_edit && $profile->verification!=1) {
row1(offensive_profile_warning($profile->verification));
}
//if ($can_edit && $profile->verification!=1) {
// row1(offensive_profile_warning($profile->verification));
//}
show_user_summary_public($user);

View File

@ -142,13 +142,6 @@ function db_error_page() {
page_tail();
}
function profile_error_page($str) {
page_head("Profile error");
echo "$str<br>\n";
echo "<p>Click your browser's <b>Back</b> button to try again.\n<p>\n";
page_tail();
}
function error_page($msg) {
page_head("Unable to handle request");
echo $msg;

View File

@ -4,16 +4,17 @@ require_once("../inc/util.inc");
require_once('../inc/sanitize_html.inc');
db_init();
set_time_limit(0);
function image_as_bb($text){
/* This function depends on sanitized HTML */
// Build some regex (should be a *lot* faster)
$pattern = '@<img src=\"([^>]+)\">@si'; // Gives us the URL in ${1}...
$replacement = '[img]${1}[/img]'; // Turns that URL into a hyperlink
// This function depends on sanitized HTML
$pattern = '@<img(.*) src=\"([^>^"]+)\"([^>]*)>@si';
$replacement = '[img]$2[/img]';
$text = preg_replace($pattern, $replacement, $text);
$pattern = "@<img src='([^>]+)'>@si"; // Gives us the URL in ${1}...
$replacement = '[img]${1}[/img]'; // Turns that URL into a hyperlink
$pattern = "@<img(.*) src='([^>^']+)'([^>]*)>@si";
$replacement = '[img]$2[/img]';
$text = preg_replace($pattern, $replacement, $text);
return $text;
@ -22,15 +23,15 @@ function image_as_bb($text){
function link_as_bb($text){
/* This function depends on sanitized HTML */
// Build some regex (should be a *lot* faster)
$pattern = '@<a href=\"([^>]+)\">@si'; // Gives us the URL in ${1}...
$replacement = '[url="${1}"]'; // Turns that URL into a hyperlink
$pattern = '@<a href=\"([^>]+)\">@si'; // Gives us the URL in $1...
$replacement = '[url=$1]'; // Turns that URL into a hyperlink
$text = preg_replace($pattern, $replacement, $text);
$pattern = "@<a href='([^>]+)'>@si"; // Gives us the URL in ${1}...
$replacement = '[url="${1}"]'; // Turns that URL into a hyperlink
$pattern = "@<a href='([^>]+)'>@si"; // Gives us the URL in $1...
$replacement = '[url=$1]'; // Turns that URL into a hyperlink
$text = preg_replace($pattern, $replacement, $text);
$pattern = "@</a>@si"; // Gives us the URL in ${1}...
$replacement = '[/url]'; // Turns that URL into a hyperlink
$pattern = "@</a>@si";
$replacement = '[/url]';
$text = preg_replace($pattern, $replacement, $text);
return $text;
}
@ -59,6 +60,9 @@ function formatting_as_bb($text){
$in[]="</pre>";$out[]="[/pre]";
$in[]="<br>";$out[]="\n";
$in[]="&gt;";$out[]=">";
$in[]="&lt;";$out[]="<";
$in[]="&amp;";$out[]="&";
return str_replace($in, $out, $text);
}
@ -71,31 +75,46 @@ function fix_text($text) {
return $text;
}
function fix_post($post) {
$text = fix_text($post->content);
if ($text != $post->content) {
$query = "update post set content = '".mysql_escape_string($text)."' where id=".$post->id;
//echo "$post->content\n\n";
//echo "$post->thread $query\n\n";
$retval = mysql_query($query);
if (!$retval) {
echo mysql_error();
exit();
}
}
}
function fix_posts() {
$start_id = 0; //Set this to something else if you like
$posts = mysql_query("select * from post where id>$start_id order by id");
echo mysql_error();
$i=0;
while ($thispost = mysql_fetch_object($posts)){
while ($post = mysql_fetch_object($posts)){
$i++;
if ($i%100 == 0) { //For every 100 posts
echo $thispost->id.". "; flush(); // print out where we are
usleep(200000); // Wait a short amount of time (1/5 sec) to give other DB queries a chance
echo $post->id.". "; flush(); // print out where we are
//usleep(200000);
}
if ($thispost->id > $start_id){
$text = fix_text($thispost->content);
if ($text != $thispost->content) {
$query = "update low_priority post set content = '".mysql_escape_string($text)."' where id=".$thispost->id;
//echo $query;
//exit();
mysql_query($query);
echo mysql_error();
}
if ($post->id > $start_id){
fix_post($post);
}
}
}
// use this to patch problem cases; hand-edit
function fix_fix() {
$posts = mysql_query("select * from post where id=99");
$post = mysql_fetch_object($posts);
fix_post($post);
}
fix_posts();
//fix_fix();
?>