function download($item, $backLink, $extLink = 0) { $app = JFactory::getApplication(); if (empty($item)) { $msg = JText::_('COM_PHOCAGALLERY_ERROR_DOWNLOADING_FILE'); $app->redirect($backLink, $msg); return false; } else { if ($extLink == 0) { phocagalleryimport('phocagallery.file.file'); $fileOriginal = PhocaGalleryFile::getFileOriginal($item->filenameno); if (!JFile::exists($fileOriginal)) { $msg = JText::_('COM_PHOCAGALLERY_ERROR_DOWNLOADING_FILE'); $app->redirect($backLink, $msg); return false; } $fileToDownload = $item->filenameno; $fileNameToDownload = $item->filename; } else { $fileToDownload = $item->exto; $fileNameToDownload = $item->title; $fileOriginal = $item->exto; } // Clears file status cache clearstatcache(); $fileOriginal = $fileOriginal; $fileSize = @filesize($fileOriginal); $mimeType = PhocaGalleryFile::getMimeType($fileToDownload); $fileName = $fileNameToDownload; // Clean the output buffer ob_end_clean(); header("Cache-Control: public, must-revalidate"); header('Cache-Control: pre-check=0, post-check=0, max-age=0'); header("Pragma: no-cache"); header("Expires: 0"); header("Content-Description: File Transfer"); header("Expires: Sat, 30 Dec 1990 07:07:07 GMT"); header("Content-Type: " . (string) $mimeType); // Problem with IE if ($extLink == 0) { header("Content-Length: " . (string) $fileSize); } header('Content-Disposition: attachment; filename="' . $fileName . '"'); header("Content-Transfer-Encoding: binary\n"); @readfile($fileOriginal); exit; } return false; }
function getRealImageSize($filename, $size = 'large', $extLink = 0) { phocagalleryimport('phocagallery.file.thumbnail'); if ($extLink == 1) { list($w, $h, $type) = @getimagesize($filename); } else { $thumbName = PhocaGalleryFileThumbnail::getThumbnailName($filename, $size); list($w, $h, $type) = @getimagesize($thumbName->abs); } $size = ''; if (isset($w) && isset($h)) { $size['w'] = $w; $size['h'] = $h; } else { $size['w'] = 0; $size['h'] = 0; } return $size; }
function display($tpl = null) { $app = JFactory::getApplication(); JHtml::_('behavior.tooltip'); JHtml::_('behavior.formvalidation'); JHtml::_('behavior.keepalive'); JHtml::_('formbehavior.chosen', 'select'); //Frontend Changes $tUri = ''; if (!$app->isAdmin()) { $tUri = JURI::base(); phocagalleryimport('phocagallery.render.renderadmin'); } $document =& JFactory::getDocument(); $uri =& JFactory::getURI(); JHTML::stylesheet('media/com_phocagallery/css/administrator/phocagallery.css'); $eName = JRequest::getVar('e_name'); $tmpl['ename'] = preg_replace('#[^A-Z0-9\\-\\_\\[\\]]#i', '', $eName); $tmpl['backlink'] = $tUri . 'index.php?option=com_phocagallery&view=phocagallerylinks&tmpl=component&e_name=' . $tmpl['ename']; // Category Tree $db =& JFactory::getDBO(); $query = 'SELECT a.title AS text, a.id AS value, a.parent_id as parentid' . ' FROM #__phocagallery_categories AS a' . ' ORDER BY a.ordering'; $db->setQuery($query); $categories = $db->loadObjectList(); $tree = array(); $text = ''; $tree = PhocaGalleryCategory::CategoryTreeOption($categories, $tree, 0, $text, -1); //----------------------------------------------------------------------- // Multiple $ctrl = 'hidecategories'; $attribs = ' '; $attribs .= ' size="5"'; //$attribs .= 'class="'.$v.'"'; $attribs .= ' class="inputbox"'; $attribs .= ' multiple="multiple"'; $ctrl .= ''; //$value = implode( '|', ) $categoriesOutput = JHTML::_('select.genericlist', $tree, $ctrl, $attribs, 'value', 'text', 0, 'hidecategories'); $this->assignRef('categoriesoutput', $categoriesOutput); $this->assignRef('tmpl', $tmpl); parent::display($tpl); }
<?php defined('_JEXEC') or die('Restricted access'); phocagalleryimport('phocagallery.render.rendermap'); echo '<script src="http://www.google.com/jsapi" type="text/javascript"></script>'; echo '<noscript>' . JText::_('COM_PHOCAGALLERY_ERROR_MAP_ENABLE_JAVASCRIPT') . '</noscript>'; echo '<div style="font-size:1px;height:1px;margin:0px;padding:0px;"> </div>'; echo '<div align="center" style="margin:0;padding:0;margin-top:10px;">'; $cmw = ''; if ((int) $this->tmpl['categorymapwidth'] > 0) { $cmw = 'width:' . $this->tmpl['categorymapwidth'] . 'px;'; } echo '<div id="phocaMap" style="margin:0;padding:0;' . $cmw . 'height:' . $this->tmpl['categorymapheight'] . 'px">'; echo '</div></div>'; ?> <script type='text/javascript'>//<![CDATA[ google.load("maps", "3.x", {"other_params":"sensor=false"}); <?php $map = new PhocaGalleryRenderMap(); echo $map->createMap('phocaMap', 'mapPhocaMap', 'phocaLatLng', 'phocaOptions', 'tstPhocaMap', 'tstIntPhocaMap'); echo $map->cancelEventF(); echo $map->checkMapF(); echo $map->startMapF(); echo $map->setLatLng($this->map['latitude'], $this->map['longitude']); echo $map->startOptions(); echo $map->setZoomOpt($this->map['zoom']) . ',' . "\n"; echo $map->setCenterOpt() . ',' . "\n"; echo $map->setTypeControlOpt() . ',' . "\n"; echo $map->setNavigationControlOpt() . ',' . "\n"; echo $map->setScaleControlOpt(1) . ',' . "\n"; echo $map->setScrollWheelOpt(1) . ',' . "\n"; echo $map->setDisableDoubleClickZoomOpt(0) . ',' . "\n";
public function display($tpl = null) { $app = JFactory::getApplication(); $user = JFactory::getUser(); $uri = JFactory::getURI(); $path = PhocaGalleryPath::getPath(); $this->params = $app->getParams(); $this->tmplGeo = array(); $this->tmpl = array(); $this->itemId = $app->input->get('Itemid', 0, 'int'); $document = JFactory::getDocument(); $library = PhocaGalleryLibrary::getLibrary(); $this->tmpl['action'] = $uri->toString(); // CSS PhocaGalleryRenderFront::renderAllCSS(); // Params $this->tmpl['display_name'] = 1; //$this->params->get( 'display_name', 1); $this->tmpl['image_categories_size'] = $this->params->get('image_categories_size', 1); $display_categories_geotagging = $this->params->get('display_categories_geotagging', 0); $display_access_category = $this->params->get('display_access_category', 1); $display_empty_categories = $this->params->get('display_empty_categories', 0); $hideCatArray = explode(',', trim($this->params->get('hide_categories', ''))); $showCatArray = explode(',', trim($this->params->get('show_categories', ''))); $showParentCatArray = explode(',', trim($this->params->get('show_parent_categories', ''))); $this->tmpl['categoriesimageordering'] = $this->params->get('categories_image_ordering', 10); $this->tmpl['categoriesdisplayavatar'] = $this->params->get('categories_display_avatar'); $this->tmpl['categories_description'] = $this->params->get('categories_description', ''); $this->tmpl['phocagallery_width'] = $this->params->get('phocagallery_width', ''); $this->tmpl['phocagallery_center'] = $this->params->get('phocagallery_center', ''); $this->tmpl['display_rating'] = $this->params->get('display_rating', 0); $this->tmpl['categories_box_space'] = $this->params->get('categories_box_space', ''); $this->tmpl['display_cat_desc_box'] = $this->params->get('display_cat_desc_box', 0); $this->tmpl['char_cat_length_name'] = $this->params->get('char_cat_length_name', 9); $this->tmpl['categories_mosaic_images'] = $this->params->get('categories_mosaic_images', 0); $this->tmpl['diff_thumb_height'] = $this->params->get('diff_thumb_height', 0); // L E G A C Y === $this->tmpl['equalpercentagewidth'] = $this->params->get('equal_percentage_width', 1); $this->tmpl['categoriesboxwidth'] = $this->params->get('categories_box_width', '33%'); $this->tmpl['categoriescolumns'] = $this->params->get('categories_columns', 1); $this->tmpl['displayrating'] = $this->params->get('display_rating', 0); $this->tmpl['display_image_categories'] = $this->params->get('display_image_categories', 1); if ($this->tmpl['display_image_categories'] == 1) { } else { // If legacy no different height, no mosaic $this->tmpl['diff_thumb_height'] = 0; $this->tmpl['categories_mosaic_images'] = 0; } // END L E G A C Y === switch ($this->tmpl['image_categories_size']) { // medium case 1: $this->tmpl['picasa_correct_width'] = (int) $this->params->get('medium_image_width', 100); $this->tmpl['picasa_correct_height'] = (int) $this->params->get('medium_image_height', 100); $this->tmpl['imagewidth'] = (int) $this->params->get('medium_image_width', 100); $this->tmpl['imageheight'] = (int) $this->params->get('medium_image_height', 100); $this->tmpl['class_suffix'] = 'medium'; if ($this->tmpl['categories_mosaic_images'] == 1) { $this->tmpl['imagewidth'] = (int) $this->params->get('medium_image_width', 100) * 3; $this->tmpl['imageheight'] = (int) $this->params->get('medium_image_height', 100) * 2; } break; // small // small case 0: default: $this->tmpl['picasa_correct_width'] = (int) $this->params->get('small_image_width', 50); $this->tmpl['picasa_correct_height'] = (int) $this->params->get('small_image_height', 50); $this->tmpl['imagewidth'] = (int) $this->params->get('small_image_width', 50); $this->tmpl['imageheight'] = (int) $this->params->get('small_image_height', 50); $this->tmpl['class_suffix'] = 'small'; if ($this->tmpl['categories_mosaic_images'] == 1) { $this->tmpl['imagewidth'] = (int) $this->params->get('small_image_width', 50) * 3; $this->tmpl['imageheight'] = (int) $this->params->get('small_image_height', 50) * 2; } break; } $this->tmpl['boxsize'] = PhocaGalleryImage::setBoxSize($this->tmpl, 1); if ($this->tmpl['diff_thumb_height'] == 2) { $document->addScript(JURI::base(true) . '/components/com_phocagallery/assets/masonry/masonry.min.js'); $document->addCustomTag('<script type="text/javascript"> window.onload = function() { var wall = new Masonry( document.getElementById(\'pg-msnr-container\'), { isFitWidth: true }); }; </script>'); } $s = '#phocagallery {' . "\n"; if ($this->tmpl['phocagallery_center'] != '') { $s .= ' margin: 0 auto; text-align: center;' . "\n"; } if ($this->tmpl['phocagallery_width'] != '') { $s .= ' width: ' . $this->tmpl['phocagallery_width'] . 'px;' . "\n"; } $s .= '}' . "\n"; if ($this->tmpl['phocagallery_center'] != '') { $s = "\n" . '#pg-msnr-container {' . "\n"; $s .= ' margin: 0 auto;' . "\n"; $s .= '}' . "\n"; } $s .= '.pg-csv-box {' . "\n"; $s .= ' height: ' . $this->tmpl['boxsize']['height'] . 'px;' . "\n"; $s .= ' width: ' . $this->tmpl['boxsize']['width'] . 'px;' . "\n"; $s .= '}' . "\n"; $s .= '.pg-csv-box-img {' . "\n"; $s .= ' height: ' . $this->tmpl['imageheight'] . 'px;' . "\n"; $s .= ' width: ' . $this->tmpl['imagewidth'] . 'px;' . "\n"; $s .= '}' . "\n"; $document->addCustomTag('<style type="text/css">' . $s . '</style>'); // Image next to Category in Categories View is ordered by Random as default $categoriesImageOrdering = PhocaGalleryOrdering::getOrderingString($this->tmpl['categoriesimageordering']); // MODEL $model = $this->getModel(); $this->tmpl['ordering'] = $model->getOrdering(); $this->categories = $this->get('data'); // Add link and unset the categories which user cannot see (if it is enabled in params) // If it will be unset while access view, we must sort the keys from category array - ACCESS $unSet = 0; foreach ($this->categories as $key => $item) { // Unset empty categories if it is set if ($display_empty_categories == 0) { if ($this->categories[$key]->numlinks < 1) { unset($this->categories[$key]); $unSet = 1; continue; } } // Set only selected category ID if (!empty($showCatArray[0]) && is_array($showCatArray)) { $unSetHCA = 0; foreach ($showCatArray as $valueHCA) { if ((int) trim($valueHCA) == $this->categories[$key]->id) { $unSetHCA = 0; $unSet = 0; break; } else { $unSetHCA = 1; $unSet = 1; } } if ($unSetHCA == 1) { unset($this->categories[$key]); continue; } } // Unset hidden category if (!empty($hideCatArray) && is_array($hideCatArray)) { $unSetHCA = 0; foreach ($hideCatArray as $valueHCA) { if ((int) trim($valueHCA) == $this->categories[$key]->id) { unset($this->categories[$key]); $unSet = 1; $unSetHCA = 1; break; } } if ($unSetHCA == 1) { continue; } } // Unset not set parent categories - only categories which have specific parent id will be displayed if (!empty($showParentCatArray[0]) && is_array($showParentCatArray)) { $unSetPHCA = 0; foreach ($showParentCatArray as $valuePHCA) { if ((int) trim($valuePHCA) == $this->categories[$key]->parent_id) { $unSetPHCA = 0; //$unSet = 0; break; } else { $unSetPHCA = 1; $unSet = 1; } } if ($unSetPHCA == 1) { unset($this->categories[$key]); continue; } } // Link $this->categories[$key]->link = PhocaGalleryRoute::getCategoryRoute($item->id, $item->alias); // USER RIGHT - ACCESS - - - - - // First Check - check if we can display category $rightDisplay = 1; if (!empty($this->categories[$key])) { $rightDisplay = PhocaGalleryAccess::getUserRight('accessuserid', $this->categories[$key]->accessuserid, $this->categories[$key]->access, $user->getAuthorisedViewLevels(), $user->get('id', 0), $display_access_category); } // Second Check - if we can display hidden category, set Key icon for them // if we don't have access right to see them // Display Key Icon (in case we want to display unaccessable categories in list view) $rightDisplayKey = 1; if ($display_access_category == 1) { // we simulate that we want not to display unaccessable categories // so if we get rightDisplayKey = 0 then the key will be displayed if (!empty($this->categories[$key])) { $rightDisplayKey = PhocaGalleryAccess::getUserRight('accessuserid', $this->categories[$key]->accessuserid, $this->categories[$key]->access, $user->getAuthorisedViewLevels(), $user->get('id', 0), 0); // 0 - simulation } } // Is Ext Image Album? $extCategory = PhocaGalleryImage::isExtImage($this->categories[$key]->extid, $this->categories[$key]->extfbcatid); // DISPLAY AVATAR, IMAGE(ordered), IMAGE(not ordered, not recursive) OR FOLDER ICON $displayAvatar = 0; if ($this->tmpl['categoriesdisplayavatar'] == 1 && isset($this->categories[$key]->avatar) && $this->categories[$key]->avatar != '' && $this->categories[$key]->avatarapproved == 1 && $this->categories[$key]->avatarpublished == 1) { $sizeString = PhocaGalleryImageFront::getSizeString($this->tmpl['image_categories_size']); $pathAvatarAbs = $path->avatar_abs . 'thumbs' . DS . 'phoca_thumb_' . $sizeString . '_' . $this->categories[$key]->avatar; $pathAvatarRel = $path->avatar_rel . 'thumbs/phoca_thumb_' . $sizeString . '_' . $this->categories[$key]->avatar; if (JFile::exists($pathAvatarAbs)) { $this->categories[$key]->linkthumbnailpath = $pathAvatarRel; $displayAvatar = 1; } } if ($displayAvatar == 0) { if ($extCategory) { if ($this->tmpl['categories_mosaic_images'] == 1) { if ($this->tmpl['categoriesimageordering'] == 10) { // Special cannot be used in this case: $categoriesImageOrdering = 1; // set to default ordering } $this->categories[$key]->filenames = PhocaGalleryImageFront::getCategoryImages($this->categories[$key]->id, $categoriesImageOrdering); $this->categories[$key]->mosaic = PhocaGalleryImageFront::renderMosaic($this->categories[$key]->filenames, $this->tmpl['image_categories_size'], 1, $this->tmpl['picasa_correct_width'], $this->tmpl['picasa_correct_height']); } else { if ($this->tmpl['categoriesimageordering'] != 10) { $imagePic = PhocaGalleryImageFront::getRandomImageRecursive($this->categories[$key]->id, $categoriesImageOrdering, 1); if ($rightDisplayKey == 0) { $imagePic = new StdClass(); $imagePic->exts = ''; $imagePic->extm = ''; $imagePic->extw = ''; $imagePic->exth = ''; } $fileThumbnail = PhocaGalleryImageFront::displayCategoriesExtImgOrFolder($imagePic->exts, $imagePic->extm, $imagePic->extw, $imagePic->exth, $this->tmpl['image_categories_size'], $rightDisplayKey); $this->categories[$key]->linkthumbnailpath = $fileThumbnail->rel; $this->categories[$key]->extw = $fileThumbnail->extw; $this->categories[$key]->exth = $fileThumbnail->exth; $this->categories[$key]->extpic = $fileThumbnail->extpic; } else { $fileThumbnail = PhocaGalleryImageFront::displayCategoriesExtImgOrFolder($this->categories[$key]->exts, $this->categories[$key]->extm, $this->categories[$key]->extw, $this->categories[$key]->exth, $this->tmpl['image_categories_size'], $rightDisplayKey); $this->categories[$key]->linkthumbnailpath = $fileThumbnail->rel; $this->categories[$key]->extw = $fileThumbnail->extw; $this->categories[$key]->exth = $fileThumbnail->exth; $this->categories[$key]->extpic = $fileThumbnail->extpic; } } } else { if ($this->tmpl['categories_mosaic_images'] == 1) { if ($this->tmpl['categoriesimageordering'] == 10) { // Special cannot be used in this case: $categoriesImageOrdering = 1; // set to default ordering } $this->categories[$key]->filenames = PhocaGalleryImageFront::getCategoryImages($this->categories[$key]->id, $categoriesImageOrdering); $this->categories[$key]->mosaic = PhocaGalleryImageFront::renderMosaic($this->categories[$key]->filenames, $this->tmpl['image_categories_size']); } else { // Standard Internal Image if ($this->tmpl['categoriesimageordering'] != 10) { $this->categories[$key]->filename = PhocaGalleryImageFront::getRandomImageRecursive($this->categories[$key]->id, $categoriesImageOrdering); } $fileThumbnail = PhocaGalleryImageFront::displayCategoriesImageOrFolder($this->categories[$key]->filename, $this->tmpl['image_categories_size'], $rightDisplayKey); $this->categories[$key]->linkthumbnailpath = $fileThumbnail->rel; } } } if ($rightDisplay == 0) { unset($this->categories[$key]); $unSet = 1; } // - - - - - - - - - - - - - - - } // ACCESS - - - - - - // In case we unset some category from the list, we must sort the array new if ($unSet == 1) { $this->categories = array_values($this->categories); } // - - - - - - - - - - - - - - - - // Do Pagination - we can do it after reducing all unneeded $this->categories, not before $totalCount = count($this->categories); $model->setTotal($totalCount); $this->tmpl['pagination'] = $this->get('pagination'); $this->categories = array_slice($this->categories, (int) $this->tmpl['pagination']->limitstart, (int) $this->tmpl['pagination']->limit); // - - - - - - - - - - - - - - - - $this->tmpl['ems'] = ''; // L E G A C Y === $this->tmpl['countcategories'] = count($this->categories); $this->tmpl['begin'] = array(); $this->tmpl['end'] = array(); $this->tmpl['begin'][0] = 0; // first $this->tmpl['begin'][1] = ceil($this->tmpl['countcategories'] / (int) $this->tmpl['categoriescolumns']); $this->tmpl['end'][0] = $this->tmpl['begin'][1] - 1; for ($j = 2; $j < (int) $this->tmpl['categoriescolumns']; $j++) { $this->tmpl['begin'][$j] = ceil($this->tmpl['countcategories'] / (int) $this->tmpl['categoriescolumns'] * $j); $this->tmpl['end'][$j - 1] = $this->tmpl['begin'][$j] - 1; } $this->tmpl['end'][$j - 1] = $this->tmpl['countcategories'] - 1; // last $this->tmpl['endfloat'] = $this->tmpl['countcategories'] - 1; if ($this->tmpl['equalpercentagewidth'] == 1) { $fixedWidth = 100 / (int) (int) $this->tmpl['categoriescolumns']; $this->tmpl['fixedwidthstyle1'] = 'width:' . $fixedWidth . '%;'; $this->tmpl['fixedwidthstyle2'] = 'width:' . $fixedWidth . '%;'; } else { $this->tmpl['fixedwidthstyle1'] = ''; //'margin: 10px;'; $this->tmpl['fixedwidthstyle2'] = ''; //'margin: 0px;'; } // END L E G A C Y === $this->_prepareDocument(); if ($display_categories_geotagging == 1) { // Params $this->tmplGeo['categorieslng'] = $this->params->get('categories_lng', ''); $this->tmplGeo['categorieslat'] = $this->params->get('categories_lat', ''); $this->tmplGeo['categorieszoom'] = $this->params->get('categories_zoom', 2); $this->tmplGeo['googlemapsapikey'] = $this->params->get('google_maps_api_key', ''); $this->tmplGeo['categoriesmapwidth'] = $this->params->get('categories_map_width', ''); $this->tmplGeo['categoriesmapheight'] = $this->params->get('categorires_map_height', 500); // If no lng and lat will be added, Phoca Gallery will try to find it in categories if ($this->tmplGeo['categorieslat'] == '' || $this->tmplGeo['categorieslng'] == '') { phocagalleryimport('phocagallery.geo.geo'); $latLng = PhocaGalleryGeo::findLatLngFromCategory($this->categories); $this->tmplGeo['categorieslng'] = $latLng['lng']; $this->tmplGeo['categorieslat'] = $latLng['lat']; } $this->assignRef('tmplGeo', $this->tmplGeo); parent::display('map'); } else { parent::display($tpl); } }
* * @component Phoca Component * @copyright Copyright (C) Jan Pavelka www.phoca.cz * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL */ defined('_JEXEC') or die; jimport('joomla.client.helper'); jimport('joomla.application.component.view'); jimport('joomla.html.pane'); phocagalleryimport('phocagallery.file.fileupload'); phocagalleryimport('phocagallery.file.fileuploadmultiple'); phocagalleryimport('phocagallery.file.fileuploadsingle'); phocagalleryimport('phocagallery.file.fileuploadjava'); phocagalleryimport('phocagallery.avatar.avatar'); phocagalleryimport('phocagallery.render.renderadmin'); phocagalleryimport('phocagallery.html.category'); //phocagalleryimport('phocagallery.pagination.paginationuser'); class PhocaGalleryViewUser extends JViewLegacy { protected $_context_subcat = 'com_phocagallery.phocagalleryusersubcat'; protected $_context_image = 'com_phocagallery.phocagalleryuserimage'; protected $tmpl; function display($tpl = null) { $app = JFactory::getApplication(); $document =& JFactory::getDocument(); $uri =& JFactory::getURI(); $menus = $app->getMenu(); $menu = $menus->getActive(); $this->params =& $app->getParams(); $user =& JFactory::getUser();
<?php /* * @package Joomla 1.5 * @copyright Copyright (C) 2005 Open Source Matters. All rights reserved. * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php * * @component Phoca Component * @copyright Copyright (C) Jan Pavelka www.phoca.cz * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL */ defined('_JEXEC') or die; jimport('joomla.application.component.view'); phocagalleryimport('phocagallery.rate.rateimage'); class PhocaGalleryViewRatingImgA extends JViewLegacy { function display($tpl = null) { if (!JRequest::checkToken('request')) { $response = array('status' => '0', 'error' => JText::_('JINVALID_TOKEN')); echo json_encode($response); return; } $app = JFactory::getApplication(); $params =& $app->getParams(); $ratingVote = $app->input->get('ratingVote', 0, 'int'); $ratingId = $app->input->get('ratingId', 0, 'int'); // ID of File $format = $app->input->get('format', '', 'string'); $task = $app->input->get('task', '', 'string'); $view = $app->input->get('view', '', 'string');
function comment() { JRequest::checkToken() or jexit('Invalid Token'); phocagalleryimport('phocagallery.comment.comment'); phocagalleryimport('phocagallery.comment.commentimage'); $app = JFactory::getApplication(); $user =& JFactory::getUser(); $view = JRequest::getVar('view', '', 'post', '', 0); $catid = JRequest::getVar('catid', '', 'post', 'string', 0); $id = JRequest::getVar('id', '', 'post', 'string', 0); $post['title'] = JRequest::getVar('phocagallerycommentstitle', '', 'post', 'string', 0); $post['comment'] = JRequest::getVar('phocagallerycommentseditor', '', 'post', 'string', 0); $Itemid = JRequest::getVar('Itemid', 0, '', 'int'); $limitStart = JRequest::getVar('limitstart', 0, '', 'int'); $tab = JRequest::getVar('tab', 0, '', 'int'); $neededAccessLevels = PhocaGalleryAccess::getNeededAccessLevels(); $access = PhocaGalleryAccess::isAccess($user->authorisedLevels(), $neededAccessLevels); $params =& $app->getParams(); $detailWindow = $params->get('detail_window', 0); $maxCommentChar = $params->get('max_comment_char', 1000); $displayCommentNoPopup = $params->get('display_comment_nopup', 0); // Maximum of character, they will be saved in database $post['comment'] = substr($post['comment'], 0, (int) $maxCommentChar); if ($detailWindow == 7 || $displayCommentNoPopup == 1) { $tmplCom = ''; } else { $tmplCom = '&tmpl=component'; } // Close Tags $post['comment'] = PhocaGalleryComment::closeTags($post['comment'], '[u]', '[/u]'); $post['comment'] = PhocaGalleryComment::closeTags($post['comment'], '[i]', '[/i]'); $post['comment'] = PhocaGalleryComment::closeTags($post['comment'], '[b]', '[/b]'); $post['imgid'] = (int) $id; $post['userid'] = $user->id; $catidAlias = $catid; $imgidAlias = $id; if ($view != 'comment') { $this->setRedirect(JRoute::_('index.php?option=com_phocagallery', false)); } $model = $this->getModel('comment'); $checkUserComment = PhocaGalleryCommentImage::checkUserComment($post['imgid'], $post['userid']); // User has already submitted a comment if ($checkUserComment) { $msg = JText::_('COM_PHOCAGALLERY_COMMENT_ALREADY_SUBMITTED'); } else { // If javascript will not protect the empty form $msg = ''; $emptyForm = 0; if ($post['title'] == '') { $msg .= JText::_('COM_PHOCAGALLERY_ERROR_COMMENT_TITLE') . ' '; $emtyForm = 1; } if ($post['comment'] == '') { $msg .= JText::_('COM_PHOCAGALLERY_ERROR_COMMENT_COMMENT'); $emtyForm = 1; } if ($emptyForm == 0) { if ($access > 0 && $user->id > 0) { if (!$model->comment($post)) { $msg = JText::_('COM_PHOCAGALLERY_ERROR_COMMENT_SUBMITTING'); } else { $msg = JText::_('COM_PHOCAGALLERY_SUCCESS_COMMENT_SUBMIT'); } } else { $app->redirect(JRoute::_('index.php?option=com_users&view=login', false), JText::_('COM_PHOCAGALLERY_NOT_AUTHORISED_ACTION')); exit; } } } $this->setRedirect(JRoute::_('index.php?option=com_phocagallery&view=comment&catid=' . $catidAlias . '&id=' . $imgidAlias . $tmplCom . '&Itemid=' . $Itemid, false), $msg); }
function display($tpl = null) { $app = JFactory::getApplication(); $document =& JFactory::getDocument(); $this->params =& $app->getParams(); // PLUGIN WINDOW - we get information from plugin $get = ''; $get['map'] = JRequest::getVar('map', '', 'get', 'string'); // Multibox $get['mapwidth'] = JRequest::getVar('mapwidth', '', 'get', 'string'); $get['mapheight'] = JRequest::getVar('mapheight', '', 'get', 'string'); $this->tmpl['enable_multibox'] = $this->params->get('enable_multibox', 0); $this->tmpl['enable_multibox_iframe'] = 0; if ($get['mapwidth'] != '') { // Seems we are in iframe $this->tmpl['enable_multibox_iframe'] = 1; } $this->tmpl['enablecustomcss'] = $this->params->get('enable_custom_css', 0); $this->tmpl['customcss'] = $this->params->get('custom_css', ''); // CSS JHtml::stylesheet('components/com_phocagallery/assets/phocagallery.css'); if ($this->tmpl['enablecustomcss'] == 1) { JHtml::stylesheet('components/com_phocagallery/assets/phocagallerycustom.css'); PhocaGalleryRenderFront::displayCustomCSS($this->tmpl['customcss']); } // PARAMS - Open window parameters - modal popup box or standard popup window $this->tmpl['detailwindow'] = $this->params->get('detail_window', 0); // Plugin information if (isset($get['map']) && $get['map'] != '') { $this->tmpl['detailwindow'] = $get['map']; } // Close and Reload links (for different window types) $close = PhocaGalleryRenderFront::renderCloseReloadDetail($this->tmpl['detailwindow']); $detail_window_close = $close['detailwindowclose']; $detail_window_reload = $close['detailwindowreload']; // PARAMS - Display Description in Detail window - set the font color $this->tmpl['detailwindow'] = $this->params->get('detail_window', 0); $this->tmpl['detailwindowbackgroundcolor'] = $this->params->get('detail_window_background_color', '#ffffff'); $this->tmpl['pgl'] = PhocaGalleryRenderInfo::getPhocaIc((int) $this->params->get('display_phoca_info', 1)); $description_lightbox_font_color = $this->params->get('description_lightbox_font_color', '#ffffff'); $description_lightbox_bg_color = $this->params->get('description_lightbox_bg_color', '#000000'); $description_lightbox_font_size = $this->params->get('description_lightbox_font_size', 12); $this->tmpl['gallerymetakey'] = $this->params->get('gallery_metakey', ''); $this->tmpl['gallerymetadesc'] = $this->params->get('gallery_metadesc', ''); if ($this->tmpl['gallerymetakey'] != '') { $document->setMetaData('keywords', $this->tmpl['gallerymetakey']); } if ($this->tmpl['gallerymetadesc'] != '') { $document->setMetaData('description', $this->tmpl['gallerymetadesc']); } // NO SCROLLBAR IN DETAIL WINDOW if ($this->tmpl['detailwindow'] == 7) { } else { $document->addCustomTag("<style type=\"text/css\"> \n" . " html,body, .contentpane{overflow:hidden;background:" . $this->tmpl['detailwindowbackgroundcolor'] . ";} \n" . " center, table {background:" . $this->tmpl['detailwindowbackgroundcolor'] . ";} \n" . " #sbox-window {background-color:#fff;padding:5px} \n" . " </style> \n"); } // PARAMS - Get image height and width $this->tmpl['largemapwidth'] = (int) $this->params->get('front_modal_box_width', 680) - 20; $this->tmpl['largemapheight'] = (int) $this->params->get('front_modal_box_height', 560) - 20; // Multibox if (isset($get['mapwidth']) && $get['mapwidth'] != '') { $this->tmpl['largemapwidth'] = $get['mapwidth']; } if (isset($get['mapheight']) && $get['mapheight'] != '') { $this->tmpl['largemapheight'] = $get['mapheight']; } // $this->tmpl['googlemapsapikey'] = $this->params->get( 'google_maps_api_key', '' ); // MODEL $model =& $this->getModel(); $map = $model->getData(); phocagalleryimport('phocagallery.image.imagefront'); if (!empty($map)) { if (isset($map->filename) && $map->filename != '') { $file_thumbnail = PhocaGalleryImageFront::displayCategoryImageOrNoImage($map->filename, 'small'); $map->thumbnail = $file_thumbnail; } else { $map->thumbnail = ''; } if (isset($map->latitude) && $map->latitude != '' && $map->latitude != 0 && isset($map->longitude) && $map->longitude != '' && $map->longitude != 0) { } else { $map->longitude = ''; $map->latitude = ''; $map->zoom = 2; $map->geotitle = ''; } } // Second try to get category data if (empty($map) || $map->longitude == '' && $map->latitude == '' && $map->geotitle == '') { $map = $model->getDataCategory(); if (!empty($map)) { if (isset($map->latitude) && $map->latitude != '' && $map->latitude != 0 && isset($map->longitude) && $map->longitude != '' && $map->longitude != 0) { $map->thumbnail = ''; if ($map->geotitle == '') { $map->geotitle = $map->title; } } else { $map->longitude = ''; $map->latitude = ''; $map->zoom = 2; $map->geotitle = ''; } } else { $map->longitude = ''; $map->latitude = ''; $map->zoom = 2; $map->geotitle = ''; $map->catslug = ''; } } // Back button $this->tmpl['backbutton'] = ''; if ($this->tmpl['detailwindow'] == 7) { phocagalleryimport('phocagallery.image.image'); $formatIcon =& PhocaGalleryImage::getFormatIcon(); $this->tmpl['backbutton'] = '<div><a href="' . JRoute::_('index.php?option=com_phocagallery&view=category&id=' . $map->catslug . '&Itemid=' . JRequest::getVar('Itemid', 0, '', 'int')) . '"' . ' title="' . JText::_('COM_PHOCAGALLERY_BACK_TO_CATEGORY') . '">' . JHtml::_('image', 'components/com_phocagallery/assets/images/icon-up-images.' . $formatIcon, JText::_('COM_PHOCAGALLERY_BACK_TO_CATEGORY')) . '</a></div>'; } // ASIGN $this->assignRef('tmpl', $this->tmpl); $this->assignRef('map', $map); $this->_prepareDocument($map); parent::display($tpl); }
defined('_JEXEC') or die; if (!defined('DS')) { define('DS', DIRECTORY_SEPARATOR); } if (!JFactory::getUser()->authorise('core.manage', 'com_phocagallery')) { return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR')); } if (!class_exists('PhocaGalleryLoader')) { require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_phocagallery' . DS . 'libraries' . DS . 'loader.php'; } require_once JPATH_COMPONENT . DS . 'controller.php'; phocagalleryimport('phocagallery.utils.settings'); phocagalleryimport('phocagallery.utils.utils'); phocagalleryimport('phocagallery.utils.exception'); phocagalleryimport('phocagallery.path.path'); phocagalleryimport('phocagallery.file.file'); phocagalleryimport('phocagallery.file.filethumbnail'); phocagalleryimport('phocagallery.file.fileupload'); phocagalleryimport('phocagallery.render.renderadmin'); phocagalleryimport('phocagallery.render.renderadminview'); phocagalleryimport('phocagallery.render.renderadminviews'); phocagalleryimport('phocagallery.text.text'); phocagalleryimport('phocagallery.render.renderprocess'); //phocagalleryimport('phocagallery.html.grid'); phocagalleryimport('phocagallery.html.jgrid'); phocagalleryimport('phocagallery.html.category'); phocagalleryimport('phocagallery.html.batch'); jimport('joomla.application.component.controller'); $controller = JControllerLegacy::getInstance('PhocaGalleryCp'); $controller->execute(JFactory::getApplication()->input->get('task')); $controller->redirect();
function createFileThumbnail($fileOriginal, $fileThumbnail, $size, $frontUpload = 0, &$errorMsg) { $paramsC = JComponentHelper::getParams('com_phocagallery'); $enable_thumb_creation = $paramsC->get('enable_thumb_creation', 1); $watermarkParams['create'] = $paramsC->get('create_watermark', 0); // Watermark $watermarkParams['x'] = $paramsC->get('watermark_position_x', 'center'); $watermarkParams['y'] = $paramsC->get('watermark_position_y', 'middle'); $crop_thumbnail = $paramsC->get('crop_thumbnail', 5); // Crop or not $crop = null; switch ($size) { case 'small1': case 'small2': case 'small3': case 'medium1': case 'medium2': case 'medium3': $crop = 1; break; case 'small': if ($crop_thumbnail == 3 || $crop_thumbnail == 5 || $crop_thumbnail == 6 || $crop_thumbnail == 7) { $crop = 1; } break; case 'medium': if ($crop_thumbnail == 2 || $crop_thumbnail == 4 || $crop_thumbnail == 5 || $crop_thumbnail == 7) { $crop = 1; } break; case 'large': default: if ($crop_thumbnail == 1 || $crop_thumbnail == 4 || $crop_thumbnail == 6 || $crop_thumbnail == 7) { $crop = 1; } break; } // disable or enable the thumbnail creation if ($enable_thumb_creation == 1) { $fileResize = PhocaGalleryFileThumbnail::getThumbnailResize($size); if (JFile::exists($fileOriginal)) { //file doesn't exist, create thumbnail if (!JFile::exists($fileThumbnail)) { $errorMsg = 'Error4'; //Don't do thumbnail if the file is smaller (width, height) than the possible thumbnail list($width, $height) = GetImageSize($fileOriginal); //larger phocagalleryimport('phocagallery.image.imagemagic'); if ($width > $fileResize['width'] || $height > $fileResize['height']) { $imageMagic = PhocaGalleryImageMagic::imageMagic($fileOriginal, $fileThumbnail, $fileResize['width'], $fileResize['height'], $crop, null, $watermarkParams, $frontUpload, $errorMsg); } else { $imageMagic = PhocaGalleryImageMagic::imageMagic($fileOriginal, $fileThumbnail, $width, $height, $crop, null, $watermarkParams, $frontUpload, $errorMsg); } if ($imageMagic) { return true; } else { return false; // error Msg will be taken from imageMagic } } else { $errorMsg = 'ThumbnailExists'; //thumbnail exists return false; } } else { $errorMsg = 'ErrorFileOriginalNotExists'; return false; } $errorMsg = 'Error3'; return false; } else { $errorMsg = 'DisabledThumbCreation'; // User have disabled the thumbanil creation e.g. because of error return false; } }
<?php /* * @package Joomla.Framework * @copyright Copyright (C) 2005 - 2010 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt * * @component Phoca Component * @copyright Copyright (C) Jan Pavelka www.phoca.cz * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License version 2 or later; */ defined('_JEXEC') or die; phocagalleryimport('phocagallery.tag.tag'); class JFormFieldPhocaTags extends JFormField { protected $type = 'PhocaTags'; protected function getInput() { $id = (int) $this->form->getValue('id'); $activeTags = array(); if ((int) $id > 0) { $activeTags = PhocaGalleryTag::getTags($id, 1); } return PhocaGalleryTag::getAllTagsSelectBox($this->name, $this->id, $activeTags, NULL, 'id'); } }
function comment() { JRequest::checkToken() or jexit('Invalid Token'); phocagalleryimport('phocagallery.comment.comment'); phocagalleryimport('phocagallery.comment.commentcategory'); $app = JFactory::getApplication(); $user = JFactory::getUser(); $catid = $this->input->get('catid', '', 'string'); $post['title'] = $this->input->get('phocagallerycommentstitle', '', 'string'); $post['comment'] = $this->input->get('phocagallerycommentseditor', '', 'string'); $view = $this->input->get('view', '', 'string'); $return = $this->input->get('return-url', null, 'base64'); $format = $this->input->get('format', 'html', 'cmd'); $viewBack = $this->input->get('viewback', '', 'string'); $tab = $this->input->get('tab', 0, 'int'); $rating = $this->input->get('rating', '', 'string'); $Itemid = $this->input->get('Itemid', 0, 'int'); $limitStart = $this->input->get('limitstart', 0, 'int'); $neededAccessLevels = PhocaGalleryAccess::getNeededAccessLevels(); $access = PhocaGalleryAccess::isAccess($user->getAuthorisedViewLevels(), $neededAccessLevels); $paramsC = JComponentHelper::getParams('com_phocagallery'); $maxCommentChar = $paramsC->get('max_comment_char', 1000); // Maximum of character, they will be saved in database $post['comment'] = substr($post['comment'], 0, (int) $maxCommentChar); // Close Tags $post['comment'] = PhocaGalleryComment::closeTags($post['comment'], '[u]', '[/u]'); $post['comment'] = PhocaGalleryComment::closeTags($post['comment'], '[i]', '[/i]'); $post['comment'] = PhocaGalleryComment::closeTags($post['comment'], '[b]', '[/b]'); $post['catid'] = (int) $catid; $post['userid'] = $user->id; $catidAlias = $catid; //Itemid if ($view != 'category') { $this->setRedirect(JRoute::_('index.php?option=com_phocagallery', false)); } $model = $this->getModel('category'); $checkUserComment = PhocaGalleryCommentCategory::checkUserComment($post['catid'], $post['userid']); // User has already submitted a comment if ($checkUserComment) { $msg = JText::_('COM_PHOCAGALLERY_COMMENT_ALREADY_SUBMITTED'); } else { // If javascript will not protect the empty form $msg = ''; $emptyForm = 0; if ($post['title'] == '') { $msg .= JText::_('COM_PHOCAGALLERY_ERROR_COMMENT_TITLE') . ' '; $emtyForm = 1; } if ($post['comment'] == '') { $msg .= JText::_('COM_PHOCAGALLERY_ERROR_COMMENT_COMMENT'); $emtyForm = 1; } if ($emptyForm == 0) { if ($access > 0 && $user->id > 0) { if (!$model->comment($post)) { $msg = JText::_('COM_PHOCAGALLERY_ERROR_COMMENT_SUBMITTING'); } else { $msg = JText::_('COM_PHOCAGALLERY_SUCCESS_COMMENT_SUBMIT'); } } else { $app->enqueueMessage(JText::_('COM_PHOCAGALLERY_NOT_AUTHORISED_ACTION')); $app->redirect(JRoute::_('index.php?option=com_users&view=login', false)); exit; } } } // Limit Start $countItem = $model->getCountItem((int) $catid); if ($countItem) { if ((int) $countItem[0] == $limitStart) { $limitStart = 0; } } else { $limitStart = 0; } if ($limitStart > 0) { $limitStartUrl = '&limitstart=' . $limitStart; } else { $limitStartUrl = ''; } $app->enqueueMessage($msg); $this->setRedirect(JRoute::_('index.php?option=com_phocagallery&view=category&id=' . $catidAlias . '&tab=' . $tab . '&Itemid=' . $Itemid . $limitStartUrl, false)); }
function display($tpl = null) { $app = JFactory::getApplication(); JHtml::_('behavior.tooltip'); JHtml::_('behavior.formvalidation'); JHtml::_('behavior.keepalive'); JHtml::_('formbehavior.chosen', 'select'); //Frontend Changes $tUri = ''; $jsLink = JURI::base(true); if (!$app->isAdmin()) { $tUri = JURI::base(); phocagalleryimport('phocagallery.render.renderadmin'); phocagalleryimport('phocagallery.file.filethumbnail'); $jsLink = JURI::base(true) . '/administrator'; } $document = JFactory::getDocument(); $uri = JFactory::getURI(); $db = JFactory::getDBO(); JHTML::stylesheet('media/com_phocagallery/css/administrator/phocagallery.css'); JHTML::stylesheet('components/com_phocagallery/assets/jcp/picker.css'); $document->addScript(JURI::root(true) . '/components/com_phocagallery/assets/jcp/picker.js'); $eName = $app->input->get('e_name', '', 'cmd'); $tmpl['ename'] = preg_replace('#[^A-Z0-9\\-\\_\\[\\]]#i', '', $eName); $tmpl['type'] = $app->input->get('type', 1, 'int'); $tmpl['backlink'] = $tUri . 'index.php?option=com_phocagallery&view=phocagallerylinks&tmpl=component&e_name=' . $tmpl['ename']; $document->addCustomTag("<!--[if lt IE 8]>\n<link rel=\"stylesheet\" href=\"../media/com_phocagallery/css/administrator/phocagalleryieall.css\" type=\"text/css\" />\n<![endif]-->"); $params = JComponentHelper::getParams('com_phocagallery'); //Filter $filter_state = $app->getUserStateFromRequest($this->_context . '.filter_state', 'filter_state', '', 'word'); $filter_catid = $app->getUserStateFromRequest($this->_context . '.filter_catid', 'filter_catid', 0, 'int'); $filter_order = $app->getUserStateFromRequest($this->_context . '.filter_order', 'filter_order', 'a.ordering', 'cmd'); $filter_order_Dir = $app->getUserStateFromRequest($this->_context . '.filter_order_Dir', 'filter_order_Dir', '', 'word'); $search = $app->getUserStateFromRequest($this->_context . '.search', 'search', '', 'string'); $search = JString::strtolower($search); // Get data from the model $items = $this->get('Data'); $total = $this->get('Total'); $tmpl['pagination'] = $this->get('Pagination'); // build list of categories $javascript = 'class="inputbox" size="1" onchange="submitform( );"'; // get list of categories for dropdown filter $filter = ''; // build list of categories $javascript = 'class="inputbox" size="1" onchange="submitform( );"'; $query = 'SELECT a.title AS text, a.id AS value, a.parent_id as parentid' . ' FROM #__phocagallery_categories AS a' . ' WHERE a.published = 1' . ' AND a.approved = 1' . ' ORDER BY a.ordering'; $db->setQuery($query); $phocagallerys = $db->loadObjectList(); $tree = array(); $text = ''; $tree = PhocaGalleryCategory::CategoryTreeOption($phocagallerys, $tree, 0, $text, -1); array_unshift($tree, JHtml::_('select.option', '0', '- ' . JText::_('COM_PHOCAGALLERY_SELECT_CATEGORY') . ' -', 'value', 'text')); $lists['catid'] = JHtml::_('select.genericlist', $tree, 'filter_catid', $javascript, 'value', 'text', $filter_catid); //----------------------------------------------------------------------- // state filter $lists['state'] = JHtml::_('grid.state', $filter_state); // table ordering $lists['order_Dir'] = $filter_order_Dir; $lists['order'] = $filter_order; // search filter $lists['search'] = $search; $user = JFactory::getUser(); $uriS = $uri->toString(); $this->assignRef('tmpl', $tmpl); $this->assignRef('button', $button); $this->assignRef('user', $user); $this->assignRef('items', $items); $this->assignRef('request_url', $uriS); switch ($tmpl['type']) { case 2: $i = 0; $itemsCount = $itemsStart = array(); foreach ($items as $key => $value) { $itemsCount[$i] = new StdClass(); $itemsCount[$i]->value = $key; $itemsCount[$i]->text = $key; $itemsStart[$i] = new StdClass(); $itemsStart[$i]->value = $key; $itemsStart[$i]->text = $key; $i++; } // Don't display it if no category is selected if ($i > 0) { $itemsCount[$i] = new StdClass(); $itemsCount[$i]->value = (int) $key + 1; $itemsCount[$i]->text = (int) $key + 1; } $categoryId = $app->input->get('filter_catid', 0, 'int'); $categoryIdList = $app->getUserStateFromRequest($this->_context . '.filter_catid', 'filter_catid', 0, 'int'); if ((int) $categoryId == 0 && $categoryIdList == 0) { $itemsCount = $itemsStart = array(); } $lists['limitstartparam'] = JHtml::_('select.genericlist', $itemsStart, 'limitstartparam', '', 'value', 'text', ''); $lists['limitcountparam'] = JHtml::_('select.genericlist', $itemsCount, 'limitcountparam', '', 'value', 'text', ''); $this->assignRef('lists', $lists); parent::display('images'); break; case 3: $this->assignRef('lists', $lists); parent::display('switchimage'); break; case 4: $this->assignRef('lists', $lists); parent::display('slideshow'); break; case 1: default: $this->assignRef('lists', $lists); parent::display($tpl); break; } }
function setMarker($id, $title, $description, $latitude, $longitude, $icon = 0, $text = '') { jimport('joomla.filter.output'); phocagalleryimport('phocagallery.text.text'); $output = ''; if ($text == '') { if ($title != '') { $text .= '<h1>' . addslashes($title) . '</h1>'; } if ($description != '') { $text .= '<div>' . PhocaGalleryText::strTrimAll(addslashes($description)) . '</div>'; } } $output .= 'var phocaPoint' . $id . ' = new google.maps.LatLng(' . $latitude . ', ' . $longitude . ');' . "\n"; $output .= 'var markerPhocaMarker' . $id . ' = new google.maps.Marker({title:"' . $title . '"'; if ($icon == 1) { $output .= ', icon:phocaImage'; $output .= ', shadow:phocaImageShadow'; $output .= ', shape:phocaImageShape'; } $output .= ', position: phocaPoint' . $id; $output .= ', map: ' . $this->_map; $output .= '});' . "\n"; $output .= 'var infoPhocaWindow' . $id . ' = new google.maps.InfoWindow({' . "\n" . ' content: \'' . $text . '\'' . "\n" . '});' . "\n"; $output .= 'google.maps.event.addListener(markerPhocaMarker' . $id . ', \'click\', function() {' . "\n" . ' infoPhocaWindow' . $id . '.open(' . $this->_map . ', markerPhocaMarker' . $id . ' );' . "\n" . ' });' . "\n"; return $output; }
<?php /* * @package Joomla * @copyright Copyright (C) Open Source Matters. All rights reserved. * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php * @component Phoca Gallery * @copyright Copyright (C) Jan Pavelka www.phoca.cz * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL */ defined('_JEXEC') or die; jimport('joomla.application.component.view'); phocagalleryimport('phocagallery.rate.ratecategory'); class PhocaGalleryCpViewPhocaGalleryCs extends JViewLegacy { protected $items; protected $pagination; protected $state; protected $tmpl; //protected $_context = 'com_phocagallery.phocagalleryc'; function display($tpl = null) { $this->items = $this->get('Items'); $this->pagination = $this->get('Pagination'); $this->state = $this->get('State'); // Preprocess the list of items to find ordering divisions. foreach ($this->items as &$item) { $this->ordering[$item->parent_id][] = $item->id; } /* * We need to load all items because of creating tree
<?php /* * @package Joomla 1.5 * @copyright Copyright (C) 2005 Open Source Matters. All rights reserved. * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php * * @component Phoca Gallery * @copyright Copyright (C) Jan Pavelka www.phoca.cz * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL */ defined('_JEXEC') or die('Restricted access'); jimport('joomla.filesystem.folder'); jimport('joomla.filesystem.file'); phocagalleryimport('phocagallery.image.image'); phocagalleryimport('phocagallery.path.path'); class PhocaGalleryFileFolder { /* * Clear Thumbs folder - if there are files in the thumbs directory but not original files e.g.: * phoca_thumbs_l_some.jpg exists in thumbs directory but some.jpg doesn't exists - delete it */ public static function cleanThumbsFolder() { //Get folder variables from Helper $path = PhocaGalleryPath::getPath(); // Initialize variables $pathOrigImg = $path->image_abs; $pathOrigImgServer = str_replace(DS, '/', $path->image_abs); // Get the list of files and folders from the given folder $fileList = JFolder::files($pathOrigImg, '', true, true);
/* * @package Joomla 1.5 * @copyright Copyright (C) 2005 Open Source Matters. All rights reserved. * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php * * @component Phoca Component * @copyright Copyright (C) Jan Pavelka www.phoca.cz * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL */ // Check to ensure this file is included in Joomla! defined('_JEXEC') or die; jimport('joomla.application.component.view'); phocagalleryimport('phocagallery.ordering.ordering'); phocagalleryimport('phocagallery.picasa.picasa'); phocagalleryimport('phocagallery.facebook.fbsystem'); class PhocaGalleryViewFeed extends JView { function display($tpl = null) { $app = JFactory::getApplication(); $user = JFactory::getUser(); $userLevels = implode(',', $user->authorisedLevels()); $db =& JFactory::getDBO(); //$menu = &JSite::getMenu(); $menu = JFactory::getApplication()->getMenu(); $document =& JFactory::getDocument(); $params = $app->getParams(); // Specific category $id = JRequest::getVar('id', 0, '', 'int'); // Params
public function renderMosaic($images, $size = 0, $extImg = 0, $w = 100, $h = 100) { $o = ''; phocagalleryimport('phocagallery.file.filethumbnail'); $count = count($images); $m1 = mt_rand(0, 1); switch ($count) { case 1: $a = 1; //array(1); break; case 2: $a = 2; //array(2); break; case 3: $at = array(3, 4); $ar = array_rand($at); $a = $at[$ar]; break; case 4: $at = array(3, 4, 5); $ar = array_rand($at); $a = $at[$ar]; break; case 5: $at = array(3, 4, 5, 6, 7); $ar = array_rand($at); $a = $at[$ar]; break; } $i = self::getMosaicFields($a, $images, $size, $extImg, $w, $h); $m2 = mt_rand(0, 1); $o .= '<div style="width: ' . $i['w'] . 'px; height: ' . $i['h'] . 'px">'; if ($m2 == 1) { $o .= '<div style="float:left;width:' . $i['w1'] . 'px;">'; $o .= $i['b1']; $o .= '</div>'; $o .= '<div style="float:left;width:' . $i['w2'] . 'px;">'; $o .= $i['b2']; $o .= '</div>'; } else { $o .= '<div style="float:right;width:' . $i['w1'] . 'px;">'; $o .= $i['b1']; $o .= '</div>'; $o .= '<div style="float:right;width:' . $i['w2'] . 'px;">'; $o .= $i['b2']; $o .= '</div>'; } $o .= '</div>'; return $o; }
<?php /* * @package Joomla 1.5 * @copyright Copyright (C) 2005 Open Source Matters. All rights reserved. * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php * * @component Phoca Gallery * @copyright Copyright (C) Jan Pavelka www.phoca.cz * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL */ defined('_JEXEC') or die; jimport('joomla.application.component.model'); phocagalleryimport('phocagallery.access.access'); phocagalleryimport('phocagallery.ordering.ordering'); class PhocagalleryModelComment extends JModel { function __construct() { parent::__construct(); $id = JRequest::getVar('id', 0, '', 'int'); $this->setId((int) $id); } function setId($id) { $this->_id = $id; $this->_data = null; } function &getData() { if (!$this->_loadData()) {
<?php /* * @package Joomla.Framework * @copyright Copyright (C) 2005 - 2010 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt * * @component Phoca Component * @copyright Copyright (C) Jan Pavelka www.phoca.cz * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License version 2 or later; */ defined('_JEXEC') or die; jimport('joomla.application.component.view'); phocagalleryimport('phocagallery.access.access'); phocagalleryimport('phocagallery.rate.ratecategory'); phocagalleryimport('phocagallery.facebook.api'); class PhocaGalleryCpViewPhocaGalleryC extends JViewLegacy { protected $state; protected $item; protected $form; protected $tmpl; public function display($tpl = null) { $this->state = $this->get('State'); $this->form = $this->get('Form'); $this->item = $this->get('Item'); //$this->item->accessuserid = PhocaGalleryUtils::toArray($this->item->accessuserid); //$this->item->accessuserid = explode(',', $this->item->accessuserid); $mainframe = JFactory::getApplication(); $db = JFactory::getDBO();
function _buildQuery() { $app = JFactory::getApplication(); $user = JFactory::getUser(); $gid = $user->get('aid', 0); // Filter by language $whereLang = ''; if ($this->getState('filter.language')) { $whereLang = ' AND cc.language IN (' . $this->_db->Quote(JFactory::getLanguage()->getTag()) . ',' . $this->_db->Quote('*') . ')'; } // Params $params = $app->getParams(); $display_subcategories = $params->get('display_subcategories', 1); //$show_empty_categories= $params->get( 'display_empty_categories', 0 ); //$hide_categories = $params->get( 'hide_categories', '' ); $catOrdering = PhocaGalleryOrdering::getOrderingString($this->getState('catordering'), 2); // Display or hide subcategories in CATEGORIES VIEW $hideSubCatSql = ''; if ((int) $display_subcategories != 1) { $hideSubCatSql = ' AND cc.parent_id = 0'; } // Get all categories which should be hidden /*$hideCatArray = explode( ',', trim( $hide_categories ) ); $hideCatSql = ''; if (is_array($hideCatArray)) { foreach ($hideCatArray as $value) { $hideCatSql .= ' AND cc.id != '. (int) trim($value) .' '; } }*/ //Display or hide empty categories /* $emptyCat = ''; if ($show_empty_categories != 1) { $emptyCat = ' AND a.published = 1'; }*/ phocagalleryimport('phocagallery.ordering.ordering'); //$categoryOrdering = PhocaGalleryOrdering::getOrderingString($category_ordering, 2); $query = 'SELECT cc.*, a.catid, COUNT(a.id) AS numlinks, u.username AS username, r.count AS ratingcount, r.average AS ratingaverage, uc.avatar AS avatar, uc.approved AS avatarapproved, uc.published AS avatarpublished, a.filename, a.exts, a.extm, a.extw, a.exth,' . ' CASE WHEN CHAR_LENGTH(cc.alias) THEN CONCAT_WS(\':\', cc.id, cc.alias) ELSE cc.id END as slug' . ' FROM #__phocagallery_categories AS cc' . ' LEFT JOIN #__phocagallery AS a ON a.catid = cc.id and a.published = 1' . ' LEFT JOIN #__phocagallery_user AS uc ON uc.userid = cc.owner_id' . ' LEFT JOIN #__users AS u ON u.id = cc.owner_id' . ' LEFT JOIN #__phocagallery_votes_statistics AS r ON r.catid = cc.id' . ' WHERE cc.published = 1' . ' AND cc.approved = 1' . $whereLang . $hideSubCatSql . ' GROUP BY cc.id' . $catOrdering['output']; return $query; }
<?php /* * @package Joomla.Framework * @copyright Copyright (C) 2005 - 2010 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt * * @component Phoca Component * @copyright Copyright (C) Jan Pavelka www.phoca.cz * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License version 2 or later; */ defined('_JEXEC') or die('Restricted access'); jimport('joomla.filesystem.folder'); jimport('joomla.filesystem.file'); phocagalleryimport('phocagallery.image.image'); phocagalleryimport('phocagallery.file.fileuploadfront'); class PhocaGalleryFileUpload { public static function realMultipleUpload($frontEnd = 0) { $paramsC = JComponentHelper::getParams('com_phocagallery'); $chunkMethod = $paramsC->get('multiple_upload_chunk', 0); $uploadMethod = $paramsC->get('multiple_upload_method', 1); JResponse::allowCache(false); // Chunk Files header('Content-type: text/plain; charset=UTF-8'); header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); header("Cache-Control: no-store, no-cache, must-revalidate"); header("Cache-Control: post-check=0, pre-check=0", false); header("Pragma: no-cache");
function rate($data) { $row =& $this->getTable('phocagalleryvotes', 'Table'); if (!$row->bind($data)) { $this->setError($this->_db->getErrorMsg()); return false; } $row->date = gmdate('Y-m-d H:i:s'); $row->published = 1; if (!$row->id) { $where = 'catid = ' . (int) $row->catid; $row->ordering = $row->getNextOrder($where); } if (!$row->check()) { $this->setError($this->_db->getErrorMsg()); return false; } if (!$row->store()) { $this->setError($this->_db->getErrorMsg()); return false; } // Update the Vote Statistics phocagalleryimport('phocagallery.rate.ratecategory'); if (!PhocaGalleryRateCategory::updateVoteStatistics($data['catid'])) { return false; } return true; }
<?php /* * @package Joomla.Framework * @copyright Copyright (C) 2005 - 2010 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt * * @component Phoca Component * @copyright Copyright (C) Jan Pavelka www.phoca.cz * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License version 2 or later; */ defined('_JEXEC') or die; if (!class_exists('PhocaGalleryLoader')) { require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_phocagallery' . DS . 'libraries' . DS . 'loader.php'; } phocagalleryimport('phocagallery.render.renderadmin'); class JFormFieldPhocaSelectFbUser extends JFormField { protected $type = 'PhocaSelectFbUser'; protected function getInput() { $db =& JFactory::getDBO(); //build the list of categories $query = 'SELECT a.id AS value, ' . ' CASE WHEN CHAR_LENGTH(a.name) THEN a.name ELSE a.appid END as text' . ' FROM #__phocagallery_fb_users AS a' . ' WHERE a.published = 1' . ' ORDER BY a.ordering'; $db->setQuery($query); $items = $db->loadObjectList(); // TODO - check for other views than category edit /*$view = JRequest::getVar( 'view' ); $catId = -1; if ($view == 'phocagalleryc') { $id = $this->form->getValue('id'); // id of current category
<?php /* * @package Joomla.Framework * @copyright Copyright (C) 2005 - 2010 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt * * @component Phoca Component * @copyright Copyright (C) Jan Pavelka www.phoca.cz * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License version 2 or later; */ defined('_JEXEC') or die; jimport('joomla.application.component.view'); jimport('joomla.client.helper'); phocagalleryimport('phocagallery.image.image'); class PhocaGalleryCpViewPhocaGalleryT extends JViewLegacy { protected $require_ftp; protected $theme_name; protected $files; public function display($tpl = null) { $document = JFactory::getDocument(); JHTML::stylesheet('media/com_phocagallery/css/administrator/phocagallery.css'); JHTML::stylesheet('administrator/components/com_phocagallery/assets/jcp/picker.css'); $document->addScript(JURI::base(true) . '/components/com_phocagallery/assets/jcp/picker.js'); $this->require_ftp = JClientHelper::setCredentialsFromRequest('ftp'); $this->files = $this->get('Files'); $this->form = $this->get('Form'); if ($this->themeName()) { $this->theme_name = $this->themeName();
function display($tpl = null) { $app = JFactory::getApplication(); $document =& JFactory::getDocument(); $this->params = $app->getParams(); $user =& JFactory::getUser(); $var['slideshow'] = JRequest::getVar('phocaslideshow', 0, '', 'int'); $var['download'] = JRequest::getVar('phocadownload', 0, '', 'int'); $uri =& JFactory::getURI(); $this->tmpl['action'] = $uri->toString(); $path = PhocaGalleryPath::getPath(); $neededAccessLevels = PhocaGalleryAccess::getNeededAccessLevels(); $access = PhocaGalleryAccess::isAccess($user->authorisedLevels(), $neededAccessLevels); // Information from the plugin - window is displayed after plugin action $get = array(); $get['detail'] = JRequest::getVar('detail', '', 'get', 'string'); $get['buttons'] = JRequest::getVar('buttons', '', 'get', 'string'); $get['ratingimg'] = JRequest::getVar('ratingimg', '', 'get', 'string'); $this->tmpl['picasa_correct_width_l'] = (int) $this->params->get('large_image_width', 640); $this->tmpl['picasa_correct_height_l'] = (int) $this->params->get('large_image_height', 480); $this->tmpl['enablecustomcss'] = $this->params->get('enable_custom_css', 0); $this->tmpl['customcss'] = $this->params->get('custom_css', ''); $this->tmpl['enable_multibox'] = $this->params->get('enable_multibox', 0); $this->tmpl['multibox_height'] = (int) $this->params->get('multibox_height', 560); $this->tmpl['multibox_width'] = (int) $this->params->get('multibox_width', 980); $this->tmpl['multibox_map_height'] = (int) $this->params->get('multibox_map_height', 300); $this->tmpl['multibox_map_width'] = (int) $this->params->get('multibox_map_width', 280); $this->tmpl['multibox_height_overflow'] = (int) $this->tmpl['multibox_height'] - 10; //padding $this->tmpl['multibox_left_bgcolor'] = $this->params->get('multibox_left_bgcolor', '#000000'); $this->tmpl['multibox_right_bgcolor'] = $this->params->get('multibox_right_bgcolor', '#ffffff'); $this->tmpl['multibox_comments_width'] = $this->params->get('multibox_comments_width', 300); $this->tmpl['multibox_comments_height'] = $this->params->get('multibox_comments_height', 600); $this->tmpl['multibox_thubms_box_width'] = $this->params->get('multibox_thubms_box_width', 300); $this->tmpl['multibox_thubms_count'] = $this->params->get('multibox_thubms_count', 4); $this->tmpl['large_image_width'] = $this->params->get('large_image_width', 640); $this->tmpl['large_image_height'] = $this->params->get('large_image_height', 640); $this->tmpl['multibox_fixed_cols'] = $this->params->get('multibox_fixed_cols', 1); $this->tmpl['display_multibox'] = $this->params->get('display_multibox', array(1, 2)); // CSS JHtml::stylesheet('components/com_phocagallery/assets/phocagallery.css'); if ($this->tmpl['enablecustomcss'] == 1) { JHtml::stylesheet('components/com_phocagallery/assets/phocagallerycustom.css'); PhocaGalleryRenderFront::displayCustomCSS($this->tmpl['customcss']); } // Plugin information $this->tmpl['detailwindow'] = $this->params->get('detail_window', 0); if (isset($get['detail']) && $get['detail'] != '') { $this->tmpl['detailwindow'] = $get['detail']; } // Plugin information $this->tmpl['detailbuttons'] = $this->params->get('detail_buttons', 1); if (isset($get['buttons']) && $get['buttons'] != '') { $this->tmpl['detailbuttons'] = $get['buttons']; } // Close and Reload links (for different window types) $close = PhocaGalleryRenderFront::renderCloseReloadDetail($this->tmpl['detailwindow']); $this->tmpl['detailwindowclose'] = $close['detailwindowclose']; $this->tmpl['detailwindowreload'] = $close['detailwindowreload']; $this->tmpl['displaydescriptiondetail'] = $this->params->get('display_description_detail', 0); $this->tmpl['displaytitleindescription'] = $this->params->get('display_title_description', 0); $this->tmpl['descriptiondetailheight'] = $this->params->get('description_detail_height', 16); $this->tmpl['fontsizedesc'] = $this->params->get('font_size_desc', 11); $this->tmpl['fontcolordesc'] = $this->params->get('font_color_desc', '#333333'); $this->tmpl['detailwindowbackgroundcolor'] = $this->params->get('detail_window_background_color', '#ffffff'); $this->tmpl['descriptionlightboxfontcolor'] = $this->params->get('description_lightbox_font_color', '#ffffff'); $this->tmpl['descriptionlightboxbgcolor'] = $this->params->get('description_lightbox_bg_color', '#000000'); $this->tmpl['descriptionlightboxfontsize'] = $this->params->get('description_lightbox_font_size', 12); $this->tmpl['displayratingimg'] = $this->params->get('display_rating_img', 0); $this->tmpl['displayicondownload'] = $this->params->get('display_icon_download', 0); $this->tmpl['externalcommentsystem'] = $this->params->get('external_comment_system', 0); $this->tmpl['largewidth'] = $this->params->get('large_image_width', 640); $this->tmpl['largeheight'] = $this->params->get('large_image_height', 480); $this->tmpl['boxlargewidth'] = $this->params->get('front_modal_box_width', 680); $this->tmpl['boxlargeheight'] = $this->params->get('front_modal_box_height', 560); $this->tmpl['slideshow_delay'] = $this->params->get('slideshow_delay', 3000); $this->tmpl['slideshow_pause'] = $this->params->get('slideshow_pause', 2500); $this->tmpl['slideshowrandom'] = $this->params->get('slideshow_random', 0); $this->tmpl['slideshow_description'] = $this->params->get('slideshow_description', 'peekaboo'); $this->tmpl['gallerymetakey'] = $this->params->get('gallery_metakey', ''); $this->tmpl['gallerymetadesc'] = $this->params->get('gallery_metadesc', ''); $this->tmpl['altvalue'] = $this->params->get('alt_value', 1); $this->tmpl['enablecustomcss'] = $this->params->get('enable_custom_css', 0); $this->tmpl['customcss'] = $this->params->get('custom_css', ''); $this->tmpl['display_tags_links'] = $this->params->get('display_tags_links', 0); $this->tmpl['ytb_display'] = $this->params->get('ytb_display', 0); $paramsFb = PhocaGalleryFbSystem::getCommentsParams($this->params->get('fb_comment_user_id', '')); // Facebook $this->tmpl['fb_comment_app_id'] = isset($paramsFb['fb_comment_app_id']) ? $paramsFb['fb_comment_app_id'] : ''; $this->tmpl['fb_comment_width'] = isset($paramsFb['fb_comment_width']) ? $paramsFb['fb_comment_width'] : 550; $this->tmpl['fb_comment_lang'] = isset($paramsFb['fb_comment_lang']) ? $paramsFb['fb_comment_lang'] : 'en_US'; $this->tmpl['fb_comment_count'] = isset($paramsFb['fb_comment_count']) ? $paramsFb['fb_comment_count'] : ''; $oH = ''; if ($this->tmpl['enable_multibox'] == 1) { $this->tmpl['fb_comment_width'] = $this->tmpl['multibox_comments_width']; $oH = 'overflow:hidden;'; } // CSS JHtml::stylesheet('components/com_phocagallery/assets/phocagallery.css'); if ($this->tmpl['enablecustomcss'] == 1) { JHtml::stylesheet('components/com_phocagallery/assets/phocagallerycustom.css'); if ($this->tmpl['customcss'] != '') { $document->addCustomTag("\n <style type=\"text/css\"> \n" . $this->escape(strip_tags($this->tmpl['customcss'])) . "\n </style> \n"); } } //Multibox displaying $this->tmpl['mb_title'] = PhocaGalleryUtils::isEnabledMultiboxFeature(1); $this->tmpl['mb_desc'] = PhocaGalleryUtils::isEnabledMultiboxFeature(2); $this->tmpl['mb_uploaded_by'] = PhocaGalleryUtils::isEnabledMultiboxFeature(3); $this->tmpl['mb_rating'] = PhocaGalleryUtils::isEnabledMultiboxFeature(4); $this->tmpl['mb_maps'] = PhocaGalleryUtils::isEnabledMultiboxFeature(5); $this->tmpl['mb_tags'] = PhocaGalleryUtils::isEnabledMultiboxFeature(6); $this->tmpl['mb_comments'] = PhocaGalleryUtils::isEnabledMultiboxFeature(7); $this->tmpl['mb_thumbs'] = PhocaGalleryUtils::isEnabledMultiboxFeature(8); // No bar in Detail View if ($this->tmpl['detailwindow'] == 7) { } else { $document->addCustomTag("<style type=\"text/css\"> \n" . " html, body, .contentpane, #all, #main {" . $oH . "background:" . $this->tmpl['detailwindowbackgroundcolor'] . ";padding:0px !important;margin:0px !important; width: 100% !important; max-width: 100% !important;} \n" . " center, table {background:" . $this->tmpl['detailwindowbackgroundcolor'] . ";} \n" . " #sbox-window {background-color:#fff;padding:5px} \n" . "body {min-width:100%} \n" . ".rt-container {width:100%} \n" . " </style> \n"); } // Download from the detail view which is not in the popupbox if ($var['download'] == 2) { $this->tmpl['displayicondownload'] = 2; } // Plugin Information if (isset($get['ratingimg']) && $get['ratingimg'] != '') { $this->tmpl['displayratingimg'] = $get['ratingimg']; } // Model $model =& $this->getModel(); $item = $model->getData(); //Multibox Thumbnails $this->tmpl['mb_thumbs_data'] = ''; if ($this->tmpl['mb_thumbs'] == 1) { // if we get item variable, we have rights to load the thumbnails, this is why we checking it if (isset($item->id) && isset($item->catid) && (int) $item->id > 0 && (int) $item->catid > 0) { $this->tmpl['mb_thumbs_data'] = $model->getThumbnails((int) $item->id, (int) $item->catid, (int) $item->ordering); } } // User Avatar $this->tmpl['useravatarimg'] = ''; $this->tmpl['useravatarmiddle'] = ''; $userAvatar = PhocaGalleryUser::getUserAvatar($item->userid); if ($userAvatar) { $pathAvatarAbs = $path->avatar_abs . 'thumbs' . DS . 'phoca_thumb_s_' . $userAvatar->avatar; $pathAvatarRel = $path->avatar_rel . 'thumbs/phoca_thumb_s_' . $userAvatar->avatar; if (JFile::exists($pathAvatarAbs)) { $sIH = $this->params->get('small_image_height', 50); $sIHR = @getImageSize($pathAvatarAbs); if (isset($sIHR[1])) { $sIH = $sIHR[1]; } if ((int) $sIH > 0) { $this->tmpl['useravatarmiddle'] = (int) $sIH / 2 - 10; } $this->tmpl['useravatarimg'] = '<img src="' . JURI::base(true) . '/' . $pathAvatarRel . '?imagesid=' . md5(uniqid(time())) . '" alt="" />'; } } // Access check - don't display the image if you have no access to this image (if user add own url) // USER RIGHT - ACCESS - - - - - - - - - - $rightDisplay = 0; if (!empty($item)) { $rightDisplay = PhocaGalleryAccess::getUserRight('accessuserid', $item->cataccessuserid, $item->cataccess, $user->authorisedLevels(), $user->get('id', 0), 0); } if ((int) $rightDisplay == 0) { echo $close['html']; //Some problem with cache - Joomla! return this message if there is no reason for do it. //$this->tmpl['pl'] = 'index.php?option=com_users&view=login&return='.base64_encode($uri->toString()); //$app->redirect(JRoute::_($this->tmpl['pl'], false), JText::_('COM_PHOCAGALLERY_NOT_AUTHORISED_ACTION')); exit; } // - - - - - - - - - - - - - - - - - - - - phocagalleryimport('phocagallery.image.image'); phocagalleryimport('phocagallery.render.renderdetailbutton'); // Javascript Slideshow buttons $detailButton = new PhocaGalleryRenderDetailButton(); if ($this->tmpl['enable_multibox'] == 1) { $detailButton->setType('multibox'); } $item->reloadbutton = $detailButton->getReload($item->catslug, $item->slug); $item->closebutton = $detailButton->getClose($item->catslug, $item->slug); $item->closetext = $detailButton->getCloseText($item->catslug, $item->slug); $item->nextbutton = $detailButton->getNext((int) $item->catid, (int) $item->id, (int) $item->ordering); $item->nextbuttonhref = $detailButton->getNext((int) $item->catid, (int) $item->id, (int) $item->ordering, 1); $item->prevbutton = $detailButton->getPrevious((int) $item->catid, (int) $item->id, (int) $item->ordering); $slideshowData = $detailButton->getJsSlideshow((int) $item->catid, (int) $item->id, (int) $var['slideshow'], $item->catslug, $item->slug); $item->slideshowbutton = $slideshowData['icons']; $item->slideshowfiles = $slideshowData['files']; $item->slideshow = $var['slideshow']; $item->download = $var['download']; // ALT VALUE $altValue = PhocaGalleryRenderFront::getAltValue($this->tmpl['altvalue'], $item->title, $item->description, $item->metadesc); $item->altvalue = $altValue; // Get file thumbnail or No Image $item->filenameno = $item->filename; $item->filename = PhocaGalleryFile::getTitleFromFile($item->filename, 1); $item->filesize = PhocaGalleryFile::getFileSize($item->filenameno); $realImageSize = ''; $extImage = PhocaGalleryImage::isExtImage($item->extid); if ($extImage) { $item->extl = $item->extl; $item->exto = $item->exto; $realImageSize = PhocaGalleryImage::getRealImageSize($item->extl, '', 1); $item->imagesize = PhocaGalleryImage::getImageSize($item->exto, 1, 1); if ($item->extw != '') { $extw = explode(',', $item->extw); $item->extw = $extw[0]; } $correctImageRes = PhocaGalleryPicasa::correctSizeWithRate($item->extw, $item->exth, $this->tmpl['picasa_correct_width_l'], $this->tmpl['picasa_correct_height_l']); $item->linkimage = JHtml::_('image', $item->extl, $item->altvalue, array('width' => $correctImageRes['width'], 'height' => $correctImageRes['height'], 'class' => 'pg-detail-image')); $item->realimagewidth = $correctImageRes['width']; $item->realimageheight = $correctImageRes['height']; } else { $item->linkthumbnailpath = PhocaGalleryImageFront::displayCategoryImageOrNoImage($item->filenameno, 'large'); $item->linkimage = JHtml::_('image', $item->linkthumbnailpath, $item->altvalue, array('class' => 'pg-detail-image')); $realImageSize = PhocaGalleryImage::getRealImageSize($item->filenameno); $item->imagesize = PhocaGalleryImage::getImageSize($item->filenameno, 1); if (isset($realImageSize['w']) && isset($realImageSize['h'])) { $item->realimagewidth = $realImageSize['w']; $item->realimageheight = $realImageSize['h']; } else { $item->realimagewidth = $this->tmpl['largewidth']; $item->realimageheight = $this->tmpl['largeheight']; } } // Add Statistics $model->hit(JRequest::getVar('id', '', '', 'int')); // R A T I N G // Only registered (VOTES + COMMENTS) $this->tmpl['notregisteredimg'] = true; $this->tmpl['usernameimg'] = ''; if ($access > 0) { $this->tmpl['notregisteredimg'] = false; $this->tmpl['usernameimg'] = $user->name; } // VOTES Statistics Img if ((int) $this->tmpl['displayratingimg'] == 1 || $this->tmpl['mb_rating']) { $this->tmpl['votescountimg'] = 0; $this->tmpl['votesaverageimg'] = 0; $this->tmpl['voteswidthimg'] = 0; $votesStatistics = PhocaGalleryRateImage::getVotesStatistics((int) $item->id); if (!empty($votesStatistics->count)) { $this->tmpl['votescountimg'] = $votesStatistics->count; } if (!empty($votesStatistics->average)) { $this->tmpl['votesaverageimg'] = $votesStatistics->average; if ($this->tmpl['votesaverageimg'] > 0) { $this->tmpl['votesaverageimg'] = round((double) $this->tmpl['votesaverageimg'] / 0.5) * 0.5; $this->tmpl['voteswidthimg'] = 22 * $this->tmpl['votesaverageimg']; } else { $this->tmpl['votesaverageimg'] = (int) 0; // not float displaying } } if ((int) $this->tmpl['votescountimg'] > 1) { $this->tmpl['votestextimg'] = 'COM_PHOCAGALLERY_VOTES'; } else { $this->tmpl['votestextimg'] = 'COM_PHOCAGALLERY_VOTE'; } // Already rated? $this->tmpl['alreadyratedimg'] = PhocaGalleryRateImage::checkUserVote((int) $item->id, (int) $user->id); } // Tags $this->tmpl['displaying_tags_output'] = ''; if ($this->tmpl['display_tags_links'] == 1 || $this->tmpl['display_tags_links'] == 3 || $this->tmpl['mb_tags']) { if ($this->tmpl['detailwindow'] == 7) { $this->tmpl['displaying_tags_output'] = PhocaGalleryTag::displayTags($item->id); } else { $this->tmpl['displaying_tags_output'] = PhocaGalleryTag::displayTags($item->id, 1); } } // Back button $this->tmpl['backbutton'] = ''; if ($this->tmpl['detailwindow'] == 7) { phocagalleryimport('phocagallery.image.image'); $formatIcon =& PhocaGalleryImage::getFormatIcon(); $this->tmpl['backbutton'] = '<div><a href="' . JRoute::_('index.php?option=com_phocagallery&view=category&id=' . $item->catslug . '&Itemid=' . JRequest::getVar('Itemid', 0, '', 'int')) . '"' . ' title="' . JText::_('COM_PHOCAGALLERY_BACK_TO_CATEGORY') . '">' . JHtml::_('image', 'components/com_phocagallery/assets/images/icon-up-images.' . $formatIcon, JText::_('COM_PHOCAGALLERY_BACK_TO_CATEGORY')) . '</a></div>'; } // ASIGN $this->assignRef('tmpl', $this->tmpl); $this->assignRef('item', $item); $this->_prepareDocument($item); if ($this->tmpl['enable_multibox'] == 1) { if ($item->download > 0) { if ($this->tmpl['displayicondownload'] == 2) { $backLink = 'index.php?option=com_phocagallery&view=category&id=' . $item->catslug . '&Itemid=' . JRequest::getVar('Itemid', 0, '', 'int'); phocagalleryimport('phocagallery.file.filedownload'); if (isset($item->exto) && $item->exto != '') { PhocaGalleryFileDownload::download($item, $backLink, 1); } else { PhocaGalleryFileDownload::download($item, $backLink); } exit; } else { parent::display('multibox'); //parent::display('download'); } } else { if (isset($item->videocode) && $item->videocode != '' && $item->videocode != '0') { $item->videocode = PhocaGalleryYoutube::displayVideo($item->videocode); } parent::display('multibox'); } } else { if (isset($item->videocode) && $item->videocode != '' && $item->videocode != '0') { $item->videocode = PhocaGalleryYoutube::displayVideo($item->videocode); if ($this->tmpl['detailwindow'] != 7 && $this->tmpl['ytb_display'] == 1) { $document->addCustomTag("<style type=\"text/css\"> \n" . " html, body, .contentpane, div#all, div#main, div#system-message-container {padding: 0px !important;margin: 0px !important;} \n" . " div#sbox-window {background-color:#fff;padding: 0px;margin: 0px;} \n" . " </style> \n"); } parent::display('video'); } else { parent::display('slideshowjs'); if ($item->slideshow == 1) { parent::display('slideshow'); } else { if ($item->download > 0) { if ($this->tmpl['displayicondownload'] == 2) { $backLink = 'index.php?option=com_phocagallery&view=category&id=' . $item->catslug . '&Itemid=' . JRequest::getVar('Itemid', 0, '', 'int'); phocagalleryimport('phocagallery.file.filedownload'); if (isset($item->exto) && $item->exto != '') { PhocaGalleryFileDownload::download($item, $backLink, 1); } else { PhocaGalleryFileDownload::download($item, $backLink); } exit; } else { parent::display('download'); } } else { parent::display($tpl); } } } } }
<?php /* * @package Joomla.Framework * @copyright Copyright (C) 2005 - 2010 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt * * @component Phoca Component * @copyright Copyright (C) Jan Pavelka www.phoca.cz * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License version 2 or later; */ defined('_JEXEC') or die; jimport('joomla.application.component.controllerform'); jimport('joomla.client.helper'); phocagalleryimport('phocagallery.youtube.youtube'); class PhocaGalleryCpControllerPhocaGalleryYtb extends JControllerForm { //protected $option = 'com_phocagallery'; protected $context = 'com_phocagallery.phocagalleryytjjb'; function __construct() { parent::__construct(); $this->registerTask('import', 'import'); } function import() { JRequest::checkToken() or die('Invalid Token'); $app = JFactory::getApplication(); //$post = JRequest::get('post'); $ytb_link = JRequest::getVar('ytb_link', '', 'post', 'string', JREQUEST_NOTRIM); $field = JRequest::getVar('field', '', 'post', 'string', JREQUEST_NOTRIM);
/* * @package Joomla.Framework * @copyright Copyright (C) 2005 - 2010 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt * * @component Phoca Component * @copyright Copyright (C) Jan Pavelka www.phoca.cz * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License version 2 or later; */ defined('_JEXEC') or die; jimport('joomla.client.helper'); jimport('joomla.application.component.view'); jimport('joomla.html.pane'); phocagalleryimport('phocagallery.file.fileuploadmultiple'); phocagalleryimport('phocagallery.file.fileuploadsingle'); phocagalleryimport('phocagallery.file.fileuploadjava'); class PhocaGalleryCpViewPhocagalleryI extends JViewLegacy { protected $field; protected $fce; protected $folderstate; protected $images; protected $folders; protected $tmpl; protected $session; protected $currentFolder; public function display($tpl = null) { $this->field = JRequest::getVar('field'); $this->fce = 'phocaSelectFileName_' . $this->field; JHTML::stylesheet('media/com_phocagallery/css/administrator/phocagallery.css');
function delete($cid = array()) { if (count($cid)) { JArrayHelper::toInteger($cid); $cids = implode(',', $cid); //Select affected catids $query = 'SELECT v.imgid AS imgid' . ' FROM #__phocagallery_img_votes AS v' . ' WHERE v.id IN ( ' . $cids . ' )'; $images = $this->_getList($query); //Delete it from DB $query = 'DELETE FROM #__phocagallery_img_votes' . ' WHERE id IN ( ' . $cids . ' )'; $this->_db->setQuery($query); if (!$this->_db->query()) { $this->setError($this->_db->getErrorMsg()); return false; } phocagalleryimport('phocagallery.rate.rateimage'); foreach ($images as $valueImgId) { $updated = PhocaGalleryRateImage::updateVoteStatistics($valueImgId->imgid); if (!$updated) { return false; } } } return true; }