Ejemplo n.º 1
0
function error_page_404($location = null)
{
    if (!$location && isset($_SERVER['REQUEST_URI'])) {
        $location = $_SERVER['REQUEST_URI'];
    }
    error_page('HTTP/1.0 404 Not Found', '404 Not Found', $location ? 'File "' . $location . '" not found.' : null);
}
Ejemplo n.º 2
0
function show_stats($brand)
{
    switch ($brand) {
        case 1:
            $x = "HTC Power to Give";
            break;
        default:
            error_page("invalid brand");
    }
    $hosts = BoincHost::enum("os_name='Android' and serialnum like '%{$x}%'");
    $n = 0;
    $t = 0;
    $a = 0;
    foreach ($hosts as $h) {
        $t += $h->total_credit;
        $a += $h->expavg_credit;
        if ($h->expavg_credit > 0.1) {
            $n++;
        }
    }
    page_head("Stats for {$x}");
    start_table();
    row2("Active devices", $n);
    row2("Average daily credit", $a);
    row2("Total credit", $t);
    end_table();
    page_tail();
}
Ejemplo n.º 3
0
function compare_aux($select_name, $xset_name, $snap)
{
    global $top_unit, $course_id, $filter, $filter_cat;
    global $breakdown, $breakdown_cat;
    get_filters_from_form();
    $select_unit = lookup_unit($top_unit, $select_name);
    if (!$select_unit) {
        error_page("no select unit");
    }
    admin_page_head("Unit comparison");
    echo "\n\t\t<link rel=\"stylesheet\" type=\"text/css\" href=\"" . URL_BASE . "bolt_admin.css\">\n\t\tThe following compares the alternatives of\n\t\t<b>{$select_name}</b> with respect to <b>{$xset_name}</b>.\n\t\t<p>\n\t";
    echo "<table class=\"bolt_box\">";
    if ($breakdown) {
        echo "<tr class=bolt_head1><td colspan=2>Total</td></tr>";
    }
    compare_case(null, $select_unit, $snap, $filter, $filter_cat, null, null);
    if ($breakdown) {
        echo "<tr class=bolt_head1><td colspan=2>Breakdown by " . $breakdown->name() . "</td></tr>";
        foreach ($breakdown->categories() as $c) {
            compare_case($c, $select_unit, $snap, $filter, $filter_cat, $breakdown, $c);
            echo "<p>";
        }
    }
    echo "</table>";
    echo "\n\t\t<form action=bolt_compare.php>\n\t\t<input type=hidden name=action value=compare>\n\t\t<input type=hidden name=course_id value={$course_id}>\n\t\t<input type=hidden name=select_name value=\"{$select_name}\">\n\t\t<input type=hidden name=xset_name value=\"{$xset_name}\">\n\t\t<table width=600><tr><td>\n\t";
    filter_form($filter ? $filter->name() : "", $filter_cat);
    echo "</td><td>";
    breakdown_form($breakdown ? $breakdown->name() : "");
    echo "\n\t\t</td></tr></table>\n\t\t<p>\n\t\t<input type=submit value=OK>\n\t\t</form>\n\t";
    admin_page_tail();
}
Ejemplo n.º 4
0
function search_action()
{
    $where = "true";
    $search_string = get_str('search_string');
    if (strlen($search_string)) {
        if (strlen($search_string) < 3) {
            error_page(tra("search string must be at least 3 characters"));
        }
        $s = BoincDb::escape_string($search_string);
        $s = escape_pattern($s);
        $where .= " and name like '{$s}%'";
    }
    $country = get_str('country');
    if ($country != 'any') {
        $s = BoincDb::escape_string($country);
        $where .= " and country='{$s}'";
    }
    $t = get_str('team');
    if ($t == 'yes') {
        $where .= " and teamid<>0";
    } else {
        if ($t == 'no') {
            $where .= " and teamid=0";
        }
    }
    $t = get_str('profile');
    if ($t == 'yes') {
        $where .= " and has_profile<>0";
    } else {
        if ($t == 'no') {
            $where .= " and has_profile=0";
        }
    }
    $search_type = get_str('search_type', true);
    $order_clause = "id desc";
    if ($search_type == 'rac') {
        $order_clause = "expavg_credit desc";
    } else {
        if ($search_type == 'total') {
            $order_clause = "total_credit desc";
        }
    }
    $fields = "id, create_time, name, country, total_credit, expavg_credit, teamid, url, has_profile, donated";
    $users = BoincUser::enum_fields($fields, $where, "order by {$order_clause} limit 100");
    page_head(tra("User search results"));
    $n = 0;
    foreach ($users as $user) {
        if ($n == 0) {
            start_table();
            table_header(tra("Name"), tra("Team"), tra("Average credit"), tra("Total credit"), tra("Country"), tra("Joined"));
        }
        show_user($user);
        $n++;
    }
    end_table();
    if (!$n) {
        echo tra("No users match your search criteria.");
    }
    page_tail();
}
Ejemplo n.º 5
0
function upload_guardian()
{
    $path = 'images/unknown.png';
    $file = $_FILES['picture'];
    if (empty($file['tmp_name'])) {
        return $path;
    }
    if ($file['size'] > 512000) {
        error_page('You are too big. >/////<');
    }
    if (!getimagesize($file['tmp_name'])) {
        error_page('not an image file.  >.^');
    }
    if (($pos = strrpos($file['name'], '.')) && in_array(strtolower(substr($file['name'], $pos)), array('.jpg', '.jpeg', '.png'))) {
    } else {
        error_page('the image is not allowed');
    }
    $upload_path = '../stub/' . md5(uniqid(mt_rand(), true));
    if (move_uploaded_file($file['tmp_name'], $upload_path)) {
        $path = $upload_path;
    } else {
        error_page('unknown error.');
    }
    return $path;
}
Ejemplo n.º 6
0
function compare_gen($select_name, $xset_name, $n, $a1, $d1, $x, $a2, $d2)
{
    global $course;
    $top_unit = (require_once $course->doc_file());
    $select_unit = lookup_unit($top_unit, $select_name);
    if (!$select_unit) {
        error_page("no such select unit");
    }
    if (!lookup_unit($top_unit, $xset_name)) {
        error_page("no such xset");
    }
    $m = count($select_unit->units);
    for ($i = 0; $i < $n; $i++) {
        $uid = random_student();
        $t1 = time();
        $t2 = $t1 + 1;
        $j = rand(0, $m - 1);
        $child = $select_unit->units[$j];
        BoltSelectFinished::insert("(user_id, course_id, end_time, name, selected_unit) values ({$uid}, {$course->id}, {$t1}, '{$select_name}', '{$child->name}')");
        if ($child->name == $x) {
            $score = urand($a2, $d2);
        } else {
            $score = urand($a1, $d1);
        }
        BoltXsetResult::insert("(create_time, user_id, course_id, start_time, end_time, name, score) values ({$t2}, {$uid}, {$course->id}, {$t2}, {$t2}, '{$xset_name}', {$score})");
    }
}
Ejemplo n.º 7
0
function form_validate()
{
    global $mybb;
    $t = form_token();
    if ($t != $_POST['_t']) {
        error_page('Sorry, the form you submitted was invalid. Please try again.');
    }
}
Ejemplo n.º 8
0
function auth_page()
{
    if (!session_is_vaild()) {
        // failed!
        error_page("Session non-exist or expired, please login again and make sure to turn on the cookie support.");
        exit;
    }
    return 0;
}
Ejemplo n.º 9
0
function delete_profile($user)
{
    $result = BoincProfile::delete_aux("userid = {$user->id}");
    if (!$result) {
        error_page("couldn't delete profile - please try again later");
    }
    delete_user_pictures($user->id);
    page_head("Delete Confirmation");
    $user->update("has_profile=0");
    echo "Your profile has been deleted<br />";
    page_tail();
}
Ejemplo n.º 10
0
function sendHTMLPage()
{
    $menu = MainMenu::getInstance();
    $page = Page::getInstance();
    if ($page->getError()) {
        header($_SERVER["SERVER_PROTOCOL"] . " 404 Not Found");
        error_page();
        exit;
    }
    header("Content-Type: text/html; charset=utf-8");
    if (sendHeaders()) {
        echo HTML();
    }
}
Ejemplo n.º 11
0
function add_app()
{
    $name = BoincDb::escape_string(post_str('add_name'));
    $user_friendly_name = BoincDb::escape_string(post_str('add_user_friendly_name'));
    if (empty($name) || empty($user_friendly_name)) {
        error_page("To add a new application please supply both a brief name and a longer 'user-friendly' name.</font></p>");
    }
    $now = time();
    $id = BoincApp::insert("(name,user_friendly_name,create_time) VALUES ('{$name}', '{$user_friendly_name}', {$now})");
    if (!$id) {
        error_page("insert failed");
    }
    echo "Application added.\n        <p>\n        You must restart the project for this to take effect.\n    ";
}
Ejemplo n.º 12
0
function exception_error($e)
{
    $s = '<dl>';
    //  $s .= get_dtdd("Message",$e->getMessage());
    //  $s .= get_dtdd("Previous",$e->getPrevious());
    $s .= get_dtdd("Code", $e->getCode());
    //  $s .= get_dtdd("File",$e->getFile());
    //  $s .= get_dtdd("Line",$e->getLine());
    //  $s .= get_dtdd("Trace",$e->getTrace());
    //  $s .= get_dtdd("TraceAsString",$e->getTraceAsString());
    //  $s .= get_dtdd("ToString",$e->__toString());
    $s .= "</dl>";
    error_page($s);
}
Ejemplo n.º 13
0
function delete_storylink($linkid)
{
    if (!is_numeric($linkid)) {
        return;
    }
    $query = "SELECT * FROM " . table_links . " WHERE link_id = '{$linkid}'";
    if (!($result = mysql_query($query))) {
        error_page(mysql_error());
    } else {
        $sql_array = mysql_fetch_object($result);
    }
    # delete the story link
    $query = "DELETE FROM " . table_links . " WHERE link_id = '{$linkid}'";
    if (!($result = mysql_query($query))) {
        error_page(mysql_error());
    }
    # delete the story comments
    $query = "DELETE FROM " . table_comments . " WHERE comment_link_id = '{$linkid}'";
    if (!($result = mysql_query($query))) {
        error_page(mysql_error());
    }
    # delete the saved links
    $query = "DELETE FROM " . table_saved_links . " WHERE saved_link_id = '{$linkid}'";
    if (!($result = mysql_query($query))) {
        error_page(mysql_error());
    }
    # delete the story tags
    $query = "DELETE FROM " . table_tags . " WHERE tag_link_id = '{$linkid}'";
    if (!($result = mysql_query($query))) {
        error_page(mysql_error());
    }
    # delete the story trackbacks
    $query = "DELETE FROM " . table_trackbacks . " WHERE trackback_link_id = '{$linkid}'";
    if (!($result = mysql_query($query))) {
        error_page(mysql_error());
    }
    # delete the story votes
    $query = "DELETE FROM " . table_votes . " WHERE vote_link_id = '{$linkid}'";
    if (!($result = mysql_query($query))) {
        error_page(mysql_error());
    }
    # delete additional categories
    $query = "DELETE FROM " . table_additional_categories . " WHERE ac_link_id = '{$linkid}'";
    if (!($result = mysql_query($query))) {
        error_page(mysql_error());
    }
    // module system hook
    $vars = array('link_id' => $linkid);
    check_actions('admin_story_delete', $vars);
}
function db_query($query)
{
    global $link, $queries;
    $time0 = microtime(true);
    $result = mysqli_query($link, $query);
    $time1 = microtime(true);
    $elapsed = $time1 - $time0;
    if (TEST) {
        $queries .= $query . ' ' . $elapsed . "\n";
    }
    if (!$result) {
        error_page("Database error: " . mysqli_error($link) . (TEST ? '<br/>Query: ' . $query : ''));
    } else {
        return $result;
    }
}
Ejemplo n.º 15
0
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>";
}
Ejemplo n.º 16
0
function show_batch($user)
{
    $batch_id = get_int('batch_id');
    $batch = BoincBatch::lookup_id($batch_id);
    if (!$batch || $batch->user_id != $user->id) {
        error_page("no batch");
    }
    page_head("Batch {$batch->id}");
    $results = BoincResult::enum("batch={$batch->id} order by workunitid");
    $i = 0;
    result_table_start(true, true, null);
    foreach ($results as $result) {
        show_result_row($result, true, true, true, $i++);
    }
    end_table();
    page_tail();
}
Ejemplo n.º 17
0
function add_admin($team)
{
    $email_addr = get_str('email_addr');
    $user = BoincUser::lookup("email_addr='{$email_addr}'");
    if (!$user) {
        error_page(tra("no such user"));
    }
    if ($user->teamid != $team->id) {
        error_page(tra("User is not member of team"));
    }
    if (is_team_admin($user, $team)) {
        error_page(tra("%1 is already an admin of %2", $email_addr, $team->name));
    }
    $now = time();
    $ret = BoincTeamAdmin::insert("(teamid, userid, create_time) values ({$team->id}, {$user->id}, {$now})");
    if (!$ret) {
        error_page(tra("Couldn't add admin"));
    }
}
Ejemplo n.º 18
0
function delete_storylink($linkid)
{
    if (!is_numeric($linkid)) {
        return;
    }
    $query = "SELECT * FROM " . table_links . " WHERE link_id = '{$linkid}'";
    if (!($result = mysql_query($query))) {
        error_page(mysql_error());
    } else {
        $sql_array = mysql_fetch_object($result);
    }
    # delete the story link
    $query = "DELETE FROM " . table_links . " WHERE link_id = '{$linkid}'";
    if (!($result = mysql_query($query))) {
        error_page(mysql_error());
    }
    # delete the story comments
    $query = "DELETE FROM " . table_comments . " WHERE comment_link_id = '{$linkid}'";
    if (!($result = mysql_query($query))) {
        error_page(mysql_error());
    }
    # delete the saved links
    $query = "DELETE FROM " . table_saved_links . " WHERE saved_link_id = '{$linkid}'";
    if (!($result = mysql_query($query))) {
        error_page(mysql_error());
    }
    # delete the story tags
    $query = "DELETE FROM " . table_tags . " WHERE tag_link_id = '{$linkid}'";
    if (!($result = mysql_query($query))) {
        error_page(mysql_error());
    }
    # delete the story trackbacks
    $query = "DELETE FROM " . table_trackbacks . " WHERE trackback_link_id = '{$linkid}'";
    if (!($result = mysql_query($query))) {
        error_page(mysql_error());
    }
    # delete the story votes
    $query = "DELETE FROM " . table_votes . " WHERE vote_link_id = '{$linkid}'";
    if (!($result = mysql_query($query))) {
        error_page(mysql_error());
    }
}
Ejemplo n.º 19
0
function validate()
{
    $x = get_str("x");
    $u = get_int("u");
    $user = lookup_user_id($u);
    if (!$user) {
        error_page(tra("No such user."));
    }
    $x2 = $user->signature;
    if ($x2 != $x) {
        error_page(tra("Error in URL data - can't validate email address"));
    }
    $result = $user->update("email_validated=1");
    if (!$result) {
        error_page(tra("Database update failed - please try again later."));
    }
    page_head(tra("Validate email address"));
    echo tra("The email address of your account has been validated.");
    page_tail();
}
Ejemplo n.º 20
0
function sendrequest($rpcres, $errortype)
{
    $debug = debug_backtrace();
    $line = $debug[0]['line'];
    $function = $debug[0]['function'];
    if ($errortype == '0') {
        if (is_a($rpcres, "PHPRPC_Error")) {
            error_page(101, $rpcres->Message, $line, $function);
        }
        if ($rpcres['response']['statcode'] != 200) {
            error_page($rpcres['response']['msgcode'], $rpcres['response']['message'], $line, $function);
        }
    } elseif ($errortype == '1') {
        if (is_a($rpcres, "PHPRPC_Error")) {
            error_popbox(101, $rpcres->Message, $line, $function, null, 'submit_failed');
        }
        if ($rpcres['response']['statcode'] != 200) {
            error_popbox($rpcres['response']['msgcode'], $rpcres['response']['message'], $line, $function, null, 'submit_failed');
        }
    }
    return $rpcres;
}
Ejemplo n.º 21
0
function add_comment()
{
    $user = get_logged_in_user();
    $scen = get_str("scen");
    $sim = get_str("sim");
    $dir = "scenarios/{$scen}/simulations/{$sim}";
    if (!is_dir($dir)) {
        error_page("No such simulation");
    }
    $cdir = "{$dir}/comments";
    @mkdir($cdir);
    $c = create_dir_seqno($cdir);
    $p = "{$cdir}/{$c}";
    file_put_contents("{$p}/userid", "{$user->id}");
    file_put_contents("{$p}/comment", get_str("comment"));
    header("Location: sim_web.php?action=show_simulation?scen={$scen}&sim={$sim}");
}
Ejemplo n.º 22
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/>.
require_once "../inc/boinc_db.inc";
require_once "../inc/util.inc";
require_once "../inc/team.inc";
check_get_args(array());
$user = get_logged_in_user();
$name = post_str("name", true);
if (strlen($name) == 0) {
    error_page(tra("You must choose a non-blank team name"));
}
$new_team = lookup_team_name($name);
if ($new_team) {
    error_page(tra("A team named %1 already exists - try another name", htmlentities($name)));
}
$url = post_str("url", true);
$type = post_str("type", true);
$name_html = post_str("name_html", true);
$description = post_str("description", true);
$country = post_str("country", true);
if ($country == "") {
    $country = "International";
}
$new_team = make_team($user->id, $name, $url, $type, $name_html, $description, $country);
if ($new_team) {
    user_join_team($new_team, $user);
    Header("Location: team_display.php?teamid={$new_team->id}");
} else {
    error_page(tra("Could not create team - please try later."));
}
Ejemplo n.º 23
0
$g_num = count($g_arr);
?>

