当前位置: 首页>>代码示例>>PHP>>正文


PHP USER::getUser方法代码示例

本文整理汇总了PHP中OCP\USER::getUser方法的典型用法代码示例。如果您正苦于以下问题:PHP USER::getUser方法的具体用法?PHP USER::getUser怎么用?PHP USER::getUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OCP\USER的用法示例。


在下文中一共展示了USER::getUser方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: search

 /**
  * Search for query in calendar events
  *
  * @param string $query
  * @return array list of \OCA\Calendar\Search\Event
  */
 function search($query)
 {
     $calendars = \OC_Calendar_Calendar::allCalendars(\OCP\USER::getUser(), true);
     // check if the calenar is enabled
     if (count($calendars) == 0 || !\OCP\App::isEnabled('calendar')) {
         return array();
     }
     $results = array();
     foreach ($calendars as $calendar) {
         $objects = \OC_Calendar_Object::all($calendar['id']);
         $date = strtotime($query);
         // search all calendar objects, one by one
         foreach ($objects as $object) {
             // skip non-events
             if ($object['objecttype'] != 'VEVENT') {
                 continue;
             }
             // check the event summary string
             if (stripos($object['summary'], $query) !== false) {
                 $results[] = new \OCA\Calendar\Search\Event($object);
                 continue;
             }
             // check if the event is happening on a queried date
             $range = $this->getDateRange($object);
             if ($date && $this->fallsWithin($date, $range)) {
                 $results[] = new \OCA\Calendar\Search\Event($object);
                 continue;
             }
         }
     }
     return $results;
 }
开发者ID:yheric455042,项目名称:owncloud82,代码行数:38,代码来源:provider.php

示例2: getCalenderSources

 public static function getCalenderSources($parameters)
 {
     $base_url = \OCP\Util::linkTo('calendar', 'ajax/events.php') . '?calendar_id=';
     foreach (Addressbook::all(\OCP\USER::getUser()) as $addressbook) {
         $parameters['sources'][] = array('url' => $base_url . 'birthday_' . $addressbook['id'], 'backgroundColor' => '#cccccc', 'borderColor' => '#888', 'textColor' => 'black', 'cache' => true, 'editable' => false);
     }
 }
开发者ID:netcon-source,项目名称:apps,代码行数:7,代码来源:hooks.php

示例3: getACL

 /**
  * Returns a list of ACE's for this node.
  *
  * Each ACE has the following properties:
  *   * 'privilege', a string such as {DAV:}read or {DAV:}write. These are
  *     currently the only supported privileges
  *   * 'principal', a url to the principal who owns the node
  *   * 'protected' (optional), indicating that this ACE is not allowed to
  *      be updated.
  *
  * @return array
  */
 public function getACL()
 {
     $readprincipal = $this->getOwner();
     $writeprincipal = $this->getOwner();
     $uid = CalendarCalendar::extractUserID($this->getOwner());
     $calendar = CalendarApp::getCalendar($this->calendarInfo['id'], false, false);
     if ($uid === \OCP\USER::getUser() && (bool) $calendar['issubscribe'] === true) {
         $readprincipal = 'principals/' . \OCP\USER::getUser();
         $writeprincipal = '';
     }
     if ($uid !== \OCP\USER::getUser()) {
         $sharedCalendar = \OCP\Share::getItemSharedWithBySource(CalendarApp::SHARECALENDAR, CalendarApp::SHARECALENDARPREFIX . $this->calendarInfo['id']);
         if ($sharedCalendar && $sharedCalendar['permissions'] & \OCP\PERMISSION_READ) {
             $readprincipal = 'principals/' . \OCP\USER::getUser();
             $writeprincipal = '';
         }
         if ($sharedCalendar && $sharedCalendar['permissions'] & \OCP\PERMISSION_UPDATE) {
             $readprincipal = 'principals/' . \OCP\USER::getUser();
             $writeprincipal = 'principals/' . \OCP\USER::getUser();
         }
     }
     $acl = array(array('privilege' => '{DAV:}read', 'principal' => $readprincipal, 'protected' => true), array('privilege' => '{DAV:}write', 'principal' => $writeprincipal, 'protected' => true), array('privilege' => '{DAV:}read', 'principal' => $readprincipal . '/calendar-proxy-write', 'protected' => true), array('privilege' => '{DAV:}write', 'principal' => $writeprincipal . '/calendar-proxy-write', 'protected' => true), array('privilege' => '{DAV:}read', 'principal' => $readprincipal . '/calendar-proxy-read', 'protected' => true), array('privilege' => '{' . \Sabre\CalDAV\Plugin::NS_CALDAV . '}read-free-busy', 'principal' => '{DAV:}authenticated', 'protected' => true));
     if (empty($this->calendarInfo['{http://sabredav.org/ns}read-only'])) {
         $acl[] = ['privilege' => '{DAV:}write', 'principal' => $writeprincipal, 'protected' => true];
         $acl[] = ['privilege' => '{DAV:}write', 'principal' => $writeprincipal . '/calendar-proxy-write', 'protected' => true];
     }
     return $acl;
 }
