本文整理汇总了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()));
*/
}
}
示例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();
示例3: initController
public static function initController()
{
\OCP\User::checkLoggedIn();
\OCP\App::checkAppEnabled('contacts');
\OCP\App::checkAppEnabled(self::APP_ID);
}