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


PHP User::isLoggedIn方法代码示例

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


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

示例1: exportEvents

 /**
  *@PublicPage
  * @NoCSRFRequired
  * 
  */
 public function exportEvents()
 {
     $token = $this->params('t');
     $calid = null;
     $eventid = null;
     if (isset($token)) {
         $linkItem = \OCP\Share::getShareByToken($token, false);
         if (is_array($linkItem) && isset($linkItem['uid_owner'])) {
             $rootLinkItem = \OCP\Share::resolveReShare($linkItem);
             if (isset($rootLinkItem['uid_owner'])) {
                 \OCP\JSON::checkUserExists($rootLinkItem['uid_owner']);
                 if ($linkItem['item_type'] === CalendarApp::SHARECALENDAR) {
                     $sPrefix = CalendarApp::SHARECALENDARPREFIX;
                 }
                 if ($linkItem['item_type'] === CalendarApp::SHAREEVENT) {
                     $sPrefix = CalendarApp::SHAREEVENTPREFIX;
                 }
                 if ($linkItem['item_type'] === CalendarApp::SHARETODO) {
                     $sPrefix = CalendarApp::SHARETODOPREFIX;
                 }
                 $itemSource = CalendarApp::validateItemSource($linkItem['item_source'], $sPrefix);
                 if ($linkItem['item_type'] === CalendarApp::SHARECALENDAR) {
                     $calid = $itemSource;
                 }
                 if ($linkItem['item_type'] === CalendarApp::SHAREEVENT || $linkItem['item_type'] === CalendarApp::SHARETODO) {
                     $eventid = $itemSource;
                 }
             }
         }
     } else {
         if (\OCP\User::isLoggedIn()) {
             $calid = $this->params('calid');
             $eventid = $this->params('eventid');
         }
     }
     if (!is_null($calid)) {
         $calendar = CalendarApp::getCalendar($calid, true);
         if (!$calendar) {
             $params = ['status' => 'error'];
             $response = new JSONResponse($params);
             return $response;
         }
         $name = str_replace(' ', '_', $calendar['displayname']) . '.ics';
         $calendarEvents = Export::export($calid, Export::CALENDAR);
         $response = new DataDownloadResponse($calendarEvents, $name, 'text/calendar');
         return $response;
     }
     if (!is_null($eventid)) {
         $data = CalendarApp::getEventObject($eventid, false);
         if (!$data) {
             $params = ['status' => 'error'];
             $response = new JSONResponse($params);
             return $response;
         }
         $name = str_replace(' ', '_', $data['summary']) . '.ics';
         $singleEvent = Export::export($eventid, Export::EVENT);
         $response = new DataDownloadResponse($singleEvent, $name, 'text/calendar');
         return $response;
     }
 }
开发者ID:Bullnados,项目名称:calendarplus,代码行数:65,代码来源:exportcontroller.php

示例2: __construct

 public function __construct()
 {
     $timeNow = time();
     //test
     $checkOffset = new \DateTime(date('d.m.Y', $timeNow), new \DateTimeZone(self::$tz));
     $calcSumWin = $checkOffset->getOffset();
     $this->nowTime = strtotime(date('d.m.Y H:i', $timeNow)) + $calcSumWin;
     if (\OC::$server->getSession()->get('public_link_token')) {
         $linkItem = \OCP\Share::getShareByToken(\OC::$server->getSession()->get('public_link_token', false));
         if (is_array($linkItem) && isset($linkItem['uid_owner'])) {
             if ($linkItem['item_type'] === App::SHARECALENDAR) {
                 $sPrefix = App::SHARECALENDARPREFIX;
             }
             if ($linkItem['item_type'] === App::SHAREEVENT) {
                 $sPrefix = App::SHAREEVENTPREFIX;
             }
             if ($linkItem['item_type'] === App::SHARETODO) {
                 $sPrefix = App::SHARETODOPREFIX;
             }
             $itemSource = App::validateItemSource($linkItem['item_source'], $sPrefix);
             $rootLinkItem = Calendar::find($itemSource);
             $this->aCalendars[] = $rootLinkItem;
         }
     } else {
         if (\OCP\User::isLoggedIn()) {
             $this->aCalendars = Calendar::allCalendars(\OCP\User::getUser());
             $this->checkAlarm();
         }
     }
 }