开发者ID:Bullnados,项目名称:calendarplus,代码行数:40,代码来源:calendar.php

示例4: getACL

 /**
  * Returns a list of ACE's for this node.
  *
  * Each ACE has the following properties:
  *   * 'privilege', a string such as {DAV:}read or {DAV:}write. These are
  *     currently the only supported privileges
  *   * 'principal', a url to the principal who owns the node
  *   * 'protected' (optional), indicating that this ACE is not allowed to
  *      be updated.
  *
  * @return array
  */
 public function getACL()
 {
     $readprincipal = $this->getOwner();
     $writeprincipal = $this->getOwner();
     $createprincipal = $this->getOwner();
     $deleteprincipal = $this->getOwner();
     $uid = AddrBook::extractUserID($this->getOwner());
     //\OCP\Config::setUserValue($uid, 'contactsplus', 'syncaddrbook', $this->addressBookInfo['uri']);
     $readWriteACL = array(array('privilege' => '{DAV:}read', 'principal' => 'principals/' . \OCP\User::getUser(), 'protected' => true), array('privilege' => '{DAV:}write', 'principal' => 'principals/' . \OCP\User::getUser(), 'protected' => true));
     if ($uid !== \OCP\USER::getUser()) {
         $sharedAddressbook = \OCP\Share::getItemSharedWithBySource(ContactsApp::SHAREADDRESSBOOK, ContactsApp::SHAREADDRESSBOOKPREFIX . $this->addressBookInfo['id']);
         if ($sharedAddressbook) {
             if ($sharedAddressbook['permissions'] & \OCP\PERMISSION_CREATE && $sharedAddressbook['permissions'] & \OCP\PERMISSION_UPDATE && $sharedAddressbook['permissions'] & \OCP\PERMISSION_DELETE) {
                 return $readWriteACL;
             }
             if ($sharedAddressbook['permissions'] & \OCP\PERMISSION_CREATE) {
                 $createprincipal = 'principals/' . \OCP\USER::getUser();
             }
             if ($sharedAddressbook['permissions'] & \OCP\PERMISSION_READ) {
                 $readprincipal = 'principals/' . \OCP\USER::getUser();
             }
             if ($sharedAddressbook['permissions'] & \OCP\PERMISSION_UPDATE) {
                 $writeprincipal = 'principals/' . \OCP\USER::getUser();
             }
             if ($sharedAddressbook['permissions'] & \OCP\PERMISSION_DELETE) {
                 $deleteprincipal = 'principals/' . \OCP\USER::getUser();
             }
         }
     } else {
         return parent::getACL();
     }
     return array(array('privilege' => '{DAV:}read', 'principal' => $readprincipal, 'protected' => true), array('privilege' => '{DAV:}write-content', 'principal' => $writeprincipal, 'protected' => true), array('privilege' => '{DAV:}bind', 'principal' => $createprincipal, 'protected' => true), array('privilege' => '{DAV:}unbind', 'principal' => $deleteprincipal, 'protected' => true));
 }
开发者ID:sahne123,项目名称:contactsplus,代码行数:45,代码来源:addressbook.php

