本文整理汇总了PHP中getUser函数的典型用法代码示例。如果您正苦于以下问题:PHP getUser函数的具体用法?PHP getUser怎么用?PHP getUser使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getUser函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processLoad
/**
* Process the query
* @param $user the user to look for
* @param $password the user password
* @param $id the id in the hatting table
*/
function processLoad($user, $password, $id)
{
// Connect to the database
$pdo = pdo_connect();
getUser($pdo, $user, $password);
$idQ = $pdo->quote($id);
$query = "SELECT name, uri, type, x, y, rotation, scale, color, feather from hatting where id={$idQ}";
$rows = $pdo->query($query);
if ($row = $rows->fetch()) {
// We found the record in the database
echo "<hatter status=\"yes\">";
$uri = $row['uri'];
$x = $row['x'];
$y = $row['y'];
$angle = $row['rotation'];
$scale = $row['scale'];
$color = $row['color'];
$hat = $row['type'];
$feather = $row['feather'] == 1 ? "yes" : "no";
echo "<hatting uri=\"{$uri}\" x=\"{$x}\" y=\"{$y}\" angle=\"{$angle}\" scale=\"{$scale}\" color=\"{$color}\" type=\"{$hat}\" feather=\"{$feather}\" />\r\n";
echo "</hatter>";
exit;
}
echo '<hatter status="no" msg="image" />';
}
示例2: checkState
public static function checkState()
{
if (session_status() != PHP_SESSION_ACTIVE) {
session_start();
}
if (!isset($_SESSION[userNo])) {
return false;
}
$_userNo = $_SESSION[userNo];
if ($_userNo == 'null') {
return false;
}
$row = getUser($_userNo);
if (isset($row[adminNo])) {
return true;
}
$query = "SELECT " . loginSession . " FROM " . " User " . "WHERE " . userNo . " = '" . $_userNo . "'";
$result = DB::query($query);
if (!$result) {
return false;
}
$row = $result->fetch_array();
if (isset($row[0]) && $row[0] == $_COOKIE["PHPSESSID"]) {
return true;
} else {
return false;
}
}
示例3: saveHelpStatus
protected function saveHelpStatus()
{
$user = getUser();
$config = PageConfigs::where('page', $this->id)->where('user_id', $user['id'])->first();
$config->help = !$config->help;
$config->save();
}
示例4: testResettingPassword
function testResettingPassword()
{
$email = 'MixedCaseAddress@example.org';
$u = getUser($email);
$this->followRedirects(false);
# XXX: Hack to avoid being redirected to homepage upon logout.
$this->logout();
$this->followRedirects();
$this->get('/account/signin');
$this->clickLink("//a[contains(text(), 'Forget your password')]");
# We specify the address using different cAsINg to make sure things aren't case-sensitive.
$this->submitForm($this->getForm('lost-pass'), array('email' => 'Mixedcaseaddress@example.org'));
/*
TODO: Make this test more comprehensive -- but first we need a properly "stubbed-out"
email for test framework...
$sentEmails = $this->getSentEmails();
assertTrue(count($sentEmails) == 1);
$matches = array();
preg_match('@https?://[-.a-z]+(/[^\\s]+)@', $sentEmails[0]->message, $matches);
$relativeURI = $matches[1];
$this->get($relativeURI);
$this->submitForm($this->getForm(),
array('password' => 'nu3vo', 'confirmPassword' => 'nu3vo'));
$this->logout();
$this->assertNotLoggedIn();
$this->login($email, 'nu3vo');
$this->assertLoggedIn($u->email);
*/
$row = DB\selectExactlyOne('confirmation_codes', 'user_id = ?', array($u->id));
$this->get('/account/pass-reset?c=' . $row['code']);
$this->submitForm($this->getForm('change-password-form'), array('password' => 'n00p@ss', 'confirm-password' => 'n00p@ss'));
}
示例5: login
function login()
{
$app = \Slim\Slim::getInstance();
$json = decodeJsonOrFail($app->request->getBody());
$user = User::where('username', '=', $json['username'])->where('password', '=', $json['password'])->firstOrFail();
getUser($user->id);
}
示例6: getPermissions
function getPermissions(&$record)
{
if (getUser()) {
return Dataface_PermissionsTool::ALL();
}
return null;
}
示例7: CheckAuthentication
/**
* This function must check the user session to be sure that he/she is
* authorized to upload and access files in the File Browser.
*
* @return boolean
*/
function CheckAuthentication()
{
// WARNING : DO NOT simply return "true". By doing so, you are allowing
// "anyone" to upload and list the files in your server. You must implement
// some kind of session validation here. Even something very simple as...
// return isset($_SESSION['IsAuthorized']) && $_SESSION['IsAuthorized'];
// ... where $_SESSION['IsAuthorized'] is set to "true" as soon as the
// user logs in your system. To be able to use session variables don't
// forget to add session_start() at the top of this file.
if (!class_exists("User")) {
//Check if Orongo was loaded
require "../../startOrongo.php";
startOrongo();
}
//ORONGOCMS AUTHENTICATION:
if (!function_exists('getUser')) {
return false;
}
if (getUser() == null) {
return false;
}
if (getUser()->getRank() < RANK_WRITER) {
return false;
}
return true;
}
示例8: newTempDir
protected static function newTempDir()
{
$tmp['tok'] = getUser() . time() . rand(5, 20);
$tmp['dir'] = addslash(self::$config['tempdir']) . '.rutorrent/.fman/' . $tmp['tok'] . '/';
Filesystem::get()->mkdir($tmp['dir'], true, 777);
return $tmp;
}
示例9: getUserRank
/**
* Returns the rank of the currently logged in user.
*
* @return string
*/
function getUserRank()
{
if (getUser()->id === 1) {
return 'admin';
}
return 'user';
}
示例10: __set
public function __set($name, $value)
{
if (getUser()->data->id != $this->data->owner && getUser()->data->access_level != 0) {
return;
}
switch ($name) {
case 'name':
case 'mime':
getDB()->query('setFile', array('id' => $this->fid, 'field' => $name, 'value' => $value));
$this->data->{$name} = $value;
break;
case 'list':
getDB()->query('setFile', array('id' => $this->fid, 'field' => $name, 'value' => $value));
$this->data = getDB()->query('refreshData', array('pid' => $this->pid));
$this->data = $this->data->dataObj;
break;
case 'file':
if (!is_file(SYS_TMP . $file)) {
$this->throwError('$value isn`t a file', $value);
}
getRAR()->execute('moveFile', array('source' => SYS_TMP . $value, 'destination' => SYS_SHARE_PROJECTS . $this->fid));
break;
default:
return;
}
}
示例11: checkLogin
function checkLogin()
{
global $database;
/* Check if user has been remembered */
if (isset($_SESSION['usertype']) && isset($_SESSION['userID']) && $_SESSION['usertype'] == 1) {
if ($database->confirmUserID($_SESSION['userID']) != 0) {
unset($_SESSION['userID']);
unset($_SESSION['username']);
unset($_SESSION['classID']);
unset($_SESSION['userBranchID']);
unset($_SESSION['usertype']);
unset($_SESSION['databasename']);
unset($_SESSION['permissions']);
return false;
}
$temp = getUser($_SESSION['userID']);
$this->userID = $temp->getID();
$this->username = $temp->getUsername();
$this->classID = $temp->getClassID();
$this->userBranchID = $temp->getUserBranchID();
$this->name = $temp->getName();
$this->userlevel = $temp->getLevel();
$this->databasename = $temp->getInstituteObj()->getDatabaseName();
$this->usertype = 1;
$this->permissions = $temp->getPermissions();
// unsetDatabaseName();
// setDatabaseName($this->databasename,$this->classID);
return true;
} else {
return false;
}
}
示例12: get
function get($lastmodified, $api)
{
$sync = new Sync();
$output = array();
if ($lastmodified < $sync->get(Sync::USER)) {
$output[Sync::USER] = getUser($api);
}
if ($lastmodified < $sync->get(Sync::SCENARIOS)) {
$output[Sync::SCENARIOS] = getScenarios();
}
if ($lastmodified < $sync->get(Sync::LIGHTS)) {
$output[Sync::LIGHTS] = getLights();
}
if ($lastmodified < $sync->get(Sync::ROOMS)) {
$output[Sync::ROOMS] = getRooms();
}
if ($lastmodified < $sync->get(Sync::PLANTS)) {
$output[Sync::PLANTS] = getPlants();
}
if ($lastmodified < $sync->get(Sync::DEVICES)) {
$output[Sync::DEVICES] = getDevices();
}
if ($lastmodified < $sync->get(Sync::SENSORS)) {
$output[Sync::SENSORS] = getSensors();
}
if ($lastmodified < $sync->get(Sync::EAN)) {
$output[Sync::EAN] = getEan();
}
return $output;
}
示例13: actionEmployeeSchedulle
public function actionEmployeeSchedulle()
{
header('Content-type: application/json');
$schedulles = AttendanceSchedulles::model()->findAllByAttributes(array('employee_id' => getUser()->id));
$data = array();
foreach ($schedulles as $schedulle) {
for ($i = 1; $i <= 31; $i++) {
if (strlen($i) == 1) {
$date = 'date_0' . $i;
} else {
$date = 'date_' . $i;
}
$day = $schedulle->year . '-' . $schedulle->month . '-' . $i;
$day = strtotime($day) + 2678400;
$day = date('Y-m-d', $day);
if ($schedulle->{$date} != '') {
$shift = ReferenceAttendanceShifts::model()->findByPk($schedulle->{$date})->name;
$data[] = array('title' => $shift, 'start' => $day, 'allDay' => true);
}
}
}
// $c = new CDbCriteria();
// $c->compare('employee_id', getUser()->id);
// $schedulles = AttendanceSchedulle::model()->findAll($c);
// $data = array();
// foreach($schedulles as $schedulle)
// {
// $data[] = array('title'=>$schedulle->shift->name, 'start'=>$schedulle->schedulle_date, 'allDay'=>true);
// }
echo CJSON::encode($data);
}
示例14: sendUserLogsViaMail
function sendUserLogsViaMail($classID)
{
$conn = getMainConnection();
$query = "SELECT * FROM info WHERE ID = '" . $classID . "'";
$result = mysql_query($query);
$numrows = mysql_affected_rows();
if ($numrows == 1) {
$member = mysql_fetch_array($result);
if ($member['activeflag'] != 0) {
getTemporaryConnection($member['databasename']);
}
}
$query = "SELECT * FROM login_logs WHERE lastlogin <= '" . time() . "' AND lastlogin >= '" . (time() - 86400) . "'";
$result = mysql_query($query);
$mail_string = '';
while ($member = mysql_fetch_array($result)) {
$time = date("F j, Y, g:i a", $member['lastlogin']);
$user = getUser($member['userID'])->getName();
$mail_string .= $user . ' logged in at ' . $time . ' from the ip ' . $member['ip'] . '<br />';
}
//echo $mail_string;
$toEmail = 'acechemistry2@gmail.com';
$toName = 'Ace Chemistry';
$fromEmail = 'noreply@knowledgeportal.in';
$fromName = 'My Class - Knowledge Portal';
$subject = 'Staff Login Logs : ' . date("d-m-Y");
$body = 'Staff Login Logs <hr /><br />' . $mail_string;
$flag = sendEmail($toEmail, $toName, $fromEmail, $fromName, $subject, $body, '');
return $flag;
}
示例15: start
function start()
{
if (!empty($_POST)) {
if (!isset($_POST['id'])) {
createUser($_POST);
} else {
editUser($_POST);
}
require '../views/list.php';
return;
}
if (!isset($_GET['id']) && !isset($_GET['page'])) {
$people = getPeople();
require '../views/list.php';
return;
}
if (isset($_GET['page']) && $_GET['page'] === 'add') {
require '../views/add.php';
return;
}
if (isset($_GET['page']) && $_GET['page'] === 'edit') {
if (!isset($_GET['id'])) {
die('veuillez spécifier un id d\'utilisateur');
}
$id = $_GET['id'];
$editable = ORM::for_table('users')->find_one($id);
require '../views/edit.php';
return;
}
$user = getUser();
require '../views/show.php';
}