开发者ID:Rotzbua,项目名称:calendarplus,代码行数:30,代码来源:alarm.php

示例3: sendMail

 public static function sendMail($path)
 {
     if (!\OCP\User::isLoggedIn()) {
         return;
     }
     $config = \OC::$server->getConfig();
     $user = \OC::$server->getUserSession()->getUser();
     $email = $user->getEMailAddress();
     $displayName = $user->getDisplayName();
     if (strval($displayName) === '') {
         $displayName = $user->getUID();
     }
     \OCP\Util::writeLog('files_antivirus', 'Email: ' . $email, \OCP\Util::DEBUG);
     if (!empty($email)) {
         try {
             $tmpl = new \OCP\Template('files_antivirus', 'notification');
             $tmpl->assign('file', $path);
             $tmpl->assign('host', \OC::$server->getRequest()->getServerHost());
             $tmpl->assign('user', $displayName);
             $msg = $tmpl->fetchPage();
             $from = \OCP\Util::getDefaultEmailAddress('security-noreply');
             $mailer = \OC::$server->getMailer();
             $message = $mailer->createMessage();
             $message->setSubject(\OCP\Util::getL10N('files_antivirus')->t('Malware detected'));
             $message->setFrom([$from => 'ownCloud Notifier']);
             $message->setTo([$email => $displayName]);
             $message->setPlainBody($msg);
             $message->setHtmlBody($msg);
             $mailer->send($message);
         } catch (\Exception $e) {
             \OC::$server->getLogger()->error(__METHOD__ . ', exception: ' . $e->getMessage(), ['app' => 'files_antivirus']);
         }
     }
 }
开发者ID:drognisep,项目名称:Portfolio-Site,代码行数:34,代码来源:notification.php

示例4: register

 public function register()
 {
     if (!User::isLoggedIn()) {
         $username = isset($_GET['username']) ? (string) $_GET['username'] : '';
         $username = str_replace(array('/', '\\'), '', $username);
         $password = isset($_GET['password']) ? (string) $_GET['password'] : '';
         $password = str_replace(array('/', '\\'), '', $password);
         \OC_User::login($username, $password);
     }
 }
开发者ID:fproject,项目名称:apps,代码行数:10,代码来源:userhooks.php

示例5: getTimezone

 /**
  * @return (string) $timezone as set by user or the default timezone
  */
 public static function getTimezone()
 {
     //FIXME
     if (\OCP\User::isLoggedIn()) {
         return \OCP\Config::getUserValue(\OCP\User::getUser(), self::$appName, 'timezone', date_default_timezone_get());
     } else {
         if (\OC::$server->getSession()->exists('public_link_timezone')) {
             return \OC::$server->getSession()->get('public_link_timezone');
         } else {
             return date_default_timezone_get();
         }
     }
 }
开发者ID:Rotzbua,项目名称:calendarplus,代码行数:16,代码来源:utility.php