<?php 
$ndate = date('Y-m-d H:i:s');
$qrys = "update " . $_POST[tb_name] . " set add12 = '" . $ndate . " (" . $_POST[to_email] . ", " . $_POST[from_email] . ")' where uid = '" . $_POST[puid] . "' ";
//메일전송 업데이트
$db_host = "localhost";
$db_id = "trevia";
$db_passwd = "trevia6681";
$db_name = "trevia";
if ($db_host && $db_id && $db_passwd && $db_name) {
    $conn = @mysql_connect($db_host, $db_id, $db_passwd) or error_page("Databases sever name, ID or Password is not correct");
    if ($conn) {
        if (!@mysql_select_db($db_name, $conn)) {
            error_page("Databases Name is not correct");
        }
    }
}
$m_sql = mysql_query($qrys);
$subject = getUTFtoKR($_POST[val3]);
$name = getUTFtoKR("{$_POST[val5]}||{$_POST[val6]}||{$_POST[val7]}||{$_POST[val8]}||{$_POST[val9]}||{$_POST[val10]}||{$_POST[val11]}||{$_POST[val12]}");
$period = getUTFtoKR("{$_POST[val4]}||{$_POST[new_val1]}||{$_POST[add2_2]}");
$cost = getUTFtoKR("{$_POST[val13]}||{$_POST[val14]}||{$_POST[val15]}||{$_POST[val16]}||{$_POST[val32]}||{$_POST[val17]}||{$_POST[val18]}||{$_POST[val19]}||{$_POST[val20]}||{$_POST[val33]}||{$_POST[val21]}||{$_POST[val22]}||{$_POST[val23]}||{$_POST[val24]}||{$_POST[val34]}||{$_POST[val25]}||{$_POST[val26]}||{$_POST[val27]}||{$_POST[val28]}||{$_POST[val35]}||{$_POST[new_val29]}||{$_POST[val29]}||{$_POST[val30]}||{$_POST[val31]}||{$_POST[val36]}||{$_POST[ext1]}||{$_POST[ext2]}||{$_POST[ext3]}||{$_POST[ext4]}");
$k = 0;
$condition_air = "";
for ($i = 0; $i < 10; $i++) {
    if (!$_POST['nadd' . $k]) {
        break;
    } else {
        if ($i != 0) {
Ejemplo n.º 24
0
// 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."));
    }
}
page_tail();
$cvs_version_tracker[] = "\$Id\$";
//Generated automatically - do not edit
Ejemplo n.º 25
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/>.
// Users are taken here after creating an account via the Wizard.
// They've already entered an email address and password.
// Now get a name, country, and zip code
require_once '../inc/boinc_db.inc';
require_once '../inc/util.inc';
require_once '../inc/countries.inc';
check_get_args(array("auth"));
$auth = get_str("auth");
$user = BoincUser::lookup_auth($auth);
if (!$user) {
    error_page("no such account");
}
page_head(tra("Finish account setup"));
echo "\n    <form action=account_finish_action.php method=post>\n";
start_table();
row2(tra("Name") . "<br><span class=\"description\">" . tra("Identifies you on our web site. Use your real name or a nickname.") . "</span>", "<input name=\"name\" size=\"30\" value=\"{$user->name}\">");
row2_init(tra("Country") . "<br><span class=\"description\">" . tra("Select the country you want to represent, if any.") . "</span>", "<select name=\"country\">");
print_country_select();
echo "</select></td></tr>\n";
row2(tra("Postal or ZIP Code") . "<br><span class=\"description\">" . tra("Optional") . "</span>", "<input name=\"postal_code\" size=\"20\">");
row2("", "<input type=\"submit\" value=\"OK\">");
end_table();
echo "\n    <input type=hidden name=auth value={$auth}>\n    </form>\n";
page_tail();
Ejemplo n.º 26
0
// under the terms of the GNU Lesser General Public License
// as published by the Free Software Foundation,
// 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";
if (DISABLE_TEAMS) {
    error_page("Teams are disabled");
}
check_get_args(array("format", "team_id", "team_ids", "team_name"));
$format = get_str("format", true);
$team_id = get_int("team_id", true);
$team_ids = get_str("team_ids", true);
BoincDb::get(true);
if ($team_id || $team_ids || $format == 'xml') {
    require_once '../inc/xml.inc';
    xml_header();
    $retval = db_init_xml();
    if ($retval) {
        xml_error($retval);
    }
}
if ($team_id) {
Ejemplo n.º 27
0
// 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/>.
// search for posts or a thread.
// Takes input from forum_search.php
require_once '../inc/time.inc';
require_once '../inc/text_transform.inc';
require_once '../inc/forum.inc';
if (DISABLE_FORUMS) {
    error_page("Forums are disabled");
}
check_get_args(array());
// Searches for the keywords in the $keyword_list array in thread titles.
// Optionally filters by forum, user, time, or hidden if specified.
//
function search_thread_titles($keyword_list, $forum = "", $user = "", $time = "", $limit = 200, $sort_style = CREATE_TIME_NEW, $show_hidden = false)
{
    $search_string = "%";
    foreach ($keyword_list as $key => $word) {
        $search_string .= BoincDb::escape_string($word) . "%";
    }
    $query = "title like '" . $search_string . "'";
    if ($forum && $forum != "all") {
        $query .= " and forum = {$forum->id}";
    }
Ejemplo n.º 28
0
// 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/util.inc";
require_once "../inc/cert.inc";
check_get_args(array("border"));
$user = get_logged_in_user();
$team = BoincTeam::lookup_id($user->teamid);
if (!$team) {
    error_page("no team");
}
$join = gmdate('j F Y', $team->create_time);
$today = gmdate('j F Y', time(0));
credit_to_ops($team->total_credit, $ops, $unit);
$border = get_str("border", true);
if ($border == "no") {
    $border = 0;
} else {
    $border = 8;
}
$credit = credit_string($team->total_credit, false);
$title_font = "\"Optima,ZapfChancery\"";
$font = "\"Optima,Lucida Bright,Times New Roman\"";
echo "\n    <table width=900 height=650 border={$border} cellpadding=20><tr><td>\n    <center>\n    <table width=700 border=0><tr><td>\n    <center>\n    <font style=\"font-size: 52\" face={$title_font}>Certificate of Computation\n\n\n    <font face={$font} style=\"font-size:28\">\n    <br><br><br>\n    This certifies that team\n    <p>\n    <font face={$font} style=\"font-size:32\">\n    {$team->name}\n\n    <font face={$font} style=\"font-size:18\">\n    <p>\n    has participated in " . PROJECT . " since {$join},\n    and has contributed {$credit}\n    to " . PROJECT . ".\n\n    <br><br><br>\n    </td><tr></table>\n    <table width=100%><tr>\n    <td width=40><br></td>\n    <td align=left>\n    <font face={$font} style=\"font-size:16\">\n";
if (defined("CERT_SIGNATURE")) {
Ejemplo n.º 29
0
}
if ($user->id == $team->ping_user) {
    $get_from_db = true;
}
// Cache the team record, its forum record, its new members,
// its admins, and its member counts
$cache_args = "teamid={$teamid}";
if (!$get_from_db) {
    $cached_data = get_cached_data(TEAM_PAGE_TTL, $cache_args);
    if ($cached_data) {
        // We found some old but non-stale data, let's use it
        $team = unserialize($cached_data);
    } else {
        $get_from_db = true;
    }
}
if ($get_from_db) {
    $team->nusers = BoincUser::count("teamid={$teamid}");
    $team->nusers_worked = BoincUser::count("teamid={$teamid} and total_credit>0");
    $team->nusers_active = BoincUser::count("teamid={$teamid} and expavg_credit>0.1");
    $team->forum = BoincForum::lookup("parent_type=1 and category={$team->id}");
    $team->new_members = new_member_list($teamid);
    $team->admins = admin_list($teamid);
    $team->founder = BoincUser::lookup_id($team->userid);
    set_cached_data(TEAM_PAGE_TTL, serialize($team), $cache_args);
}
if (!$team) {
    error_page(tra("no such team"));
}
display_team_page($team, $user);
page_tail(true);
Ejemplo n.º 30
0
// http://boinc.berkeley.edu
// Copyright (C) 2008 University of California
//
// BOINC is free software; you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License
// as published by the Free Software Foundation,
// 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/>.
//
// This file was modified by contributors of "BOINC Web Tweak" project.
require_once "../inc/util.inc";
db_init();
$user = get_logged_in_user();
if (!@file_get_contents('../ops/ffmail/subject')) {
    error_page('This project hasn\'t created an email message -
		please notify its administrators');
}
page_head("Tell your friends about " . PROJECT);
echo "\r\n<table width=600><tr><td>\r\nHelp us by telling your friends, family and coworkers about " . PROJECT . ".\r\n<p>\r\nFill in this form with the names and email addresses\r\nof people you think might be interested in " . PROJECT . ".\r\nWe'll send them an email in your name,\r\nand you can add your own message if you like.\r\n<form method=get action=ffmail_action.php>\r\n<table cellpadding=4>\r\n<tr><td class=heading>Your name:</td><td class=heading>Your email address:</td></tr>\r\n<tr><td><b>{$user->name}</b></td><td><b>{$user->email_addr}</b></td></tr>\r\n\r\n<input type=hidden name=uname value=\"{$user->name}\">\r\n<input type=hidden name=uemail value=\"{$user->email_addr}\">\r\n\r\n<tr><td class=heading>Friend's name:</td><td class=heading>Friend's email address:</td></tr>\r\n";
for ($i = 0; $i < 5; $i++) {
    echo "\r\n\t\t<tr><td><input size=30 name=n{$i}></td><td><input size=30 name=e{$i}></tr>\r\n\t";
}
echo "\r\n<tr><td class=heading colspan=2>Additional message (optional)</td></tr>\r\n<tr><td colspan=2><textarea name=comment rows=8 cols=50></textarea></td></tr>\r\n<tr><td align=center><input type=submit name=action value=Preview></td>\r\n\t<td align=center><input type=submit name=action value=Send></td>\r\n</tr>\r\n</table>\r\n</form>\r\n</td></tr></table>\r\n";
page_tail();