示例5: getACL

 /**
  * Returns a list of ACE's for this node.
  *
  * Each ACE has the following properties:
  *   * 'privilege', a string such as {DAV:}read or {DAV:}write. These are
  *     currently the only supported privileges
  *   * 'principal', a url to the principal who owns the node
  *   * 'protected' (optional), indicating that this ACE is not allowed to
  *      be updated.
  *
  * @return array
  */
 public function getACL()
 {
     $readprincipal = $this->getOwner();
     $writeprincipal = $this->getOwner();
     $calendarConnector = new CalendarConnector();
     $shareConnector = new ShareConnector();
     $uid = $calendarConnector->extractUserID($this->getOwner());
     $calendar = $calendarConnector->getCalendar($this->calendarInfo['id'], false, false);
     $user = \OCP\USER::getUser();
     if ($uid === $user && (bool) $calendar['issubscribe'] === true) {
         $readprincipal = 'principals/' . $user;
         $writeprincipal = '';
     }
     if ($uid !== $user) {
         $sharedCalendar = $shareConnector->getItemSharedWithBySourceCalendar($this->calendarInfo['id']);
         if ($sharedCalendar && $sharedCalendar['permissions'] & $shareConnector->getReadAccess()) {
             $readprincipal = 'principals/' . $user;
             $writeprincipal = '';
         }
         if ($sharedCalendar && $sharedCalendar['permissions'] & $shareConnector->getUpdateAccess()) {
             $readprincipal = 'principals/' . $user;
             $writeprincipal = 'principals/' . $user;
         }
     }
     $acl = array(array('privilege' => '{DAV:}read', 'principal' => $readprincipal, 'protected' => true), array('privilege' => '{DAV:}write', 'principal' => $writeprincipal, 'protected' => true), array('privilege' => '{DAV:}read', 'principal' => $readprincipal . '/calendar-proxy-write', 'protected' => true), array('privilege' => '{DAV:}write', 'principal' => $writeprincipal . '/calendar-proxy-write', 'protected' => true), array('privilege' => '{DAV:}read', 'principal' => $readprincipal . '/calendar-proxy-read', 'protected' => true), array('privilege' => '{' . \Sabre\CalDAV\Plugin::NS_CALDAV . '}read-free-busy', 'principal' => '{DAV:}authenticated', 'protected' => true));
     if (empty($this->calendarInfo['{http://sabredav.org/ns}read-only'])) {
         $acl[] = ['privilege' => '{DAV:}write', 'principal' => $writeprincipal, 'protected' => true];
         $acl[] = ['privilege' => '{DAV:}write', 'principal' => $writeprincipal . '/calendar-proxy-write', 'protected' => true];
     }
     return $acl;
 }
开发者ID:Rotzbua,项目名称:calendarplus,代码行数:43,代码来源:calendar.php

示例6: __construct

 public function __construct($userid = null)
 {
     if ($userid !== null) {
         $this->userid = $userid;
     } else {
         $this->userid = \OCP\USER::getUser();
     }
 }
开发者ID:netcon-source,项目名称:apps,代码行数:8,代码来源:foldermapper.php

示例7: setFileData

 public function setFileData($path, $width, $height)
 {
     $stmt = \OCP\DB::prepare('INSERT INTO `*PREFIX*pictures_images_cache` (`uid_owner`, `path`, `width`, `height`) VALUES (?, ?, ?, ?)');
     $stmt->execute(array(\OCP\USER::getUser(), $path, $width, $height));
     $ret = array('path' => $path, 'width' => $width, 'height' => $height);
     $dir = dirname($path);
     $this->cache[$dir][$path] = $ret;
     return $ret;
 }
开发者ID:blablubli,项目名称:owncloudapps,代码行数:9,代码来源:managers.php

示例8: init

 /**
  * init the versioning and create the versions folder.
  */
 public static function init()
 {
     if (\OCP\Config::getSystemValue('files_versions', Storage::DEFAULTENABLED) == 'true') {
         // create versions folder
         $foldername = \OCP\Config::getSystemValue('datadirectory') . '/' . \OCP\USER::getUser() . '/' . \OCP\Config::getSystemValue('files_versionsfolder', Storage::DEFAULTFOLDER);
         if (!is_dir($foldername)) {
             mkdir($foldername);
         }
     }
 }
开发者ID:jaeindia,项目名称:ownCloud-Enhancements,代码行数:13,代码来源:versions.php

示例9: deleteThumb

 /**
  * Delete thumb from filesystem if exists
  * @param string $thumbPath
  */
 private static function deleteThumb($thumbPath)
 {
     // Get full thumbnail path
     $fileInfo = pathinfo($thumbPath);
     $user = \OCP\USER::getUser();
     $previewDir = \OC_User::getHome($user) . '/oclife/previews/' . $user;
     $fullThumbPath = $previewDir . $fileInfo['dirname'] . '/' . $fileInfo['filename'] . '.png';
     // If thumbnail exists remove it
     if (file_exists($fullThumbPath)) {
         unlink($fullThumbPath);
     }
 }
