Example #1
0
 function upload_dir($data)
 {
     //		$this->debug('WordpressReadOnly::upload_dir($data);');
     //		$this->debug('-> $data = ');
     //		$this->debug(print_r($data, true));
     if ($this->upload_basedir == '') {
         $this->upload_basedir = $this->tempdir . 'wpro' . time() . rand(0, 999999);
         while (is_dir($this->upload_basedir)) {
             $this->upload_basedir = $this->tempdir . 'wpro' . time() . rand(0, 999999);
         }
     }
     $data['basedir'] = $this->upload_basedir;
     switch (wpro_get_option('wpro-service')) {
         case 'ftp':
             $data['baseurl'] = 'http://' . trim(str_replace('//', '/', trim(wpro_get_option('wpro-ftp-webroot'), '/') . '/' . trim(wpro_get_option('wpro-folder'))), '/');
             break;
         default:
             if (wpro_get_option('wpro-aws-virthost')) {
                 $data['baseurl'] = 'http://' . trim(str_replace('//', '/', wpro_get_option('wpro-aws-bucket') . '/' . trim(wpro_get_option('wpro-folder'))), '/');
             } else {
                 $data['baseurl'] = 'http://' . trim(str_replace('//', '/', wpro_get_option('wpro-aws-bucket') . '.s3.amazonaws.com/' . trim(wpro_get_option('wpro-folder'))), '/');
             }
     }
     $data['path'] = $this->upload_basedir . $data['subdir'];
     $data['url'] = $data['baseurl'] . $data['subdir'];
     $this->removeTemporaryLocalData($data['path']);
     //		$this->debug('-> RETURNS = ');
     //		$this->debug(print_r($data, true));
     return $data;
 }
Example #2
0
 function upload_dir($data)
 {
     global $cud_file_ext;
     //		$this->debug('WordpressReadOnly::upload_dir($data);');
     //		$this->debug('-> $data = ');
     //		$this->debug(print_r($data, true));
     if ($this->upload_basedir == '') {
         $this->upload_basedir = $this->tempdir . 'wpro' . time() . rand(0, 999999);
         while (is_dir($this->upload_basedir)) {
             $this->upload_basedir = $this->tempdir . 'wpro' . time() . rand(0, 999999);
         }
     }
     $data['basedir'] = $this->upload_basedir;
     switch (wpro_get_option('wpro-service')) {
         case 'ftp':
             $data['baseurl'] = 'http://' . trim(str_replace('//', '/', trim(wpro_get_option('wpro-ftp-webroot'), '/') . '/' . trim(wpro_get_option('wpro-folder'))), '/');
             break;
         default:
             if (wpro_get_option('wpro-aws-cloudfront')) {
                 $data['baseurl'] = 'http://' . trim(str_replace('//', '/', wpro_get_option('wpro-aws-cloudfront') . '/' . trim(wpro_get_option('wpro-folder'))), '/');
             } elseif (wpro_get_option('wpro-aws-virthost')) {
                 $data['baseurl'] = 'http://' . trim(str_replace('//', '/', wpro_get_option('wpro-aws-bucket') . '/' . trim(wpro_get_option('wpro-folder'))), '/');
             } else {
                 $data['baseurl'] = 'http://' . trim(str_replace('//', '/', wpro_get_option('wpro-aws-bucket') . '.s3.amazonaws.com/' . trim(wpro_get_option('wpro-folder'))), '/');
             }
     }
     $time = current_time('mysql');
     $d = substr($time, 8, 2);
     $day = "/{$d}";
     $data['subdir'] = $data['subdir'] . $day;
     // $extension = substr(strrchr($_POST['name'],'.'),1);
     if ($cud_file_ext == 'mp3') {
         $customdir = '/media';
         $data['subdir'] = $customdir . $data['subdir'];
     }
     $data['path'] = $this->upload_basedir . $data['subdir'];
     $data['url'] = $data['baseurl'] . $data['subdir'];
     $this->removeTemporaryLocalData($data['path']);
     //		$this->debug('-> RETURNS = ');
     //		$this->debug(print_r($data, true));
     return $data;
 }