Exemplo n.º 1
2
 /**
  * Uploads backup file from server to Google Drive.
  *
  * @param 	array 	$args	arguments passed to the function
  * [google_drive_token] -> user's Google drive token in json form
  * [google_drive_directory] -> folder on user's Google Drive account which backup file should be upload to
  * [google_drive_site_folder] -> subfolder with site name in google_drive_directory which backup file should be upload to
  * [backup_file] -> absolute path of backup file on local server
  * @return 	bool|array		true is successful, array with error message if not
  */
 function google_drive_backup($args)
 {
     extract($args);
     global $mmb_plugin_dir;
     require_once "{$mmb_plugin_dir}/lib/google-api-client/Google_Client.php";
     require_once "{$mmb_plugin_dir}/lib/google-api-client/contrib/Google_DriveService.php";
     $gdrive_client = new Google_Client();
     $gdrive_client->setUseObjects(true);
     $gdrive_client->setAccessToken($google_drive_token);
     $gdrive_service = new Google_DriveService($gdrive_client);
     try {
         $about = $gdrive_service->about->get();
         $root_folder_id = $about->getRootFolderId();
     } catch (Exception $e) {
         return array('error' => $e->getMessage());
     }
     try {
         $list_files = $gdrive_service->files->listFiles(array("q" => "title='{$google_drive_directory}' and '{$root_folder_id}' in parents and trashed = false"));
         $files = $list_files->getItems();
     } catch (Exception $e) {
         return array('error' => $e->getMessage());
     }
     if (isset($files[0])) {
         $managewp_folder = $files[0];
     }
     if (!isset($managewp_folder)) {
         try {
             $_managewp_folder = new Google_DriveFile();
             $_managewp_folder->setTitle($google_drive_directory);
             $_managewp_folder->setMimeType('application/vnd.google-apps.folder');
             if ($root_folder_id != null) {
                 $parent = new Google_ParentReference();
                 $parent->setId($root_folder_id);
                 $_managewp_folder->setParents(array($parent));
             }
             $managewp_folder = $gdrive_service->files->insert($_managewp_folder, array());
         } catch (Exception $e) {
             return array('error' => $e->getMessage());
         }
     }
     if ($google_drive_site_folder) {
         try {
             $subfolder_title = $this->site_name;
             $managewp_folder_id = $managewp_folder->getId();
             $list_files = $gdrive_service->files->listFiles(array("q" => "title='{$subfolder_title}' and '{$managewp_folder_id}' in parents and trashed = false"));
             $files = $list_files->getItems();
         } catch (Exception $e) {
             return array('error' => $e->getMessage());
         }
         if (isset($files[0])) {
             $backup_folder = $files[0];
         } else {
             try {
                 $_backup_folder = new Google_DriveFile();
                 $_backup_folder->setTitle($subfolder_title);
                 $_backup_folder->setMimeType('application/vnd.google-apps.folder');
                 if (isset($managewp_folder)) {
                     $_backup_folder->setParents(array($managewp_folder));
                 }
                 $backup_folder = $gdrive_service->files->insert($_backup_folder, array());
             } catch (Exception $e) {
                 return array('error' => $e->getMessage());
             }
         }
     } else {
         $backup_folder = $managewp_folder;
     }
     $file_path = explode('/', $backup_file);
     $new_file = new Google_DriveFile();
     $new_file->setTitle(end($file_path));
     $new_file->setDescription('Backup file of site: ' . $this->site_name . '.');
     if ($backup_folder != null) {
         $new_file->setParents(array($backup_folder));
     }
     $tries = 1;
     while ($tries <= 2) {
         try {
             $data = file_get_contents($backup_file);
             $createdFile = $gdrive_service->files->insert($new_file, array('data' => $data));
             break;
         } catch (Exception $e) {
             if ($e->getCode() >= 500 && $e->getCode() <= 504 && $mmb_gdrive_upload_tries <= 2) {
                 sleep(2);
                 $tries++;
             } else {
                 return array('error' => $e->getMessage());
             }
         }
     }
     return true;
 }
 function uploadFile($filePath = "", $fileName, $folderId = null)
 {
     if ($fileName == null) {
         $fileName = basename($filePath);
     }
     $data = "";
     $file = new Google_DriveFile();
     $file->setTitle($fileName);
     if ($filePath) {
         $file->setMimeType('');
         $data = file_get_contents($filePath);
     } else {
         $file->setMimeType('application/vnd.google-apps.folder');
     }
     if ($folderId != null) {
         $folders = explode(",", $folderId);
         $parents = array();
         foreach ($folders as $folder) {
             $parent = new Google_ParentReference();
             $parent->setId($folder);
             array_push($parents, $parent);
         }
         $file->setParents($parents);
     }
     $service = new Google_DriveService($this->gClient);
     $createdFile = $service->files->insert($file, array('data' => $data, 'mimeType' => ''));
     return $createdFile;
 }
Exemplo n.º 3
0
/**
 * Copy an existing file.
 *
 * @param Google_DriveService $service Drive API service instance.
 * @param String $originFileId ID of the origin file to copy.
 * @param String $copyTitle Title of the copy.
 * @return DriveFile The copied file. NULL is returned if an API error occurred.
 */
function copyFile($service, $originFileId, $copyTitle, $parentId)
{
    $copiedFile = new Google_DriveFile();
    $parent = new Google_ParentReference();
    $parent->setId($parentId);
    $copiedFile->setParents(array($parent));
    $copiedFile->setTitle($copyTitle);
    try {
        return $service->files->copy($originFileId, $copiedFile);
    } catch (Exception $e) {
        print "An error occurred: " . $e->getMessage();
    }
    return NULL;
}
Exemplo n.º 4
0
 public function touch($path, $mtime = null)
 {
     $file = $this->getDriveFile($path);
     $result = false;
     if ($file) {
         if (isset($mtime)) {
             $file->setModifiedDate($mtime);
             $result = $this->service->files->patch($file->getId(), $file, array('setModifiedDate' => true));
         } else {
             $result = $this->service->files->touch($file->getId());
         }
     } else {
         $parentFolder = $this->getDriveFile(dirname($path));
         if ($parentFolder) {
             $file = new \Google_DriveFile();
             $file->setTitle(basename($path));
             $parent = new \Google_ParentReference();
             $parent->setId($parentFolder->getId());
             $file->setParents(array($parent));
             $result = $this->service->files->insert($file);
         }
     }
     if ($result) {
         $this->setDriveFile($path, $result);
     }
     return (bool) $result;
 }
