示例#1
0
 /**
  * Delete the file and all associated rows (done by foreign keys) and files
  * $params object should be a json like
  * <code>
  * {
  *  'id': 1
  * }
  * </code>
  *
  * @param $params
  * @return RokCommon_Ajax_Result
  */
 public function delete($params)
 {
     $result = new RokCommon_Ajax_Result();
     try {
         RokGallery_Doctrine::getConnection()->beginTransaction();
         $file = RokGallery_Model_FileTable::getSingle($params->id);
         if ($file === false) {
             throw new RokCommon_Ajax_Exception(rc__('ROKGALLERY_UNABLE_TO_FIND_FILE_N_TO_DELETE', $params->id));
         }
         $realdirpath = realpath($file->basepath);
         if ($realdirpath == false) {
             throw new RokCommon_Ajax_Exception(rc__('ROKGALLERY_UNABLE_TO_FIND_DIR_N_FOR_FILE_N_TO_REMOVE', $realdirpath, $file->title));
         }
         $delret = RokGallery_Helper::delete_folder($realdirpath);
         if ($delret === false) {
             throw new RokCommon_Ajax_Exception(rc__('ROKGALLERY_UNABLE_TO_DELETE_DIR_N_FOR_FILE_N_TO_REMOVE', $realdirpath, $file->title));
         }
         $file->delete();
         RokGallery_Doctrine::getConnection()->commit();
     } catch (Exception $e) {
         RokGallery_Doctrine::getConnection()->rollback();
         throw $e;
     }
     return $result;
 }
示例#2
0
 /**
  * Get the full list of jobs
  * <code>
  * {
  *  'ids': [1,2,3]
  * }
  * </code>
  * @param $params
  * @return RokCommon_Ajax_Result
  */
 public function delete($params)
 {
     $result = new RokCommon_Ajax_Result();
     try {
         $q = Doctrine_Query::create()->select('f.*')->from('RokGallery_Model_File f')->whereIn('f.id', $params->ids);
         $files = $q->execute(array(), Doctrine_Core::HYDRATE_RECORD);
         $q->free();
         try {
             RokGallery_Doctrine::getConnection()->beginTransaction();
             foreach ($files as &$file) {
                 $realdirpath = realpath($file->basepath);
                 if ($realdirpath == false) {
                     throw new RokCommon_Ajax_Exception(rc__('ROKGALLERY_UNABLE_TO_FIND_DIR_N_FOR_FILE_N_TO_REMOVE', $dirpath, $file->title));
                 }
                 $delret = RokGallery_Helper::delete_folder($realdirpath);
                 if ($delret === false) {
                     throw new RokCommon_Ajax_Exception(rc__('ROKGALLERY_UNABLE_TO_DELETE_DIR_N_FOR_FILE_N_TO_REMOVE', $dirpath, $file->title));
                 }
                 $file->delete();
             }
             RokGallery_Doctrine::getConnection()->commit();
         } catch (Exception $e) {
             RokGallery_Doctrine::getConnection()->rollback();
             throw $e;
         }
     } catch (Exception $e) {
         throw $e;
     }
     return $result;
 }
 public static function process()
 {
     // process the file delete queue
     $instance = self::getInstance();
     foreach ($instance->get() as $delete_folder) {
         if (file_exists($delete_folder)) {
             @RokGallery_Helper::delete_folder($delete_folder);
         }
     }
     $instance->clear();
 }
 /**
  * @param $filter
  */
 protected function filesize($filter)
 {
     $filter->query = RokGallery_Helper::getFilesizeAsInt($filter->query);
     switch ($filter->operator) {
         case 'is':
             $this->_query->andWhere('f.filesize = ?', (int) $filter->query);
             break;
         case 'greater_than':
             $this->_query->andWhere('f.filesize >= ?', (int) $filter->query);
             break;
         case 'lesser_than':
             $this->_query->andWhere('f.filesize <= ?', (int) $filter->query);
             break;
         default:
     }
 }
示例#5
0
 /**
  * Returns the relative path to the slice image
  *
  * @param string $seperator
  * @return string
  */
 public function getRelativePath($seperator = '/')
 {
     return RokGallery_Helper::getPathFromGUID($this->guid, $seperator) . $seperator . $this->filename;
 }
