本文整理汇总了PHP中bb_die函数的典型用法代码示例。如果您正苦于以下问题:PHP bb_die函数的具体用法?PHP bb_die怎么用?PHP bb_die使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bb_die函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: insert_cron_job
function insert_cron_job($cron_arr)
{
$row = DB()->fetch_row("SELECT cron_title, cron_script FROM " . BB_CRON . " WHERE cron_title = '" . $_POST['cron_title'] . "' or cron_script = '" . $_POST['cron_script'] . "' ");
if ($row) {
global $lang;
if ($_POST['cron_script'] == $row['cron_script']) {
$langmode = $lang['SCRIPT_DUPLICATE'];
} else {
$langmode = $lang['TITLE_DUPLICATE'];
}
$message = $langmode . "<br /><br />" . sprintf($lang['CLICK_RETURN_JOBS_ADDED'], "<a href=\"javascript:history.back(-1)\">", "</a>") . "<br /><br />" . sprintf($lang['CLICK_RETURN_JOBS'], "<a href=\"admin_cron.php?mode=list\">", "</a>") . "<br /><br />" . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], "<a href=\"index.php?pane=right\">", "</a>");
bb_die($message);
}
$cron_active = $cron_arr['cron_active'];
$cron_title = $cron_arr['cron_title'];
$cron_script = $cron_arr['cron_script'];
$schedule = $cron_arr['schedule'];
$run_day = $cron_arr['run_day'];
$run_time = $cron_arr['run_time'];
$run_order = $cron_arr['run_order'];
$last_run = $cron_arr['last_run'];
$next_run = $cron_arr['next_run'];
$run_interval = $cron_arr['run_interval'];
$log_enabled = $cron_arr['log_enabled'];
$log_file = $cron_arr['log_file'];
$log_sql_queries = $cron_arr['log_sql_queries'];
$disable_board = $cron_arr['disable_board'];
$run_counter = $cron_arr['run_counter'];
DB()->query("INSERT INTO " . BB_CRON . " (cron_active, cron_title, cron_script, schedule, run_day, run_time, run_order, last_run, next_run, run_interval, log_enabled, log_file, log_sql_queries, disable_board, run_counter) VALUES (\n\t{$cron_active}, '{$cron_title}', '{$cron_script}', '{$schedule}', '{$run_day}', '{$run_time}', '{$run_order}', '{$last_run}', '{$next_run}', '{$run_interval}', {$log_enabled}, '{$log_file}', {$log_sql_queries}, {$disable_board}, '{$run_counter}')");
}
示例2: bb_check_post_flood
/**
* Check to make sure that a user is not making too many posts in a short amount of time.
*/
function bb_check_post_flood()
{
global $bbdb;
$user_id = (int) $user_id;
$throttle_time = bb_get_option('throttle_time');
if (bb_current_user_can('manage_options') || empty($throttle_time)) {
return;
}
if (bb_is_user_logged_in()) {
$bb_current_user = bb_get_current_user();
if (isset($bb_current_user->data->last_posted) && time() < $bb_current_user->data->last_posted + $throttle_time && !bb_current_user_can('throttle')) {
if (defined('DOING_AJAX') && DOING_AJAX) {
die(__('Slow down; you move too fast.'));
} else {
bb_die(__('Slow down; you move too fast.'));
}
}
} else {
if (($last_posted = bb_get_transient($_SERVER['REMOTE_ADDR'] . '_last_posted')) && time() < $last_posted + $throttle_time) {
if (defined('DOING_AJAX') && DOING_AJAX) {
die(__('Slow down; you move too fast.'));
} else {
bb_die(__('Slow down; you move too fast.'));
}
}
}
}
示例3: bb_block_current_user
function bb_block_current_user()
{
global $bbdb;
if ($id = bb_get_current_user_info('id')) {
bb_update_usermeta($id, $bbdb->prefix . 'been_blocked', 1);
}
// Just for logging.
bb_die(__("You've been blocked. If you think a mistake has been made, contact this site's administrator."));
}
示例4: topic_info
function topic_info($topic_id)
{
global $lang;
$sql = "\n\t\tSELECT\n\t\t\ttor.poster_id, tor.forum_id, tor.attach_id, tor.call_seed_time,\n\t\t\tt.topic_title, sn.seeders\n\t\tFROM " . BB_BT_TORRENTS . " tor\n\t\tLEFT JOIN " . BB_TOPICS . " t USING(topic_id)\n\t\tLEFT JOIN " . BB_BT_TRACKER_SNAP . " sn USING(topic_id)\n\t\tWHERE tor.topic_id = {$topic_id}\n\t";
if (!($torrent = DB()->fetch_row($sql))) {
bb_die($lang['TOPIC_POST_NOT_EXIST']);
}
return $torrent;
}
示例5: get_config
/**
* Get attachment mod configuration
*/
function get_config()
{
global $bb_cfg;
$attach_config = array();
$sql = 'SELECT * FROM ' . BB_ATTACH_CONFIG;
if (!($result = DB()->sql_query($sql))) {
bb_die('Could not query attachment information');
}
while ($row = DB()->sql_fetchrow($result)) {
$attach_config[$row['config_name']] = trim($row['config_value']);
}
// We assign the original default board language here, because it gets overwritten later with the users default language
$attach_config['board_lang'] = trim($bb_cfg['default_lang']);
return $attach_config;
}
示例6: send_file_to_browser
function send_file_to_browser($attachment, $upload_dir)
{
global $bb_cfg, $lang, $userdata;
$filename = $upload_dir == '' ? $attachment['physical_filename'] : $upload_dir . '/' . $attachment['physical_filename'];
$gotit = false;
if (@(!file_exists(@amod_realpath($filename)))) {
bb_die($lang['ERROR_NO_ATTACHMENT'] . "<br /><br />" . $filename . "<br /><br />" . $lang['TOR_NOT_FOUND']);
} else {
$gotit = true;
}
// Correct the mime type - we force application/octet-stream for all files, except images
// Please do not change this, it is a security precaution
if (!strstr($attachment['mimetype'], 'image')) {
$attachment['mimetype'] = 'application/octet-stream';
}
//bt
if (!(isset($_GET['original']) && !IS_USER)) {
include INC_DIR . 'functions_torrent.php';
send_torrent_with_passkey($filename);
}
// Now the tricky part... let's dance
header('Pragma: public');
$real_filename = clean_filename(basename($attachment['real_filename']));
$mimetype = $attachment['mimetype'] . ';';
$charset = "charset={$bb_cfg['lang'][$userdata['user_lang']]['encoding']};";
// Send out the Headers
header("Content-Type: {$mimetype} {$charset} name=\"{$real_filename}\"");
header("Content-Disposition: inline; filename=\"{$real_filename}\"");
unset($real_filename);
// Now send the File Contents to the Browser
if ($gotit) {
$size = @filesize($filename);
if ($size) {
header("Content-length: {$size}");
}
readfile($filename);
} else {
bb_die($lang['ERROR_NO_ATTACHMENT'] . "<br /><br />" . $filename . "<br /><br />" . $lang['TOR_NOT_FOUND']);
}
exit;
}
示例7: update_table_bool
function update_table_bool($table_name, $key, $field_name, $field_def_val)
{
// Clear current status
$sql = "UPDATE {$table_name}\n\t\tSET {$field_name} = {$field_def_val}\n\t\tWHERE 1";
if (!($result = DB()->sql_query($sql))) {
bb_die('Could not update ' . $table_name);
}
if (isset($_POST[$field_name])) {
// Get new status
$in_sql = array();
foreach ($_POST[$field_name] as $i => $val) {
$in_sql[] = intval($val);
}
// Update status
if ($in_sql = join(',', $in_sql)) {
$sql = "UPDATE {$table_name}\n\t\t\t\tSET {$field_name} = 1\n\t\t\t\tWHERE {$key} IN({$in_sql})";
if (!($result = DB()->sql_query($sql))) {
bb_die('Could not update ' . $table_name);
}
}
}
return;
}
示例8: bb_die
}
if (!bb_current_user_can('edit_post', $post_id)) {
bb_die(__('Sorry, post is too old.'));
}
bb_check_admin_referer('edit-post_' . $post_id);
if (0 != $bb_post->post_status && 'all' == $_GET['view']) {
// We're trying to edit a deleted post
add_filter('bb_is_first_where', 'bb_no_where');
}
// Check possible anonymous user data
$post_author = $post_email = $post_url = '';
if (!bb_get_user(get_post_author_id($post_id))) {
if (!($post_author = sanitize_user(trim($_POST['author'])))) {
bb_die(__('Every post needs an author name!'));
} elseif (!($post_email = sanitize_email(trim($_POST['email'])))) {
bb_die(__('Every post needs a valid email address!'));
}
if (!empty($_POST['url'])) {
$post_url = esc_url(trim($_POST['url']));
}
}
// Loop through possible anonymous post data
foreach (array('post_author', 'post_email', 'post_url') as $field) {
if (!empty(${$field})) {
$post_data[$field] = ${$field};
}
}
// Setup topic data
if (bb_is_first($bb_post->post_id) && bb_current_user_can('edit_topic', $bb_post->topic_id)) {
$post_data['topic_title'] = stripslashes($_POST['topic']);
$post_data['topic_id'] = $bb_post->topic_id;
示例9: bb_nonce_ays
function bb_nonce_ays($action)
{
$title = __('bbPress Failure Notice');
$html .= "\t<div id='message' class='updated fade'>\n\t<p>" . esc_html(bb_explain_nonce($action)) . "</p>\n\t<p>";
if (nxt_get_referer()) {
$html .= "<a href='" . remove_query_arg('updated', esc_url(nxt_get_referer())) . "'>" . __('Please try again.') . "</a>";
}
$html .= "</p>\n\t</div>\n";
$html .= "</body>\n</html>";
bb_die($html, $title);
}
示例10: bb_repermalink
<?php
require_once './bb-load.php';
$forum_id = 0;
bb_repermalink();
if (!$forum) {
bb_die(__('Forum not found.'));
}
$bb_db_override = false;
do_action('bb_forum.php_pre_db', $forum_id);
if (!$bb_db_override) {
if ($topics = get_latest_topics($forum_id, $page)) {
bb_cache_last_posts($topics);
}
if ($stickies = get_sticky_topics($forum_id, $page)) {
bb_cache_last_posts($stickies);
}
}
bb_load_template('forum.php', array('bb_db_override', 'stickies'), $forum_id);
示例11: bb_die
bb_die(__('Please enter a topic title'));
}
$args = array();
if (isset($post_author)) {
$args['topic_poster_name'] = $args['topic_last_poster_name'] = $post_author;
}
$topic_id = bb_new_topic($topic, $forum_id, $tags, $args);
} elseif (isset($_POST['topic_id'])) {
$topic_id = (int) $_POST['topic_id'];
bb_check_admin_referer('create-post_' . $topic_id);
}
if (bb_is_login_required() && !bb_current_user_can('write_post', $topic_id)) {
bb_die(__('You are not allowed to post. Are you logged in?'));
}
if (!topic_is_open($topic_id)) {
bb_die(__('This topic has been closed'));
}
$post_data = array('post_text' => stripslashes($_POST['post_content']), 'topic_id' => $topic_id);
foreach (array('post_author', 'post_email', 'post_url') as $field) {
if (!empty(${$field})) {
$post_data[$field] = ${$field};
}
}
$post_id = bb_insert_post($post_data);
$tags = trim($_POST['tags']);
bb_add_topic_tags($topic_id, $tags);
$topic = get_topic($topic_id, false);
$link = get_post_link($post_id);
if ($topic->topic_posts) {
$link = add_query_arg('replies', $topic->topic_posts, $link);
}
示例12: get_topic
<?php
require 'admin-action.php';
$topic_id = (int) $_GET['id'];
$topic = get_topic($topic_id);
if (!$topic) {
bb_die(__('There is a problem with that topic, pardner.'));
}
if (!bb_current_user_can('close_topic', $topic_id)) {
nxt_redirect(bb_get_uri(null, null, BB_URI_CONTEXT_HEADER));
exit;
}
bb_check_admin_referer('close-topic_' . $topic_id);
if (topic_is_open($topic_id)) {
bb_close_topic($topic_id);
$message = 'closed';
} else {
bb_open_topic($topic_id);
$message = 'opened';
}
if ($sendto = nxt_get_referer()) {
$sendto = remove_query_arg('message', $sendto);
$sendto = add_query_arg('message', $message, $sendto);
} else {
$sendto = get_topic_link($topic_id);
}
bb_safe_redirect($sendto);
exit;
示例13: die
<?php
if (!defined('IN_FORUM')) {
die('Hacking attempt');
}
if (empty($_GET['u']) || empty($_GET['act_key'])) {
bb_die('Bad request');
}
$sql = "SELECT user_active, user_id, username, user_email, user_newpasswd, user_lang, user_actkey\n\tFROM " . BB_USERS . "\n\tWHERE user_id = " . intval($_GET[POST_USERS_URL]);
if (!($result = DB()->sql_query($sql))) {
bb_die('Could not obtain user information');
}
if ($row = DB()->sql_fetchrow($result)) {
if ($row['user_active'] && trim($row['user_actkey']) == '') {
bb_die($lang['ALREADY_ACTIVATED']);
} else {
if (trim($row['user_actkey']) == trim($_GET['act_key']) && trim($row['user_actkey']) != '') {
$sql_update_pass = $row['user_newpasswd'] != '' ? ", user_password = '" . md5(md5($row['user_newpasswd'])) . "', user_newpasswd = ''" : '';
$sql = "UPDATE " . BB_USERS . "\n\t\t\tSET user_active = 1, user_actkey = ''" . $sql_update_pass . "\n\t\t\tWHERE user_id = " . $row['user_id'];
if (!($result = DB()->sql_query($sql))) {
bb_die('Could not update users table');
}
$message = $sql_update_pass == '' ? $lang['ACCOUNT_ACTIVE'] : $lang['PASSWORD_ACTIVATED'];
bb_die($message);
} else {
bb_die($lang['WRONG_ACTIVATION']);
}
}
} else {
bb_die($lang['NO_SUCH_USER']);
}
示例14: define
<?php
define('IN_FORUM', true);
define('BB_ROOT', './');
require BB_ROOT . 'common.php';
$user->session_start();
set_die_append_msg();
if (!IS_SUPER_ADMIN) {
bb_die($lang['ONLY_FOR_SUPER_ADMIN']);
}
$confirm = request_var('confirm', '');
if ($confirm) {
DB()->query("\n\t\tCREATE TEMPORARY TABLE tmp_buf_dlstatus (\n\t\t\tuser_id mediumint(9) NOT NULL default '0',\n\t\t\ttopic_id mediumint(8) unsigned NOT NULL default '0',\n\t\t\tuser_status tinyint(1) NOT NULL default '0',\n\t\t\tPRIMARY KEY (user_id, topic_id)\n\t\t) ENGINE = MyISAM\n\t");
DB()->query("\n\t\tINSERT INTO tmp_buf_dlstatus\n\t\t\t(user_id, topic_id, user_status)\n\t\tSELECT\n\t\t\tuser_id, topic_id, user_status\n\t\tFROM bb_bt_dlstatus_new\n\t");
DB()->query("\n\t\tREPLACE INTO bb_bt_dlstatus_main\n\t\t\t(user_id, topic_id, user_status)\n\t\tSELECT\n\t\t\tuser_id, topic_id, user_status\n\t\tFROM tmp_buf_dlstatus\n\t");
DB()->query("DROP TEMPORARY TABLE IF EXISTS tmp_buf_dlstatus");
DB()->query("RENAME TABLE bb_bt_dlstatus_main TO bb_bt_dlstatus");
DB()->query("DROP TABLE IF EXISTS bb_bt_dlstatus_mrg");
DB()->query("DROP TABLE IF EXISTS bb_bt_dlstatus_new");
bb_die('<h1 style="color: green">База данных обновлена</h1>');
} else {
$msg = '<form method="POST">';
$msg .= '<h1 style="color: red">!!! Перед тем как нажать на кнопку, сделайте бекап базы данных !!!</h1><br />';
$msg .= '<input type="submit" name="confirm" value="Начать обновление Базы Данных (R571)" style="height: 30px; font:bold 14px Arial, Helvetica, sans-serif;" />';
$msg .= '</form>';
bb_die($msg);
}
示例15: bb_die
bb_die(__('No forums to update!'));
}
if ((int) $_POST['forum_id'] && isset($_POST['forum_name']) && '' !== $_POST['forum_name']) {
bb_update_forum($_POST);
}
foreach (array('action', 'id') as $arg) {
$sent_from = remove_query_arg($arg, $sent_from);
}
bb_safe_redirect(add_query_arg('message', 'updated', $sent_from));
exit;
break;
case 'delete':
bb_check_admin_referer('delete-forums');
$forum_id = (int) $_POST['forum_id'];
$move_topics_forum = (int) $_POST['move_topics_forum'];
if (!bb_current_user_can('delete_forum', $forum_id)) {
bb_die(__("You don't have the authority to kill off the forums."));
}
if (isset($_POST['move_topics']) && $_POST['move_topics'] != 'delete') {
bb_move_forum_topics($forum_id, $move_topics_forum);
}
if (!bb_delete_forum($forum_id)) {
bb_die(__('Error occured while trying to delete forum'));
}
foreach (array('action', 'id') as $arg) {
$sent_from = remove_query_arg($arg, $sent_from);
}
bb_safe_redirect(add_query_arg('message', 'deleted', $sent_from));
exit;
break;
}