Example #1
0
function do_updates()
{
    $id = post_int("id");
    $app = BoincApp::lookup_id($id);
    if (!$app) {
        admin_error_page("no such app");
    }
    $n = post_str("deprecated", true) ? 1 : 0;
    $app->update("deprecated={$n}");
    $n = post_num("weight");
    $app->update("weight={$n}");
    $n = post_int("homogeneous_redundancy");
    $app->update("homogeneous_redundancy={$n}");
    $n = post_int("target_nresults");
    $app->update("target_nresults={$n}");
    $n = post_str("homogeneous_app_version", true) ? 1 : 0;
    $app->update("homogeneous_app_version={$n}");
    $n = post_str("non_cpu_intensive", true) ? 1 : 0;
    $app->update("non_cpu_intensive={$n}");
    $n = post_str("beta", true) ? 1 : 0;
    $app->update("beta={$n}");
    $n = post_str("fraction_done_exact", true) ? 1 : 0;
    $app->update("fraction_done_exact={$n}");
    echo "Application {$id} updated.\n        <p>\n        You must restart the project for this to take effect.\n    ";
}
function hide_explanation()
{
    switch (post_int("category", true)) {
        case 1:
            $c = "Obscene";
            break;
        case 2:
            $c = "Flame/Hate mail";
            break;
        case 3:
            $c = "Commercial spam";
            break;
        case 4:
            $c = "Double post";
            break;
        case 5:
            $c = "User Request";
            break;
        default:
            $c = "Other";
            break;
    }
    $x = "\nYour post was categorized as " . $c;
    $x .= mod_comment();
    return $x;
}
Example #3
0
function handle_add_confirm($user)
{
    $destid = post_int('userid');
    $destuser = BoincUser::lookup_id($destid);
    if (!$destuser) {
        error_page("No such user");
    }
    check_pending($user, $destuser);
    check_ignoring($user, $destuser);
    $msg = post_str('message', true);
    if ($msg) {
        $msg = sanitize_tags(BoincDb::escape_string($msg));
    }
    $now = time();
    $ret = BoincFriend::replace("user_src={$user->id}, user_dest={$destid}, message='{$msg}', create_time={$now}, reciprocated=0");
    if (!$ret) {
        error_page(tra("Database error"));
    }
    $now = time();
    $type = NOTIFY_FRIEND_REQ;
    BoincNotify::replace("userid={$destid}, create_time={$now}, type={$type}, opaque={$user->id}");
    BoincForumPrefs::lookup($destuser);
    if ($destuser->prefs->pm_notification == 1) {
        send_friend_request_email($user, $destuser, $msg);
    }
    page_head(tra("Friend request sent"));
    echo tra("We have notified %1 of your request.", "<b>" . $destuser->name . "</b>");
    page_tail();
}
Example #4
0
function user_permissions_action()
{
    $bitset = '';
    for ($i = 0; $i < S_NFLAGS; $i++) {
        if (post_int("role" . $i, TRUE) == 1) {
            $bitset .= '1';
            echo "<br> setting {$i}";
        } else {
            $bitset .= '0';
        }
    }
    $userid = post_int("userid");
    $query = "UPDATE forum_preferences SET special_user='******' WHERE userid={$userid}";
    _mysql_query($query);
    Header("Location: user_permissions.php");
}
function update()
{
    $id = post_int("id");
    $av = BoincAppVersion::lookup_id($id);
    if (!$av) {
        error_page("no such app version");
    }
    $n = post_str("beta", true) ? 1 : 0;
    $av->update("beta={$n}");
    $n = post_str("deprecated", true) ? 1 : 0;
    $av->update("deprecated={$n}");
    $n = post_int("min_core_version");
    $av->update("min_core_version={$n}");
    $n = post_int("max_core_version");
    $av->update("max_core_version={$n}");
    echo "<b>Updated app version {$id}.  This change will take effect when you restart the project.</b><p>";
}
Example #6
0
function handle_suspend($user)
{
    global $g_logged_in_user;
    $dt = post_int('suspend_for', true);
    $reason = $_POST['suspend_reason'];
    if ($dt > 0 && empty($reason)) {
        admin_error_page("You must supply a reason for a suspension.\n            <p><a href=manage_user.php?userid={$user->id}>Try again</a>");
    } else {
        if (is_numeric($dt)) {
            $t = $dt > 0 ? time() + $dt : 0;
            $q = "UPDATE forum_preferences SET banished_until={$t} WHERE userid={$user->id}";
            _mysql_query($q);
            // put a timestamp in wiki to trigger re-validation of credentials
            if (function_exists('touch_wiki_user')) {
                touch_wiki_user($user);
            }
            // Send suspension e-mail to user and administrators
            if ($dt > 0) {
                $subject = PROJECT . " posting privileges suspended for " . $user->name;
                $body = "\nForum posting privileges for the " . PROJECT . " user \"" . $user->name . "\"\nhave been suspended for " . time_diff($dt) . " by " . $g_logged_in_user->name . ". \nThe reason given was:\n\n{$reason}\n\nThe suspension will end at " . time_str($t) . "\n";
            } else {
                $subject = PROJECT . " user " . $user->name . " unsuspended";
                $body = "\nForum posting privileges for the " . PROJECT . " user \"" . $user->name . "\"\nhave been restored by " . $g_logged_in_user->name . "\n";
                if ($reason) {
                    $body .= "The reason given was:\n\n   {$reason}\n";
                }
            }
            send_email($user, $subject, $body);
            $emails = explode(",", POST_REPORT_EMAILS);
            foreach ($emails as $email) {
                $admin->email_addr = $email;
                send_email($admin, $subject, $body);
            }
        }
    }
}
    }
    $images_as_links = $_POST["forum_images_as_links"] != "" ? 1 : 0;
    $link_popup = $_POST["forum_link_popup"] != "" ? 1 : 0;
    $hide_avatars = $_POST["forum_hide_avatars"] != "" ? 1 : 0;
    $hide_signatures = $_POST["forum_hide_signatures"] != "" ? 1 : 0;
    $highlight_special = $_POST["forum_highlight_special"] != "" ? 1 : 0;
    $jump_to_unread = $_POST["forum_jump_to_unread"] != "" ? 1 : 0;
    $ignore_sticky_posts = $_POST["forum_ignore_sticky_posts"] != "" ? 1 : 0;
    $no_signature_by_default = $_POST["signature_by_default"] != "" ? 0 : 1;
    $signature = post_str("signature", true);
    if (strlen($signature) > 250) {
        error_page(tra("Your signature was too long, please keep it less than 250 characters."));
    }
    $forum_sort = post_int("forum_sort");
    $thread_sort = post_int("thread_sort");
    $display_wrap_postcount = post_int("forum_display_wrap_postcount");
    if ($display_wrap_postcount < 1) {
        $display_wrap_postcount = 1;
    }
    $signature = BoincDb::escape_string($signature);
    $user->prefs->update("images_as_links={$images_as_links}, link_popup={$link_popup}, hide_avatars={$hide_avatars}, hide_signatures={$hide_signatures}, highlight_special={$highlight_special}, jump_to_unread={$jump_to_unread}, ignore_sticky_posts={$ignore_sticky_posts}, no_signature_by_default={$no_signature_by_default}, avatar='{$avatar_url}', signature='{$signature}', forum_sorting={$forum_sort}, thread_sorting={$thread_sort}, display_wrap_postcount={$display_wrap_postcount}");
}
// DISABLE_FORUMS
$add_user_to_filter = $_POST["add_user_to_filter"] != "";
if ($add_user_to_filter) {
    $user_to_add = trim($_POST["forum_filter_user"]);
    if ($user_to_add != "" and $user_to_add == strval(intval($user_to_add))) {
        $other_user = BoincUser::lookup_id($user_to_add);
        if (!$other_user) {
            echo tra("No such user:"******" " . $user_to_add;
        } else {
// BOINC is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// See the GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with BOINC.  If not, see <http://www.gnu.org/licenses/>.
require_once "../inc/util_ops.inc";
$cancel = post_int('cancel', true);
$hide_canceled = post_str('hide_canceled', true);
$hide_dlerr = post_str('hide_dlerr', true);
$appid = post_int('appid', true);
$WU = post_arr('WU', true);
$back = post_str('back', true);
$clause = post_str('clause', true);
$limit = post_int('limit', true);
if (!$limit || $limit == 0) {
    $limit = 20;
}
admin_page_head("Cancel Workunits");
// check for WUs to cancel
//
$WUs = "";
if ($cancel && $cancel == 1) {
    if ($WU) {
        foreach ($WU as $key => $value) {
            if ($WUs != "") {
                $WUs = $WUs . ",";
            }
            $WUs = $WUs . $value;
        }
        $result = $thread->update("sticky=0");
        $action_name = "made non-sticky";
        break;
    case "lock":
        $result = $thread->update("locked=1");
        $action_name = "locked";
        break;
    case "unlock":
        $result = $thread->update("locked=0");
        $action_name = "unlocked";
        break;
    case "move":
        if ($forum->parent_type != 0) {
            error_page("No");
        }
        $fid = post_int('forumid');
        $new_forum = BoincForum::lookup_id($fid);
        $result = move_thread($thread, $forum, $new_forum);
        $action_name = "moved from {$forum->title} to {$new_forum->title}";
        break;
    case "title":
        $new_title = post_str('newtitle');
        $title = BoincDb::escape_string($new_title);
        $result = $thread->update("title='{$title}'");
        $action_name = "renamed from '{$thread->title}' to '{$new_title}'";
        break;
    default:
        error_page("Unknown action");
}
if (!$result) {
    error_page("Moderation failed");
//
// You should have received a copy of the GNU Lesser General Public License
// along with BOINC.  If not, see <http://www.gnu.org/licenses/>.
require_once "../inc/db_ops.inc";
require_once "../inc/util_ops.inc";
db_init();
admin_page_head("Manage special users action");
$bitset = '';
for ($i = 0; $i < S_NFLAGS; $i++) {
    if (post_int("role" . $i, TRUE) == '1') {
        $bitset = str_pad($bitset, $i + 1, '1');
    } else {
        $bitset = str_pad($bitset, $i + 1, '0');
    }
}
if ($bitset == "0000000") {
    $bitset = '';
}
$userid = post_int("userid");
$query = "UPDATE forum_preferences SET special_user='******' WHERE userid='{$userid}'";
_mysql_query($query);
if (_mysql_affected_rows() == 1) {
    echo "<center><h2>Success</h2>";
} else {
    echo "<center><h2>Failure</h2>";
}
echo "Query was: {$query}</center>";
//echo "<br><a href=\"manage_special_users.php\">Manage users</a>";
admin_page_tail();
$cvs_version_tracker[] = "\$Id\$";
//Generated automatically - do not edit
Example #11
0
//   such as a week, before purging them.  So active users will always
//   have at least one result in the database.
require_once "../inc/util_ops.inc";
require_once "../inc/email.inc";
function exit_error($message)
{
    echo "Error: {$message} <br>";
    exit;
}
// These are set to large values because otherwise the script has
// a tendency to just stop after some time.
//
ini_set("memory_limit", "20M");
set_time_limit(3600);
$receiver = 0;
$receiver = post_int('receiver', true);
$subject = post_str('subject', true);
$body = post_str('body', true);
$body = stripslashes($body);
admin_page_head("Send mass email");
if ($receiver > 0) {
    db_init();
    switch ($receiver) {
        case 1:
            // all users
            $query = "select * from user where send_email > 0";
            break;
        case 2:
            // unsuccessful users
            $week_ago = time(0) - 7 * 86400;
            $query = "select user.id,user.name,user.email_addr from user left join result on user.id=result.userid where send_email>0 and total_credit=0 and user.create_time<{$week_ago} and isnull(result.id)";
if (!post_str('action', true)) {
    if (!get_str('action', true)) {
        error_page(tra("You must specify an action..."));
    } else {
        $action = get_str('action');
    }
} else {
    $action = post_str('action');
}
$userid = post_int('userid');
$user = BoincUser::lookup_id($userid);
if ($action != "start") {
    error_page("Unknown action");
}
// TODO: create a function for this in forum_banishment_vote.inc to make it more flexible
switch (post_int("category", true)) {
    case 1:
        $mod_category = tra("Obscene");
    case 2:
        $mod_category = tra("Flame/Hate mail");
    case 3:
        $mod_category = tra("User Request");
    default:
        $mod_category = tra("Other");
}
if (post_str('reason', true)) {
    start_vote($config, $logged_in_user, $user, $mod_category, post_str("reason"));
} else {
    start_vote($config, $logged_in_user, $user, $mod_category, "None given");
}
$cvs_version_tracker[] = "\$Id: forum_moderate_post_action.php 13718 2007-09-30 11:17:11Z Rytis \$";
Example #13
0
    $query .= " limit {$limit}";
    return BoincPost::enum_general($query);
}
$logged_in_user = get_logged_in_user(false);
BoincForumPrefs::lookup($logged_in_user);
if ($logged_in_user && $logged_in_user->prefs->privilege(S_MODERATOR)) {
    $show_hidden_posts = true;
} else {
    $show_hidden_posts = false;
}
page_head(tra("Forum search results"));
$search_keywords = post_str("search_keywords", true);
$search_author = post_int("search_author", true);
$search_max_time = post_int("search_max_time");
$search_forum = post_int("search_forum");
$search_sort = post_int("search_sort");
$search_list = explode(" ", $search_keywords);
if ($search_max_time) {
    $min_timestamp = time() - $search_max_time * 3600 * 24;
} else {
    $min_timestamp = 0;
}
$limit = 100;
if ($search_forum == -1) {
    $forum = null;
} else {
    if ($search_forum) {
        $forum = BoincForum::lookup_id($search_forum);
    }
}
$user = null;
Example #14
0
function do_confirmedblock($logged_in_user)
{
    check_tokens($logged_in_user->authenticator);
    $id = post_int("id");
    $blocked_user = BoincUser::lookup_id($id);
    if (!$blocked_user) {
        error_page(tra("no such user"));
    }
    add_ignored_user($logged_in_user, $blocked_user);
    page_head(tra("User %1 blocked", $blocked_user->name));
    echo "<div>" . tra("User %1 has been blocked from sending you private messages.", $blocked_user->name) . "\n";
    echo tra("To unblock, visit %1message board preferences%2", "<a href=\"edit_forum_preferences_form.php\">", "</a>") . "</div>\n";
}
Example #15
0
File: ramp.php Project: happyj/qcn
require_once "../inc/db_ops.inc";
require_once "../project/common.inc";
db_init();
set_time_limit(600);
$user = get_logged_in_user(true);
// authenticate admin-level user
qcn_admin_user_auth($user, true);
$query = "SELECT id, fname, lname, email_addr, addr1, addr2, city, region, postcode, country, latitude, longitude, phone, fax, bshare_coord, bshare_map, bshare_ups, cpu_type, cpu_os, cpu_age, cpu_floor, cpu_admin, cpu_permission, cpu_firewall, cpu_proxy, cpu_internet, cpu_unint_power, sensor_distribute, comments,\n loc_home,\n loc_business,\n loc_affix_perm,\n loc_self_install,\n loc_day_install_sunday,\n loc_time_install_sunday,\n loc_day_install_monday,\n loc_time_install_monday,\n loc_day_install_tuesday,\n loc_time_install_tuesday,\n loc_day_install_wednesday,\n loc_time_install_wednesday,\n loc_day_install_thursday,\n loc_time_install_thursday,\n loc_day_install_friday,\n loc_time_install_friday,\n loc_day_install_saturday,\n loc_time_install_saturday,\n loc_years_host, \n  ramp_type, \n  quake_damage, \n  liquefaction,\n from_unixtime(time_added) time_add, \n from_unixtime(time_edit) time_ed,\n completed,\n from_unixtime(time_completed) time_comp\nfrom qcn_ramp_participant WHERE active=1 ";
$order = "order by country, lname, fname";
$show_aggregate = false;
// start $_POST
$nresults = post_int("nresults", true);
$last_pos = post_int("last_pos", true);
$bUseCSV = post_int("cbUseCSV", true);
$bUseRegional = post_int("cbUseRegional", true);
$bUseComp = post_int("cbUseComp", true);
/*$bUseArchive = post_int("cbUseArchive", true);
$bUseFile  = post_int("cbUseFile", true);
$bUseQuake = post_int("cbUseQuake", true);
$bUseQCNQuake = post_int("cbUseQCNQuake", true);
$bUseLat   = post_int("cbUseLat", true);
$bUseSensor = post_int("cbUseSensor", true);
$bUseTime  = post_int("cbUseTime", true);
$bUseHost = post_int("cbUseHost", true);
$strHostID = post_int("HostID", true);
*/
$selectSort = post_str("selectSort", true);
$strCountry = post_str("db_country", true);
if (!$selectSort) {
    $selectSort = "Last Name";
}
Example #16
0
function delete_badge()
{
    $id = post_int("id");
    $badge = BoincBadge::lookup_id($id);
    if (!$badge) {
        admin_error_page("no such badge");
    }
    BoincBadgeUser::delete("badge_id={$id}");
    BoincBadgeTeam::delete("badge_id={$id}");
    $badge->delete();
}
Example #17
0
function doRAMPSubmit($userid, $rampid, $ramp_type)
{
    /*   print_r($_POST);Array ( [db_id] => 0 [lnm0] => [db_fname] => car [db_lname] => Christensen [db_addr1] => 14525 SW Millikan #76902 [db_addr2] => [db_city] => Beaverton [db_region] => OR [db_postcode_] => [db_country] => United States [db_phone] => +1 215 989 4276 [db_fax] => carlgt1@yahoo.com [db_email_addr] => carlgt6@hotmail.com [lat0] => [lng0] => [addrlookup] => 14525 SW Millikan #76902, , Beaverton, OR, United States [db_bshare_map] => on [db_bshare_coord] => on [db_bshare_ups] => on [db_sensor_distribute] => on [db_cpu_os] => Mac OS X (Intel) [db_cpu_age] => 5 [db_cpu_floor] => 6 [db_cpu_admi
    n] => on [db_cpu_permission] => on [db_cpu_firewall] => on [db_cpu_internet] => on [db_cpu_proxy] => on [db_cpu_unint_power] => on [db_comments] =>
     hkhk [submit] => Submit )
    */
    // copy over post variables to reuse in the fields below, and for the sql insert/update!
    $row["id"] = $rampid;
    $row["ramp_type"] = $ramp_type;
    $row["userid"] = $userid;
    $row["fname"] = mysql_real_escape_string(post_str("db_fname"));
    $row["lname"] = mysql_real_escape_string(post_str("db_lname"));
    $row["email_addr"] = mysql_real_escape_string(post_str("db_email_addr"));
    $row["addr1"] = mysql_real_escape_string(post_str("db_addr1"));
    $row["addr2"] = mysql_real_escape_string(post_str("db_addr2", true));
    // note it's optional
    $row["city"] = mysql_real_escape_string(post_str("db_city"));
    $row["region"] = mysql_real_escape_string(post_str("db_region", true));
    // note it's optional
    $row["country"] = mysql_real_escape_string(post_str("db_country"));
    $row["postcode"] = mysql_real_escape_string(post_str("db_postcode", true));
    // note it's optional
    $row["latitude"] = post_double("lat0", true);
    $row["longitude"] = post_double("lng0", true);
    $row["gmap_placename"] = mysql_real_escape_string(post_str("addrlookup", true));
    // note it's optional
    $row["gmap_view_level"] = 18;
    $row["gmap_view_type"] = 0;
    $row["phone"] = mysql_real_escape_string(post_str("db_phone", true));
    // note it's optional
    $row["fax"] = mysql_real_escape_string(post_str("db_fax", true));
    // note it's optional
    $row["bshare_coord"] = $_POST["db_bshare_coord"] == "on" ? 1 : 0;
    $row["bshare_map"] = $_POST["db_bshare_map"] == "on" ? 1 : 0;
    $row["bshare_ups"] = $_POST["db_bshare_ups"] == "on" ? 1 : 0;
    $row["cpu_type"] = post_str("db_cpu_os", true);
    $row["cpu_os"] = post_str("db_cpu_os", true);
    $row["cpu_age"] = post_int("db_cpu_age", true);
    $row["cpu_floor"] = post_int("db_cpu_floor", true);
    $row["cpu_admin"] = post_int("db_cpu_admin", true);
    $row["cpu_permission"] = post_int("db_cpu_permission", true);
    $row["cpu_firewall"] = post_int("db_cpu_firewall", true);
    $row["cpu_proxy"] = post_int("db_cpu_proxy", true);
    $row["cpu_internet"] = post_int("db_cpu_internet", true);
    $row["cpu_unint_power"] = post_int("db_cpu_unint_power", true);
    $row["sensor_distribute"] = $_POST["db_sensor_distribute"] == "on" ? 1 : 0;
    $row["comments"] = mysql_real_escape_string(post_str("db_comments", true));
    $row["loc_home"] = $_POST["db_loc_home"] == "on" ? 1 : 0;
    $row["loc_business"] = $_POST["db_loc_business"] == "on" ? 1 : 0;
    $row["loc_affix_perm"] = $_POST["db_loc_affix_perm"] == "on" ? 1 : 0;
    $row["loc_self_install"] = $_POST["db_loc_self_install"] == "on" ? 1 : 0;
    $row["loc_day_install_sunday"] = $_POST["db_loc_day_install_sunday"] == "on" ? 1 : 0;
    $row["loc_day_install_monday"] = $_POST["db_loc_day_install_monday"] == "on" ? 1 : 0;
    $row["loc_day_install_tuesday"] = $_POST["db_loc_day_install_tuesday"] == "on" ? 1 : 0;
    $row["loc_day_install_wednesday"] = $_POST["db_loc_day_install_wednesday"] == "on" ? 1 : 0;
    $row["loc_day_install_thursday"] = $_POST["db_loc_day_install_thursday"] == "on" ? 1 : 0;
    $row["loc_day_install_friday"] = $_POST["db_loc_day_install_friday"] == "on" ? 1 : 0;
    $row["loc_day_install_saturday"] = $_POST["db_loc_day_install_saturday"] == "on" ? 1 : 0;
    if ($row["loc_day_install_sunday"]) {
        $row["loc_time_install_sunday"] = post_str("db_loc_time_install_sunday", true);
    } else {
        $row["loc_time_install_sunday"] = "";
    }
    if ($row["loc_day_install_monday"]) {
        $row["loc_time_install_monday"] = post_str("db_loc_time_install_monday", true);
    } else {
        $row["loc_time_install_monday"] = "";
    }
    if ($row["loc_day_install_tuesday"]) {
        $row["loc_time_install_tuesday"] = post_str("db_loc_time_install_tuesday", true);
    } else {
        $row["loc_time_install_tuesday"] = "";
    }
    if ($row["loc_day_install_wednesday"]) {
        $row["loc_time_install_wednesday"] = post_str("db_loc_time_install_wednesday", true);
    } else {
        $row["loc_time_install_wednesday"] = "";
    }
    if ($row["loc_day_install_thursday"]) {
        $row["loc_time_install_thursday"] = post_str("db_loc_time_install_thursday", true);
    } else {
        $row["loc_time_install_thursday"] = "";
    }
    if ($row["loc_day_install_friday"]) {
        $row["loc_time_install_friday"] = post_str("db_loc_time_install_friday", true);
    } else {
        $row["loc_time_install_friday"] = "";
    }
    if ($row["loc_day_install_saturday"]) {
        $row["loc_time_install_saturday"] = post_str("db_loc_time_install_saturday", true);
    } else {
        $row["loc_time_install_saturday"] = "";
    }
    $row["loc_time_hour_install"] = post_int("db_loc_time_hour_install", true);
    if ($row["loc_time_hour_install"] == "") {
        $row["loc_time_hour_install"] = "null";
    }
    $row["loc_time_minute_install"] = post_int("db_loc_time_minute_install", true);
    if ($row["loc_time_minute_install"] == "") {
        $row["loc_time_minute_install"] = "null";
    }
    $row["loc_years_host"] = post_int("db_loc_years_host", true);
    if ($row["loc_years_host"] == "") {
        $row["loc_years_host"] = 1;
    }
    $row["quake_damage"] = post_str("db_quake_damage", true);
    $row["liquefaction"] = $_POST["db_liquefaction"] == "on" ? 1 : 0;
    $mylat = $row["latitude"];
    $mylng = $row["longitude"];
    $zoomout = 1;
    $bInsert = true;
    // insert if no db_id posted (i.e. record exists for this userid
    $sqlStart = "INSERT INTO qcn_ramp_participant SET ";
    $sqlEnd = "";
    if ($row["id"] > 0) {
        $bInsert = false;
        $sqlStart = "UPDATE qcn_ramp_participant SET ";
        $sqlEnd = "WHERE id=" . $row["id"] . " AND userid=" . $row["userid"];
        // node the userid check
    }
    $sqlSet = "userid=" . $row["userid"] . ", \n            qcn_ramp_coordinator_id = NULL, \n            fname='" . $row["fname"] . "', \n            lname='" . $row["lname"] . "', \n            email_addr='" . $row["email_addr"] . "', \n            addr1='" . $row["addr1"] . "', \n            addr2='" . $row["addr2"] . "', \n            city='" . $row["city"] . "', \n            region='" . $row["region"] . "', \n            country='" . $row["country"] . "', \n            postcode='" . $row["postcode"] . "', \n            latitude=" . $row["latitude"] . ", \n            longitude=" . $row["longitude"] . ", \n            gmap_placename='" . $row["gmap_placename"] . "', \n            gmap_view_level=" . $row["gmap_view_level"] . ", \n            gmap_view_type=" . $row["gmap_view_type"] . ", \n            phone='" . $row["phone"] . "', \n            fax='" . $row["fax"] . "', \n            bshare_coord=" . $row["bshare_coord"] . ", \n            bshare_map=" . $row["bshare_map"] . ", \n            bshare_ups=" . $row["bshare_ups"] . ", \n            cpu_type='" . $row["cpu_type"] . "', \n            cpu_os='" . $row["cpu_os"] . "', \n            cpu_age=" . $row["cpu_age"] . ", \n            cpu_floor=" . $row["cpu_floor"] . ", \n            cpu_admin=" . $row["cpu_admin"] . ", \n            cpu_permission=" . $row["cpu_permission"] . ", \n            cpu_firewall=" . $row["cpu_firewall"] . ", \n            cpu_proxy=" . $row["cpu_proxy"] . ", \n            cpu_internet=" . $row["cpu_internet"] . ", \n            cpu_unint_power=" . $row["cpu_unint_power"] . ",             \n            sensor_distribute=" . $row["sensor_distribute"] . ", \n            loc_home=" . $row["loc_home"] . ",\n            loc_business=" . $row["loc_business"] . ",\n            loc_affix_perm=" . $row["loc_affix_perm"] . ",\n            loc_self_install=" . $row["loc_self_install"] . ",\n            loc_day_install_sunday=" . $row["loc_day_install_sunday"] . ",\n            loc_day_install_monday=" . $row["loc_day_install_monday"] . ",\n            loc_day_install_tuesday=" . $row["loc_day_install_tuesday"] . ",\n            loc_day_install_wednesday=" . $row["loc_day_install_wednesday"] . ",\n            loc_day_install_thursday=" . $row["loc_day_install_thursday"] . ",\n            loc_day_install_friday=" . $row["loc_day_install_friday"] . ",\n            loc_day_install_saturday=" . $row["loc_day_install_saturday"] . ",\n            loc_time_install_sunday='" . $row["loc_time_install_sunday"] . "',\n            loc_time_install_monday='" . $row["loc_time_install_monday"] . "',\n            loc_time_install_tuesday='" . $row["loc_time_install_tuesday"] . "',\n            loc_time_install_wednesday='" . $row["loc_time_install_wednesday"] . "',\n            loc_time_install_thursday='" . $row["loc_time_install_thursday"] . "',\n            loc_time_install_friday='" . $row["loc_time_install_friday"] . "',\n            loc_time_install_saturday='" . $row["loc_time_install_saturday"] . "',\n            loc_years_host=" . $row["loc_years_host"] . ",\n            comments='" . $row["comments"] . "', \n            ramp_type='" . $row["ramp_type"] . "', \n            quake_damage='" . $row["quake_damage"] . "', \n            liquefaction=" . $row["liquefaction"] . ", \n            active=1, time_edit=unix_timestamp() " . ($bInsert ? ", time_added=unix_timestamp() " : "");
    //echo "<BR><BR>" . $sqlStart . $sqlSet . $sqlEnd . "<BR><BR>";
    //echo $sqlStart . $sqlSet . $sqlEnd;
    $result = mysql_query($sqlStart . $sqlSet . $sqlEnd);
    if ($result) {
        if ($bInsert) {
            // get the insert id
            $row["id"] = mysql_insert_id();
            if (!$row["id"]) {
                echo "<BR><BR><B><center><font color=red>Database Error in inserting information - please try later or review your submission!</font></center></b><BR><BR>";
            }
        }
        //mysql_free_result($result);
        return "<BR><BR><center><B>Your submission has been saved.  Thank you for taking part in QCN RAMP!</font></center></b><BR><BR>";
    } else {
        //echo $sqlStart . $sqlSet . $sqlEnd;
        return "<BR><BR><B><center><font color=red>Error in updating information - please try later or review your submission!</font></center></b><BR><BR>";
    }
    return "";
}
//
// This file was modified by contributors of "BOINC Web Tweak" project.
require_once "../inc/boinc_db.inc";
require_once "../inc/util.inc";
require_once "../inc/team.inc";
$user = get_logged_in_user();
$teamid = post_int("id");
$team = BoincTeam::lookup_id($teamid);
if (!$team) {
    error_page("No such team");
}
require_founder_login($user, $team);
page_head("Removing users from {$team->name}");
$ndel = 0;
for ($i = 0; $i < $_POST["ninactive_users"]; $i++) {
    $userid = post_int("remove_{$i}", true);
    if (!$userid) {
        continue;
    }
    $user = BoincUser::lookup_id($userid);
    if (!$user) {
        continue;
    }
    if ($user->teamid != $team->id) {
        echo "<br>{$user->name} is not a member of {$team->name}";
    } else {
        user_quit_team($user);
        echo "<br>{$user->name} has been removed";
        $ndel++;
    }
}
<?php

include_once "../inc/db.inc";
include_once "../inc/util.inc";
include_once "../inc/prefs.inc";
include_once "../inc/queue.inc";
db_init();
$timestr = time_str(time(0));
$jobapplication = post_int('application');
$jobname = escapeshellarg($_POST['name']);
$jobinput = post_str('input');
$jobfops = post_int('fops');
$jobdisk = post_int('disk');
$jobmem = post_int('mem');
if (get_magic_quotes_gpc()) {
    $jobinput = stripslashes($jobinput);
}
$config = get_config();
$name = parse_config($config, "<long_name>");
$user = get_logged_in_user();
$jobapplicationname = mysql_fetch_object(mysql_query("SELECT * FROM app WHERE id=" . $jobapplication));
$app = $jobapplicationname;
$jobapplicationfriendlyname = $jobapplicationname->user_friendly_name;
$jobapplicationname = $jobapplicationname->name;
$title = "New job for '" . $jobname . "' " . $user->name . " at " . $timestr;
page_head($title);
start_table();
row1("Job speciffics");
row2("Job application: ", $jobapplicationfriendlyname);
row2("Job name: ", $jobname);
row2("Job estimated time to complete: ", floor((double) $jobfops / 92254963740.0) . " min. ");
Example #20
0
// You should have received a copy of the GNU Lesser General Public License
// along with BOINC.  If not, see <http://www.gnu.org/licenses/>.
// This file allows people to rate posts in a thread
require_once '../inc/forum.inc';
require_once '../inc/util.inc';
$config = get_config();
if (parse_bool($config, "no_forum_rating")) {
    page_head(tra("Rating offline"));
    echo tra("This function is turned off by the project");
    page_tail();
    exit(0);
}
if (!empty($_GET['post'])) {
    $postId = get_int('post');
    $choice = post_str('submit', true);
    $rating = post_int('rating', true);
    if (!$choice) {
        $choice = get_str('choice', true);
    }
    if ($choice == SOLUTION or $choice == "p") {
        $rating = 1;
    } else {
        $rating = -1;
    }
    $user = get_logged_in_user();
    if ($choice == null && ($rating == null || $rating > 2 || $rating < -2)) {
        show_result_page(false, NULL, NULL, $choice);
    }
    $post = BoincPost::lookup_id($postId);
    $thread = BoincThread::lookup_id($post->thread);
    $forum = BoincForum::lookup_id($thread->forum);
Example #21
0
$config = get_config();
if (parse_bool($config, "disable_account_creation") || parse_bool($config, "no_web_account_creation")) {
    error_page("Account creation is disabled");
}
$privatekey = parse_config($config, "<recaptcha_private_key>");
if ($privatekey) {
    $recaptcha = new ReCaptcha($privatekey);
    $resp = $recaptcha->verifyResponse($_SERVER["REMOTE_ADDR"], $_POST["g-recaptcha-response"]);
    if (!$resp->success) {
        show_error(tra("Your reCAPTCHA response was not correct. Please try again."));
    }
}
// see whether the new account should be pre-enrolled in a team,
// and initialized with its founder's project prefs
//
$teamid = post_int("teamid", true);
if ($teamid) {
    $team = BoincTeam::lookup_id($teamid);
    $clone_user = BoincUser::lookup_id($team->userid);
    if (!$clone_user) {
        error_page("User {$userid} not found");
    }
    $project_prefs = $clone_user->project_prefs;
} else {
    $teamid = 0;
    $project_prefs = "";
}
if (defined('INVITE_CODES')) {
    $invite_code = post_str("invite_code");
    if (strlen($invite_code) == 0) {
        show_error(tra("You must supply an invitation code to create an account."));
Example #22
0
function edit_action($forum)
{
    $title = strip_tags(post_str('title'));
    $title = BoincDb::escape_string($title);
    $description = strip_tags(post_str('description'));
    $description = BoincDb::escape_string($description);
    $post_min_interval = post_int('post_min_interval');
    $post_min_total_credit = post_int('post_min_total_credit');
    $post_min_expavg_credit = post_int('post_min_expavg_credit');
    $ret = $forum->update("title='{$title}', description='{$description}', post_min_interval={$post_min_interval}, post_min_total_credit={$post_min_total_credit}, post_min_expavg_credit={$post_min_expavg_credit}");
    if ($ret) {
        page_head("Team Message Board Updated");
        echo "Update successful";
        page_tail();
    } else {
        error_page("update failed");
    }
}
Example #23
0
//
// BOINC is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// See the GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with BOINC.  If not, see <http://www.gnu.org/licenses/>.
// Redirect user to PayPal system
require_once "../inc/util.inc";
db_init();
$logged_in_user = get_logged_in_user(false);
$amount = post_str("inV");
$item_id = post_int("item_id", true);
if ($item_id == null) {
    $item_id = 1;
}
$currency = post_str("currency");
if (post_int("anonymous", true) == 1 || $logged_in_user == null) {
    $userid = 0;
} else {
    $userid = $logged_in_user->id;
}
$order_time = time();
// Write user id to paypal table, so the return script knows it's expecting this payment
mysql_query("INSERT INTO donation_paypal SET order_time = '" . $order_time . "', userid = '{$userid}', item_number=" . $item_id . ", order_amount = '" . boinc_real_escape_string($amount) . "'");
$payment_id = mysql_insert_id();
$URL = "www.paypal.com/cgi-bin/webscr";
$fields = "cmd=_xclick&lc=US&business=" . PAYPAL_ADDRESS . "&quantity=1&item_name=Donation&item_number=" . $payment_id . "_" . $order_time . "&amount=" . $amount . "&no_shipping=1&return=" . URL_BASE . "donated.php?st=Completed&rm=2&cancel_return=" . URL_BASE . "/donated.php&no_note=1&currency_code=" . $currency . "&bn=PP-BuyNowBF";
header("Location: https://{$URL}?{$fields}");
exit;
// either version 3 of the License, or (at your option) any later version.
//
// BOINC is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// See the GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with BOINC.  If not, see <http://www.gnu.org/licenses/>.
require_once "../inc/boinc_db.inc";
require_once "../inc/util.inc";
require_once "../inc/team.inc";
check_get_args(array("tnow", "ttok"));
$user = get_logged_in_user(true);
check_tokens($user->authenticator);
$teamid = post_int("teamid");
$team = BoincTeam::lookup_id($teamid);
require_team($team);
if (!$team->joinable) {
    error_page(tra("The team %1 is not joinable.", $team->name));
}
if ($user->teamid == $team->id) {
    page_head(tra("Already a member"));
    echo tra("You are already a member of %1.", $team->name);
} else {
    $success = user_join_team($team, $user);
    if ($success) {
        page_head(tra("Joined %1", $team->name));
        echo tra("You have joined %1.", "<a href=team_display.php?teamid={$team->id}>{$team->name}</a>");
    } else {
        error_page(tra("Couldn't join team - please try again later."));
Example #25
0
if (isset($_POST['special_user']) && $user && $is_admin) {
    $bits = "";
    for ($i = 0; $i < $Nbf; $i++) {
        $key = "special_user_{$i}";
        if (array_key_exists($key, $_POST) && $_POST[$key]) {
            $bits .= "1";
        } else {
            $bits .= "0";
        }
    }
    $q = "UPDATE forum_preferences SET special_user=\"{$bits}\" WHERE userid={$id}";
    mysql_query($q);
}
// Process a suspension:
if (isset($_POST['suspend_submit']) && !empty($user) && $is_admin) {
    $dt = post_int('suspend_for', true);
    if ($is_admin || $is_mod && $dt < 86400) {
        $reason = $_POST['suspend_reason'];
        if ($dt > 0 && empty($reason)) {
            error_page("You must supply a reason for a suspension.\n                <p><a href=manage_user.php?userid={$user->id}>Try again</a>");
        } else {
            if (is_numeric($dt)) {
                $t = time() + $dt;
                $q = "UPDATE forum_preferences SET banished_until={$t} WHERE userid={$id}";
                mysql_query($q);
                // put a timestamp in wiki to trigger re-validation of credentials
                if (function_exists('touch_wiki_user')) {
                    touch_wiki_user($user);
                }
                // Send suspension e-mail to user and administrators
                if ($dt > 0) {