Exemple #1
0
 public static function delete($parameters)
 {
     OC_Util::checkLoggedIn();
     $user = OC_User::getUser();
     $app = addslashes(strip_tags($parameters['app']));
     $key = addslashes(strip_tags($parameters['key']));
     if ($key === "" or $app === "") {
         return new OC_OCS_Result(null, 101);
         //key and app are NOT optional here
     }
     if (OC_Preferences::deleteKey($user, $app, $key)) {
         return new OC_OCS_Result(null, 100);
     }
 }
Exemple #2
0
 * @license AGPL-3.0
 *
 * This code is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License, version 3,
 * as published by the Free Software Foundation.
 *
 * This program 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, version 3,
 * along with this program.  If not, see <http://www.gnu.org/licenses/>
 *
 */
\OC_Util::checkLoggedIn();
\OC::$server->getSession()->close();
if (!\OC_App::isEnabled('files_trashbin')) {
    exit;
}
$file = array_key_exists('file', $_GET) ? (string) $_GET['file'] : '';
$maxX = array_key_exists('x', $_GET) ? (int) $_GET['x'] : '44';
$maxY = array_key_exists('y', $_GET) ? (int) $_GET['y'] : '44';
$scalingUp = array_key_exists('scalingup', $_GET) ? (bool) $_GET['scalingup'] : true;
if ($file === '') {
    \OC_Response::setStatus(400);
    //400 Bad Request
    \OCP\Util::writeLog('core-preview', 'No file parameter was passed', \OCP\Util::DEBUG);
    exit;
}
if ($maxX === 0 || $maxY === 0) {
Exemple #3
0
 /**
  * Check if the user is a subadmin, redirects to home if not
  *
  * @return null|boolean $groups where the current user is subadmin
  */
 public static function checkSubAdminUser()
 {
     OC_Util::checkLoggedIn();
     if (!OC_SubAdmin::isSubAdmin(OC_User::getUser())) {
         header('Location: ' . OC_Helper::linkToAbsolute('', 'index.php'));
         exit;
     }
     return true;
 }
Exemple #4
0
 /**
  * Check if the user is logged in, redirects to home if not. With
  * redirect URL parameter to the request URI.
  */
 public static function checkLoggedIn()
 {
     \OC_Util::checkLoggedIn();
 }
Exemple #5
0
 /**
  * Check if the user is a subadmin, redirects to home if not
  *
  * @return null|boolean $groups where the current user is subadmin
  */
 public static function checkSubAdminUser()
 {
     OC_Util::checkLoggedIn();
     $userObject = \OC::$server->getUserSession()->getUser();
     $isSubAdmin = false;
     if ($userObject !== null) {
         $isSubAdmin = \OC::$server->getGroupManager()->getSubAdmin()->isSubAdmin($userObject);
     }
     if (!$isSubAdmin) {
         header('Location: ' . OC_Helper::linkToAbsolute('', 'index.php'));
         exit;
     }
     return true;
 }