Exemple #1
0
 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;
 }
Exemple #2
0
 /**
  * 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)));
     }
 }
 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))));
     }
 }
Exemple #4
0
\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
Exemple #5
0
 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);
 }
Exemple #6
0
 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));
 }
 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);
         }
     }
 }
Exemple #8
0
 /**
  * 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;
 }
Exemple #9
0
 /**
  * @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];
             $this->append('cssfiles', $web . '/' . $file . '?v=' . self::$versionHash);
         }
     }
 }
Exemple #10
0
 /**
  * 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);
 }
        $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']);
            ?>
Exemple #12
0
 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);
 }
 *
 * 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();
        }
Exemple #14
0
 /**
  * @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;
 }
 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']);
 }
Exemple #16
0
    $backendService = \OC_Mount_Config::$app->getContainer()->query('\\OCA\\Files_External\\Service\\BackendService');
    $enableCertImport = $backendService->isUserMountingAllowed();
}
// Return template
$tmpl = new OC_Template('settings', 'personal', 'user');
$tmpl->assign('usage', OC_Helper::humanFileSize($storageInfo['used']));
$tmpl->assign('total_space', OC_Helper::humanFileSize($storageInfo['total']));
$tmpl->assign('usage_relative', $storageInfo['relative']);
$tmpl->assign('clients', $clients);
$tmpl->assign('email', $email);
$tmpl->assign('languages', $languages);
$tmpl->assign('commonlanguages', $commonLanguages);
$tmpl->assign('activelanguage', $userLang);
$tmpl->assign('passwordChangeSupported', OC_User::canUserChangePassword(OC_User::getUser()));
$tmpl->assign('displayNameChangeSupported', OC_User::canUserChangeDisplayName(OC_User::getUser()));
$tmpl->assign('displayName', OC_User::getDisplayName());
$tmpl->assign('enableAvatars', $config->getSystemValue('enable_avatars', true));
$tmpl->assign('avatarChangeSupported', OC_User::canUserChangeAvatar(OC_User::getUser()));
$tmpl->assign('certs', $certificateManager->listCertificates());
$tmpl->assign('showCertificates', $enableCertImport);
$tmpl->assign('urlGenerator', $urlGenerator);
// Get array of group ids for this user
$groups = \OC::$server->getGroupManager()->getUserIdGroups(OC_User::getUser());
$groups2 = array_map(function ($group) {
    return $group->getGID();
}, $groups);
sort($groups2);
$tmpl->assign('groups', $groups2);
// add hardcoded forms from the template
$l = \OC::$server->getL10N('settings');
$formsAndMore = [];
Exemple #17
0
 /**
  * get the metadata of all files stored in $folder
  *
  * @param string $folderId
  * @return array|false
  */
 public function getFolderContentsById($folderId)
 {
     $cache = $this->getSourceCache('');
     if ($cache) {
         $owner = $this->storage->getSharedFrom();
         $parentPath = $this->getPathById($folderId);
         if ($parentPath !== '') {
             $parentPath .= '/';
         }
         $sourceFolderContent = $cache->getFolderContentsById($folderId);
         foreach ($sourceFolderContent as &$c) {
             $c['path'] = ltrim($parentPath . $c['name'], '/');
             $c['uid_owner'] = $owner;
             $c['displayname_owner'] = \OC_User::getDisplayName($owner);
             $c['permissions'] = $c['permissions'] & $this->storage->getPermissions(false);
         }
         return $sourceFolderContent;
     }
     return false;
 }
 /**
  * @param string $renderas
  * @param string $appid application id
  */
 public function __construct($renderas, $appid = '')
 {
     // 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');
         }
         // Update notification
         if (OC_Config::getValue('updatechecker', true) === true) {
             $data = OC_Updater::check();
             if (isset($data['version']) && $data['version'] != '' and $data['version'] !== array() && OC_User::isAdminUser(OC_User::getUser())) {
                 $this->assign('updateAvailable', true);
                 $this->assign('updateVersion', $data['versionstring']);
                 $this->assign('updateLink', $data['web']);
             } 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', '', false);
         $this->assign('appid', $appid);
         $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());
         $this->assign('appsmanagement_active', strpos(OC_Request::requestUri(), OC_Helper::linkToRoute('settings_apps')) === 0);
         $this->assign('enableAvatars', \OC_Config::getValue('enable_avatars', true));
     } else {
         if ($renderas == 'error') {
             parent::__construct('core', 'layout.guest', '', false);
         } else {
             if ($renderas == 'guest') {
                 parent::__construct('core', 'layout.guest');
             } else {
                 parent::__construct('core', 'layout.base');
             }
         }
     }
     $versionParameter = '?v=' . md5(implode(OC_Util::getVersion()));
     $useAssetPipeline = $this->isAssetPipelineEnabled();
     if ($useAssetPipeline) {
         $this->append('jsfiles', OC_Helper::linkToRoute('js_config') . $versionParameter);
         $this->generateAssets();
     } else {
         // 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);
         }
         foreach ($jsfiles as $info) {
             $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());
         foreach ($cssfiles as $info) {
             $web = $info[1];
             $file = $info[2];
             $this->append('cssfiles', $web . '/' . $file . $versionParameter);
         }
     }
 }
