Ejemplo n.º 1
0
function handleActions($request)
{
    if (is_array($request) && isset($request['action'])) {
        switch ($request['action']) {
            case 'createNewFolder':
                return createNewFolder($request['idUser'], $request['path'], $request['folderName'], $request['inheritRightsFromParent']);
                break;
            case 'rename':
                return renameHandler($request['idElement'], $request['idUser'], $request['name'], $request['options']);
                break;
            case 'move':
                return moveHandler($request['idElement'], $request['idUser'], $request['path'], $request['options']);
                break;
            case 'disable':
                return disableHandler($request['idElement'], $request['idUser'], $request['returnImpactedElements']);
                break;
            case 'copy':
                return copyHandler($request['idElement'], $request['idUser'], $request['path'], $request['options']);
                break;
            case 'uplodad':
                break;
            case 'download':
                break;
            case 'shareWithUser':
                return shareWithUser($request['idElement'], $request['idUser'], $request['email'], $request['code']);
                break;
            case 'anonymousShare':
                break;
        }
    } else {
        return array('error' => 'Action parameter required, none found');
    }
}
Ejemplo n.º 2
0
<?php

/**
 * Created by PhpStorm.
 * User: Harry
 * Date: 12/06/14
 * Time: 19:59
 */
$projectRoot = $_SERVER['DOCUMENT_ROOT'] . '/Nestbox';
require_once $projectRoot . '/required.php';
if (!empty($_POST['newName']) && isset($_POST['idElement'])) {
    $renameResult = renameHandler($_POST['idElement'], $userId, $_POST['newName']);
    if (is_array($renameResult) && array_key_exists('error', $renameResult)) {
        echo $renameResult['error'];
    } else {
        echo 'The element has been successfully renamed to ' . $_POST['newName'];
    }
}