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


PHP OC_JSON::checkLoggedIn方法代码示例

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


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

示例1: getTagger

 protected static function getTagger($type)
 {
     \OC_JSON::checkLoggedIn();
     \OC_JSON::callCheck();
     try {
         $tagger = \OC::$server->getTagManager()->load($type);
         return $tagger;
     } catch (\Exception $e) {
         \OCP\Util::writeLog('core', __METHOD__ . ' Exception: ' . $e->getMessage(), \OCP\Util::ERROR);
         $l = new \OC_L10n('core');
         \OC_JSON::error(array('message' => $l->t('Error loading tags')));
         exit;
     }
 }
开发者ID:evanjt,项目名称:core,代码行数:14,代码来源:controller.php

示例2: getDisplayNames

 public static function getDisplayNames($args)
 {
     \OC_JSON::checkLoggedIn();
     \OC_JSON::callCheck();
     $users = $_GET['users'];
     $result = array();
     $userManager = \OC::$server->getUserManager();
     foreach ($users as $user) {
         $userObject = $userManager->get($user);
         if (is_object($userObject)) {
             $result[$user] = $userObject->getDisplayName();
         } else {
             $result[$user] = $user;
         }
     }
     \OC_JSON::success(array('users' => $result));
 }
开发者ID:droiter,项目名称:openwrt-on-android,代码行数:17,代码来源:controller.php

示例3:

<?php

/**
 * Copyright (c) 2011 Georg Ehrke <ownclouddev at georgswebsite dot de>
 * This file is licensed under the Affero General Public License version 3 or
 * later.
 * See the COPYING-README file.
 */
require_once '../../../lib/base.php';
OC_JSON::checkLoggedIn();
$duration = OC_Preferences::getValue(OC_User::getUser(), 'calendar', 'duration', "60");
OC_JSON::encodedPrint(array("duration" => $duration));
?>
 
开发者ID:Teino1978-Corp,项目名称:Teino1978-Corp-owncloud_.htaccess-,代码行数:13,代码来源:owncloud_apps_calendar_ajax_duration.php

示例4: changeUserPassword

 public static function changeUserPassword($args)
 {
     // Check if we are an user
     \OC_JSON::callCheck();
     \OC_JSON::checkLoggedIn();
     $l = new \OC_L10n('settings');
     if (isset($_POST['username'])) {
         $username = $_POST['username'];
     } else {
         \OC_JSON::error(array('data' => array('message' => $l->t('No user supplied'))));
         exit;
     }
     $password = isset($_POST['password']) ? $_POST['password'] : null;
     $recoveryPassword = isset($_POST['recoveryPassword']) ? $_POST['recoveryPassword'] : null;
     $isUserAccessible = false;
     $currentUserObject = \OC::$server->getUserSession()->getUser();
     $targetUserObject = \OC::$server->getUserManager()->get($username);
     if ($currentUserObject !== null && $targetUserObject !== null) {
         $isUserAccessible = \OC::$server->getGroupManager()->getSubAdmin()->isUserAccessible($currentUserObject, $targetUserObject);
     }
     if (\OC_User::isAdminUser(\OC_User::getUser())) {
         $userstatus = 'admin';
     } elseif ($isUserAccessible) {
         $userstatus = 'subadmin';
     } else {
         \OC_JSON::error(array('data' => array('message' => $l->t('Authentication error'))));
         exit;
     }
     if (\OC_App::isEnabled('encryption')) {
         //handle the recovery case
         $crypt = new \OCA\Encryption\Crypto\Crypt(\OC::$server->getLogger(), \OC::$server->getUserSession(), \OC::$server->getConfig(), \OC::$server->getL10N('encryption'));
         $keyStorage = \OC::$server->getEncryptionKeyStorage();
         $util = new \OCA\Encryption\Util(new \OC\Files\View(), $crypt, \OC::$server->getLogger(), \OC::$server->getUserSession(), \OC::$server->getConfig(), \OC::$server->getUserManager());
         $keyManager = new \OCA\Encryption\KeyManager($keyStorage, $crypt, \OC::$server->getConfig(), \OC::$server->getUserSession(), new \OCA\Encryption\Session(\OC::$server->getSession()), \OC::$server->getLogger(), $util);
         $recovery = new \OCA\Encryption\Recovery(\OC::$server->getUserSession(), $crypt, \OC::$server->getSecureRandom(), $keyManager, \OC::$server->getConfig(), $keyStorage, \OC::$server->getEncryptionFilesHelper(), new \OC\Files\View());
         $recoveryAdminEnabled = $recovery->isRecoveryKeyEnabled();
         $validRecoveryPassword = false;
         $recoveryEnabledForUser = false;
         if ($recoveryAdminEnabled) {
             $validRecoveryPassword = $keyManager->checkRecoveryPassword($recoveryPassword);
             $recoveryEnabledForUser = $recovery->isRecoveryEnabledForUser($username);
         }
         if ($recoveryEnabledForUser && $recoveryPassword === '') {
             \OC_JSON::error(array('data' => array('message' => $l->t('Please provide an admin recovery password, otherwise all user data will be lost'))));
         } elseif ($recoveryEnabledForUser && !$validRecoveryPassword) {
             \OC_JSON::error(array('data' => array('message' => $l->t('Wrong admin recovery password. Please check the password and try again.'))));
         } else {
             // now we know that everything is fine regarding the recovery password, let's try to change the password
             $result = \OC_User::setPassword($username, $password, $recoveryPassword);
             if (!$result && $recoveryEnabledForUser) {
                 \OC_JSON::error(array("data" => array("message" => $l->t("Backend doesn't support password change, but the user's encryption key was successfully updated."))));
             } elseif (!$result && !$recoveryEnabledForUser) {
                 \OC_JSON::error(array("data" => array("message" => $l->t("Unable to change password"))));
             } else {
                 \OC_JSON::success(array("data" => array("username" => $username)));
             }
         }
     } else {
         // if encryption is disabled, proceed
         if (!is_null($password) && \OC_User::setPassword($username, $password)) {
             \OC_JSON::success(array('data' => array('username' => $username)));
         } else {
             \OC_JSON::error(array('data' => array('message' => $l->t('Unable to change password'))));
         }
     }
 }
