本文整理汇总了PHP中GetUser函数的典型用法代码示例。如果您正苦于以下问题:PHP GetUser函数的具体用法?PHP GetUser怎么用?PHP GetUser使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetUser函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: printPage
/**
* printPage
*
* @return Void Doesn't return anything.
*/
public function printPage()
{
$user = GetUser();
$split_api = $this->GetApi('Splittest');
// for permission checks
$subaction = $this->_getGetRequest('subaction', 'print');
$perpage = $this->_getGetRequest('PerPageDisplay', null);
$jobids = $this->_getGETRequest('jobids', null);
$listids = $this->_getGETRequest('split_statids', null);
$jobids = explode(",", $jobids);
$listids = explode(",", $listids);
SendStudio_Functions::LoadLanguageFile('Stats');
if (!SplitTest_API::OwnsJobs($user->Get('userid'), $jobids) && !$user->Admin()) {
FlashMessage(GetLang('NoAccess'), SS_FLASH_MSG_ERROR, $this->base_url);
return;
}
// Get some setup parameters for the API
$sortdetails = array('sort' => 'splitname', 'direction' => 'asc');
$page_number = 0;
$perpage = 20;
$displayAll = false;
// just show a single splitest campaign send. If you want every campaign send for a split test set to true
$dateFromat = self::getDateFormat();
$statitics = array();
$jobid = 0;
for ($i = 0; $i < count($jobids); $i++) {
$stats = array();
$stats_api = new Splittest_Stats_API();
$jobid = $jobids[$i];
$splitid = $listids[$i];
// get the array of stats data
$stats = $stats_api->GetStats(array($splitid), $sortdetails, false, $page_number, $perpage, $displayAll, $jobid);
foreach ($stats as $stats_id => $stats_details) {
$stats[$stats_id]['splitname'] = htmlspecialchars($stats_details['splitname'], ENT_QUOTES, SENDSTUDIO_CHARSET);
$stats[$stats_id]['campaign_names'] = htmlspecialchars($stats_details['campaign_names'], ENT_QUOTES, SENDSTUDIO_CHARSET);
$stats[$stats_id]['list_names'] = htmlspecialchars($stats_details['list_names'], ENT_QUOTES, SENDSTUDIO_CHARSET);
}
// A Splittest can be sent multiple times hence we might have multiple campaign record sets here
while (list($id, $data) = each($stats)) {
$charts = $this->generateCharts($data['splitname'], $data['campaigns'], $subaction);
foreach ($charts as $type => $data) {
$stats[$id][$type] = $data;
}
}
$statistics[] = $stats;
}
$template = GetTemplateSystem(dirname(__FILE__) . '/templates');
$template->Assign('DateFormat', $dateFromat);
$template->Assign('statsData', $statistics);
$template->Assign('subaction', $subaction);
$options = $this->_getGETRequest('options', null);
for ($i = 0; $i < count($options); $i++) {
$template->Assign($options[$i], $options[$i]);
}
$template->ParseTemplate('Stats_Summary_Splittest');
}
示例2: GetMthodFileView
/**
* Created by PhpStorm.
* User: sp
* Date: 26/11/15
* Time: 3:59 PM
*/
function GetMthodFileView($Data)
{
include '../common/controller/user_get.php';
include '../common/controller/file_get.php';
$UserDetail = GetUser($Data);
$Response = GetFile($UserDetail[0]['Username']);
if ($Response["STATUS CODE"] == 903) {
return "NoData";
}
return $Response['Payloads'];
}
示例3: HandleFileRequest
/**
* Created by PhpStorm.
* User: sp
* Date: 24/11/15
* Time: 4:37 AM
*/
function HandleFileRequest($Request)
{
include '../common/config/ErrorCodes.php';
include '../common/helpers/ValidateRequest.php';
include '../common/controller/user_get.php';
include '../common/controller/add_file.php';
include '../common/controller/file_get.php';
include '../common/controller/add_fav.php';
include '../common/controller/Rename.php';
if (validate_file_request($Request) == "True") {
$UserDetail = GetUser($Request["payloads"]);
if (isset($UserDetail[0]['Username'])) {
$RequestData['Username'] = $UserDetail[0]['Username'];
$RequestData['Time'] = time();
switch ($Request["type"]) {
case "PUT":
$RequestData['File'] = $Request['payloads']['File'];
$RequestData['Filename'] = $Request['payloads']['File'];
$RequestData['Type'] = $Request['payloads']['Type'];
$Res = AddFile($RequestData);
$Response = ReturnResponse($Res);
break;
case "GET":
$Response = GetFile($RequestData['Username']);
break;
case "FAV":
$RequestData['File'] = $Request['payloads']['File'];
$RequestData['Fav'] = $Request['payloads']['Fav'];
$Res = AddFav($RequestData);
$Response = ReturnResponse($Res);
break;
case "RENAME":
$RequestData['File'] = $Request['payloads']['File'];
$RequestData['Filename'] = $Request['payloads']['Filename'];
$Res = RenameFile($RequestData);
$Response = ReturnResponse($Res);
break;
default:
$Response = ReturnResponse(TYPE_NOT_SPECIFIED);
}
return $Response;
} else {
$Response = ReturnResponse(PAYLOAD_MISSING);
$Response['info'] = "Could Not Get User";
return $Response;
}
} else {
$Response = ReturnResponse(PAYLOAD_MISSING);
$Response['info'] = "Data verification failed";
return $Request;
}
}
示例4: CreateTopic
function CreateTopic($username, $topicname, $content, $sectionid, $topictype)
{
$row = ExeSQLFirstRow("SELECT * FROM Topics WHERE Topicname='" . $topicname . "'");
$okay = true;
if ($row[0] == "") {
ExeSQL("INSERT INTO Topics VALUES(NULL, " . $sectionid . ", -1, '" . $topicname . "', '" . $username . "', '" . $topictype . "', 0, now())") or exit;
$row = ExeSQLFirstRow("SELECT * FROM Topics WHERE Topicname='" . $topicname . "'");
ExeSQL("INSERT INTO Posts VALUES(NULL, " . $row[0] . ", '" . $username . "', now(), '" . $content . "')");
$row = ExeSQLFirstRow("SELECT * FROM Posts WHERE TOPICID=" . $row[0]);
ExeSQL("UPDATE ForumSection SET LASTPOSTID=" . $row[0] . ", Topiccount=Topiccount+1 WHERE INDEXID=" . $sectionid);
$user = GetUser($username);
$user->AddExp(Points::$createtopic);
$user->CommitUpdate();
} else {
$okay = false;
}
return $okay;
}
示例5: Process
/**
* Process
* Logs you out and redirects you back to the login page.
* If you are automatically logged in,
* this will also remove the cookie (sets the time back a year)
* so you're not automatically logged in anymore.
*
* @see Login::Process
* @see GetSession
* @see Session::Set
*
* @return void
*/
function Process()
{
$session =& GetSession();
$sessionuser = $session->Get('UserDetails');
$userid = $sessionuser->userid;
$user =& GetUser($userid);
$user->settings = $sessionuser->settings;
$user->SaveSettings();
unset($user);
$session->Set('UserDetails', '');
if (isset($_COOKIE['TrackPointLogin'])) {
$oneyear = time() - 3600 * 265 * 24;
setcookie('TrackPointLogin', '', $oneyear, '/');
}
$_SESSION = array();
session_destroy();
header('Location: ' . $_SERVER['PHP_SELF'] . '?Page=Login&Action=Logout');
}
示例6: __construct
/**
* __construct
* Sets the base path where to look for language token files.
*
* @return Void Does not return anything.
*/
public function __construct()
{
$lang_folder = IEM_PATH . '/language';
$user_lang_folder = 'default';
// ----- Get user language preference
$user = GetUser();
$temp = $user->user_language;
if (!empty($temp) && is_dir("{$lang_folder}/{$user_lang_folder}")) {
$user_lang_folder = $temp;
}
unset($temp);
unset($user);
// -----
$this->base_path = "{$lang_folder}/{$user_lang_folder}";
}
示例7: GetTextMenuItems
/**
* GetTextMenuItems
* This checks the addon is installed & enabled before displaying in the 'tools' menu at the top of the page.
*
* @param EventData_IEM_SENDSTUDIOFUNCTIONS_GENERATETEXTMENULINKS $data The existing text menu items. This addon puts itself into the tools menu.
*
* @uses Load
* @uses enabled
*
* @see SendStudio_Functions::GenerateTextMenuLinks
*
* @return Void The menu is passed in by reference, so it's manipulated directly.
*
* @uses EventData_IEM_SENDSTUDIOFUNCTIONS_GENERATETEXTMENULINKS
*/
public static function GetTextMenuItems(EventData_IEM_SENDSTUDIOFUNCTIONS_GENERATETEXTMENULINKS $data)
{
$user = GetUser();
if (!$user->Admin()) {
return;
}
try {
$me = new self();
$me->Load();
} catch (Exception $e) {
return;
}
if (!$me->enabled) {
return;
}
if (!isset($data->data['tools'])) {
$data->data['tools'] = array();
}
$data->data['tools'][] = array('text' => GetLang('Addon_dbcheck_Menu_Text'), 'link' => $me->admin_url, 'description' => GetLang('Addon_dbcheck_Menu_Description'));
unset($me);
}
示例8: GetTextMenuItems
/**
* GetTextMenuItems
* This checks the addon is installed & enabled before displaying in the 'tools' menu at the top of the page.
*
* @param EventData_IEM_SENDSTUDIOFUNCTIONS_GENERATETEXTMENULINKS $data The existing text menu items. This addon puts itself into the tools menu.
*
* @uses Load
* @uses enabled
*
* @see SendStudio_Functions::GenerateTextMenuLinks
*
* @return Void The menu is passed in by reference, so it's manipulated directly.
*
* @uses EventData_IEM_SENDSTUDIOFUNCTIONS_GENERATETEXTMENULINKS
*/
static function GetTextMenuItems(EventData_IEM_SENDSTUDIOFUNCTIONS_GENERATETEXTMENULINKS $data)
{
$user = GetUser();
if (!$user->Admin()) {
return;
}
try {
$me = new self();
$me->Load();
} catch (Exception $e) {
return;
}
if (!$me->enabled) {
return;
}
if (!isset($data->data['tools'])) {
$data->data['tools'] = array();
}
$data->data['tools'][] = array('text' => GetLang('Addon_updatecheck_Menu_Text'), 'link' => "#\" onclick=\"tb_show('" . LNG_Addon_updatecheck_Check . "', 'index.php?Page=Addons&Addon=updatecheck&Ajax=true&keepThis=true&TB_iframe=true&height=80&width=300', '');", 'description' => GetLang('Addon_updatecheck_Menu_Description'));
unset($me);
}
示例9: HandleUserRequest
/**
* Created by PhpStorm.
* User: sp
* Date: 24/11/15
* Time: 4:37 AM
*/
function HandleUserRequest($Request)
{
include '../common/controller/user_add.php';
include '../common/controller/user_get.php';
include '../common/config/ErrorCodes.php';
include '../common/helpers/ValidateRequest.php';
if (validate_userview_request($Request) == "True") {
$Type = $Request["type"];
$RequestData = $Request["payloads"];
switch ($Type) {
case "PUT":
$Response["STATUS CODE"] = AddUser($RequestData);
if ($Response["STATUS CODE"] == ERROR_DUP_NAME) {
$Response["SUCCESS"] = "False";
} else {
$Response["Payloads"] = "User Added Successfully";
}
$Response["SUCCESS"] = "True";
return $Response;
case "GET":
$Response["Payloads"] = GetUser($RequestData);
if ($Response["Payloads"] == ERROR_DATA_NOT_FOUND) {
$Response["STATUS CODE"] = ERROR_DATA_NOT_FOUND;
$Response["SUCCESS"] = "False";
$Response['Payloads'] = "Authentication Error";
} else {
$Response["SUCCESS"] = "True";
$Response["STATUS CODE"] = 200;
}
return $Response;
default:
return TYPE_NOT_SPECIFIED;
}
} else {
$Response["SUCCESS"] = "False";
$Response["STATUS CODE"] = PAYLOAD_MISSING;
$Response["Payloads"] = "Payloads Missing";
return $Response;
}
}
示例10: ViewSubscriber
/**
* ViewSubscriber
* Prints the 'view subscriber' page and all appropriate options including custom fields.
*
* @param Int $listid The list the subscriber is on. This is checked to make sure the user has 'manage' access to the list before anything else.
* @param Int $subscriberid The subscriberid to view.
* @param Int $segmentid The ID of the segment that the subscriber is going to be fetched from
* @param String $msgtype The heading to show when viewing a subscriber. This can be either error or success. Used with $msg to display something.
* @param String $msg The message to display in the heading. If this is not present, no message is displayed.
*
* @see GetApi
* @see Subscribers_API::GetCustomFieldSettings
* @see Lists_API::GetCustomFields
* @see Lists_API::Load
* @see Lists_API::GetListFormat
*
* @return Void Doesn't return anything. Prints out the view form and that's it.
*/
function ViewSubscriber($listid = 0, $subscriberid = 0, $segmentid = 0, $msgtype = 'Error', $msg = false)
{
$user = GetUser();
$access = $user->HasAccess('Subscribers', 'Manage');
if (!$access) {
$this->DenyAccess();
return;
}
$this->SetupGoogleCalendar();
$search_info = IEM::sessionGet('Search_Subscribers');
$GLOBALS['list'] = $listid;
if ($msg && $msgtype) {
switch (strtolower($msgtype)) {
case 'success':
$GLOBALS['Success'] = $msg;
$GLOBALS['Message'] = $this->ParseTemplate('SuccessMsg', true, false);
break;
default:
$GLOBALS['Error'] = $msg;
$GLOBALS['Message'] = $this->ParseTemplate('ErrorMsg', true, false);
}
}
$SubscriberApi = $this->GetApi('Subscribers');
$subscriberinfo = false;
/**
* Get Subscriber record from the database
*/
$adminAccess = false;
// If this user is an admin/list admin/list admintype == a then give permission
if ($user->Admin() || $user->ListAdminType() == 'a' || $user->ListAdmin()) {
$adminAccess = true;
}
// Get subscribers from list
if ($segmentid == 0) {
if (!$adminAccess && !$SubscriberApi->CheckPermission($user->userid, $subscriberid)) {
$this->DenyAccess();
return;
}
$subscriberinfo = $SubscriberApi->LoadSubscriberList($subscriberid, $listid);
// Get subscribers from segment
} else {
if (!$adminAccess) {
$segmentapi = $this->GetApi('Segment', true);
$segmentapi->Load($segmentid);
if ($segmentapi->ownerid != $user->userid && !$user->HasAccess('Segments', 'View', $segmentid)) {
$this->DenyAccess();
return;
}
}
$subscriberinfo = $SubscriberApi->LoadSubscriberSegment($subscriberid, $segmentid);
}
/**
* -----
*/
// hmm, the subscriber doesn't exist or can't be loaded? show an error.
if (empty($subscriberinfo)) {
$GLOBALS['ErrorMessage'] = GetLang('SubscriberDoesntExist_View');
$this->DenyAccess();
return;
}
// Log this to "User Activity Log"
$logURL = SENDSTUDIO_APPLICATION_URL . '/admin/index.php?Page=Subscribers&Action=Edit&List=' . $_GET['List'] . '&id=' . $_GET['id'];
IEM::logUserActivity($logURL, 'images/contacts_view.gif', $subscriberinfo['emailaddress']);
$list_api = $this->GetApi('Lists');
$list_api->Load($listid);
//.........这里部分代码省略.........
示例11: array
$stmt->bindValue(':medium', $addMovie['medium'], SQLITE3_TEXT);
$stmt->bindValue(':condition', $addMovie['condition'], SQLITE3_TEXT);
$stmt->bindValue(':userId', $addMovie['userId'], SQLITE3_INTEGER);
$r = $stmt->execute();
$response['AddMovie'] = $r === FALSE ? false : $db->lastInsertRowID();
}
if (isset($payloadDecoded['Search'])) {
$searchString = $payloadDecoded['Search'];
$searchString = '%' . $searchString . '%';
$stmt = $db->prepare('SELECT * FROM movies WHERE info LIKE :searchString');
$stmt->bindValue(':searchString', $searchString, SQLITE3_TEXT);
$r = $stmt->execute();
$movies = array();
while ($row = $r->fetchArray(SQLITE3_ASSOC)) {
$row['info'] = json_decode($row['info'], true);
$row['user'] = GetUser($row['user_id']);
$movies[] = $row;
}
$response['Search'] = count($movies) > 0 ? $movies : false;
}
function GetUser($id)
{
global $db;
$stmt = $db->prepare('SELECT * FROM users WHERE id=:id');
$stmt->bindValue(':id', $id, SQLITE3_INTEGER);
$r = $stmt->execute();
return $r->fetchArray(SQLITE3_ASSOC);
}
//-----------------------------------------------
// RESPONSE AND EXIT
//-----------------------------------------------
示例12: PrintStep2
function PrintStep2($error = false)
{
if (!$error) {
$session =& GetSession();
$backupfile = $session->Get('BackupFilename');
$link = str_replace(TRACKPOINT_BASE_DIRECTORY, TRACKPOINT_APPLICATION_URL, TEMP_DIRECTORY . '/' . $backupfile);
$msg = 'Your database has been backed up successfully. You can download it from here: <a href="' . $link . '" target="_blank">' . $link . '</a>';
$this->PrintUpgradeHeader('2', $msg);
$this->StartUpgrade();
} else {
$user =& GetUser();
$msg = 'Problem updating your database:<br/>' . urldecode($error) . '<br/>';
$msg .= 'Please post a support ticket through http://www.interspire.com/clientarea and include the error message above.<br/>';
$this->PrintUpgradeHeader('2', $msg);
}
$this->PrintUpgradeFooter();
}
示例13: getTagsSize
/**
* getTagsSize
* This will return number of dynamic content tags
*
* @return int Return size of loaded dynamic content tags
*/
public function getTagsSize()
{
$user = GetUser();
$query = "SELECT COUNT(dct.tagid) AS tagsize FROM [|PREFIX|]dynamic_content_tags dct ";
if (!$user->isAdmin()) {
$query .= " WHERE dct.ownerid = '{$user->Get('userid')}' ";
}
$result = $this->db->Query($query);
if ($row = $this->db->Fetch($result)) {
return $row['tagsize'];
}
return 0;
}
示例14: Show_Send_Step_4
/**
* Show_Send_Step_4
* Step 4 handles two pieces of functionality:
* - if cron support is enabled, it "approves" the job for sending and then redirects the user to the main splittest page
*
* If cron is not enabled, it processes and sends the emails out in popup mode.
* It looks at the queues table for people to send to, and sends one email per window refresh.
* It prints out a report of what's going on:
* - how many have been sent
* - how many left
* - approx how long it has taken so far
* - approx how long to go
* - optional extra - pause after displaying that info and sending the email (based on user restrictions)
*
* @uses Jobs_API
* @uses Jobs_API::ApproveJob
* @uses Jobs_API::QueueSize
* @uses CheckCronEnabled
* @uses Splittest_Send_API::StartJob
*/
public function Show_Send_Step_4()
{
$send_details = IEM::sessionGet('SplitTestSendDetails');
if (!$send_details || !isset($send_details['splitid']) || (int) $send_details['splitid'] <= 0) {
FlashMessage(GetLang('Addon_splittest_Send_InvalidSplitTest'), SS_FLASH_MSG_ERROR, $this->admin_url);
return;
}
$jobid = $send_details['Job'];
require_once SENDSTUDIO_API_DIRECTORY . '/jobs.php';
$jobApi = new Jobs_API();
if (isset($_GET['Start']) || self::CheckCronEnabled()) {
/**
* Remove the "cleanup" variables so we don't kill the send off when we either
* - successfully schedule a send
* - or start a send going.
*/
IEM::sessionRemove('SplitTestSend_Cleanup');
$user = GetUser();
$jobApi->ApproveJob($jobid, $user->Get('userid'), $user->Get('userid'));
}
/**
* If we get here and cron is enabled, we're finishing off a scheduled send setup.
* Show a message and return the user to the manage screen.
*/
if (self::CheckCronEnabled()) {
FlashMessage(GetLang('Addon_splittest_Send_JobScheduled'), SS_FLASH_MSG_SUCCESS, $this->admin_url);
return;
}
$this->template_system->Assign('AdminUrl', $this->admin_url, false);
$send_api = $this->GetApi('Splittest_Send');
if (isset($_GET['Start'])) {
$send_api->StartJob($jobid, $send_details['splitid']);
}
$sendqueue = $jobApi->GetJobQueue($jobid);
$job = $jobApi->LoadJob($jobid);
$send_api->Set('statids', $send_details['Stats']);
$send_api->Set('jobdetails', $job['jobdetails']);
$send_api->Set('jobowner', $job['ownerid']);
$queuesize = $jobApi->QueueSize($sendqueue, 'splittest');
$send_details['SendQueue'] = $sendqueue;
$timenow = $send_api->GetServerTime();
$timediff = $timenow - $send_details['SendStartTime'];
$time_so_far = $this->TimeDifference($timediff);
$num_left_to_send = $send_details['SendSize'] - $queuesize;
if ($num_left_to_send > 0) {
$timeunits = $timediff / $num_left_to_send;
$timediff = $timeunits * $queuesize;
} else {
$timediff = 0;
}
$timewaiting = $this->TimeDifference($timediff);
$this->template_system->Assign('SendTimeSoFar', sprintf(GetLang('Addon_splittest_Send_Step4_TimeSoFar'), $time_so_far));
$this->template_system->Assign('SendTimeLeft', sprintf(GetLang('Addon_splittest_Send_Step4_TimeLeft'), $timewaiting));
if ($num_left_to_send == 1) {
$this->template_system->Assign('Send_NumberAlreadySent', GetLang('Addon_splittest_Send_Step4_NumberSent_One'));
} else {
$this->template_system->Assign('Send_NumberAlreadySent', sprintf(GetLang('Addon_splittest_Send_Step4_NumberSent_Many'), $this->PrintNumber($num_left_to_send)));
}
if ($queuesize <= 0) {
require_once SENDSTUDIO_API_DIRECTORY . '/ss_email.php';
$email = new SS_Email_API();
if (SENDSTUDIO_SAFE_MODE) {
$email->Set('imagedir', TEMP_DIRECTORY . '/send');
} else {
$email->Set('imagedir', TEMP_DIRECTORY . '/send.' . $jobid . '.' . $sendqueue);
}
$email->CleanupImages();
$send_details['SendEndTime'] = $send_api->GetServerTime();
IEM::sessionSet('SplitTestSendDetails', $send_details);
$this->template_system->Assign('Send_NumberLeft', GetLang('Addon_splittest_Send_Step4_SendFinished'));
$this->template_system->ParseTemplate('send_step4');
?>
<script>
window.opener.focus();
window.opener.document.location = '<?php
echo $this->admin_url . '&Action=Send&Step=5';
?>
';
window.close();
</script>
//.........这里部分代码省略.........
示例15: userTimestamp
/**
* userTimestamp
* When provided with a GMT Unix timestamp, it will return a timestamp
* adjusted for the user's timezone, taking into account the server's
* timezone offset.
*
* @see fixTimestamp
*
* @param Int|String $gmt_ts A valid GMT timestamp.
*
* @return Int A timestamp that has been adjusted with the current user's timezone offset.
*/
private static function userTimestamp($gmt_ts)
{
if (!$gmt_ts) {
return 0;
}
$user = GetUser();
// User timezone offset (seconds).
$user_offset = $user->Get('usertimezone');
// "GMT-11:30"
$user_offset = substr($user_offset, 3);
// "-11:30"
$user_offset = str_replace(':3', '.5', $user_offset);
// "-11.50"
$user_offset = str_replace(':', '.', $user_offset);
$user_offset = floatval($user_offset);
// -11.5
$user_offset = $user_offset * 60 * 60;
// to seconds
$server_offset = date('Z');
return intval($gmt_ts) + ($user_offset - $server_offset);
}