Exemplo n.º 5
0
 public function createFolder($title, $parentId = null)
 {
     $client = $this->getClient();
     $service = new Google_DriveService($client);
     $file = new Google_DriveFile();
     $file->setTitle($title);
     $file->setMimeType('application/vnd.google-apps.folder');
     if (null !== $parentId) {
         $parent = new Google_ParentReference();
         $parent->setId($parentId);
         $file->setParents(array($parent));
     }
     return $service->files->insert($file, array('mimeType' => 'application/vnd.google-apps.folder'));
 }
Exemplo n.º 6
0
 public function uploadfile()
 {
     if ($_FILES['upld_file'] && $this->input->post('folderid')) {
         try {
             $client = $this->google_client;
             $client->setAccessToken($this->session->userdata('accessToken'));
             $service = new Google_DriveService($client);
             $folderdetailArray = $this->usermodel->getallfolders($this->input->post('folderid'), 'getbyId');
             //pr($folderdetailArray);
             /*$file = new Google_DriveFile();
             		$file->setTitle($_FILES['upld_file']['name']);
             		$file->setDescription('This is a '.$_FILES['upld_file']['type'].' document');
             		$file->setMimeType($_FILES['upld_file']['type']);
             		$service->files->insert(
             		    $file,
             		    array(
             			'data' => file_get_contents($_FILES['upld_file']['tmp_name']),
             			'mimeType' => $_FILES['upld_file']['type']
             		    )
             		);*/
             $title = $_FILES['upld_file']['name'];
             $description = 'This is a ' . $_FILES['upld_file']['type'] . ' document';
             $parentId = $folderdetailArray[0]['googlefolderId'];
             $mimeType = $_FILES['upld_file']['type'];
             $filename = $_FILES['upld_file']['name'];
             $filepath = $_FILES['upld_file']['tmp_name'];
             $file = new Google_DriveFile();
             $file->setTitle($title);
             $file->setDescription($description);
             $file->setMimeType($mimeType);
             if ($parentId != null) {
                 $parent = new Google_ParentReference();
                 $parent->setId($parentId);
                 $file->setParents(array($parent));
             }
             $service->files->insert($file, array('data' => file_get_contents($filepath), 'mimeType' => $mimeType));
             //pr($service);
             /*Recent file insert function call*/
             $array = array('title' => $title, 'doc_id' => '', 'doc_type' => $mimeType, 'folder_id' => $parentId, 'folder_name' => '', 'user_id' => $this->session->userdata('userid'), 'action_description' => 'File uploading');
             $this->usermodel->saverecentfiles($array);
             //insertFile($service, $title, $description, $parentId, $mimeType, $filename,$filepath);
             $this->session->set_flashdata('message', '<div class="alert-success">' . $this->lang->line('file_upload_sucesss') . '</div>');
             redirect('users/fileListing/' . $parentId);
         } catch (Exception $e) {
             pre($e);
             exit;
             $this->session->set_flashdata('message', '<div class="alert-error">' . $this->lang->line('file_upload_sucesss') . '</div>');
             redirect('users/fileListing/' . $parentId);
         }
     }
 }