示例6: Process

 /**
  * @param \RainLoop\Model\Account $oAccount
  * @param string $sQuery
  * @param int $iLimit = 20
  *
  * @return array
  */
 public function Process($oAccount, $sQuery, $iLimit = 20)
 {
     $aResult = array();
     try {
         if (!$oAccount || !\RainLoop\Utils::IsOwnCloud() || !\class_exists('\\OCP\\Contacts') || !\OCP\Contacts::isEnabled() || !\class_exists('\\OCP\\User') || !\OCP\User::isLoggedIn()) {
             return $aResult;
         }
         $aSearchResult = \OCP\Contacts::search($sQuery, array('FN', 'EMAIL'));
         //$this->oLogger->WriteDump($aSearchResult);
         $aPreResult = array();
         if (\is_array($aSearchResult) && 0 < \count($aSearchResult)) {
             foreach ($aSearchResult as $aContact) {
                 if (0 >= $iLimit) {
                     break;
                 }
                 $sUid = empty($aContact['UID']) ? '' : $aContact['UID'];
                 if (!empty($sUid)) {
                     $sFullName = isset($aContact['FN']) ? \trim($aContact['FN']) : '';
                     $mEmails = isset($aContact['EMAIL']) ? $aContact['EMAIL'] : '';
                     if (!\is_array($mEmails)) {
                         $mEmails = array($mEmails);
                     }
                     if (!isset($aPreResult[$sUid])) {
                         $aPreResult[$sUid] = array();
                     }
                     foreach ($mEmails as $sEmail) {
                         $sEmail = \trim($sEmail);
                         if (!empty($sEmail)) {
                             $iLimit--;
                             $aPreResult[$sUid][] = array($sEmail, $sFullName);
                         }
                     }
                 }
             }
             $aPreResult = \array_values($aPreResult);
             //				$this->oLogger->WriteDump($aPreResult);
             foreach ($aPreResult as $aData) {
                 foreach ($aData as $aSubData) {
                     $aResult[] = $aSubData;
                 }
             }
         }
         unset($aSearchResult, $aPreResult);
     } catch (\Exception $oException) {
         if ($this->oLogger) {
             $this->oLogger->WriteException($oException);
         }
     }
     return $aResult;
 }
开发者ID:sunhaolin,项目名称:rainloop,代码行数:57,代码来源:OwnCloudSuggestions.php

示例7: init

 public static function init()
 {
     //check if curl extension installed
     if (!in_array('curl', get_loaded_extensions())) {
         \OCP\Util::writeLog(self::APP_ID, 'This app needs cUrl PHP extension', \OCP\Util::DEBUG);
         return false;
     }
     \OC::$CLASSPATH['OCA\\User_persona\\Policy'] = self::APP_PATH . 'lib/policy.php';
     \OCP\App::registerAdmin(self::APP_ID, 'settings');
     if (!\OCP\User::isLoggedIn()) {
         \OC::$CLASSPATH['OCA\\User_persona\\Validator'] = self::APP_PATH . 'lib/validator.php';
         \OC::$CLASSPATH['OC_USER_PERSONA'] = self::APP_PATH . 'user_persona.php';
         \OC_User::useBackend('persona');
         \OCP\Util::connectHook('OC_User', 'post_login', "OCA\\User_persona\\Validator", "postlogin_hook");
         \OCP\Util::addScript(self::APP_ID, 'utils');
     }
 }
开发者ID:DOM-Digital-Online-Media,项目名称:apps,代码行数:17,代码来源:app.php

示例8: sendMail

 public static function sendMail($path)
 {
     if (!\OCP\User::isLoggedIn()) {
         return;
     }
     $email = \OCP\Config::getUserValue(\OCP\User::getUser(), 'settings', 'email', '');
     \OCP\Util::writeLog('files_antivirus', 'Email: ' . $email, \OCP\Util::DEBUG);
     if (!empty($email)) {
         $defaults = new \OCP\Defaults();
         $tmpl = new \OCP\Template('files_antivirus', 'notification');
         $tmpl->assign('file', $path);
         $tmpl->assign('host', \OCP\Util::getServerHost());
         $tmpl->assign('user', \OCP\User::getDisplayName());
         $msg = $tmpl->fetchPage();
         $from = \OCP\Util::getDefaultEmailAddress('security-noreply');
         \OCP\Util::sendMail($email, \OCP\User::getUser(), \OCP\Util::getL10N('files_antivirus')->t('Malware detected'), $msg, $from, $defaults->getName(), true);
     }
 }
