1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* Users Class Manager |
4
|
|
|
* |
5
|
|
|
* You may not change or alter any portion of this comment or credits |
6
|
|
|
* of supporting developers from this source code or any supporting source code |
7
|
|
|
* which is considered copyrighted (c) material of the original comment or credit authors. |
8
|
|
|
* This program is distributed in the hope that it will be useful, |
9
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
10
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
11
|
|
|
* |
12
|
|
|
* @copyright (c) 2000-2016 XOOPS Project (www.xoops.org) |
13
|
|
|
* @license GNU GPL 2 (https://www.gnu.org/licenses/gpl-2.0.html) |
14
|
|
|
* @package system |
15
|
|
|
*/ |
16
|
|
|
// defined('XOOPS_ROOT_PATH') || exit('XOOPS root path not defined'); |
17
|
|
|
|
18
|
|
|
include_once XOOPS_ROOT_PATH . '/kernel/user.php'; |
19
|
|
|
|
20
|
|
|
/** |
21
|
|
|
* System Users |
22
|
|
|
* |
23
|
|
|
* @copyright (c) 2000-2016 XOOPS Project (www.xoops.org) |
24
|
|
|
* @package system |
25
|
|
|
*/ |
26
|
|
|
class SystemUsers extends XoopsUser |
27
|
|
|
{ |
28
|
|
|
/** |
29
|
|
|
* |
30
|
|
|
*/ |
31
|
|
|
public function __construct() |
32
|
|
|
{ |
33
|
|
|
parent::__construct(); |
34
|
|
|
} |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* @return XoopsThemeForm |
38
|
|
|
*/ |
39
|
|
|
public function getForm() |
40
|
|
|
{ |
41
|
|
|
if ($this->isNew()) { |
42
|
|
|
$blank_img = 'blank.gif'; |
43
|
|
|
} else { |
44
|
|
|
$blank_img = $this->getVar('avatar_file', 'e'); |
45
|
|
|
} |
46
|
|
|
// Get User Config |
47
|
|
|
/** @var XoopsConfigHandler $config_handler */ |
48
|
|
|
$config_handler = xoops_getHandler('config'); |
49
|
|
|
$xoopsConfigUser = $config_handler->getConfigsByCat(XOOPS_CONF_USER); |
50
|
|
|
|
51
|
|
|
$form = new XoopsThemeForm(_AM_SYSTEM_AVATAR_ADD, 'avatar_form', 'admin.php', 'post', true); |
52
|
|
|
$form->setExtra('enctype="multipart/form-data"'); |
53
|
|
|
$form->addElement(new XoopsFormText(_IMAGENAME, 'avatar_name', 50, 255, $this->getVar('avatar_name', 'e')), true); |
|
|
|
|
54
|
|
|
|
55
|
|
|
$maxpixel = '<div class="small basic italic">' . _US_MAXPIXEL . ' : ' . $xoopsConfigUser['avatar_width'] . ' x ' . $xoopsConfigUser['avatar_height'] . '</div>'; |
56
|
|
|
$maxsize = '<div class="small basic italic">' . _US_MAXIMGSZ . ' : ' . $xoopsConfigUser['avatar_maxsize'] . '</div>'; |
57
|
|
|
|
58
|
|
|
$uploadirectory_img = ''; |
59
|
|
|
$imgtray_img = new XoopsFormElementTray(_IMAGEFILE . '<br><br>' . $maxpixel . $maxsize, '<br>'); |
60
|
|
|
$imageselect_img = new XoopsFormSelect(sprintf(_AM_SYSTEM_AVATAR_USE_FILE, XOOPS_UPLOAD_PATH), 'avatar_file', $blank_img); |
61
|
|
|
$image_array_img = XoopsLists::getImgListAsArray(XOOPS_UPLOAD_PATH); |
62
|
|
|
$imageselect_img->addOption("$blank_img", $blank_img); |
63
|
|
|
foreach ($image_array_img as $image_img) { |
64
|
|
|
// if (preg_match('#avt#', $image_img)) { |
65
|
|
|
if (false !== strpos($image_img, 'avt')) { |
66
|
|
|
$imageselect_img->addOption("$image_img", $image_img); |
67
|
|
|
} |
68
|
|
|
} |
69
|
|
|
$imageselect_img->setExtra("onchange='showImgSelected(\"image_img\", \"avatar_file\", \"" . $uploadirectory_img . "\", \"\", \"" . XOOPS_UPLOAD_URL . "\")'"); |
70
|
|
|
$imgtray_img->addElement($imageselect_img, false); |
71
|
|
|
$imgtray_img->addElement(new XoopsFormLabel('', "<br><img src='" . XOOPS_UPLOAD_URL . '/' . $blank_img . "' name='image_img' id='image_img' alt='' />")); |
72
|
|
|
$fileseltray_img = new XoopsFormElementTray('<br>', '<br><br>'); |
73
|
|
|
$fileseltray_img->addElement(new XoopsFormFile(_AM_SYSTEM_AVATAR_UPLOAD, 'avatar_file', 500000), false); |
74
|
|
|
$imgtray_img->addElement($fileseltray_img); |
75
|
|
|
$form->addElement($imgtray_img); |
76
|
|
|
|
77
|
|
|
$form->addElement(new XoopsFormText(_IMGWEIGHT, 'avatar_weight', 3, 4, $this->getVar('avatar_weight', 'e'))); |
78
|
|
|
$form->addElement(new XoopsFormRadioYN(_IMGDISPLAY, 'avatar_display', $this->getVar('avatar_display', 'e'), _YES, _NO)); |
|
|
|
|
79
|
|
|
$form->addElement(new XoopsFormHidden('op', 'save')); |
80
|
|
|
$form->addElement(new XoopsFormHidden('fct', 'avatars')); |
81
|
|
|
$form->addElement(new XoopsFormHidden('avatar_id', $this->getVar('avatar_id', 'e'))); |
|
|
|
|
82
|
|
|
$form->addElement(new XoopsFormButton('', 'avt_button', _SUBMIT, 'submit')); |
83
|
|
|
|
84
|
|
|
return $form; |
85
|
|
|
} |
86
|
|
|
} |
87
|
|
|
|
88
|
|
|
/** |
89
|
|
|
* System users handler class. (Singelton) |
90
|
|
|
* |
91
|
|
|
* This class is responsible for providing data access mechanisms to the data source |
92
|
|
|
* of XOOPS block class objects. |
93
|
|
|
* |
94
|
|
|
* @copyright (c) 2000-2016 XOOPS Project (www.xoops.org) |
95
|
|
|
* @package system |
96
|
|
|
* @subpackage avatar |
97
|
|
|
*/ |
98
|
|
|
class SystemUsersHandler extends XoopsUserHandler |
99
|
|
|
{ |
100
|
|
|
/** |
101
|
|
|
* @param null|XoopsDatabase $db |
102
|
|
|
*/ |
103
|
|
|
public function __construct(XoopsDatabase $db) |
104
|
|
|
{ |
105
|
|
|
parent::__construct($db); |
106
|
|
|
$this->className = 'SystemUsers'; |
107
|
|
|
} |
108
|
|
|
} |
109
|
|
|
|