本文整理汇总了PHP中UserManager类的典型用法代码示例。如果您正苦于以下问题:PHP UserManager类的具体用法?PHP UserManager怎么用?PHP UserManager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了UserManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
public function execute($dataContainer)
{
//No direct access
defined('_WEXEC') or die("Access denied");
$smarty = $dataContainer->getSmarty();
require_once PATH_ACCESS . '/GlobalSettingsManager.php';
require_once PATH_ACCESS . '/CardManager.php';
require_once PATH_ACCESS . '/UserManager.php';
$cm = new CardManager();
$um = new UserManager();
$gsManager = new GlobalSettingsManager();
try {
$help_str = $gsManager->getHelpText();
} catch (Exception $e) {
die('Ein Fehler ist aufgetreten:' . $e->getMessage());
}
if ($dataContainer->getAcl()->moduleGet('root/web/Babesk')) {
// set {cardid} in helptext administration to replace it with the cardnumber
$help_str = str_replace("{cardid}", $cm->getCardnumberByUserID($_SESSION['uid']), $help_str);
}
//set {login} in helptext administration to replace it with the login name
$help_str = str_replace("{login}", $um->getUsername($_SESSION['uid']), $help_str);
$smarty->assign('help_str', $help_str);
$smarty->display($this->smartyPath . "help.tpl");
}
示例2: service
public function service()
{
$userManager = new UserManager($this->config, $this->args);
$email = strtolower($this->secure($_REQUEST["email"]));
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
$jsonArr = array('status' => "err", "errText" => $this->getPhrase(471));
echo json_encode($jsonArr);
return false;
}
$customer = $userManager->getCustomerByEmail($email);
if ($customer != null) {
$emailSenderManager = new EmailSenderManager('gmail');
$customerEmail = $customer->getEmail();
$userName = $customer->getName();
$password = $customer->getPassword();
$subject = "Your PcStore Password!";
$templateId = "customer_forgot_password";
$params = array("name" => $userName, "password" => $password);
$emailSenderManager->sendEmail('support', $customerEmail, $subject, $templateId, $params);
$jsonArr = array('status' => "ok", "message" => "Your password sent to your " . $email . " email.\nPlease check your email.");
echo json_encode($jsonArr);
return true;
} else {
$jsonArr = array('status' => "err", "errText" => $this->getPhrase(381));
echo json_encode($jsonArr);
return false;
}
}
示例3: process
public function process($parameters)
{
//do control panela maju pristup len prihlaseny uzivatelia
$this->checkUser();
//hlavicka stranky
$this->head['title'] = 'Ovládací panel';
$userManager = new UserManager();
$validation = new Validation();
//zadane URL pre odhlasenie
if (!empty($parameters[0]) && $parameters[0] == 'odhlasit') {
$userManager->logOut();
$this->redirect('prihlasenie');
}
//data pre sablonu
$user = $userManager->returnUser();
$this->data['admin'] = $user['admin'];
$this->data['userRank'] = $validation->returnUserRank($user['admin']);
$this->data['user'] = $user['name'];
$this->data['avatar'] = $user['avatar'];
$this->data['registrationDate'] = $user['registration_date'];
$this->data['lastVisit'] = $user['last_visit'];
$this->data['comments'] = $user['comments'];
$this->data['articles'] = $user['articles'];
$this->data['sex'] = $user['sex'];
$this->data['email'] = $user['email'];
//nastavenie sablony
$this->view = 'controlPanel';
}
示例4: route
public function route($params)
{
$userManager = new UserManager();
$user = $userManager->returnUser();
if (!$user) {
$this->redirect("login");
}
switch ($user['role']) {
case 2:
$this->view = 'admin_dashboard';
break;
case 1:
$reviewManager = new ReviewManager();
$this->data['no_reviewed'] = $reviewManager->return_no_reviewed($user['id_user']);
$this->data['reviewed'] = $reviewManager->return_reviewed($user['id_user']);
$this->view = 'reviewer_dashboard';
break;
case 0:
default:
$this->view = 'author_dashboard';
break;
}
$header_menu = 'login_bar';
$this->data['title_html'] = 'Hlavní panel';
$this->head['title_html'] = $this->data['title_html'];
$this->header_menu = $header_menu;
}
示例5: process
public function process($parameters)
{
$parsedURL = $this->parseURL($parameters[0]);
//predanie URL do funkcie
if (empty($parsedURL[0])) {
//ak chyba prvy parameter
$this->redirect('clanky/uvod');
}
//presmeruj na uvodny clanok
$controllerClass = $this->camelCase(array_shift($parsedURL)) . 'Controller';
//#spracovanie URL na parametre, volanie pozadovaneho kontroleru
if (file_exists('controllers/' . $controllerClass . '.php')) {
//ak existuje kontroler z URL
$this->controller = new $controllerClass();
} else {
$this->redirect('chyba');
}
//ak neexistuje, presmeruj na chybove hlasenie
$this->controller->process($parsedURL);
//spracovanie ostatnych parametrov vo vnorenom kontroleri
$userManager = new UserManager();
//predanie premennych do hlavnej sablony
$this->data['user'] = $userManager->returnUserName();
$this->data['title'] = $this->controller->head['title'];
$this->data['key_words'] = $this->controller->head['key_words'];
$this->data['description'] = $this->controller->head['description'];
$this->data['messages'] = $this->returnMessages();
$this->data['topArticles'] = $this->topArticles();
$this->view = 'layout';
//nastavenie hlavnej sablony
}
示例6: executePopup
public function executePopup()
{
$userManager = new UserManager();
$acct_schema = $userManager->getAcctSchema();
//if the user name contains spaces, replace %20 by a space
$_GET['user'] = str_replace("%20", " ", $_GET['user']);
//if the group field exists in ACCT table, sort the db result by group
if (array_key_exists(GROUP, $acct_schema)) {
$result = $userManager->getDetailedStat($_GET['user'], GROUP);
} else {
$result = $userManager->getDetailedStat($_GET['user'], null);
}
$user_status = array();
$has_status = 0;
foreach ($result as $line) {
if (array_key_exists(STATUS, $acct_schema)) {
$has_status = 1;
if (!array_key_exists(TYPE, $acct_schema) || $line[TYPE] != 'dir') {
if (isset($user_status[$line[STATUS]])) {
$user_status[$line[STATUS]] += $line[COUNT];
} else {
$user_status[$line[STATUS]] = $line[COUNT];
}
}
}
}
$this->page->addVar('acct_schema', $acct_schema);
$this->page->addVar('result', $result);
if ($has_status) {
$this->page->addVar('user_status', $user_status);
}
}
示例7: preforward
/**
* preprocess before forwarding.
*
* @access public
*/
public function preforward()
{
$um = new UserManager();
$list = $um->userlist($this->backend);
$this->af->setApp("userlist", $list);
$this->af->setApp("listsize", count($list));
}
示例8: Premium
/**
* Fonction faisant devenir premium le membre connecté.
*/
function Premium()
{
$udm = new User_DroitManager(connexionDb());
$udm->modifDroit($_SESSION['User']->getId(), 3);
$um = new UserManager(connexionDb());
$user = $um->getUserById($_SESSION['User']->getId());
$_SESSION['User'] = $user;
}
示例9: getAuthor
public function getAuthor()
{
if (!$this->author) {
$manager = new UserManager($this->database);
$this->author = $manager->findById($this->id_author);
}
return $this->author;
}
示例10: getUser
public function getUser()
{
if (!$this->user) {
$manager = new UserManager($this->database);
$this->user = $manager->findById($this->id_user);
}
return $this->user;
}
示例11: onPost
function onPost($postData, FormSubmit $sender)
{
$userManager = new UserManager();
if ($sender != $this->submitButton) {
throw new Exception("The post sender is invalid!");
}
$userManager->login($this->usernameBox->text, $this->passwordBox->text);
}
示例12: getUser
public function getUser()
{
if (!$this->user) {
$userManager = new UserManager($this->db);
$this->user = $userManager->readById($this->user_id);
}
return $this->user;
}
示例13: login_form
/**
* Return the complete code for the login page
* @return <string>
*/
public static function login_form()
{
$user_manager = new UserManager();
$user_manager->_render->hideLoginLanguageSelection();
$user_manager->setLoginStyle(false);
$html = Form::openForm('login_confirm', Get::rel_path('lms') . '/index.php?modname=login&op=confirm') . $user_manager->getExtLoginMask(Get::rel_path('lms') . '/index.php?modname=login&op=login', '') . Form::closeForm();
return $html;
}
示例14: checkToken
/**
* @param Rest_Token $token
* @return PFUser or null if the user is not found
* @throws Rest_Exception_InvalidTokenException
*/
public function checkToken(Rest_Token $token)
{
if ($this->token_factory->doesTokenExist($token->getUserId(), $token->getTokenValue())) {
return $this->user_manager->getUserById($token->getUserId());
}
throw new Rest_Exception_InvalidTokenException();
}
示例15: continueSession
/**
*
* @see session_continue
*
* @param String $sessionKey
*
* @return User
*/
private function continueSession($sessionKey)
{
$user = $this->userManager->getCurrentUser($sessionKey);
if ($user->isLoggedIn()) {
return $user;
}
throw new SoapFault('3001', 'Invalid session');
}