public function loadUploaderConfiguration() { $uploaderConfig = GalleryConfig::model()->find(array('condition' => "type='uploader'"))->config; $this->uploaderConfig = unserialize($uploaderConfig); $galleryConfig = GalleryConfig::model()->find(array('condition' => "type='gallery'"))->config; $this->galleryConfig = unserialize($galleryConfig); }
public function actionIndex() { $galleryConfig = GalleryConfig::model()->find(); $criteria = new CDbCriteria(); $criteria->limit = $galleryConfig->limit; $dataProvider = new CActiveDataProvider('Gallery', array('criteria' => $criteria, 'sort' => array('defaultOrder' => 'sort_order'), 'pagination' => array('pageSize' => $galleryConfig->limit))); $this->render('index', array('dataProvider' => $dataProvider)); }
/** * Generate an image gallery from the Gallery template, if no images are * available, then return an empty string. * * @return String */ public function Gallery() { if ($this->Images()->exists()) { $vars = array('HideDescription' => $this->HideDescription, 'Images' => $this->Images()->sort('SortOrder'), 'Width' => GalleryConfig::config()->width, 'Height' => GalleryConfig::config()->height); return $this->renderWith('Gallery', $vars); } else { return ""; } }
public function actionIndex() { $model = GalleryConfig::model()->find(); if (isset($_POST['GalleryConfig'])) { $model->attributes = $_POST['GalleryConfig']; if ($model->save()) { Yii::app()->user->setFlash('success', "Изменения успешно сохранены!"); } } $this->render('index', array('model' => $model)); }
public function __construct() { $galleryConfig = unserialize(GalleryConfig::model()->find(array('condition' => "type='gallery'"))->config); $albumConfig = unserialize(GalleryConfig::model()->find(array('condition' => "type='album'"))->config); $collectionConfig = unserialize(GalleryConfig::model()->find(array('condition' => "type='collection'"))->config); $fancyBoxConfig = unserialize(GalleryConfig::model()->find(array('condition' => "type='fancybox'"))->config); $uploaderConfig = unserialize(GalleryConfig::model()->find(array('condition' => "type='uploader'"))->config); $configs = array_merge($galleryConfig, $albumConfig, $collectionConfig, $fancyBoxConfig, $uploaderConfig); foreach ($configs as $config => $value) { $this->{$config} = $value; } }
/** * {@inheritdoc} */ public function synchronize() { $this->pictures = array(); $config = GalleryConfig::load(); $Gallery = new Gallery(); $result = PersistenceContext::get_querier()->select("SELECT g.id, g.name, g.path, g.width, g.height, g.idcat, gc.auth\n\t\tFROM " . GallerySetup::$gallery_table . " g\n\t\tLEFT JOIN " . GallerySetup::$gallery_cats_table . " gc on gc.id = g.idcat\n\t\tWHERE g.aprob = 1\n\t\tORDER BY RAND()\n\t\tLIMIT 30"); while ($row = $result->fetch()) { $row['auth'] = $row['idcat'] == 0 ? $config->get_authorizations() : unserialize(stripslashes($row['auth'])); //Calcul des dimensions avec respect des proportions. list($row['width'], $row['height']) = $Gallery->get_resize_properties($row['width'], $row['height']); $this->pictures[$row['id']] = $row; } $result->dispose(); }
public function updateGalleryConfig() { $type = $_POST['scenario']; $model = new Cfg($type); $model->attributes = $_POST['Cfg']; if ($model->validate()) { $record = GalleryConfig::model()->find(array('condition' => "type='{$type}'")); $attributes = array("config" => serialize($_POST['Cfg'])); $record->saveAttributes($attributes); Yii::app()->user->setFlash('succes', Yii::t('app', 'Configuration succesfully saved!')); } else { Yii::app()->user->setFlash('error', Yii::t('app', 'There are errors. Configuration wasn\'t saved! Old configuration is reloaded!')); } }
public function updateGalleryConfig() { if (isset($_POST['Cfg']['predefinedTitle'])) { $_POST['Cfg']['predefinedTitle'] = operations::purifiedTtext($_POST['Cfg']['predefinedTitle']); } $type = $_POST['scenario']; $model = new Cfg($type); $model->attributes = $_POST['Cfg']; if ($model->validate()) { $record = GalleryConfig::model()->find(array('condition' => "type='{$type}'")); $attributes = array("config" => serialize($_POST['Cfg'])); $record->saveAttributes($attributes); Yii::app()->user->setFlash('succes', $this->tr('successUpdate')); } else { Yii::app()->user->setFlash('error', $this->tr('errorUpdate')); } }
public function run() { $galleryConfig = GalleryConfig::model()->find(); $displayMode = $galleryConfig->display_mode; switch ($displayMode) { case 0: $gallery = Gallery::getFirstGallery(); break; case 1: $gallery = Gallery::getRandomGallery(); break; case 2: $gallery = Gallery::getSelectedGallery($galleryConfig->selected_gallery_id); break; } $this->render('gallery', array('gallery' => $gallery)); return parent::run(); }
function get_feed_data_struct($idcat = 0, $name = '') { if (GalleryService::get_categories_manager()->get_categories_cache()->category_exists($idcat)) { $category = GalleryService::get_categories_manager()->get_categories_cache()->get_category($idcat); $config = GalleryConfig::load(); $site_name = GeneralConfig::load()->get_site_name(); $site_name = $idcat != Category::ROOT_CATEGORY ? $site_name . ' : ' . $category->get_name() : $site_name; $feed_module_name = LangLoader::get_message('module_title', 'common', 'gallery'); $data = new FeedData(); $data->set_title($feed_module_name . ' - ' . $site_name); $data->set_date(new Date()); $data->set_link(SyndicationUrlBuilder::rss('gallery', $idcat)); $data->set_host(HOST); $data->set_desc($feed_module_name . ' - ' . $site_name); $data->set_lang(LangLoader::get_message('xml_lang', 'main')); $data->set_auth_bit(Category::READ_AUTHORIZATIONS); $categories = GalleryService::get_categories_manager()->get_childrens($idcat, new SearchCategoryChildrensOptions(), true); $ids_categories = array_keys($categories); $results = PersistenceContext::get_querier()->select('SELECT * FROM ' . GallerySetup::$gallery_table . ' WHERE idcat IN :ids_categories ORDER BY timestamp DESC LIMIT :pics_number_per_page', array('ids_categories' => $ids_categories, 'pics_number_per_page' => $config->get_pics_number_per_page())); foreach ($results as $row) { $link = TextHelper::htmlentities(GalleryUrlBuilder::get_link_item($row['idcat'], $row['id'])); $item = new FeedItem(); $item->set_title($row['name']); $item->set_link($link); $item->set_guid($link); $item->set_date(new Date($row['timestamp'], Timezone::SERVER_TIMEZONE)); $item->set_image_url(Url::to_rel('/gallery/pics/' . $row['path'])); $item->set_auth(GalleryService::get_categories_manager()->get_heritated_authorizations($row['idcat'], Category::READ_AUTHORIZATIONS, Authorizations::AUTH_PARENT_PRIORITY)); $data->add_item($item); } $results->dispose(); return $data; } }
public function get_menu_content() { global $LANG; $tpl = new FileTemplate('gallery/gallery_mini.tpl'); //Chargement de la langue du module. load_module_lang('gallery'); $config = GalleryConfig::load(); $array_random_pics = GalleryMiniMenuCache::load()->get_pictures(); $i = 0; //Affichage des miniatures disponibles $array_pics_mini = 'var array_pics_mini = new Array();' . "\n"; list($nbr_pics, $sum_height, $sum_width, $scoll_mode, $height_max, $width_max) = array(0, 0, 0, 0, 142, 142); if (isset($array_random_pics) && $array_random_pics !== array()) { $gallery_mini = array(); shuffle($array_random_pics); //On mélange les éléments du tableau. //Vérification des autorisations. $break = 0; foreach ($array_random_pics as $array_pics_info) { if (GalleryAuthorizationsService::check_authorizations($array_pics_info['idcat'])->read()) { $gallery_mini[] = $array_pics_info; $break++; } if ($break == $config->get_pics_number_in_mini()) { break; } } //Aucune photo ne correspond, on fait une requête pour vérifier. if (count($gallery_mini) == 0) { $array_random_pics = array(); $result = PersistenceContext::get_querier()->select("SELECT g.id, g.name, g.path, g.width, g.height, g.idcat, gc.auth\n\t\t\t\tFROM " . GallerySetup::$gallery_table . " g\n\t\t\t\tLEFT JOIN " . GallerySetup::$gallery_cats_table . " gc on gc.id = g.idcat\n\t\t\t\tWHERE g.aprob = 1 AND gc.aprob = 1\n\t\t\t\tORDER BY RAND()\n\t\t\t\tLIMIT " . $config->get_pics_number_in_mini()); while ($row = $result->fetch()) { $array_random_pics[] = $row; } //Vérification des autorisations. $break = 0; foreach ($array_random_pics as $key => $array_pics_info) { if (GalleryAuthorizationsService::check_authorizations($array_pics_info['idcat'])->read()) { $gallery_mini[] = $array_pics_info; $break++; } if ($break == $config->get_pics_number_in_mini()) { break; } } } $tpl->put_all(array('C_FADE' => false, 'C_VERTICAL_SCROLL' => false, 'C_HORIZONTAL_SCROLL' => false, 'C_STATIC' => false)); switch ($config->get_scroll_type()) { case GalleryConfig::STATIC_SCROLL: $tpl->put('C_FADE', true); break; case GalleryConfig::VERTICAL_DYNAMIC_SCROLL: $tpl->put('C_VERTICAL_SCROLL', true); break; case GalleryConfig::HORIZONTAL_DYNAMIC_SCROLL: $tpl->put('C_HORIZONTAL_SCROLL', true); break; case GalleryConfig::NO_SCROLL: $tpl->put('C_STATIC', true); break; } $Gallery = new Gallery(); foreach ($gallery_mini as $key => $row) { //Si la miniature n'existe pas (cache vidé) on regénère la miniature à partir de l'image en taille réelle. if (!is_file(PATH_TO_ROOT . '/gallery/pics/thumbnails/' . $row['path'])) { $Gallery->Resize_pics(PATH_TO_ROOT . '/gallery/pics/' . $row['path']); } //Redimensionnement + création miniature // On recupère la hauteur et la largeur de l'image. if ($row['width'] == 0 || $row['height'] == 0) { list($row['width'], $row['height']) = @getimagesize(PATH_TO_ROOT . '/gallery/pics/thumbnails/' . $row['path']); } if ($row['width'] == 0 || $row['height'] == 0) { list($row['width'], $row['height']) = array(142, 142); } $tpl->assign_block_vars('pics_mini', array('ID' => $row['id'], 'PICS' => TPL_PATH_TO_ROOT . '/gallery/pics/thumbnails/' . $row['path'], 'NAME' => TextHelper::strprotect($row['name'], TextHelper::HTML_PROTECT, TextHelper::ADDSLASHES_FORCE), 'HEIGHT' => $row['height'], 'WIDTH' => $row['width'], 'U_PICS' => TPL_PATH_TO_ROOT . '/gallery/gallery' . url('.php?cat=' . $row['idcat'] . '&id=' . $row['id'], '-' . $row['idcat'] . '-' . $row['id'] . '.php'))); $sum_height += $row['height'] + 5; $sum_width += $row['width'] + 5; if ($config->get_scroll_type() == GalleryConfig::NO_SCROLL) { break; } $i++; } } $tpl->put_all(array('ARRAY_PICS' => $array_pics_mini, 'HEIGHT_DIV' => $config->get_mini_max_height(), 'SUM_HEIGHT' => $sum_height + 10, 'HIDDEN_HEIGHT' => $config->get_mini_max_height() + 10, 'WIDTH_DIV' => $config->get_mini_max_width(), 'SUM_WIDTH' => $sum_width + 30, 'HIDDEN_WIDTH' => $config->get_mini_max_width() * 3 + 30, 'SCROLL_DELAY' => $config->get_mini_pics_speed() * 1000, 'L_NO_RANDOM_PICS' => $i == 0 ? '<br /><span class="smaller"><em>' . $LANG['no_random_img'] . '</em></span><br />' : '', 'L_GALLERY' => $LANG['gallery'])); return $tpl->render(); }
public function GalleryThumbnail() { $width = GalleryConfig::config()->thumb_width; $height = GalleryConfig::config()->thumb_height; return $this->owner->croppedImage($width, $height); }
public function setStandardShop() { //operation reserved only for admins if (!$this->levelAccess === 2) { return; } $arrStandardShop = array('gallery' => array('isShopStyle' => true, 'cssTheme' => 'shop', 'thumbStyle' => 'square', 'imgWidth' => 700, 'thumbWidth' => 50, 'thWidth' => 200, 'hCollectionShop' => true, 'itemWidthCollectionShop' => 140, 'itemInfoShop' => 'ProductID' . "\n" . 'Availability' . "\n" . 'Name' . "\n" . 'Model' . "\n" . 'Price' . "\n" . 'Coin' . "\n" . 'VTA' . "\n" . 'Quantity' . "\n" . 'Url'), 'album' => array('showAlbumTitleDescription' => false, 'itemsOnPaginate' => 0, 'thTitleShow' => false, 'useInfoBox' => false), 'uploader' => array('max' => 6)); foreach ($arrStandardShop as $type => $attrs) { $config = unserialize(GalleryConfig::model()->find(array('condition' => "type='{$type}'"))->config); foreach ($attrs as $attr => $val) { $config[$attr] = $val; } $record = GalleryConfig::model()->find(array('condition' => "type='{$type}'")); $attributes = array("config" => serialize($config)); $record->saveAttributes($attributes); } return; }
public function get_root_category() { $root = new RichRootCategory(); $root->set_authorizations(GalleryConfig::load()->get_authorizations()); return $root; }
protected function beforeSave() { if (parent::beforeSave()) { // Читаем конфигурацию каталога $galleryConfig = GalleryConfig::model()->findByPk(1); // Загружаем фотографии $photos = new GalleryPhoto(); if ($photosUpload = CUploadedFile::getInstances($photos, 'image')) { foreach ($photosUpload as $file) { $photo = new GalleryPhoto(); $photoName = md5(time() . $file->name) . '.' . $file->getExtensionName(); $photo->file = $photoName; $file->saveAs($this->folder . '/' . $photoName); $this->uploaded_photos[] = $photo; Yii::app()->ih->load($this->folder . '/' . $photoName)->adaptiveThumb($galleryConfig->prev_x, $galleryConfig->prev_y)->save($this->folder . '/small/' . $photoName, false, 100)->reload()->adaptiveThumb(200, 135)->save($this->folder . '/medium/' . $photoName, false, 100); } } if ($this->isNewRecord) { $this->sort_order = $this->getMaxSortOrder() + 10; } if (!empty($this->uploaded_photos)) { foreach ($this->uploaded_photos as $photo) { $photo->gallery_id = $this->id; $photo->save(); } if ($this->photos and $coverPhoto = $this->getCover()) { $this->cover_photo_id = $coverPhoto->id; } } return true; } else { return false; } }
public function cfgModel($type) { $attributes = unserialize(GalleryConfig::model()->find(array('condition' => "type='{$type}'"))->config); $model = new Cfg($type); foreach ($model as $attr => $value) { if (array_key_exists($attr, $attributes)) { $model->{$attr} = $attributes[$attr]; } else { unset($model->{$attr}); } } return $model; }
} else { $config->disable_views_counter(); } if (retrieve(POST, 'author_displayed', '')) { $config->enable_author_display(); } else { $config->disable_author_display(); } $config->set_member_max_pics_number(retrieve(POST, 'member_max_pics_number', 0)); $config->set_moderator_max_pics_number(retrieve(POST, 'moderator_max_pics_number', 0)); $config->set_pics_enlargement_mode(retrieve(POST, 'pics_enlargement_mode', GalleryConfig::FULL_SCREEN)); $config->set_scroll_type(retrieve(POST, 'scroll_type', GalleryConfig::VERTICAL_DYNAMIC_SCROLL)); $config->set_pics_number_in_mini(retrieve(POST, 'pics_number_in_mini', 8)); $config->set_mini_pics_speed(retrieve(POST, 'mini_pics_speed', 6)); $config->set_authorizations(Authorizations::build_auth_array_from_form(Category::READ_AUTHORIZATIONS, Category::WRITE_AUTHORIZATIONS, Category::MODERATION_AUTHORIZATIONS)); GalleryConfig::save(); GalleryService::get_categories_manager()->regenerate_cache(); ###### Régénération du cache de la gallery ####### GalleryMiniMenuCache::invalidate(); AppContext::get_response()->redirect(HOST . REWRITED_SCRIPT); } elseif ($gallery_cache) { //Recréaction miniatures, et inscrustation du logo sur image. $Gallery = new Gallery(); $Gallery->Clear_cache(); GalleryMiniMenuCache::invalidate(); AppContext::get_response()->redirect('/gallery/admin_gallery_config.php'); } else { $tpl = new FileTemplate('gallery/admin_gallery_config.tpl'); //Vitesse de défilement des miniatures. $mini_pics_speed = ''; for ($i = 1; $i <= 10; $i++) {
* (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ###################################################*/ require_once '../kernel/begin.php'; require_once '../gallery/gallery_begin.php'; require_once '../kernel/header.php'; $config = GalleryConfig::load(); $g_idpics = retrieve(GET, 'id', 0); $g_del = retrieve(GET, 'del', 0); $g_move = retrieve(GET, 'move', 0); $g_add = retrieve(GET, 'add', false); $g_page = retrieve(GET, 'p', 1); $g_views = retrieve(GET, 'views', false); $g_notes = retrieve(GET, 'notes', false); $g_sort = retrieve(GET, 'sort', ''); $g_sort = !empty($g_sort) ? 'sort=' . $g_sort : ''; //Récupération du mode d'ordonnement. if (preg_match('`([a-z]+)_([a-z]+)`', $g_sort, $array_match)) { $g_type = $array_match[1]; $g_mode = $array_match[2]; } else { list($g_type, $g_mode) = array('date', 'desc');
private function publishForVisitor() { $baseUrl = Yii::app()->assetManager->publish($this->path->assets); $hideTooltips = (bool) $this->conf->hideTooltips; $jqcfg = CJavaScript::encode(unserialize(GalleryConfig::model()->find(array('condition' => "type='fancybox'"))->config)); if (is_dir($this->path->assets)) { Yii::app()->clientScript->registerCssFile($baseUrl . '/themes/' . $this->conf->cssTheme . '/standard.css'); Yii::app()->clientScript->registerCssFile($baseUrl . '/fancybox/jquery.fancybox-1.3.4.min.css'); Yii::app()->clientScript->registerCssFile($baseUrl . '/themes/' . $this->conf->cssTheme . '/custom.css'); //will place jquery and jquery-ui to end of page not in the head if ($this->conf->coreScriptPosEnd) { Yii::app()->clientScript->coreScriptPosition = CClientScript::POS_END; } Yii::app()->clientScript->registerCoreScript('jquery'); Yii::app()->clientScript->registerScriptFile($baseUrl . '/jquery.bttooltip.min.js', CClientScript::POS_END); if (!$this->isShop) { Yii::app()->clientScript->registerScriptFile($baseUrl . '/setThumbs.min.js', CClientScript::POS_END); Yii::app()->clientScript->registerScript('setThumbs', "setThumbsWidht('" . $this->conf->thumbWidth . "', '" . $this->conf->thumbStyle . "', '" . $this->conf->ratioThumb . "')", CClientScript::POS_READY); } else { Yii::app()->clientScript->registerScriptFile($baseUrl . '/setThumbsShop.min.js', CClientScript::POS_END); Yii::app()->clientScript->registerScript('setThumbs', "setThumbsWidht('" . $this->conf->thumbWidth . "', '" . $this->conf->thumbStyle . "', '" . $this->conf->ratioThumb . "', '" . (bool) $this->collection . "')", CClientScript::POS_READY); } Yii::app()->clientScript->registerScript('setGallery', "\$('.gImg').fancybox({$jqcfg}); \$('.ttp').bttooltip({design:'fbtooltip', hide :'{$hideTooltips}'});"); if ($this->conf->mouseEnabled) { Yii::app()->clientScript->registerScriptFile($baseUrl . '/fancybox/jquery.mousewheel-3.0.4.pack.min.js', CClientScript::POS_END); } if ($this->conf->easingEnabled) { Yii::app()->clientScript->registerScriptFile($baseUrl . '/fancybox/jquery.easing-1.3.pack.min.js', CClientScript::POS_END); } Yii::app()->clientScript->registerScriptFile($baseUrl . '/fancybox/jquery.fancybox-1.3.4.min.js', CClientScript::POS_END); } else { throw new Exception($this->tr('errFolder')); } }
private function build_view() { global $LANG, $Bread_crumb; load_module_lang('gallery'); $g_idpics = retrieve(GET, 'id', 0); $g_views = retrieve(GET, 'views', false); $g_notes = retrieve(GET, 'notes', false); $g_sort = retrieve(GET, 'sort', ''); $g_sort = !empty($g_sort) ? 'sort=' . $g_sort : ''; //Récupération du mode d'ordonnement. if (preg_match('`([a-z]+)_([a-z]+)`', $g_sort, $array_match)) { $g_type = $array_match[1]; $g_mode = $array_match[2]; } else { list($g_type, $g_mode) = array('date', 'desc'); } $comments_topic = new GalleryCommentsTopic(); $config = GalleryConfig::load(); $category = $this->get_category(); $categories = GalleryService::get_categories_manager()->get_categories_cache()->get_childrens($category->get_id()); $authorized_categories = GalleryService::get_authorized_categories($category->get_id()); $Gallery = new Gallery(); $nbr_pics = $this->db_querier->count(GallerySetup::$gallery_table, 'WHERE idcat=:idcat AND aprob = 1', array('idcat' => $category->get_id())); $total_cat = count($categories); //On crée une pagination si le nombre de catégories est trop important. $page = AppContext::get_request()->get_getint('p', 1); $pagination = new ModulePagination($page, $total_cat, $config->get_categories_number_per_page()); $pagination->set_url(new Url('/gallery/gallery.php?p=%d&cat=' . $category->get_id() . '&id=' . $g_idpics . '&' . $g_sort)); if ($pagination->current_page_is_empty() && $page > 1) { $error_controller = PHPBoostErrors::unexisting_page(); DispatchManager::redirect($error_controller); } //Colonnes des catégories. $nbr_column_cats = $total_cat > $config->get_columns_number() ? $config->get_columns_number() : $total_cat; $nbr_column_cats = !empty($nbr_column_cats) ? $nbr_column_cats : 1; $column_width_cats = floor(100 / $nbr_column_cats); //Colonnes des images. $nbr_column_pics = $nbr_pics > $config->get_columns_number() ? $config->get_columns_number() : $nbr_pics; $nbr_column_pics = !empty($nbr_column_pics) ? $nbr_column_pics : 1; $column_width_pics = floor(100 / $nbr_column_pics); $is_admin = AppContext::get_current_user()->check_level(User::ADMIN_LEVEL); $is_modo = GalleryAuthorizationsService::check_authorizations($category->get_id())->moderation(); $module_data_path = $this->tpl->get_pictures_data_path(); $rewrite_title = Url::encode_rewrite($category->get_name()); ##### Catégorie disponibles ##### $nbr_cat_displayed = 0; if ($total_cat > 0 && empty($g_idpics)) { $this->tpl->put('C_GALLERY_CATS', true); $j = 0; $result = $this->db_querier->select('SELECT @id_cat:= gallery_cats.id, gallery_cats.*, (SELECT COUNT(*) FROM ' . GallerySetup::$gallery_table . ' WHERE idcat IN ( @id_cat, (SELECT GROUP_CONCAT(id SEPARATOR \',\') FROM ' . GallerySetup::$gallery_cats_table . ' WHERE id_parent = @id_cat), (SELECT GROUP_CONCAT(childs.id SEPARATOR \',\') FROM ' . GallerySetup::$gallery_cats_table . ' parents INNER JOIN ' . GallerySetup::$gallery_cats_table . ' childs ON parents.id = childs.id_parent WHERE parents.id_parent = @id_cat) ) AND aprob = 1 ) AS nbr_pics FROM ' . GallerySetup::$gallery_cats_table . ' gallery_cats WHERE id_parent = :id_category AND id IN :authorized_categories ORDER BY id_parent, c_order LIMIT :number_items_per_page OFFSET :display_from', array('id_category' => $category->get_id(), 'authorized_categories' => $authorized_categories, 'number_items_per_page' => $pagination->get_number_items_per_page(), 'display_from' => $pagination->get_display_from())); while ($row = $result->fetch()) { $category_image = new Url($row['image']); $this->tpl->assign_block_vars('sub_categories_list', array('C_CATEGORY_IMAGE' => !empty($row['image']), 'CATEGORY_NAME' => $row['name'], 'CATEGORY_IMAGE' => $category_image->rel(), 'PICTURES_NUMBER' => sprintf($LANG['nbr_pics_info'], $row['nbr_pics']), 'U_CATEGORY' => GalleryUrlBuilder::get_link_cat($row['id'], $row['name']))); $nbr_cat_displayed++; } $result->dispose(); } $category_description = FormatingHelper::second_parse($category->get_description()); $this->tpl->put_all(array('C_ROOT_CATEGORY' => $category->get_id() == Category::ROOT_CATEGORY, 'C_CATEGORY_DESCRIPTION' => $category_description, 'C_SUB_CATEGORIES' => $nbr_cat_displayed > 0, 'C_SUBCATEGORIES_PAGINATION' => $pagination->has_several_pages(), 'SUBCATEGORIES_PAGINATION' => $pagination->display(), 'ARRAY_JS' => '', 'NBR_PICS' => 0, 'MAX_START' => 0, 'START_THUMB' => 0, 'END_THUMB' => 0, 'COLUMNS_NUMBER' => $nbr_column_pics, 'CATS_COLUMNS_WIDTH' => $column_width_cats, 'COLUMN_WIDTH_PICS' => $column_width_pics, 'CATEGORY_DESCRIPTION' => $category_description, 'U_EDIT_CATEGORY' => $category->get_id() == Category::ROOT_CATEGORY ? GalleryUrlBuilder::configuration()->rel() : GalleryUrlBuilder::edit_category($category->get_id())->rel(), 'CAT_ID' => $category->get_id(), 'DISPLAY_MODE' => $config->get_pics_enlargement_mode(), 'GALLERY' => $category->get_id() != Category::ROOT_CATEGORY ? $this->lang['module_title'] . ' - ' . $category->get_name() : $this->lang['module_title'], 'HEIGHT_MAX' => $config->get_mini_max_height(), 'WIDTH_MAX' => $column_width_pics, 'MODULE_DATA_PATH' => $module_data_path, 'L_APROB' => $LANG['aprob'], 'L_UNAPROB' => $LANG['unaprob'], 'L_FILE_FORBIDDEN_CHARS' => $LANG['file_forbidden_chars'], 'L_TOTAL_IMG' => $category->get_id() != Category::ROOT_CATEGORY ? sprintf($LANG['total_img_cat'], $nbr_pics) : '', 'L_ADD_IMG' => $LANG['add_pic'], 'L_GALLERY' => $this->lang['module_title'], 'L_CATEGORIES' => $category->get_id_parent() >= 0 ? $LANG['sub_album'] : $LANG['album'], 'L_NAME' => $LANG['name'], 'L_EDIT' => LangLoader::get_message('edit', 'common'), 'L_MOVETO' => $LANG['moveto'], 'L_DELETE' => LangLoader::get_message('delete', 'common'), 'L_SUBMIT' => $LANG['submit'], 'L_ALREADY_VOTED' => $LANG['already_vote'], 'L_ORDER_BY' => LangLoader::get_message('sort_by', 'common') . (isset($LANG[$g_type]) ? ' ' . strtolower($LANG[$g_type]) : ''), 'L_DIRECTION' => $LANG['direction'], 'L_DISPLAY' => LangLoader::get_message('display', 'common'), 'U_INDEX' => url('.php'), 'U_BEST_VIEWS' => PATH_TO_ROOT . '/gallery/gallery' . url('.php?views=1&cat=' . $category->get_id(), '-' . $category->get_id() . '.php?views=1'), 'U_BEST_NOTES' => PATH_TO_ROOT . '/gallery/gallery' . url('.php?notes=1&cat=' . $category->get_id(), '-' . $category->get_id() . '.php?notes=1'), 'U_ASC' => PATH_TO_ROOT . '/gallery/gallery' . url('.php?cat=' . $category->get_id() . '&sort=' . $g_type . '_' . 'asc', '-' . $category->get_id() . '.php?sort=' . $g_type . '_' . 'asc'), 'U_DESC' => PATH_TO_ROOT . '/gallery/gallery' . url('.php?cat=' . $category->get_id() . '&sort=' . $g_type . '_' . 'desc', '-' . $category->get_id() . '.php?sort=' . $g_type . '_' . 'desc'), 'U_ORDER_BY_NAME' => PATH_TO_ROOT . '/gallery/gallery' . url('.php?sort=name_desc&cat=' . $category->get_id(), '-' . $category->get_id() . '+' . $rewrite_title . '.php?sort=name_desc'), 'U_ORDER_BY_DATE' => PATH_TO_ROOT . '/gallery/gallery' . url('.php?sort=date_desc&cat=' . $category->get_id(), '-' . $category->get_id() . '+' . $rewrite_title . '.php?sort=date_desc'), 'U_ORDER_BY_VIEWS' => PATH_TO_ROOT . '/gallery/gallery' . url('.php?sort=views_desc&cat=' . $category->get_id(), '-' . $category->get_id() . '+' . $rewrite_title . '.php?sort=views_desc'), 'U_ORDER_BY_NOTES' => PATH_TO_ROOT . '/gallery/gallery' . url('.php?sort=notes_desc&cat=' . $category->get_id(), '-' . $category->get_id() . '+' . $rewrite_title . '.php?sort=notes_desc'), 'U_ORDER_BY_COM' => PATH_TO_ROOT . '/gallery/gallery' . url('.php?sort=com_desc&cat=' . $category->get_id(), '-' . $category->get_id() . '+' . $rewrite_title . '.php?sort=com_desc'), 'L_BEST_VIEWS' => $LANG['best_views'], 'L_BEST_NOTES' => $LANG['best_notes'], 'L_ASC' => $LANG['asc'], 'L_DESC' => $LANG['desc'], 'L_DATE' => LangLoader::get_message('date', 'date-common'), 'L_VIEWS' => $LANG['views'], 'L_NOTES' => LangLoader::get_message('notes', 'common'), 'L_COM' => $LANG['com_s'])); ##### Affichage des photos ##### if ($nbr_pics > 0) { switch ($g_type) { case 'name': $sort_type = 'g.name'; break; case 'date': $sort_type = 'g.timestamp'; break; case 'views': $sort_type = 'g.views'; break; case 'notes': $sort_type = 'notes.average_notes'; break; case 'com': $sort_type = 'com.number_comments'; break; default: $sort_type = 'g.timestamp'; } switch ($g_mode) { case 'desc': $sort_mode = 'DESC'; break; case 'asc': $sort_mode = 'ASC'; break; default: $sort_mode = 'DESC'; } $g_sql_sort = ' ORDER BY ' . $sort_type . ' ' . $sort_mode; if ($g_views) { $g_sql_sort = ' ORDER BY g.views DESC'; } elseif ($g_notes) { $g_sql_sort = ' ORDER BY notes.average_notes DESC'; } $this->tpl->put('C_GALLERY_PICS', true); //Affichage d'une photo demandée. if (!empty($g_idpics)) { $info_pics = $this->db_querier->select_single_row_query("SELECT g.*, m.display_name, m.groups, m.level, notes.average_notes, notes.number_notes, note.note\n\t\t\t\t\tFROM " . GallerySetup::$gallery_table . " g\n\t\t\t\t\tLEFT JOIN " . DB_TABLE_MEMBER . " m ON m.user_id = g.user_id\n\t\t\t\t\tLEFT JOIN " . DB_TABLE_COMMENTS_TOPIC . " com ON com.id_in_module = g.id AND com.module_id = 'gallery'\n\t\t\t\t\tLEFT JOIN " . DB_TABLE_AVERAGE_NOTES . " notes ON notes.id_in_module = g.id AND notes.module_name = 'gallery'\n\t\t\t\t\tLEFT JOIN " . DB_TABLE_NOTE . " note ON note.id_in_module = g.id AND note.module_name = 'gallery' AND note.user_id = :user_id\n\t\t\t\t\tWHERE g.idcat = :idcat AND g.id = :id AND g.aprob = 1\n\t\t\t\t\t" . $g_sql_sort, array('user_id' => AppContext::get_current_user()->get_id(), 'idcat' => $category->get_id(), 'id' => $g_idpics)); if (!empty($info_pics['id'])) { $Bread_crumb->add(stripslashes($info_pics['name']), PATH_TO_ROOT . '/gallery/gallery' . url('.php?cat=' . $info_pics['idcat'] . '&id=' . $info_pics['id'], '-' . $info_pics['idcat'] . '-' . $info_pics['id'] . '.php')); //Affichage miniatures. $id_previous = 0; $id_next = 0; $nbr_pics_display_before = floor(($nbr_column_pics - 1) / 2); //Nombres de photos de chaque côté de la miniature de la photo affichée. $nbr_pics_display_after = $nbr_column_pics - 1 - floor($nbr_pics_display_before); list($i, $reach_pics_pos, $pos_pics, $thumbnails_before, $thumbnails_after, $start_thumbnails, $end_thumbnails) = array(0, false, 0, 0, 0, $nbr_pics_display_before, $nbr_pics_display_after); $array_pics = array(); $array_js = 'var array_pics = new Array();'; $result = $this->db_querier->select("SELECT g.id, g.idcat, g.path\n\t\t\t\t\tFROM " . GallerySetup::$gallery_table . " g\n\t\t\t\t\tWHERE g.idcat = :idcat AND g.aprob = 1\n\t\t\t\t\t" . $g_sql_sort, array('idcat' => $category->get_id())); while ($row = $result->fetch()) { //Si la miniature n'existe pas (cache vidé) on regénère la miniature à partir de l'image en taille réelle. if (!file_exists(PATH_TO_ROOT . '/gallery/pics/thumbnails/' . $row['path'])) { $Gallery->Resize_pics(PATH_TO_ROOT . '/gallery/pics/' . $row['path']); } //Redimensionnement + création miniature //Affichage de la liste des miniatures sous l'image. $array_pics[] = '<td class="center" style="height:' . ($config->get_mini_max_height() + 16) . 'px"><span id="thumb' . $i . '"><a href="gallery' . url('.php?cat=' . $row['idcat'] . '&id=' . $row['id'] . '&sort=' . $g_sort, '-' . $row['idcat'] . '-' . $row['id'] . '.php?sort=' . $g_sort) . '#pics_max' . '"><img src="pics/thumbnails/' . $row['path'] . '" alt="' . $row['path'] . '" /></a></span></td>'; if ($row['id'] == $g_idpics) { $reach_pics_pos = true; $pos_pics = $i; } else { if (!$reach_pics_pos) { $thumbnails_before++; $id_previous = $row['id']; } else { $thumbnails_after++; if (empty($id_next)) { $id_next = $row['id']; } } } $array_js .= 'array_pics[' . $i . '] = new Array();' . "\n"; $array_js .= 'array_pics[' . $i . '][\'link\'] = \'' . GalleryUrlBuilder::get_link_item($row['idcat'], $row['id']) . '#pics_max' . "';\n"; $array_js .= 'array_pics[' . $i . '][\'path\'] = \'' . $row['path'] . "';\n"; $i++; } $result->dispose(); $activ_note = $config->is_notation_enabled() && AppContext::get_current_user()->check_level(User::MEMBER_LEVEL); if ($activ_note) { //Affichage notation. $notation = new Notation(); $notation->set_module_name('gallery'); $notation->set_id_in_module($info_pics['id']); $notation->set_notation_scale($config->get_notation_scale()); $notation->set_number_notes($info_pics['number_notes']); $notation->set_average_notes($info_pics['average_notes']); $notation->set_user_already_noted(!empty($info_pics['note'])); } if ($thumbnails_before < $nbr_pics_display_before) { $end_thumbnails += $nbr_pics_display_before - $thumbnails_before; } if ($thumbnails_after < $nbr_pics_display_after) { $start_thumbnails += $nbr_pics_display_after - $thumbnails_after; } $html_protected_name = $info_pics['name']; $comments_topic->set_id_in_module($info_pics['id']); $comments_topic->set_url(new Url('/gallery/gallery.php?cat=' . $category->get_id() . '&id=' . $g_idpics . '&com=0')); //Liste des catégories. $search_category_children_options = new SearchCategoryChildrensOptions(); $search_category_children_options->add_authorizations_bits(Category::READ_AUTHORIZATIONS); $search_category_children_options->add_authorizations_bits(Category::WRITE_AUTHORIZATIONS); $categories_tree = GalleryService::get_categories_manager()->get_select_categories_form_field($info_pics['id'] . 'cat', '', $info_pics['idcat'], $search_category_children_options); $method = new ReflectionMethod('AbstractFormFieldChoice', 'get_options'); $method->setAccessible(true); $categories_tree_options = $method->invoke($categories_tree); $cat_list = ''; foreach ($categories_tree_options as $option) { $cat_list .= $option->display()->render(); } $group_color = User::get_group_color($info_pics['groups'], $info_pics['level']); //Affichage de l'image et de ses informations. $this->tpl->put_all(array('C_GALLERY_PICS_MAX' => true, 'C_GALLERY_PICS_MODO' => $is_modo, 'C_AUTHOR_DISPLAYED' => $config->is_author_displayed(), 'C_VIEWS_COUNTER_ENABLED' => $config->is_views_counter_enabled(), 'C_TITLE_ENABLED' => $config->is_title_enabled(), 'C_COMMENTS_ENABLED' => $config->are_comments_enabled(), 'C_NOTATION_ENABLED' => $config->is_notation_enabled(), 'ID' => $info_pics['id'], 'NAME' => '<span id="fi_' . $info_pics['id'] . '">' . stripslashes($info_pics['name']) . '</span> <span id="fi' . $info_pics['id'] . '"></span>', 'POSTOR' => '<a class="small ' . UserService::get_level_class($info_pics['level']) . '"' . (!empty($group_color) ? ' style="color:' . $group_color . '"' : '') . ' href="' . UserUrlBuilder::profile($info_pics['user_id'])->rel() . '">' . $info_pics['display_name'] . '</a>', 'DATE' => Date::to_format($info_pics['timestamp'], Date::FORMAT_DAY_MONTH_YEAR), 'VIEWS' => $info_pics['views'] + 1, 'DIMENSION' => $info_pics['width'] . ' x ' . $info_pics['height'], 'SIZE' => NumberHelper::round($info_pics['weight'] / 1024, 1), 'L_COMMENTS' => CommentsService::get_number_and_lang_comments('gallery', $info_pics['id']), 'KERNEL_NOTATION' => $activ_note ? NotationService::display_active_image($notation) : '', 'COLSPAN' => $config->get_columns_number() + 2, 'CAT' => $cat_list, 'RENAME' => $html_protected_name, 'RENAME_CUT' => $html_protected_name, 'IMG_APROB' => $info_pics['aprob'] == 1 ? 'fa fa-eye-slash' : 'fa fa-eye', 'ARRAY_JS' => $array_js, 'NBR_PICS' => $i - 1, 'MAX_START' => $i - 1 - $nbr_column_pics, 'START_THUMB' => $pos_pics - $start_thumbnails > 0 ? $pos_pics - $start_thumbnails : 0, 'END_THUMB' => $pos_pics + $end_thumbnails, 'L_KB' => LangLoader::get_message('unit.kilobytes', 'common'), 'L_INFORMATIONS' => $LANG['informations'], 'L_NAME' => $LANG['name'], 'L_POSTOR' => $LANG['postor'], 'L_VIEWS' => $LANG['views'], 'L_ADD_ON' => $LANG['add_on'], 'L_DIMENSION' => $LANG['dimension'], 'L_SIZE' => $LANG['size'], 'L_NOTE' => LangLoader::get_message('note', 'common'), 'L_COM' => $LANG['com'], 'L_EDIT' => LangLoader::get_message('edit', 'common'), 'L_APROB_IMG' => $info_pics['aprob'] == 1 ? $LANG['unaprob'] : $LANG['aprob'], 'L_THUMBNAILS' => $LANG['thumbnails'], 'U_DEL' => url('gallery.php?del=' . $info_pics['id'] . '&token=' . AppContext::get_session()->get_token() . '&cat=' . $category->get_id()), 'U_MOVE' => url('gallery.php?id=' . $info_pics['id'] . '&token=' . AppContext::get_session()->get_token() . '&move=\' + this.options[this.selectedIndex].value'), 'U_PREVIOUS' => $pos_pics > 0 ? '<a href="' . GalleryUrlBuilder::get_link_item($category->get_id(), $id_previous) . '#pics_max"><i class="fa fa-arrow-left fa-2x"></i></a> <a href="' . GalleryUrlBuilder::get_link_item($category->get_id(), $id_previous) . '#pics_max">' . $LANG['previous'] . '</a>' : '', 'U_NEXT' => $pos_pics < $i - 1 ? '<a href="' . GalleryUrlBuilder::get_link_item($category->get_id(), $id_next) . '#pics_max">' . $LANG['next'] . '</a> <a href="' . GalleryUrlBuilder::get_link_item($category->get_id(), $id_next) . '#pics_max"><i class="fa fa-arrow-right fa-2x"></i></a>' : '', 'U_LEFT_THUMBNAILS' => $pos_pics - $start_thumbnails > 0 ? '<span id="display_left"><a href="javascript:display_thumbnails(\'left\')"><i class="fa fa-arrow-left fa-2x"></i></a></span>' : '<span id="display_left"></span>', 'U_RIGHT_THUMBNAILS' => $pos_pics - $start_thumbnails <= $i - 1 - $nbr_column_pics ? '<span id="display_right"><a href="javascript:display_thumbnails(\'right\')"><i class="fa fa-arrow-right fa-2x"></i></a></span>' : '<span id="display_right"></span>', 'U_COMMENTS' => GalleryUrlBuilder::get_link_item($info_pics['idcat'], $info_pics['id'], 0, $g_sort) . '#comments-list', 'U_IMG_MAX' => 'show_pics.php?id=' . $info_pics['id'] . '&cat=' . $info_pics['idcat'])); //Affichage de la liste des miniatures sous l'image. $i = 0; foreach ($array_pics as $pics) { if ($i >= $pos_pics - $start_thumbnails && $i <= $pos_pics + $end_thumbnails) { $this->tpl->assign_block_vars('list_preview_pics', array('PICS' => $pics)); } $i++; } //Commentaires if (AppContext::get_request()->get_getint('com', 0) == 0 && $config->are_comments_enabled()) { $this->tpl->put_all(array('COMMENTS' => CommentsService::display($comments_topic)->render())); } } } else { $sort = retrieve(GET, 'sort', ''); //On crée une pagination si le nombre de photos est trop important. $page = AppContext::get_request()->get_getint('pp', 1); $pagination = new ModulePagination($page, $nbr_pics, $config->get_pics_number_per_page()); $pagination->set_url(new Url('/gallery/gallery.php?pp=%d' . (!empty($sort) ? '&sort=' . $sort : '') . '&cat=' . $category->get_id())); if ($pagination->current_page_is_empty() && $page > 1) { $error_controller = PHPBoostErrors::unexisting_page(); DispatchManager::redirect($error_controller); } $this->tpl->put_all(array('C_GALLERY_MODO' => $is_modo, 'C_PICTURE_NAME_DISPLAYED' => $config->is_title_enabled(), 'C_AUTHOR_DISPLAYED' => $config->is_author_displayed(), 'C_VIEWS_COUNTER_ENABLED' => $config->is_views_counter_enabled(), 'C_COMMENTS_ENABLED' => $config->are_comments_enabled(), 'C_PAGINATION' => $pagination->has_several_pages(), 'PAGINATION' => $pagination->display(), 'L_EDIT' => LangLoader::get_message('edit', 'common'), 'L_VIEW' => $LANG['view'], 'L_VIEWS' => $LANG['views'])); $is_connected = AppContext::get_current_user()->check_level(User::MEMBER_LEVEL); $j = 0; $result = $this->db_querier->select("SELECT g.id, g.idcat, g.name, g.path, g.timestamp, g.aprob, g.width, g.height, g.user_id, g.views, g.aprob, m.display_name, m.groups, m.level, notes.average_notes, notes.number_notes, note.note\n\t\t\t\tFROM " . GallerySetup::$gallery_table . " g\n\t\t\t\tLEFT JOIN " . DB_TABLE_MEMBER . " m ON m.user_id = g.user_id\n\t\t\t\tLEFT JOIN " . DB_TABLE_COMMENTS_TOPIC . " com ON com.id_in_module = g.id AND com.module_id = 'gallery'\n\t\t\t\tLEFT JOIN " . DB_TABLE_AVERAGE_NOTES . " notes ON notes.id_in_module = g.id AND notes.module_name = 'gallery'\n\t\t\t\tLEFT JOIN " . DB_TABLE_NOTE . " note ON note.id_in_module = g.id AND note.module_name = 'gallery' AND note.user_id = :user_id\n\t\t\t\tWHERE g.idcat = :idcat AND g.aprob = 1\n\t\t\t\t" . $g_sql_sort . "\n\t\t\t\tLIMIT :number_items_per_page OFFSET :display_from", array('user_id' => AppContext::get_current_user()->get_id(), 'idcat' => $category->get_id(), 'number_items_per_page' => $pagination->get_number_items_per_page(), 'display_from' => $pagination->get_display_from())); while ($row = $result->fetch()) { //Si la miniature n'existe pas (cache vidé) on regénère la miniature à partir de l'image en taille réelle. if (!file_exists(PATH_TO_ROOT . '/gallery/pics/thumbnails/' . $row['path'])) { $Gallery->Resize_pics(PATH_TO_ROOT . '/gallery/pics/' . $row['path']); } //Redimensionnement + création miniature $onclick = ''; //Affichage de l'image en grand. if ($config->get_pics_enlargement_mode() == GalleryConfig::FULL_SCREEN) { $display_link = PATH_TO_ROOT . '/gallery/pics/' . $row['path'] . '" onmousedown="increment_view(' . $row['id'] . ');" title="' . str_replace('"', '', stripslashes($row['name'])); } elseif ($config->get_pics_enlargement_mode() == GalleryConfig::POPUP) { $onclick = 'increment_view(' . $row['id'] . ');display_pics_popup(\'' . PATH_TO_ROOT . '/gallery/show_pics' . url('.php?id=' . $row['id'] . '&cat=' . $row['idcat']) . '\', \'' . $row['width'] . '\', \'' . $row['height'] . '\');return false;'; $display_link = ''; } elseif ($config->get_pics_enlargement_mode() == GalleryConfig::RESIZE) { $onclick = 'increment_view(' . $row['id'] . ');display_pics(' . $row['id'] . ', \'' . PATH_TO_ROOT . '/gallery/show_pics' . url('.php?id=' . $row['id'] . '&cat=' . $row['idcat']) . '\');return false;'; $display_link = ''; } else { $onclick = true; $display_link = url('gallery.php?cat=' . $row['idcat'] . '&id=' . $row['id'], 'gallery-' . $row['idcat'] . '-' . $row['id'] . '.php') . '#pics_max'; } //Liste des catégories. $search_category_children_options = new SearchCategoryChildrensOptions(); $search_category_children_options->add_authorizations_bits(Category::READ_AUTHORIZATIONS); $search_category_children_options->add_authorizations_bits(Category::WRITE_AUTHORIZATIONS); $categories_tree = GalleryService::get_categories_manager()->get_select_categories_form_field($row['id'] . 'cat', '', $row['idcat'], $search_category_children_options); $method = new ReflectionMethod('AbstractFormFieldChoice', 'get_options'); $method->setAccessible(true); $categories_tree_options = $method->invoke($categories_tree); $cat_list = ''; foreach ($categories_tree_options as $option) { $cat_list .= $option->display()->render(); } $notation = new Notation(); $notation->set_module_name('gallery'); $notation->set_notation_scale($config->get_notation_scale()); $notation->set_id_in_module($row['id']); $notation->set_number_notes($row['number_notes']); $notation->set_average_notes($row['average_notes']); $notation->set_user_already_noted(!empty($row['note'])); $group_color = User::get_group_color($row['groups'], $row['level']); $comments_topic->set_id_in_module($row['id']); $html_protected_name = $row['name']; $this->tpl->assign_block_vars('pics_list', array('C_IMG_APROB' => $row['aprob'] == 1, 'C_OPEN_TR' => is_int($j++ / $nbr_column_pics), 'C_CLOSE_TR' => is_int($j / $nbr_column_pics), 'ID' => $row['id'], 'APROB' => $row['aprob'], 'PATH' => $row['path'], 'NAME' => stripslashes($row['name']), 'SHORT_NAME' => TextHelper::wordwrap_html(stripslashes($row['name']), 22, ' '), 'POSTOR' => $LANG['by'] . (!empty($row['display_name']) ? ' <a class="small ' . UserService::get_level_class($row['level']) . '"' . (!empty($group_color) ? ' style="color:' . $group_color . '"' : '') . ' href="' . UserUrlBuilder::profile($row['user_id'])->rel() . '">' . $row['display_name'] . '</a>' : ' ' . $LANG['guest']), 'VIEWS' => $row['views'], 'L_VIEWS' => $row['views'] > 1 ? $LANG['views'] : $LANG['view'], 'L_COMMENTS' => CommentsService::get_number_and_lang_comments('gallery', $row['id']), 'KERNEL_NOTATION' => $config->is_notation_enabled() && $is_connected ? NotationService::display_active_image($notation) : NotationService::display_static_image($notation), 'CAT' => $cat_list, 'ONCLICK' => $onclick, 'RENAME' => $html_protected_name, 'RENAME_CUT' => $html_protected_name, 'L_APROB_IMG' => $row['aprob'] == 1 ? $LANG['unaprob'] : $LANG['aprob'], 'U_PICTURE_LINK' => PATH_TO_ROOT . '/gallery/gallery' . url('.php?cat=' . $row['idcat'] . '&id=' . $row['id'], '-' . $row['idcat'] . '-' . $row['id'] . '.php'), 'U_PICTURE' => PATH_TO_ROOT . '/gallery/pics/thumbnails/' . $row['path'], 'U_DEL' => url('gallery.php?del=' . $row['id'] . '&token=' . AppContext::get_session()->get_token() . '&cat=' . $category->get_id()), 'U_MOVE' => url('gallery.php?id=' . $row['id'] . '&token=' . AppContext::get_session()->get_token() . '&move=\' + this.options[this.selectedIndex].value'), 'U_DISPLAY' => $display_link, 'U_COMMENTS' => PATH_TO_ROOT . '/gallery/gallery' . url('.php?cat=' . $row['idcat'] . '&id=' . $row['id'] . '&com=0', '-' . $row['idcat'] . '-' . $row['id'] . '.php?com=0') . '#comments-list')); } $result->dispose(); //Création des cellules du tableau si besoin est. while (!is_int($j / $nbr_column_pics)) { $this->tpl->assign_block_vars('end_table', array('TD_END' => '<td class="td-end" style="width:' . $column_width_pics . '%"> </td>', 'TR_END' => is_int(++$j / $nbr_column_pics) ? '</tr>' : '')); } } } }
private function _create_pics_error($path, $width, $height) { global $LANG; $config = GalleryConfig::load(); $width = $width == 0 ? $config->get_mini_max_width() : $width; $height = $height == 0 ? $config->get_mini_max_height() : $height; $font = PATH_TO_ROOT . '/kernel/data/fonts/impact.ttf'; $font_size = 12; $thumbnail = @imagecreate($width, $height); if ($thumbnail === false) { $this->error = 'e_unabled_create_pics'; } $background = @imagecolorallocate($thumbnail, 255, 255, 255); $text_color = @imagecolorallocate($thumbnail, 0, 0, 0); //Centrage du texte. $array_size_ttf = imagettfbbox($font_size, 0, $font, $LANG['e_error_img']); $text_width = abs($array_size_ttf[2] - $array_size_ttf[0]); $text_height = abs($array_size_ttf[7] - $array_size_ttf[1]); $text_x = $width / 2 - $text_width / 2; $text_y = $height / 2 + $text_height / 2; //Ecriture du code. imagettftext($thumbnail, $font_size, 0, $text_x, $text_y, $text_color, $font, $LANG['e_error_img']); @imagejpeg($thumbnail, $path, 75); }