本文整理汇总了PHP中post_param函数的典型用法代码示例。如果您正苦于以下问题:PHP post_param函数的具体用法?PHP post_param怎么用?PHP post_param使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了post_param函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: bookmarks_script
/**
* Script to make a bookmark add-form popup.
*/
function bookmarks_script()
{
require_lang('bookmarks');
$type = get_param('type');
switch ($type) {
case '_ad':
$title = get_page_title('ADD_BOOKMARK');
$folder = post_param('folder_new', '');
if ($folder == '') {
$folder = post_param('folder');
}
if ($folder == '!') {
$folder = '';
}
add_bookmark(get_member(), $folder, post_param('title'), post_param('page_link'));
$content = inform_screen($title, do_lang_tempcode('SUCCESS'));
$content->attach('<script type="text/javascript">// <![CDATA[
if (window.opener) window.close();
//]]></script>');
break;
default:
$url = find_script('bookmarks') . '?no_redirect=1&type=_ad';
$keep = symbol_tempcode('KEEP');
$url .= $keep->evaluate();
$content = add_bookmark_form($url);
break;
}
$echo = do_template('POPUP_HTML_WRAP', array('TITLE' => do_lang_tempcode('ADD_BOOKMARK'), 'CONTENT' => $content));
$echo->handle_symbol_preprocessing();
$echo->evaluate_echo();
}
示例2: run
/**
* Standard modular run function.
*
* @param array A map of parameters.
* @return tempcode The result of execution.
*/
function run($map)
{
require_lang('staff_checklist');
$newdata = post_param('stafflinksedit', NULL);
if (!is_null($newdata)) {
$items = explode("\n", $newdata);
$GLOBALS['SITE_DB']->query_delete('stafflinks');
foreach ($items as $i) {
$q = trim($i);
if (!empty($q)) {
$bits = explode('=', $q);
if (count($bits) >= 2) {
$last_bit = array_pop($bits);
$bits = array(implode('=', $bits), $last_bit);
$link = $bits[0];
} else {
$link = $q;
}
$link_title = $GLOBALS['SITE_DB']->query_value_null_ok('url_title_cache', 't_title', array('t_url' => $link));
if (is_null($link_title) || substr($link_title, 0, 1) == '!') {
$link_title = '';
$downloaded_at_link = http_download_file($link, 3000, false);
if (is_string($downloaded_at_link)) {
$matches = array();
if (preg_match('#\\s*<title[^>]*\\s*>\\s*(.*)\\s*\\s*<\\s*/title\\s*>#mi', $downloaded_at_link, $matches) != 0) {
require_code('character_sets');
$link_title = trim(str_replace('–', '-', str_replace('—', '-', @html_entity_decode(convert_to_internal_encoding($matches[1]), ENT_QUOTES, get_charset()))));
}
}
$GLOBALS['SITE_DB']->query_insert('url_title_cache', array('t_url' => $link, 't_title' => $link_title), false, true);
// To stop weird race-like conditions
}
if (count($bits) == 2) {
$link_desc = $bits[1];
} else {
$link_desc = $link_title;
}
$GLOBALS['SITE_DB']->query_insert('stafflinks', array('link' => $link, 'link_title' => $link_title, 'link_desc' => $link_desc));
}
}
}
$rows = $GLOBALS['SITE_DB']->query_select('stafflinks', array('*'));
$formattedstafflinks = array();
$unformattedstafflinks = array();
foreach ($rows as $r) {
if ($r['link_title'] == '') {
$r['link_title'] = $r['link_desc'];
}
if (strlen($r['link_title']) > strlen($r['link_desc'])) {
$r['link_title'] = $r['link_desc'];
}
$formattedstafflinks[] = array('URL' => $r['link'], 'TITLE' => $r['link_title'], 'DESC' => $r['link_title'] == $r['link_desc'] ? '' : $r['link_desc']);
$unformattedstafflinks[] = array('LINKS' => $r['link'] . '=' . $r['link_desc']);
}
$map_comcode = '';
foreach ($map as $key => $val) {
$map_comcode .= ' ' . $key . '="' . addslashes($val) . '"';
}
return do_template('BLOCK_MAIN_STAFF_LINKS', array('URL' => get_self_url(), 'BLOCK_NAME' => 'main_staff_links', 'MAP' => $map_comcode, 'FORMATTEDLINKS' => $formattedstafflinks, 'UNFORMATTEDLINKS' => $unformattedstafflinks));
}
示例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') {
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'));
}
示例4: run
/**
* Standard modular run function.
*
* @param array A map of parameters.
* @return tempcode The result of execution.
*/
function run($map)
{
require_code('textfiles');
$file = array_key_exists('param', $map) ? $map['param'] : 'admin_notes';
$title = array_key_exists('title', $map) ? $map['title'] : do_lang('NOTES');
$lang_none = array_key_exists('lang_none', $map) ? $map['lang_none'] : '0';
$scrolls = array_key_exists('scrolls', $map) ? $map['scrolls'] : '0';
$lang = $lang_none == '1' ? NULL : '';
$file = filter_naughty($file, true);
$new = post_param('new', NULL);
if (!is_null($new)) {
$hooks = find_all_hooks('blocks', 'main_notes');
foreach (array_keys($hooks) as $hook) {
require_code('hooks/blocks/main_notes/' . filter_naughty_harsh($hook));
$ob = object_factory('Hook_notes_' . filter_naughty_harsh($hook), true);
if (is_null($ob)) {
continue;
}
$ob->run($file);
}
write_text_file($file, $lang, $new);
log_it('NOTES', $file);
attach_message(do_lang_tempcode('SUCCESS'), 'inform');
}
$contents = read_text_file($file, $lang, true);
$post_url = get_self_url();
$map_comcode = '';
foreach ($map as $key => $val) {
$map_comcode .= ' ' . $key . '="' . addslashes($val) . '"';
}
return do_template('BLOCK_MAIN_NOTES', array('_GUID' => 'f737053505de3bd8ccfe806ec014b8fb', 'TITLE' => $title, 'BLOCK_NAME' => 'main_notes', 'MAP' => $map_comcode, 'CONTENTS' => $contents, 'SCROLLS' => array_key_exists('scrolls', $map) && $map['scrolls'] == '1', 'URL' => $post_url));
}
示例5: _a_tag_link_fixup
/**
* Used by semihtml_to_comcode to fix <a> tag links. preg_replace_callback callback
*
* @param array Array of matches
* @return string Substituted text
*/
function _a_tag_link_fixup($matches)
{
$referer = post_param('http_referer', ocp_srv('HTTP_REFERER'));
$caller_url = looks_like_url($referer) ? preg_replace('#/[^/]*$#', '', $referer) : get_base_url();
$ret = '<a ' . $matches[1] . 'href="' . qualify_url($matches[2], $caller_url) . '"' . $matches[3] . '>';
return $ret;
}
示例6: 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);
}
示例7: 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);
}
示例8: 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');
}
示例9: run
/**
* Standard modular run function for preview hooks.
*
* @return array A pair: The preview, the updated post Comcode
*/
function run()
{
require_code('comcode_add');
$comcode = _get_preview_environment_comcode(post_param('tag'));
$temp_tpl = comcode_to_tempcode($comcode[0]);
return array($temp_tpl, NULL);
}
示例10: set_fields
/**
* Standard modular run function for setting features from the setup wizard.
*/
function set_fields()
{
if (!addon_installed('stats')) {
return;
}
set_option('stats_store_time', post_param('stats_store_time'));
}
示例11: run
/**
* Standard modular run function.
*
* @return tempcode The result of execution.
*/
function run()
{
require_lang('bulkupload');
$GLOBALS['HELPER_PANEL_PIC'] = 'pagepics/bulkuploadassistant';
$GLOBALS['HELPER_PANEL_TUTORIAL'] = 'tut_adv_comcode';
$GLOBALS['HELPER_PANEL_TEXT'] = comcode_lang_string('DOC_BULK_UPLOAD');
$title = get_page_title('BULK_UPLOAD');
$parameter = post_param('parameter', '');
require_code('form_templates');
if ($parameter == '') {
$post_url = build_url(array('page' => '_SELF'), '_SELF');
$text = paragraph(do_lang_tempcode('BULK_UPLOAD_HELP'));
$submit_name = do_lang_tempcode('BULK_UPLOAD');
$fields = form_input_line(do_lang_tempcode('DIRECTORY'), do_lang_tempcode('DIRECTORY_BULK'), 'parameter', 'uploads/attachments/' . date('Y-m-d', utctime_to_usertime()), true);
return do_template('FORM_SCREEN', array('_GUID' => '77a2ca460745145d8a1d18cf24971fea', 'SKIP_VALIDATION' => true, 'HIDDEN' => '', 'FIELDS' => $fields, 'URL' => $post_url, 'TITLE' => $title, 'TEXT' => $text, 'SUBMIT_NAME' => $submit_name));
} else {
breadcrumb_set_parents(array(array('_SELF:_SELF:misc', do_lang_tempcode('BULK_UPLOAD'))));
breadcrumb_set_self(do_lang_tempcode('_RESULTS'));
$out = $this->do_dir(get_custom_file_base() . '/' . filter_naughty($parameter, true));
if ($out->is_empty()) {
inform_exit(do_lang_tempcode('NO_FILES'));
}
return do_template('BULK_HELPER_RESULTS_SCREEN', array('_GUID' => '5d373553cf21a58f15006bd4e600a9ee', 'TITLE' => $title, 'RESULTS' => $out));
}
}
示例12: run
/**
* Standard modular run function for snippet hooks. Generates XHTML to insert into a page using AJAX.
*
* @return tempcode The snippet
*/
function run()
{
if (has_actual_page_access(get_member(), 'admin_themes')) {
require_code('tempcode_compiler');
return template_to_tempcode(post_param('css'));
}
return new ocp_tempcode();
}
示例13: run
/**
* Standard modular run function for preview hooks.
*
* @return array A pair: The preview, the updated post Comcode
*/
function run()
{
$_GET['keep_theme_seed'] = post_param('seed_hex');
$_GET['keep_theme_dark'] = post_param('dark', '0');
$_GET['keep_theme_source'] = 'default';
$_GET['keep_theme_algorithm'] = 'equations';
$preview = request_page($GLOBALS['SITE_DB']->query_value('zones', 'zone_default_page'), true, '');
return array($preview, NULL);
}
示例14: _do_template
/**
* A template has not been structurally cached, so compile it and store in the cache.
*
* @param ID_TEXT The theme the template is in the context of
* @param PATH The path to the template file
* @param ID_TEXT The codename of the template (e.g. foo)
* @param ID_TEXT The actual codename to use for the template (e.g. thin_foo)
* @param LANGUAGE_NAME The language the template is in the context of
* @param string File type suffix of template file
* @param ?ID_TEXT The theme to cache in (NULL: main theme)
* @return tempcode The compiled tempcode
*/
function _do_template($theme, $path, $codename, $_codename, $lang, $suffix, $theme_orig = NULL)
{
if (is_null($theme_orig)) {
$theme_orig = $theme;
}
$base_dir = ($theme == 'default' && ($suffix != '.css' || strpos($path, '/css_custom') === false) ? get_file_base() : get_custom_file_base()) . '/themes/';
global $CACHE_TEMPLATES, $FILE_ARRAY, $TEMPLATE_PREVIEW_OP, $MEM_CACHE;
if (isset($FILE_ARRAY)) {
$html = unixify_line_format(file_array_get('themes/' . $theme . $path . $codename . $suffix));
} else {
$html = unixify_line_format(file_get_contents($base_dir . filter_naughty($theme . $path . $codename) . $suffix, FILE_TEXT));
}
if (strpos($html, '{$,Parser hint: pure}') !== false) {
return make_string_tempcode(preg_replace('#\\{\\$,.*\\}#U', '/*no minify*/', $html));
}
if ($GLOBALS['SEMI_DEBUG_MODE'] && strpos($html, '.innerHTML') !== false && strpos($html, 'Parser hint: .innerHTML okay') === false) {
require_code('site');
attach_message('Do not use the .innerHTML property in your Javascript because it will not work in true XHTML (when the browsers real XML parser is in action). Use ocPortal\'s global setInnerHTML/getInnerHTML functions.', 'warn');
}
// Strip off trailing final lines from single lines templates. Editors often put these in, and it causes annoying "visible space" issues
if (substr($html, -1, 1) == chr(10) && substr_count($html, chr(10)) == 1) {
$html = substr($html, 0, strlen($html) - 1);
}
if ($TEMPLATE_PREVIEW_OP) {
$test = post_param($codename, NULL);
if (!is_null($test)) {
$html = post_param($test . '_new');
}
}
$result = template_to_tempcode($html, 0, false, $codename, $theme, $lang);
if ($CACHE_TEMPLATES && ($suffix == '.tpl' || $codename == 'no_cache')) {
if (!is_null($MEM_CACHE)) {
persistant_cache_set(array('TEMPLATE', $theme, $lang, $_codename), $result->to_assembly(), strpos($path, 'default/templates/') !== false);
} else {
$path2 = get_custom_file_base() . '/themes/' . $theme_orig . '/templates_cached/' . filter_naughty($lang) . '/';
$myfile = @fopen($path2 . filter_naughty($_codename) . $suffix . '.tcd', 'wb');
if ($myfile === false) {
if (@mkdir($path2, 0777)) {
require_code('files');
fix_permissions($path2, 0777);
} else {
if (file_exists($path2 . filter_naughty($_codename) . $suffix . '.tcd')) {
warn_exit(do_lang_tempcode('WRITE_ERROR', $path2 . filter_naughty($_codename) . $suffix . '.tcd'));
} else {
warn_exit(do_lang_tempcode('WRITE_ERROR_CREATE', $path2 . filter_naughty($_codename) . $suffix . '.tcd'));
}
}
} else {
fwrite($myfile, $result->to_assembly($lang));
fclose($myfile);
fix_permissions($path2 . filter_naughty($_codename) . $suffix . '.tcd');
}
}
}
return $result;
}
示例15: _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;
}