コード例 #1
0
function getFileInfo()
{
    $file = new StorageAPIs($_SESSION['sHost'], $_SESSION['sApp'], $_SESSION['sTr']);
    $var0 = trim($_POST['var0'], " ");
    $var1 = trim($_POST['var1'], " ");
    echo "\nGET FILE INFO: \n\n";
    if (strlen($var0) == 0 || strlen($var1) == 0) {
        echo "\n Error: Empty mandatory field(s)!\n";
    } else {
        $file->setAuthToken($var0);
        $responseObject = $file->getFileInfo($var1);
        $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->getClickableDownloadUrl();
            if (!empty($current)) {
                echo " Clickable Download URL: " . $current . "\n";
            } else {
                echo " Clickable Download URL: N/A\n";
            }
            $current = $responseObject->getCreatedOn();
            if (!empty($current)) {
                echo " Created On: " . $current . "\n";
            } else {
                echo " Created On: N/A\n";
            }
            $current = $responseObject->getDownloadUrl();
            if (!empty($current)) {
                echo " Download URL: " . $current . "\n";
            } else {
                echo " Download URL: N/A\n";
            }
            $current = $responseObject->getName();
            if (!empty($current)) {
                echo " Name: " . $current . "\n";
            } else {
                echo " Name: N/A\n";
            }
            $current = $responseObject->getOwnedByStorage();
            if (!empty($current)) {
                echo " Owned by Storage: " . $current . "\n";
            } else {
                echo " Owned by Storage: N/A\n";
            }
            $current = $responseObject->getParentId();
            if (strlen($current) == 0) {
                echo " Parent Id: N/A\n";
            } else {
                echo " Parent Id: " . $current . "\n";
            }
            $current = $responseObject->getSize();
            if (!empty($current)) {
                echo " Size: " . $current . "\n";
            } else {
                echo " Size: N/A\n";
            }
        }
    }
    echo "\n----------------------------------------------------------------------------------------------------\n";
}
コード例 #2
0
ファイル: base.php プロジェクト: EdgeCommerce/edgecommerce
 public function file_info($file_id = null)
 {
     $obj = new \StorageAPIs(\Session::get('ysi.sHost'), \Session::get('ysi.sApp'), \Session::get('ysi.sTr'));
     $obj->setAuthToken(\Session::get('ysi.sToken'));
     $file = $obj->getFileInfo($file_id);
     $current = $file->getErrorStatus();
     if (!empty($current)) {
         $out = array('errorcode' => $current->getCode(), 'errormessage' => $current->getMessage());
     } else {
         $out['data']['revision'] = $file->getRevision();
         $out['data']['id'] = $file->getId();
         $out['data']['clickable_download_url'] = $file->getClickableDownloadUrl();
         $out['data']['created_on'] = $file->getCreatedOn();
         $out['data']['download_url'] = $file->getDownloadUrl();
         $out['data']['name'] = $file->getName();
         $out['data']['owned_by_storage'] = $file->getOwnedByStorage();
         $out['data']['parent_id'] = $file->getParentId();
         $out['data']['size'] = $file->getSize();
     }
     return $out;
 }