Пример #1
0
 /**
  * save the new value for the access list for the passed user
  */
 function setFieldAccessList($id_user, $data)
 {
     $preference = new UserPreferences($id_user);
     $ser_value = addslashes(serialize($data));
     $result = $preference->setPreference('user_rules.field_policy', $ser_value);
     $result = $preference->setPreference('user_rules.online_status', $data['online_status']);
     if ($result) {
         $this->_field_access_list[$id_user] = $data;
     }
     return $result;
 }
Пример #2
0
function adminManager_lang_course()
{
    checkPerm('view');
    require_once _base_ . '/lib/lib.form.php';
    $lang =& DoceboLanguage::createInstance('adminrules', 'framework');
    $adminidst = importVar('adminidst', true, 0);
    $user_pref = new UserPreferences($adminidst);
    if (isset($_POST['save'])) {
        $re = $user_pref->setPreference('admin_rules.user_lang_assigned', isset($_POST['admin_lang']) ? urlencode(serialize($_POST['admin_lang'])) : '');
        Util::jump_to('index.php?modname=admin_manager&op=view&result=' . ($re ? 1 : 0));
    }
    $all_languages = Docebo::langManager()->getAllLangCode();
    $assigned_lang = unserialize(urldecode($user_pref->getAdminPreference('admin_rules.user_lang_assigned')));
    $GLOBALS['page']->add(getTitleArea($lang->def('_ADMIN_MANAGMENT'), 'admin_managmer', $lang->def('_ADMIN_MANAGMENT')) . '<div class="std_block">' . Form::getFormHeader($lang->def('_SELECT_LANG_TO_ASSIGN')) . Form::openForm('admin_lang_editing', 'index.php?modname=admin_manager&amp;op=edit_lang') . Form::openElementSpace() . Form::getHidden('adminidst', 'adminidst', $adminidst), 'content');
    while (list(, $lang_code) = each($all_languages)) {
        $GLOBALS['page']->add(Form::getCheckbox('<img src="' . getPathImage('cms') . 'language/' . $lang_code . '.png" alt="' . $lang_code . '" /> ' . $lang_code, 'admin_lang_' . $lang_code, 'admin_lang[' . $lang_code . ']', '1', isset($assigned_lang[$lang_code])), 'content');
    }
    $GLOBALS['page']->add(Form::closeElementSpace() . Form::openButtonSpace() . Form::getButton('save', 'save', $lang->def('_SAVE')) . Form::getButton('undo_pref', 'undo_pref', $lang->def('_UNDO')) . Form::closeButtonSpace() . Form::closeForm() . '</div>', 'content');
}
Пример #3
0
 function org_waitingUser()
 {
     checkPerm('approve_waiting_user', false, 'directory', 'framework');
     require_once _base_ . '/lib/lib.form.php';
     require_once $GLOBALS['where_framework'] . '/lib/lib.field.php';
     require_once _base_ . '/lib/lib.table.php';
     require_once _base_ . '/lib/lib.usermanager.php';
     if (isset($_POST['ok_waiting'])) {
         $user_man = new UserManager();
         // Remove refused users
         $refused = array();
         $aopproved = array();
         if (isset($_POST['waiting_user_refuse'])) {
             while (list($idst) = each($_POST['waiting_user_refuse'])) {
                 $this->aclManager->deleteTempUser($idst, false, false, true);
             }
             $refused[] = $idst;
         }
         // Subscribed accepted users
         if (isset($_POST['waiting_user_accept'])) {
             $idst_usergroup = $this->aclManager->getGroup(false, ADMIN_GROUP_USER);
             $idst_usergroup = $idst_usergroup[ACL_INFO_IDST];
             $idst_oc = $this->aclManager->getGroup(false, '/oc_0');
             $idst_oc = $idst_oc[ACL_INFO_IDST];
             $idst_ocd = $this->aclManager->getGroup(false, '/ocd_0');
             $idst_ocd = $idst_ocd[ACL_INFO_IDST];
             $request = $this->aclManager->getTempUsers(false, true);
             while (list($idst) = each($_POST['waiting_user_accept'])) {
                 if ($this->aclManager->registerUser(addslashes($request[$idst]['userid']), addslashes($request[$idst]['firstname']), addslashes($request[$idst]['lastname']), $request[$idst]['pass'], addslashes($request[$idst]['email']), '', '', true, $idst)) {
                     $approved[] = $idst;
                     $this->aclManager->addToGroup($idst_usergroup, $idst);
                     $this->aclManager->addToGroup($idst_oc, $idst);
                     $this->aclManager->addToGroup($idst_ocd, $idst);
                     if ($request[$idst]['create_by_admin'] != 0) {
                         $pref = new UserPreferences($request[$idst]['create_by_admin']);
                         if ($pref->getAdminPreference('admin_rules.limit_user_insert') == 'on') {
                             $max_insert = $pref->getAdminPreference('admin_rules.max_user_insert');
                             $pref->setPreference('admin_rules.max_user_insert', $max_insert - 1);
                         }
                     }
                     $this->aclManager->deleteTempUser($idst, false, false, false);
                 }
             }
         }
         require_once _base_ . '/lib/lib.platform.php';
         require_once _base_ . '/lib/lib.eventmanager.php';
         // send the alert
         /*
         			if(!empty($refused)) {
         
         				$array_subst = array('[url]' => Get::sett('url'));
         
         				$msg_composer = new EventMessageComposer('admin_directory', 'framework');
         
         				$msg_composer->setSubjectLangText('email', '_REFUSED_USER_SBJ', false);
         				$msg_composer->setBodyLangText('email', '_REFUSED_USER_TEXT', $array_subst);
         
         				$msg_composer->setBodyLangText('sms', '_REFUSED_USER_TEXT_SMS', $array_subst);
         
         				createNewAlert(	'UserApproved', 'directory', 'edit', '1', 'Users refused',
         							$refused, $msg_composer );
         			}*/
         if (!empty($approved)) {
             $pl_man =& PlatformManager::createInstance();
             $array_subst = array('[url]' => Get::sett('url', ''));
             $msg_composer2 = new EventMessageComposer('admin_directory', 'framework');
             $msg_composer2->setSubjectLangText('email', '_APPROVED_USER_SBJ', false);
             $msg_composer2->setBodyLangText('email', '_APPROVED_USER_TEXT', $array_subst);
             $msg_composer2->setBodyLangText('sms', '_APPROVED_USER_TEXT_SMS', $array_subst);
             createNewAlert('UserApproved', 'directory', 'edit', '1', 'Users approved', $approved, $msg_composer2, true);
         }
         Util::jump_to('index.php?modname=directory&op=org_chart');
     } elseif (isset($_POST['cancel_waiting'])) {
         Util::jump_to('index.php?modname=directory&op=org_chart');
     } else {
         $tb = new Table(0, $this->lang->def('_WAITING_USERS'), $this->lang->def('_WAITING_USER_SUMMARY'));
         $type_h = array('', '', '', 'image', 'image');
         $cont_h = array($this->lang->def('_USERNAME'), $this->lang->def('_DIRECTORY_FULLNAME'), $this->lang->def('_BY'), '<img src="' . getPathImage('framework') . 'directory/wuser_accept.gif" alt="' . $this->lang->def('_ACCEPT') . '" ' . 'title="' . $this->lang->def('_ACCEPT_USER') . '" />', '<img src="' . getPathImage('framework') . 'directory/wuser_refuse.gif" alt="' . $this->lang->def('_REFUSE_USER') . '" ' . 'title="' . $this->lang->def('_REFUSE_USER_TITLE') . '" />');
         $tb->setColsStyle($type_h);
         $tb->addHead($cont_h);
         $temp_users = $this->aclManager->getTempUsers(false, true);
         if ($temp_users !== false) {
             $idst_admins = array();
             while (list($idst, $info) = each($temp_users)) {
                 if ($info['create_by_admin'] != 0) {
                     $idst_admins[] = $info['create_by_admin'];
                 }
             }
             $admins = $this->aclManager->getUsers($idst_admins);
             reset($temp_users);
             while (list($idst, $info) = each($temp_users)) {
                 if ($info['create_by_admin'] != 0) {
                     $creator = $admins[$info['create_by_admin']][ACL_INFO_LASTNAME] . ' ' . $admins[$info['create_by_admin']][ACL_INFO_FIRSTNAME];
                     if ($creator == '') {
                         $creator = $this->aclManager->relativeId($admins[$info['create_by_admin']][ACL_INFO_USERID]);
                     }
                 } else {
                     $creator = $this->lang->def('_DIRECOTRY_SELFREGISTERED');
                 }
                 $more = isset($_GET['id_user']) && $_GET['id_user'] == $idst ? '<a href="index.php?modname=directory&amp;op=org_waitinguser"><img src="' . getPathImage() . 'standard/less.gif"></a> ' : '<a href="index.php?modname=directory&amp;op=org_waitinguser&amp;id_user='******'"><img src="' . getPathImage() . 'standard/more.gif"></a> ';
                 $cont = array($more . $this->aclManager->relativeId($info['userid']), $info['lastname'] . ' ' . $info['firstname'], $creator, Form::getInputCheckbox('waiting_user_accept_' . $idst, 'waiting_user_accept[' . $idst . ']', $idst, false, '') . Form::getLabel('waiting_user_accept_' . $idst, $this->lang->def('_ACCEPT'), 'access-only'), Form::getInputCheckbox('waiting_user_refuse_' . $idst, 'waiting_user_refuse[' . $idst . ']', $idst, false, '') . Form::getLabel('waiting_user_refuse_' . $idst, $this->lang->def('_REFUSE_USER'), 'access-only'));
                 $tb->addBody($cont);
                 if (isset($_GET['id_user']) && $idst == $_GET['id_user']) {
                     $field = new FieldList();
                     $tb->addBodyExpanded($field->playFieldsForUser($idst, false, true), 'user_specific_info');
                 }
             }
         }
         $GLOBALS['page']->add(getTitleArea($this->lang->def('_WAITING_USERS'), 'directory') . '<div class="std_block">' . Form::openForm('waiting_user', 'index.php?modname=directory&amp;op=org_waitinguser') . $tb->getTable() . Form::openButtonSpace() . Form::getButton('ok_waiting', 'ok_waiting', $this->lang->def('_SAVE')) . Form::getButton('cancel_waiting', 'cancel_waiting', $this->lang->def('_UNDO')) . Form::closeButtonSpace() . Form::closeForm() . '</div>', 'content');
     }
 }