Exemplo n.º 7
0
function gdwpm_action_callback()
{
    global $wpdb, $cek_kunci, $gdwpm_opt_akun, $gdwpm_service, $gdwpm_apiConfig;
    $gdwpm_opt_akun = get_option('gdwpm_akun_opt');
    // imel, client id, gdwpm_service akun, private key
    require_once 'gdwpm-api/Google_Client.php';
    require_once 'gdwpm-api/contrib/Google_DriveService.php';
    if (isset($_POST['folder_pilian'])) {
        $gdwpm_apiConfig['use_objects'] = true;
        $gdwpm_service = new GDWPMBantuan($gdwpm_opt_akun[1], $gdwpm_opt_akun[2], $gdwpm_opt_akun[3]);
        $fld = $_POST['folder_pilian'];
        if (isset($_POST['pagetoken'])) {
            $daftar_berkas = $gdwpm_service->getFilesInFolder($fld, $_POST['pilmaxres'], $_POST['pagetoken']);
        } else {
            $daftar_berkas = $gdwpm_service->getFilesInFolder($fld, $_POST['pilmaxres']);
        }
        //array($daftarfile, $i, $totalhal, $halterlihat)
        if ($daftar_berkas[1] <= 0) {
            // total files < 1
            if ($daftar_berkas[2] > 1) {
                // total halaman > 1
                if ($daftar_berkas[3] == $daftar_berkas[2]) {
                    echo '<div class="sukses"><p style="text-align:center;"><img src="' . plugins_url('/images/animation/gdwpm_breaker_256.png', __FILE__) . '"><br/>This page is empty.</p></div>';
                    echo $daftar_berkas[0];
                } else {
                    echo '<div class="sukses"><p style="text-align:center;"><img src="' . plugins_url('/images/animation/gdwpm_breaker_256.png', __FILE__) . '"><br/>Your request contains multiple pages, click the page number below.</p></div>';
                    echo $daftar_berkas[0];
                }
            } else {
                echo '<div class="sukses"><p style="text-align:center;"><img src="' . plugins_url('/images/animation/gdwpm_breaker_256.png', __FILE__) . '"><br/>This folder is empty.</p></div>';
            }
        } else {
            echo '<div class="sukses"><p>Folder ID: <strong>' . $fld . '</strong> and items on page: <strong>' . $daftar_berkas[1] . '</strong>.<select style="float:right;" id="pilihBaris" onchange="gantiBaris(this, \'paginasi\');"><option value="5">5 rows/sheet</option><option value="10" selected="selected">10 rows/sheet</option>   <option value="15">15 rows/sheet</option><option value="20">20 rows/sheet</option><option value="25">25 rows/sheet</option><option value="30">30 rows/sheet</option><option value="40">40 rows/sheet</option><option value="50">50 rows/sheet</option></select></p></div>';
            echo $daftar_berkas[0];
        }
    } elseif (isset($_POST['folder_pilian_file_gal'])) {
        $gdwpm_apiConfig['use_objects'] = true;
        $gdwpm_service = new GDWPMBantuan($gdwpm_opt_akun[1], $gdwpm_opt_akun[2], $gdwpm_opt_akun[3]);
        $fld = $_POST['folder_pilian_file_gal'];
        if (isset($_POST['pagetoken'])) {
            $daftar_berkas = $gdwpm_service->getFilesInFolder($fld, $_POST['pilmaxres'], $_POST['pagetoken'], 'gall');
        } else {
            $daftar_berkas = $gdwpm_service->getFilesInFolder($fld, $_POST['pilmaxres'], null, 'gall');
        }
        //array($daftarfile, $i, $totalhal, $halterlihat)
        if ($daftar_berkas[1] <= 0) {
            // total files < 1
            if ($daftar_berkas[2] > 1) {
                // total halaman > 1
                if ($daftar_berkas[3] == $daftar_berkas[2]) {
                    echo '<div class="sukses_gal"><p style="text-align:center;"><img src="' . plugins_url('/images/animation/gdwpm_breaker_256.png', __FILE__) . '"><br/>This page is empty.</p></div>';
                    echo $daftar_berkas[0];
                } else {
                    echo '<div class="sukses_gal"><p style="text-align:center;"><img src="' . plugins_url('/images/animation/gdwpm_breaker_256.png', __FILE__) . '"><br/>Your request contains multiple pages, click the page number below.</p></div>';
                    echo $daftar_berkas[0];
                }
            } else {
                echo '<div class="sukses_gal"><p style="text-align:center;"><img src="' . plugins_url('/images/animation/gdwpm_breaker_256.png', __FILE__) . '"><br/>This folder is empty.</p></div>';
            }
        } else {
            echo '<div class="sukses_gal"><p>Folder ID: <strong>' . $fld . '</strong> and items on page: <strong>' . $daftar_berkas[1] . '</strong>.<select style="float:right;" id="pilihBaris_gal" onchange="gantiBaris(this, \'paginasi_gal\');"><option value="5">5 rows/sheet</option><option value="10" selected="selected">10 rows/sheet</option>   <option value="15">15 rows/sheet</option><option value="20">20 rows/sheet</option><option value="25">25 rows/sheet</option><option value="30">30 rows/sheet</option><option value="40">40 rows/sheet</option><option value="50">50 rows/sheet</option></select></p></div>';
            echo $daftar_berkas[0];
        }
    } elseif (isset($_POST['folder_pilian_file_del'])) {
        $gdwpm_apiConfig['use_objects'] = true;
        $gdwpm_service = new GDWPMBantuan($gdwpm_opt_akun[1], $gdwpm_opt_akun[2], $gdwpm_opt_akun[3]);
        $fld = $_POST['folder_pilian_file_del'];
        if (isset($_POST['pagetoken'])) {
            $daftar_berkas = $gdwpm_service->getFilesInFolder($fld, $_POST['pilmaxres'], $_POST['pagetoken'], 'checkbox');
        } else {
            $daftar_berkas = $gdwpm_service->getFilesInFolder($fld, $_POST['pilmaxres'], null, 'checkbox');
        }
        $daftarfile = $daftar_berkas[0];
        $i = $daftar_berkas[1];
        if ($daftar_berkas[1] <= 0) {
            if ($daftar_berkas[2] > 1) {
                // total halaman > 1
                if ($daftar_berkas[3] == $daftar_berkas[2]) {
                    echo '<div class="sukses_del"><p style="text-align:center;"><img src="' . plugins_url('/images/animation/gdwpm_breaker_256.png', __FILE__) . '"><br/>This page is empty.</p></div>';
                    echo $daftarfile;
                } else {
                    echo '<div class="sukses_del"><p style="text-align:center;"><img src="' . plugins_url('/images/animation/gdwpm_breaker_256.png', __FILE__) . '"><br/>Your request contains multiple pages, click the page number below.</p></div>';
                    echo $daftarfile;
                }
            } else {
                echo '<div class="sukses_del"><p style="text-align:center;"><img src="' . plugins_url('/images/animation/gdwpm_breaker_256.png', __FILE__) . '"><br/>This folder is empty.</p></div>';
            }
        } else {
            echo '<div class="sukses_del"><p>Folder ID: <strong>' . $fld . '</strong> and items on page: <strong>' . $i . '</strong>.</p></div>';
            echo $daftarfile;
        }
    } elseif (isset($_POST['dataimages'])) {
        // insert gallery
        $unikid = strtotime("now");
        $postjudul = base64_decode($_POST['judul']);
        $postkat = base64_decode($_POST['album']);
        $postkontenarr = explode(' , ', $_POST['dataimages']);
        //$postkonten = "<div class='gdwpmgallery'>";		//lightbox
        //$postkonten = '<div class="fotorama" data-allowfullscreen="native" data-loop="true" data-autoplay="true">';	//fotorama
        if (isset($_POST['css_effect'])) {
            $css_effect = $_POST['css_effect'];
            //default/blackwhite/lighthover
        } else {
            $css_effect = 'default';
        }
        switch ($css_effect) {
            case "default":
                $efekgbr = '';
                break;
            case "blackwhite":
                $efekgbr = ' gdwpm-bwefek';
                break;
            case "lighthover":
                $efekgbr = ' gdwpm-lightefek';
                break;
            default:
                $efekgbr = '';
        }
        if (isset($_POST['css_style'])) {
            $css_style = $_POST['css_style'];
            //default/blackwhite/lighthover
        } else {
            $css_style = 'default';
        }
        $jmlkolom = 3;
        $justproper = '1 | 90 | justify';
        if ($css_style == 'justified') {
            if (isset($_POST['css_style_justified'])) {
                $justproper = $_POST['css_style_justified'];
            }
            $postkonten = '<div id="gdwpmgal-' . $unikid . '" class="gdwpmGallery1' . $efekgbr . '" data-gal1="' . $justproper . '">';
            //Justified + lightbox
            $dataSource = array();
            foreach ($postkontenarr as $key => $val) {
                // id, thumbid, flnme | captionimg
                $indidata = explode(' | ', $val);
                $indidatadecode = json_decode(base64_decode($indidata[0]), true);
                $captionimg = base64_decode($indidata[1]);
                if ($key == 0) {
                    $sampleImage = $indidatadecode[1];
                }
                //$dataSource[] = array($indidatadecode[0], $indidatadecode[1]) . ' | ' . $captionimg;
                //$postkonten .= '<div class="galleryItem"><a href="//www.googledrive.com/host/'.$indidatadecode[0].'" data-lightbox="'.$unikid.'" data-title="'.$captionimg.'"><img src="//www.googledrive.com/host/'.$thumbId.'" alt="'.$indidatadecode[1].'"/></a></div>';      //lightbox
                //$postkonten .= '<a href="//www.googledrive.com/host/'.$thumbId.'" data-full="//www.googledrive.com/host/'.$indidatadecode[0].'" data-caption="'.$captionimg.'"></a>';	//fotorama
                $boxttl = '';
                $jusalt = '';
                if (!empty($captionimg)) {
                    $boxttl = 'data-title="' . $captionimg . '" ';
                    $jusalt = 'alt="' . $captionimg . '" ';
                }
                $postkonten .= '<a href="https://www.googledrive.com/host/' . $indidatadecode[0] . '" ' . $boxttl . 'data-lightbox="' . $unikid . '"><img ' . $jusalt . 'src="https://www.googledrive.com/host/' . $indidatadecode[1] . '" /></a>';
                //justified
            }
        } else {
            if (isset($_POST['css_style_default'])) {
                $jmlkolom = $_POST['css_style_default'];
            }
            $postkonten = '<div class="gdwpmGallery0' . $efekgbr . ' gallery gallery-columns-' . $jmlkolom . '">';
            $dataSource = array();
            foreach ($postkontenarr as $key => $val) {
                // id, thumbid, flnme | captionimg
                $indidata = explode(' | ', $val);
                $indidatadecode = json_decode(base64_decode($indidata[0]), true);
                $captionimg = base64_decode($indidata[1]);
                if ($key == 0) {
                    $sampleImage = $indidatadecode[1];
                }
                $postkonten .= '<dl style="width:' . 100 / $jmlkolom . '%;" class="gallery-item"><dt class="gallery-icon"><a href="https://www.googledrive.com/host/' . $indidatadecode[0] . '" data-lightbox="' . $unikid . '" data-title="' . $captionimg . '"><img class="attachment-thumbnail img-rounded" src="https://www.googledrive.com/host/' . $indidatadecode[1] . '" alt="' . $indidatadecode[2] . '" width="200" /></a></dt><dd class="wp-caption-text gallery-caption">' . $captionimg . '</dd></dl>';
                if ($key > 0 && ($key + 1) % $jmlkolom == 0 || $key == count($postkontenarr) - 1) {
                    $postkonten .= '<br style="clear: both" />';
                }
            }
        }
        $postkonten .= '</div>';
        //$postkonten = base64_decode($_POST['dataimages']);
        $gallery = array('post_title' => wp_strip_all_tags($postjudul), 'post_name' => sanitize_title_with_dashes($postjudul), 'post_content' => $postkonten, 'post_status' => 'publish', 'post_author' => 1, 'post_type' => 'gdwpm_galleries');
        if (empty($_POST['galid']) || $_POST['galid'] == '') {
            $galeri_id = wp_insert_post($gallery);
            $infokita = 'created';
        } else {
            $gallery['ID'] = $_POST['galid'];
            $galeri_id = wp_update_post($gallery);
            $infokita = 'saved';
        }
        if ($galeri_id != 0) {
            wp_set_object_terms($galeri_id, $postkat, 'gdwpm_album');
            update_post_meta($galeri_id, 'sampleImage', $sampleImage);
            $baseData = base64_encode(json_encode(array($galeri_id, wp_strip_all_tags($postjudul), $postkat, $css_style, $css_effect, 'lightbox', $jmlkolom, $justproper)));
            $baseData .= ' items:' . $_POST['dataimages'];
            update_post_meta($galeri_id, 'base64data', $baseData);
            echo '<strong>' . $postjudul . '</strong> successfully ' . $infokita . '. Gallery ID: <strong>' . $galeri_id . '</strong>. Shortcode: <code>[gdwpm-gallery id="' . $galeri_id . '"]</code>. Permalink: <a href="' . get_permalink($galeri_id) . '" title="Open ' . $postjudul . ' in new window" target="_blank">' . get_permalink($galeri_id) . '</a>';
        } else {
            echo 'Cannot create gallery.';
        }
    } elseif (isset($_POST['masuk_perpus'])) {
        //$gdwpm_berkas_terpilih_arr = explode(' | ', $_POST['masuk_perpus']);
        $gdwpm_berkas_terpilih_arr = json_decode(base64_decode($_POST['masuk_perpus']), true);
        gdwpm_ijin_masuk_perpus(sanitize_mime_type($gdwpm_berkas_terpilih_arr[0]), $gdwpm_berkas_terpilih_arr[1], $gdwpm_berkas_terpilih_arr[2], $gdwpm_berkas_terpilih_arr[3], $gdwpm_berkas_terpilih_arr[4], $gdwpm_berkas_terpilih_arr[5]);
        echo '<strong>' . $gdwpm_berkas_terpilih_arr[1] . '</strong> has been added to your Media Library';
    } elseif (isset($_POST['gdwpm_ukuran_preview_lebar']) || isset($_POST['gdwpm_ukuran_preview_tinggi'])) {
        $nonce = $_REQUEST['gdwpm_override_nonce'];
        if (!wp_verify_nonce($nonce, 'gdwpm_override_dir')) {
            wp_die('<strong>Oops... failed!</strong>');
        } else {
            if (!$gdwpm_ukuran_preview) {
                $gdwpm_ukuran_preview = get_option('gdwpm_ukuran_preview');
            }
            if (ctype_digit($_POST['gdwpm_ukuran_preview_lebar']) && ctype_digit($_POST['gdwpm_ukuran_preview_tinggi'])) {
                if ($_POST['gdwpm_ukuran_preview_lebar'] > 20 && $_POST['gdwpm_ukuran_preview_tinggi'] > 10) {
                    if ($_POST['gdwpm_cekbok_embed_video'] == 'checked') {
                        if (isset($_POST['gdwpm_video_play_style']) && $_POST['gdwpm_ukuran_video_lebar'] > 20 && $_POST['gdwpm_ukuran_video_tinggi'] > 20 && ctype_digit($_POST['gdwpm_ukuran_video_lebar']) && ctype_digit($_POST['gdwpm_ukuran_video_tinggi'])) {
                            $gdwpm_ukuran_prev_arr = array($_POST['gdwpm_ukuran_preview_lebar'], $_POST['gdwpm_ukuran_preview_tinggi'], $_POST['gdwpm_cekbok_embed_video'], $_POST['gdwpm_video_play_style'], $_POST['gdwpm_ukuran_video_lebar'], $_POST['gdwpm_ukuran_video_tinggi']);
                            update_option('gdwpm_ukuran_preview', $gdwpm_ukuran_prev_arr);
                            echo '<div id="info">Option saved.</div><div id="hasil">[gdwpm id="<b>YOURGOOGLEDRIVEFILEID</b>" w="<b>' . $gdwpm_ukuran_prev_arr[0] . '</b>" h="<b>' . $gdwpm_ukuran_prev_arr[1] . '</b>"]</div><div id="hasilvid">[gdwpm id="<b>YOURGOOGLEDRIVEFILEID</b>" video="<b>' . $gdwpm_ukuran_prev_arr[3] . '</b>" w="<b>' . $gdwpm_ukuran_prev_arr[4] . '</b>" h="<b>' . $gdwpm_ukuran_prev_arr[5] . '</b>"]</div>';
                        } else {
                            echo '<div id="info"><strong>Warning:</strong> Minimum value is 20.</div><div id="hasil">[gdwpm id="GOOGLEDRIVEFILEID" w="<b>' . $gdwpm_ukuran_preview[0] . '</b>" h="<b>' . $gdwpm_ukuran_preview[1] . '</b>"]</div>';
                        }
                    } else {
                        $gdwpm_ukuran_prev_arr = array($_POST['gdwpm_ukuran_preview_lebar'], $_POST['gdwpm_ukuran_preview_tinggi'], $_POST['gdwpm_cekbok_embed_video'], $gdwpm_ukuran_preview[3], $gdwpm_ukuran_preview[4], $gdwpm_ukuran_preview[5]);
                        update_option('gdwpm_ukuran_preview', $gdwpm_ukuran_prev_arr);
                        echo '<div id="info">Option saved.</div><div id="hasil">[gdwpm id="<b>YOURGOOGLEDRIVEFILEID</b>" w="<b>' . $gdwpm_ukuran_prev_arr[0] . '</b>" h="<b>' . $gdwpm_ukuran_prev_arr[1] . '</b>"]</div>';
                    }
                } else {
                    echo '<div id="info"><strong>Warning:</strong> Minimum value is 10.</div><div id="hasil">[gdwpm id="GOOGLEDRIVEFILEID" w="<b>' . $gdwpm_ukuran_preview[0] . '</b>" h="<b>' . $gdwpm_ukuran_preview[1] . '</b>"]</div>';
                }
            } else {
                echo '<div id="info"><strong>Warning:</strong> Numeric only please.</div><div id="hasil">[gdwpm id="GOOGLEDRIVEFILEID" w="<b>' . $gdwpm_ukuran_preview[0] . '</b>" h="<b>' . $gdwpm_ukuran_preview[1] . '</b>"]</div>';
            }
        }
    } elseif (isset($_POST['gdwpm_cekbok_opsi_value'])) {
        $nonce = $_REQUEST['gdwpm_override_nonce'];
        if (!wp_verify_nonce($nonce, 'gdwpm_override_dir')) {
            wp_die('<strong>Oops... failed!</strong>');
        } else {
            $folder_bawaan = preg_replace("/[^a-zA-Z0-9]+/", " ", $_POST['gdwpm_folder_opsi_value']);
            $folder_bawaan = sanitize_text_field($folder_bawaan);
            if (empty($folder_bawaan) && $_POST['gdwpm_cekbok_opsi_value'] == 'checked') {
                echo 'Folder name cannot be empty!';
            } else {
                $gdwpm_cekbok = array($_POST['gdwpm_cekbok_opsi_value'], $folder_bawaan, $_POST['gdwpm_cekbok_masukperpus_override']);
                update_option('gdwpm_override_dir_bawaan', $gdwpm_cekbok);
                echo 'Option saved.';
            }
        }
    } elseif (isset($_POST['gdwpm_cekbok_opsi_dummy'])) {
        $nonce = $_REQUEST['gdwpm_override_nonce'];
        if (!wp_verify_nonce($nonce, 'gdwpm_override_dir')) {
            die('<strong>Oops... failed!</strong>');
        } else {
            update_option('gdwpm_dummy_folder', $_POST['gdwpm_cekbok_opsi_dummy']);
            echo 'Option saved.';
        }
    } elseif (isset($_REQUEST['gdwpm_tabulasi'])) {
        if ($_REQUEST['gdwpm_tabulasi'] == 'opsyen') {
            $nonce = $_REQUEST['gdwpm_tab_opsi_nonce'];
            if (!wp_verify_nonce($nonce, 'gdwpm_tab_opsi_key')) {
                wp_die('<div class="error"><p>Oops.. security check is not ok!</p></div>');
            } else {
                require_once 'google-drive-wp-media-options.php';
            }
        } elseif ($_REQUEST['gdwpm_tabulasi'] == 'infosyen') {
            $nonce = $_REQUEST['gdwpm_tab_info_nonce'];
            if (!wp_verify_nonce($nonce, 'gdwpm_tab_opsi_key')) {
                wp_die('<div class="error"><p>Oops.. security check is not ok!</p></div>');
            } else {
                require_once 'google-drive-wp-media-info.php';
            }
        } elseif ($_REQUEST['gdwpm_tabulasi'] == 'apidoku') {
            $nonce = $_REQUEST['gdwpm_tabulasi_nonce'];
            if (!wp_verify_nonce($nonce, 'gdwpm_tabulasi_ajax')) {
                wp_die('<div class="error"><p>Oops.. security check is not ok!</p></div>');
            } else {
                require_once 'google-drive-wp-media-documentation.php';
            }
        } elseif ($_REQUEST['gdwpm_tabulasi'] == 'themeset') {
            $nonce = $_REQUEST['gdwpm_tabulasi_themeset_nonce'];
            if (!wp_verify_nonce($nonce, 'gdwpm_tabulasi_themeset_nonce')) {
                wp_die('<div class="error"><p>Oops.. security check is not ok!</p></div>');
            } else {
                require_once 'google-drive-wp-media-themes.php';
            }
        } elseif ($_REQUEST['gdwpm_tabulasi'] == 'albums') {
            $nonce = $_REQUEST['gdwpm_tabulasi_albums_nonce'];
            if (!wp_verify_nonce($nonce, 'gdwpm_tabulasi_albums_nonce')) {
                wp_die('<div class="error"><p>Oops.. security check is not ok!</p></div>');
            } else {
                require_once 'google-drive-wp-media-albums.php';
            }
        } elseif ($_REQUEST['gdwpm_tabulasi'] == 'galleries') {
            $nonce = $_REQUEST['gdwpm_tabulasi_galleries_nonce'];
            if (!wp_verify_nonce($nonce, 'gdwpm_tabulasi_galleries_nonce')) {
                wp_die('<div class="error"><p>Oops.. security check is not ok.</p></div>');
            } else {
                if (isset($_REQUEST['paged'])) {
                    $paged = $_REQUEST['paged'];
                }
                if (isset($_REQUEST['delete'])) {
                    $gdwpmbuang_gal = wp_delete_post(trim($_REQUEST['delete']), true);
                    if ($gdwpmbuang_gal) {
                        echo '<div class="updated"><p>Gallery ID="' . $_REQUEST['delete'] . '" successfully deleted.</p></div>';
                    } else {
                        echo '<div class="error"><p>Gallery ID="' . $_REQUEST['delete'] . '" cannot deleted!</p></div>';
                    }
                }
                require_once 'google-drive-wp-media-galleries.php';
            }
        } else {
            wp_die('<div class="error"><p>Oops.. something goes wrong!</p></div>');
        }
    } elseif (isset($_POST['gdwpm_opsi_theme_css'])) {
        $nonce = $_REQUEST['gdwpm_theme_setting_nonce'];
        if (!wp_verify_nonce($nonce, 'gdwpm_theme_setting_nonce')) {
            die('<strong>Oops... failed!</strong>');
        } else {
            update_option('gdwpm_nama_theme_css', $_POST['gdwpm_opsi_theme_css']);
        }
    } elseif (isset($_REQUEST['gdwpm_nonce_aplod_berkas'])) {
        $nonce = $_REQUEST['gdwpm_nonce_aplod_berkas'];
        if (!wp_verify_nonce($nonce, 'gdwpm_satpam_aplod_berkas')) {
            die('<div class="error"><p>Oops.. security check is not ok!</p></div>');
        } else {
            if (empty($_FILES) || $_FILES["file"]["error"]) {
                wp_die('<div class="error"><p>Oops.. error, upload failed! ' . $_FILES["file"]["error"] . '</p></div>');
            }
            if (isset($_REQUEST["gdpwm_nama_file"])) {
                $filename = $_REQUEST["gdpwm_nama_file"];
            } elseif (!empty($_FILES)) {
                $filename = $_FILES["file"]["name"];
            } else {
                $filename = uniqid("file_");
            }
            //if(CHUNK_INTERNAL){
            $gdwpm_opsi_chunk = get_option('gdwpm_opsi_chunk');
            if ($gdwpm_opsi_chunk['local']['cekbok'] == 'checked') {
                $targetDir = ini_get("upload_tmp_dir");
                $maxFileAge = 5 * 3600;
                // Temp file age in seconds
                // Create target dir
                if (!file_exists($targetDir)) {
                    //@mkdir($targetDir);
                    if (!file_exists($targetDir = sys_get_temp_dir())) {
                        $upload_dir = wp_upload_dir();
                        if (!file_exists($targetDir = $upload_dir['basedir'] . DIRECTORY_SEPARATOR . 'gdwpm-tmp')) {
                            @mkdir($targetDir);
                        }
                    }
                }
                $filePath = $targetDir . DIRECTORY_SEPARATOR . $filename;
                // Chunking might be enabled
                $chunk = isset($_REQUEST["chunk"]) ? intval($_REQUEST["chunk"]) : 0;
                $chunks = isset($_REQUEST["chunks"]) ? intval($_REQUEST["chunks"]) : 0;
                if (!is_dir($targetDir) || !($dir = opendir($targetDir))) {
                    die('<div class="error"><p>Oops.. error. Failed to open temp directory.</p></div>');
                }
                while (($file = readdir($dir)) !== false) {
                    $tmpfilePath = $targetDir . DIRECTORY_SEPARATOR . $file;
                    // If temp file is current file proceed to the next
                    if ($tmpfilePath == "{$filePath}.part") {
                        continue;
                    }
                    // Remove temp file if it is older than the max age and is not the current file
                    if (preg_match('/\\.part$/', $file) && filemtime($tmpfilePath) < time() - $maxFileAge) {
                        @unlink($tmpfilePath);
                    }
                }
                closedir($dir);
                // Open temp file
                if (!($out = @fopen("{$filePath}.part", $chunks ? "ab" : "wb"))) {
                    die('<div class="error"><p>Oops.. error. Failed to open output stream.</p></div>');
                }
                if (!empty($_FILES)) {
                    if ($_FILES["file"]["error"] || !is_uploaded_file($_FILES["file"]["tmp_name"])) {
                        die('<div class="error"><p>Oops.. error. Failed to move uploaded file.</p></div>');
                    }
                    // Read binary input stream and append it to temp file
                    if (!($in = @fopen($_FILES["file"]["tmp_name"], "rb"))) {
                        die('<div class="error"><p>Oops.. error. Failed to open input stream.</p></div>');
                    }
                } else {
                    if (!($in = @fopen("php://input", "rb"))) {
                        die('<div class="error"><p>Oops.. error. Failed to open input stream.</p></div>');
                    }
                }
                while ($buff = fread($in, 4096)) {
                    fwrite($out, $buff);
                }
                @fclose($out);
                @fclose($in);
            } else {
                $chunks = true;
            }
            // Check if file has been uploaded
            if (!$chunks || $chunk == $chunks - 1) {
                // Strip the temp .part suffix off
                if ($filePath) {
                    rename("{$filePath}.part", $filePath);
                } else {
                    $filePath = $_FILES["file"]["tmp_name"];
                }
                if (!$gdwpm_service) {
                    $gdwpm_service = new GDWPMBantuan($gdwpm_opt_akun[1], $gdwpm_opt_akun[2], $gdwpm_opt_akun[3]);
                }
                $mime_berkas_arr = wp_check_filetype($filename);
                $mime_berkas = $mime_berkas_arr['type'];
                if (empty($mime_berkas)) {
                    $mime_berkas = $_FILES['file']['type'];
                }
                $folder_ortu = preg_replace("/[^a-zA-Z0-9]+/", " ", $_POST['gdpwm_nm_br']);
                $folder_ortu = trim(sanitize_text_field($folder_ortu));
                $folderId = $_POST['gdpwm_nm_id'];
                $nama_polder = $_POST['gdpwm_nm_bks'];
                if ($folder_ortu != '') {
                    //cek folder array id namafolder
                    $last_folder = get_option('gdwpm_new_folder_kecing');
                    if ($folder_ortu != $last_folder[1]) {
                        $folderId = $gdwpm_service->getFolderIdByName($folder_ortu);
                        if ($folderId) {
                            update_option('gdwpm_new_folder_kecing', array($folderId, $folder_ortu));
                        }
                        $nama_polder = $folder_ortu;
                    } else {
                        $folderId = $last_folder[0];
                        $nama_polder = $last_folder[1];
                    }
                }
                $content = $_POST['gdpwm_sh_ds'];
                if (!$folderId) {
                    $folderId = $gdwpm_service->createFolder($folder_ortu);
                    $gdwpm_service->setPermissions($folderId, $gdwpm_opt_akun[0]);
                    update_option('gdwpm_new_folder_kecing', array($folderId, $nama_polder));
                }
                if (strpos($mime_berkas_arr['type'], 'image') !== false) {
                    // cek gambar if img auto create thumb .. array('checked', '', '122', '122', 'false');
                    $gdwpm_img_thumbs = get_option('gdwpm_img_thumbs');
                    // ITUNG DIMENSI
                    $image = wp_get_image_editor($filePath);
                    if (!is_wp_error($image)) {
                        $ukuran_asli = $image->get_size();
                        // $ukuran_asli['width']; $ukuran_asli['height'];
                    }
                    $idthumb_w_h = '';
                    if ($gdwpm_img_thumbs[0] == 'checked') {
                        $folderId_thumb = $gdwpm_img_thumbs[1];
                        if (empty($folderId_thumb) || $folderId_thumb == '') {
                            //$folderId_thumb = $gdwpm_service->getFolderIdByName( 'gdwpm-thumbnails' );
                            //if(!$folderId_thumb){
                            $folderId_thumb = $gdwpm_service->createFolder('gdwpm-thumbnails');
                            $gdwpm_service->setPermissions($folderId_thumb, $gdwpm_opt_akun[0]);
                            //}
                            $gdwpm_img_thumbs[1] = trim($folderId_thumb);
                            update_option('gdwpm_img_thumbs', $gdwpm_img_thumbs);
                        }
                        if ($ukuran_asli) {
                            if ($gdwpm_img_thumbs[4] == 'true') {
                                $image->resize($gdwpm_img_thumbs[2], $gdwpm_img_thumbs[3], true);
                            } else {
                                $image->resize($gdwpm_img_thumbs[2], $gdwpm_img_thumbs[3], false);
                            }
                            $img = $image->save();
                            // path, file, mime-type
                            $filename_thumb = $img['file'];
                            $filePath_thumb = $img['path'];
                            $mime_berkas_thumb = $img['mime-type'];
                            $imgwidth_thumb = $img['width'];
                            $imgheight_thumb = $img['height'];
                        }
                        $fileParent_thumb = new Google_ParentReference();
                        $fileParent_thumb->setId($folderId_thumb);
                        $fileId_thumb = $gdwpm_service->createFileFromPath($filePath_thumb, $filename_thumb, $content, $fileParent_thumb);
                        $gdwpm_service->setPermissions($fileId_thumb, 'me', 'reader', 'anyone');
                        $idthumb_w_h = 'thumbId:' . $fileId_thumb . ' thumbWidth:' . $imgwidth_thumb . ' thumbHeight:' . $imgheight_thumb;
                    }
                    $gdwpm_sizez_meta = 'selfWidth:' . $ukuran_asli['width'] . ' selfHeight:' . $ukuran_asli['height'] . ' ' . $idthumb_w_h;
                    @unlink($filename_thumb);
                } else {
                    $gdwpm_sizez_meta = '';
                }
                $fileParent = new Google_ParentReference();
                $fileParent->setId($folderId);
                //$fileId = $gdwpm_service->createFileFromPath( $_FILES["file"]["tmp_name"], $filename, $content, $fileParent );
                $fileId = $gdwpm_service->createFileFromPath($filePath, $filename, $content, $fileParent);
                if ($fileId) {
                    $gdwpm_service->setPermissions($fileId, 'me', 'reader', 'anyone');
                    if (strpos($mime_berkas_arr['type'], 'image') !== false && !empty($gdwpm_sizez_meta)) {
                        $gdwpm_service->insertProperty($fileId, 'gdwpm-sizes', $gdwpm_sizez_meta);
                    }
                    $sukinfo = '';
                    $metainfo = '';
                    if (!empty($mime_berkas) && isset($_POST['gdpwm_med_ly']) == '1') {
                        /*			if(strpos($mime_berkas_arr['type'], 'video') !== false){
                        							$gdwpm_meta_arr = wp_read_video_metadata( $filePath );
                        							$metainfo = json_encode($gdwpm_meta_arr);
                        						}elseif(strpos($mime_berkas_arr['type'], 'audio') !== false){
                        							$gdwpm_meta_arr = wp_read_audio_metadata( $filePath );
                        							$metainfo = json_encode($gdwpm_meta_arr);
                        						}elseif(strpos($mime_berkas_arr['type'], 'image') !== false){
                        							$gdwpm_meta_arr = wp_read_image_metadata( $filePath );
                        							$metainfo = json_encode($gdwpm_meta_arr);
                        						}
                        			*/
                        gdwpm_ijin_masuk_perpus($mime_berkas, $filename, $fileId, $content, $nama_polder, $gdwpm_sizez_meta, $metainfo);
                        $sukinfo = ' and added into your Media Library';
                    }
                    echo '<div class="updated"><p>' . $filename . ' (<strong>' . $fileId . '</strong>) successfully uploaded to <strong>' . $nama_polder . '</strong>' . $sukinfo . '.</p></div>';
                } else {
                    echo '<div class="error"><p>Failed to upload <strong>' . $filename . '</strong> to Google Drive.</p></div>';
                }
                @unlink($filePath);
            }
            wp_die();
        }
    }
    wp_die();
}
Exemplo n.º 8
0
 public function insertFile($args)
 {
     $title = $args[0];
     $description = $args[1];
     $parentId = $args[2];
     //$mimeType = $args[3];
     $filename = $args[4];
     $this->checkDrive();
     $this->driveFile = new \Google_Service_Drive_DriveFile();
     $this->driveFile->setTitle($title);
     $this->driveFile->setDescription($description);
     // Set the parent folder.
     if ($parentId != null) {
         $parent = new \Google_ParentReference();
         $parent->setId($parentId);
         $this->driveFile->setParents(array($parent));
     }
     try {
         $data = file_get_contents($filename);
         $createdFile = $this->drive->files->insert($this->driveFile, array('data' => $data, 'uploadType' => 'multipart', 'mimeType' => 'application/vnd.ms-excel', 'pinned' => true, 'convert' => true));
         if ($createdFile['id'] != '') {
             return $createdFile['id'];
         } else {
             return false;
         }
     } catch (Exception $e) {
         print "An error occurred: " . $e->getMessage();
     }
 }