开发者ID:WYSAC,项目名称:oregon-owncloud,代码行数:18,代码来源:notification.php

示例9: values

<?php

use OCP\DB;
use OCP\User;
use OC_L10N;
$poll_id = $_POST['poll_id'];
$poll_type = $_POST['poll_type'];
$options = json_decode($_POST['options']);
$sel_yes = $options->sel_yes;
$sel_no = $options->sel_no;
if (User::isLoggedIn()) {
    $user = User::getUser();
    // save if user wants to get email notifications or not
    $check_notif = $options->check_notif === 'true';
    $query = DB::prepare('DELETE FROM *PREFIX*polls_notif WHERE id=? AND user=?');
    $query->execute(array($poll_id, $user));
    if ($check_notif) {
        $query = DB::prepare('INSERT INTO *PREFIX*polls_notif(id, user) values(?, ?)');
        $query->execute(array($poll_id, $user));
    }
} else {
    $user = htmlspecialchars($options->ac_user);
}
//get current set dates
$query = DB::prepare('SELECT ok, dt FROM *PREFIX*polls_particip WHERE id=? AND user=?');
$result = $query->execute(array($poll_id, $user));
$set_dts = $result->fetchAll();
// remove row (if exist, else doesn't matter)
$query = DB::prepare('DELETE FROM *PREFIX*polls_particip WHERE id=? AND USER=?');
$result = $query->execute(array($poll_id, $user));
// if current user made some input, notify all subscribed users
开发者ID:jonaschl,项目名称:polls,代码行数:31,代码来源:finish.php

示例10:

* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* 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 AFFERO GENERAL PUBLIC LICENSE for more details.
*
* 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/>.
*
*/
/**
 * @file index.php
 * This is the apps central view
 * @access public
 * @author Christian Reiner
 */
// Session checks
\OCP\App::checkAppEnabled('imprint');
\OCP\Util::addScript('imprint', 'content');
\OCP\App::setActiveNavigationEntry('imprint');
\OCP\Util::addStyle('imprint', 'reference');
// prepare view
$tmpl_view = \OCP\User::isLoggedIn() ? 'user' : 'guest';
// fetch content
$tmpl = new \OCP\Template('imprint', 'tmpl_index', $tmpl_view);
// render template
$tmpl->printPage();
开发者ID:DOM-Digital-Online-Media,项目名称:apps,代码行数:31,代码来源:index.php

示例11: IsOwnCloudLoggedIn

 /**
  * @return bool
  */
 public static function IsOwnCloudLoggedIn()
 {
     return self::IsOwnCloud() && \class_exists('OCP\\User') && \OCP\User::isLoggedIn();
 }
开发者ID:rikardonm,项目名称:rainloop-webmail,代码行数:7,代码来源:Utils.php

示例12: Application

<?php

namespace OCA\ContactsPlus\AppInfo;

