Exemplo n.º 1
0
if (empty($clientId) || empty($privateKey)) {
    $error = 'Please enter all required parameters';
    F3::set('error', $error);
} else {
    //Get base path
    $basePath = F3::get('POST["basePath"]');
    F3::set('userId', $clientId);
    F3::set('privateKey', $privateKey);
    //###Create Signer, ApiClient and Management Api objects
    //Create signer object
    $signer = new GroupDocsRequestSigner($privateKey);
    //Create apiClient object
    $apiClient = new APIClient($signer);
    // PHP SDK Version > 1.0
    //Create Management Api object
    $mgmtApi = new MgmtApi($apiClient);
    //Check if user entered base path
    if ($basePath == "") {
        //If base base is empty seting base path to prod server
        $basePath = 'https://api.groupdocs.com/v2.0';
    }
    //Set base path
    $mgmtApi->setBasePath($basePath);
    try {
        //###Make a request to Management API using clientId
        $userAccountInfo = $mgmtApi->GetUserProfile($clientId);
        //Check the result of the request
        if ($userAccountInfo->status == "Ok") {
            //If request was successfull - set userInfo variable for template
            F3::set('userInfo', $userAccountInfo->result->user);
        } else {
Exemplo n.º 2
0
 $targetFileId = "";
 $firstFileId = F3::get('POST["sourceFileId"]');
 $secondFileId = F3::get('POST["targetFileId"]');
 $url = F3::get('POST["url"]');
 $targetUrl = F3::get('POST["targetUrl"]');
 $iframe = "";
 //###Create Signer, ApiClient and Storage Api objects
 //Create signer object
 $signer = new GroupDocsRequestSigner($privateKey);
 //Create apiClient object
 $apiClient = new APIClient($signer);
 //Create ComparisonApi object
 $CompareApi = new ComparisonApi($apiClient);
 //Create Storage Api object
 $storageApi = new StorageApi($apiClient);
 $mgmtApi = new MgmtApi($apiClient);
 if ($basePath == "") {
     //If base base is empty seting base path to prod server
     $basePath = 'https://api.groupdocs.com/v2.0';
 }
 //Set base path
 $CompareApi->setBasePath($basePath);
 $storageApi->setBasePath($basePath);
 $mgmtApi->setBasePath($basePath);
 //Check entered source file GUID and target file GUID
 if ($firstFileId != "" || $secondFileId != "") {
     if ($firstFileId != "") {
         $sourceFileId = $firstFileId;
     }
     if ($secondFileId != "") {
         $targetFileId = $secondFileId;
Exemplo n.º 3
0
 $file = $_FILES['file'];
 F3::set('userId', $clientId);
 F3::set('privateKey', $privateKey);
 F3::set('email', $email);
 F3::set('firstName', $firstName);
 F3::set('lastName', $lastName);
 // Create signer object
 $signer = new GroupDocsRequestSigner($privateKey);
 // Create apiClient object
 $apiClient = new ApiClient($signer);
 // Create Annotation object
 $antApi = new AntApi($apiClient);
 //Create Storage Api object
 $storageApi = new StorageApi($apiClient);
 //Create MgmtApi object (this class allow manipulations with User account)
 $mgmtApi = new MgmtApi($apiClient);
 if ($basePath == "") {
     //If base base is empty seting base path to prod server
     $basePath = 'https://api.groupdocs.com/v2.0';
 }
 //Build propper basePath
 if (substr($basePath, -3) != "2.0") {
     if (substr($basePath, -1) != "/") {
         $basePath = $basePath . "/v2.0";
     } else {
         $basePath = $basePath . "v2.0";
     }
 }
 //Set base path
 $antApi->setBasePath($basePath);
 $storageApi->setBasePath($basePath);