mirror of https://github.com/BOINC/boinc.git
*** empty log message ***
svn path=/trunk/boinc/; revision=5417
This commit is contained in:
parent
66fccb3a8a
commit
a6d5713db1
|
@ -24646,3 +24646,20 @@ David 12 Feb 2005
|
|||
|
||||
client/
|
||||
http.C
|
||||
|
||||
David 12 Feb 2005
|
||||
- added functions in PHP code to get data from GET and POST,
|
||||
and do various safety checking on it.
|
||||
These functions should be used exclusively;
|
||||
$_GET and $_POST should not be accessed directly
|
||||
- moved some stuff out of html/inc/util.inc
|
||||
|
||||
html/
|
||||
inc/
|
||||
db_ops.inc
|
||||
gallery.inc
|
||||
prefs.inc
|
||||
profile.inc
|
||||
util.inc
|
||||
user/
|
||||
various (didn't finish)
|
||||
|
|
|
@ -3,59 +3,87 @@ $cvs_version_tracker[]="\$Id$"; //Generated automatically - do not edit
|
|||
|
||||
define("NVALIDATE_STATES", 6);
|
||||
|
||||
// Converts a mysql-Timestamp to a user readable format
|
||||
// @return String A user readable DateTime-String in UTC
|
||||
// @param Integer $x The mysql-Timestamp to convert
|
||||
function mysqltime_str($x) {
|
||||
if(strpos($x,"-")==4) {
|
||||
// Syntax of supplied mysql-timestamp is YYYY-MM-DD HH:MM:SS
|
||||
$year = substr($x,0,4);
|
||||
$month = substr($x,5,2);
|
||||
$day = substr($x,8,2);
|
||||
$hour = substr($x,11,2);
|
||||
$minute = substr($x,14,2);
|
||||
$second = substr($x,17,2);
|
||||
} else {
|
||||
// Syntax of supplied mysql-timestamp is YYYYMMDDHHMMSS
|
||||
$year = substr($x,0,4);
|
||||
$month = substr($x,4,2);
|
||||
$day = substr($x,6,2);
|
||||
$hour = substr($x,8,2);
|
||||
$minute = substr($x,10,2);
|
||||
$second = substr($x,12,2);
|
||||
|
||||
}
|
||||
//make a Unix-Timestamp
|
||||
// echo "Time string is " . "$x";
|
||||
$time = mktime($hour,$minute,$second,$month,$day,$year);
|
||||
return time_str($time);
|
||||
}
|
||||
|
||||
// Function prints a description of $table
|
||||
//
|
||||
function print_describe_table_onecol($table, $which, $columns) {
|
||||
$result=mysql_query("SELECT * from $table LIMIT 1");
|
||||
$fields=mysql_num_fields($result);
|
||||
|
||||
$avgnum=(int)($fields/$columns);
|
||||
if ($avgnum*$columns<$fields) {
|
||||
$avgnum++;
|
||||
}
|
||||
$result=mysql_query("SELECT * from $table LIMIT 1");
|
||||
$fields=mysql_num_fields($result);
|
||||
|
||||
$actualcolumns=0;
|
||||
while ($avgnum*$actualcolumns<$fields) {
|
||||
$actualcolumns++;
|
||||
}
|
||||
|
||||
if ($which>$actualcolumns) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
$bot=($which-1)*$avgnum;
|
||||
$top=$which*$avgnum;
|
||||
|
||||
$width=100.0/$actualcolumns;
|
||||
|
||||
// echo "<td><table border='2' width=\"$width%\">\n";
|
||||
echo "<td><table border=\"1\" width=\"100%\">\n";
|
||||
echo "<tr><th align=\"left\">NAME</th><th align=\"left\">Type</th><th align=\"left\">Bytes</th>\n";
|
||||
for ($count=$bot; $count<$top; $count++) {
|
||||
if ($count<$fields) {
|
||||
$name= mysql_field_name($result, $count);
|
||||
$type= mysql_field_type($result, $count);
|
||||
$length=mysql_field_len($result, $count);
|
||||
} else {
|
||||
$name="<br/> ";
|
||||
$type="<br/>";
|
||||
$length="<br/>";
|
||||
$avgnum=(int)($fields/$columns);
|
||||
if ($avgnum*$columns<$fields) {
|
||||
$avgnum++;
|
||||
}
|
||||
echo "\t<tr><td><b>$name</b></td><td>$type</td><td>$length</td></tr>\n";
|
||||
}
|
||||
echo "</table></td>";
|
||||
return 0;
|
||||
|
||||
$actualcolumns=0;
|
||||
while ($avgnum*$actualcolumns<$fields) {
|
||||
$actualcolumns++;
|
||||
}
|
||||
|
||||
if ($which>$actualcolumns) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
$bot=($which-1)*$avgnum;
|
||||
$top=$which*$avgnum;
|
||||
|
||||
$width=100.0/$actualcolumns;
|
||||
|
||||
// echo "<td><table border='2' width=\"$width%\">\n";
|
||||
echo "<td><table border=\"1\" width=\"100%\">\n";
|
||||
echo "<tr><th align=\"left\">NAME</th><th align=\"left\">Type</th><th align=\"left\">Bytes</th>\n";
|
||||
for ($count=$bot; $count<$top; $count++) {
|
||||
if ($count<$fields) {
|
||||
$name= mysql_field_name($result, $count);
|
||||
$type= mysql_field_type($result, $count);
|
||||
$length=mysql_field_len($result, $count);
|
||||
} else {
|
||||
$name="<br/> ";
|
||||
$type="<br/>";
|
||||
$length="<br/>";
|
||||
}
|
||||
echo "\t<tr><td><b>$name</b></td><td>$type</td><td>$length</td></tr>\n";
|
||||
}
|
||||
echo "</table></td>";
|
||||
return 0;
|
||||
}
|
||||
|
||||
function print_describe_table($table, $how_many_columns) {
|
||||
// Number of columns for showing table description
|
||||
echo "<h2>Description of <b>$table</b> table fields:</h2>\n";
|
||||
echo "<table border=\"0\" width=\"100%\">\n\t<tr>";
|
||||
for ($i=1; $i<=$how_many_columns; $i++) {
|
||||
print_describe_table_onecol($table, $i, $how_many_columns);
|
||||
}
|
||||
echo "\t</tr>\n</table>\n";
|
||||
return 0;
|
||||
// Number of columns for showing table description
|
||||
echo "<h2>Description of <b>$table</b> table fields:</h2>\n";
|
||||
echo "<table border=\"0\" width=\"100%\">\n\t<tr>";
|
||||
for ($i=1; $i<=$how_many_columns; $i++) {
|
||||
print_describe_table_onecol($table, $i, $how_many_columns);
|
||||
}
|
||||
echo "\t</tr>\n</table>\n";
|
||||
return 0;
|
||||
}
|
||||
|
||||
function print_detail_field() {
|
||||
|
|
|
@ -9,6 +9,45 @@ require_once("../inc/uotd.inc");
|
|||
$alphabet = array('A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','0','1','2','3','4','5','6','7','8','9');
|
||||
|
||||
|
||||
// Generates a standard set of links between associated multi-page documents.
|
||||
// All linked files must be of the form "$filename_<page number>.html".
|
||||
|
||||
function write_page_links($filename, $currPageNum, $numPages) {
|
||||
echo "<p>Page $currPageNum of $numPages</p>";
|
||||
|
||||
$nextPageNum = $currPageNum + 1;
|
||||
$prevPageNum = $currPageNum - 1;
|
||||
|
||||
// Make the 'previous' and 'next' page links as appropriate.
|
||||
if ($currPageNum > 1) {
|
||||
echo "<a href={$filename}_{$prevPageNum}.html>Previous Page</a>";
|
||||
|
||||
if ($currPageNum != $numPages) {
|
||||
echo " | ";
|
||||
}
|
||||
}
|
||||
if ($currPageNum != $numPages) {
|
||||
//fwrite($descriptor, "<a href=$filename" . "_" . $nextPageNum . ".html>Next Page</a>");
|
||||
echo "<a href={$filename}_{$nextPageNum}.html>Next Page</a>";
|
||||
}
|
||||
|
||||
//fwrite($descriptor, "<p>Jump to Page:\n");
|
||||
echo "<p>Jump to Page:\n";
|
||||
|
||||
// Make the individual page links (or a bold non-link for the current page).
|
||||
//
|
||||
for ($i = 1; $i <= $numPages; $i++) {
|
||||
if ($i != $currPageNum) {
|
||||
//fwrite($descriptor, "<a href=$filename" . "_" . $i . ".html>$i</a>\n");
|
||||
echo "<a href={$filename}_{$i}.html>$i</a>\n";
|
||||
} else {
|
||||
//fwrite($descriptor, "<b>$i</b>\n");
|
||||
echo "<b>$i</b>\n";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Generates the html files which comprise the photo gallery.
|
||||
// $room: which gallery to generate (user, computer).
|
||||
// $width: the width of the table of images.
|
||||
|
|
|
@ -97,6 +97,19 @@ global $top_parse_result;
|
|||
global $in_project_specific;
|
||||
global $venue_name;
|
||||
|
||||
function check_venue($x) {
|
||||
if ($x == "home") return;
|
||||
if ($x == "work") return;
|
||||
if ($x == "school") return;
|
||||
error_page("bad venue: $x");
|
||||
}
|
||||
|
||||
function check_subset($x) {
|
||||
if ($x == "global") return;
|
||||
if ($x == "project") return;
|
||||
error_page("bad subset: $x");
|
||||
}
|
||||
|
||||
// functions to convert between max_bytes_sec_* as stored in the
|
||||
// database and max_bytes_sec_* as displayed/entered on the web
|
||||
// pages. Currently max_bytes_sec_* is stored in bytes and
|
||||
|
|
|
@ -18,6 +18,32 @@ define('MAX_DESC_LENGTH', 90);
|
|||
define('GALLERY_WIDTH', 7);
|
||||
define('GALLERY_HEIGHT', 4);
|
||||
|
||||
// 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,
|
||||
// it will be selected by default.
|
||||
//
|
||||
function show_combo_box($name, $filename, $selection=null) {
|
||||
if (!file_exists($filename)) {
|
||||
echo "ERROR: $filename does not exist! Cannot create combo box.<br>";
|
||||
exit();
|
||||
}
|
||||
echo "<select name=\"$name\">\n";
|
||||
|
||||
$file = fopen($filename, "r");
|
||||
|
||||
while ($line = trim(fgets($file, 1024))) {
|
||||
if ($line == $selection) {
|
||||
echo "<option SELECTED value=\"$line\">$line\n";
|
||||
} else {
|
||||
echo "<option value=\"$line\">$line\n";
|
||||
}
|
||||
}
|
||||
|
||||
echo "</select>\n";
|
||||
fclose($file);
|
||||
}
|
||||
|
||||
function get_profile($userid) {
|
||||
$result = mysql_query("SELECT * FROM profile WHERE userid = $userid");
|
||||
if (!$result) {
|
||||
|
|
|
@ -65,6 +65,7 @@ function get_logged_in_user($must_be_logged_in=true) {
|
|||
if (!$authenticator) {
|
||||
$authenticator = $_COOKIE['auth'];
|
||||
}
|
||||
$authenticator = process_user_text($authenticator);
|
||||
$user = get_user_from_auth($authenticator);
|
||||
if ($must_be_logged_in) {
|
||||
require_login($user);
|
||||
|
@ -81,32 +82,6 @@ function show_login($user) {
|
|||
}
|
||||
}
|
||||
|
||||
// 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,
|
||||
// it will be selected by default.
|
||||
//
|
||||
function show_combo_box($name, $filename, $selection=null) {
|
||||
if (!file_exists($filename)) {
|
||||
echo "ERROR: $filename does not exist! Cannot create combo box.<br>";
|
||||
exit();
|
||||
}
|
||||
echo "<select name=\"$name\">\n";
|
||||
|
||||
$file = fopen($filename, "r");
|
||||
|
||||
while ($line = trim(fgets($file, 1024))) {
|
||||
if ($line == $selection) {
|
||||
echo "<option SELECTED value=\"$line\">$line\n";
|
||||
} else {
|
||||
echo "<option value=\"$line\">$line\n";
|
||||
}
|
||||
}
|
||||
|
||||
echo "</select>\n";
|
||||
fclose($file);
|
||||
}
|
||||
|
||||
function page_head($title, $java_onload="") {
|
||||
$styleSheet = URL_BASE . STYLESHEET;
|
||||
$rssname = PROJECT . " RSS 2.0";
|
||||
|
@ -201,36 +176,6 @@ function time_str($x) {
|
|||
function pretty_time_str($x) {
|
||||
return time_str($x);
|
||||
}
|
||||
// Converts a mysql-Timestamp to a user readable format
|
||||
// @return String A user readable DateTime-String in UTC
|
||||
// @param Integer $x The mysql-Timestamp to convert
|
||||
function mysqltime_str($x) {
|
||||
if(strpos($x,"-")==4)
|
||||
{
|
||||
// Syntax of supplied mysql-timestamp is YYYY-MM-DD HH:MM:SS
|
||||
$year = substr($x,0,4);
|
||||
$month = substr($x,5,2);
|
||||
$day = substr($x,8,2);
|
||||
$hour = substr($x,11,2);
|
||||
$minute = substr($x,14,2);
|
||||
$second = substr($x,17,2);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Syntax of supplied mysql-timestamp is YYYYMMDDHHMMSS
|
||||
$year = substr($x,0,4);
|
||||
$month = substr($x,4,2);
|
||||
$day = substr($x,6,2);
|
||||
$hour = substr($x,8,2);
|
||||
$minute = substr($x,10,2);
|
||||
$second = substr($x,12,2);
|
||||
|
||||
}
|
||||
//make a Unix-Timestamp
|
||||
// echo "Time string is " . "$x";
|
||||
$time = mktime($hour,$minute,$second,$month,$day,$year);
|
||||
return time_str($time);
|
||||
}
|
||||
function start_table($extra="width=100%") {
|
||||
echo "<table border=1 cellpadding=5 $extra>";
|
||||
}
|
||||
|
@ -387,45 +332,6 @@ function no_cache() {
|
|||
header ("Pragma: no-cache"); // HTTP/1.0
|
||||
}
|
||||
|
||||
// Generates a standard set of links between associated multi-page documents.
|
||||
// All linked files must be of the form "$filename_<page number>.html".
|
||||
|
||||
function write_page_links($filename, $currPageNum, $numPages) {
|
||||
echo "<p>Page $currPageNum of $numPages</p>";
|
||||
|
||||
$nextPageNum = $currPageNum + 1;
|
||||
$prevPageNum = $currPageNum - 1;
|
||||
|
||||
// Make the 'previous' and 'next' page links as appropriate.
|
||||
if ($currPageNum > 1) {
|
||||
echo "<a href={$filename}_{$prevPageNum}.html>Previous Page</a>";
|
||||
|
||||
if ($currPageNum != $numPages) {
|
||||
echo " | ";
|
||||
}
|
||||
}
|
||||
if ($currPageNum != $numPages) {
|
||||
//fwrite($descriptor, "<a href=$filename" . "_" . $nextPageNum . ".html>Next Page</a>");
|
||||
echo "<a href={$filename}_{$nextPageNum}.html>Next Page</a>";
|
||||
}
|
||||
|
||||
//fwrite($descriptor, "<p>Jump to Page:\n");
|
||||
echo "<p>Jump to Page:\n";
|
||||
|
||||
// Make the individual page links (or a bold non-link for the current page).
|
||||
//
|
||||
for ($i = 1; $i <= $numPages; $i++) {
|
||||
if ($i != $currPageNum) {
|
||||
//fwrite($descriptor, "<a href=$filename" . "_" . $i . ".html>$i</a>\n");
|
||||
echo "<a href={$filename}_{$i}.html>$i</a>\n";
|
||||
} else {
|
||||
//fwrite($descriptor, "<b>$i</b>\n");
|
||||
echo "<b>$i</b>\n";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Generates a legal filename from a parameter string.
|
||||
|
||||
function get_legal_filename($name) {
|
||||
|
@ -504,4 +410,44 @@ function html_info() {
|
|||
return "<br><a href=html.php><font size=-2>You may use HTML tags</font></a>\n";
|
||||
}
|
||||
|
||||
function get_int($name, $optional=false) {
|
||||
$x = $_GET[$name];
|
||||
if (!is_numeric($x)) {
|
||||
if ($optional) {
|
||||
return null;
|
||||
} else {
|
||||
error_page("missing or bad parameter: $name $x");
|
||||
}
|
||||
}
|
||||
return (int)$x;
|
||||
}
|
||||
|
||||
function post_int($name, $optional=false) {
|
||||
$x = $_POST[$name];
|
||||
if (!is_numeric($x)) {
|
||||
if ($optional) {
|
||||
return null;
|
||||
} else {
|
||||
error_page("missing or bad parameter: $name $x");
|
||||
}
|
||||
}
|
||||
return (int)$x;
|
||||
}
|
||||
|
||||
function get_str($name, $optional=false) {
|
||||
$x = $_GET[$name];
|
||||
if (!$x && !optional) {
|
||||
error_page("missing or bad parameter: $name");
|
||||
}
|
||||
return $x;
|
||||
}
|
||||
|
||||
function post_str($name, $optional=false) {
|
||||
$x = $_POST[$name];
|
||||
if (!$x && !optional) {
|
||||
error_page("missing or bad parameter: $name");
|
||||
}
|
||||
return $x;
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -7,8 +7,10 @@
|
|||
|
||||
$user = get_logged_in_user();
|
||||
|
||||
$venue = $_GET["venue"];
|
||||
$subset = $_GET["subset"];
|
||||
$venue = get_str("venue");
|
||||
check_venue($venue);
|
||||
$subset = get_str("subset");
|
||||
check_subset($subset);
|
||||
|
||||
if ($subset == "global") {
|
||||
$prefs = prefs_parse_global($user->global_prefs);
|
||||
|
|
|
@ -7,8 +7,10 @@
|
|||
|
||||
$user = get_logged_in_user();
|
||||
|
||||
$venue = $_GET["venue"];
|
||||
$subset = $_GET["subset"];
|
||||
$venue = get_str("venue");
|
||||
check_venue($venue);
|
||||
$subset = get_str("subset");
|
||||
check_subset($subset);
|
||||
|
||||
$x = subset_name($subset);
|
||||
page_head("Add $x preferences for $venue");
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
|
||||
db_init();
|
||||
|
||||
$id = $_GET["id"];
|
||||
$str = $_GET["str"];
|
||||
$id = get_int("id");
|
||||
$str = process_user_text(get_str("str"));
|
||||
|
||||
$user = null;
|
||||
$result = mysql_query("select * from user where id=$id");
|
||||
|
|
|
@ -27,7 +27,7 @@ function show_error($str) {
|
|||
init_session();
|
||||
db_init();
|
||||
|
||||
$teamid = $_POST["teamid"];
|
||||
$teamid = post_int("teamid");
|
||||
if ($teamid) {
|
||||
$team = lookup_team($teamid);
|
||||
$clone_user = lookup_user_id($team->userid);
|
||||
|
|
|
@ -28,7 +28,7 @@ echo "
|
|||
|
||||
<form action=create_account_action.php method=post>
|
||||
";
|
||||
$teamid = $_GET['teamid'];
|
||||
$teamid = get_int("teamid", true);
|
||||
if ($teamid) {
|
||||
$team = lookup_team($teamid);
|
||||
$user = lookup_user_id($team->userid);
|
||||
|
|
|
@ -3,11 +3,11 @@
|
|||
require_once("../inc/db.inc");
|
||||
require_once("../inc/util.inc");
|
||||
|
||||
init_session();
|
||||
init_session();
|
||||
|
||||
page_head("Download debugging files");
|
||||
page_head("Download debugging files");
|
||||
|
||||
echo "
|
||||
echo "
|
||||
<h2>Download debugging files</h2>
|
||||
<p>
|
||||
<b>Windows users</b>:
|
||||
|
@ -38,7 +38,7 @@ require_once("../inc/util.inc");
|
|||
Thanks for helping make BOINC a better product.
|
||||
<p>
|
||||
<p>
|
||||
";
|
||||
";
|
||||
|
||||
page_tail();
|
||||
?>
|
||||
|
|
|
@ -9,40 +9,40 @@ require_once("../inc/db.inc");
|
|||
require_once("../inc/download.inc");
|
||||
|
||||
|
||||
db_init();
|
||||
db_init();
|
||||
|
||||
page_head("Download BOINC software");
|
||||
echo "
|
||||
<font color=ff0000>
|
||||
<b>First-time ".PROJECT." participants</b>:
|
||||
<br>Don't download BOINC software now.
|
||||
<a href=create_account_form.php>Create an account</a> first.
|
||||
</font>
|
||||
<p>
|
||||
";
|
||||
print_download_links();
|
||||
echo "
|
||||
<p>
|
||||
Instructions for installing and running BOINC are
|
||||
<a href=http://boinc.berkeley.edu/participate.php>here</a>.
|
||||
<p>
|
||||
If your computer is not one of the above types,
|
||||
you can
|
||||
<ul>
|
||||
<li> <a href=http://boinc.berkeley.edu/anonymous_platform.php>download and compile the BOINC software yourself</a> or
|
||||
<li> <a href=download_other.php>download from a third-party site</a>.
|
||||
</ul>
|
||||
<p>
|
||||
BOINC can be customized for
|
||||
<a href=http://boinc.berkeley.edu/language.php>languages other than English</a>
|
||||
<p>
|
||||
<font size=-1>
|
||||
<a href=http://boinc.berkeley.edu>BOINC</a>
|
||||
is distributed computing software
|
||||
developed at the University of California by
|
||||
the SETI@home project.
|
||||
</font>
|
||||
";
|
||||
page_tail();
|
||||
page_head("Download BOINC software");
|
||||
echo "
|
||||
<font color=ff0000>
|
||||
<b>First-time ".PROJECT." participants</b>:
|
||||
<br>Don't download BOINC software now.
|
||||
<a href=create_account_form.php>Create an account</a> first.
|
||||
</font>
|
||||
<p>
|
||||
";
|
||||
print_download_links();
|
||||
echo "
|
||||
<p>
|
||||
Instructions for installing and running BOINC are
|
||||
<a href=http://boinc.berkeley.edu/participate.php>here</a>.
|
||||
<p>
|
||||
If your computer is not one of the above types,
|
||||
you can
|
||||
<ul>
|
||||
<li> <a href=http://boinc.berkeley.edu/anonymous_platform.php>download and compile the BOINC software yourself</a> or
|
||||
<li> <a href=download_other.php>download from a third-party site</a>.
|
||||
</ul>
|
||||
<p>
|
||||
BOINC can be customized for
|
||||
<a href=http://boinc.berkeley.edu/language.php>languages other than English</a>
|
||||
<p>
|
||||
<font size=-1>
|
||||
<a href=http://boinc.berkeley.edu>BOINC</a>
|
||||
is distributed computing software
|
||||
developed at the University of California by
|
||||
the SETI@home project.
|
||||
</font>
|
||||
";
|
||||
page_tail();
|
||||
end_cache(DOWNLOAD_PAGE_TTL);
|
||||
?>
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
<?php
|
||||
|
||||
require_once("../inc/db.inc");
|
||||
require_once("../inc/util.inc");
|
||||
require_once("../inc/email.inc");
|
||||
require_once("../inc/user.inc");
|
||||
require_once("../inc/db.inc");
|
||||
require_once("../inc/util.inc");
|
||||
require_once("../inc/email.inc");
|
||||
require_once("../inc/user.inc");
|
||||
|
||||
function send_verify_email($user, $email_addr, $key) {
|
||||
mail(
|
||||
|
@ -12,13 +12,13 @@ function send_verify_email($user, $email_addr, $key) {
|
|||
"You have asked that the email address of your " . PROJECT . " account be changed to $email_addr.
|
||||
To confirm this change, please visit the following URL:
|
||||
". URL_BASE ."confirm_email_change.php?id=$user->id&str=$key"
|
||||
); // Changed from (URL_BASE || MASTER_URL)
|
||||
);
|
||||
}
|
||||
|
||||
db_init();
|
||||
$user = get_logged_in_user();
|
||||
|
||||
$email_addr = trim(strtolower($HTTP_POST_VARS["email_addr"]));
|
||||
$email_addr = process_user_text(post_str("email_addr"));
|
||||
|
||||
page_head("Edit email address");
|
||||
if ($email_addr == "Verification pending") {
|
||||
|
|
|
@ -1,28 +1,29 @@
|
|||
<?php
|
||||
require_once("../inc/db.inc");
|
||||
require_once("../inc/user.inc");
|
||||
require_once("../inc/util.inc");
|
||||
require_once("../inc/countries.inc");
|
||||
|
||||
db_init();
|
||||
$user = get_logged_in_user();
|
||||
require_once("../inc/db.inc");
|
||||
require_once("../inc/user.inc");
|
||||
require_once("../inc/util.inc");
|
||||
require_once("../inc/countries.inc");
|
||||
|
||||
$name = process_user_text($HTTP_POST_VARS["user_name"]);
|
||||
$url = process_user_text($HTTP_POST_VARS["url"]);
|
||||
$country = $HTTP_POST_VARS["country"];
|
||||
if (!is_valid_country($country)) {
|
||||
echo "bad country";
|
||||
exit();
|
||||
}
|
||||
$postal_code = process_user_text($HTTP_POST_VARS["postal_code"]);
|
||||
db_init();
|
||||
$user = get_logged_in_user();
|
||||
|
||||
$result = mysql_query("update user set name='$name', url='$url', country='$country', postal_code='$postal_code' where id=$user->id");
|
||||
if ($result) {
|
||||
Header("Location: home.php");
|
||||
} else {
|
||||
page_head("User info update");
|
||||
echo "Couldn't update user info.";
|
||||
page_tail();
|
||||
}
|
||||
$name = process_user_text(post_str("user_name"));
|
||||
$url = process_user_text(post_str("url"));
|
||||
$country = post_str("country");
|
||||
if (!is_valid_country($country)) {
|
||||
echo "bad country";
|
||||
exit();
|
||||
}
|
||||
$postal_code = process_user_text(post_str("postal_code"));
|
||||
|
||||
$result = mysql_query("update user set name='$name', url='$url', country='$country', postal_code='$postal_code' where id=$user->id");
|
||||
if ($result) {
|
||||
Header("Location: home.php");
|
||||
} else {
|
||||
page_head("User info update");
|
||||
echo "Couldn't update user info.";
|
||||
page_tail();
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -1,27 +0,0 @@
|
|||
<?php
|
||||
require_once("../inc/util.inc");
|
||||
?>
|
||||
<html>
|
||||
<head>
|
||||
<title>User Profile Voting Information</title>
|
||||
</head>
|
||||
<table border=0 cellpadding=0>
|
||||
<?php
|
||||
|
||||
if ($_GET['val'] == "recommend") {
|
||||
|
||||
row1("Recommending User Profiles");
|
||||
rowify("<br>");
|
||||
rowify("If you really like a profile, hit the \"recommend\" button. The " . PROJECT . " team reviews recommended profiles for various purposes.");
|
||||
} else {
|
||||
|
||||
row1("Voting to Reject a Profile");
|
||||
rowify("<br>");
|
||||
rowify("If you find a profile offensive, please click \"vote to reject\". This flags the profile for review by " . PROJECT . " staff.");
|
||||
}
|
||||
|
||||
end_table();
|
||||
?>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -9,14 +9,7 @@ $logged_in_user = get_logged_in_user();
|
|||
|
||||
|
||||
if ($_POST['submit']) {
|
||||
|
||||
if (empty($_GET['id'])) {
|
||||
// TODO: Standard error page
|
||||
echo "Invalid post ID.<br>";
|
||||
exit();
|
||||
}
|
||||
|
||||
$post = getPost($_GET['id']);
|
||||
$post = getPost(get_int("id"));
|
||||
$thread = getThread($post->thread);
|
||||
|
||||
if (time() > $post->timestamp + MAXIMUM_EDIT_TIME){
|
||||
|
@ -41,20 +34,14 @@ if ($_POST['submit']) {
|
|||
|
||||
page_head('Forum');
|
||||
|
||||
if (!empty($_GET['id'])) {
|
||||
$post = getPost($_GET['id']);
|
||||
$thread = getThread($post->thread);
|
||||
$forum = getForum($thread->forum);
|
||||
$category = getCategory($forum->category);
|
||||
} else {
|
||||
// TODO: Standard error page
|
||||
echo "No post was specified.<br>";
|
||||
exit();
|
||||
}
|
||||
if (time() > $post->timestamp + MAXIMUM_EDIT_TIME){
|
||||
$post = getPost(get_int("id"));
|
||||
$thread = getThread($post->thread);
|
||||
$forum = getForum($thread->forum);
|
||||
$category = getCategory($forum->category);
|
||||
if (time() > $post->timestamp + MAXIMUM_EDIT_TIME){
|
||||
echo "You can no longer edit this post.<br>Posts can only be edited at most ".(MAXIMUM_EDIT_TIME/60)." minutes after they have been created.";
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
if ($logged_in_user->id != $post->user) {
|
||||
// Can't edit other's posts.
|
||||
|
|
|
@ -7,28 +7,17 @@ require_once('../inc/forum_show.inc');
|
|||
|
||||
db_init();
|
||||
|
||||
if (empty($_GET['id'])) {
|
||||
// TODO: Standard error page
|
||||
echo "Invalid forum ID.<br>";
|
||||
exit();
|
||||
}
|
||||
$id = get_int("id");
|
||||
$sort_style = get_str("sort", true);
|
||||
$start = get_int("start", true);
|
||||
if (!$start) $start = 0;
|
||||
|
||||
$_GET['id'] = stripslashes(strip_tags($_GET['id']));
|
||||
$_GET['sort'] = stripslashes(strip_tags($_GET['sort']));
|
||||
|
||||
if (!array_key_exists('start', $_GET) || $_GET['start'] < 0) {
|
||||
$start = 0;
|
||||
} else {
|
||||
$start = $_GET['start'];
|
||||
}
|
||||
|
||||
$forum = getForum($_GET['id']);
|
||||
$forum = getForum($id);
|
||||
$category = getCategory($forum->category);
|
||||
$logged_in_user = get_logged_in_user(false);
|
||||
$logged_in_user = getForumPreferences($logged_in_user);
|
||||
|
||||
if ($category->is_helpdesk) {
|
||||
$sort_style = $_GET['sort'];
|
||||
if (!$sort_style) {
|
||||
$sort_style = getSortStyle($logged_in_user,"faq");
|
||||
} else {
|
||||
|
@ -37,13 +26,10 @@ if ($category->is_helpdesk) {
|
|||
if (!$sort_style) $sort_style = 'activity';
|
||||
page_head('Help Desk');
|
||||
} else {
|
||||
$sort_style = $_GET['sort'];
|
||||
if (!$sort_style) {
|
||||
$sort_style = getSortStyle($logged_in_user,"forum");
|
||||
//$sort_style = $_COOKIE['forum_sort_style'];
|
||||
} else {
|
||||
setSortStyle($logged_in_user, "forum",$sort_style);
|
||||
//setcookie('forum_sort_style', $sort_style, time()+3600*24*365);
|
||||
setSortStyle($logged_in_user, "forum",$sort_style);
|
||||
}
|
||||
if (!$sort_style) $sort_style = 'modified-new';
|
||||
page_head('Message boards : '.$forum->title);
|
||||
|
@ -59,7 +45,7 @@ echo "
|
|||
|
||||
show_forum_title($forum, NULL, $category->is_helpdesk);
|
||||
|
||||
echo "<p>\n<a href=\"forum_post.php?id=", $_GET['id'], "\">";
|
||||
echo "<p>\n<a href=forum_post.php?id=$id>";
|
||||
|
||||
if ($category->is_helpdesk) {
|
||||
echo "Submit a question or problem";
|
||||
|
@ -82,5 +68,4 @@ show_forum($category, $forum, $start, $sort_style, $logged_in_user);
|
|||
|
||||
page_tail();
|
||||
|
||||
|
||||
?>
|
||||
|
|
|
@ -27,55 +27,55 @@ if (!empty($_GET['post'])) {
|
|||
$user = get_logged_in_user(true);
|
||||
$user = getForumPreferences($user);
|
||||
|
||||
if (getHasRated($user,$postId)){
|
||||
echo "You have already rated this post.";
|
||||
if (getHasRated($user,$postId)) {
|
||||
echo "You have already rated this post.";
|
||||
} else {
|
||||
$result = mysql_query("SELECT * FROM post WHERE id = $postId");
|
||||
if ($result) {
|
||||
if (mysql_num_rows($result) > 0) {
|
||||
$post = mysql_fetch_object($result);
|
||||
if ($result) {
|
||||
if (mysql_num_rows($result) > 0) {
|
||||
$post = mysql_fetch_object($result);
|
||||
|
||||
if ($choice == NULL || $choice == SOLUTION || $choice == OFF_TOPIC || $choice=="p" || $choice=="n") {
|
||||
$points = $post->votes * $post->score;
|
||||
$votes = $post->votes + 1;
|
||||
$score = ($points + $rating) / $votes;
|
||||
if ($choice == NULL || $choice == SOLUTION || $choice == OFF_TOPIC || $choice=="p" || $choice=="n") {
|
||||
$points = $post->votes * $post->score;
|
||||
$votes = $post->votes + 1;
|
||||
$score = ($points + $rating) / $votes;
|
||||
|
||||
$result2 = mysql_query("UPDATE post SET votes = $votes, score = $score WHERE id = $postId");
|
||||
} else if ($choice == SUFFERER) {
|
||||
$sql = "UPDATE thread SET sufferers = sufferers + 1 WHERE id = " . $post->thread;
|
||||
$result2 = mysql_query($sql);
|
||||
}
|
||||
$result2 = mysql_query("UPDATE post SET votes = $votes, score = $score WHERE id = $postId");
|
||||
} else if ($choice == SUFFERER) {
|
||||
$sql = "UPDATE thread SET sufferers = sufferers + 1 WHERE id = " . $post->thread;
|
||||
$result2 = mysql_query($sql);
|
||||
}
|
||||
|
||||
if ($result2) {
|
||||
show_result_page(true, $post, $choice);
|
||||
setHasRated($user,$postId);
|
||||
} else {
|
||||
show_result_page(false, $post, $choice);
|
||||
}
|
||||
} else {
|
||||
if ($result2) {
|
||||
show_result_page(true, $post, $choice);
|
||||
setHasRated($user,$postId);
|
||||
} else {
|
||||
show_result_page(false, $post, $choice);
|
||||
}
|
||||
} else {
|
||||
show_result_page(false, NULL, $choice);
|
||||
}
|
||||
} else {
|
||||
show_result_page(false, NULL, $choice);
|
||||
}
|
||||
} else {
|
||||
show_result_page(false, NULL, $choice);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function show_result_page($success, $post, $choice) {
|
||||
$logged_in_user = get_logged_in_user(false);
|
||||
|
||||
if ($success) {
|
||||
if ($choice) {
|
||||
page_head('Input Recorded');
|
||||
echo "<p>Your input has been successfully recorded. Thank you for your help.</p>";
|
||||
} else {
|
||||
page_head('Vote Registered');
|
||||
if ($success) {
|
||||
if ($choice) {
|
||||
page_head('Input Recorded');
|
||||
echo "<p>Your input has been successfully recorded. Thank you for your help.</p>";
|
||||
} else {
|
||||
page_head('Vote Registered');
|
||||
echo "<span class=\"title\">Vote Registered</span>";
|
||||
echo "<p>Your rating has been successfully recorded. Thank you for your input.</p>";
|
||||
}
|
||||
echo "<a href=\"forum_thread.php?id=", $post->thread, "#", $post->id, "\">Return to thread</a>";
|
||||
}
|
||||
echo "<a href=\"forum_thread.php?id=", $post->thread, "#", $post->id, "\">Return to thread</a>";
|
||||
} else {
|
||||
page_head('Vote Submission Problem');
|
||||
page_head('Vote Submission Problem');
|
||||
echo "<span class=\"title\">Vote submission failed</span>";
|
||||
if ($post) {
|
||||
echo "<p>There was a problem recording your vote in our database. Please try again later.</p>";
|
||||
|
|
|
@ -14,16 +14,15 @@ if (!empty($_GET['thread']) && !empty($_POST['content'])) {
|
|||
$_GET['thread'] = stripslashes($_GET['thread']);
|
||||
|
||||
if (!empty($_GET['post'])) {
|
||||
$parent_post = $_GET['post'];
|
||||
$parent_post = $_GET['post'];
|
||||
} else {
|
||||
$parent_post = NULL;
|
||||
$parent_post = NULL;
|
||||
}
|
||||
|
||||
if ($_POST['add_signature']=="add_it"){
|
||||
//$forum_signature = "\n".$logged_in_user->signature; //Old style: concatenate signature
|
||||
$add_signature=true; // New style: set a flag and concatenate later
|
||||
$add_signature=true; // set a flag and concatenate later
|
||||
} else {
|
||||
$add_signature=false;
|
||||
$add_signature=false;
|
||||
}
|
||||
|
||||
replyToThread($_GET['thread'], $logged_in_user->id, $_POST['content'], $parent_post, $add_signature);
|
||||
|
@ -33,9 +32,9 @@ if (!empty($_GET['thread']) && !empty($_POST['content'])) {
|
|||
|
||||
|
||||
if (empty($_GET['thread'])) {
|
||||
// TODO: Standard error page.
|
||||
echo "No thread ID specified.<br>";
|
||||
exit();
|
||||
// TODO: Standard error page.
|
||||
echo "No thread ID specified.<br>";
|
||||
exit();
|
||||
}
|
||||
|
||||
if (!empty($_GET['post'])) {
|
||||
|
@ -50,9 +49,9 @@ $helpdesk = $category->is_helpdesk;
|
|||
|
||||
// TODO: Write a function for this.
|
||||
if ($helpdesk) {
|
||||
page_head('Questions and problems');
|
||||
page_head('Questions and problems');
|
||||
} else {
|
||||
page_head('Message boards');
|
||||
page_head('Message boards');
|
||||
}
|
||||
|
||||
show_forum_title($forum, $thread, $helpdesk);
|
||||
|
@ -102,12 +101,12 @@ function show_message_row($thread, $category, $post=NULL) {
|
|||
if ($post) echo quote_text(stripslashes($post->content), 80);
|
||||
if ($logged_in_user->no_signature_by_default==0){$enable_signature="checked=\"true\"";} else {$enable_signature="";}
|
||||
echo "</textarea><p>
|
||||
<input type=\"submit\" value=\"Post reply\">
|
||||
<input type=\"submit\" value=\"Post reply\">
|
||||
|
||||
<input name=add_signature value=add_it ".$enable_signature." type=checkbox>Add my signature to this reply
|
||||
|
||||
</form>
|
||||
";
|
||||
";
|
||||
|
||||
echo "</td></tr>\n";
|
||||
}
|
||||
|
|
|
@ -34,10 +34,10 @@ function show_category($category) {
|
|||
}
|
||||
|
||||
function show_forums() {
|
||||
$categories = getCategories();
|
||||
while ($category = mysql_fetch_object($categories)) {
|
||||
$categories = getCategories();
|
||||
while ($category = mysql_fetch_object($categories)) {
|
||||
show_category($category);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
start_forum_table(array("Topic", "Threads", "Posts", "Last post"));
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
require_once("../inc/cache.inc");
|
||||
require_once("../inc/util.inc");
|
||||
|
||||
$id = $_GET["userid"];
|
||||
$format = $_GET["format"];
|
||||
$id = get_int("userid");
|
||||
$format = get_str("format", true);
|
||||
$cache_args = "userid=$id";
|
||||
if ($format) {
|
||||
if ($format=="xml") {
|
||||
$cache_args .= "&format=xml";
|
||||
}
|
||||
start_cache(USER_PAGE_TTL, $cache_args);
|
||||
|
|
Loading…
Reference in New Issue