本文整理汇总了PHP中get_int函数的典型用法代码示例。如果您正苦于以下问题:PHP get_int函数的具体用法?PHP get_int怎么用?PHP get_int使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_int函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: select_profile
function select_profile($cmd)
{
// Request for a random profile.
//
if ($cmd == "rand") {
$profiles = array();
$pic = get_int('pic');
if ($pic == 0) {
$profiles = BoincProfile::enum("has_picture=0", "limit 1000");
} else {
if ($pic == 1) {
$profiles = BoincProfile::enum("has_picture=1", "limit 1000");
} else {
if ($pic == -1) {
$profiles = BoincProfile::enum(null, "limit 1000");
}
}
}
if (count($profiles) == 0) {
page_head(tra("No profiles"));
echo tra("No profiles matched your query.");
page_tail();
exit;
}
shuffle($profiles);
$userid = $profiles[0]->userid;
header("Location: " . URL_BASE . "view_profile.php?userid={$userid}");
exit;
}
}
开发者ID:maexlich,项目名称:boinc-igemathome,代码行数:30,代码来源:profile_menu.php
示例2: includeNominations
public function includeNominations(Beatmapset $beatmapset, ParamBag $params = null)
{
if ($beatmapset->isPending()) {
if ($params !== null) {
$userId = get_int($params->get('user_id')[0] ?? null);
}
$nominations = $beatmapset->recentEvents()->get();
foreach ($nominations as $nomination) {
if ($nomination->type === BeatmapsetEvent::DISQUALIFY) {
$disqualifyEvent = $nomination;
}
if (isset($userId) && $nomination->user_id === $userId && $nomination->type === BeatmapsetEvent::NOMINATE) {
$alreadyNominated = true;
}
}
$result = ['required' => $beatmapset->requiredNominationCount(), 'current' => $beatmapset->currentNominationCount()];
if (isset($disqualifyEvent)) {
$result['disqualification'] = ['reason' => $disqualifyEvent->comment, 'created_at' => json_time($disqualifyEvent->created_at)];
}
if (isset($userId)) {
$result['nominated'] = $alreadyNominated ?? false;
}
return $this->item($beatmapset, function ($beatmapset) use($result) {
return $result;
});
} elseif ($beatmapset->qualified()) {
$eta = $beatmapset->rankingETA();
$result = ['ranking_eta' => json_time($eta)];
return $this->item($beatmapset, function ($beatmapset) use($result) {
return $result;
});
} else {
return;
}
}
开发者ID:ameliaikeda,项目名称:osu-web,代码行数:35,代码来源:BeatmapsetTransformer.php
示例3: update_info
function update_info()
{
global $user;
$sex = get_int('sex');
$birth_year = get_int('birth_year');
$user->bolt->update("sex={$sex}, birth_year={$birth_year}");
}
开发者ID:CalvinZhu,项目名称:boinc,代码行数:7,代码来源:bolt_sched.php
示例4: remove_admin
function remove_admin($team)
{
$userid = get_int('userid');
$ret = BoincTeamAdmin::delete("teamid={$team->id} and userid={$userid}");
if (!$ret) {
error_page(tra("failed to remove admin"));
}
}
开发者ID:nicolas17,项目名称:boincgit-test,代码行数:8,代码来源:team_admins.php
示例5: show
public function show($id)
{
$postStartId = Request::input('start');
$postEndId = get_int(Request::input('end'));
$nthPost = get_int(Request::input('n'));
$skipLayout = Request::input('skip_layout') === '1';
$jumpTo = null;
$topic = Topic::with('forum.cover')->findOrFail($id);
$this->authorizeView($topic->forum);
$posts = $topic->posts();
if ($postStartId === 'unread') {
$postStartId = Post::lastUnreadByUser($topic, Auth::user());
} else {
$postStartId = get_int($postStartId);
}
if ($nthPost !== null) {
$post = $topic->nthPost($nthPost);
if ($post) {
$postStartId = $post->post_id;
}
}
if (!$skipLayout) {
foreach ([$postStartId, $postEndId, 0] as $jumpPoint) {
if ($jumpPoint === null) {
continue;
}
$jumpTo = $jumpPoint;
break;
}
}
if ($postStartId !== null && !$skipLayout) {
// move starting post up by ten to avoid hitting
// page autoloader right after loading the page.
$postPosition = $topic->postPosition($postStartId);
$post = $topic->nthPost($postPosition - 10);
$postStartId = $post->post_id;
}
if ($postStartId !== null) {
$posts = $posts->where('post_id', '>=', $postStartId);
} elseif ($postEndId !== null) {
$posts = $posts->where('post_id', '<=', $postEndId)->orderBy('post_id', 'desc');
}
$posts = $posts->take(20)->with('user.rank')->with('user.country')->with('user.supports')->get()->sortBy(function ($p) {
return $p->post_id;
});
if ($posts->count() === 0) {
abort($skipLayout ? 204 : 404);
}
$postsPosition = $topic->postsPosition($posts);
Event::fire(new TopicWasViewed($topic, $posts->last(), Auth::user()));
$template = $skipLayout ? '_posts' : 'show';
$cover = fractal_item_array($topic->cover()->firstOrNew([]), new TopicCoverTransformer());
return view("forum.topics.{$template}", compact('topic', 'posts', 'postsPosition', 'jumpTo', 'cover'));
}
开发者ID:Hughp135,项目名称:osu-web,代码行数:54,代码来源:TopicsController.php
示例6: IdQuery
function IdQuery($query, $id)
{
global $app, $db;
$cleanID = get_int($id);
// bad request
if ($cleanID == null) {
$app->halt(400);
}
// execute query
$result = $db->query(str_replace("_ID_", $cleanID, $query));
return $result;
}
开发者ID:JcBernack,项目名称:anno-designer,代码行数:12,代码来源:bootstrap.php
示例7: handle_add
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}");
}
开发者ID:CalvinZhu,项目名称:boinc,代码行数:16,代码来源:bossa_example4.php
示例8: discussion
public function discussion($id)
{
$returnJson = Request::input('format') === 'json';
$lastUpdated = get_int(Request::input('last_updated'));
$beatmapset = Beatmapset::findOrFail($id);
$discussion = $beatmapset->beatmapsetDiscussion()->firstOrFail();
if ($returnJson && $lastUpdated !== null && $lastUpdated >= $discussion->updated_at->timestamp) {
return ['updated' => false];
}
$initialData = ['beatmapset' => $beatmapset->defaultJson(), 'beatmapsetDiscussion' => $discussion->defaultJson()];
if ($returnJson) {
return $initialData;
} else {
return view('beatmapsets.discussion', compact('beatmapset', 'initialData'));
}
}
开发者ID:ppy,项目名称:osu-web,代码行数:16,代码来源:BeatmapsetsController.php
示例9: show_batch
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();
}
开发者ID:CalvinZhu,项目名称:boinc,代码行数:17,代码来源:submit_status.php
示例10: get_batch_output_files
function get_batch_output_files($auth_str)
{
$batch_id = get_int('batch_id', true);
if ($batch_id) {
$batch = BoincBatch::lookup_id($batch_id);
if (!$batch) {
die("no batch {$batch_id}");
}
} else {
$batch_name = get_int('batch_name');
$batch_name = BoincDb::escape_string($batch_name);
$batch = BoincBatch::lookup("name='{$batch_name}'");
if (!$batch) {
die("no batch {$batch_name}");
}
}
$user = BoincUser::lookup_id($batch->user_id);
if (!$user) {
die("no user {$batch->user_id}");
}
$x = md5($user->authenticator . $batch->id);
if ($x != $auth_str) {
die("bad auth str");
}
$zip_basename = tempnam("../cache", "boinc_batch_");
$zip_filename = $zip_basename . ".zip";
$fanout = parse_config(get_config(), "<uldl_dir_fanout>");
$upload_dir = parse_config(get_config(), "<upload_dir>");
$wus = BoincWorkunit::enum("batch={$batch->id}");
foreach ($wus as $wu) {
if (!$wu->canonical_resultid) {
continue;
}
$result = BoincResult::lookup_id($wu->canonical_resultid);
$names = get_outfile_names($result);
foreach ($names as $name) {
$path = dir_hier_path($name, $upload_dir, $fanout);
if (is_file($path)) {
system(" nice -9 zip -jq {$zip_basename} {$path}");
}
}
}
do_download($zip_filename);
unlink($zip_filename);
}
开发者ID:CalvinZhu,项目名称:boinc,代码行数:45,代码来源:get_output.php
示例11: print_cart
function print_cart()
{
global $in_cart;
if (array_key_exists('игрушка детская велосипед', $in_cart)) {
if (get_available($in_cart['игрушка детская велосипед']['количество заказано'], $in_cart['игрушка детская велосипед']['осталось на складе']) >= 3) {
echo '<p>Поздравляем вас с участием в акции, вы купили товар "игрушка детская велосипед" в количестве более 3 штук, и получаете скидку в 30%</p>';
$in_cart['игрушка детская велосипед']['diskont'] = 'diskont3';
} else {
echo 'Купив товар "игрушка детская велосипед" количеством более 3 штук вы получите скидку 30%!';
}
$action_profit = get_profit($in_cart['игрушка детская велосипед']['количество заказано'], $in_cart['игрушка детская велосипед']['осталось на складе'], $in_cart['игрушка детская велосипед']['цена']);
}
$cart = '<table border="1"><tr>';
$cart .= '<td>№</td>' . '<td><b>Наименование</b></td>' . '<td><b>Цена</b></td>' . '<td><b>Скидка</b></td>';
$cart .= '<td><b>В заказе</b></td>' . '<td><b>На складе</b></td>' . '<td><b>Итого со скидкой</b></td></tr>';
static $total_goods = 0;
static $total_cost = 0;
static $count = 0;
static $total_profit = 0;
foreach ($in_cart as $key => $val) {
$item_price = $val['цена'];
$in_order = $val['количество заказано'];
$in_stock = $val['осталось на складе'];
$diskont = get_int($val['diskont']);
$show_diskont = $diskont > 0 ? $diskont . '0%' : '0%';
//красивое число скидки в таблице
$price = get_price($item_price, $diskont, $in_order, $key, $in_stock);
$cart .= '<tr><td>' . ++$count . '</td>';
$cart .= '<td>' . $key . '</td>';
$cart .= '<td>' . $item_price . '</td>';
$cart .= '<td>' . $show_diskont . '</td>';
$cart .= '<td>' . $in_order . '</td>';
$cart .= '<td>' . $in_stock . '</td>';
$cart .= '<td>' . $price[0] . '</td>';
$cart .= '</tr>';
$total_goods += get_available($in_order, $in_stock);
$total_cost += $price[0];
$total_profit += $price[1] - $price[0];
}
$cart .= '</table>';
$cart .= $action_profit;
$cart .= '<table style="border:1px solid gray;background:lightgray"><tr><td>ИТОГО в заказе:</td><td> - ' . $count . ' наименования,<br/>';
$cart .= '- ' . $total_goods . ' товаров,<br/> - ' . $total_cost . ' сумма к оплате,<br/> - ' . $total_profit . ' сэкономлено на скидках</td></tr></table>';
return $cart;
}
开发者ID:LEXXiY,项目名称:devschool,代码行数:45,代码来源:dz4.php
示例12: validate
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();
}
开发者ID:nicolas17,项目名称:boincgit-test,代码行数:20,代码来源:validate_email_addr.php
示例13: includeCurrentUserAttributes
public function includeCurrentUserAttributes(BeatmapDiscussion $discussion, ParamBag $params = null)
{
if ($params === null) {
return;
}
$userId = get_int($params->get('user_id')[0] ?? null);
if ($userId === null) {
return;
}
$score = 0;
// This assumes beatmapDiscussionVotes are already preloaded and
// thus will save one query.
foreach ($discussion->beatmapDiscussionVotes as $vote) {
if ($vote->user_id === $userId) {
$score = $vote->score;
break;
}
}
return $this->item($discussion, function ($discussion) use($score) {
return ['vote_score' => $score];
});
}
开发者ID:ameliaikeda,项目名称:osu-web,代码行数:22,代码来源:BeatmapDiscussionTransformer.php
示例14: error_page
// 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;
}
end_table();
if ($offset == 0 && $n == 0) {
开发者ID:maexlich,项目名称:boinc-igemathome,代码行数:31,代码来源:profile_search_action.php
示例15: page_head
if ($passwd_hash != $user->passwd_hash) {
page_head("Password incorrect");
echo "The password you entered is incorrect. Please try again.\n";
print_login_form_aux($next_url, null, $email_addr);
page_tail();
exit;
}
$authenticator = $user->authenticator;
Header("Location: {$next_url}");
$perm = $_POST['stay_logged_in'];
send_cookie('auth', $authenticator, $perm);
exit;
}
// check for time/id/hash case.
$id = get_int('id', true);
$t = get_int('t', true);
$h = get_str('h', true);
if ($id && $t && $h) {
$user = BoincUser::lookup_id($id);
if (!$user) {
error_page("Invalid user ID.\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.");
}
$x = $id . $user->authenticator . $t;
$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.");
}
开发者ID:Turante,项目名称:boincweb,代码行数:31,代码来源:login_action.php
示例16: db_init
// 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_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)) {
开发者ID:Turante,项目名称:boincweb,代码行数:31,代码来源:db_action.php
示例17: get_int
//
// 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/>.
// show details of an app
require_once '../inc/util_ops.inc';
$appid = get_int("appid");
$app = BoincApp::lookup_id($appid);
if (!$app) {
admin_error_page("no such app");
}
admin_page_head("Details for {$app->name} ({$app->user_friendly_name})");
start_table();
row2("Min average efficiency", $app->min_avg_pfc);
echo "\n <p>\n In the list below, 'Credit scale factor' should\n be roughly 1 for CPU versions, 0.1 for GPU versions.\n If values are far outside this range,\n you may have bad FLOPs estimates.\n In this case, you may want to\n <ol>\n <li> <a href=job_times.php?appid={$appid}>Get a better FLOPs estimate</a>\n <li> <a href=app_reset.php?appid={$appid}>reset credit statistics for this application</a>.\n </ol>\n";
end_table();
echo "<h2>App versions</h2>\n";
$avs = BoincAppVersion::enum("appid={$appid}");
$avs = current_versions($avs);
foreach ($avs as $av) {
$platform = BoincPlatform::lookup_id($av->platformid);
start_table();
开发者ID:CalvinZhu,项目名称:boinc,代码行数:31,代码来源:app_details.php
示例18: notices_rss_start
{
return $a->time < $b->time;
}
function notices_rss_start()
{
$t = gmdate('D, d M Y H:i:s', time()) . " GMT";
header("Expires: {$t}");
header("Last-Modified: {$t}");
header("Content-Type: application/xml");
echo "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>\n <rss version=\"2.0\">\n <channel>\n <title>" . PROJECT . " notices</title>\n <link>" . URL_BASE . "</link>\n <description>Notices</description>\n <lastBuildDate>{$t}</lastBuildDate>\n ";
}
function notices_rss_end()
{
echo "\n </channel>\n </rss>\n ";
}
$userid = get_int('userid');
$auth = get_str('auth');
$since_time = time() - 30 * 86400;
$user = BoincUser::lookup_id($userid);
if (!$user) {
xml_error();
}
// the auth in the URL includes "userid_"
//
$x = $user->id . "_" . notify_rss_auth($user);
if ($x != $auth) {
xml_error(-155, 'Invalid authenticator');
}
$since_clause = "and create_time > {$since_time}";
$notifies = BoincNotify::enum("userid = {$userid} {$since_clause}");
$forum = news_forum();
开发者ID:nicolas17,项目名称:boincgit-test,代码行数:31,代码来源:notices.php
示例19: error_page
// 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 allows people to subscribe to threads.
// Whenever someone posts to the thread
// the subscribers will receive a notification email
require_once '../inc/forum.inc';
if (DISABLE_FORUMS) {
error_page("Forums are disabled");
}
check_get_args(array("action", "thread", "tnow", "ttok"));
$action = get_str('action');
$threadid = get_int('thread');
$thread = BoincThread::lookup_id($threadid);
$forum = BoincForum::lookup_id($thread->forum);
function show_title($forum, $thread)
{
switch ($forum->parent_type) {
case 0:
$category = BoincCategory::lookup_id($forum->category);
show_forum_title($category, $forum, $thread);
break;
case 1:
show_team_forum_title($forum, $thread);
break;
}
}
function subscribe($forum, $thread, $user)
开发者ID:CalvinZhu,项目名称:boinc,代码行数:31,代码来源:forum_subscribe.php
示例20: check_get_args
// 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/cache.inc";
require_once "../inc/util.inc";
require_once "../inc/boinc_db.inc";
require_once "../inc/team.inc";
check_get_args(array("teamid"));
$teamid = get_int("teamid");
$team = BoincTeam::lookup_id($teamid);
$get_from_db = false;
$user = get_logged_in_user(false);
// always show fresh copy to admins; they might be editing info
//
if (is_team_admin($user, $team)) {
$get_from_db = true;
}
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) {
开发者ID:nicolas17,项目名称:boincgit-test,代码行数:31,代码来源:team_display.php
注:本文中的get_int函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论