XOOPS
2.6.0
Main Page
Related Pages
Classes
Files
Examples
File List
File Members
users.php
Go to the documentation of this file.
1
<?php
2
/*
3
You may not change or alter any portion of this comment or credits
4
of supporting developers from this source code or any supporting source code
5
which is considered copyrighted (c) material of the original comment or credit authors.
6
7
This program is distributed in the hope that it will be useful,
8
but WITHOUT ANY WARRANTY; without even the implied warranty of
9
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10
*/
11
26
// Get main instance
27
$xoops
=
Xoops::getInstance
();
28
29
// Check users rights
30
if
(!
$xoops
->isUser() || !
$xoops
->isModule() || !
$xoops
->user->isAdmin(
$xoops
->module->mid())) {
31
exit
(
XoopsLocale::E_NO_ACCESS_PERMISSION
);
32
}
33
34
// Check is active
35
if
(!
$xoops
->getModuleConfig(
'active_users'
,
'system'
)) {
36
$xoops
->redirect(
'admin.php'
, 2,
XoopsLocale::E_SECTION_NOT_ACTIVE
);
37
}
38
39
/*********************************************************/
40
/* Users Functions */
41
/*********************************************************/
50
function
synchronize
(
$uid
,
$type
)
51
{
52
$xoops
=
Xoops::getInstance
();
53
$db =
$xoops
->db();
54
55
switch
(
$type
) {
56
case
'user'
:
57
$total_posts = 0;
58
/* @var $plugin SystemPluginInterface */
59
$plugins = \Xoops\Module\Plugin::getPlugins();
60
foreach
($plugins as $plugin) {
61
if
(
$res
= $plugin->userPosts(
$uid
)) {
62
$total_posts +=
$res
;
63
}
64
}
65
66
$query
= $db->createXoopsQueryBuilder()
67
->updatePrefix(
'users'
)
68
->set(
'posts'
,
':posts'
)
69
->where(
'uid = :uid'
)
70
->setParameter(
':posts'
, $total_posts)
71
->setParameter(
':uid'
,
$uid
);
72
73
$result
=
$query
->execute();
74
//if (!$result) {
75
// $xoops->redirect("admin.php?fct=users", 1, XoopsLocale::E_USER_NOT_UPDATED);
76
//}
77
break
;
78
79
case
'all users'
:
80
$sql
= $db->createXoopsQueryBuilder()
81
->select(
'uid'
)
82
->fromPrefix(
'users'
,
'u'
);
83
84
$result
=
$sql
->execute();
85
if
(!
$result
) {
86
$xoops
->redirect(
"admin.php?fct=users"
, 1,
XoopsLocale::E_USER_ID_NOT_FETCHED
);
87
}
88
$rows =
$result
->fetchAll();
89
foreach
($rows as $row) {
90
synchronize
($row[
'uid'
],
"user"
);
91
}
92
break
;
93
}
94
}
$res
if(!$dbm->isConnectable()) $res
Definition:
page_siteinit.php:119
Xoops\getInstance
static getInstance()
Definition:
Xoops.php:160
synchronize
if(!$xoops->isUser()||!$xoops->isModule()||!$xoops->user->isAdmin($xoops->module->mid())) if(!$xoops->getModuleConfig('active_users', 'system')) synchronize($uid, $type)
Definition:
users.php:50
XoopsLocaleEn_US\E_SECTION_NOT_ACTIVE
const E_SECTION_NOT_ACTIVE
Definition:
en_US.php:362
$query
$query
Definition:
index.php:37
$result
$result
Definition:
pda.php:33
XoopsLocaleEn_US\E_USER_ID_NOT_FETCHED
const E_USER_ID_NOT_FETCHED
Definition:
en_US.php:375
exit
exit
Definition:
browse.php:104
$uid
if(!$xoops->isUser()) $uid
Definition:
index.php:31
$sql
$sql
Definition:
pda.php:32
XoopsLocaleEn_US\E_NO_ACCESS_PERMISSION
const E_NO_ACCESS_PERMISSION
Definition:
en_US.php:351
$type
$type
Definition:
misc.php:33
$xoops
$xoops
Definition:
users.php:27
usr64
htdocs
modules
system
admin
users
users.php
Generated on Fri May 22 2015 03:07:04 for XOOPS by
1.8.9.1