function flickr_users_get_by_url($error_404 = 1)
{
    $path = get_str("path");
    $nsid = get_str("nsid");
    if ($path && $GLOBALS['cfg']['enable_feature_path_alias_redirects']) {
        loadlib("flickr_users_path_aliases");
        $alias = flickr_users_path_aliases_get_by_alias($path);
        if ($alias && $alias['redirect_to']) {
            $new_path = urlencode($alias['redirect_to']);
            $redir = str_replace($path, $new_path, $_SERVER['REQUEST_URI']);
            header("location: {$redir}");
        }
    }
    if ($path) {
        $flickr_user = flickr_users_get_by_path_alias($path);
        # see also: notes in flickr_users_create_user()
        # see also: inc_path_alias_conflict.txt
        if ($flickr_user && $GLOBALS['cfg']['enable_feature_path_alias_redirects']) {
            $other_flickr_user = _flickr_users_get_by_path_alias($path);
            $other_user = users_get_by_id($other_flickr_user['user_id']);
            $GLOBALS['smarty']->assign("path_alias_conflict", 1);
            $GLOBALS['smarty']->assign_by_ref("path_alias_other_user", $other_user);
            $GLOBALS['smarty']->assign_by_ref("path_alias_other_flickr_user", $other_flickr_user);
        }
    } else {
        if ($nsid) {
            $flickr_user = flickr_users_get_by_nsid($nsid);
        }
    }
    if (!$flickr_user && $error_404) {
        error_404();
    }
    return $flickr_user;
}
function api_flickr_photos_geo_possibleCorrections()
{
    $photo_id = get_int64("photo_id");
    $photo = _api_flickr_photos_geo_get_photo($photo_id);
    $type = get_str("place_type");
    if (!$type) {
        api_output_error(999, "Missing place type");
    }
    if (!flickr_places_is_valid_placetype($type)) {
        api_output_error(999, "Invalid place type");
    }
    # TO DO: calculate based on $type
    $radius = 1.5;
    $bbox = geo_utils_bbox_from_point($photo['latitude'], $photo['longitude'], $radius, 'km');
    $bbox = implode(",", array($bbox[1], $bbox[0], $bbox[3], $bbox[2]));
    $method = 'flickr.places.placesForBoundingBox';
    $args = array('bbox' => $bbox, 'place_type' => $type);
    $rsp = flickr_api_call($method, $args);
    if (!$rsp['ok']) {
        api_output_error(999, "Flickr API error");
    }
    $possible = array();
    if ($rsp['rsp']['places']['total']) {
        foreach ($rsp['rsp']['places']['place'] as $place) {
            $possible[] = array('woeid' => $place['woeid'], 'placetype' => $place['place_type'], 'name' => $place['_content']);
        }
    }
    $parent = flickr_places_parent_placetype($type);
    $out = array('place_type' => $type, 'parent_place_type' => $parent, 'places' => $possible);
    return api_output_ok($out);
}
function api_output_jsonp_ensure_valid_callback()
{
    # see http://stackoverflow.com/questions/3128062/is-this-safe-for-providing-jsonp
    $callback = get_str("callback");
    if (api_output_jsonp_ensure_valid_function_name($callback) && api_output_jsonp_ensure_no_reserved_words($callback)) {
        return $callback;
    } else {
        api_output_jsonp_send_fatal();
    }
}
function api_test_echo()
{
    $out = array();
    foreach ($_GET as $k => $ignore) {
        if ($k = filter_strict($k)) {
            $v = filter_strict(get_str($k));
            $out[$k] = $v;
        }
    }
    api_output_ok($out);
}
Example #5
0
function api_test_echo()
{
    $out = array();
    foreach ($_GET as $k => $ignore) {
        if ($GLOBALS['cfg']['api_auth_type'] == 'oauth2' && $k == 'access_token') {
            continue;
        }
        if ($k = filter_strict($k)) {
            $v = filter_strict(get_str($k));
            $out[$k] = $v;
        }
    }
    api_output_ok($out);
}
Example #6
0
function get_download_url($pname, $need_vbox)
{
    global $platforms;
    global $url_base;
    $need_vbox = get_str("need_vbox", true);
    $p = $platforms[$pname];
    $v = latest_version($p);
    $file = $v['file'];
    if ($need_vbox && array_key_exists('vbox_file', $v)) {
        $file = $v['vbox_file'];
    }
    $url = $url_base . $file;
    return $url;
}
Example #7
0
function handle_add($job, $inst)
{
    $f = null;
    $f->x = get_int('pic_x');
    $f->y = get_int('pic_y');
    $f->type = sanitize_tags(get_str('type'));
    $c = sanitize_tags(get_str('comment', true));
    if (strstr($c, "(optional)")) {
        $c = "";
    }
    $f->comment = $c;
    $output = $inst->get_opaque_data();
    $output->features[] = $f;
    $inst->set_opaque_data($output);
    header("location: bossa_example4.php?bji={$inst->id}");
}
 /**
  * 上传列表
  * @author jry <*****@*****.**>
  */
 public function index()
 {
     //搜索
     $keyword = I('keyword', '', 'string');
     $condition = array('like', '%' . $keyword . '%');
     $map['id|path'] = array($condition, $condition, '_multi' => true);
     //获取所有上传
     $map['status'] = array('egt', '0');
     //禁用和正常状态
     $data_list = D('PublicUpload')->page(!empty($_GET["p"]) ? $_GET["p"] : 1, C('ADMIN_PAGE_ROWS'))->where($map)->order('sort desc,id desc')->select();
     $page = new \Common\Util\Page(D('PublicUpload')->where($map)->count(), C('ADMIN_PAGE_ROWS'));
     foreach ($data_list as &$data) {
         $data['name'] = get_str($data['name'], 0, 30) . '<input class="form-control input-sm" value="' . $data['path'] . '">';
     }
     //使用Builder快速建立列表页面。
     $builder = new \Common\Builder\ListBuilder();
     $builder->setMetaTitle('上传列表')->addTopButton('resume')->addTopButton('forbid')->addTopButton('delete')->setSearch('请输入ID/上传关键字', U('index'))->addTableColumn('id', 'ID')->addTableColumn('show', '文件')->addTableColumn('name', '文件名及路径')->addTableColumn('size', '大小')->addTableColumn('ctime', '创建时间', 'time')->addTableColumn('sort', '排序')->addTableColumn('status', '状态', 'status')->addTableColumn('right_button', '操作', 'btn')->setTableDataList($data_list)->setTableDataPage($page->show())->addRightButton('forbid')->addRightButton('delete')->display();
 }