Exemplo n.º 9
0
        $this->_service->permissions->insert($fileId, $perm);
    }
    public function getFileIdByName($name)
    {
        $files = $this->_service->files->listFiles();
        foreach ($files['items'] as $item) {
            if ($item['title'] == $name) {
                return $item['id'];
            }
        }
        return false;
    }
}
if ($_SERVER['argc'] != 2) {
    echo "ERROR: no file selected\n";
    die;
}
$path = $_SERVER['argv'][1];
printf("Uploading %s to Google Drive\n", $path);
$service = new DriveServiceHelper(CLIENT_ID, SERVICE_ACCOUNT_NAME, KEY_PATH);
$folderId = $service->getFileIdByName(BACKUP_FOLDER);
if (!$folderId) {
    echo "Creating folder...\n";
    $folderId = $service->createFolder(BACKUP_FOLDER);
    $service->setPermissions($folderId, SHARE_WITH_GOOGLE_EMAIL);
}
$fileParent = new Google_ParentReference();
$fileParent->setId($folderId);
$fileId = $service->createFileFromPath($path, $path, $fileParent);
printf("File: %s created\n", $fileId);
$service->setPermissions($fileId, SHARE_WITH_GOOGLE_EMAIL);
Exemplo n.º 10
0
 public function file_upload($drive, $path)
 {
     try {
         // Check file existence
         if (file_exists($path)) {
             $path_parts = pathinfo($path);
             if (extension_loaded('fileinfo')) {
                 $finfo = finfo_open();
                 $fileinfo = finfo_file($finfo, $path, FILEINFO_MIME);
                 finfo_close($finfo);
             } else {
                 $fileinfo = 'application/x-rar-compressed';
             }
             $file = new Google_DriveFile();
             $file->setMimeType($fileinfo);
             $file->setTitle($path_parts['basename']);
             if ($location = Phpfox::getService('backuprestore.backuprestore')->getBTDBSettingByName('backup_setting')) {
                 $setting_value = unserialize($location['setting_value']);
                 if ($setting_value['sv_subfolder']) {
                     $root = $setting_value['sv_subfolder'];
                 }
             } else {
                 $root = '';
             }
             if ($fileid = $this->createFolder($drive, $root)) {
                 $parentId = $fileid;
             }
             //               // Set the parent folder.
             if ($parentId != null) {
                 $parent = new Google_ParentReference();
                 $parent->setId($parentId);
                 $file->setParents(array($parent));
             }
             //file_get_contents — Читает содержимое файла в строку
             $data = file_get_contents($path);
         }
         $createdFile = $drive->files->insert($file, array('data' => $data, 'mimeType' => $fileinfo));
         return $createdFile->id;
     } catch (Exception $e) {
     }
     throw $e;
 }
