<?php

/**
 * ownCloud
 *
 * @author Michael Gapczynski
 * @copyright 2011 Michael Gapczynski GapczynskiM@gmail.com
 *
 * 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/>.
 *
 */
require_once '../../lib/base.php';
require_once 'lib_share.php';
OC_Util::checkLoggedIn();
OC_Util::checkAppEnabled('files_sharing');
OC_App::setActiveNavigationEntry("files_sharing_list");
OC_Util::addScript("files_sharing", "list");
$tmpl = new OC_Template("files_sharing", "list", "user");
$tmpl->assign("shared_items", OC_Share::getMySharedItems());
$tmpl->printPage();
Ejemplo n.º 2
0
<?php

require_once OC::$APPSROOT . '/apps/files_sharing/lib_share.php';
OCP\JSON::checkAppEnabled('files_sharing');
OCP\JSON::checkLoggedIn();
$items = array();
$userDirectory = '/' . OCP\USER::getUser() . '/files';
$dirLength = strlen($userDirectory);
if ($rows = OC_Share::getMySharedItems()) {
    for ($i = 0; $i < count($rows); $i++) {
        $source = $rows[$i]['source'];
        // Strip out user directory
        $item = substr($source, $dirLength);
        if ($rows[$i]['uid_shared_with'] == OC_Share::PUBLICLINK) {
            $items[$item] = true;
        } else {
            if (!isset($items[$item])) {
                $items[$item] = false;
            }
        }
    }
}
OCP\JSON::success(array('data' => $items));