Example #9
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"));
    }
}
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();
}
Example #11
0
login_ensure_loggedin($history_url);
$fsq_user = foursquare_users_get_by_foursquare_id($fsq_id);
if (!$fsq_user) {
    error_404();
}
$owner = users_get_by_id($fsq_user['user_id']);
$is_own = $owner['id'] == $GLOBALS['cfg']['user']['id'] ? 1 : 0;
# for now...
if (!$is_own) {
    error_403();
}
$more = array();
if ($page = get_int32("page")) {
    $more['page'] = $page;
}
if ($when = get_str("when")) {
    $more['when'] = $when;
    $history_url .= urlencode($when) . "/";
    # TO DO: find some better heuristic for this number
    # besides "pull it out of my ass" (20120206/straup)
    $more['per_page'] = 100;
}
$more['inflate_locality'] = 1;
$rsp = privatesquare_checkins_for_user($owner, $more);
# TO DO: oh god...timezones :-(
if ($when) {
    list($start, $stop) = datetime_when_parse($more['when']);
    $GLOBALS['smarty']->assign("when", $when);
    $GLOBALS['smarty']->assign("start", $start);
    $GLOBALS['smarty']->assign("stop", $stop);
}
// 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/profile.inc";
$user = get_logged_in_user();
$cmd = get_str("cmd", true);
if ($cmd == "delete") {
    $result = delete_profile($user);
    if (!$result) {
        error_page(tra("couldn't delete profile - please try again later"));
    }
    delete_user_pictures($user->id);
    page_head(tra("Delete Confirmation"));
    $user->update("has_profile=0");
    echo tra("Your profile has been deleted.") . "<br>";
    page_tail();
    exit;
}
page_head(tra("Profile delete confirmation"));
echo "\n    <h2>" . tra("Are you sure?") . "</h2><p>\n    " . tra("Deleted profiles are gone forever and cannot be recovered --\nyou will have to start from scratch\nif you want another profile in the future.") . "\n    <p>\n    " . tra("If you're sure, click 'Yes'\nto remove your profile from our database.") . "\n    <p>\n";
show_button("delete_profile.php?cmd=delete", tra("Yes"), tra("Delete my profile"));
Example #13
0
	include("include/init.php");

	if (! $GLOBALS['cfg']['enable_feature_password_retrieval']){
		error_404();
	}

	if ($GLOBALS['cfg']['user']['id']){

		header("location: /");
		exit();
	}

	$reset_code = post_str('reset');

	if (! $reset_code){
		$reset_code = get_str('reset');
	}

	if (! $reset_code){

		# seriously, go away...

		header("location: /");
		exit();
	}

	$user = users_get_by_password_reset_code($reset_code);

	if (! $user){

		$GLOBALS['error']['nouser'] = 1;		
Example #14
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/forum_db.inc";
require_once "../inc/util.inc";
require_once "../inc/xml.inc";
xml_header();
if (DISABLE_FORUMS) {
    xml_error(-1, "Forums are disabled");
}
$retval = db_init_xml();
if ($retval) {
    xml_error($retval);
}
$method = get_str("method", true);
if ($method != "user_posts" && $method != "user_threads") {
    xml_error(-1);
}
$userid = get_int("userid", true);
$user = BoincUser::lookup_id($userid);
if (!$user) {
    xml_error(ERR_DB_NOT_FOUND);
}
if ($method == "user_posts") {
    $count = get_int("count", true);
    if (!$count || $count <= 0 || $count > 50) {
        $count = 10;
    }
    $length = get_int("contentlength", true);
    if ($length == null || $length <= 0) {
Example #15
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/>.
include_once "../inc/util.inc";
include_once "../inc/prefs.inc";
include_once "../inc/prefs_project.inc";
check_get_args(array("subset", "venue", "confirmed", "cols", "tnow", "ttok"));
$user = get_logged_in_user();
check_tokens($user->authenticator);
$subset = get_str("subset");
$venue = get_str("venue");
$confirmed = get_str("confirmed", true);
$columns = get_int("cols", true);
$c = $columns ? "&cols={$columns}" : "";
if ($confirmed) {
    if ($subset == "global") {
        $main_prefs = prefs_parse_global($user->global_prefs);
        $main_prefs->{$venue} = null;
        global_prefs_update($user, $main_prefs);
    } else {
        $main_prefs = prefs_parse_project($user->project_prefs);
        $main_prefs->{$venue} = null;
        project_prefs_update($user, $main_prefs);
    }
    Header("Location: prefs.php?subset={$subset}{$c}");
} else {
    page_head(tra("Confirm delete preferences"));
Example #16
0
	include("include/init.php");

	#
	# do we have a valid cookie set?
	#

	if (!login_check_login()){
		$GLOBALS['error']['badcookies'] = 1;
		$smarty->display("page_checkcookie.txt");
		exit;
	}

	#
	# where shall we bounce to?
	#

	$redir = $GLOBALS['cfg']['abs_root_url'];

	if ($_redir = get_str("redir")){
		$redir .= $_redir;
	}

	#
	# go!
	#

	header("location: {$redir}");
	exit;
?>
Example #17
0
            //make sure only numbers get through
            $team = BoincTeam::lookup_id($team_id);
            if ($team) {
                show_team_xml($team);
                $total++;
                if ($total == 100) {
                    break;
                }
            }
            //do not error out
        }
    }
    echo "</teams>\n";
    exit;
}
$team_name = get_str("team_name");
$name_lc = strtolower($team_name);
$name_lc = escape_pattern($name_lc);
$clause = "name like '%" . BoincDb::escape_string($name_lc) . "%' order by expavg_credit desc limit 100";
$teams = BoincTeam::enum($clause);
if ($format == 'xml') {
    echo "<teams>\n";
    $total = 0;
    foreach ($teams as $team) {
        show_team_xml($team);
        $total++;
        if ($total == 100) {
            break;
        }
    }
    echo "</teams>\n";
Example #18
0
// Object-caching and full-file caching is used to speed up queries
// for data from this page.
$cvs_version_tracker[] = "\$Id\$";
//Generated automatically - do not edit
require_once "../inc/cache.inc";
require_once "../inc/util.inc";
require_once "../inc/xml.inc";
require_once "../inc/boinc_db.inc";
require_once "../inc/user.inc";
require_once "../inc/forum.inc";
require_once "../project/project.inc";
$auth = get_str("auth", true);
if (!$auth) {
    $id = get_int("userid");
}
$format = get_str("format", true);
if ($format == "xml") {
    // don't do caching for XML
    xml_header();
    $retval = db_init_xml();
    if ($retval) {
        xml_error($retval);
    }
    if ($auth) {
        $user = lookup_user_auth($auth);
        $show_hosts = true;
    } else {
        $user = lookup_user_id($id);
        $show_hosts = false;
    }
    if (!$user) {
Example #19
0
}
$uotd_candidates = count_uotd_candidates();
if ($uotd_candidates >= 0) {
    if ($uotd_candidates >= UOTD_THRESHOLD * 2) {
        $color = "#00aa00";
    } elseif ($uotd_candidates < UOTD_THRESHOLD) {
        $color = "#ff0000";
    } else {
        $color = "#ff9900";
    }
    echo "<li><span style=\"color: " . $color . "\">There are " . $uotd_candidates . " remaining\r\n\t\tcandidates for User of the Day.</span></li>\n";
}
echo "</ul>\n";
echo "\r\n\t<p>\r\n\t<table border=\"0\"><tr valign=\"top\">\r\n\t<td><b>Browse database:</b>\r\n\t<ul> \r\n\t\t<li><a href=\"db_action.php?table=platform\">Platforms</a></li>\r\n\t\t<li><a href=\"db_action.php?table=app\">Applications</a></li>\r\n\t\t<li><a href=\"db_form.php?table=app_version\">Application versions</a></li>\r\n\t\t<li><a href=\"db_form.php?table=user\">Users</a> (<a href=\"list_new_users.php\">recently registered</a>)</li>\r\n\t\t<li><a href=\"db_form.php?table=team\">Teams</a></li>\r\n\t\t<li><a href=\"db_form.php?table=host&amp;detail=low\">Hosts</a></li>\r\n\t\t<li><a href=\"db_form.php?table=workunit\">Workunits</a></li>\r\n\t\t<li><a href=\"db_form.php?table=result&amp;detail=low\">Results</a></li>\r\n\t\t<li><a href=dbinfo.php>DB row counts and disk usage</a>\r\n\t</ul>\r\n\t\r\n\t</td> \r\n\t<td><b>Regular Operations:</b>\r\n\t<ul>\r\n\t\t<li><a href=\"profile_screen_form.php\">Screen user profiles </a></li>\r\n\t\t<li><a href=\"manage_special_users.php\">Manage special users</a></li>\r\n\t</ul>\r\n\t\r\n\t</td> \r\n\t<td><b>Special Operations:</b>\r\n\t<ul>\r\n\t\t<li><a href=\"manage_apps.php\">Manage applications</a></li>\r\n\t\t<li><a href=\"manage_app_versions.php\">Manage application versions</a></li>\r\n\t\t<li><a href=\"mass_email.php\">Send mass email to a selected set of users</a></li>\r\n\t\t<li><a href=\"problem_host.php\">Email user with misconfigured host</a></li>\r\n\t\t<li><a href=\"job_times.php\">FLOP count statistics</a>\r\n\t\t<li><a href=\"cancel_wu_form.php\">Cancel workunits</a></li>\r\n\t\t<li><form action=\"manage_user.php\">\r\n\t\t\t<input type=\"submit\" value=\"Manage user\">\r\n\t\t\tID: <input name=\"userid\">\r\n\t\t\t</form>\r\n\t\t</li>\r\n\t\t<li>\r\n\t\t\t<form method=\"get\" action=\"clear_host.php\">\r\n\t\t\tClear Host: \r\n\t\t\t<input type=\"text\" size=\"5\" name=\"hostid\">\r\n\t\t\t<input type=\"submit\" value=\"Clear RPC\">\r\n\t\t\t</form>\r\n\t\t</li>\r\n\t</ul>\r\n\t</td>\r\n\t</tr>\r\n\t</table>\r\n";
// Application Result Summaries:
$show_deprecated = get_str("show_deprecated", true);
$show_only = array("all");
// Add all appids you want to display, or "all"
$result = mysql_query("select id, name, deprecated from app");
while ($app = mysql_fetch_object($result)) {
    if (in_array($app->id, $show_only) || in_array("all", $show_only) && (!$app->deprecated || $show_deprecated)) {
        echo "\r\n\t<b>Result summary for <tt>{$app->name}</tt>:</b>\r\n\t<ul>\r\n\t<li> Past 24 hours:\r\n\t\t<a href=\"result_summary.php?appid={$app->id}&amp;nsecs=86400\">summary</a> |\r\n\t\t<a href=\"pass_percentage_by_platform.php?appid={$app->id}&amp;nsecs=86400\">pass percentage by platform</a> | \r\n\t\t<a href=\"failure_result_summary_by_host.php?appid={$app->id}&amp;nsecs=86400\">failure by host</a> |\r\n\t\t<a href=\"failure_result_summary_by_platform.php?appid={$app->id}&amp;nsecs=86400\"> failure by platform</a>\r\n\t<li>Past &nbsp;&nbsp;&nbsp;7 days:\r\n\t\t<a href=\"result_summary.php?appid={$app->id}&amp;nsecs=604800\">summary</a> |\r\n\t\t<a href=\"pass_percentage_by_platform.php?appid={$app->id}&amp;nsecs=604800\">pass percentage by platform</a> |\r\n\t\t<a href=\"failure_result_summary_by_host.php?appid={$app->id}&amp;nsecs=604800\">failure by host</a> |\r\n\t\t<a href=\"failure_result_summary_by_platform.php?appid={$app->id}&amp;nsecs=604800\">failure by platform</a>\r\n\t</ul>\r\n\t";
    }
}
mysql_free_result($result);
if ($show_deprecated) {
    echo "<a href=\"index.php?show_deprecated=0\">Hide deprecated applications</a>";
} else {
    echo "<a href=\"index.php?show_deprecated=1\">Show deprecated applications</a>";
}
// Periodic tasks
    if (isset($place[$type])) {
        $woeid = $place[$type]['woeid'];
        $parts = explode(",", $place[$type]['_content']);
        $name = trim($parts[0]);
        $hier[] = array('woeid' => $woeid, 'placetype' => $type, 'name' => $name);
    }
}
$hier = array_reverse($hier);
$GLOBALS['smarty']->assign_by_ref("place", $place);
$GLOBALS['smarty']->assign_by_ref("hierarchy", $hier);
# now get the photos
$more = array('viewer_id' => $GLOBALS['cfg']['user']['id']);
if ($page = get_int32("page")) {
    $more['page'] = $page;
}
if ($context = get_str("context")) {
    $str_map = flickr_photos_geo_context_map("string keys");
    if (isset($str_map[$context])) {
        $geo_context = $str_map[$context];
        $more['geocontext'] = $geo_context;
        $GLOBALS['smarty']->assign("context", $context);
        $GLOBALS['smarty']->assign("geo_context", $geo_context);
    }
} else {
    $rsp = flickr_photos_places_contexts_for_user_and_place($owner, $place, $more);
    if ($rsp['ok']) {
        $GLOBALS['smarty']->assign("geo_contexts", $rsp['contexts']);
        $ctx_map = flickr_photos_geo_context_map();
        $GLOBALS['smarty']->assign_by_ref("geo_contexts_map", $ctx_map);
    }
}
//
// 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";
Example #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/>.
//
// This file was modified by contributors of "BOINC Web Tweak" project.
require_once "../inc/util_ops.inc";
require_once "../inc/db_ops.inc";
db_init();
$detail = null;
$show_aggregate = false;
$nresults = get_int("nresults", true);
$entries_to_show = get_int("entries_to_show", true);
$last_pos = get_int("last_pos", true);
$table = get_str("table", true);
$detail = get_str("detail", true);
$clauses = get_str("clauses", true);
if (strstr($clauses, ";")) {
    error_page("bad clause");
}
$q = new SqlQueryString();
$q->process_form_items();
if (isset($nresults)) {
    $entries_to_show = $nresults;
} else {
    $entries_to_show = 20;
}
$page_entries_to_show = $entries_to_show;
if (isset($last_pos)) {
    $start_at = $last_pos;
} else {
    $start_at = 0;
Example #23
0
<?php

// This file is part of BOINC.
// 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/>.
require_once "../inc/util.inc";
check_get_args(array("st"));
$st = get_str("st", true);
page_head(tra("PayPal - Transaction Completed"));
if ($st == "Completed") {
    echo "<div>" . tra("Thank you for donating!") . "<br>\n";
    echo tra("Your donation for has been completed.") . "<br>\n";
    echo tra("Your donation will be added to the progress bar after confirmation by PayPal.") . "</div>";
} else {
    echo "<strong>" . tra("You have canceled your donation.") . "</strong>";
}
page_tail();
Example #24
0
    $x = md5($x);
    $x = substr($x, 0, 16);
    if ($x != $h) {
        error_page("Invalid authenticator.\r\n\t\t\tPlease make sure you visited the complete URL;\r\n\t\t\tit may have been split across lines by your email reader.");
    }
    if (time() - $t > 86400) {
        error_page("Link has expired;\r\n\t\t\tgo <a href=get_passwd.php>here</a> to\r\n\t\t\tget a new login link by email.");
    }
    send_cookie('auth', $user->authenticator, true);
    Header("Location: home.php");
    exit;
}
// check for account key case.
// see if key is in URL; if not then check for POST data
//
$authenticator = get_str("key", true);
if (!$authenticator) {
    $authenticator = post_str("authenticator", true);
}
if (!$authenticator) {
    error_page("You must supply an account key");
}
if (substr($user->authenticator, 0, 1) == 'x') {
    //User has been bad so we are going to take away ability to post for awhile.
    error_page("This account has been administratively disabled.");
}
$user = lookup_user_auth($authenticator);
if (!$user) {
    page_head("Login failed");
    echo "There is no account with that authenticator.\r\n\t\tPlease <a href=get_passwd.php>try again</a>.\r\n\t";
    page_tail();
Example #25
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}");
}
// 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";
if (DISABLE_PROFILES) {
    error_page("Profiles are disabled");
}
check_get_args(array("search_string", "offset"));
function show_profile_link2($profile, $n)
{
    $user = BoincUser::lookup_id($profile->userid);
    echo "<tr><td>" . user_links($user) . "</td><td>" . date_str($user->create_time) . "</td><td>{$user->country}</td><td>" . (int) $user->total_credit . "</td><td>" . (int) $user->expavg_credit . "</td></tr>\n";
}
$search_string = get_str('search_string');
$search_string = sanitize_tags($search_string);
$search_string = BoincDb::escape_string($search_string);
$offset = get_int('offset', true);
if (!$offset) {
    $offset = 0;
}
$count = 10;
page_head(tra("Profiles containing '%1'", $search_string));
$profiles = BoincProfile::enum("match(response1, response2) against ('{$search_string}') limit {$offset},{$count}");
start_table();
echo "\n    <tr><th>" . tra("User name") . "</th>\n    <th>" . tra("Joined project") . "</th>\n    <th>" . tra("Country") . "</th>\n    <th>" . tra("Total credit") . "</th>\n    <th>" . tra("Recent credit") . "</th></tr>\n";
$n = 0;
foreach ($profiles as $profile) {
    show_profile_link2($profile, $n + $offset + 1);
    $n += 1;
Example #27
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/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")) {
    echo "\n        <img src=" . CERT_SIGNATURE . ">\n        <br>\n    ";
}
if (defined("CERT_DIRECTOR_NAME")) {
    echo CERT_DIRECTOR_NAME . " <br>Director, " . PROJECT . "\n        <br>\n    ";
}
<?php

include "include/init.php";
loadlib("flickr_api");
# http://www.flickr.com/services/api/flickr.people.getInfo.html
# http://www.flickr.com/services/api/misc.buddyicons.html
$nsid = get_str("nsid");
if (!$nsid) {
    error_404();
}
$cache_key = "flickr_buddyicon_{$nsid}";
$cache = cache_get($cache_key);
if ($cache['ok']) {
    $buddyicon = $cache['data'];
} else {
    $method = "flickr.people.getInfo";
    $args = array("user_id" => $nsid);
    $rsp = flickr_api_call($method, $args);
    if (!$rsp['ok']) {
        error_500();
    }
    $icon_server = $rsp['rsp']['person']['iconserver'];
    $icon_farm = $rsp['rsp']['person']['iconfarm'];
    if (!$icon_server) {
        $buddyicon = "http://www.flickr.com/images/buddyicon.jpg";
    } else {
        $buddyicon = "http://farm{$icon_farm}.static.flickr.com/{$icon_server}/buddyicons/{$nsid}.jpg";
    }
    cache_set($cache_key, $buddyicon);
}
header("location: {$buddyicon}");
Example #29
0
<?php

include "include/init.php";
features_ensure_enabled(array("api", "api_documentation"));
$default = $GLOBALS['cfg']['api']['default_format'];
$formats = $GLOBALS['cfg']['api']['formats'];
$format = get_str("format");
if (!$format) {
    error_404();
}
if (!in_array($format, $formats)) {
    error_404();
}
$GLOBALS['smarty']->assign("default", $default);
$GLOBALS['smarty']->assign("format", $format);
$GLOBALS['smarty']->display("page_api_format.txt");
exit;
<?php

include "include/init.php";
loadlib("flickr_api");
$redir = get_str('redir') ? get_str('redir') : '/';
# Some basic sanity checking like are you already logged in?
if ($GLOBALS['cfg']['user']['id']) {
    header("location: {$redir}");
    exit;
}
if (!$GLOBALS['cfg']['enable_feature_signin']) {
    $GLOBALS['smarty']->display("page_signin_disabled.txt");
    exit;
}
# Build a URL with the perms for the auth token we're requesting
# and send the user there. Rocket science, I know...
$extra = array();
if ($redir = get_str('redir')) {
    $extra['redir'] = $redir;
}
$perms = $GLOBALS['cfg']['flickr_api_perms'];
$url = flickr_api_auth_url($perms, $extra);
header("location: {$url}");
exit;