本文整理汇总了PHP中phocagalleryimport函数的典型用法代码示例。如果您正苦于以下问题:PHP phocagalleryimport函数的具体用法?PHP phocagalleryimport怎么用?PHP phocagalleryimport使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了phocagalleryimport函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: download
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;
}
示例2: getRealImageSize
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;
}
示例3: display
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);
}
示例4: defined
<?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";
示例5: display
//.........这里部分代码省略.........
}
$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);
}
}
示例6: defined
*
* @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();
示例7: defined
<?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');
示例8: comment
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);
}
示例9: display
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 = '';
}
//.........这里部分代码省略.........
示例10: defined
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();
示例11: createFileThumbnail
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;
}
}
示例12: defined
<?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');
}
}
示例13: comment
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));
}
示例14: display
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');
//.........这里部分代码省略.........
示例15: setMarker
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;
}