Пример #1
0
function getFolderInfo()
{
    $folder = new StorageAPIs($_SESSION['sHost'], $_SESSION['sApp'], $_SESSION['sTr']);
    $var0 = trim($_POST['var0'], " ");
    $var1 = trim($_POST['var1'], " ");
    $var2 = trim($_POST['var2'], " ");
    $var3 = trim($_POST['var3'], " ");
    echo "\nGET FOLDER INFO: \n\n";
    if (strlen($var0) == 0 || strlen($var1) == 0) {
        echo "\n Error: Empty mandatory field(s)!\n";
    } else {
        $folder->setAuthToken($var0);
        $responseObject = $folder->getFolderInfo($var1, $var2, $var3);
        $current = $responseObject->getErrorStatus();
        if (!empty($current)) {
            echo "Error Status: \n";
            echo " Error code: " . $current->getCode() . "\n";
            echo " Error message: " . $current->getMessage() . "\n";
        } else {
            $current = $responseObject->getRevision();
            if (!empty($current)) {
                echo " Revision: " . $current . "\n";
            } else {
                echo " Revision: N/A\n";
            }
            $current = $responseObject->getId();
            if (!empty($current)) {
                echo " Id: " . $current . "\n";
            } else {
                echo " Id: N/A\n";
            }
            $current = $responseObject->getCurrentUsage();
            if (!empty($current)) {
                echo " Current Usage: " . $current . "\n";
            } else {
                echo " Current Usage: N/A\n";
            }
            $current = $responseObject->getCreatedOn();
            if (!empty($current)) {
                echo " Created On: " . $current . "\n";
            } else {
                echo " Created On: N/A\n";
            }
            $current = $responseObject->getFileCount();
            if (strlen($current) == 0) {
                echo " File Count: N/A\n";
            } else {
                echo " File Count: " . $current . "\n";
            }
            $current = $responseObject->getFolderCount();
            if (strlen($current) == 0) {
                echo " Folder Count: N/A\n";
            } else {
                echo " Folder Count: " . $current . "\n";
            }
            $current = $responseObject->getName();
            if (!empty($current)) {
                echo " Name: " . $current . "\n";
            } else {
                echo " Name: N/A\n";
            }
            $current = $responseObject->getParentId();
            if (strlen($current) == 0) {
                echo " Parent Id: N/A\n";
            } else {
                echo " Parent Id: " . $current . "\n";
            }
            $current = $responseObject->getReadable();
            if (strlen($current) == 0) {
                echo " Readable: N/A\n";
            } else {
                echo " Readable: " . $current . "\n";
            }
            $current = $responseObject->getSize();
            if (strlen($current) == 0) {
                echo " Size: N/A\n";
            } else {
                echo " Size: " . $current . "\n";
            }
            $current = $responseObject->getType();
            if (!empty($current)) {
                echo " Type: " . $current . "\n";
            } else {
                echo " Type: N/A\n";
            }
            $current = $responseObject->getUpdatedOn();
            if (!empty($current)) {
                echo " Updated On: " . $current . "\n";
            } else {
                echo " Updated On: N/A\n";
            }
            $current = $responseObject->getWritable();
            if (strlen($current) == 0) {
                echo " Writable: N/A\n";
            } else {
                echo " Writable: " . $current . "\n";
            }
            $current = $responseObject->getStorageQuota();
            if (strlen($current) == 0) {
                echo " Storage Quota: N/A\n";
            } else {
                echo " Storage Quota: " . $current . "\n";
            }
            $files = $responseObject->getFiles();
            if (!empty($files)) {
                echo "\nFiles: \n";
                foreach ($files as $file) {
                    echo "\nFile: \n";
                    $current = $file->getRevision();
                    if (!empty($current)) {
                        echo " Revision: " . $current . "\n";
                    } else {
                        echo " Revision: N/A\n";
                    }
                    $current = $file->getId();
                    if (!empty($current)) {
                        echo " Id: " . $current . "\n";
                    } else {
                        echo " Id: N/A\n";
                    }
                    $current = $file->getCreatedOn();
                    if (!empty($current)) {
                        echo " Created On: " . $current . "\n";
                    } else {
                        echo " Created On: N/A\n";
                    }
                    $current = $file->getName();
                    if (!empty($current)) {
                        echo " Name: " . $current . "\n";
                    } else {
                        echo " Name: N/A\n";
                    }
                    $current = $file->getParentId();
                    if (strlen($current) == 0) {
                        echo " Parent Id: N/A\n";
                    } else {
                        echo " Parent Id: " . $current . "\n";
                    }
                    $current = $file->getSize();
                    if (strlen($current) == 0) {
                        echo " Size: N/A\n";
                    } else {
                        echo " Size: " . $current . "\n";
                    }
                }
            } else {
                echo "\nFiles: N/A\n";
            }
            $folders = $responseObject->getFolders();
            if (!empty($folders)) {
                echo "\nFolders: \n";
                foreach ($folders as $folder) {
                    echo "\nFolder: \n";
                    $current = $folder->getRevision();
                    if (!empty($current)) {
                        echo " Revision: " . $current . "\n";
                    } else {
                        echo " Revision: N/A\n";
                    }
                    $current = $folder->getId();
                    if (!empty($current)) {
                        echo " Id: " . $current . "\n";
                    } else {
                        echo " Id: N/A\n";
                    }
                    $current = $folder->getCreatedOn();
                    if (!empty($current)) {
                        echo " Created On: " . $current . "\n";
                    } else {
                        echo " Created On: N/A\n";
                    }
                    $current = $folder->getFileCount();
                    if (strlen($current) == 0) {
                        echo " File Count: N/A\n";
                    } else {
                        echo " File Count: " . $current . "\n";
                    }
                    $current = $folder->getFolderCount();
                    if (strlen($current) == 0) {
                        echo " Folder Count: N/A\n";
                    } else {
                        echo " Folder Count: " . $current . "\n";
                    }
                    $current = $folder->getName();
                    if (!empty($current)) {
                        echo " Name: " . $current . "\n";
                    } else {
                        echo " Name: N/A\n";
                    }
                    $current = $folder->getOwnedByUser();
                    if (!empty($current)) {
                        echo " Owned by user: "******"\n";
                    } else {
                        echo " Owned by user: N/A\n";
                    }
                    $current = $folder->getParentId();
                    if (strlen($current) == 0) {
                        echo " Parent Id: N/A\n";
                    } else {
                        echo " Parent Id: " . $current . "\n";
                    }
                    $current = $folder->getReadable();
                    if (strlen($current) == 0) {
                        echo " Readable: N/A\n";
                    } else {
                        echo " Readable: " . $current . "\n";
                    }
                    $current = $folder->getSize();
                    if (strlen($current) == 0) {
                        echo " Size: N/A\n";
                    } else {
                        echo " Size: " . $current . "\n";
                    }
                    $current = $folder->getType();
                    if (!empty($current)) {
                        echo " Type: " . $current . "\n";
                    } else {
                        echo " Type: N/A\n";
                    }
                    $current = $folder->getUpdatedOn();
                    if (!empty($current)) {
                        echo " Updated On: " . $current . "\n";
                    } else {
                        echo " Updated On: N/A\n";
                    }
                    $current = $folder->getWritable();
                    if (strlen($current) == 0) {
                        echo " Writable: N/A\n";
                    } else {
                        echo " Writable: " . $current . "\n";
                    }
                }
            } else {
                echo "\nFolders: N/A\n";
            }
        }
    }
    echo "\n----------------------------------------------------------------------------------------------------\n";
}