Exemple #19
0
 /**
  * @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');
         }
         // Code integrity notification
         $integrityChecker = \OC::$server->getIntegrityCodeChecker();
         if (!$integrityChecker->hasPassedCheck()) {
             \OCP\Util::addScript('core', 'integritycheck-failed-notification');
         }
         // 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();
         $appsMgmtActive = strpos(\OC::$server->getRequest()->getRequestUri(), \OC::$server->getURLGenerator()->linkToRoute('settings.AppSettings.viewApps')) === 0;
         if ($appsMgmtActive) {
             $l = \OC::$server->getL10N('lib');
             $this->assign('application', $l->t('Apps'));
         }
         $this->assign('user_displayname', $userDisplayName);
         $this->assign('user_uid', \OC_User::getUser());
         $this->assign('appsmanagement_active', $appsMgmtActive);
         $this->assign('enableAvatars', $this->config->getSystemValue('enable_avatars', true) === true);
         if (\OC_User::getUser() === false) {
             $this->assign('userAvatarSet', false);
         } else {
             $this->assign('userAvatarSet', \OC::$server->getAvatarManager()->getAvatar(\OC_User::getUser())->exists());
         }
     } 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 (\OC::$server->getSystemConfig()->getValue('installed', false)) {
         if (empty(self::$versionHash)) {
             $v = \OC_App::getAppVersions();
             $v['core'] = implode('.', \OCP\Util::getVersion());
             self::$versionHash = md5(implode(',', $v));
         }
     } else {
         self::$versionHash = md5('not installed');
     }
     $useAssetPipeline = self::isAssetPipelineEnabled();
     if ($useAssetPipeline) {
         $this->append('jsfiles', \OC::$server->getURLGenerator()->linkToRoute('js_config', ['v' => self::$versionHash]));
         $this->generateAssets();
     } else {
         // Add the js files
         $jsFiles = self::findJavascriptFiles(\OC_Util::$scripts);
         $this->assign('jsfiles', array());
         if ($this->config->getSystemValue('installed', false) && $renderAs != 'error') {
             $this->append('jsfiles', \OC::$server->getURLGenerator()->linkToRoute('js_config', ['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];
             $this->append('cssfiles', $web . '/' . $file . '?v=' . self::$versionHash);
         }
     }
 }
 *
 * You should have received a copy of the GNU Affero General Public
 * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
 *
 */
