示例#1
0
$em = EventManager::instance();
$user_id = null;
$user = null;
// Validate user
$vUserId = new Valid_UInt('user_id');
$vUserId->required();
if ($request->valid($vUserId)) {
    $user_id = $request->get('user_id');
    $user = $um->getUserById($user_id);
}
if (!$user_id || !$user) {
    $GLOBALS['Response']->addFeedback('error', 'Invalid user');
}
// Validate action
$vAction = new Valid_Whitelist('action', array('update_user'));
$vAction->required();
if ($request->valid($vAction)) {
    $action = $request->get('action');
} else {
    $action = '';
}
if ($request->isPost()) {
    if ($action == 'update_user') {
        /*
         * Update the user
         */
        $vDate = new Valid('expiry_date');
        $vDate->addRule(new Rule_Date());
        //$vDate->required();
        if (!$request->valid($vDate)) {
            $GLOBALS['Response']->addFeedback('error', $Language->getText('admin_usergroup', 'data_not_parsed'));
示例#2
0
} else {
    // Finish script, no output
    exit;
}
// Number of user to display
$limit = 15;
$list = array();
$isMember = false;
$isAdmin = false;
$isPrivate = false;
$user = UserManager::instance()->getCurrentUser();
if ($user->isRestricted()) {
    $isMember = true;
}
$vPrivate = new Valid_Whitelist('private', array('1'));
$vPrivate->required();
// Allow the autocomplete to include private projects only to super user
if ($request->valid($vPrivate) && $user->isSuperUser()) {
    $isPrivate = true;
}
$prjManager = ProjectManager::instance();
$nbProjectFound = 0;
$projects = $prjManager->searchProjectsNameLike($name, $limit, $nbProjectFound, $user, $isMember, $isAdmin, $isPrivate);
foreach ($projects as $project) {
    $list[] = $project->getPublicName() . " (" . $project->getUnixName() . ")";
}
$nbLeft = $nbProjectFound - $limit;
if ($nbLeft > 0) {
    $list[] = '<strong>' . $nbLeft . ' left ...</strong>';
}
//