开发者ID:rchicoli,项目名称:owncloud-core,代码行数:66,代码来源:Controller.php

示例5: checkLoggedIn

 /**
  * @brief Check if the user is logged in, send json error msg if not
  */
 public static function checkLoggedIn()
 {
     return \OC_JSON::checkLoggedIn();
 }
开发者ID:noci2012,项目名称:owncloud,代码行数:7,代码来源:json.php

示例6: changeUserPassword

 public static function changeUserPassword($args)
 {
     // Check if we are an user
     \OC_JSON::callCheck();
     \OC_JSON::checkLoggedIn();
     // Manually load apps to ensure hooks work correctly (workaround for issue 1503)
     \OC_App::loadApps();
     if (isset($_POST['username'])) {
         $username = $_POST['username'];
     } else {
         $l = new \OC_L10n('settings');
         \OC_JSON::error(array('data' => array('message' => $l->t('No user supplied'))));
         exit;
     }
     $password = isset($_POST['password']) ? $_POST['password'] : null;
     $recoveryPassword = isset($_POST['recoveryPassword']) ? $_POST['recoveryPassword'] : null;
     if (\OC_User::isAdminUser(\OC_User::getUser())) {
         $userstatus = 'admin';
     } elseif (\OC_SubAdmin::isUserAccessible(\OC_User::getUser(), $username)) {
         $userstatus = 'subadmin';
     } else {
         $l = new \OC_L10n('settings');
         \OC_JSON::error(array('data' => array('message' => $l->t('Authentication error'))));
         exit;
     }
     if (\OC_App::isEnabled('files_encryption')) {
         //handle the recovery case
         $util = new \OCA\Encryption\Util(new \OC_FilesystemView('/'), $username);
         $recoveryAdminEnabled = \OC_Appconfig::getValue('files_encryption', 'recoveryAdminEnabled');
         $validRecoveryPassword = false;
         $recoveryPasswordSupported = false;
         if ($recoveryAdminEnabled) {
             $validRecoveryPassword = $util->checkRecoveryPassword($recoveryPassword);
             $recoveryEnabledForUser = $util->recoveryEnabledForUser();
         }
         if ($recoveryEnabledForUser && $recoveryPassword === '') {
             $l = new \OC_L10n('settings');
             \OC_JSON::error(array('data' => array('message' => $l->t('Please provide an admin recovery password, otherwise all user data will be lost'))));
         } elseif ($recoveryEnabledForUser && !$validRecoveryPassword) {
             $l = new \OC_L10n('settings');
             \OC_JSON::error(array('data' => array('message' => $l->t('Wrong admin recovery password. Please check the password and try again.'))));
         } else {
             // now we know that everything is fine regarding the recovery password, let's try to change the password
             $result = \OC_User::setPassword($username, $password, $recoveryPassword);
             if (!$result && $recoveryPasswordSupported) {
                 $l = new \OC_L10n('settings');
                 \OC_JSON::error(array("data" => array("message" => $l->t("Back-end doesn't support password change, but the users encryption key was successfully updated."))));
             } elseif (!$result && !$recoveryPasswordSupported) {
                 $l = new \OC_L10n('settings');
                 \OC_JSON::error(array("data" => array("message" => $l->t("Unable to change password"))));
             } else {
                 \OC_JSON::success(array("data" => array("username" => $username)));
             }
         }
     } else {
         // if encryption is disabled, proceed
         if (!is_null($password) && \OC_User::setPassword($username, $password)) {
             \OC_JSON::success(array('data' => array('username' => $username)));
         } else {
             $l = new \OC_L10n('settings');
             \OC_JSON::error(array('data' => array('message' => $l->t('Unable to change password'))));
         }
     }
 }
开发者ID:omusico,项目名称:isle-web-framework,代码行数:64,代码来源:controller.php

示例7: postCroppedAvatar

 public static function postCroppedAvatar($args)
 {
     \OC_JSON::checkLoggedIn();
     \OC_JSON::callCheck();
     $user = \OC_User::getUser();
     if (isset($_POST['crop'])) {
         $crop = $_POST['crop'];
     } else {
         $l = new \OC_L10n('core');
         \OC_JSON::error(array("data" => array("message" => $l->t("No crop data provided"))));
         return;
     }
     $tmpavatar = \OC_Cache::get('tmpavatar');
     if (is_null($tmpavatar)) {
         $l = new \OC_L10n('core');
         \OC_JSON::error(array("data" => array("message" => $l->t("No temporary profile picture available, try again"))));
         return;
     }
     $image = new \OC_Image($tmpavatar);
     $image->crop($crop['x'], $crop['y'], $crop['w'], $crop['h']);
     try {
         $avatar = new \OC_Avatar($user);
         $avatar->set($image->data());
         // Clean up
         \OC_Cache::remove('tmpavatar');
         \OC_JSON::success();
     } catch (\Exception $e) {
         \OC_JSON::error(array("data" => array("message" => $e->getMessage())));
     }
 }
开发者ID:omusico,项目名称:isle-web-framework,代码行数:30,代码来源:controller.php


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