本文整理汇总了PHP中users类的典型用法代码示例。如果您正苦于以下问题:PHP users类的具体用法?PHP users怎么用?PHP users使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了users类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: module_main
protected function module_main()
{
//get menus from all plugins
$menu = (array) null;
$plugins = cls_orm::find('plugins', 'enable=1');
foreach ($plugins as $plugin) {
//now get all menus from plugins
if (method_exists($plugin->name, 'core_menu')) {
$plugin_menu = call_user_func(array($plugin->name, 'core_menu'));
foreach ($plugin_menu as $mnu) {
array_push($menu, $mnu);
}
}
}
//now $menu is 2d array with plugins menu
//show action
//check for that plugin is set
if (!isset($_GET['p'])) {
$_GET['p'] = 'core';
}
//check for that action is set
if (!isset($_GET['a'])) {
$_GET['a'] = 'default';
}
//now going to do action
$router = new cls_router($_GET['p'], $_GET['a']);
$plugin_content = $router->show_content(false);
$obj_users = new users();
$user_info = $obj_users->get_info();
$content = $this->module_load(array(_('Administrator:') . $plugin_content[0], $this->view_main($menu, $plugin_content[1], $user_info)));
return $content;
}
示例2: get_sso_token
/**
* @param string $api_key API ключ UserEcho
* @param string $project_key Ключ UserEcho
* @param array $user_info
*
* @return SSO KEY
*/
public static function get_sso_token($api_key, $project_key, $user_info)
{
$sso_key = '';
if ($uid = get_uid(false)) {
$user = new users();
$user->GetUserByUID($uid);
$iv = str_shuffle('memoKomo1234QWER');
$message = array('guid' => $uid, 'expires_date' => gmdate('Y-m-d H:i:s', time() + 86400), 'display_name' => $user->login, 'email' => $user->email, 'locale' => 'ru', 'verified_email' => true);
// key hash, length = 16
$key_hash = substr(hash('sha1', $api_key . $project_key, true), 0, 16);
$message_json = json_encode(encodeCharset('CP1251', 'UTF-8', $message));
// double XOR first block message_json
for ($i = 0; $i < 16; ++$i) {
$message_json[$i] = $message_json[$i] ^ $iv[$i];
}
// fill tail of message_json by bytes equaled count empty bytes (to 16)
$pad = 16 - strlen($message_json) % 16;
$message_json = $message_json . str_repeat(chr($pad), $pad);
// encode json
$cipher = mcrypt_module_open(MCRYPT_RIJNDAEL_128, '', 'cbc', '');
mcrypt_generic_init($cipher, $key_hash, $iv);
$encrypted_bytes = mcrypt_generic($cipher, $message_json);
mcrypt_generic_deinit($cipher);
// encode bytes to url safe string
$sso_key = urlencode(base64_encode($encrypted_bytes));
}
return $sso_key;
}
示例3: check
public function check()
{
$this->setView('reclaim/index');
if (Session::isLoggedIn()) {
return Error::set('You\'re logged in!');
}
$this->view['valid'] = true;
$this->view['publicKey'] = Config::get('recaptcha:publicKey');
if (empty($_POST['recaptcha_challenge_field']) || empty($_POST['recaptcha_response_field'])) {
return Error::set('We could not find the captcha validation fields!');
}
$recaptcha = Recaptcha::check($_POST['recaptcha_challenge_field'], $_POST['recaptcha_response_field']);
if (is_string($recaptcha)) {
return Error::set(Recaptcha::$errors[$recaptcha]);
}
if (empty($_POST['username']) || empty($_POST['password'])) {
return Error::set('All forms are required.');
}
$reclaims = new reclaims(ConnectionFactory::get('mongo'));
$good = $reclaims->authenticate($_POST['username'], $_POST['password']);
if (!$good) {
return Error::set('Invalid username/password.');
}
$reclaims->import($_POST['username'], $_POST['password']);
$users = new users(ConnectionFactory::get('mongo'));
$users->authenticate($_POST['username'], $_POST['password']);
header('Location: ' . Url::format('/'));
}
示例4: authenticate
function authenticate(\Slim\Route $route)
{
// Getting request headers
$headers = apache_request_headers();
$response = array();
$app = \Slim\Slim::getInstance();
// Verifying Authorization Header
if (isset($headers['Authorization'])) {
$db = new users();
// get the api key
$api_key = $headers['Authorization'];
// validating api key
if (!$db->isValidApiKey($api_key)) {
// api key is not present in users table
echo json_encode(array('error' => true, 'message' => 'Acceso Denegado. Api key Invalida'));
$app->stop();
} else {
global $user_id;
// get user primary key id
$user = $db->getUserId($api_key);
if ($user != NULL) {
$user_id = $user;
}
}
} else {
// api key is missing in header
echo json_encode(array('error' => true, 'message' => 'Falta Api key'));
$app->stop();
}
}
示例5: run
/**
* run - display template and edit data
*
* @access public
*/
public function run()
{
$tpl = new template();
$user = new users();
//Only admins
if ($user->isAdmin($_SESSION['userdata']['id'])) {
$msgKey = '';
if (isset($_POST['save']) === true) {
$values = array('name' => $_POST['name'], 'street' => $_POST['street'], 'zip' => $_POST['zip'], 'city' => $_POST['city'], 'state' => $_POST['state'], 'country' => $_POST['country'], 'phone' => $_POST['phone'], 'internet' => $_POST['internet'], 'email' => $_POST['email']);
if ($values['name'] !== '') {
if ($this->isClient($values) !== true) {
$this->addClient($values);
$tpl->setNotification('ADD_CLIENT_SUCCESS', 'success');
} else {
$tpl->setNotification('CLIENT_EXISTS', 'error');
}
} else {
$tpl->setNotification('NO_NAME', 'error');
}
$tpl->assign('values', $values);
}
$tpl->display('clients.newClient');
} else {
$tpl->display('general.error');
}
}
示例6: confirm
public function confirm($arguments)
{
if (Session::isLoggedIn()) {
return Error::set(self::ERR_LOGGED_IN);
}
if (empty($arguments[0])) {
return Error::set(self::ERR_NO_LOST_ID);
}
if (empty($arguments[1]) || $arguments[1] != 'auth' && $arguments[1] != 'password') {
return Error::set(self::ERR_INIVALID_MODE);
}
$passReset = new passwordReset(ConnectionFactory::get('redis'));
$info = $passReset->get($arguments[0], $arguments[1] == 'auth' ? true : false);
if (is_string($info)) {
return Error::set($info);
}
$users = new users(ConnectionFactory::get('mongo'));
if ($arguments[1] == 'auth') {
$users->changeAuth($info[1], true, false, false, false);
$this->view['password'] = false;
} else {
$password = $users->resetPassword($info[1]);
$this->view['password'] = $password;
}
}
示例7: __construct
/**
* Конструктор класса.
*
* @param string $sender Логин автора рассылки
*/
public function __construct($sender = 'admin')
{
$this->_sender = new users();
$this->_sender->GetUser($sender);
$this->_dbMaster = new DB('master');
$this->_dbProxy = new DB('plproxy');
}
示例8: searchUser
function searchUser()
{
if (!isset($_REQUEST['st'])) {
//return error
echo '{"result":0,"message": "search did not work."}';
}
$txt = $_REQUEST['st'];
include "users.php";
$obj = new users();
if (!$obj->searchUsers($txt)) {
//return error
echo '{"result":0,"message": "search did not work."}';
return;
}
//at this point the search has been successful.
//generate the JSON message to echo to the browser
$row = $obj->fetch();
echo '{"result":1,"users":[';
//start of json object
while ($row) {
echo json_encode($row);
//convert the result array to json object
$row = $obj->fetch();
if ($row) {
echo ",";
//if there are more rows, add comma
}
}
echo "]}";
//end of json array and object
}
示例9: run
public function run()
{
$tpl = new template();
$id = (int) $_GET['id'];
$users = new users();
$clients = new clients();
if ($id && $id > 0) {
$lead = $this->getLead($id);
$contact = $this->getLeadContact($id);
$values = array('user' => $contact['email'], 'password' => '', 'firstname' => '', 'lastname' => '', 'phone' => $contact['phone'], 'role' => 3, 'clientId' => $lead['clientId']);
if (isset($_POST['save'])) {
if (isset($_POST['user']) && isset($_POST['firstname']) && isset($_POST['lastname'])) {
$hasher = new PasswordHash(8, TRUE);
$values = array('user' => $_POST['user'], 'password' => $hasher->HashPassword($_POST['password']), 'firstname' => $_POST['firstname'], 'lastname' => $_POST['lastname'], 'phone' => $_POST['phone'], 'role' => $_POST['role'], 'clientId' => $_POST['clientId']);
if ($users->usernameExist($values['user']) !== true) {
$users->addUser($values);
$tpl->setNotification('USER_CREATED', 'success');
} else {
$tpl->setNotification('USERNAME_EXISTS', 'error');
}
} else {
$tpl->setNotification('MISSING_FIELDS', 'error');
}
}
$tpl->assign('values', $values);
$tpl->assign('clients', $clients->getAll());
$tpl->assign('roles', $users->getRoles());
$tpl->display('leads.convertToUser');
} else {
$tpl->display('general.error');
}
}
示例10: handler
public static function handler($data = null)
{
if (isset($_SESSION['done_autoauth'])) {
return;
}
if (empty($_SERVER['SSL_CLIENT_RAW_CERT'])) {
return self::done();
}
if (Session::isLoggedIn()) {
return self::done();
}
$certs = new certs(ConnectionFactory::get('mongo'), ConnectionFactory::get('redis'));
$userId = $certs->check($_SERVER['SSL_CLIENT_RAW_CERT']);
if ($userId == NULL) {
return self::done();
}
$users = new users(ConnectionFactory::get('mongo'));
$user = $users->get($userId, false);
if (empty($user)) {
return;
}
if (!in_array('autoauth', $user['auths'])) {
return self::done();
}
if ($user['status'] == users::ACCT_LOCKED) {
return self::done();
}
Session::setBatchVars($user);
return self::done();
}
示例11: pay_place_top
function pay_place_top($catalog = 0, $caruselTop)
{
global $DB, $session;
if ($catalog == 0) {
$yaM = "yaCounter6051055.reachGoal('main_carousel_ref');";
} else {
$yaM = "yaCounter6051055.reachGoal('cat_carousel_ref');";
}
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/pay_place.php';
$payPlace = new pay_place($catalog);
$ppAds = $payPlace->getUserPlaceNew();
if (is_array($ppAds)) {
foreach ($ppAds as $ppAd) {
$pp_uids[] = $ppAd['uid'];
}
$pp_uids = array_unique($pp_uids);
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/users.php';
$usrs = new users();
$pp_result = $usrs->getUsers('uid IN (' . implode(',', array_values($pp_uids)) . ')');
foreach ($pp_result as $k => $v) {
$toppay_usr[$v['uid']] = $v;
}
$pp_h = $payPlace->getAllInfo($pp_uids);
}
$not_load_info = true;
ob_start();
include $_SERVER['DOCUMENT_ROOT'] . '/templates/pay_place.php';
$html = antispam(str_replace(array("\r", "\n"), '', ob_get_clean()));
$aRes['success'] = true;
$aRes['html'] = iconv('windows-1251', 'UTF-8', $html);
echo json_encode($aRes);
}
示例12: get_profile
public function get_profile()
{
$id = $_GET['id'];
$user = new users();
$res = $user->find($id);
echo json_encode($res);
}
示例13: getClassList
function getClassList($classID)
{
//print "classID: $classID";
$users = new users();
$classList = $users->getClassList($classID, false);
$users->close();
//print_r($classList);
return $classList;
}
示例14: getModules
public function getModules($id)
{
$users = new users();
$modules = $this->userModules;
if ($users->isAdmin($id)) {
$modules = $this->adminModules;
}
return $modules;
}
示例15: SafetyPhoneNever
/**
* Больше не показывать это сообщение.
*/
function SafetyPhoneNever()
{
session_start();
$aRes = array('success' => false);
if (isset($_SESSION['uid'])) {
$users = new users();
$aRes['success'] = $users->setSafetyPhoneHide($_SESSION['uid']);
}
echo json_encode($aRes);
}