示例#1
0
文件: class.vf.php 项目: hshoghi/cms
 public static function getFolder($folders_id = NULL, $params = NULL, $extra_params = NULL)
 {
     // check to see if this has been cached as an empty folder
     $mem_key = vf::getEmptyFolderKey($folders_id);
     $folder = mem($mem_key);
     if ($folder && !$_GET['refresh_empty_folders']) {
         return $folder;
     }
     // it's not a known empty folder (or we are refreshing)
     // get the folder
     $folder = (object) self::$client->get_folder($folders_id, $params, $extra_params);
     // if the folder is empty/error, cache the empty folder
     if ($folder->error) {
         mem($mem_key, $folder, '6 hours');
     }
     return $folder;
 }
示例#2
0
文件: slideshow.php 项目: hshoghi/cms
				<a href="#enlarge" class="vf-slideshow-enlarge"></a>
				<?php 
    }
    ?>
				<a href="#next" class="vf-slideshow-next"></a>
				<a href="#playpause" class="vf-slideshow-pause"></a>
				<a href="#prev" class="vf-slideshow-prev"></a>
			</div>
			<?php 
}
?>
		</div>
	</div>
	<div class="vf-slideshow-thumbs has-floats"><?php 
// elapsed('before getting thumbnails in batch');
$fetched = vf::getItem($items_arr, array('width' => $gallery->thumb_width, 'height' => $gallery->thumb_height, 'crop' => $gallery->crop));
// krumo(vf::$client);
// elapsed('after getting thunbnails in batch');
// krumo($fetched);
$fetched = $single_to_multiple($fetched);
foreach ($fetched->items as $k => $i) {
    if (!$i->html) {
        continue;
    }
    if ($k == 0) {
        $class = 'first selected';
    } else {
        if ($k == $gallery->folder->items_count - 1) {
            $class = 'last';
        } else {
            $class = null;
示例#3
0
文件: enlarge.php 项目: hshoghi/cms
<?php

$item = vf::getItem($this->ide, array('width' => 800));
?>
<div class="vf-enlarge-skybox-container">
    <div>
        <a href="javascript:history.back()">Click Here To Close</a>
    </div>
    <div>
        <a href="javascript:history.back()" class="vf-enlarge-skybox">
            <?php 
echo $item->http_html;
?>
        </a>
    </div>
</div>
示例#4
0
文件: remove.php 项目: hshoghi/cms
<?php

// delete media items_id
$items_id = $_POST['items_id'];
if (!$items_id) {
    exit_json(array('status' => 'Error', 'errors' => array('Invalid ID')));
}
$re = vf::removeItem($items_id);
exit_json(array('status' => 'OK', 'data' => $re));
exit_json($re);
示例#5
0
            $event->venue->address1 = $event->address1;
            $event->venue->address2 = $event->address2;
            $event->venue->city = $event->city;
            $event->venue->zip = $event->zip;
            $event->venue->state = $event->state;
            $event->url = parseEventUrl($event);
            $ct_event->ct_event_id = $event->ct_event_id;
            /**
             * Fetch media for the event .
             */
            $mediaIds = $ct_event->getMediaIDs(1);
            $index = count($mediaIds) > 1 ? 1 : 0;
            //$mediaIds[$index]
            $event->img_small = \vf::getItem($ct_event->getFlyer(), $media_config_small);
            if (!$event->img_small && count($mediaIds)) {
                $event->img_small = \vf::getItem($mediaIds[0], $media_config_small);
            }
        });
        \mem($cache_name, $events, $event_cache_duration);
    }
    $default_markets[$i]['events'] = $events;
}
\Website::top();
?>
			<section class="banner slider">

			<?php 
include "templates/website/media-box/mediabox.php";
?>
			
	</section>