开发者ID:Greenworker,项目名称:oclife,代码行数:16,代码来源:utilities.php

示例10: getAddressBooksForUser

 /**
  * Returns the list of addressbooks for a specific user.
  *
  * @param string $principaluri
  * @return array
  */
 public function getAddressBooksForUser($principaluri)
 {
     $data = AddrBook::allWherePrincipalURIIs($principaluri);
     $addressbooks = array();
     foreach ($data as $i) {
         if ($i['userid'] !== \OCP\USER::getUser()) {
             $i['uri'] = $i['uri'] . '_shared_by_' . $i['userid'];
         }
         $addressbooks[] = array('id' => $i['id'], 'uri' => $i['uri'], 'principaluri' => 'principals/' . $i['userid'], '{DAV:}displayname' => $i['displayname'], '{' . \Sabre\CardDAV\Plugin::NS_CARDDAV . '}addressbook-description' => $i['description'], '{http://calendarserver.org/ns/}getctag' => $i['ctag'], '{http://sabredav.org/ns}sync-token' => $i['ctag'] ? $i['ctag'] : '0');
         //\OCP\Util::writeLog('kontakte','CARDDAV->:'.$i['displayname'], \OCP\Util::DEBUG);
     }
     return $addressbooks;
 }
开发者ID:BacLuc,项目名称:newGryfiPage,代码行数:19,代码来源:backend.php

示例11: getACL

 /**
  * Returns a list of ACE's for this node.
  *
  * Each ACE has the following properties:
  *   * 'privilege', a string such as {DAV:}read or {DAV:}write. These are
  *     currently the only supported privileges
  *   * 'principal', a url to the principal who owns the node
  *   * 'protected' (optional), indicating that this ACE is not allowed to
  *      be updated.
  *
  * @return array
  */
 public function getACL()
 {
     $readprincipal = $this->getOwner();
     $writeprincipal = $this->getOwner();
     $uid = AddrBook::extractUserID($this->getOwner());
     if ($uid !== \OCP\USER::getUser()) {
         $sharedAddressbook = \OCP\Share::getItemSharedWithBySource(ContactsApp::SHAREADDRESSBOOK, ContactsApp::SHAREADDRESSBOOKPREFIX . $this->addressBookInfo['id']);
         if ($sharedAddressbook && $sharedAddressbook['permissions'] & \OCP\PERMISSION_READ) {
             $readprincipal = 'principals/' . \OCP\USER::getUser();
         }
         if ($sharedAddressbook && $sharedAddressbook['permissions'] & \OCP\PERMISSION_UPDATE) {
             $writeprincipal = 'principals/' . \OCP\USER::getUser();
         }
     }
     return array(array('privilege' => '{DAV:}read', 'principal' => $readprincipal, 'protected' => true), array('privilege' => '{DAV:}write', 'principal' => $writeprincipal, 'protected' => true));
 }
开发者ID:BacLuc,项目名称:newGryfiPage,代码行数:28,代码来源:card.php

示例12: search

 /**
  * Search for query in tasks
  *
  * @param string $query
  * @return array list of \OCA\Tasks\Controller\Task
  */
 function search($query)
 {
     $calendars = \OC_Calendar_Calendar::allCalendars(\OCP\USER::getUser(), true);
     $user_timezone = \OC_Calendar_App::getTimezone();
     // check if the calenar is enabled
     if (count($calendars) == 0 || !\OCP\App::isEnabled('tasks')) {
         return array();
     }
     $results = array();
     foreach ($calendars as $calendar) {
         // $calendar_entries = \OC_Calendar_Object::all($calendar['id']);
         $objects = \OC_Calendar_Object::all($calendar['id']);
         // $date = strtotime($query);
         // 	// search all calendar objects, one by one
         foreach ($objects as $object) {
             // skip non-todos
             if ($object['objecttype'] != 'VTODO') {
                 continue;
             }
             $vtodo = Helper::parseVTODO($object['calendardata']);
             $id = $object['id'];
             $calendarId = $object['calendarid'];
             // check these properties
             $properties = array('SUMMARY', 'DESCRIPTION', 'LOCATION', 'CATEGORIES');
             foreach ($properties as $property) {
                 $string = $vtodo->getAsString($property);
                 if (stripos($string, $query) !== false) {
                     // $results[] = new \OCA\Tasks\Controller\Task($id,$calendarId,$vtodo,$property,$query,$user_timezone);
                     $results[] = Helper::arrayForJSON($id, $vtodo, $user_timezone, $calendarId);
                     continue 2;
                 }
             }
             $comments = $vtodo->COMMENT;
             if ($comments) {
                 foreach ($comments as $com) {
                     if (stripos($com->value, $query) !== false) {
                         // $results[] = new \OCA\Tasks\Controller\Task($id,$calendarId,$vtodo,'COMMENTS',$query,$user_timezone);
                         $results[] = Helper::arrayForJSON($id, $vtodo, $user_timezone, $calendarId);
                         continue 2;
                     }
                 }
             }
         }
     }
     usort($results, array($this, 'sort_completed'));
     return $results;
 }