Пример #4
0
function approveusers()
{
    checkPerm('moderate', false, 'course');
    require_once $GLOBALS['where_lms'] . '/lib/lib.course.php';
    require_once _base_ . '/lib/lib.preference.php';
    $id_course = importVar('id_course', true, 0);
    $course_info = Man_Course::getCourseInfo($id_course);
    $edition_id = getCourseEditionId();
    $re = true;
    $approve_user = array();
    $deny_user = array();
    if (isset($_POST['waiting_user'])) {
        $man_course = new Man_Course();
        $waiting_users =& $man_course->getWaitingSubscribed($id_course);
        $tot_deny = array();
        require_once _lms_ . '/lib/lib.course.php';
        $docebo_course = new DoceboCourse($id_course);
        $group_levels = $docebo_course->getCourseLevel($id_course);
        while (list($id_user, $action) = each($_POST['waiting_user'])) {
            if ($action == 0) {
                // approved -----------------------------------------------
                $text_query = "\r\n\t\t\t\tUPDATE " . $GLOBALS['prefix_lms'] . "_courseuser\r\n\t\t\t\tSET waiting = 0, \r\n\t\t\t\t\tstatus = '" . _CUS_SUBSCRIBED . "'\r\n\t\t\t\tWHERE idCourse = '" . $id_course . "' AND idUser = '******' ";
                $text_query .= "AND edition_id='" . $edition_id . "'";
                $result = sql_query($text_query);
                if ($result) {
                    $approve_user[] = $id_user;
                }
                $re &= $result;
            } elseif ($action == 1) {
                // refused --------------------------------------------------
                $level = $waiting_users['users_info'][$id_user]['level'];
                $sub_by = $waiting_users['users_info'][$id_user]['subscribed_by'];
                $result = removeSubscription($id_course, $id_user, $group_levels[$level], $edition_id);
                if ($sub_by != 0 && $id_user != $sub_by) {
                    if (isset($tot_deny[$sub_by])) {
                        $tot_deny[$sub_by]++;
                    } else {
                        $tot_deny[$sub_by] = 1;
                    }
                }
                if ($result) {
                    $deny_user[] = $id_user;
                }
                $re &= $result;
            }
        }
    }
    if (!empty($tot_deny)) {
        while (list($id_user, $inc) = each($tot_deny)) {
            $pref = new UserPreferences($id_user);
            $max_subscribe = $pref->getAdminPreference('admin_rules.max_course_subscribe');
            $pref->setPreference('admin_rules.max_course_subscribe', $max_subscribe + $inc);
        }
    }
    require_once _base_ . '/lib/lib.eventmanager.php';
    $array_subst = array('[url]' => Get::sett('url'), '[course]' => $course_info['name']);
    if (!empty($approve_user)) {
        $msg_composer = new EventMessageComposer();
        $msg_composer->setSubjectLangText('email', '_APPROVED_SUBSCRIBED_SUBJECT', false);
        $msg_composer->setBodyLangText('email', '_APPROVED_SUBSCRIBED_TEXT', $array_subst);
        $msg_composer->setBodyLangText('email', "\n\n" . $_POST['subscribe_accept'], array(), true);
        $msg_composer->setBodyLangText('sms', '_APPROVED_SUBSCRIBED_TEXT_SMS', $array_subst);
        // send message to the user subscribed
        createNewAlert('UserCourseInserted', 'subscribe', 'approve', '1', 'User course approve', $approve_user, $msg_composer, true);
    }
    if (!empty($deny_user)) {
        $msg_composer = new EventMessageComposer();
        $msg_composer->setSubjectLangText('email', '_DENY_SUBSCRIBED_SUBJECT', false);
        $msg_composer->setBodyLangText('email', '_DENY_SUBSCRIBED_TEXT', $array_subst);
        $msg_composer->setBodyLangText('email', "\n\n" . $_POST['subscribe_refuse'], array(), true);
        $msg_composer->setSubjectLangText('sms', '_DENY_SUBSCRIBED_SUBJECT_SMS', false);
        $msg_composer->setBodyLangText('sms', '_DENY_SUBSCRIBED_TEXT_SMS', $array_subst);
        // send message to the user subscribed
        createNewAlert('UserCourseInserted', 'subscribe', 'deny', '1', 'User course deny', $deny_user, $msg_composer, true);
    }
    backcourse($re ? 'ok' : 'err');
}
 public function callback()
 {
     return false;
     $pl = Get::gReq('pl', DOTY_STRING);
     switch ($pl) {
         case "twitter":
             $twitter = new EpiTwitter($this->conf['twitter_key'], $this->conf['twitter_secret']);
             $oauth_token = Get::gReq('oauth_token', DOTY_STRING);
             $twitter->setToken($oauth_token);
             $resp = $twitter->getAccessToken();
             echo $resp->oauth_token . "<br />";
             echo $resp->oauth_token_secret . "<br />";
             var_dump($resp->oauth_callback_confirmed);
             echo "<br />";
             $twitter->setToken($resp->oauth_token, $resp->oauth_token_secret);
             require_once _base_ . '/lib/lib.preference.php';
             $preference = new UserPreferences(getLogUserId());
             $preference->setPreference('social.twitter_key', $resp->oauth_token);
             $preference->setPreference('social.twitter_secret', $resp->oauth_token_secret);
             $statusText = 'Prova 01';
             //$res =$twitter->post('/statuses/update.json', array('status' => $statusText));
             //echo $res->text;
             break;
     }
 }
