* 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/>
 *
 */
\OCP\JSON::checkAppEnabled('files_external_listing');
\OCP\JSON::checkLoggedIn();
\OCP\JSON::callCheck();
\OC_JSON::checkAdminUser();
$defaultDir = '/home';
if (\OC_Util::runningOnWindows()) {
    $defaultDir = 'C:\\';
}
$localroot = OCP\Config::getAppValue('files_external_listing', 'starting_dir', $defaultDir);
if (isset($_POST['path'])) {
    $path = realpath($_POST['path']);
    if (strpos($path, $localroot) === 0 or empty($_POST['path'])) {
        if (empty($_POST['path'])) {
            $path = $localroot;
        }
        if (!is_dir($path)) {
            //path is incorrect or is a file. Nothing to do, we work only with dirs
            OCP\JSON::error(array('data' => array('message' => 'Incorrect path: ' . $_POST['path'])));
        } elseif (isset($_POST['isnotempty']) && $_POST['isnotempty']) {
Пример #2
0
 /**
  * @brief Check if the user is a admin, send json error msg if not
  */
 public static function checkAdminUser()
 {
     return \OC_JSON::checkAdminUser();
 }