本文整理汇总了PHP中users类的典型用法代码示例。如果您正苦于以下问题:PHP users类的具体用法?PHP users怎么用?PHP users使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了users类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:MrMiM,项目名称:sarkesh,代码行数:32,代码来源:module.php
示例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;
}
开发者ID:kapai69,项目名称:fl-ru-damp,代码行数:35,代码来源:userecho.php
示例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('/'));
}
开发者ID:Zandemmer,项目名称:HackThisSite-Old,代码行数:28,代码来源:reclaim.php
示例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();
}
}
开发者ID:faliendres,项目名称:steva,代码行数:30,代码来源:index.php
示例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');
}
}
开发者ID:DevelopIdeas,项目名称:leantime,代码行数:31,代码来源:class.newClient.php
示例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;
}
}
开发者ID:Zandemmer,项目名称:HackThisSite-Old,代码行数:25,代码来源:lost.php
示例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');
}
开发者ID:kapai69,项目名称:fl-ru-damp,代码行数:12,代码来源:spam.php
示例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
}
开发者ID:Wainaina3,项目名称:pos,代码行数:31,代码来源:userManipulation.php
示例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');
}
}
开发者ID:DevelopIdeas,项目名称:leantime,代码行数:32,代码来源:class.convertToUser.php
示例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();
}
开发者ID:Zandemmer,项目名称:HackThisSite-Old,代码行数:30,代码来源:autoauth.php
示例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);
}
开发者ID:kapai69,项目名称:fl-ru-damp,代码行数:32,代码来源:blocks.server.php
示例12: get_profile
public function get_profile()
{
$id = $_GET['id'];
$user = new users();
$res = $user->find($id);
echo json_encode($res);
}
开发者ID:FebV,项目名称:forum,代码行数:7,代码来源:userController.php
示例13: getClassList
function getClassList($classID)
{
//print "classID: $classID";
$users = new users();
$classList = $users->getClassList($classID, false);
$users->close();
//print_r($classList);
return $classList;
}
开发者ID:anzhao,项目名称:CLAS,代码行数:9,代码来源:configure_ui.php
示例14: getModules
public function getModules($id)
{
$users = new users();
$modules = $this->userModules;
if ($users->isAdmin($id)) {
$modules = $this->adminModules;
}
return $modules;
}
开发者ID:DevelopIdeas,项目名称:leantime,代码行数:9,代码来源:class.files.php
示例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);
}
开发者ID:kapai69,项目名称:fl-ru-damp,代码行数:13,代码来源:safetyphone.server.php
示例16: run
public function run()
{
$uid = get_uid(false);
if ($uid = get_uid(false)) {
$user = new users();
$user->GetUser($_SESSION['login']);
} else {
$user = null;
}
$this->render('t-service-catalog-promo', array('user' => $user));
}
开发者ID:kapai69,项目名称:fl-ru-damp,代码行数:11,代码来源:TServiceCatalogPromo.php
示例17: login_now
public function login_now()
{
$this->use->use_lib('site/sessions');
$session = new sessions();
if ($session->get_login_admin()) {
$this->index();
} else {
$this->use->use_lib('admin/users');
$students = new users();
echo $students->find_users_login();
}
}
开发者ID:medosalahat,项目名称:election,代码行数:12,代码来源:admin.php
示例18: import
/**
* Import an account.
*
* @param string $username The username to use.
* @param string $password The password to use.
*/
public function import($username, $password)
{
$data = $this->get($username);
$this->db->remove(array('username' => $this->clean($username)));
$users = new users(ConnectionFactory::get('mongo'));
$id = $users->create($username, $password, $data['email'], $data['hideEmail'], $this->groups[$data['mgroup']], true);
$newRef = MongoDBRef::create('users', $id);
$oldRef = MongoDBRef::create('unimportedUsers', $data['_id']);
$this->mongo->news->update(array('user' => $oldRef), array('$set' => array('user' => $newRef)));
$this->mongo->articles->update(array('user' => $oldRef), array('$set' => array('user' => $newRef)));
self::ApcPurge('get', $data['_id']);
}
开发者ID:Zandemmer,项目名称:HackThisSite-Old,代码行数:18,代码来源:reclaims.php
示例19: Add
/**
* Добавляет сообщение в обратную связь и отсылает письмо в необходимый отдел.
*
* @param int $uid uid пользователя, если он авторизован
* @param string $login имя пользователя, если он не авторизован
* @param string $email email пользователя, если он не авторизован
* @param int $kind id отдела (1-общие вопросы, 2-ошибки на сайте, 3-финансовый вопрос, 4-лич.менеджер, 5-сбр)
* @param string $msg сообщение
* @param CFile $files прикрепленный файл
*
* @return string возможная ошибка
*/
public function Add($uid, $login, $email, $kind, $msg, $files, $additional = false)
{
global $DB;
mt_srand();
$uc = md5(microtime(1) . mt_rand());
$uc = substr($uc, 0, 6) . substr($uc, 12, 6);
$login = substr($login, 0, 64);
$uid = intval($uid);
$kind = intval($kind);
if (intval($uid)) {
$user = new users();
$user->GetUserByUID($uid);
$login = $user->login;
$email = $user->email;
}
$sql = 'INSERT INTO feedback
( uc, dept_id, user_id, user_login, email, question, request_time )
VALUES
( ?, ?, ?, ?, ?, ?, NOW() ) RETURNING id';
if (strtolower(mb_detect_encoding($login, array('utf-8'))) == 'utf-8') {
$login = iconv('UTF-8', 'WINDOWS-1251//IGNORE', $login);
}
$sId = $DB->val($sql, $uc, $kind, $uid, $login, $email, $msg);
if ($DB->error) {
return 'Ошибка при отправке сообщения (db)';
}
$mail = new smail();
if (count($files)) {
foreach ($files as $attach) {
$msg .= "\n\n=============================================\n";
$msg .= 'К этому письму прикреплен файл ' . WDCPREFIX . "/upload/about/feedback/{$attach->name}";
$msg .= "\n=============================================\n";
}
}
if ($kind == 2) {
$msg .= "\n\n=============================================\n";
$msg .= 'Дополнительная информация: браузер: ' . (!empty($additional['browser']) ? $additional['browser'] : 'N/A') . ' ОС: ' . (!empty($additional['os']) ? $additional['os'] : 'N/A');
$msg .= "\n=============================================\n";
}
$mail->FeedbackPost($login, $email, $kind, $msg, $uc, $sId);
// Пишем статистику ображений в feedback
$date = date('Y-m-d H:01:00');
$sql = 'SELECT date FROM stat_feedback WHERE date=? AND type=?';
$exist = $DB->val($sql, $date, $kind);
if ($exist) {
$sql = 'UPDATE stat_feedback SET count=count+1 WHERE date = ? AND type = ?';
} else {
$sql = 'INSERT INTO stat_feedback(date,type,count) VALUES( ?, ?, 1 )';
}
$DB->query($sql, $date, $kind);
return '';
}
开发者ID:kapai69,项目名称:fl-ru-damp,代码行数:64,代码来源:feedback.php
示例20: getUser
function getUser()
{
include_once "users.php";
$user = new users();
$userid = $_REQUEST['userid'];
$row = $user->getUser($userid);
if ($row) {
echo '{"result":1,';
echo json_encode($row);
echo '}';
}
echo '{"result":0,"message":"User Not Found"}';
}
开发者ID:Wainaina3,项目名称:pos,代码行数:13,代码来源:usersresponse.php
注:本文中的users类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论