示例#6
0
文件: gallery.php 项目: hshoghi/cms
<?php 
    } else {
        # getItem will strip the data we have already if the item is not an image,
        # we need to preserve non-image items' data
        $_items = $items;
        $items = vf::getItem(vf_gallery_inc::itemsToFlatArray($items), array('width' => $gallery->width, 'height' => $gallery->height, 'crop' => $gallery->crop));
        global $sky_content_type;
        foreach ($_items as $index => $_i) {
            if ($i['media_type'] != 'image') {
                continue;
            }
            # if we have items that are not images,
            # we need to restore the data to our items array
            # and generate an appropriate html representation (vfolder server file icons)
            $type = $_i['media_type'] . '/' . $i_['media_subtype'];
            $_item_src = sprintf('%s://%s/images/file-icons/%s.jpg', vf::$client->secure ? 'https' : 'http', vf::getFilesDomain(), array_search($type, $sky_content_type) ?: 'file');
            $_item_html = sprintf('<img width="%s" heigh="%s" src="%s" />', $gallery->width, $gallery->height, $_item_src);
            $items->items[$index] = (object) array('_id' => $_i['_id'], 'items_id' => $_i['_id'], 'src' => $_item_src, 'html' => $_item_html);
        }
        // makes sure $items is consistent
        $items = call_user_func(function () use($items) {
            if ($items->items) {
                return $items->items;
            }
            return array($items);
        });
        foreach ($items as $i) {
            ?>
				<div class="vf-gallery-item" ide="<?php 
            echo $i->items_id;
            ?>
示例#7
0
文件: gallery.php 项目: hshoghi/cms
<?php

//  gallery
$_GET['curl_timeout'] = 20;
if (!$_POST['_token']) {
    return;
}
$token = $_POST['_token'];
$pars = $_SESSION['VF']['gallery'][$token];
if (!$pars) {
    throw new \Exception('Invalid token to generate gallery.');
}
$pars = (array) $pars;
$pars['folder'] = $pars['folder']->path;
echo vf::gallery($pars)->html;
示例#8
0
    /**
     *	sets object params by the args array
     *	@param	array	$args
     *	@global $disable_vf
     */
    public function __construct(array $args = array())
    {
        global $disable_vf;
        if ($disable_vf) {
            ?>
			<strong style="color:red;">
				The Uploader Is Temporarily Disabled Due to Technical Difficulties.
			</strong>
<?php 
            return;
        }
        $this->setByArray(self::$defaults)->setByArray($args);
        if ($this->gallery && !$this->folder) {
            $this->folder = $this->gallery->folder;
        }
        $this->setMemToken();
        if (!$this->folder) {
            throw new Exception('class: vf_uploader requires a folder paramter');
        } else {
            if (!is_object($this->folder)) {
                $this->folder = vf::getFolder($this->folder);
            }
        }
        if (!$this->folder->folders_path) {
            throw new Exception('Could not get folder object from server.');
        }
        $this->makeButton();
    }
示例#9
0
文件: enlarge.php 项目: hshoghi/cms
<?php

$items_id = decrypt(IDE);
$item = vf::getItem($items_id, array('width' => 800));
?>
<div class="vf-enlarge-skybox-container">
	<div>
		<a href="javascript:history.back()">Click Here To Close</a>
	</div>
	<div>
		<a href="javascript:history.back()" class="vf-enlarge-skybox">
			<?php 
echo $item->html;
?>
		</a>
	</div>
</div>
示例#10
0
 public function initFolder($refresh = false)
 {
     $path = is_object($this->folder) ? $this->folder->folders_path : $this->folder;
     $e = $refresh || is_ajax_request() ? array('refresh_memcached' => true) : null;
     return $this->folder = vf::getFolder($path, array('limit' => $this->limit), $e);
 }
示例#11
0
文件: view.php 项目: hshoghi/cms
<?php

// view item
$i = vf::getItem($this->ide);
$this->redirect($i->errors ? '/404' : $i->http_url);
示例#12
0
	*/

	$cache_key = 'newyears.com::cache::event::medias::'.$event->ide ;

	//$medias = mem($cache_key);
	
	if (!$medias){ 
		$medias = $event->getVenuePhotos(['limit'=>10, 'width'=>600, 'height'=>400]);  


		if ($medias && count($medias)){
			foreach($medias as $key=>$media){

				if( is_object($media) ) {
					
					$media->thumb = \vf::getItem($media->id, $thumb_config);


				}
			}

			mem($cache_key, $medias, '20 minutes');
		} 



	}

	$event->medias = $medias; 

示例#13
0
文件: standard.php 项目: hshoghi/cms
    echo $this->data[0]['subtitle'];
    ?>
</a>
            </div>
        </div>
    </div>
    <div class="thumbnails">
<?php 
    foreach ($this->data as $key => $img) {
        // make image heights fill the full height of the mediabox (so no empty spaces)
        $temp_height = ceil($sidebar_height / ($this->num_thumbs - $key));
        $sidebar_height = $sidebar_height - $temp_height;
        $small_conf = array('height' => $temp_height, 'width' => $this->thumb_width - 4, 'crop' => 'center');
        // empty thumbnails need to be there, or images dont cycle properly
        // set to to lookalike object if no thumb width, or things will stop working
        $small_img = !$this->thumb_width || $this->thumb_width <= 4 ? (object) array('src' => '') : vf::getItem($img['media_item_id'], $small_conf);
        ?>
		
		<div>
            <img src="<?php 
        echo $small_img->src;
        ?>
" class="thumb thumb_<?php 
        echo $key;
        ?>
" num="<?php 
        echo $key;
        ?>
" />
        </div>
<?php 
示例#14
0
文件: view.php 项目: hshoghi/cms
<?php

// view item
$i = vf::getItem(IDE);
if ($i->errors) {
    redirect('/404', 302);
}
redirect($i->src, 302);
示例#15
0
 /**
  * Does the upload if there are no errors, and uploads the db_field if necessary
  * @return array   response array
  */
 public function doUpload()
 {
     if ($this->errors) {
         return $this->respond();
     }
     $upload_opts = array('folders_path' => $this->folders_path);
     $re = vf::$client->upload_to_server($this->uploaded_file, $upload_opts);
     unlink($this->uploaded_file);
     // delete file from tmpdir
     if (!$re['success']) {
         $this->errors[] = 'There was an error uploading the file:';
         $this->errors[] = $re['last_error'];
         return $this->respond($re);
     }
     // clear empty folder cache
     $key = vf::getEmptyFolderKey($this->folders_path);
     mem($key, null);
     if ($this->params['db_field'] && $this->params['db_row_id']) {
         $this->updateDBRecord($re['items_id']);
     }
     return $this->respond($re);
 }