Exemplo n.º 11
0
 public function putFileChunk($name, $file)
 {
     $file = realpath($file);
     if (!file_exists($file)) {
         $this->_throwExeption($this->_helper->__('File "%s" doesn\'t exist', strval($file)));
     }
     $handle = fopen($file, "rb");
     $filename = basename($name);
     $chunkSize = $this->getChunkSize();
     $fileObject = new Google_DriveFile();
     $fileObject->setTitle($filename);
     if (!($mimeType = $this->getRequestMimeType())) {
         if (substr(".tar.gz", -7)) {
             $mimeType = self::MIME_TYPE_TGZ;
         } else {
             if (substr(".gz", -3)) {
                 $mimeType = self::MIME_TYPE_GZIP;
             } else {
                 $mimeType = self::MIME_TYPE_GOOGLE_FILES;
             }
         }
         $this->setRequestMimeType($mimeType);
     }
     if (!($parentId = $this->getRequestParentId())) {
         $parentId = $this->getBackupFolder();
         $this->setRequestParentId($parentId);
     }
     if ($parentId != null) {
         $parent = new Google_ParentReference();
         $parent->setId($parentId);
         $fileObject->setParents(array($parent));
     }
     $media = new Google_MediaFileUpload($mimeType, null, true, $chunkSize);
     if (!($fileSize = $this->getRequestFileSize())) {
         $fileSize = $this->filesize($file);
     }
     $media->setFileSize($fileSize);
     $byte = $startByte = (double) $this->getRequestBytes();
     if ($byte > 0) {
         $this->fseek($handle, $byte);
         $media->resumeUri = $this->getRequestUrl();
         $media->progress = $byte;
     }
     /**
      * @var Google_HttpRequest $httpRequest
      * @see Google_FilesServiceResource::insert
      */
     $httpRequest = $this->getService(false)->files->insert($fileObject, array('mimeType' => $mimeType, 'mediaUpload' => $media));
     while (!feof($handle)) {
         if ($this->timeIsUp()) {
             $this->setRequestBytes($byte);
             $this->setRequestUrl($media->resumeUri);
             $nextChunk = true;
             break;
         }
         $chunk = fread($handle, $chunkSize);
         $uploadStatus = $media->nextChunk($httpRequest, $chunk);
         $byte += $chunkSize;
     }
     fclose($handle);
     $locale = Mage::app()->getLocale()->getLocale();
     if (isset($nextChunk)) {
         $this->_addBackupProcessMessage($this->_helper->__('Bytes from %1$s to %2$s were added (total: %3$s)', Zend_Locale_Format::toNumber($startByte, array('precision' => 0, 'locale' => $locale)), Zend_Locale_Format::toNumber($byte, array('precision' => 0, 'locale' => $locale)), Zend_Locale_Format::toNumber($fileSize, array('precision' => 0, 'locale' => $locale))));
         return false;
     }
     $this->_addBackupProcessMessage($this->_helper->__('Bytes from %1$s to %2$s were added (total: %3$s)', Zend_Locale_Format::toNumber($startByte, array('precision' => 0, 'locale' => $locale)), Zend_Locale_Format::toNumber($fileSize, array('precision' => 0, 'locale' => $locale)), Zend_Locale_Format::toNumber($fileSize, array('precision' => 0, 'locale' => $locale))));
     if (!isset($uploadStatus) || !is_array($uploadStatus) || empty($uploadStatus['id'])) {
         $this->_throwExeption($this->_helper->__('Error chunk upload response'));
     }
     $fileCloudPath = $this->getConfigValue(self::APP_PATH);
     $returnPath = $fileCloudPath . '/' . $filename;
     $this->_addAdditionalInfo($uploadStatus['id'], $returnPath);
     $this->clearRequestParams();
     return $returnPath;
 }