コード例 #1
0
ファイル: Importer.php プロジェクト: dioscouri/f3-redirect
 /**
  * Target for the upload handler
  */
 public function handleUpload()
 {
     try {
         $files = $this->app->get("FILES");
         $model = \Dsc\Mongo\Collections\Assets::createFromUpload($files['import_file'], array('type' => 'redirect.importer'));
         $this->app->reroute("/admin/redirect/import/preview/" . $model->id);
     } catch (\Exception $e) {
         \Dsc\System::addMessage($e->getMessage(), 'error');
         $this->app->reroute("/admin/redirect/import");
     }
 }
コード例 #2
0
ファイル: Assets.php プロジェクト: dioscouri/f3-assets
 protected function beforeSave()
 {
     if (empty($this->type)) {
         $this->type = $this->__type;
     }
     if (empty($this->md5)) {
         if (!empty($this->{'s3.ETag'})) {
             $this->md5 = str_replace('"', '', $this->{'s3.ETag'});
         } elseif (!empty($this->filename) && file_exists($this->filename)) {
             $this->md5 = md5_file($this->filename);
         } else {
             $this->md5 = md5($this->slug);
         }
     }
     return parent::beforeSave();
 }
コード例 #3
0
ファイル: Asset.php プロジェクト: dioscouri/f3-assets
 /**
  * Displays the thumb
  */
 public function thumb()
 {
     $flash = \Dsc\Flash::instance();
     $this->app->set('flash', $flash);
     $slug = $this->inputfilter->clean($this->app->get('PARAMS.slug'), 'PATH');
     $item = $this->getItem();
     if ($item == null) {
         $this->app->reroute(\Assets\Models\Settings::fetch()->get('images.default_thumb'));
         exit(0);
     }
     switch ($item->storage) {
         case "s3":
         case "cloudfiles":
         case "cdn":
             $this->app->reroute($item->thumb);
             break;
         case "gridfs":
         default:
             try {
                 $thumb = \Dsc\Mongo\Collections\Assets::cachedThumb($slug);
                 if (empty($thumb['bin'])) {
                     throw new \Exception();
                 }
             } catch (\Exception $e) {
                 return $this->app->error(404, 'Invalid Thumb');
             }
             $height = $this->app->get('PARAMS.height');
             $width = $this->app->get('PARAMS.width');
             if ($height && $width) {
                 $this->app->set('height', $height);
                 $this->app->set('width', $width);
             }
             $flash->store($thumb);
             echo $this->theme->renderView('Assets/Site/Views::assets/thumb.php');
             break;
     }
 }
コード例 #4
0
ファイル: list.php プロジェクト: dioscouri/f3-assets
<h3>Select from an Existing Asset</h3>
<form id="assets" class="searchForm" action="./admin/assets/element/<?php 
echo $PARAMS['id'];
?>
" method="post">

    <div class="row">
        <div class="col-xs-12 col-sm-5 col-md-5 col-lg-8">
        
            <ul class="list-filters list-unstyled list-inline">
                <li>
                    <select name="filter[type]" class="form-control" onchange="this.form.submit();">
                        <option value="">All Types</option>
                        <?php 
foreach (\Dsc\Mongo\Collections\Assets::distinctTypes() as $type) {
    ?>
                        	<option value="<?php 
    echo $type;
    ?>
" <?php 
    if ($state->get('filter.type') == $type) {
        echo "selected='selected'";
    }
    ?>
><?php 
    echo $type;
    ?>
</option>
                        <?php 
}
コード例 #5
0
ファイル: image.php プロジェクト: dioscouri/f3-assets
                            <div class="form-group">
                                <label>Tags: Enter multiple tags, separated by a comma</label>
                                <input name="tags" data-tags='<?php 
echo json_encode(\Dsc\Mongo\Collections\Assets::distinctTags());
?>
' value="<?php 
echo implode(",", (array) $flash->old('tags'));
?>
" type="text" name="tags" class="form-control ui-select2-tags" />
                            </div>
                            <!-- /.form-group -->
                            
                            <div class="form-group">
                                <label>Type</label>
                                <input name="type" class="form-control ui-select2" data-tags='<?php 
echo json_encode(\Dsc\Mongo\Collections\Assets::distinctTypes());
?>
' data-maximum="1" value="<?php 
echo $flash->old('type');
?>
" />
                            </div>
                            <!-- /.form-group -->
                            
                        </div>
                        <!-- /.col-md-10 -->
                    </div>
                    <!-- /.row -->
                    
                    <hr/>
                    
コード例 #6
0
ファイル: list.php プロジェクト: dioscouri/f3-assets
    ?>
><?php 
    echo $type;
    ?>
</option>
                            <?php 
}
?>
                            
                        </select>
                    </li>
                    <li>
                        <select name="filter[storage]" class="form-control" onchange="this.form.submit();">
                            <option value="">All Stores</option>
                            <?php 
foreach (\Dsc\Mongo\Collections\Assets::distinctStores() as $store) {
    ?>
                            	<option value="<?php 
    echo $store;
    ?>
" <?php 
    if ($state->get('filter.storage') == $store) {
        echo "selected='selected'";
    }
    ?>
><?php 
    echo $store;
    ?>
</option>
                            <?php 
}