示例#6
0
 protected function &getPresentationImage(RokGallery_Model_Slice $slice, JRegistry $params)
 {
     $image = new stdClass();
     $image->id = $slice->id;
     $image->title = $params->get('detail_use_title_from', 'slice') == 'slice' ? $slice->title : $slice->File->title;
     $image->caption = $params->get('detail_use_caption_from', 'slice') == 'slice' ? $slice->caption : $slice->File->description;
     $image->created_at = date('j M Y', strtotime($slice->File->created_at));
     $image->updated_at = date('j M Y', strtotime($slice->updated_at));
     $image->views = $slice->File->Views->count;
     $image->loves = $slice->File->Loves->count;
     $image->thumburl = $slice->thumburl;
     $image->imageurl = $slice->imageurl;
     $image->xsize = $params->get('detail_use_dimensions_from', 'file') == 'slice' ? $slice->xsize : $slice->File->xsize;
     $image->ysize = $params->get('detail_use_dimensions_from', 'file') == 'slice' ? $slice->xsize : $slice->File->xsize;
     $image->filesize = RokGallery_Helper::decodeSize($params->get('detail_use_filesize_from', 'file') == 'slice' ? $slice->filesize : $slice->File->filesize);
     $image->fullimageurl = $slice->File->imageurl;
     $image->doilove = $slice->doilove;
     switch ($params->get('gallery_use_tags_from', 'slice')) {
         case 'slice':
             $tags =& $slice->Tags;
             break;
         case 'file':
             $tags =& $slice->File->Tags;
             break;
         case 'combined':
             $tags =& $slice->getCombinedTags();
             break;
     }
     $image->tags = array();
     foreach ($tags as $tag) {
         if (!($params->get('gallery_remove_gallery_tags', false) && in_array($tag['tag'], $slice->Gallery->filetags))) {
             $image->tags[] = $tag['tag'];
         }
     }
     return $image;
 }
示例#7
0
            <div class="gallery-description">
                <h1 class="image-title"><?php 
echo $file->title;
?>
</h1>
                <div class="image-pixels"><strong><?php 
echo $file->xsize;
?>
</strong>x<strong><?php 
echo $file->ysize;
?>
</strong> (<?php 
echo $file->xsize * $file->ysize;
?>
  pixels)  / <strong><?php 
echo RokGallery_Helper::decodeSize($file->filesize);
?>
</strong></div>
                <div class="image-description"><?php 
echo $file->description;
?>
</div>
                <div class="image-statusbar">
                    <div class="image-date"><?php 
echo date('j M Y (H:i)', strtotime($file->created_at));
?>
</div>
                    <div class="image-close dark button"><span><?php 
rc_e('ROKGALLERY_CLOSE');
?>
</span></div>
$passed_params->showcase_autoplay_delay = $params->get('showcase_autoplay_delay', 7) * 1000;
$passed_params->showcase_captionsanimation = $params->get('showcase_captionsanimation', 'crossfade');
$passed_params->moduleid = $module->id;
$passed_params->layout_context = 'mod_rokgallery.' . $passed_params->layout;
$passed_params->style_context = $passed_params->layout_context . '.' . $passed_params->style;
$request_var_root = 'mod_rokgallery.' . $passed_params->layout;
$request_var_css = $request_var_root . '.css';
$request_var_js = $request_var_root . '.js';
if (!RokCommon_Request::get($request_var_css, false)) {
    $doc =& JFactory::getDocument();
    if (file_exists(RokCommon_Composite::get($passed_params->layout_context)->get($passed_params->layout . '.css'))) {
        $doc->addStyleSheet(RokCommon_Composite::get($passed_params->layout_context)->getURL($passed_params->layout . '.css'));
    }
    if (file_exists(RokCommon_Composite::get($passed_params->style_context)->get('style.css'))) {
        $doc->addStyleSheet(RokCommon_Composite::get($passed_params->style_context)->getURL('style.css'));
    }
    RokCommon_Request::set($request_var_css, true);
}
if (!RokCommon_Request::get($request_var_js, false)) {
    $doc =& JFactory::getDocument();
    if (file_exists(RokCommon_Composite::get($passed_params->layout_context)->get($passed_params->layout . RokGallery_Helper::getJSVersion() . '.js'))) {
        $doc->addScript(RokCommon_Composite::get($passed_params->layout_context)->getURL($passed_params->layout . RokGallery_Helper::getJSVersion() . '.js'));
    }
    RokCommon_Request::set($request_var_js, true);
}
if (file_exists(RokCommon_Composite::get($passed_params->layout_context)->get('javascript.php'))) {
    $doc->addScriptDeclaration(RokCommon_Composite::get($passed_params->layout_context)->load('javascript.php', array('passed_params' => $passed_params)));
}
$rokgallerymodule = new RokGalleryModule();
$passed_params->slices = $rokgallerymodule->getSlices($params);
require JModuleHelper::getLayoutPath('mod_rokgallery');
示例#9
0
 /**
  * @param RokGallery_Model_File $record
  * @return string
  */
 protected function _getBasePath(RokGallery_Model_File $record)
 {
     $root = RokGallery_Config::getOption(RokGallery_Config::OPTION_ROOT_PATH);
     $path = $root . RokGallery_Helper::getPathFromGUID($record->guid, DS);
     return $path;
 }
示例#10
0
<?php

/**
 * @version   $Id$
 * @author    RocketTheme http://www.rockettheme.com
 * @copyright Copyright (C) 2007 - 2011 RocketTheme, LLC
 * @license   http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 only
 */
if (RokCommon_Browser::getShortName() == 'ie7') {
    RokCommon_Header::addStyle(RokCommon_Composite::get($that->context)->getUrl('rokgallery-ie7.css'));
}
RokCommon_Header::addScript(RokCommon_Composite::get($that->context)->getUrl('loves' . RokGallery_Helper::getJSVersion() . '.js'));