當前位置: 首頁>>代碼示例>>PHP>>正文


PHP User::checkLoggedIn方法代碼示例

本文整理匯總了PHP中OCP\User::checkLoggedIn方法的典型用法代碼示例。如果您正苦於以下問題:PHP User::checkLoggedIn方法的具體用法?PHP User::checkLoggedIn怎麽用?PHP User::checkLoggedIn使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在OCP\User的用法示例。


在下文中一共展示了User::checkLoggedIn方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: servePreview

 /**
  * @brief offer preview for download
  *
  * if no preview exists for this file, send icon instead
  * 
  * @param string $path full path to file
  * @param string type type of preview requested
  */
 public static function servePreview($path, $type)
 {
     \OCP\User::checkLoggedIn();
     \OC::$server->getSession()->close();
     $i = \OC\Files\Filesystem::getFileInfo($path, false);
     /* check for predefined cover, if found replace $path with that of cover file */
     $meta = Meta::get($i['fileid']);
     if ($meta['cover']) {
         $path = pathinfo($path)['dirname'] . '/' . $meta['cover'];
         $i = \OC\Files\Filesystem::getFileInfo($path, false);
     }
     if (\OC::$server->getPreviewManager()->isMimeSupported($i['mimetype'])) {
         $preview = new \OC\Preview(\OC_User::getUser(), 'files');
         $preview->setFile($path);
         switch ($type) {
             case 'cover':
                 $preview->setMaxX(Config::getApp('cover-x', '200'));
                 $preview->setMaxY(Config::getApp('cover-y', '200'));
                 break;
             case 'thumbnail':
                 $preview->setMaxX(Config::getApp('thumb-x', '36'));
                 $preview->setMaxY(Config::getApp('thumb-y', '36'));
                 break;
         }
         $preview->showPreview();
     } else {
         // no preview, serve icon instead
         $scheme = !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443 ? 'https' : 'http';
         header("Location: " . $scheme . "://" . $_SERVER['HTTP_HOST'] . \OC_Helper::mimetypeIcon($i->getMimeType()));
         /* Note: relative URL should be enough (RFC7231) but some OPDS clients
          * (especially those in dedicated book readers) might not support them
          * 
          * header("Location: " . \OC_Helper::mimetypeIcon($i->getMimeType()));
          */
     }
 }
開發者ID:RavenB,項目名稱:owncloud-apps,代碼行數:44,代碼來源:feed.php

示例2:

<?php

\OCP\User::checkLoggedIn();
\OCP\App::checkAppEnabled('fc_mail_attachments');
\OCP\Util::addscript('fc_mail_attachments', 'utils');
\OCP\Util::addscript('fc_mail_attachments', 'account');
//OCP\Util::addstyle('fc_mail_attachments', 'style');
$user = OCP\User::getUser();
$tmpl = new OCP\Template('fc_mail_attachments', 'settings');
$query = \OCP\DB::prepare('SELECT * FROM `*PREFIX*fc_mail_attachments` WHERE user = ?');
$results = $query->execute(array($user))->fetchAll();
if (sizeof($results)) {
    $conf = $results[0];
    $tmpl->assign('dir', $conf['dir']);
    $tmpl->assign('mail_host', $conf['mail_host']);
    $tmpl->assign('mail_port', $conf['mail_port']);
    $tmpl->assign('mail_security', $conf['mail_security']);
    $tmpl->assign('mail_user', $conf['mail_user']);
}
return $tmpl->fetchPage();
開發者ID:shiruken1,項目名稱:owncloud_mail_attachments,代碼行數:20,代碼來源:settings.php

示例3: initController

 public static function initController()
 {
     \OCP\User::checkLoggedIn();
     \OCP\App::checkAppEnabled('contacts');
     \OCP\App::checkAppEnabled(self::APP_ID);
 }
開發者ID:seanbradley28,項目名稱:gsync,代碼行數:6,代碼來源:app.php


注:本文中的OCP\User::checkLoggedIn方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。