|
| 1 | +<?php |
| 2 | +/** |
| 3 | + * |
| 4 | + * This file is part of the phpBB Forum Software package. |
| 5 | + * |
| 6 | + * @copyright (c) phpBB Limited <https://www.phpbb.com> |
| 7 | + * @license GNU General Public License, version 2 (GPL-2.0) |
| 8 | + * |
| 9 | + * For full copyright and license information, please see |
| 10 | + * the docs/CREDITS.txt file. |
| 11 | + * |
| 12 | + */ |
| 13 | + |
| 14 | +namespace {EXTENSION.vendor_name}\{EXTENSION.extension_name}\ucp; |
| 15 | + |
| 16 | +class main_module |
| 17 | +{ |
| 18 | + var $u_action; |
| 19 | +
|
| 20 | + function main($id, $mode) |
| 21 | + { |
| 22 | + global $db, $request, $template, $user; |
| 23 | +
|
| 24 | + $this->tpl_name = 'ucp_demo_body'; |
| 25 | + $this->page_title = $user->lang('UCP_DEMO_TITLE'); |
| 26 | + add_form_key('acme/demo'); |
| 27 | +
|
| 28 | + $data = array( |
| 29 | + 'user_acme' => $request->variable('user_acme', $user->data['user_acme']), |
| 30 | + ); |
| 31 | +
|
| 32 | + if ($request->is_set_post('submit')) |
| 33 | + { |
| 34 | + if (!check_form_key('acme/demo')) |
| 35 | + { |
| 36 | + trigger_error('FORM_INVALID'); |
| 37 | + } |
| 38 | + |
| 39 | + $sql = 'UPDATE ' . USERS_TABLE . ' |
| 40 | + SET ' . $db->sql_build_array('UPDATE', $data) . ' |
| 41 | + WHERE user_id = ' . $user->data['user_id']; |
| 42 | + $db->sql_query($sql); |
| 43 | + |
| 44 | + meta_refresh(3, $this->u_action); |
| 45 | + $message = $user->lang('UCP_DEMO_SAVED') . '<br /><br />' . $user->lang('RETURN_UCP', '<a href="' . $this->u_action . '">', '</a>'); |
| 46 | + trigger_error($message); |
| 47 | + } |
| 48 | + |
| 49 | + $template->assign_vars(array( |
| 50 | + 'S_USER_ACME' => $data['user_acme'], |
| 51 | + 'S_UCP_ACTION' => $this->u_action, |
| 52 | + )); |
| 53 | + } |
| 54 | +} |
0 commit comments