36 if (!
$xoops->getConfig(
'welcome_type')) {
44 if (!is_object(
$user)) {
48 $xoopsMailer =
$xoops->getMailer();
49 if (
$xoops->getConfig(
'welcome_type') == 1 ||
$xoops->getConfig(
'welcome_type') == 3) {
50 $xoopsMailer->useMail();
52 if (
$xoops->getConfig(
'welcome_type') == 2 ||
$xoops->getConfig(
'welcome_type') == 3) {
53 $xoopsMailer->usePM();
55 $xoopsMailer->setTemplate(
'welcome.tpl');
57 $xoopsMailer->setToUsers(
$user);
58 if (
$xoops->getConfig(
'reg_disclaimer')) {
59 $xoopsMailer->assign(
'TERMSOFUSE',
$xoops->getConfig(
'reg_disclaimer'));
61 $xoopsMailer->assign(
'TERMSOFUSE',
'');
63 return $xoopsMailer->send();
74 $args = func_get_args();
75 $args_num = func_num_args();
100 if (is_object(
$user)) {
118 if (strrpos(
$email,
' ') > 0) {
122 if (!
$xoops->userIsAdmin) {
123 $bad_emails =
$xoops->getConfig(
'bad_emails');
124 if (!empty($bad_emails)) {
125 foreach ($bad_emails as $be) {
126 if (!empty($be) && preg_match(
'/' . $be .
'/i',
$email)) {
135 switch (
$xoops->getConfig(
'uname_test_level')) {
138 $restriction =
'/[^a-zA-Z0-9\_\-]/';
142 $restriction =
'/[^a-zA-Z0-9\_\-<>\,\.\$\%\#\@\!\\\'\']/';
146 $restriction =
'/[\000-\040]/';
149 if (empty(
$uname) || preg_match($restriction,
$uname)) {
153 if (!
$xoops->userIsAdmin) {
154 $maxuname =
$xoops->getConfig(
'maxuname');
155 if (!empty($maxuname) && mb_strlen(
$uname) > $maxuname) {
158 $minuname =
$xoops->getConfig(
'minuname');
159 if (!empty($minuname) && mb_strlen(
$uname) < $minuname) {
162 $bad_unames =
$xoops->getConfig(
'bad_unames');
163 if (!empty($bad_unames)) {
164 foreach ($bad_unames as $bu) {
165 if (!empty($bu) && preg_match(
'/' . $bu .
'/i',
$uname)) {
207 $minpass =
$xoops->getConfig(
'minpass');
208 if ((
$pass !=
'') && (!empty($minpass)) && (mb_strlen(
$pass) < $minpass)) {
224 public static function getIP($asString =
false)
228 if (!empty(
$_SERVER[
'HTTP_X_FORWARDED_FOR'])) {
229 $proxy_ip =
$_SERVER[
'HTTP_X_FORWARDED_FOR'];
231 if (!empty(
$_SERVER[
'HTTP_X_FORWARDED'])) {
232 $proxy_ip =
$_SERVER[
'HTTP_X_FORWARDED'];
234 if (!empty(
$_SERVER[
'HTTP_FORWARDED_FOR'])) {
235 $proxy_ip =
$_SERVER[
'HTTP_FORWARDED_FOR'];
237 if (!empty(
$_SERVER[
'HTTP_FORWARDED'])) {
238 $proxy_ip =
$_SERVER[
'HTTP_FORWARDED'];
243 if (!empty(
$_SERVER[
'HTTP_X_COMING_FROM'])) {
244 $proxy_ip =
$_SERVER[
'HTTP_X_COMING_FROM'];
246 if (!empty(
$_SERVER[
'HTTP_COMING_FROM'])) {
247 $proxy_ip =
$_SERVER[
'HTTP_COMING_FROM'];
255 if (!empty($proxy_ip) && preg_match(
'/^([0-9]{1,3}\.){3,3}[0-9]{1,3}/', $proxy_ip, $regs) && count($regs) > 0) {
261 $the_IP = ($asString) ? $the_IP : ip2long($the_IP);
278 if (!is_array($uids)) {
279 $uids = array($uids);
281 $userids = array_map(
'intval', array_filter($uids));
285 if (count($userids) > 0) {
287 $criteria->add(
new Criteria(
'uid',
"('" . implode(
',', array_unique($userids)) .
"')",
'IN'));
293 foreach ($rows as
$uid => $row) {
294 if ($usereal && $row[
'name']) {
295 $users[
$uid] =
$myts->htmlSpecialChars($row[
'name']);
297 $users[
$uid] =
$myts->htmlSpecialChars($row[
'uname']);
301 .
$uid .
'" title="' . $users[
$uid] .
'">' . $users[
$uid] .
'</a>';
305 if (in_array(0, $users,
true)) {
306 $users[0] =
$myts->htmlSpecialChars(
$xoops->getConfig(
'anonymous'));
320 public static function getUnameFromId($userid, $usereal =
false, $linked =
false)
324 $userid = intval($userid);
329 if (is_object(
$user)) {
330 if ($usereal &&
$user->getVar(
'name')) {
331 $username =
$user->getVar(
'name');
333 $username =
$user->getVar(
'uname');
335 if (!empty($linked)) {
337 . $userid .
'" title="' . $username .
'">' . $username .
'</a>';
341 if (empty($username)) {
342 $username =
$myts->htmlSpecialChars(
$xoops->getConfig(
'anonymous'));
const E_MUST_PROVIDE_PASSWORD
static getUnameFromId($userid, $usereal=false, $linked=false)
if($uname== ''||$pass== '') $member_handler
const EF_PASSWORD_MUST_BE_GREATER_THAN
static getUnameFromIds($uids, $usereal=false, $linked=false)
static sendWelcome($user)
const E_EMAIL_SHOULD_NOT_CONTAIN_SPACES
static getIP($asString=false)
if(!$xoops->isUser()) $uid
const E_PASSWORDS_MUST_MATCH
const EF_USERNAME_MUST_BE_MORE_THAN
const EF_USERNAME_MUST_BE_LESS_THAN