primo commit
This commit is contained in:
11
administrator/components/com_phocagallery/access.xml
Normal file
11
administrator/components/com_phocagallery/access.xml
Normal file
@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<access component="com_phocagallery">
|
||||
<section name="component">
|
||||
<action name="core.admin" title="JAction_Admin" description="JAction_Admin_Component_Desc" />
|
||||
<action name="core.manage" title="JAction_Manage" description="JAction_Manage_Component_Desc" />
|
||||
<action name="core.create" title="JAction_Create" description="JAction_Create_Component_Desc" />
|
||||
<action name="core.delete" title="JAction_Delete" description="JAction_Delete_Component_Desc" />
|
||||
<action name="core.edit" title="JAction_Edit" description="JAction_Edit_Component_Desc" />
|
||||
<action name="core.edit.state" title="JACTION_EDITSTATE" description="JAction_EditState_Component_Desc" />
|
||||
</section>
|
||||
</access>
|
||||
1094
administrator/components/com_phocagallery/config.xml
Normal file
1094
administrator/components/com_phocagallery/config.xml
Normal file
File diff suppressed because it is too large
Load Diff
68
administrator/components/com_phocagallery/controller.php
Normal file
68
administrator/components/com_phocagallery/controller.php
Normal file
@ -0,0 +1,68 @@
|
||||
<?php
|
||||
/*
|
||||
* @package Joomla
|
||||
* @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;
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\HTML\Helpers\Sidebar;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\HTML\HTMLHelper;
|
||||
use Joomla\CMS\MVC\Controller\BaseController;
|
||||
|
||||
jimport('joomla.application.component.controller');
|
||||
|
||||
$l['cp'] = array('COM_PHOCAGALLERY_CONTROL_PANEL', '');
|
||||
$l['i'] = array('COM_PHOCAGALLERY_IMAGES', 'phocagalleryimgs');
|
||||
$l['c'] = array('COM_PHOCAGALLERY_CATEGORIES', 'phocagallerycs');
|
||||
$l['t'] = array('COM_PHOCAGALLERY_THEMES', 'phocagalleryt');
|
||||
$l['cr'] = array('COM_PHOCAGALLERY_CATEGORY_RATING', 'phocagalleryra');
|
||||
$l['ir'] = array('COM_PHOCAGALLERY_IMAGE_RATING', 'phocagalleryraimg');
|
||||
$l['cc'] = array('COM_PHOCAGALLERY_CATEGORY_COMMENTS', 'phocagallerycos');
|
||||
$l['ic'] = array('COM_PHOCAGALLERY_IMAGE_COMMENTS', 'phocagallerycoimgs');
|
||||
$l['u'] = array('COM_PHOCAGALLERY_USERS', 'phocagalleryusers');
|
||||
///$l['fb'] = array('COM_PHOCAGALLERY_FB', 'phocagalleryfbs');
|
||||
$l['tg'] = array('COM_PHOCAGALLERY_TAGS', 'phocagallerytags');
|
||||
$l['ef'] = array('COM_PHOCAGALLERY_STYLES', 'phocagalleryefs');
|
||||
$l['in'] = array('COM_PHOCAGALLERY_INFO', 'phocagalleryin');
|
||||
|
||||
// Submenu view
|
||||
//$view = JFactory::getApplication()->input->get( 'view', '', '', 'string', J REQUEST_ALLOWRAW );
|
||||
//$layout = JFactory::getApplication()->input->get( 'layout', '', '', 'string', J REQUEST_ALLOWRAW );
|
||||
$view = Factory::getApplication()->input->get('view');
|
||||
$layout = Factory::getApplication()->input->get('layout');
|
||||
|
||||
if ($layout == 'edit') {
|
||||
|
||||
} else {
|
||||
|
||||
foreach ($l as $k => $v) {
|
||||
|
||||
if ($v[1] == '') {
|
||||
$link = 'index.php?option=com_phocagallery';
|
||||
} else {
|
||||
$link = 'index.php?option=com_phocagallery&view=';
|
||||
}
|
||||
|
||||
if ($view == $v[1]) {
|
||||
Sidebar::addEntry(Text::_($v[0]), $link.$v[1], true );
|
||||
} else {
|
||||
Sidebar::addEntry(Text::_($v[0]), $link.$v[1]);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
class PhocaGalleryCpController extends BaseController
|
||||
{
|
||||
function display($cachable = false, $urlparams = Array()) {
|
||||
parent::display($cachable, $urlparams);
|
||||
}
|
||||
}
|
||||
?>
|
||||
@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
@ -0,0 +1,365 @@
|
||||
<?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();
|
||||
use Joomla\CMS\MVC\Controller\FormController;
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Session\Session;
|
||||
use Joomla\CMS\Router\Route;
|
||||
jimport('joomla.application.component.controllerform');
|
||||
|
||||
class PhocaGalleryCpControllerPhocaGalleryc extends FormController
|
||||
{
|
||||
protected $option = 'com_phocagallery';
|
||||
|
||||
|
||||
function __construct($config=array()) {
|
||||
|
||||
parent::__construct($config);
|
||||
|
||||
// - - - - - - - - - -
|
||||
// Load external image - Picasa
|
||||
// - - - - - - - - - -
|
||||
// In case the "Load" button will be saved, two actions need to be done:
|
||||
// 1) Save (apply) the category data (we use Joomla! framework controller so we need to set save method, task = apply
|
||||
// 2) load external images - we need to identify "Load", but task is apply, so we use subtask = loadextimg
|
||||
$task = Factory::getApplication()->input->get('task');
|
||||
if ((string)$task == 'loadextimgp') {
|
||||
if ($this->registerTask( 'loadextimgp', 'save')) {
|
||||
Factory::getApplication()->input->set('task','apply');// we need to apply category data
|
||||
Factory::getApplication()->input->set('subtask','loadextimgp');// we need to get info to run loading images
|
||||
}
|
||||
}
|
||||
if ((string)$task == 'loadextimgf') {
|
||||
if ($this->registerTask( 'loadextimgf', 'save')) {
|
||||
Factory::getApplication()->input->set('task','apply');// we need to apply category data
|
||||
Factory::getApplication()->input->set('subtask','loadextimgf');// we need to get info to run loading images
|
||||
}
|
||||
}
|
||||
$this->registerTask( 'uploadextimgf', 'uploadExtImgF');
|
||||
$this->registerTask( 'uploadextimgfpgn', 'uploadExtImgFPgn');
|
||||
|
||||
if ((string)$task == 'loadextimgi') {
|
||||
if ($this->registerTask( 'loadextimgi', 'save')) {
|
||||
Factory::getApplication()->input->set('task','apply');// we need to apply category data
|
||||
Factory::getApplication()->input->set('subtask','loadextimgi');// we need to get info to run loading images
|
||||
}
|
||||
}
|
||||
|
||||
// If there will be not used pagination (less than 20 images e.g.) data will be saved in model and images loaded - no redirection
|
||||
// If there will be used pagination, don't save the data again, redirect the site with "loadextimgpgn" id value
|
||||
$this->registerTask( 'loadextimgpgn', 'loadExtImgPgn');// data stored now we only loading other images
|
||||
$this->registerTask( 'loadextimgpgnfb', 'loadExtImgPgnFb');// data stored now we only loading other images
|
||||
// - - - - - - - - - -
|
||||
|
||||
}
|
||||
|
||||
function loadExtImgPgn() {
|
||||
|
||||
$picStart = Factory::getApplication()->input->get( 'picstart', 0, 'get', 'int' );
|
||||
$idCat = Factory::getApplication()->input->get( 'id', 0, 'get', 'int' );
|
||||
if ($picStart > 0 && $idCat > 0) {
|
||||
$model = $this->getModel();
|
||||
$message = '';
|
||||
$loadImg = $model->loadExtImages($idCat, '', $message);
|
||||
|
||||
$this->setRedirect( 'index.php?option=com_phocagallery&task=phocagalleryc.edit&id='. $idCat, $message );
|
||||
}
|
||||
}
|
||||
|
||||
function loadExtImgPgnFb() {
|
||||
|
||||
$fbCount = Factory::getApplication()->input->get( 'fbcount', 0, 'get', 'int' );
|
||||
$idCat = Factory::getApplication()->input->get( 'id', 0, 'get', 'int' );
|
||||
if ($fbCount > 0 && $idCat > 0) {
|
||||
$model = $this->getModel();
|
||||
$message = '';
|
||||
$loadImg = $model->loadExtImagesFb($idCat, '', $message);
|
||||
$this->setRedirect( 'index.php?option=com_phocagallery&task=phocagalleryc.edit&id='. $idCat, $message );
|
||||
}
|
||||
}
|
||||
function uploadExtImgF() {
|
||||
|
||||
$idCat = Factory::getApplication()->input->get( 'id', 0, 'get', 'int' );
|
||||
$data = Factory::getApplication()->input->get('jform', array(), 'post', 'array');
|
||||
|
||||
if (isset($data['extfbuid']) && $data['extfbuid'] > 0 && isset($data['extfbcatid']) && $data['extfbcatid'] != '' ) {
|
||||
if ($idCat > 0) {
|
||||
$model = $this->getModel();
|
||||
$message = '';
|
||||
$loadImg = $model->uploadExtImagesFb($idCat, $data, $message);
|
||||
}
|
||||
} else {
|
||||
$message = Text::_('COM_PHOCAGALLERY_ERROR_FB_USER_ALBUM_NOT_SELECTED');
|
||||
$this->setRedirect( 'index.php?option=com_phocagallery&task=phocagalleryc.edit&id='. $idCat, $message, 'error' );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function uploadExtImgFPgn() {
|
||||
|
||||
$fbImg = Factory::getApplication()->input->get( 'fbimg', 0, 'get', 'int' );
|
||||
$idCat = Factory::getApplication()->input->get( 'id', 0, 'get', 'int' );
|
||||
if ($fbImg > 0 && $idCat > 0) {
|
||||
$model = $this->getModel();
|
||||
$message = '';
|
||||
$loadImg = $model->uploadExtImagesFb($idCat, '', $message);
|
||||
$this->setRedirect( 'index.php?option=com_phocagallery&task=phocagalleryc.edit&id='. $idCat, $message );
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* NOT USED IT IS A SUBTASK OF SAVE
|
||||
function loadExtImgI() {
|
||||
$idCat = Factory::getApplication()->input->get( 'id', 0, 'get', 'int' );
|
||||
if ($idCat > 0) {
|
||||
$model = $this->getModel();
|
||||
$message = '';
|
||||
$loadImg = $model->loadExtImagesI($idCat, '', $message);
|
||||
|
||||
$this->setRedirect( 'index.php?option=com_phocagallery&task=phocagalleryc.edit&id='. $idCat, $message );
|
||||
}
|
||||
}*/
|
||||
|
||||
|
||||
|
||||
protected function allowAdd($data = array()) {
|
||||
$user = Factory::getUser();
|
||||
$allow = null;
|
||||
$allow = $user->authorise('core.create', 'com_phocagallery');
|
||||
if ($allow === null) {
|
||||
return parent::allowAdd($data);
|
||||
} else {
|
||||
return $allow;
|
||||
}
|
||||
}
|
||||
|
||||
protected function allowEdit($data = array(), $key = 'id') {
|
||||
$user = Factory::getUser();
|
||||
$allow = null;
|
||||
$allow = $user->authorise('core.edit', 'com_phocagallery');
|
||||
if ($allow === null) {
|
||||
return parent::allowEdit($data, $key);
|
||||
} else {
|
||||
return $allow;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function save($key = null, $urlVar = null)
|
||||
{
|
||||
// Check for request forgeries.
|
||||
Session::checkToken() or jexit(Text::_('JINVALID_TOKEN'));
|
||||
|
||||
// Initialise variables.
|
||||
$app = Factory::getApplication();
|
||||
$lang = Factory::getLanguage();
|
||||
$model = $this->getModel();
|
||||
$table = $model->getTable();
|
||||
//$data = JFactory::getApplication()->input->get('jform', array(), 'post', 'array');
|
||||
$data = $app->input->post->get('jform', array(), 'array');
|
||||
|
||||
$checkin = property_exists($table, 'checked_out');
|
||||
$context = "$this->option.edit.$this->context";
|
||||
$task = $this->getTask();
|
||||
|
||||
// Determine the name of the primary key for the data.
|
||||
if (empty($key)) {
|
||||
$key = $table->getKeyName();
|
||||
}
|
||||
|
||||
// The urlVar may be different from the primary key to avoid data collisions.
|
||||
if (empty($urlVar)) {
|
||||
$urlVar = $key;
|
||||
}
|
||||
|
||||
$recordId = Factory::getApplication()->input->getInt($urlVar);
|
||||
|
||||
$session = Factory::getSession();
|
||||
$registry = $session->get('registry');
|
||||
|
||||
if (!$this->checkEditId($context, $recordId)) {
|
||||
// Somehow the person just went to the form and saved it - we don't allow that.
|
||||
//$this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $recordId));
|
||||
$this->setMessage(Text::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $recordId), 'error');
|
||||
|
||||
$this->setRedirect(Route::_('index.php?option='.$this->option.'&view='.$this->view_list.$this->getRedirectToListAppend(), false));
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Populate the row id from the session.
|
||||
$data[$key] = $recordId;
|
||||
|
||||
// The save2copy task needs to be handled slightly differently.
|
||||
if ($task == 'save2copy') {
|
||||
// Check-in the original row.
|
||||
if ($checkin && $model->checkin($data[$key]) === false) {
|
||||
// Check-in failed, go back to the item and display a notice.
|
||||
//$this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_CHECKIN_FAILED', $model->getError()));
|
||||
$this->setMessage(Text::sprintf('JLIB_APPLICATION_ERROR_CHECKIN_FAILED', $model->getError()), 'error');
|
||||
$this->setRedirect('index.php?option='.$this->option.'&view='.$this->view_item.$this->getRedirectToItemAppend($recordId, $urlVar));
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Reset the ID and then treat the request as for Apply.
|
||||
$data[$key] = 0;
|
||||
$task = 'apply';
|
||||
}
|
||||
|
||||
// Access check.
|
||||
if (!$this->allowSave($data)) {
|
||||
//$this->setError(Text::_('JLIB_APPLICATION_ERROR_SAVE_NOT_PERMITTED'));
|
||||
$this->setMessage(Text::_('JLIB_APPLICATION_ERROR_SAVE_NOT_PERMITTED'), 'error');
|
||||
$this->setRedirect(Route::_('index.php?option='.$this->option.'&view='.$this->view_list.$this->getRedirectToListAppend(), false));
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Validate the posted data.
|
||||
// Sometimes the form needs some posted data, such as for plugins and modules.
|
||||
$form = $model->getForm($data, false);
|
||||
|
||||
if (!$form) {
|
||||
$app->enqueueMessage($model->getError(), 'error');
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Test if the data is valid.
|
||||
|
||||
$validData = $model->validate($form, $data);
|
||||
|
||||
// Check for validation errors.
|
||||
if ($validData === false) {
|
||||
// Get the validation messages.
|
||||
$errors = $model->getErrors();
|
||||
|
||||
// Push up to three validation messages out to the user.
|
||||
for ($i = 0, $n = count($errors); $i < $n && $i < 3; $i++)
|
||||
{
|
||||
if (!empty($errors[$i])) {
|
||||
$app->enqueueMessage($errors[$i]->getMessage(), 'warning');
|
||||
}
|
||||
else {
|
||||
$app->enqueueMessage($errors[$i], 'warning');
|
||||
}
|
||||
}
|
||||
|
||||
// Save the data in the session.
|
||||
$app->setUserState($context.'.data', $data);
|
||||
|
||||
// Redirect back to the edit screen.
|
||||
$this->setRedirect(Route::_('index.php?option='.$this->option.'&view='.$this->view_item.$this->getRedirectToItemAppend($recordId, $key), false));
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Attempt to save the data.
|
||||
// PHOCAEDIT
|
||||
$extImgError = false;
|
||||
if (!$model->save($validData, $extImgError)) {
|
||||
// Save the data in the session.
|
||||
$app->setUserState($context.'.data', $validData);
|
||||
|
||||
// Redirect back to the edit screen.
|
||||
//$this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_SAVE_FAILED', $model->getError()));
|
||||
$this->setMessage(Text::sprintf('JLIB_APPLICATION_ERROR_SAVE_FAILED', $model->getError()), 'error');
|
||||
$this->setRedirect(Route::_('index.php?option='.$this->option.'&view='.$this->view_item.$this->getRedirectToItemAppend($recordId, $key), false));
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Save succeeded, check-in the record.
|
||||
if ($checkin && $model->checkin($validData[$key]) === false) {
|
||||
// Save the data in the session.
|
||||
$app->setUserState($context.'.data', $validData);
|
||||
|
||||
// Check-in failed, go back to the record and display a notice.
|
||||
//$this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_CHECKIN_FAILED', $model->getError()));
|
||||
$this->setMessage(Text::sprintf('JLIB_APPLICATION_ERROR_CHECKIN_FAILED', $model->getError()), 'error');
|
||||
$this->setRedirect('index.php?option='.$this->option.'&view='.$this->view_item.$this->getRedirectToItemAppend($recordId, $key));
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->setMessage(Text::_(($lang->hasKey($this->text_prefix.($recordId==0 && $app->isClient('site') ? '_SUBMIT' : '').'_SAVE_SUCCESS') ? $this->text_prefix : 'JLIB_APPLICATION') . ($recordId==0 && $app->isClient('site') ? '_SUBMIT' : '') . '_SAVE_SUCCESS'));
|
||||
|
||||
// Redirect the user and adjust session state based on the chosen task.
|
||||
|
||||
// Category Saved but not loaded images
|
||||
//PHOCAEDIT
|
||||
if ($extImgError) {
|
||||
// NOT MORE USED - app enque message used
|
||||
//$this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_SAVE_FAILED', $model->getError()));
|
||||
//$this->setMessage($this->getError(), 'error');
|
||||
|
||||
$this->setMessage(Text::sprintf('JLIB_APPLICATION_ERROR_SAVE_FAILED', $model->getError()), 'error');
|
||||
$this->setRedirect('index.php?option='.$this->option.'&view='.$this->view_item.$this->getRedirectToItemAppend($recordId, $key));
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
//PHOCAEDIT
|
||||
|
||||
switch ($task)
|
||||
{
|
||||
case 'apply':
|
||||
// Set the record data in the session.
|
||||
$recordId = $model->getState($this->context.'.id');
|
||||
$this->holdEditId($context, $recordId);
|
||||
$app->setUserState($context.'.data', null);
|
||||
|
||||
// Redirect back to the edit screen.
|
||||
|
||||
$this->setRedirect(Route::_('index.php?option='.$this->option.'&view='.$this->view_item.$this->getRedirectToItemAppend($recordId, $key), false));
|
||||
break;
|
||||
|
||||
case 'save2new':
|
||||
// Clear the record id and data from the session.
|
||||
$this->releaseEditId($context, $recordId);
|
||||
$app->setUserState($context.'.data', null);
|
||||
|
||||
// Redirect back to the edit screen.
|
||||
$this->setRedirect(Route::_('index.php?option='.$this->option.'&view='.$this->view_item.$this->getRedirectToItemAppend(null, $key), false));
|
||||
break;
|
||||
|
||||
default:
|
||||
// Clear the record id and data from the session.
|
||||
$this->releaseEditId($context, $recordId);
|
||||
$app->setUserState($context.'.data', null);
|
||||
|
||||
|
||||
// Redirect to the list screen.
|
||||
$this->setRedirect(Route::_('index.php?option='.$this->option.'&view='.$this->view_list.$this->getRedirectToListAppend(), false));
|
||||
break;
|
||||
}
|
||||
|
||||
// Invoke the postSave method to allow for the child class to access the model.
|
||||
$this->postSaveHook($model, $validData);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function batch($model = null) {
|
||||
Session::checkToken() or jexit(Text::_('JINVALID_TOKEN'));
|
||||
|
||||
// Set the model
|
||||
$model = $this->getModel('phocagalleryc', '', array());
|
||||
|
||||
// Preset the redirect
|
||||
$this->setRedirect(Route::_('index.php?option=com_phocagallery&view=phocagallerycs'.$this->getRedirectToListAppend(), false));
|
||||
|
||||
return parent::batch($model);
|
||||
}
|
||||
}
|
||||
?>
|
||||
@ -0,0 +1,46 @@
|
||||
<?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;
|
||||
use Joomla\CMS\MVC\Controller\FormController;
|
||||
use Joomla\CMS\Factory;
|
||||
jimport('joomla.application.component.controllerform');
|
||||
|
||||
class PhocaGalleryCpControllerPhocaGalleryCo extends FormController
|
||||
{
|
||||
protected $option = 'com_phocagallery';
|
||||
|
||||
function __construct($config=array()) {
|
||||
parent::__construct($config);
|
||||
}
|
||||
|
||||
protected function allowAdd($data = array()) {
|
||||
$user = Factory::getUser();
|
||||
$allow = null;
|
||||
$allow = $user->authorise('core.create', 'com_phocagallery');
|
||||
if ($allow === null) {
|
||||
return parent::allowAdd($data);
|
||||
} else {
|
||||
return $allow;
|
||||
}
|
||||
}
|
||||
|
||||
protected function allowEdit($data = array(), $key = 'id') {
|
||||
$user = Factory::getUser();
|
||||
$allow = null;
|
||||
$allow = $user->authorise('core.edit', 'com_phocagallery');
|
||||
if ($allow === null) {
|
||||
return parent::allowEdit($data, $key);
|
||||
} else {
|
||||
return $allow;
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
@ -0,0 +1,46 @@
|
||||
<?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;
|
||||
use Joomla\CMS\MVC\Controller\FormController;
|
||||
use Joomla\CMS\Factory;
|
||||
jimport('joomla.application.component.controllerform');
|
||||
|
||||
class PhocaGalleryCpControllerPhocaGalleryCoImg extends FormController
|
||||
{
|
||||
protected $option = 'com_phocagallery';
|
||||
|
||||
function __construct($config=array()) {
|
||||
parent::__construct($config);
|
||||
}
|
||||
|
||||
protected function allowAdd($data = array()) {
|
||||
$user = Factory::getUser();
|
||||
$allow = null;
|
||||
$allow = $user->authorise('core.create', 'com_phocagallery');
|
||||
if ($allow === null) {
|
||||
return parent::allowAdd($data);
|
||||
} else {
|
||||
return $allow;
|
||||
}
|
||||
}
|
||||
|
||||
protected function allowEdit($data = array(), $key = 'id') {
|
||||
$user = Factory::getUser();
|
||||
$allow = null;
|
||||
$allow = $user->authorise('core.edit', 'com_phocagallery');
|
||||
if ($allow === null) {
|
||||
return parent::allowEdit($data, $key);
|
||||
} else {
|
||||
return $allow;
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
@ -0,0 +1,43 @@
|
||||
<?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;
|
||||
use Joomla\CMS\MVC\Controller\AdminController;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Session\Session;
|
||||
use Joomla\CMS\Factory;
|
||||
jimport('joomla.application.component.controlleradmin');
|
||||
|
||||
|
||||
class PhocaGalleryCpControllerPhocaGalleryCoImgs extends AdminController
|
||||
{
|
||||
protected $option = 'com_phocagallery';
|
||||
|
||||
public function &getModel($name = 'PhocaGalleryCoImg', $prefix = 'PhocaGalleryCpModel', $config = array())
|
||||
{
|
||||
$model = parent::getModel($name, $prefix, array('ignore_request' => true));
|
||||
return $model;
|
||||
}
|
||||
|
||||
public function saveOrderAjax() {
|
||||
Session::checkToken() or jexit(Text::_('JINVALID_TOKEN'));
|
||||
$pks = $this->input->post->get('cid', array(), 'array');
|
||||
$order = $this->input->post->get('order', array(), 'array');
|
||||
\Joomla\Utilities\ArrayHelper::toInteger($pks);
|
||||
\Joomla\Utilities\ArrayHelper::toInteger($order);
|
||||
$model = $this->getModel();
|
||||
$return = $model->saveorder($pks, $order);
|
||||
if ($return) { echo "1";}
|
||||
Factory::getApplication()->close();
|
||||
}
|
||||
}
|
||||
?>
|
||||
@ -0,0 +1,40 @@
|
||||
<?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;
|
||||
use Joomla\CMS\MVC\Controller\AdminController;
|
||||
use Joomla\CMS\Factory;
|
||||
jimport('joomla.application.component.controlleradmin');
|
||||
|
||||
|
||||
class PhocaGalleryCpControllerPhocaGalleryCos extends AdminController
|
||||
{
|
||||
protected $option = 'com_phocagallery';
|
||||
|
||||
public function &getModel($name = 'PhocaGalleryCo', $prefix = 'PhocaGalleryCpModel', $config = array())
|
||||
{
|
||||
$model = parent::getModel($name, $prefix, array('ignore_request' => true));
|
||||
return $model;
|
||||
}
|
||||
|
||||
public function saveOrderAjax() {
|
||||
$pks = $this->input->post->get('cid', array(), 'array');
|
||||
$order = $this->input->post->get('order', array(), 'array');
|
||||
\Joomla\Utilities\ArrayHelper::toInteger($pks);
|
||||
\Joomla\Utilities\ArrayHelper::toInteger($order);
|
||||
$model = $this->getModel();
|
||||
$return = $model->saveorder($pks, $order);
|
||||
if ($return) { echo "1";}
|
||||
Factory::getApplication()->close();
|
||||
}
|
||||
}
|
||||
?>
|
||||
@ -0,0 +1,105 @@
|
||||
<?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;
|
||||
use Joomla\CMS\MVC\Controller\AdminController;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Session\Session;
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Router\Route;
|
||||
jimport('joomla.application.component.controlleradmin');
|
||||
|
||||
class PhocaGalleryCpControllerPhocaGallerycs extends AdminController
|
||||
{
|
||||
protected $option = 'com_phocagallery';
|
||||
|
||||
public function __construct($config = array())
|
||||
{
|
||||
parent::__construct($config);
|
||||
$this->registerTask('disapprove', 'approve');
|
||||
|
||||
}
|
||||
|
||||
public function &getModel($name = 'PhocaGalleryc', $prefix = 'PhocaGalleryCpModel', $config = array())
|
||||
{
|
||||
$model = parent::getModel($name, $prefix, array('ignore_request' => true));
|
||||
return $model;
|
||||
}
|
||||
|
||||
|
||||
function approve()
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
|
||||
|
||||
// Get items to publish from the request.
|
||||
$cid = Factory::getApplication()->input->get('cid', array(), '', 'array');
|
||||
$data = array('approve' => 1, 'disapprove' => 0);
|
||||
$task = $this->getTask();
|
||||
$value = \Joomla\Utilities\ArrayHelper::getValue($data, $task, 0, 'int');
|
||||
|
||||
if (empty($cid)) {
|
||||
throw new Exception(Text::_($this->text_prefix.'_NO_ITEM_SELECTED'), 500);
|
||||
} else {
|
||||
// Get the model.
|
||||
$model = $this->getModel();
|
||||
|
||||
// Make sure the item ids are integers
|
||||
\Joomla\Utilities\ArrayHelper::toInteger($cid);
|
||||
|
||||
// Publish the items.
|
||||
|
||||
if (!$model->approve($cid, $value)) {
|
||||
throw new Exception($model->getError(), 500);
|
||||
} else {
|
||||
if ($value == 1) {
|
||||
$ntext = $this->text_prefix.'_N_ITEMS_APPROVED';
|
||||
} else if ($value == 0) {
|
||||
$ntext = $this->text_prefix.'_N_ITEMS_DISAPPROVED';
|
||||
}
|
||||
$this->setMessage(Text::plural($ntext, count($cid)));
|
||||
}
|
||||
}
|
||||
|
||||
$this->setRedirect(Route::_('index.php?option='.$this->option.'&view='.$this->view_list, false));
|
||||
}
|
||||
|
||||
function cooliris() {
|
||||
|
||||
$cids = Factory::getApplication()->input->get( 'cid', array(0), 'post', 'array' );
|
||||
$model = $this->getModel( 'phocagalleryc' );
|
||||
$message = '';
|
||||
if(!$model->cooliris($cids, $message)) {
|
||||
$message = PhocaGalleryUtils::setMessage(Text::_( $message ), Text::_('COM_PHOCAGALLERY_ERROR_CREATING_COOLIRS_FILE'));
|
||||
}
|
||||
else {
|
||||
$message = PhocaGalleryUtils::setMessage(Text::_( $message ), Text::_('COM_PHOCAGALLERY_COOLIRIS_FILE_CREATED'));
|
||||
}
|
||||
|
||||
$link = 'index.php?option=com_phocagallery&view=phocagallerycs';
|
||||
$this->setRedirect( $link, $message );
|
||||
}
|
||||
|
||||
public function saveOrderAjax() {
|
||||
Session::checkToken() or jexit(Text::_('JINVALID_TOKEN'));
|
||||
$pks = $this->input->post->get('cid', array(), 'array');
|
||||
$order = $this->input->post->get('order', array(), 'array');
|
||||
//$originalOrder = explode(',', $this->input->getString('original_order_values'));
|
||||
\Joomla\Utilities\ArrayHelper::toInteger($pks);
|
||||
\Joomla\Utilities\ArrayHelper::toInteger($order);
|
||||
//if (!($order === $originalOrder)) {
|
||||
$model = $this->getModel();
|
||||
$return = $model->saveorder($pks, $order);
|
||||
if ($return){echo "1";}
|
||||
//}
|
||||
Factory::getApplication()->close();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,46 @@
|
||||
<?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();
|
||||
use Joomla\CMS\MVC\Controller\FormController;
|
||||
use Joomla\CMS\Factory;
|
||||
jimport('joomla.application.component.controllerform');
|
||||
|
||||
class PhocaGalleryCpControllerPhocaGalleryef extends FormController
|
||||
{
|
||||
protected $option = 'com_phocagallery';
|
||||
|
||||
|
||||
function __construct($config=array()) {
|
||||
parent::__construct($config);
|
||||
}
|
||||
|
||||
protected function allowAdd($data = array()) {
|
||||
$user = Factory::getUser();
|
||||
$allow = null;
|
||||
$allow = $user->authorise('core.create', 'com_phocagallery');
|
||||
if ($allow === null) {
|
||||
return parent::allowAdd($data);
|
||||
} else {
|
||||
return $allow;
|
||||
}
|
||||
}
|
||||
|
||||
protected function allowEdit($data = array(), $key = 'id') {
|
||||
$user = Factory::getUser();
|
||||
$allow = null;
|
||||
$allow = $user->authorise('core.edit', 'com_phocagallery');
|
||||
if ($allow === null) {
|
||||
return parent::allowEdit($data, $key);
|
||||
} else {
|
||||
return $allow;
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
@ -0,0 +1,44 @@
|
||||
<?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;
|
||||
use Joomla\CMS\MVC\Controller\AdminController;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Session\Session;
|
||||
use Joomla\CMS\Factory;
|
||||
|
||||
class PhocaGalleryCpControllerPhocaGalleryefs extends AdminController
|
||||
{
|
||||
protected $option = 'com_phocagallery';
|
||||
|
||||
public function __construct($config = array()){
|
||||
parent::__construct($config);
|
||||
$this->registerTask('apply', 'save');
|
||||
}
|
||||
|
||||
public function &getModel($name = 'PhocaGalleryef', $prefix = 'PhocaGalleryCpModel', $config = array()) {
|
||||
$model = parent::getModel($name, $prefix, array('ignore_request' => true));
|
||||
return $model;
|
||||
}
|
||||
|
||||
public function saveOrderAjax() {
|
||||
Session::checkToken() or jexit(Text::_('JINVALID_TOKEN'));
|
||||
$pks = $this->input->post->get('cid', array(), 'array');
|
||||
$order = $this->input->post->get('order', array(), 'array');
|
||||
\Joomla\Utilities\ArrayHelper::toInteger($pks);
|
||||
\Joomla\Utilities\ArrayHelper::toInteger($order);
|
||||
$model = $this->getModel();
|
||||
$return = $model->saveorder($pks, $order);
|
||||
if ($return) { echo "1";}
|
||||
Factory::getApplication()->close();
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
@ -0,0 +1,46 @@
|
||||
<?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;
|
||||
use Joomla\CMS\MVC\Controller\FormController;
|
||||
use Joomla\CMS\Factory;
|
||||
jimport('joomla.application.component.controllerform');
|
||||
|
||||
class PhocaGalleryCpControllerPhocaGalleryFb extends FormController
|
||||
{
|
||||
protected $option = 'com_phocagallery';
|
||||
|
||||
function __construct($config=array()) {
|
||||
parent::__construct($config);
|
||||
}
|
||||
|
||||
protected function allowAdd($data = array()) {
|
||||
$user = Factory::getUser();
|
||||
$allow = null;
|
||||
$allow = $user->authorise('core.create', 'com_phocagallery');
|
||||
if ($allow === null) {
|
||||
return parent::allowAdd($data);
|
||||
} else {
|
||||
return $allow;
|
||||
}
|
||||
}
|
||||
|
||||
protected function allowEdit($data = array(), $key = 'id') {
|
||||
$user = Factory::getUser();
|
||||
$allow = null;
|
||||
$allow = $user->authorise('core.edit', 'com_phocagallery');
|
||||
if ($allow === null) {
|
||||
return parent::allowEdit($data, $key);
|
||||
} else {
|
||||
return $allow;
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
@ -0,0 +1,43 @@
|
||||
<?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;
|
||||
use Joomla\CMS\MVC\Controller\AdminController;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Session\Session;
|
||||
use Joomla\CMS\Factory;
|
||||
jimport('joomla.application.component.controlleradmin');
|
||||
|
||||
|
||||
class PhocaGalleryCpControllerPhocaGalleryFbs extends AdminController
|
||||
{
|
||||
protected $option = 'com_phocagallery';
|
||||
|
||||
public function &getModel($name = 'PhocaGalleryFb', $prefix = 'PhocaGalleryCpModel', $config = array())
|
||||
{
|
||||
$model = parent::getModel($name, $prefix, array('ignore_request' => true));
|
||||
return $model;
|
||||
}
|
||||
|
||||
public function saveOrderAjax() {
|
||||
Session::checkToken() or jexit(Text::_('JINVALID_TOKEN'));
|
||||
$pks = $this->input->post->get('cid', array(), 'array');
|
||||
$order = $this->input->post->get('order', array(), 'array');
|
||||
\Joomla\Utilities\ArrayHelper::toInteger($pks);
|
||||
\Joomla\Utilities\ArrayHelper::toInteger($order);
|
||||
$model = $this->getModel();
|
||||
$return = $model->saveorder($pks, $order);
|
||||
if ($return) { echo "1";}
|
||||
Factory::getApplication()->close();
|
||||
}
|
||||
}
|
||||
?>
|
||||
@ -0,0 +1,150 @@
|
||||
<?php
|
||||
/*
|
||||
* @package Joomla
|
||||
* @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
|
||||
*/
|
||||
|
||||
// Check to ensure this file is included in Joomla!
|
||||
defined('_JEXEC') or die();
|
||||
use Joomla\CMS\MVC\Controller\FormController;
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Session\Session;
|
||||
use Joomla\CMS\Router\Route;
|
||||
jimport('joomla.application.component.controllerform');
|
||||
|
||||
class PhocaGalleryCpControllerPhocaGalleryImg extends FormController
|
||||
{
|
||||
protected $option = 'com_phocagallery';
|
||||
|
||||
function __construct($config=array()) {
|
||||
|
||||
|
||||
parent::__construct($config);
|
||||
}
|
||||
|
||||
protected function allowAdd($data = array()) {
|
||||
$user = Factory::getUser();
|
||||
$allow = null;
|
||||
$allow = $user->authorise('core.create', 'com_phocagallery');
|
||||
if ($allow === null) {
|
||||
return parent::allowAdd($data);
|
||||
} else {
|
||||
return $allow;
|
||||
}
|
||||
}
|
||||
|
||||
protected function allowEdit($data = array(), $key = 'id') {
|
||||
$user = Factory::getUser();
|
||||
$allow = null;
|
||||
$allow = $user->authorise('core.edit', 'com_phocagallery');
|
||||
if ($allow === null) {
|
||||
return parent::allowEdit($data, $key);
|
||||
} else {
|
||||
return $allow;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
function deletethumbs()
|
||||
{
|
||||
$cid = Factory::getApplication()->input->get( 'cid', array(0), 'get', 'array' );
|
||||
|
||||
$model = &$this->getModel( 'phocagallery' );
|
||||
if ($model->deletethumbs($cid[0])) {
|
||||
$msg = Text::_( 'COM_PHOCAGALLERY_SUCCESS_THUMBNAIL_DELETE' );
|
||||
} else {
|
||||
$msg = Text::_( 'COM_PHOCAGALLERY_ERROR_THUMBNAIL_DELETE' );
|
||||
}
|
||||
|
||||
|
||||
$link = 'index.php?option=com_phocagallery&view=phocagalleryimgs';
|
||||
$this->setRedirect($link, $msg);
|
||||
}
|
||||
*/
|
||||
function rotate() {
|
||||
$id = Factory::getApplication()->input->get( 'id', 0, 'get', 'int' );
|
||||
$angle = Factory::getApplication()->input->get( 'angle', 90, 'get', 'int' );
|
||||
$model = $this->getModel( 'phocagalleryimg' );
|
||||
|
||||
$message = '';
|
||||
$rotateReturn = $model->rotate($id, $angle, $message);
|
||||
|
||||
if (!$rotateReturn) {
|
||||
$message = PhocaGalleryUtils::setMessage($message, Text::_( 'COM_PHOCAGALLERY_ERROR_IMAGE_ROTATE' ));
|
||||
} else {
|
||||
$message = Text::_( 'COM_PHOCAGALLERY_SUCCESS_IMAGE_ROTATE' );
|
||||
}
|
||||
|
||||
$link = 'index.php?option=com_phocagallery&view=phocagalleryimgs';
|
||||
$this->setRedirect($link, $message);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
*if thumbnails are created - show message after creating thumbnails - show that files was saved in database
|
||||
*/
|
||||
function thumbs() {
|
||||
$msg = Text::_( 'COM_PHOCAGALLERY_SUCCESS_SAVE_MULTIPLE' );
|
||||
|
||||
$countcat = Factory::getApplication()->input->get( 'countcat', 0, 'get', 'int' );
|
||||
$countimg = Factory::getApplication()->input->get( 'countimg', 0, 'get', 'int' );
|
||||
//$imagesid = JFactory::getApplication()->input->get( 'imagesid', 0, 'get', 'int' );
|
||||
|
||||
$link = 'index.php?option=com_phocagallery&view=phocagalleryimgs&countcat='.$countcat.'&countimg='.$countimg.'&imagesid='.md5(time());
|
||||
//$link = 'index.php?option=com_phocagallery&view=phocagalleryimgs';
|
||||
$this->setRedirect($link, $msg);
|
||||
}
|
||||
|
||||
function disablethumbs() {
|
||||
$model = $this->getModel( 'phocagalleryimg' );
|
||||
if ($model->disableThumbs()) {
|
||||
$msg = Text::_('COM_PHOCAGALLERY_SUCCESS_DISABLE_THUMBS');
|
||||
} else {
|
||||
$msg = Text::_('COM_PHOCAGALLERY_ERROR_DISABLE_THUMBS');
|
||||
}
|
||||
$link = 'index.php?option=com_phocagallery&view=phocagalleryimgs';
|
||||
$this->setRedirect($link, $msg);
|
||||
}
|
||||
|
||||
|
||||
|
||||
function recreate() {
|
||||
$cid = Factory::getApplication()->input->get( 'cid', array(), '', 'array' );
|
||||
\Joomla\Utilities\ArrayHelper::toInteger($cid);
|
||||
|
||||
if (count( $cid ) < 1) {
|
||||
throw new Exception(Text::_( 'COM_PHOCAGALLERY_SELECT_ITEM_RECREATE' ), 500);
|
||||
return false;
|
||||
}
|
||||
$message = '';
|
||||
$model = $this->getModel( 'phocagalleryimg' );
|
||||
if(!$model->recreate($cid, $message)) {
|
||||
$message = PhocaGalleryUtils::setMessage($message, Text::_( 'COM_PHOCAGALLERY_ERROR_THUMBS_REGENERATING' ));
|
||||
} else {
|
||||
$message = Text::_( 'COM_PHOCAGALLERY_SUCCESS_THUMBS_REGENERATING' );
|
||||
}
|
||||
|
||||
$this->setRedirect( 'index.php?option=com_phocagallery&view=phocagalleryimgs', $message );
|
||||
}
|
||||
|
||||
public function batch($model = null) {
|
||||
Session::checkToken() or jexit(Text::_('JINVALID_TOKEN'));
|
||||
|
||||
// Set the model
|
||||
$model = $this->getModel('phocagalleryimg', '', array());
|
||||
|
||||
// Preset the redirect
|
||||
$this->setRedirect(Route::_('index.php?option=com_phocagallery&view=phocagalleryimgs'.$this->getRedirectToListAppend(), false));
|
||||
|
||||
|
||||
return parent::batch($model);
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
@ -0,0 +1,88 @@
|
||||
<?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;
|
||||
use Joomla\CMS\MVC\Controller\AdminController;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Session\Session;
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Router\Route;
|
||||
jimport('joomla.application.component.controlleradmin');
|
||||
|
||||
class PhocaGalleryCpControllerPhocaGalleryImgs extends AdminController
|
||||
{
|
||||
protected $option = 'com_phocagallery';
|
||||
|
||||
public function __construct($config = array())
|
||||
{
|
||||
parent::__construct($config);
|
||||
$this->registerTask('disapprove', 'approve');
|
||||
|
||||
}
|
||||
|
||||
public function &getModel($name = 'PhocaGalleryImg', $prefix = 'PhocaGalleryCpModel', $config = array())
|
||||
{
|
||||
$model = parent::getModel($name, $prefix, array('ignore_request' => true));
|
||||
return $model;
|
||||
}
|
||||
|
||||
|
||||
function approve()
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
|
||||
|
||||
// Get items to publish from the request.
|
||||
$cid = Factory::getApplication()->input->get('cid', array(), '', 'array');
|
||||
$data = array('approve' => 1, 'disapprove' => 0);
|
||||
$task = $this->getTask();
|
||||
$value = \Joomla\Utilities\ArrayHelper::getValue($data, $task, 0, 'int');
|
||||
|
||||
if (empty($cid)) {
|
||||
throw new Exception(Text::_($this->text_prefix.'_NO_ITEM_SELECTED'), 500);
|
||||
} else {
|
||||
// Get the model.
|
||||
$model = $this->getModel();
|
||||
|
||||
// Make sure the item ids are integers
|
||||
\Joomla\Utilities\ArrayHelper::toInteger($cid);
|
||||
|
||||
// Publish the items.
|
||||
|
||||
if (!$model->approve($cid, $value)) {
|
||||
throw new Exception($model->getError(), 500);
|
||||
} else {
|
||||
if ($value == 1) {
|
||||
$ntext = $this->text_prefix.'_N_ITEMS_APPROVED';
|
||||
} else if ($value == 0) {
|
||||
$ntext = $this->text_prefix.'_N_ITEMS_DISAPPROVED';
|
||||
}
|
||||
$this->setMessage(Text::plural($ntext, count($cid)));
|
||||
}
|
||||
}
|
||||
|
||||
$this->setRedirect(Route::_('index.php?option='.$this->option.'&view='.$this->view_list, false));
|
||||
}
|
||||
|
||||
public function saveOrderAjax() {
|
||||
Session::checkToken() or jexit(Text::_('JINVALID_TOKEN'));
|
||||
$pks = $this->input->post->get('cid', array(), 'array');
|
||||
$order = $this->input->post->get('order', array(), 'array');
|
||||
|
||||
\Joomla\Utilities\ArrayHelper::toInteger($pks);
|
||||
\Joomla\Utilities\ArrayHelper::toInteger($order);
|
||||
$model = $this->getModel();
|
||||
$return = $model->saveorder($pks, $order);
|
||||
if ($return) { echo "1";}
|
||||
Factory::getApplication()->close();
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,22 @@
|
||||
<?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();
|
||||
class PhocaGalleryCpControllerPhocaGalleryIn extends PhocaGalleryCpController
|
||||
{
|
||||
function __construct() {
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
function cancel($key = NULL) {
|
||||
$this->setRedirect( 'index.php?option=com_phocagallery' );
|
||||
}
|
||||
}
|
||||
?>
|
||||
@ -0,0 +1,548 @@
|
||||
<?php
|
||||
/*
|
||||
* @package Joomla
|
||||
* @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();
|
||||
|
||||
class PhocaGalleryCpControllerPhocaGalleryinstall extends PhocaGalleryCpController
|
||||
{
|
||||
function __construct() {
|
||||
parent::__construct();
|
||||
$this->registerTask( 'install' , 'install' );
|
||||
$this->registerTask( 'upgrade' , 'upgrade' );
|
||||
}
|
||||
|
||||
function install() {
|
||||
$db = JFactory::getDBO();
|
||||
//$dbPref = $db->getPrefix();
|
||||
$msgSQL = $msgFile = $msgError = '';
|
||||
|
||||
// ------------------------------------------
|
||||
// PHOCAGALLERY
|
||||
// ------------------------------------------
|
||||
$query =' DROP TABLE IF EXISTS '.$db->quoteName('#__phocagallery').';';
|
||||
$db->setQuery( $query );
|
||||
if (!$result = $db->query()){$msgSQL .= $db->stderr() . '<br />';}
|
||||
|
||||
$query =' CREATE TABLE '.$db->quoteName('#__phocagallery').'('."\n";
|
||||
$query.=' '.$db->quoteName('id').' int(11) unsigned NOT NULL auto_increment,'."\n";
|
||||
$query.=' '.$db->quoteName('catid').' int(11) NOT NULL default \'0\','."\n";
|
||||
$query.=' '.$db->quoteName('sid').' int(11) NOT NULL default \'0\','."\n";
|
||||
$query.=' '.$db->quoteName('title').' varchar(250) NOT NULL default \'\','."\n";
|
||||
$query.=' '.$db->quoteName('alias').' varchar(255) NOT NULL default \'\','."\n";
|
||||
$query.=' '.$db->quoteName('filename').' varchar(250) NOT NULL default \'\','."\n";
|
||||
$query.=' '.$db->quoteName('description').' text,'."\n";
|
||||
$query.=' '.$db->quoteName('date').' datetime NOT NULL default \'0000-00-00 00:00:00\','."\n";
|
||||
$query.=' '.$db->quoteName('hits').' int(11) NOT NULL default \'0\','."\n";
|
||||
$query.=' '.$db->quoteName('latitude').' varchar(20) NOT NULL default \'\','."\n";
|
||||
$query.=' '.$db->quoteName('longitude').' varchar(20) NOT NULL default \'\','."\n";
|
||||
$query.=' '.$db->quoteName('zoom').' int(3) NOT NULL default \'0\','."\n";
|
||||
$query.=' '.$db->quoteName('geotitle').' varchar(255) NOT NULL default \'\','."\n";
|
||||
$query.=' '.$db->quoteName('userid').' int(11) NOT NULL default \'0\','."\n";
|
||||
$query.=' '.$db->quoteName('videocode').' text,'."\n";
|
||||
$query.=' '.$db->quoteName('vmproductid').' int(11) NOT NULL default \'0\','."\n";
|
||||
$query.=' '.$db->quoteName('pcproductid').' int(11) NOT NULL default \'0\','."\n";
|
||||
$query.=' '.$db->quoteName('imgorigsize').' int(11) NOT NULL default \'0\','."\n";
|
||||
$query.=' '.$db->quoteName('published').' tinyint(1) NOT NULL default \'0\','."\n";
|
||||
$query.=' '.$db->quoteName('approved').' tinyint(1) NOT NULL default \'0\','."\n";
|
||||
$query.=' '.$db->quoteName('checked_out').' int(11) NOT NULL default \'0\','."\n";
|
||||
$query.=' '.$db->quoteName('checked_out_time').' datetime NOT NULL default \'0000-00-00 00:00:00\','."\n";
|
||||
$query.=' '.$db->quoteName('ordering').' int(11) NOT NULL default \'0\','."\n";
|
||||
$query.=' '.$db->quoteName('params').' text,'."\n";
|
||||
$query.=' '.$db->quoteName('metakey').' text,'."\n";
|
||||
$query.=' '.$db->quoteName('metadesc').' text,'."\n";
|
||||
$query.=' '.$db->quoteName('metadata').' text,'."\n";
|
||||
$query.=' '.$db->quoteName('extlink1').' text,'."\n";
|
||||
$query.=' '.$db->quoteName('extlink2').' text,'."\n";
|
||||
$query.=' '.$db->quoteName('extid').' varchar(255) NOT NULL default \'\','."\n";
|
||||
$query.=' '.$db->quoteName('exttype').' tinyint(1) NOT NULL default \'0\','."\n";
|
||||
$query.=' '.$db->quoteName('extl').' varchar(255) NOT NULL default \'\','."\n";
|
||||
$query.=' '.$db->quoteName('extm').' varchar(255) NOT NULL default \'\','."\n";
|
||||
$query.=' '.$db->quoteName('exts').' varchar(255) NOT NULL default \'\','."\n";
|
||||
$query.=' '.$db->quoteName('exto').' varchar(255) NOT NULL default \'\','."\n";
|
||||
$query.=' '.$db->quoteName('extw').' varchar(255) NOT NULL default \'\','."\n";
|
||||
$query.=' '.$db->quoteName('exth').' varchar(255) NOT NULL default \'\','."\n";
|
||||
$query.=' '.$db->quoteName('language').' char(7) NOT NULL default \'\','."\n";
|
||||
$query.=' PRIMARY KEY ('.$db->quoteName('id').'),'."\n";
|
||||
$query.=' KEY '.$db->quoteName('catid').' ('.$db->quoteName('catid').','.$db->quoteName('published').')'."\n";
|
||||
$query.=') DEFAULT CHARSET=utf8;'."\n";
|
||||
$query.=''."\n";
|
||||
|
||||
$db->setQuery( $query );
|
||||
if (!$result = $db->query()){$msgSQL .= $db->stderr() . '<br />';}
|
||||
|
||||
// ------------------------------------------
|
||||
// PHOCAGALLERY CATEGORIES
|
||||
// ------------------------------------------
|
||||
$query=' DROP TABLE IF EXISTS '.$db->quoteName('#__phocagallery_categories').';'."\n";
|
||||
|
||||
$db->setQuery( $query );
|
||||
if (!$result = $db->query()){$msgSQL .= $db->stderr() . '<br />';}
|
||||
|
||||
$query=' CREATE TABLE '.$db->quoteName('#__phocagallery_categories').' ('."\n";
|
||||
$query.=' '.$db->quoteName('id').' int(11) NOT NULL auto_increment,'."\n";
|
||||
$query.=' '.$db->quoteName('parent_id').' int(11) NOT NULL default 0,'."\n";
|
||||
$query.=' '.$db->quoteName('owner_id').' int(11) NOT NULL default 0,'."\n";
|
||||
$query.=' '.$db->quoteName('title').' varchar(255) NOT NULL default \'\','."\n";
|
||||
$query.=' '.$db->quoteName('name').' varchar(255) NOT NULL default \'\','."\n";
|
||||
$query.=' '.$db->quoteName('alias').' varchar(255) NOT NULL default \'\','."\n";
|
||||
$query.=' '.$db->quoteName('image').' varchar(255) NOT NULL default \'\','."\n";
|
||||
$query.=' '.$db->quoteName('section').' varchar(50) NOT NULL default \'\','."\n";
|
||||
$query.=' '.$db->quoteName('image_position').' varchar(30) NOT NULL default \'\','."\n";
|
||||
$query.=' '.$db->quoteName('description').' text,'."\n";
|
||||
$query.=' '.$db->quoteName('date').' datetime NOT NULL default \'0000-00-00 00:00:00\','."\n";
|
||||
$query.=' '.$db->quoteName('published').' tinyint(1) NOT NULL default \'0\','."\n";
|
||||
$query.=' '.$db->quoteName('approved').' tinyint(1) NOT NULL default \'0\','."\n";
|
||||
$query.=' '.$db->quoteName('checked_out').' int(11) unsigned NOT NULL default \'0\','."\n";
|
||||
$query.=' '.$db->quoteName('checked_out_time').' datetime NOT NULL default \'0000-00-00 00:00:00\','."\n";
|
||||
$query.=' '.$db->quoteName('editor').' varchar(50) default NULL,'."\n";
|
||||
$query.=' '.$db->quoteName('ordering').' int(11) NOT NULL default \'0\','."\n";
|
||||
$query.=' '.$db->quoteName('access').' tinyint(3) unsigned NOT NULL default \'0\','."\n";
|
||||
$query.=' '.$db->quoteName('count').' int(11) NOT NULL default \'0\','."\n";
|
||||
$query.=' '.$db->quoteName('hits').' int(11) NOT NULL default \'0\','."\n";
|
||||
$query.=' '.$db->quoteName('accessuserid').' text,'."\n";
|
||||
$query.=' '.$db->quoteName('uploaduserid').' text,'."\n";
|
||||
$query.=' '.$db->quoteName('deleteuserid').' text,'."\n";
|
||||
$query.=' '.$db->quoteName('userfolder').' text,'."\n";
|
||||
$query.=' '.$db->quoteName('latitude').' varchar(20) NOT NULL default \'\','."\n";
|
||||
$query.=' '.$db->quoteName('longitude').' varchar(20) NOT NULL default \'\','."\n";
|
||||
$query.=' '.$db->quoteName('zoom').' int(3) NOT NULL default \'0\','."\n";
|
||||
$query.=' '.$db->quoteName('geotitle').' varchar(255) NOT NULL default \'\','."\n";
|
||||
$query.=' '.$db->quoteName('extid').' varchar(255) NOT NULL default \'\','."\n";
|
||||
$query.=' '.$db->quoteName('exta').' varchar(255) NOT NULL default \'\','."\n";
|
||||
$query.=' '.$db->quoteName('extu').' varchar(255) NOT NULL default \'\','."\n";
|
||||
$query.=' '.$db->quoteName('extauth').' varchar(255) NOT NULL default \'\','."\n";
|
||||
$query.=' '.$db->quoteName('extfbuid').' int(11) NOT NULL default \'0\','."\n";
|
||||
$query.=' '.$db->quoteName('extfbcatid').' varchar(255) NOT NULL default \'\','."\n";
|
||||
$query.=' '.$db->quoteName('params').' text,'."\n";
|
||||
$query.=' '.$db->quoteName('metakey').' text,'."\n";
|
||||
$query.=' '.$db->quoteName('metadesc').' text,'."\n";
|
||||
$query.=' '.$db->quoteName('metadata').' text,'."\n";
|
||||
$query.=' '.$db->quoteName('language').' char(7) NOT NULL default \'\','."\n";
|
||||
$query.=' PRIMARY KEY ('.$db->quoteName('id').'),'."\n";
|
||||
$query.=' KEY '.$db->quoteName('cat_idx').' ('.$db->quoteName('section').','.$db->quoteName('published').','.$db->quoteName('access').'),'."\n";
|
||||
$query.=' KEY '.$db->quoteName('idx_access').' ('.$db->quoteName('access').'),'."\n";
|
||||
$query.=' KEY '.$db->quoteName('idx_checkout').' ('.$db->quoteName('checked_out').')'."\n";
|
||||
$query.=') DEFAULT CHARSET=utf8;';
|
||||
|
||||
$db->setQuery( $query );
|
||||
if (!$result = $db->query()){$msgSQL .= $db->stderr() . '<br />';}
|
||||
|
||||
// ------------------------------------------
|
||||
// PHOCAGALLERY VOTES
|
||||
// ------------------------------------------
|
||||
$query ='DROP TABLE IF EXISTS '.$db->quoteName('#__phocagallery_votes').';'."\n";
|
||||
|
||||
$db->setQuery( $query );
|
||||
if (!$result = $db->query()){$msgSQL .= $db->stderr() . '<br />';}
|
||||
|
||||
$query =' CREATE TABLE '.$db->quoteName('#__phocagallery_votes').' ('."\n";
|
||||
$query.=' '.$db->quoteName('id').' int(11) NOT NULL auto_increment,'."\n";
|
||||
$query.=' '.$db->quoteName('catid').' int(11) NOT NULL default 0,'."\n";
|
||||
$query.=' '.$db->quoteName('userid').' int(11) NOT NULL default 0,'."\n";
|
||||
$query.=' '.$db->quoteName('date').' datetime NOT NULL default \'0000-00-00 00:00:00\','."\n";
|
||||
$query.=' '.$db->quoteName('rating').' tinyint(1) NOT NULL default \'0\','."\n";
|
||||
$query.=' '.$db->quoteName('published').' tinyint(1) NOT NULL default \'0\','."\n";
|
||||
$query.=' '.$db->quoteName('checked_out').' int(11) unsigned NOT NULL default \'0\','."\n";
|
||||
$query.=' '.$db->quoteName('checked_out_time').' datetime NOT NULL default \'0000-00-00 00:00:00\','."\n";
|
||||
$query.=' '.$db->quoteName('ordering').' int(11) NOT NULL default \'0\','."\n";
|
||||
$query.=' '.$db->quoteName('params').' text,'."\n";
|
||||
$query.=' '.$db->quoteName('language').' char(7) NOT NULL default \'\','."\n";
|
||||
$query.=' PRIMARY KEY ('.$db->quoteName('id').')'."\n";
|
||||
$query.=') DEFAULT CHARSET=utf8;'."\n";
|
||||
|
||||
$db->setQuery( $query );
|
||||
if (!$result = $db->query()){$msgSQL .= $db->stderr() . '<br />';}
|
||||
|
||||
// ------------------------------------------
|
||||
// PHOCAGALLERY COMMENTS
|
||||
// ------------------------------------------
|
||||
$query ='DROP TABLE IF EXISTS '.$db->quoteName('#__phocagallery_comments').';'."\n";
|
||||
|
||||
$db->setQuery( $query );
|
||||
if (!$result = $db->query()){$msgSQL .= $db->stderr() . '<br />';}
|
||||
|
||||
$query =' CREATE TABLE '.$db->quoteName('#__phocagallery_comments').' ('."\n";
|
||||
$query.=' '.$db->quoteName('id').' int(11) NOT NULL auto_increment,'."\n";
|
||||
$query.=' '.$db->quoteName('catid').' int(11) NOT NULL default 0,'."\n";
|
||||
$query.=' '.$db->quoteName('userid').' int(11) NOT NULL default 0,'."\n";
|
||||
$query.=' '.$db->quoteName('date').' datetime NOT NULL default \'0000-00-00 00:00:00\','."\n";
|
||||
$query.=' '.$db->quoteName('title').' varchar(255) NOT NULL default \'\','."\n";
|
||||
$query.=' '.$db->quoteName('alias').' varchar(255) NOT NULL default \'\','."\n";
|
||||
$query.=' '.$db->quoteName('comment').' text,'."\n";
|
||||
$query.=' '.$db->quoteName('published').' tinyint(1) NOT NULL default \'0\','."\n";
|
||||
$query.=' '.$db->quoteName('checked_out').' int(11) unsigned NOT NULL default \'0\','."\n";
|
||||
$query.=' '.$db->quoteName('checked_out_time').' datetime NOT NULL default \'0000-00-00 00:00:00\','."\n";
|
||||
$query.=' '.$db->quoteName('ordering').' int(11) NOT NULL default \'0\','."\n";
|
||||
$query.=' '.$db->quoteName('params').' text,'."\n";
|
||||
$query.=' '.$db->quoteName('language').' char(7) NOT NULL default \'\','."\n";
|
||||
$query.=' PRIMARY KEY ('.$db->quoteName('id').')'."\n";
|
||||
$query.=') DEFAULT CHARSET=utf8;'."\n";
|
||||
|
||||
$db->setQuery( $query );
|
||||
if (!$result = $db->query()){$msgSQL .= $db->stderr() . '<br />';}
|
||||
|
||||
// ------------------------------------------
|
||||
// PHOCAGALLERY VOTES STATISTICS
|
||||
// ------------------------------------------
|
||||
$query ='DROP TABLE IF EXISTS '.$db->quoteName('#__phocagallery_votes_statistics').';'."\n";
|
||||
|
||||
$db->setQuery( $query );
|
||||
if (!$result = $db->query()){$msgSQL .= $db->stderr() . '<br />';}
|
||||
|
||||
$query =' CREATE TABLE '.$db->quoteName('#__phocagallery_votes_statistics').' ('."\n";
|
||||
$query.=' '.$db->quoteName('id').' int(11) NOT NULL auto_increment,'."\n";
|
||||
$query.=' '.$db->quoteName('catid').' int(11) NOT NULL default 0,'."\n";
|
||||
$query.=' '.$db->quoteName('count').' int(11) NOT NULL default \'0\','."\n";
|
||||
$query.=' '.$db->quoteName('average').' float(8,6) NOT NULL default \'0\','."\n";
|
||||
$query.=' '.$db->quoteName('language').' char(7) NOT NULL default \'\','."\n";
|
||||
$query.=' PRIMARY KEY ('.$db->quoteName('id').')'."\n";
|
||||
$query.=') DEFAULT CHARSET=utf8;'."\n";
|
||||
|
||||
$db->setQuery( $query );
|
||||
if (!$result = $db->query()){$msgSQL .= $db->stderr() . '<br />';}
|
||||
|
||||
// ------------------------------------------
|
||||
// PHOCAGALLERY USER CATEGORY
|
||||
// ------------------------------------------
|
||||
// Removed in 2.6.0
|
||||
/* $query ='DROP TABLE IF EXISTS '.$db->quoteName('#__phocagallery_user_category').';'."\n";
|
||||
|
||||
$db->setQuery( $query );
|
||||
if (!$result = $db->query()){$msgSQL .= $db->stderr() . '<br />';}
|
||||
|
||||
$query =' CREATE TABLE '.$db->quoteName('#__phocagallery_user_category').' ('."\n";
|
||||
$query.=' '.$db->quoteName('id').' int(11) NOT NULL auto_increment,'."\n";
|
||||
$query.=' '.$db->quoteName('catid').' int(11) NOT NULL default 0,'."\n";
|
||||
$query.=' '.$db->quoteName('userid').' int(11) NOT NULL default 0,'."\n";
|
||||
$query.=' PRIMARY KEY ('.$db->quoteName('id').'),'."\n";
|
||||
$query.=' KEY '.$db->quoteName('catid').' ('.$db->quoteName('catid').','.$db->quoteName('userid').')'."\n";
|
||||
$query.=') ENGINE=MyISAM CHARACTER SET '.$db->quoteName('utf8').';'."\n";
|
||||
|
||||
$db->setQuery( $query );
|
||||
if (!$result = $db->query()){$msgSQL .= $db->stderr() . '<br />';}
|
||||
*/
|
||||
// ------------------------------------------
|
||||
// PHOCAGALLERY IMAGE VOTES (2.5.0)
|
||||
// ------------------------------------------
|
||||
$query ='DROP TABLE IF EXISTS '.$db->quoteName('#__phocagallery_img_votes').';'."\n";
|
||||
|
||||
$db->setQuery( $query );
|
||||
if (!$result = $db->query()){$msgSQL .= $db->stderr() . '<br />';}
|
||||
|
||||
$query =' CREATE TABLE '.$db->quoteName('#__phocagallery_img_votes').' ('."\n";
|
||||
$query.=' '.$db->quoteName('id').' int(11) NOT NULL auto_increment,'."\n";
|
||||
$query.=' '.$db->quoteName('imgid').' int(11) NOT NULL default 0,'."\n";
|
||||
$query.=' '.$db->quoteName('userid').' int(11) NOT NULL default 0,'."\n";
|
||||
$query.=' '.$db->quoteName('date').' datetime NOT NULL default \'0000-00-00 00:00:00\','."\n";
|
||||
$query.=' '.$db->quoteName('rating').' tinyint(1) NOT NULL default \'0\','."\n";
|
||||
$query.=' '.$db->quoteName('published').' tinyint(1) NOT NULL default \'0\','."\n";
|
||||
$query.=' '.$db->quoteName('checked_out').' int(11) unsigned NOT NULL default \'0\','."\n";
|
||||
$query.=' '.$db->quoteName('checked_out_time').' datetime NOT NULL default \'0000-00-00 00:00:00\','."\n";
|
||||
$query.=' '.$db->quoteName('ordering').' int(11) NOT NULL default \'0\','."\n";
|
||||
$query.=' '.$db->quoteName('params').' text,'."\n";
|
||||
$query.=' '.$db->quoteName('language').' char(7) NOT NULL default \'\','."\n";
|
||||
$query.=' PRIMARY KEY ('.$db->quoteName('id').')'."\n";
|
||||
$query.=') DEFAULT CHARSET=utf8;'."\n";
|
||||
|
||||
$db->setQuery( $query );
|
||||
if (!$result = $db->query()){$msgSQL .= $db->stderr() . '<br />';}
|
||||
|
||||
// ------------------------------------------
|
||||
// PHOCAGALLERY IMAGE VOTES STATISTICS (2.5.0)
|
||||
// ------------------------------------------
|
||||
$query ='DROP TABLE IF EXISTS '.$db->quoteName('#__phocagallery_img_votes_statistics').';'."\n";
|
||||
|
||||
$db->setQuery( $query );
|
||||
if (!$result = $db->query()){$msgSQL .= $db->stderr() . '<br />';}
|
||||
|
||||
$query =' CREATE TABLE '.$db->quoteName('#__phocagallery_img_votes_statistics').' ('."\n";
|
||||
$query.=' '.$db->quoteName('id').' int(11) NOT NULL auto_increment,'."\n";
|
||||
$query.=' '.$db->quoteName('imgid').' int(11) NOT NULL default 0,'."\n";
|
||||
$query.=' '.$db->quoteName('count').' int(11) NOT NULL default \'0\','."\n";
|
||||
$query.=' '.$db->quoteName('average').' float(8,6) NOT NULL default \'0\','."\n";
|
||||
$query.=' '.$db->quoteName('language').' char(7) NOT NULL default \'\','."\n";
|
||||
$query.=' PRIMARY KEY ('.$db->quoteName('id').')'."\n";
|
||||
$query.=') DEFAULT CHARSET=utf8;'."\n";
|
||||
|
||||
$db->setQuery( $query );
|
||||
if (!$result = $db->query()){$msgSQL .= $db->stderr() . '<br />';}
|
||||
|
||||
|
||||
|
||||
// ------------------------------------------
|
||||
// PHOCAGALLERY USER (2.6.0)
|
||||
// ------------------------------------------
|
||||
$query ='DROP TABLE IF EXISTS '.$db->quoteName('#__phocagallery_user').';'."\n";
|
||||
|
||||
$db->setQuery( $query );
|
||||
if (!$result = $db->query()){$msgSQL .= $db->stderr() . '<br />';}
|
||||
|
||||
$query =' CREATE TABLE '.$db->quoteName('#__phocagallery_user').' ('."\n";
|
||||
$query.=' '.$db->quoteName('id').' int(11) NOT NULL auto_increment,'."\n";
|
||||
$query.=' '.$db->quoteName('userid').' int(11) NOT NULL default 0,'."\n";
|
||||
$query.=' '.$db->quoteName('avatar').' varchar(40) NOT NULL default \'\','."\n";
|
||||
$query.=' '.$db->quoteName('published').' tinyint(1) NOT NULL default \'0\','."\n";
|
||||
$query.=' '.$db->quoteName('approved').' tinyint(1) NOT NULL default \'0\','."\n";
|
||||
$query.=' '.$db->quoteName('checked_out').' int(11) NOT NULL default \'0\','."\n";
|
||||
$query.=' '.$db->quoteName('checked_out_time').' datetime NOT NULL default \'0000-00-00 00:00:00\','."\n";
|
||||
$query.=' '.$db->quoteName('ordering').' int(11) NOT NULL default \'0\','."\n";
|
||||
$query.=' '.$db->quoteName('params').' text,'."\n";
|
||||
$query.=' '.$db->quoteName('language').' char(7) NOT NULL default \'\','."\n";
|
||||
$query.=' PRIMARY KEY ('.$db->quoteName('id').'),'."\n";
|
||||
$query.=' KEY '.$db->quoteName('userid').' ('.$db->quoteName('userid').')'."\n";
|
||||
$query.=') DEFAULT CHARSET=utf8;'."\n";
|
||||
|
||||
$db->setQuery( $query );
|
||||
if (!$result = $db->query()){$msgSQL .= $db->stderr() . '<br />';}
|
||||
|
||||
|
||||
// ------------------------------------------
|
||||
// PHOCAGALLERY IMAGES COMMENTS 2.6.0
|
||||
// ------------------------------------------
|
||||
$query ='DROP TABLE IF EXISTS '.$db->quoteName('#__phocagallery_img_comments').';'."\n";
|
||||
|
||||
$db->setQuery( $query );
|
||||
if (!$result = $db->query()){$msgSQL .= $db->stderr() . '<br />';}
|
||||
|
||||
$query =' CREATE TABLE '.$db->quoteName('#__phocagallery_img_comments').' ('."\n";
|
||||
$query.=' '.$db->quoteName('id').' int(11) NOT NULL auto_increment,'."\n";
|
||||
$query.=' '.$db->quoteName('imgid').' int(11) NOT NULL default 0,'."\n";
|
||||
$query.=' '.$db->quoteName('userid').' int(11) NOT NULL default 0,'."\n";
|
||||
$query.=' '.$db->quoteName('date').' datetime NOT NULL default \'0000-00-00 00:00:00\','."\n";
|
||||
$query.=' '.$db->quoteName('title').' varchar(255) NOT NULL default \'\','."\n";
|
||||
$query.=' '.$db->quoteName('alias').' varchar(255) NOT NULL default \'\','."\n";
|
||||
$query.=' '.$db->quoteName('comment').' text,'."\n";
|
||||
$query.=' '.$db->quoteName('published').' tinyint(1) NOT NULL default \'0\','."\n";
|
||||
$query.=' '.$db->quoteName('checked_out').' int(11) unsigned NOT NULL default \'0\','."\n";
|
||||
$query.=' '.$db->quoteName('checked_out_time').' datetime NOT NULL default \'0000-00-00 00:00:00\','."\n";
|
||||
$query.=' '.$db->quoteName('ordering').' int(11) NOT NULL default \'0\','."\n";
|
||||
$query.=' '.$db->quoteName('params').' text,'."\n";
|
||||
$query.=' '.$db->quoteName('language').' char(7) NOT NULL default \'\','."\n";
|
||||
$query.=' PRIMARY KEY ('.$db->quoteName('id').')'."\n";
|
||||
$query.=') DEFAULT CHARSET=utf8;'."\n";
|
||||
|
||||
$db->setQuery( $query );
|
||||
if (!$result = $db->query()){$msgSQL .= $db->stderr() . '<br />';}
|
||||
|
||||
// ------------------------------------------
|
||||
// PHOCAGALLERY FB 3.0.0
|
||||
// ------------------------------------------
|
||||
$query ='DROP TABLE IF EXISTS '.$db->quoteName('#__phocagallery_fb_users').';'."\n";
|
||||
|
||||
$db->setQuery( $query );
|
||||
if (!$result = $db->query()){$msgSQL .= $db->stderr() . '<br />';}
|
||||
|
||||
$query =' CREATE TABLE '.$db->quoteName('#__phocagallery_fb_users').' ('."\n";
|
||||
$query.=' '.$db->quoteName('id').' int(11) NOT NULL auto_increment,'."\n";
|
||||
$query.=' '.$db->quoteName('appid').' varchar(255) NOT NULL default \'\','."\n";
|
||||
$query.=' '.$db->quoteName('appsid').' varchar(255) NOT NULL default \'\','."\n";
|
||||
$query.=' '.$db->quoteName('uid').' varchar(255) NOT NULL default \'\','."\n";
|
||||
$query.=' '.$db->quoteName('name').' varchar(255) NOT NULL default \'\','."\n";
|
||||
$query.=' '.$db->quoteName('link').' varchar(255) NOT NULL default \'\','."\n";
|
||||
$query.=' '.$db->quoteName('secret').' varchar(255) NOT NULL default \'\','."\n";
|
||||
$query.=' '.$db->quoteName('base_domain').' varchar(255) NOT NULL default \'\','."\n";
|
||||
$query.=' '.$db->quoteName('expires').' varchar(100) NOT NULL default \'\','."\n";
|
||||
$query.=' '.$db->quoteName('session_key').' text,'."\n";
|
||||
$query.=' '.$db->quoteName('access_token').' text,'."\n";
|
||||
$query.=' '.$db->quoteName('sig').' text,'."\n";
|
||||
$query.=' '.$db->quoteName('fanpageid').' varchar(255) NOT NULL default \'\','."\n";
|
||||
$query.=' '.$db->quoteName('published').' tinyint(1) NOT NULL default \'0\','."\n";
|
||||
$query.=' '.$db->quoteName('checked_out').' int(11) unsigned NOT NULL default \'0\','."\n";
|
||||
$query.=' '.$db->quoteName('checked_out_time').' datetime NOT NULL default \'0000-00-00 00:00:00\','."\n";
|
||||
$query.=' '.$db->quoteName('ordering').' int(11) NOT NULL default \'0\','."\n";
|
||||
$query.=' '.$db->quoteName('comments').' text,'."\n";
|
||||
$query.=' '.$db->quoteName('params').' text,'."\n";
|
||||
$query.=' '.$db->quoteName('language').' char(7) NOT NULL default \'\','."\n";
|
||||
$query.=' PRIMARY KEY ('.$db->quoteName('id').')'."\n";
|
||||
$query.=') DEFAULT CHARSET=utf8;'."\n";
|
||||
|
||||
$db->setQuery( $query );
|
||||
if (!$result = $db->query()){$msgSQL .= $db->stderr() . '<br />';}
|
||||
|
||||
// ------------------------------------------
|
||||
// PHOCAGALLERY TAGS (3.1.0)
|
||||
// ------------------------------------------
|
||||
|
||||
$query =' DROP TABLE IF EXISTS '.$db->quoteName('#__phocagallery_tags').' ;';
|
||||
$db->setQuery( $query );
|
||||
if (!$result = $db->query()){$msgSQL .= $db->stderr() . '<br />';}
|
||||
|
||||
$query ='CREATE TABLE '.$db->quoteName('#__phocagallery_tags').' ('."\n";
|
||||
$query.=' '.$db->quoteName('id').' int(11) NOT NULL auto_increment,'."\n";
|
||||
$query.=' '.$db->quoteName('title').' varchar(255) NOT NULL default \'\','."\n";
|
||||
$query.=' '.$db->quoteName('alias').' varchar(255) NOT NULL default \'\','."\n";
|
||||
$query.=' '.$db->quoteName('link_cat').' int(11) NOT NULL default 0,'."\n";
|
||||
$query.=' '.$db->quoteName('link_ext').' varchar(255) NOT NULL default \'\','."\n";
|
||||
$query.=' '.$db->quoteName('description').' text,'."\n";
|
||||
$query.=' '.$db->quoteName('published').' tinyint(1) NOT NULL default \'0\','."\n";
|
||||
$query.=' '.$db->quoteName('checked_out').' int(11) unsigned NOT NULL default \'0\','."\n";
|
||||
$query.=' '.$db->quoteName('checked_out_time').' datetime NOT NULL default \'0000-00-00 00:00:00\','."\n";
|
||||
$query.=' '.$db->quoteName('ordering').' int(11) NOT NULL default \'0\','."\n";
|
||||
$query.=' '.$db->quoteName('params').' text,'."\n";
|
||||
$query.=' '.$db->quoteName('language').' char(7) NOT NULL default \'\','."\n";
|
||||
$query.=' PRIMARY KEY ('.$db->quoteName('id').')'."\n";
|
||||
$query.=') DEFAULT CHARSET=utf8;'."\n";
|
||||
|
||||
$db->setQuery( $query );
|
||||
if (!$result = $db->query()){$msgSQL .= $db->stderr() . '<br />';}
|
||||
|
||||
|
||||
|
||||
$query =' DROP TABLE IF EXISTS '.$db->quoteName('#__phocagallery_tags_ref').' ;';
|
||||
$db->setQuery( $query );
|
||||
if (!$result = $db->query()){$msgSQL .= $db->stderr() . '<br />';}
|
||||
|
||||
$query ='CREATE TABLE '.$db->quoteName('#__phocagallery_tags_ref').' ('."\n";
|
||||
$query.=' '.$db->quoteName('id').' SERIAL,'."\n";
|
||||
$query.=' '.$db->quoteName('imgid').' int(11) NOT NULL default 0,'."\n";
|
||||
$query.=' '.$db->quoteName('tagid').' int(11) NOT NULL default 0,'."\n";
|
||||
$query.=' PRIMARY KEY ('.$db->quoteName('id').'),'."\n";
|
||||
$query.=' UNIQUE KEY '.$db->quoteName('i_imgid').' ('.$db->quoteName('imgid').','.$db->quoteName('tagid').')'."\n";
|
||||
$query.=') DEFAULT CHARSET=utf8;'."\n";
|
||||
|
||||
$query =' DROP TABLE IF EXISTS '.$db->quoteName('#__phocagallery_styles').' ;';
|
||||
$db->setQuery( $query );
|
||||
if (!$result = $db->query()){$msgSQL .= $db->stderr() . '<br />';}
|
||||
|
||||
$query ='CREATE TABLE '.$db->quoteName('#__phocagallery_styles').' ('."\n";
|
||||
$query.=' '.$db->quoteName('id').' int(11) NOT NULL auto_increment,'."\n";
|
||||
$query.=' '.$db->quoteName('title').' varchar(255) NOT NULL default \'\','."\n";
|
||||
$query.=' '.$db->quoteName('alias').' varchar(255) NOT NULL default \'\','."\n";
|
||||
$query.=' '.$db->quoteName('filename').' varchar(255) NOT NULL default \'\','."\n";
|
||||
$query.=' '.$db->quoteName('menulink').' text,'."\n";
|
||||
$query.=' '.$db->quoteName('type').' tinyint(1) NOT NULL default \'0\','."\n";
|
||||
$query.=' '.$db->quoteName('published').' tinyint(1) NOT NULL default \'0\','."\n";
|
||||
$query.=' '.$db->quoteName('checked_out').' int(11) unsigned NOT NULL default \'0\','."\n";
|
||||
$query.=' '.$db->quoteName('checked_out_time').' datetime NOT NULL default \'0000-00-00 00:00:00\','."\n";
|
||||
$query.=' '.$db->quoteName('ordering').' int(11) NOT NULL default \'0\','."\n";
|
||||
$query.=' '.$db->quoteName('params').' text,'."\n";
|
||||
$query.=' '.$db->quoteName('language').' char(7) NOT NULL default \'\','."\n";
|
||||
$query.=' PRIMARY KEY ('.$db->quoteName('id').')'."\n";
|
||||
$query.=') DEFAULT CHARSET=utf8;'."\n";
|
||||
|
||||
|
||||
|
||||
|
||||
$db->setQuery( $query );
|
||||
if (!$result = $db->query()){$msgSQL .= $db->stderr() . '<br />';}
|
||||
|
||||
|
||||
// Error
|
||||
if ($msgSQL !='') {
|
||||
$msgError .= '<br />' . $msgSQL;
|
||||
}
|
||||
/*if ($msgFile !='') {
|
||||
$msgError .= '<br />' . $msgFile;
|
||||
}*/
|
||||
|
||||
// End Message
|
||||
if ($msgError !='') {
|
||||
$msg = JText::_( 'Phoca Gallery not successfully installed' ) . ': ' . $msgError;
|
||||
} else {
|
||||
$msg = JText::_( 'Phoca Gallery successfully installed' );
|
||||
}
|
||||
|
||||
$link = 'index.php?option=com_phocagallery';
|
||||
$this->setRedirect($link, $msg);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function upgrade() {
|
||||
|
||||
$db =JFactory::getDBO();
|
||||
//$dbPref = $db->getPrefix();
|
||||
$msgSQL = $msgFile = $msgError = '';
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Error
|
||||
if ($msgSQL !='') {
|
||||
$msgError .= '<br />' . $msgSQL;
|
||||
}
|
||||
/*
|
||||
/*if ($msgFile !='') {
|
||||
$msgError .= '<br />' . $msgFile;
|
||||
}*/
|
||||
// End Message
|
||||
if ($msgError !='') {
|
||||
$msg = JText::_( 'Phoca Gallery not successfully upgraded' ) . ': ' . $msgError;
|
||||
} else {
|
||||
$msg = JText::_( 'Phoca Gallery successfully upgraded' );
|
||||
}
|
||||
/*
|
||||
$linkUpgrade = '';
|
||||
foreach ($convertDataNeeded as $key => $value) {
|
||||
if ($value == 1) {
|
||||
$linkUpgrade .= '&'.$key.'=1';
|
||||
}
|
||||
}
|
||||
if ($linkUpgrade != '') {
|
||||
$link = 'index.php?option=com_phocagallery&view=phocagalleryupgrade'.$linkUpgrade;
|
||||
} else {
|
||||
$link = 'index.php?option=com_phocagallery';
|
||||
}*/
|
||||
$link = 'index.php?option=com_phocagallery';
|
||||
$this->setRedirect($link, $msg);
|
||||
}
|
||||
|
||||
|
||||
function AddColumnIfNotExists(&$errorMsg, $table, $column, $attributes = "INT( 11 ) NOT NULL default '0'", $after = '' ) {
|
||||
|
||||
$app = JFactory::getApplication();
|
||||
$db =JFactory::getDBO();
|
||||
$columnExists = false;
|
||||
|
||||
$query = 'SHOW COLUMNS FROM '.$table;
|
||||
$db->setQuery( $query );
|
||||
if (!$result = $db->query()){return false;}
|
||||
$columnData = $db->loadObjectList();
|
||||
|
||||
foreach ($columnData as $valueColumn) {
|
||||
if ($valueColumn->Field == $column) {
|
||||
$columnExists = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$columnExists) {
|
||||
if ($after != '') {
|
||||
$query = 'ALTER TABLE '.$db->quoteName($table).' ADD '.$db->quoteName($column).' '.$attributes.' AFTER '.$db->quoteName($after).';';
|
||||
} else {
|
||||
$query = 'ALTER TABLE '.$db->quoteName($table).' ADD '.$db->quoteName($column).' '.$attributes.';';
|
||||
}
|
||||
$db->setQuery( $query );
|
||||
if (!$result = $db->query()){return false;}
|
||||
$errorMsg = 'notexistcreated';
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// utf-8 test: ä,ö,ü,ř,ž
|
||||
?>
|
||||
@ -0,0 +1,114 @@
|
||||
<?php
|
||||
/*
|
||||
* @package Joomla
|
||||
* @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
|
||||
*/
|
||||
|
||||
// Check to ensure this file is included in Joomla!
|
||||
defined('_JEXEC') or die();
|
||||
use Joomla\CMS\MVC\Controller\FormController;
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Session\Session;
|
||||
use Joomla\CMS\Router\Route;
|
||||
jimport('joomla.application.component.controllerform');
|
||||
|
||||
class PhocaGalleryCpControllerPhocaGalleryM extends FormController
|
||||
{
|
||||
protected $option = 'com_phocagallery';
|
||||
protected $view_list = 'phocagallerym';
|
||||
protected $layout = 'edit';
|
||||
|
||||
function __construct() {
|
||||
parent::__construct();
|
||||
|
||||
$this->layout = 'edit';
|
||||
// Register Extra tasks
|
||||
//$this->registerTask( 'add' , 'eidt' );
|
||||
//$view = JFactory::getApplication()->input->get( 'view' );
|
||||
|
||||
}
|
||||
|
||||
//public function display() {
|
||||
//$this->setRedirect(JRoute::_('index.php?option='.$this->option.'&view='.$this->view_list.'&layout='.$this->layout, false));
|
||||
//}
|
||||
|
||||
|
||||
|
||||
protected function allowAdd($data = array()) {
|
||||
$user = Factory::getUser();
|
||||
$allow = null;
|
||||
$allow = $user->authorise('core.create', 'com_phocagallery');
|
||||
if ($allow === null) {
|
||||
return parent::allowAdd($data);
|
||||
} else {
|
||||
return $allow;
|
||||
}
|
||||
}
|
||||
|
||||
protected function allowEdit($data = array(), $key = 'id') {
|
||||
$user = Factory::getUser();
|
||||
$allow = null;
|
||||
$allow = $user->authorise('core.edit', 'com_phocagallery');
|
||||
if ($allow === null) {
|
||||
return parent::allowEdit($data, $key);
|
||||
} else {
|
||||
return $allow;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
function save() {
|
||||
Session::checkToken() or jexit(Text::_('JINVALID_TOKEN'));
|
||||
$post = Factory::getApplication()->input->get('post');
|
||||
//$data = JFactory::getApplication()->input->get('jform', array(0), 'post', 'array');
|
||||
$data = $app->input->post->get('jform', array(), 'array');
|
||||
|
||||
if(isset($post['foldercid'])) {
|
||||
$data['foldercid'] = $post['foldercid'];
|
||||
}
|
||||
if(isset($post['cid'])) {
|
||||
$data['cid'] = $post['cid'];
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
$model = $this->getModel( 'phocagallerym' );
|
||||
|
||||
if ($model->save($data)) {
|
||||
$msg = Text::_( 'COM_PHOCAGALLERY_SUCCESS_SAVE_MULTIPLE' );
|
||||
} else {
|
||||
$msg = Text::_( 'COM_PHOCAGALLERY_ERROR_SAVE_MULTIPLE' );
|
||||
}
|
||||
|
||||
$link = 'index.php?option=com_phocagallery&view=phocagalleryimgs';
|
||||
$this->setRedirect($link, $msg);
|
||||
}*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function edit($key = NULL, $urlVar = NULL) {
|
||||
//JFactory::getApplication()->input->set( 'view', 'phocagallerym' );
|
||||
//JFactory::getApplication()->input->set( 'layout', 'Edit' );
|
||||
//JFactory::getApplication()->input->set( 'hidemainmenu', 1 );
|
||||
//PhocaGalleryCpControllerPhocaGalleryM::display();
|
||||
$this->setRedirect(Route::_('index.php?option='.$this->option.'&view='.$this->view_list.'&layout='.$this->layout, false));
|
||||
}
|
||||
|
||||
function cancel($key = NULL) {
|
||||
// Checkin the Phoca Gallery
|
||||
//$model = $this->getModel( 'phocagallery' );
|
||||
//$model->checkin();
|
||||
|
||||
$this->setRedirect( 'index.php?option=com_phocagallery&view=phocagalleryimgs' );
|
||||
}
|
||||
}
|
||||
?>
|
||||
@ -0,0 +1,41 @@
|
||||
<?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;
|
||||
use Joomla\CMS\MVC\Controller\AdminController;
|
||||
use Joomla\CMS\Factory;
|
||||
jimport('joomla.application.component.controlleradmin');
|
||||
|
||||
|
||||
class PhocaGalleryCpControllerPhocaGalleryRa extends AdminController
|
||||
{
|
||||
protected $option = 'com_phocagallery';
|
||||
|
||||
public function getModel($name = 'PhocaGalleryRa', $prefix = 'PhocaGalleryCpModel', $config = [])
|
||||
{
|
||||
$model = parent::getModel($name, $prefix, array('ignore_request' => true));
|
||||
return $model;
|
||||
}
|
||||
|
||||
public function saveOrderAjax() {
|
||||
$pks = $this->input->post->get('cid', array(), 'array');
|
||||
$order = $this->input->post->get('order', array(), 'array');
|
||||
\Joomla\Utilities\ArrayHelper::toInteger($pks);
|
||||
\Joomla\Utilities\ArrayHelper::toInteger($order);
|
||||
$model = $this->getModel();
|
||||
$return = $model->saveorder($pks, $order);
|
||||
if ($return) { echo "1";}
|
||||
Factory::getApplication()->close();
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
@ -0,0 +1,40 @@
|
||||
<?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;
|
||||
use Joomla\CMS\MVC\Controller\AdminController;
|
||||
use Joomla\CMS\Factory;
|
||||
jimport('joomla.application.component.controlleradmin');
|
||||
|
||||
|
||||
class PhocaGalleryCpControllerPhocaGalleryRaImg extends AdminController
|
||||
{
|
||||
protected $option = 'com_phocagallery';
|
||||
|
||||
public function getModel($name = 'PhocaGalleryRaImg', $prefix = 'PhocaGalleryCpModel', $config = array())
|
||||
{
|
||||
$model = parent::getModel($name, $prefix, array('ignore_request' => true));
|
||||
return $model;
|
||||
}
|
||||
|
||||
public function saveOrderAjax() {
|
||||
$pks = $this->input->post->get('cid', array(), 'array');
|
||||
$order = $this->input->post->get('order', array(), 'array');
|
||||
\Joomla\Utilities\ArrayHelper::toInteger($pks);
|
||||
\Joomla\Utilities\ArrayHelper::toInteger($order);
|
||||
$model = $this->getModel();
|
||||
$return = $model->saveorder($pks, $order);
|
||||
if ($return) { echo "1";}
|
||||
Factory::getApplication()->close();
|
||||
}
|
||||
}
|
||||
?>
|
||||
@ -0,0 +1,167 @@
|
||||
<?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();
|
||||
use Joomla\CMS\MVC\Controller\FormController;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Session\Session;
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Client\ClientHelper;
|
||||
jimport('joomla.application.component.controllerform');
|
||||
jimport('joomla.client.helper');
|
||||
|
||||
class PhocaGalleryCpControllerPhocaGalleryT extends FormController
|
||||
{
|
||||
protected $option = 'com_phocagallery';
|
||||
|
||||
function __construct() {
|
||||
parent::__construct();
|
||||
$this->registerTask( 'themeinstall' , 'themeinstall' );
|
||||
$this->registerTask( 'bgimagesmall' , 'bgimagesmall' );
|
||||
$this->registerTask( 'bgimagemedium' , 'bgimagemedium' );
|
||||
$this->registerTask( 'displayeditcss' , 'displayeditcss' );
|
||||
}
|
||||
|
||||
function displayeditcss() {
|
||||
Session::checkToken() or jexit(Text::_('JINVALID_TOKEN'));
|
||||
$fileid = $this->input->get('fileid');
|
||||
$fileid = urldecode(base64_decode($fileid));
|
||||
$model = $this->getModel();
|
||||
echo $model->getFileContent($fileid);
|
||||
Factory::getApplication()->close();
|
||||
}
|
||||
|
||||
function themeinstall() {
|
||||
|
||||
Session::checkToken() or die( 'Invalid Token' );
|
||||
//$post = JFactory::getApplication()->input->get('post');
|
||||
|
||||
$post = array();
|
||||
$post['theme_component'] = Factory::getApplication()->input->get('theme_component', array(), 'raw');
|
||||
$post['theme_categories'] = Factory::getApplication()->input->get('theme_categories', array(), 'raw');
|
||||
$post['theme_category'] = Factory::getApplication()->input->get('theme_category', array(), 'raw');
|
||||
$theme = array();
|
||||
|
||||
if (isset($post['theme_component'])) {
|
||||
//$theme['component'] = 1;
|
||||
}
|
||||
if (isset($post['theme_categories'])) {
|
||||
// TO DO - change to 1 in case the parameters component will be added to Joomla! CMS back
|
||||
$theme['categories'] = 0;
|
||||
}
|
||||
if (isset($post['theme_category'])) {
|
||||
// TO DO - change to 1 in case the parameters component will be added to Joomla! CMS back
|
||||
$theme['category'] = 0;
|
||||
}
|
||||
$theme['component'] = 1;
|
||||
|
||||
if (!empty($theme)) {
|
||||
|
||||
$ftp = ClientHelper::setCredentialsFromRequest('ftp');
|
||||
|
||||
$model = $this->getModel( 'phocagalleryt' );
|
||||
|
||||
if ($model->install($theme)) {
|
||||
$cache = Factory::getCache('mod_menu');
|
||||
$cache->clean();
|
||||
$msg = Text::_('COM_PHOCAGALLERY_SUCCESS_THEME_INSTALLED');
|
||||
}
|
||||
} else {
|
||||
$msg = Text::_('COM_PHOCAGALLERY_ERROR_THEME_APPLICATION_AREA');
|
||||
}
|
||||
|
||||
$this->setRedirect( 'index.php?option=com_phocagallery&view=phocagalleryt', $msg );
|
||||
}
|
||||
|
||||
function cancel($key = NULL) {
|
||||
$this->setRedirect( 'index.php?option=com_phocagallery' );
|
||||
}
|
||||
|
||||
function bgimagesmall() {
|
||||
Session::checkToken() or die( 'Invalid Token' );
|
||||
|
||||
//$post = JFactory::getApplication()->input->get('post');
|
||||
$post = array();
|
||||
$post['siw'] = Factory::getApplication()->input->files->get( 'siw');
|
||||
$post['sih'] = Factory::getApplication()->input->files->get( 'sih');
|
||||
$post['ssbgc'] = Factory::getApplication()->input->files->get( 'ssbgc');
|
||||
$post['sibgc'] = Factory::getApplication()->input->files->get( 'sibgc');
|
||||
$post['sibrdc'] = Factory::getApplication()->input->files->get( 'sibrdc');
|
||||
$post['siec'] = Factory::getApplication()->input->files->get( 'siec');
|
||||
$post['sie'] = Factory::getApplication()->input->files->get( 'sie');
|
||||
|
||||
$data['image'] = 'shadow3';
|
||||
$data['iw'] = $post['siw'];
|
||||
$data['ih'] = $post['sih'];
|
||||
$data['sbgc'] = $post['ssbgc'];
|
||||
$data['ibgc'] = $post['sibgc'];
|
||||
$data['ibrdc'] = $post['sibrdc'];
|
||||
$data['iec'] = $post['siec'];
|
||||
$data['ie'] = $post['sie'];
|
||||
|
||||
phocagalleryimport('phocagallery.image.imagebgimage');
|
||||
$errorMsg = '';
|
||||
$bgImage = PhocaGalleryImageBgImage::createBgImage($data, $errorMsg);
|
||||
|
||||
if ($bgImage) {
|
||||
$msg = Text::_('COM_PHOCAGALLERY_SUCCESS_BG_IMAGE');
|
||||
} else {
|
||||
$msg = Text::_('COM_PHOCAGALLERY_ERROR_BG_IMAGE');
|
||||
if($errorMsg != '') {
|
||||
$msg .= '<br />' . $errorMsg;
|
||||
}
|
||||
}
|
||||
|
||||
$linkSuffix = '&siw='.$post['siw'].'&sih='.$post['sih'].'&ssbgc='.str_replace('#','',$post['ssbgc']).'&sibgc='.str_replace('#','',$post['sibgc']).'&sibrdc='.str_replace('#','',$post['sibrdc']).'&sie='.$post['sie'].'&siec='.str_replace('#','',$post['siec']);
|
||||
|
||||
$this->setRedirect( 'index.php?option=com_phocagallery&view=phocagalleryt'.$linkSuffix , $msg );
|
||||
}
|
||||
|
||||
function bgimagemedium() {
|
||||
Session::checkToken() or die( 'Invalid Token' );
|
||||
//$post = JFactory::getApplication()->input->get('post');
|
||||
$post = array();
|
||||
$post['miw'] = Factory::getApplication()->input->files->get( 'miw');
|
||||
$post['mih'] = Factory::getApplication()->input->files->get( 'mih');
|
||||
$post['msbgc'] = Factory::getApplication()->input->files->get( 'msbgc');
|
||||
$post['mibgc'] = Factory::getApplication()->input->files->get( 'mibgc');
|
||||
$post['mibrdc'] = Factory::getApplication()->input->files->get( 'mibrdc');
|
||||
$post['miec'] = Factory::getApplication()->input->files->get( 'miec');
|
||||
$post['mie'] = Factory::getApplication()->input->files->get( 'mie');
|
||||
|
||||
$data['image'] = 'shadow1';
|
||||
$data['iw'] = $post['miw'];
|
||||
$data['ih'] = $post['mih'];
|
||||
$data['sbgc'] = $post['msbgc'];
|
||||
$data['ibgc'] = $post['mibgc'];
|
||||
$data['ibrdc'] = $post['mibrdc'];
|
||||
$data['iec'] = $post['miec'];
|
||||
$data['ie'] = $post['mie'];
|
||||
|
||||
phocagalleryimport('phocagallery.image.imagebgimage');
|
||||
$errorMsg = '';
|
||||
$bgImage = PhocaGalleryImageBgImage::createBgImage($data, $errorMsg);
|
||||
|
||||
if ($bgImage) {
|
||||
$msg = Text::_('COM_PHOCAGALLERY_SUCCESS_BG_IMAGE');
|
||||
} else {
|
||||
$msg = Text::_('COM_PHOCAGALLERY_ERROR_BG_IMAGE');
|
||||
if($errorMsg != '') {
|
||||
$msg .= '<br />' . $errorMsg;
|
||||
}
|
||||
}
|
||||
|
||||
$linkSuffix = '&miw='.$post['miw'].'&mih='.$post['mih'].'&msbgc='.str_replace('#','',$post['msbgc']).'&mibgc='.str_replace('#','',$post['mibgc']).'&mibrdc='.str_replace('#','',$post['mibrdc']).'&mie='.$post['mie'].'&miec='.str_replace('#','',$post['miec']);
|
||||
|
||||
$this->setRedirect( 'index.php?option=com_phocagallery&view=phocagalleryt'.$linkSuffix , $msg );
|
||||
}
|
||||
}
|
||||
?>
|
||||
@ -0,0 +1,47 @@
|
||||
<?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();
|
||||
use Joomla\CMS\MVC\Controller\FormController;
|
||||
use Joomla\CMS\Factory;
|
||||
jimport('joomla.application.component.controllerform');
|
||||
|
||||
class PhocaGalleryCpControllerPhocaGalleryTag extends FormController
|
||||
{
|
||||
protected $option = 'com_phocagallery';
|
||||
|
||||
function __construct($config=array()) {
|
||||
parent::__construct($config);
|
||||
}
|
||||
|
||||
protected function allowAdd($data = array()) {
|
||||
$user = Factory::getUser();
|
||||
$allow = null;
|
||||
$allow = $user->authorise('core.create', 'com_phocagallery');
|
||||
if ($allow === null) {
|
||||
return parent::allowAdd($data);
|
||||
} else {
|
||||
return $allow;
|
||||
}
|
||||
}
|
||||
|
||||
protected function allowEdit($data = array(), $key = 'id') {
|
||||
$user = Factory::getUser();
|
||||
$allow = null;
|
||||
$allow = $user->authorise('core.edit', 'com_phocagallery');
|
||||
if ($allow === null) {
|
||||
return parent::allowEdit($data, $key);
|
||||
} else {
|
||||
return $allow;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
@ -0,0 +1,42 @@
|
||||
<?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;
|
||||
use Joomla\CMS\MVC\Controller\AdminController;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Session\Session;
|
||||
use Joomla\CMS\Factory;
|
||||
jimport('joomla.application.component.controlleradmin');
|
||||
|
||||
class PhocaGalleryCpControllerPhocaGalleryTags extends AdminController
|
||||
{
|
||||
protected $option = 'com_phocagallery';
|
||||
|
||||
|
||||
|
||||
public function &getModel($name = 'PhocaGalleryTag', $prefix = 'PhocaGalleryCpModel', $config = array())
|
||||
{
|
||||
$model = parent::getModel($name, $prefix, array('ignore_request' => true));
|
||||
return $model;
|
||||
}
|
||||
|
||||
public function saveOrderAjax() {
|
||||
Session::checkToken() or jexit(Text::_('JINVALID_TOKEN'));
|
||||
$pks = $this->input->post->get('cid', array(), 'array');
|
||||
$order = $this->input->post->get('order', array(), 'array');
|
||||
\Joomla\Utilities\ArrayHelper::toInteger($pks);
|
||||
\Joomla\Utilities\ArrayHelper::toInteger($order);
|
||||
$model = $this->getModel();
|
||||
$return = $model->saveorder($pks, $order);
|
||||
if ($return) { echo "1";}
|
||||
Factory::getApplication()->close();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,137 @@
|
||||
<?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' );
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Session\Session;
|
||||
use Joomla\CMS\Client\ClientHelper;
|
||||
use Joomla\CMS\Component\ComponentHelper;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Filesystem\Path;
|
||||
use Joomla\CMS\Filesystem\Folder;
|
||||
use Joomla\CMS\Filesystem\File;
|
||||
jimport('joomla.client.helper');
|
||||
jimport('joomla.filesystem.file');
|
||||
jimport('joomla.filesystem.folder');
|
||||
|
||||
class PhocaGalleryCpControllerPhocaGalleryu extends PhocaGalleryCpController
|
||||
{
|
||||
function __construct() {
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
function createfolder() {
|
||||
$app = Factory::getApplication();
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or jexit( 'Invalid Token' );
|
||||
|
||||
// Set FTP credentials, if given
|
||||
jimport('joomla.client.helper');
|
||||
ClientHelper::setCredentialsFromRequest('ftp');
|
||||
|
||||
$paramsC = ComponentHelper::getParams('com_phocagallery');
|
||||
$folder_permissions = $paramsC->get( 'folder_permissions', 0755 );
|
||||
//$folder_permissions = octdec((int)$folder_permissions);
|
||||
|
||||
$path = PhocaGalleryPath::getPath();
|
||||
//$folderNew = J Request::getCmd( 'foldername', '');
|
||||
//$folderCheck = JFactory::getApplication()->input->get( 'foldername', null, '', 'string', J REQUEST_ALLOWRAW);
|
||||
$folderNew = $app->input->getstring('foldername', '');
|
||||
//$folderCheck = $app->input->getstring('foldername', null, '', 'string', J REQUEST_ALLOWRAW);
|
||||
$folderCheck = $app->input->getstring('foldername', null, '', 'string');
|
||||
$parent = Factory::getApplication()->input->get( 'folderbase', '', '', 'path' );
|
||||
$tab = Factory::getApplication()->input->get( 'tab', '', '', 'string' );
|
||||
$field = Factory::getApplication()->input->get( 'field');
|
||||
$viewBack = Factory::getApplication()->input->get( 'viewback', '', '', '' );
|
||||
|
||||
$link = '';
|
||||
switch ($viewBack) {
|
||||
case 'phocagalleryi':
|
||||
$link = 'index.php?option=com_phocagallery&view=phocagalleryi&tmpl=component&folder='.$parent.'&tab='.(string)$tab.'&field='.$field;
|
||||
break;
|
||||
|
||||
case 'phocagallerym':
|
||||
$link = 'index.php?option=com_phocagallery&view=phocagallerym&layout=edit&hidemainmenu=1&tab='.(string)$tab.'&folder='.$parent;
|
||||
break;
|
||||
|
||||
case 'phocagalleryf':
|
||||
$link = 'index.php?option=com_phocagallery&view=phocagalleryf&tmpl=component&folder='.$parent.'&field='.$field;
|
||||
break;
|
||||
|
||||
default:
|
||||
$app->enqueueMessage(Text::_('COM_PHOCAGALLERY_ERROR_CONTROLLER'));
|
||||
$app->redirect('index.php?option=com_phocagallery');
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
//JFactory::getApplication()->input->set('folder', $parent);
|
||||
Factory::getApplication()->input->set('folder', $parent);
|
||||
|
||||
if (($folderCheck !== null) && ($folderNew !== $folderCheck)) {
|
||||
$app->enqueueMessage(Text::_('COM_PHOCAGALLERY_WARNING_DIRNAME'));
|
||||
$app->redirect($link);
|
||||
}
|
||||
|
||||
if (strlen($folderNew) > 0) {
|
||||
$folder = Path::clean($path->image_abs. '/'. $parent. '/'. $folderNew);
|
||||
if (!Folder::exists($folder) && !File::exists($folder)) {
|
||||
//JFolder::create($path, $folder_permissions );
|
||||
switch((int)$folder_permissions) {
|
||||
case 777:
|
||||
Folder::create($folder, 0777 );
|
||||
break;
|
||||
case 705:
|
||||
Folder::create($folder, 0705 );
|
||||
break;
|
||||
case 666:
|
||||
Folder::create($folder, 0666 );
|
||||
break;
|
||||
case 644:
|
||||
Folder::create($folder, 0644 );
|
||||
break;
|
||||
case 755:
|
||||
Default:
|
||||
Folder::create($folder, 0755 );
|
||||
break;
|
||||
}
|
||||
if (isset($folder)) {
|
||||
$data = "<html>\n<body bgcolor=\"#FFFFFF\">\n</body>\n</html>";
|
||||
File::write($folder. '/'. "index.html", $data);
|
||||
}
|
||||
|
||||
$app->enqueueMessage(Text::_('COM_PHOCAGALLERY_SUCCESS_FOLDER_CREATING'));
|
||||
$app->redirect($link);
|
||||
} else {
|
||||
$app->enqueueMessage(Text::_('COM_PHOCAGALLERY_ERROR_FOLDER_CREATING_EXISTS'));
|
||||
$app->redirect($link);
|
||||
}
|
||||
//JFactory::getApplication()->input->set('folder', ($parent) ? $parent.'/'.$folder : $folder);
|
||||
}
|
||||
$app->redirect($link);
|
||||
}
|
||||
|
||||
function multipleupload() {
|
||||
$result = PhocaGalleryFileUpload::realMultipleUpload();
|
||||
return true;
|
||||
}
|
||||
|
||||
function upload() {
|
||||
$result = PhocaGalleryFileUpload::realSingleUpload();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
function javaupload() {
|
||||
$result = PhocaGalleryFileUpload::realJavaUpload();
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
/*
|
||||
* @package Joomla
|
||||
* @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();
|
||||
|
||||
class PhocaGalleryCpControllerPhocaGalleryuninstall extends PhocaGalleryCpController
|
||||
{
|
||||
function __construct() {
|
||||
parent::__construct();
|
||||
}
|
||||
}
|
||||
?>
|
||||
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
/*
|
||||
* @package Joomla
|
||||
* @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
|
||||
*/
|
||||
|
||||
// Check to ensure this file is included in Joomla!
|
||||
defined('_JEXEC') or die();
|
||||
|
||||
class PhocaGalleryCpControllerPhocaGalleryUser extends PhocaGalleryCpController
|
||||
{
|
||||
}
|
||||
?>
|
||||
@ -0,0 +1,100 @@
|
||||
<?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;
|
||||
use Joomla\CMS\MVC\Controller\AdminController;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Session\Session;
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Router\Route;
|
||||
jimport('joomla.application.component.controlleradmin');
|
||||
|
||||
|
||||
class PhocaGalleryCpControllerPhocaGalleryUsers extends AdminController
|
||||
{
|
||||
protected $option = 'com_phocagallery';
|
||||
|
||||
public function __construct($config = array())
|
||||
{
|
||||
parent::__construct($config);
|
||||
$this->registerTask('disapprove', 'approve');
|
||||
|
||||
}
|
||||
|
||||
public function &getModel($name = 'PhocaGalleryUser', $prefix = 'PhocaGalleryCpModel', $config = array())
|
||||
{
|
||||
$model = parent::getModel($name, $prefix, array('ignore_request' => true));
|
||||
return $model;
|
||||
}
|
||||
|
||||
function approve()
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
|
||||
|
||||
// Get items to publish from the request.
|
||||
$cid = Factory::getApplication()->input->get('cid', array(), '', 'array');
|
||||
$data = array('approve' => 1, 'disapprove' => 0);
|
||||
$task = $this->getTask();
|
||||
$value = \Joomla\Utilities\ArrayHelper::getValue($data, $task, 0, 'int');
|
||||
|
||||
if (empty($cid)) {
|
||||
throw new Exception(Text::_($this->text_prefix.'_NO_ITEM_SELECTED'), 500);
|
||||
} else {
|
||||
// Get the model.
|
||||
$model = $this->getModel();
|
||||
|
||||
// Make sure the item ids are integers
|
||||
\Joomla\Utilities\ArrayHelper::toInteger($cid);
|
||||
|
||||
// Publish the items.
|
||||
|
||||
if (!$model->approve($cid, $value)) {
|
||||
throw new Exception($model->getError(), 500);
|
||||
} else {
|
||||
if ($value == 1) {
|
||||
$ntext = $this->text_prefix.'_N_ITEMS_APPROVED';
|
||||
} else if ($value == 0) {
|
||||
$ntext = $this->text_prefix.'_N_ITEMS_DISAPPROVED';
|
||||
}
|
||||
$this->setMessage(Text::plural($ntext, count($cid)));
|
||||
}
|
||||
}
|
||||
|
||||
$this->setRedirect(Route::_('index.php?option='.$this->option.'&view='.$this->view_list, false));
|
||||
}
|
||||
/* TO DO - get the same rules as approve has */
|
||||
function approveall() {
|
||||
|
||||
$model = $this->getModel('phocagalleryuser');
|
||||
if(!$model->approveall()) {
|
||||
$msg = Text::_( 'COM_PHOCAGALLERY_ERROR_APPROVE_ALL' );
|
||||
} else {
|
||||
$msg = Text::_( 'COM_PHOCAGALLERY_SUCCESS_APPROVE_ALL' );
|
||||
}
|
||||
|
||||
$this->setRedirect( 'index.php?option=com_phocagallery&view=phocagalleryusers' , $msg);
|
||||
}
|
||||
|
||||
public function saveOrderAjax() {
|
||||
Session::checkToken() or jexit(Text::_('JINVALID_TOKEN'));
|
||||
$pks = $this->input->post->get('cid', array(), 'array');
|
||||
$order = $this->input->post->get('order', array(), 'array');
|
||||
\Joomla\Utilities\ArrayHelper::toInteger($pks);
|
||||
\Joomla\Utilities\ArrayHelper::toInteger($order);
|
||||
$model = $this->getModel();
|
||||
$return = $model->saveorder($pks, $order);
|
||||
if ($return) { echo "1";}
|
||||
Factory::getApplication()->close();
|
||||
}
|
||||
}
|
||||
?>
|
||||
@ -0,0 +1,190 @@
|
||||
<?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();
|
||||
use Joomla\CMS\MVC\Controller\FormController;
|
||||
use Joomla\CMS\Session\Session;
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Filesystem\File;
|
||||
jimport('joomla.application.component.controllerform');
|
||||
jimport('joomla.client.helper');
|
||||
phocagalleryimport('phocagallery.youtube.youtube');
|
||||
|
||||
class PhocaGalleryCpControllerPhocaGalleryYtb extends FormController
|
||||
{
|
||||
//protected $option = 'com_phocagallery';
|
||||
protected $context = 'com_phocagallery.phocagalleryytjjb';
|
||||
|
||||
function __construct() {
|
||||
parent::__construct();
|
||||
$this->registerTask( 'import' , 'import' );
|
||||
}
|
||||
|
||||
function import() {
|
||||
|
||||
Session::checkToken() or die( 'Invalid Token' );
|
||||
$app = Factory::getApplication();
|
||||
//$post = JFactory::getApplication()->input->get('post');
|
||||
//$ytb_link = JFactory::getApplication()->input->get( 'ytb_link', '', 'post', 'string', J REQUEST_NOTRIM);
|
||||
//$field = JFactory::getApplication()->input->get( 'field', '', 'post', 'string', J REQUEST_NOTRIM);
|
||||
$ytb_link = Factory::getApplication()->input->get( 'ytb_link', '', 'string' );
|
||||
$field = Factory::getApplication()->input->get( 'field', '', 'string' );
|
||||
$catid = Factory::getApplication()->input->get( 'catid', 0, 'int' );
|
||||
|
||||
$errorYtbMsg = '';
|
||||
|
||||
$folder = '';
|
||||
if ((int)$catid > 0) {
|
||||
$db =Factory::getDBO();
|
||||
$query = 'SELECT c.userfolder'
|
||||
.' FROM #__phocagallery_categories AS c'
|
||||
.' WHERE c.id = '.$db->Quote((int)$catid);
|
||||
|
||||
$db->setQuery($query, 0, 1);
|
||||
$folderObj = $db->loadObject();
|
||||
|
||||
if (!$db->execute()) {
|
||||
$this->setError($db->getErrorMsg());
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isset($folderObj->userfolder) && $folderObj->userfolder != '') {
|
||||
$folder = $folderObj->userfolder . '/';// Save to category folder
|
||||
} else {
|
||||
$folder = '';// No category folder - save to root
|
||||
}
|
||||
} else {
|
||||
$errorYtbMsg .= Text::_('COM_PHOCAGALLERY_YTB_ERROR_NO_CATEGORY');
|
||||
}
|
||||
|
||||
$ytb = PhocaGalleryYoutube::importYtb($ytb_link, $folder, $errorYtbMsg);
|
||||
|
||||
/*
|
||||
$ytb_code = str_replace("&feature=related","",PhocaGalleryYoutube::getCode(strip_tags($ytb_link)));
|
||||
|
||||
$msg = $errorMsg = '';
|
||||
$ytb = array();
|
||||
$ytb['title'] = '';
|
||||
$ytb['desc'] = '';
|
||||
$ytb['filename'] = '';
|
||||
$ytb['link'] = strip_tags($ytb_link);
|
||||
|
||||
if(!function_exists("curl_init")){
|
||||
$errorMsg .= Text::_('COM_PHOCAGALLERY_YTB_NOT_LOADED_CURL');
|
||||
} else if ($ytb_code == '') {
|
||||
$errorMsg .= Text::_('COM_PHOCAGALLERY_YTB_URL_NOT_CORRECT');
|
||||
} else {
|
||||
|
||||
$folder = '';
|
||||
if ((int)$catid > 0) {
|
||||
$db =Factory::getDBO();
|
||||
$query = 'SELECT c.userfolder'
|
||||
.' FROM #__phocagallery_categories AS c'
|
||||
.' WHERE c.id = '.$db->Quote((int)$catid);
|
||||
|
||||
$db->setQuery($query, 0, 1);
|
||||
$folderObj = $db->loadObject();
|
||||
|
||||
if (!$db->query()) {
|
||||
$this->setError($db->getErrorMsg());
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isset($folderObj->userfolder) && $folderObj->userfolder != '') {
|
||||
$folder = $folderObj->userfolder . '/';// Save to category folder
|
||||
} else {
|
||||
$folder = '';// No category folder - save to root
|
||||
}
|
||||
} else {
|
||||
$errorMsg .= Text::_('COM_PHOCAGALLERY_YTB_ERROR_NO_CATEGORY');
|
||||
}
|
||||
|
||||
// Data
|
||||
$cUrl = curl_init("http://gdata.youtube.com/feeds/api/videos/".strip_tags($ytb_code));
|
||||
curl_setopt($cUrl,CURLOPT_RETURNTRANSFER,1);
|
||||
$xml = curl_exec($cUrl);
|
||||
curl_close($cUrl);
|
||||
|
||||
$xml = str_replace('<media:', '<phcmedia', $xml);
|
||||
$xml = str_replace('</media:', '</phcmedia', $xml);
|
||||
|
||||
$data = simplexml_load_file($file);
|
||||
|
||||
//Title
|
||||
if (isset($data->title)) {
|
||||
$ytb['title'] = (string)$data->title;
|
||||
}
|
||||
|
||||
if ($ytb['title'] == '' && isset($data->phcmediagroup->phcmediatitle)) {
|
||||
$ytb['title'] = (string)$data->phcmediagroup->phcmediatitle;
|
||||
}
|
||||
|
||||
if (isset($data->phcmediagroup->phcmediadescription)) {
|
||||
$ytb['desc'] = (string)$data->phcmediagroup->phcmediadescription;
|
||||
}
|
||||
|
||||
// Thumbnail
|
||||
if (isset($data->phcmediagroup->phcmediathumbnail[0]['url'])) {
|
||||
$cUrl = curl_init(strip_tags((string)$data->phcmediagroup->phcmediathumbnail[0]['url']));
|
||||
curl_setopt($cUrl,CURLOPT_RETURNTRANSFER,1);
|
||||
$img = curl_exec($cUrl);
|
||||
curl_close($cUrl);
|
||||
}
|
||||
|
||||
if ($img != '') {
|
||||
$cUrl = curl_init("http://img.youtube.com/vi/".strip_tags($ytb_code)."/0.jpg");
|
||||
curl_setopt($cUrl,CURLOPT_RETURNTRANSFER,1);
|
||||
$img = curl_exec($cUrl);
|
||||
curl_close($cUrl);
|
||||
}
|
||||
|
||||
$ytb['filename'] = $folder.strip_tags($ytb_code).'.jpg';
|
||||
|
||||
if (!File::write(JPATH_ROOT . '/' .'images' . '/' . 'phocagallery' . '/'. $ytb['filename'], $img)) {
|
||||
$errorMsg .= Text::_('COM_PHOCAGALLERY_YTB_ERROR_WRITE_IMAGE');
|
||||
}
|
||||
}*/
|
||||
|
||||
if ((bool)$ytb !== false) {
|
||||
|
||||
Factory::getApplication()->input->set('ytb_title', $ytb['title']);
|
||||
Factory::getApplication()->input->set('ytb_desc', $ytb['desc']);
|
||||
Factory::getApplication()->input->set('ytb_filename', $ytb['filename']);
|
||||
Factory::getApplication()->input->set('ytb_link', $ytb['link']);
|
||||
}
|
||||
|
||||
if ($errorYtbMsg != '') {
|
||||
$msg = $errorYtbMsg;
|
||||
$import = '';
|
||||
$redirect = 'index.php?option=com_phocagallery&view=phocagalleryytb&tmpl=component&field='.$field.'&catid='.(int)$catid.$import;
|
||||
$app->enqueueMessage($errorYtbMsg, 'error');
|
||||
$this->setRedirect( $redirect );
|
||||
} else {
|
||||
$msg = Text::_('COM_PHOCAGALLERY_YTB_SUCCESS_IMPORT');
|
||||
$import = '&import=1';
|
||||
|
||||
$app->getUserStateFromRequest( $this->context.'.ytb_title', 'ytb_title', $ytb['title'], 'string' );
|
||||
$app->getUserStateFromRequest( $this->context.'.ytb_desc', 'ytb_desc', $ytb['desc'], 'string' );
|
||||
$app->getUserStateFromRequest( $this->context.'.ytb_filename', 'ytb_filename', $ytb['filename'], 'string' );
|
||||
$app->getUserStateFromRequest( $this->context.'.ytb_link', 'ytb_link', $ytb['link'], 'string' );
|
||||
$redirect = 'index.php?option=com_phocagallery&view=phocagalleryytb&tmpl=component&field='.$field.'&catid='.(int)$catid.$import;
|
||||
$app->enqueueMessage($msg, 'message');
|
||||
$this->setRedirect( $redirect );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function cancel($key = NULL) {
|
||||
$this->setRedirect( 'index.php?option=com_phocagallery' );
|
||||
}
|
||||
}
|
||||
?>
|
||||
@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 24 KiB |
@ -0,0 +1,90 @@
|
||||
<?php defined('_JEXEC') or die;?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" lang="en_GB" xml:lang="en_GB">
|
||||
<head>
|
||||
<title>Phoca Gallery</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<style type="text/css">
|
||||
body {
|
||||
font-family: "Roboto", sans, Arial;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Phoca Gallery</h1>
|
||||
<div style="float:right;margin:10px;"><img src="logo-phoca.png" alt="" /></div>
|
||||
<p> </p>
|
||||
<p> </p>
|
||||
<div><a href="https://www.phoca.cz/project/phocagallery-joomla-gallery" target="_blank">Phoca Gallery Main Site</a></div>
|
||||
<p> </p>
|
||||
<h2>Documentation</h2>
|
||||
<div><a href="https://www.phoca.cz/documentation/category/2-phoca-gallery-component" target="_blank">Documentation</a></div>
|
||||
<ul>
|
||||
<li><a href="https://www.phoca.cz/documents/2-phoca-gallery-component/2-features" target="_blank">Features</a></li>
|
||||
<li><a href="https://www.phoca.cz/documents/2-phoca-gallery-component/219-phoca-gallery-concepts-and-glossary" target="_blank">Phoca Gallery Concepts and Glossary</a></li>
|
||||
<li><a href="https://www.phoca.cz/documents/2-phoca-gallery-component/21-quick-start-guide" target="_blank">Quick Start Guide</a></li>
|
||||
<li><a href="https://www.phoca.cz/documents/2-phoca-gallery-component/4-installation" target="_blank">Installation</a></li>
|
||||
<li><a href="https://www.phoca.cz/documents/2-phoca-gallery-component/203-installation-problem-solving" target="_blank">Installation Problem Solving</a></li>
|
||||
<li><a href="https://www.phoca.cz/documents/2-phoca-gallery-component/13-upgrading-phoca-gallery" target="_blank">Upgrading Phoca Gallery</a></li>
|
||||
<li><a href="https://www.phoca.cz/documents/2-phoca-gallery-component/6-uploading-images" target="_blank">Uploading Images</a></li>
|
||||
<li><a href="https://www.phoca.cz/documents/2-phoca-gallery-component/218-creating-and-editing-categories" target="_blank">Creating and editing Categories</a></li>
|
||||
<li><a href="https://www.phoca.cz/documents/2-phoca-gallery-component/7-adding-images" target="_blank">Adding Images</a></li>
|
||||
<li><a href="https://www.phoca.cz/documents/2-phoca-gallery-component/8-multiple-adding-images-categories-and-subcategories" target="_blank">Multiple adding images, categories and subcategories</a></li>
|
||||
<li><a href="https://www.phoca.cz/documents/2-phoca-gallery-component/9-creating-thumbnails-and-problem-solving" target="_blank">Creating Thumbnails and Problem solving</a></li>
|
||||
<li><a href="https://www.phoca.cz/documents/2-phoca-gallery-component/10-creating-menu-link" target="_blank">Creating Menu Link</a></li>
|
||||
<li><a href="https://www.phoca.cz/documents/2-phoca-gallery-component/11-global-configuration-parameters-component-in-menu-item" target="_blank">Global Configuration (Parameters - component in menu item)</a></li>
|
||||
<li><a href="https://www.phoca.cz/documents/2-phoca-gallery-component/494-options-parameters" target="_blank">Options (Parameters)</a></li>
|
||||
<li><a href="https://www.phoca.cz/documents/2-phoca-gallery-component/678-options-parameters-since-joomla-3" target="_blank">Phoca Gallery Options (Parameters - since Joomla! 3)</a></li>
|
||||
<li><a href="https://www.phoca.cz/documents/2-phoca-gallery-component/701-relationship-between-the-parameters" target="_blank">Relationship between the parameters</a></li>
|
||||
<li><a href="https://www.phoca.cz/documents/2-phoca-gallery-component/12-global-configuration-thumbnails-modal-box-popup-window-resizing" target="_blank">Guide to resize thumbnails</a></li>
|
||||
<li><a href="https://www.phoca.cz/documents/2-phoca-gallery-component/16-themes" target="_blank">Themes</a></li>
|
||||
<li><a href="https://www.phoca.cz/documents/2-phoca-gallery-component/20-user-upload" target="_blank">User Control Panel - Frontend User Upload</a></li>
|
||||
<li><a href="https://www.phoca.cz/documents/2-phoca-gallery-component/892-frontend-upload-default-settings-of-category-access-rights" target="_blank">Frontend Upload - Default Settings Of Category Access Rights</a></li>
|
||||
<li><a href="https://www.phoca.cz/documents/2-phoca-gallery-component/71-geotagging" target="_blank">Geotagging</a></li>
|
||||
<li><a href="https://www.phoca.cz/documents/2-phoca-gallery-component/19-watermark" target="_blank">Watermark</a></li>
|
||||
<li><a href="https://www.phoca.cz/documents/2-phoca-gallery-component/24-faq" target="_blank">FAQ</a></li>
|
||||
<li><a href="https://www.phoca.cz/documents/2-phoca-gallery-component/511-tips" target="_blank">Tips</a></li>
|
||||
<li><a href="https://www.phoca.cz/documents/2-phoca-gallery-component/78-rtl-displaying-thumbnails" target="_blank">RTL - displaying thumbnails</a></li>
|
||||
<li><a href="https://www.phoca.cz/documents/2-phoca-gallery-component/92-moving-your-phoca-gallery-from-one-site-to-another" target="_blank">Moving your Phoca Gallery from one site to another</a></li>
|
||||
<li><a href="https://www.phoca.cz/documents/2-phoca-gallery-component/106-creating-phoca-gallery-theme" target="_blank">Creating Phoca Gallery Theme</a></li>
|
||||
<li><a href="https://www.phoca.cz/documents/2-phoca-gallery-component/286-permissions-change-since-version-252" target="_blank">Permissions Change since version 2.5.2</a></li>
|
||||
<li><a href="https://www.phoca.cz/documents/2-phoca-gallery-component/290-creating-flv-video-gallery" target="_blank">Creating FLV Video Gallery</a></li>
|
||||
<li><a href="https://www.phoca.cz/documents/2-phoca-gallery-component/317-styling-background-image" target="_blank">Styling Background Image</a></li>
|
||||
<li><a href="https://www.phoca.cz/documents/2-phoca-gallery-component/18-youtube-videos" target="_blank">YouTube Videos</a></li>
|
||||
<li><a href="https://www.phoca.cz/documents/2-phoca-gallery-component/1010-displaying-imgur-albums-with-help-of-phoca-gallery" target="_blank">Displaying imgur albums with help of Phoca Gallery</a></li>
|
||||
<li><a href="https://www.phoca.cz/documents/2-phoca-gallery-component/321-displaying-google-picasa-web-albums-or-google-plus-or-google-photos" target="_blank">Displaying Google Picasa Web Albums (or Google Plus or Google Photos)</a></li>
|
||||
<li><a href="https://www.phoca.cz/documents/2-phoca-gallery-component/443-displaying-facebook-albums" target="_blank">Displaying Facebook Albums</a></li>
|
||||
<li><a href="https://www.phoca.cz/documents/2-phoca-gallery-component/359-simple-caddy-integration" target="_blank">Simple Caddy Integration</a></li>
|
||||
<li><a href="https://www.phoca.cz/documents/2-phoca-gallery-component/391-adding-facebook-comments-in-phoca-gallery" target="_blank">Adding Facebook Comments in Phoca Gallery</a></li>
|
||||
<li><a href="https://www.phoca.cz/documents/2-phoca-gallery-component/438-cannot-find-joomla-xml-setup-file" target="_blank">Cannot find Joomla XML setup file</a></li>
|
||||
<li><a href="https://www.phoca.cz/documents/2-phoca-gallery-component/627-multibox" target="_blank">Multibox</a></li>
|
||||
<li><a href="https://www.phoca.cz/documents/2-phoca-gallery-component/634-css-styling-phoca-gallery" target="_blank">CSS - Styling Phoca Gallery</a></li>
|
||||
<li><a href="https://www.phoca.cz/documents/2-phoca-gallery-component/876-displaying-images-like-on-phoca-joomla-3-demo-site" target="_blank">Displaying images like on Phoca Joomla! 3 Demo site</a></li>
|
||||
<li><a href="https://www.phoca.cz/documents/2-phoca-gallery-component/17-cooliris-and-cooliris-3d-wall-piclens" target="_blank">Cooliris and Cooliris 3D Wall (PicLens)</a></li>
|
||||
</ul>
|
||||
<p> </p>
|
||||
<h2>Support</h2>
|
||||
<ul>
|
||||
<li><a href="https://www.phoca.cz/forum" target="_blank">Phoca Forum</a></li>
|
||||
<li><a href="https://www.phoca.cz/forum/app.php/feed" target="_blank">Phoca Forum RSS</a></li>
|
||||
</ul>
|
||||
<p> </p>
|
||||
<h2>News</h2>
|
||||
<ul>
|
||||
<li><a href="https://www.phoca.cz/news" target="_blank">Phoca News</a></li>
|
||||
<li><a href="https://www.phoca.cz/news?format=feed&type=rss" target="_blank">Phoca News RSS</a></li>
|
||||
<li><a href="https://www.phoca.cz/download/feed/111?format=feed&type=rss" target="_blank">Phoca Latest Releases RSS</a></li>
|
||||
</ul>
|
||||
<p> </p>
|
||||
<h2>Demo</h2>
|
||||
<ul>
|
||||
<li><a href="https://www.phoca.cz/joomla3demo/" target="_blank">Joomla! 3 Demo</a></li>
|
||||
<li><a href="https://www.phoca.cz/phocacartdemo/phoca-gallery" target="_blank">Phoca Gallery And Masonry.js Demo</a></li>
|
||||
<li><a href="https://www.phoca.cz/joomlademo/" target="_blank">Joomla! 2.5 Demo</a></li>
|
||||
<li><a href="https://www.phoca.cz/demo/" target="_blank">Joomla! 1.5 Demo</a></li>
|
||||
</ul>
|
||||
<p> </p>
|
||||
<p> </p>
|
||||
<a href="javascript:void(0);" onclick="javascript:window.close();"><span class="small">Close window</span></a>
|
||||
</body>
|
||||
</html>
|
||||
@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
BIN
administrator/components/com_phocagallery/help/logo-phoca.png
Normal file
BIN
administrator/components/com_phocagallery/help/logo-phoca.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 24 KiB |
@ -0,0 +1,90 @@
|
||||
<?php defined('_JEXEC') or die;?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" lang="en_GB" xml:lang="en_GB">
|
||||
<head>
|
||||
<title>Phoca Gallery</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<style type="text/css">
|
||||
body {
|
||||
font-family: "Roboto", sans, Arial;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Phoca Gallery</h1>
|
||||
<div style="float:right;margin:10px;"><img src="logo-phoca.png" alt="" /></div>
|
||||
<p> </p>
|
||||
<p> </p>
|
||||
<div><a href="https://www.phoca.cz/project/phocagallery-joomla-gallery" target="_blank">Phoca Gallery Main Site</a></div>
|
||||
<p> </p>
|
||||
<h2>Documentation</h2>
|
||||
<div><a href="https://www.phoca.cz/documentation/category/2-phoca-gallery-component" target="_blank">Documentation</a></div>
|
||||
<ul>
|
||||
<li><a href="https://www.phoca.cz/documents/2-phoca-gallery-component/2-features" target="_blank">Features</a></li>
|
||||
<li><a href="https://www.phoca.cz/documents/2-phoca-gallery-component/219-phoca-gallery-concepts-and-glossary" target="_blank">Phoca Gallery Concepts and Glossary</a></li>
|
||||
<li><a href="https://www.phoca.cz/documents/2-phoca-gallery-component/21-quick-start-guide" target="_blank">Quick Start Guide</a></li>
|
||||
<li><a href="https://www.phoca.cz/documents/2-phoca-gallery-component/4-installation" target="_blank">Installation</a></li>
|
||||
<li><a href="https://www.phoca.cz/documents/2-phoca-gallery-component/203-installation-problem-solving" target="_blank">Installation Problem Solving</a></li>
|
||||
<li><a href="https://www.phoca.cz/documents/2-phoca-gallery-component/13-upgrading-phoca-gallery" target="_blank">Upgrading Phoca Gallery</a></li>
|
||||
<li><a href="https://www.phoca.cz/documents/2-phoca-gallery-component/6-uploading-images" target="_blank">Uploading Images</a></li>
|
||||
<li><a href="https://www.phoca.cz/documents/2-phoca-gallery-component/218-creating-and-editing-categories" target="_blank">Creating and editing Categories</a></li>
|
||||
<li><a href="https://www.phoca.cz/documents/2-phoca-gallery-component/7-adding-images" target="_blank">Adding Images</a></li>
|
||||
<li><a href="https://www.phoca.cz/documents/2-phoca-gallery-component/8-multiple-adding-images-categories-and-subcategories" target="_blank">Multiple adding images, categories and subcategories</a></li>
|
||||
<li><a href="https://www.phoca.cz/documents/2-phoca-gallery-component/9-creating-thumbnails-and-problem-solving" target="_blank">Creating Thumbnails and Problem solving</a></li>
|
||||
<li><a href="https://www.phoca.cz/documents/2-phoca-gallery-component/10-creating-menu-link" target="_blank">Creating Menu Link</a></li>
|
||||
<li><a href="https://www.phoca.cz/documents/2-phoca-gallery-component/11-global-configuration-parameters-component-in-menu-item" target="_blank">Global Configuration (Parameters - component in menu item)</a></li>
|
||||
<li><a href="https://www.phoca.cz/documents/2-phoca-gallery-component/494-options-parameters" target="_blank">Options (Parameters)</a></li>
|
||||
<li><a href="https://www.phoca.cz/documents/2-phoca-gallery-component/678-options-parameters-since-joomla-3" target="_blank">Phoca Gallery Options (Parameters - since Joomla! 3)</a></li>
|
||||
<li><a href="https://www.phoca.cz/documents/2-phoca-gallery-component/701-relationship-between-the-parameters" target="_blank">Relationship between the parameters</a></li>
|
||||
<li><a href="https://www.phoca.cz/documents/2-phoca-gallery-component/12-global-configuration-thumbnails-modal-box-popup-window-resizing" target="_blank">Guide to resize thumbnails</a></li>
|
||||
<li><a href="https://www.phoca.cz/documents/2-phoca-gallery-component/16-themes" target="_blank">Themes</a></li>
|
||||
<li><a href="https://www.phoca.cz/documents/2-phoca-gallery-component/20-user-upload" target="_blank">User Control Panel - Frontend User Upload</a></li>
|
||||
<li><a href="https://www.phoca.cz/documents/2-phoca-gallery-component/892-frontend-upload-default-settings-of-category-access-rights" target="_blank">Frontend Upload - Default Settings Of Category Access Rights</a></li>
|
||||
<li><a href="https://www.phoca.cz/documents/2-phoca-gallery-component/71-geotagging" target="_blank">Geotagging</a></li>
|
||||
<li><a href="https://www.phoca.cz/documents/2-phoca-gallery-component/19-watermark" target="_blank">Watermark</a></li>
|
||||
<li><a href="https://www.phoca.cz/documents/2-phoca-gallery-component/24-faq" target="_blank">FAQ</a></li>
|
||||
<li><a href="https://www.phoca.cz/documents/2-phoca-gallery-component/511-tips" target="_blank">Tips</a></li>
|
||||
<li><a href="https://www.phoca.cz/documents/2-phoca-gallery-component/78-rtl-displaying-thumbnails" target="_blank">RTL - displaying thumbnails</a></li>
|
||||
<li><a href="https://www.phoca.cz/documents/2-phoca-gallery-component/92-moving-your-phoca-gallery-from-one-site-to-another" target="_blank">Moving your Phoca Gallery from one site to another</a></li>
|
||||
<li><a href="https://www.phoca.cz/documents/2-phoca-gallery-component/106-creating-phoca-gallery-theme" target="_blank">Creating Phoca Gallery Theme</a></li>
|
||||
<li><a href="https://www.phoca.cz/documents/2-phoca-gallery-component/286-permissions-change-since-version-252" target="_blank">Permissions Change since version 2.5.2</a></li>
|
||||
<li><a href="https://www.phoca.cz/documents/2-phoca-gallery-component/290-creating-flv-video-gallery" target="_blank">Creating FLV Video Gallery</a></li>
|
||||
<li><a href="https://www.phoca.cz/documents/2-phoca-gallery-component/317-styling-background-image" target="_blank">Styling Background Image</a></li>
|
||||
<li><a href="https://www.phoca.cz/documents/2-phoca-gallery-component/18-youtube-videos" target="_blank">YouTube Videos</a></li>
|
||||
<li><a href="https://www.phoca.cz/documents/2-phoca-gallery-component/1010-displaying-imgur-albums-with-help-of-phoca-gallery" target="_blank">Displaying imgur albums with help of Phoca Gallery</a></li>
|
||||
<li><a href="https://www.phoca.cz/documents/2-phoca-gallery-component/321-displaying-google-picasa-web-albums-or-google-plus-or-google-photos" target="_blank">Displaying Google Picasa Web Albums (or Google Plus or Google Photos)</a></li>
|
||||
<li><a href="https://www.phoca.cz/documents/2-phoca-gallery-component/443-displaying-facebook-albums" target="_blank">Displaying Facebook Albums</a></li>
|
||||
<li><a href="https://www.phoca.cz/documents/2-phoca-gallery-component/359-simple-caddy-integration" target="_blank">Simple Caddy Integration</a></li>
|
||||
<li><a href="https://www.phoca.cz/documents/2-phoca-gallery-component/391-adding-facebook-comments-in-phoca-gallery" target="_blank">Adding Facebook Comments in Phoca Gallery</a></li>
|
||||
<li><a href="https://www.phoca.cz/documents/2-phoca-gallery-component/438-cannot-find-joomla-xml-setup-file" target="_blank">Cannot find Joomla XML setup file</a></li>
|
||||
<li><a href="https://www.phoca.cz/documents/2-phoca-gallery-component/627-multibox" target="_blank">Multibox</a></li>
|
||||
<li><a href="https://www.phoca.cz/documents/2-phoca-gallery-component/634-css-styling-phoca-gallery" target="_blank">CSS - Styling Phoca Gallery</a></li>
|
||||
<li><a href="https://www.phoca.cz/documents/2-phoca-gallery-component/876-displaying-images-like-on-phoca-joomla-3-demo-site" target="_blank">Displaying images like on Phoca Joomla! 3 Demo site</a></li>
|
||||
<li><a href="https://www.phoca.cz/documents/2-phoca-gallery-component/17-cooliris-and-cooliris-3d-wall-piclens" target="_blank">Cooliris and Cooliris 3D Wall (PicLens)</a></li>
|
||||
</ul>
|
||||
<p> </p>
|
||||
<h2>Support</h2>
|
||||
<ul>
|
||||
<li><a href="https://www.phoca.cz/forum" target="_blank">Phoca Forum</a></li>
|
||||
<li><a href="https://www.phoca.cz/forum/app.php/feed" target="_blank">Phoca Forum RSS</a></li>
|
||||
</ul>
|
||||
<p> </p>
|
||||
<h2>News</h2>
|
||||
<ul>
|
||||
<li><a href="https://www.phoca.cz/news" target="_blank">Phoca News</a></li>
|
||||
<li><a href="https://www.phoca.cz/news?format=feed&type=rss" target="_blank">Phoca News RSS</a></li>
|
||||
<li><a href="https://www.phoca.cz/download/feed/111?format=feed&type=rss" target="_blank">Phoca Latest Releases RSS</a></li>
|
||||
</ul>
|
||||
<p> </p>
|
||||
<h2>Demo</h2>
|
||||
<ul>
|
||||
<li><a href="https://www.phoca.cz/joomla3demo/" target="_blank">Joomla! 3 Demo</a></li>
|
||||
<li><a href="https://www.phoca.cz/phocacartdemo/phoca-gallery" target="_blank">Phoca Gallery And Masonry.js Demo</a></li>
|
||||
<li><a href="https://www.phoca.cz/joomlademo/" target="_blank">Joomla! 2.5 Demo</a></li>
|
||||
<li><a href="https://www.phoca.cz/demo/" target="_blank">Joomla! 1.5 Demo</a></li>
|
||||
</ul>
|
||||
<p> </p>
|
||||
<p> </p>
|
||||
<a href="javascript:void(0);" onclick="javascript:window.close();"><span class="small">Close window</span></a>
|
||||
</body>
|
||||
</html>
|
||||
@ -0,0 +1 @@
|
||||
<html><body></body></html>
|
||||
@ -0,0 +1,38 @@
|
||||
<?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;
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Object\CMSObject;
|
||||
|
||||
class PhocaGalleryCoImgsHelper
|
||||
{
|
||||
public static function getActions($categoryId = 0, $imageCommentId = 0)
|
||||
{
|
||||
$user = Factory::getUser();
|
||||
$result = new CMSObject;
|
||||
|
||||
if (empty($categoryId)) {
|
||||
$assetName = 'com_phocagallery';
|
||||
} else {
|
||||
$assetName = 'com_phocagallery.phocagallerycoimgs.'.(int) $categoryId;
|
||||
}
|
||||
|
||||
$actions = array(
|
||||
'core.admin', 'core.manage', 'core.create', 'core.edit', 'core.edit.state', 'core.delete'
|
||||
);
|
||||
|
||||
foreach ($actions as $action) {
|
||||
$result->set($action, $user->authorise($action, $assetName));
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,38 @@
|
||||
<?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;
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Object\CMSObject;
|
||||
|
||||
class PhocaGalleryCosHelper
|
||||
{
|
||||
public static function getActions($categoryId = 0, $commentId = 0)
|
||||
{
|
||||
$user = Factory::getUser();
|
||||
$result = new CMSObject;
|
||||
|
||||
if (empty($categoryId)) {
|
||||
$assetName = 'com_phocagallery';
|
||||
} else {
|
||||
$assetName = 'com_phocagallery.phocagallerycos.'.(int) $categoryId;
|
||||
}
|
||||
|
||||
$actions = array(
|
||||
'core.admin', 'core.manage', 'core.create', 'core.edit', 'core.edit.state', 'core.delete'
|
||||
);
|
||||
|
||||
foreach ($actions as $action) {
|
||||
$result->set($action, $user->authorise($action, $assetName));
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,34 @@
|
||||
<?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;
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Object\CMSObject;
|
||||
|
||||
class PhocaGalleryCpHelper
|
||||
{
|
||||
public static function getActions()
|
||||
{
|
||||
$user = Factory::getUser();
|
||||
$result = new CMSObject;
|
||||
|
||||
$assetName = 'com_phocagallery';
|
||||
|
||||
$actions = array(
|
||||
'core.admin', 'core.manage', 'core.create', 'core.edit', 'core.edit.state', 'core.delete'
|
||||
);
|
||||
|
||||
foreach ($actions as $action) {
|
||||
$result->set($action, $user->authorise($action, $assetName));
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,38 @@
|
||||
<?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;
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Object\CMSObject;
|
||||
|
||||
class PhocaGalleryCsHelper
|
||||
{
|
||||
public static function getActions($categoryId = 0)
|
||||
{
|
||||
$user = Factory::getUser();
|
||||
$result = new CMSObject;
|
||||
|
||||
if (empty($categoryId)) {
|
||||
$assetName = 'com_phocagallery';
|
||||
} else {
|
||||
$assetName = 'com_phocagallery.phocagallerycs.'.(int) $categoryId;
|
||||
}
|
||||
|
||||
$actions = array(
|
||||
'core.admin', 'core.manage', 'core.create', 'core.edit', 'core.edit.state', 'core.delete'
|
||||
);
|
||||
|
||||
foreach ($actions as $action) {
|
||||
$result->set($action, $user->authorise($action, $assetName));
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,38 @@
|
||||
<?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;
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Object\CMSObject;
|
||||
|
||||
class PhocaGalleryEfsHelper
|
||||
{
|
||||
public static function getActions($categoryId = 0, $commentId = 0)
|
||||
{
|
||||
$user = Factory::getUser();
|
||||
$result = new CMSObject;
|
||||
|
||||
if (empty($categoryId)) {
|
||||
$assetName = 'com_phocagallery';
|
||||
} else {
|
||||
$assetName = 'com_phocagallery.phocagalleryefs.'.(int) $categoryId;
|
||||
}
|
||||
|
||||
$actions = array(
|
||||
'core.admin', 'core.manage', 'core.create', 'core.edit', 'core.edit.state', 'core.delete'
|
||||
);
|
||||
|
||||
foreach ($actions as $action) {
|
||||
$result->set($action, $user->authorise($action, $assetName));
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,39 @@
|
||||
<?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;
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Object\CMSObject;
|
||||
|
||||
class PhocaGalleryFbsHelper
|
||||
{
|
||||
public static function getActions($id = '')
|
||||
{
|
||||
$user = Factory::getUser();
|
||||
$result = new CMSObject;
|
||||
|
||||
if ($id != '') {
|
||||
$assetName = 'com_phocagallery.phocagalleryfbs.'.(int)$id;
|
||||
} else {
|
||||
$assetName = 'com_phocagallery.phocagalleryfbs';
|
||||
}
|
||||
|
||||
$actions = array(
|
||||
'core.admin', 'core.manage', 'core.create', 'core.edit', 'core.edit.state', 'core.delete'
|
||||
);
|
||||
|
||||
foreach ($actions as $action) {
|
||||
$result->set($action, $user->authorise($action, $assetName));
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
?>
|
||||
@ -0,0 +1,38 @@
|
||||
<?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;
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Object\CMSObject;
|
||||
|
||||
class PhocaGalleryImgsHelper
|
||||
{
|
||||
public static function getActions($categoryId = 0)
|
||||
{
|
||||
$user = Factory::getUser();
|
||||
$result = new CMSObject;
|
||||
|
||||
if (empty($categoryId)) {
|
||||
$assetName = 'com_phocagallery';
|
||||
} else {
|
||||
$assetName = 'com_phocagallery.phocagalleryimgs.'.(int) $categoryId;
|
||||
}
|
||||
|
||||
$actions = array(
|
||||
'core.admin', 'core.manage', 'core.create', 'core.edit', 'core.edit.state', 'core.delete'
|
||||
);
|
||||
|
||||
foreach ($actions as $action) {
|
||||
$result->set($action, $user->authorise($action, $assetName));
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,38 @@
|
||||
<?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;
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Object\CMSObject;
|
||||
|
||||
class PhocaGalleryMHelper
|
||||
{
|
||||
public static function getActions($categoryId = 0)
|
||||
{
|
||||
$user = Factory::getUser();
|
||||
$result = new CMSObject;
|
||||
|
||||
if (empty($categoryId)) {
|
||||
$assetName = 'com_phocagallery';
|
||||
} else {
|
||||
$assetName = 'com_phocagallery.phocagallerym.'.(int) $categoryId;
|
||||
}
|
||||
|
||||
$actions = array(
|
||||
'core.admin', 'core.manage', 'core.create', 'core.edit', 'core.edit.state', 'core.delete'
|
||||
);
|
||||
|
||||
foreach ($actions as $action) {
|
||||
$result->set($action, $user->authorise($action, $assetName));
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,38 @@
|
||||
<?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;
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Object\CMSObject;
|
||||
|
||||
class PhocaGalleryRaHelper
|
||||
{
|
||||
public static function getActions($categoryId = 0)
|
||||
{
|
||||
$user = Factory::getUser();
|
||||
$result = new CMSObject;
|
||||
|
||||
if (empty($categoryId)) {
|
||||
$assetName = 'com_phocagallery';
|
||||
} else {
|
||||
$assetName = 'com_phocagallery.phocagalleryra.'.(int) $categoryId;
|
||||
}
|
||||
|
||||
$actions = array(
|
||||
'core.admin', 'core.manage', 'core.create', 'core.edit', 'core.edit.state', 'core.delete'
|
||||
);
|
||||
|
||||
foreach ($actions as $action) {
|
||||
$result->set($action, $user->authorise($action, $assetName));
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
?>
|
||||
@ -0,0 +1,38 @@
|
||||
<?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;
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Object\CMSObject;
|
||||
|
||||
class PhocaGalleryRaImgHelper
|
||||
{
|
||||
public static function getActions($categoryId = 0)
|
||||
{
|
||||
$user = Factory::getUser();
|
||||
$result = new CMSObject;
|
||||
|
||||
if (empty($categoryId)) {
|
||||
$assetName = 'com_phocagallery';
|
||||
} else {
|
||||
$assetName = 'com_phocagallery.phocagalleryraimg.'.(int) $categoryId;
|
||||
}
|
||||
|
||||
$actions = array(
|
||||
'core.admin', 'core.manage', 'core.create', 'core.edit', 'core.edit.state', 'core.delete'
|
||||
);
|
||||
|
||||
foreach ($actions as $action) {
|
||||
$result->set($action, $user->authorise($action, $assetName));
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
?>
|
||||
@ -0,0 +1,38 @@
|
||||
<?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;
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Object\CMSObject;
|
||||
|
||||
class PhocaGalleryTHelper
|
||||
{
|
||||
public static function getActions($categoryId = 0)
|
||||
{
|
||||
$user = Factory::getUser();
|
||||
$result = new CMSObject;
|
||||
|
||||
if (empty($categoryId)) {
|
||||
$assetName = 'com_phocagallery';
|
||||
} else {
|
||||
$assetName = 'com_phocagallery.phocagalleryt.'.(int) $categoryId;
|
||||
}
|
||||
|
||||
$actions = array(
|
||||
'core.admin', 'core.manage', 'core.create', 'core.edit', 'core.edit.state', 'core.delete'
|
||||
);
|
||||
|
||||
foreach ($actions as $action) {
|
||||
$result->set($action, $user->authorise($action, $assetName));
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,102 @@
|
||||
<?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;
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\HTML\HTMLHelper;
|
||||
|
||||
class PhocaGalleryTagHelper
|
||||
{
|
||||
public function getTags($fileId, $select = 0) {
|
||||
|
||||
$db =Factory::getDBO();
|
||||
|
||||
if ($select == 1) {
|
||||
$query = 'SELECT r.tagid';
|
||||
} else {
|
||||
$query = 'SELECT a.*';
|
||||
}
|
||||
$query .= ' FROM #__phocagallery_tags AS a'
|
||||
//.' LEFT JOIN #__phocagallery AS f ON f.id = r.fileid'
|
||||
.' LEFT JOIN #__phocagallery_tags_ref AS r ON a.id = r.tagid'
|
||||
.' WHERE r.fileid = '.(int) $fileId;
|
||||
$db->setQuery($query);
|
||||
|
||||
|
||||
if ($select == 1) {
|
||||
$tags = $db->loadColumn();
|
||||
} else {
|
||||
$tags = $db->loadObjectList();
|
||||
}
|
||||
|
||||
return $tags;
|
||||
}
|
||||
|
||||
public function storeTags($tagsArray, $fileId) {
|
||||
|
||||
|
||||
if ((int)$fileId > 0) {
|
||||
$db =Factory::getDBO();
|
||||
$query = ' DELETE '
|
||||
.' FROM #__phocagallery_tags_ref'
|
||||
. ' WHERE fileid = '. (int)$fileId;
|
||||
$db->setQuery($query);
|
||||
if (!$db->execute()) {
|
||||
$this->setError('Database Error - Deleting FileId Tags');
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!empty($tagsArray)) {
|
||||
|
||||
$values = array();
|
||||
$valuesString = '';
|
||||
|
||||
foreach($tagsArray as $k => $v) {
|
||||
$values[] = ' ('.(int)$fileId.', '.(int)$v.')';
|
||||
}
|
||||
|
||||
if (!empty($values)) {
|
||||
$valuesString = implode($values, ',');
|
||||
|
||||
$query = ' INSERT INTO #__phocagallery_tags_ref (fileid, tagid)'
|
||||
.' VALUES '.(string)$valuesString;
|
||||
|
||||
$db->setQuery($query);
|
||||
if (!$db->execute()) {
|
||||
$this->setError('Database Error - Insert FileId Tags');
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function getAllTagsSelectBox($name, $id, $activeArray, $javascript = NULL, $order = 'id' ) {
|
||||
|
||||
$db =Factory::getDBO();
|
||||
$query = 'SELECT a.id AS value, a.title AS text'
|
||||
.' FROM #__phocagallery_tags AS a'
|
||||
. ' ORDER BY '. $order;
|
||||
$db->setQuery($query);
|
||||
|
||||
/*if (!$db->query()) {
|
||||
$this->setError('Database Error - Getting All Tags');
|
||||
return false;
|
||||
}*/
|
||||
|
||||
$tags = $db->loadObjectList();
|
||||
|
||||
$tagsO = HTMLHelper::_('select.genericlist', $tags, $name, 'class="form-control" size="4" multiple="multiple"'. $javascript, 'value', 'text', $activeArray, $id);
|
||||
|
||||
return $tagsO;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,39 @@
|
||||
<?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;
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Object\CMSObject;
|
||||
|
||||
class PhocaGalleryTagsHelper
|
||||
{
|
||||
public static function getActions($itemId = 0)
|
||||
{
|
||||
$user = Factory::getUser();
|
||||
$result = new CMSObject;
|
||||
|
||||
if (empty($itemId)) {
|
||||
$assetName = 'com_phocagallery';
|
||||
} else {
|
||||
$assetName = 'com_phocagallery.phocagallerytags'.(int) $itemId;
|
||||
}
|
||||
|
||||
$actions = array(
|
||||
'core.admin', 'core.manage', 'core.create', 'core.edit', 'core.edit.state', 'core.delete'
|
||||
);
|
||||
|
||||
foreach ($actions as $action) {
|
||||
$result->set($action, $user->authorise($action, $assetName));
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
?>
|
||||
@ -0,0 +1,38 @@
|
||||
<?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;
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Object\CMSObject;
|
||||
|
||||
class PhocaGalleryUsersHelper
|
||||
{
|
||||
public static function getActions($categoryId = 0)
|
||||
{
|
||||
$user = Factory::getUser();
|
||||
$result = new CMSObject;
|
||||
|
||||
if (empty($categoryId)) {
|
||||
$assetName = 'com_phocagallery';
|
||||
} else {
|
||||
$assetName = 'com_phocagallery.phocagalleryusers.'.(int) $categoryId;
|
||||
}
|
||||
|
||||
$actions = array(
|
||||
'core.admin', 'core.manage', 'core.create', 'core.edit', 'core.edit.state', 'core.delete'
|
||||
);
|
||||
|
||||
foreach ($actions as $action) {
|
||||
$result->set($action, $user->authorise($action, $assetName));
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
1
administrator/components/com_phocagallery/index.html
Normal file
1
administrator/components/com_phocagallery/index.html
Normal file
@ -0,0 +1 @@
|
||||
<html><body style="background-color: #000;"></body></html>
|
||||
@ -0,0 +1 @@
|
||||
<html><body style="background-color: #000;"></body></html>
|
||||
120
administrator/components/com_phocagallery/install/script.php
Normal file
120
administrator/components/com_phocagallery/install/script.php
Normal file
@ -0,0 +1,120 @@
|
||||
<?php
|
||||
/*
|
||||
* @package Joomla.Framework
|
||||
* @copyright Copyright (C) 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' );
|
||||
if(!defined('DS')) define('DS', DIRECTORY_SEPARATOR);
|
||||
jimport( 'joomla.filesystem.folder' );
|
||||
|
||||
class com_phocagalleryInstallerScript
|
||||
{
|
||||
function install($parent) {
|
||||
//echo '<p>' . JText::_('COM_PHOCAGALLLERY_INSTALL_TEXT') . '</p>';
|
||||
|
||||
|
||||
$folder[0][0] = 'images/phocagallery/' ;
|
||||
$folder[0][1] = JPATH_ROOT . '/'. $folder[0][0];
|
||||
$folder[1][0] = 'images/phocagallery/avatars/';
|
||||
$folder[1][1] = JPATH_ROOT . '/' . $folder[1][0];
|
||||
|
||||
$message = '';
|
||||
$error = array();
|
||||
foreach ($folder as $key => $value)
|
||||
{
|
||||
if (!JFolder::exists( $value[1]))
|
||||
{
|
||||
if (JFolder::create( $value[1], 0755 ))
|
||||
{
|
||||
|
||||
$data = "<html>\n<body bgcolor=\"#FFFFFF\">\n</body>\n</html>";
|
||||
JFile::write($value[1]. '/'. "index.html", $data);
|
||||
$message .= '<div><b><span style="color:#009933">Folder</span> ' . $value[0]
|
||||
.' <span style="color:#009933">created!</span></b></div>';
|
||||
$error[] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
$message .= '<div><b><span style="color:#CC0033">Folder</span> ' . $value[0]
|
||||
.' <span style="color:#CC0033">creation failed!</span></b> Please create it manually.</div>';
|
||||
$error[] = 1;
|
||||
}
|
||||
}
|
||||
else//Folder exist
|
||||
{
|
||||
$message .= '<div><b><span style="color:#009933">Folder</span> ' . $value[0]
|
||||
.' <span style="color:#009933">exists!</span></b></div>';
|
||||
$error[] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
//$app = JFactory::getApplication();
|
||||
//$app->redirect(JRoute::_('index.php?option=com_phocagallery'), $message);
|
||||
JFactory::getApplication()->enqueueMessage($message);
|
||||
$parent->getParent()->setRedirectURL('index.php?option=com_phocagallery');
|
||||
}
|
||||
function uninstall($parent) {
|
||||
//echo '<p>' . JText::_('COM_PHOCAGALLLERY_UNINSTALL_TEXT') . '</p>';
|
||||
}
|
||||
|
||||
function update($parent) {
|
||||
//echo '<p>' . JText::sprintf('COM_PHOCAGALLERY_UPDATE_TEXT', $parent->get('manifest')->version) . '</p>';
|
||||
|
||||
|
||||
|
||||
$folder[0][0] = 'images/phocagallery/' ;
|
||||
$folder[0][1] = JPATH_ROOT . '/'. $folder[0][0];
|
||||
$folder[1][0] = 'images/phocagallery/avatars/';
|
||||
$folder[1][1] = JPATH_ROOT . '/' . $folder[1][0];
|
||||
|
||||
$message = '';
|
||||
$error = array();
|
||||
foreach ($folder as $key => $value)
|
||||
{
|
||||
if (!JFolder::exists( $value[1]))
|
||||
{
|
||||
if (JFolder::create( $value[1], 0755 ))
|
||||
{
|
||||
|
||||
$data = "<html>\n<body bgcolor=\"#FFFFFF\">\n</body>\n</html>";
|
||||
JFile::write($value[1]. '/'. "index.html", $data);
|
||||
$message .= '<div><b><span style="color:#009933">Folder</span> ' . $value[0]
|
||||
.' <span style="color:#009933">created!</span></b></div>';
|
||||
$error[] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
$message .= '<div><b><span style="color:#CC0033">Folder</span> ' . $value[0]
|
||||
.' <span style="color:#CC0033">creation failed!</span></b> Please create it manually.</div>';
|
||||
$error[] = 1;
|
||||
}
|
||||
}
|
||||
else//Folder exist
|
||||
{
|
||||
$message .= '<div><b><span style="color:#009933">Folder</span> ' . $value[0]
|
||||
.' <span style="color:#009933">exists!</span></b></div>';
|
||||
$error[] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$msg = JText::_('COM_PHOCAGALLERY_UPDATE_TEXT');
|
||||
$msg .= ' (' . JText::_('COM_PHOCAGALLERY_VERSION'). ': ' . $parent->get('manifest')->version . ')';
|
||||
$msg .= '<br />'. $message;
|
||||
$app = JFactory::getApplication();
|
||||
$app->enqueueMessage($msg);
|
||||
$app->redirect(JRoute::_('index.php?option=com_phocagallery'));
|
||||
}
|
||||
|
||||
function preflight($type, $parent) {
|
||||
//echo '<p>' . JText::_('COM_PHOCAGALLERY_PREFLIGHT_' . $type . '_TEXT') . '</p>';
|
||||
}
|
||||
|
||||
function postflight($type, $parent) {
|
||||
//echo '<p>' . JText::_('COM_PHOCAGALLERY_POSTFLIGHT_' . $type . '_TEXT') . '</p>';
|
||||
}
|
||||
}
|
||||
@ -0,0 +1 @@
|
||||
<html><body style="background-color: #000;"></body></html>
|
||||
@ -0,0 +1 @@
|
||||
<html><body style="background-color: #000;"></body></html>
|
||||
@ -0,0 +1,272 @@
|
||||
-- -------------------------------------------------------------------- --
|
||||
-- Phoca Gallery manual installation --
|
||||
-- -------------------------------------------------------------------- --
|
||||
-- See documentation on https://www.phoca.cz/ --
|
||||
-- --
|
||||
-- Change all prefixes #__ to prefix which is set in your Joomla! site --
|
||||
-- (e.g. from #__phocagallery to jos_phocagallery) --
|
||||
-- Run this SQL queries in your database tool, e.g. in phpMyAdmin --
|
||||
-- If you have questions, just ask in Phoca Forum --
|
||||
-- https://www.phoca.cz/forum/ --
|
||||
-- -------------------------------------------------------------------- --
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `#__phocagallery` (
|
||||
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`catid` int(11) NOT NULL DEFAULT '0',
|
||||
`sid` int(11) NOT NULL DEFAULT '0',
|
||||
`title` varchar(250) NOT NULL DEFAULT '',
|
||||
`alias` varchar(255) NOT NULL DEFAULT '',
|
||||
`filename` varchar(250) NOT NULL DEFAULT '',
|
||||
`format` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`description` text,
|
||||
`date` datetime NOT NULL,
|
||||
`hits` int(11) NOT NULL DEFAULT '0',
|
||||
`latitude` varchar(20) NOT NULL DEFAULT '',
|
||||
`longitude` varchar(20) NOT NULL DEFAULT '',
|
||||
`zoom` int(3) NOT NULL DEFAULT '0',
|
||||
`geotitle` varchar(255) NOT NULL DEFAULT '',
|
||||
`userid` int(11) NOT NULL DEFAULT '0',
|
||||
`videocode` text,
|
||||
`vmproductid` int(11) NOT NULL DEFAULT '0',
|
||||
`pcproductid` int(11) NOT NULL DEFAULT '0',
|
||||
`imgorigsize` int(11) NOT NULL DEFAULT '0',
|
||||
`published` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`approved` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`checked_out` int(11) NOT NULL DEFAULT '0',
|
||||
`checked_out_time` datetime,
|
||||
`ordering` int(11) NOT NULL DEFAULT '0',
|
||||
`params` text,
|
||||
`metakey` text,
|
||||
`metadesc` text,
|
||||
`metadata` text,
|
||||
`extlink1` text,
|
||||
`extlink2` text,
|
||||
`extid` varchar(255) NOT NULL DEFAULT '',
|
||||
`exttype` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`extl` varchar(255) NOT NULL DEFAULT '',
|
||||
`extm` varchar(255) NOT NULL DEFAULT '',
|
||||
`exts` varchar(255) NOT NULL DEFAULT '',
|
||||
`exto` varchar(255) NOT NULL DEFAULT '',
|
||||
`extw` varchar(255) NOT NULL DEFAULT '',
|
||||
`exth` varchar(255) NOT NULL DEFAULT '',
|
||||
`language` char(7) NOT NULL DEFAULT '',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `catid` (`catid`,`published`)
|
||||
) DEFAULT CHARSET=utf8 ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `#__phocagallery_categories` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`parent_id` int(11) NOT NULL DEFAULT '0',
|
||||
`owner_id` int(11) NOT NULL DEFAULT '0',
|
||||
`image_id` int(11) NOT NULL DEFAULT '0',
|
||||
`title` varchar(255) NOT NULL DEFAULT '',
|
||||
`name` varchar(255) NOT NULL DEFAULT '',
|
||||
`alias` varchar(255) NOT NULL DEFAULT '',
|
||||
`image` varchar(255) NOT NULL DEFAULT '',
|
||||
`section` varchar(50) NOT NULL DEFAULT '',
|
||||
`image_position` varchar(30) NOT NULL DEFAULT '',
|
||||
`description` text,
|
||||
`date` datetime NOT NULL,
|
||||
`published` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`approved` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`checked_out` int(11) unsigned NOT NULL DEFAULT '0',
|
||||
`checked_out_time` datetime,
|
||||
`editor` varchar(50) DEFAULT NULL,
|
||||
`ordering` int(11) NOT NULL DEFAULT '0',
|
||||
`access` tinyint(3) unsigned NOT NULL DEFAULT '0',
|
||||
`count` int(11) NOT NULL DEFAULT '0',
|
||||
`hits` int(11) NOT NULL DEFAULT '0',
|
||||
`accessuserid` text,
|
||||
`uploaduserid` text,
|
||||
`deleteuserid` text,
|
||||
`userfolder` text,
|
||||
`latitude` varchar(20) NOT NULL DEFAULT '',
|
||||
`longitude` varchar(20) NOT NULL DEFAULT '',
|
||||
`zoom` int(3) NOT NULL DEFAULT '0',
|
||||
`geotitle` varchar(255) NOT NULL DEFAULT '',
|
||||
`extid` varchar(255) NOT NULL DEFAULT '',
|
||||
`exta` varchar(255) NOT NULL DEFAULT '',
|
||||
`extu` varchar(255) NOT NULL DEFAULT '',
|
||||
`extauth` varchar(255) NOT NULL DEFAULT '',
|
||||
`imgurclient` varchar(255) NOT NULL DEFAULT '',
|
||||
`imguralbum` varchar(255) NOT NULL DEFAULT '',
|
||||
`extfbuid` int(11) NOT NULL DEFAULT '0',
|
||||
`extfbcatid` varchar(255) NOT NULL DEFAULT '',
|
||||
`params` text,
|
||||
`metakey` text,
|
||||
`metadesc` text,
|
||||
`metadata` text,
|
||||
`language` char(7) NOT NULL DEFAULT '',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `cat_idx` (`section`,`published`,`access`),
|
||||
KEY `idx_access` (`access`),
|
||||
KEY `idx_checkout` (`checked_out`)
|
||||
) DEFAULT CHARSET=utf8 ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `#__phocagallery_comments` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`catid` int(11) NOT NULL DEFAULT '0',
|
||||
`userid` int(11) NOT NULL DEFAULT '0',
|
||||
`date` datetime NOT NULL,
|
||||
`title` varchar(255) NOT NULL DEFAULT '',
|
||||
`alias` varchar(255) NOT NULL DEFAULT '',
|
||||
`comment` text,
|
||||
`published` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`checked_out` int(11) unsigned NOT NULL DEFAULT '0',
|
||||
`checked_out_time` datetime,
|
||||
`ordering` int(11) NOT NULL DEFAULT '0',
|
||||
`params` text,
|
||||
`language` char(7) NOT NULL DEFAULT '',
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARSET=utf8 ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `#__phocagallery_fb_users` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`appid` varchar(255) NOT NULL DEFAULT '',
|
||||
`appsid` varchar(255) NOT NULL DEFAULT '',
|
||||
`uid` varchar(255) NOT NULL DEFAULT '',
|
||||
`name` varchar(255) NOT NULL DEFAULT '',
|
||||
`link` varchar(255) NOT NULL DEFAULT '',
|
||||
`secret` varchar(255) NOT NULL DEFAULT '',
|
||||
`base_domain` varchar(255) NOT NULL DEFAULT '',
|
||||
`expires` varchar(100) NOT NULL DEFAULT '',
|
||||
`session_key` text,
|
||||
`access_token` text,
|
||||
`sig` text,
|
||||
`fanpageid` varchar(255) NOT NULL DEFAULT '',
|
||||
`published` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`checked_out` int(11) unsigned NOT NULL DEFAULT '0',
|
||||
`checked_out_time` datetime,
|
||||
`ordering` int(11) NOT NULL DEFAULT '0',
|
||||
`comments` text,
|
||||
`params` text,
|
||||
`language` char(7) NOT NULL DEFAULT '',
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARSET=utf8 ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `#__phocagallery_img_comments` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`imgid` int(11) NOT NULL DEFAULT '0',
|
||||
`userid` int(11) NOT NULL DEFAULT '0',
|
||||
`date` datetime NOT NULL,
|
||||
`title` varchar(255) NOT NULL DEFAULT '',
|
||||
`alias` varchar(255) NOT NULL DEFAULT '',
|
||||
`comment` text,
|
||||
`published` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`checked_out` int(11) unsigned NOT NULL DEFAULT '0',
|
||||
`checked_out_time` datetime,
|
||||
`ordering` int(11) NOT NULL DEFAULT '0',
|
||||
`params` text,
|
||||
`language` char(7) NOT NULL DEFAULT '',
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARSET=utf8 ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `#__phocagallery_img_votes` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`imgid` int(11) NOT NULL DEFAULT '0',
|
||||
`userid` int(11) NOT NULL DEFAULT '0',
|
||||
`date` datetime NOT NULL,
|
||||
`rating` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`published` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`checked_out` int(11) unsigned NOT NULL DEFAULT '0',
|
||||
`checked_out_time` datetime,
|
||||
`ordering` int(11) NOT NULL DEFAULT '0',
|
||||
`params` text,
|
||||
`language` char(7) NOT NULL DEFAULT '',
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARSET=utf8 ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `#__phocagallery_img_votes_statistics` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`imgid` int(11) NOT NULL DEFAULT '0',
|
||||
`count` int(11) NOT NULL DEFAULT '0',
|
||||
`average` float(8,6) NOT NULL DEFAULT '0.000000',
|
||||
`language` char(7) NOT NULL DEFAULT '',
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARSET=utf8 ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `#__phocagallery_styles` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`title` varchar(255) NOT NULL DEFAULT '',
|
||||
`alias` varchar(255) NOT NULL DEFAULT '',
|
||||
`filename` varchar(255) NOT NULL DEFAULT '',
|
||||
`menulink` text,
|
||||
`type` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`published` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`checked_out` int(11) unsigned NOT NULL DEFAULT '0',
|
||||
`checked_out_time` datetime,
|
||||
`ordering` int(11) NOT NULL DEFAULT '0',
|
||||
`params` text,
|
||||
`language` char(7) NOT NULL DEFAULT '',
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARSET=utf8 ;
|
||||
|
||||
INSERT INTO `#__phocagallery_styles` (`id`, `title`, `alias`, `filename`, `menulink`, `type`, `published`, `checked_out`, `checked_out_time`, `ordering`, `params`, `language`) VALUES
|
||||
(1, 'Phocagallery', 'phocagallery', 'phocagallery.css', '', 1, 1, 0, '0000-00-00 00:00:00', 1, NULL, '*'),
|
||||
(2, 'Rating', '', 'rating.css', NULL, 1, 1, 0, '0000-00-00 00:00:00', 2, NULL, '*'),
|
||||
(3, 'Default', '', 'default.css', NULL, 2, 1, 0, '0000-00-00 00:00:00', 3, NULL, '*'),
|
||||
(4, 'Simple', '', 'theme_simple.css', NULL, 1, 1, 0, '0000-00-00 00:00:00', 3, NULL, '*');
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `#__phocagallery_tags` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`title` varchar(255) NOT NULL DEFAULT '',
|
||||
`alias` varchar(255) NOT NULL DEFAULT '',
|
||||
`link_cat` int(11) NOT NULL DEFAULT '0',
|
||||
`link_ext` varchar(255) NOT NULL DEFAULT '',
|
||||
`description` text,
|
||||
`published` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`checked_out` int(11) unsigned NOT NULL DEFAULT '0',
|
||||
`checked_out_time` datetime,
|
||||
`ordering` int(11) NOT NULL DEFAULT '0',
|
||||
`params` text,
|
||||
`language` char(7) NOT NULL DEFAULT '',
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARSET=utf8 ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `#__phocagallery_tags_ref` (
|
||||
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`imgid` int(11) NOT NULL DEFAULT '0',
|
||||
`tagid` int(11) NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `id` (`id`),
|
||||
UNIQUE KEY `i_imgid` (`imgid`,`tagid`)
|
||||
) DEFAULT CHARSET=utf8 ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `#__phocagallery_user` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`userid` int(11) NOT NULL DEFAULT '0',
|
||||
`avatar` varchar(40) NOT NULL DEFAULT '',
|
||||
`published` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`approved` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`checked_out` int(11) NOT NULL DEFAULT '0',
|
||||
`checked_out_time` datetime,
|
||||
`ordering` int(11) NOT NULL DEFAULT '0',
|
||||
`params` text,
|
||||
`language` char(7) NOT NULL DEFAULT '',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `userid` (`userid`)
|
||||
) DEFAULT CHARSET=utf8 ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `#__phocagallery_votes` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`catid` int(11) NOT NULL DEFAULT '0',
|
||||
`userid` int(11) NOT NULL DEFAULT '0',
|
||||
`date` datetime NOT NULL,
|
||||
`rating` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`published` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`checked_out` int(11) unsigned NOT NULL DEFAULT '0',
|
||||
`checked_out_time` datetime,
|
||||
`ordering` int(11) NOT NULL DEFAULT '0',
|
||||
`params` text,
|
||||
`language` char(7) NOT NULL DEFAULT '',
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARSET=utf8 ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `#__phocagallery_votes_statistics` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`catid` int(11) NOT NULL DEFAULT '0',
|
||||
`count` int(11) NOT NULL DEFAULT '0',
|
||||
`average` float(8,6) NOT NULL DEFAULT '0.000000',
|
||||
`language` char(7) NOT NULL DEFAULT '',
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARSET=utf8 ;
|
||||
@ -0,0 +1,13 @@
|
||||
DROP TABLE IF EXISTS `#__phocagallery`;
|
||||
DROP TABLE IF EXISTS `#__phocagallery_categories`;
|
||||
DROP TABLE IF EXISTS `#__phocagallery_comments`;
|
||||
DROP TABLE IF EXISTS `#__phocagallery_fb_users`;
|
||||
DROP TABLE IF EXISTS `#__phocagallery_img_comments`;
|
||||
DROP TABLE IF EXISTS `#__phocagallery_img_votes`;
|
||||
DROP TABLE IF EXISTS `#__phocagallery_img_votes_statistics`;
|
||||
DROP TABLE IF EXISTS `#__phocagallery_styles`;
|
||||
DROP TABLE IF EXISTS `#__phocagallery_tags`;
|
||||
DROP TABLE IF EXISTS `#__phocagallery_tags_ref`;
|
||||
DROP TABLE IF EXISTS `#__phocagallery_user`;
|
||||
DROP TABLE IF EXISTS `#__phocagallery_votes`;
|
||||
DROP TABLE IF EXISTS `#__phocagallery_votes_statistics`;
|
||||
@ -0,0 +1,118 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage Layout
|
||||
*
|
||||
* @copyright (C) 2018 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\HTML\HTMLHelper;
|
||||
use Joomla\CMS\Language\Text;
|
||||
|
||||
extract($displayData);
|
||||
|
||||
/**
|
||||
* Layout variables
|
||||
* -----------------
|
||||
* @var string $autocomplete Autocomplete attribute for the field.
|
||||
* @var boolean $autofocus Is autofocus enabled?
|
||||
* @var string $class Classes for the input.
|
||||
* @var string $description Description of the field.
|
||||
* @var boolean $disabled Is this field disabled?
|
||||
* @var string $group Group the field belongs to. <fields> section in form XML.
|
||||
* @var boolean $hidden Is this field hidden in the form?
|
||||
* @var string $hint Placeholder for the field.
|
||||
* @var string $id DOM id of the field.
|
||||
* @var string $label Label of the field.
|
||||
* @var string $labelclass Classes to apply to the label.
|
||||
* @var boolean $multiple Does this field support multiple values?
|
||||
* @var string $name Name of the input field.
|
||||
* @var string $onchange Onchange attribute for the field.
|
||||
* @var string $onclick Onclick attribute for the field.
|
||||
* @var string $pattern Pattern (Reg Ex) of value of the form field.
|
||||
* @var boolean $readonly Is this field read only?
|
||||
* @var boolean $repeat Allows extensions to duplicate elements.
|
||||
* @var boolean $required Is this field required?
|
||||
* @var integer $size Size attribute of the input.
|
||||
* @var boolean $spellcheck Spellcheck state for the form field.
|
||||
* @var string $validate Validation rules to apply.
|
||||
* @var string $value Value attribute of the field.
|
||||
* @var array $options Options available for this field.
|
||||
* @var string $dataAttribute Miscellaneous data attributes preprocessed for HTML output
|
||||
* @var array $dataAttributes Miscellaneous data attribute for eg, data-*
|
||||
*/
|
||||
|
||||
$html = array();
|
||||
$attr = '';
|
||||
|
||||
// Initialize the field attributes.
|
||||
$attr .= !empty($size) ? ' size="' . $size . '"' : '';
|
||||
$attr .= $multiple ? ' multiple' : '';
|
||||
$attr .= $autofocus ? ' autofocus' : '';
|
||||
$attr .= $onchange ? ' onchange="' . $onchange . '"' : '';
|
||||
$attr .= $dataAttribute;
|
||||
|
||||
// To avoid user's confusion, readonly="readonly" should imply disabled="disabled".
|
||||
if ($readonly || $disabled) {
|
||||
$attr .= ' disabled="disabled"';
|
||||
}
|
||||
|
||||
$attr2 = '';
|
||||
$attr2 .= !empty($class) ? ' class="' . $class . '"' : '';
|
||||
$attr2 .= ' placeholder="' . $this->escape($hint ?: Text::_('JGLOBAL_TYPE_OR_SELECT_SOME_OPTIONS')) . '" ';
|
||||
|
||||
if ($required) {
|
||||
$attr .= ' required class="required"';
|
||||
$attr2 .= ' required';
|
||||
}
|
||||
|
||||
// Create a read-only list (no name) with hidden input(s) to store the value(s).
|
||||
if ($readonly) {
|
||||
$html[] = HTMLHelper::_('select.genericlist', $options, '', trim($attr), 'value', 'text', $value, $id);
|
||||
|
||||
// E.g. form field type tag sends $this->value as array
|
||||
if ($multiple && is_array($value)) {
|
||||
if (!count($value)) {
|
||||
$value[] = '';
|
||||
}
|
||||
|
||||
foreach ($value as $val) {
|
||||
$html[] = '<input type="hidden" name="' . $name . '" value="' . htmlspecialchars($val, ENT_COMPAT, 'UTF-8') . '">';
|
||||
}
|
||||
} else {
|
||||
$html[] = '<input type="hidden" name="' . $name . '" value="' . htmlspecialchars($value, ENT_COMPAT, 'UTF-8') . '">';
|
||||
}
|
||||
} else // Create a regular list.
|
||||
{
|
||||
$html[] = HTMLHelper::_('select.genericlist', $options, $name, trim($attr), 'value', 'text', $value, $id);
|
||||
}
|
||||
|
||||
if ($refreshPage === true && $hasCustomFields) {
|
||||
$attr2 .= ' data-refresh-catid="' . $refreshCatId . '" data-refresh-section="' . $refreshSection . '"';
|
||||
$attr2 .= ' onchange="Joomla.categoryHasChanged(this)"';
|
||||
|
||||
Factory::getDocument()->getWebAssetManager()
|
||||
->registerAndUseScript('field.category-change', 'layouts/joomla/form/field/category-change.min.js', [], ['defer' => true], ['core'])
|
||||
->useScript('webcomponent.core-loader');
|
||||
|
||||
// Pass the element id to the javascript
|
||||
Factory::getDocument()->addScriptOptions('category-change', $id);
|
||||
} else {
|
||||
$attr2 .= $onchange ? ' onchange="' . $onchange . '"' : '';
|
||||
}
|
||||
|
||||
Text::script('JGLOBAL_SELECT_NO_RESULTS_MATCH');
|
||||
Text::script('JGLOBAL_SELECT_PRESS_TO_SELECT');
|
||||
|
||||
Factory::getApplication()->getDocument()->getWebAssetManager()
|
||||
->usePreset('choicesjs')
|
||||
->useScript('webcomponent.field-fancy-select');
|
||||
|
||||
?>
|
||||
|
||||
<joomla-field-fancy-select <?php echo $attr2; ?>><?php echo implode($html); ?></joomla-field-fancy-select>
|
||||
@ -0,0 +1,130 @@
|
||||
<?php
|
||||
/*
|
||||
* @package Joomla
|
||||
* @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');
|
||||
|
||||
?><svg aria-hidden="true" class="ph-sr-only" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<defs>
|
||||
<symbol id="ph-si-feed" viewBox="0 0 512 512">
|
||||
<path d="M108.56 342.78a60.34 60.34 0 1060.56 60.44 60.63 60.63 0 00-60.56-60.44z" />
|
||||
<path d="M48 186.67v86.55c52 0 101.94 15.39 138.67 52.11s52 86.56 52 138.67h86.66c0-151.56-125.66-277.33-277.33-277.33z" />
|
||||
<path d="M48 48v86.56c185.25 0 329.22 144.08 329.22 329.44H464C464 234.66 277.67 48 48 48z" />
|
||||
</symbol>
|
||||
<symbol id="ph-si-category" viewBox="0 0 512 512">
|
||||
<path d="M72 64c-30.928 0-56 25.072-56 56v272c0 30.928 25.072 56 56 56h368c30.928 0 56-25.072 56-56V152c0-30.928-25.072-56-56-56H220.11a23.885 23.885 0 01-13.31-4L179 73.41A55.768 55.768 0 00147.89 64H72z" />
|
||||
</symbol>
|
||||
|
||||
|
||||
<symbol id="ph-si-back" viewBox="0 0 512 512">
|
||||
<path d="M48 256c0 114.87 93.13 208 208 208s208-93.13 208-208S370.87 48 256 48 48 141.13 48 256zm212.65-91.36a16 16 0 01.09 22.63L208.42 240H342a16 16 0 010 32H208.42l52.32 52.73A16 16 0 11238 347.27l-79.39-80a16 16 0 010-22.54l79.39-80a16 16 0 0122.65-.09z" />
|
||||
</symbol>
|
||||
|
||||
<symbol id="ph-si-prev" viewBox="0 0 512 512">
|
||||
<path d="M48 256c0 114.87 93.13 208 208 208s208-93.13 208-208S370.87 48 256 48 48 141.13 48 256zm212.65-91.36a16 16 0 01.09 22.63L208.42 240H342a16 16 0 010 32H208.42l52.32 52.73A16 16 0 11238 347.27l-79.39-80a16 16 0 010-22.54l79.39-80a16 16 0 0122.65-.09z" />
|
||||
</symbol>
|
||||
|
||||
<symbol id="ph-si-next" viewBox="0 0 512 512">
|
||||
<path d="M464 256c0-114.87-93.13-208-208-208S48 141.13 48 256s93.13 208 208 208 208-93.13 208-208zm-212.65 91.36a16 16 0 01-.09-22.63L303.58 272H170a16 16 0 010-32h133.58l-52.32-52.73A16 16 0 11274 164.73l79.39 80a16 16 0 010 22.54l-79.39 80a16 16 0 01-22.65.09z"/>
|
||||
</symbol>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<symbol id="ph-si-image" viewBox="0 0 512 512">
|
||||
<ellipse cx="373.14" cy="219.33" rx="46.29" ry="46" fill="none" />
|
||||
<path d="M80 132v328a20 20 0 0020 20h392a20 20 0 0020-20V132a20 20 0 00-20-20H100a20 20 0 00-20 20zm293.14 41.33a46 46 0 11-46.28 46 46.19 46.19 0 0146.28-46zm-261.41 276v-95.48l122.76-110.2L328.27 337l-113 112.33zm368.27 0H259l144.58-144L480 370.59z" />
|
||||
<path d="M20 32A20 20 0 000 52v344a20 20 0 0020 20h28V100a20 20 0 0120-20h380V52a20 20 0 00-20-20z" />
|
||||
</symbol>
|
||||
|
||||
<symbol id="ph-si-lock" viewBox="0 0 512 512">
|
||||
<path d="M368 192h-16v-80a96 96 0 10-192 0v80h-16a64.07 64.07 0 00-64 64v176a64.07 64.07 0 0064 64h224a64.07 64.07 0 0064-64V256a64.07 64.07 0 00-64-64zm-48 0H192v-80a64 64 0 11128 0z" />
|
||||
</symbol>
|
||||
|
||||
<symbol id="ph-si-download" viewBox="0 0 512 512">
|
||||
<path d="M376 160H272v153.37l52.69-52.68a16 16 0 0122.62 22.62l-80 80a16 16 0 01-22.62 0l-80-80a16 16 0 0122.62-22.62L240 313.37V160H136a56.06 56.06 0 00-56 56v208a56.06 56.06 0 0056 56h240a56.06 56.06 0 0056-56V216a56.06 56.06 0 00-56-56zM272 48a16 16 0 00-32 0v112h32z" />
|
||||
</symbol>
|
||||
|
||||
<symbol id="ph-si-view" viewBox="0 0 512 512">
|
||||
<path d="M456.69 421.39L362.6 327.3a173.81 173.81 0 0034.84-104.58C397.44 126.38 319.06 48 222.72 48S48 126.38 48 222.72s78.38 174.72 174.72 174.72A173.81 173.81 0 00327.3 362.6l94.09 94.09a25 25 0 0035.3-35.3zM97.92 222.72a124.8 124.8 0 11124.8 124.8 124.95 124.95 0 01-124.8-124.8z" />
|
||||
</symbol>
|
||||
|
||||
<symbol id="ph-si-earth" viewBox="0 0 512 512">
|
||||
<path d="M414.39 97.74A224 224 0 1097.61 414.52 224 224 0 10414.39 97.74zM64 256.13a191.63 191.63 0 016.7-50.31c7.34 15.8 18 29.45 25.25 45.66 9.37 20.84 34.53 15.06 45.64 33.32 9.86 16.21-.67 36.71 6.71 53.67 5.36 12.31 18 15 26.72 24 8.91 9.08 8.72 21.52 10.08 33.36a305.36 305.36 0 007.45 41.27c0 .1 0 .21.08.31C117.8 411.13 64 339.8 64 256.13zm192 192a193.12 193.12 0 01-32-2.68c.11-2.71.16-5.24.43-7 2.43-15.9 10.39-31.45 21.13-43.35 10.61-11.74 25.15-19.68 34.11-33 8.78-13 11.41-30.5 7.79-45.69-5.33-22.44-35.82-29.93-52.26-42.1-9.45-7-17.86-17.82-30.27-18.7-5.72-.4-10.51.83-16.18-.63-5.2-1.35-9.28-4.15-14.82-3.42-10.35 1.36-16.88 12.42-28 10.92-10.55-1.41-21.42-13.76-23.82-23.81-3.08-12.92 7.14-17.11 18.09-18.26 4.57-.48 9.7-1 14.09.68 5.78 2.14 8.51 7.8 13.7 10.66 9.73 5.34 11.7-3.19 10.21-11.83-2.23-12.94-4.83-18.21 6.71-27.12 8-6.14 14.84-10.58 13.56-21.61-.76-6.48-4.31-9.41-1-15.86 2.51-4.91 9.4-9.34 13.89-12.27 11.59-7.56 49.65-7 34.1-28.16-4.57-6.21-13-17.31-21-18.83-10-1.89-14.44 9.27-21.41 14.19-7.2 5.09-21.22 10.87-28.43 3-9.7-10.59 6.43-14.06 10-21.46 1.65-3.45 0-8.24-2.78-12.75q5.41-2.28 11-4.23a15.6 15.6 0 008 3c6.69.44 13-3.18 18.84 1.38 6.48 5 11.15 11.32 19.75 12.88 8.32 1.51 17.13-3.34 19.19-11.86 1.25-5.18 0-10.65-1.2-16a190.83 190.83 0 01105 32.21c-2-.76-4.39-.67-7.34.7-6.07 2.82-14.67 10-15.38 17.12-.81 8.08 11.11 9.22 16.77 9.22 8.5 0 17.11-3.8 14.37-13.62-1.19-4.26-2.81-8.69-5.42-11.37a193.27 193.27 0 0118 14.14c-.09.09-.18.17-.27.27-5.76 6-12.45 10.75-16.39 18.05-2.78 5.14-5.91 7.58-11.54 8.91-3.1.73-6.64 1-9.24 3.08-7.24 5.7-3.12 19.4 3.74 23.51 8.67 5.19 21.53 2.75 28.07-4.66 5.11-5.8 8.12-15.87 17.31-15.86a15.4 15.4 0 0110.82 4.41c3.8 3.94 3.05 7.62 3.86 12.54 1.43 8.74 9.14 4 13.83-.41a192.12 192.12 0 019.24 18.77c-5.16 7.43-9.26 15.53-21.67 6.87-7.43-5.19-12-12.72-21.33-15.06-8.15-2-16.5.08-24.55 1.47-9.15 1.59-20 2.29-26.94 9.22-6.71 6.68-10.26 15.62-17.4 22.33-13.81 13-19.64 27.19-10.7 45.57 8.6 17.67 26.59 27.26 46 26 19.07-1.27 38.88-12.33 38.33 15.38-.2 9.81 1.85 16.6 4.86 25.71 2.79 8.4 2.6 16.54 3.24 25.21a158 158 0 004.74 30.07A191.75 191.75 0 01256 448.13z" />
|
||||
</symbol>
|
||||
|
||||
<symbol id="ph-si-camera" viewBox="0 0 512 512">
|
||||
<path d="M432 144h-59c-3 0-6.72-1.94-9.62-5l-25.94-40.94a15.52 15.52 0 00-1.37-1.85C327.11 85.76 315 80 302 80h-92c-13 0-25.11 5.76-34.07 16.21a15.52 15.52 0 00-1.37 1.85l-25.94 41c-2.22 2.42-5.34 5-8.62 5v-8a16 16 0 00-16-16h-24a16 16 0 00-16 16v8h-4a48.05 48.05 0 00-48 48V384a48.05 48.05 0 0048 48h352a48.05 48.05 0 0048-48V192a48.05 48.05 0 00-48-48zM256 368a96 96 0 1196-96 96.11 96.11 0 01-96 96z" />
|
||||
</symbol>
|
||||
|
||||
<symbol id="ph-si-comment" viewBox="0 0 512 512">
|
||||
<path d="M144 464a16 16 0 01-16-16v-64h-24a72.08 72.08 0 01-72-72V120a72.08 72.08 0 0172-72h304a72.08 72.08 0 0172 72v192a72.08 72.08 0 01-72 72H245.74l-91.49 76.29A16.05 16.05 0 01144 464z" />
|
||||
</symbol>
|
||||
|
||||
<symbol id="ph-si-ext-link" viewBox="0 0 512 512">
|
||||
<path d="M200.66 352H144a96 96 0 010-192h55.41m113.18 0H368a96 96 0 010 192h-56.66m-142.27-96h175.86" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="48" />
|
||||
</symbol>
|
||||
|
||||
<symbol id="ph-si-up" viewBox="0 0 512 512">
|
||||
<path d="M256 48C141.13 48 48 141.13 48 256s93.13 208 208 208 208-93.13 208-208S370.87 48 256 48zm91.36 212.65a16 16 0 01-22.63.09L272 208.42V342a16 16 0 01-32 0V208.42l-52.73 52.32A16 16 0 11164.73 238l80-79.39a16 16 0 0122.54 0l80 79.39a16 16 0 01.09 22.65z" />
|
||||
</symbol>
|
||||
|
||||
<symbol id="ph-si-upload" viewBox="0 0 512 512">
|
||||
<path d="M255.803 64a45.006 45.006 0 00-31.623 13.178L122.926 178.432a45.002 45.002 0 000 63.642 45.002 45.002 0 0063.64 0l24.432-24.431v110.74A45.002 45.002 0 00256 373.385a45.002 45.002 0 0045.002-45.002v-110.74l24.432 24.431a45.002 45.002 0 0063.64 0 45.002 45.002 0 000-63.642L287.82 77.178A45.006 45.006 0 00255.803 64zM36 330.984c-11.08 0-20 8.92-20 20V428c0 11.08 8.92 20 20 20h440c11.08 0 20-8.92 20-20v-77.016c0-11.08-8.92-20-20-20H320.947A65 65 0 01256 393.383a65 65 0 01-64.947-62.399H36zm396.256 25.12h23.922c11.08 0 20 8.92 20 20v26.777c0 11.08-8.92 20-20 20h-23.922c-11.08 0-20-8.92-20-20v-26.777c0-11.08 8.92-20 20-20z" />
|
||||
</symbol>
|
||||
|
||||
<symbol id="ph-si-upload-multiple" viewBox="0 0 512 512">
|
||||
<path d="M255.803 64a45.006 45.006 0 00-31.623 13.178L122.926 178.432a45.002 45.002 0 000 63.642 45.002 45.002 0 0063.64 0l24.432-24.431v110.74A45.002 45.002 0 00256 373.385a45.002 45.002 0 0045.002-45.002v-110.74l24.432 24.431a45.002 45.002 0 0063.64 0 45.002 45.002 0 000-63.642L287.82 77.178A45.006 45.006 0 00255.803 64zM36 330.984c-11.08 0-20 8.92-20 20V428c0 11.08 8.92 20 20 20h440c11.08 0 20-8.92 20-20v-77.016c0-11.08-8.92-20-20-20H320.947A65 65 0 01256 393.383a65 65 0 01-64.947-62.399H36zm312.256 25.12h23.92c11.08 0 20 8.92 20 20v26.777c0 11.08-8.92 20-20 20h-23.92c-11.08 0-20-8.92-20-20v-26.777c0-11.08 8.92-20 20-20zm84 0h23.922c11.08 0 20 8.92 20 20v26.777c0 11.08-8.92 20-20 20h-23.922c-11.08 0-20-8.92-20-20v-26.777c0-11.08 8.92-20 20-20z" />
|
||||
</symbol>
|
||||
|
||||
<symbol id="ph-si-cart" viewBox="0 0 512 512">
|
||||
<circle cx="176" cy="416" r="32" />
|
||||
<circle cx="400" cy="416" r="32" />
|
||||
<path d="M456.8 120.78a23.92 23.92 0 00-18.56-8.78H133.89l-6.13-34.78A16 16 0 00112 64H48a16 16 0 000 32h50.58l45.66 258.78A16 16 0 00160 368h256a16 16 0 000-32H173.42l-5.64-32h241.66A24.07 24.07 0 00433 284.71l28.8-144a24 24 0 00-5-19.93z" />
|
||||
</symbol>
|
||||
|
||||
<symbol id="ph-si-trash" viewBox="0 0 512 512">
|
||||
<path d="M296 64h-80a7.91 7.91 0 00-8 8v24h96V72a7.91 7.91 0 00-8-8z" fill="none"/><path d="M432 96h-96V72a40 40 0 00-40-40h-80a40 40 0 00-40 40v24H80a16 16 0 000 32h17l19 304.92c1.42 26.85 22 47.08 48 47.08h184c26.13 0 46.3-19.78 48-47l19-305h17a16 16 0 000-32zM192.57 416H192a16 16 0 01-16-15.43l-8-224a16 16 0 1132-1.14l8 224A16 16 0 01192.57 416zM272 400a16 16 0 01-32 0V176a16 16 0 0132 0zm32-304h-96V72a7.91 7.91 0 018-8h80a7.91 7.91 0 018 8zm32 304.57A16 16 0 01320 416h-.58A16 16 0 01304 399.43l8-224a16 16 0 1132 1.14z"/>
|
||||
</symbol>
|
||||
|
||||
<symbol id="ph-si-enabled" viewBox="0 0 512 512">
|
||||
<path d="M256 48C141.31 48 48 141.31 48 256s93.31 208 208 208 208-93.31 208-208S370.69 48 256 48zm108.25 138.29l-134.4 160a16 16 0 01-12 5.71h-.27a16 16 0 01-11.89-5.3l-57.6-64a16 16 0 1123.78-21.4l45.29 50.32 122.59-145.91a16 16 0 0124.5 20.58z"/>
|
||||
</symbol>
|
||||
|
||||
<symbol id="ph-si-disabled" viewBox="0 0 512 512">
|
||||
<path d="M256 48C141.31 48 48 141.31 48 256s93.31 208 208 208 208-93.31 208-208S370.69 48 256 48zm80 224H176a16 16 0 010-32h160a16 16 0 010 32z"/>
|
||||
</symbol>
|
||||
|
||||
<symbol id="ph-si-star" viewBox="0 0 512 512">
|
||||
<path d="M394 480a16 16 0 01-9.39-3L256 383.76 127.39 477a16 16 0 01-24.55-18.08L153 310.35 23 221.2a16 16 0 019-29.2h160.38l48.4-148.95a16 16 0 0130.44 0l48.4 149H480a16 16 0 019.05 29.2L359 310.35l50.13 148.53A16 16 0 01394 480z"/>
|
||||
</symbol>
|
||||
|
||||
<symbol id="ph-si-user" viewBox="0 0 512 512">
|
||||
<path d="M332.64 64.58C313.18 43.57 286 32 256 32c-30.16 0-57.43 11.5-76.8 32.38-19.58 21.11-29.12 49.8-26.88 80.78C156.76 206.28 203.27 256 256 256s99.16-49.71 103.67-110.82c2.27-30.7-7.33-59.33-27.03-80.6zM432 480H80a31 31 0 01-24.2-11.13c-6.5-7.77-9.12-18.38-7.18-29.11C57.06 392.94 83.4 353.61 124.8 326c36.78-24.51 83.37-38 131.2-38s94.42 13.5 131.2 38c41.4 27.6 67.74 66.93 76.18 113.75 1.94 10.73-.68 21.34-7.18 29.11A31 31 0 01432 480z"/>
|
||||
</symbol>
|
||||
|
||||
<symbol id="ph-si-stats" viewBox="0 0 512 512">
|
||||
<path d="M104 496H72a24 24 0 01-24-24V328a24 24 0 0124-24h32a24 24 0 0124 24v144a24 24 0 01-24 24zm224 0h-32a24 24 0 01-24-24V232a24 24 0 0124-24h32a24 24 0 0124 24v240a24 24 0 01-24 24zm112 0h-32a24 24 0 01-24-24V120a24 24 0 0124-24h32a24 24 0 0124 24v352a24 24 0 01-24 24zm-224 0h-32a24 24 0 01-24-24V40a24 24 0 0124-24h32a24 24 0 0124 24v432a24 24 0 01-24 24z"/>
|
||||
</symbol>
|
||||
|
||||
<symbol id="ph-si-ytb" viewBox="0 0 512 512">
|
||||
<path d="M508.64 148.79c0-45-33.1-81.2-74-81.2C379.24 65 322.74 64 265 64h-18c-57.6 0-114.2 1-169.6 3.6C36.6 67.6 3.5 104 3.5 149 1 184.59-.06 220.19 0 255.79q-.15 53.4 3.4 106.9c0 45 33.1 81.5 73.9 81.5 58.2 2.7 117.9 3.9 178.6 3.8q91.2.3 178.6-3.8c40.9 0 74-36.5 74-81.5 2.4-35.7 3.5-71.3 3.4-107q.34-53.4-3.26-106.9zM207 353.89v-196.5l145 98.2z"/>
|
||||
</symbol>
|
||||
|
||||
<symbol id="ph-si-search" viewBox="0 0 512 512">
|
||||
<path d="M456.69 421.39L362.6 327.3a173.81 173.81 0 0034.84-104.58C397.44 126.38 319.06 48 222.72 48S48 126.38 48 222.72s78.38 174.72 174.72 174.72A173.81 173.81 0 00327.3 362.6l94.09 94.09a25 25 0 0035.3-35.3zM97.92 222.72a124.8 124.8 0 11124.8 124.8 124.95 124.95 0 01-124.8-124.8z"/>
|
||||
</symbol>
|
||||
|
||||
<symbol id="ph-si-save" viewBox="0 0 512 512">
|
||||
<path d="M465.94 119.76l-73.7-73.7A47.68 47.68 0 00358.3 32H96a64 64 0 00-64 64v320a64 64 0 0064 64h320a64 64 0 0064-64V153.7a47.68 47.68 0 00-14.06-33.94zM120 112h176a8 8 0 018 8v48a8 8 0 01-8 8H120a8 8 0 01-8-8v-48a8 8 0 018-8zm139.75 319.91a80 80 0 1176.16-76.16 80.06 80.06 0 01-76.16 76.16z"/><circle cx="256" cy="352" r="48"/>
|
||||
</symbol>
|
||||
|
||||
</defs>
|
||||
</svg>
|
||||
@ -0,0 +1,616 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Phoca Cart
|
||||
* @author Jan Pavelka - https://www.phoca.cz
|
||||
* @copyright Copyright (C) Jan Pavelka https://www.phoca.cz
|
||||
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 and later
|
||||
* @cms Joomla
|
||||
* @copyright Copyright (C) Open Source Matters. All rights reserved.
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
|
||||
*/
|
||||
|
||||
namespace Phoca\Render;
|
||||
|
||||
defined( '_JEXEC' ) or die( 'Restricted access' );
|
||||
|
||||
use Joomla\CMS\HTML\Helpers\Sidebar;
|
||||
use Joomla\CMS\HTML\HTMLHelper;
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Router\Route;
|
||||
use Joomla\CMS\Version;
|
||||
use Joomla\CMS\Layout\FileLayout;
|
||||
|
||||
class Adminview
|
||||
{
|
||||
public $view = '';
|
||||
public $viewtype = 2;
|
||||
public $option = '';
|
||||
public $optionLang = '';
|
||||
public $compatible = false;
|
||||
public $sidebar = true;
|
||||
protected $document = false;
|
||||
|
||||
public function __construct(){
|
||||
|
||||
$app = Factory::getApplication();
|
||||
$version = new Version();
|
||||
$this->compatible = $version->isCompatible('4.0.0-alpha');
|
||||
$this->view = $app->input->get('view');
|
||||
$this->option = $app->input->get('option');
|
||||
$this->optionLang = strtoupper($this->option);
|
||||
$this->sidebar = Factory::getApplication()->getTemplate(true)->params->get('menu', 1) ? true : false;
|
||||
$this->document = Factory::getDocument();
|
||||
$wa = $app->getDocument()->getWebAssetManager();
|
||||
|
||||
HTMLHelper::_('behavior.formvalidator');
|
||||
HTMLHelper::_('behavior.keepalive');
|
||||
HTMLHelper::_('jquery.framework', false);
|
||||
|
||||
$wa->registerAndUseStyle($this->option . '.font', 'media/' . $this->option . '/duotone/joomla-fonts.css', array('version' => 'auto'));
|
||||
$wa->registerAndUseStyle($this->option . '.main', 'media/' .$this->option . '/css/administrator/'.str_replace('com_', '', $this->option).'.css', array('version' => 'auto'));
|
||||
$wa->registerAndUseStyle($this->option . '.version', 'media/' .$this->option . '/css/administrator/4.css', array('version' => 'auto'));
|
||||
$wa->registerAndUseStyle($this->option . '.theme', 'media/' .$this->option . '/css/administrator/theme-dark.css', array('version' => 'auto'), [], ['template.active']);
|
||||
}
|
||||
|
||||
public function startHeader() {
|
||||
|
||||
$layoutSVG = new FileLayout('svg_definitions', null, array('component' => $this->option));
|
||||
return $layoutSVG->render(array());
|
||||
|
||||
}
|
||||
|
||||
public function startCp() {
|
||||
|
||||
// CSS based on user groups
|
||||
$user = Factory::getUser();
|
||||
$groupClass = '';
|
||||
if (!empty($user->groups)) {
|
||||
foreach ($user->groups as $k => $v) {
|
||||
$groupClass .= ' group-'. $v;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$o = array();
|
||||
if ($this->compatible) {
|
||||
|
||||
if ($this->sidebar) {
|
||||
$o[] = '<div class="ph-group-class '.$groupClass.'">';
|
||||
} else {
|
||||
$o[] = '<div class="row '.$groupClass.'">';
|
||||
$o[] = '<div id="j-main-container" class="col-md-2">'. Sidebar::render().'</div>';
|
||||
$o[] = '<div id="j-main-container" class="col-md-10">';
|
||||
}
|
||||
|
||||
} else {
|
||||
$o[] = '<div id="j-sidebar-container" class="span2">' . Sidebar::render() . '</div>'."\n";
|
||||
$o[] = '<div id="j-main-container" class="span10">'."\n";
|
||||
}
|
||||
|
||||
return implode("\n", $o);
|
||||
}
|
||||
|
||||
public function endCp() {
|
||||
|
||||
$o = array();
|
||||
if ($this->compatible) {
|
||||
if ($this->sidebar) {
|
||||
$o[] = '</div>';// end groupClass
|
||||
} else {
|
||||
|
||||
$o[] = '</div></div>';
|
||||
}
|
||||
} else {
|
||||
$o[] = '</div>';
|
||||
}
|
||||
|
||||
return implode("\n", $o);
|
||||
}
|
||||
|
||||
public function startForm($option, $view, $itemId, $id = 'adminForm', $name = 'adminForm', $class = '', $layout = 'edit', $tmpl = '') {
|
||||
|
||||
|
||||
if ($layout != '') {
|
||||
$layout = '&layout='.$layout;
|
||||
}
|
||||
if ($view != '') {
|
||||
$viewP = '&view='.$view;
|
||||
}
|
||||
if ($tmpl != '') {
|
||||
$tmpl = '&tmpl='.$tmpl;
|
||||
}
|
||||
|
||||
$containerClass = 'container';
|
||||
if ($this->compatible) {
|
||||
$containerClass = '';
|
||||
}
|
||||
|
||||
// CSS based on user groups
|
||||
$user = Factory::getUser();
|
||||
$groupClass = '';
|
||||
if (!empty($user->groups)) {
|
||||
foreach ($user->groups as $k => $v) {
|
||||
$groupClass .= ' group-'. $v;
|
||||
}
|
||||
}
|
||||
|
||||
return '<div id="'.$view.'" class="'.$groupClass.'"><form action="'.Route::_('index.php?option='.$option . $viewP . $layout . '&id='.(int) $itemId . $tmpl).'" method="post" name="'.$name.'" id="'.$id.'" class="form-validate '.$class.'" role="form">'."\n"
|
||||
.'<div id="phAdminEdit" class="'.$containerClass.'"><div class="row">'."\n";
|
||||
}
|
||||
|
||||
public function endForm() {
|
||||
return '</div></div>'."\n".'</form>'."\n".'</div>'. "\n" . $this->ajaxTopHtml();
|
||||
}
|
||||
|
||||
public function startFormRoute($view, $route, $id = 'adminForm', $name = 'adminForm') {
|
||||
|
||||
// CSS based on user groups
|
||||
$user = Factory::getUser();
|
||||
$groupClass = '';
|
||||
if (!empty($user->groups)) {
|
||||
foreach ($user->groups as $k => $v) {
|
||||
$groupClass .= ' group-'. $v;
|
||||
}
|
||||
}
|
||||
|
||||
return '<div id="'.$view.'" class="'.$groupClass.'"><form action="'.Route::_($route).'" method="post" name="'.$name.'" id="'.$id.'" class="form-validate">'."\n"
|
||||
.'<div id="phAdminEdit" class="row">'."\n";
|
||||
}
|
||||
|
||||
public function ajaxTopHtml($text = '') {
|
||||
$o = '<div id="ph-ajaxtop">';
|
||||
if ($text != '') {
|
||||
$o .= '<div id="ph-ajaxtop-message"><div class="ph-loader-top"></div> '. strip_tags(addslashes($text)) . '</div>';
|
||||
}
|
||||
$o .= '</div>';
|
||||
return $o;
|
||||
}
|
||||
|
||||
public function formInputs($task = '') {
|
||||
|
||||
$o = '';
|
||||
$o .= '<input type="hidden" name="task" value="" />'. "\n";
|
||||
if ($task != '') {
|
||||
$o .= '<input type="hidden" name="taskgroup" value="'.strip_tags($task).'" />'. "\n";
|
||||
}
|
||||
$o .= HTMLHelper::_('form.token'). "\n";
|
||||
return $o;
|
||||
}
|
||||
|
||||
public function groupHeader($form, $formArray , $image = '', $formArraySuffix = array(), $realSuffix = 0) {
|
||||
|
||||
$md = 6;
|
||||
$columns = 12;
|
||||
$count = count($formArray);
|
||||
|
||||
if ($image != '') {
|
||||
$mdImage = 2;
|
||||
$columns = 10;
|
||||
}
|
||||
|
||||
$md = round(($columns/(int)$count), 0);
|
||||
$md = $md == 0 ? 1 : $md;
|
||||
|
||||
|
||||
$o = '';
|
||||
|
||||
$o .= '<div class="row title-alias form-vertical mb-3">';
|
||||
|
||||
if (!empty($formArray)) {
|
||||
|
||||
foreach ($formArray as $k => $v) {
|
||||
|
||||
|
||||
// Suffix below input
|
||||
if (isset($formArraySuffix[$k]) && $formArraySuffix[$k] != '' && $formArraySuffix[$k] != '<small>()</small>') {
|
||||
if ($realSuffix) {
|
||||
$value = $form->getInput($v) .' '. $formArraySuffix[$k];
|
||||
} else {
|
||||
$value = $formArraySuffix[$k];
|
||||
}
|
||||
} else {
|
||||
$value = $form->getInput($v);
|
||||
}
|
||||
|
||||
|
||||
$o .= '<div class="col-12 col-md-'.(int)$md.'">';
|
||||
|
||||
$o .= '<div class="control-group ph-par-'.$v.'">'."\n"
|
||||
. '<div class="control-label">'. $form->getLabel($v) . '</div>'."\n"
|
||||
. '<div class="clearfix"></div>'. "\n"
|
||||
. '<div>' . $value. '</div>'."\n"
|
||||
. '<div class="clearfix"></div>' . "\n"
|
||||
. '</div>'. "\n";
|
||||
|
||||
$o .= '</div>';
|
||||
}
|
||||
}
|
||||
|
||||
if ($image != '') {
|
||||
|
||||
$o .= '<div class="col-12 col-md-'.(int)$mdImage.'">';
|
||||
$o .= '<div class="ph-admin-additional-box-img-box">'.$image.'</div>';
|
||||
$o .= '</div>';
|
||||
|
||||
}
|
||||
|
||||
|
||||
$o .= '</div>';
|
||||
|
||||
|
||||
|
||||
return $o;
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function group($form, $formArray, $clear = 0) {
|
||||
|
||||
$wa = Factory::getApplication()->getDocument()->getWebAssetManager();
|
||||
|
||||
$o = '';
|
||||
if (!empty($formArray)) {
|
||||
if ($clear == 1) {
|
||||
foreach ($formArray as $value) {
|
||||
|
||||
$description = Text::_($form->getFieldAttribute($value, 'description'));
|
||||
$descriptionOutput = '';
|
||||
if ($description != '') {
|
||||
$descriptionOutput = '<div role="tooltip">'.$description.'</div>';
|
||||
}
|
||||
|
||||
$datashowon = '';
|
||||
$showon = $form->getFieldAttribute($value, 'showon');
|
||||
$group = $form->getFieldAttribute($value, 'group');
|
||||
$formControl = $form->getFormControl();
|
||||
if($showon) {
|
||||
$wa->useScript('showon');
|
||||
$datashowon = ' data-showon=\'' . json_encode(FormHelper::parseShowOnConditions($showon, $formControl,$group)) . '\'';
|
||||
}
|
||||
|
||||
$o .=
|
||||
|
||||
'<div class="control-group-clear ph-par-'.$value.'" '.$datashowon.'>'."\n"
|
||||
.'<div class="control-label">'. $form->getLabel($value) . $descriptionOutput . '</div>'."\n"
|
||||
//. '<div class="clearfix"></div>'. "\n"
|
||||
. '<div>' . $form->getInput($value). '</div>'."\n"
|
||||
. '<div class="clearfix"></div>' . "\n"
|
||||
. '</div>'. "\n";
|
||||
|
||||
}
|
||||
} else {
|
||||
foreach ($formArray as $value) {
|
||||
|
||||
$description = Text::_($form->getFieldAttribute($value, 'description'));
|
||||
$descriptionOutput = '';
|
||||
if ($description != '') {
|
||||
$descriptionOutput = '<div role="tooltip">'.$description.'</div>';
|
||||
}
|
||||
|
||||
$datashowon = '';
|
||||
$showon = $form->getFieldAttribute($value, 'showon');
|
||||
$group = $form->getFieldAttribute($value, 'group');
|
||||
$formControl = $form->getFormControl();
|
||||
if($showon) {
|
||||
$wa->useScript('showon');
|
||||
$datashowon = ' data-showon=\'' . json_encode(FormHelper::parseShowOnConditions($showon, $formControl,$group)) . '\'';
|
||||
}
|
||||
|
||||
//$o .= $form->renderField($value) ;
|
||||
$o .= '<div class="control-group ph-par-'.$value.'" '.$datashowon.'>'."\n"
|
||||
. '<div class="control-label">'. $form->getLabel($value) . $descriptionOutput . '</div>'
|
||||
. '<div class="controls">' . $form->getInput($value). '</div>'."\n"
|
||||
. '</div>' . "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
return $o;
|
||||
}
|
||||
|
||||
public function item($form, $item, $suffix = '', $realSuffix = 0) {
|
||||
|
||||
$wa = Factory::getApplication()->getDocument()->getWebAssetManager();
|
||||
|
||||
$value = $o = '';
|
||||
if ($suffix != '' && $suffix != '<small>()</small>') {
|
||||
if ($realSuffix) {
|
||||
$value = $form->getInput($item) .' '. $suffix;
|
||||
} else {
|
||||
$value = $suffix;
|
||||
}
|
||||
} else {
|
||||
$value = $form->getInput($item);
|
||||
|
||||
}
|
||||
|
||||
|
||||
$description = Text::_($form->getFieldAttribute($item, 'description'));
|
||||
$descriptionOutput = '';
|
||||
if ($description != '') {
|
||||
$descriptionOutput = '<div role="tooltip">'.$description.'</div>';
|
||||
}
|
||||
|
||||
$datashowon = '';
|
||||
$showon = $form->getFieldAttribute($item, 'showon');
|
||||
$group = $form->getFieldAttribute($item, 'group');
|
||||
$formControl = $form->getFormControl();
|
||||
if($showon) {
|
||||
$wa->useScript('showon');
|
||||
$datashowon = ' data-showon=\'' . json_encode(FormHelper::parseShowOnConditions($showon, $formControl,$group)) . '\'';
|
||||
}
|
||||
|
||||
|
||||
$o .= '<div class="control-group ph-par-'.$item.'" '.$datashowon.'>'."\n";
|
||||
$o .= '<div class="control-label">'. $form->getLabel($item) . $descriptionOutput . '</div>'."\n"
|
||||
. '<div class="controls">' . $value.'</div>'."\n"
|
||||
. '</div>' . "\n";
|
||||
return $o;
|
||||
}
|
||||
|
||||
public function itemLabel($item, $label, $description = '', $name = '') {
|
||||
|
||||
|
||||
$description = Text::_($description);
|
||||
$descriptionOutput = '';
|
||||
if ($description != '') {
|
||||
$descriptionOutput = '<div role="tooltip">'.$description.'</div>';
|
||||
}
|
||||
|
||||
$o = '';
|
||||
$o .= '<div class="control-group ph-par-'.$name.'">'."\n";
|
||||
$o .= '<div class="control-label"><label>'. $label .'</label>'. $descriptionOutput . '</div>'."\n"
|
||||
. '<div class="controls">' . $item.'</div>'."\n"
|
||||
. '</div>' . "\n";
|
||||
return $o;
|
||||
}
|
||||
|
||||
public function itemText($item, $label, $class = '', $name = '') {
|
||||
|
||||
|
||||
$o = '';
|
||||
$o .= '<div class="control-group ph-par-ph-text-'.$name.' ph-control-group-text">'."\n";
|
||||
$o .= '<div class="control-label"><label>'. $label . '</label></div>'."\n"
|
||||
. '<div class="controls '.$class.'">' . $item.'</div>'."\n"
|
||||
. '</div>' . "\n";
|
||||
return $o;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static function getCalendarDate($dateCustom) {
|
||||
|
||||
$config = Factory::getConfig();
|
||||
$user = Factory::getUser();
|
||||
$filter = 'USER_UTC';//'SERVER_UTC'
|
||||
|
||||
switch (strtoupper($filter)){
|
||||
case 'SERVER_UTC':
|
||||
if ($dateCustom && $dateCustom != Factory::getDbo()->getNullDate()) {
|
||||
$date = Factory::getDate($dateCustom, 'UTC');
|
||||
$date->setTimezone(new \DateTimeZone($config->get('offset')));
|
||||
$dateCustom = $date->format('Y-m-d H:i:s', true, false);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'USER_UTC':
|
||||
if ($dateCustom && $dateCustom != Factory::getDbo()->getNullDate()) {
|
||||
$date = Factory::getDate($dateCustom, 'UTC');
|
||||
$date->setTimezone(new \DateTimeZone($user->getParam('timezone', $config->get('offset'))));
|
||||
$dateCustom = $date->format('Y-m-d H:i:s', true, false);
|
||||
}
|
||||
break;
|
||||
}
|
||||
return $dateCustom;
|
||||
}
|
||||
|
||||
/* CP */
|
||||
public function quickIconButton( $link, $text = '', $icon = '', $color = '', $item = '') {
|
||||
|
||||
$o = '<div class="ph-cp-item '.$item.'-item-box">';
|
||||
$o .= ' <div class="ph-cp-item-icon">';
|
||||
$o .= ' <a class="ph-cp-item-icon-link" href="'.$link.'"><span style="background-color: '.$color.'20;"><i style="color: '.$color.';" class="phi '.$icon.' ph-cp-item-icon-link-large"></i></span></a>';
|
||||
$o .= ' </div>';
|
||||
|
||||
$o .= ' <div class="ph-cp-item-title"><a class="ph-cp-item-title-link" href="'.$link.'"><span>'.$text.'</span></a></div>';
|
||||
$o .= '</div>';
|
||||
|
||||
return $o;
|
||||
}
|
||||
|
||||
|
||||
public function getLinks($internalLinksOnly = 0) {
|
||||
|
||||
|
||||
$links = array();
|
||||
switch ($this->option) {
|
||||
|
||||
case 'com_phocacart':
|
||||
$links[] = array('Phoca Cart site', 'https://www.phoca.cz/phocacart');
|
||||
$links[] = array('Phoca Cart documentation site', 'https://www.phoca.cz/documentation/category/116-phoca-cart-component');
|
||||
$links[] = array('Phoca Cart download site', 'https://www.phoca.cz/download/category/100-phoca-cart-component');
|
||||
$links[] = array('Phoca Cart extensions', 'https://www.phoca.cz/phocacart-extensions');
|
||||
break;
|
||||
|
||||
case 'com_phocamenu':
|
||||
$links[] = array('Phoca Restaurant Menu site', 'https://www.phoca.cz/phocamenu');
|
||||
$links[] = array('Phoca Restaurant Menu documentation site', 'https://www.phoca.cz/documentation/category/52-phoca-restaurant-menu-component');
|
||||
$links[] = array('Phoca Restaurant Menu download site', 'https://www.phoca.cz/download/category/36-phoca-restaurant-menu-component');
|
||||
break;
|
||||
|
||||
case 'com_phocagallery':
|
||||
$links[] = array('Phoca Gallery site', 'https://www.phoca.cz/phocagallery');
|
||||
$links[] = array('Phoca Gallery documentation site', 'https://www.phoca.cz/documentation/category/2-phoca-gallery-component');
|
||||
$links[] = array('Phoca Gallery download site', 'https://www.phoca.cz/download/category/66-phoca-gallery');
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
$links[] = array('Phoca News', 'https://www.phoca.cz/news');
|
||||
$links[] = array('Phoca Forum', 'https://www.phoca.cz/forum');
|
||||
|
||||
if ($internalLinksOnly == 1) {
|
||||
return $links;
|
||||
}
|
||||
|
||||
$components = array();
|
||||
$components[] = array('Phoca Gallery','phocagallery', 'pg');
|
||||
$components[] = array('Phoca Guestbook','phocaguestbook', 'pgb');
|
||||
$components[] = array('Phoca Download','phocadownload', 'pd');
|
||||
$components[] = array('Phoca Documentation','phocadocumentation', 'pdc');
|
||||
$components[] = array('Phoca Favicon','phocafavicon', 'pfv');
|
||||
$components[] = array('Phoca SEF','phocasef', 'psef');
|
||||
$components[] = array('Phoca PDF','phocapdf', 'ppdf');
|
||||
$components[] = array('Phoca Restaurant Menu','phocamenu', 'prm');
|
||||
$components[] = array('Phoca Maps','phocamaps', 'pm');
|
||||
$components[] = array('Phoca Font','phocafont', 'pf');
|
||||
$components[] = array('Phoca Email','phocaemail', 'pe');
|
||||
$components[] = array('Phoca Install','phocainstall', 'pi');
|
||||
$components[] = array('Phoca Template','phocatemplate', 'pt');
|
||||
$components[] = array('Phoca Panorama','phocapanorama', 'pp');
|
||||
$components[] = array('Phoca Commander','phocacommander', 'pcm');
|
||||
$components[] = array('Phoca Photo','phocaphoto', 'ph');
|
||||
$components[] = array('Phoca Cart','phocacart', 'pc');
|
||||
|
||||
$banners = array();
|
||||
$banners[] = array('Phoca Restaurant Menu','phocamenu', 'prm');
|
||||
$banners[] = array('Phoca Cart','phocacart', 'pc');
|
||||
|
||||
$o = '';
|
||||
$o .= '<p> </p>';
|
||||
$o .= '<h4 style="margin-bottom:5px;">'.Text::_($this->optionLang.'_USEFUL_LINKS'). '</h4>';
|
||||
$o .= '<ul>';
|
||||
foreach ($links as $k => $v) {
|
||||
$o .= '<li><a style="text-decoration:underline" href="'.$v[1].'" target="_blank">'.$v[0].'</a></li>';
|
||||
}
|
||||
$o .= '</ul>';
|
||||
|
||||
$o .= '<div>';
|
||||
$o .= '<p> </p>';
|
||||
$o .= '<h4 style="margin-bottom:5px;">'.Text::_($this->optionLang.'_USEFUL_TIPS'). '</h4>';
|
||||
|
||||
$m = mt_rand(0, 10);
|
||||
if ((int)$m > 0) {
|
||||
$o .= '<div>';
|
||||
$num = range(0,(count($components) - 1 ));
|
||||
shuffle($num);
|
||||
for ($i = 0; $i<3; $i++) {
|
||||
$numO = $num[$i];
|
||||
$o .= '<div style="float:left;width:33%;margin:0 auto;">';
|
||||
$o .= '<div><a style="text-decoration:underline;" href="https://www.phoca.cz/'.$components[$numO][1].'" target="_blank">'.HTMLHelper::_('image', 'media/'.$this->option.'/images/administrator/icon-box-'.$components[$numO][2].'.png', ''). '</a></div>';
|
||||
$o .= '<div style="margin-top:-10px;"><small><a style="text-decoration:underline;" href="https://www.phoca.cz/'.$components[$numO][1].'" target="_blank">'.$components[$numO][0].'</a></small></div>';
|
||||
$o .= '</div>';
|
||||
}
|
||||
$o .= '<div style="clear:both"></div>';
|
||||
$o .= '</div>';
|
||||
} else {
|
||||
$num = range(0,(count($banners) - 1 ));
|
||||
shuffle($num);
|
||||
$numO = $num[0];
|
||||
$o .= '<div><a href="https://www.phoca.cz/'.$banners[$numO][1].'" target="_blank">'.HTMLHelper::_('image', 'media/'.$this->option.'/images/administrator/b-'.$banners[$numO][2].'.png', ''). '</a></div>';
|
||||
|
||||
}
|
||||
|
||||
$o .= '<p> </p>';
|
||||
$o .= '<h4 style="margin-bottom:5px;">'.Text::_($this->optionLang.'_PLEASE_READ'). '</h4>';
|
||||
$o .= '<div><a style="text-decoration:underline" href="https://www.phoca.cz/phoca-needs-your-help/" target="_blank">'.Text::_($this->optionLang.'_PHOCA_NEEDS_YOUR_HELP'). '</a></div>';
|
||||
|
||||
$o .= '</div>';
|
||||
return $o;
|
||||
}
|
||||
|
||||
|
||||
// TABS
|
||||
public function navigation($tabs, $activeTab = '') {
|
||||
|
||||
if ($this->compatible) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$o = '<ul class="nav nav-tabs">';
|
||||
$i = 0;
|
||||
foreach($tabs as $k => $v) {
|
||||
$cA = 0;
|
||||
if ($activeTab != '') {
|
||||
if ($activeTab == $k) {
|
||||
$cA = 'class="active"';
|
||||
}
|
||||
} else {
|
||||
if ($i == 0) {
|
||||
$cA = 'class="active"';
|
||||
}
|
||||
}
|
||||
$o .= '<li '.$cA.'><a href="#'.$k.'" data-bs-toggle="tab">'. $v.'</a></li>'."\n";
|
||||
$i++;
|
||||
}
|
||||
$o .= '</ul>';
|
||||
return $o;
|
||||
}
|
||||
|
||||
|
||||
public function startTabs($active = 'general') {
|
||||
if ($this->compatible) {
|
||||
return HTMLHelper::_('uitab.startTabSet', 'myTab', array('active' => $active));
|
||||
} else {
|
||||
return '<div id="phAdminEditTabs" class="tab-content">'. "\n";
|
||||
}
|
||||
}
|
||||
|
||||
public function endTabs() {
|
||||
if ($this->compatible) {
|
||||
return HTMLHelper::_('uitab.endTabSet');
|
||||
} else {
|
||||
return '</div>';
|
||||
}
|
||||
}
|
||||
|
||||
public function startTab($id, $name, $active = '') {
|
||||
if ($this->compatible) {
|
||||
return HTMLHelper::_('uitab.addTab', 'myTab', $id, $name);
|
||||
} else {
|
||||
return '<div class="tab-pane '.$active.'" id="'.$id.'">'."\n";
|
||||
}
|
||||
}
|
||||
|
||||
public function endTab() {
|
||||
if ($this->compatible) {
|
||||
return HTMLHelper::_('uitab.endTab');
|
||||
} else {
|
||||
return '</div>';
|
||||
}
|
||||
}
|
||||
|
||||
public function itemCalc($id, $name, $value, $form = 'pform', $size = 1, $class = '') {
|
||||
|
||||
switch ($size){
|
||||
case 3: $class = 'form-control input-xxlarge'. ' ' . $class;
|
||||
break;
|
||||
case 2: $class = 'form-control input-xlarge'. ' ' . $class;
|
||||
break;
|
||||
case 0: $class = 'form-control input-mini'. ' ' . $class;
|
||||
break;
|
||||
default: $class= 'form-control input-small'. ' ' . $class;
|
||||
break;
|
||||
}
|
||||
$o = '';
|
||||
$o .= '<input type="text" name="'.$form.'['.(int)$id.']['.htmlspecialchars($name, ENT_QUOTES, 'UTF-8').']" id="'.$form.'_'.(int)$id.'_'.htmlspecialchars($name, ENT_QUOTES, 'UTF-8').'" value="'.htmlspecialchars($value, ENT_QUOTES, 'UTF-8').'" class="'.htmlspecialchars($class, ENT_QUOTES, 'UTF-8').'" />';
|
||||
|
||||
return $o;
|
||||
}
|
||||
|
||||
public function itemCalcCheckbox($id, $name, $value, $form = 'pform' ) {
|
||||
|
||||
$checked = '';
|
||||
if ($value == 1) {
|
||||
$checked = 'checked="checked"';
|
||||
}
|
||||
$o = '';
|
||||
$o .= '<input type="checkbox" name="'.$form.'['.(int)$id.']['.htmlspecialchars($name, ENT_QUOTES, 'UTF-8').']" id="'.$form.'_'.(int)$id.'_'.htmlspecialchars($name, ENT_QUOTES, 'UTF-8').'" '.$checked.' />';
|
||||
|
||||
return $o;
|
||||
}
|
||||
}
|
||||
?>
|
||||
@ -0,0 +1,522 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Phoca Cart
|
||||
* @author Jan Pavelka - https://www.phoca.cz
|
||||
* @copyright Copyright (C) Jan Pavelka https://www.phoca.cz
|
||||
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 and later
|
||||
* @cms Joomla
|
||||
* @copyright Copyright (C) Open Source Matters. All rights reserved.
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
|
||||
*/
|
||||
|
||||
namespace Phoca\Render;
|
||||
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
use Joomla\CMS\HTML\HTMLHelper;
|
||||
|
||||
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\HTML\Helpers\Sidebar;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Layout\FileLayout;
|
||||
use Joomla\CMS\Router\Route;
|
||||
use Joomla\CMS\Session\Session;
|
||||
use Joomla\CMS\Version;
|
||||
|
||||
|
||||
class Adminviews
|
||||
{
|
||||
public $view = '';
|
||||
public $viewtype = 1;
|
||||
public $option = '';
|
||||
public $optionLang = '';
|
||||
public $tmpl = '';
|
||||
public $compatible = false;
|
||||
public $sidebar = true;
|
||||
protected $document = false;
|
||||
|
||||
public function __construct() {
|
||||
|
||||
$app = Factory::getApplication();
|
||||
$version = new Version();
|
||||
$this->compatible = $version->isCompatible('4.0.0-alpha');
|
||||
$this->view = $app->input->get('view');
|
||||
$this->option = $app->input->get('option');
|
||||
$this->optionLang = strtoupper($this->option);
|
||||
$this->tmpl = $app->input->get('tmpl');
|
||||
$this->sidebar = Factory::getApplication()->getTemplate(true)->params->get('menu', 1) ? true : false;
|
||||
$this->document = Factory::getDocument();
|
||||
$wa = $app->getDocument()->getWebAssetManager();
|
||||
|
||||
HTMLHelper::_('bootstrap.tooltip');
|
||||
HTMLHelper::_('behavior.multiselect');
|
||||
HTMLHelper::_('dropdown.init');
|
||||
HTMLHelper::_('jquery.framework', false);
|
||||
|
||||
$wa->registerAndUseStyle($this->option . '.font', 'media/' . $this->option . '/duotone/joomla-fonts.css', array('version' => 'auto'));
|
||||
$wa->registerAndUseStyle($this->option . '.main', 'media/' .$this->option . '/css/administrator/'.str_replace('com_', '', $this->option).'.css', array('version' => 'auto'));
|
||||
$wa->registerAndUseStyle($this->option . '.version', 'media/' .$this->option . '/css/administrator/4.css', array('version' => 'auto'));
|
||||
$wa->registerAndUseStyle($this->option . '.theme', 'media/' .$this->option . '/css/administrator/theme-dark.css', array('version' => 'auto'), [], ['template.active']);
|
||||
|
||||
// Modal
|
||||
if ($this->tmpl == 'component') {
|
||||
HTMLHelper::_('behavior.core');
|
||||
HTMLHelper::_('behavior.polyfill', array('event'), 'lt IE 9');
|
||||
//HTMLHelper::_('script', 'media/' . $this->option . '/js/administrator/admin-phocaitems-modal.min.js', array('version' => 'auto', 'relative' => true));
|
||||
HTMLHelper::_('bootstrap.tooltip', '.hasTooltip', array('placement' => 'bottom'));
|
||||
HTMLHelper::_('bootstrap.popover', '.hasPopover', array('placement' => 'bottom'));
|
||||
}
|
||||
}
|
||||
|
||||
public function startHeader() {
|
||||
|
||||
$layoutSVG = new FileLayout('svg_definitions', null, array('component' => $this->option));
|
||||
//return $layoutSVG->render(array());
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function startMainContainer($id = 'phAdminView', $class = 'ph-admin-box') {
|
||||
|
||||
$o = array();
|
||||
|
||||
if ($this->compatible) {
|
||||
|
||||
// Joomla! 4
|
||||
|
||||
$o[] = '<div class="row">';
|
||||
if ($this->sidebar) {
|
||||
|
||||
$o[] = '<div id="j-main-container" class="col-md-12">';
|
||||
} else {
|
||||
|
||||
$o[] = '<div id="j-sidebar-container" class="col-md-2">' . Sidebar::render() . '</div>';
|
||||
$o[] = '<div id="j-main-container" class="col-md-10">';
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
$o[] = '<div id="j-sidebar-container" class="span2">' . Sidebar::render() . '</div>';
|
||||
$o[] = '<div id="j-main-container" class="span10">';
|
||||
}
|
||||
|
||||
return implode("\n", $o);
|
||||
}
|
||||
|
||||
public function endMainContainer() {
|
||||
$o = array();
|
||||
|
||||
$o[] = '</div>';
|
||||
if ($this->compatible) {
|
||||
$o[] = '</div>';
|
||||
}
|
||||
return implode("\n", $o);
|
||||
}
|
||||
|
||||
public function jsJorderTable($listOrder) {
|
||||
|
||||
$js = 'Joomla.orderTable = function() {' . "\n"
|
||||
. ' table = document.getElementById("sortTable");' . "\n"
|
||||
. ' direction = document.getElementById("directionTable");' . "\n"
|
||||
. ' order = table.options[table.selectedIndex].value;' . "\n"
|
||||
. ' if (order != \'' . $listOrder . '\') {' . "\n"
|
||||
. ' dirn = \'asc\';' . "\n"
|
||||
. ' } else {' . "\n"
|
||||
. ' dirn = direction.options[direction.selectedIndex].value;' . "\n"
|
||||
. ' }' . "\n"
|
||||
. ' Joomla.tableOrdering(order, dirn, \'\');' . "\n"
|
||||
. '}' . "\n";
|
||||
Factory::getDocument()->addScriptDeclaration($js);
|
||||
}
|
||||
|
||||
public function startForm($option, $view, $id = 'adminForm', $name = 'adminForm') {
|
||||
|
||||
// CSS based on user groups
|
||||
$user = Factory::getUser();
|
||||
$groupClass = '';
|
||||
if (!empty($user->groups)) {
|
||||
foreach ($user->groups as $k => $v) {
|
||||
$groupClass .= ' group-'. $v;
|
||||
}
|
||||
}
|
||||
|
||||
return '<div id="' . $view . '" class="'.$groupClass.'"><form action="' . Route::_('index.php?option=' . $option . '&view=' . $view) . '" method="post" name="' . $name . '" id="' . $id . '">' . "\n" . '';
|
||||
}
|
||||
|
||||
public function startFormModal($option, $view, $id = 'adminForm', $name = 'adminForm', $function = '') {
|
||||
|
||||
// CSS based on user groups
|
||||
$user = Factory::getUser();
|
||||
$groupClass = '';
|
||||
if (!empty($user->groups)) {
|
||||
foreach ($user->groups as $k => $v) {
|
||||
$groupClass .= ' group-'. $v;
|
||||
}
|
||||
}
|
||||
|
||||
return '<div id="' . $view . '" class="'.$groupClass.'"><form action="' . Route::_('index.php?option=' . $option . '&view=' . $view . '&layout=modal&tmpl=component&function=' . $function . '&' . Session::getFormToken() . '=1') . '" method="post" name="' . $name . '" id="' . $id . '">' . "\n" . '';
|
||||
}
|
||||
|
||||
public function endForm() {
|
||||
return '</form>' . "\n" . '' . "\n" . $this->ajaxTopHtml();
|
||||
}
|
||||
|
||||
public function ajaxTopHtml($text = '') {
|
||||
$o = '<div id="ph-ajaxtop">';
|
||||
if ($text != '') {
|
||||
$o .= '<div id="ph-ajaxtop-message"><div class="ph-loader-top"></div> ' . strip_tags(addslashes($text)) . '</div>';
|
||||
}
|
||||
$o .= '</div>';
|
||||
return $o;
|
||||
}
|
||||
|
||||
/* Modal */
|
||||
public function startMainContainerNoSubmenu() {
|
||||
//return '<div id="j-main-container" class="col-xs-12 col-sm-10 col-md-10">'. "\n";
|
||||
$o = '<div id="j-main-container" class="col-xs-12 col-sm-12 col-md-12 ph-admin-box-content ph-admin-manage">' . "\n";
|
||||
$o .= '<div id="ph-system-message-container"></div>' . "\n";// specific container for moving messages from joomla to phoca
|
||||
//$this->moveSystemMessageFromJoomlaToPhoca();
|
||||
return $o;
|
||||
}
|
||||
|
||||
public function moveSystemMessageFromJoomlaToPhoca() {
|
||||
|
||||
$s = array();
|
||||
//$s[] = 'document.getElementById("system-message-container").style.display = "none";';
|
||||
$s[] = 'jQuery(document).ready(function() {';
|
||||
//$s[] = ' jQuery("#system-message-container").removeClass("j-toggle-main");';
|
||||
$s[] = ' jQuery("#system-message-container").css("display", "none");';
|
||||
$s[] = ' var phSystemMsg = jQuery("#system-message-container").html();';
|
||||
$s[] = ' jQuery("#ph-system-message-container").html(phSystemMsg);';
|
||||
$s[] = '});';
|
||||
Factory::getDocument()->addScriptDeclaration(implode("\n", $s));
|
||||
}
|
||||
|
||||
public function startTable($id, $class = '') {
|
||||
return '<table class="table table-striped '.$class.'" id="' . $id . '">' . "\n";
|
||||
}
|
||||
|
||||
public function endTable() {
|
||||
return '</table>' . "\n";
|
||||
}
|
||||
|
||||
public function tblFoot($listFooter, $columns) {
|
||||
return '<tfoot>' . "\n" . '<tr><td colspan="' . (int)$columns . '">' . $listFooter . '</td></tr>' . "\n" . '</tfoot>' . "\n";
|
||||
}
|
||||
|
||||
public function startTblHeader() {
|
||||
return '<thead>' . "\n" . '<tr>' . "\n";
|
||||
}
|
||||
|
||||
public function endTblHeader() {
|
||||
return '</tr>' . "\n" . '</thead>' . "\n";
|
||||
}
|
||||
|
||||
public function thOrderingXML($txtHo, $listDirn, $listOrder, $prefix = 'a', $empty = false) {
|
||||
|
||||
if ($empty) {
|
||||
return '<th class="nowrap center ph-ordering"></th>' . "\n";
|
||||
}
|
||||
|
||||
return '<th class="nowrap center ph-ordering">' . "\n"
|
||||
. HTMLHelper::_('searchtools.sort', '', strip_tags($prefix) . '.ordering', $listDirn, $listOrder, null, 'asc', $txtHo, 'icon-menu-2') . "\n"
|
||||
. '</th>';
|
||||
//HTMLHelper::_('searchtools.sort', $this->t['l'].'_IN_STOCK', 'a.stock', $listDirn, $listOrder ).'</th>'."\n";
|
||||
|
||||
}
|
||||
|
||||
public function thCheck($txtCh) {
|
||||
return '<th class=" ph-check">' . "\n"
|
||||
. '<input type="checkbox" name="checkall-toggle" value="" title="' . Text::_($txtCh) . '" onclick="Joomla.checkAll(this)" />' . "\n"
|
||||
. '</th>' . "\n";
|
||||
}
|
||||
|
||||
public function tdOrder($canChange, $saveOrder, $orderkey, $ordering = 0, $catOrderingEnabled = true) {
|
||||
|
||||
$o = '<td class="order nowrap center ">' . "\n";
|
||||
if ($canChange) {
|
||||
$disableClassName = '';
|
||||
$disabledLabel = '';
|
||||
if (!$saveOrder) {
|
||||
$disabledLabel = Text::_('JORDERINGDISABLED');
|
||||
$disableClassName = 'inactive tip-top';
|
||||
}
|
||||
if (!$catOrderingEnabled && !$saveOrder) {
|
||||
//$disableClassName = 'inactive tip-top';
|
||||
$disabledLabel = Text::_($this->optionLang . '_SELECT_CATEGORY_TO_ORDER_ITEMS');
|
||||
}
|
||||
$o .= '<span class="sortable-handler hasTooltip ' . $disableClassName . '" title="' . $disabledLabel . '"><i class="icon-menu"></i></span>' . "\n";
|
||||
} else {
|
||||
$o .= '<span class="sortable-handler inactive"><i class="icon-menu"></i></span>' . "\n";
|
||||
}
|
||||
$orderkeyPlus = $ordering; //$orderkey + 1;
|
||||
$o .= '<input type="text" style="display:none" name="order[]" size="5" value="' . $orderkeyPlus . '" />' . "\n"
|
||||
. '</td>' . "\n";
|
||||
return $o;
|
||||
}
|
||||
|
||||
public function tdRating($ratingAvg) {
|
||||
$o = '<td class="small ">';
|
||||
$voteAvg = round(((float)$ratingAvg / 0.5)) * 0.5;
|
||||
$voteAvgWidth = 16 * $voteAvg;
|
||||
$o .= '<ul class="star-rating-small">'
|
||||
. '<li class="current-rating" style="width:' . $voteAvgWidth . 'px"></li>'
|
||||
. '<li><span class="star1"></span></li>';
|
||||
|
||||
for ($ir = 2; $ir < 6; $ir++) {
|
||||
$o .= '<li><span class="stars' . $ir . '"></span></li>';
|
||||
}
|
||||
$o .= '</ul>';
|
||||
$o .= '</td>' . "\n";
|
||||
return $o;
|
||||
}
|
||||
|
||||
public function tdLanguage($lang, $langTitle, $langTitleE) {
|
||||
|
||||
$o = '<td class="small nowrap ">';
|
||||
if ($lang == '*') {
|
||||
$o .= Text::_('JALL');
|
||||
} else {
|
||||
if ($langTitle) {
|
||||
$o .= $langTitleE;
|
||||
} else {
|
||||
$o .= Text::_('JUNDEFINED');
|
||||
}
|
||||
}
|
||||
$o .= '</td>' . "\n";
|
||||
return $o;
|
||||
}
|
||||
|
||||
public function tdEip($id, $value, $params = array()) {
|
||||
|
||||
$classBox = isset($params['classbox']) ? $params['clasbox'] : 'small';
|
||||
$classEip = isset($params['classeip']) ? $params['classeip'] : 'ph-editinplace-text ph-eip-text ph-eip-price';
|
||||
|
||||
$o = array();
|
||||
$o[] = '<td class="' . $classBox . '">';
|
||||
$o[] = '<span class="' . $classEip . '" id="' . $id . '">' . $value . '</span>';
|
||||
$o[] = '</td>';
|
||||
|
||||
return implode("\n", $o);
|
||||
}
|
||||
|
||||
|
||||
public function formInputsXml($listOrder, $listDirn, $originalOrders) {
|
||||
|
||||
return '<input type="hidden" name="task" value="" />' . "\n"
|
||||
. '<input type="hidden" name="boxchecked" value="0" />' . "\n"
|
||||
//.'<input type="hidden" name="filter_order" value="'.$listOrder.'" />'. "\n"
|
||||
//.'<input type="hidden" name="filter_order_Dir" value="'.$listDirn.'" />'. "\n"
|
||||
. HTMLHelper::_('form.token') . "\n"
|
||||
. '<input type="hidden" name="original_order_values" value="' . implode(',', $originalOrders) . '" />' . "\n";
|
||||
}
|
||||
|
||||
public function td($value, $class = '', $tag = 'td') {
|
||||
|
||||
// th for columns which cannot be hidden (Joomla feature);
|
||||
if ($class != '') {
|
||||
return '<'.$tag.' class="' . $class . '">' . $value . '</'.$tag.'>' . "\n";
|
||||
} else {
|
||||
return '<'.$tag.'>' . $value . '</'.$tag.'>' . "\n";
|
||||
}
|
||||
}
|
||||
|
||||
public function tdPublishDownUp($publishUp, $publishDown, $class = '') {
|
||||
|
||||
$o = '';
|
||||
$db = Factory::getDBO();
|
||||
//$app = Factory::getApplication();
|
||||
$nullDate = $db->getNullDate();
|
||||
$now = Factory::getDate();
|
||||
$config = Factory::getConfig();
|
||||
$publish_up = Factory::getDate($publishUp);
|
||||
$publish_down = Factory::getDate($publishDown);
|
||||
$tz = new \DateTimeZone($config->get('offset'));
|
||||
$publish_up->setTimezone($tz);
|
||||
$publish_down->setTimezone($tz);
|
||||
|
||||
|
||||
if ($now->toUnix() <= ($publish_up->toUnix())) { // Possible $publish_up->toUnix() - 1 for lazy servers where e.g. when multiple add, pending is displayed instead of active, because it is faster then SQL date
|
||||
$text = Text::_($this->optionLang . '_PENDING');
|
||||
} else if (($now->toUnix() <= $publish_down->toUnix() || $publishDown == $nullDate)) {
|
||||
$text = Text::_($this->optionLang . '_ACTIVE');
|
||||
} else if ($now->toUnix() > $publish_down->toUnix()) {
|
||||
$text = Text::_($this->optionLang . '_EXPIRED');
|
||||
}
|
||||
|
||||
$times = '';
|
||||
if (isset($publishUp)) {
|
||||
if ($publishUp == $nullDate) {
|
||||
$times .= Text::_($this->optionLang . '_START') . ': ' . Text::_($this->optionLang . '_ALWAYS');
|
||||
} else {
|
||||
$times .= Text::_($this->optionLang . '_START') . ": " . $publish_up->format("D, d M Y H:i:s");
|
||||
}
|
||||
}
|
||||
if (isset($publishDown)) {
|
||||
if ($publishDown == $nullDate) {
|
||||
$times .= "<br />" . Text::_($this->optionLang . '_FINISH') . ': ' . Text::_($this->optionLang . '_NO_EXPIRY');
|
||||
} else {
|
||||
$times .= "<br />" . Text::_($this->optionLang . '_FINISH') . ": " . $publish_down->format("D, d M Y H:i:s");
|
||||
}
|
||||
}
|
||||
|
||||
if ($times) {
|
||||
$o .= '<td align="center" class="'.$class.'">'
|
||||
. '<span class="editlinktip hasTip" title="' . Text::_($this->optionLang . '_PUBLISH_INFORMATION') . '::' . $times . '">'
|
||||
. '<a href="javascript:void(0);" >' . $text . '</a></span>'
|
||||
. '</td>' . "\n";
|
||||
} else {
|
||||
$o .= '<td></td>' . "\n";
|
||||
}
|
||||
return $o;
|
||||
}
|
||||
|
||||
|
||||
public function saveOrder($t, $listDirn, $catid = 0) {
|
||||
|
||||
|
||||
|
||||
$saveOrderingUrl = 'index.php?option=' . $t['o'] . '&task=' . $t['tasks'] . '.saveOrderAjax&tmpl=component&' . Session::getFormToken() . '=1';
|
||||
|
||||
// Joomla BUG: https://github.com/joomla/joomla-cms/issues/36346 $this->t['catid']
|
||||
// Add catid to the URL instead of sending in POST
|
||||
// administrator/components/com_phocacart/views/phocacartitems/tmpl/default.php 37
|
||||
if ((int)$catid > 0) {
|
||||
$saveOrderingUrl .= '&catid='.(int)$catid;
|
||||
}
|
||||
// ---
|
||||
|
||||
if ($this->compatible) {
|
||||
HTMLHelper::_('draggablelist.draggable');
|
||||
} else {
|
||||
HTMLHelper::_('sortablelist.sortable', 'categoryList', 'adminForm', strtolower($listDirn), $saveOrderingUrl, false, true);
|
||||
}
|
||||
|
||||
return $saveOrderingUrl;
|
||||
}
|
||||
|
||||
public function firstColumnHeader($listDirn, $listOrder, $prefix = 'a', $empty = false) {
|
||||
if ($this->compatible) {
|
||||
return '<th class="w-1 text-center ph-check">' . HTMLHelper::_('grid.checkall') . '</td>';
|
||||
} else {
|
||||
return $this->thOrderingXML('JGRID_HEADING_ORDERING', $listDirn, $listOrder, $prefix, $empty);
|
||||
}
|
||||
}
|
||||
|
||||
public function secondColumnHeader($listDirn, $listOrder, $prefix = 'a', $empty = false) {
|
||||
if ($this->compatible) {
|
||||
return $this->thOrderingXML('JGRID_HEADING_ORDERING', $listDirn, $listOrder, $prefix, $empty);
|
||||
} else {
|
||||
return $this->thCheck('JGLOBAL_CHECK_ALL');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function startTblBody($saveOrder, $saveOrderingUrl, $listDirn) {
|
||||
|
||||
$o = array();
|
||||
|
||||
if ($this->compatible) {
|
||||
$o[] = '<tbody';
|
||||
if ($saveOrder) {
|
||||
$o[] = ' class="js-draggable" data-url="' . $saveOrderingUrl . '" data-direction="' . strtolower($listDirn) . '" data-nested="true"';
|
||||
}
|
||||
$o[] = '>';
|
||||
|
||||
} else {
|
||||
$o[] = '<tbody>' . "\n";
|
||||
}
|
||||
|
||||
return implode("", $o);
|
||||
}
|
||||
|
||||
public function endTblBody() {
|
||||
return '</tbody>' . "\n";
|
||||
}
|
||||
|
||||
public function startTr($i, $catid = 0, $id = 0, $level = -1, $parentsString = '', $class = '') {
|
||||
$i2 = $i % 2;
|
||||
|
||||
$dataItemId = '';
|
||||
if ($id > 0) {
|
||||
$dataItemId = ' data-item-id="'.(int)$id.'"';
|
||||
}
|
||||
$dataItemCatid = '';
|
||||
|
||||
if ($this->compatible) {
|
||||
$dataItemCatid = ' data-draggable-group="' . (int)$catid . '"';
|
||||
} else {
|
||||
$dataItemCatid = ' sortable-group-id="' . (int)$catid . '"';
|
||||
}
|
||||
|
||||
$dataParents = '';
|
||||
if ($parentsString != '') {
|
||||
$dataParents = ' data-parents="'.$parentsString.'"';
|
||||
} else if ($catid > 0) {
|
||||
$dataParents = ' data-parents="'.(int)$catid.'"';
|
||||
}
|
||||
|
||||
$dataLevel = '';
|
||||
if ($level > -1) {
|
||||
$dataLevel = ' data-parents="'.(int)$level.'"';
|
||||
}
|
||||
|
||||
|
||||
return '<tr for="cb'.$i.'" class="'.$class.'row' . $i2 . '"'.$dataItemId.$dataItemCatid.$dataParents.$dataLevel.' data-transitions>' . "\n";
|
||||
|
||||
}
|
||||
|
||||
public function endTr() {
|
||||
return '</tr>' . "\n";
|
||||
}
|
||||
|
||||
public function createIndentation($level) {
|
||||
|
||||
if ((int)$level > 1) {
|
||||
$intendetation = str_repeat('- ', ((int)$level - 1));
|
||||
return '<div class="ph-intendation">'.$intendetation.'</div>';
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
public function firstColumn($i, $itemId, $canChange, $saveOrder, $orderkey, $ordering, $saveOrderCatSelected = true) {
|
||||
if ($this->compatible) {
|
||||
return $this->td(HTMLHelper::_('grid.id', $i, $itemId), 'text-center ph-select-row');
|
||||
} else {
|
||||
return $this->tdOrder($canChange, $saveOrder, $orderkey, $ordering, $saveOrderCatSelected);
|
||||
}
|
||||
}
|
||||
|
||||
public function secondColumn($i, $itemId, $canChange, $saveOrder, $orderkey, $ordering, $saveOrderCatSelected = true, $catid = 0) {
|
||||
|
||||
if ($this->compatible) {
|
||||
|
||||
$o = array();
|
||||
$o[] = '<td class="text-center d-none d-md-table-cell">';
|
||||
|
||||
$iconClass = '';
|
||||
if (!$canChange) {
|
||||
$iconClass = ' inactive';
|
||||
} else if (!$saveOrderCatSelected) {
|
||||
$iconClass = ' inactive" title="' . Text::_($this->optionLang . '_SELECT_CATEGORY_TO_ORDER_ITEMS');
|
||||
} else if (!$saveOrder) {
|
||||
$iconClass = ' inactive" title="' . Text::_('JORDERINGDISABLED');
|
||||
}
|
||||
|
||||
$o[] = '<span class="sortable-handler' . $iconClass . '"><span class="fas fa-ellipsis-v" aria-hidden="true"></span></span>';
|
||||
|
||||
if ($canChange && $saveOrder) {
|
||||
$o[] = '<input type="text" name="order[]" size="5" value="' . $ordering . '" class="width-20 text-area-order hidden">';
|
||||
|
||||
}
|
||||
|
||||
$o[] = '</td>';
|
||||
|
||||
return implode("", $o);
|
||||
|
||||
} else {
|
||||
return $this->td(HTMLHelper::_('grid.id', $i, $itemId), "small ");
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/**
|
||||
* Users who do not have 'composer' to manage dependencies, include this
|
||||
* file to provide auto-loading of the classes in this library.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
spl_autoload_register ( function ($class) {
|
||||
/*
|
||||
* PSR-4 autoloader, based on PHP Framework Interop Group snippet (Under MIT License.)
|
||||
* https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-4-autoloader-examples.md
|
||||
*/
|
||||
$prefix = "Phoca\\";
|
||||
$base_dir = __DIR__ . "/";
|
||||
|
||||
|
||||
/* Only continue for classes in this namespace */
|
||||
$len = strlen ( $prefix );
|
||||
if (strncmp ( $prefix, $class, $len ) !== 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* Require the file if it exists */
|
||||
//$relative_class = substr ( $class, $len );
|
||||
//$relative_class = str_replace('Joomla/CMS/' . $class);
|
||||
$relative_class = $class;
|
||||
|
||||
$file = $base_dir . str_replace ( '\\', '/', $relative_class ) . '.php';
|
||||
|
||||
|
||||
if (file_exists ( $file )) {
|
||||
|
||||
require $file;
|
||||
}
|
||||
} );
|
||||
@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
@ -0,0 +1,86 @@
|
||||
<?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;
|
||||
|
||||
|
||||
spl_autoload_register(array('JLoader','load'));
|
||||
|
||||
class PhocaGalleryLoader extends JLoader
|
||||
{
|
||||
private static $paths = array();
|
||||
protected static $classes = array();
|
||||
|
||||
public static function import($filePath, $base = null, $key = 'libraries.') {
|
||||
|
||||
|
||||
|
||||
$keyPath = $key ? $key . $filePath : $filePath;
|
||||
|
||||
if (!isset($paths[$keyPath])) {
|
||||
if ( !$base ) {
|
||||
$base = JPATH_ADMINISTRATOR.'/components/com_phocagallery/libraries';
|
||||
}
|
||||
|
||||
$parts = explode( '.', $filePath );
|
||||
|
||||
$className = array_pop( $parts );
|
||||
|
||||
|
||||
switch($className) {
|
||||
case 'helper' :
|
||||
$className = ucfirst((string)array_pop( $parts )).ucfirst((string)$className);
|
||||
break;
|
||||
|
||||
default :
|
||||
$className = ucfirst((string)$className);
|
||||
break;
|
||||
}
|
||||
|
||||
$path = str_replace( '.', '/', $filePath );
|
||||
|
||||
if (strpos($filePath, 'phocagallery') === 0) {
|
||||
$className = 'PhocaGallery'.$className;
|
||||
$classes = JLoader::register($className, $base. '/'. $path.'.php');
|
||||
|
||||
$rs = isset($classes[strtolower($className)]);
|
||||
|
||||
|
||||
} else {
|
||||
// If it is not in the joomla namespace then we have no idea if
|
||||
// it uses our pattern for class names/files so just include
|
||||
// if the file exists or set it to false if not
|
||||
|
||||
$filename = $base. '/'. $path.'.php';
|
||||
|
||||
if (is_file($filename)) {
|
||||
$rs = (bool) include $filename;
|
||||
} else {
|
||||
// if the file doesn't exist fail
|
||||
$rs = false;
|
||||
|
||||
// note: JLoader::register does an is_file check itself so we don't need it above, we do it here because we
|
||||
// try to load the file directly and it may not exist which could cause php to throw up nasty warning messages
|
||||
// at us so we set it to false here and hope that if the programmer is good enough they'll check the return value
|
||||
// instead of hoping it'll work. remmeber include only fires a warning, so $rs was going to be false with a nasty
|
||||
// warning message
|
||||
}
|
||||
}
|
||||
|
||||
PhocaGalleryLoader::$paths[$keyPath] = $rs;
|
||||
}
|
||||
|
||||
return PhocaGalleryLoader::$paths[$keyPath];
|
||||
}
|
||||
}
|
||||
|
||||
function phocagalleryimport($path) {
|
||||
return PhocaGalleryLoader::import($path);
|
||||
}
|
||||
@ -0,0 +1,407 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Phoca Gallery
|
||||
* @author Jan Pavelka - https://www.phoca.cz
|
||||
* @copyright Copyright (C) Jan Pavelka https://www.phoca.cz
|
||||
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 and later
|
||||
* @cms Joomla
|
||||
* @copyright Copyright (C) Open Source Matters. All rights reserved.
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
|
||||
*/
|
||||
|
||||
defined( '_JEXEC' ) or die( 'Restricted access' );
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\HTML\HTMLHelper;
|
||||
use Joomla\CMS\Component\ComponentHelper;
|
||||
|
||||
class PhocaGalleryAccess
|
||||
{
|
||||
/*
|
||||
* Get info about access in only one category
|
||||
*/
|
||||
public static function getCategoryAccess($id) {
|
||||
|
||||
$output = array();
|
||||
$db = Factory::getDBO();
|
||||
$query = 'SELECT c.access, c.accessuserid, c.uploaduserid, c.deleteuserid, c.userfolder' .
|
||||
' FROM #__phocagallery_categories AS c' .
|
||||
' WHERE c.id = '. (int) $id .
|
||||
' ORDER BY c.id';
|
||||
$db->setQuery($query, 0, 1);
|
||||
$output = $db->loadObject();
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Method to check if the user have access to category
|
||||
* Display or hide the not accessible categories - subcat folder will be not displayed
|
||||
* Check whether category access level allows access
|
||||
*
|
||||
* E.g.: Should the link to Subcategory or to Parentcategory be displayed
|
||||
* E.g.: Should the delete button displayed, should be the upload button displayed
|
||||
*
|
||||
* @param string $params rightType: accessuserid, uploaduserid, deleteuserid - access, upload, delete right
|
||||
* @param int $params rightUsers - All selected users which should have the "rightType" right
|
||||
* @param int $params rightGroup - All selected Groups of users(public, registered or special ) which should have the "rT" right
|
||||
* @param int $params userAID - Specific group of user who display the category in front (public, special, registerd)
|
||||
* @param int $params userId - Specific id of user who display the category in front (1,2,3,...)
|
||||
* @param int $params Additional param - e.g. $display_access_category (Should be unaccessed category displayed)
|
||||
* @return boolean 1 or 0
|
||||
*/
|
||||
|
||||
public static function getUserRight($rightType = 'accessuserid', $rightUsers = array(), $rightGroup = 0, $userAID = array(), $userId = 0 , $additionalParam = 0 ) {
|
||||
$user = Factory::getUser();
|
||||
// we can get the variables here, not before function call
|
||||
$userAID = $user->getAuthorisedViewLevels();
|
||||
$userId = $user->get('id', 0);
|
||||
$guest = 0;
|
||||
if (isset($user->guest) && $user->guest == 1) {
|
||||
$guest = 1;
|
||||
}
|
||||
|
||||
|
||||
/* // User ACL
|
||||
$rightGroupAccess = 0;
|
||||
// User can be assigned to different groups
|
||||
foreach ($userAID as $keyUserAID => $valueUserAID) {
|
||||
if ((int)$rightGroup == (int)$valueUserAID) {
|
||||
$rightGroupAccess = 1;
|
||||
break;
|
||||
}
|
||||
}*/
|
||||
// Normally we use "registered" group
|
||||
// But if user defines own "registered" groups in registered_access_level, these need to be taken in effect too
|
||||
$nAL = self::getNeededAccessLevels();
|
||||
$rightGroupA = array();
|
||||
$rightGroupA[] = (int)$rightGroup;
|
||||
if(!empty($nAL)){
|
||||
//$rightGroupA = array_merge($nAL, $rightGroupA);
|
||||
}
|
||||
|
||||
// User ACL
|
||||
$rightGroupAccess = 0;
|
||||
// User can be assigned to different groups
|
||||
foreach ($userAID as $keyUserAID => $valueUserAID) {
|
||||
/*if ((int)$rightGroup == (int)$valueUserAID) {
|
||||
$rightGroupAccess = 1;
|
||||
break;
|
||||
}*/
|
||||
foreach($rightGroupA as $keyRightGroupA => $valueRightGroupA) {
|
||||
if ((int)$valueRightGroupA == (int)$valueUserAID) {
|
||||
$rightGroupAccess = 1;
|
||||
break 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$rightUsersIdArray = array();
|
||||
if (!empty($rightUsers) && isset($rightUsers) && $rightUsers != '') {
|
||||
$rightUsersIdArray = explode( ',', trim( $rightUsers ) );
|
||||
} else {
|
||||
$rightUsersIdArray = array();
|
||||
}
|
||||
|
||||
|
||||
// Access rights (Default open for all)
|
||||
// Upload and Delete rights (Default closed for all)
|
||||
switch ($rightType) {
|
||||
case 'accessuserid':
|
||||
$rightDisplay = 1;
|
||||
break;
|
||||
|
||||
default:
|
||||
$rightDisplay = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
if ($additionalParam == 0) { // We want not to display unaccessable categories ($display_access_category)
|
||||
if ($rightGroup != 0) {
|
||||
|
||||
if ($rightGroupAccess == 0) {
|
||||
$rightDisplay = 0;
|
||||
} else { // Access level only for one registered user
|
||||
if (!empty($rightUsersIdArray)) {
|
||||
// Check if the user is contained in selected array
|
||||
$userIsContained = 0;
|
||||
foreach ($rightUsersIdArray as $key => $value) {
|
||||
if ($userId == $value) {
|
||||
$userIsContained = 1;// check if the user id is selected in multiple box
|
||||
|
||||
break;// don't search again
|
||||
}
|
||||
// for access (-1 not selected - all registered, 0 all users)
|
||||
// Access is checked by group, but upload and delete not
|
||||
|
||||
|
||||
if ($value == -1) {
|
||||
if ($guest == 0) {
|
||||
$userIsContained = 1;// in multiple select box is selected - All registered users
|
||||
}
|
||||
|
||||
break;// don't search again
|
||||
}
|
||||
}
|
||||
|
||||
if ($userIsContained == 0) {
|
||||
$rightDisplay = 0;
|
||||
} else {
|
||||
if ($rightType == 'uploaduserid' || $rightType == 'deleteuserid') {
|
||||
$rightDisplay = 1;
|
||||
}
|
||||
|
||||
}
|
||||
// else {
|
||||
// // E.g. upload right begins with 0, so we need to set it to 1
|
||||
// $rightDisplay = 1;
|
||||
// }
|
||||
} else {
|
||||
|
||||
// Access rights (Default open for all)
|
||||
// Upload and Delete rights (Default closed for all)
|
||||
switch ($rightType) {
|
||||
case 'accessuserid':
|
||||
$rightDisplay = 1;
|
||||
break;
|
||||
|
||||
default:
|
||||
$rightDisplay = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $rightDisplay;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to display multiple select box
|
||||
* @param string $name Name (id, name parameters)
|
||||
* @param array $active Array of items which will be selected
|
||||
* @param int $nouser Select no user
|
||||
* @param string $javascript Add javascript to the select box
|
||||
* @param string $order Ordering of items
|
||||
* @param int $reg Only registered users
|
||||
* @return array of id
|
||||
*/
|
||||
|
||||
public static function usersList( $name, $id, $active, $nouser = 0, $javascript = NULL, $order = 'name', $reg = 1,$returnArray = 0) {
|
||||
|
||||
$activeArray = $active;
|
||||
if ($active != '') {
|
||||
$activeArray = explode(',',$active);
|
||||
}
|
||||
|
||||
$db = Factory::getDBO();
|
||||
$and = '';
|
||||
if ($reg) {
|
||||
// does not include registered users in the list
|
||||
$and = ' AND m.group_id != 2';
|
||||
}
|
||||
|
||||
$query = 'SELECT u.id AS value, u.name AS text'
|
||||
. ' FROM #__users AS u'
|
||||
. ' JOIN #__user_usergroup_map AS m ON m.user_id = u.id'
|
||||
. ' WHERE u.block = 0'
|
||||
. $and
|
||||
. ' GROUP BY u.id, u.name'
|
||||
. ' ORDER BY '. $order;
|
||||
|
||||
|
||||
$db->setQuery( $query );
|
||||
if ( $nouser ) {
|
||||
|
||||
// Access rights (Default open for all)
|
||||
// Upload and Delete rights (Default closed for all)
|
||||
|
||||
$idInput1 = $idInput2 = $idInput3 = $idInput4 = false;
|
||||
$idText1 = $idText2 = $idText3 = $idText4 = false;
|
||||
|
||||
switch ($name) {
|
||||
case 'jform[accessuserid][]':
|
||||
$idInput1 = -1;
|
||||
$idText1 = Text::_( 'COM_PHOCAGALLERY_ALL_REGISTERED_USERS' );
|
||||
$idInput2 = -2;
|
||||
$idText2 = Text::_( 'COM_PHOCAGALLERY_NOBODY' );
|
||||
break;
|
||||
|
||||
case 'batch[accessuserid][]':
|
||||
$idInput4 = -3;
|
||||
$idText4 = Text::_( 'COM_PHOCAGALLERY_KEEP_ORIGINAL_ACCESS_RIGHTS_LEVELS' );
|
||||
$idInput3 = 0;
|
||||
$idText3 = Text::_( 'COM_PHOCAGALLERY_NOT_SET' );
|
||||
$idInput1 = -1;
|
||||
$idText1 = Text::_( 'COM_PHOCAGALLERY_ALL_REGISTERED_USERS' );
|
||||
$idInput2 = -2;
|
||||
$idText2 = Text::_( 'COM_PHOCAGALLERY_NOBODY' );
|
||||
break;
|
||||
|
||||
case 'jform[default_accessuserid][]':
|
||||
$idInput3 = 0;
|
||||
$idText3 = Text::_( 'COM_PHOCAGALLERY_NOT_SET' );
|
||||
$idInput1 = -1;
|
||||
$idText1 = Text::_( 'COM_PHOCAGALLERY_ALL_REGISTERED_USERS' );
|
||||
$idInput2 = -2;
|
||||
$idText2 = Text::_( 'COM_PHOCAGALLERY_NOBODY' );
|
||||
break;
|
||||
|
||||
default:
|
||||
$idInput1 = -2;
|
||||
$idText1 = Text::_( 'COM_PHOCAGALLERY_NOBODY' );
|
||||
$idInput2 = -1;
|
||||
$idText2 = Text::_( 'COM_PHOCAGALLERY_ALL_REGISTERED_USERS' );
|
||||
break;
|
||||
}
|
||||
|
||||
$users = array();
|
||||
|
||||
if ($idText4) {
|
||||
$users[] = HTMLHelper::_('select.option', $idInput4, '- '. $idText4 .' -' );
|
||||
}
|
||||
if ($idText3) {
|
||||
$users[] = HTMLHelper::_('select.option', $idInput3, '- '. $idText3 .' -' );
|
||||
}
|
||||
$users[] = HTMLHelper::_('select.option', $idInput1, '- '. $idText1 .' -' );
|
||||
$users[] = HTMLHelper::_('select.option', $idInput2, '- '. $idText2 .' -' );
|
||||
|
||||
|
||||
$users = array_merge( $users, $db->loadObjectList() );
|
||||
} else {
|
||||
$users = $db->loadObjectList();
|
||||
}
|
||||
|
||||
if ($returnArray == 1) {
|
||||
return $users;
|
||||
}
|
||||
|
||||
$users = HTMLHelper::_('select.genericlist', $users, $name, 'class="form-control" size="4" multiple="multiple"'. $javascript, 'value', 'text', $activeArray, $id );
|
||||
|
||||
return $users;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Get list of users to select Owner of the category
|
||||
*/
|
||||
public static function usersListOwner( $name, $id, $active, $nouser = 0, $javascript = NULL, $order = 'name', $reg = 1, $returnArray = 0) {
|
||||
|
||||
$db = Factory::getDBO();
|
||||
$and = '';
|
||||
if ($reg) {
|
||||
// does not include registered users in the list
|
||||
$and = ' AND m.group_id != 2';
|
||||
}
|
||||
|
||||
$query = 'SELECT u.id AS value, u.name AS text'
|
||||
. ' FROM #__users AS u'
|
||||
. ' JOIN #__user_usergroup_map AS m ON m.user_id = u.id'
|
||||
. ' WHERE u.block = 0'
|
||||
. $and
|
||||
. ' GROUP BY u.id, u.name'
|
||||
. ' ORDER BY '. $order;
|
||||
|
||||
|
||||
$db->setQuery( $query );
|
||||
if ( $nouser ) {
|
||||
|
||||
$idInput1 = -1;
|
||||
$idText1 = Text::_( 'COM_PHOCAGALLERY_NOBODY' );
|
||||
$users[] = HTMLHelper::_('select.option', -1, '- '. $idText1 .' -' );
|
||||
|
||||
$users = array_merge( $users, $db->loadObjectList() );
|
||||
} else {
|
||||
$users = $db->loadObjectList();
|
||||
}
|
||||
|
||||
if ($returnArray == 1) {
|
||||
return $users;
|
||||
}
|
||||
|
||||
$users = HTMLHelper::_('select.genericlist', $users, $name, 'class="form-control" size="4" '. $javascript, 'value', 'text', $active, $id );
|
||||
|
||||
return $users;
|
||||
}
|
||||
|
||||
/*
|
||||
* Used for commenting and rating
|
||||
*/
|
||||
public static function getNeededAccessLevels() {
|
||||
|
||||
$paramsC = ComponentHelper::getParams('com_phocagallery');
|
||||
$registeredAccessLevel = $paramsC->get( 'registered_access_level', array(2,3,4) );
|
||||
return $registeredAccessLevel;
|
||||
}
|
||||
|
||||
/*
|
||||
* Check if user's groups access rights (e.g. user is public, registered, special) can meet needed Levels
|
||||
*/
|
||||
|
||||
public static function isAccess($userLevels, $neededLevels) {
|
||||
|
||||
$rightGroupAccess = 0;
|
||||
|
||||
// User can be assigned to different groups
|
||||
foreach($userLevels as $keyuserLevels => $valueuserLevels) {
|
||||
foreach($neededLevels as $keyneededLevels => $valueneededLevels) {
|
||||
|
||||
if ((int)$valueneededLevels == (int)$valueuserLevels) {
|
||||
$rightGroupAccess = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ($rightGroupAccess == 1) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return (boolean)$rightGroupAccess;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get the array of values for one parameters saved in param array
|
||||
* @param string $params
|
||||
* @param string $param param: e.g. accessuserid, uploaduserid, deleteuserid, userfolder
|
||||
* @return array of values from one param in params array which is saved in db table in 'params' column
|
||||
*/
|
||||
/*///
|
||||
function getParamsArray($params='', $param='accessuserid') {
|
||||
// All params from category / params for userid only
|
||||
if ($params != '') {
|
||||
$paramsArray = trim ($params);
|
||||
$paramsArray = explode( ',', $params );
|
||||
|
||||
if (is_array($paramsArray))
|
||||
{
|
||||
foreach ($paramsArray as $value)
|
||||
{
|
||||
$find = '/'.$param.'=/i';
|
||||
$replace = $param.'=';
|
||||
|
||||
$idParam = preg_match( "".$find."" , $value );
|
||||
if ($idParam) {
|
||||
$paramsId = str_replace($replace, '', $value);
|
||||
if ($paramsId != '') {
|
||||
$paramsIdArray = trim ($paramsId);
|
||||
$paramsIdArray = explode( ',', $paramsId );
|
||||
// Unset empty keys
|
||||
foreach ($paramsIdArray as $key2 => $value2)
|
||||
{
|
||||
if ($value2 == '') {
|
||||
unset($paramsIdArray[$key2]);
|
||||
}
|
||||
}
|
||||
|
||||
return $paramsIdArray;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return array();
|
||||
}*/
|
||||
}
|
||||
?>
|
||||
@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
@ -0,0 +1,508 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Phoca Gallery
|
||||
* @author Jan Pavelka - https://www.phoca.cz
|
||||
* @copyright Copyright (C) Jan Pavelka https://www.phoca.cz
|
||||
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 and later
|
||||
* @cms Joomla
|
||||
* @copyright Copyright (C) Open Source Matters. All rights reserved.
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
|
||||
*/
|
||||
defined('_JEXEC') or die();
|
||||
use Joomla\CMS\Object\CMSObject;
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\HTML\HTMLHelper;
|
||||
use Joomla\CMS\Router\Route;
|
||||
jimport('joomla.application.component.model');
|
||||
|
||||
|
||||
|
||||
final class PhocaGalleryCategory
|
||||
{
|
||||
|
||||
private static $categoryA = array();
|
||||
private static $categoryF = array();
|
||||
private static $categoryP = array();
|
||||
private static $categoryI = array();
|
||||
|
||||
|
||||
public function __construct() {
|
||||
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
public static function CategoryTreeOption($data, $tree, $id=0, $text='', $currentId = 0) {
|
||||
|
||||
foreach ($data as $key) {
|
||||
$show_text = $text . $key->text;
|
||||
|
||||
if ($key->parentid == $id && $currentId != $id && $currentId != $key->value) {
|
||||
$tree[$key->value] = new CMSObject();
|
||||
$tree[$key->value]->text = $show_text;
|
||||
$tree[$key->value]->value = $key->value;
|
||||
$tree = self::CategoryTreeOption($data, $tree, $key->value, $show_text . " - ", $currentId );
|
||||
}
|
||||
}
|
||||
return($tree);
|
||||
}
|
||||
|
||||
public static function filterCategory($query, $active = NULL, $frontend = NULL, $onChange = TRUE, $fullTree = NULL ) {
|
||||
|
||||
$db = Factory::getDBO();
|
||||
|
||||
$form = 'adminForm';
|
||||
if ($frontend == 1) {
|
||||
$form = 'phocacartproductsform';
|
||||
}
|
||||
|
||||
if ($onChange) {
|
||||
$onChO = 'class="form-control" size="1" onchange="document.'.$form.'.submit( );"';
|
||||
} else {
|
||||
$onChO = 'class="form-control" size="1"';
|
||||
}
|
||||
|
||||
$categories[] = HTMLHelper::_('select.option', '0', '- '.Text::_('COM_phocagallery_SELECT_CATEGORY').' -');
|
||||
$db->setQuery($query);
|
||||
$catData = $db->loadObjectList();
|
||||
|
||||
|
||||
|
||||
if ($fullTree) {
|
||||
|
||||
// Start - remove in case there is a memory problem
|
||||
$tree = array();
|
||||
$text = '';
|
||||
|
||||
$queryAll = ' SELECT cc.id AS value, cc.title AS text, cc.parent_id as parentid'
|
||||
.' FROM #__phocagallery_categories AS cc'
|
||||
.' ORDER BY cc.ordering';
|
||||
$db->setQuery($queryAll);
|
||||
$catDataAll = $db->loadObjectList();
|
||||
|
||||
$catDataTree = PhocacartCategory::CategoryTreeOption($catDataAll, $tree, 0, $text, -1);
|
||||
|
||||
$catDataTreeRights = array();
|
||||
//-
|
||||
/*foreach ($catData as $k => $v) {
|
||||
foreach ($catDataTree as $k2 => $v2) {
|
||||
if ($v->value == $v2->value) {
|
||||
$catDataTreeRights[$k]->text = $v2->text;
|
||||
$catDataTreeRights[$k]->value = $v2->value;
|
||||
}
|
||||
}
|
||||
} */
|
||||
//-
|
||||
|
||||
/*
|
||||
|
||||
foreach ($catDataTree as $k => $v) {
|
||||
foreach ($catData as $k2 => $v2) {
|
||||
if ($v->value == $v2->value) {
|
||||
$catDataTreeRights[$k] = new StdClass();
|
||||
$catDataTreeRights[$k]->text = $v->text;
|
||||
$catDataTreeRights[$k]->value = $v->value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
$catDataTree = array();
|
||||
$catDataTree = $catDataTreeRights;
|
||||
// End - remove in case there is a memory problem
|
||||
|
||||
// Uncomment in case there is a memory problem
|
||||
//$catDataTree = $catData;
|
||||
} else {
|
||||
$catDataTree = $catData;
|
||||
}
|
||||
|
||||
$categories = array_merge($categories, $catDataTree );
|
||||
|
||||
$category = HTMLHelper::_('select.genericlist', $categories, 'catid', $onChO, 'value', 'text', $active);
|
||||
|
||||
return $category;
|
||||
}
|
||||
|
||||
public static function options($type = 0)
|
||||
{
|
||||
|
||||
|
||||
$db = Factory::getDBO();
|
||||
|
||||
//build the list of categories
|
||||
$query = 'SELECT a.title AS text, a.id AS value, a.parent_id as parentid'
|
||||
. ' FROM #__phocagallery_categories AS a'
|
||||
. ' WHERE a.published = 1'
|
||||
. ' ORDER BY a.ordering';
|
||||
$db->setQuery( $query );
|
||||
$items = $db->loadObjectList();
|
||||
|
||||
$catId = -1;
|
||||
|
||||
$javascript = 'class="form-control" size="1" onchange="submitform( );"';
|
||||
|
||||
$tree = array();
|
||||
$text = '';
|
||||
$tree = PhocacartCategory::CategoryTreeOption($items, $tree, 0, $text, $catId);
|
||||
|
||||
return $tree;
|
||||
|
||||
}*/
|
||||
|
||||
public static function getCategoryById($id) {
|
||||
|
||||
$id = (int)$id;
|
||||
if( empty(self::$categoryI[$id])) {
|
||||
|
||||
$db = Factory::getDBO();
|
||||
$query = 'SELECT a.title, a.alias, a.id, a.parent_id'
|
||||
. ' FROM #__phocagallery_categories AS a'
|
||||
. ' WHERE a.id = '.(int)$id
|
||||
. ' ORDER BY a.ordering'
|
||||
. ' LIMIT 1';
|
||||
$db->setQuery( $query );
|
||||
|
||||
$category = $db->loadObject();
|
||||
if (!empty($category) && isset($category->id) && (int)$category->id > 0) {
|
||||
|
||||
$query = 'SELECT a.title, a.alias, a.id, a.parent_id'
|
||||
. ' FROM #__phocagallery_categories AS a'
|
||||
. ' WHERE a.parent_id = '.(int)$id
|
||||
. ' ORDER BY a.ordering';
|
||||
//. ' LIMIT 1'; We need all subcategories
|
||||
$db->setQuery( $query );
|
||||
$subcategories = $db->loadObjectList();
|
||||
if (!empty($subcategories)) {
|
||||
$category->subcategories = $subcategories;
|
||||
}
|
||||
}
|
||||
|
||||
self::$categoryI[$id] = $category;
|
||||
}
|
||||
return self::$categoryI[$id];
|
||||
}
|
||||
/*
|
||||
public static function getChildren($id) {
|
||||
$db = Factory::getDBO();
|
||||
$query = 'SELECT a.title, a.alias, a.id'
|
||||
. ' FROM #__phocagallery_categories AS a'
|
||||
. ' WHERE a.parent_id = '.(int)$id
|
||||
. ' ORDER BY a.ordering';
|
||||
$db->setQuery( $query );
|
||||
$categories = $db->loadObjectList();
|
||||
return $categories;
|
||||
}
|
||||
*/
|
||||
public static function getPath($path = array(), $id = 0, $parent_id = 0, $title = '', $alias = '') {
|
||||
|
||||
if( empty(self::$categoryA[$id])) {
|
||||
self::$categoryP[$id] = self::getPathTree($path, $id, $parent_id, $title, $alias);
|
||||
}
|
||||
|
||||
return self::$categoryP[$id];
|
||||
}
|
||||
|
||||
public static function getPathTree($path = array(), $id = 0, $parent_id = 0, $title = '', $alias = '') {
|
||||
|
||||
static $iCT = 0;
|
||||
|
||||
if ((int)$id > 0) {
|
||||
//$path[$iCT]['id'] = (int)$id;
|
||||
//$path[$iCT]['catid'] = (int)$parent_id;
|
||||
//$path[$iCT]['title'] = $title;
|
||||
//$path[$iCT]['alias'] = $alias;
|
||||
|
||||
$path[$id] = (int)$id. ':'. $alias;
|
||||
}
|
||||
|
||||
if ((int)$parent_id > 0) {
|
||||
$db = Factory::getDBO();
|
||||
$query = 'SELECT a.title, a.alias, a.id, a.parent_id'
|
||||
. ' FROM #__phocagallery_categories AS a'
|
||||
. ' WHERE a.id = '.(int)$parent_id
|
||||
. ' ORDER BY a.ordering';
|
||||
$db->setQuery( $query );
|
||||
$category = $db->loadObject();
|
||||
|
||||
if (isset($category->id)) {
|
||||
$id = (int)$category->id;
|
||||
$title = '';
|
||||
if (isset($category->title)) {
|
||||
$title = $category->title;
|
||||
}
|
||||
|
||||
$alias = '';
|
||||
if (isset($category->alias)) {
|
||||
$alias = $category->alias;
|
||||
}
|
||||
|
||||
$parent_id = 0;
|
||||
if (isset($category->parent_id)) {
|
||||
$parent_id = (int)$category->parent_id;
|
||||
}
|
||||
$iCT++;
|
||||
|
||||
$path = self::getPathTree($path, (int)$id, (int)$parent_id, $title, $alias);
|
||||
}
|
||||
}
|
||||
return $path;
|
||||
}
|
||||
/*
|
||||
public static function categoryTree($d, $r = 0, $pk = 'parent_id', $k = 'id', $c = 'children') {
|
||||
$m = array();
|
||||
foreach ($d as $e) {
|
||||
isset($m[$e[$pk]]) ?: $m[$e[$pk]] = array();
|
||||
isset($m[$e[$k]]) ?: $m[$e[$k]] = array();
|
||||
$m[$e[$pk]][] = array_merge($e, array($c => &$m[$e[$k]]));
|
||||
}
|
||||
//return $m[$r][0]; // remove [0] if there could be more than one root nodes
|
||||
if (isset($m[$r])) {
|
||||
return $m[$r];
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static function nestedToUl($data, $currentCatid = 0) {
|
||||
$result = array();
|
||||
|
||||
if (!empty($data) && count($data) > 0) {
|
||||
$result[] = '<ul>';
|
||||
foreach ($data as $k => $v) {
|
||||
$link = Route::_(PhocacartRoute::getCategoryRoute($v['id'], $v['alias']));
|
||||
|
||||
// Current Category is selected
|
||||
if ($currentCatid == $v['id']) {
|
||||
$result[] = sprintf(
|
||||
'<li data-jstree=\'{"opened":true,"selected":true}\' >%s%s</li>',
|
||||
'<a href="'.$link.'">' . $v['title']. '</a>',
|
||||
self::nestedToUl($v['children'], $currentCatid)
|
||||
);
|
||||
} else {
|
||||
$result[] = sprintf(
|
||||
'<li>%s%s</li>',
|
||||
'<a href="'.$link.'">' . $v['title']. '</a>',
|
||||
self::nestedToUl($v['children'], $currentCatid)
|
||||
);
|
||||
}
|
||||
}
|
||||
$result[] = '</ul>';
|
||||
}
|
||||
|
||||
return implode("\n", $result);
|
||||
}
|
||||
|
||||
public static function nestedToCheckBox($data, $d, $currentCatid = 0, &$active = 0, $forceCategoryId = 0) {
|
||||
|
||||
|
||||
$result = array();
|
||||
if (!empty($data) && count($data) > 0) {
|
||||
$result[] = '<ul class="ph-filter-module-category-tree">';
|
||||
foreach ($data as $k => $v) {
|
||||
|
||||
$checked = '';
|
||||
$value = htmlspecialchars($v['alias']);
|
||||
if (isset($d['nrinalias']) && $d['nrinalias'] == 1) {
|
||||
$value = (int)$v['id'] .'-'. htmlspecialchars($v['alias']);
|
||||
}
|
||||
|
||||
if (in_array($value, $d['getparams'])) {
|
||||
$checked = 'checked';
|
||||
$active = 1;
|
||||
}
|
||||
|
||||
// This only can happen in category view (category filters are empty, id of category is larger then zero)
|
||||
// This is only marking the category as active in category list
|
||||
if (empty($d['getparams']) || (isset($d['getparams'][0]) && $d['getparams'][0] == '')) {
|
||||
// Empty parameters, so we can set category id by id of category view
|
||||
if ($forceCategoryId > 0 && (int)$forceCategoryId == (int)$v['id']) {
|
||||
$checked = 'checked';
|
||||
$active = 1;
|
||||
}
|
||||
}
|
||||
|
||||
$count = '';
|
||||
// If we are in item view - one category is selected but if user click on filter to select other category, this one should be still selected - we go to items view with 2 selected
|
||||
// because force category is on
|
||||
if (isset($v['count_products']) && isset($d['params']['display_category_count']) && $d['params']['display_category_count'] == 1 ) {
|
||||
$count = ' <span class="ph-filter-count">'.(int)$v['count_products'].'</span>';
|
||||
}
|
||||
|
||||
$icon = '';
|
||||
if ($v['icon_class'] != '') {
|
||||
$icon = '<span class="' . PhocacartText::filterValue($v['icon_class'], 'text') . ' ph-filter-item-icon"></span> ';
|
||||
}
|
||||
|
||||
$jsSet = '';
|
||||
|
||||
if (isset($d['forcecategory']['idalias']) && $d['forcecategory']['idalias'] != '') {
|
||||
// Category View - force the category parameter if set in parameters
|
||||
$jsSet .= 'phChangeFilter(\'c\', \''.$d['forcecategory']['idalias'].'\', 1, \'text\', 0, 1, 1);'; // ADD IS FIXED ( use "text" as formType - it cannot by managed by checkbox, it is fixed - always 1 - does not depends on checkbox, it is fixed 1
|
||||
}
|
||||
|
||||
|
||||
|
||||
$jsSet .= 'phChangeFilter(\''.$d['param'].'\', \''. $value.'\', this, \''.$d['formtype'].'\',\''.$d['uniquevalue'].'\', 0, 1);';// ADD OR REMOVE
|
||||
|
||||
|
||||
$result[] = '<li><div class="checkbox">';
|
||||
$result[] = '<label class="ph-checkbox-container"><input type="checkbox" name="tag" value="'.$value.'" '.$checked.' onchange="'.$jsSet.'" />'. $icon . $v['title'].$count.'<span class="ph-checkbox-checkmark"></span></label>';
|
||||
$result[] = '</div></li>';
|
||||
$result[] = self::nestedToCheckBox($v['children'], $d, $currentCatid, $active);
|
||||
}
|
||||
$result[] = '</ul>';
|
||||
}
|
||||
|
||||
return implode("\n", $result);
|
||||
}
|
||||
|
||||
public static function getCategoryTreeFormat($ordering = 1, $display = '', $hide = '', $type = array(0,1), $lang = '') {
|
||||
|
||||
$cis = str_replace(',', '', 'o'.$ordering .'d'. $display .'h'. $hide. 'l'. $lang);
|
||||
if( empty(self::$categoryF[$cis])) {
|
||||
|
||||
$itemOrdering = PhocacartOrdering::getOrderingText($ordering,1);
|
||||
$db = Factory::getDBO();
|
||||
$wheres = array();
|
||||
$user = PhocacartUser::getUser();
|
||||
$userLevels = implode (',', $user->getAuthorisedViewLevels());
|
||||
$userGroups = implode (',', PhocacartGroup::getGroupsById($user->id, 1, 1));
|
||||
$wheres[] = " c.access IN (".$userLevels.")";
|
||||
$wheres[] = " (gc.group_id IN (".$userGroups.") OR gc.group_id IS NULL)";
|
||||
$wheres[] = " c.published = 1";
|
||||
|
||||
if ($lang != '' && $lang != '*') {
|
||||
$wheres[] = PhocacartUtilsSettings::getLangQuery('c.language', $lang);
|
||||
}
|
||||
|
||||
if (!empty($type) && is_array($type)) {
|
||||
$wheres[] = " c.type IN (".implode(',', $type).")";
|
||||
}
|
||||
|
||||
if ($display != '') {
|
||||
$wheres[] = " c.id IN (".$display.")";
|
||||
}
|
||||
if ($hide != '') {
|
||||
$wheres[] = " c.id NOT IN (".$hide.")";
|
||||
}
|
||||
|
||||
$columns = 'c.id, c.title, c.alias, c.parent_id';
|
||||
$groupsFull = $columns;
|
||||
$groupsFast = 'c.id';
|
||||
$groups = PhocacartUtilsSettings::isFullGroupBy() ? $groupsFull : $groupsFast;
|
||||
|
||||
$query = 'SELECT c.id, c.title, c.alias, c.parent_id'
|
||||
. ' FROM #__phocagallery_categories AS c'
|
||||
. ' LEFT JOIN #__phocagallery_item_groups AS gc ON c.id = gc.item_id AND gc.type = 2'// type 2 is category
|
||||
. ' WHERE ' . implode( ' AND ', $wheres )
|
||||
. ' GROUP BY '.$groups
|
||||
. ' ORDER BY '.$itemOrdering;
|
||||
$db->setQuery( $query );
|
||||
|
||||
$items = $db->loadAssocList();
|
||||
$tree = self::categoryTree($items);
|
||||
$currentCatid = self::getActiveCategoryId();
|
||||
self::$categoryF[$cis] = self::nestedToUl($tree, $currentCatid);
|
||||
}
|
||||
|
||||
return self::$categoryF[$cis];
|
||||
}
|
||||
|
||||
public static function getCategoryTreeArray($ordering = 1, $display = '', $hide = '', $type = array(0,1), $lang = '', $limitCount = -1) {
|
||||
|
||||
$cis = str_replace(',', '', 'o'.$ordering .'d'. $display .'h'. $hide . 'l'. $lang . 'c'.$limitCount);
|
||||
if( empty(self::$categoryA[$cis])) {
|
||||
|
||||
$itemOrdering = PhocacartOrdering::getOrderingText($ordering,1);
|
||||
$db = Factory::getDBO();
|
||||
$wheres = array();
|
||||
$user = PhocacartUser::getUser();
|
||||
$userLevels = implode (',', $user->getAuthorisedViewLevels());
|
||||
$userGroups = implode (',', PhocacartGroup::getGroupsById($user->id, 1, 1));
|
||||
$wheres[] = " c.access IN (".$userLevels.")";
|
||||
$wheres[] = " (gc.group_id IN (".$userGroups.") OR gc.group_id IS NULL)";
|
||||
$wheres[] = " c.published = 1";
|
||||
|
||||
if ($lang != '' && $lang != '*') {
|
||||
$wheres[] = PhocacartUtilsSettings::getLangQuery('c.language', $lang);
|
||||
}
|
||||
|
||||
if (!empty($type) && is_array($type)) {
|
||||
$wheres[] = " c.type IN (".implode(',', $type).")";
|
||||
}
|
||||
|
||||
if ($display != '') {
|
||||
$wheres[] = " c.id IN (".$display.")";
|
||||
}
|
||||
if ($hide != '') {
|
||||
$wheres[] = " c.id NOT IN (".$hide.")";
|
||||
}
|
||||
|
||||
if ((int)$limitCount > -1) {
|
||||
$wheres[] = " c.count_products > ".(int)$limitCount;
|
||||
}
|
||||
|
||||
$query = 'SELECT c.id, c.title, c.alias, c.parent_id, c.icon_class, c.image, c.description, c.count_products'
|
||||
. ' FROM #__phocagallery_categories AS c'
|
||||
. ' LEFT JOIN #__phocagallery_item_groups AS gc ON c.id = gc.item_id AND gc.type = 2'// type 2 is category
|
||||
. ' WHERE ' . implode( ' AND ', $wheres )
|
||||
. ' ORDER BY '.$itemOrdering;
|
||||
$db->setQuery( $query );
|
||||
$items = $db->loadAssocList();
|
||||
self::$categoryA[$cis] = self::categoryTree($items);
|
||||
}
|
||||
return self::$categoryA[$cis];
|
||||
}
|
||||
|
||||
public static function getActiveCategoryId() {
|
||||
|
||||
$app = Factory::getApplication();
|
||||
$option = $app->input->get( 'option', '', 'string' );
|
||||
$view = $app->input->get( 'view', '', 'string' );
|
||||
$catid = $app->input->get( 'catid', '', 'int' ); // ID in items view is category id
|
||||
$id = $app->input->get( 'id', '', 'int' );
|
||||
|
||||
if ($option == 'com_phocacart' && ($view == 'items' || $view == 'category')) {
|
||||
|
||||
if ((int)$id > 0) {
|
||||
return $id;
|
||||
}
|
||||
}
|
||||
if ($option == 'com_phocacart' && $view == 'item') {
|
||||
|
||||
if ((int)$catid > 0) {
|
||||
return $catid;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static function getActiveCategories($items, $ordering) {
|
||||
|
||||
$db = Factory::getDbo();
|
||||
$o = array();
|
||||
$wheres = array();
|
||||
$ordering = PhocacartOrdering::getOrderingText($ordering, 1);//c
|
||||
if ($items != '') {
|
||||
$wheres[] = 'c.id IN (' . $items . ')';
|
||||
$q = 'SELECT DISTINCT c.title, CONCAT(c.id, \'-\', c.alias) AS alias, \'c\' AS parameteralias, \'category\' AS parametertitle FROM #__phocagallery_categories AS c'
|
||||
. (!empty($wheres) ? ' WHERE ' . implode(' AND ', $wheres) : '')
|
||||
. ' GROUP BY c.alias, c.title'
|
||||
. ' ORDER BY ' . $ordering;
|
||||
|
||||
$db->setQuery($q);
|
||||
$o = $db->loadAssocList();
|
||||
}
|
||||
return $o;
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
public final function __clone() {
|
||||
throw new Exception('Function Error: Cannot clone instance of Singleton pattern', 500);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
?>
|
||||
@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
@ -0,0 +1,72 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Phoca Gallery
|
||||
* @author Jan Pavelka - https://www.phoca.cz
|
||||
* @copyright Copyright (C) Jan Pavelka https://www.phoca.cz
|
||||
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 and later
|
||||
* @cms Joomla
|
||||
* @copyright Copyright (C) Open Source Matters. All rights reserved.
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
|
||||
*/
|
||||
defined( '_JEXEC' ) or die( 'Restricted access' );
|
||||
|
||||
class PhocaGalleryComment
|
||||
{
|
||||
public static function closeTags($comment, $tag, $endTag) {
|
||||
if (substr_count(strtolower($comment), $tag) > substr_count(strtolower($comment), $endTag)) {
|
||||
$comment .= $endTag;
|
||||
$comment = PhocaGalleryComment::closeTags($comment, $tag, $endTag);
|
||||
}
|
||||
return $comment;
|
||||
|
||||
}
|
||||
|
||||
public static function getSmileys() {
|
||||
$smileys = array();
|
||||
$smileys[':)'] = '🙂';
|
||||
$smileys[':lol:'] = '😄';
|
||||
$smileys[':('] = '☹';
|
||||
$smileys[':?'] = '😕';
|
||||
$smileys[':wink:'] = '😉';
|
||||
return $smileys;
|
||||
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* @based based on Seb's BB-Code-Parser script by seb
|
||||
* @url http://www.traum-projekt.com/forum/54-traum-scripts/25292-sebs-bb-code-parser.html
|
||||
*/
|
||||
public static function bbCodeReplace($string, $currentString = '') {
|
||||
|
||||
while($currentString != $string) {
|
||||
$currentString = $string;
|
||||
$string = preg_replace_callback('{\[(\w+)((=)(.+)|())\]((.|\n)*)\[/\1\]}U', array('PhocaGalleryComment', 'bbCodeCallback'), $string);
|
||||
}
|
||||
return $string;
|
||||
}
|
||||
|
||||
/*
|
||||
* @based based on Seb's BB-Code-Parser script by seb
|
||||
* @url http://www.traum-projekt.com/forum/54-traum-scripts/25292-sebs-bb-code-parser.html
|
||||
*/
|
||||
public static function bbCodeCallback($matches) {
|
||||
$tag = trim($matches[1]);
|
||||
$bodyString = $matches[6];
|
||||
$argument = $matches[4];
|
||||
|
||||
switch($tag) {
|
||||
case 'b':
|
||||
case 'i':
|
||||
case 'u':
|
||||
$replacement = '<'.$tag.'>'.$bodyString.'</'.$tag.'>';
|
||||
break;
|
||||
|
||||
Default: // unknown tag => reconstruct and return original expression
|
||||
$replacement = '[' . $tag . ']' . $bodyString . '[/' . $tag .']';
|
||||
break;
|
||||
}
|
||||
return $replacement;
|
||||
}
|
||||
}
|
||||
?>
|
||||
@ -0,0 +1,47 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Phoca Gallery
|
||||
* @author Jan Pavelka - https://www.phoca.cz
|
||||
* @copyright Copyright (C) Jan Pavelka https://www.phoca.cz
|
||||
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 and later
|
||||
* @cms Joomla
|
||||
* @copyright Copyright (C) Open Source Matters. All rights reserved.
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
|
||||
*/
|
||||
defined( '_JEXEC' ) or die( 'Restricted access' );
|
||||
use Joomla\CMS\Factory;
|
||||
|
||||
class PhocaGalleryCommentCategory
|
||||
{
|
||||
public static function checkUserComment($catid, $userid) {
|
||||
$db =Factory::getDBO();
|
||||
$query = 'SELECT co.id AS id'
|
||||
.' FROM #__phocagallery_comments AS co'
|
||||
.' WHERE co.catid = '. (int)$catid
|
||||
.' AND co.userid = '. (int)$userid
|
||||
.' ORDER BY co.id';
|
||||
$db->setQuery($query, 0, 1);
|
||||
$checkUserComment = $db->loadObject();
|
||||
|
||||
if ($checkUserComment) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static function displayComment($catid) {
|
||||
|
||||
$db =Factory::getDBO();
|
||||
$query = 'SELECT co.id AS id, co.title AS title, co.comment AS comment, co.date AS date, u.name AS name, u.username AS username'
|
||||
.' FROM #__phocagallery_comments AS co'
|
||||
.' LEFT JOIN #__users AS u ON u.id = co.userid '
|
||||
.' WHERE co.catid = '. (int)$catid
|
||||
.' AND co.published = 1'
|
||||
.' ORDER by ordering';
|
||||
$db->setQuery($query);
|
||||
$commentItem = $db->loadObjectList();
|
||||
|
||||
return $commentItem;
|
||||
}
|
||||
}
|
||||
?>
|
||||
@ -0,0 +1,249 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Phoca Gallery
|
||||
* @author Jan Pavelka - https://www.phoca.cz
|
||||
* @copyright Copyright (C) Jan Pavelka https://www.phoca.cz
|
||||
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 and later
|
||||
* @cms Joomla
|
||||
* @copyright Copyright (C) Open Source Matters. All rights reserved.
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
|
||||
*/
|
||||
defined( '_JEXEC' ) or die( 'Restricted access' );
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Session\Session;
|
||||
use Joomla\CMS\Uri\Uri;
|
||||
use Joomla\CMS\Language\Text;
|
||||
|
||||
class PhocaGalleryCommentImage
|
||||
{
|
||||
public static function checkUserComment($imgid, $userid) {
|
||||
$db =Factory::getDBO();
|
||||
$query = 'SELECT co.id AS id'
|
||||
.' FROM #__phocagallery_img_comments AS co'
|
||||
.' WHERE co.imgid = '. (int)$imgid
|
||||
.' AND co.userid = '. (int)$userid
|
||||
.' ORDER BY co.id';
|
||||
$db->setQuery($query, 0, 1);
|
||||
$checkUserComment = $db->loadObject();
|
||||
|
||||
if ($checkUserComment) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static function displayComment($imgid) {
|
||||
|
||||
$db =Factory::getDBO();
|
||||
$query = 'SELECT co.id AS id, co.title AS title, co.comment AS comment, co.date AS date, u.name AS name, u.username AS username, uc.avatar AS avatar'
|
||||
.' FROM #__phocagallery_img_comments AS co'
|
||||
.' LEFT JOIN #__users AS u ON u.id = co.userid'
|
||||
.' LEFT JOIN #__phocagallery_user AS uc ON uc.userid = u.id'
|
||||
/*.' WHERE co.imgid = '. (int)$imgid
|
||||
.' AND co.published = 1'
|
||||
.' AND uc.published = 1'
|
||||
.' AND uc.approved = 1'*/
|
||||
|
||||
.' WHERE '
|
||||
. ' CASE WHEN avatar IS NOT NULL THEN'
|
||||
.' co.imgid = '. (int)$imgid
|
||||
.' AND co.published = 1'
|
||||
.' AND uc.published = 1'
|
||||
.' AND uc.approved = 1'
|
||||
.' ELSE'
|
||||
.' co.imgid = '. (int)$imgid
|
||||
.' AND co.published = 1'
|
||||
.' END'
|
||||
|
||||
.' ORDER by co.ordering';
|
||||
$db->setQuery($query);
|
||||
$commentItem = $db->loadObjectList();
|
||||
|
||||
return $commentItem;
|
||||
}
|
||||
|
||||
public static function getUserAvatar($userId) {
|
||||
$db = Factory::getDBO();
|
||||
$query = 'SELECT a.*'
|
||||
. ' FROM #__phocagallery_user AS a'
|
||||
. ' WHERE a.userid = '.(int)$userId;
|
||||
$db->setQuery( $query );
|
||||
$avatar = $db->loadObject();
|
||||
if(isset($avatar->id)) {
|
||||
return $avatar;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static function renderCommentImageJS() {
|
||||
|
||||
|
||||
// We only use refresh task (it means to get answer)
|
||||
// pgRequest uses pgRequestRefresh site
|
||||
$document = Factory::getDocument();
|
||||
$url = 'index.php?option=com_phocagallery&view=commentimga&task=commentimg&format=json&'.Session::getFormToken().'=1';
|
||||
$urlRefresh = 'index.php?option=com_phocagallery&view=commentimga&task=refreshcomment&format=json&'.Session::getFormToken().'=1';
|
||||
$imgLoadingUrl = Uri::base(). 'media/com_phocagallery/images/icon-loading3.gif';
|
||||
$imgLoadingHTML = '<img src="'.$imgLoadingUrl.'" alt="" />';
|
||||
//$js = '<script type="text/javascript">' . "\n";
|
||||
//$js .= 'window.addEvent("domready",function() {
|
||||
$js = '
|
||||
function pgCommentImage(id, m, container) {
|
||||
|
||||
var result = "#pg-cv-comment-img-box-result" + id;
|
||||
|
||||
var commentTxtArea = "#pg-cv-comments-editor-img" + id;
|
||||
var comment = jQuery(commentTxtArea).val();
|
||||
data = {"commentId": id, "commentValue": comment, "format":"json"};
|
||||
|
||||
pgRequest = jQuery.ajax({
|
||||
type: "POST",
|
||||
url: "'.$urlRefresh.'",
|
||||
async: "false",
|
||||
cache: "false",
|
||||
data: data,
|
||||
dataType:"JSON",
|
||||
|
||||
beforeSend: function(){
|
||||
jQuery(result).html("'.addslashes($imgLoadingHTML).'");
|
||||
if (m == 2) {
|
||||
var wall = new Masonry(document.getElementById(container));
|
||||
}
|
||||
},
|
||||
|
||||
success: function(data){
|
||||
if (data.status == 1){
|
||||
jQuery(result).html(data.message);
|
||||
} else if(data.status == 0){
|
||||
jQuery(result).html(data.error);
|
||||
} else {
|
||||
jQuery(result).text("'.Text::_('COM_PHOCAGALLERY_ERROR_REQUESTING_ITEM').'");
|
||||
}
|
||||
|
||||
if (m == 2) {
|
||||
var wall = new Masonry(document.getElementById(container));
|
||||
}
|
||||
},
|
||||
|
||||
error: function(){
|
||||
jQuery(result).text( "'.Text::_('COM_PHOCAGALLERY_ERROR_REQUESTING_ITEM').'");
|
||||
|
||||
if (m == 2) {
|
||||
var wall = new Masonry(document.getElementById(container));
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
}';
|
||||
|
||||
$document->addScriptDeclaration($js);
|
||||
|
||||
//})';
|
||||
|
||||
/*
|
||||
if (r) {
|
||||
if (r.error == false) {
|
||||
jQuery(result).set("html", jsonObj.message);
|
||||
} else {
|
||||
jQuery(result).set("html", r.error);
|
||||
}
|
||||
} else {
|
||||
jQuery(result).set("text", "'.Text::_('COM_PHOCAGALLERY_ERROR_REQUESTING_ITEM').'");
|
||||
}
|
||||
|
||||
if (m == 2) {
|
||||
var wall = new Masonry(document.getElementById(container));
|
||||
}
|
||||
|
||||
|
||||
|
||||
var pgRequest = new Request.JSON({
|
||||
url: "'.$urlRefresh.'",
|
||||
method: "post",
|
||||
|
||||
onRequest: function(){
|
||||
jQuery(result).set("html", "'.addslashes($imgLoadingHTML).'");
|
||||
if (m == 2) {
|
||||
var wall = new Masonry(document.getElementById(container));
|
||||
}
|
||||
},
|
||||
|
||||
onComplete: function(jsonObj) {
|
||||
try {
|
||||
var r = jsonObj;
|
||||
} catch(e) {
|
||||
var r = false;
|
||||
}
|
||||
|
||||
if (r) {
|
||||
if (r.error == false) {
|
||||
jQuery(result).set("html", jsonObj.message);
|
||||
} else {
|
||||
jQuery(result).set("html", r.error);
|
||||
}
|
||||
} else {
|
||||
jQuery(result).set("text", "'.Text::_('COM_PHOCAGALLERY_ERROR_REQUESTING_ITEM').'");
|
||||
}
|
||||
|
||||
if (m == 2) {
|
||||
var wall = new Masonry(document.getElementById(container));
|
||||
}
|
||||
},
|
||||
|
||||
onFailure: function() {
|
||||
jQuery(result).set("text", "'.Text::_('COM_PHOCAGALLERY_ERROR_REQUESTING_ITEM').'");
|
||||
|
||||
if (m == 2) {
|
||||
var wall = new Masonry(document.getElementById(container));
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
pgRequest.send({
|
||||
data: {"commentId": id, "commentValue": comment, "format":"json"},
|
||||
});
|
||||
|
||||
};';
|
||||
|
||||
//$js .= '});';
|
||||
|
||||
|
||||
/*
|
||||
var resultcomment = "pg-cv-comment-img-box-newcomment" + id;
|
||||
// Refreshing Voting
|
||||
var pgRequestRefresh = new Request.JSON({
|
||||
url: "'.$urlRefresh.'",
|
||||
method: "post",
|
||||
|
||||
onComplete: function(json2Obj) {
|
||||
try {
|
||||
var rr = json2Obj;
|
||||
} catch(e) {
|
||||
var rr = false;
|
||||
}
|
||||
|
||||
if (rr) {
|
||||
$(resultcomment).set("html", json2Obj.message);
|
||||
} else {
|
||||
$(resultcomment).set("text", "'.Text::_('COM_PHOCAGALLERY_ERROR_REQUESTING_ITEM').'");
|
||||
}
|
||||
},
|
||||
|
||||
onFailure: function() {
|
||||
$(resultcomment).set("text", "'.Text::_('COM_PHOCAGALLERY_ERROR_REQUESTING_ITEM').'");
|
||||
}
|
||||
})
|
||||
|
||||
pgRequestRefresh.send({
|
||||
data: {"commentId": id, "commentValue": comment, "format":"json"}
|
||||
});
|
||||
//End refreshing comments
|
||||
*/
|
||||
|
||||
//$js .= "\n" .'</script>';
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
?>
|
||||
@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,162 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2011 Facebook, Inc.
|
||||
* @copyright Copyright 2011 Facebook, Inc.
|
||||
* @license
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License. You may obtain
|
||||
* a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
//require_once "base_facebook.php";
|
||||
|
||||
/**
|
||||
* Extends the BaseFacebook class with the intent of using
|
||||
* PHP sessions to store user ids and access tokens.
|
||||
*/
|
||||
defined( '_JEXEC' ) or die( 'Restricted access' );
|
||||
class Facebook extends BaseFacebook
|
||||
{
|
||||
const FBSS_COOKIE_NAME = 'fbss';
|
||||
|
||||
// We can set this to a high number because the main session
|
||||
// expiration will trump this.
|
||||
const FBSS_COOKIE_EXPIRE = 31556926; // 1 year
|
||||
|
||||
// Stores the shared session ID if one is set.
|
||||
protected $sharedSessionID;
|
||||
|
||||
/**
|
||||
* Identical to the parent constructor, except that
|
||||
* we start a PHP session to store the user ID and
|
||||
* access token if during the course of execution
|
||||
* we discover them.
|
||||
*
|
||||
* @param Array $config the application configuration. Additionally
|
||||
* accepts "sharedSession" as a boolean to turn on a secondary
|
||||
* cookie for environments with a shared session (that is, your app
|
||||
* shares the domain with other apps).
|
||||
* @see BaseFacebook::__construct in facebook.php
|
||||
*/
|
||||
public function __construct($config) {
|
||||
if (!session_id()) {
|
||||
session_start();
|
||||
}
|
||||
parent::__construct($config);
|
||||
if (!empty($config['sharedSession'])) {
|
||||
$this->initSharedSession();
|
||||
}
|
||||
}
|
||||
|
||||
protected static $kSupportedKeys =
|
||||
array('state', 'code', 'access_token', 'user_id');
|
||||
|
||||
protected function initSharedSession() {
|
||||
$cookie_name = $this->getSharedSessionCookieName();
|
||||
if (isset($_COOKIE[$cookie_name])) {
|
||||
$data = $this->parseSignedRequest($_COOKIE[$cookie_name]);
|
||||
if ($data && !empty($data['domain']) &&
|
||||
self::isAllowedDomain($this->getHttpHost(), $data['domain'])) {
|
||||
// good case
|
||||
$this->sharedSessionID = $data['id'];
|
||||
return;
|
||||
}
|
||||
// ignoring potentially unreachable data
|
||||
}
|
||||
// evil/corrupt/missing case
|
||||
$base_domain = $this->getBaseDomain();
|
||||
$this->sharedSessionID = md5(uniqid(mt_rand(), true));
|
||||
$cookie_value = $this->makeSignedRequest(
|
||||
array(
|
||||
'domain' => $base_domain,
|
||||
'id' => $this->sharedSessionID,
|
||||
)
|
||||
);
|
||||
$_COOKIE[$cookie_name] = $cookie_value;
|
||||
if (!headers_sent()) {
|
||||
$expire = time() + self::FBSS_COOKIE_EXPIRE;
|
||||
setcookie($cookie_name, $cookie_value, $expire, '/', '.'.$base_domain);
|
||||
} else {
|
||||
// @codeCoverageIgnoreStart
|
||||
self::errorLog(
|
||||
'Shared session ID cookie could not be set! You must ensure you '.
|
||||
'create the Facebook instance before headers have been sent. This '.
|
||||
'will cause authentication issues after the first request.'
|
||||
);
|
||||
// @codeCoverageIgnoreEnd
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides the implementations of the inherited abstract
|
||||
* methods. The implementation uses PHP sessions to maintain
|
||||
* a store for authorization codes, user ids, CSRF states, and
|
||||
* access tokens.
|
||||
*/
|
||||
protected function setPersistentData($key, $value) {
|
||||
if (!in_array($key, self::$kSupportedKeys)) {
|
||||
self::errorLog('Unsupported key passed to setPersistentData.');
|
||||
return;
|
||||
}
|
||||
|
||||
$session_var_name = $this->constructSessionVariableName($key);
|
||||
$_SESSION[$session_var_name] = $value;
|
||||
}
|
||||
|
||||
protected function getPersistentData($key, $default = false) {
|
||||
if (!in_array($key, self::$kSupportedKeys)) {
|
||||
self::errorLog('Unsupported key passed to getPersistentData.');
|
||||
return $default;
|
||||
}
|
||||
|
||||
$session_var_name = $this->constructSessionVariableName($key);
|
||||
return isset($_SESSION[$session_var_name]) ?
|
||||
$_SESSION[$session_var_name] : $default;
|
||||
}
|
||||
|
||||
protected function clearPersistentData($key) {
|
||||
if (!in_array($key, self::$kSupportedKeys)) {
|
||||
self::errorLog('Unsupported key passed to clearPersistentData.');
|
||||
return;
|
||||
}
|
||||
|
||||
$session_var_name = $this->constructSessionVariableName($key);
|
||||
unset($_SESSION[$session_var_name]);
|
||||
}
|
||||
|
||||
protected function clearAllPersistentData() {
|
||||
foreach (self::$kSupportedKeys as $key) {
|
||||
$this->clearPersistentData($key);
|
||||
}
|
||||
if ($this->sharedSessionID) {
|
||||
$this->deleteSharedSessionCookie();
|
||||
}
|
||||
}
|
||||
|
||||
protected function deleteSharedSessionCookie() {
|
||||
$cookie_name = $this->getSharedSessionCookieName();
|
||||
unset($_COOKIE[$cookie_name]);
|
||||
$base_domain = $this->getBaseDomain();
|
||||
setcookie($cookie_name, '', 1, '/', '.'.$base_domain);
|
||||
}
|
||||
|
||||
protected function getSharedSessionCookieName() {
|
||||
return self::FBSS_COOKIE_NAME . '_' . $this->getAppId();
|
||||
}
|
||||
|
||||
protected function constructSessionVariableName($key) {
|
||||
$parts = array('fb', $this->getAppId(), $key);
|
||||
if ($this->sharedSessionID) {
|
||||
array_unshift($parts, $this->sharedSessionID);
|
||||
}
|
||||
return implode('_', $parts);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,350 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Phoca Gallery
|
||||
* @author Jan Pavelka - https://www.phoca.cz
|
||||
* @copyright Copyright (C) Jan Pavelka https://www.phoca.cz
|
||||
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 and later
|
||||
* @cms Joomla
|
||||
* @copyright Copyright (C) Open Source Matters. All rights reserved.
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
|
||||
*/
|
||||
defined( '_JEXEC' ) or die( 'Restricted access' );
|
||||
if (is_file( JPATH_ADMINISTRATOR.'/components/com_phocagallery/libraries/phocagallery/facebook/base_facebook.php') &&
|
||||
is_file( JPATH_ADMINISTRATOR.'/components/com_phocagallery/libraries/phocagallery/facebook/facebook.php')) {
|
||||
if (class_exists('FacebookApiException') && class_exists('Facebook')) {
|
||||
} else {
|
||||
require_once( JPATH_ADMINISTRATOR.'/components/com_phocagallery/libraries/phocagallery/facebook/base_facebook.php');
|
||||
require_once( JPATH_ADMINISTRATOR.'/components/com_phocagallery/libraries/phocagallery/facebook/facebook.php');
|
||||
}
|
||||
}
|
||||
|
||||
class PhocaGalleryFb
|
||||
{
|
||||
private static $fb = array();
|
||||
|
||||
private function __construct(){}
|
||||
|
||||
public static function getAppInstance($appid, $appsid) {
|
||||
|
||||
if( !array_key_exists( $appid, self::$fb ) ) {
|
||||
$facebook = new Facebook(array(
|
||||
'appId' => $appid,
|
||||
'secret' => $appsid,
|
||||
'cookie' => false,
|
||||
));
|
||||
|
||||
self::$fb[$appid] = $facebook;
|
||||
}
|
||||
return self::$fb[$appid];
|
||||
}
|
||||
|
||||
public static function getSession() {
|
||||
|
||||
|
||||
}
|
||||
|
||||
public static function getFbStatus($appid, $appsid) {
|
||||
|
||||
$facebook = self::getAppInstance($appid, $appsid);
|
||||
|
||||
$fbLogout = JFactory::getApplication()->input->get('fblogout', 0, '', 'int');
|
||||
if($fbLogout == 1) {
|
||||
$facebook->destroySession();
|
||||
}
|
||||
|
||||
$fbuser = $facebook->getUser();
|
||||
|
||||
$session = array();
|
||||
$session['uid'] = $facebook->getUser();
|
||||
$session['secret'] = $facebook->getApiSecret();
|
||||
$session['access_token']= $facebook->getAccessToken();
|
||||
|
||||
$output = array();
|
||||
|
||||
|
||||
$u = null;
|
||||
// Session based API call.
|
||||
if ($fbuser) {
|
||||
try {
|
||||
$u = $facebook->api('/me');
|
||||
} catch (FacebookApiException $e) {
|
||||
error_log($e);
|
||||
}
|
||||
}
|
||||
|
||||
$uri = JURI::getInstance();
|
||||
// login or logout url will be needed depending on current user state.
|
||||
if ($u) {
|
||||
$uid = $facebook->getUser();
|
||||
$params = array('next' => $uri->toString() . '&fblogout=1' );
|
||||
$logoutUrl = $facebook->getLogoutUrl($params);
|
||||
|
||||
$output['log'] = 1;
|
||||
$output['html'] = '<div><img src="https://graph.facebook.com/'. $uid .'/picture" /></div>';
|
||||
$output['html'] .= '<div>'. $u['name'].'</div>';
|
||||
//$output['html'] .= '<div><a href="'. $logoutUrl .'"><img src="http://static.ak.fbcdn.net/rsrc.php/z2Y31/hash/cxrz4k7j.gif" /></a></div>';
|
||||
$output['html'] .= '<div><a href="'. $logoutUrl .'"><span class="btn btn-primary">'.JText::_('COM_PHOCAGALLERY_FB_LOGOUT').'</span></a></div><p> </p>';
|
||||
|
||||
/*
|
||||
$script = array();
|
||||
$fields = array('name', 'uid', 'base_domain', 'secret', 'session_key', 'access_token', 'sig');
|
||||
$script[] = 'function clearFbFields() {';
|
||||
foreach ($fields as $field) {
|
||||
$script[] = ' document.getElementById(\'jform_'.$field.'\').value = \'\';';
|
||||
}
|
||||
$script[] = '}';
|
||||
|
||||
// Add the script to the document head.
|
||||
JFactory::getDocument()->addScriptDeclaration(implode("\n", $script));
|
||||
$uri = JURI::getInstance();
|
||||
$loginUrl = $facebook->getLoginUrl(array('req_perms' => 'user_photos,user_groups,offline_access,publish_stream', 'cancel_url' => $uri->toString(), 'next' => $uri->toString()));
|
||||
|
||||
$output['log'] = 0;
|
||||
$output['html'] .= '<div><a onclick="clearFbFields()" href="'. $loginUrl .'">Clear and Fill data bu</a></div>';*/
|
||||
|
||||
} else {
|
||||
|
||||
|
||||
/*$loginUrl = $facebook->getLoginUrl(array('req_perms' => 'user_photos,user_groups,offline_access,publish_stream,photo_upload,manage_pages', 'scope' => 'user_photos,user_groups,offline_access,publish_stream,photo_upload,manage_pages', 'cancel_url' => $uri->toString(), 'next' => $uri->toString()));
|
||||
*/
|
||||
// v2.3
|
||||
/*
|
||||
$loginUrl = $facebook->getLoginUrl(array('req_perms' => 'user_photos,user_groups,manage_pages', 'scope' => 'user_photos,user_groups,manage_pages', 'cancel_url' => $uri->toString(), 'next' => $uri->toString()));
|
||||
*/
|
||||
// v2.5
|
||||
$loginUrl = $facebook->getLoginUrl(array('req_perms' => 'user_photos,manage_pages,publish_actions', 'scope' => 'user_photos,manage_pages,publish_actions', 'cancel_url' => $uri->toString(), 'next' => $uri->toString()));
|
||||
|
||||
$output['log'] = 0;
|
||||
$output['html'] = '<div><a href="'. $loginUrl .'"><span class="btn btn-primary">'.JText::_('COM_PHOCAGALLERY_FB_LOGIN').'</span></a></div><p> </p>';
|
||||
//$output['html'] = '<div><a href="'. $loginUrl .'"><img src="http://static.ak.fbcdn.net/rsrc.php/zB6N8/hash/4li2k73z.gif" /></a></div>';
|
||||
|
||||
}
|
||||
$output['u'] = $u;
|
||||
$output['session'] = $session;
|
||||
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static function getFbAlbums ($appid, $appidfanpage, $appsid, $session, $aid = 0, $albumN = array(), $next = '') {
|
||||
$facebook = self::getAppInstance($appid, $appsid);
|
||||
$facebook->setAccessToken($session['access_token']);
|
||||
|
||||
$albums['data'] = array();
|
||||
// Change the uid to fan page id => Fan PAGE has other UID
|
||||
$userID = $newUID = $session['uid'];
|
||||
|
||||
$nextS = '';
|
||||
if ($next != '') {
|
||||
$next = parse_url($next, PHP_URL_QUERY);
|
||||
$nextS = '?'.strip_tags($next);
|
||||
}
|
||||
|
||||
if (isset($appidfanpage) && $appidfanpage != '') {
|
||||
$newUID = $appidfanpage;
|
||||
$albums = $facebook->api("/".$newUID."/albums".$nextS);
|
||||
} else {
|
||||
$albums = $facebook->api("/me/albums".$nextS);
|
||||
}
|
||||
|
||||
/* $loginUrl = $facebook->getLoginUrl(array('scope' => 'user_photos'));
|
||||
if ($aid > 0) {
|
||||
// TO DO - if used
|
||||
$albums = $facebook->api(array('method' => 'photos.getAlbums', 'aids' => $aid));
|
||||
} else {
|
||||
//$albums = $facebook->api(array('method' => 'photos.getAlbums', 'uid' => $newUID));
|
||||
//$albums = $facebook->api(array('method' => 'photos.getAlbums'));
|
||||
$albums = $facebook->api("/me/albums");
|
||||
|
||||
} */
|
||||
if (!empty($albums['data'])) {
|
||||
$albumN[] = $albums['data'];
|
||||
}
|
||||
|
||||
if (isset($albums['paging']['next']) && $albums['paging']['next'] != '') {
|
||||
$albumN = self::getFbAlbums($appid, $appidfanpage, $appsid, $session, $aid, $albumN, $albums['paging']['next']);
|
||||
|
||||
|
||||
}
|
||||
|
||||
return $albumN;
|
||||
}
|
||||
|
||||
/* BY ID
|
||||
public function getFbAlbumsFan ($appid, $appsid, $session, $id = 0) {
|
||||
|
||||
$facebook = self::getAppInstance($appid, $appsid, $session);
|
||||
$facebook->setSession($session);
|
||||
$albums = false;
|
||||
$userID = $session['uid'];
|
||||
|
||||
if ($aid > 0) {
|
||||
$albums = $facebook->api('/' . $userID . '/albums');
|
||||
} else {
|
||||
$albums = $facebook->api('/' . $userID . '/albums');
|
||||
}
|
||||
return $albums['data'];
|
||||
}*/
|
||||
|
||||
|
||||
public static function getFbAlbumName ($appid, $appsid, $session, $aid) {
|
||||
$facebook = self::getAppInstance($appid, $appsid);
|
||||
$facebook->setAccessToken($session['access_token']);
|
||||
//$album = $facebook->api(array('method' => 'photos.getAlbums', 'aids' => $aid));
|
||||
$album = $facebook->api("/".$aid);
|
||||
$albumName = '';
|
||||
if (isset($album['name']) && $album['name'] != '') {
|
||||
$albumName = $album['name'];
|
||||
}
|
||||
return $albumName;
|
||||
}
|
||||
|
||||
public static function getFbImages ($appid, $appsid, $session, &$fbAfter, $aid = 0, $limit = 0 ) {
|
||||
$facebook = self::getAppInstance($appid, $appsid);
|
||||
$facebook->setAccessToken($session['access_token']);
|
||||
$images['data'] = array();
|
||||
|
||||
|
||||
$fields = 'id,name,source,picture,created,created_time,images';
|
||||
if ($aid > 0) {
|
||||
//$images = $facebook->api(array('method' => 'photos.get', 'aid' => $aid));
|
||||
if ((int)$limit > 0 && $fbAfter != '') {
|
||||
$images = $facebook->api("/".$aid."/photos", 'GET', array('limit' => $limit,'after' => $fbAfter, 'fields' => $fields));
|
||||
} else if ((int)$limit > 0 && $fbAfter == '') {
|
||||
$images = $facebook->api("/".$aid."/photos", 'GET', array('limit' => $limit, 'fields' => $fields));
|
||||
} else {
|
||||
$images = $facebook->api("/".$aid."/photos", 'GET', array('fields' => $fields));
|
||||
}
|
||||
}
|
||||
/*
|
||||
$images = $facebook->api("/".$aid."/photos");
|
||||
id (String
|
||||
created_time (String
|
||||
from (Array
|
||||
height (Integer
|
||||
icon (String
|
||||
images (Array
|
||||
link (String
|
||||
name (String
|
||||
picture (String
|
||||
source (String
|
||||
updated_time (String
|
||||
width (Integer */
|
||||
|
||||
|
||||
|
||||
$fbAfter = '';// Unset this variable and check again if there is still new after value (if there are more images to pagination)
|
||||
if (isset($images['paging'])) {
|
||||
$paging = $images['paging'];
|
||||
if (isset($paging['next']) && $paging['next'] != '') {
|
||||
$query = parse_url($paging['next'], PHP_URL_QUERY);
|
||||
parse_str($query, $parse);
|
||||
if (isset($parse['after'])) {
|
||||
$fbAfter = $parse['after']; // we return $fbAfter value in reference - new after value is set
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $images['data'];
|
||||
}
|
||||
|
||||
/*
|
||||
public static function getFbImages ($appid, $appsid, $session, $aid = 0) {
|
||||
$facebook = self::getAppInstance($appid, $appsid);
|
||||
$facebook->setAccessToken($session['access_token']);
|
||||
$images['data'] = array();
|
||||
|
||||
if ($aid > 0) {
|
||||
//$images = $facebook->api(array('method' => 'photos.get', 'aid' => $aid));
|
||||
$images = $facebook->api("/".$aid."/photos");
|
||||
}
|
||||
return $images['data'];
|
||||
}
|
||||
*/
|
||||
/*
|
||||
public static function getFbImages ($appid, $appsid, $session, $aid = 0) {
|
||||
$facebook = self::getAppInstance($appid, $appsid);
|
||||
$facebook->setAccessToken($session['access_token']);
|
||||
$images['data'] = array();
|
||||
|
||||
if ($aid > 0) {
|
||||
//$images = $facebook->api(array('method' => 'photos.get', 'aid' => $aid));
|
||||
//$images = $facebook->api("/".$aid."/photos");
|
||||
$limit = 25;
|
||||
$completeI = array();
|
||||
$partI = $facebook->api("/".$aid."/photos", 'GET', array('limit' => $limit) );
|
||||
|
||||
$completeI[0] = $partI['data'];
|
||||
$i = 1;
|
||||
while ($partI['data']) {
|
||||
$completeI[1] = $partI['data'];
|
||||
$paging = $partI['paging'];
|
||||
if (isset($paging['next']) && $paging['next'] != '') {
|
||||
$query = parse_url($paging['next'], PHP_URL_QUERY);
|
||||
parse_str($query, $par);
|
||||
if (isset($parse['limit']) && isset($parse['after'])) {
|
||||
$partI = $facebook->api("/".$aid."/photos", 'GET', array('limit' => $parse['limit'],'after' => $parse['after']));
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return $images['data'];
|
||||
} */
|
||||
|
||||
/* BY ID
|
||||
public static function getFbImagesFan ($appid, $appsid, $session, $id = 0) {
|
||||
|
||||
|
||||
$facebook = self::getAppInstance($appid, $appsid, $session);
|
||||
$facebook->setSession($session);
|
||||
$images = false;
|
||||
if ($id > 0) {
|
||||
$imagesFolder = $facebook->api('/' . $id . '/photos?limit=0');
|
||||
$images = $imagesFolder['data'];
|
||||
}
|
||||
return $images;
|
||||
}*/
|
||||
|
||||
public static function exportFbImage ($appid, $appidfanpage, $appsid, $session, $image, $aid = 0) {
|
||||
|
||||
$facebook = self::getAppInstance($appid, $appsid);
|
||||
$facebook->setAccessToken($session['access_token']);
|
||||
$facebook->setFileUploadSupport(true);
|
||||
|
||||
// Change the uid to fan page id => Fan PAGE has other UID
|
||||
$userID = $newUID = $session['uid'];
|
||||
$newToken = $session['access_token'];//Will be changed if needed (for fan page)
|
||||
if (isset($appidfanpage) && $appidfanpage != '') {
|
||||
$newUID = $appidfanpage;
|
||||
$params = array('access_token' => $session['access_token']);
|
||||
$accounts = $facebook->api('/'.$session['uid'].'/accounts', 'GET', $params);
|
||||
|
||||
foreach($accounts['data'] as $account) {
|
||||
if( $account['id'] == $appidfanpage || $account['name'] == $appidfanpage ){
|
||||
$newToken = $account['access_token'];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ($aid > 0) {
|
||||
//$export = $facebook->api(array('method' => 'photos.upload', 'aid' => $aid, 'uid' => $newUID, 'caption' => $image['caption'], $image['filename'] => '@'.$image['fileorigabs']));
|
||||
|
||||
$args = array('caption' => $image['caption'], 'aid' => $aid, 'uid' => $newUID, 'access_token' => $newToken);
|
||||
$args['image'] = '@'.$image['fileorigabs'];
|
||||
$export = $facebook->api('/'. $aid . '/photos', 'post', $args);
|
||||
|
||||
return $export;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public final function __clone() {
|
||||
throw new Exception('Function Error: Cannot clone instance of Singleton pattern', 500);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,151 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Phoca Gallery
|
||||
* @author Jan Pavelka - https://www.phoca.cz
|
||||
* @copyright Copyright (C) Jan Pavelka https://www.phoca.cz
|
||||
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 and later
|
||||
* @cms Joomla
|
||||
* @copyright Copyright (C) Open Source Matters. All rights reserved.
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\Registry\Registry;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Uri\Uri;
|
||||
class PhocaGalleryFbSystem
|
||||
{
|
||||
public static function setSessionData($data) {
|
||||
|
||||
$session = array();
|
||||
// Don't set the session, in other way the SIG will be not the same
|
||||
//$session['uid'] = $session['base_domain'] = $session['secret'] = '';
|
||||
//$session['access_token'] = $session['session_key'] = $session['sig'] = '';
|
||||
$session['expires'] = 0;
|
||||
|
||||
|
||||
if (isset($data->uid) && $data->uid != '') {$session['uid'] = $data->uid;}
|
||||
if (isset($data->base_domain) && $data->base_domain != '') {$session['base_domain'] = $data->base_domain;}
|
||||
if (isset($data->secret) && $data->secret != '') {$session['secret'] = $data->secret;}
|
||||
if (isset($data->session_key) && $data->session_key != '') {$session['session_key'] = $data->session_key;}
|
||||
if (isset($data->access_token) && $data->access_token != ''){$session['access_token'] = $data->access_token;}
|
||||
if (isset($data->sig) && $data->sig != '') {$session['sig'] = $data->sig;}
|
||||
|
||||
ksort($session);
|
||||
return $session;
|
||||
}
|
||||
|
||||
public static function getFbUserInfo ($id) {
|
||||
|
||||
$db = Factory::getDBO();
|
||||
|
||||
//build the list of categories
|
||||
$query = 'SELECT a.*'
|
||||
. ' FROM #__phocagallery_fb_users AS a'
|
||||
. ' WHERE a.id ='.(int)$id;
|
||||
$db->setQuery( $query );
|
||||
|
||||
|
||||
$item = $db->loadObject();
|
||||
return $item;
|
||||
}
|
||||
|
||||
public static function getCommentsParams($id) {
|
||||
|
||||
$o = array();
|
||||
$item = self::getFbUserInfo($id);
|
||||
|
||||
if(isset($item->appid)) {
|
||||
$o['fb_comment_app_id'] = $item->appid;
|
||||
}
|
||||
if(isset($item->comments) && $item->comments != '') {
|
||||
$registry = new Registry;
|
||||
$registry->loadString($item->comments);
|
||||
$item->comments = $registry->toArray();
|
||||
foreach($item->comments as $key => $value) {
|
||||
$o[$key] = $value;
|
||||
}
|
||||
|
||||
}
|
||||
return $o;
|
||||
}
|
||||
|
||||
public static function getImageFromCat($idCat, $idImg = 0) {
|
||||
|
||||
$db = Factory::getDBO();
|
||||
|
||||
$nextImg = '';
|
||||
if ($idImg > 0) {
|
||||
$nextImg = ' AND a.id > '.(int)$idImg;
|
||||
}
|
||||
|
||||
$query = 'SELECT a.*'
|
||||
.' FROM #__phocagallery AS a'
|
||||
.' WHERE a.catid = '.(int) $idCat
|
||||
.' AND a.published = 1'
|
||||
.' AND a.approved = 1'
|
||||
. $nextImg
|
||||
.' ORDER BY a.id ASC LIMIT 1';
|
||||
|
||||
$db->setQuery( $query );
|
||||
$item = $db->loadObject();
|
||||
|
||||
if(!isset($item->id) || (isset($item->id) && $item->id < 1)) {
|
||||
$img['end'] = 1;
|
||||
return $img;
|
||||
}
|
||||
|
||||
if (isset($item->description) && $item->description != '') {
|
||||
$img['caption'] = $item->title . ' - ' .$item->description;
|
||||
} else {
|
||||
$img['caption'] = $item->title;
|
||||
}
|
||||
//TO DO TEST EXT IMAGE
|
||||
if (isset($item->extid) && $item->extid != '') {
|
||||
$img['extid'] = $item->extid;
|
||||
}
|
||||
$img['id'] = $item->id;
|
||||
$img['title'] = $item->title;
|
||||
$img['filename'] = PhocaGalleryFile::getTitleFromFile($item->filename, 1);
|
||||
$img['fileorigabs'] = PhocaGalleryFile::getFileOriginal($item->filename);
|
||||
|
||||
return $img;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Used while pagination
|
||||
*/
|
||||
public static function renderProcessPage($id, $refreshUrl, $countInfo = '', $import = 0) {
|
||||
|
||||
if ($import == 0) {
|
||||
$stopText = Text::_( 'COM_PHOCAGALLERY_STOP_UPLOADING_FACEBOOK_IMAGES' );
|
||||
$dataText = Text::_('COM_PHOCAGALLERY_FB_UPLOADING_DATA');
|
||||
} else {
|
||||
$stopText = Text::_( 'COM_PHOCAGALLERY_STOP_IMPORTING_FACEBOOK_IMAGES' );
|
||||
$dataText = Text::_('COM_PHOCAGALLERY_FB_IMPORTING_DATA');
|
||||
}
|
||||
|
||||
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">' . "\n";
|
||||
echo '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-en" lang="en-en" dir="ltr" >'. "\n";
|
||||
echo '<head>'. "\n";
|
||||
echo '<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />'. "\n\n";
|
||||
echo '<title>'.$dataText.'</title>'. "\n";
|
||||
echo '<link rel="stylesheet" href="'.Uri::root(true).'/media/com_phocagallery/css/administrator/phocagallery.css" type="text/css" />';
|
||||
|
||||
echo '</head>'. "\n";
|
||||
echo '<body>'. "\n";
|
||||
|
||||
echo '<div style="text-align:right;padding:10px"><a style="font-family: sans-serif, Arial;font-weight:bold;color:#fc0000;font-size:14px;" href="index.php?option=com_phocagallery&task=phocagalleryc.edit&id='.(int)$id.'">' .$stopText.'</a></div>';
|
||||
|
||||
echo '<div id="loading-ext-img-processp" style="font-family: sans-serif, Arial;font-weight:normal;color:#666;font-size:14px;padding:10px"><div class="loading"><div class="ph-lds-ellipsis"><div></div><div></div><div></div><div></div></div><div> </div><div><center>'.$dataText.'</center></div>';
|
||||
|
||||
echo $countInfo;
|
||||
echo '</div></div>';
|
||||
|
||||
echo '<meta http-equiv="refresh" content="2;url='.$refreshUrl.'" />';
|
||||
echo '</body></html>';
|
||||
exit;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
@ -0,0 +1,204 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Phoca Gallery
|
||||
* @author Jan Pavelka - https://www.phoca.cz
|
||||
* @copyright Copyright (C) Jan Pavelka https://www.phoca.cz
|
||||
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 and later
|
||||
* @cms Joomla
|
||||
* @copyright Copyright (C) Open Source Matters. All rights reserved.
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
|
||||
*/
|
||||
defined( '_JEXEC' ) or die( 'Restricted access' );
|
||||
use Joomla\CMS\Object\CMSObject;
|
||||
use Joomla\CMS\Filesystem\File;
|
||||
use Joomla\CMS\Filesystem\Path;
|
||||
use Joomla\CMS\Factory;
|
||||
jimport( 'joomla.filesystem.folder' );
|
||||
jimport( 'joomla.filesystem.file' );
|
||||
phocagalleryimport('phocagallery.image.image');
|
||||
phocagalleryimport('phocagallery.path.path');
|
||||
|
||||
class PhocaGalleryFile
|
||||
{
|
||||
public static function getTitleFromFile(&$filename, $displayExt = 0) {
|
||||
|
||||
if (!isset($filename)) {
|
||||
$filename = '';
|
||||
}
|
||||
|
||||
$filename = str_replace('//', '/', $filename);
|
||||
$filename = str_replace('\\', '/', $filename);
|
||||
$folderArray = explode('/', $filename);// Explode the filename (folder and file name)
|
||||
$countFolderArray = count($folderArray);// Count this array
|
||||
$lastArrayValue = $countFolderArray - 1;// The last array value is (Count array - 1)
|
||||
|
||||
$title = new stdClass();
|
||||
$title->with_extension = $folderArray[$lastArrayValue];
|
||||
$title->without_extension = PhocaGalleryFile::removeExtension($folderArray[$lastArrayValue]);
|
||||
|
||||
if ($displayExt == 1) {
|
||||
return $title->with_extension;
|
||||
} else if ($displayExt == 0) {
|
||||
return $title->without_extension;
|
||||
} else {
|
||||
return $title;
|
||||
}
|
||||
}
|
||||
|
||||
public static function removeExtension($filename) {
|
||||
return substr($filename, 0, strrpos( $filename, '.' ));
|
||||
}
|
||||
|
||||
|
||||
public static function getMimeType($filename) {
|
||||
$ext = File::getExt($filename);
|
||||
switch(strtolower($ext)) {
|
||||
case 'png':
|
||||
$mime = 'image/png';
|
||||
break;
|
||||
case 'jpg':
|
||||
case 'jpeg':
|
||||
$mime = 'image/jpeg';
|
||||
break;
|
||||
case 'gif':
|
||||
$mime = 'image/gif';
|
||||
break;
|
||||
case 'webp':
|
||||
$mime = 'image/webp';
|
||||
break;
|
||||
case 'avif':
|
||||
$mime = 'image/avif';
|
||||
break;
|
||||
Default:
|
||||
$mime = '';
|
||||
break;
|
||||
}
|
||||
return $mime;
|
||||
}
|
||||
|
||||
public static function getFileSize($filename, $readable = 1) {
|
||||
|
||||
$path = PhocaGalleryPath::getPath();
|
||||
$fileNameAbs = Path::clean($path->image_abs . $filename);
|
||||
|
||||
if (!File::exists($fileNameAbs)) {
|
||||
$fileNameAbs = $path->image_abs_front . 'phoca_thumb_l_no_image.png';
|
||||
}
|
||||
|
||||
if ($readable == 1) {
|
||||
return PhocaGalleryFile::getFileSizeReadable(filesize($fileNameAbs));
|
||||
} else {
|
||||
return filesize($fileNameAbs);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* http://aidanlister.com/repos/v/function.size_readable.php
|
||||
*/
|
||||
public static function getFileSizeReadable ($size, $retstring = null, $onlyMB = false) {
|
||||
|
||||
if ($onlyMB) {
|
||||
$sizes = array('B', 'kB', 'MB');
|
||||
} else {
|
||||
$sizes = array('B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB');
|
||||
}
|
||||
|
||||
|
||||
if ($retstring === null) { $retstring = '%01.2f %s'; }
|
||||
$lastsizestring = end($sizes);
|
||||
|
||||
foreach ($sizes as $sizestring) {
|
||||
if ($size < 1024) { break; }
|
||||
if ($sizestring != $lastsizestring) { $size /= 1024; }
|
||||
}
|
||||
|
||||
if ($sizestring == $sizes[0]) { $retstring = '%01d %s'; } // Bytes aren't normally fractional
|
||||
return sprintf($retstring, $size, $sizestring);
|
||||
}
|
||||
|
||||
public static function getFileOriginal($filename, $rel = 0) {
|
||||
$path = PhocaGalleryPath::getPath();
|
||||
if ($rel == 1) {
|
||||
return str_replace('//', '/', $path->image_rel . $filename);
|
||||
} else {
|
||||
return Path::clean($path->image_abs . $filename);
|
||||
}
|
||||
}
|
||||
|
||||
public static function getFileFormat($filename) {
|
||||
$path = PhocaGalleryPath::getPath();
|
||||
$file = Path::clean($path->image_abs . $filename);
|
||||
$size = getimagesize($file);
|
||||
if (isset($size[0]) && isset($size[1]) && (int)$size[1] > (int)$size[0]) {
|
||||
return 2;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
public static function existsFileOriginal($filename) {
|
||||
$fileOriginal = PhocaGalleryFile::getFileOriginal($filename);
|
||||
if (File::exists($fileOriginal)) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static function deleteFile ($filename) {
|
||||
$fileOriginal = PhocaGalleryFile::getFileOriginal($filename);
|
||||
if (File::exists($fileOriginal)){
|
||||
File::delete($fileOriginal);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static function existsCss($file, $type) {
|
||||
$path = self::getCSSPath($type);
|
||||
if (file_exists($path.$file) && $file != '') {
|
||||
return $path.$file;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static function getCSSPath($type, $rel = 0) {
|
||||
$paths = PhocaGalleryPath::getPath();
|
||||
if ($rel == 1) {
|
||||
if ($type == 1) {
|
||||
return $paths->media_css_rel . 'main/';
|
||||
} else {
|
||||
return $paths->media_css_rel . 'custom/';
|
||||
}
|
||||
} else {
|
||||
if ($type == 1) {
|
||||
return Path::clean($paths->media_css_abs . 'main/');
|
||||
} else {
|
||||
return Path::clean($paths->media_css_abs . 'custom/');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static function getCSSFile($id = 0, $fullPath = 0) {
|
||||
if ((int)$id > 0) {
|
||||
$db = Factory::getDBO();
|
||||
$query = 'SELECT a.filename as filename, a.type as type'
|
||||
.' FROM #__phocagallery_styles AS a'
|
||||
.' WHERE a.id = '.(int) $id
|
||||
.' ORDER BY a.id';
|
||||
$db->setQuery($query, 0, 1);
|
||||
$filename = $db->loadObject();
|
||||
if (isset($filename->filename) && $filename->filename != '') {
|
||||
if ($fullPath == 1 && isset($filename->type)) {
|
||||
return self::getCSSPath($filename->type). $filename->filename;
|
||||
} else {
|
||||
return $filename->filename;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
?>
|
||||
@ -0,0 +1,124 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Phoca Gallery
|
||||
* @author Jan Pavelka - https://www.phoca.cz
|
||||
* @copyright Copyright (C) Jan Pavelka https://www.phoca.cz
|
||||
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 and later
|
||||
* @cms Joomla
|
||||
* @copyright Copyright (C) Open Source Matters. All rights reserved.
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
|
||||
*/
|
||||
defined( '_JEXEC' ) or die( 'Restricted access' );
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Filesystem\File;
|
||||
jimport( 'joomla.filesystem.folder' );
|
||||
jimport( 'joomla.filesystem.file' );
|
||||
|
||||
class PhocaGalleryFileDownload
|
||||
{
|
||||
public static function download($item, $backLink, $extLink = 0) {
|
||||
|
||||
|
||||
// If you comment or remove the following line, user will be able to download external images
|
||||
// but it can happen that such will be stored on your server in root (the example is picasa images)
|
||||
$extLink = 0;
|
||||
|
||||
$app = Factory::getApplication();
|
||||
|
||||
if (empty($item)) {
|
||||
$msg = Text::_('COM_PHOCAGALLERY_ERROR_DOWNLOADING_FILE');
|
||||
$app->enqueueMessage($msg, 'error');
|
||||
$app->redirect($backLink);
|
||||
return false;
|
||||
} else {
|
||||
if ($extLink == 0) {
|
||||
phocagalleryimport('phocagallery.file.file');
|
||||
$fileOriginal = PhocaGalleryFile::getFileOriginal($item->filenameno);
|
||||
|
||||
if (!File::exists($fileOriginal)) {
|
||||
$msg = Text::_('COM_PHOCAGALLERY_ERROR_DOWNLOADING_FILE');
|
||||
$app->enqueueMessage($msg, 'error');
|
||||
$app->redirect($backLink);
|
||||
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;
|
||||
|
||||
if ($extLink > 0) {
|
||||
$content = '';
|
||||
if (function_exists('curl_init')) {
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, $fileOriginal);
|
||||
curl_setopt($ch, CURLOPT_HEADER, 0);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
$downloadedFile = fopen($fileName, 'w+');
|
||||
curl_setopt($ch, CURLOPT_FILE, $downloadedFile);
|
||||
$content = curl_exec ($ch);
|
||||
$fileSize= strlen($content);
|
||||
curl_close ($ch);
|
||||
fclose($downloadedFile);
|
||||
}
|
||||
if ($content != '') {
|
||||
// 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);
|
||||
|
||||
header("Content-Length: ". (string)$fileSize);
|
||||
|
||||
header('Content-Disposition: attachment; filename="'.$fileName.'"');
|
||||
header("Content-Transfer-Encoding: binary\n");
|
||||
|
||||
echo $content;
|
||||
exit;
|
||||
|
||||
}
|
||||
} else {
|
||||
|
||||
// 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;
|
||||
|
||||
}
|
||||
}
|
||||
?>
|
||||
@ -0,0 +1,147 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Phoca Gallery
|
||||
* @author Jan Pavelka - https://www.phoca.cz
|
||||
* @copyright Copyright (C) Jan Pavelka https://www.phoca.cz
|
||||
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 and later
|
||||
* @cms Joomla
|
||||
* @copyright Copyright (C) Open Source Matters. All rights reserved.
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
|
||||
*/
|
||||
defined( '_JEXEC' ) or die( 'Restricted access' );
|
||||
use Joomla\CMS\Filesystem\Folder;
|
||||
use Joomla\CMS\Filesystem\File;
|
||||
use Joomla\CMS\Filesystem\Path;
|
||||
use Joomla\CMS\Component\ComponentHelper;
|
||||
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('\\', '/', $path->image_abs);
|
||||
|
||||
// Get the list of files and folders from the given folder
|
||||
$fileList = Folder::files($pathOrigImg, '', true, true);
|
||||
|
||||
// Iterate over the files if they exist
|
||||
if ($fileList !== false) {
|
||||
foreach ($fileList as $file) {
|
||||
if (File::exists($file) && substr($file, 0, 1) != '.' && strtolower($file) !== 'index.html') {
|
||||
|
||||
//Clean absolute path
|
||||
$file = str_replace('\\', '/', Path::clean($file));
|
||||
|
||||
$positions = strpos($file, "phoca_thumb_s_");//is there small thumbnail
|
||||
$positionm = strpos($file, "phoca_thumb_m_");//is there medium thumbnail
|
||||
$positionl = strpos($file, "phoca_thumb_l_");//is there large thumbnail
|
||||
|
||||
//Clean small thumbnails if original file doesn't exist
|
||||
if ($positions === false) {}
|
||||
else {
|
||||
$filenameThumbs = $file;//only thumbnails will be listed
|
||||
$fileNameOrigs = str_replace ('thumbs/phoca_thumb_s_', '', $file);//get fictive original files
|
||||
|
||||
//There is Thumbfile but not Originalfile - we delete it
|
||||
if (File::exists($filenameThumbs) && !File::exists($fileNameOrigs)) {
|
||||
File::delete($filenameThumbs);
|
||||
}
|
||||
// Reverse
|
||||
// $filenameThumb = PhocaGalleryHelper::getTitleFromFilenameWithExt($file);
|
||||
// $fileNameOriginal = PhocaGalleryHelper::getTitleFromFilenameWithExt($file);
|
||||
// $filenameThumb = str_replace ($fileNameOriginal, 'thumbs/phoca_thumb_m_' . $fileNameOriginal, $file);
|
||||
}
|
||||
|
||||
//Clean medium thumbnails if original file doesn't exist
|
||||
if ($positionm === false) {}
|
||||
else {
|
||||
$filenameThumbm = $file;//only thumbnails will be listed
|
||||
$fileNameOrigm = str_replace ('thumbs/phoca_thumb_m_', '', $file);//get fictive original files
|
||||
|
||||
//There is Thumbfile but not Originalfile - we delete it
|
||||
if (File::exists($filenameThumbm) && !File::exists($fileNameOrigm)) {
|
||||
File::delete($filenameThumbm);
|
||||
}
|
||||
}
|
||||
|
||||
//Clean large thumbnails if original file doesn't exist
|
||||
if ($positionl === false) {}
|
||||
else {
|
||||
$filenameThumbl = $file;//only thumbnails will be listed
|
||||
$fileNameOrigl = str_replace ('thumbs/phoca_thumb_l_', '', $file);//get fictive original files
|
||||
|
||||
//There is Thumbfile but not Originalfile - we delete it
|
||||
if (File::exists($filenameThumbl) && !File::exists($fileNameOrigl)) {
|
||||
File::delete($filenameThumbl);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static function createFolder($folder, &$errorMsg) {
|
||||
$paramsC = ComponentHelper::getParams('com_phocagallery');
|
||||
$folder_permissions = $paramsC->get( 'folder_permissions', 0755 );
|
||||
// Doesn't work on some servers
|
||||
//$folder_permissions = octdec((int)$folder_permissions);
|
||||
|
||||
$path = PhocaGalleryPath::getPath();
|
||||
$folder = Path::clean($path->image_abs . $folder);
|
||||
if (strlen($folder) > 0) {
|
||||
if (!Folder::exists($folder) && !File::exists($folder)) {
|
||||
|
||||
// Because of problems on some servers:
|
||||
// It is temporary solution
|
||||
switch((int)$folder_permissions) {
|
||||
case 777:
|
||||
Folder::create($folder, 0777 );
|
||||
break;
|
||||
case 705:
|
||||
Folder::create($folder, 0705 );
|
||||
break;
|
||||
case 666:
|
||||
Folder::create($folder, 0666 );
|
||||
break;
|
||||
case 644:
|
||||
Folder::create($folder, 0644 );
|
||||
break;
|
||||
case 755:
|
||||
Default:
|
||||
Folder::create($folder, 0755 );
|
||||
break;
|
||||
}
|
||||
//JFolder::create($folder, $folder_permissions );
|
||||
if (isset($folder)) {
|
||||
|
||||
$data = "<html>\n<body bgcolor=\"#FFFFFF\">\n</body>\n</html>";
|
||||
File::write($folder. '/'. "index.html", $data);
|
||||
}
|
||||
// folder was not created
|
||||
if (!Folder::exists($folder)) {
|
||||
$errorMsg = "CreatingFolder";
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
$errorMsg = "FolderExists";
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
$errorMsg = "FolderNameEmpty";
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
?>
|
||||
@ -0,0 +1,127 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Phoca Gallery
|
||||
* @author Jan Pavelka - https://www.phoca.cz
|
||||
* @copyright Copyright (C) Jan Pavelka https://www.phoca.cz
|
||||
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 and later
|
||||
* @cms Joomla
|
||||
* @copyright Copyright (C) Open Source Matters. All rights reserved.
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
|
||||
*/
|
||||
defined( '_JEXEC' ) or die( 'Restricted access' );
|
||||
use Joomla\CMS\Component\ComponentHelper;
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Filesystem\Path;
|
||||
use Joomla\CMS\Filesystem\Folder;
|
||||
use Joomla\CMS\Filesystem\File;
|
||||
use Joomla\CMS\Object\CMSObject;
|
||||
jimport( 'joomla.filesystem.folder' );
|
||||
jimport( 'joomla.filesystem.file' );
|
||||
phocagalleryimport('phocagallery.image.image');
|
||||
phocagalleryimport('phocagallery.path.path');
|
||||
phocagalleryimport('phocagallery.file.filefolder');
|
||||
setlocale(LC_ALL, 'C.UTF-8', 'C');
|
||||
|
||||
class PhocaGalleryFileFolderList
|
||||
{
|
||||
public static function getList($small = 0, $medium = 0, $large = 0, $refreshUrl = '') {
|
||||
static $list;
|
||||
|
||||
$params = ComponentHelper::getParams( 'com_phocagallery' );
|
||||
$clean_thumbnails = $params->get( 'clean_thumbnails', 0 );
|
||||
|
||||
// Only process the list once per request
|
||||
if (is_array($list)) {
|
||||
return $list;
|
||||
}
|
||||
|
||||
// Get current path from request
|
||||
$current = Factory::getApplication()->input->get('folder', '', 'path');
|
||||
|
||||
// If undefined, set to empty
|
||||
if ($current == 'undefined') {
|
||||
$current = '';
|
||||
}
|
||||
|
||||
//Get folder variables from Helper
|
||||
$path = PhocaGalleryPath::getPath();
|
||||
|
||||
// Initialize variables
|
||||
if (strlen($current) > 0) {
|
||||
$origPath = Path::clean($path->image_abs.$current);
|
||||
} else {
|
||||
$origPath = $path->image_abs;
|
||||
}
|
||||
$origPathServer = str_replace('\\', '/', $path->image_abs);
|
||||
|
||||
$images = array ();
|
||||
$folders = array ();
|
||||
|
||||
// Get the list of files and folders from the given folder
|
||||
$fileList = Folder::files($origPath);
|
||||
$folderList = Folder::folders($origPath, '', false, false, array(0 => 'thumbs'));
|
||||
|
||||
if(is_array($fileList) && !empty($fileList)) {
|
||||
natcasesort($fileList);
|
||||
}
|
||||
|
||||
$field = Factory::getApplication()->input->get('field');;
|
||||
$refreshUrl = $refreshUrl . '&folder='.$current.'&field='.$field;
|
||||
|
||||
|
||||
// Iterate over the files if they exist
|
||||
//file - abc.img, file_no - folder/abc.img
|
||||
if ($fileList !== false) {
|
||||
foreach ($fileList as $file) {
|
||||
|
||||
$ext = strtolower(File::getExt($file));
|
||||
// Don't display thumbnails from defined files (don't save them into a database)...
|
||||
$dontCreateThumb = PhocaGalleryFileThumbnail::dontCreateThumb($file);
|
||||
if ($dontCreateThumb == 1) {
|
||||
$ext = '';// WE USE $ext FOR NOT CREATE A THUMBNAIL CLAUSE
|
||||
}
|
||||
if ($ext == 'jpg' || $ext == 'png' || $ext == 'gif' || $ext == 'jpeg' || $ext == 'webp' || $ext == 'avif') {
|
||||
|
||||
if (File::exists($origPath. '/'. $file) && substr($file, 0, 1) != '.' && strtolower($file) !== 'index.html') {
|
||||
|
||||
//Create thumbnails small, medium, large
|
||||
$fileNo = $current . "/" . $file;
|
||||
$fileThumb = PhocaGalleryFileThumbnail::getOrCreateThumbnail($fileNo, $refreshUrl, $small, $medium, $large);
|
||||
|
||||
$tmp = new CMSObject();
|
||||
$tmp->name = $fileThumb['name'];
|
||||
$tmp->nameno = $fileThumb['name_no'];
|
||||
$tmp->linkthumbnailpath = $fileThumb['thumb_name_m_no_rel'];
|
||||
$tmp->linkthumbnailpathabs = $fileThumb['thumb_name_m_no_abs'];
|
||||
$images[] = $tmp;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Clean Thumbs Folder if there are thumbnail files but not original file
|
||||
if ($clean_thumbnails == 1) {
|
||||
PhocaGalleryFileFolder::cleanThumbsFolder();
|
||||
}
|
||||
// - - - - - - - - - - - -
|
||||
|
||||
// Iterate over the folders if they exist
|
||||
|
||||
if ($folderList !== false) {
|
||||
foreach ($folderList as $folder) {
|
||||
$tmp = new CMSObject();
|
||||
$tmp->name = basename($folder);
|
||||
$tmp->path_with_name = str_replace('\\', '/', Path::clean($origPath . '/'. $folder));
|
||||
$tmp->path_without_name_relative= $path->image_abs . str_replace($origPathServer, '', $tmp->path_with_name);
|
||||
$tmp->path_with_name_relative_no= str_replace($origPathServer, '', $tmp->path_with_name);
|
||||
|
||||
|
||||
$folders[] = $tmp;
|
||||
}
|
||||
}
|
||||
|
||||
$list = array('folders' => $folders, 'Images' => $images);
|
||||
return $list;
|
||||
}
|
||||
}
|
||||
?>
|
||||
@ -0,0 +1,675 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Phoca Gallery
|
||||
* @author Jan Pavelka - https://www.phoca.cz
|
||||
* @copyright Copyright (C) Jan Pavelka https://www.phoca.cz
|
||||
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 and later
|
||||
* @cms Joomla
|
||||
* @copyright Copyright (C) Open Source Matters. All rights reserved.
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
|
||||
*/
|
||||
defined( '_JEXEC' ) or die( 'Restricted access' );
|
||||
use Joomla\CMS\Object\CMSObject;
|
||||
use Joomla\CMS\Filesystem\Path;
|
||||
use Joomla\CMS\Filesystem\File;
|
||||
use Joomla\CMS\Component\ComponentHelper;
|
||||
use Joomla\CMS\Filesystem\Folder;
|
||||
jimport( 'joomla.filesystem.folder' );
|
||||
jimport( 'joomla.filesystem.file' );
|
||||
phocagalleryimport('phocagallery.path.path');
|
||||
phocagalleryimport('phocagallery.file.file');
|
||||
|
||||
class PhocaGalleryFileThumbnail
|
||||
{
|
||||
/*
|
||||
*Get thumbnailname
|
||||
*/
|
||||
public static function getThumbnailName($filename, $size) {
|
||||
|
||||
$path = PhocaGalleryPath::getPath();
|
||||
$title = PhocaGalleryFile::getTitleFromFile($filename , 1);
|
||||
|
||||
$thumbName = new CMSObject();
|
||||
|
||||
switch ($size) {
|
||||
case 'large':
|
||||
$fileNameThumb = 'phoca_thumb_l_'. $title;
|
||||
$thumbName->abs = Path::clean(str_replace($title, 'thumbs'. '/'. $fileNameThumb, $path->image_abs . $filename));
|
||||
$thumbName->rel = str_replace ($title, 'thumbs/' . $fileNameThumb, $path->image_rel . $filename);
|
||||
break;
|
||||
|
||||
case 'large1':
|
||||
$fileNameThumb = 'phoca_thumb_l1_'. $title;
|
||||
$thumbName->abs = Path::clean(str_replace($title, 'thumbs'. '/'. $fileNameThumb, $path->image_abs . $filename));
|
||||
$thumbName->rel = str_replace ($title, 'thumbs/' . $fileNameThumb, $path->image_rel . $filename);
|
||||
break;
|
||||
|
||||
case 'medium1':
|
||||
$fileNameThumb = 'phoca_thumb_m1_'. $title;
|
||||
$thumbName->abs = Path::clean(str_replace($title, 'thumbs' . '/'. $fileNameThumb, $path->image_abs . $filename));
|
||||
$thumbName->rel = str_replace ($title, 'thumbs/' . $fileNameThumb, $path->image_rel . $filename);
|
||||
break;
|
||||
|
||||
case 'medium2':
|
||||
$fileNameThumb = 'phoca_thumb_m2_'. $title;
|
||||
$thumbName->abs = Path::clean(str_replace($title, 'thumbs' . '/'. $fileNameThumb, $path->image_abs . $filename));
|
||||
$thumbName->rel = str_replace ($title, 'thumbs/' . $fileNameThumb, $path->image_rel . $filename);
|
||||
break;
|
||||
|
||||
case 'medium3':
|
||||
$fileNameThumb = 'phoca_thumb_m3_'. $title;
|
||||
$thumbName->abs = Path::clean(str_replace($title, 'thumbs' . '/'. $fileNameThumb, $path->image_abs . $filename));
|
||||
$thumbName->rel = str_replace ($title, 'thumbs/' . $fileNameThumb, $path->image_rel . $filename);
|
||||
break;
|
||||
|
||||
case 'medium':
|
||||
$fileNameThumb = 'phoca_thumb_m_'. $title;
|
||||
$thumbName->abs = Path::clean(str_replace($title, 'thumbs'. '/'. $fileNameThumb, $path->image_abs . $filename));
|
||||
$thumbName->rel = str_replace ($title, 'thumbs/' . $fileNameThumb, $path->image_rel . $filename);
|
||||
break;
|
||||
|
||||
|
||||
case 'small1':
|
||||
$fileNameThumb = 'phoca_thumb_s1_'. $title;
|
||||
$thumbName->abs = Path::clean(str_replace($title, 'thumbs' . '/'. $fileNameThumb, $path->image_abs . $filename));
|
||||
$thumbName->rel = str_replace ($title, 'thumbs/' . $fileNameThumb, $path->image_rel . $filename);
|
||||
break;
|
||||
|
||||
case 'small2':
|
||||
$fileNameThumb = 'phoca_thumb_s2_'. $title;
|
||||
$thumbName->abs = Path::clean(str_replace($title, 'thumbs' . '/'. $fileNameThumb, $path->image_abs . $filename));
|
||||
$thumbName->rel = str_replace ($title, 'thumbs/' . $fileNameThumb, $path->image_rel . $filename);
|
||||
break;
|
||||
|
||||
case 'small3':
|
||||
$fileNameThumb = 'phoca_thumb_s3_'. $title;
|
||||
$thumbName->abs = Path::clean(str_replace($title, 'thumbs' . '/'. $fileNameThumb, $path->image_abs . $filename));
|
||||
$thumbName->rel = str_replace ($title, 'thumbs/' . $fileNameThumb, $path->image_rel . $filename);
|
||||
break;
|
||||
|
||||
default:
|
||||
case 'small':
|
||||
$fileNameThumb = 'phoca_thumb_s_'. $title;
|
||||
$thumbName->abs = Path::clean(str_replace($title, 'thumbs' . '/'. $fileNameThumb, $path->image_abs . $filename));
|
||||
$thumbName->rel = str_replace ($title, 'thumbs/' . $fileNameThumb, $path->image_rel . $filename);
|
||||
break;
|
||||
}
|
||||
|
||||
$thumbName->rel = str_replace('//', '/', $thumbName->rel);
|
||||
|
||||
return $thumbName;
|
||||
}
|
||||
|
||||
public static function deleteFileThumbnail ($filename, $small=0, $medium=0, $large=0) {
|
||||
|
||||
if ($small == 1) {
|
||||
$fileNameThumbS = PhocaGalleryFileThumbnail::getThumbnailName ($filename, 'small');
|
||||
if (File::exists($fileNameThumbS->abs)) {
|
||||
File::delete($fileNameThumbS->abs);
|
||||
}
|
||||
$fileNameThumbS = PhocaGalleryFileThumbnail::getThumbnailName ($filename, 'small1');
|
||||
if (File::exists($fileNameThumbS->abs)) {
|
||||
File::delete($fileNameThumbS->abs);
|
||||
}
|
||||
$fileNameThumbS = PhocaGalleryFileThumbnail::getThumbnailName ($filename, 'small2');
|
||||
if (File::exists($fileNameThumbS->abs)) {
|
||||
File::delete($fileNameThumbS->abs);
|
||||
}
|
||||
$fileNameThumbS = PhocaGalleryFileThumbnail::getThumbnailName ($filename, 'small3');
|
||||
if (File::exists($fileNameThumbS->abs)) {
|
||||
File::delete($fileNameThumbS->abs);
|
||||
}
|
||||
}
|
||||
|
||||
if ($medium == 1) {
|
||||
$fileNameThumbM = PhocaGalleryFileThumbnail::getThumbnailName ($filename, 'medium');
|
||||
if (File::exists($fileNameThumbM->abs)) {
|
||||
File::delete($fileNameThumbM->abs);
|
||||
}
|
||||
$fileNameThumbM = PhocaGalleryFileThumbnail::getThumbnailName ($filename, 'medium1');
|
||||
if (File::exists($fileNameThumbM->abs)) {
|
||||
File::delete($fileNameThumbM->abs);
|
||||
}
|
||||
$fileNameThumbM = PhocaGalleryFileThumbnail::getThumbnailName ($filename, 'medium2');
|
||||
if (File::exists($fileNameThumbM->abs)) {
|
||||
File::delete($fileNameThumbM->abs);
|
||||
}
|
||||
$fileNameThumbM = PhocaGalleryFileThumbnail::getThumbnailName ($filename, 'medium3');
|
||||
if (File::exists($fileNameThumbM->abs)) {
|
||||
File::delete($fileNameThumbM->abs);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ($large == 1) {
|
||||
$fileNameThumbL = PhocaGalleryFileThumbnail::getThumbnailName ($filename, 'large');
|
||||
if (File::exists($fileNameThumbL->abs)) {
|
||||
File::delete($fileNameThumbL->abs);
|
||||
}
|
||||
$fileNameThumbL = PhocaGalleryFileThumbnail::getThumbnailName ($filename, 'large1');
|
||||
if (File::exists($fileNameThumbL->abs)) {
|
||||
File::delete($fileNameThumbL->abs);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* Main Thumbnail creating function
|
||||
*
|
||||
* file = abc.jpg
|
||||
* fileNo = folder/abc.jpg
|
||||
* if small, medium, large = 1, create small, medium, large thumbnail
|
||||
*/
|
||||
public static function getOrCreateThumbnail($fileNo, $refreshUrl, $small = 0, $medium = 0, $large = 0, $frontUpload = 0) {
|
||||
|
||||
|
||||
if ($frontUpload) {
|
||||
$returnFrontMessage = '';
|
||||
}
|
||||
|
||||
$onlyThumbnailInfo = 0;
|
||||
if ($small == 0 && $medium == 0 && $large == 0) {
|
||||
$onlyThumbnailInfo = 1;
|
||||
}
|
||||
|
||||
$paramsC = ComponentHelper::getParams('com_phocagallery');
|
||||
$additional_thumbnails = $paramsC->get( 'additional_thumbnails',0 );
|
||||
|
||||
$path = PhocaGalleryPath::getPath();
|
||||
$origPathServer = str_replace('//', '/', $path->image_abs);
|
||||
$file['name'] = PhocaGalleryFile::getTitleFromFile($fileNo, 1);
|
||||
$file['name_no'] = ltrim($fileNo, '/');
|
||||
$file['name_original_abs'] = PhocaGalleryFile::getFileOriginal($fileNo);
|
||||
$file['name_original_rel'] = PhocaGalleryFile::getFileOriginal($fileNo, 1);
|
||||
$file['path_without_file_name_original']= str_replace($file['name'], '', $file['name_original_abs']);
|
||||
$file['path_without_file_name_thumb'] = str_replace($file['name'], '', $file['name_original_abs'] . 'thumbs' . '/');
|
||||
//$file['path_without_name'] = str_replace('\\', '/', JPath::clean($origPathServer));
|
||||
//$file['path_with_name_relative_no'] = str_replace($origPathServer, '', $file['name_original']);
|
||||
/*
|
||||
$file['path_with_name_relative'] = $path['orig_rel_ds'] . str_replace($origPathServer, '', $file['name_original']);
|
||||
$file['path_with_name_relative_no'] = str_replace($origPathServer, '', $file['name_original']);
|
||||
|
||||
$file['path_without_name'] = str_replace('\\', '/', Path::clean($origPath.'/'));
|
||||
$file['path_without_name_relative'] = $path['orig_rel_ds'] . str_replace($origPathServer, '', $file['path_without_name']);
|
||||
$file['path_without_name_relative_no'] = str_replace($origPathServer, '', $file['path_without_name']);
|
||||
$file['path_without_name_thumbs'] = $file['path_without_name'] .'thumbs';
|
||||
$file['path_without_file_name_original'] = str_replace($file['name'], '', $file['name_original']);
|
||||
$file['path_without_name_thumbs_no'] = str_replace($file['name'], '', $file['name_original'] .'thumbs');*/
|
||||
|
||||
|
||||
$ext = strtolower(File::getExt($file['name']));
|
||||
switch ($ext) {
|
||||
case 'jpg':
|
||||
case 'png':
|
||||
case 'gif':
|
||||
case 'jpeg':
|
||||
case 'webp':
|
||||
case 'avif':
|
||||
|
||||
//Get File thumbnails name
|
||||
|
||||
$thumbNameS = PhocaGalleryFileThumbnail::getThumbnailName ($fileNo, 'small');
|
||||
$file['thumb_name_s_no_abs'] = $thumbNameS->abs;
|
||||
$file['thumb_name_s_no_rel'] = $thumbNameS->rel;
|
||||
|
||||
$thumbNameM = PhocaGalleryFileThumbnail::getThumbnailName ($fileNo, 'medium');
|
||||
$file['thumb_name_m_no_abs'] = $thumbNameM->abs;
|
||||
$file['thumb_name_m_no_rel'] = $thumbNameM->rel;
|
||||
|
||||
$thumbNameL = PhocaGalleryFileThumbnail::getThumbnailName ($fileNo, 'large');
|
||||
$file['thumb_name_l_no_abs'] = $thumbNameL->abs;
|
||||
$file['thumb_name_l_no_rel'] = $thumbNameL->rel;
|
||||
|
||||
|
||||
// Don't create thumbnails from watermarks...
|
||||
$dontCreateThumb = PhocaGalleryFileThumbnail::dontCreateThumb($file['name']);
|
||||
if ($dontCreateThumb == 1) {
|
||||
$onlyThumbnailInfo = 1; // WE USE $onlyThumbnailInfo FOR NOT CREATE A THUMBNAIL CLAUSE
|
||||
}
|
||||
|
||||
// We want only information from the pictures OR
|
||||
if ( $onlyThumbnailInfo == 0 ) {
|
||||
|
||||
$thumbInfo = $fileNo;
|
||||
//Create thumbnail folder if not exists
|
||||
$errorMsg = 'ErrorCreatingFolder';
|
||||
$creatingFolder = PhocaGalleryFileThumbnail::createThumbnailFolder($file['path_without_file_name_original'], $file['path_without_file_name_thumb'], $errorMsg );
|
||||
|
||||
switch ($errorMsg) {
|
||||
case 'Success':
|
||||
//case 'ThumbnailExists':
|
||||
case 'DisabledThumbCreation':
|
||||
//case 'OnlyInformation':
|
||||
break;
|
||||
|
||||
Default:
|
||||
|
||||
// BACKEND OR FRONTEND
|
||||
if ($frontUpload !=1) {
|
||||
PhocaGalleryRenderProcess::getProcessPage( $file['name'], $thumbInfo, $refreshUrl, $errorMsg, $frontUpload);
|
||||
exit;
|
||||
} else {
|
||||
$returnFrontMessage = $errorMsg;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
// Folder must exist
|
||||
if (Folder::exists($file['path_without_file_name_thumb'])) {
|
||||
|
||||
|
||||
// Thumbnails real size
|
||||
$tRS = array();
|
||||
|
||||
|
||||
$errorMsgS = $errorMsgM = $errorMsgL = '';
|
||||
//Small thumbnail
|
||||
if ($small == 1) {
|
||||
|
||||
$createSmall = PhocaGalleryFileThumbnail::createFileThumbnail($file['name_original_abs'], $thumbNameS->abs, 'small', $frontUpload, $errorMsgS);
|
||||
if ($additional_thumbnails == 2 || $additional_thumbnails == 3 || $additional_thumbnails == 7) {
|
||||
PhocaGalleryFileThumbnail::createFileThumbnail($file['name_original_abs'], str_replace('phoca_thumb_s_', 'phoca_thumb_s1_', $thumbNameS->abs), 'small1', $frontUpload, $errorMsgS);
|
||||
PhocaGalleryFileThumbnail::createFileThumbnail($file['name_original_abs'], str_replace('phoca_thumb_s_', 'phoca_thumb_s2_', $thumbNameS->abs), 'small2', $frontUpload, $errorMsgS);
|
||||
PhocaGalleryFileThumbnail::createFileThumbnail($file['name_original_abs'], str_replace('phoca_thumb_s_', 'phoca_thumb_s3_', $thumbNameS->abs), 'small3', $frontUpload, $errorMsgS);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Thumbnail real size
|
||||
if ($createSmall && File::exists($thumbNameS->abs)) {
|
||||
$size = getimagesize($thumbNameS->abs);
|
||||
if (isset($size[0])) {
|
||||
$tRS['s']['w'] = $size[0];
|
||||
}
|
||||
if (isset($size[1])) {
|
||||
$tRS['s']['h'] = $size[1];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$errorMsgS = 'ThumbnailExists';// in case we only need medium or large, because of if clause bellow
|
||||
}
|
||||
|
||||
//Medium thumbnail
|
||||
if ($medium == 1) {
|
||||
$createMedium = PhocaGalleryFileThumbnail::createFileThumbnail($file['name_original_abs'], $thumbNameM->abs, 'medium', $frontUpload, $errorMsgM);
|
||||
if ($additional_thumbnails == 1 || $additional_thumbnails == 3 || $additional_thumbnails == 7) {
|
||||
PhocaGalleryFileThumbnail::createFileThumbnail($file['name_original_abs'], str_replace('phoca_thumb_m_', 'phoca_thumb_m1_', $thumbNameM->abs), 'medium1', $frontUpload, $errorMsgM);
|
||||
PhocaGalleryFileThumbnail::createFileThumbnail($file['name_original_abs'], str_replace('phoca_thumb_m_', 'phoca_thumb_m2_', $thumbNameM->abs), 'medium2', $frontUpload, $errorMsgM);
|
||||
PhocaGalleryFileThumbnail::createFileThumbnail($file['name_original_abs'], str_replace('phoca_thumb_m_', 'phoca_thumb_m3_', $thumbNameM->abs), 'medium3', $frontUpload, $errorMsgM);
|
||||
|
||||
}
|
||||
|
||||
// Thumbnail real size
|
||||
if ($createMedium && File::exists($thumbNameM->abs)) {
|
||||
$size = getimagesize($thumbNameM->abs);
|
||||
if (isset($size[0])) {
|
||||
$tRS['m']['w'] = $size[0];
|
||||
}
|
||||
if (isset($size[1])) {
|
||||
$tRS['m']['h'] = $size[1];
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
$errorMsgM = 'ThumbnailExists'; // in case we only need small or large, because of if clause bellow
|
||||
}
|
||||
|
||||
//Large thumbnail
|
||||
if ($large == 1) {
|
||||
$createLarge = PhocaGalleryFileThumbnail::createFileThumbnail($file['name_original_abs'], $thumbNameL->abs, 'large', $frontUpload, $errorMsgL);
|
||||
if ($additional_thumbnails == 7) {
|
||||
PhocaGalleryFileThumbnail::createFileThumbnail($file['name_original_abs'], str_replace('phoca_thumb_l_', 'phoca_thumb_l1_', $thumbNameL->abs), 'large1', $frontUpload, $errorMsgL);
|
||||
}
|
||||
|
||||
// Thumbnail real size
|
||||
if ($createLarge && File::exists($thumbNameL->abs)) {
|
||||
|
||||
$size = getimagesize($thumbNameL->abs);
|
||||
if (isset($size[0])) {
|
||||
$tRS['l']['w'] = $size[0];
|
||||
}
|
||||
if (isset($size[1])) {
|
||||
$tRS['l']['h'] = $size[1];
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
$errorMsgL = 'ThumbnailExists'; // in case we only need small or medium, because of if clause bellow
|
||||
}
|
||||
|
||||
// Error messages for all 3 thumbnails (if the message contains error string, we got error
|
||||
// Other strings can be:
|
||||
// - ThumbnailExists - do not display error message nor success page
|
||||
// - OnlyInformation - do not display error message nor success page
|
||||
// - DisabledThumbCreation - do not display error message nor success page
|
||||
|
||||
$creatingSError = $creatingMError = $creatingLError = false;
|
||||
$creatingSError = preg_match("/Error/i", $errorMsgS);
|
||||
$creatingMError = preg_match("/Error/i", $errorMsgM);
|
||||
$creatingLError = preg_match("/Error/i", $errorMsgL);
|
||||
|
||||
|
||||
// Add info about real thumbnail sizes into database
|
||||
if ($creatingSError || $creatingMError || $creatingLError) {
|
||||
|
||||
} else {
|
||||
|
||||
|
||||
if ((isset($createSmall) && $createSmall) || (isset($createMedium) && $createMedium) || (isset($createLarge) && $createLarge)) {
|
||||
// Set it only when really new thumbnail was created
|
||||
|
||||
PhocaGalleryImage::updateRealThumbnailSizes($file['name_original_rel'], $tRS);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// BACKEND OR FRONTEND
|
||||
if ($frontUpload != 1) {
|
||||
|
||||
// There is an error while creating thumbnail in m or in s or in l
|
||||
if ($creatingSError || $creatingMError || $creatingLError) {
|
||||
// if all or two errors appear, we only display the last error message
|
||||
// because the errors in this case is the same
|
||||
if ($errorMsgS != '') {
|
||||
$creatingError = $errorMsgS;
|
||||
}
|
||||
if ($errorMsgM != '') {
|
||||
$creatingError = $errorMsgM;
|
||||
}
|
||||
if ($errorMsgL != '') {
|
||||
$creatingError = $errorMsgL;
|
||||
}
|
||||
|
||||
PhocaGalleryRenderProcess::getProcessPage( $file['name'], $thumbInfo, $refreshUrl, $creatingError);exit;
|
||||
} else if ($errorMsgS == '' && $errorMsgM == '' && $errorMsgL == '') {
|
||||
PhocaGalleryRenderProcess::getProcessPage( $file['name'], $thumbInfo, $refreshUrl);exit;
|
||||
} else if ($errorMsgS == '' && $errorMsgM == '' && $errorMsgL == 'ThumbnailExists') {
|
||||
PhocaGalleryRenderProcess::getProcessPage( $file['name'], $thumbInfo, $refreshUrl);exit;
|
||||
} else if ($errorMsgS == '' && $errorMsgM == 'ThumbnailExists' && $errorMsgL == 'ThumbnailExists') {
|
||||
PhocaGalleryRenderProcess::getProcessPage( $file['name'], $thumbInfo, $refreshUrl);exit;
|
||||
} else if ($errorMsgS == '' && $errorMsgM == 'ThumbnailExists' && $errorMsgL == '') {
|
||||
PhocaGalleryRenderProcess::getProcessPage( $file['name'], $thumbInfo, $refreshUrl);exit;
|
||||
} else if ($errorMsgS == 'ThumbnailExists' && $errorMsgM == 'ThumbnailExists' && $errorMsgL == '') {
|
||||
PhocaGalleryRenderProcess::getProcessPage( $file['name'], $thumbInfo, $refreshUrl);exit;
|
||||
} else if ($errorMsgS == 'ThumbnailExists' && $errorMsgM == '' && $errorMsgL == '') {
|
||||
PhocaGalleryRenderProcess::getProcessPage( $file['name'], $thumbInfo, $refreshUrl);exit;
|
||||
} else if ($errorMsgS == 'ThumbnailExists' && $errorMsgM == '' && $errorMsgL == 'ThumbnailExists') {
|
||||
PhocaGalleryRenderProcess::getProcessPage( $file['name'], $thumbInfo, $refreshUrl);exit;
|
||||
}
|
||||
} else {
|
||||
// There is an error while creating thumbnail in m or in s or in l
|
||||
if ($creatingSError || $creatingMError || $creatingLError) {
|
||||
// if all or two errors appear, we only display the last error message
|
||||
// because the errors in this case is the same
|
||||
if ($errorMsgS != '') {
|
||||
$creatingError = $errorMsgS;
|
||||
}
|
||||
if ($errorMsgM != '') {
|
||||
$creatingError = $errorMsgM;
|
||||
}
|
||||
if ($errorMsgL != '') {
|
||||
$creatingError = $errorMsgL;
|
||||
} // because the errors in this case is the same
|
||||
|
||||
$returnFrontMessage = $creatingError;
|
||||
} else if ($errorMsgS == '' && $errorMsgM == '' && $errorMsgL == '') {
|
||||
$returnFrontMessage = 'Success';
|
||||
} else if ($errorMsgS == '' && $errorMsgM == '' && $errorMsgL == 'ThumbnailExists') {
|
||||
$returnFrontMessage = 'Success';
|
||||
} else if ($errorMsgS == '' && $errorMsgM == 'ThumbnailExists' && $errorMsgL == 'ThumbnailExists') {
|
||||
$returnFrontMessage = 'Success';
|
||||
} else if ($errorMsgS == '' && $errorMsgM == 'ThumbnailExists' && $errorMsgL == '') {
|
||||
$returnFrontMessage = 'Success';
|
||||
} else if ($errorMsgS == 'ThumbnailExists' && $errorMsgM == 'ThumbnailExists' && $errorMsgL == '') {
|
||||
$returnFrontMessage = 'Success';
|
||||
} else if ($errorMsgS == 'ThumbnailExists' && $errorMsgM == '' && $errorMsgL == '') {
|
||||
$returnFrontMessage = 'Success';
|
||||
} else if ($errorMsgS == 'ThumbnailExists' && $errorMsgM == '' && $errorMsgL == 'ThumbnailExists') {
|
||||
$returnFrontMessage = 'Success';
|
||||
}
|
||||
}
|
||||
|
||||
if ($frontUpload == 1) {
|
||||
return $returnFrontMessage;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
return $file;
|
||||
}
|
||||
|
||||
public static function dontCreateThumb ($filename) {
|
||||
$dontCreateThumb = false;
|
||||
$dontCreateThumbArray = array ('watermark-large.png', 'watermark-medium.png');
|
||||
foreach ($dontCreateThumbArray as $key => $value) {
|
||||
if (strtolower($filename) == strtolower($value)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static function createThumbnailFolder($folderOriginal, $folderThumbnail, &$errorMsg) {
|
||||
|
||||
$paramsC = ComponentHelper::getParams('com_phocagallery');
|
||||
$enable_thumb_creation = $paramsC->get( 'enable_thumb_creation', 1 );
|
||||
$folder_permissions = $paramsC->get( 'folder_permissions', 0755 );
|
||||
//$folder_permissions = octdec((int)$folder_permissions);
|
||||
|
||||
// disable or enable the thumbnail creation
|
||||
if ($enable_thumb_creation == 1) {
|
||||
|
||||
if (Folder::exists($folderOriginal)) {
|
||||
if (strlen($folderThumbnail) > 0) {
|
||||
$folderThumbnail = Path::clean($folderThumbnail);
|
||||
if (!Folder::exists($folderThumbnail) && !File::exists($folderThumbnail)) {
|
||||
switch((int)$folder_permissions) {
|
||||
case 777:
|
||||
Folder::create($folderThumbnail, 0777 );
|
||||
break;
|
||||
case 705:
|
||||
Folder::create($folderThumbnail, 0705 );
|
||||
break;
|
||||
case 666:
|
||||
Folder::create($folderThumbnail, 0666 );
|
||||
break;
|
||||
case 644:
|
||||
Folder::create($folderThumbnail, 0644 );
|
||||
break;
|
||||
case 755:
|
||||
Default:
|
||||
Folder::create($folderThumbnail, 0755 );
|
||||
break;
|
||||
}
|
||||
|
||||
//JFolder::create($folderThumbnail, $folder_permissions );
|
||||
if (isset($folderThumbnail)) {
|
||||
$data = "<html>\n<body bgcolor=\"#FFFFFF\">\n</body>\n</html>";
|
||||
File::write($folderThumbnail. '/'. "index.html", $data);
|
||||
}
|
||||
// folder was not created
|
||||
if (!Folder::exists($folderThumbnail)) {
|
||||
$errorMsg = 'ErrorCreatingFolder';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$errorMsg = 'Success';
|
||||
|
||||
return true;
|
||||
} else {
|
||||
$errorMsg = 'DisabledThumbCreation';
|
||||
return false; // User have disabled the thumbanil creation e.g. because of error
|
||||
}
|
||||
}
|
||||
|
||||
public static function createFileThumbnail($fileOriginal, $fileThumbnail, $size, $frontUpload=0, &$errorMsg = '') {
|
||||
|
||||
$paramsC = ComponentHelper::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':
|
||||
case 'large1':
|
||||
$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 (File::exists($fileOriginal)) {
|
||||
//file doesn't exist, create thumbnail
|
||||
if (!File::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;
|
||||
}
|
||||
}
|
||||
|
||||
public static function getThumbnailResize($size = 'all') {
|
||||
|
||||
// Get width and height from Default settings
|
||||
$params = ComponentHelper::getParams('com_phocagallery') ;
|
||||
$large_image_width = $params->get( 'large_image_width', 640 );
|
||||
$large_image_height = $params->get( 'large_image_height', 480 );
|
||||
$medium_image_width = $params->get( 'medium_image_width', 256 );
|
||||
$medium_image_height= $params->get( 'medium_image_height', 192 );
|
||||
$small_image_width = $params->get( 'small_image_width', 128 );
|
||||
$small_image_height = $params->get( 'small_image_height', 96 );
|
||||
$additional_thumbnail_margin = $params->get( 'additional_thumbnail_margin', 0 );
|
||||
|
||||
switch ($size) {
|
||||
case 'large':
|
||||
$fileResize['width'] = $large_image_width;
|
||||
$fileResize['height'] = $large_image_height;
|
||||
break;
|
||||
|
||||
case 'medium':
|
||||
$fileResize['width'] = $medium_image_width;
|
||||
$fileResize['height'] = $medium_image_height;
|
||||
break;
|
||||
|
||||
case 'medium1':
|
||||
$fileResize['width'] = $medium_image_width;
|
||||
$fileResize['height'] = ((int)$medium_image_height * 2) + (int)$additional_thumbnail_margin;
|
||||
break;
|
||||
|
||||
case 'medium2':
|
||||
$fileResize['width'] = (int)$medium_image_width * 2;
|
||||
$fileResize['height'] = $medium_image_height;
|
||||
break;
|
||||
|
||||
case 'medium3':
|
||||
$fileResize['width'] = (int)$medium_image_width * 2;
|
||||
$fileResize['height'] = (int)$medium_image_height * 2;
|
||||
break;
|
||||
|
||||
case 'small':
|
||||
$fileResize['width'] = $small_image_width;
|
||||
$fileResize['height'] = $small_image_height;
|
||||
break;
|
||||
|
||||
case 'small1':
|
||||
$fileResize['width'] = $small_image_width;
|
||||
$fileResize['height'] = (int)$small_image_height * 2;
|
||||
break;
|
||||
|
||||
case 'small2':
|
||||
$fileResize['width'] = (int)$small_image_width * 2;
|
||||
$fileResize['height'] = $small_image_height;
|
||||
break;
|
||||
|
||||
case 'small3':
|
||||
$fileResize['width'] = (int)$small_image_width * 2;
|
||||
$fileResize['height'] = (int)$small_image_height * 2;
|
||||
break;
|
||||
|
||||
case 'large1':
|
||||
$fileResize['width'] = $large_image_width;
|
||||
$scale = (int)$large_image_height / $medium_image_height;
|
||||
$fileResize['height'] = ((int)$large_image_height * 2) + ((int)$additional_thumbnail_margin * $scale);
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
case 'all':
|
||||
$fileResize['smallwidth'] = $small_width;
|
||||
$fileResize['smallheight'] = $small_height;
|
||||
$fileResize['mediumwidth'] = $medium_width;
|
||||
$fileResize['mediumheight'] = $medium_height;
|
||||
$fileResize['largewidth'] = $large_width;
|
||||
$fileResize['largeheight'] = $large_height;
|
||||
break;
|
||||
}
|
||||
return $fileResize;
|
||||
}
|
||||
}
|
||||
?>
|
||||
@ -0,0 +1,815 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Phoca Gallery
|
||||
* @author Jan Pavelka - https://www.phoca.cz
|
||||
* @copyright Copyright (C) Jan Pavelka https://www.phoca.cz
|
||||
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 and later
|
||||
* @cms Joomla
|
||||
* @copyright Copyright (C) Open Source Matters. All rights reserved.
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
|
||||
*/
|
||||
|
||||
use Joomla\CMS\Filesystem\File;
|
||||
|
||||
defined( '_JEXEC' ) or die( 'Restricted access' );
|
||||
use Joomla\CMS\Component\ComponentHelper;
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Session\Session;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Client\ClientHelper;
|
||||
use Joomla\CMS\Filesystem\Path;
|
||||
use Joomla\CMS\Filesystem\Folder;
|
||||
use Joomla\CMS\Uri\Uri;
|
||||
use Joomla\CMS\HTML\HTMLHelper;
|
||||
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 = ComponentHelper::getParams('com_phocagallery');
|
||||
$chunkMethod = $paramsC->get( 'multiple_upload_chunk', 0 );
|
||||
$uploadMethod = $paramsC->get( 'multiple_upload_method', 4 );
|
||||
|
||||
$app = Factory::getApplication();
|
||||
$app->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");
|
||||
|
||||
// Invalid Token
|
||||
Session::checkToken( 'request' ) or jexit(json_encode(array( 'jsonrpc' => '2.0', 'result' => 'error', 'code' => 100,
|
||||
'message' => Text::_('COM_PHOCAGALLERY_ERROR').': ',
|
||||
'details' => Text::_('COM_PHOCAGALLERY_INVALID_TOKEN'))));
|
||||
|
||||
// Set FTP credentials, if given
|
||||
$ftp = ClientHelper::setCredentialsFromRequest('ftp');
|
||||
|
||||
$path = PhocaGalleryPath::getPath();
|
||||
$file = Factory::getApplication()->input->files->get( 'file', null );
|
||||
$chunk = Factory::getApplication()->input->get( 'chunk', 0, '', 'int' );
|
||||
$chunks = Factory::getApplication()->input->get( 'chunks', 0, '', 'int' );
|
||||
$folder = Factory::getApplication()->input->get( 'folder', '', '', 'path' );
|
||||
|
||||
// Make the filename safe
|
||||
if (isset($file['name'])) {
|
||||
$file['name'] = File::makeSafe($file['name']);
|
||||
}
|
||||
if (isset($folder) && $folder != '') {
|
||||
$folder = $folder . '/';
|
||||
}
|
||||
|
||||
$chunkEnabled = 0;
|
||||
// Chunk only if is enabled and only if flash is enabled
|
||||
if (($chunkMethod == 1 && $uploadMethod == 1) || ($frontEnd == 0 && $chunkMethod == 0 && $uploadMethod == 1)) {
|
||||
$chunkEnabled = 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if (isset($file['name'])) {
|
||||
|
||||
|
||||
// - - - - - - - - - -
|
||||
// Chunk Method
|
||||
// - - - - - - - - - -
|
||||
// $chunkMethod = 1, for frontend and backend
|
||||
// $chunkMethod = 0, only for backend
|
||||
if ($chunkEnabled == 1) {
|
||||
|
||||
// If chunk files are used, we need to upload parts to temp directory
|
||||
// and then we can run e.g. the condition to recognize if the file already exists
|
||||
// We must upload the parts to temp, in other case we get everytime the info
|
||||
// that the file exists (because the part has the same name as the file)
|
||||
// so after first part is uploaded, in fact the file already exists
|
||||
// Example: NOT USING CHUNK
|
||||
// If we upload abc.jpg file to server and there is the same file
|
||||
// we compare it and can recognize, there is one, don't upload it again.
|
||||
// Example: USING CHUNK
|
||||
// If we upload abc.jpg file to server and there is the same file
|
||||
// the part of current file will overwrite the same file
|
||||
// and then (after all parts will be uploaded) we can make the condition to compare the file
|
||||
// and we recognize there is one - ok don't upload it BUT the file will be damaged by
|
||||
// parts uploaded by the new file - so this is why we are using temp file in Chunk method
|
||||
$stream = Factory::getStream();// Chunk Files
|
||||
$tempFolder = 'pgpluploadtmpfolder/';
|
||||
$filepathImgFinal = Path::clean($path->image_abs.$folder.strtolower($file['name']));
|
||||
$filepathImgTemp = Path::clean($path->image_abs.$folder.$tempFolder.strtolower($file['name']));
|
||||
$filepathFolderFinal = Path::clean($path->image_abs.$folder);
|
||||
$filepathFolderTemp = Path::clean($path->image_abs.$folder.$tempFolder);
|
||||
$maxFileAge = 60 * 60; // Temp file age in seconds
|
||||
$lastChunk = $chunk + 1;
|
||||
$realSize = 0;
|
||||
|
||||
// Get the real size - if chunk is uploaded, it is only a part size, so we must compute all size
|
||||
// If there is last chunk we can computhe the whole size
|
||||
if ($lastChunk == $chunks) {
|
||||
if (File::exists($filepathImgTemp) && File::exists($file['tmp_name'])) {
|
||||
$realSize = filesize($filepathImgTemp) + filesize($file['tmp_name']);
|
||||
}
|
||||
}
|
||||
|
||||
// 5 minutes execution time
|
||||
@set_time_limit(5 * 60);// usleep(5000);
|
||||
|
||||
// If the file already exists on the server:
|
||||
// - don't copy the temp file to final
|
||||
// - remove all parts in temp file
|
||||
// Because some parts are uploaded before we can run the condition
|
||||
// to recognize if the file already exists.
|
||||
if (File::exists($filepathImgFinal)) {
|
||||
if($lastChunk == $chunks){
|
||||
@Folder::delete($filepathFolderTemp);
|
||||
}
|
||||
|
||||
jexit(json_encode(array( 'jsonrpc' => '2.0', 'result' => 'error', 'code' => 108,
|
||||
'message' => Text::_('COM_PHOCAGALLERY_ERROR').': ',
|
||||
'details' => Text::_('COM_PHOCAGALLERY_FILE_ALREADY_EXISTS'))));
|
||||
}
|
||||
|
||||
if (!PhocaGalleryFileUpload::canUpload( $file, $errUploadMsg, $frontEnd, $chunkEnabled, $realSize )) {
|
||||
|
||||
// If there is some error, remove the temp folder with temp files
|
||||
if($lastChunk == $chunks){
|
||||
@Folder::delete($filepathFolderTemp);
|
||||
}
|
||||
jexit(json_encode(array( 'jsonrpc' => '2.0', 'result' => 'error', 'code' => 104,
|
||||
'message' => Text::_('COM_PHOCAGALLERY_ERROR').': ',
|
||||
'details' => Text::_($errUploadMsg))));
|
||||
}
|
||||
|
||||
// Ok create temp folder and add chunks
|
||||
if (!Folder::exists($filepathFolderTemp)) {
|
||||
@Folder::create($filepathFolderTemp);
|
||||
}
|
||||
|
||||
// Remove old temp files
|
||||
if (Folder::exists($filepathFolderTemp)) {
|
||||
$dirFiles = Folder::files($filepathFolderTemp);
|
||||
if (!empty($dirFiles)) {
|
||||
foreach ($dirFiles as $fileS) {
|
||||
$filePathImgS = $filepathFolderTemp . $fileS;
|
||||
// Remove temp files if they are older than the max age
|
||||
if (preg_match('/\\.tmp$/', $fileS) && (filemtime($filepathImgTemp) < time() - $maxFileAge)) {
|
||||
@File::delete($filePathImgS);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
jexit(json_encode(array( 'jsonrpc' => '2.0', 'result' => 'error', 'code' => 100,
|
||||
'message' => Text::_('COM_PHOCAGALLERY_ERROR').': ',
|
||||
'details' => Text::_('COM_PHOCAGALLERY_ERROR_FOLDER_UPLOAD_NOT_EXISTS'))));
|
||||
}
|
||||
|
||||
// Look for the content type header
|
||||
if (isset($_SERVER["HTTP_CONTENT_TYPE"]))
|
||||
$contentType = $_SERVER["HTTP_CONTENT_TYPE"];
|
||||
|
||||
if (isset($_SERVER["CONTENT_TYPE"]))
|
||||
$contentType = $_SERVER["CONTENT_TYPE"];
|
||||
|
||||
if (strpos($contentType, "multipart") !== false) {
|
||||
if (isset($file['tmp_name']) && is_uploaded_file($file['tmp_name'])) {
|
||||
|
||||
// Open temp file
|
||||
$out = $stream->open($filepathImgTemp, $chunk == 0 ? "wb" : "ab");
|
||||
//$out = fopen($filepathImgTemp, $chunk == 0 ? "wb" : "ab");
|
||||
if ($out) {
|
||||
// Read binary input stream and append it to temp file
|
||||
$in = fopen($file['tmp_name'], "rb");
|
||||
if ($in) {
|
||||
while ($buff = fread($in, 4096)) {
|
||||
$stream->write($buff);
|
||||
//fwrite($out, $buff);
|
||||
}
|
||||
} else {
|
||||
jexit(json_encode(array( 'jsonrpc' => '2.0', 'result' => 'error', 'code' => 101,
|
||||
'message' => Text::_('COM_PHOCAGALLERY_ERROR').': ',
|
||||
'details' => Text::_('COM_PHOCAGALLERY_ERROR_OPEN_INPUT_STREAM'))));
|
||||
}
|
||||
$stream->close();
|
||||
//fclose($out);
|
||||
@File::delete($file['tmp_name']);
|
||||
} else {
|
||||
jexit(json_encode(array( 'jsonrpc' => '2.0', 'result' => 'error', 'code' => 102,
|
||||
'message' => Text::_('COM_PHOCAGALLERY_ERROR').': ',
|
||||
'details' => Text::_('COM_PHOCAGALLERY_ERROR_OPEN_OUTPUT_STREAM'))));
|
||||
}
|
||||
} else {
|
||||
jexit(json_encode(array( 'jsonrpc' => '2.0', 'result' => 'error', 'code' => 103,
|
||||
'message' => Text::_('COM_PHOCAGALLERY_ERROR').': ',
|
||||
'details' => Text::_('COM_PHOCAGALLERY_ERROR_MOVE_UPLOADED_FILE'))));
|
||||
}
|
||||
} else {
|
||||
// Open temp file
|
||||
$out = $stream->open($filepathImgTemp, $chunk == 0 ? "wb" : "ab");
|
||||
//$out = JFile::read($filepathImg);
|
||||
if ($out) {
|
||||
// Read binary input stream and append it to temp file
|
||||
$in = fopen("php://input", "rb");
|
||||
|
||||
if ($in) {
|
||||
while ($buff = fread($in, 4096)) {
|
||||
$stream->write($buff);
|
||||
}
|
||||
} else {
|
||||
jexit(json_encode(array( 'jsonrpc' => '2.0', 'result' => 'error', 'code' => 101,
|
||||
'message' => Text::_('COM_PHOCAGALLERY_ERROR').': ',
|
||||
'details' => Text::_('COM_PHOCAGALLERY_ERROR_OPEN_INPUT_STREAM'))));
|
||||
}
|
||||
$stream->close();
|
||||
//fclose($out);
|
||||
} else {
|
||||
jexit(json_encode(array( 'jsonrpc' => '2.0', 'result' => 'error', 'code' => 102,
|
||||
'message' => Text::_('COM_PHOCAGALLERY_ERROR').': ',
|
||||
'details' => Text::_('COM_PHOCAGALLERY_ERROR_OPEN_OUTPUT_STREAM'))));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Rename the Temp File to Final File
|
||||
if($lastChunk == $chunks){
|
||||
|
||||
if(($imginfo = getimagesize($filepathImgTemp)) === FALSE) {
|
||||
Folder::delete($filepathFolderTemp);
|
||||
jexit(json_encode(array( 'jsonrpc' => '2.0', 'result' => 'error', 'code' => 110,
|
||||
'message' => Text::_('COM_PHOCAGALLERY_ERROR').': ',
|
||||
'details' => Text::_('COM_PHOCAGALLERY_WARNING_INVALIDIMG'))));
|
||||
}
|
||||
|
||||
|
||||
if(!File::move($filepathImgTemp, $filepathImgFinal)) {
|
||||
|
||||
Folder::delete($filepathFolderTemp);
|
||||
|
||||
jexit(json_encode(array( 'jsonrpc' => '2.0', 'result' => 'error', 'code' => 109,
|
||||
'message' => Text::_('COM_PHOCAGALLERY_ERROR').': ',
|
||||
'details' => Text::_('COM_PHOCAGALLERY_ERROR_UNABLE_TO_MOVE_FILE') .'<br />'
|
||||
. Text::_('COM_PHOCAGALLERY_CHECK_PERMISSIONS_OWNERSHIP'))));
|
||||
}
|
||||
|
||||
|
||||
Folder::delete($filepathFolderTemp);
|
||||
}
|
||||
|
||||
if ((int)$frontEnd > 0) {
|
||||
return $file['name'];
|
||||
}
|
||||
|
||||
jexit(json_encode(array( 'jsonrpc' => '2.0', 'result' => 'OK', 'code' => 200,
|
||||
'message' => Text::_('COM_PHOCAGALLERY_SUCCESS').': ',
|
||||
'details' => Text::_('COM_PHOCAGALLERY_IMAGES_UPLOADED'))));
|
||||
|
||||
|
||||
} else {
|
||||
// No Chunk Method
|
||||
|
||||
$filepathImgFinal = Path::clean($path->image_abs.$folder.strtolower($file['name']));
|
||||
$filepathFolderFinal = Path::clean($path->image_abs.$folder);
|
||||
|
||||
|
||||
|
||||
if (!PhocaGalleryFileUpload::canUpload( $file, $errUploadMsg, $frontEnd, $chunkMethod, 0 )) {
|
||||
jexit(json_encode(array( 'jsonrpc' => '2.0', 'result' => 'error', 'code' => 104,
|
||||
'message' => Text::_('COM_PHOCAGALLERY_ERROR').': ',
|
||||
'details' => Text::_($errUploadMsg))));
|
||||
}
|
||||
|
||||
if (File::exists($filepathImgFinal)) {
|
||||
jexit(json_encode(array( 'jsonrpc' => '2.0', 'result' => 'error', 'code' => 108,
|
||||
'message' => Text::_('COM_PHOCAGALLERY_ERROR').': ',
|
||||
'details' => Text::_('COM_PHOCAGALLERY_FILE_ALREADY_EXISTS'))));
|
||||
}
|
||||
|
||||
|
||||
if(!File::upload($file['tmp_name'], $filepathImgFinal, false, true)) {
|
||||
jexit(json_encode(array( 'jsonrpc' => '2.0', 'result' => 'error', 'code' => 109,
|
||||
'message' => Text::_('COM_PHOCAGALLERY_ERROR').': ',
|
||||
'details' => Text::_('COM_PHOCAGALLERY_ERROR_UNABLE_TO_UPLOAD_FILE') .'<br />'
|
||||
. Text::_('COM_PHOCAGALLERY_CHECK_PERMISSIONS_OWNERSHIP'))));
|
||||
}
|
||||
|
||||
if ((int)$frontEnd > 0) {
|
||||
return $file['name'];
|
||||
}
|
||||
|
||||
jexit(json_encode(array( 'jsonrpc' => '2.0', 'result' => 'OK', 'code' => 200,
|
||||
'message' => Text::_('COM_PHOCAGALLERY_SUCCESS').': ',
|
||||
'details' => Text::_('COM_PHOCAGALLERY_IMAGES_UPLOADED'))));
|
||||
|
||||
|
||||
}
|
||||
} else {
|
||||
// No isset $file['name']
|
||||
|
||||
jexit(json_encode(array( 'jsonrpc' => '2.0', 'result' => 'error', 'code' => 104,
|
||||
'message' => Text::_('COM_PHOCAGALLERY_ERROR').': ',
|
||||
'details' => Text::_('COM_PHOCAGALLERY_ERROR_UNABLE_TO_UPLOAD_FILE'))));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static function realSingleUpload( $frontEnd = 0 ) {
|
||||
|
||||
// $paramsC = JComponentHelper::getParams('com_phocagallery');
|
||||
// $chunkMethod = $paramsC->get( 'multiple_upload_chunk', 0 );
|
||||
// $uploadMethod = $paramsC->get( 'multiple_upload_method', 4 );
|
||||
|
||||
$app = Factory::getApplication();
|
||||
Session::checkToken( 'request' ) or jexit( 'ERROR: '. Text::_('COM_PHOCAGALLERY_INVALID_TOKEN'));
|
||||
|
||||
$app->allowCache(false);
|
||||
|
||||
$path = PhocaGalleryPath::getPath();
|
||||
$file = Factory::getApplication()->input->files->get( 'Filedata', null );
|
||||
$folder = Factory::getApplication()->input->get( 'folder', '', '', 'path' );
|
||||
$format = Factory::getApplication()->input->get( 'format', 'html', '', 'cmd');
|
||||
$return = Factory::getApplication()->input->get( 'return-url', null, 'post', 'base64' );//includes field
|
||||
$viewBack = Factory::getApplication()->input->get( 'viewback', '', '', '' );
|
||||
$tab = Factory::getApplication()->input->get( 'tab', '', '', 'string' );
|
||||
$field = Factory::getApplication()->input->get( 'field' );
|
||||
$errUploadMsg = '';
|
||||
$folderUrl = $folder;
|
||||
$tabUrl = '';
|
||||
$component = Factory::getApplication()->input->get( 'option', '', '', 'string' );
|
||||
|
||||
// In case no return value will be sent (should not happen)
|
||||
if ($component != '' && $frontEnd == 0) {
|
||||
$componentUrl = 'index.php?option='.$component;
|
||||
} else {
|
||||
$componentUrl = 'index.php';
|
||||
}
|
||||
if ($tab != '') {
|
||||
$tabUrl = '&tab='.(string)$tab;
|
||||
}
|
||||
|
||||
$ftp = ClientHelper::setCredentialsFromRequest('ftp');
|
||||
|
||||
// Make the filename safe
|
||||
if (isset($file['name'])) {
|
||||
$file['name'] = File::makeSafe($file['name']);
|
||||
}
|
||||
|
||||
|
||||
if (isset($folder) && $folder != '') {
|
||||
$folder = $folder . '/';
|
||||
}
|
||||
|
||||
|
||||
// All HTTP header will be overwritten with js message
|
||||
if (isset($file['name'])) {
|
||||
$filepath = Path::clean($path->image_abs.$folder.strtolower($file['name']));
|
||||
|
||||
if (!PhocaGalleryFileUpload::canUpload( $file, $errUploadMsg, $frontEnd )) {
|
||||
|
||||
if ($errUploadMsg == 'COM_PHOCAGALLERY_WARNING_FILE_TOOLARGE') {
|
||||
$errUploadMsg = Text::_($errUploadMsg) . ' ('.PhocaGalleryFile::getFileSizeReadable($file['size']).')';
|
||||
} else if ($errUploadMsg == 'COM_PHOCAGALLERY_WARNING_FILE_TOOLARGE_RESOLUTION') {
|
||||
$imgSize = PhocaGalleryImage::getImageSize($file['tmp_name']);
|
||||
$errUploadMsg = Text::_($errUploadMsg) . ' ('.(int)$imgSize[0].' x '.(int)$imgSize[1].' px)';
|
||||
} else {
|
||||
$errUploadMsg = Text::_($errUploadMsg);
|
||||
}
|
||||
|
||||
|
||||
/*if ($return) {
|
||||
$app->enqueueMessage( $errUploadMsg, 'error');
|
||||
$app->redirect(base64_decode($return).'&folder='.$folderUrl);
|
||||
exit;
|
||||
} else {
|
||||
$app->enqueueMessage( $errUploadMsg, 'error');
|
||||
$app->redirect($componentUrl, $errUploadMsg, 'error');
|
||||
exit;
|
||||
}*/
|
||||
|
||||
|
||||
if ($return) {
|
||||
$app->enqueueMessage( $errUploadMsg, 'error');
|
||||
if ($frontEnd > 0) {
|
||||
|
||||
$app->redirect(base64_decode($return));
|
||||
} else {
|
||||
$app->redirect(base64_decode($return).'&folder='.$folderUrl);
|
||||
}
|
||||
exit;
|
||||
} else {
|
||||
$app->enqueueMessage( $errUploadMsg, 'error');
|
||||
$app->redirect($componentUrl);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
if (File::exists($filepath)) {
|
||||
if ($return) {
|
||||
$app->enqueueMessage( Text::_('COM_PHOCAGALLERY_FILE_ALREADY_EXISTS'), 'error');
|
||||
$app->redirect(base64_decode($return).'&folder='.$folderUrl);
|
||||
exit;
|
||||
} else {
|
||||
$app->enqueueMessage(Text::_('COM_PHOCAGALLERY_FILE_ALREADY_EXISTS'), 'error');
|
||||
$app->redirect($componentUrl);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
if (!File::upload($file['tmp_name'], $filepath, false, true)) {
|
||||
if ($return) {
|
||||
$app->enqueueMessage( Text::_('COM_PHOCAGALLERY_ERROR_UNABLE_TO_UPLOAD_FILE'), 'error');
|
||||
$app->redirect(base64_decode($return).'&folder='.$folderUrl);
|
||||
exit;
|
||||
} else {
|
||||
$app->enqueueMessage( Text::_('COM_PHOCAGALLERY_ERROR_UNABLE_TO_UPLOAD_FILE'), 'error');
|
||||
$app->redirect($componentUrl);
|
||||
exit;
|
||||
}
|
||||
} else {
|
||||
|
||||
if ((int)$frontEnd > 0) {
|
||||
return $file['name'];
|
||||
}
|
||||
|
||||
if ($return) {
|
||||
$app->enqueueMessage( Text::_('COM_PHOCAGALLERY_SUCCESS_FILE_UPLOAD'));
|
||||
$app->redirect(base64_decode($return).'&folder='.$folderUrl);
|
||||
exit;
|
||||
} else {
|
||||
$app->enqueueMessage( Text::_('COM_PHOCAGALLERY_SUCCESS_FILE_UPLOAD'));
|
||||
$app->redirect($componentUrl);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$msg = Text::_('COM_PHOCAGALLERY_ERROR_UNABLE_TO_UPLOAD_FILE');
|
||||
if ($return) {
|
||||
$app->enqueueMessage( $msg);
|
||||
$app->redirect(base64_decode($return).'&folder='.$folderUrl);
|
||||
exit;
|
||||
} else {
|
||||
switch ($viewBack) {
|
||||
case 'phocagalleryi':
|
||||
$app->enqueueMessage( $msg, 'error');
|
||||
$app->redirect('index.php?option=com_phocagallery&view=phocagalleryi&tmpl=component'.$tabUrl.'&folder='.$folder.'&field='.$field);
|
||||
exit;
|
||||
break;
|
||||
|
||||
case 'phocagallerym':
|
||||
$app->enqueueMessage( $msg, 'error');
|
||||
$app->redirect('index.php?option=com_phocagallery&view=phocagallerym&layout=form&hidemainmenu=1'.$tabUrl.'&folder='.$folder);
|
||||
exit;
|
||||
break;
|
||||
|
||||
default:
|
||||
$app->enqueueMessage( $msg, 'error');
|
||||
$app->redirect('index.php?option=com_phocagallery');
|
||||
exit;
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static function realJavaUpload( $frontEnd = 0 ) {
|
||||
|
||||
$app = Factory::getApplication();
|
||||
|
||||
Session::checkToken( 'request' ) or exit( 'ERROR: '. Text::_('COM_PHOCAGALLERY_INVALID_TOKEN'));
|
||||
|
||||
// $files = Factory::getApplication()->input->get( 'Filedata', '', 'files', 'array' );
|
||||
|
||||
$path = PhocaGalleryPath::getPath();
|
||||
$folder = Factory::getApplication()->input->get( 'folder', '', '', 'path' );
|
||||
|
||||
if (isset($folder) && $folder != '') {
|
||||
$folder = $folder . '/';
|
||||
}
|
||||
$errUploadMsg = '';
|
||||
$ftp = ClientHelper::setCredentialsFromRequest('ftp');
|
||||
|
||||
foreach ($_FILES as $fileValue => $file) {
|
||||
echo('File key: '. $fileValue . "\n");
|
||||
foreach ($file as $item => $val) {
|
||||
echo(' Data received: ' . $item.'=>'.$val . "\n");
|
||||
}
|
||||
|
||||
|
||||
// Make the filename safe
|
||||
if (isset($file['name'])) {
|
||||
$file['name'] = File::makeSafe($file['name']);
|
||||
}
|
||||
|
||||
if (isset($file['name'])) {
|
||||
$filepath = Path::clean($path->image_abs.$folder.strtolower($file['name']));
|
||||
|
||||
if (!PhocaGalleryFileUpload::canUpload( $file, $errUploadMsg, $frontEnd )) {
|
||||
exit( 'ERROR: '.Text::_($errUploadMsg));
|
||||
}
|
||||
|
||||
if (File::exists($filepath)) {
|
||||
exit( 'ERROR: '.Text::_('COM_PHOCAGALLERY_FILE_ALREADY_EXISTS'));
|
||||
}
|
||||
|
||||
if (!File::upload($file['tmp_name'], $filepath, false, true)) {
|
||||
exit( 'ERROR: '.Text::_('COM_PHOCAGALLERY_ERROR_UNABLE_TO_UPLOAD_FILE'));
|
||||
}
|
||||
if ((int)$frontEnd > 0) {
|
||||
return $file['name'];
|
||||
}
|
||||
|
||||
exit( 'SUCCESS');
|
||||
} else {
|
||||
exit( 'ERROR: '.Text::_('COM_PHOCAGALLERY_ERROR_UNABLE_TO_UPLOAD_FILE'));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* can Upload
|
||||
*
|
||||
* @param array $file
|
||||
* @param string $errorUploadMsg
|
||||
* @param int $frontEnd - if it is called from frontend or backend (1 - category view, 2 user control panel)
|
||||
* @param boolean $chunkMethod - if chunk method is used (multiple upload) then there are special rules
|
||||
* @param string $realSize - if chunk method is used we get info about real size of file (not only the part)
|
||||
* @return boolean True on success
|
||||
* @since 1.5
|
||||
*/
|
||||
|
||||
|
||||
public static function canUpload( $file, &$errUploadMsg, $frontEnd = 0, $chunkEnabled = 0, $realSize = 0 ) {
|
||||
|
||||
$params = ComponentHelper::getParams( 'com_phocagallery' );
|
||||
$paramsL = array();
|
||||
$paramsL['upload_extensions'] = 'gif,jpg,png,jpeg,webp,avif';
|
||||
$paramsL['image_extensions'] = 'gif,jpg,png,jpeg,webp,avif';
|
||||
$paramsL['upload_mime'] = 'image/jpeg,image/gif,image/png,image/webp,image/avif';
|
||||
$paramsL['upload_mime_illegal'] ='application/x-shockwave-flash,application/msword,application/excel,application/pdf,application/powerpoint,text/plain,application/x-zip,text/html';
|
||||
|
||||
// The file doesn't exist
|
||||
if(empty($file['name'])) {
|
||||
$errUploadMsg = 'COM_PHOCAGALLERY_ERROR_UNABLE_TO_UPLOAD_FILE';
|
||||
return false;
|
||||
}
|
||||
|
||||
// Not safe file
|
||||
jimport('joomla.filesystem.file');
|
||||
if ($file['name'] !== File::makesafe($file['name'])) {
|
||||
$errUploadMsg = 'COM_PHOCAGALLERY_WARNING_FILENAME';
|
||||
return false;
|
||||
}
|
||||
|
||||
$format = strtolower(File::getExt($file['name']));
|
||||
|
||||
// Allowable extension
|
||||
$allowable = explode( ',', $paramsL['upload_extensions']);
|
||||
if ($format == '' || $format == false || (!in_array($format, $allowable))) {
|
||||
//if (!in_array($format, $allowable)) {
|
||||
$errUploadMsg = 'COM_PHOCAGALLERY_WARNING_FILETYPE';
|
||||
return false;
|
||||
}
|
||||
|
||||
// 'COM_PHOCAGALLERY_MAX_RESOLUTION'
|
||||
$imgSize = PhocaGalleryImage::getImageSize($file['tmp_name']);
|
||||
$maxResWidth = $params->get( 'upload_maxres_width', 3072 );
|
||||
$maxResHeight = $params->get( 'upload_maxres_height', 2304 );
|
||||
if (((int)$maxResWidth > 0 && (int)$maxResHeight > 0)
|
||||
&& ((int)$imgSize[0] > (int)$maxResWidth || (int)$imgSize[1] > (int)$maxResHeight)) {
|
||||
$errUploadMsg = 'COM_PHOCAGALLERY_WARNING_FILE_TOOLARGE_RESOLUTION';
|
||||
return false;
|
||||
}
|
||||
|
||||
// User (only in ucp) - Check the size of all images by users
|
||||
if ($frontEnd == 2) {
|
||||
$user = Factory::getUser();
|
||||
$maxUserImageSize = (int)$params->get( 'user_images_max_size', 20971520 );
|
||||
|
||||
if ($chunkEnabled == 1) {
|
||||
$fileSize = $realSize;
|
||||
} else {
|
||||
$fileSize = $file['size'];
|
||||
}
|
||||
$allFileSize = PhocaGalleryFileUploadFront::getSizeAllOriginalImages($fileSize, $user->id);
|
||||
|
||||
if ((int)$maxUserImageSize > 0 && (int) $allFileSize > $maxUserImageSize) {
|
||||
$errUploadMsg = Text::_('COM_PHOCAGALLERY_WARNING_USERIMAGES_TOOLARGE');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Max size of image
|
||||
// If chunk method is used, we need to get computed size
|
||||
$maxSize = $params->get( 'upload_maxsize', 3145728 );
|
||||
if ($chunkEnabled == 1) {
|
||||
if ((int)$maxSize > 0 && (int)$realSize > (int)$maxSize) {
|
||||
$errUploadMsg = 'COM_PHOCAGALLERY_WARNING_FILE_TOOLARGE';
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if ((int)$maxSize > 0 && (int)$file['size'] > (int)$maxSize) {
|
||||
$errUploadMsg = 'COM_PHOCAGALLERY_WARNING_FILE_TOOLARGE';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
$user = Factory::getUser();
|
||||
$imginfo = null;
|
||||
|
||||
|
||||
// Image check
|
||||
$images = explode( ',', $paramsL['image_extensions']);
|
||||
if(in_array($format, $images)) { // if its an image run it through getimagesize
|
||||
if ($chunkEnabled != 1) {
|
||||
if(($imginfo = getimagesize($file['tmp_name'])) === FALSE) {
|
||||
$errUploadMsg = 'COM_PHOCAGALLERY_WARNING_INVALIDIMG';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} else if(!in_array($format, $images)) {
|
||||
// if its not an image...and we're not ignoring it
|
||||
$allowed_mime = explode(',', $paramsL['upload_mime']);
|
||||
$illegal_mime = explode(',', $paramsL['upload_mime_illegal']);
|
||||
if(function_exists('finfo_open')) {
|
||||
// We have fileinfo
|
||||
$finfo = finfo_open(FILEINFO_MIME);
|
||||
$type = finfo_file($finfo, $file['tmp_name']);
|
||||
if(strlen($type) && !in_array($type, $allowed_mime) && in_array($type, $illegal_mime)) {
|
||||
$errUploadMsg = 'COM_PHOCAGALLERY_WARNING_INVALIDMIME';
|
||||
return false;
|
||||
}
|
||||
finfo_close($finfo);
|
||||
} else if(function_exists('mime_content_type')) {
|
||||
// we have mime magic
|
||||
$type = mime_content_type($file['tmp_name']);
|
||||
if(strlen($type) && !in_array($type, $allowed_mime) && in_array($type, $illegal_mime)) {
|
||||
$errUploadMsg = 'COM_PHOCAGALLERY_WARNING_INVALIDMIME';
|
||||
return false;
|
||||
}
|
||||
}/* else if(!$user->authorize( 'login', 'administrator' )) {
|
||||
$errUploadMsg = = 'WARNNOTADMIN';
|
||||
return false;
|
||||
}*/
|
||||
}
|
||||
|
||||
// XSS Check
|
||||
$xss_check = file_get_contents($file['tmp_name'], false, null, -1, 256);
|
||||
|
||||
$html_tags = array(
|
||||
'abbr', 'acronym', 'address', 'applet', 'area', 'audioscope', 'base', 'basefont', 'bdo', 'bgsound', 'big', 'blackface', 'blink',
|
||||
'blockquote', 'body', 'bq', 'br', 'button', 'caption', 'center', 'cite', 'code', 'col', 'colgroup', 'comment', 'custom', 'dd', 'del',
|
||||
'dfn', 'dir', 'div', 'dl', 'dt', 'em', 'embed', 'fieldset', 'fn', 'font', 'form', 'frame', 'frameset', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6',
|
||||
'head', 'hr', 'html', 'iframe', 'ilayer', 'img', 'input', 'ins', 'isindex', 'keygen', 'kbd', 'label', 'layer', 'legend', 'li', 'limittext',
|
||||
'link', 'listing', 'map', 'marquee', 'menu', 'meta', 'multicol', 'nobr', 'noembed', 'noframes', 'noscript', 'nosmartquotes', 'object',
|
||||
'ol', 'optgroup', 'option', 'param', 'plaintext', 'pre', 'rt', 'ruby', 's', 'samp', 'script', 'select', 'server', 'shadow', 'sidebar',
|
||||
'small', 'spacer', 'span', 'strike', 'strong', 'style', 'sub', 'sup', 'table', 'tbody', 'td', 'textarea', 'tfoot', 'th', 'thead', 'title',
|
||||
'tr', 'tt', 'ul', 'var', 'wbr', 'xml', 'xmp', '!DOCTYPE', '!--',
|
||||
);
|
||||
|
||||
foreach ($html_tags as $tag)
|
||||
{
|
||||
// A tag is '<tagname ', so we need to add < and a space or '<tagname>'
|
||||
if (stripos($xss_check, '<' . $tag . ' ') !== false || stripos($xss_check, '<' . $tag . '>') !== false)
|
||||
{
|
||||
$errUploadMsg = 'COM_PHOCAGALLERY_WARNING_IEXSS';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
/*
|
||||
function uploader($id='file-upload', $params = array()) {
|
||||
|
||||
$path = 'media/com_phocagallery/js/upload/';
|
||||
JHtml::script('swf.js', $path, false ); // mootools are loaded yet
|
||||
JHtml::script('uploader.js', $path, false );// mootools are loaded yet
|
||||
|
||||
static $uploaders;
|
||||
|
||||
if (!isset($uploaders)) {
|
||||
$uploaders = array();
|
||||
}
|
||||
|
||||
if (isset($uploaders[$id]) && ($uploaders[$id])) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Setup options object
|
||||
$opt['url'] = (isset($params['targetURL'])) ? $params['targetURL'] : null ;
|
||||
$opt['swf'] = (isset($params['swf'])) ? $params['swf'] : Uri::root(true).'/media/system/swf/uploader.swf';
|
||||
$opt['multiple'] = (isset($params['multiple']) && !($params['multiple'])) ? '\\false' : '\\true';
|
||||
$opt['queued'] = (isset($params['queued']) && !($params['queued'])) ? '\\false' : '\\true';
|
||||
$opt['queueList'] = (isset($params['queueList'])) ? $params['queueList'] : 'upload-queue';
|
||||
$opt['instantStart'] = (isset($params['instantStart']) && ($params['instantStart'])) ? '\\true' : '\\false';
|
||||
$opt['allowDuplicates'] = (isset($params['allowDuplicates']) && !($params['allowDuplicates'])) ? '\\false' : '\\true';
|
||||
$opt['limitSize'] = (isset($params['limitSize']) && ($params['limitSize'])) ? (int)$params['limitSize'] : null;
|
||||
$opt['limitFiles'] = (isset($params['limitFiles']) && ($params['limitFiles'])) ? (int)$params['limitFiles'] : null;
|
||||
$opt['optionFxDuration'] = (isset($params['optionFxDuration'])) ? (int)$params['optionFxDuration'] : null;
|
||||
$opt['container'] = (isset($params['container'])) ? '\\$('.$params['container'].')' : '\\$(\''.$id.'\').getParent()';
|
||||
$opt['types'] = (isset($params['types'])) ?'\\'.$params['types'] : '\\{\'All Files (*.*)\': \'*.*\'}';
|
||||
|
||||
// Optional functions
|
||||
$opt['createReplacement'] = (isset($params['createReplacement'])) ? '\\'.$params['createReplacement'] : null;
|
||||
$opt['onComplete'] = (isset($params['onComplete'])) ? '\\'.$params['onComplete'] : null;
|
||||
$opt['onAllComplete'] = (isset($params['onAllComplete'])) ? '\\'.$params['onAllComplete'] : null;
|
||||
|
||||
/* types: Object with (description: extension) pairs, Default: Images (*.jpg; *.jpeg; *.gif; *.png)
|
||||
*/
|
||||
/*
|
||||
$options = PhocaGalleryFileUpload::getJSObject($opt);
|
||||
|
||||
// Attach tooltips to document
|
||||
$document =Factory::getDocument();
|
||||
$uploaderInit = 'sBrowseCaption=\''.Text::_('Browse Files', true).'\';
|
||||
sRemoveToolTip=\''.Text::_('Remove from queue', true).'\';
|
||||
window.addEvent(\'load\', function(){
|
||||
var Uploader = new FancyUpload($(\''.$id.'\'), '.$options.');
|
||||
$(\'upload-clear\').adopt(new Element(\'input\', { type: \'button\', events: { click: Uploader.clearList.bind(Uploader, [false])}, value: \''.Text::_('Clear Completed').'\' })); });';
|
||||
$document->addScriptDeclaration($uploaderInit);
|
||||
|
||||
// Set static array
|
||||
$uploaders[$id] = true;
|
||||
return;
|
||||
}
|
||||
|
||||
protected static function getJSObject($array=array())
|
||||
{
|
||||
// Initialise variables.
|
||||
$object = '{';
|
||||
|
||||
// Iterate over array to build objects
|
||||
foreach ((array)$array as $k => $v)
|
||||
{
|
||||
if (is_null($v)) {
|
||||
continue;
|
||||
}
|
||||
if (!is_array($v) && !is_object($v))
|
||||
{
|
||||
$object .= ' '.$k.': ';
|
||||
$object .= (is_numeric($v) || strpos($v, '\\') === 0) ? (is_numeric($v)) ? $v : substr($v, 1) : "'".$v."'";
|
||||
$object .= ',';
|
||||
}
|
||||
else {
|
||||
$object .= ' '.$k.': '.PhocaGalleryFileUpload::getJSObject($v).',';
|
||||
}
|
||||
}
|
||||
if (substr($object, -1) == ',') {
|
||||
$object = substr($object, 0, -1);
|
||||
}
|
||||
$object .= '}';
|
||||
|
||||
return $object;
|
||||
}*/
|
||||
|
||||
public static function renderFTPaccess() {
|
||||
|
||||
$ftpOutput = '<fieldset title="'.Text::_('COM_PHOCAGALLERY_FTP_LOGIN_LABEL'). '">'
|
||||
.'<legend>'. Text::_('COM_PHOCAGALLERY_FTP_LOGIN_LABEL').'</legend>'
|
||||
.Text::_('COM_PHOCAGALLERY_FTP_LOGIN_DESC')
|
||||
.'<table class="adminform nospace">'
|
||||
.'<tr>'
|
||||
.'<td width="120"><label for="username">'. Text::_('JGLOBAL_USERNAME').':</label></td>'
|
||||
.'<td><input type="text" id="username" name="username" class="input_box" size="70" value="" /></td>'
|
||||
.'</tr>'
|
||||
.'<tr>'
|
||||
.'<td width="120"><label for="password">'. Text::_('JGLOBAL_PASSWORD').':</label></td>'
|
||||
.'<td><input type="password" id="password" name="password" class="input_box" size="70" value="" /></td>'
|
||||
.'</tr></table></fieldset>';
|
||||
return $ftpOutput;
|
||||
}
|
||||
|
||||
public static function renderCreateFolder($sessName, $sessId, $currentFolder, $viewBack, $attribs = '') {
|
||||
|
||||
if ($attribs != '') {
|
||||
$attribs = '&'.$attribs;
|
||||
}
|
||||
|
||||
$folderOutput = '<form action="'. Uri::base()
|
||||
.'index.php?option=com_phocagallery&task=phocagalleryu.createfolder&'. $sessName.'='.$sessId.'&'
|
||||
.Session::getFormToken().'=1&viewback='.$viewBack.'&'
|
||||
.'folder='.PhocaGalleryText::filterValue($currentFolder, 'folderpath').$attribs .'" name="folderForm" id="folderForm" method="post">'
|
||||
//.'<fieldset id="folderview">'
|
||||
//.'<legend>'.JText::_('COM_PHOCAGALLERY_FOLDER').'</legend>'
|
||||
.'<div class="ph-in"><div class="ph-head-form">'.Text::_('COM_PHOCAGALLERY_CREATE_FOLDER').'</div>'
|
||||
.'<dl class="dl-horizontal ph-input">'
|
||||
.'<dt><input class="form-control" type="text" id="foldername" name="foldername" /></dt>'
|
||||
.'<input class="update-folder" type="hidden" name="folderbase" id="folderbase" value="'.PhocaGalleryText::filterValue($currentFolder, 'folderpath').'" />'
|
||||
.'<dd><button class="btn btn-success" type="submit">'. Text::_( 'COM_PHOCAGALLERY_CREATE_FOLDER' ).'</button></dd>'
|
||||
.'</dl></div>'
|
||||
//.'</fieldset>'
|
||||
.HTMLHelper::_( 'form.token' )
|
||||
.'</form>';
|
||||
return $folderOutput;
|
||||
}
|
||||
}
|
||||
?>
|
||||
@ -0,0 +1,37 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Phoca Gallery
|
||||
* @author Jan Pavelka - https://www.phoca.cz
|
||||
* @copyright Copyright (C) Jan Pavelka https://www.phoca.cz
|
||||
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 and later
|
||||
* @cms Joomla
|
||||
* @copyright Copyright (C) Open Source Matters. All rights reserved.
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
|
||||
*/
|
||||
defined( '_JEXEC' ) or die( 'Restricted access' );
|
||||
use Joomla\CMS\Factory;
|
||||
|
||||
class PhocaGalleryFileUploadFront
|
||||
{
|
||||
public static function getSizeAllOriginalImages($fileSize, $userId) {
|
||||
|
||||
$db =Factory::getDBO();
|
||||
$allFileSize = 0;
|
||||
$query = 'SELECT SUM(a.imgorigsize) AS sumimgorigsize'
|
||||
.' FROM #__phocagallery AS a'
|
||||
.' LEFT JOIN #__phocagallery_categories AS cc ON a.catid = cc.id'
|
||||
.' WHERE cc.owner_id = '.(int)$userId;
|
||||
$db->setQuery($query, 0, 1);
|
||||
$sumImgOrigSize = $db->loadObject();
|
||||
|
||||
if(isset($sumImgOrigSize->sumimgorigsize) && (int)$sumImgOrigSize->sumimgorigsize > 0) {
|
||||
$allFileSize = (int)$allFileSize + (int)$sumImgOrigSize->sumimgorigsize;
|
||||
}
|
||||
|
||||
if (isset($fileSize)) {
|
||||
$allFileSize = (int)$allFileSize + (int)$fileSize;
|
||||
}
|
||||
return (int)$allFileSize;
|
||||
}
|
||||
}
|
||||
?>
|
||||
@ -0,0 +1,78 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Phoca Gallery
|
||||
* @author Jan Pavelka - https://www.phoca.cz
|
||||
* @copyright Copyright (C) Jan Pavelka https://www.phoca.cz
|
||||
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 and later
|
||||
* @cms Joomla
|
||||
* @copyright Copyright (C) Open Source Matters. All rights reserved.
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
|
||||
*/
|
||||
defined( '_JEXEC' ) or die( 'Restricted access' );
|
||||
use Joomla\CMS\Language\Text;
|
||||
|
||||
class PhocaGalleryFileUploadJava
|
||||
{
|
||||
public $returnUrl;
|
||||
public $url;
|
||||
public $source;
|
||||
public $height;
|
||||
public $width;
|
||||
public $resizeheight;
|
||||
public $resizewidth;
|
||||
public $uploadmaxsize;
|
||||
|
||||
public function __construct() {}
|
||||
|
||||
public function getJavaUploadHTML() {
|
||||
|
||||
|
||||
|
||||
$html = '<!--[if !IE]> -->' . "\n"
|
||||
|
||||
.'<object classid="java:wjhk.jupload2.JUploadApplet" type="application/x-java-applet"'
|
||||
.' archive="http://localhost/'. $this->source.'" height="'.$this->height.'" width="'.$this->width.'" >' . "\n"
|
||||
.'<param name="archive" value="'. $this->source.'" />' . "\n"
|
||||
.'<param name="postURL" value="'. $this->url.'"/>' . "\n"
|
||||
.'<param name="afterUploadURL" value="'. $this->returnUrl.'"/>' . "\n"
|
||||
.'<param name="allowedFileExtensions" value="jpg/gif/png/" />' . "\n"
|
||||
.'<param name="uploadPolicy" value="PictureUploadPolicy" />' . "\n"
|
||||
.'<param name="nbFilesPerRequest" value="1" />' . "\n"
|
||||
.'<param name="maxPicHeight" value="'. $this->resizeheight .'" />' . "\n"
|
||||
.'<param name="maxPicWidth" value="'. $this->resizewidth .'" />' . "\n"
|
||||
.'<param name="maxFileSize" value="'. $this->uploadmaxsize .'" />' . "\n"
|
||||
.'<param name="pictureTransmitMetadata" value="true" />' . "\n"
|
||||
.'<param name="showLogWindow" value="false" />' . "\n"
|
||||
.'<param name="showStatusBar" value="false" />' . "\n"
|
||||
.'<param name="pictureCompressionQuality" value="1" />' . "\n"
|
||||
.'<param name="lookAndFeel" value="system"/>' . "\n"
|
||||
.'<!--<![endif]-->'. "\n"
|
||||
.'<object classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" codebase="http://java.sun.com/update/1.5.0/jinstall-1_5_0-windows-i586.cab"'
|
||||
.' height="'.$this->height.'" width="'.$this->width.'" >'. "\n"
|
||||
.'<param name="code" value="wjhk.jupload2.JUploadApplet" />'. "\n"
|
||||
.'<param name="archive" value="'. $this->source .'" />'. "\n"
|
||||
.'<param name="postURL" value="'. $this->url .'"/>'. "\n"
|
||||
.'<param name="afterUploadURL" value="'. $this->returnUrl.'"/>'. "\n"
|
||||
.'<param name="allowedFileExtensions" value="jpg/gif/png" />' . "\n"
|
||||
.'<param name="uploadPolicy" value="PictureUploadPolicy" /> ' . "\n"
|
||||
.'<param name="nbFilesPerRequest" value="1" />'. "\n"
|
||||
.'<param name="maxPicHeight" value="'. $this->resizeheight .'" />'. "\n"
|
||||
.'<param name="maxPicWidth" value="'. $this->resizewidth .'" />'. "\n"
|
||||
.'<param name="maxFileSize" value="'. $this->uploadmaxsize .'" />' . "\n"
|
||||
.'<param name="pictureTransmitMetadata" value="true" />'. "\n"
|
||||
.'<param name="showLogWindow" value="false" />'. "\n"
|
||||
.'<param name="showStatusBar" value="false" />'. "\n"
|
||||
.'<param name="pictureCompressionQuality" value="1" />'. "\n"
|
||||
.'<param name="lookAndFeel" value="system"/>' . "\n"
|
||||
.'<div style="color:#cc0000">'.Text::_('COM_PHOCAGALLERY_JAVA_PLUGIN_MUST_BE_ENABLED').'</div>'. "\n"
|
||||
.'</object>'. "\n"
|
||||
.'<!--[if !IE]> -->'. "\n"
|
||||
.'</object>' . "\n"
|
||||
.'<!--<![endif]-->'. "\n"
|
||||
.'</fieldset>' . "\n";
|
||||
|
||||
return $html;
|
||||
|
||||
}
|
||||
}
|
||||
?>
|
||||
@ -0,0 +1,307 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Phoca Gallery
|
||||
* @author Jan Pavelka - https://www.phoca.cz
|
||||
* @copyright Copyright (C) Jan Pavelka https://www.phoca.cz
|
||||
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 and later
|
||||
* @cms Joomla
|
||||
* @copyright Copyright (C) Open Source Matters. All rights reserved.
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
|
||||
*/
|
||||
defined( '_JEXEC' ) or die( 'Restricted access' );
|
||||
use Joomla\CMS\Component\ComponentHelper;
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Uri\Uri;
|
||||
|
||||
use Joomla\CMS\HTML\HTMLHelper;
|
||||
|
||||
class PhocaGalleryFileUploadMultiple
|
||||
{
|
||||
public $method = 1;
|
||||
public $url = '';
|
||||
public $reload = '';
|
||||
public $maxFileSize = '';
|
||||
public $chunkSize = '';
|
||||
public $imageHeight = '';
|
||||
public $imageWidth = '';
|
||||
public $imageQuality= '';
|
||||
public $frontEnd = 0;
|
||||
|
||||
public function __construct() {}
|
||||
|
||||
static public function renderMultipleUploadLibraries() {
|
||||
|
||||
$paramsC = ComponentHelper::getParams('com_phocagallery');
|
||||
$chunkMethod = $paramsC->get( 'multiple_upload_chunk', 0 );
|
||||
$uploadMethod = $paramsC->get( 'multiple_upload_method', 4 );
|
||||
|
||||
//First load mootools, then jquery and set noConflict
|
||||
//JHtml::_('behavior.framework', true);// Load it here to be sure, it is loaded before jquery
|
||||
HTMLHelper::_('jquery.framework', false);// Load it here because of own nonConflict method (nonconflict is set below)
|
||||
$document = Factory::getDocument();
|
||||
// No more used - - - - -
|
||||
//$nC = 'var pgJQ = jQuery.noConflict();';//SET BELOW
|
||||
//$document->addScriptDeclaration($nC);//SET BELOW
|
||||
// - - - - - - - - - - - -
|
||||
|
||||
if ($uploadMethod == 2) {
|
||||
//$document->addScript(JUri::root(true).'/media/com_phocagallery/js/plupload/gears_init.js');
|
||||
}
|
||||
if ($uploadMethod == 5) {
|
||||
//$document->addScript('http://bp.yahooapis.com/2.4.21/browserplus-min.js');
|
||||
}
|
||||
|
||||
HTMLHelper::_('script', 'media/com_phocagallery/js/plupload/plupload.js', array('version' => 'auto'));
|
||||
if ($uploadMethod == 2) {
|
||||
//$document->addScript(JUri::root(true).'/media/com_phocagallery/js/plupload/plupload.gears.js');
|
||||
}
|
||||
if ($uploadMethod == 3) {
|
||||
//$document->addScript(JUri::root(true).'/media/com_phocagallery/js/plupload/plupload.silverlight.js');
|
||||
}
|
||||
if ($uploadMethod == 1) {
|
||||
//$document->addScript(JUri::root(true).'/media/com_phocagallery/js/plupload/plupload.flash.js');
|
||||
}
|
||||
if ($uploadMethod == 5) {
|
||||
//$document->addScript(JUri::root(true).'/media/com_phocagallery/js/plupload/plupload.browserplus.js');
|
||||
}
|
||||
if ($uploadMethod == 6) {
|
||||
|
||||
HTMLHelper::_('script', 'media/com_phocagallery/js/plupload/plupload.html4.js', array('version' => 'auto'));
|
||||
}
|
||||
if ($uploadMethod == 4) {
|
||||
|
||||
HTMLHelper::_('script', 'media/com_phocagallery/js/plupload/plupload.html5.js', array('version' => 'auto'));
|
||||
}
|
||||
|
||||
HTMLHelper::_('script', 'media/com_phocagallery/js/plupload/jquery.plupload.queue/jquery.plupload.queue.js', array('version' => 'auto'));
|
||||
HTMLHelper::_('stylesheet', 'media/com_phocagallery/js/plupload/jquery.plupload.queue/css/jquery.plupload.queue.css', array('version' => 'auto'));
|
||||
}
|
||||
|
||||
static public function getMultipleUploadSizeFormat($size) {
|
||||
$readableSize = PhocaGalleryFile::getFileSizeReadable($size, '%01.0f %s', 1);
|
||||
|
||||
$readableSize = str_replace(' ', '', $readableSize);
|
||||
|
||||
$readableSize = strtolower($readableSize);
|
||||
return $readableSize;
|
||||
}
|
||||
|
||||
public function renderMultipleUploadJS($frontEnd = 0, $chunkMethod = 0) {
|
||||
|
||||
$document = Factory::getDocument();
|
||||
|
||||
switch ($this->method) {
|
||||
case 2:
|
||||
$name = 'gears_uploader';
|
||||
$runtime = 'gears';
|
||||
break;
|
||||
case 3:
|
||||
$name = 'silverlight_uploader';
|
||||
$runtime = 'silverlight';
|
||||
break;
|
||||
case 4:
|
||||
$name = 'html5_uploader';
|
||||
$runtime = 'html5';
|
||||
break;
|
||||
|
||||
case 5:
|
||||
$name = 'browserplus_uploader';
|
||||
$runtime = 'browserplus';
|
||||
break;
|
||||
|
||||
case 6:
|
||||
$name = 'html4_uploader';
|
||||
$runtime = 'html4';
|
||||
break;
|
||||
|
||||
case 1:
|
||||
default:
|
||||
$name = 'flash_uploader';
|
||||
$runtime = 'flash';
|
||||
break;
|
||||
}
|
||||
|
||||
$chunkEnabled = 0;
|
||||
// Chunk only if is enabled and only if flash is enabled
|
||||
if (($chunkMethod == 1 && $this->method == 1) || ($this->frontEnd == 0 && $chunkMethod == 0 && $this->method == 1)) {
|
||||
$chunkEnabled = 1;
|
||||
}
|
||||
|
||||
$this->url = PhocaGalleryText::filterValue($this->url, 'text');
|
||||
$this->reload = PhocaGalleryText::filterValue($this->reload, 'text');
|
||||
$this->url = str_replace('&', '&', $this->url);
|
||||
$this->reload = str_replace('&', '&', $this->reload);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//$js = ' var pgJQ = jQuery.noConflict();';
|
||||
$js = 'var pgJQ = jQuery.noConflict();';
|
||||
$js .=' pgJQ(function() {'."\n";
|
||||
|
||||
$js.=''."\n";
|
||||
$js.=' plupload.addI18n({'."\n";
|
||||
$js.=' \'Select files\' : \''.addslashes(Text::_('COM_PHOCAGALLERY_SELECT_IMAGES')).'\','."\n";
|
||||
$js.=' \'Add files to the upload queue and click the start button.\' : \''.addslashes(Text::_('COM_PHOCAGALLERY_ADD_IMAGES_TO_UPLOAD_QUEUE_AND_CLICK_START_BUTTON')).'\','."\n";
|
||||
$js.=' \'Filename\' : \''.addslashes(Text::_('COM_PHOCAGALLERY_FILENAME')).'\','."\n";
|
||||
$js.=' \'Status\' : \''.addslashes(Text::_('COM_PHOCAGALLERY_STATUS')).'\','."\n";
|
||||
$js.=' \'Size\' : \''.addslashes(Text::_('COM_PHOCAGALLERY_SIZE')).'\','."\n";
|
||||
$js.=' \'Add files\' : \''.addslashes(Text::_('COM_PHOCAGALLERY_ADD_IMAGES')).'\','."\n";
|
||||
$js.=' \'Add Files\' : \''.addslashes(Text::_('COM_PHOCAGALLERY_ADD_IMAGES')).'\','."\n";
|
||||
$js.=' \'Start upload\':\''.addslashes(Text::_('COM_PHOCAGALLERY_START_UPLOAD')).'\','."\n";
|
||||
$js.=' \'Stop Upload\':\''.addslashes(Text::_('COM_PHOCAGALLERY_STOP_CURRENT_UPLOAD')).'\','."\n";
|
||||
$js.=' \'Stop current upload\' : \''.addslashes(Text::_('COM_PHOCAGALLERY_STOP_CURRENT_UPLOAD')).'\','."\n";
|
||||
$js.=' \'Start uploading queue\' : \''.addslashes(Text::_('COM_PHOCAGALLERY_START_UPLOADING_QUEUE')).'\','."\n";
|
||||
$js.=' \'Drag files here.\' : \''.addslashes(Text::_('COM_PHOCAGALLERY_DRAG_FILES_HERE')).'\''."\n";
|
||||
$js.=' });';
|
||||
$js.=''."\n";
|
||||
$js.=' pgJQ("#'.$name.'").pluploadQueue({'."\n";
|
||||
$js.=' runtimes : \''.$runtime.'\','."\n";
|
||||
$js.=' url : \''.$this->url.'\','."\n";
|
||||
//$js.=' max_file_size : \''.$this->maxFileSize.'\','."\n";
|
||||
|
||||
if ($this->maxFileSize != '0b') {
|
||||
$js.=' max_file_size : \''.$this->maxFileSize.'\','."\n";
|
||||
}
|
||||
|
||||
if ($chunkEnabled == 1) {
|
||||
$js.=' chunk_size : \'1mb\','."\n";
|
||||
}
|
||||
$js.=' preinit: attachCallbacks,'."\n";
|
||||
$js.=' unique_names : false,'."\n";
|
||||
$js.=' multipart: true,'."\n";
|
||||
$js.=' filters : ['."\n";
|
||||
$js.=' {title : "'.Text::_('COM_PHOCAGALLERY_IMAGE_FILES').'", extensions : "jpg,gif,png,jpeg,webp,avif"}'."\n";
|
||||
//$js.=' {title : "Zip files", extensions : "zip"}'."\n";
|
||||
$js.=' ],'."\n";
|
||||
$js.=''."\n";
|
||||
if ($this->method != 6) {
|
||||
if ((int)$this->imageWidth > 0 || (int)$this->imageWidth > 0) {
|
||||
$js.=' resize : {width : '.$this->imageWidth.', height : '.$this->imageHeight.', quality : '.$this->imageQuality.'},'."\n";
|
||||
$js.=''."\n";
|
||||
}
|
||||
}
|
||||
if ($this->method == 1) {
|
||||
$js.=' flash_swf_url : \''.Uri::root(true).'/media/com_phocagallery/js/plupload/plupload.flash.swf\''."\n";
|
||||
} else if ($this->method == 3) {
|
||||
$js.=' silverlight_xap_url : \''.Uri::root(true).'/media/com_phocagallery/js/plupload/plupload.silverlight.xap\''."\n";
|
||||
}
|
||||
$js.=' });'."\n";
|
||||
|
||||
$js.=''."\n";
|
||||
|
||||
$js.='function attachCallbacks(Uploader) {'."\n";
|
||||
$js.=' Uploader.bind(\'FileUploaded\', function(Up, File, Response) {'."\n";
|
||||
$js.=' var obj = eval(\'(\' + Response.response + \')\');'."\n";
|
||||
if ($this->method == 6) {
|
||||
$js.=' var queueFiles = Uploader.total.failed + Uploader.total.uploaded;'."\n";
|
||||
$js.=' var uploaded0 = Uploader.total.uploaded;'."\n";
|
||||
} else {
|
||||
$js.=' var queueFiles = Uploader.total.failed + Uploader.total.uploaded + 1;'."\n";
|
||||
$js.=' var uploaded0 = Uploader.total.uploaded + 1;'."\n";
|
||||
}
|
||||
$js.=''."\n";
|
||||
$js.=' if ((typeof(obj.result) != \'undefined\') && obj.result == \'error\') {'."\n";
|
||||
$js.=' '."\n";
|
||||
if ($this->method == 6) {
|
||||
//$js.=' var uploaded0 = Uploader.total.uploaded;'."\n";
|
||||
} else {
|
||||
//$js.=' var uploaded0 = Uploader.total.uploaded + 1;'."\n";
|
||||
}
|
||||
$js.=' Up.trigger("Error", {message : obj.message, code : obj.code, details : obj.details, file: File});'."\n";
|
||||
|
||||
|
||||
//$js.=' console.log(obj);'."\n";
|
||||
|
||||
$js.=' if( queueFiles == Uploader.files.length) {'."\n";
|
||||
if ($this->method == 6) {
|
||||
$js.=' var uploaded0 = Uploader.total.uploaded;'."\n";
|
||||
} else {
|
||||
$js.=' var uploaded0 = Uploader.total.uploaded;'."\n";
|
||||
}
|
||||
$js.=' window.location = \''.$this->reload.'\' + \'&muuploaded=\' + uploaded0 + \'&mufailed=\' + Uploader.total.failed;'."\n";
|
||||
//$js.=' alert(\'Error\' + obj.message)'."\n";
|
||||
$js.=' }'."\n";
|
||||
$js.=' return false; '."\n";
|
||||
$js.=''."\n";
|
||||
$js.=' } else {'."\n";
|
||||
$js.=' if( queueFiles == Uploader.files.length) {'."\n";
|
||||
//$js.=' var uploaded = Uploader.total.uploaded + 1;'."\n";
|
||||
if ($this->method == 6) {
|
||||
$js.=' var uploaded = Uploader.total.uploaded;'."\n";
|
||||
} else {
|
||||
$js.=' var uploaded = Uploader.total.uploaded + 1;'."\n";
|
||||
}
|
||||
$js.=' window.location = \''.$this->reload.'\' + \'&muuploaded=\' + uploaded + \'&mufailed=\' + Uploader.total.failed;'."\n";
|
||||
//$js.=' alert(\'OK\' + obj.message)'."\n";
|
||||
$js.=' }'."\n";
|
||||
$js.=' }'."\n";
|
||||
$js.=' });'."\n";
|
||||
$js.=' '."\n";
|
||||
$js.=' Uploader.bind(\'Error\', function(Up, ErrorObj) {'."\n";
|
||||
$js.=''."\n";
|
||||
// $js.=' if (ErrorObj.code == 100) { '."\n";
|
||||
$js.=' pgJQ(\'#\' + ErrorObj.file.id).append(\'<div class="alert alert-error alert-danger">\'+ ErrorObj.message + ErrorObj.details +\'</div>\');'."\n";
|
||||
|
||||
//$js.= ' console.log(ErrorObj.file.id + " " + ErrorObj.message + " " + ErrorObj.details);'."\n";
|
||||
|
||||
// $js.=' }'."\n";
|
||||
$js.=' }); '."\n";
|
||||
$js.='}';
|
||||
|
||||
$js.='});'."\n";// End $(function()
|
||||
|
||||
$document->addScriptDeclaration($js);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function getMultipleUploadHTML($width = '', $height = '330', $mootools = 1) {
|
||||
|
||||
|
||||
switch ($this->method) {
|
||||
case 2:
|
||||
$name = 'gears_uploader';
|
||||
$msg = Text::_('COM_PHOCAGALLERY_NOT_INSTALLED_GEARS');
|
||||
break;
|
||||
case 3:
|
||||
$name = 'silverlight_uploader';
|
||||
$msg = Text::_('COM_PHOCAGALLERY_NOT_INSTALLED_SILVERLIGHT');
|
||||
break;
|
||||
case 4:
|
||||
$name = 'html5_uploader';
|
||||
$msg = Text::_('COM_PHOCAGALLERY_NOT_SUPPORTED_HTML5');
|
||||
break;
|
||||
|
||||
case 5:
|
||||
$name = 'browserplus_uploader';
|
||||
$msg = Text::_('COM_PHOCAGALLERY_NOT_INSTALLED_BROWSERPLUS');
|
||||
break;
|
||||
|
||||
case 6:
|
||||
$name = 'html4_uploader';
|
||||
$msg = Text::_('COM_PHOCAGALLERY_NOT_SUPPORTED_HTML4');
|
||||
break;
|
||||
|
||||
case 1:
|
||||
default:
|
||||
$name = 'flash_uploader';
|
||||
$msg = Text::_('COM_PHOCAGALLERY_NOT_INSTALLED_FLASH');
|
||||
break;
|
||||
}
|
||||
|
||||
$style = '';
|
||||
if ($width != '') {
|
||||
$style .= 'width: '.(int)$width.'px;';
|
||||
}
|
||||
if ($height != '') {
|
||||
$style .= 'height: '.(int)$height.'px;';
|
||||
}
|
||||
|
||||
return '<div id="'.$name.'" style="'.$style.'">'.$msg.'</div>';
|
||||
|
||||
}
|
||||
}
|
||||
?>
|
||||
@ -0,0 +1,40 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Phoca Gallery
|
||||
* @author Jan Pavelka - https://www.phoca.cz
|
||||
* @copyright Copyright (C) Jan Pavelka https://www.phoca.cz
|
||||
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 and later
|
||||
* @cms Joomla
|
||||
* @copyright Copyright (C) Open Source Matters. All rights reserved.
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
|
||||
*/
|
||||
defined( '_JEXEC' ) or die( 'Restricted access' );
|
||||
use Joomla\CMS\Language\Text;
|
||||
|
||||
class PhocaGalleryFileUploadSingle
|
||||
{
|
||||
public $tab = '';
|
||||
public $returnUrl = '';
|
||||
|
||||
public function __construct() {}
|
||||
|
||||
public function getSingleUploadHTML( $frontEnd = 0) {
|
||||
|
||||
if ($frontEnd == 1) {
|
||||
|
||||
$html = '<input type="hidden" name="controller" value="category" />'
|
||||
.'<input type="hidden" name="tab" value="'.$this->tab.'" />';
|
||||
|
||||
} else {
|
||||
$html = '<input type="file" id="sfile-upload" name="Filedata" />'
|
||||
//.'<input type="submit" id="sfile-upload-submit" value="'.JText::_('COM_PHOCAGALLERY_START_UPLOAD').'"/>'
|
||||
.'<button class="btn btn-primary" id="upload-submit"><i class="icon-upload icon-white"></i> '.Text::_('COM_PHOCAGALLERY_START_UPLOAD').'</button>'
|
||||
.'<input type="hidden" name="return-url" value="'. base64_encode($this->returnUrl).'" />'
|
||||
.'<input type="hidden" name="tab" value="'.$this->tab.'" />';
|
||||
}
|
||||
|
||||
return $html;
|
||||
|
||||
}
|
||||
}
|
||||
?>
|
||||
@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
@ -0,0 +1,104 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Phoca Gallery
|
||||
* @author Jan Pavelka - https://www.phoca.cz
|
||||
* @copyright Copyright (C) Jan Pavelka https://www.phoca.cz
|
||||
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 and later
|
||||
* @cms Joomla
|
||||
* @copyright Copyright (C) Open Source Matters. All rights reserved.
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
|
||||
*/
|
||||
defined( '_JEXEC' ) or die( 'Restricted access' );
|
||||
use Joomla\CMS\Filesystem\File;
|
||||
|
||||
class PhocaGalleryGeo
|
||||
{
|
||||
/*
|
||||
* Geotagging
|
||||
* If no lat or lng will be set by image, it will be automatically set by category
|
||||
*/
|
||||
public static function findLatLngFromCategory($categories) {
|
||||
$output['lat'] = '';
|
||||
$output['lng'] = '';
|
||||
foreach ($categories as $category) {
|
||||
if (isset($category->latitude) && isset($category->longitude)) {
|
||||
if ($category->latitude != '' && $category->latitude != '') {
|
||||
$output['lat'] = $category->latitude;
|
||||
}
|
||||
if ($category->longitude != '' && $category->longitude != '') {
|
||||
$output['lng'] = $category->longitude;
|
||||
}
|
||||
|
||||
if ($output['lat'] != '' && $output['lng'] != '') {
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
}
|
||||
// If nothing will be found, paste some lng, lat
|
||||
$output['lat'] = 50.079623358200884;
|
||||
$output['lng'] = 14.429919719696045;
|
||||
return $output;
|
||||
}
|
||||
|
||||
public static function getGeoCoords($filename){
|
||||
|
||||
$lat = $long = '';
|
||||
$fileOriginal = PhocaGalleryFile::getFileOriginal($filename);
|
||||
|
||||
if (!function_exists('exif_read_data')) {
|
||||
return array('latitude' => 0, 'longitude' => 0);
|
||||
} else {
|
||||
if (strtolower(File::getExt($fileOriginal)) != 'jpg') {
|
||||
return array('latitude' => 0, 'longitude' => 0);
|
||||
}
|
||||
|
||||
// Not happy but @ must be added because of different warnings returned by exif functions - can break multiple upload
|
||||
$exif = @exif_read_data($fileOriginal, 0, true);
|
||||
if (empty($exif)) {
|
||||
return array('latitude' => 0, 'longitude' => 0);
|
||||
}
|
||||
|
||||
|
||||
if (isset($exif['GPS']['GPSLatitude'][0])) {$GPSLatDeg = explode('/',$exif['GPS']['GPSLatitude'][0]);}
|
||||
if (isset($exif['GPS']['GPSLatitude'][1])) {$GPSLatMin = explode('/',$exif['GPS']['GPSLatitude'][1]);}
|
||||
if (isset($exif['GPS']['GPSLatitude'][2])) {$GPSLatSec = explode('/',$exif['GPS']['GPSLatitude'][2]);}
|
||||
if (isset($exif['GPS']['GPSLongitude'][0])) {$GPSLongDeg = explode('/',$exif['GPS']['GPSLongitude'][0]);}
|
||||
if (isset($exif['GPS']['GPSLongitude'][1])) {$GPSLongMin = explode('/',$exif['GPS']['GPSLongitude'][1]);}
|
||||
if (isset($exif['GPS']['GPSLongitude'][2])) {$GPSLongSec = explode('/',$exif['GPS']['GPSLongitude'][2]);}
|
||||
|
||||
|
||||
if (isset($GPSLatDeg[0]) && isset($GPSLatDeg[1]) && (int)$GPSLatDeg[1] > 0
|
||||
&& isset($GPSLatMin[0]) && isset($GPSLatMin[1]) && (int)$GPSLatMin[1] > 0
|
||||
&& isset($GPSLatSec[0]) && isset($GPSLatSec[1]) && (int)$GPSLatSec[1] > 0) {
|
||||
|
||||
$lat = $GPSLatDeg[0]/$GPSLatDeg[1]+
|
||||
($GPSLatMin[0]/$GPSLatMin[1])/60+
|
||||
($GPSLatSec[0]/$GPSLatSec[1])/3600;
|
||||
|
||||
if(isset($exif['GPS']['GPSLatitudeRef']) && $exif['GPS']['GPSLatitudeRef'] == 'S'){$lat=$lat*(-1);}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (isset($GPSLongDeg[0]) && isset($GPSLongDeg[1]) && (int)$GPSLongDeg[1] > 0
|
||||
&& isset($GPSLongMin[0]) && isset($GPSLongMin[1]) && (int)$GPSLongMin[1] > 0
|
||||
&& isset($GPSLongSec[0]) && isset($GPSLongSec[1]) && (int)$GPSLongSec[1] > 0) {
|
||||
|
||||
|
||||
$long = $GPSLongDeg[0]/$GPSLongDeg[1]+
|
||||
($GPSLongMin[0]/$GPSLongMin[1])/60+
|
||||
($GPSLongSec[0]/$GPSLongSec[1])/3600;
|
||||
|
||||
if(isset($exif['GPS']['GPSLongitudeRef']) && $exif['GPS']['GPSLongitudeRef'] == 'W'){$long=$long*(-1);}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
return array('latitude' => $lat, 'longitude' => $long);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
@ -0,0 +1,64 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Phoca Gallery
|
||||
* @author Jan Pavelka - https://www.phoca.cz
|
||||
* @copyright Copyright (C) Jan Pavelka https://www.phoca.cz
|
||||
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 and later
|
||||
* @cms Joomla
|
||||
* @copyright Copyright (C) Open Source Matters. All rights reserved.
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
|
||||
*/
|
||||
defined('_JEXEC') or die;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\HTML\HTMLHelper;
|
||||
use Joomla\CMS\Factory;
|
||||
|
||||
abstract class PhocaGalleryBatch
|
||||
{
|
||||
|
||||
public static function item($published, $category = 0)
|
||||
{
|
||||
// Create the copy/move options.
|
||||
$options = array(
|
||||
HTMLHelper::_('select.option', 'c', Text::_('JLIB_HTML_BATCH_COPY')),
|
||||
HTMLHelper::_('select.option', 'm', Text::_('JLIB_HTML_BATCH_MOVE'))
|
||||
);
|
||||
|
||||
$db = Factory::getDbo();
|
||||
|
||||
//build the list of categories
|
||||
$query = 'SELECT a.title AS text, a.id AS value, a.parent_id as parentid'
|
||||
. ' FROM #__phocagallery_categories AS a'
|
||||
// TO DO. ' WHERE a.published = '.(int)$published
|
||||
. ' ORDER BY a.ordering';
|
||||
$db->setQuery( $query );
|
||||
$data = $db->loadObjectList();
|
||||
$tree = array();
|
||||
$text = '';
|
||||
$catId= -1;
|
||||
$tree = PhocaGalleryCategoryhtml::CategoryTreeOption($data, $tree, 0, $text, $catId);
|
||||
|
||||
if ($category == 1) {
|
||||
array_unshift($tree, HTMLHelper::_('select.option', 0, Text::_('JLIB_HTML_ADD_TO_ROOT'), 'value', 'text'));
|
||||
}
|
||||
|
||||
|
||||
// Create the batch selector to change select the category by which to move or copy.
|
||||
$lines = array(
|
||||
'<label id="batch-choose-action-lbl" for="batch-choose-action">',
|
||||
Text::_('JLIB_HTML_BATCH_MENU_LABEL'),
|
||||
'</label>',
|
||||
'<fieldset id="batch-choose-action" class="combo">',
|
||||
'<select name="batch[category_id]" class="form-select" id="batch-category-id">',
|
||||
'<option value=""> - '.Text::_('JSELECT').' - </option>',
|
||||
/*JHtml::_('select.options', JHtml::_('category.options', $extension, array('published' => (int) $published))),*/
|
||||
HTMLHelper::_('select.options', $tree ),
|
||||
'</select>',
|
||||
HTMLHelper::_( 'select.radiolist', $options, 'batch[move_copy]', '', 'value', 'text', 'm'),
|
||||
'</fieldset>'
|
||||
);
|
||||
|
||||
return implode("\n", $lines);
|
||||
}
|
||||
}
|
||||
?>
|
||||
@ -0,0 +1,64 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Phoca Gallery
|
||||
* @author Jan Pavelka - https://www.phoca.cz
|
||||
* @copyright Copyright (C) Jan Pavelka https://www.phoca.cz
|
||||
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 and later
|
||||
* @cms Joomla
|
||||
* @copyright Copyright (C) Open Source Matters. All rights reserved.
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
|
||||
*/
|
||||
defined('_JEXEC') or die;
|
||||
class PhocaGalleryCategory
|
||||
{
|
||||
public static function options($type = 0, $ignorePublished = 0)
|
||||
{
|
||||
if ($type == 1) {
|
||||
$tree[0] = new JObject();
|
||||
$tree[0]->text = JText::_('COM_PHOCAGALLERY_MAIN_CSS');
|
||||
$tree[0]->value = 1;
|
||||
$tree[1] = new JObject();
|
||||
$tree[1]->text = JText::_('COM_PHOCAGALLERY_CUSTOM_CSS');
|
||||
$tree[1]->value = 2;
|
||||
return $tree;
|
||||
}
|
||||
|
||||
$db = JFactory::getDBO();
|
||||
|
||||
//build the list of categories
|
||||
$query = 'SELECT a.title AS text, a.id AS value, a.parent_id as parentid'
|
||||
. ' FROM #__phocagallery_categories AS a';
|
||||
if ($ignorePublished == 0) {
|
||||
$query .= ' WHERE a.published = 1';
|
||||
}
|
||||
$query .= ' ORDER BY a.ordering';
|
||||
$db->setQuery( $query );
|
||||
$phocagallerys = $db->loadObjectList();
|
||||
|
||||
$catId = -1;
|
||||
|
||||
$javascript = 'class="inputbox" size="1" onchange="Joomla.submitform( );"';
|
||||
|
||||
$tree = array();
|
||||
$text = '';
|
||||
$tree = self::CategoryTreeOption($phocagallerys, $tree, 0, $text, $catId);
|
||||
|
||||
return $tree;
|
||||
|
||||
}
|
||||
|
||||
public static function CategoryTreeOption($data, $tree, $id=0, $text='', $currentId = 0) {
|
||||
|
||||
foreach ($data as $key) {
|
||||
$show_text = $text . $key->text;
|
||||
|
||||
if ($key->parentid == $id && $currentId != $id && $currentId != $key->value) {
|
||||
$tree[$key->value] = new JObject();
|
||||
$tree[$key->value]->text = $show_text;
|
||||
$tree[$key->value]->value = $key->value;
|
||||
$tree = self::CategoryTreeOption($data, $tree, $key->value, $show_text . " - ", $currentId );
|
||||
}
|
||||
}
|
||||
return($tree);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,67 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Phoca Gallery
|
||||
* @author Jan Pavelka - https://www.phoca.cz
|
||||
* @copyright Copyright (C) Jan Pavelka https://www.phoca.cz
|
||||
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 and later
|
||||
* @cms Joomla
|
||||
* @copyright Copyright (C) Open Source Matters. All rights reserved.
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
|
||||
*/
|
||||
defined('_JEXEC') or die;
|
||||
use Joomla\CMS\Object\CMSObject;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Factory;
|
||||
class PhocaGalleryCategoryhtml
|
||||
{
|
||||
public static function options($type = 0, $ignorePublished = 0)
|
||||
{
|
||||
if ($type == 1) {
|
||||
$tree[0] = new CMSObject();
|
||||
$tree[0]->text = Text::_('COM_PHOCAGALLERY_MAIN_CSS');
|
||||
$tree[0]->value = 1;
|
||||
$tree[1] = new CMSObject();
|
||||
$tree[1]->text = Text::_('COM_PHOCAGALLERY_CUSTOM_CSS');
|
||||
$tree[1]->value = 2;
|
||||
return $tree;
|
||||
}
|
||||
|
||||
$db = Factory::getDBO();
|
||||
|
||||
//build the list of categories
|
||||
$query = 'SELECT a.title AS text, a.id AS value, a.parent_id as parentid'
|
||||
. ' FROM #__phocagallery_categories AS a';
|
||||
if ($ignorePublished == 0) {
|
||||
$query .= ' WHERE a.published = 1';
|
||||
}
|
||||
$query .= ' ORDER BY a.ordering';
|
||||
$db->setQuery( $query );
|
||||
$phocagallerys = $db->loadObjectList();
|
||||
|
||||
$catId = -1;
|
||||
|
||||
$javascript = 'class="form-control" size="1" onchange="Joomla.submitform( );"';
|
||||
|
||||
$tree = array();
|
||||
$text = '';
|
||||
$tree = self::CategoryTreeOption($phocagallerys, $tree, 0, $text, $catId);
|
||||
|
||||
return $tree;
|
||||
|
||||
}
|
||||
|
||||
public static function CategoryTreeOption($data, $tree, $id=0, $text='', $currentId = 0) {
|
||||
|
||||
foreach ($data as $key) {
|
||||
$show_text = $text . $key->text;
|
||||
|
||||
if ($key->parentid == $id && $currentId != $id && $currentId != $key->value) {
|
||||
$tree[$key->value] = new CMSObject();
|
||||
$tree[$key->value]->text = $show_text;
|
||||
$tree[$key->value]->value = $key->value;
|
||||
$tree = self::CategoryTreeOption($data, $tree, $key->value, $show_text . " - ", $currentId );
|
||||
}
|
||||
}
|
||||
return($tree);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,141 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Phoca Gallery
|
||||
* @author Jan Pavelka - https://www.phoca.cz
|
||||
* @copyright Copyright (C) Jan Pavelka https://www.phoca.cz
|
||||
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 and later
|
||||
* @cms Joomla
|
||||
* @copyright Copyright (C) Open Source Matters. All rights reserved.
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
|
||||
*/
|
||||
|
||||
/*
|
||||
jimport('joomla.html.grid');
|
||||
jimport('joomla.html.html.grid');
|
||||
jimport('joomla.html.html.jgrid');
|
||||
*/
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
use Joomla\CMS\HTML\Helpers\Grid;
|
||||
use Joomla\CMS\HTML\HTMLHelper;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Factory;
|
||||
if (! class_exists('HTMLHelperGrid')) {
|
||||
require_once( JPATH_SITE.'/libraries/src/HTML/Helpers/Grid.php' );
|
||||
}
|
||||
|
||||
|
||||
|
||||
class PhocaGalleryGrid extends Grid
|
||||
{
|
||||
|
||||
public static function id($rowNum, $recId, $checkedOut = false, $name = 'cid', $stub = 'cb', $title = '', $formId = null)
|
||||
{
|
||||
if ($checkedOut)
|
||||
{
|
||||
return '';
|
||||
}
|
||||
else
|
||||
{
|
||||
return '<input type="checkbox" id="cb' . $rowNum . '" name="' . $name . '[]" value="' . $recId
|
||||
. '" onclick="Joomla.isChecked(this.checked, \'undefined\');" title="' . Text::sprintf('JGRID_CHECKBOX_ROW_N', ($rowNum + 1)) . '" />';
|
||||
//return '<input type="checkbox" id="cb' . $rowNum . '" name="' . $name . '[]" value="' . $recId
|
||||
// . '" title="' . JText::sprintf('JGRID_CHECKBOX_ROW_N', ($rowNum + 1)) . '" />';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to sort a column in a grid
|
||||
*
|
||||
* @param string $title The link title
|
||||
* @param string $order The order field for the column
|
||||
* @param string $direction The current direction
|
||||
* @param string $selected The selected ordering
|
||||
* @param string $task An optional task override
|
||||
* @param string $new_direction An optional direction for the new column
|
||||
* @param string $tip An optional text shown as tooltip title instead of $title
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @since 1.5
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* GRID in frontend must be customized
|
||||
* because Joomla! takes "adminForm" as the only one name of form ??????????????????????????????????????????
|
||||
*
|
||||
*/
|
||||
|
||||
public static function sort($title, $order, $direction = 'asc', $selected = 0, $task = null, $new_direction = 'asc', $tip = '', $form = '', $suffix = '')
|
||||
{
|
||||
|
||||
$direction = strtolower($direction);
|
||||
$icon = array('arrow-up-3', 'arrow-down-3');
|
||||
$index = (int) ($direction == 'desc');
|
||||
|
||||
if ($order != $selected)
|
||||
{
|
||||
$direction = $new_direction;
|
||||
}
|
||||
else
|
||||
{
|
||||
$direction = ($direction == 'desc') ? 'asc' : 'desc';
|
||||
}
|
||||
|
||||
$html = '<a href="#" onclick="Joomla.tableOrderingPhoca(\'' . $order . '\',\'' . $direction . '\',\'' . $task . '\',\'' . $form . '\',\'' . $suffix . '\');return false;"'
|
||||
. ' class="hasTooltip" title="' . HTMLHelper::tooltipText(($tip ? $tip : $title), 'JGLOBAL_CLICK_TO_SORT_THIS_COLUMN') . '">';
|
||||
|
||||
if (isset($title['0']) && $title['0'] == '<')
|
||||
{
|
||||
$html .= $title;
|
||||
}
|
||||
else
|
||||
{
|
||||
$html .= Text::_($title);
|
||||
}
|
||||
|
||||
if ($order == $selected)
|
||||
{
|
||||
|
||||
$html .= ' <i class="icon-' . $icon[$index] . ' glyphicon glyphicon-' . $icon[$index] . '"></i>';
|
||||
}
|
||||
|
||||
$html .= '</a>';
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
public static function renderSortJs() {
|
||||
|
||||
|
||||
$o = '';
|
||||
$o .= '<script type="text/javascript">'."\n";
|
||||
$o .= ''."\n";
|
||||
$o .= 'Joomla.tableOrderingPhoca = function(order, dir, task, form, suffix) {'."\n";
|
||||
$o .= ''."\n";
|
||||
$o .= ' if (typeof(form) === "undefined") {'."\n";
|
||||
$o .= ' form = document.getElementById("adminForm");'."\n";
|
||||
$o .= ' }'."\n";
|
||||
$o .= ''."\n";
|
||||
$o .= ''."\n";
|
||||
$o .= ' if (typeof form == "string" || form instanceof String) {'."\n";
|
||||
$o .= ' form = document.getElementById(form);'."\n";
|
||||
$o .= ' }'."\n";
|
||||
$o .= ''."\n";
|
||||
$o .= ' var orderS = "filter_order" + suffix;'."\n";
|
||||
$o .= ' var orderSDir = "filter_order_Dir" + suffix;'."\n";
|
||||
$o .= ''."\n";
|
||||
$o .= ' form[orderS].value = order;'."\n";
|
||||
$o .= ' form[orderSDir].value = dir;'."\n";
|
||||
$o .= ' Joomla.submitform(task, form);'."\n";
|
||||
$o .= ''."\n";
|
||||
$o .= '}'."\n";
|
||||
$o .= '</script>'."\n";
|
||||
|
||||
|
||||
|
||||
$document = Factory::getDocument();
|
||||
$document->addCustomTag($o);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1 @@
|
||||
<html><body></body></html>
|
||||
@ -0,0 +1,44 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Phoca Gallery
|
||||
* @author Jan Pavelka - https://www.phoca.cz
|
||||
* @copyright Copyright (C) Jan Pavelka https://www.phoca.cz
|
||||
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 and later
|
||||
* @cms Joomla
|
||||
* @copyright Copyright (C) Open Source Matters. All rights reserved.
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
|
||||
*/
|
||||
|
||||
/*
|
||||
jimport('joomla.html.grid');
|
||||
jimport('joomla.html.html.grid');
|
||||
jimport('joomla.html.html.jgrid');
|
||||
*/
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
use Joomla\CMS\HTML\Helpers\JGrid;
|
||||
use Joomla\CMS\HTML\HTMLHelper;
|
||||
if (! class_exists('HTMLHelperJGrid')) {
|
||||
require_once( JPATH_SITE.'/libraries/src/HTML/Helpers/JGrid.php' );
|
||||
}
|
||||
|
||||
class PhocaGalleryJGrid extends JGrid
|
||||
{
|
||||
|
||||
public static function approved($value, $i, $prefix = '', $enabled = true, $checkbox='cb')
|
||||
{
|
||||
if (is_array($prefix)) {
|
||||
$options = $prefix;
|
||||
$enabled = array_key_exists('enabled', $options) ? $options['enabled'] : $enabled;
|
||||
$checkbox = array_key_exists('checkbox', $options) ? $options['checkbox'] : $checkbox;
|
||||
$prefix = array_key_exists('prefix', $options) ? $options['prefix'] : '';
|
||||
}
|
||||
$states = array(
|
||||
1 => array('disapprove', 'COM_PHOCAGALLERY_APPROVED', 'COM_PHOCAGALLERY_NOT_APPROVE_ITEM', 'COM_PHOCAGALLERY_APPROVED', false, 'publish', 'publish'),
|
||||
0 => array('approve', 'COM_PHOCAGALLERY_NOT_APPROVED', 'COM_PHOCAGALLERY_APPROVE_ITEM', 'COM_PHOCAGALLERY_NOT_APPROVED', false, 'unpublish', 'unpublish')
|
||||
);
|
||||
return self::state($states, $value, $i, $prefix, $enabled, true, $checkbox);
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
@ -0,0 +1,354 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Phoca Gallery
|
||||
* @author Jan Pavelka - https://www.phoca.cz
|
||||
* @copyright Copyright (C) Jan Pavelka https://www.phoca.cz
|
||||
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 and later
|
||||
* @cms Joomla
|
||||
* @copyright Copyright (C) Open Source Matters. All rights reserved.
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
|
||||
*/
|
||||
defined( '_JEXEC' ) or die( 'Restricted access' );
|
||||
use Joomla\CMS\Filesystem\Path;
|
||||
use Joomla\CMS\Filesystem\File;
|
||||
use Joomla\CMS\Uri\Uri;
|
||||
use Joomla\CMS\Factory;
|
||||
|
||||
class PhocaGalleryImage
|
||||
{
|
||||
|
||||
public static function getImageSize($filename, $returnString = 0, $extLink = 0) {
|
||||
|
||||
phocagalleryimport('phocagallery.image.image');
|
||||
phocagalleryimport('phocagallery.path.path');
|
||||
|
||||
if ($extLink == 1) {
|
||||
$fileNameAbs = $filename;
|
||||
} else {
|
||||
$path = PhocaGalleryPath::getPath();
|
||||
$fileNameAbs = Path::clean($path->image_abs . $filename);
|
||||
|
||||
if (!File::exists($fileNameAbs)) {
|
||||
$fileNameAbs = $path->image_abs_front . 'phoca_thumb_l_no_image.png';
|
||||
}
|
||||
}
|
||||
|
||||
if ($returnString == 1) {
|
||||
$imageSize = @getimagesize($fileNameAbs);
|
||||
return $imageSize[0] . ' x '.$imageSize[1];
|
||||
} else {
|
||||
return @getimagesize($fileNameAbs);
|
||||
}
|
||||
}
|
||||
|
||||
public static 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);
|
||||
}
|
||||
$sizeA = array();
|
||||
if (isset($w) && isset($h)) {
|
||||
$sizeA['w'] = $w;
|
||||
$sizeA['h'] = $h;
|
||||
} else {
|
||||
$sizeA['w'] = 0;
|
||||
$sizeA['h'] = 0;
|
||||
}
|
||||
return $sizeA;
|
||||
}
|
||||
|
||||
|
||||
public static function correctSizeWithRate($width, $height, $corWidth = 100, $corHeight = 100) {
|
||||
$image['width'] = $corWidth;
|
||||
$image['height'] = $corHeight;
|
||||
|
||||
|
||||
|
||||
if ($width > $height) {
|
||||
if ($width > $corWidth) {
|
||||
$image['width'] = $corWidth;
|
||||
$rate = $width / $corWidth;
|
||||
$image['height'] = $height / $rate;
|
||||
} else {
|
||||
$image['width'] = $width;
|
||||
$image['height'] = $height;
|
||||
}
|
||||
} else {
|
||||
if ($height > $corHeight) {
|
||||
$image['height'] = $corHeight;
|
||||
$rate = $height / $corHeight;
|
||||
$image['width'] = $width / $rate;
|
||||
} else {
|
||||
$image['width'] = $width;
|
||||
$image['height'] = $height;
|
||||
}
|
||||
}
|
||||
return $image;
|
||||
}
|
||||
|
||||
public static function correctSize($imageSize, $size = 100, $sizeBox = 100, $sizeAdd = 0) {
|
||||
|
||||
$image['size'] = $imageSize;
|
||||
if ((int)$image['size'] < (int)$size ) {
|
||||
$image['size'] = $size;
|
||||
$image['boxsize'] = (int)$size + (int)$sizeAdd;
|
||||
} else {
|
||||
$image['boxsize'] = (int)$image['size'] + (int)$sizeAdd;
|
||||
}
|
||||
return $image;
|
||||
}
|
||||
|
||||
public static function correctSwitchSize($switchHeight, $switchWidth) {
|
||||
|
||||
$switchImage['height'] = $switchHeight;
|
||||
$switchImage['centerh'] = ($switchHeight / 2) - 18;
|
||||
$switchImage['width'] = $switchWidth;
|
||||
$switchImage['centerw'] = ($switchWidth / 2) - 18;
|
||||
$switchImage['height'] = $switchImage['height'] + 5;
|
||||
return $switchImage;
|
||||
}
|
||||
|
||||
/*
|
||||
* type ... 1 categories, 2 category view
|
||||
*/
|
||||
public static function setBoxSize($p, $type = 1) {
|
||||
|
||||
|
||||
$w = 20;
|
||||
$w2 = 25;
|
||||
$w3 = 18;
|
||||
$w4 = 40;
|
||||
|
||||
$boxWidth = 0;
|
||||
$boxSize['width'] = 0;
|
||||
$boxSize['height'] = 0;
|
||||
|
||||
|
||||
if (isset($p['imagewidth'])) {
|
||||
$boxSize['width'] = $boxSize['width'] + (int)$p['imagewidth'];
|
||||
}
|
||||
|
||||
if (isset($p['imageheight'])) {
|
||||
$boxSize['height'] = $boxSize['height'] + (int)$p['imageheight'];
|
||||
}
|
||||
|
||||
if (isset($p['display_name']) && ($p['display_name'] == 1 || $p['display_name'] == 2)) {
|
||||
$boxSize['height'] = $boxSize['height'] + $w;
|
||||
}
|
||||
|
||||
if ($type == 3) {
|
||||
$boxSize['height'] = $boxSize['height'] + $w;
|
||||
return $boxSize;
|
||||
}
|
||||
|
||||
if ( (isset($p['display_rating']) && $p['display_rating'] == 1) || (isset($p['display_rating_img']) && $p['display_rating_img'] > 0)) {
|
||||
|
||||
|
||||
if ($type == 1) {
|
||||
$boxSize['height'] = $boxSize['height'] + $w4;
|
||||
} else {
|
||||
$boxSize['height'] = $boxSize['height'] + $w;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (isset($p['displaying_tags_true']) && $p['displaying_tags_true'] == 1) {
|
||||
$boxSize['height'] = $boxSize['height'] + (int) + $w3;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if (isset($p['display_icon_detail']) && $p['display_icon_detail'] == 1) {
|
||||
$boxWidth = $boxWidth + $w;
|
||||
}
|
||||
if (isset($p['display_icon_download']) && (int)$p['display_icon_download'] > 0) {
|
||||
$boxWidth = $boxWidth + $w;
|
||||
}
|
||||
if (isset($p['display_icon_vm']) && $p['display_icon_vm'] == 1) {
|
||||
$boxWidth = $boxWidth + $w;
|
||||
}
|
||||
|
||||
if (isset($p['start_cooliris']) && $p['start_cooliris'] == 1) {
|
||||
$boxWidth = $boxWidth + $w;
|
||||
}
|
||||
|
||||
if (isset($p['trash']) && $p['trash'] == 1) {
|
||||
$boxWidth = $boxWidth + $w;
|
||||
}
|
||||
|
||||
if (isset($p['publish_unpublish']) && $p['publish_unpublish'] == 1) {
|
||||
$boxWidth = $boxWidth + $w;
|
||||
}
|
||||
|
||||
if (isset($p['display_icon_geo_box']) && $p['display_icon_geo_box'] == 1) {
|
||||
$boxWidth = $boxWidth + $w;
|
||||
}
|
||||
|
||||
if (isset($p['display_camera_info']) && $p['display_camera_info'] == 1) {
|
||||
$boxWidth = $boxWidth + $w;
|
||||
}
|
||||
|
||||
if (isset($p['display_icon_extlink1_box']) && $p['display_icon_extlink1_box'] == 1) {
|
||||
$boxWidth = $boxWidth + $w;
|
||||
}
|
||||
|
||||
if (isset($p['display_icon_extlink2_box']) && $p['display_icon_extlink2_box'] == 1) {
|
||||
$boxWidth = $boxWidth + $w;
|
||||
}
|
||||
|
||||
if (isset($p['approved_not_approved']) && $p['approved_not_approved'] == 1) {
|
||||
$boxWidth = $boxWidth + $w;
|
||||
}
|
||||
|
||||
if (isset($p['display_icon_commentimg_box']) && $p['display_icon_commentimg_box'] == 1) {
|
||||
$boxWidth = $boxWidth + $w;
|
||||
}
|
||||
|
||||
$boxHeightRows = ceil($boxWidth/$boxSize['width']);
|
||||
$boxSize['height'] = ($w * $boxHeightRows) + $boxSize['height'];
|
||||
|
||||
// LAST
|
||||
if ($type == 1) {
|
||||
if (isset($p['categories_box_space'])) {
|
||||
$boxSize['height'] = $boxSize['height'] + (int)$p['categories_box_space'];
|
||||
}
|
||||
} else {
|
||||
if (isset($p['category_box_space'])) {
|
||||
$boxSize['height'] = $boxSize['height'] + (int)$p['category_box_space'];
|
||||
}
|
||||
}
|
||||
|
||||
return $boxSize;
|
||||
}
|
||||
|
||||
public static function getPngQuality($thumbQuality) {
|
||||
|
||||
if ((int)$thumbQuality < 0) {
|
||||
$thumbQuality = 0;
|
||||
}
|
||||
if ((int)$thumbQuality > 100) {
|
||||
$thumbQuality = 100;
|
||||
}
|
||||
|
||||
$pngQuality = ($thumbQuality - 100) / 11.111111;
|
||||
$pngQuality = round(abs($pngQuality));
|
||||
return $pngQuality;
|
||||
}
|
||||
|
||||
public static function getJpegQuality($jpegQuality) {
|
||||
if ((int)$jpegQuality < 0) {
|
||||
$jpegQuality = 0;
|
||||
}
|
||||
if ((int)$jpegQuality > 100) {
|
||||
$jpegQuality = 100;
|
||||
}
|
||||
return $jpegQuality;
|
||||
}
|
||||
|
||||
/*
|
||||
* Transform image (only with html method) for overlib effect e.g.
|
||||
*
|
||||
* @param array An array of image size (width, height)
|
||||
* @param int Rate
|
||||
* @access public
|
||||
*/
|
||||
|
||||
public static function getTransformImageArray($imgSize, $rate) {
|
||||
if (isset($imgSize[0]) && isset($imgSize[1])) {
|
||||
$w = (int)$imgSize[0];
|
||||
$h = (int)$imgSize[1];
|
||||
|
||||
if ($w != 0) {$w = $w/$rate;} // plus or minus should be divided, not null
|
||||
if ($h != 0) {$h = $h/$rate;}
|
||||
$wHOutput = array('width' => $w, 'height' => $h, 'style' => 'background: #fff url('.Uri::base(true).'/media/com_phocagallery/images/icon-loading2.gif) 50% 50% no-repeat;');
|
||||
} else {
|
||||
$w = $h = 0;
|
||||
$wHOutput = array();
|
||||
}
|
||||
return $wHOutput;
|
||||
}
|
||||
|
||||
/*
|
||||
* Used for albums or specific images
|
||||
* Check if it is Picasa or Facebook category or image
|
||||
* If we ask only on image, the second parameter will be empty and will be ignnored
|
||||
* If we ask album, first check Picasa album, second check Facebook album
|
||||
*/
|
||||
|
||||
public static function isExtImage($extid, $extfbcatid = '') {
|
||||
|
||||
// EXTID (IMAGES): Picasa - yes, Facebook - yes
|
||||
// EXTID (ALBUMS): Picasa - yes, Facebook - no
|
||||
if (isset($extid) && $extid != '') {
|
||||
return true;
|
||||
}
|
||||
|
||||
// EXTFBCATID (IMAGES): Picasa - no, Facebook - no
|
||||
// EXTFBCATID (ALBUMS): Picasa - no, Facebook - yes
|
||||
if (isset($extfbcatid) && $extfbcatid != '') {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static function getImageByImageId($id = 0) {
|
||||
|
||||
$db = Factory::getDBO();
|
||||
$query = ' SELECT a.id, a.title, c.title as category_title'
|
||||
.' FROM #__phocagallery AS a'
|
||||
.' LEFT JOIN #__phocagallery_categories AS c ON c.id = a.catid'
|
||||
.' WHERE a.id = '.(int)$id
|
||||
.' GROUP BY a.id, a.title, c.title'
|
||||
.' ORDER BY a.id'
|
||||
.' LIMIT 1';
|
||||
$db->setQuery($query);
|
||||
$image = $db->loadObject();
|
||||
|
||||
return $image;
|
||||
}
|
||||
|
||||
public static function updateRealThumbnailSizes($image, $sizes) {
|
||||
|
||||
if ($image == '') {
|
||||
return false;
|
||||
}
|
||||
if (empty($sizes)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$path = PhocaGalleryPath::getPath();
|
||||
$file = str_replace($path->image_rel, '', $image);
|
||||
|
||||
$extW = '';
|
||||
if (isset($sizes['l']['w']) && isset($sizes['m']['w']) && isset($sizes['s']['w'])) {
|
||||
$extW = (int)$sizes['l']['w'].','.(int)$sizes['m']['w'].','.(int)$sizes['s']['w'];
|
||||
}
|
||||
$extH = '';
|
||||
if (isset($sizes['l']['h']) && isset($sizes['m']['h']) && isset($sizes['s']['h'])) {
|
||||
$extH = (int)$sizes['l']['h'].','.(int)$sizes['m']['h'].','.(int)$sizes['s']['h'];
|
||||
}
|
||||
|
||||
if ($file != '' && $extW != '' && $extH != '') {
|
||||
|
||||
$db = Factory::getDBO();
|
||||
$query = 'UPDATE #__phocagallery'
|
||||
.' SET extw = '.$db->quote($extW).','
|
||||
.' exth = '.$db->quote($extH)
|
||||
.' WHERE filename = '.$db->quote($file);
|
||||
|
||||
$db->setQuery($query);
|
||||
$db->execute();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
?>
|
||||
@ -0,0 +1,333 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Phoca Gallery
|
||||
* @author Jan Pavelka - https://www.phoca.cz
|
||||
* @copyright Copyright (C) Jan Pavelka https://www.phoca.cz
|
||||
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 and later
|
||||
* @cms Joomla
|
||||
* @copyright Copyright (C) Open Source Matters. All rights reserved.
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
|
||||
*/
|
||||
defined( '_JEXEC' ) or die( 'Restricted access' );
|
||||
use Joomla\CMS\Component\ComponentHelper;
|
||||
use Joomla\CMS\Filesystem\File;
|
||||
jimport( 'joomla.filesystem.folder' );
|
||||
jimport( 'joomla.filesystem.file' );
|
||||
phocagalleryimport('phocagallery.path.path');
|
||||
phocagalleryimport('phocagallery.file.file');
|
||||
phocagalleryimport('phocagallery.image.image');
|
||||
phocagalleryimport('phocagallery.utils.utils');
|
||||
|
||||
/*
|
||||
* Obsolete
|
||||
*/
|
||||
|
||||
class PhocaGalleryImageBgImage
|
||||
{
|
||||
public static function createBgImage($data, &$errorMsg) {
|
||||
|
||||
$params = ComponentHelper::getParams('com_phocagallery') ;
|
||||
$jfile_thumbs = $params->get( 'jfile_thumbs', 1 );
|
||||
$jpeg_quality = $params->get( 'jpeg_quality', 85 );
|
||||
$jpeg_quality = PhocaGalleryImage::getJpegQuality($jpeg_quality);
|
||||
$webp_quality = $params->get( 'webp_quality', 80 );
|
||||
$webp_quality = PhocaGalleryImage::getJpegQuality($webp_quality);
|
||||
$avif_quality = $params->get( 'avif_quality', 80 );
|
||||
$avif_quality = PhocaGalleryImage::getJpegQuality($avif_quality);
|
||||
$formatIcon = 'png';
|
||||
$path = PhocaGalleryPath::getPath();
|
||||
|
||||
$fileIn = $fileOut = $path->image_abs_front. $data['image'] .'.'. $formatIcon;
|
||||
|
||||
if ($fileIn !== '' && File::exists($fileIn)) {
|
||||
|
||||
/*$memory = 8;
|
||||
$memoryLimitChanged = 0;
|
||||
|
||||
$memory = (int)ini_get( 'memory_limit' );
|
||||
if ($memory == 0) {
|
||||
$memory = 8;
|
||||
}
|
||||
|
||||
// Try to increase memory
|
||||
if ($memory < 50) {
|
||||
ini_set('memory_limit', '50M');
|
||||
$memoryLimitChanged = 1;
|
||||
}*/
|
||||
|
||||
$imageWidth = $data['iw'];
|
||||
$imageHeight = $data['ih'];
|
||||
$completeImageWidth = $imageWidth + 18;
|
||||
$completeImageHeight = $imageHeight + 18;
|
||||
|
||||
$completeImageBackground = $data['sbgc'];
|
||||
$retangleColor = $data['ibgc'];
|
||||
$borderColor = $data['ibrdc'];
|
||||
$shadowColor = $data['iec'];
|
||||
$effect = $data['ie'];// shadow or glow
|
||||
|
||||
$imgX = 6; $imgWX = $imageWidth + 5 + $imgX;// Image Width + space (padding) + Start Position
|
||||
$imgY = 6; $imgHY = $imageHeight + 5 + $imgY;
|
||||
$brdX = $imgX - 1; $brdWX = $imgWX + 1;
|
||||
$brdY = $imgY - 1; $brdHY = $imgHY + 1;
|
||||
|
||||
// Crate an image
|
||||
$img = @imagecreatetruecolor($completeImageWidth, $completeImageHeight);
|
||||
if (!$img) {
|
||||
$errorMsg = 'ErrorNoImageCreateTruecolor';
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($completeImageBackground == '') {
|
||||
switch($formatIcon) {
|
||||
case 'jpg':
|
||||
case 'jpeg':
|
||||
case 'gif':
|
||||
$completeImageBackground = '#ffffff';
|
||||
break;
|
||||
case 'png':
|
||||
case 'webp':
|
||||
case 'avif':
|
||||
@imagealphablending($img,false);
|
||||
imagefilledrectangle($img,0,0,$completeImageWidth,$completeImageHeight,imagecolorallocatealpha($img,255,255,255,127));
|
||||
@imagealphablending($img,true);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
$bGClr = PhocaGalleryUtils::htmlToRgb($completeImageBackground);
|
||||
imagefilledrectangle($img, 0, 0, $completeImageWidth, $completeImageHeight, imagecolorallocate($img, $bGClr[0], $bGClr[1], $bGClr[2]));
|
||||
}
|
||||
|
||||
// Create Retangle
|
||||
if ($retangleColor != '') {
|
||||
$rtgClr = PhocaGalleryUtils::htmlToRgb($retangleColor);
|
||||
$retangle = imagecolorallocate($img, $rtgClr[0], $rtgClr[1], $rtgClr[2]);
|
||||
}
|
||||
// Create Border
|
||||
if ($borderColor != '') {
|
||||
$brdClr = PhocaGalleryUtils::htmlToRgb($borderColor);
|
||||
$border = imagecolorallocate($img, $brdClr[0], $brdClr[1], $brdClr[2]);
|
||||
}
|
||||
|
||||
// Effect (shadow,glow)
|
||||
if ((int)$effect > 0)
|
||||
if ($shadowColor != '') {
|
||||
$shdClr = PhocaGalleryUtils::htmlToRgb($shadowColor);
|
||||
|
||||
if ((int)$effect == 3) {
|
||||
$shdX = $brdX - 1;
|
||||
$shdY = $brdY - 1;
|
||||
$effectArray = array(55,70,85,100,115);
|
||||
} else if ((int)$effect == 2) {
|
||||
$shdX = $brdX + 3;
|
||||
$shdY = $brdY + 3;
|
||||
$effectArray = array(50, 70, 90, 110);
|
||||
} else {
|
||||
$shdX = $brdX + 3;
|
||||
$shdY = $brdY + 3;
|
||||
$effectArray = array(0,0,0,0);
|
||||
}
|
||||
$shdWX = $brdWX + 1;
|
||||
$shdHY = $brdHY + 1;
|
||||
|
||||
|
||||
foreach($effectArray as $key => $value) {
|
||||
$effectImg = @imagecolorallocatealpha($img, $shdClr[0], $shdClr[1], $shdClr[2],$value);
|
||||
if (!$effectImg) {
|
||||
$errorMsg = 'ErrorNoImageColorAllocateAlpha';
|
||||
return false;
|
||||
}
|
||||
imagerectangle($img, $shdX, $shdY, $shdWX, $shdHY, $effectImg);
|
||||
|
||||
if ((int)$effect == 3) {
|
||||
$shdX--;
|
||||
$shdY--;
|
||||
|
||||
} else if ((int)$effect == 2) {
|
||||
$shdX++;
|
||||
$shdY++;
|
||||
|
||||
} else {
|
||||
//$shdX++;
|
||||
//$shdY++;
|
||||
}
|
||||
|
||||
$shdWX++;
|
||||
$shdHY++;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// Write Rectangle over the shadow
|
||||
if ($retangleColor != '') {
|
||||
imagefilledrectangle($img, $imgX, $imgY, $imgWX, $imgHY, $retangle);
|
||||
}
|
||||
if ($borderColor != '') {
|
||||
imagerectangle($img, $brdX, $brdY, $brdWX, $brdHY, $border);
|
||||
}
|
||||
|
||||
|
||||
switch($formatIcon) {
|
||||
case 'jpg':
|
||||
case 'jpeg':
|
||||
if (!function_exists('ImageJPEG')) {
|
||||
$errorMsg = 'ErrorNoJPGFunction';
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($jfile_thumbs == 1) {
|
||||
ob_start();
|
||||
if (!@ImageJPEG($img, NULL, $jpeg_quality)) {
|
||||
ob_end_clean();
|
||||
$errorMsg = 'ErrorWriteFile';
|
||||
return false;
|
||||
}
|
||||
$imgJPEGToWrite = ob_get_contents();
|
||||
ob_end_clean();
|
||||
|
||||
if(!File::write( $fileOut, $imgJPEGToWrite)) {
|
||||
$errorMsg = 'ErrorWriteFile';
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if (!@ImageJPEG($img, $fileOut, $jpeg_quality)) {
|
||||
$errorMsg = 'ErrorWriteFile';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 'png' :
|
||||
if (!function_exists('ImagePNG')) {
|
||||
$errorMsg = 'ErrorNoPNGFunction';
|
||||
return false;
|
||||
}
|
||||
@imagesavealpha($img, true);
|
||||
if ($jfile_thumbs == 1) {
|
||||
ob_start();
|
||||
if (!@ImagePNG($img, NULL)) {
|
||||
ob_end_clean();
|
||||
$errorMsg = 'ErrorWriteFile';
|
||||
return false;
|
||||
}
|
||||
$imgPNGToWrite = ob_get_contents();
|
||||
ob_end_clean();
|
||||
|
||||
if(!File::write( $fileOut, $imgPNGToWrite)) {
|
||||
$errorMsg = 'ErrorWriteFile';
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if (!@ImagePNG($img, $fileOut)) {
|
||||
$errorMsg = 'ErrorWriteFile';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 'gif' :
|
||||
if (!function_exists('ImageGIF')) {
|
||||
$errorMsg = 'ErrorNoGIFFunction';
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($jfile_thumbs == 1) {
|
||||
ob_start();
|
||||
if (!@ImageGIF($img, NULL)) {
|
||||
ob_end_clean();
|
||||
$errorMsg = 'ErrorWriteFile';
|
||||
return false;
|
||||
}
|
||||
$imgGIFToWrite = ob_get_contents();
|
||||
ob_end_clean();
|
||||
|
||||
if(!File::write( $fileOut, $imgGIFToWrite)) {
|
||||
$errorMsg = 'ErrorWriteFile';
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if (!@ImageGIF($img, $fileOut)) {
|
||||
$errorMsg = 'ErrorWriteFile';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 'webp' :
|
||||
if (!function_exists('ImageWebp')) {
|
||||
$errorMsg = 'ErrorNoWEBPFunction';
|
||||
return false;
|
||||
}
|
||||
@imagesavealpha($img, true);
|
||||
if ($jfile_thumbs == 1) {
|
||||
ob_start();
|
||||
if (!@imagewebp($img, NULL, $webp_quality)) {
|
||||
ob_end_clean();
|
||||
$errorMsg = 'ErrorWriteFile';
|
||||
return false;
|
||||
}
|
||||
$imgWEBPToWrite = ob_get_contents();
|
||||
ob_end_clean();
|
||||
|
||||
if(!File::write( $fileOut, $imgWEBPToWrite)) {
|
||||
$errorMsg = 'ErrorWriteFile';
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if (!@imagewebp($img, $fileOut, $webp_quality)) {
|
||||
$errorMsg = 'ErrorWriteFile';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 'avif' :
|
||||
if (!function_exists('ImageAvif')) {
|
||||
$errorMsg = 'ErrorNoAVIFFunction';
|
||||
return false;
|
||||
}
|
||||
@imagesavealpha($img, true);
|
||||
if ($jfile_thumbs == 1) {
|
||||
ob_start();
|
||||
if (!@imageavif($img, NULL, $avif_quality)) {
|
||||
ob_end_clean();
|
||||
$errorMsg = 'ErrorWriteFile';
|
||||
return false;
|
||||
}
|
||||
$imgAVIFToWrite = ob_get_contents();
|
||||
ob_end_clean();
|
||||
|
||||
if(!File::write( $fileOut, $imgAVIFToWrite)) {
|
||||
$errorMsg = 'ErrorWriteFile';
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if (!@imageavif($img, $fileOut, $webp_quality)) {
|
||||
$errorMsg = 'ErrorWriteFile';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
Default:
|
||||
$errorMsg = 'ErrorNotSupportedImage';
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
|
||||
// free memory
|
||||
ImageDestroy($img);// Original
|
||||
|
||||
/*if ($memoryLimitChanged == 1) {
|
||||
$memoryString = $memory . 'M';
|
||||
ini_set('memory_limit', $memoryString);
|
||||
}*/
|
||||
|
||||
return true; // Success
|
||||
}
|
||||
|
||||
$errorMsg = 'Error2';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
?>
|
||||
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user