11 public $mConfig =
null;
13 public function User_AbstractUserEditForm($userConfig)
20 parent::__construct();
21 $this->mConfig = $userConfig;
24 public function validateUname()
26 if ($this->
get(
'uname')) {
30 $userHandler=&xoops_gethandler(
'user');
32 if ($this->
get(
'uid') > 0) {
33 $criteria->add(
new Criteria(
'uid', $this->
get(
'uid'),
'<>'));
35 if ($userHandler->getCount($criteria) > 0) {
43 switch ($this->mConfig[
'uname_test_level']) {
45 $regex=
"/[^a-zA-Z0-9\_\-]/";
49 $regex=
"/[^a-zA-Z0-9\_\-<>\,\.\$\%\#\@\!\\\'\"]/";
53 $regex=
"/[\000-\040]/";
56 if (preg_match($regex, $this->
get(
'uname'))) {
63 foreach ($this->mConfig[
'bad_unames'] as $t_uname) {
64 if (!empty($t_uname) && preg_match(
"/{$t_uname}/i", $this->
get(
'uname'))) {
72 public function validateEmail()
74 if (strlen($this->
get(
'email')) > 0) {
75 foreach ($this->mConfig[
'bad_emails'] as $t_email) {
76 if (!empty($t_email) && preg_match(
"/{$t_email}/i", $this->
get(
'email'))) {
85 $userHandler=&xoops_gethandler(
'user');
87 if ($this->
get(
'uid') > 0) {
88 $criteria->add(
new Criteria(
'uid', $this->
get(
'uid'),
'<>'));
90 if ($userHandler->getCount($criteria) > 0) {
96 public function validateTimezone_offset()
98 $handler =& xoops_gethandler(
'timezone');
99 $obj =& $handler->get($this->
get(
'timezone_offset'));
100 if (!is_object($obj)) {
105 public function validateUrl()
107 $t_url = $this->
get(
'url');
108 if (strlen($t_url) > 0) {
109 if (!preg_match(
'/^https?(:\/\/[-_.!~*\'()a-zA-Z0-9;\/?:\@&=+\$,%#]+)$/', $t_url)) {
115 public function validatePass()
118 if (strlen($this->
get(
'pass')) > 0 && !preg_match(
'/^[\x21-\x7e]+$/', $this->
get(
'pass'))) {
120 $this->
set(
'pass',
null);
121 $this->
set(
'vpass',
null);
124 if (strlen($this->
get(
'pass'))>0||strlen($this->
get(
'vpass'))>0) {
125 if ($this->
get(
'pass')!=$this->
get(
'vpass')) {
127 $this->
set(
'pass',
null);
128 $this->
set(
'vpass',
null);