Пример #6
0
 function _opt_in($options, $platform, $opt_link)
 {
     $social = new Social();
     $lang =& DoceboLanguage::createInstance('register', $platform);
     // Check for error
     $out = '';
     $error = $this->_checkField($_POST, $options, $platform, true);
     if ($error['error']) {
         $this->error = true;
         return '<div class="reg_err_data">' . $error['msg'] . '</div>';
     }
     // Insert temporary
     $random_code = md5($_POST['register']['userid'] . mt_rand() . mt_rand() . mt_rand());
     // register as temporary user and send mail
     $acl_man =& Docebo::user()->getAclManager();
     $iduser = $acl_man->registerTempUser($_POST['register']['userid'], $_POST['register']['firstname'], $_POST['register']['lastname'], $_POST['register']['pwd'], $_POST['register']['email'], $random_code);
     if ($iduser === false) {
         $out .= '<div class="reg_err_data">' . $lang->def('_OPERATION_FAILURE') . '</div>';
         $this->error = true;
         return $out;
     }
     // facebook register:
     if ($social->isActive('facebook')) {
         if (isset($_SESSION['fb_info']) && is_array($_SESSION['fb_info'])) {
             $social = new Social();
             $social->connectAccount('facebook', $_SESSION['fb_info']['id'], $iduser, true);
             unset($_SESSION['fb_info']);
         }
     }
     // ----
     // add base inscription policy
     $enrollrules = new EnrollrulesAlms();
     $enrollrules->newRules('_NEW_USER', array($iduser), Lang::get());
     // subscribe to groups -----------------------------------------
     if (isset($_POST['group_sel_implode'])) {
         $groups = explode(',', $_POST['group_sel_implode']);
         while (list(, $idst) = each($groups)) {
             $acl_man->addToGroup($idst, $iduser);
             // FORMA: added the inscription policy
             $enrollrules = new EnrollrulesAlms();
             $enrollrules->applyRulesMultiLang('_LOG_USERS_TO_GROUP', array((string) $iduser), false, (int) $idst, true);
             // END FORMA
         }
     }
     //if the user had enter a code we must check if there are folder related to it and add the folder's field
     $registration_code_type = Get::sett('registration_code_type', '0');
     $code_is_mandatory = Get::sett('mandatory_code', 'off') == 'on';
     $reg_code = Get::req('reg_code', DOTY_MIXED, '');
     if ($registration_code_type === 'custom') {
         $reg_code = 'change_by_custom_operation';
     }
     $array_folder = false;
     $uma = new UsermanagementAdm();
     $reg_code_res = $this->processRegistrationCode($acl_man, $uma, $iduser, $reg_code, $registration_code_type);
     if ($reg_code_res['success'] == false) {
         $acl_man->deleteTempUser($iduser);
         $this->error = true;
         return '<div class="reg_err_data">' . $reg_code_res['msg'] . '</div>';
     }
     // save language selected
     require_once _base_ . '/lib/lib.preference.php';
     $preference = new UserPreferences($iduser);
     $preference->setPreference('ui.language', Lang::get());
     // Save fields
     $extra_field = new FieldList();
     $extra_field->setFieldEntryTable($GLOBALS['prefix_fw'] . '_field_userentry');
     $extra_field->storeFieldsForUser($iduser);
     // Send mail
     $admin_mail = $options['mail_sender'];
     // FIX BUG 399
     //$link = str_replace('&amp;', '&', $opt_link.( strpos($opt_link, '?') === false ? '?' : '&' ).'random_code='.$random_code);
     $link = Get::sett('url', '') . 'index.php?modname=login&op=register_opt&random_code=' . $random_code;
     // END FIX BUG 399
     $text = $lang->def('_REG_MAIL_TEXT');
     $text = str_replace('[userid]', $_POST['register']['userid'], $text);
     $text = str_replace('[firstname]', $_POST['register']['firstname'], $text);
     $text = str_replace('[lastname]', $_POST['register']['lastname'], $text);
     $text = str_replace('[password]', $_POST['register']['pwd'], $text);
     $text = str_replace('[link]', '' . $link . '', $text);
     $text = str_replace('[hour]', $options['hour_request_limit'], $text);
     $text = stripslashes($text);
     //check register_type != self (include all previous cases except the new one "self without opt-in")
     if (strcmp($options['register_type'], 'self') != 0) {
         require_once _base_ . '/lib/lib.mailer.php';
         $mailer = DoceboMailer::getInstance();
         if (!$mailer->SendMail($admin_mail, $_POST['register']['email'], Lang::t('_MAIL_OBJECT', 'register'), $text, false, array(MAIL_REPLYTO => $admin_mail, MAIL_SENDER_ACLNAME => false))) {
             if ($registration_code_type == 'code_module') {
                 // ok, the registration has failed, let's remove the user association form the code
                 $code_manager = new CodeManager();
                 $code_manager->resetUserAssociation($code, $iduser);
             }
             $acl_man->deleteTempUser($iduser);
             $this->error = true;
             $out .= '<div class="reg_err_data">' . $lang->def('_OPERATION_FAILURE') . '</div>';
         } else {
             $out .= '<div class="reg_success">' . $lang->def('_REG_SUCCESS') . '</div>';
         }
     }
     //end
     $_GET['random_code'] = $random_code;
     $_GET['idst'] = $iduser;
     //check register_type = self
     if (strcmp($options['register_type'], 'self') == 0) {
         $text_self = $lang->def('_REG_MAIL_TEXT_SELF');
         $text_self = str_replace('[userid]', $_POST['register']['userid'], $text_self);
         $text_self = str_replace('[firstname]', $_POST['register']['firstname'], $text_self);
         $text_self = str_replace('[lastname]', $_POST['register']['lastname'], $text_self);
         $text_self = str_replace('[password]', $_POST['register']['pwd'], $text_self);
         require_once _base_ . '/lib/lib.mailer.php';
         $mailer = DoceboMailer::getInstance();
         if (!$mailer->SendMail($admin_mail, $_POST['register']['email'], Lang::t('_MAIL_OBJECT_SELF', 'register'), $text_self, false, false)) {
             $out .= '<div class="reg_err_data">' . $lang->def('_OPERATION_FAILURE') . '</div>';
         } else {
             $this->confirmRegister($this->_platform, $options);
             $out .= '<div class="reg_success">' . $lang->def('_REG_SUCCESS_SELF') . '</div>';
         }
     }
     //end
     return $out;
 }
 function createuser_action()
 {
     //check permissions
     if (!$this->permissions['add_user']) {
         $output = array('success' => false, 'message' => $this->_getErrorMessage('no permission'));
         echo $this->echoResult($output);
         return;
     }
     $userid = Get::req('username', DOTY_STRING, '');
     $password = Get::Req('password', DOTY_STRING, '');
     $password_confirm = Get::req('password_confirm', DOTY_STRING, '');
     $output = array();
     if ($userid == '') {
         $output['success'] = false;
         $output['message'] = Lang::t('_ERR_INVALID_USER', 'register');
         echo $this->echoResult($output);
         return;
     }
     if ($password != $password_confirm) {
         $output['success'] = false;
         $output['message'] = Lang::t('_ERR_PASSWORD_NO_MATCH', 'register');
         echo $this->echoResult($output);
         return;
     }
     $userdata = new stdClass();
     $userdata->userid = trim($userid);
     $userdata->firstname = trim(Get::req('firstname', DOTY_STRING, ''));
     $userdata->lastname = trim(Get::req('lastname', DOTY_STRING, ''));
     $userdata->email = trim(Get::req('email', DOTY_STRING, ''));
     $userdata->password = $password;
     $userdata->force_change = trim(Get::Req('force_changepwd', DOTY_INT, 0));
     /* $userdata->facebook_id = Get::pReq('facebook_id', DOTY_STRING, '');
     		$userdata->twitter_id = Get::pReq('twitter_id', DOTY_STRING, '');
     		$userdata->linkedin_id = Get::pReq('linkedin_id', DOTY_STRING, '');
     		$userdata->google_id = Get::pReq('google_id', DOTY_STRING, ''); */
     if (Docebo::user()->user_level == ADMIN_GROUP_GODADMIN) {
         $userdata->level = Get::req('level', DOTY_STRING, ADMIN_GROUP_USER);
     } else {
         $userdata->level = ADMIN_GROUP_USER;
     }
     if (!$this->model->checkUserid($userdata->userid)) {
         $output['success'] = false;
         $output['message'] = Lang::t('_USERID_DUPLICATE', 'organization_chart');
         echo $this->echoResult($output);
         return;
     }
     if (!$this->_canUseLevel($userdata->level)) {
         $output['success'] = false;
         $output['message'] = Lang::t('_OPERATION_FAILURE', 'standard');
         echo $this->echoResult($output);
         return;
     }
     if (Get::sett('pass_change_first_login', 'off') == 'on') {
         $userdata->force_change = 1;
     }
     $userdata->preferences =& $_POST;
     $folders = Get::req('sel', DOTY_MIXED, false);
     $idst = $this->model->createUser($userdata, $folders);
     if (is_numeric($idst) && $idst > 0) {
         $output['success'] = true;
         $output['idst'] = $idst;
         $output['total_users'] = $this->model->getUsersCount();
         $output['message'] = Lang::t('_OPERATION_SUCCESSFUL', 'standard') . ': ' . $userid;
         // Send alert:
         require_once _base_ . '/lib/lib.eventmanager.php';
         $acl_man = Docebo::user()->getAclManager();
         $array_subst = array('[url]' => Get::sett('url'), '[userid]' => $userid, '[password]' => $password);
         $e_msg = new EventMessageComposer();
         $e_msg->setSubjectLangText('email', '_REGISTERED_USER_SBJ', false);
         $e_msg->setBodyLangText('email', '_REGISTERED_USER_TEXT', $array_subst);
         $e_msg->setBodyLangText('sms', '_REGISTERED_USER_TEXT_SMS', $array_subst);
         $recipients = array($idst);
         if (!empty($recipients)) {
             createNewAlert('UserNew', 'directory', 'edit', '1', 'New user created', $recipients, $e_msg);
             ob_clean();
         }
         // Increment the counter for users created by this admin:
         if (Docebo::user()->getUserLevelId() != ADMIN_GROUP_GODADMIN) {
             $admin_pref = new AdminPreference();
             $pref = $admin_pref->getAdminRules(Docebo::user()->getIdSt());
             if ($pref['admin_rules.limit_user_insert'] == 'on') {
                 $user_pref = new UserPreferences(Docebo::user()->getIdSt());
                 $user_created_count = (int) $user_pref->getPreference('user_created_count');
                 $user_created_count++;
                 $user_pref->setPreference('user_created_count', $user_created_count);
                 if ($user_created_count >= $pref['admin_rules.max_user_insert']) {
                     $output['force_page_refresh'] = true;
                     $output['message'] = Lang::t('_USER_CREATED_MAX_REACHED', 'admin_directory');
                 }
             }
         }
     } else {
         $output['success'] = false;
         $output['message'] = Lang::t('_OPERATION_FAILURE', 'standard');
     }
     $this->echoResult($output);
 }