/** * Run the tool */ function run_tool() { global $db, $template; $step = request_var('step', 0); // Select the batch $sql = 'SELECT user_id, user_email, user_email_hash FROM ' . USERS_TABLE; $result = $db->sql_query_limit($sql, $this->batch_size, $step * $this->batch_size); $batch = $db->sql_fetchrowset($result); $db->sql_freeresult($result); if (!$batch) { trigger_error('UPDATE_EMAIL_HASHES_COMPLETE'); } foreach ($batch as $userrow) { $new_hash = phpbb_email_hash($userrow['user_email']); if ($userrow['user_email_hash'] == $new_hash) { // Skip if the hash hasn't changed continue; } // Update the field $sql = 'UPDATE ' . USERS_TABLE . " SET user_email_hash = '" . $new_hash . "'\n\t\t\t\tWHERE user_id = " . $userrow['user_id']; $db->sql_query($sql); } meta_refresh(0, append_sid(STK_INDEX, array('c' => 'support', 't' => 'update_email_hashes', 'submit' => true, 'step' => ++$step))); $template->assign_var('U_BACK_TOOL', false); trigger_error('UPDATE_EMAIL_HASHES_NOT_COMPLETE'); }
function main($id, $mode) { global $config, $db, $user, $table_prefix, $auth, $template, $phpbb_root_path, $phpEx; define('TABLE_PREFIX', $table_prefix); require_once 'class_ulogin.php'; $uLogin = new uLogin($db); if ($config['require_activation'] == USER_ACTIVATION_DISABLE) { trigger_error('UCP_REGISTER_DISABLE'); } if (!($user_id = $uLogin->auth())) { $user_id = $uLogin->register(); } if ($user_id) { $session = $user->session_create($user_id, 0, 1); } if (!$session) { page_header($user->lang['LOGIN'], false); $template->set_filenames(array('body' => 'login_body.html')); make_jumpbox(append_sid("{$phpbb_root_path}viewforum.{$phpEx}")); page_footer(); exit; } $redirect = request_var('redirect', "{$phpbb_root_path}index.{$phpEx}"); $message = $user->lang['LOGIN_REDIRECT']; $l_redirect = $redirect === "{$phpbb_root_path}index.{$phpEx}" || $redirect === "index.{$phpEx}" ? $user->lang['RETURN_INDEX'] : $user->lang['RETURN_PAGE']; $redirect = reapply_sid($redirect); if (defined('IN_CHECK_BAN') && $session['user_row']['user_type'] != USER_FOUNDER) { return false; } $redirect = meta_refresh(3, $redirect); trigger_error($message . '<br /><br />' . sprintf($l_redirect, '<a href="' . $redirect . '">', '</a>')); }
public function base() { $note = utf8_normalize_nfc($this->request->variable('note', '', true)); $submit = isset($_POST['submit']) ? true : false; $error = array(); // check if user s logged in, since this page can be used only after registration... if (!$this->user->data['is_registered']) { login_box($this->helper->route('vinny_usersnotes_controller')); } // ... and also this is not for bots (especially for bad ones :) if ($this->user->data['is_bot']) { redirect(append_sid("{$this->phpbb_root_path}index.{$this->phpEx}")); } $s_action = $this->helper->route('vinny_usersnotes_controller'); $s_hidden_fields = ''; add_form_key('postform'); // create a template variables $this->template->assign_vars(array('S_POST_ACTION' => $s_action, 'S_HIDDEN_FIELDS' => $s_hidden_fields, 'ERROR' => sizeof($error) ? implode('<br />', $error) : '')); if ($submit) { /*if(!check_form_key('postform')) { trigger_error('FORM_INVALID'); }*/ $sql = 'UPDATE ' . USERS_TABLE . ' SET user_note = "' . $note . '" WHERE user_id = ' . $this->user->data['user_id']; $this->db->sql_query($sql); meta_refresh(3, $this->helper->route('vinny_usersnotes_controller')); trigger_error(sprintf($this->user->lang['NOTES_SAVED'], $this->helper->route('vinny_usersnotes_controller'))); } // create a template variables $this->template->assign_vars(array('NOTE' => $this->user->data['user_note'])); $this->template->assign_block_vars('navlinks', array('FORUM_NAME' => $this->user->lang['NOTES'])); return $this->helper->render('notes.html', $this->user->lang['NOTES']); }
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'; }
/** * Run tool. * * @return \Symfony\Component\HttpFoundation\Response */ public function run_tool() { $type = $this->request->variable('type', 'queue'); $start = $this->request->variable('start', 0); $continue_start = null; switch ($type) { case 'queue': $continue_start = $this->sync_queue_topics($start); if ($continue_start === null) { $type = 'contrib'; $continue_start = 0; } break; case 'contrib': $continue_start = $this->sync_contrib_topics($start); break; } if ($continue_start !== null) { $params = array('tool' => 'rebuild_topic_urls', 'type' => $type, 'submit' => 1, 'hash' => generate_link_hash('manage'), 'start' => $continue_start); meta_refresh(2, $this->controller_helper->route('phpbb.titania.administration.tool', $params)); } $msg = $continue_start !== null ? 'PLEASE_WAIT_FOR_TOOL' : 'DONE'; $this->template->assign_vars(array('MESSAGE_TEXT' => $this->user->lang($msg), 'MESSAGE_TITLE' => $this->user->lang('INFORMATION'))); return $this->controller_helper->render('message_body.html', $msg); }
/** * Run Tool * * Does the actual stuff we want the tool to do after submission */ function run_tool() { global $db, $template; $part = request_var('part', 0); $limit = 500; $i = 0; $sql = 'SELECT user_id, username, username_clean FROM ' . USERS_TABLE; $result = $db->sql_query_limit($sql, $limit, ($part * $limit)); while ($row = $db->sql_fetchrow($result)) { $i++; $username_clean = utf8_clean_string($row['username']); if ($username_clean != $row['username_clean']) { $db->sql_query('UPDATE ' . USERS_TABLE . " SET username_clean = '$username_clean' WHERE user_id = {$row['user_id']}"); } } $db->sql_freeresult($result); if ($i == $limit) { meta_refresh(0, append_sid(STK_INDEX, 't=reclean_usernames&submit=1&part=' . (++$part))); $template->assign_var('U_BACK_TOOL', false); trigger_error('RECLEAN_USERNAMES_NOT_COMPLETE'); } else { trigger_error('RECLEAN_USERNAMES_COMPLETE'); } }
function main($id, $mode) { global $config, $phpbb_root_path, $phpEx; global $db, $user, $auth, $template, $phpbb_container; if (!$config['allow_password_reset']) { trigger_error($user->lang('UCP_PASSWORD_RESET_DISABLED', '<a href="mailto:' . htmlspecialchars($config['board_contact']) . '">', '</a>')); } $username = request_var('username', '', true); $email = strtolower(request_var('email', '')); $submit = isset($_POST['submit']) ? true : false; if ($submit) { $sql = 'SELECT user_id, username, user_permissions, user_email, user_jabber, user_notify_type, user_type, user_lang, user_inactive_reason FROM ' . USERS_TABLE . "\n\t\t\t\tWHERE user_email_hash = '" . $db->sql_escape(phpbb_email_hash($email)) . "'\n\t\t\t\t\tAND username_clean = '" . $db->sql_escape(utf8_clean_string($username)) . "'"; $result = $db->sql_query($sql); $user_row = $db->sql_fetchrow($result); $db->sql_freeresult($result); if (!$user_row) { trigger_error('NO_EMAIL_USER'); } if ($user_row['user_type'] == USER_IGNORE) { trigger_error('NO_USER'); } if ($user_row['user_type'] == USER_INACTIVE) { if ($user_row['user_inactive_reason'] == INACTIVE_MANUAL) { trigger_error('ACCOUNT_DEACTIVATED'); } else { trigger_error('ACCOUNT_NOT_ACTIVATED'); } } // Check users permissions $auth2 = new \phpbb\auth\auth(); $auth2->acl($user_row); if (!$auth2->acl_get('u_chgpasswd')) { trigger_error('NO_AUTH_PASSWORD_REMINDER'); } $server_url = generate_board_url(); // Make password at least 8 characters long, make it longer if admin wants to. // gen_rand_string() however has a limit of 12 or 13. $user_password = gen_rand_string_friendly(max(8, mt_rand((int) $config['min_pass_chars'], (int) $config['max_pass_chars']))); // For the activation key a random length between 6 and 10 will do. $user_actkey = gen_rand_string(mt_rand(6, 10)); // Instantiate passwords manager $passwords_manager = $phpbb_container->get('passwords.manager'); $sql = 'UPDATE ' . USERS_TABLE . "\n\t\t\t\tSET user_newpasswd = '" . $db->sql_escape($passwords_manager->hash($user_password)) . "', user_actkey = '" . $db->sql_escape($user_actkey) . "'\n\t\t\t\tWHERE user_id = " . $user_row['user_id']; $db->sql_query($sql); include_once $phpbb_root_path . 'includes/functions_messenger.' . $phpEx; $messenger = new messenger(false); $messenger->template('user_activate_passwd', $user_row['user_lang']); $messenger->set_addresses($user_row); $messenger->anti_abuse_headers($config, $user); $messenger->assign_vars(array('USERNAME' => htmlspecialchars_decode($user_row['username']), 'PASSWORD' => htmlspecialchars_decode($user_password), 'U_ACTIVATE' => "{$server_url}/ucp.{$phpEx}?mode=activate&u={$user_row['user_id']}&k={$user_actkey}")); $messenger->send($user_row['user_notify_type']); meta_refresh(3, append_sid("{$phpbb_root_path}index.{$phpEx}")); $message = $user->lang['PASSWORD_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_INDEX'], '<a href="' . append_sid("{$phpbb_root_path}index.{$phpEx}") . '">', '</a>'); trigger_error($message); } $template->assign_vars(array('USERNAME' => $username, 'EMAIL' => $email, 'S_PROFILE_ACTION' => append_sid($phpbb_root_path . 'ucp.' . $phpEx, 'mode=sendpassword'))); $this->tpl_name = 'ucp_remind'; $this->page_title = 'UCP_REMIND'; }
function run_tool() { global $config, $db, $template; $step = request_var('step', 0); $begin = $this->_batch_size * $step; // Get the batch $sql = 'SELECT attach_id, physical_filename FROM ' . ATTACHMENTS_TABLE; $result = $db->sql_query_limit($sql, $this->_batch_size, $begin); $batch = $db->sql_fetchrowset($result); $db->sql_freeresult($result); if (empty($batch)) { // Nothing to do trigger_error('RESYNC_ATTACHMENTS_FINISHED'); } $delete_ids = array(); foreach ($batch as $row) { // Does the file still exists? $path = PHPBB_ROOT_PATH . $config['upload_path'] . "/{$row['physical_filename']}"; if (file_exists($path)) { // Yes, next please! continue; } $delete_ids[] = $row['attach_id']; } // Run all the queries if (!empty($delete_ids)) { $db->sql_query('DELETE FROM ' . ATTACHMENTS_TABLE . ' WHERE ' . $db->sql_in_set('attach_id', $delete_ids)); } // Next step $template->assign_var('U_BACK_TOOL', false); meta_refresh(3, append_sid(STK_INDEX, array('c' => 'admin', 't' => 'resync_attachments', 'step' => ++$step, 'submit' => true))); trigger_error('RESYNC_ATTACHMENTS_PROGRESS'); }
/** * 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'); }
/** * Run Tool * * Does the actual stuff we want the tool to do after submission */ function run_tool() { global $db, $template, $user, $phpbb_root_path, $phpEx; $part = request_var('part', 0); $limit = 500; $i = 0; $sql = 'SELECT user_id, username, username_clean FROM ' . USERS_TABLE; $result = $db->sql_query_limit($sql, $limit, $part * $limit); while ($row = $db->sql_fetchrow($result)) { $i++; $username_clean = $db->sql_escape(utf8_clean_string($row['username'])); if ($username_clean != $row['username_clean']) { $sql = 'SELECT user_id, username, username_clean FROM ' . USERS_TABLE . ' WHERE username_clean LIKE \'' . $username_clean . '\''; $res = $db->sql_query_limit($sql, 1); $duplicate = $db->sql_fetchrow($res); $db->sql_freeresult($res); if (!empty($duplicate)) { $url = append_sid("{$phpbb_root_path}adm/index.{$phpEx}", 'i=users&mode=overview&u=' . $duplicate['user_id'] . '&sid=' . $user->data['session_id']); $problem = append_sid("{$phpbb_root_path}adm/index.{$phpEx}", 'i=users&mode=overview&u=' . $row['user_id'] . '&sid=' . $user->data['session_id']); trigger_error(sprintf($user->lang['USER_ALREADY_EXISTS'], $duplicate['username'], $url, $row['username'], $problem), E_USER_WARNING); } $db->sql_query('UPDATE ' . USERS_TABLE . " SET username_clean = '{$username_clean}' WHERE user_id = {$row['user_id']}"); } } $db->sql_freeresult($result); if ($i == $limit) { meta_refresh(0, append_sid(STK_INDEX, 't=reclean_usernames&submit=1&part=' . ++$part)); $template->assign_var('U_BACK_TOOL', false); trigger_error('RECLEAN_USERNAMES_NOT_COMPLETE'); } else { trigger_error('RECLEAN_USERNAMES_COMPLETE'); } }
protected function set_personal_settings() { if ($this->request->is_set_post('submit')) { $gallery_settings = array('watch_own' => $this->request->variable('watch_own', false), 'watch_com' => $this->request->variable('watch_com', false), 'user_allow_comments' => $this->request->variable('allow_comments', false)); $additional_settings = array(); /** * Event set personal settings * * @event phpbbgallery.core.ucp.set_settings_submit * @var array additional_settings array of additional settings * @since 1.2.0 */ $vars = array('additional_settings'); extract($this->dispatcher->trigger_event('phpbbgallery.core.ucp.set_settings_submit', compact($vars))); $gallery_settings = array_merge($gallery_settings, $additional_settings); if (!$this->config['phpbb_gallery_allow_comments'] || !$this->config['phpbb_gallery_comment_user_control']) { unset($gallery_settings['user_allow_comments']); } $this->gallery_user->set_user_id($this->user->data['user_id']); $this->gallery_user->update_data($gallery_settings); meta_refresh(3, $this->u_action); trigger_error($this->user->lang['WATCH_CHANGED'] . '<br /><br />' . sprintf($this->user->lang['RETURN_UCP'], '<a href="' . $this->u_action . '">', '</a>')); } /** * Event no submit personal settings * * @event phpbbgallery.core.ucp.set_settings_nosubmit * @since 1.2.0 */ $this->dispatcher->dispatch('phpbbgallery.core.ucp.set_settings_nosubmit'); $this->template->assign_vars(array('S_PERSONAL_SETTINGS' => true, 'S_UCP_ACTION' => $this->u_action, 'L_TITLE' => $this->user->lang['UCP_GALLERY_SETTINGS'], 'L_TITLE_EXPLAIN' => $this->user->lang['WATCH_NOTE'], 'S_WATCH_OWN' => $this->gallery_user->get_data('watch_own'), 'S_WATCH_COM' => $this->gallery_user->get_data('watch_com'), 'S_ALLOW_COMMENTS' => $this->gallery_user->get_data('user_allow_comments'), 'S_COMMENTS_ENABLED' => $this->config['phpbb_gallery_allow_comments'] && $this->config['phpbb_gallery_comment_user_control'])); }
function main($id, $mode) { global $config, $phpbb_root_path, $phpEx; global $db, $user, $auth, $template; $user_id = request_var('u', 0); $key = request_var('k', ''); $sql = 'SELECT user_id, username, user_type, user_email, user_newpasswd, user_lang, user_notify_type, user_actkey, user_inactive_reason FROM ' . USERS_TABLE . "\n\t\t\tWHERE user_id = {$user_id}"; $result = $db->sql_query($sql); $user_row = $db->sql_fetchrow($result); $db->sql_freeresult($result); if (!$user_row) { trigger_error('NO_USER'); } if ($user_row['user_type'] != USER_INACTIVE && !$user_row['user_newpasswd']) { meta_refresh(3, append_sid("{$phpbb_root_path}index.{$phpEx}")); trigger_error('ALREADY_ACTIVATED'); } if ($user_row['user_inactive_reason'] == INACTIVE_MANUAL || $user_row['user_actkey'] != $key) { trigger_error('WRONG_ACTIVATION'); } $update_password = $user_row['user_newpasswd'] ? true : false; if ($update_password) { $sql_ary = array('user_actkey' => '', 'user_password' => $user_row['user_newpasswd'], 'user_newpasswd' => '', 'user_pass_convert' => 0, 'user_login_attempts' => 0); $sql = 'UPDATE ' . USERS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' WHERE user_id = ' . $user_row['user_id']; $db->sql_query($sql); } if (!$update_password) { include_once $phpbb_root_path . 'includes/functions_user.' . $phpEx; user_active_flip('activate', $user_row['user_id']); $sql = 'UPDATE ' . USERS_TABLE . "\n\t\t\t\tSET user_actkey = ''\n\t\t\t\tWHERE user_id = {$user_row['user_id']}"; $db->sql_query($sql); } if ($config['require_activation'] == USER_ACTIVATION_ADMIN && !$update_password) { include_once $phpbb_root_path . 'includes/functions_messenger.' . $phpEx; $messenger = new messenger(false); $messenger->template('admin_welcome_activated', $user_row['user_lang']); $messenger->to($user_row['user_email'], $user_row['username']); $messenger->headers('X-AntiAbuse: Board servername - ' . $config['server_name']); $messenger->headers('X-AntiAbuse: User_id - ' . $user->data['user_id']); $messenger->headers('X-AntiAbuse: Username - ' . $user->data['username']); $messenger->headers('X-AntiAbuse: User IP - ' . $user->ip); $messenger->assign_vars(array('USERNAME' => htmlspecialchars_decode($user_row['username']))); $messenger->send($user_row['user_notify_type']); $message = 'ACCOUNT_ACTIVE_ADMIN'; } else { if (!$update_password) { $message = $user_row['user_inactive_reason'] == INACTIVE_PROFILE ? 'ACCOUNT_ACTIVE_PROFILE' : 'ACCOUNT_ACTIVE'; } else { $message = 'PASSWORD_ACTIVATED'; } } meta_refresh(3, append_sid("{$phpbb_root_path}index.{$phpEx}")); trigger_error($user->lang[$message]); }
/** * Action for route /markpostunread/{return_forum_id}/{unread_post_id} * * Marks a post unread and displays a redirect message */ public function markpostunread($return_forum_id, $unread_post_id) { $this->user->add_lang_ext('kasimi/markpostunread', 'common'); $this->core->mark_unread_post($return_forum_id, $unread_post_id); $return_index = append_sid($this->core->root_path . 'index.' . $this->core->php_ext); $return_forum = append_sid($this->core->root_path . 'viewforum.' . $this->core->php_ext, 'f=' . $return_forum_id); meta_refresh(3, $return_forum); return $this->helper->message('MARKPOSTUNREAD_REDIRECT_FORMAT', array($this->user->lang('MARKPOSTUNREAD_MARKED_UNREAD'), sprintf($this->user->lang('RETURN_FORUM'), '<a href="' . $return_forum . '">', '</a>'), sprintf($this->user->lang('RETURN_INDEX'), '<a href="' . $return_index . '">', '</a>'))); }
function main($id, $mode) { global $config, $phpbb_root_path, $phpEx; global $db, $user, $auth, $template; $username = request_var('username', '', true); $email = strtolower(request_var('email', '')); $submit = isset($_POST['submit']) ? true : false; if ($submit) { $sql = 'SELECT user_id, username, user_permissions, user_email, user_jabber, user_notify_type, user_type, user_lang, user_inactive_reason FROM ' . USERS_TABLE . "\n\t\t\t\tWHERE user_email = '" . $db->sql_escape($email) . "'\n\t\t\t\t\tAND username_clean = '" . $db->sql_escape(utf8_clean_string($username)) . "'"; $result = $db->sql_query($sql); $user_row = $db->sql_fetchrow($result); $db->sql_freeresult($result); if (!$user_row) { trigger_error('NO_EMAIL_USER'); } if ($user_row['user_type'] == USER_IGNORE) { trigger_error('NO_USER'); } if ($user_row['user_type'] == USER_INACTIVE) { if ($user_row['user_inactive_reason'] == INACTIVE_MANUAL) { trigger_error('ACCOUNT_DEACTIVATED'); } else { trigger_error('ACCOUNT_NOT_ACTIVATED'); } } // Check users permissions $auth2 = new auth(); $auth2->acl($user_row); if (!$auth2->acl_get('u_chgpasswd')) { trigger_error('NO_AUTH_PASSWORD_REMINDER'); } $server_url = generate_board_url(); $key_len = 54 - strlen($server_url); $key_len = max(6, $key_len); // we want at least 6 $key_len = $config['max_pass_chars'] ? min($key_len, $config['max_pass_chars']) : $key_len; // we want at most $config['max_pass_chars'] $user_actkey = substr(gen_rand_string(10), 0, $key_len); $user_password = gen_rand_string(8); $sql = 'UPDATE ' . USERS_TABLE . "\n\t\t\t\tSET user_newpasswd = '" . $db->sql_escape(phpbb_hash($user_password)) . "', user_actkey = '" . $db->sql_escape($user_actkey) . "'\n\t\t\t\tWHERE user_id = " . $user_row['user_id']; $db->sql_query($sql); include_once $phpbb_root_path . 'includes/functions_messenger.' . $phpEx; $messenger = new messenger(false); $messenger->template('user_activate_passwd', $user_row['user_lang']); $messenger->to($user_row['user_email'], $user_row['username']); $messenger->im($user_row['user_jabber'], $user_row['username']); $messenger->assign_vars(array('USERNAME' => htmlspecialchars_decode($user_row['username']), 'PASSWORD' => htmlspecialchars_decode($user_password), 'U_ACTIVATE' => "{$server_url}/ucp.{$phpEx}?mode=activate&u={$user_row['user_id']}&k={$user_actkey}")); $messenger->send($user_row['user_notify_type']); meta_refresh(3, append_sid("{$phpbb_root_path}index.{$phpEx}")); $message = $user->lang['PASSWORD_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_INDEX'], '<a href="' . append_sid("{$phpbb_root_path}index.{$phpEx}") . '">', '</a>'); trigger_error($message); } $template->assign_vars(array('USERNAME' => $username, 'EMAIL' => $email, 'S_PROFILE_ACTION' => append_sid($phpbb_root_path . 'ucp.' . $phpEx, 'mode=sendpassword'))); $this->tpl_name = 'ucp_remind'; $this->page_title = 'UCP_REMIND'; }
function main($id, $mode) { global $config, $phpbb_root_path, $phpEx; global $db, $user, $auth, $template; $user_id = request_var('u', 0); $key = request_var('k', ''); $sql = 'SELECT user_id, username, user_type, user_email, user_newpasswd, user_lang, user_notify_type, user_actkey FROM ' . USERS_TABLE . "\n\t\t\tWHERE user_id = {$user_id}"; $result = $db->sql_query($sql); $user_row = $db->sql_fetchrow($result); $db->sql_freeresult($result); if (!$user_row) { trigger_error('NO_USER'); } if ($user_row['user_type'] != USER_INACTIVE && !$user_row['user_newpasswd']) { meta_refresh(3, append_sid("{$phpbb_root_path}index.{$phpEx}")); trigger_error('ALREADY_ACTIVATED'); } if ($user_row['user_actkey'] != $key) { trigger_error('WRONG_ACTIVATION'); } $update_password = $user_row['user_newpasswd'] ? true : false; if ($update_password) { $sql_ary = array('user_type' => USER_NORMAL, 'user_actkey' => '', 'user_password' => $user_row['user_newpasswd'], 'user_newpasswd' => ''); $sql = 'UPDATE ' . USERS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' WHERE user_id = ' . $user_row['user_id']; $db->sql_query($sql); } if (!$update_password) { include_once $phpbb_root_path . 'includes/functions_user.' . $phpEx; // Now we need to demote the user from the inactive group and add him to the registered group user_active_flip($user_row['user_id'], $user_row['user_type'], '', $user_row['username'], true); // Update last username update_last_username(); set_config('num_users', $config['num_users'] + 1, true); } if ($config['require_activation'] == USER_ACTIVATION_ADMIN && !$update_password) { include_once $phpbb_root_path . 'includes/functions_messenger.' . $phpEx; $messenger = new messenger(false); $messenger->template('admin_welcome_activated', $user_row['user_lang']); $messenger->replyto($config['board_contact']); $messenger->to($user_row['user_email'], $user_row['username']); $messenger->headers('X-AntiAbuse: Board servername - ' . $config['server_name']); $messenger->headers('X-AntiAbuse: User_id - ' . $user->data['user_id']); $messenger->headers('X-AntiAbuse: Username - ' . $user->data['username']); $messenger->headers('X-AntiAbuse: User IP - ' . $user->ip); $messenger->assign_vars(array('SITENAME' => $config['sitename'], 'USERNAME' => html_entity_decode($user_row['username']), 'EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . $config['board_email_sig']))); $messenger->send($user_row['user_notify_type']); $message = 'ACCOUNT_ACTIVE_ADMIN'; } else { $message = !$update_password ? 'ACCOUNT_ACTIVE' : 'PASSWORD_ACTIVATED'; } meta_refresh(3, append_sid("{$phpbb_root_path}index.{$phpEx}")); trigger_error($user->lang[$message]); }
/** * Check for permission to view topics * * @param object $event The event object * @return null * @access public */ public function viewtopic_before_f_read_check($event) { $forum_id = $event['forum_id']; if (!$this->check_auth($forum_id)) { $this->user->add_lang_ext('rmcgirr83/topicrestriction', 'common'); $link = append_sid("{$this->root_path}viewforum.{$this->php_ext}", "f={$forum_id}"); meta_refresh(3, $link); trigger_error('TOPIC_VIEW_NOTICE'); } }
function run_tool() { $section = phpbb::$request->variable('section', 0); $start = phpbb::$request->variable('start', 0); $limit = titania::$config->search_backend == 'solr' ? 250 : 100; $total = 0; $search_manager = phpbb::$container->get('phpbb.titania.search.manager'); $sync = phpbb::$container->get('phpbb.titania.sync'); switch ($section) { case 0: $search_manager->truncate(); $display_message = 'TRUNCATING_SEARCH'; break; case 1: $sql = 'SELECT COUNT(contrib_id) AS cnt FROM ' . TITANIA_CONTRIBS_TABLE; phpbb::$db->sql_query($sql); $total = phpbb::$db->sql_fetchfield('cnt'); phpbb::$db->sql_freeresult(); $sync->contribs('index', false, $start, $limit); $display_message = 'INDEXING_CONTRIBS'; break; case 2: $sql = 'SELECT COUNT(post_id) AS cnt FROM ' . TITANIA_POSTS_TABLE; phpbb::$db->sql_query($sql); $total = phpbb::$db->sql_fetchfield('cnt'); phpbb::$db->sql_freeresult(); $sync->posts('index', $start, $limit); $display_message = 'INDEXING_POSTS'; break; case 3: $sql = 'SELECT COUNT(faq_id) AS cnt FROM ' . TITANIA_CONTRIB_FAQ_TABLE; phpbb::$db->sql_query($sql); $total = phpbb::$db->sql_fetchfield('cnt'); phpbb::$db->sql_freeresult(); $sync->faqs('index', $start, $limit); $display_message = 'INDEXING_FAQ'; break; case 4: trigger_error('DONE'); break; } $params = array('tool' => 'reindex', 'section' => $section, 'submit' => 1, 'hash' => generate_link_hash('manage')); if ($start + $limit >= $total) { $params['section']++; } else { $params['start'] = $start + $limit; } // Move to the next step meta_refresh(0, phpbb::$container->get('controller.helper')->route('phpbb.titania.administration.tool', $params)); $display_message = phpbb::$user->lang[$display_message]; $section_status = $start + $limit < $total ? sprintf(phpbb::$user->lang['SECTION_STATUS'], $start + $limit, $total) : phpbb::$user->lang['DONE']; trigger_error(sprintf(phpbb::$user->lang['REINDEX_STATUS'], $display_message, $section, $section_status)); }
function main($id, $mode) { global $karmamod, $config, $db, $user, $auth, $template, $phpbb_root_path, $phpEx; $submit = isset($_POST['submit']) ? true : false; $error = $data = array(); $s_hidden_fields = ''; $data = array('enable' => $karmamod->config['enabled'] ? request_var('enable', (bool) $karmamod->config['user_enabled']) : (bool) $karmamod->config['enabled'], 'notify_email' => $karmamod->config['notify_email'] ? request_var('notify_email', (bool) $karmamod->config['user_notify_email']) : (bool) $karmamod->config['notify_email'], 'notify_pm' => $karmamod->config['notify_pm'] ? request_var('notify_pm', (bool) $karmamod->config['user_notify_pm']) : (bool) $karmamod->config['notify_pm'], 'notify_jabber' => $karmamod->config['notify_jabber'] ? request_var('notify_jabber', (bool) $karmamod->config['user_notify_jabber']) : (bool) $karmamod->config['notify_jabber'], 'toplist' => request_var('toplist', (bool) $karmamod->config['toplist']), 'toplist_users' => request_var('toplist_users', (int) $karmamod->config['toplist_users']), 'comments_per_page' => request_var('comments_per_page', (int) $user->data['user_karma_comments_per_page']), 'comments_self' => request_var('comments_self', (bool) $karmamod->config['comments_self']), 'karma_comments_sk' => request_var('comments_sk', !empty($user->data['user_karma_comments_sortby_type']) ? $user->data['user_karma_comments_sortby_type'] : 't'), 'karma_comments_sd' => request_var('comments_sd', !empty($user->data['user_karma_comments_sortby_dir']) ? $user->data['user_karma_comments_sortby_dir'] : 'd'), 'karma_comments_st' => request_var('comments_st', !empty($user->data['user_karma_comments_show_days']) ? $user->data['user_karma_comments_show_days'] : 0)); if ($submit) { if ($karmamod->config['comments']) { // Check that comments sort orders has only one symbol at value $error = validate_data($data, array('karma_comments_sk' => array('string', false, 1, 1), 'karma_comments_sd' => array('string', false, 1, 1))); } if (!sizeof($error)) { $sql_ary = array('user_karma_enable' => $data['enable'], 'user_karma_notify_email' => $data['notify_email'], 'user_karma_notify_pm' => $data['notify_pm'], 'user_karma_notify_jabber' => $data['notify_jabber'], 'user_karma_toplist' => $data['toplist'], 'user_karma_toplist_users' => $data['toplist_users'], 'user_karma_comments_per_page' => $data['comments_per_page'], 'user_karma_comments_self' => $data['comments_self'], 'user_karma_comments_sortby_type' => $data['karma_comments_sk'], 'user_karma_comments_sortby_dir' => $data['karma_comments_sd'], 'user_karma_comments_show_days' => $data['karma_comments_st']); $sql = 'UPDATE ' . USERS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' WHERE user_id = ' . $user->data['user_id']; $db->sql_query($sql); meta_refresh(3, $this->u_action); $message = $user->lang['UCP_KARMA_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], '<a href="' . $this->u_action . '">', '</a>'); trigger_error($message); } // Replace "error" strings with their real, localised form $error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '\\1'", $error); } // Comments ordering options $sort_dir_text = array('a' => $user->lang['ASCENDING'], 'd' => $user->lang['DESCENDING']); $limit_comments_days = array(0 => $user->lang['KARMA_ALL_COMMENTS'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']); $sort_by_comments_text = array('a' => $user->lang['AUTHOR'], 't' => $user->lang['KARMA_SORT_TIME'], 'p' => $user->lang['KARMA_SORT_POST'], 'o' => $user->lang['KARMA_SORT_TOPIC'], 'f' => $user->lang['KARMA_SORT_FORUM']); $sort_by_comments_sql = array('a' => 'u.username_clean', 't' => 'k.karma_time', 'p' => 'k.post_id', 'o' => 'k.topic_id', 'f' => 'k.forum_id'); $s_limit_comments_days = '<select name="comments_st">'; foreach ($limit_comments_days as $day => $text) { $selected = $data['karma_comments_st'] == $day ? ' selected="selected"' : ''; $s_limit_comments_days .= '<option value="' . $day . '"' . $selected . '>' . $text . '</option>'; } $s_limit_comments_days .= '</select>'; $s_sort_comments_key = '<select name="comments_sk">'; foreach ($sort_by_comments_text as $key => $text) { $selected = $data['karma_comments_sk'] == $key ? ' selected="selected"' : ''; $s_sort_comments_key .= '<option value="' . $key . '"' . $selected . '>' . $text . '</option>'; } $s_sort_comments_key .= '</select>'; $s_sort_comments_dir = '<select name="comments_sd">'; foreach ($sort_dir_text as $key => $value) { $selected = $data['karma_comments_sd'] == $key ? ' selected="selected"' : ''; $s_sort_comments_dir .= '<option value="' . $key . '"' . $selected . '>' . $value . '</option>'; } $s_sort_comments_dir .= '</select>'; $template->assign_vars(array('ERROR' => sizeof($error) ? implode('<br />', $error) : '', 'S_ENABLE' => $data['enable'], 'S_NOTIFY_EMAIL' => $data['notify_email'], 'S_NOTIFY_PM' => $data['notify_pm'], 'S_NOTIFY_JABBER' => $data['notify_jabber'], 'S_TOPLIST' => $data['toplist'], 'S_COMMENTS_SELF' => $karmamod->config['comments_self'] ? true : false, 'TOPLIST_USERS' => $data['toplist_users'], 'COMMENTS_PER_PAGE' => $data['comments_per_page'], 'S_COMMENTS_SORT_DAYS' => $s_limit_comments_days, 'S_COMMENTS_SORT_KEY' => $s_sort_comments_key, 'S_COMMENTS_SORT_DIR' => $s_sort_comments_dir, 'S_ENABLE_SELECT' => $karmamod->config['enabled_ucp'] ? true : false, 'S_NOTIFY_EMAIL_SELECT' => $karmamod->config['notify_email'] && $config['email_enable'] ? true : false, 'S_NOTIFY_PM_SELECT' => $karmamod->config['notify_pm'] && $config['allow_privmsg'] ? true : false, 'S_NOTIFY_JABBER_SELECT' => $karmamod->config['notify_jabber'] && $config['jab_enable'] ? true : false, 'S_TOPLIST_SELECT' => $karmamod->config['toplist'] ? true : false, 'S_COMMENTS_SELECT' => $karmamod->config['comments'] ? true : false)); $template->assign_vars(array('L_TITLE' => $user->lang['UCP_KARMA'], 'S_HIDDEN_FIELDS' => $s_hidden_fields, 'S_UCP_ACTION' => $this->u_action)); $this->tpl_name = 'karma_ucp'; $this->page_title = 'UCP_KARMA'; }
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; } }
function display_options() { global $template, $user, $db; $user->add_lang('groups'); $settings_value = request_var('settings', array('' => ''), true); $groups = request_var('user_groups', array(0)); $all_groups = request_var('all_groups', 0); $submit = request_var('sa', false); $user_settings = array(0 => 'viewimg', 1 => 'viewflash', 2 => 'viewsmilies', 3 => 'viewsigs', 4 => 'viewavatars', 5 => 'viewcensors', 6 => 'attachsig', 7 => '', 8 => 'bbcode', 9 => 'smilies', 10 => '', 11 => '', 12 => '', 13 => '', 14 => '', 15 => 'sig_bbcode', 16 => 'sig_smilies', 17 => 'sig_links'); $sql = 'SELECT group_id, group_name FROM ' . GROUPS_TABLE; $result = $db->sql_query($sql); $s_options = ''; while ($row = $db->sql_fetchrow($result)) { $group_name = isset($user->lang['G_' . $row['group_name'] . '']) ? $user->lang['G_' . $row['group_name'] . ''] : $row['group_name']; $s_options .= '<option value="' . $row['group_id'] . '">' . $group_name; } $db->sql_freeresult($result); $s_options .= '</option>'; foreach ($user_settings as $bit => $settings) { if ($settings) { $template->assign_block_vars('settings', array('SETTINGS' => $settings, 'BIT' => $bit, 'SETTINGS_NAME' => $user->lang[$settings])); } } $template->assign_vars(array('S_OPTIONS' => $s_options, 'U_DISPLAY_ACTION' => append_sid(STK_INDEX, array('c' => 'user_group', 't' => 'user_options')))); $template->set_filenames(array('body' => 'tools/user_options.html')); if ($submit) { if (!sizeof($groups) || $all_groups) { $sql_where = ''; } else { $sql_where = ' WHERE ' . $db->sql_in_set('group_id', $groups) . ''; } foreach ($settings_value as $bit => $settings) { if ($settings) { if ($settings == 1) { $sql = 'UPDATE ' . USERS_TABLE . ' SET user_options = (user_options & ' . pow(2, $bit) . ') ^ user_options' . $sql_where; } else { $sql = 'UPDATE ' . USERS_TABLE . ' SET user_options = user_options | ' . pow(2, $bit) . '' . $sql_where; } $db->sql_query($sql); } } meta_refresh(3, append_sid(STK_ROOT_PATH . 'index.' . PHP_EXT, 'c=usergroup&t=user_options')); trigger_error($user->lang['USER_OPTIONS_OK']); } page_header($user->lang['USER_OPTIONS'], false); page_footer(); }
function run_tool() { $section = request_var('section', 0); $start = request_var('start', 0); $limit = titania::$config->search_backend == 'solr' ? 1000 : 100; $total = 0; $sync = new titania_sync(); switch ($section) { case 0: titania_search::truncate(); $display_message = 'Truncating Search'; break; case 1: $sql = 'SELECT COUNT(contrib_id) AS cnt FROM ' . TITANIA_CONTRIBS_TABLE; phpbb::$db->sql_query($sql); $total = phpbb::$db->sql_fetchfield('cnt'); phpbb::$db->sql_freeresult(); $sync->contribs('index', false, $start, $limit); $display_message = 'Indexing Contributions'; break; case 2: $sql = 'SELECT COUNT(post_id) AS cnt FROM ' . TITANIA_POSTS_TABLE; phpbb::$db->sql_query($sql); $total = phpbb::$db->sql_fetchfield('cnt'); phpbb::$db->sql_freeresult(); $sync->posts('index', $start, $limit); $display_message = 'Indexing Posts'; break; case 3: $sql = 'SELECT COUNT(faq_id) AS cnt FROM ' . TITANIA_CONTRIB_FAQ_TABLE; phpbb::$db->sql_query($sql); $total = phpbb::$db->sql_fetchfield('cnt'); phpbb::$db->sql_freeresult(); $sync->faqs('index', $start, $limit); $display_message = 'Indexing FAQ'; break; case 4: trigger_back('Done!'); break; } if ($start + $limit >= $total) { // Move to the next step meta_refresh(0, titania_url::build_url('manage/administration', array('t' => 'reindex', 'section' => $section + 1, 'submit' => 1, 'hash' => generate_link_hash('manage')))); } else { // Move to the next step meta_refresh(0, titania_url::build_url('manage/administration', array('t' => 'reindex', 'section' => $section, 'start' => $start + $limit, 'submit' => 1, 'hash' => generate_link_hash('manage')))); } trigger_error($display_message . ' - section ' . $section . ' of 3 - ' . ($start + $limit < $total ? 'part ' . ($start + $limit) . ' of ' . $total : 'Done')); }
/** * 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)); } } }
/** * Main module handler. * * @param string $short_name Module short name * @param string $mode Module mode * @return null */ public function main($short_name, $mode) { try { $this->controller->base($mode, $this->u_action); } catch (\Exception $e) { $message = $e->getMessage() . '<br /><br />' . $this->user->lang('RETURN_UCP', '<a href="' . $this->u_action . '">', '</a>'); meta_refresh(3, $this->u_action); trigger_error($message); } $style_path = $this->ext_root . 'styles/' . rawurlencode($this->user->style['style_path']) . '/'; $u_ucp = append_sid($this->phpbb_root_path . 'ucp.' . $this->php_ext); $this->template->assign_vars(array('S_ACTION' => $this->u_action, 'TITANIA_THEME_PATH' => $style_path . 'theme/')); $this->p_master->assign_tpl_vars($u_ucp); $this->template->set_filenames(array('body' => '@phpbb_titania/ucp/subscriptions.html')); page_header($this->user->lang['SUBSCRIPTION_TITANIA']); page_footer(); }
function main($module_id, $mode) { global $db, $user, $auth, $template, $cache, $request; global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx; $user->add_lang_ext('phpbbireland/portal', 'k_config'); $this->tpl_name = 'acp_config'; $this->page_title = $user->lang['ACP_CONFIG']; add_form_key('config'); $action = $request->variable('action', ''); $mode = $request->variable('mode', ''); $generate = $request->variable('generate', ''); $data = $this->check_version(); $submit = isset($_POST['submit']) ? true : false; $forum_id = $request->variable('f', 0); $forum_data = $errors = array(); if ($request->is_set_post('submit')) { if (!check_form_key('config')) { trigger_error('FORM_INVALID'); } } $blocks_width = $config['blocks_width']; $blocks_enabled = $config['blocks_enabled']; $portal_version = $config['portal_version']; $portal_build = $config['portal_build']; if ($data['version']) { $template->assign_vars(array('MOD_ANNOUNCEMENT' => $data['announcement'][0], 'MOD_CURRENT_VERSION' => $config['portal_version'], 'MOD_DOWNLOAD' => $data['download'][0], 'MOD_LATEST_VERSION' => $data['version'], 'MOD_TITLE' => $data['title'][0], 'S_UP_TO_DATE' => $data['version'] > $config['portal_version'] ? false : true)); } $template->assign_vars(array('S_BLOCKS_WIDTH' => $blocks_width, 'S_BLOCKS_ENABLED' => $blocks_enabled, 'S_PORTAL_VERSION' => $portal_version, 'S_PORTAL_BUILD' => $portal_build, 'U_BACK' => $this->u_action, 'S_OPT' => 'configure', 'S_MOD_DATA' => $data['version'] ? true : false)); if ($submit) { $mode = 'save'; } else { $mode = 'reset'; } switch ($mode) { case 'save': $config->set('blocks_width', $request->variable('blocks_width', 180)); $config->set('blocks_enabled', $request->variable('blocks_enabled', 1)); $config->set('portal_build', $request->variable('portal_build', '')); $mode = 'reset'; $template->assign_var('S_OPT', 'save'); meta_refresh(0, $this->u_action); return; case 'default': break; } }
/** * Get image information */ public static function get_info($image_id, $extended_info = true) { global $db, $user; $sql_array = array('SELECT' => '*', 'FROM' => array(GALLERY_IMAGES_TABLE => 'i'), 'WHERE' => 'i.image_id = ' . (int) $image_id); if ($extended_info) { $sql_array['LEFT_JOIN'] = array(array('FROM' => array(GALLERY_WATCH_TABLE => 'w'), 'ON' => 'i.image_id = w.image_id AND w.user_id = ' . $user->data['user_id']), array('FROM' => array(GALLERY_FAVORITES_TABLE => 'f'), 'ON' => 'i.image_id = f.image_id AND f.user_id = ' . $user->data['user_id'])); } $sql = $db->sql_build_query('SELECT', $sql_array); $result = $db->sql_query($sql); $row = $db->sql_fetchrow($result); $db->sql_freeresult($result); if (!$row) { meta_refresh(3, phpbb_gallery_url::append_sid('index')); trigger_error('IMAGE_NOT_EXIST'); } return $row; }
/** * Main method, is called by p_master to run the module */ public function main($mode, $id) { // Fetch all the data $fid = request_var('f', 0); $pid = request_var('prefixid', 0); $red = request_var('redirect', 'index.' . PHP_EXT); $tid = request_var('t', 0); $red = reapply_sid($red); // Get the prefix data $tree = $forums = array(); sp_phpbb::$cache->obtain_prefix_forum_tree($tree, $forums); // Nothing for this forum if (empty($tree[$fid])) { return; } // Fetch the current data for this forum $sql = 'SELECT subject_prefix_id FROM ' . TOPICS_TABLE . ' WHERE topic_id = ' . $tid; $result = sp_phpbb::$db->sql_query($sql); $_c_pid = sp_phpbb::$db->sql_fetchfield('subject_prefix_id', false, $result); sp_phpbb::$db->sql_freeresult($result); // No change if ($pid == $_c_pid) { meta_refresh(2, $red); trigger_error(sp_phpbb::$user->lang['PREFIX_NOT_CHANGED'] . '<br /><br />' . sprintf(sp_phpbb::$user->lang['RETURN_PAGE'], '<a href="' . $red . '">', '</a>')); } // The selected prefix can be used in this forum? if (!isset($tree[$fid][$pid]) && $pid > 0) { meta_refresh(2, $red); trigger_error(sp_phpbb::$user->lang['PREFIX_NOT_ALLOWED'] . '<br /><br />' . sprintf(sp_phpbb::$user->lang['RETURN_PAGE'], '<a href="' . $red . '">', '</a>')); } // Update $sql = 'UPDATE ' . TOPICS_TABLE . ' SET subject_prefix_id = ' . $pid . ' WHERE topic_id = ' . $tid; sp_phpbb::$db->sql_query($sql); if (sp_phpbb::$db->sql_affectedrows() == -1) { trigger_error('PREFIX_UPDATE_FAILED'); } else { sp_cache::subject_prefix_quick_clear(); meta_refresh(2, $red); trigger_error(sp_phpbb::$user->lang['PREFIX_UPDATED_SUCCESS'] . '<br /><br />' . sprintf(sp_phpbb::$user->lang['RETURN_PAGE'], '<a href="' . $red . '">', '</a>')); } }
public function main($id, $mode) { global $db, $user, $auth, $template, $phpbb_root_path, $phpEx; global $request, $phpbb_container, $phpbb_log; $user->add_lang_ext('jv/deletemyregistration', 'ucp'); $error = array(); $submit = $request->variable('submit', false, false, \phpbb\request\request_interface::POST); $delete_acc = $request->variable('delete_acc', false, false, \phpbb\request\request_interface::POST); $delete_post = $request->variable('delete_post', false, false, \phpbb\request\request_interface::POST) && $auth->acl_get('u_my_acc_post_delete') ? true : false; $user_password = $request->variable('user_password', '', true); add_form_key('my_acc_delete'); if ($submit) { if (!check_form_key('my_acc_delete')) { $error[] = 'FORM_INVALID'; } if (!$delete_acc) { $error[] = 'MY_ACC_DELETE_CONFIRM_ERROR'; } if ($user->data['user_type'] == USER_FOUNDER) { $error[] = 'MY_ACC_DELETE_FOUNDER_ERROR'; } // Instantiate passwords manager $passwords_manager = $phpbb_container->get('passwords.manager'); if (!$passwords_manager->check($user_password, $user->data['user_password'])) { $error[] = 'CUR_PASSWORD_ERROR'; } if (!sizeof($error) && $submit) { $delete_type = $delete_post ? 'remove' : 'retain'; $log_type = $delete_post ? 'LOG_MY_ACC_POST_DELETE' : 'LOG_MY_ACC_DELETE'; $additional_data = array('reportee_id' => 0, $user->data['username']); $phpbb_log->add('user', ANONYMOUS, $user->ip, $log_type, time(), $additional_data); user_delete($delete_type, $user->data['user_id'], $user->data['username']); meta_refresh(5, append_sid($phpbb_root_path . 'index.' . $phpEx)); trigger_error('MY_ACC_DELETE_SUCCESS'); } // Replace "error" strings with their real, localised form $error = array_map(array($user, 'lang'), $error); } $template->assign_vars(array('S_ERROR' => sizeof($error) ? true : false, 'S_DELETE_MY_POST' => $auth->acl_get('u_my_acc_post_delete') ? true : false, 'S_UCP_ACTION' => $this->u_action, 'L_TITLE' => $user->lang['UCP_PROFILE_' . strtoupper($mode)], 'ERROR' => sizeof($error) ? implode('<br />', $error) : '', 'CONFIRM_CHECKED' => $delete_acc ? ' checked="checked"' : '', 'POST_CHECKED' => $delete_post ? ' checked="checked"' : '')); // Set desired template $this->tpl_name = 'ucp_profile_' . $mode; $this->page_title = 'UCP_PROFILE_' . strtoupper($mode); }
function main($id, $mode) { global $cache, $config, $db, $user, $auth, $template, $phpbb_root_path, $phpEx, $request; $submit = isset($_POST['submit']) ? true : false; $error = $data = array(); switch ($mode) { case 'configuration': $data = array('user_mchat_index' => $request->variable('user_mchat_index', (bool) $user->data['user_mchat_index']), 'user_mchat_sound' => $request->variable('user_mchat_sound', (bool) $user->data['user_mchat_sound']), 'user_mchat_stats_index' => $request->variable('user_mchat_stats_index', (bool) $user->data['user_mchat_stats_index']), 'user_mchat_topics' => $request->variable('user_mchat_topics', (bool) $user->data['user_mchat_topics']), 'user_mchat_avatars' => $request->variable('user_mchat_avatars', (bool) $user->data['user_mchat_avatars']), 'user_mchat_input_area' => $request->variable('user_mchat_input_area', (bool) $user->data['user_mchat_input_area']), 'user_mchat_mobile_before' => $request->variable('user_mchat_mobile_before', (bool) $user->data['user_mchat_mobile_before']), 'user_mchat_follow' => $request->variable('user_mchat_follow', (bool) $user->data['user_mchat_follow']), 'user_mchat_titleflash_duration' => $request->variable('user_mchat_titleflash_duration', (int) $user->data['user_mchat_titleflash_duration']), 'user_mchat_capitalization' => $request->variable('user_mchat_capitalization', (bool) $user->data['user_mchat_capitalization'])); add_form_key('ucp_mchat'); if ($submit) { if (!check_form_key('ucp_mchat')) { $error[] = 'FORM_INVALID'; } if (!sizeof($error)) { $sql_ary = array('user_mchat_index' => $data['user_mchat_index'], 'user_mchat_sound' => $data['user_mchat_sound'], 'user_mchat_stats_index' => $data['user_mchat_stats_index'], 'user_mchat_topics' => $data['user_mchat_topics'], 'user_mchat_avatars' => $data['user_mchat_avatars'], 'user_mchat_input_area' => $data['user_mchat_input_area'], 'user_mchat_mobile_before' => $data['user_mchat_mobile_before'], 'user_mchat_follow' => $data['user_mchat_follow'], 'user_mchat_titleflash_duration' => $data['user_mchat_titleflash_duration'], 'user_mchat_capitalization' => $data['user_mchat_capitalization']); if (sizeof($sql_ary)) { $sql = 'UPDATE ' . USERS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' WHERE user_id = ' . (int) $user->data['user_id']; $db->sql_query($sql); } meta_refresh(3, $this->u_action); $message = $user->lang['PROFILE_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], '<a href="' . $this->u_action . '">', '</a>'); trigger_error($message); } // Replace "error" strings with their real, localised form // The /e modifier is deprecated since PHP 5.5.0 //$error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '\\1'", $error); foreach ($error as $i => $err) { $lang = $this->user->lang($err); if (!empty($lang)) { $error[$i] = $lang; } } } $template->assign_vars(array('ERROR' => sizeof($error) ? implode('<br />', $error) : '', 'S_DISPLAY_MCHAT' => $data['user_mchat_index'], 'S_SOUND_MCHAT' => $data['user_mchat_sound'], 'S_STATS_MCHAT' => $data['user_mchat_stats_index'], 'S_TOPICS_MCHAT' => $data['user_mchat_topics'], 'S_AVATARS_MCHAT' => $data['user_mchat_avatars'], 'S_INPUT_MCHAT' => $data['user_mchat_input_area'], 'S_MOBILE_MCHAT' => $data['user_mchat_mobile_before'], 'S_MCHAT_FOLLOW' => $data['user_mchat_follow'], 'S_MCHAT_TITLEFLASHDURATION' => $data['user_mchat_titleflash_duration'], 'S_MCHAT_CAPITALIZATION' => $data['user_mchat_capitalization'], 'S_MCHAT_TOPICS' => $config['mchat_new_posts_edit'] || $config['mchat_new_posts_quote'] || $config['mchat_new_posts_reply'] || $config['mchat_new_posts_topic'], 'S_MCHAT_LOCATION' => $config['mchat_location'], 'S_MCHAT_INDEX' => $config['mchat_on_index'] || $config['mchat_stats_index'], 'S_MCHAT_INDEX_STATS' => $config['mchat_stats_index'], 'S_MCHAT_AVATARS' => $config['avatars'])); break; } $template->assign_vars(array('L_TITLE' => $user->lang['UCP_PROFILE_MCHAT'], 'S_UCP_ACTION' => $this->u_action)); // Set desired template $this->tpl_name = 'ucp_mchat'; $this->page_title = 'UCP_PROFILE_MCHAT'; }
function main($id, $mode) { global $cache, $config, $db, $user, $auth, $template, $phpbb_root_path, $phpEx, $request; global $phpbb_container; $this->functions_mchat = $phpbb_container->get('dmzx.mchat.functions_mchat'); // $user->add_lang('mods/mchat_lang'); $submit = isset($_POST['submit']) ? true : false; $error = $data = array(); switch ($mode) { case 'configuration': $data = array('user_mchat_index' => $request->variable('user_mchat_index', (bool) $user->data['user_mchat_index']), 'user_mchat_sound' => $request->variable('user_mchat_sound', (bool) $user->data['user_mchat_sound']), 'user_mchat_stats_index' => $request->variable('user_mchat_stats_index', (bool) $user->data['user_mchat_stats_index']), 'user_mchat_topics' => $request->variable('user_mchat_topics', (bool) $user->data['user_mchat_topics']), 'user_mchat_avatars' => $request->variable('user_mchat_avatars', (bool) $user->data['user_mchat_avatars']), 'user_mchat_input_area' => $request->variable('user_mchat_input_area', (bool) $user->data['user_mchat_input_area'])); add_form_key('ucp_mchat'); if ($submit) { if (!check_form_key('ucp_mchat')) { $error[] = 'FORM_INVALID'; } if (!sizeof($error)) { $sql_ary = array('user_mchat_index' => $data['user_mchat_index'], 'user_mchat_sound' => $data['user_mchat_sound'], 'user_mchat_stats_index' => $data['user_mchat_stats_index'], 'user_mchat_topics' => $data['user_mchat_topics'], 'user_mchat_avatars' => $data['user_mchat_avatars'], 'user_mchat_input_area' => $data['user_mchat_input_area']); if (sizeof($sql_ary)) { $sql = 'UPDATE ' . USERS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' WHERE user_id = ' . (int) $user->data['user_id']; $db->sql_query($sql); } meta_refresh(3, $this->u_action); $message = $user->lang['PROFILE_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], '<a href="' . $this->u_action . '">', '</a>'); trigger_error($message); } // Replace "error" strings with their real, localised form $error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '\\1'", $error); } if (($mchat_cache = $cache->get('_mchat_config')) === false) { $this->functions_mchat->mchat_cache(); } $mchat_cache = $cache->get('_mchat_config'); $template->assign_vars(array('ERROR' => sizeof($error) ? implode('<br />', $error) : '', 'S_DISPLAY_MCHAT' => $data['user_mchat_index'], 'S_SOUND_MCHAT' => $data['user_mchat_sound'], 'S_STATS_MCHAT' => $data['user_mchat_stats_index'], 'S_TOPICS_MCHAT' => $data['user_mchat_topics'], 'S_AVATARS_MCHAT' => $data['user_mchat_avatars'], 'S_INPUT_MCHAT' => $data['user_mchat_input_area'], 'S_MCHAT_TOPICS' => $config['mchat_new_posts'], 'S_MCHAT_INDEX' => $config['mchat_on_index'] || $config['mchat_stats_index'] ? true : false, 'S_MCHAT_AVATARS' => $mchat_cache['avatars'])); break; } $template->assign_vars(array('L_TITLE' => $user->lang['UCP_PROFILE_MCHAT'], 'S_UCP_ACTION' => $this->u_action)); // Set desired template $this->tpl_name = 'ucp_mchat'; $this->page_title = 'UCP_PROFILE_MCHAT'; }
/** * Handle running tool. * * @return JsonResponse */ public function handle() { $this->user->add_lang_ext('phpbb/titania', 'manage_tools'); $this->check_auth(); $result = $this->run(); $result['message'] = $this->user->lang($result['message']); $next_call = null; if ($result['next_batch'] !== false) { $params = $this->get_next_params($result); $next_call = $this->helper->route($this->tool->get_route(), $params); } if ($this->request->is_ajax()) { return new JsonResponse(array_merge($result, array('next_call' => str_replace('&', '&', $next_call)))); } if ($next_call) { meta_refresh(3, $next_call); } return $this->helper->message($result['message']); }