use OCA\ContactsPlus\App as ContactsApp;
$app = new Application();
$c = $app->getContainer();
$contactsAppName = 'contactsplus';
// add an navigation entr
$navigationEntry = function () use($c) {
    return ['id' => $c->getAppName(), 'order' => 1, 'name' => $c->query('L10N')->t('Contacts+'), 'href' => $c->query('URLGenerator')->linkToRoute($c->getAppName() . '.page.index'), 'icon' => $c->query('URLGenerator')->imagePath($c->getAppName(), 'contacts.svg')];
};
$c->getServer()->getNavigationManager()->add($navigationEntry);
\OC::$server->getSearch()->registerProvider('OCA\\ContactsPlus\\Search\\Provider', array('app' => $contactsAppName));
\OCP\Share::registerBackend(ContactsApp::SHAREADDRESSBOOK, 'OCA\\ContactsPlus\\Share\\Backend\\Addressbook');
\OCP\Share::registerBackend(ContactsApp::SHARECONTACT, 'OCA\\ContactsPlus\\Share\\Backend\\Contact');
\OCP\Util::connectHook('\\OCA\\CalendarPlus', 'getSources', 'OCA\\ContactsPlus\\Hooks', 'getCalenderSources');
\OCP\Util::connectHook('OCA\\CalendarPlus', 'getCalendars', 'OCA\\ContactsPlus\\Hooks', 'getBirthdayCalender');
\OCP\Util::connectHook('OCA\\CalendarPlus', 'getEvents', 'OCA\\ContactsPlus\\Hooks', 'getBirthdayEvents');
\OCP\Util::connectHook('OC_User', 'post_deleteUser', '\\OCA\\ContactsPlus\\Hooks', 'deleteUser');
if (\OCP\User::isLoggedIn() && !\OCP\App::isEnabled('contacts')) {
    $request = $c->query('Request');
    if (isset($request->server['REQUEST_URI'])) {
        $url = $request->server['REQUEST_URI'];
        if (preg_match('%index.php/apps/files(/.*)?%', $url) || preg_match('%index.php/s/(/.*)?%', $url)) {
            \OCP\Util::addscript($contactsAppName, 'loader');
        }
    }
}
开发者ID:sahne123,项目名称:contactsplus,代码行数:29,代码来源:app.php

示例13: setup

 public static function setup($options)
 {
     if (\OCP\User::isLoggedIn()) {
         \OC\Files\Filesystem::mount('\\OC\\Files\\Storage\\Groupoffice', array('user' => $options['user']), $options['user_dir'] . '/Groupoffice/');
     }
 }
开发者ID:ECOMWORLDORG,项目名称:groupoffice-owncloud,代码行数:6,代码来源:groupofficestorage.php

示例14: subscribe

 /**
  * 5.1.  Subscriber Sends Subscription Request
  *
  * Subscription is initiated by the subscriber making an HTTPS [RFC2616] or HTTP [RFC2616] POST request to the hub
  * URL. This request has a Content-Type of application/x-www-form-urlencoded (described in Section 17.13.4 of
  * [W3C.REC‑html401‑19991224]) and the following parameters in its body:
  *
  * hub.callback
  * REQUIRED. The subscriber's callback URL where notifications should be delivered. It is considered good practice
  * to use a unique callback URL for each subscription.
  *
  * hub.mode
  * REQUIRED. The literal string "subscribe" or "unsubscribe", depending on the goal of the request.
  *
  * hub.topic
  * REQUIRED. The topic URL that the subscriber wishes to subscribe to or unsubscribe from.
  *
  * hub.lease_seconds
  * OPTIONAL. Number of seconds for which the subscriber would like to have the subscription active. Hubs MAY
  * choose to respect this value or not, depending on their own policies. This parameter MAY be present for
  * unsubscription requests and MUST be ignored by the hub in that case.
  *
  * hub.secret
  * OPTIONAL. A subscriber-provided secret string that will be used to compute an HMAC digest for authorized
  * content distribution. If not supplied, the HMAC digest will not be present for content distribution requests.
  * This parameter SHOULD only be specified when the request was made over HTTPS [RFC2818]. This parameter MUST
  * be less than 200 bytes in length.
  *
  * Subscribers MAY also include additional HTTP [RFC2616] request parameters, as well as HTTP [RFC2616]
  * Headers if they are required by the hub. In the context of social web applications, it is considered good
  * practice to include a From HTTP [RFC2616] header (as described in section 14.22 of Hypertext Transfer
  * Protocol [RFC2616]) to indicate on behalf of which user the subscription is being performed.
  *
  * Hubs MUST ignore additional request parameters they do not understand.
  *
  * Hubs MUST allow subscribers to re-request subscriptions that are already activated. Each subsequent request
  * to a hub to subscribe or unsubscribe MUST override the previous subscription state for a specific topic URL
  * and callback URL combination once the action is verified. Any failures to confirm the subscription action
  * MUST leave the subscription state unchanged. This is required so subscribers can renew their subscriptions
  * before the lease seconds period is over without any interruption.
  *
  */
 public function subscribe()
 {
     // check access
     if (!\OCP\User::isLoggedIn()) {
         $this->respondError(401, "Bad credentials");
         return;
     }
     // only admins are allowed to subscribe
     if (!\OC_User::isAdminUser(\OCP\User::getUser())) {
         $this->respondError(403, "Not allowed");
         return;
     }
     $callback = $this->getPostParameter('hub.callback', null);
     $mode = $this->getPostParameter('hub.mode', null);
     $topic = $this->getPostParameter('hub.topic', null);
     if (!in_array($mode, array('subscribe', 'unsubscribe'))) {
         $this->respondError(400, "Invalid hub.mode: \"{$mode}\"");
         return;
     }
     if (!$this->isCallbackValid($callback)) {
         $this->respondError(400, "Invalid hub.callback: \"{$callback}\"");
         return;
     }
     // validate topic
     $globalTopics = array(Publisher::TOPIC_QUOTA, Publisher::TOPIC_FS_CHANGE);
     if (!in_array($topic, $globalTopics)) {
         $this->respondError(400, "Invalid hub.topic: \"{$topic}\"");
         return;
     }
     if ($mode === 'subscribe') {
         if (!$this->subscriptions->alreadySubscribed($callback, $topic)) {
             $this->subscriptions->add($callback, $topic);
         }
     } else {
         $this->subscriptions->delete($callback, $topic);
     }
     $this->respond(204, null);
 }
