primo commit
This commit is contained in:
@ -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' );
|
||||
}
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user