本文整理汇总了PHP中confirm_box函数的典型用法代码示例。如果您正苦于以下问题:PHP confirm_box函数的具体用法?PHP confirm_box怎么用?PHP confirm_box使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了confirm_box函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: main
function main($id, $mode)
{
global $db, $user, $template, $auth, $phpbb_container;
$forbidden_forums = $auth->acl_getf('!f_read', true);
$forbidden_forums = array_unique(array_keys($forbidden_forums));
$controller = $phpbb_container->get('sheer.postbookmark.helper');
$controller->get_bookmarks(false, $forbidden_forums);
if (isset($_POST['unbookmark'])) {
$s_hidden_fields = array('unbookmark' => 1);
$topics = isset($_POST['t']) ? array_keys(request_var('t', array(0 => 0))) : array();
$url = $this->u_action;
if (!sizeof($topics)) {
trigger_error('NO_BOOKMARKS_SELECTED');
}
foreach ($topics as $topic_id) {
$s_hidden_fields['t'][$topic_id] = 1;
}
if (confirm_box(true)) {
$sql = 'DELETE FROM ' . POSTS_BOOKMARKS_TABLE . '
WHERE user_id = ' . $user->data['user_id'] . '
AND ' . $db->sql_in_set('post_id', $topics);
$db->sql_query($sql);
meta_refresh(3, $url);
$message = $user->lang['BOOKMARKS_REMOVED'] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], '<a href="' . $url . '">', '</a>');
trigger_error($message);
} else {
confirm_box(false, 'REMOVE_SELECTED_BOOKMARKS', build_hidden_fields($s_hidden_fields));
}
}
$template->assign_vars(array('S_HIDDEN_FIELDS' => isset($s_hidden_fields) ? $s_hidden_fields : '', 'S_UCP_ACTION' => $this->u_action));
$this->tpl_name = 'ucp_postbookmark_body';
}
示例2: display_confirm
/**
* Display confirm box
*
* @param string $action Requested action
* @return null
*/
public function display_confirm($action)
{
switch ($action) {
case 'votes':
$confirm = true;
$confirm_lang = 'DIR_RESET_VOTES_CONFIRM';
break;
case 'comments':
$confirm = true;
$confirm_lang = 'DIR_RESET_COMMENTS_CONFIRM';
break;
case 'clicks':
$confirm = true;
$confirm_lang = 'DIR_RESET_CLICKS_CONFIRM';
break;
case 'orphans':
$confirm = true;
$confirm_lang = 'DIR_DELETE_ORPHANS';
break;
default:
$confirm = false;
}
if ($confirm) {
confirm_box(false, $this->user->lang[$confirm_lang], build_hidden_fields(array('action' => $action)));
}
}
示例3: handle_gb_post_delete
/**
* Do the various checks required for removing posts as well as removing it
*/
function handle_gb_post_delete($post_id, &$post_data, &$guestbook)
{
global $user, $db, $auth, $config;
global $phpbb_root_path, $phpEx;
// If moderator removing post or user itself removing post, present a confirmation screen
if ($auth->acl_get('m_gb_delete') || $post_data['poster_id'] == $user->data['user_id'] && $user->data['is_registered'] && $auth->acl_get('u_gb_delete') && ($post_data['post_time'] > time() - $config['delete_time'] * 60 || !$config['delete_time'])) {
$s_hidden_fields = build_hidden_fields(array('p' => $post_id, 'gbmode' => 'delete'));
if (confirm_box(true)) {
$data = array('post_time' => $post_data['post_time'], 'poster_id' => $post_data['poster_id']);
$next_post_id = gb_delete_post($post_id, $data, $guestbook);
$post_username = $post_data['poster_id'] == ANONYMOUS && !empty($post_data['post_username']) ? $post_data['post_username'] : $post_data['username'];
add_log('mod', 0, 0, 'LOG_GB_DELETE_POST', $post_username);
$member = $guestbook->getmember();
$meta_info = append_sid("{$phpbb_root_path}memberlist.{$phpEx}", "mode=viewprofile&u=" . $member['user_id']);
unset($member);
$message = $user->lang['POST_DELETED'] . '<br /><br />' . sprintf($user->lang['RETURN_PROFILE'], '<a href="' . $meta_info . '">', '</a>');
meta_refresh(3, $meta_info);
trigger_error($message);
} else {
confirm_box(false, 'DELETE_POST', $s_hidden_fields);
}
redirect(append_sid("{$phpbb_root_path}memberlist.{$phpEx}", "mode=viewprofile&u=" . request_var('u', 0)));
}
// If we are here the user is not able to delete - present the correct error message
if ($post_data['poster_id'] != $user->data['user_id'] && $auth->acl_get('u_gb_delete')) {
trigger_error('DELETE_OWN_POSTS');
}
trigger_error('USER_CANNOT_DELETE');
}
示例4: display_options
function display_options()
{
global $db, $template, $user, $cache;
$off = request_var('off', false);
page_header($user->lang['CLEAR_EXTENSIONS']);
$no_composer = false;
if ($off) {
$uids = request_var('marked_name', array('', ''));
if (empty($uids)) {
$error[] = 'NO_EXT_SELECTED';
trigger_error('NO_EXT_SELECTED', E_USER_WARNING);
}
if (confirm_box(true)) {
$sql = 'UPDATE ' . EXT_TABLE . '
SET ext_active = 0
WHERE ' . $db->sql_in_set('ext_name', $uids, false);
$db->sql_query($sql);
$cache->purge();
// Purge the cache
trigger_error('OFF_EXT_SUCCESS');
} else {
$hidden = build_hidden_fields(array('marked_name' => $uids));
confirm_box(false, 'EXT_OFF', $hidden, 'confirm_body.html', STK_DIR_NAME . '/index.' . PHP_EXT . '?c=admin&t=clear_extensions&off=' . true);
}
}
$sql = 'SELECT *
FROM ' . EXT_TABLE . '';
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result)) {
$path = explode('/', $row['ext_name']);
$display_name = $root = $missing_path = '';
foreach ($path as $key => $ext_path) {
if ($dir = @opendir('' . PHPBB_ROOT_PATH . 'ext/' . $root . '' . $ext_path . '')) {
$file = readdir($dir);
$root = '' . $ext_path . '/';
} else {
$missing_path = $ext_path;
break;
}
}
if (!$missing_path) {
if (file_exists('' . PHPBB_ROOT_PATH . 'ext/' . $row['ext_name'] . '/composer.json')) {
$buffer = file_get_contents('' . PHPBB_ROOT_PATH . 'ext/' . $row['ext_name'] . '/composer.json');
if ($buffer) {
$obj = json_decode($buffer);
$display_name = $obj->{'extra'}->{'display-name'};
}
} else {
$no_composer = true;
}
}
$template->assign_block_vars('row', array('EXT_NAME' => $row['ext_name'], 'MISSING_PATH' => $missing_path ? $missing_path : '', 'NO_COMPOSER' => $no_composer ? true : false, 'DISPLAY_NAME' => $display_name ? $display_name : sprintf($user->lang['NO_COMPOSER'], $row['ext_name']), 'NO_COMPOSER' => $display_name ? false : true, 'S_ACTIVE' => $row['ext_active'], 'EXT_MISSING_PATH' => $missing_path ? sprintf($user->lang['EXT_MISSING_PATH'], $row['ext_name']) : ''));
}
$db->sql_freeresult($result);
$template->assign_vars(array('S_ACTION' => append_sid("" . STK_ROOT_PATH . "index." . PHP_EXT . "", 'c=admin&t=clear_extensions')));
$template->set_filenames(array('body' => 'tools/clear_extensions.html'));
page_footer();
}
示例5: main
public function main($id, $mode)
{
global $config, $db, $request, $template, $user, $phpbb_root_path, $phpEx, $phpbb_container;
$this->config = $config;
$this->db = $db;
$this->log = $phpbb_container->get('log');
$this->request = $request;
$this->template = $template;
$this->user = $user;
$this->phpbb_root_path = $phpbb_root_path;
$this->php_ext = $phpEx;
// Load a template from adm/style for our ACP page
$this->tpl_name = 'acp_usermerge';
// Set the page title for our ACP page
$this->page_title = 'ACP_USER_MERGE';
// Quick var-checking and var setup.
$action = $this->request->variable('action', '');
$merge = $action == 'merge' ? true : false;
$errors = array();
$old_username = $this->request->variable('old_username', '', true);
$new_username = $this->request->variable('new_username', '', true);
$form_key = 'acp_user_merge';
add_form_key($form_key);
// Hath we an invalid form key?
if ($this->request->is_set_post('submit') && !check_form_key($form_key)) {
$errors[] = $user->lang['FORM_INVALID'];
}
if ($this->request->is_set_post('submit') || $merge) {
$old_user_id = $this->check_user($old_username, $errors, true);
$new_user_id = $this->check_user($new_username, $errors, false);
}
// Make sure we have submitted the form, and that we do not have errors
if (($this->request->is_set_post('submit') || $merge) && !sizeof($errors)) {
if ($old_user_id == $new_user_id) {
$warning = sprintf($this->user->lang['CANNOT_MERGE_SAME'], $old_username);
trigger_error($warning . adm_back_link($this->u_action), E_USER_WARNING);
}
// Have we confirmed this change?
if (confirm_box(true)) {
// Let's roll!
$this->user_merge($old_user_id, $new_user_id);
$this->log->add('admin', $this->user->data['user_id'], $this->user->ip, 'LOG_USERS_MERGED', time(), array($old_username . ' » ' . $new_username));
trigger_error($this->user->lang['USERS_MERGED'] . adm_back_link($this->u_action));
} else {
$hidden_fields = array('i' => $id, 'mode' => $mode, 'old_username' => $old_username, 'new_username' => $new_username, 'action' => 'merge');
// Be annoying. Are you suuuuuuuuuuuure? No, really, are you sure?
$merge_users_confirm = sprintf($this->user->lang['MERGE_USERS_CONFIRM'], $old_username);
confirm_box(false, $merge_users_confirm, build_hidden_fields($hidden_fields));
}
}
$user_merge_version = !empty($this->config['usermerge_version']) ? $this->config['usermerge_version'] : '';
// Assign template stuffs now.
$this->page_title = $this->user->lang['ACP_USER_MERGE_TITLE'];
$template->assign_vars(array('S_ERROR' => sizeof($errors) ? true : false, 'ERROR_MSG' => implode('<br />', $errors), 'USER_MERGE_VERSION' => $user_merge_version, 'U_FIND_OLD_USERNAME' => append_sid("{$this->phpbb_root_path}memberlist.{$this->php_ext}", 'mode=searchuser&form=user_merge&field=old_username&select_single=true'), 'U_FIND_NEW_USERNAME' => append_sid("{$this->phpbb_root_path}memberlist.{$this->php_ext}", 'mode=searchuser&form=user_merge&field=new_username&select_single=true'), 'OLD_USERNAME' => !empty($old_user_id) ? $old_username : '', 'NEW_USERNAME' => !empty($new_user_id) ? $new_username : '', 'L_TITLE' => $this->user->lang['ACP_USER_MERGE_TITLE'], 'L_EXPLAIN' => $this->user->lang['ACP_USER_MERGE_EXPLAIN'], 'USERMERGE_VERSION' => $user_merge_version, 'U_ACTION' => $this->u_action));
}
示例6: main
public function main($id, $mode)
{
global $config, $db, $user, $template, $table_prefix, $request;
$user->add_lang_ext('tas2580/paypal', 'common');
switch ($mode) {
case 'settings':
$this->tpl_name = 'acp_paypal_body';
$this->page_title = $user->lang('ACP_PAYPAL_TITLE');
add_form_key('acp_paypal');
// delete amount
if ($request->is_set('delete')) {
$id = $request->variable('delete', 0);
if (confirm_box(true)) {
$sql = 'DELETE FROM ' . $table_prefix . 'paypal_amount WHERE amount_id = ' . (int) $id;
$result = $db->sql_query($sql);
trigger_error($user->lang['AMOUNT_DELETED'] . adm_back_link($this->u_action));
} else {
confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array('action' => 'delete', 'id' => $id)));
}
}
// Form is submitted
if ($request->is_set_post('submit')) {
if (!check_form_key('acp_paypal')) {
trigger_error($user->lang('FORM_INVALID') . adm_back_link($this->u_action), E_USER_WARNING);
}
$config->set('paypal_email', $request->variable('paypal_email', ''));
$config->set('paypal_default_item', $request->variable('paypal_default_item', '', true));
$config->set('paypal_description', $request->variable('paypal_description', '', true));
$config->set('currency_code', $request->variable('currency_code', ''));
trigger_error($user->lang('ACP_SAVED') . adm_back_link($this->u_action));
}
// Form is submitted
if ($request->is_set_post('submit_amount')) {
$add_amount = $request->variable('add_amount', 0);
$sql_data = array('amount_value' => $add_amount);
$sql = 'INSERT INTO ' . $table_prefix . 'paypal_amount
' . $db->sql_build_array('INSERT', $sql_data);
$db->sql_query($sql);
trigger_error($user->lang('ACP_SAVED') . adm_back_link($this->u_action));
}
$sql = 'SELECT *
FROM ' . $table_prefix . 'paypal_amount
ORDER BY amount_value';
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result)) {
$template->assign_block_vars('amounts', array('AMOUNT' => number_format($row['amount_value'] / 100, 2), 'U_DELETE' => $this->u_action . '&delete=' . $row['amount_id']));
}
$template->assign_vars(array('U_ACTION' => $this->u_action, 'PAYPAL_EMAIL' => isset($config['paypal_email']) ? $config['paypal_email'] : '', 'PAYPAL_DEFAULT_ITEM' => isset($config['paypal_default_item']) ? $config['paypal_default_item'] : '', 'PAYPAL_DESCRIPTION' => isset($config['paypal_description']) ? $config['paypal_description'] : '', 'SEL_CURRENCY_CODE' => isset($config['currency_code']) ? $user->lang('DONATION_' . $config['currency_code']) : '', 'CURRENCY_CODE' => $this->currency_code_select($config['currency_code'])));
break;
case 'items':
$this->tpl_name = 'acp_paypal_items_body';
$this->page_title = $user->lang('ACP_PAYPAL_ITEMS');
break;
}
}
示例7: main
public function main($id, $mode)
{
global $cache, $phpbb_container, $request, $user;
// Add the pages ACP lang file
$user->add_lang_ext('phpbb/pages', 'pages_acp');
// Get an instance of the admin controller
$admin_controller = $phpbb_container->get('phpbb.pages.admin.controller');
// Requests
$action = $request->variable('action', '');
$page_id = $request->variable('page_id', 0);
// Make the $u_action url available in the admin controller
$admin_controller->set_page_url($this->u_action);
// Load a template from adm/style for our ACP page
$this->tpl_name = 'manage_pages';
// Set the page title for our ACP page
$this->page_title = $user->lang('ACP_PAGES_MANAGE');
// Perform any actions submitted by the user
switch ($action) {
case 'add':
// Set the page title for our ACP page
$this->page_title = $user->lang('ACP_PAGES_CREATE_PAGE');
// Load the add page handle in the admin controller
$admin_controller->add_page();
// Return to stop execution of this script
return;
break;
case 'edit':
// Set the page title for our ACP page
$this->page_title = $user->lang('ACP_PAGES_EDIT_PAGE');
// Load the edit page handle in the admin controller
$admin_controller->edit_page($page_id);
// Return to stop execution of this script
return;
break;
case 'delete':
// Use a confirm box routine when deleting a page
if (confirm_box(true)) {
// Delete page on confirmation from the user
$admin_controller->delete_page($page_id);
} else {
// Request confirmation from the user to delete the page
confirm_box(false, $user->lang('ACP_PAGES_DELETE_CONFIRM'), build_hidden_fields(array('page_id' => $page_id, 'mode' => $mode, 'action' => $action)));
}
break;
case 'purge_icons':
// Purge icon cache
$cache->destroy('_pages_icons');
break;
}
// Display pages
$admin_controller->display_pages();
}
示例8: base
public function base($action, $userid)
{
//load language file
$this->user->add_lang_ext('anavaro/zebraenhance', 'zebra_enchance');
$confirm = $this->request->variable('confirm', '');
$u_action = $this->root_path . 'ucp.php?i=168';
switch ($action) {
case 'cancel_fr':
// check mode
if ($confirm) {
//$this->var_display($userid);
//let me delete all requests between you and user id.
$sql = 'DELETE FROM ' . $this->table_prefix . 'zebra_confirm WHERE user_id = ' . $userid . ' AND zebra_id = ' . $this->user->data['user_id'];
$this->db->sql_query($sql);
$sql = 'DELETE FROM ' . $this->table_prefix . 'zebra_confirm WHERE user_id = ' . $this->user->data['user_id'] . ' AND zebra_id = ' . $userid;
$this->db->sql_query($sql);
$message = '';
if ($this->request->is_ajax()) {
$json_response = new \phpbb\json_response();
$json_response->send(array('success' => $updated, 'MESSAGE_TITLE' => $this->user->lang['INFORMATION'], 'MESSAGE_TEXT' => $this->user->lang['UCP_ZEBRA_ENCHANCE_CONFIRM_CANCEL_ASK'], 'REFRESH_DATA' => array('time' => 3, 'url' => $u_action)));
} else {
meta_refresh(3, $u_action);
trigger_error($this->user->lang['UCP_ZEBRA_ENCHANCE_CONFIRM_CANCEL']);
}
} else {
confirm_box(false, $this->user->lang['UCP_ZEBRA_ENCHANCE_CONFIRM_CANCEL_ASK']);
}
break;
case 'togle_bff':
$sql = 'SELECT bff FROM ' . ZEBRA_TABLE . ' WHERE zebra_id = ' . $userid . ' AND user_id = ' . $this->user->data['user_id'];
$result = $this->db->sql_fetchrow($this->db->sql_query($sql));
if ($result) {
if ($result['bff'] == '0') {
$sql = 'UPDATE ' . ZEBRA_TABLE . ' SET bff = 1 WHERE zebra_id = ' . $userid . ' AND user_id = ' . $this->user->data['user_id'];
$this->db->sql_query($sql);
$exit = 'add';
}
if ($result['bff'] == '1') {
$sql = 'UPDATE ' . ZEBRA_TABLE . ' SET bff = 0 WHERE zebra_id = ' . $userid . ' AND user_id = ' . $this->user->data['user_id'];
$this->db->sql_query($sql);
$exit = 'rem';
}
$json_response = new \phpbb\json_response();
$json_response->send(array('status' => '0', 'exit' => $exit, 'user_id' => $userid));
} else {
$json_response = new \phpbb\json_response();
$json_response->send(array('status' => '1', 'user_id' => $userid));
}
break;
}
}
示例9: main
public function main($id, $mode)
{
global $phpbb_container, $request, $user;
// Add the auto groups ACP lang file
$user->add_lang_ext('phpbb/autogroups', 'autogroups_acp');
// Get an instance of the admin controller
$admin_controller = $phpbb_container->get('phpbb.autogroups.admin_controller');
// Requests
$action = $request->variable('action', '');
$autogroups_id = $request->variable('autogroups_id', 0);
// Make the $u_action url available in the admin controller
$admin_controller->set_page_url($this->u_action);
// Load a template from adm/style for our ACP auto groups
$this->tpl_name = 'manage_autogroups';
// Set the page title for our ACP auto groups
$this->page_title = $user->lang('ACP_AUTOGROUPS_MANAGE');
// Quick-submit settings from the general options form
if ($request->is_set_post('generalsubmit')) {
$admin_controller->submit_autogroups_options();
}
// Perform any actions submitted by the user
switch ($action) {
case 'add':
case 'edit':
// Set the page title for our ACP auto groups
$this->page_title = $user->lang(strtoupper("ACP_AUTOGROUPS_{$action}"));
// Load the save auto group handle in the admin controller
$admin_controller->save_autogroup_rule($autogroups_id);
// Return to stop execution of this script
return;
break;
case 'sync':
// Resync applies an auto group check against all users
$admin_controller->resync_autogroup_rule($autogroups_id);
break;
case 'delete':
// Use a confirm box routine when deleting an auto group rule
if (confirm_box(true)) {
// Delete auto group rule on confirmation from the user
$admin_controller->delete_autogroup_rule($autogroups_id);
} else {
// Request confirmation from the user to delete the auto group rule
confirm_box(false, $user->lang('ACP_AUTOGROUPS_DELETE_CONFIRM'), build_hidden_fields(array('autogroups_id' => $autogroups_id, 'mode' => $mode, 'action' => $action)));
}
break;
}
// Display auto group rules
$admin_controller->display_autogroups();
}
示例10: delete
/**
* Delete a version of an article
*
* @param string $id Id of the version to delete
* @return object
*/
public function delete($id)
{
if (!$this->auth->acl_get('u_wiki_delete')) {
trigger_error('NOT_AUTHORISED');
}
if (confirm_box(true)) {
$sql = 'DELETE FROM ' . $this->table_article . '
WHERE article_id = ' . (int) $id;
$this->db->sql_query($sql);
//return $helper->message('DELETE_VERSION_SUCCESS', array());
trigger_error($this->user->lang['DELETE_VERSION_SUCCESS'] . '<br /><br /><a href="' . $this->helper->route('tas2580_wiki_index', array()) . '">' . $this->user->lang['BACK_TO_WIKI'] . '</a>');
} else {
$s_hidden_fields = build_hidden_fields(array('id' => $id));
confirm_box(false, $this->user->lang['CONFIRM_DELETE_VERSION'], $s_hidden_fields);
}
}
示例11: delete
/**
* Delete action (deletes an idea via confirm dialog)
*
* @return null
* @access public
*/
public function delete()
{
if ($this->is_mod()) {
if (confirm_box(true)) {
include $this->root_path . 'includes/functions_admin.' . $this->php_ext;
$this->ideas->delete($this->data['idea_id'], $this->data['topic_id']);
$redirect = $this->helper->route('phpbb_ideas_index_controller');
$message = $this->language->lang('IDEA_DELETED') . '<br /><br />' . $this->language->lang('RETURN_IDEAS', '<a href="' . $redirect . '">', '</a>');
meta_refresh(3, $redirect);
trigger_error($message);
// trigger error needed for data-ajax
} else {
confirm_box(false, $this->language->lang('CONFIRM_OPERATION'), build_hidden_fields(array('idea_id' => $this->data['idea_id'], 'mode' => 'delete')), 'confirm_body.html', $this->helper->route('phpbb_ideas_idea_controller', array('idea_id' => $this->data['idea_id'], 'mode' => 'delete'), true, false, UrlGeneratorInterface::ABSOLUTE_URL));
}
}
}
示例12: main
function main($id, $mode)
{
global $db, $request, $user, $template, $phpbb_container;
$this->tpl_name = 'acp_thanks_truncate';
$this->page_title = 'ACP_THANKS_TRUNCATE';
$all_posts_thanks = $all_thanks = $del_thanks = $del_uposts = $del_posts = 0;
$thanks_table = $phpbb_container->getParameter('tables.thanks');
$sql = 'SELECT COUNT(post_id) as total_match_count
FROM ' . $thanks_table;
$result = $db->sql_query($sql);
$all_thanks = $end_thanks = $del_thanks = $db->sql_fetchfield('total_match_count');
$db->sql_freeresult($result);
$sql = 'SELECT COUNT(DISTINCT post_id) as total_match_count
FROM ' . $thanks_table;
$result = $db->sql_query($sql);
$all_posts_thanks = $del_posts = $end_posts_thanks = $db->sql_fetchfield('total_match_count');
$db->sql_freeresult($result);
$sql = 'SELECT COUNT(DISTINCT user_id) as total_match_count
FROM ' . $thanks_table;
$result = $db->sql_query($sql);
$all_users_thanks = $del_uposts = $end_users_thanks = $db->sql_fetchfield('total_match_count');
$db->sql_freeresult($result);
$truncate = $request->variable('truncate', false);
if ($truncate) {
// check mode
if (confirm_box(true)) {
$sql = 'TRUNCATE TABLE ' . $thanks_table;
$result = $db->sql_query($sql);
$db->sql_freeresult($result);
$sql = 'SELECT COUNT(post_id) as total_match_count
FROM ' . $thanks_table;
$result = $db->sql_query($sql);
$end_thanks = $db->sql_fetchfield('total_match_count');
$db->sql_freeresult($result);
$end_posts_thanks = $all_posts_thanks - $del_posts;
$end_users_thanks = $all_users_thanks - $del_uposts;
$del_thanks = $all_thanks - $end_thanks;
} else {
$s_hidden_fields = build_hidden_fields(array('truncate' => true));
//display mode
confirm_box(false, 'TRUNCATE_THANKS', $s_hidden_fields);
trigger_error($user->lang['TRUNCATE_NO_THANKS'] . adm_back_link($this->u_action));
}
}
$template->assign_vars(array('ALLTHANKS' => $all_thanks, 'POSTSTHANKS' => $all_posts_thanks, 'USERSTHANKS' => $all_users_thanks, 'POSTSEND' => $end_posts_thanks, 'USERSEND' => $end_users_thanks, 'THANKSEND' => $end_thanks, 'S_TRUNCATE' => $truncate));
}
示例13: main
function main($id, $mode)
{
global $config, $db, $user, $auth, $template;
global $phpbb_root_path, $phpEx;
// Quick var-checking and var setup.
$submit = isset($_POST['submit']) ? true : false;
$action = request_var('action', '');
$errors = array();
$merge = $action == 'merge' ? true : false;
$old_username = utf8_normalize_nfc(request_var('old_username', '', true));
$new_username = utf8_normalize_nfc(request_var('new_username', '', true));
// Setup some things for the module.
$user->add_lang(array('mods/info_acp_user_merge', 'mods/lang_user_merge'));
$this->tpl_name = 'acp_user_merge';
$form_key = 'acp_user_merge';
add_form_key($form_key);
// Hath we an invalid form key?
if ($submit && !check_form_key($form_key)) {
$errors[] = $user->lang['FORM_INVALID'];
}
if ($submit || $merge) {
$old_user_id = $this->check_user($old_username, $errors, true);
$new_user_id = $this->check_user($new_username, $errors, false);
}
// Make sure we have submitted the form, and that we do not have errors
if (($submit || $merge) && !sizeof($errors)) {
// Have we confirmed this change?
if (confirm_box(true)) {
// Let's roll!
user_merge($old_user_id, $new_user_id);
add_log('admin', 'LOG_USERS_MERGED', $old_username . ' » ' . $new_username);
trigger_error($user->lang['USERS_MERGED'] . adm_back_link($this->u_action));
} else {
$hidden_fields = array('i' => $id, 'mode' => $mode, 'old_username' => $old_username, 'new_username' => $new_username, 'action' => 'merge');
// Be annoying. Are you suuuuuuuuuuuure? No, really, are you sure?
confirm_box(false, $user->lang['MERGE_USERS_CONFIRM'], build_hidden_fields($hidden_fields));
}
}
$user_merge_version = !empty($config['user_merge_version']) ? $config['user_merge_version'] : '';
// Assign template stuffs now.
$this->page_title = $user->lang['ACP_USER_MERGE_TITLE'];
$template->assign_vars(array('S_ERROR' => sizeof($errors) ? true : false, 'ERROR_MSG' => implode('<br />', $errors), 'USER_MERGE_VERSION' => $user_merge_version, 'U_FIND_OLD_USERNAME' => append_sid("{$phpbb_root_path}memberlist.{$phpEx}", 'mode=searchuser&form=user_merge&field=old_username&select_single=true'), 'U_FIND_NEW_USERNAME' => append_sid("{$phpbb_root_path}memberlist.{$phpEx}", 'mode=searchuser&form=user_merge&field=new_username&select_single=true'), 'OLD_USERNAME' => !empty($old_user_id) ? $old_username : '', 'NEW_USERNAME' => !empty($new_user_id) ? $new_username : '', 'L_TITLE' => $user->lang['ACP_USER_MERGE_TITLE'], 'L_EXPLAIN' => $user->lang['ACP_USER_MERGE_EXPLAIN'], 'U_ACTION' => $this->u_action));
}
示例14: ucp_profile_reg_details_data
/**
* Delete the user
*
* @param type $event
*/
public function ucp_profile_reg_details_data($event)
{
$this->user->add_lang(array('acp/common', 'acp/users'));
$delete_type = request_var('delete_type', '');
$this->template->assign_vars(array('AUTH_DELETE_POSTS' => $this->auth->acl_get('u_self_delete_posts') ? true : false));
if ($event['submit'] && $delete_type) {
if ($this->user->data['user_type'] == USER_FOUNDER) {
$this->error[] = 'CANNOT_REMOVE_FOUNDER';
}
if (!sizeof($this->error)) {
if (confirm_box(true)) {
$delete_type = $this->auth->acl_get('u_self_delete_posts') ? $delete_type : 'remove';
user_delete($delete_type, $this->user->data['user_id'], $this->user->data['username']);
add_log('admin', 'LOG_USER_DELETED', $this->user->data['username']);
trigger_error($this->user->lang['USER_DELETED'] . '<br /><br />' . sprintf($this->user->lang['RETURN_INDEX'], '<a href="' . generate_board_url() . '">', '</a>'));
} else {
confirm_box(false, $this->user->lang['CONFIRM_OPERATION'], build_hidden_fields(array('delete' => 1, 'form_token' => $this->request->variable('form_token', ''), 'submit' => true, 'cur_password' => $this->request->variable('cur_password', '', true), 'delete_type' => $delete_type)));
}
}
}
}
示例15: handle_mark_actions
/**
* Handle all actions possible with marked messages
*/
function handle_mark_actions($user_id, $mark_action)
{
global $db, $user, $phpbb_root_path, $phpEx;
$msg_ids = request_var('marked_msg_id', array(0));
$cur_folder_id = request_var('cur_folder_id', PRIVMSGS_NO_BOX);
$confirm = isset($_POST['confirm']) ? true : false;
if (!sizeof($msg_ids)) {
return false;
}
switch ($mark_action) {
case 'mark_important':
$sql = 'UPDATE ' . PRIVMSGS_TO_TABLE . "\n\t\t\t\tSET pm_marked = 1 - pm_marked\n\t\t\t\tWHERE folder_id = {$cur_folder_id}\n\t\t\t\t\tAND user_id = {$user_id}\n\t\t\t\t\tAND " . $db->sql_in_set('msg_id', $msg_ids);
$db->sql_query($sql);
break;
case 'delete_marked':
if (confirm_box(true)) {
delete_pm($user_id, $msg_ids, $cur_folder_id);
$success_msg = sizeof($msg_ids) == 1 ? 'MESSAGE_DELETED' : 'MESSAGES_DELETED';
$redirect = append_sid("{$phpbb_root_path}ucp.{$phpEx}", 'i=pm&folder=' . $cur_folder_id);
meta_refresh(3, $redirect);
trigger_error($user->lang[$success_msg] . '<br /><br />' . sprintf($user->lang['RETURN_FOLDER'], '<a href="' . $redirect . '">', '</a>'));
} else {
$s_hidden_fields = array('cur_folder_id' => $cur_folder_id, 'mark_option' => 'delete_marked', 'submit_mark' => true, 'marked_msg_id' => $msg_ids);
confirm_box(false, 'DELETE_MARKED_PM', build_hidden_fields($s_hidden_fields));
}
break;
default:
return false;
}
return true;
}