本文整理汇总了PHP中OC_User::getDisplayName方法的典型用法代码示例。如果您正苦于以下问题:PHP OC_User::getDisplayName方法的具体用法?PHP OC_User::getDisplayName怎么用?PHP OC_User::getDisplayName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OC_User
的用法示例。
在下文中一共展示了OC_User::getDisplayName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: formatCacheEntry
protected function formatCacheEntry($entry)
{
$path = $entry['path'];
$entry = parent::formatCacheEntry($entry);
$sharePermissions = $this->storage->getPermissions($path);
if (isset($entry['permissions'])) {
$entry['permissions'] &= $sharePermissions;
} else {
$entry['permissions'] = $sharePermissions;
}
$entry['uid_owner'] = $this->storage->getOwner($path);
$entry['displayname_owner'] = \OC_User::getDisplayName($entry['uid_owner']);
if ($path === '') {
$entry['is_share_mount_point'] = true;
}
return $entry;
}
示例2: sendTestMail
/**
* Send a mail to test the settings
*/
public static function sendTestMail()
{
\OC_Util::checkAdminUser();
\OCP\JSON::callCheck();
$l = \OC::$server->getL10N('settings');
$email = \OC_Preferences::getValue(\OC_User::getUser(), 'settings', 'email', '');
if (!empty($email)) {
$defaults = new \OC_Defaults();
try {
\OC_Mail::send($email, \OC_User::getDisplayName(), $l->t('test email settings'), $l->t('If you received this email, the settings seem to be correct.'), \OCP\Util::getDefaultEmailAddress('no-reply'), $defaults->getName());
} catch (\Exception $e) {
$message = $l->t('A problem occurred while sending the e-mail. Please revisit your settings.');
\OC_JSON::error(array("data" => array("message" => $message)));
exit;
}
\OC_JSON::success(array("data" => array("message" => $l->t("Email sent"))));
} else {
$message = $l->t('You need to set your user email before being able to send test emails.');
\OC_JSON::error(array("data" => array("message" => $message)));
}
}
示例3: getAvatar
public static function getAvatar($args)
{
\OC_JSON::checkLoggedIn();
\OC_JSON::callCheck();
$user = stripslashes($args['user']);
$size = (int) $args['size'];
if ($size > 2048) {
$size = 2048;
} elseif ($size === 0) {
$size = 64;
}
$avatar = new \OC_Avatar($user);
$image = $avatar->get($size);
\OC_Response::disableCaching();
\OC_Response::setLastModifiedHeader(time());
if ($image instanceof \OC_Image) {
\OC_Response::setETagHeader(crc32($image->data()));
$image->show();
} else {
// Signalizes $.avatar() to display a defaultavatar
\OC_JSON::success(array("data" => array("displayname" => \OC_User::getDisplayName($user))));
}
}
示例4: isset
\OCP\JSON::checkAppEnabled('gallery');
OCP\Util::addStyle('gallery', 'styles');
OCP\Util::addStyle('gallery', 'mobile');
$token = isset($_GET['t']) ? (string) $_GET['t'] : '';
if ($token) {
$linkItem = \OCP\Share::getShareByToken($token, false);
if (is_array($linkItem) && isset($linkItem['uid_owner'])) {
// seems to be a valid share
$type = $linkItem['item_type'];
$fileSource = $linkItem['file_source'];
$shareOwner = $linkItem['uid_owner'];
$path = null;
$rootLinkItem = \OCP\Share::resolveReShare($linkItem);
$fileOwner = $rootLinkItem['uid_owner'];
$albumName = trim($linkItem['file_target'], '//');
$ownerDisplayName = \OC_User::getDisplayName($fileOwner);
// stupid copy and paste job
if (isset($linkItem['share_with'])) {
// Authenticate share_with
$url = OCP\Util::linkToPublic('gallery') . '&t=' . $token;
if (isset($_GET['file'])) {
$url .= '&file=' . urlencode($_GET['file']);
} else {
if (isset($_GET['dir'])) {
$url .= '&dir=' . urlencode($_GET['dir']);
}
}
if (isset($_POST['password'])) {
$password = $_POST['password'];
if ($linkItem['share_type'] == OCP\Share::SHARE_TYPE_LINK) {
// Check Password
示例5: getCurrentUser
public static function getCurrentUser()
{
$email = \OC::$server->getConfig()->getUserValue(OC_User::getUser(), 'settings', 'email', '');
$data = array('id' => OC_User::getUser(), 'display-name' => OC_User::getDisplayName(), 'email' => $email);
return new OC_OCS_Result($data);
}
示例6: testAdminEditDisplayNameOfUser
public function testAdminEditDisplayNameOfUser()
{
// Test admin editing users name
$user = $this->generateUsers();
\OC_Group::addToGroup($user, 'admin');
self::loginAsUser($user);
$user2 = $this->generateUsers();
$result = \OCA\provisioning_API\Users::editUser(array('userid' => $user2, '_put' => array('key' => 'display', 'value' => 'newname')));
$this->assertInstanceOf('OC_OCS_Result', $result);
$this->assertTrue($result->succeeded());
$this->assertEquals('newname', \OC_User::getDisplayName($user2));
}
示例7: __construct
public function __construct($renderas)
{
// Decide which page we show
if ($renderas == 'user') {
parent::__construct('core', 'layout.user');
if (in_array(OC_APP::getCurrentApp(), array('settings', 'admin', 'help')) !== false) {
$this->assign('bodyid', 'body-settings');
} else {
$this->assign('bodyid', 'body-user');
}
// Add navigation entry
$this->assign('application', '', false);
$navigation = OC_App::getNavigation();
$this->assign('navigation', $navigation);
$this->assign('settingsnavigation', OC_App::getSettingsNavigation());
foreach ($navigation as $entry) {
if ($entry['active']) {
$this->assign('application', $entry['name']);
break;
}
}
$user_displayname = OC_User::getDisplayName();
$this->assign('user_displayname', $user_displayname);
$this->assign('user_uid', OC_User::getUser());
} else {
if ($renderas == 'guest' || $renderas == 'error') {
parent::__construct('core', 'layout.guest');
} else {
parent::__construct('core', 'layout.base');
}
}
$versionParameter = '?v=' . md5(implode(OC_Util::getVersion()));
// Add the js files
$jsfiles = self::findJavascriptFiles(OC_Util::$scripts);
$this->assign('jsfiles', array(), false);
if (OC_Config::getValue('installed', false) && $renderas != 'error') {
$this->append('jsfiles', OC_Helper::linkToRoute('js_config') . $versionParameter);
}
if (!empty(OC_Util::$core_scripts)) {
$this->append('jsfiles', OC_Helper::linkToRemoteBase('core.js', false) . $versionParameter);
}
foreach ($jsfiles as $info) {
$root = $info[0];
$web = $info[1];
$file = $info[2];
$this->append('jsfiles', $web . '/' . $file . $versionParameter);
}
// Add the css files
$cssfiles = self::findStylesheetFiles(OC_Util::$styles);
$this->assign('cssfiles', array());
if (!empty(OC_Util::$core_styles)) {
$this->append('cssfiles', OC_Helper::linkToRemoteBase('core.css', false) . $versionParameter);
}
foreach ($cssfiles as $info) {
$root = $info[0];
$web = $info[1];
$file = $info[2];
$paths = explode('/', $file);
$in_root = false;
foreach (OC::$APPSROOTS as $app_root) {
if ($root == $app_root['path']) {
$in_root = true;
break;
}
}
if ($in_root) {
$app = $paths[0];
unset($paths[0]);
$path = implode('/', $paths);
$this->append('cssfiles', OC_Helper::linkTo($app, $path) . $versionParameter);
} else {
$this->append('cssfiles', $web . '/' . $file . $versionParameter);
}
}
}
示例8: getFolderContents
/**
* get the metadata of all files stored in $folder
*
* @param string $folder
* @return array
*/
public function getFolderContents($folder)
{
if ($folder === false) {
$folder = '';
}
$dir = $folder !== '' ? $folder . '/' : '';
$cache = $this->getSourceCache($folder);
if ($cache) {
$parent = $this->storage->getFile($folder);
$sourceFolderContent = $cache->getFolderContents($this->files[$folder]);
foreach ($sourceFolderContent as $key => $c) {
$sourceFolderContent[$key]['path'] = $dir . $c['name'];
$sourceFolderContent[$key]['uid_owner'] = $parent['uid_owner'];
$sourceFolderContent[$key]['displayname_owner'] = \OC_User::getDisplayName($parent['uid_owner']);
$sourceFolderContent[$key]['permissions'] = $sourceFolderContent[$key]['permissions'] & $this->storage->getPermissions($dir . $c['name']);
}
return $sourceFolderContent;
}
return false;
}
示例9: __construct
/**
* @param string $renderAs
* @param string $appId application id
*/
public function __construct($renderAs, $appId = '')
{
// yes - should be injected ....
$this->config = \OC::$server->getConfig();
// Decide which page we show
if ($renderAs == 'user') {
parent::__construct('core', 'layout.user');
if (in_array(OC_App::getCurrentApp(), ['settings', 'admin', 'help']) !== false) {
$this->assign('bodyid', 'body-settings');
} else {
$this->assign('bodyid', 'body-user');
}
// Update notification
if ($this->config->getSystemValue('updatechecker', true) === true && OC_User::isAdminUser(OC_User::getUser())) {
$updater = new \OC\Updater(\OC::$server->getHTTPHelper(), \OC::$server->getConfig());
$data = $updater->check();
if (isset($data['version']) && $data['version'] != '' and $data['version'] !== array()) {
$this->assign('updateAvailable', true);
$this->assign('updateVersion', $data['versionstring']);
$this->assign('updateLink', $data['web']);
\OCP\Util::addScript('core', 'update-notification');
} else {
$this->assign('updateAvailable', false);
// No update available or not an admin user
}
} else {
$this->assign('updateAvailable', false);
// Update check is disabled
}
// Add navigation entry
$this->assign('application', '');
$this->assign('appid', $appId);
$navigation = OC_App::getNavigation();
$this->assign('navigation', $navigation);
$settingsNavigation = OC_App::getSettingsNavigation();
$this->assign('settingsnavigation', $settingsNavigation);
foreach ($navigation as $entry) {
if ($entry['active']) {
$this->assign('application', $entry['name']);
break;
}
}
foreach ($settingsNavigation as $entry) {
if ($entry['active']) {
$this->assign('application', $entry['name']);
break;
}
}
$userDisplayName = OC_User::getDisplayName();
$this->assign('user_displayname', $userDisplayName);
$this->assign('user_uid', OC_User::getUser());
$this->assign('appsmanagement_active', strpos(\OC::$server->getRequest()->getRequestUri(), \OC::$server->getURLGenerator()->linkToRoute('settings.AppSettings.viewApps')) === 0);
$this->assign('enableAvatars', $this->config->getSystemValue('enable_avatars', true));
$this->assign('userAvatarSet', \OC_Helper::userAvatarSet(OC_User::getUser()));
} else {
if ($renderAs == 'error') {
parent::__construct('core', 'layout.guest', '', false);
$this->assign('bodyid', 'body-login');
} else {
if ($renderAs == 'guest') {
parent::__construct('core', 'layout.guest');
$this->assign('bodyid', 'body-login');
} else {
parent::__construct('core', 'layout.base');
}
}
}
// Send the language to our layouts
$this->assign('language', OC_L10N::findLanguage());
if (empty(self::$versionHash)) {
$v = OC_App::getAppVersions();
$v['core'] = implode('.', \OC_Util::getVersion());
self::$versionHash = md5(implode(',', $v));
}
$useAssetPipeline = self::isAssetPipelineEnabled();
if ($useAssetPipeline) {
$this->append('jsfiles', OC_Helper::linkToRoute('js_config', array('v' => self::$versionHash)));
$this->generateAssets();
} else {
// Add the js files
$jsFiles = self::findJavascriptFiles(OC_Util::$scripts);
$this->assign('jsfiles', array(), false);
if ($this->config->getSystemValue('installed', false) && $renderAs != 'error') {
$this->append('jsfiles', OC_Helper::linkToRoute('js_config', array('v' => self::$versionHash)));
}
foreach ($jsFiles as $info) {
$web = $info[1];
$file = $info[2];
$this->append('jsfiles', $web . '/' . $file . '?v=' . self::$versionHash);
}
// Add the css files
$cssFiles = self::findStylesheetFiles(OC_Util::$styles);
$this->assign('cssfiles', array());
foreach ($cssFiles as $info) {
$web = $info[1];
$file = $info[2];
//.........这里部分代码省略.........
示例10: getDisplayName
/**
* Get the user display name of the user currently logged in.
* @param string|null $user user id or null for current user
* @return string display name
*/
public static function getDisplayName($user = null)
{
return \OC_User::getDisplayName($user);
}
示例11: foreach
$showGroups = true;
$showUsers = true;
$newMsgCounter = 0;
foreach ($_['rooms'] as $rid => $room) {
$room_name = $room['name'];
if ($room['type'] == "group" && $showGroups) {
$showGroups = false;
?>
<li class='user-label'><label><?php
p($l->t("Groups"));
?>
</label></li>
<?php
}
if ($room['type'] == "user") {
$room_name = OC_User::getDisplayName($room['name']);
$avatar = OC_Conversations::getUserAvatar($room['name']);
if ($showUsers) {
$showUsers = false;
?>
<li class='user-label'><label><?php
p($l->t("User"));
?>
</label></li>
<?php
}
}
?>
<li class="<?php
p($room['type']);
?>
示例12: getCurrentUser
public static function getCurrentUser()
{
$email = OC_Preferences::getValue(OC_User::getUser(), 'settings', 'email', '');
$data = array('id' => OC_User::getUser(), 'display-name' => OC_User::getDisplayName(), 'email' => $email);
return new OC_OCS_Result($data);
}
示例13:
*
* This library is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
if ($_POST) {
$username = \OC_User::getDisplayName();
$password = $_POST['password'];
\OC_User::clearBackends();
\OC_User::useBackend(new OC_User_Database());
if (\OC_User::userExists($username)) {
if (!empty($password) && \OC_User::setPassword($username, $password)) {
\OC_JSON::success();
} else {
\OC_JSON::error();
}
} else {
if (!empty($password) && \OC_User::createUser($username, $password)) {
\OC_JSON::success();
} else {
\OC_JSON::error();
}
示例14: displayNamesInGroup
/**
* @brief get a list of all display names in a group
* @returns array with display names (value) and user ids(key)
*/
public function displayNamesInGroup($gid, $search, $limit, $offset)
{
if (!$this->enabled) {
return array();
}
if (!$this->groupExists($gid)) {
return array();
}
$users = $this->usersInGroup($gid, $search, $limit, $offset);
$displayNames = array();
foreach ($users as $user) {
$displayNames[$user] = \OC_User::getDisplayName($user);
}
return $displayNames;
}
示例15: preparePost
public static function preparePost($post)
{
$dateTimeObj = new DateTime($post['date']);
return array("id" => $post['id'], "avatar" => self::getUserAvatar($post['author']), "author" => OC_User::getDisplayName($post['author']), "date" => array('ISO8601' => $dateTimeObj->format(DateTime::ISO8601), 'datetime' => date('Y-m-d H:i\\h', strtotime($post['date']))), "text" => empty($post['text']) ? "" : self::formatComment($post['text']), "attachment" => empty($post['attachment']) ? "" : self::getAttachment($post['attachment']), "room" => $post['room']);
}