示例#1
0
<?php

// Firefox and Konqueror tries to download application/json for me.  --Arthur
OCP\JSON::setContentTypeHeader('text/plain');
// If a directory token is sent along check if public upload is permitted.
// If not, check the login.
// If no token is sent along, rely on login only
$allowedPermissions = OCP\PERMISSION_ALL;
$errorCode = null;
$l = OC_L10N::get('files');
if (empty($_POST['dirToken'])) {
    // The standard case, files are uploaded through logged in users :)
    OCP\JSON::checkLoggedIn();
    $dir = isset($_POST['dir']) ? $_POST['dir'] : "";
    if (!$dir || empty($dir) || $dir === false) {
        OCP\JSON::error(array('data' => array_merge(array('message' => $l->t('Unable to set upload directory.')))));
        die;
    }
} else {
    // TODO: ideally this code should be in files_sharing/ajax/upload.php
    // and the upload/file transfer code needs to be refactored into a utility method
    // that could be used there
    \OC_User::setIncognitoMode(true);
    // return only read permissions for public upload
    $allowedPermissions = OCP\PERMISSION_READ;
    $publicDirectory = !empty($_POST['subdir']) ? $_POST['subdir'] : '/';
    $linkItem = OCP\Share::getShareByToken($_POST['dirToken']);
    if ($linkItem === false) {
        OCP\JSON::error(array('data' => array_merge(array('message' => $l->t('Invalid Token')))));
        die;
    }
示例#2
0
 *
 * This library is free software; you can redistribute it and/or
 * 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/>.
 *
 */
OCP\JSON::setContentTypeHeader('text/javascript');
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('contacts');
$user = \OC::$server->getUserSession()->getUser()->getUId();
$groupsort = OCP\Config::getUserValue($user, 'contacts', 'groupsort', '');
$groupsort = explode(',', $groupsort);
$tmp = array();
foreach ($groupsort as $group) {
    if (is_int($group)) {
        $tmp[] = $group;
    }
}
$groupsort = implode(',', $tmp);
echo 'var contacts_groups_sortorder=[' . $groupsort . '],';
echo 'contacts_lastgroup=\'' . OCP\Config::getUserValue($user, 'contacts', 'lastgroup', 'all') . '\',';
echo 'contacts_sortby=\'' . OCP\Config::getUserValue($user, 'contacts', 'sortby', 'fn') . '\',';
示例#3
0
}
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('gallery');
$images = \OCP\Files::searchByMime('image');
$user = \OCP\User::getUser();
$users = array();
$result = array();
foreach ($images as &$image) {
    // we show shared images another way
    if ($image->getStorage() instanceof \OC\Files\Storage\Shared) {
        $owner = $image['uid_owner'];
        $users[$owner] = $owner;
    } else {
        $owner = $user;
    }
    $path = $image['path'];
    if (strpos($path, DIRECTORY_SEPARATOR . ".")) {
        continue;
    }
    $result[] = $owner . $path;
}
$displayNames = array();
foreach ($users as $user) {
    $displayNames[$user] = \OCP\User::getDisplayName($user);
}
function startsWith($haystack, $needle)
{
    return !strncmp($haystack, $needle, strlen($needle));
}
OCP\JSON::setContentTypeHeader();
echo json_encode(array('images' => $result, 'users' => array_values($users), 'displayNames' => $displayNames));
示例#4
0
 *
 * 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/>.
 *
 */
// Check if we are a user
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('contacts');
OCP\JSON::callCheck();
// Firefox and Konqueror tries to download application/json for me.  --Arthur
OCP\JSON::setContentTypeHeader('text/plain; charset=utf-8');
require_once 'loghandler.php';
$image = null;
$x1 = isset($_POST['x1']) && $_POST['x1'] ? $_POST['x1'] : 0;
//$x2 = isset($_POST['x2']) ? $_POST['x2'] : -1;
$y1 = isset($_POST['y1']) && $_POST['y1'] ? $_POST['y1'] : 0;
//$y2 = isset($_POST['y2']) ? $_POST['y2'] : -1;
$w = isset($_POST['w']) && $_POST['w'] ? $_POST['w'] : -1;
$h = isset($_POST['h']) && $_POST['h'] ? $_POST['h'] : -1;
$tmpkey = isset($_POST['tmpkey']) ? $_POST['tmpkey'] : '';
$id = isset($_POST['id']) ? $_POST['id'] : '';
if ($tmpkey == '') {
    bailOut('Missing key to temporary file.');
}
if ($id == '') {
    bailOut('Missing contact id.');