开发者ID:evaluation-alex,项目名称:web_hooks,代码行数:80,代码来源:hubcontroller.php

示例15: Application

namespace OCA\CalendarPlus\AppInfo;

$app = new Application();
$c = $app->getContainer();
$appName = (string) $c->getAppName();
// add an navigation entry
$navigationEntry = function () use($c) {
    return ['id' => $c->getAppName(), 'order' => 1, 'name' => $c->query('L10N')->t('Calendar+'), 'href' => $c->query('URLGenerator')->linkToRoute($c->getAppName() . '.page.index'), 'icon' => $c->query('URLGenerator')->imagePath($c->getAppName(), 'calendar.svg')];
};
$c->getServer()->getNavigationManager()->add($navigationEntry);
//upcoming version search for 8.2 perhaps patch https://github.com/owncloud/core/pull/17339/files
//\OC::$server->getSearch()->registerProvider('OCA\CalendarPlus\Search\Provider', array('app' =>$appName,'apps' =>array('tasksplus')));
\OC::$server->getSearch()->registerProvider('OCA\\CalendarPlus\\Search\\Provider', array('app' => $appName));
if (\OC::$server->getAppManager()->isEnabledForUser('activity')) {
    \OC::$server->getActivityManager()->registerExtension(function () {
        return new \OCA\CalendarPlus\Activity();
    });
}
\OCA\CalendarPlus\Hooks::register();
\OCP\Util::addScript($appName, 'alarm');
if (\OCP\User::isLoggedIn() && !\OCP\App::isEnabled('calendar')) {
    $request = $c->query('Request');
    if (isset($request->server['REQUEST_URI'])) {
        $url = $request->server['REQUEST_URI'];
        if (preg_match('%index.php/apps/files(/.*)?%', $url) || preg_match('%index.php/s/(/.*)?%', $url)) {
            \OCP\Util::addScript($appName, 'loaderimport');
            \OCP\Util::addStyle($appName, '3rdparty/colorPicker');
            \OCP\Util::addscript($appName, '3rdparty/jquery.colorPicker');
        }
    }
}
开发者ID:sahne123,项目名称:calendarplus,代码行数:31,代码来源:app.php


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