本文整理汇总了PHP中post_param_integer函数的典型用法代码示例。如果您正苦于以下问题:PHP post_param_integer函数的具体用法?PHP post_param_integer怎么用?PHP post_param_integer使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了post_param_integer函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: action_done
/**
* Standard actualisation stage of pointstore item purchase.
*
* @return tempcode The UI
*/
function action_done()
{
$class = str_replace('hook_pointstore_', '', strtolower(get_class($this)));
if (get_option('is_on_' . $class . '_buy') == '0') {
return new ocp_tempcode();
}
$topic_id = post_param_integer('select_topic_id', -1);
if ($topic_id == -1) {
$_topic_id = post_param('manual_topic_id');
$topic_id = intval($_topic_id);
}
$title = get_page_title('TOPIC_PINNING');
// Check points
$cost = intval(get_option($class));
$points_left = available_points(get_member());
if ($points_left < $cost && !has_specific_permission(get_member(), 'give_points_self')) {
return warn_screen($title, do_lang_tempcode('_CANT_AFFORD', integer_format($cost), integer_format($points_left)));
}
// Actuate
$GLOBALS['FORUM_DRIVER']->pin_topic($topic_id);
require_code('points2');
charge_member(get_member(), $cost, do_lang('TOPIC_PINNING'));
$GLOBALS['SITE_DB']->query_insert('sales', array('date_and_time' => time(), 'memberid' => get_member(), 'purchasetype' => 'TOPIC_PINNING', 'details' => strval($topic_id), 'details2' => ''));
// Show message
$url = build_url(array('page' => '_SELF', 'type' => 'misc'), '_SELF');
return redirect_screen($title, $url, do_lang_tempcode('ORDER_GENERAL_DONE'));
}
示例2: run
/**
* Standard modular run function for preview hooks.
*
* @return array A pair: The preview, the updated post Comcode
*/
function run()
{
require_code('uploads');
$urls = get_url('', 'file', 'uploads/iotds', 0, OCP_UPLOAD_IMAGE, true, '', 'file2');
if ($urls[0] == '') {
if (!is_null(post_param_integer('id', NULL))) {
$rows = $GLOBALS['SITE_DB']->query_select('iotds', array('url', 'thumb_url'), array('id' => post_param_integer('id')), '', 1);
$urls = $rows[0];
$url = $urls['url'];
$thumb_url = $urls['thumb_url'];
} else {
warn_exit(do_lang_tempcode('IMPROPERLY_FILLED_IN_UPLOAD'));
}
} else {
$url = $urls[0];
$thumb_url = $urls[1];
}
$caption = comcode_to_tempcode(post_param('caption', ''));
$title = comcode_to_tempcode(post_param('title', ''));
require_code('images');
$thumb = do_image_thumb(url_is_local($thumb_url) ? get_custom_base_url() . '/' . $thumb_url : $thumb_url, $caption, true);
$url = url_is_local($url) ? get_custom_base_url() . '/' . $url : $url;
$preview = do_template('IOTD', array('ID' => '', 'IMAGE_URL' => $url, 'SUBMITTER' => strval(get_member()), 'VIEW_URL' => $url, 'IMAGE' => $thumb, 'CAPTION' => $title));
return array($preview, NULL);
}
示例3: action_done
/**
* Standard actualisation stage of pointstore item purchase.
*
* @return tempcode The UI
*/
function action_done()
{
$class = str_replace('hook_pointstore_', '', strtolower(get_class($this)));
if (get_option('is_on_' . $class . '_buy') == '0' || get_forum_type() != 'ocf') {
return new ocp_tempcode();
}
if ($GLOBALS['FORUM_DRIVER']->get_member_row_field(get_member(), 'm_highlighted_name') == 1) {
warn_exit(do_lang_tempcode('_ALREADY_HAVE'));
}
$title = get_page_title('NAME_HIGHLIGHTING');
post_param_integer('confirm');
// To make sure we're not being passed by a GET
// Check points
$cost = intval(get_option($class));
$points_left = available_points(get_member());
if ($points_left < $cost && !has_specific_permission(get_member(), 'give_points_self')) {
return warn_screen($title, do_lang_tempcode('_CANT_AFFORD', integer_format($cost), integer_format($points_left)));
}
// Actuate
$GLOBALS['FORUM_DB']->query_update('f_members', array('m_highlighted_name' => 1), array('id' => get_member()), '', 1);
require_code('points2');
charge_member(get_member(), $cost, do_lang('NAME_HIGHLIGHTING'));
$GLOBALS['SITE_DB']->query_insert('sales', array('date_and_time' => time(), 'memberid' => get_member(), 'purchasetype' => 'NAME_HIGHLIGHTING', 'details' => '', 'details2' => ''));
// Show message
$url = build_url(array('page' => '_SELF', 'type' => 'misc'), '_SELF');
return redirect_screen($title, $url, do_lang_tempcode('ORDER_GENERAL_DONE'));
}
示例4: backend_cloud_script
/**
* Handle cloud registrations.
*/
function backend_cloud_script()
{
// Closed site
$site_closed = get_option('site_closed');
if ($site_closed == '1' && !has_specific_permission(get_member(), 'access_closed_site') && !$GLOBALS['IS_ACTUALLY_ADMIN']) {
header('Content-Type: text/plain');
@exit(get_option('closed'));
}
$path = post_param('path', '');
$procedure = post_param('registerProcedure', '');
$protocol = post_param('protocol', '');
if ($protocol == 'soap') {
exit('false');
}
if ($protocol == 'http-post') {
exit('false');
}
if ($protocol == 'xml-rpc' && !function_exists('xmlrpc_encode')) {
exit('false');
}
$port = post_param_integer('port', '80');
// $watching_channel=$_POST['channels'];
$status = register_them($path, $procedure, $protocol, $port, get_param('type', ''));
if (!$status) {
exit('false');
}
exit('true');
}
示例5: run
/**
* Standard modular run function for preview hooks.
*
* @return array A pair: The preview, the updated post Comcode
*/
function run()
{
if (!has_specific_permission(get_member(), 'comcode_dangerous')) {
exit;
}
require_code('zones2');
require_code('zones3');
$bparameters = '';
$bparameters_xml = '';
$block = post_param('block');
$parameters = get_block_parameters($block);
$parameters[] = 'failsafe';
$parameters[] = 'cache';
$parameters[] = 'quick_cache';
foreach ($parameters as $parameter) {
$value = post_param($parameter, NULL);
if (is_null($value)) {
if (post_param_integer('tick_on_form__' . $parameter, NULL) === NULL) {
continue;
}
// If not on form, continue, otherwise must be 0
$value = '0';
}
if ($value != '' && ($parameter != 'failsafe' || $value == '1') && ($parameter != 'cache' || $value != block_cache_default($block)) && ($parameter != 'quick_cache' || $value == '1')) {
$bparameters .= ' ' . $parameter . '="' . str_replace('"', '\\"', $value) . '"';
$bparameters_xml = '<blockParam key="' . escape_html($parameter) . '" val="' . escape_html($value) . '" />';
}
}
$comcode = '[block' . $bparameters . ']' . $block . '[/block]';
$preview = comcode_to_tempcode($comcode);
return array($preview, NULL);
}
示例6: get_attachments
/**
* Get what we need to get attachments in a form-field interface.
*
* @param ID_TEXT The name of the field attachments are for
* @return array A pair: the attachments UI (tempcode), the hidden attachment field
*/
function get_attachments($posting_field_name)
{
$image_types = str_replace(',', ', ', get_option('valid_images'));
require_lang('javascript');
require_javascript('javascript_swfupload');
require_css('swfupload');
require_code('files2');
$max_attach_size = get_max_file_size(get_member(), $GLOBALS['SITE_DB']);
$attach_size_field = form_input_hidden('MAX_FILE_SIZE', strval($max_attach_size));
$num_attachments = post_param_integer('num_attachments', has_js() ? 1 : 3);
$attachments = new ocp_tempcode();
for ($i = 1; $i <= $num_attachments; $i++) {
$attachments->attach(do_template('ATTACHMENT', array('_GUID' => 'c3b38ca70cbd1c5f9cf91bcae9ed1134', 'POSTING_FIELD_NAME' => $posting_field_name, 'I' => strval($i))));
}
if (get_forum_type() == 'ocf') {
require_code('ocf_groups');
require_lang('ocf');
$max_attachments = ocf_get_member_best_group_property(get_member(), 'max_attachments_per_post');
} else {
$max_attachments = 100;
}
$attachment_template = do_template('ATTACHMENT', array('_GUID' => 'c3b38ca70cbd1c5f9cf91bcae9ed11dsds', 'POSTING_FIELD_NAME' => $posting_field_name, 'I' => '__num_attachments__'));
$attachments = do_template('ATTACHMENTS', array('_GUID' => '054921e7c09412be479676759accf222', 'POSTING_FIELD_NAME' => $posting_field_name, 'ATTACHMENT_TEMPLATE' => $attachment_template, 'IMAGE_TYPES' => $image_types, 'ATTACHMENTS' => $attachments, 'MAX_ATTACHMENTS' => strval($max_attachments), 'NUM_ATTACHMENTS' => strval($num_attachments)));
return array($attachments, $attach_size_field);
}
示例7: update_cart
/**
* Update cart
*
* @param array Product details
*/
function update_cart($product_det)
{
if (!is_array($product_det) || count($product_det) == 0) {
return;
}
foreach ($product_det as $product) {
$where = array('product_id' => $product['product_id'], 'is_deleted' => 0);
if (is_guest()) {
$where['session_id'] = get_session_id();
} else {
$where['ordered_by'] = get_member();
}
if ($product['Quantity'] > 0) {
$GLOBALS['SITE_DB']->query_update('shopping_cart', array('quantity' => $product['Quantity']), $where);
} else {
$GLOBALS['SITE_DB']->query_delete('shopping_cart', $where);
}
}
//Update tax opt out status to the current order
$tax_opted_out = post_param_integer('tax_opted_out', 0);
$order_id = get_current_order_id();
if (get_option('allow_opting_out_of_tax') == '1') {
$GLOBALS['SITE_DB']->query_update('shopping_order', array('tax_opted_out' => $tax_opted_out), array('id' => $order_id), '', 1);
}
}
示例8: run
/**
* Standard modular run function for snippet hooks. Generates XHTML to insert into a page using AJAX.
*
* @return tempcode The snippet
*/
function run()
{
if (get_option('is_on_rating') == '0') {
return do_lang_tempcode('INTERNAL_ERROR');
}
// Has there actually been any rating?
if (strtoupper(ocp_srv('REQUEST_METHOD')) == 'POST' || ocp_srv('HTTP_REFERER') == '') {
$rating = either_param_integer('rating', NULL);
} else {
$rating = post_param_integer('rating');
// Will fail
}
$content_type = get_param('content_type');
$type = get_param('type', '');
$content_id = get_param('id');
$content_url = get_param('content_url', '', true);
$content_title = get_param('content_title', '', true);
require_code('feedback');
actualise_specific_rating($rating, get_page_name(), get_member(), $content_type, $type, $content_id, $content_url, $content_title);
actualise_give_rating_points();
$template = get_param('template', NULL);
if ($template !== '') {
if (is_null($template)) {
$template = 'RATING_BOX';
}
return display_rating($content_url, $content_title, $content_type, $content_id, $template);
}
return do_lang_tempcode('THANKYOU_FOR_RATING_SHORT');
}
示例9: render_tab
/**
* Standard modular render function for profile tabs edit hooks.
*
* @param MEMBER The ID of the member who is being viewed
* @param MEMBER The ID of the member who is doing the viewing
* @param boolean Whether to leave the tab contents NULL, if tis hook supports it, so that AJAX can load it later
* @return ?array A tuple: The tab title, the tab body text (may be blank), the tab fields, extra Javascript (may be blank) the suggested tab order, hidden fields (optional) (NULL: if $leave_to_ajax_if_possible was set)
*/
function render_tab($member_id_of, $member_id_viewing, $leave_to_ajax_if_possible = false)
{
$title = do_lang_tempcode('DELETE_MEMBER');
$order = 200;
// Actualiser
$delete_account = post_param_integer('delete', 0);
if ($delete_account == 1) {
if (is_guest($member_id_of)) {
warn_exit(do_lang_tempcode('INTERNAL_ERROR'));
}
ocf_delete_member($member_id_of);
inform_exit(do_lang_tempcode('SUCCESS'));
}
if ($leave_to_ajax_if_possible) {
return NULL;
}
// UI fields
$username = $GLOBALS['FORUM_DRIVER']->get_username($member_id_of);
$text = do_lang_tempcode('_DELETE_MEMBER' . ($member_id_of == get_member() ? '_SUICIDAL' : ''), escape_html($username));
$fields = new ocp_tempcode();
require_code('form_templates');
$fields->attach(form_input_tick(do_lang_tempcode('DELETE'), do_lang_tempcode('DESCRIPTION_DELETE'), 'delete', false));
$javascript = '';
return array($title, $fields, $text, $javascript, $order);
}
示例10: set_fields
/**
* Standard modular run function for setting features from the setup wizard.
*/
function set_fields()
{
if (!addon_installed('banners')) {
return;
}
$usergroups = $GLOBALS['FORUM_DRIVER']->get_usergroup_list();
if (post_param_integer('have_default_banners_donation', 0) == 0) {
$test = $GLOBALS['SITE_DB']->query_value_null_ok('banners', 'name', array('name' => 'donate'));
if (!is_null($test)) {
require_code('banners2');
delete_banner('donate');
foreach (array_keys($usergroups) as $id) {
$GLOBALS['SITE_DB']->query_insert('group_page_access', array('page_name' => 'donate', 'zone_name' => 'site', 'group_id' => $id), false, true);
}
}
}
if (post_param_integer('have_default_banners_advertising', 0) == 0) {
$test = $GLOBALS['SITE_DB']->query_value_null_ok('banners', 'name', array('name' => 'advertise_here'));
if (!is_null($test)) {
require_code('banners2');
delete_banner('advertise_here');
foreach (array_keys($usergroups) as $id) {
$GLOBALS['SITE_DB']->query_insert('group_page_access', array('page_name' => 'advertise', 'zone_name' => 'site', 'group_id' => $id), false, true);
}
}
}
$test = $GLOBALS['SITE_DB']->query_value('banners', 'COUNT(*)');
if ($test == 0) {
set_option('is_on_banners', '0');
}
}
示例11: set_fields
/**
* Standard modular run function for setting features from the setup wizard.
*/
function set_fields()
{
if (!addon_installed('news')) {
return;
}
$admin_groups = $GLOBALS['FORUM_DRIVER']->get_super_admin_groups();
$groups = $GLOBALS['FORUM_DRIVER']->get_usergroup_list(false, true);
$GLOBALS['SITE_DB']->query_delete('gsp', array('specific_permission' => 'have_personal_category', 'the_page' => 'cms_news'));
if (post_param_integer('keep_blogs', 0) == 1) {
foreach (array_keys($groups) as $group_id) {
if (!in_array($group_id, $admin_groups)) {
$GLOBALS['SITE_DB']->query_insert('gsp', array('specific_permission' => 'have_personal_category', 'group_id' => $group_id, 'module_the_name' => '', 'category_name' => '', 'the_page' => 'cms_news', 'the_value' => 1));
}
}
}
if (post_param_integer('keep_news_categories', 0) == 0) {
$news_cats = $GLOBALS['SITE_DB']->query_select('news_categories', array('id'), array('nc_owner' => NULL));
foreach ($news_cats as $news_cat) {
if ($news_cat['id'] > db_get_first_id() && $news_cat['id'] < db_get_first_id() + 7) {
require_code('news');
delete_news_category($news_cat['id']);
}
}
}
}
示例12: action_done
/**
* Standard actualisation stage of pointstore item purchase.
*
* @return tempcode The UI
*/
function action_done()
{
$class = str_replace('hook_pointstore_', '', strtolower(get_class($this)));
if (get_option('is_on_' . $class . '_buy') == '0') {
return new ocp_tempcode();
}
$amount = post_param_integer('amount', -1);
$title = get_page_title('GAMBLING');
// Check points
$cost = intval(get_option('minimum_gamble_amount'));
$points_left = available_points(get_member());
$max = min(intval(get_option('maximum_gamble_amount')), $points_left);
if (!has_specific_permission(get_member(), 'give_points_self') || $amount < 0) {
if ($amount < $cost || $amount > $max) {
warn_exit(do_lang_tempcode('INVALID_GAMBLE_AMOUNT'));
}
if ($points_left < $amount) {
return warn_screen($title, do_lang_tempcode('_CANT_AFFORD', integer_format($cost), integer_format($points_left)));
}
}
// Calculate
$average_gamble_multiplier = floatval(get_option('average_gamble_multiplier')) / 100.0;
$maximum_gamble_multiplier = floatval(get_option('maximum_gamble_multiplier')) / 100.0;
$above_average = mt_rand(0, 10) < 5;
if ($above_average) {
// $winnings=round($average_gamble_multiplier*$amount+mt_rand(0,round($maximum_gamble_multiplier*$amount-$average_gamble_multiplier*$amount))); Even distribution is NOT wise
$peak = $maximum_gamble_multiplier * $amount;
$under = 0.0;
$number = intval(round($average_gamble_multiplier * $amount + mt_rand(0, intval(round($maximum_gamble_multiplier * $amount - $average_gamble_multiplier * $amount)))));
for ($x = 1; $x < intval($peak); $x++) {
$p = $peak * (1.0 / pow(floatval($x) + 0.4, 2.0) - 1.0 / pow($maximum_gamble_multiplier * floatval($amount), 2.0));
// Using a 1/x^2 curve. 0.4 is a bit of a magic number to get the averaging right
$under += $p;
if ($under > floatval($number)) {
break;
}
}
$winnings = intval(round($average_gamble_multiplier * $amount + $x * 1.1));
// 1.1 is a magic number to make it seem a bit fairer
} else {
$winnings = mt_rand(0, intval(round($average_gamble_multiplier * $amount)));
}
// Actuate
require_code('points2');
charge_member(get_member(), $amount - $winnings, do_lang('GAMBLING'));
$GLOBALS['SITE_DB']->query_insert('sales', array('date_and_time' => time(), 'memberid' => get_member(), 'purchasetype' => 'GAMBLING', 'details' => strval($amount), 'details2' => ''));
// Show message
if ($winnings > $amount) {
$result = do_lang_tempcode('GAMBLE_CONGRATULATIONS', integer_format($winnings - $amount), integer_format($amount));
} else {
$result = do_lang_tempcode('GAMBLE_COMMISERATIONS', integer_format($amount - $winnings), integer_format($amount));
}
$url = build_url(array('page' => '_SELF', 'type' => 'misc'), '_SELF');
return redirect_screen($title, $url, $result);
}
示例13: _get_input_date
/**
* Check a POST inputted date for validity, and get the Unix timestamp for the inputted date.
*
* @param ID_TEXT The stub of the parameter name (stub_year, stub_month, stub_day, stub_hour, stub_minute)
* @param boolean Whether to allow over get parameters also
* @return ?TIME The timestamp of the date (NULL: no input date was chosen)
*/
function _get_input_date($stub, $get_also = false)
{
$timezone = post_param('timezone', get_users_timezone());
if ($get_also) {
// if (either_param_integer($stub,0)==0) return NULL; // NULL was chosen Doesn't work like this now
$year = either_param_integer($stub . '_year', NULL);
if (is_null($year)) {
return NULL;
}
$month = either_param_integer($stub . '_month', NULL);
if (is_null($month)) {
return NULL;
}
$day = either_param_integer($stub . '_day', NULL);
if (is_null($day)) {
return NULL;
}
$hour = either_param_integer($stub . '_hour', NULL);
$minute = either_param_integer($stub . '_minute', NULL);
} else {
// if (post_param_integer($stub,0)==0) return NULL; // NULL was chosen Doesn't work like this now
$year = post_param_integer($stub . '_year', NULL);
if (is_null($year)) {
return NULL;
}
$month = post_param_integer($stub . '_month', NULL);
if (is_null($month)) {
return NULL;
}
$day = post_param_integer($stub . '_day', NULL);
if (is_null($day)) {
return NULL;
}
$hour = post_param_integer($stub . '_hour', NULL);
$minute = post_param_integer($stub . '_minute', NULL);
}
if (!checkdate($month, $day, $year)) {
warn_exit(do_lang_tempcode('INVALID_DATE_GIVEN'));
}
if (is_null($hour)) {
if (strpos($stub, 'end') !== false) {
$hour = 23;
$minute = 59;
} else {
$hour = 0;
$minute = 0;
}
}
$time = mktime($hour, $minute, 0, $month, $day, $year);
if ($year >= 1970 || @strftime('%Y', @mktime(0, 0, 0, 1, 1, 1963)) == '1963') {
$amount_forward = tz_time($time, $timezone) - $time;
$time = $time - $amount_forward;
}
return $time;
}
示例14: run
/**
* Standard modular run function for preview hooks.
*
* @return array A pair: The preview, the updated post Comcode
*/
function run()
{
require_lang('ocf');
require_css('ocf');
$original_comcode = post_param('post');
$posting_ref_id = post_param_integer('posting_ref_id', mt_rand(0, 100000));
$post_bits = do_comcode_attachments($original_comcode, 'seedy_post', strval(-$posting_ref_id), true, $GLOBALS['SITE_DB']);
$post_comcode = $post_bits['comcode'];
$post_html = $post_bits['tempcode'];
return array($post_html, $post_comcode);
}
示例15: _do_price_mail
/**
* Update an e-mail address from what was chosen in an interface; update or delete each price/cost/item
*/
function _do_price_mail()
{
$i = 0;
while (array_key_exists('forw_' . strval($i), $_POST)) {
$price = post_param_integer('forw_' . strval($i));
$name = 'forw_' . post_param('dforw_' . strval($i));
$name2 = 'forw_' . post_param('ndforw_' . strval($i));
if (post_param_integer('delete_forw_' . strval($i), 0) == 1) {
$GLOBALS['SITE_DB']->query_delete('prices', array('name' => $name), '', 1);
} else {
$GLOBALS['SITE_DB']->query_update('prices', array('price' => $price, 'name' => $name2), array('name' => $name), '', 1);
}
$i++;
}
}