本文整理汇总了PHP中script_close函数的典型用法代码示例。如果您正苦于以下问题:PHP script_close函数的具体用法?PHP script_close怎么用?PHP script_close使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了script_close函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: generate_smilies
function generate_smilies($mode, $forum_id)
{
global $_CLASS;
// add option for all smiles in window
$display_link = false;
$mode = $mode == 'window' ? 'window' : 'inline';
if ($mode == 'inline') {
$sql = 'SELECT smiley_id
FROM ' . SMILIES_TABLE . '
WHERE smiley_type = 1';
$result = $_CLASS['core_db']->query_limit($sql, 1, 0);
if ($row = $_CLASS['core_db']->fetch_row_assoc($result)) {
$display_link = true;
}
$_CLASS['core_db']->free_result($result);
}
if (is_null($smiley = $_CLASS['core_cache']->get('smiley_' . $mode))) {
$smiley = array();
$sql = 'SELECT *
FROM ' . SMILIES_TABLE . '
WHERE smiley_type =' . ($mode == 'inline' ? '0' : '1') . '
ORDER BY smiley_order';
$result = $_CLASS['core_db']->query($sql);
while ($row = $_CLASS['core_db']->fetch_row_assoc($result)) {
$smiley[] = array('SMILEY_CODE' => $row['smiley_code'], 'SMILEY_IMG' => $row['smiley_src'], 'SMILEY_WIDTH' => $row['smiley_width'], 'SMILEY_HEIGHT' => $row['smiley_height'], 'SMILEY_DESC' => $row['smiley_description']);
}
$_CLASS['core_cache']->put('smiley_' . $mode, $smiley);
$_CLASS['core_db']->free_result($result);
}
$_CLASS['core_template']->assign('smiley', $smiley);
if ($mode == 'inline') {
$_CLASS['core_template']->assign_array(array('S_SHOW_SMILEY_LINK' => $display_link ? true : false, 'U_MORE_SMILIES' => generate_link('Forums&file=posting&mode=smilies&f=' . $forum_id)));
}
if ($mode == 'window') {
global $config;
$_CLASS['core_template']->assign('T_SMILIES_PATH', "{$config['smilies_path']}/");
$_CLASS['core_template']->display('modules/Forums/posting_smilies.html');
script_close();
}
}
示例2: str_replace
}
$path = str_replace('install/', '', $path);
$domain = empty($_SERVER['SERVER_NAME']) ? $_SERVER['HTTP_HOST'] : $_SERVER['SERVER_NAME'];
$_CLASS['core_template']->assign_array(array('site_name' => 'New CMS Site', 'site_domain' => $domain, 'site_path' => $path, 'site_port' => $_SERVER['SERVER_PORT'] == 80 ? '' : $_SERVER['SERVER_PORT'], 'cookie_domain' => $domain, 'cookie_path' => $path, 'cookie_name' => 'cms', 'username' => '', 'password' => '', 'password_confirm' => '', 'email' => '', 'email_confirm' => '', 'error' => empty($error) ? false : implode('<br/>', $error), 'config_content' => $config_data));
$_CLASS['core_template']->display('installer/stage3.html');
script_close();
}
}
}
if ($stage === 2) {
if (isset($_POST['test']) && empty($error)) {
$error[] = 'Database Setting Perfect :-)';
}
$_CLASS['core_template']->assign_array(array('database_options' => $database_options, 'error' => empty($error) ? false : implode('<br/>', $error), 'server' => isset($site_db['server']) ? $site_db['server'] : 'localhost', 'port' => isset($site_db['port']) ? $site_db['port'] : '', 'database' => isset($site_db['database']) ? $site_db['database'] : '', 'username' => isset($site_db['username']) ? $site_db['username'] : '', 'password' => isset($site_db['password']) ? $site_db['password'] : '', 'file' => isset($site_db['file']) ? $site_db['file'] : '', 'table_prefix' => get_variable('table_prefix', 'POST', 'cms_'), 'user_prefix' => get_variable('user_prefix', 'POST', 'cms_')));
$_CLASS['core_template']->display('installer/stage2.html');
script_close();
}
if ($stage === 1) {
$gd_info = gd_info();
$continue = true;
if (!($compatible = version_compare(PHP_VERSION, '4.2.0', '>='))) {
$continue = false;
}
$_CLASS['core_template']->assign_array(array('error' => false, 'magic_quotes_gpc' => (bool) ini_get('magic_quotes_gpc') === false, 'output_buffering' => (int) ini_get('output_buffering') === 0, 'register_globals' => (bool) ini_get('register_globals') === false, 'safe_mode' => (bool) ini_get('safe_mode') === false, 'php_version' => PHP_VERSION, 'workable_Version' => $compatible, 'recommended_Version' => version_compare(PHP_VERSION, '4.3.0', '>='), 'mbstring' => extension_loaded('mbstring'), 'zlib' => extension_loaded('zlib'), 'gd' => extension_loaded('gd'), 'gd_version' => $gd_info['GD Version'], 'continue' => $continue));
$_CLASS['core_template']->display('installer/stage1.html');
script_close();
}
if (!$stage) {
$_CLASS['core_template']->display('installer/agreement.html');
script_close();
}
示例3: do_login
function do_login($login_options, $template)
{
global $_CLASS, $_CORE_CONFIG;
$error = '';
$login_array = array('redirect' => false, 'explain' => false, 'success' => '', 'admin_login' => false, 'full_login' => true, 'full_screen' => false);
if (is_array($login_options)) {
$login_array = array_merge($login_array, $login_options);
}
if (isset($_POST['login'])) {
$user_name = get_variable('username', 'POST');
$user_password = get_variable('password', 'POST');
if (!$user_name || !$user_password) {
$error = 'INCOMPLETE_LOGIN_INFO';
}
if (!$error && $_CORE_CONFIG['user']['enable_confirm']) {
$code = $_CLASS['core_user']->session_data_get('confirmation_code');
$confirm_code = get_variable('confirm_code', 'POST', false);
if (!$code || !$confirm_code || $code !== $confirm_code) {
// $error = 'CONFIRM_CODE_WRONG';
}
}
if (!$error) {
$result = $this->user_auth($user_name, $user_password);
if (is_numeric($result)) {
$_CLASS['core_user']->login($result, $login_array['admin_login'], !empty($_POST['hidden']), !empty($_POST['auto_login']));
$login_array['redirect'] = generate_link(get_variable('redirect', 'POST', $login_array['redirect']), array('admin' => $login_array['admin_login']));
$_CLASS['core_display']->meta_refresh(5, $login_array['redirect']);
$message = ($login_array['success'] ? $_CLASS['core_user']->get_lang($login_array['success']) : $_CLASS['core_user']->lang['LOGIN_REDIRECT']) . '<br /><br />' . sprintf($_CLASS['core_user']->lang['RETURN_PAGE'], '<a href="' . $login_array['redirect'] . '">', '</a> ');
trigger_error($message);
}
$error = is_string($result) ? $result : 'LOGIN_ERROR';
}
}
if (!$login_array['redirect']) {
$login_array['redirect'] = htmlspecialchars($_CLASS['core_user']->url);
}
$s_hidden_fields = '<input type="hidden" name="redirect" value="' . $login_array['redirect'] . '" />';
if ($_CORE_CONFIG['user']['enable_confirm']) {
$confirm_image = '<img src="' . generate_link('system&mode=confirmation_image') . '" alt="" title="" />';
$_CLASS['core_user']->session_data_set('confirmation_code', generate_string(6));
} else {
$confirm_image = false;
}
$_CLASS['core_template']->assign_array(array('LOGIN_ERROR' => $_CLASS['core_user']->get_lang($error), 'LOGIN_EXPLAIN' => $_CLASS['core_user']->get_lang($login_array['explain']), 'U_SEND_PASSWORD' => $_CORE_CONFIG['email']['email_enable'] ? generate_link('Control_Panel&mode=sendpassword') : '', 'U_RESEND_ACTIVATION' => $_CORE_CONFIG['user']['activation'] != USER_ACTIVATION_NONE && $_CORE_CONFIG['email']['email_enable'] ? generate_link('Control_Panel&mode=resend_act') : '', 'U_TERMS_USE' => generate_link('Control_Panel&mode=terms'), 'U_PRIVACY' => generate_link('Control_Panel&mode=privacy'), 'U_REGISTER' => generate_link('Control_Panel&mode=register'), 'U_CONFIRM_IMAGE' => $confirm_image, 'USERNAME' => isset($data['user_name']) ? $data['user_name'] : '', 'S_DISPLAY_FULL_LOGIN' => $login_array['full_login'], 'S_LOGIN_ACTION' => !$login_array['admin_login'] ? generate_link($_CLASS['core_user']->url) : generate_link(false, array('admin' => true)), 'S_HIDDEN_FIELDS' => $s_hidden_fields));
if (!$template && $login_array['full_screen']) {
$template = 'login_body_full.html';
}
$_CLASS['core_template']->display($template ? $template : 'login_body.html');
script_close();
}
示例4: redirect
function redirect($url = false, $save = false)
{
$url = $url ? str_replace('&', '&', $url) : generate_link();
if (preg_match('#Microsoft|WebSTAR|Xitami#', $_SERVER['SERVER_SOFTWARE'])) {
header('Refresh: 0; url=' . $url);
} else {
header('Location: ' . $url);
}
header('P3P: CP="CAO DSP COR CURa ADMa DEVa OUR IND PHY ONL UNI COM NAV INT DEM PRE"');
header('Cache-Control: private, pre-check=0, post-check=0, max-age=0');
header('Expires: 0');
header('Pragma: no-cache');
echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="refresh" content="0; url=' . $url . '">
<title>Redirect</title>
</head>
<body>
<div align="center"><a href="' . $url . '">Click here to continue</a></div>
</body>
</html>';
script_close($save);
}
示例5: ON
FROM ' . FORUMS_TOPICS_TABLE . ' t LEFT JOIN ' . FORUMS_FORUMS_TABLE . " f ON (f.forum_id = t.forum_id)\n\t\t\tWHERE t.topic_id = {$topic_id}";
break;
case 'quote':
case 'edit':
case 'delete':
if (!$post_id) {
trigger_error('NO_POST');
}
$sql = 'SELECT f.*, t.*, p.*, u.username, u.user_sig, u.user_sig_bbcode_uid, u.user_sig_bbcode_bitfield
FROM ' . FORUMS_POSTS_TABLE . ' p, ' . USERS_TABLE . ' u , ' . FORUMS_TOPICS_TABLE . ' t
LEFT JOIN ' . FORUMS_FORUMS_TABLE . " f ON (f.forum_id = t.forum_id)\n\t\t\tWHERE p.post_id = {$post_id}\n\t\t\t\tAND t.topic_id = p.topic_id\n\t\t\t\tAND u.user_id = p.poster_id";
break;
case 'smilies':
require_once $site_file_root . 'includes/forums/functions_posting.php';
generate_smilies('window', $forum_id);
script_close(false);
break;
default:
trigger_error('NO_POST_MODE');
break;
}
$result = $_CLASS['core_db']->query($sql);
$posting_data = $_CLASS['core_db']->fetch_row_assoc($result);
$_CLASS['core_db']->free_result($result);
if (!$posting_data) {
trigger_error('NO_POST');
}
require_once $site_file_root . 'includes/forums/message_parser.php';
require_once $site_file_root . 'includes/forums/functions_admin.php';
require_once $site_file_root . 'includes/forums/functions_posting.php';
// remove
示例6: ucp_register
function ucp_register($id, $mode)
{
global $site_file_root, $config, $_CLASS, $_CORE_CONFIG;
$coppa = isset($_REQUEST['coppa']) ? (int) $_REQUEST['coppa'] : null;
$submit = isset($_POST['submit']);
if ($_CORE_CONFIG['user']['activation'] == USER_ACTIVATION_DISABLE || ($coppa || $_CORE_CONFIG['user']['activation'] == USER_ACTIVATION_SELF || $_CORE_CONFIG['user']['activation'] == USER_ACTIVATION_ADMIN) && !$_CORE_CONFIG['email']['email_enable']) {
trigger_error('UCP_REGISTER_DISABLE');
}
$_CLASS['core_template']->assign('S_UCP_ACTION', generate_link('Control_Panel&mode=register'));
$error = $data = array();
$s_hidden_fields = '';
if (!isset($_POST['agreed'])) {
if ($_CORE_CONFIG['user']['coppa_enable'] && is_null($coppa)) {
$now = explode(':', gmdate('m:j:Y'));
$coppa_birthday = $_CLASS['core_user']->format_date(mktime(12, 0, 0, $now[0], $now[1], $now[2] - 13), 'D M d, Y');
$_CLASS['core_template']->assign_array(array('L_COPPA_NO' => sprintf($_CLASS['core_user']->lang['UCP_COPPA_BEFORE'], $coppa_birthday), 'L_COPPA_YES' => sprintf($_CLASS['core_user']->lang['UCP_COPPA_ON_AFTER'], $coppa_birthday), 'U_COPPA_NO' => generate_link('Control_Panel&mode=register&coppa=0'), 'U_COPPA_YES' => generate_link('Control_Panel&mode=register&coppa=1'), 'S_SHOW_COPPA' => true, 'S_HIDDEN_FIELDS' => $s_hidden_fields, 'S_REGISTER_ACTION' => generate_link('Control_Panel&mode=register')));
} else {
$s_hidden_fields .= '<input type="hidden" name="coppa" value="' . $coppa . '" />';
$_CLASS['core_template']->assign_array(array('S_SHOW_COPPA' => false, 'S_HIDDEN_FIELDS' => $s_hidden_fields, 'S_REGISTER_ACTION' => generate_link('Control_Panel&mode=register')));
}
$this->display($_CLASS['core_user']->lang['REGISTER'], 'ucp_agreement.html');
script_close();
}
if ($submit) {
require_once $site_file_root . 'includes/functions_user.php';
$error = array();
$username = get_variable('username', 'POST', false);
$password = get_variable('password', 'POST', false);
$email = get_variable('email', 'POST', false);
$email_confirm = get_variable('email_confirm', 'POST', '');
//when we add this make sure to confirm that it's one of the installed langs
$lang = $_CORE_CONFIG['global']['default_lang'];
$tz = get_variable('tz', 'POST', false);
if (strpos($username, "\n")) {
die;
}
$username_validate = validate_username($username);
if ($username_validate !== true) {
$error[] = $_CLASS['core_user']->get_lang($username_validate);
}
if (!$password || $password !== get_variable('password_confirm', 'POST', '')) {
$error[] = $_CLASS['core_user']->get_lang('PASSWORD_ERROR');
}
if (!$email || $email !== $email_confirm) {
$error[] = $_CLASS['core_user']->get_lang('EMAIL_ERROR');
} elseif (!check_email($email)) {
$error[] = $_CLASS['core_user']->get_lang('EMAIL_INVALID');
}
if (!$tz || !in_array($tz, tz_array())) {
$tz = null;
}
if ($_CORE_CONFIG['user']['enable_confirm']) {
$confirmation_code = $_CLASS['core_user']->session_data_get('confirmation_code');
$confirm_code = trim(get_variable('confirm_code', 'POST', false));
if (!$confirm_code || !$confirmation_code || $confirm_code != $confirmation_code) {
$error[] = $_CLASS['core_user']->get_lang('CONFIRM_CODE_WRONG');
}
// we don't need this any more
$_CLASS['core_user']->user_data_kill('confirmation_code');
}
if (empty($error)) {
$password = encode_password($password, $_CORE_CONFIG['user']['password_encoding']);
if (!$password) {
//do some admin contact thing here
die('Activation disabled: Passwaord encoding problem');
}
if ($coppa || $_CORE_CONFIG['user']['activation'] == USER_ACTIVATION_SELF || $_CORE_CONFIG['user']['activation'] == USER_ACTIVATION_ADMIN) {
if (!$_CORE_CONFIG['email']['email_enable']) {
//do some admin contact thing here
die('Activation disabled: Email Disabled');
}
$user_status = STATUS_PENDING;
$user_act_key = generate_string(10);
if ($coppa) {
$message = $_CLASS['core_user']->lang['ACCOUNT_COPPA'];
$email_template = 'coppa_welcome_inactive';
} elseif ($_CORE_CONFIG['user']['activation'] == USER_ACTIVATION_SELF) {
$message = $_CLASS['core_user']->lang['ACCOUNT_INACTIVE'];
$email_template = 'user_welcome_inactive';
} elseif ($_CORE_CONFIG['user']['activation'] == USER_ACTIVATION_ADMIN) {
$message = $_CLASS['core_user']->lang['ACCOUNT_INACTIVE_ADMIN'];
$email_template = 'admin_welcome_inactive';
}
} else {
$user_status = STATUS_ACTIVE;
$user_act_key = null;
$email_template = 'user_welcome';
$message = $_CLASS['core_user']->lang['ACCOUNT_ADDED'];
}
$data = array('username' => (string) $username, 'user_email' => (string) $email, 'user_group' => $coppa ? 3 : 2, 'user_reg_date' => (int) $_CLASS['core_user']->time, 'user_timezone' => (string) $tz, 'user_password' => (string) $password, 'user_password_encoding' => (string) $_CORE_CONFIG['user']['password_encoding'], 'user_lang' => $lang ? (string) $lang : null, 'user_type' => USER_NORMAL, 'user_status' => (int) $user_status, 'user_act_key' => (string) $user_act_key, 'user_ip' => (string) $_CLASS['core_user']->ip);
user_add($data);
if ($data['user_status'] === STATUS_ACTIVE) {
set_core_config('user', 'newest_user_id', $data['user_id'], false);
set_core_config('user', 'newest_username', $data['username'], false);
set_core_config('user', 'total_users', $_CORE_CONFIG['user']['total_users'] + 1, false);
}
require_once $site_file_root . 'includes/mailer.php';
$mailer = new core_mailer();
$mailer->to($email, $username);
$mailer->subject($subject);
//.........这里部分代码省略.........
示例7: sql_error
function sql_error($backtrace, $return = false)
{
if ($return) {
return array('message' => @mysql_error(), 'code' => @mysql_errno());
}
if (!$this->report_error) {
return;
}
$message = '<br clear="all"/><table><tr><td><u>SQL ERROR</u><br /><br />' . @mysql_error() . '<br /><br />File:<br/><br/>' . $backtrace['file'] . '<br /><br />Line:<br /><br />' . $backtrace['line'] . '<br /><br /><u>CALLING PAGE</u><br /><br />' . ($sql ? '<br /><br /><u>SQL</u><br /><br />' . $this->last_query : '') . '<br /></td></tr></table>';
if ($this->in_transaction) {
$this->transaction('rollback');
}
trigger_error($message, E_USER_ERROR);
script_close(false);
}
示例8: error_handler
function error_handler($errtype, $error, $errfile, $errline)
{
global $_CLASS, $site_file_root, $_CORE_CONFIG;
if ($this->report != ERROR_NONE) {
echo $error;
//damn windows
$errfile = str_replace('\\', '/', $errfile);
// Remove the root paths, site files, along with document root
$errfile = str_replace($site_file_root, '', str_replace($_SERVER['DOCUMENT_ROOT'], '', $errfile));
}
switch ($errtype) {
case E_NOTICE:
case E_WARNING:
if (!$this->report) {
return;
}
$errtype = $errtype == E_NOTICE ? 'E_NOTICE' : 'E_WARNING';
$this->error = array('type' => $errtype, 'error' => $error, 'file' => $errfile, 'line' => $errline);
$this->format_error($errtype);
$this->error_setting = array('title', 'redirect');
break;
case E_USER_ERROR:
$code = false;
if (mb_strpos($error, ':')) {
list($code, $error) = explode(':', $error, 2);
if (!is_numeric($code)) {
$error = $code . ':' . $error;
} else {
$header_array = array(404 => 'HTTP/1.0 404 Not Found', 503 => 'HTTP/1.0 503 Service Unavailable');
settype($code, 'integer');
if (!empty($header_array[$code])) {
header($header_array[$code]);
}
}
}
if (isset($_CLASS['core_user'])) {
$_CLASS['core_user']->user_setup();
$error = !empty($_CLASS['core_user']->lang[$error]) ? $_CLASS['core_user']->lang[$error] : $error;
}
$_CLASS['core_template']->assign('MESSAGE_TEXT', $error);
if (isset($_CLASS['core_display'])) {
$_CLASS['core_display']->display(false, 'error.html');
}
$_CLASS['core_template']->display('error.html');
script_close();
break;
case E_USER_NOTICE:
$_CLASS['core_user']->user_setup();
$this->error_setting['title'] = empty($_CLASS['core_user']->lang[$this->error_setting['title']]) ? $this->error_setting['title'] : $_CLASS['core_user']->lang[$this->error_setting['title']];
$error = empty($_CLASS['core_user']->lang[$error]) ? $error : $_CLASS['core_user']->lang[$error];
$_CLASS['core_template']->assign_array(array('MESSAGE_TITLE' => $this->error_setting['title'], 'MESSAGE_TEXT' => $error));
$this->error_setting = array('title', 'redirect');
if (isset($_CLASS['core_display'])) {
$_CLASS['core_display']->display($this->error_setting['title'], 'message.html');
}
$_CLASS['core_template']->display('message.html');
script_close();
break;
}
}
示例9: login
function login($id = ANONYMOUS, $admin_login = false, $hidden = false, $auto_log = false)
{
global $_CLASS;
settype($id, 'int');
if ($bot = check_bot_status($this->browser, $this->ip)) {
$id = $bot;
}
if (!$this->can_create()) {
if (!$bot) {
$this->user_setup();
trigger_error('SITE_TEMP_UNAVAILABLE', E_USER_ERROR);
}
header('HTTP/1.0 503 Service Unavailable');
script_close(false);
}
$result = $_CLASS['core_db']->query('SELECT * FROM ' . USERS_TABLE . ' WHERE user_id = ' . $id);
$this->data = $_CLASS['core_db']->fetch_row_assoc($result);
$_CLASS['core_db']->free_result($result);
if (!$this->data) {
die('Installlation problem');
// Error here, however this happen
}
$this->is_user = !$bot && $this->data['user_type'] == USER_NORMAL;
$this->is_bot = $bot;
if (isset($_CLASS['core_auth'])) {
unset($_CLASS['core_auth']);
}
load_class(false, 'core_auth', 'auth_db');
$this->data['session_admin'] = ADMIN_NOT_ADMIN;
if (!$this->is_bot && $_CLASS['core_auth']->admin_auth()) {
$this->data['session_admin'] = $admin_login ? ADMIN_IS_ADMIN : ADMIN_NOT_LOGGED;
}
$this->is_admin = $this->data['session_admin'] === ADMIN_IS_ADMIN;
$this->data['session_hidden'] = $hidden;
$this->session_create($auto_log);
}
示例10: display
function display($page_title, $tpl_name)
{
global $_CLASS;
page_header();
$_CLASS['core_template']->display('modules/Control_Panel/' . $tpl_name);
script_close();
}
示例11: login_forum_box
function login_forum_box($forum_data)
{
global $config, $_CLASS;
$sql = 'SELECT forum_id
FROM ' . FORUMS_ACCESS_TABLE . "\n\t\tWHERE forum_id = '" . $forum_data['forum_id'] . "'\n\t\t\tAND user_id = '" . $_CLASS['core_user']->data['user_id'] . "'\n\t\t\tAND session_id = '" . $_CLASS['core_user']->session_id . "'";
$result = $_CLASS['core_db']->query($sql);
if ($row = $_CLASS['core_db']->fetch_row_assoc($result)) {
$_CLASS['core_db']->free_result($result);
return true;
}
$_CLASS['core_db']->free_result($result);
$password = request_var('password', '');
if ($password) {
// Remove expired authorised sessions
$sql = 'SELECT session_id
FROM ' . SESSIONS_TABLE;
$result = $_CLASS['core_db']->query($sql);
if ($row = $_CLASS['core_db']->fetch_row_assoc($result)) {
$sql_in = array();
do {
$sql_in[] = "'" . $_CLASS['core_db']->escape($row['session_id']) . "'";
} while ($row = $_CLASS['core_db']->fetch_row_assoc($result));
$sql = 'DELETE FROM ' . FORUMS_ACCESS_TABLE . '
WHERE session_id NOT IN (' . implode(', ', $sql_in) . ')';
$_CLASS['core_db']->query($sql);
}
$_CLASS['core_db']->free_result($result);
if ($password == $forum_data['forum_password']) {
$sql = 'INSERT INTO ' . FORUMS_ACCESS_TABLE . ' (forum_id, user_id, session_id)
VALUES (' . $forum_data['forum_id'] . ', ' . $_CLASS['core_user']->data['user_id'] . ", '" . $_CLASS['core_db']->escape($_CLASS['core_user']->session_id) . "')";
$_CLASS['core_db']->query($sql);
return true;
}
$_CLASS['core_template']->assign('LOGIN_ERROR', $_CLASS['core_user']->lang['WRONG_PASSWORD']);
}
page_header();
$_CLASS['core_template']->display('modules/forums/login_forum.html');
script_close();
}
示例12: compose_pm
function compose_pm($id, $mode, $action)
{
global $_CLASS, $site_file_root, $config;
if (!$action) {
$action = 'post';
}
$_CLASS['core_template']->assign(array('S_DISPLAY_FORM' => false, 'S_DRAFT_LOADED' => false, 'S_SHOW_DRAFTS' => false, 'S_POST_REVIEW' => false, 'S_INLINE_ATTACHMENT_OPTIONS' => false, 'S_EDIT_REASON' => false, 'S_HAS_ATTACHMENTS' => false, 'to_recipient' => false, 'bcc_recipient' => false, 'S_DISPLAY_HISTORY' => false, 'S_DISPLAY_PREVIEW' => false));
// Grab only parameters needed here
$to_user_id = request_var('u', 0);
$to_group_id = request_var('g', 0);
$msg_id = request_var('p', 0);
$quote_post = request_var('q', 0);
$draft_id = request_var('d', 0);
$lastclick = request_var('lastclick', 0);
$message_text = $subject = '';
// Do NOT use request_var or specialchars here
$address_list = isset($_REQUEST['address_list']) ? $_REQUEST['address_list'] : array();
$submit = isset($_POST['post']);
$preview = isset($_POST['preview']);
$save = isset($_POST['save']);
$load = isset($_POST['load']);
$cancel = isset($_POST['cancel']);
$confirm = isset($_POST['confirm']);
$delete = isset($_POST['delete']);
$remove_u = isset($_REQUEST['remove_u']);
$remove_g = isset($_REQUEST['remove_g']);
$add_to = isset($_REQUEST['add_to']);
$add_bcc = isset($_REQUEST['add_bcc']);
$refresh = isset($_POST['add_file']) || isset($_POST['delete_file']) || isset($_POST['edit_comment']) || $save || $load || $remove_u || $remove_g || $add_to || $add_bcc;
$action = $delete && !$preview && !$refresh && $submit ? 'delete' : $action;
$error = array();
$current_time = gmtime();
// Was cancel pressed? If so then redirect to the appropriate page
if ($cancel || $current_time - $lastclick < 2 && $submit) {
$redirect = generate_link("Control_Panel&i={$id}&mode=view_messages&action=view_message" . ($msg_id ? "&p={$msg_id}" : ''));
redirect($redirect);
}
if ($action == 'forward' && (!$config['forward_pm'] || !$_CLASS['auth']->acl_get('u_pm_forward'))) {
trigger_error('NO_AUTH_FORWARD_MESSAGE');
}
if ($action == 'edit' && !$_CLASS['auth']->acl_get('u_pm_edit')) {
trigger_error('NO_AUTH_EDIT_MESSAGE');
}
$sql = '';
// What is all this following SQL for? Well, we need to know
// some basic information in all cases before we do anything.
switch ($action) {
case 'post':
if (!$_CLASS['auth']->acl_get('u_sendpm')) {
trigger_error('NO_AUTH_SEND_MESSAGE');
}
break;
case 'reply':
case 'quote':
case 'forward':
if (!$msg_id) {
trigger_error('NO_MESSAGE');
}
if (!$_CLASS['auth']->acl_get('u_sendpm')) {
trigger_error('NO_AUTH_SEND_MESSAGE');
}
if ($quote_post) {
$sql = 'SELECT p.post_text as message_text, p.poster_id as author_id, p.post_time as message_time, p.bbcode_bitfield, p.bbcode_uid, p.enable_sig, p.enable_html, p.enable_smilies, p.enable_magic_url, t.topic_title as message_subject, u.username as quote_username
FROM ' . FORUMS_POSTS_TABLE . ' p, ' . FORUMS_TOPICS_TABLE . ' t, ' . USERS_TABLE . " u\n\t\t\t\t\tWHERE p.post_id = {$msg_id}\n\t\t\t\t\t\tAND t.topic_id = p.topic_id\n\t\t\t\t\t\tAND u.user_id = p.poster_id";
} else {
$sql = 'SELECT t.*, p.*, u.username as quote_username
FROM ' . FORUMS_PRIVMSGS_TO_TABLE . ' t, ' . FORUMS_PRIVMSGS_TABLE . ' p, ' . USERS_TABLE . ' u
WHERE t.user_id = ' . $_CLASS['core_user']->data['user_id'] . "\n\t\t\t\t\t\tAND p.author_id = u.user_id\n\t\t\t\t\t\tAND t.msg_id = p.msg_id\n\t\t\t\t\t\tAND p.msg_id = {$msg_id}";
}
break;
case 'edit':
if (!$msg_id) {
trigger_error('NO_MESSAGE');
}
// check for outbox (not read) status, we do not allow editing if one user already having the message
$sql = 'SELECT p.*, t.*
FROM ' . FORUMS_PRIVMSGS_TO_TABLE . ' t, ' . FORUMS_PRIVMSGS_TABLE . ' p
WHERE t.user_id = ' . $_CLASS['core_user']->data['user_id'] . '
AND t.folder_id = ' . PRIVMSGS_OUTBOX . "\n\t\t\t\t\tAND t.msg_id = {$msg_id}\n\t\t\t\t\tAND t.msg_id = p.msg_id";
break;
case 'delete':
if (!$_CLASS['auth']->acl_get('u_pm_delete')) {
trigger_error('NO_AUTH_DELETE_MESSAGE');
}
if (!$msg_id) {
trigger_error('NO_MESSAGE');
}
$sql = 'SELECT msg_id, unread, new, author_id, folder_id
FROM ' . FORUMS_PRIVMSGS_TO_TABLE . '
WHERE user_id = ' . $_CLASS['core_user']->data['user_id'] . "\n\t\t\t\t\tAND msg_id = {$msg_id}";
break;
case 'smilies':
require_once $site_file_root . 'includes/forums/functions_posting.php';
generate_smilies('window', 0);
script_close(false);
break;
default:
trigger_error('NO_ACTION_MODE');
break;
}
//.........这里部分代码省略.........
示例13: page_articles
function page_articles()
{
global $_CLASS;
$_CLASS['core_user']->user_setup();
if (isset($_GET['mode'])) {
switch ($_GET['mode']) {
case 'print':
$print = true;
case 'view':
$print = isset($print);
$id = get_variable('id', 'GET', false, 'int');
if (!$id) {
trigger_error('ARTICLE_NOT_FOUND');
}
$result = $_CLASS['core_db']->query('SELECT * FROM ' . ARTICLES_TABLE . ' WHERE articles_id = ' . $id);
$row = $_CLASS['core_db']->fetch_row_assoc($result);
$_CLASS['core_db']->free_result($result);
if (!$row || $row['articles_status'] != STATUS_ACTIVE) {
trigger_error('ARTICLE_NOT_FOUND');
}
$_CLASS['core_template']->assign_array(array('ARTICLES_POSTER' => $row['poster_name'] ? $row['poster_name'] : $_CLASS['core_user']->get_lang('ANONYMOUS'), 'ARTICLES_POSTER_LINK' => $row['poster_name'] && $row['poster_id'] ? generate_link('Members_List&mode=viewprofile&u=' . $row['poster_id']) : '', 'ARTICLES_TEXT' => $row['articles_text'], 'ARTICLES_CONTENT_LINK' => generate_link('articles&mode=view&id=' . $row['articles_id']), 'ARTICLES_TIME' => $_CLASS['core_user']->format_date($row['articles_posted']), 'ARTICLES_TITLE' => $row['articles_title'], 'ARTICLES_ID' => $id, 'ARTICLES_LINK_PRINT' => generate_link('articles&mode=print&id=' . $row['articles_id']), 'ARTICLES_LINK_SEND' => generate_link('articles&mode=send&id=' . $row['articles_id'])));
$_CLASS['core_display']->display(false, $print ? 'modules/articles/print.html' : 'modules/articles/view.html');
script_close();
break;
}
}
$start = get_variable('start', 'GET', false, 'int');
$collapable_holding = array();
$expire_updated = false;
$limit = 10;
$sql = 'SELECT * FROM ' . ARTICLES_TABLE . ' WHERE articles_status = ' . STATUS_ACTIVE . ' ORDER BY articles_order ASC';
$result = $_CLASS['core_db']->query_limit($sql, $limit, $start);
while ($row = $_CLASS['core_db']->fetch_row_assoc($result)) {
// this can cause problems, only thing to do is remove the limit query and do a loop until we get the needed articles
if ($row['articles_auth'] && !$_CLASS['core_auth']->auth(@unserialize($row['articles_auth'])) && !$_CLASS['core_auth']->admin_power('articles')) {
continue;
}
if ($row['articles_expires'] && !$expire_updated && $_CLASS['core_user']->time > $row['articles_expires']) {
$_CLASS['core_db']->query('UPDATE ' . ARTICLES_TABLE . ' SET articles_status = ' . STATUS_DISABLED . ' WHERE articles_expires > 0 AND articles_expires <= ' . $_CLASS['core_user']->time);
$expire_updated = true;
continue;
}
if ($row['articles_starts'] && $row['articles_starts'] > $_CLASS['core_user']->time) {
continue;
}
$_CLASS['core_template']->assign_vars_array('articles', array('poster' => $row['poster_name'] ? $row['poster_name'] : $_CLASS['core_user']->get_lang('ANONYMOUS'), 'content' => $row['articles_intro'] ? $row['articles_intro'] : $row['articles_text'], 'time' => $_CLASS['core_user']->format_date($row['articles_posted']), 'title' => $row['articles_title'], 'id' => $row['articles_id'], 'collapse' => check_collapsed_status('a_' . $row['articles_id']), 'full_story' => $row['articles_intro'] && $row['articles_text'], 'link_poster' => $row['poster_name'] && $row['poster_id'] ? generate_link('Members_List&mode=viewprofile&u=' . $row['poster_id']) : '', 'link_content' => generate_link('articles&mode=view&id=' . $row['articles_id']), 'link_print' => generate_link('articles&mode=print&id=' . $row['articles_id']), 'link_send' => generate_link('articles&mode=send&id=' . $row['articles_id'])));
$collapable_holding[] = 'a_' . $row['articles_id'];
}
$_CLASS['core_db']->free_result($result);
// Garbage collection, would cause problems with guest/loggin articl views
if ($cookie_data = get_variable('collapsed_items', 'COOKIE')) {
$collapsed_items = $cookie_data ? explode(':', $cookie_data) : array();
$count = count($collapsed_items);
for ($i = 0; $i < $count; $i++) {
if (mb_strpos($collapsed_items[$i], 'a_') === 0 && !in_array($collapsed_items[$i], $collapable_holding)) {
unset($collapsed_items[$i]);
}
}
$collapsed_items = implode(':', $collapsed_items);
setcookie('collapsed_items', $collapsed_items, (int) $_CLASS['core_user']->time + 31536000000.0, '/');
}
$result = $_CLASS['core_db']->query('SELECT COUNT(*) AS total FROM ' . ARTICLES_TABLE . ' WHERE articles_status = ' . STATUS_ACTIVE);
$row = $_CLASS['core_db']->fetch_row_assoc($result);
$_CLASS['core_db']->free_result($result);
$pagination = generate_pagination('articles', $row['total'], $limit, $start);
$_CLASS['core_template']->assign_array(array('articles_pagination' => $pagination['formated'], 'articles_pagination_array' => $pagination['array']));
$_CLASS['core_display']->display(false, 'modules/articles/index.html');
}
示例14: send_file_to_browser
function send_file_to_browser($attachment, $upload_dir, $category)
{
global $_CLASS, $config;
$filename = $upload_dir . '/' . $attachment['physical_filename'];
if (!@file_exists($filename)) {
trigger_error($_CLASS['core_user']->lang['ERROR_NO_ATTACHMENT'] . '<br /><br />' . sprintf($_CLASS['core_user']->lang['FILE_NOT_FOUND_404'], $filename));
}
// Check if headers already sent or not able to get the file contents.
if (headers_sent() || !@is_readable($filename)) {
trigger_error('UNABLE_TO_DELIVER_FILE');
}
/*
Correct the mime type - we force application/octetstream for all files, except images
Please do not change this, it is a security precaution
*/
if (strpos($attachment['mimetype'], 'image') !== 0) {
$attachment['mimetype'] = strpos(strtolower($_CLASS['core_user']->browser), 'msie') !== false || strpos(strtolower($_CLASS['core_user']->browser), 'opera') !== false ? 'application/octetstream' : 'application/octet-stream';
}
/* Clean all output buffers */
if (@ob_get_length()) {
while (@ob_end_clean()) {
}
}
header('Content-Encoding: ');
/* Send out required headers */
header('Pragma: public');
// Try X-Sendfile since it is much more server friendly - only works if the path is *not* outside of the root path...
// lighttpd has core support for it. An apache2 module is available at http://celebnamer.celebworld.ws/stuff/mod_xsendfile/
if (strpos($upload_dir, '/') !== 0 && strpos($upload_dir, '../') === false && (!SITE_ROOT || (strpos($upload_dir, SITE_ROOT) || @file_exists(SITE_ROOT . $filename)))) {
header('X-Sendfile: ' . $filename);
}
header('Content-Type: ' . $attachment['mimetype'] . '; name="' . $attachment['real_filename'] . '"');
header('Content-Disposition: ' . (strpos($attachment['mimetype'], 'image') === 0 ? 'inline' : 'attachment') . '; filename="' . $attachment['real_filename'] . '"');
/* Now send the File Contents to the Browser */
$size = @filesize($filename);
if ($size) {
header('Content-Length: ' . $size);
}
$result = @readfile($filename);
if (!$result) {
trigger_error('Unable to deliver file.<br />Error was: ' . $php_errormsg, E_USER_WARNING);
}
script_close(false);
}
示例15: display_footer
function display_footer($save = true)
{
global $_CLASS, $_CORE_MODULE, $_CORE_CONFIG;
if ($this->displayed['footer']) {
return;
}
if (!$this->displayed['header']) {
script_close($save);
}
if ($_CORE_MODULE = $this->get_module()) {
require SITE_FILE_ROOT . 'modules/' . $_CORE_MODULE['module_name'] . '/index.php';
}
$this->displayed['footer'] = true;
if ($this->homepage) {
$_CLASS['core_blocks']->display(BLOCK_BOTTOM);
}
$_CLASS['core_blocks']->display(BLOCK_MESSAGE_BOTTOM);
if ($this->displayed['header']) {
$this->theme->theme_footer();
}
script_close($save);
}