开发者ID:WeatherellTechnology,项目名称:weatherstorm7,代码行数:53,代码来源:searchcontroller.php

示例13: getACL

 /**
  * Returns a list of ACE's for this node.
  *
  * Each ACE has the following properties:
  *   * 'privilege', a string such as {DAV:}read or {DAV:}write. These are
  *     currently the only supported privileges
  *   * 'principal', a url to the principal who owns the node
  *   * 'protected' (optional), indicating that this ACE is not allowed to
  *      be updated.
  *
  * @return array
  */
 public function getACL()
 {
     $readprincipal = $this->getOwner();
     $writeprincipal = $this->getOwner();
     $uid = $this->carddavBackend->userIDByPrincipal($this->getOwner());
     if ($uid != \OCP\USER::getUser()) {
         list(, $id) = explode('::', $this->addressBookInfo['id']);
         $sharedAddressbook = \OCP\Share::getItemSharedWithBySource('addressbook', $id);
         if ($sharedAddressbook && $sharedAddressbook['permissions'] & \OCP\PERMISSION_READ) {
             $readprincipal = 'principals/' . \OCP\USER::getUser();
         }
         if ($sharedAddressbook && $sharedAddressbook['permissions'] & \OCP\PERMISSION_UPDATE) {
             $writeprincipal = 'principals/' . \OCP\USER::getUser();
         }
     }
     return array(array('privilege' => '{DAV:}read', 'principal' => $readprincipal, 'protected' => true), array('privilege' => '{DAV:}write', 'principal' => $writeprincipal, 'protected' => true));
 }
开发者ID:WYSAC,项目名称:oregon-owncloud,代码行数:29,代码来源:card.php

示例14: __construct

 public function __construct($imagePath, $user = null, $square = false)
 {
     if (!Filesystem::isValidPath($imagePath)) {
         return;
     }
     if (is_null($user)) {
         $this->view = Filesystem::getView();
         $this->user = \OCP\USER::getUser();
     } else {
         $this->view = new View('/' . $user . '/files');
         $this->user = $user;
     }
     $galleryDir = \OC_User::getHome($this->user) . '/gallery/' . $this->user . '/';
     $this->path = $galleryDir . $imagePath . '.png';
     if (!file_exists($this->path)) {
         self::create($imagePath, $square);
     }
 }
开发者ID:WYSAC,项目名称:oregon-owncloud,代码行数:18,代码来源:albumthumbnail.php

示例15: explore

function explore($current_dir, $sub_dirs, $num_of_results)
{
    $return = array();
    // Search for pdfs in sub directories.
    foreach ($sub_dirs as $dir) {
        $pdfs = \OC_FileCache::searchByMime('application', 'pdf', '/' . \OCP\USER::getUser() . '/files' . $current_dir . $dir . '/');
        sort($pdfs);
        $max_count = min(count($pdfs), $num_of_results);
        $thumbs = array();
        for ($i = $max_count - 1; $i >= 0; $i--) {
            if (!in_array($pdfs[$i], $thumbs)) {
                $thumbs[] = $pdfs[$i];
            }
        }
        $return[] = array($dir, $thumbs);
    }
    return $return;
}
开发者ID:DOM-Digital-Online-Media,项目名称:apps,代码行数:18,代码来源:dir.php


注:本文中的OCP\USER::getUser方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。