本文整理汇总了PHP中redirect_screen函数的典型用法代码示例。如果您正苦于以下问题:PHP redirect_screen函数的具体用法?PHP redirect_screen怎么用?PHP redirect_screen使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了redirect_screen函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: validate_ip_script
/**
* Validate an IP address, indirectly by passing through a confirmation code.
*/
function validate_ip_script()
{
@ob_end_clean();
global $EXTRA_HEAD;
$EXTRA_HEAD->attach('<meta name="robots" content="noindex" />');
// XHTMLXHTML
$keep = keep_symbol(array('1'));
$code = either_param('code', '');
if ($code == '') {
$title = get_page_title('CONFIRM');
require_code('form_templates');
$fields = new ocp_tempcode();
$fields->attach(form_input_codename(do_lang_tempcode('CODE'), '', 'code', '', true));
$submit_name = do_lang_tempcode('PROCEED');
$url = find_script('validateip') . $keep;
$middle = do_template('FORM_SCREEN', array('_GUID' => 'd92ce4ec82dc709f920a4ce6760778de', 'TITLE' => $title, 'SKIP_VALIDATION' => true, 'HIDDEN' => '', 'URL' => $url, 'FIELDS' => $fields, 'TEXT' => do_lang_tempcode('MISSING_CONFIRM_CODE'), 'SUBMIT_NAME' => $submit_name));
$echo = globalise($middle, NULL, '', true);
$echo->evaluate_echo();
exit;
}
// If we're still here, we're ok to go
require_lang('ocf');
$test = $GLOBALS['FORUM_DB']->query_value_null_ok('f_member_known_login_ips', 'i_val_code', array('i_val_code' => $code));
if (is_null($test)) {
warn_exit(do_lang_tempcode('ALREADY_VALIDATED'));
}
$GLOBALS['FORUM_DB']->query_update('f_member_known_login_ips', array('i_val_code' => ''), array('i_val_code' => $code), '', 1);
$title = get_page_title('CONFIRM');
$middle = redirect_screen($title, get_base_url() . $keep, do_lang_tempcode('SUCCESS'));
$echo = globalise($middle, NULL, '', true);
$echo->evaluate_echo();
exit;
}
示例2: ocw_refresh_with_message
/**
* Show the current user a message. Function does not return.
*
* @param tempcode The message to show
* @param ID_TEXT Code of message type to show
* @set warn inform fatal
*/
function ocw_refresh_with_message($message, $msg_type = 'inform')
{
$url = build_url(array('page' => 'ocworld'), '_SELF');
@ob_end_clean();
$title = get_page_title('MESSAGE');
$tpl = redirect_screen($title, $url, $message, false, $msg_type);
$echo = globalise($tpl, NULL, '', true);
$echo->evaluate_echo();
exit;
}
示例3: ___text
/**
* Standard stage of pointstore item purchase.
*
* @return tempcode The UI
*/
function ___text()
{
if (get_option('is_on_flagrant_buy') == '0') {
return new ocp_tempcode();
}
$title = get_page_title('TITLE_NEWTEXT');
// Define variables
$member_id = get_member();
$message = post_param('message');
$days = post_param_integer('days');
$points_left = available_points($member_id);
// First we need to know the price of the number of days we ordered. After that, compare that price with our users current number of points.
$dayprice = intval(get_option('text'));
$total = $dayprice * $days;
if ($points_left < $total && !has_specific_permission(get_member(), 'give_points_self')) {
return warn_screen($title, do_lang_tempcode('FLAGRANT_LACK_POINTS', integer_format($days), integer_format($total), integer_format($points_left)));
}
// Add this to the database
$GLOBALS['SITE_DB']->query_insert('text', array('notes' => '', 'activation_time' => NULL, 'active_now' => 0, 'user_id' => $member_id, 'the_message' => insert_lang_comcode($message, 2), 'days' => $days, 'order_time' => time()));
// Mail off the notice
require_code('notifications');
$_url = build_url(array('page' => 'admin_flagrant'), 'adminzone', NULL, false, false, true);
$manage_url = $_url->evaluate();
dispatch_notification('pointstore_request_flagrant', NULL, do_lang('TITLE_NEWTEXT', NULL, NULL, NULL, get_site_default_lang()), do_lang('MAIL_FLAGRANT_TEXT', $message, comcode_escape($manage_url), NULL, get_site_default_lang()));
// Now, deduct the points from our user's account
require_code('points2');
charge_member($member_id, $total, do_lang('PURCHASED_FLAGRANT'));
$url = build_url(array('page' => '_SELF', 'type' => 'misc'), '_SELF');
return redirect_screen($title, $url, do_lang_tempcode('ORDER_FLAGRANT_DONE'));
}
示例4: deliver
/**
* Actualiser to deliver an invoice.
*
* @return tempcode The result.
*/
function deliver()
{
$title = get_page_title('MARK_AS_DELIVERED');
breadcrumb_set_self(do_lang_tempcode('DONE'));
breadcrumb_set_parents(array(array('_SEARCH:admin_ecommerce:ecom_usage', do_lang_tempcode('ECOMMERCE')), array('_SELF:_SELF:misc', do_lang_tempcode('INVOICES')), array('_SELF:_SELF:undelivered', do_lang_tempcode('UNDELIVERED_INVOICES'))));
$GLOBALS['SITE_DB']->query_update('invoices', array('i_state' => 'delivered'), array('id' => get_param_integer('id')), '', 1);
$url = build_url(array('page' => '_SELF', 'type' => 'undelivered'), '_SELF');
return redirect_screen($title, $url, do_lang_tempcode('SUCCESS'));
}
示例5: __ed
/**
* Actualiser to edit a test section.
*
* @return tempcode The result of execution.
*/
function __ed()
{
check_specific_permission('edit_own_tests');
$id = get_param_integer('id');
$rows = $GLOBALS['SITE_DB']->query_select('test_sections', array('*'), array('id' => $id), '', 1);
if (!array_key_exists(0, $rows)) {
warn_exit('MISSING_RESOURCE');
}
$section = $rows[0];
if (!(has_specific_permission(get_member(), 'edit_own_tests') && ($section['s_assigned_to'] == get_member() || $GLOBALS['FORUM_DRIVER']->is_staff(get_member())))) {
access_denied('ACCESS_DENIED');
}
if (post_param_integer('delete', 0) == 1) {
$title = get_page_title('DELETE_TEST_SECTION');
$GLOBALS['SITE_DB']->query_delete('test_sections', array('id' => $id), '', 1);
$GLOBALS['SITE_DB']->query_delete('tests', array('t_section' => $id));
return inform_screen($title, do_lang_tempcode('SUCCESS'));
} else {
$title = get_page_title('EDIT_TEST_SECTION');
// New tests
$this->_add_new_tests($id);
$assigned_to = post_param_integer('assigned_to');
if ($assigned_to == -1) {
$assigned_to = NULL;
}
$GLOBALS['SITE_DB']->query_update('test_sections', array('s_section' => post_param('section'), 's_notes' => post_param('notes'), 's_inheritable' => post_param_integer('inheritable', 0), 's_assigned_to' => $assigned_to), array('id' => get_param_integer('id')), '', 1);
// Tests that are edited/deleted (or possibly unchanged, but we count that as edited)
foreach (array_keys($_POST) as $key) {
$matches = array();
if (preg_match('#edit_(\\d+)_test#', $key, $matches) != 0) {
$tid = $matches[1];
$delete = post_param_integer('edit_' . $tid . '_delete', 0);
if ($delete == 1) {
$GLOBALS['SITE_DB']->query_delete('tests', array('id' => $tid), '', 1);
} else {
$assigned_to = post_param_integer('edit_' . $tid . '_assigned_to');
if ($assigned_to == -1) {
$assigned_to = NULL;
}
$inherit_section = post_param_integer('edit_' . $tid . '_inherit_section');
if ($inherit_section == -1) {
$inherit_section = NULL;
}
$GLOBALS['SITE_DB']->query_update('tests', array('t_test' => post_param('edit_' . $tid . '_test'), 't_assigned_to' => $assigned_to, 't_enabled' => post_param_integer('edit_' . $tid . '_enabled', 0), 't_inherit_section' => $inherit_section), array('id' => $tid), '', 1);
}
}
}
// Show it worked / Refresh
$url = build_url(array('page' => '_SELF', 'type' => 'go'), '_SELF');
return redirect_screen($title, $url, do_lang_tempcode('SUCCESS'));
}
}
示例6: set_lang_code_2
/**
* The actualiser to translate code (called externally, and may operate on many lang files).
*
* @return tempcode The UI
*/
function set_lang_code_2()
{
$lang = post_param('lang');
$lang_files = get_lang_files(fallback_lang());
foreach (array_keys($lang_files) as $lang_file) {
$for_base_lang = get_lang_file_map(fallback_lang(), $lang_file, true);
$for_base_lang_2 = get_lang_file_map($lang, $lang_file, false);
$descriptions = get_lang_file_descriptions(fallback_lang(), $lang_file);
$out = '';
foreach ($for_base_lang_2 + $for_base_lang as $key => $now_val) {
$val = post_param('l_' . $key, array_key_exists($key, $for_base_lang_2) ? $for_base_lang_2[$key] : $now_val);
if (str_replace(chr(10), '\\n', $val) != $now_val || !array_key_exists($key, $for_base_lang) || $for_base_lang[$key] != $val || !file_exists(get_file_base() . '/lang/' . fallback_lang() . '/' . $lang_file . '.ini')) {
// if it's changed from default ocPortal, or not in default ocPortal, or was already changed in language file, or whole file is not in default ocPortal
$out .= $key . '=' . str_replace(chr(10), '\\n', $val) . "\n";
}
}
if ($out != '') {
$path = get_custom_file_base() . '/lang_custom/' . filter_naughty($lang) . '/' . filter_naughty($lang_file) . '.ini';
$path_backup = $path . '.' . strval(time());
if (file_exists($path)) {
@copy($path, $path_backup) or intelligent_write_error($path_backup);
sync_file($path_backup);
}
$myfile = @fopen($path, 'wt');
if ($myfile === false) {
intelligent_write_error($path);
}
fwrite($myfile, "[descriptions]\n");
foreach ($descriptions as $key => $description) {
if (fwrite($myfile, $key . '=' . $description . "\n") == 0) {
warn_exit(do_lang_tempcode('COULD_NOT_SAVE_FILE'));
}
}
fwrite($myfile, "\n[strings]\n");
fwrite($myfile, $out);
fclose($myfile);
fix_permissions($path);
sync_file($path);
$path_backup2 = $path . '.latest_in_ocp_edit';
@copy($path, $path_backup2) or intelligent_write_error($path_backup2);
sync_file($path_backup2);
}
}
$title = get_page_title('TRANSLATE_CODE');
log_it('TRANSLATE_CODE');
require_code('view_modes');
erase_cached_language();
erase_cached_templates();
// Show it worked / Refresh
$url = post_param('redirect', '');
if ($url == '') {
return inform_screen($title, do_lang_tempcode('SUCCESS'));
}
return redirect_screen($title, $url, do_lang_tempcode('SUCCESS'));
}
示例7: module_do_upload
/**
* The actualiser for uploading a file.
*
* @return tempcode The UI.
*/
function module_do_upload()
{
if (!has_specific_permission(get_member(), 'upload_filedump')) {
access_denied('I_ERROR');
}
$title = get_page_title('FILEDUMP_UPLOAD');
if (function_exists('set_time_limit')) {
@set_time_limit(0);
}
// Slowly uploading a file can trigger time limit, on some servers
$place = filter_naughty(post_param('place'));
require_code('uploads');
if (!is_swf_upload(true) && (!array_key_exists('file', $_FILES) || !is_uploaded_file($_FILES['file']['tmp_name']))) {
$attach_name = 'file';
$max_size = get_max_file_size();
if (isset($_FILES[$attach_name]) && ($_FILES[$attach_name]['error'] == 1 || $_FILES[$attach_name]['error'] == 2)) {
warn_exit(do_lang_tempcode('FILE_TOO_BIG', integer_format($max_size)));
} elseif (isset($_FILES[$attach_name]) && ($_FILES[$attach_name]['error'] == 3 || $_FILES[$attach_name]['error'] == 6 || $_FILES[$attach_name]['error'] == 7)) {
warn_exit(do_lang_tempcode('ERROR_UPLOADING_' . strval($_FILES[$attach_name]['error'])));
} else {
warn_exit(do_lang_tempcode('ERROR_UPLOADING'));
}
}
$file = $_FILES['file']['name'];
if (get_magic_quotes_gpc()) {
$file = stripslashes($file);
}
if (!has_specific_permission(get_member(), 'upload_anything_filedump') || get_file_base() != get_custom_file_base()) {
check_extension($file);
}
$file = str_replace('.', '-', basename($file, '.' . get_file_extension($file))) . '.' . get_file_extension($file);
if (!file_exists(get_custom_file_base() . '/uploads/filedump' . $place . $file)) {
$max_size = get_max_file_size();
if ($_FILES['file']['size'] > $max_size) {
warn_exit(do_lang_tempcode('FILE_TOO_BIG', integer_format(intval($max_size))));
}
$full = get_custom_file_base() . '/uploads/filedump' . $place . $file;
if (is_swf_upload(true)) {
@rename($_FILES['file']['tmp_name'], $full) or warn_exit(do_lang_tempcode('FILE_MOVE_ERROR', escape_html($file), escape_html('uploads/filedump' . $place)));
} else {
@move_uploaded_file($_FILES['file']['tmp_name'], $full) or warn_exit(do_lang_tempcode('FILE_MOVE_ERROR', escape_html($file), escape_html('uploads/filedump' . $place)));
}
fix_permissions($full);
sync_file($full);
$return_url = build_url(array('page' => '_SELF', 'place' => $place), '_SELF');
$test = $GLOBALS['SITE_DB']->query_value_null_ok('filedump', 'description', array('name' => $file, 'path' => $place));
if (!is_null($test)) {
delete_lang($test);
}
$GLOBALS['SITE_DB']->query_delete('filedump', array('name' => $file, 'path' => $place), '', 1);
$description = post_param('description');
$GLOBALS['SITE_DB']->query_insert('filedump', array('name' => $file, 'path' => $place, 'the_member' => get_member(), 'description' => insert_lang_comcode($description, 3)));
require_code('notifications');
$subject = do_lang('FILEDUMP_NOTIFICATION_MAIL_SUBJECT', get_site_name(), $file, $place);
$mail = do_lang('FILEDUMP_NOTIFICATION_MAIL', comcode_escape(get_site_name()), comcode_escape($file), array(comcode_escape($place), comcode_escape($description)));
dispatch_notification('filedump', $place, $subject, $mail);
log_it('FILEDUMP_UPLOAD', $file, $place);
if (has_actual_page_access($GLOBALS['FORUM_DRIVER']->get_guest_id(), get_page_name(), get_zone_name())) {
syndicate_described_activity('filedump:ACTIVITY_FILEDUMP_UPLOAD', $place . '/' . $file, '', '', '', '', '', 'filedump');
}
return redirect_screen($title, $return_url, do_lang_tempcode('SUCCESS'));
} else {
warn_exit(do_lang_tempcode('OVERWRITE_ERROR'));
}
return new ocp_tempcode();
}
示例8: invisible
/**
* The actualiser for toggling invisible mode.
*
* @return tempcode The UI.
*/
function invisible()
{
if (get_option('is_on_invisibility') == '1') {
$visible = array_key_exists(get_session_id(), $GLOBALS['SESSION_CACHE']) && $GLOBALS['SESSION_CACHE'][get_session_id()]['session_invisible'] == 0;
} else {
$visible = false;
// Small fudge: always say thay are not visible now, so this will make them visible -- because they don't have permission to be invisible
}
$title = get_page_title($visible ? 'INVISIBLE' : 'BE_VISIBLE');
$GLOBALS['SITE_DB']->query_update('sessions', array('session_invisible' => $visible ? 1 : 0), array('the_user' => get_member(), 'the_session' => get_session_id()), '', 1);
global $SESSION_CACHE;
if ($SESSION_CACHE[get_session_id()]['the_user'] == get_member()) {
$SESSION_CACHE[get_session_id()]['session_invisible'] = $visible ? 1 : 0;
if (get_value('session_prudence') !== '1') {
persistant_cache_set('SESSION_CACHE', $SESSION_CACHE);
}
}
decache('side_users_online');
// Store in cookie, if we have login cookies around
if (array_key_exists(get_member_cookie(), $_COOKIE)) {
require_code('users_active_actions');
ocp_setcookie(get_member_cookie() . '_invisible', strval($visible ? 1 : 0));
$_COOKIE[get_member_cookie() . '_invisible'] = strval($visible ? 1 : 0);
}
$url = get_param('redirect', NULL);
if (is_null($url)) {
$_url = build_url(array('page' => ''), '');
$url = $_url->evaluate();
}
return redirect_screen($title, $url, do_lang_tempcode('SUCCESS'));
}
示例9: 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'));
}
示例10: validate_post
/**
* The actualiser to validate a post.
*
* @return tempcode The UI
*/
function validate_post()
{
$post_id = get_param_integer('id');
require_code('ocf_posts_action');
require_code('ocf_posts_action2');
require_code('ocf_posts_action3');
$topic_id = ocf_validate_post($post_id);
$redirect = get_param('redirect', '');
if ($redirect != '') {
return redirect_screen(get_page_title('VALIDATE_POST'), $redirect, do_lang_tempcode('SUCCESS'));
}
return $this->redirect_to('VALIDATE_POST', $topic_id);
}
示例11: actual
//.........这里部分代码省略.........
intelligent_write_error($adminguide_path);
}
if (fwrite($myfile, $adminguide) < strlen($adminguide)) {
warn_exit(do_lang_tempcode('COULD_NOT_SAVE_FILE'));
}
fclose($myfile);
fix_permissions($adminguide_path);
sync_file($adminguide_path);
$start_path = get_file_base() . '/adminzone/pages/comcode_custom/' . get_site_default_lang() . '/start.txt';
if (!file_exists($start_path)) {
$start = post_param('start_page');
$myfile = @fopen($start_path, 'wb');
if ($myfile === false) {
intelligent_write_error($start_path);
}
if (fwrite($myfile, $start) < strlen($start)) {
warn_exit(do_lang_tempcode('COULD_NOT_SAVE_FILE'));
}
fclose($myfile);
fix_permissions($start_path);
sync_file($start_path);
}
if (get_file_base() == get_custom_file_base()) {
$critical_errors = file_get_contents(get_file_base() . '/sources/critical_errors.php');
$critical_errors = str_replace('ocPortal', post_param('rebrand_name'), $critical_errors);
$critical_errors = str_replace('http://ocportal.com', post_param('rebrand_base_url'), $critical_errors);
$critical_errors = str_replace('ocProducts', 'ocProducts/' . post_param('company_name'), $critical_errors);
$critical_errors_path = 'sources_custom/critical_errors.php';
afm_make_file($critical_errors_path, $critical_errors, false);
}
$save_header_path = get_file_base() . '/themes/' . $GLOBALS['FORUM_DRIVER']->get_theme() . '/templates_custom/HEADER.tpl';
$header_path = $save_header_path;
if (!file_exists($header_path)) {
$header_path = get_file_base() . '/themes/default/templates/HEADER.tpl';
}
$header_tpl = file_get_contents($header_path);
$header_tpl = str_replace('Copyright ocProducts Limited', '', $header_tpl);
$myfile = @fopen($save_header_path, 'wb');
if ($myfile === false) {
intelligent_write_error($save_header_path);
}
if (fwrite($myfile, $header_tpl) < strlen($header_tpl)) {
warn_exit(do_lang_tempcode('COULD_NOT_SAVE_FILE'));
}
fclose($myfile);
fix_permissions($save_header_path);
sync_file($save_header_path);
if (post_param_integer('churchy', 0) == 1) {
if (is_object($GLOBALS['FORUM_DB'])) {
$GLOBALS['FORUM_DB']->query_delete('f_emoticons', array('e_code' => ':devil:'), '', 1);
} else {
$GLOBALS['SITE_DB']->query_delete('f_emoticons', array('e_code' => ':devil:'), '', 1);
}
}
// Make sure some stuff is disabled for non-admin staff
$staff_groups = $GLOBALS['FORUM_DRIVER']->get_moderator_groups();
$disallowed_pages = array('admin_setupwizard', 'admin_addons', 'admin_backup', 'admin_errorlog', 'admin_import', 'admin_occle', 'admin_phpinfo', 'admin_debrand');
foreach (array_keys($staff_groups) as $id) {
foreach ($disallowed_pages as $page) {
$GLOBALS['SITE_DB']->query_delete('group_page_access', array('page_name' => $page, 'zone_name' => 'adminzone', 'group_id' => $id), '', 1);
// in case already exists
$GLOBALS['SITE_DB']->query_insert('group_page_access', array('page_name' => $page, 'zone_name' => 'adminzone', 'group_id' => $id));
}
}
// Clean up the theme images
// background-image
$theme = $GLOBALS['FORUM_DRIVER']->get_theme();
find_theme_image('background_image');
//$GLOBALS['SITE_DB']->query_update('theme_images',array('path'=>'themes/default/images/blank.gif'),array('id'=>'background-image','theme'=>$theme),'',1); No longer ocp-specific
// logo/*
if (addon_installed('zone_logos')) {
find_theme_image('logo/adminzone-logo');
find_theme_image('logo/cms-logo');
find_theme_image('logo/collaboration-logo');
$main_logo_url = find_theme_image('logo/-logo', false, true);
$GLOBALS['SITE_DB']->query_update('theme_images', array('path' => $main_logo_url), array('id' => 'logo/adminzone-logo', 'theme' => $theme), '', 1);
$GLOBALS['SITE_DB']->query_update('theme_images', array('path' => $main_logo_url), array('id' => 'logo/cms-logo', 'theme' => $theme), '', 1);
$GLOBALS['SITE_DB']->query_update('theme_images', array('path' => $main_logo_url), array('id' => 'logo/collaboration-logo', 'theme' => $theme), '', 1);
}
// Various other icons
require_code('uploads');
$path = get_url('', 'favicon', 'themes/default/images_custom');
if ($path[0] != '') {
$GLOBALS['SITE_DB']->query_update('theme_images', array('path' => $path[0]), array('id' => 'favicon'));
}
$path = get_url('', 'appleicon', 'themes/default/images_custom');
if ($path[0] != '') {
$GLOBALS['SITE_DB']->query_update('theme_images', array('path' => $path[0]), array('id' => 'appleicon'));
}
if (addon_installed('ocf_avatars')) {
$path = get_url('', 'system_avatar', 'themes/default/images_custom');
if ($path[0] != '') {
$GLOBALS['SITE_DB']->query_update('theme_images', array('path' => $path[0]), array('id' => 'ocf_default_avatars/default_set/ocp_fanatic'));
}
}
$title = get_page_title('SUPER_DEBRAND');
// Redirect them back to editing screen
$url = build_url(array('page' => '_SELF', 'type' => 'misc'), '_SELF');
return redirect_screen($title, $url, do_lang_tempcode('SUCCESS'));
}
示例12: action_done2
/**
* Standard actualisation stage of pointstore item purchase.
*
* @return tempcode The UI
*/
function action_done2()
{
$class = str_replace('hook_pointstore_', '', strtolower(get_class($this)));
$title = get_page_title('OCGIFTS_TITLE');
$gift_id = get_param_integer('gift');
$member_id = get_member();
$to_member = post_param('username', '');
$gift_message = post_param('gift_message', '');
$member_row = $GLOBALS['FORUM_DB']->query_select('f_members', array('*'), array('m_username' => $to_member), '', 1);
if (isset($member_row[0]['id']) && $member_row[0]['id'] > 0) {
$to_member_id = $member_row[0]['id'];
$anonymous = post_param_integer('anonymous', 0);
$gift_row = $GLOBALS['SITE_DB']->query_select('ocgifts', array('*'), array('id' => $gift_id));
if (isset($gift_row[0]['id']) && $gift_row[0]['id'] > 0) {
//check available points and charge
$available_points = available_points($member_id);
if ($gift_row[0]['price'] > $available_points) {
warn_exit(do_lang_tempcode('CANT_AFFORD'));
}
require_code('points2');
//get gift points
charge_member($member_id, $gift_row[0]['price'], do_lang('GIFT_PURCHASING') . ' - ' . strval($gift_row[0]['price']) . ' point(-s).');
$gift_row_id = $GLOBALS['SITE_DB']->query_insert('members_gifts', array('to_user_id' => $to_member_id, 'from_user_id' => $member_id, 'gift_id' => $gift_id, 'add_time' => time(), 'is_anonymous' => $anonymous, 'topic_id' => NULL, 'gift_message' => $gift_message), true);
}
if (isset($gift_row[0]['id']) && $gift_row[0]['id'] > 0) {
require_code('notifications');
if ($anonymous == 0) {
$subject = do_lang('GOT_GIFT');
$message = '[html]' . do_lang('GIFT_EXPLANATION1', $GLOBALS['FORUM_DRIVER']->get_username($member_id), $gift_row[0]['name']) . '[/html].' . "\n\n" . '[img]' . get_custom_base_url() . '/' . $gift_row[0]['image'] . '[/img]' . "\n\n" . $gift_message;
dispatch_notification('gift', NULL, $subject, $message, array($to_member_id));
} else {
$subject = do_lang('GOT_GIFT', NULL, NULL, NULL, get_lang($to_member_id));
$message = '[html]' . do_lang('GIFT_EXPLANATION2', $gift_row[0]['name'], NULL, NULL, get_lang($to_member_id)) . '[/html].' . "\n\n" . '[img]' . get_custom_base_url() . '/' . $gift_row[0]['image'] . '[/img]' . "\n\n" . $gift_message;
dispatch_notification('gift', NULL, $subject, $message, array($to_member_id), A_FROM_SYSTEM_UNPRIVILEGED);
}
}
} else {
warn_exit(do_lang_tempcode('NO_MEMBER_SELECTED'));
}
// Show message
$result = do_lang_tempcode('GIFT_CONGRATULATIONS');
$url = build_url(array('page' => '_SELF', 'type' => 'misc'), '_SELF');
return redirect_screen($title, $url, $result);
}
示例13: toggle_ip_ban
/**
* The actualiser to toggle an IP ban.
*
* @return tempcode The UI
*/
function toggle_ip_ban()
{
$ip = get_param('id');
$test = $GLOBALS['SITE_DB']->query_value_null_ok('usersubmitban_ip', 'ip', array('ip' => $ip));
if (is_null($test)) {
$title = get_page_title('IP_BANNED');
if ($ip == get_ip_address()) {
warn_exit(do_lang_tempcode('AVOIDING_BANNING_SELF'));
}
if (post_param_integer('confirm', 0) == 0) {
$preview = do_lang_tempcode('BAN_IP_DESCRIPTION', escape_html($ip));
$url = get_self_url(false, false);
return do_template('CONFIRM_SCREEN', array('TITLE' => $title, 'PREVIEW' => $preview, 'FIELDS' => form_input_hidden('confirm', '1'), 'URL' => $url));
}
require_code('failure');
add_ip_ban($ip);
log_it('IP_BANNED', $ip);
} else {
$title = get_page_title('IP_UNBANNED');
if (post_param_integer('confirm', 0) == 0) {
$preview = do_lang_tempcode('UNBAN_IP_DESCRIPTION', escape_html($ip));
$url = get_self_url(false, false);
return do_template('CONFIRM_SCREEN', array('TITLE' => $title, 'PREVIEW' => $preview, 'FIELDS' => form_input_hidden('confirm', '1'), 'URL' => $url));
}
require_code('failure');
remove_ip_ban($ip);
log_it('IP_UNBANNED', $ip);
}
persistant_cache_delete('IP_BANS');
// Show it worked / Refresh
$_url = get_param('redirect', NULL);
if (!is_null($_url)) {
$url = make_string_tempcode($_url);
} else {
$url = build_url(array('page' => '_SELF', 'type' => 'misc'), '_SELF');
}
return redirect_screen($title, $url, do_lang_tempcode('SUCCESS'));
}
示例14: do_update_ticket
/**
* Actualise ticket creation/reply, then show the ticket again.
*
* @return tempcode The UI
*/
function do_update_ticket()
{
$title = get_page_title('SUPPORT_TICKETS');
$id = get_param('id');
$_title = post_param('title');
$post = post_param('post');
if ($post == '') {
warn_exit(do_lang_tempcode('NO_PARAMETER_SENT', 'post'));
}
$ticket_type = post_param_integer('ticket_type', -1);
$this->check_id($id);
$staff_only = post_param_integer('staff_only', 0) == 1;
// Update
$_home_url = build_url(array('page' => '_SELF', 'type' => 'ticket', 'id' => $id, 'redirect' => NULL), '_SELF', NULL, false, true, true);
$home_url = $_home_url->evaluate();
$email = '';
if ($ticket_type != -1) {
$type_string = get_translated_text($ticket_type);
$ticket_type_details = get_ticket_type($ticket_type);
//$_title=$type_string.' ('.$_title.')';
if (!has_category_access(get_member(), 'tickets', $type_string)) {
access_denied('I_ERROR');
}
// Check FAQ search results first
if ($ticket_type_details['search_faq'] && post_param_integer('faq_searched', 0) == 0) {
$results = $this->do_search($title, $id, $post);
if (!is_null($results)) {
return $results;
}
}
$new_post = new ocp_tempcode();
$new_post->attach(do_lang('THIS_WITH_COMCODE', do_lang('TICKET_TYPE'), $type_string) . "\n\n");
$email = trim(post_param('email', ''));
if ($email != '') {
$body = '> ' . str_replace(chr(10), chr(10) . '> ', $post);
if (substr($body, -2) == '> ') {
$body = substr($body, 0, strlen($body) - 2);
}
$new_post->attach('[email subject="Re: ' . comcode_escape(post_param('title')) . ' [' . get_site_name() . ']" body="' . comcode_escape($body) . '"]' . $email . '[/email]' . "\n\n");
} elseif (is_guest() && $ticket_type_details['guest_emails_mandatory']) {
// Error if the e-mail address is required for this ticket type
warn_exit(do_lang_tempcode('ERROR_GUEST_EMAILS_MANDATORY'));
}
$new_post->attach($post);
$post = $new_post->evaluate();
}
if (addon_installed('captcha')) {
if (get_option('captcha_on_feedback') == '1') {
require_code('captcha');
enforce_captcha();
}
}
ticket_add_post(get_member(), $id, $ticket_type, $_title, $post, $home_url, $staff_only);
// Find true ticket title
$_forum = 1;
$_topic_id = 1;
$_ticket_type = 1;
// These will be returned by reference
$posts = get_ticket_posts($id, $_forum, $_topic_id, $_ticket_type);
if (!is_array($posts)) {
warn_exit(do_lang_tempcode('MISSING_RESOURCE'));
}
$__title = $_title;
foreach ($posts as $ticket_post) {
$__title = $ticket_post['title'];
if ($__title != '') {
break;
}
}
// Send email
if (!$staff_only) {
if ($email == '') {
$email = $GLOBALS['FORUM_DRIVER']->get_member_email_address(get_member());
}
send_ticket_email($id, $__title, $post, $home_url, $email, $ticket_type);
}
$url = build_url(array('page' => '_SELF', 'type' => 'ticket', 'id' => $id), '_SELF');
if (is_guest()) {
$url = build_url(array('page' => '_SELF'), '_SELF');
}
if (get_param('redirect', '') != '') {
$url = make_string_tempcode(get_param('redirect'));
}
return redirect_screen($title, $url, do_lang_tempcode('TICKET_STARTED'));
}
示例15: ocf_render_forumview
/**
* Render the OCF forumview.
*
* @param ?integer Forum ID (NULL: personal topics).
* @param string The filter category (blank if no filter)
* @param integer Maximum results to show
* @param integer Offset for result showing
* @param AUTO_LINK Virtual root
* @param ?MEMBER The member to show personal topics of (NULL: not showing personal topics)
* @return mixed Either Tempcode (an interface that must be shown) or a Tuple: The main Tempcode, a title to use (also Tempcode), breadcrumbs (also Tempcode), the forum name (string). For a PT view, it is always a tuple, never raw Tempcode (as it can go inside a tabset).
*/
function ocf_render_forumview($id, $current_filter_cat, $max, $start, $root, $of_member_id)
{
require_css('ocf');
$type = is_null($id) ? 'pt' : 'misc';
if ($type == 'pt') {
if (is_guest()) {
access_denied('NOT_AS_GUEST');
}
require_code('ocf_forumview_pt');
$details = ocf_get_personal_topics($start, $max, $of_member_id);
$root_forum_name = $GLOBALS['FORUM_DB']->query_value('f_forums', 'f_name', array('id' => $root));
$tree = hyperlink(build_url(array('page' => '_SELF', 'id' => $root == db_get_first_id() ? NULL : $root), '_SELF'), escape_html($root_forum_name), false, false, do_lang_tempcode('GO_BACKWARDS_TO', $root_forum_name), NULL, NULL, 'up');
$tree->attach(' > ');
$pt_username = $GLOBALS['FORUM_DRIVER']->get_username($of_member_id);
if (is_null($pt_username)) {
$pt_username = do_lang('UNKNOWN');
}
$tree->attach(do_lang_tempcode('PERSONAL_TOPICS_OF', escape_html($pt_username)));
$details['name'] = do_lang_tempcode('PERSONAL_TOPICS_OF', escape_html($pt_username));
} else {
$GLOBALS['FEED_URL'] = find_script('backend') . '?mode=ocf_forumview&filter=' . strval($id);
$details = ocf_get_forum_view($start, $max, $id);
$tree = ocf_forum_breadcrumbs($id, $details['name'], $details['parent_forum']);
if (array_key_exists('question', $details) && is_null(get_bot_type())) {
// Was there a question answering attempt?
$answer = post_param('answer', '-1#');
if ($answer != '-1#') {
if (strtolower(trim($answer)) == strtolower(trim($details['answer']))) {
if (!is_guest()) {
$GLOBALS['FORUM_DB']->query_insert('f_forum_intro_member', array('i_forum_id' => $id, 'i_member_id' => get_member()));
} else {
$GLOBALS['FORUM_DB']->query_insert('f_forum_intro_ip', array('i_forum_id' => $id, 'i_ip' => get_ip_address(3)));
}
} else {
$url = get_self_url();
$title = get_page_title('INTRO_QUESTION');
return redirect_screen($title, $url, do_lang_tempcode('INTRO_ANSWER_INCORRECT'), false, 'warn');
}
} else {
// Ask the question
$title = get_page_title($details['answer'] == '' ? 'INTRO_NOTICE' : 'INTRO_QUESTION');
$url = get_self_url();
return do_template('OCF_FORUM_INTRO_QUESTION_SCREEN', array('ANSWER' => $details['answer'], 'TITLE' => $title, 'URL' => $url, 'QUESTION' => $details['question']));
}
}
}
if ($type == 'pt') {
$forum_name = do_lang('PERSONAL_TOPICS');
} else {
$forum_name = $details['name'];
}
$may_mass_moderate = array_key_exists('may_move_topics', $details) || array_key_exists('may_delete_topics', $details);
// Find categories
$categories = new ocp_tempcode();
if ($type != 'pt') {
foreach ($details['categories'] as $best => $category) {
if (array_key_exists('subforums', $category)) {
// Subforums
$forums = new ocp_tempcode();
foreach ($category['subforums'] as $subforum) {
if (array_key_exists('last_topic_id', $subforum) && !is_null($subforum['last_topic_id'])) {
if (!is_null($subforum['last_member_id'])) {
if (!is_guest($subforum['last_member_id'])) {
//$colour=get_group_colour(ocf_get_member_primary_group($subforum['last_member_id']));
$poster = do_template('OCF_USER_MEMBER', array('_GUID' => '39r932rwefldjfldjlf', 'USERNAME' => $subforum['last_username'], 'PROFILE_URL' => $GLOBALS['FORUM_DRIVER']->member_profile_url($subforum['last_member_id'], false, true)));
} else {
$poster = protect_from_escaping(escape_html($subforum['last_username']));
}
} else {
$poster = do_lang_tempcode('NA_EM');
}
$topic_url = build_url(array('page' => 'topicview', 'id' => $subforum['last_topic_id'], 'type' => 'first_unread'), get_module_zone('topicview'));
$topic_url->attach('#first_unread');
$latest = do_template('OCF_FORUM_LATEST', array('_GUID' => 'dlfsdfkoewfdlfsldfk', 'DATE' => is_null($subforum['last_time']) ? do_lang_tempcode('NA_EM') : protect_from_escaping(escape_html(get_timezoned_date($subforum['last_time']))), 'DATE_RAW' => is_null($subforum['last_time']) ? '' : strval($subforum['last_time']), 'TOPIC_URL' => $topic_url, 'TOPIC_TITLE' => $subforum['last_title'] == '' ? do_lang_tempcode('NA') : $subforum['last_title'], 'POSTER' => $poster, 'MEMBER_ID' => is_null($subforum['last_member_id']) ? '' : strval($subforum['last_member_id']), 'ID' => strval($subforum['last_topic_id'])));
} elseif (array_key_exists('protected_last_post', $subforum)) {
$latest = do_lang_tempcode('PROTECTED_LAST_POST');
} else {
$latest = do_lang_tempcode('NO_POSTS_YET');
}
// Work out where the subforum URL is
if ($subforum['redirection'] != '' && !is_numeric($subforum['redirection'])) {
$subforum_url = $subforum['redirection'];
$subforum_num_posts = do_lang_tempcode('NA_EM');
$subforum_num_topics = do_lang_tempcode('NA_EM');
$latest = do_lang_tempcode('NA_EM');
$subforum['has_new'] = false;
$subforums = new ocp_tempcode();
$new_post_or_not = 'redirect';
} else {
//.........这里部分代码省略.........