OC_JSON::callCheck();
OC_JSON::checkSubAdminUser();
if (isset($_GET['offset'])) {
    $offset = $_GET['offset'];
} else {
    $offset = 0;
}
if (isset($_GET['limit'])) {
    $limit = $_GET['limit'];
} else {
    $limit = 10;
}
$users = array();
if (OC_User::isAdminUser(OC_User::getUser())) {
    $batch = OC_User::getDisplayNames('', $limit, $offset);
    foreach ($batch as $user => $displayname) {
        $users[] = array('name' => $user, 'displayname' => $displayname, 'groups' => join(', ', OC_Group::getUserGroups($user)), 'subadmin' => join(', ', OC_SubAdmin::getSubAdminsGroups($user)), 'quota' => OC_Preferences::getValue($user, 'files', 'quota', 'default'));
    }
} else {
    $groups = OC_SubAdmin::getSubAdminsGroups(OC_User::getUser());
    $batch = OC_Group::usersInGroups($groups, '', $limit, $offset);
    foreach ($batch as $user) {
        $users[] = array('name' => $user, 'displayname' => OC_User::getDisplayName($user), 'groups' => join(', ', OC_Group::getUserGroups($user)), 'quota' => OC_Preferences::getValue($user, 'files', 'quota', 'default'));
    }
}
OC_JSON::success(array('data' => $users));
OCP\JSON::callCheck();
OC_JSON::checkLoggedIn();
$l = \OC::$server->getL10N('settings');
$username = isset($_POST["username"]) ? $_POST["username"] : OC_User::getUser();
$displayName = (string) $_POST["displayName"];
$userstatus = null;
if (OC_User::isAdminUser(OC_User::getUser())) {
    $userstatus = 'admin';
}
$isUserAccessible = false;
$subadminUserObject = \OC::$server->getUserManager()->get(\OC_User::getUser());
$targetUserObject = \OC::$server->getUserManager()->get($username);
if ($subadminUserObject !== null && $targetUserObject !== null) {
    $isUserAccessible = \OC::$server->getGroupManager()->getSubAdmin()->isUserAccessible($subadminUserObject, $targetUserObject);
}
if ($isUserAccessible) {
    $userstatus = 'subadmin';
}
if ($username === OC_User::getUser() && OC_User::canUserChangeDisplayName($username)) {
    $userstatus = 'changeOwnDisplayName';
}
if (is_null($userstatus)) {
    OC_JSON::error(array("data" => array("message" => $l->t("Authentication error"))));
    exit;
}
// Return Success story
if (OC_User::setDisplayName($username, $displayName)) {
    OC_JSON::success(array("data" => array("message" => $l->t('Your full name has been changed.'), "username" => $username, 'displayName' => $displayName)));
} else {
    OC_JSON::error(array("data" => array("message" => $l->t("Unable to change full name"), 'displayName' => OC_User::getDisplayName($username))));
}
			<!--input type="hidden" name="creator" value="<?php 
p(OC_User::getUser());
?>
" /-->
			<!--
			<tr>
				<td>
					<?php 
p($l->t('Creator'));
?>
 :
				</td>

				<td>
					<?php 
print "&nbsp;" . OC_User::getDisplayName() . "&nbsp;(" . OC_User::getUser() . ")";
?>
				</td>
			</tr>
			-->

			<tr>
				<td>
					<?php 
p($l->t('Deadline'));
?>
 : <span class="required">*</span>
				</td>

				<td>
					<input type="text" id="deadline" name="deadline" placeholder="MM/DD/YYYY" <?php 
Exemple #23
0
 /**
  * Returns the display name for the uid given
  *
  * @param string $uid
  * @return string
  */
 public function getDisplayName($uid)
 {
     return \OC_User::getDisplayName($uid);
 }
<?php foreach ($_['conversation'] as $post) : 
	$post = OC_Conversations::preparePost($post);
	extract($post); ?>
	<div class="comment" data-id="<?php p($id); ?>">
		<div class="comment-header">
			<?php if ( ! empty($avatar) ) { ?>
				<div class="avatar">
					<img src="<?php p($avatar); ?>" />
				</div>
			<?php } ?>
			<div class="author">
				<strong><?php p(OC_User::getDisplayName($author)); ?></strong>				
			</div>
			<div class="date">
				<time class="timeago" datetime="<?php p($date['ISO8601']); ?>"><?php p($date['datetime']); ?></time>
			</div>
			<?php 
			$uid = OC_User::getUser();
			if( USER_CONVERSATIONS_CAN_DELETE && ( OC_User::isAdminUser($uid) || $author == $uid ) ): ?>
				<div class="delete"><a href="#" class="action delete delete-icon"></a></div>
			<?php endif; ?>
		</div>
		<?php if ( ! empty($text) ) { ?>
			<div class="comment-text">
				<?php print_unescaped( $text ); ?>
			</div>
		<?php } 
		if ( ! empty($attachment) ) { ?>
			<div class="comment-attachment">
				<?php echo $this->inc('part.attachment', array('attachment' => $attachment)); ?>
			</div>