if ($callbackUrl != "") { if (file_exists(__DIR__ . '/../downloads')) { delFolder(__DIR__ . '/../downloads/'); } } F3::set('userId', $clientId); F3::set('privateKey', $privateKey); //###Create Signer, ApiClient and Storage Api objects //Create signer object $signer = new GroupDocsRequestSigner($privateKey); //Create apiClient object $apiClient = new APIClient($signer); //Create Doc Api object $docApi = new DocApi($apiClient); //Create Storage Api object $apiStorage = new StorageApi($apiClient); //Create AsyncApi object $api = new AsyncApi($apiClient); $mergApi = new MergeApi($apiClient); $signatureApi = new SignatureApi($apiClient); //Set url to choose whot server to use if ($basePath == "") { //If base base is empty seting base path to prod server $basePath = 'https://api.groupdocs.com/v2.0'; } //Set base path $docApi->setBasePath($basePath); $apiStorage->setBasePath($basePath); $api->setBasePath($basePath); $mergApi->setBasePath($basePath); $signatureApi->setBasePath($basePath);
if (!isset($clientId) || !isset($privateKey) || !isset($folder)) { $error = 'Please enter all required parameters'; F3::set('error', $error); } else { //Clear entered data from tags and spaces $clientId = strip_tags(trim($clientId)); $privateKey = strip_tags(trim($privateKey)); $folder = strip_tags(trim($folder)); $basePath = F3::get('POST["basePath"]'); //###Create Signer, ApiClient and Storage Api objects //Create signer object $signer = new GroupDocsRequestSigner($privateKey); //Create apiClient object $apiClient = new APIClient($signer); //Create Storage Api object $storageApi = new StorageApi($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'; } $basePath = strip_tags(trim($basePath)); //Set base path $storageApi->setBasePath($basePath); //###Make a request to Storage API using clientId and file id try { //Check entere path for propper slashes if (strpos($folder, '\\') == true) { $folder = str_replace('\\', '/', $folder); } //Create folder
F3::set('error', $error); } else { //Get base path $basePath = F3::get('POST["basePath"]'); // Deleting of tags, slashes and space from clientId and privateKey $clientID = strip_tags(stripslashes(trim($clientId))); //ClientId==UserId $apiKey = strip_tags(stripslashes(trim($privateKey))); //ApiKey==PrivateKey //### Create Signer, ApiClient and Storage Api objects // Create signer object $signer = new GroupDocsRequestSigner($apiKey); // Create apiClient object $apiClient = new APIClient($signer); // Create Storage Api object $storageApi = new StorageApi($apiClient); $id = ""; if ($basePath == "") { //If base base is empty seting base path to prod server $basePath = 'https://api.groupdocs.com/v2.0'; } //Set base path $storageApi->setBasePath($basePath); $url = F3::get('POST["url"]'); //Check is URL entered if ($url != "") { //Upload file from URL try { $uploadResult = $storageApi->UploadWeb($clientID, $url); //CHeck upload status if ($uploadResult->status == "Ok") {
$folderPath = trim(strip_tags($folderPath . "/")); } } } //Deleting of tags, slashes and space from clientId and privateKey $clientID = strip_tags(stripslashes(trim($clientId))); //ClientId==UserId $apiKey = strip_tags(stripslashes(trim($privateKey))); //ApiKey==PrivateKey //###Create Signer, ApiClient and Storage Api objects //Create signer object $signer = new GroupDocsRequestSigner($apiKey); //Create apiClient object $apiClient = new APIClient($signer); //Create Storage Api object $storageApi = new StorageApi($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 $storageApi->setBasePath($basePath); $iframe = null; //Check URL entered if ($url != "") { //Upload file from URL try { $uploadResult = $storageApi->UploadWeb($clientID, $url); //Check upload status if ($uploadResult->status == "Ok") {
F3::set('error', $error); } else { //Get base path $basePath = F3::get('POST["basePath"]'); //Get entered by user data $url = F3::get('POST["url"]'); $file = $_FILES['file']; $fileId = F3::get('POST["fileId"]'); $guid = ""; //###Create Signer, ApiClient and Storage Api objects //Create signer object $signer = new GroupDocsRequestSigner($privateKey); //Create apiClient object $apiClient = new APIClient($signer); //Create Storage Api object $storageApi = new StorageApi($apiClient); if ($basePath == "") { //If base base is empty seting base path to prod server $basePath = 'https://api.groupdocs.com/v2.0'; } //Set base path $storageApi->setBasePath($basePath); //Check if user choose upload file from URL if ($url != "") { //Upload file from URL try { $uploadResult = $storageApi->UploadWeb($clientId, $url); //Check is file uploaded if ($uploadResult->status == "Ok") { //Get file GUID $guid = $uploadResult->result->id;
if (empty($clientId) || empty($privateKey)) { $error = 'Please enter all required parameters'; F3::set('error', $error); } else { //Get base path $basePath = F3::get('POST["basePath"]'); //Set variables for Viewer F3::set('userId', $clientId); F3::set('privateKey', $privateKey); //###Create Signer, ApiClient and Storage Api objects //Create signer object $signer = new GroupDocsRequestSigner($privateKey); //Create apiClient object $apiClient = new APIClient($signer); //Create Storage Api object $storageApi = new StorageApi($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 $storageApi->setBasePath($basePath); //###Make request to Storage try { //Geting all Entities with thumbnails from current user $files = $storageApi->ListEntities($clientId, "", null, null, null, null, null, null, true); //Obtaining all thumbnails $thumbnail = ''; $name = ''; if ($files->status == "Ok") {
$clientId = F3::get('POST["clientId"]'); $privateKey = F3::get('POST["privateKey"]'); $fileId = F3::get('POST["fileId"]'); //###Check clientId, privateKey and file Id if (!isset($clientId) || !isset($privateKey) || !isset($fileId)) { $error = 'Please enter all required parameters'; F3::set('error', $error); } else { $basePath = F3::get('POST["basePath"]'); //###Create Signer, ApiClient and Storage Api objects //Create signer object $signer = new GroupDocsRequestSigner($privateKey); //Create apiClient object $apiClient = new APIClient($signer); //Create Storage Api object $storageApi = new StorageApi($apiClient); $docApi = new DocApi($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 $storageApi->setBasePath($basePath); $docApi->setBasePath($basePath); //###Make a request to Doc API using clientId and file id //Obtaining all Metadata for file try { $docInfo = $docApi->GetDocumentMetadata($clientId, $fileId); //Selecting file names if ($docInfo->status == "Ok") {
//Get base path $basePath = F3::get('POST["basePath"]'); $clientID = strip_tags(stripslashes(trim($clientId))); //ClientId==UserId $apiKey = strip_tags(stripslashes(trim($privateKey))); //ApiKey==PrivateKey //Process template F3::set('userId', $clientId); F3::set('privateKey', $privateKey); //###Create Signer, ApiClient and Storage Api objects //Create signer object $signer = new GroupDocsRequestSigner($apiKey); //Create apiClient object $apiClient = new APIClient($signer); //Create Storage Api object $storageApi = new StorageApi($apiClient); //Set url to choose whot server to use if ($basePath == "") { //If base base is empty seting base path to prod server $basePath = 'https://api.groupdocs.com/v2.0'; } //Set base path $storageApi->setBasePath($basePath); //###Make a request to Storage API using clientId //Upload file to current user storage using entere URl to the file $uploadResult = $storageApi->UploadWeb($clientID, $url); //###Check if file uploaded successfully if ($uploadResult->status == "Ok") { $guid = $uploadResult->result->guid; //Generation of iframe URL using $pageImage->result->guid //iframe to prodaction server
try { //###Check if user entered all parameters if (empty($clientId) || empty($privateKey)) { throw new Exception('Please enter FILE ID'); } else { F3::set('userId', $clientId); F3::set('privateKey', $privateKey); //###Create Signer, ApiClient and Storage Api objects //Create signer object $signer = new GroupDocsRequestSigner($privateKey); //Create apiClient object $apiClient = new APIClient($signer); //Create Doc Api object $docApi = new DocApi($apiClient); //Create Storage Api object $storageApi = new StorageApi($apiClient); //Create AsyncApi object $api = new AsyncApi($apiClient); $mergApi = new MergeApi($apiClient); //Set url to choose whot server to use if ($basePath == "") { //If base base is empty seting base path to prod server $basePath = 'https://api.groupdocs.com/v2.0'; } //Set base path $docApi->setBasePath($basePath); $storageApi->setBasePath($basePath); $api->setBasePath($basePath); $mergApi->setBasePath($basePath); //Get entered by user data $url = F3::get('POST["url"]');
//Delete temporary file which content callback data if (file_exists(__DIR__ . '/../callback_info.txt')) { unlink(__DIR__ . '/../callback_info.txt'); } //Deleting of tags, slashes and space from clientId and privateKey $clientID = strip_tags(stripslashes(trim($clientId))); //ClientId==UserId $apiKey = strip_tags(stripslashes(trim($privateKey))); //ApiKey==PrivateKey //###Create Signer, ApiClient and Storage Api objects //Create signer object $signer = new GroupDocsRequestSigner($apiKey); //Create apiClient object $apiClient = new APIClient($signer); //Create Storage Api object $storageApi = new StorageApi($apiClient); //Get entered by user data $name = ""; $fileGuId = ""; //Get file for upload $file = $_FILES['file']; if ($file["name"] != "") { //Get uploaded file $uploadedFile = $_FILES['file']; //###Check uploaded file if (null === $uploadedFile) { return new RedirectResponse("/sample39"); } //Temp name of the file $tmpName = $uploadedFile['tmp_name']; //Original name of the file
$clientId = $userInfo[0]; $privateKey = $userInfo[1]; //Get raw data $json = file_get_contents("php://input"); //Decode json with raw data to array $callBack_data = json_decode($json, true); //Get job id from array $jobId = $callBack_data["SourceId"]; //Create signer object $signer = new GroupDocsRequestSigner(trim($privateKey)); //Create apiClient object $apiClient = new APIClient($signer); //Create AsyncApi object $asyncApi = new AsyncApi($apiClient); //Create Storage Api object $storageApi = new StorageApi($apiClient); sleep(5); //Make request to Async API to get job info $jobInfo = $asyncApi->GetJobDocuments(trim($clientId), $jobId, ""); if ($jobInfo->status == "Ok") { //Get file guid $guid = $jobInfo->result->inputs[0]->outputs[0]->guid; //Get file name $name = $jobInfo->result->inputs[0]->outputs[0]->name; } //Local path to the downloads folder $downloadFolder = dirname(__FILE__) . '/../../downloads'; //Check is folder exist if (!file_exists($downloadFolder)) { //If folder don't exist create it mkdir($downloadFolder);
$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 Document Api objects // Create signer object $signer = new GroupDocsRequestSigner($privateKey); // Create apiClient object $apiClient = new ApiClient($signer); // Create Document object $docApi = new DocApi($apiClient); //Create Storage object $storageApi = new StorageApi($apiClient); if ($basePath == "") { //If base base is empty seting base path to prod server $basePath = 'https://api.groupdocs.com/v2.0'; } //Set base path $docApi->setBasePath($basePath); $storageApi->setBasePath($basePath); try { //Check folder name, if empty - set folder name to empty string if (empty($folderName) || $folderName == Null) { $folderName = ""; } //Get all files $files = $storageApi->ListEntities($clientId, $folderName, 0); //Obtaining file guid by file name
include_once(dirname(__FILE__) . '/lib/groupdocs-php/APIClient.php'); include_once(dirname(__FILE__) . '/lib/groupdocs-php/StorageApi.php'); include_once(dirname(__FILE__) . '/lib/groupdocs-php/GroupDocsRequestSigner.php'); $path = $_POST['dir']; if ($path == NULL || $path == "/") { $path = ""; } $private_key = $_GET['private_key']; $user_id = $_GET['user_id']; $signer = new GroupDocsRequestSigner($private_key); $apiClient = new APIClient($signer); $api = new StorageApi($apiClient); $cur_path = substr($path, 0, strlen($path)-1); try { $result = $api->ListEntities($user_id, $cur_path); $files = $result->result->files; $folders = $result->result->folders; } catch (Exception $e) { echo $e->getMessage(); } print("<ul class=\"jqueryFileTree\" style=\"display: ;\">"); if(!empty($folders)){
} else { //Get base path $basePath = F3::get('POST["basePath"]'); if ($basePath == "") { $basePath = 'https://api.groupdocs.com/v2.0'; } F3::set('userId', $clientId); F3::set('privateKey', $privateKey); F3::set('fileName', $fileName); #### Create Signer, ApiClient and Annotation Api objects # Create signer object $signer = new GroupDocsRequestSigner($privateKey); # Create apiClient object $apiClient = new ApiClient($signer); # Create Storage object $storageApi = new StorageApi($apiClient); $storageApi->setBasePath($basePath); #Get file GUID by it's name try { $allFiles = $storageApi->ListEntities($clientId, "", null, null, null, null, null, null, false); if ($allFiles->status == "Ok") { for ($i = 0; $i < count($allFiles->result->files); $i++) { if ($allFiles->result->files[$i]->name == $fileName) { $fileGuid = $allFiles->result->files[$i]->guid; } } # Delete file from Api Storage try { if ($fileGuid == "") { $message = '<span style="color: red">This file is no longer available</span>'; } else {
if (count($array) > 1) { $lastFolder = array_pop($array); $newPath = implode("/", $array); } else { $lastFolder = array_pop($array); } // initialization some variables $folderId = null; $users = ""; //### Create Signer, ApiClient, StorageApi and Document Api objects // Create signer object $signer = new GroupDocsRequestSigner($privateKey); // Create apiClient object $apiClient = new ApiClient($signer); // Create Storage object $storageApi = new StorageApi($apiClient); // Create Document object $docApi = new DocApi($apiClient); if ($basePath == "") { //If base base is empty seting base path to prod server $basePath = 'https://api.groupdocs.com/v2.0'; } //Set base path $storageApi->setBasePath($basePath); $docApi->setBasePath($basePath); // get folder ID try { $list = $storageApi->ListEntities($clientId, $newPath); if ($list->status == "Ok") { foreach ($list->result->folders as $folder) { if ($folder->name == $lastFolder) {
$iframeType = F3::get('POST["iframeType"]'); F3::set("iframeType", $iframeType); //Get base path $basePath = F3::get('POST["basePath"]'); //Get entered by user data $fileGuId = ""; $url = F3::get('POST["url"]'); $file = $_FILES['file']; $fileId = F3::get('POST["fileId"]'); //###Create Signer, ApiClient and Storage Api objects //Create signer object $signer = new GroupDocsRequestSigner($privateKey); //Create apiClient object $apiClient = new APIClient($signer); //Create Storage Api object $storageApi = new StorageApi($apiClient); //Check is 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 $storageApi->setBasePath($basePath); //Check if user choose upload file from URL if ($url != "") { //Upload file from URL try { $uploadResult = $storageApi->UploadWeb($clientId, $url); //Check is file uploaded if ($uploadResult->status == "Ok") { //Get file GUID
$privateKey = F3::get('POST["privateKey"]'); //###Check clientId and privateKey if (empty($clientId) || empty($privateKey)) { $error = 'Please enter all required parameters'; F3::set('error', $error); } else { //Get base path $basePath = F3::get('POST["basePath"]'); //###Create Signer, ApiClient and Storage Api objects //Create signer object $signer = new GroupDocsRequestSigner($privateKey); //Create apiClient object $apiClient = new APIClient($signer); // PHP SDK V1.1 //Create Storage Api object $storageApi = new StorageApi($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 $storageApi->setBasePath($basePath); //###Make a request to Storage API using clientId //Obtaining all Entities from current user try { $files = $storageApi->ListEntities($clientId, '', 0); if ($files->status == "Ok") { //Obtaining file names $name = ''; foreach ($files->result->files as $item) {