You've already forked joomla_test
first commit
This commit is contained in:
12
administrator/components/com_k2/access.xml
Normal file
12
administrator/components/com_k2/access.xml
Normal file
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<access component="com_k2">
|
||||
<section name="component">
|
||||
<action name="core.admin" title="JACTION_ADMIN" description="JACTION_ADMIN_COMPONENT_DESC"/>
|
||||
<action name="core.manage" title="JACTION_MANAGE" description="JACTION_MANAGE_COMPONENT_DESC"/>
|
||||
<action name="core.create" title="JACTION_CREATE" description="JACTION_CREATE_COMPONENT_DESC"/>
|
||||
<action name="core.delete" title="JACTION_DELETE" description="JACTION_DELETE_COMPONENT_DESC"/>
|
||||
<action name="core.edit" title="JACTION_EDIT" description="JACTION_EDIT_COMPONENT_DESC"/>
|
||||
<action name="core.edit.state" title="JACTION_EDITSTATE" description="JACTION_EDITSTATE_COMPONENT_DESC"/>
|
||||
<action name="core.edit.own" title="JACTION_EDITOWN" description="JACTION_EDITOWN_COMPONENT_DESC"/>
|
||||
</section>
|
||||
</access>
|
||||
1134
administrator/components/com_k2/config.xml
Normal file
1134
administrator/components/com_k2/config.xml
Normal file
File diff suppressed because it is too large
Load Diff
151
administrator/components/com_k2/controllers/categories.php
Normal file
151
administrator/components/com_k2/controllers/categories.php
Normal file
@@ -0,0 +1,151 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: categories.php 1812 2013-01-14 18:45:06Z lefteris.kavadas $
|
||||
* @package K2
|
||||
* @author JoomlaWorks http://www.joomlaworks.net
|
||||
* @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.
|
||||
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
jimport('joomla.application.component.controller');
|
||||
|
||||
class K2ControllerCategories extends K2Controller
|
||||
{
|
||||
|
||||
public function display($cachable = false, $urlparams = array())
|
||||
{
|
||||
JRequest::setVar('view', 'categories');
|
||||
parent::display();
|
||||
}
|
||||
|
||||
function publish()
|
||||
{
|
||||
JRequest::checkToken() or jexit('Invalid Token');
|
||||
$model = $this->getModel('categories');
|
||||
$model->publish();
|
||||
}
|
||||
|
||||
function unpublish()
|
||||
{
|
||||
JRequest::checkToken() or jexit('Invalid Token');
|
||||
$model = $this->getModel('categories');
|
||||
$model->unpublish();
|
||||
}
|
||||
|
||||
function saveorder()
|
||||
{
|
||||
JRequest::checkToken() or jexit('Invalid Token');
|
||||
$model = $this->getModel('categories');
|
||||
$model->saveorder();
|
||||
$document = JFactory::getDocument();
|
||||
if ($document->getType() == 'raw')
|
||||
{
|
||||
echo '1';
|
||||
return $this;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->setRedirect('index.php?option=com_k2&view=categories', JText::_('K2_NEW_ORDERING_SAVED'));
|
||||
}
|
||||
}
|
||||
|
||||
function orderup()
|
||||
{
|
||||
JRequest::checkToken() or jexit('Invalid Token');
|
||||
$model = $this->getModel('categories');
|
||||
$model->orderup();
|
||||
}
|
||||
|
||||
function orderdown()
|
||||
{
|
||||
JRequest::checkToken() or jexit('Invalid Token');
|
||||
$model = $this->getModel('categories');
|
||||
$model->orderdown();
|
||||
}
|
||||
|
||||
function accessregistered()
|
||||
{
|
||||
JRequest::checkToken() or jexit('Invalid Token');
|
||||
$model = $this->getModel('categories');
|
||||
$model->accessregistered();
|
||||
}
|
||||
|
||||
function accessspecial()
|
||||
{
|
||||
JRequest::checkToken() or jexit('Invalid Token');
|
||||
$model = $this->getModel('categories');
|
||||
$model->accessspecial();
|
||||
}
|
||||
|
||||
function accesspublic()
|
||||
{
|
||||
JRequest::checkToken() or jexit('Invalid Token');
|
||||
$model = $this->getModel('categories');
|
||||
$model->accesspublic();
|
||||
}
|
||||
|
||||
function trash()
|
||||
{
|
||||
JRequest::checkToken() or jexit('Invalid Token');
|
||||
$model = $this->getModel('categories');
|
||||
$model->trash();
|
||||
}
|
||||
|
||||
function restore()
|
||||
{
|
||||
JRequest::checkToken() or jexit('Invalid Token');
|
||||
$model = $this->getModel('categories');
|
||||
$model->restore();
|
||||
}
|
||||
|
||||
function remove()
|
||||
{
|
||||
JRequest::checkToken() or jexit('Invalid Token');
|
||||
$model = $this->getModel('categories');
|
||||
$model->remove();
|
||||
}
|
||||
|
||||
function add()
|
||||
{
|
||||
$mainframe = JFactory::getApplication();
|
||||
$mainframe->redirect('index.php?option=com_k2&view=category');
|
||||
}
|
||||
|
||||
function edit()
|
||||
{
|
||||
$mainframe = JFactory::getApplication();
|
||||
$cid = JRequest::getVar('cid');
|
||||
$mainframe->redirect('index.php?option=com_k2&view=category&cid='.$cid[0]);
|
||||
}
|
||||
|
||||
function element()
|
||||
{
|
||||
JRequest::setVar('view', 'categories');
|
||||
JRequest::setVar('layout', 'element');
|
||||
parent::display();
|
||||
}
|
||||
|
||||
function move()
|
||||
{
|
||||
$view = $this->getView('categories', 'html');
|
||||
$view->setLayout('move');
|
||||
$view->move();
|
||||
}
|
||||
|
||||
function saveMove()
|
||||
{
|
||||
$model = $this->getModel('categories');
|
||||
$model->move();
|
||||
}
|
||||
|
||||
function copy()
|
||||
{
|
||||
JRequest::checkToken() or jexit('Invalid Token');
|
||||
$model = $this->getModel('categories');
|
||||
$model->copy();
|
||||
}
|
||||
|
||||
}
|
||||
49
administrator/components/com_k2/controllers/category.php
Normal file
49
administrator/components/com_k2/controllers/category.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: category.php 1812 2013-01-14 18:45:06Z lefteris.kavadas $
|
||||
* @package K2
|
||||
* @author JoomlaWorks http://www.joomlaworks.net
|
||||
* @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.
|
||||
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
jimport('joomla.application.component.controller');
|
||||
|
||||
class K2ControllerCategory extends K2Controller
|
||||
{
|
||||
|
||||
public function display($cachable = false, $urlparams = array())
|
||||
{
|
||||
JRequest::setVar('view', 'category');
|
||||
parent::display();
|
||||
}
|
||||
|
||||
function save()
|
||||
{
|
||||
JRequest::checkToken() or jexit('Invalid Token');
|
||||
$model = $this->getModel('category');
|
||||
$model->save();
|
||||
}
|
||||
|
||||
function saveAndNew()
|
||||
{
|
||||
JRequest::checkToken() or jexit('Invalid Token');
|
||||
$model = $this->getModel('category');
|
||||
$model->save();
|
||||
}
|
||||
|
||||
function apply()
|
||||
{
|
||||
$this->save();
|
||||
}
|
||||
|
||||
function cancel()
|
||||
{
|
||||
$mainframe = JFactory::getApplication();
|
||||
$mainframe->redirect('index.php?option=com_k2&view=categories');
|
||||
}
|
||||
|
||||
}
|
||||
60
administrator/components/com_k2/controllers/comments.php
Normal file
60
administrator/components/com_k2/controllers/comments.php
Normal file
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: comments.php 1812 2013-01-14 18:45:06Z lefteris.kavadas $
|
||||
* @package K2
|
||||
* @author JoomlaWorks http://www.joomlaworks.net
|
||||
* @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.
|
||||
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
jimport('joomla.application.component.controller');
|
||||
|
||||
class K2ControllerComments extends K2Controller
|
||||
{
|
||||
|
||||
public function display($cachable = false, $urlparams = array())
|
||||
{
|
||||
require_once (JPATH_SITE.DS.'components'.DS.'com_k2'.DS.'helpers'.DS.'route.php');
|
||||
JRequest::setVar('view', 'comments');
|
||||
parent::display();
|
||||
}
|
||||
|
||||
function publish()
|
||||
{
|
||||
JRequest::checkToken() or jexit('Invalid Token');
|
||||
$model = $this->getModel('comments');
|
||||
$model->publish();
|
||||
}
|
||||
|
||||
function unpublish()
|
||||
{
|
||||
JRequest::checkToken() or jexit('Invalid Token');
|
||||
$model = $this->getModel('comments');
|
||||
$model->unpublish();
|
||||
}
|
||||
|
||||
function remove()
|
||||
{
|
||||
JRequest::checkToken() or jexit('Invalid Token');
|
||||
$model = $this->getModel('comments');
|
||||
$model->remove();
|
||||
}
|
||||
|
||||
function deleteUnpublished()
|
||||
{
|
||||
JRequest::checkToken() or jexit('Invalid Token');
|
||||
$model = $this->getModel('comments');
|
||||
$model->deleteUnpublished();
|
||||
}
|
||||
|
||||
function saveComment()
|
||||
{
|
||||
JRequest::checkToken() or jexit('Invalid Token');
|
||||
$model = $this->getModel('comments');
|
||||
$model->save();
|
||||
}
|
||||
|
||||
}
|
||||
49
administrator/components/com_k2/controllers/controller.php
Normal file
49
administrator/components/com_k2/controllers/controller.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: controller.php 1812 2013-01-14 18:45:06Z lefteris.kavadas $
|
||||
* @package K2
|
||||
* @author JoomlaWorks http://www.joomlaworks.net
|
||||
* @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.
|
||||
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die ;
|
||||
|
||||
jimport('joomla.application.component.controller');
|
||||
|
||||
if (version_compare(JVERSION, '3.0', 'ge'))
|
||||
{
|
||||
class K2Controller extends JControllerLegacy
|
||||
{
|
||||
public function display($cachable = false, $urlparams = array())
|
||||
{
|
||||
parent::display($cachable, $urlparams);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
else if (version_compare(JVERSION, '2.5', 'ge'))
|
||||
{
|
||||
class K2Controller extends JController
|
||||
{
|
||||
public function display($cachable = false, $urlparams = false)
|
||||
{
|
||||
parent::display($cachable, $urlparams);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
class K2Controller extends JController
|
||||
{
|
||||
public function display($cachable = false)
|
||||
{
|
||||
parent::display($cachable);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
42
administrator/components/com_k2/controllers/extrafield.php
Normal file
42
administrator/components/com_k2/controllers/extrafield.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: extrafield.php 1812 2013-01-14 18:45:06Z lefteris.kavadas $
|
||||
* @package K2
|
||||
* @author JoomlaWorks http://www.joomlaworks.net
|
||||
* @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.
|
||||
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
jimport('joomla.application.component.controller');
|
||||
|
||||
class K2ControllerExtraField extends K2Controller
|
||||
{
|
||||
|
||||
public function display($cachable = false, $urlparams = array())
|
||||
{
|
||||
JRequest::setVar('view', 'extrafield');
|
||||
parent::display();
|
||||
}
|
||||
|
||||
function save()
|
||||
{
|
||||
JRequest::checkToken() or jexit('Invalid Token');
|
||||
$model = $this->getModel('extraField');
|
||||
$model->save();
|
||||
}
|
||||
|
||||
function apply()
|
||||
{
|
||||
$this->save();
|
||||
}
|
||||
|
||||
function cancel()
|
||||
{
|
||||
$mainframe = JFactory::getApplication();
|
||||
$mainframe->redirect('index.php?option=com_k2&view=extrafields');
|
||||
}
|
||||
|
||||
}
|
||||
89
administrator/components/com_k2/controllers/extrafields.php
Normal file
89
administrator/components/com_k2/controllers/extrafields.php
Normal file
@@ -0,0 +1,89 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: extrafields.php 1812 2013-01-14 18:45:06Z lefteris.kavadas $
|
||||
* @package K2
|
||||
* @author JoomlaWorks http://www.joomlaworks.net
|
||||
* @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.
|
||||
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die ;
|
||||
|
||||
jimport('joomla.application.component.controller');
|
||||
|
||||
class K2ControllerExtraFields extends K2Controller
|
||||
{
|
||||
|
||||
public function display($cachable = false, $urlparams = array())
|
||||
{
|
||||
JRequest::setVar('view', 'extrafields');
|
||||
parent::display();
|
||||
}
|
||||
|
||||
function publish()
|
||||
{
|
||||
JRequest::checkToken() or jexit('Invalid Token');
|
||||
$model = $this->getModel('extraFields');
|
||||
$model->publish();
|
||||
}
|
||||
|
||||
function unpublish()
|
||||
{
|
||||
JRequest::checkToken() or jexit('Invalid Token');
|
||||
$model = $this->getModel('extraFields');
|
||||
$model->unpublish();
|
||||
}
|
||||
|
||||
function saveorder()
|
||||
{
|
||||
JRequest::checkToken() or jexit('Invalid Token');
|
||||
$model = $this->getModel('extraFields');
|
||||
$model->saveorder();
|
||||
$document = JFactory::getDocument();
|
||||
if ($document->getType() == 'raw')
|
||||
{
|
||||
echo '1';
|
||||
return $this;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->setRedirect('index.php?option=com_k2&view=extrafields', JText::_('K2_NEW_ORDERING_SAVED'));
|
||||
}
|
||||
}
|
||||
|
||||
function orderup()
|
||||
{
|
||||
JRequest::checkToken() or jexit('Invalid Token');
|
||||
$model = $this->getModel('extraFields');
|
||||
$model->orderup();
|
||||
}
|
||||
|
||||
function orderdown()
|
||||
{
|
||||
JRequest::checkToken() or jexit('Invalid Token');
|
||||
$model = $this->getModel('extraFields');
|
||||
$model->orderdown();
|
||||
}
|
||||
|
||||
function remove()
|
||||
{
|
||||
JRequest::checkToken() or jexit('Invalid Token');
|
||||
$model = $this->getModel('extraFields');
|
||||
$model->remove();
|
||||
}
|
||||
|
||||
function add()
|
||||
{
|
||||
$mainframe = JFactory::getApplication();
|
||||
$mainframe->redirect('index.php?option=com_k2&view=extrafield');
|
||||
}
|
||||
|
||||
function edit()
|
||||
{
|
||||
$mainframe = JFactory::getApplication();
|
||||
$cid = JRequest::getVar('cid');
|
||||
$mainframe->redirect('index.php?option=com_k2&view=extrafield&cid='.$cid[0]);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: extrafieldsgroup.php 1812 2013-01-14 18:45:06Z lefteris.kavadas $
|
||||
* @package K2
|
||||
* @author JoomlaWorks http://www.joomlaworks.net
|
||||
* @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.
|
||||
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
jimport('joomla.application.component.controller');
|
||||
|
||||
class K2ControllerExtraFieldsGroup extends K2Controller
|
||||
{
|
||||
|
||||
public function display($cachable = false, $urlparams = array())
|
||||
{
|
||||
JRequest::setVar('view', 'extrafieldsgroup');
|
||||
$model = $this->getModel('extraFields');
|
||||
$view = $this->getView('extrafieldsgroup', 'html');
|
||||
$view->setModel($model, true);
|
||||
parent::display();
|
||||
}
|
||||
|
||||
function save()
|
||||
{
|
||||
JRequest::checkToken() or jexit('Invalid Token');
|
||||
$model = $this->getModel('extraFields');
|
||||
$view = $this->getView('extrafieldsgroup', 'html');
|
||||
$view->setModel($model, true);
|
||||
$model->saveGroup();
|
||||
}
|
||||
|
||||
function apply()
|
||||
{
|
||||
$this->save();
|
||||
}
|
||||
|
||||
function cancel()
|
||||
{
|
||||
$mainframe = JFactory::getApplication();
|
||||
$mainframe->redirect('index.php?option=com_k2&view=extrafieldsgroups');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: extrafieldsgroups.php 1812 2013-01-14 18:45:06Z lefteris.kavadas $
|
||||
* @package K2
|
||||
* @author JoomlaWorks http://www.joomlaworks.net
|
||||
* @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.
|
||||
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
jimport('joomla.application.component.controller');
|
||||
|
||||
class K2ControllerExtraFieldsGroups extends K2Controller
|
||||
{
|
||||
|
||||
public function display($cachable = false, $urlparams = array())
|
||||
{
|
||||
JRequest::setVar('view', 'extrafieldsgroups');
|
||||
$model = $this->getModel('extraFields');
|
||||
$view = $this->getView('extrafieldsgroups', 'html');
|
||||
$view->setModel($model, true);
|
||||
parent::display();
|
||||
}
|
||||
|
||||
function add()
|
||||
{
|
||||
$mainframe = JFactory::getApplication();
|
||||
$mainframe->redirect('index.php?option=com_k2&view=extrafieldsgroup');
|
||||
}
|
||||
|
||||
function edit()
|
||||
{
|
||||
$mainframe = JFactory::getApplication();
|
||||
$cid = JRequest::getVar('cid');
|
||||
$mainframe->redirect('index.php?option=com_k2&view=extrafieldsgroup&cid='.$cid[0]);
|
||||
}
|
||||
|
||||
function remove()
|
||||
{
|
||||
JRequest::checkToken() or jexit('Invalid Token');
|
||||
$model = $this->getModel('extraFields');
|
||||
$model->removeGroups();
|
||||
}
|
||||
|
||||
}
|
||||
24
administrator/components/com_k2/controllers/info.php
Normal file
24
administrator/components/com_k2/controllers/info.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: info.php 1812 2013-01-14 18:45:06Z lefteris.kavadas $
|
||||
* @package K2
|
||||
* @author JoomlaWorks http://www.joomlaworks.net
|
||||
* @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.
|
||||
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
jimport('joomla.application.component.controller');
|
||||
|
||||
class K2ControllerInfo extends K2Controller
|
||||
{
|
||||
|
||||
public function display($cachable = false, $urlparams = array())
|
||||
{
|
||||
JRequest::setVar('view', 'info');
|
||||
parent::display();
|
||||
}
|
||||
|
||||
}
|
||||
115
administrator/components/com_k2/controllers/item.php
Normal file
115
administrator/components/com_k2/controllers/item.php
Normal file
@@ -0,0 +1,115 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: item.php 1812 2013-01-14 18:45:06Z lefteris.kavadas $
|
||||
* @package K2
|
||||
* @author JoomlaWorks http://www.joomlaworks.net
|
||||
* @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.
|
||||
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die ;
|
||||
|
||||
jimport('joomla.application.component.controller');
|
||||
|
||||
class K2ControllerItem extends K2Controller
|
||||
{
|
||||
|
||||
public function display($cachable = false, $urlparams = array())
|
||||
{
|
||||
JRequest::setVar('view', 'item');
|
||||
parent::display();
|
||||
}
|
||||
|
||||
function save()
|
||||
{
|
||||
JRequest::checkToken() or jexit('Invalid Token');
|
||||
$model = $this->getModel('item');
|
||||
$model->save();
|
||||
}
|
||||
|
||||
function apply()
|
||||
{
|
||||
$this->save();
|
||||
}
|
||||
|
||||
function cancel()
|
||||
{
|
||||
JRequest::checkToken() or jexit('Invalid Token');
|
||||
$model = $this->getModel('item');
|
||||
$model->cancel();
|
||||
}
|
||||
|
||||
function deleteAttachment()
|
||||
{
|
||||
$model = $this->getModel('item');
|
||||
$model->deleteAttachment();
|
||||
}
|
||||
|
||||
function tag()
|
||||
{
|
||||
$model = $this->getModel('tag');
|
||||
$model->addTag();
|
||||
}
|
||||
|
||||
function download()
|
||||
{
|
||||
$model = $this->getModel('item');
|
||||
$model->download();
|
||||
}
|
||||
|
||||
function extraFields()
|
||||
{
|
||||
$mainframe = JFactory::getApplication();
|
||||
$itemID = JRequest::getInt('id', NULL);
|
||||
$categoryModel = $this->getModel('category');
|
||||
$category = $categoryModel->getData();
|
||||
$extraFieldModel = $this->getModel('extraField');
|
||||
$extraFields = $extraFieldModel->getExtraFieldsByGroup($category->extraFieldsGroup);
|
||||
|
||||
$output = '<table class="admintable" id="extraFields">';
|
||||
$counter = 0;
|
||||
if (count($extraFields))
|
||||
{
|
||||
foreach ($extraFields as $extraField)
|
||||
{
|
||||
|
||||
if ($extraField->type == 'header')
|
||||
{
|
||||
$output .= '<tr><td colspan="2" ><h4 class="k2ExtraFieldHeader">'.$extraField->name.'</h4></td></tr>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$output .= '<tr><td align="right" class="key"><label for="K2ExtraField_'.$extraField->id.'">'.$extraField->name.'</label></td>';
|
||||
$output .= '<td>'.$extraFieldModel->renderExtraField($extraField, $itemID).'</td></tr>';
|
||||
}
|
||||
$counter++;
|
||||
}
|
||||
}
|
||||
$output .= '</table>';
|
||||
|
||||
if ($counter == 0)
|
||||
$output = JText::_('K2_THIS_CATEGORY_DOESNT_HAVE_ASSIGNED_EXTRA_FIELDS');
|
||||
|
||||
echo $output;
|
||||
|
||||
$mainframe->close();
|
||||
}
|
||||
|
||||
function resetHits()
|
||||
{
|
||||
JRequest::checkToken() or jexit('Invalid Token');
|
||||
$model = $this->getModel('item');
|
||||
$model->resetHits();
|
||||
|
||||
}
|
||||
|
||||
function resetRating()
|
||||
{
|
||||
JRequest::checkToken() or jexit('Invalid Token');
|
||||
$model = $this->getModel('item');
|
||||
$model->resetRating();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
202
administrator/components/com_k2/controllers/items.php
Normal file
202
administrator/components/com_k2/controllers/items.php
Normal file
@@ -0,0 +1,202 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: items.php 1812 2013-01-14 18:45:06Z lefteris.kavadas $
|
||||
* @package K2
|
||||
* @author JoomlaWorks http://www.joomlaworks.net
|
||||
* @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.
|
||||
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die ;
|
||||
|
||||
jimport('joomla.application.component.controller');
|
||||
|
||||
class K2ControllerItems extends K2Controller
|
||||
{
|
||||
|
||||
public function display($cachable = false, $urlparams = array())
|
||||
{
|
||||
JRequest::setVar('view', 'items');
|
||||
parent::display();
|
||||
}
|
||||
|
||||
function publish()
|
||||
{
|
||||
JRequest::checkToken() or jexit('Invalid Token');
|
||||
$model = $this->getModel('items');
|
||||
$model->publish();
|
||||
}
|
||||
|
||||
function unpublish()
|
||||
{
|
||||
JRequest::checkToken() or jexit('Invalid Token');
|
||||
$model = $this->getModel('items');
|
||||
$model->unpublish();
|
||||
}
|
||||
|
||||
function saveorder()
|
||||
{
|
||||
JRequest::checkToken() or jexit('Invalid Token');
|
||||
$model = $this->getModel('items');
|
||||
$result = $model->saveorder();
|
||||
$document = JFactory::getDocument();
|
||||
if ($document->getType() == 'raw')
|
||||
{
|
||||
echo '1';
|
||||
return $this;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->setRedirect('index.php?option=com_k2&view=items', JText::_('K2_NEW_ORDERING_SAVED'));
|
||||
}
|
||||
}
|
||||
|
||||
function orderup()
|
||||
{
|
||||
JRequest::checkToken() or jexit('Invalid Token');
|
||||
$model = $this->getModel('items');
|
||||
$model->orderup();
|
||||
}
|
||||
|
||||
function orderdown()
|
||||
{
|
||||
JRequest::checkToken() or jexit('Invalid Token');
|
||||
$model = $this->getModel('items');
|
||||
$model->orderdown();
|
||||
}
|
||||
|
||||
function savefeaturedorder()
|
||||
{
|
||||
JRequest::checkToken() or jexit('Invalid Token');
|
||||
$model = $this->getModel('items');
|
||||
$result = $model->savefeaturedorder();
|
||||
$document = JFactory::getDocument();
|
||||
if ($document->getType() == 'raw')
|
||||
{
|
||||
echo '1';
|
||||
return $this;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->setRedirect('index.php?option=com_k2&view=items', JText::_('K2_NEW_FEATURED_ORDERING_SAVED'));
|
||||
}
|
||||
}
|
||||
|
||||
function featuredorderup()
|
||||
{
|
||||
JRequest::checkToken() or jexit('Invalid Token');
|
||||
$model = $this->getModel('items');
|
||||
$model->featuredorderup();
|
||||
}
|
||||
|
||||
function featuredorderdown()
|
||||
{
|
||||
JRequest::checkToken() or jexit('Invalid Token');
|
||||
$model = $this->getModel('items');
|
||||
$model->featuredorderdown();
|
||||
}
|
||||
|
||||
function accessregistered()
|
||||
{
|
||||
JRequest::checkToken() or jexit('Invalid Token');
|
||||
$model = $this->getModel('items');
|
||||
$model->accessregistered();
|
||||
}
|
||||
|
||||
function accessspecial()
|
||||
{
|
||||
JRequest::checkToken() or jexit('Invalid Token');
|
||||
$model = $this->getModel('items');
|
||||
$model->accessspecial();
|
||||
}
|
||||
|
||||
function accesspublic()
|
||||
{
|
||||
JRequest::checkToken() or jexit('Invalid Token');
|
||||
$model = $this->getModel('items');
|
||||
$model->accesspublic();
|
||||
}
|
||||
|
||||
function featured()
|
||||
{
|
||||
JRequest::checkToken() or jexit('Invalid Token');
|
||||
$model = $this->getModel('items');
|
||||
$model->featured();
|
||||
}
|
||||
|
||||
function trash()
|
||||
{
|
||||
JRequest::checkToken() or jexit('Invalid Token');
|
||||
$model = $this->getModel('items');
|
||||
$model->trash();
|
||||
}
|
||||
|
||||
function restore()
|
||||
{
|
||||
JRequest::checkToken() or jexit('Invalid Token');
|
||||
$model = $this->getModel('items');
|
||||
$model->restore();
|
||||
}
|
||||
|
||||
function remove()
|
||||
{
|
||||
JRequest::checkToken() or jexit('Invalid Token');
|
||||
$model = $this->getModel('items');
|
||||
$model->remove();
|
||||
}
|
||||
|
||||
function add()
|
||||
{
|
||||
$mainframe = JFactory::getApplication();
|
||||
$mainframe->redirect('index.php?option=com_k2&view=item');
|
||||
}
|
||||
|
||||
function edit()
|
||||
{
|
||||
$mainframe = JFactory::getApplication();
|
||||
$cid = JRequest::getVar('cid');
|
||||
$mainframe->redirect('index.php?option=com_k2&view=item&cid='.$cid[0]);
|
||||
}
|
||||
|
||||
function copy()
|
||||
{
|
||||
JRequest::checkToken() or jexit('Invalid Token');
|
||||
$model = $this->getModel('items');
|
||||
$model->copy();
|
||||
}
|
||||
|
||||
function element()
|
||||
{
|
||||
JRequest::setVar('view', 'items');
|
||||
JRequest::setVar('layout', 'element');
|
||||
parent::display();
|
||||
}
|
||||
|
||||
function import()
|
||||
{
|
||||
$model = $this->getModel('items');
|
||||
if (K2_JVERSION != '15')
|
||||
{
|
||||
$model->importJ16();
|
||||
}
|
||||
else
|
||||
{
|
||||
$model->import();
|
||||
}
|
||||
}
|
||||
|
||||
function move()
|
||||
{
|
||||
$view = $this->getView('items', 'html');
|
||||
$view->setLayout('move');
|
||||
$view->move();
|
||||
}
|
||||
|
||||
function saveMove()
|
||||
{
|
||||
$model = $this->getModel('items');
|
||||
$model->move();
|
||||
}
|
||||
|
||||
}
|
||||
82
administrator/components/com_k2/controllers/media.php
Normal file
82
administrator/components/com_k2/controllers/media.php
Normal file
@@ -0,0 +1,82 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: media.php 1812 2013-01-14 18:45:06Z lefteris.kavadas $
|
||||
* @package K2
|
||||
* @author JoomlaWorks http://www.joomlaworks.net
|
||||
* @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.
|
||||
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
jimport('joomla.application.component.controller');
|
||||
|
||||
class K2ControllerMedia extends K2Controller
|
||||
{
|
||||
|
||||
public function display($cachable = false, $urlparams = array())
|
||||
{
|
||||
JRequest::setVar('view', 'media');
|
||||
parent::display();
|
||||
}
|
||||
|
||||
function connector()
|
||||
{
|
||||
$mainframe = JFactory::getApplication();
|
||||
$params = JComponentHelper::getParams('com_media');
|
||||
$root = $params->get('file_path', 'media');
|
||||
$folder = JRequest::getVar('folder', $root, 'default', 'path');
|
||||
$type = JRequest::getCmd('type', 'video');
|
||||
if (JString::trim($folder) == "")
|
||||
{
|
||||
$folder = $root;
|
||||
}
|
||||
$url = JURI::root(true).'/'.$folder;
|
||||
$path = JPATH_SITE.DS.JPath::clean($folder);
|
||||
JPath::check($path);
|
||||
include_once JPATH_COMPONENT_ADMINISTRATOR.DS.'lib'.DS.'elfinder'.DS.'elFinderConnector.class.php';
|
||||
include_once JPATH_COMPONENT_ADMINISTRATOR.DS.'lib'.DS.'elfinder'.DS.'elFinder.class.php';
|
||||
include_once JPATH_COMPONENT_ADMINISTRATOR.DS.'lib'.DS.'elfinder'.DS.'elFinderVolumeDriver.class.php';
|
||||
include_once JPATH_COMPONENT_ADMINISTRATOR.DS.'lib'.DS.'elfinder'.DS.'elFinderVolumeLocalFileSystem.class.php';
|
||||
function access($attr, $path, $data, $volume)
|
||||
{
|
||||
$mainframe = JFactory::getApplication();
|
||||
// Hide files and folders starting with .
|
||||
if (strpos(basename($path), '.') === 0 && $attr == 'hidden')
|
||||
{
|
||||
return true;
|
||||
}
|
||||
// Read only access for front-end. Full access for administration section.
|
||||
switch($attr)
|
||||
{
|
||||
case 'read' :
|
||||
return true;
|
||||
break;
|
||||
case 'write' :
|
||||
return ($mainframe->isSite()) ? false : true;
|
||||
break;
|
||||
case 'locked' :
|
||||
return ($mainframe->isSite()) ? true : false;
|
||||
break;
|
||||
case 'hidden' :
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ($mainframe->isAdmin())
|
||||
{
|
||||
$permissions = array('read' => true, 'write' => true);
|
||||
}
|
||||
else
|
||||
{
|
||||
$permissions = array('read' => true, 'write' => false);
|
||||
}
|
||||
$options = array('roots' => array( array('driver' => 'LocalFileSystem', 'path' => $path, 'URL' => $url, 'accessControl' => 'access', 'defaults' => $permissions)));
|
||||
$connector = new elFinderConnector(new elFinder($options));
|
||||
$connector->run();
|
||||
}
|
||||
|
||||
}
|
||||
42
administrator/components/com_k2/controllers/settings.php
Normal file
42
administrator/components/com_k2/controllers/settings.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: settings.php 1812 2013-01-14 18:45:06Z lefteris.kavadas $
|
||||
* @package K2
|
||||
* @author JoomlaWorks http://www.joomlaworks.net
|
||||
* @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.
|
||||
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
jimport('joomla.application.component.controller');
|
||||
|
||||
class K2ControllerSettings extends K2Controller
|
||||
{
|
||||
|
||||
public function display($cachable = false, $urlparams = array())
|
||||
{
|
||||
if (K2_JVERSION != '15')
|
||||
{
|
||||
$mainframe = JFactory::getApplication();
|
||||
$mainframe->redirect('index.php?option=com_config&view=component&component=com_k2&path=&tmpl=component');
|
||||
}
|
||||
else
|
||||
{
|
||||
JRequest::setVar('tmpl', 'component');
|
||||
parent::display();
|
||||
}
|
||||
}
|
||||
|
||||
function save()
|
||||
{
|
||||
$mainframe = JFactory::getApplication();
|
||||
JRequest::checkToken() or jexit('Invalid Token');
|
||||
$model = $this->getModel('settings');
|
||||
$model->save();
|
||||
$mainframe->redirect('index.php?option=com_k2&view=settings');
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
42
administrator/components/com_k2/controllers/tag.php
Normal file
42
administrator/components/com_k2/controllers/tag.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: tag.php 1812 2013-01-14 18:45:06Z lefteris.kavadas $
|
||||
* @package K2
|
||||
* @author JoomlaWorks http://www.joomlaworks.net
|
||||
* @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.
|
||||
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
jimport('joomla.application.component.controller');
|
||||
|
||||
class K2ControllerTag extends K2Controller
|
||||
{
|
||||
|
||||
public function display($cachable = false, $urlparams = array())
|
||||
{
|
||||
JRequest::setVar('view', 'tag');
|
||||
parent::display();
|
||||
}
|
||||
|
||||
function save()
|
||||
{
|
||||
JRequest::checkToken() or jexit('Invalid Token');
|
||||
$model = $this->getModel('tag');
|
||||
$model->save();
|
||||
}
|
||||
|
||||
function apply()
|
||||
{
|
||||
$this->save();
|
||||
}
|
||||
|
||||
function cancel()
|
||||
{
|
||||
$mainframe = JFactory::getApplication();
|
||||
$mainframe->redirect('index.php?option=com_k2&view=tags');
|
||||
}
|
||||
|
||||
}
|
||||
72
administrator/components/com_k2/controllers/tags.php
Normal file
72
administrator/components/com_k2/controllers/tags.php
Normal file
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: tags.php 1927 2013-02-12 11:52:35Z lefteris.kavadas $
|
||||
* @package K2
|
||||
* @author JoomlaWorks http://www.joomlaworks.net
|
||||
* @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.
|
||||
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die ;
|
||||
|
||||
jimport('joomla.application.component.controller');
|
||||
|
||||
class K2ControllerTags extends K2Controller
|
||||
{
|
||||
|
||||
public function display($cachable = false, $urlparams = array())
|
||||
{
|
||||
JRequest::setVar('view', 'tags');
|
||||
parent::display();
|
||||
}
|
||||
|
||||
function publish()
|
||||
{
|
||||
JRequest::checkToken() or jexit('Invalid Token');
|
||||
$model = $this->getModel('tags');
|
||||
$model->publish();
|
||||
}
|
||||
|
||||
function unpublish()
|
||||
{
|
||||
JRequest::checkToken() or jexit('Invalid Token');
|
||||
$model = $this->getModel('tags');
|
||||
$model->unpublish();
|
||||
}
|
||||
|
||||
function remove()
|
||||
{
|
||||
JRequest::checkToken() or jexit('Invalid Token');
|
||||
$model = $this->getModel('tags');
|
||||
$model->remove();
|
||||
}
|
||||
|
||||
function add()
|
||||
{
|
||||
$mainframe = JFactory::getApplication();
|
||||
$mainframe->redirect('index.php?option=com_k2&view=tag');
|
||||
}
|
||||
|
||||
function edit()
|
||||
{
|
||||
$mainframe = JFactory::getApplication();
|
||||
$cid = JRequest::getVar('cid');
|
||||
$mainframe->redirect('index.php?option=com_k2&view=tag&cid='.$cid[0]);
|
||||
}
|
||||
|
||||
function element()
|
||||
{
|
||||
JRequest::setVar('view', 'tags');
|
||||
JRequest::setVar('layout', 'element');
|
||||
parent::display();
|
||||
}
|
||||
|
||||
function removeOrphans()
|
||||
{
|
||||
JRequest::checkToken() or jexit('Invalid Token');
|
||||
$model = $this->getModel('tags');
|
||||
$model->removeOrphans();
|
||||
}
|
||||
|
||||
}
|
||||
50
administrator/components/com_k2/controllers/user.php
Normal file
50
administrator/components/com_k2/controllers/user.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: user.php 1812 2013-01-14 18:45:06Z lefteris.kavadas $
|
||||
* @package K2
|
||||
* @author JoomlaWorks http://www.joomlaworks.net
|
||||
* @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.
|
||||
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
jimport('joomla.application.component.controller');
|
||||
|
||||
class K2ControllerUser extends K2Controller
|
||||
{
|
||||
|
||||
public function display($cachable = false, $urlparams = array())
|
||||
{
|
||||
JRequest::setVar('view', 'user');
|
||||
parent::display();
|
||||
}
|
||||
|
||||
function save()
|
||||
{
|
||||
JRequest::checkToken() or jexit('Invalid Token');
|
||||
$model = $this->getModel('user');
|
||||
$model->save();
|
||||
}
|
||||
|
||||
function apply()
|
||||
{
|
||||
$this->save();
|
||||
}
|
||||
|
||||
function cancel()
|
||||
{
|
||||
$mainframe = JFactory::getApplication();
|
||||
$mainframe->redirect('index.php?option=com_k2&view=users');
|
||||
}
|
||||
|
||||
function report()
|
||||
{
|
||||
$model = K2Model::getInstance('User', 'K2Model');
|
||||
$model->setState('id', JRequest::getInt('id'));
|
||||
$model->reportSpammer();
|
||||
$this->setRedirect('index.php?option=com_k2&view=users');
|
||||
}
|
||||
|
||||
}
|
||||
42
administrator/components/com_k2/controllers/usergroup.php
Normal file
42
administrator/components/com_k2/controllers/usergroup.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: usergroup.php 1812 2013-01-14 18:45:06Z lefteris.kavadas $
|
||||
* @package K2
|
||||
* @author JoomlaWorks http://www.joomlaworks.net
|
||||
* @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.
|
||||
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
jimport('joomla.application.component.controller');
|
||||
|
||||
class K2ControllerUserGroup extends K2Controller
|
||||
{
|
||||
|
||||
public function display($cachable = false, $urlparams = array())
|
||||
{
|
||||
JRequest::setVar('view', 'usergroup');
|
||||
parent::display();
|
||||
}
|
||||
|
||||
function save()
|
||||
{
|
||||
JRequest::checkToken() or jexit('Invalid Token');
|
||||
$model = $this->getModel('userGroup');
|
||||
$model->save();
|
||||
}
|
||||
|
||||
function apply()
|
||||
{
|
||||
$this->save();
|
||||
}
|
||||
|
||||
function cancel()
|
||||
{
|
||||
$mainframe = JFactory::getApplication();
|
||||
$mainframe->redirect('index.php?option=com_k2&view=usergroups');
|
||||
}
|
||||
|
||||
}
|
||||
44
administrator/components/com_k2/controllers/usergroups.php
Normal file
44
administrator/components/com_k2/controllers/usergroups.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: usergroups.php 1812 2013-01-14 18:45:06Z lefteris.kavadas $
|
||||
* @package K2
|
||||
* @author JoomlaWorks http://www.joomlaworks.net
|
||||
* @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.
|
||||
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
jimport('joomla.application.component.controller');
|
||||
|
||||
class K2ControllerUserGroups extends K2Controller
|
||||
{
|
||||
|
||||
public function display($cachable = false, $urlparams = array())
|
||||
{
|
||||
JRequest::setVar('view', 'usergroups');
|
||||
parent::display();
|
||||
}
|
||||
|
||||
function edit()
|
||||
{
|
||||
$mainframe = JFactory::getApplication();
|
||||
$cid = JRequest::getVar('cid');
|
||||
$mainframe->redirect('index.php?option=com_k2&view=usergroup&cid='.$cid[0]);
|
||||
}
|
||||
|
||||
function add()
|
||||
{
|
||||
$mainframe = JFactory::getApplication();
|
||||
$mainframe->redirect('index.php?option=com_k2&view=usergroup');
|
||||
}
|
||||
|
||||
function remove()
|
||||
{
|
||||
JRequest::checkToken() or jexit('Invalid Token');
|
||||
$model = $this->getModel('userGroups');
|
||||
$model->remove();
|
||||
}
|
||||
|
||||
}
|
||||
88
administrator/components/com_k2/controllers/users.php
Normal file
88
administrator/components/com_k2/controllers/users.php
Normal file
@@ -0,0 +1,88 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: users.php 1812 2013-01-14 18:45:06Z lefteris.kavadas $
|
||||
* @package K2
|
||||
* @author JoomlaWorks http://www.joomlaworks.net
|
||||
* @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.
|
||||
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
jimport('joomla.application.component.controller');
|
||||
|
||||
class K2ControllerUsers extends K2Controller
|
||||
{
|
||||
|
||||
public function display($cachable = false, $urlparams = array())
|
||||
{
|
||||
JRequest::setVar('view', 'users');
|
||||
parent::display();
|
||||
}
|
||||
|
||||
function edit()
|
||||
{
|
||||
$mainframe = JFactory::getApplication();
|
||||
$cid = JRequest::getVar('cid');
|
||||
$mainframe->redirect('index.php?option=com_k2&view=user&cid='.$cid[0]);
|
||||
}
|
||||
|
||||
function remove()
|
||||
{
|
||||
JRequest::checkToken() or jexit('Invalid Token');
|
||||
$model = $this->getModel('users');
|
||||
$model->remove();
|
||||
}
|
||||
|
||||
function element()
|
||||
{
|
||||
JRequest::setVar('view', 'users');
|
||||
JRequest::setVar('layout', 'element');
|
||||
parent::display();
|
||||
}
|
||||
|
||||
function enable()
|
||||
{
|
||||
JRequest::checkToken() or jexit('Invalid Token');
|
||||
$model = $this->getModel('users');
|
||||
$model->enable();
|
||||
}
|
||||
|
||||
function disable()
|
||||
{
|
||||
JRequest::checkToken() or jexit('Invalid Token');
|
||||
$model = $this->getModel('users');
|
||||
$model->disable();
|
||||
}
|
||||
|
||||
function delete()
|
||||
{
|
||||
JRequest::checkToken() or jexit('Invalid Token');
|
||||
$model = $this->getModel('users');
|
||||
$model->delete();
|
||||
}
|
||||
|
||||
function move()
|
||||
{
|
||||
$view = $this->getView('users', 'html');
|
||||
$view->setLayout('move');
|
||||
$model = $this->getModel('users');
|
||||
$view->setModel($model);
|
||||
$view->move();
|
||||
}
|
||||
|
||||
function saveMove()
|
||||
{
|
||||
JRequest::checkToken() or jexit('Invalid Token');
|
||||
$model = $this->getModel('users');
|
||||
$model->saveMove();
|
||||
}
|
||||
|
||||
function import()
|
||||
{
|
||||
$model = $this->getModel('users');
|
||||
$model->import();
|
||||
}
|
||||
|
||||
}
|
||||
52
administrator/components/com_k2/elements/base.php
Normal file
52
administrator/components/com_k2/elements/base.php
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: base.php 1812 2013-01-14 18:45:06Z lefteris.kavadas $
|
||||
* @package K2
|
||||
* @author JoomlaWorks http://www.joomlaworks.net
|
||||
* @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.
|
||||
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die ;
|
||||
|
||||
if (K2_JVERSION == '15')
|
||||
{
|
||||
jimport('joomla.html.parameter.element');
|
||||
class K2Element extends JElement
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
jimport('joomla.form.formfield');
|
||||
class K2Element extends JFormField
|
||||
{
|
||||
|
||||
function getInput()
|
||||
{
|
||||
return $this->fetchElement($this->name, $this->value, $this->element, $this->options['control']);
|
||||
}
|
||||
|
||||
function getLabel()
|
||||
{
|
||||
if (method_exists($this, 'fetchTooltip'))
|
||||
{
|
||||
return $this->fetchTooltip($this->element['label'], $this->description, $this->element, $this->options['control'], $this->element['name'] = '');
|
||||
}
|
||||
else
|
||||
{
|
||||
return parent::getLabel();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function render()
|
||||
{
|
||||
return $this->getInput();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
94
administrator/components/com_k2/elements/categories.php
Normal file
94
administrator/components/com_k2/elements/categories.php
Normal file
@@ -0,0 +1,94 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: categories.php 1812 2013-01-14 18:45:06Z lefteris.kavadas $
|
||||
* @package K2
|
||||
* @author JoomlaWorks http://www.joomlaworks.net
|
||||
* @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.
|
||||
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
require_once (JPATH_ADMINISTRATOR.'/components/com_k2/elements/base.php');
|
||||
|
||||
class K2ElementCategories extends K2Element
|
||||
{
|
||||
|
||||
function fetchElement($name, $value, &$node, $control_name)
|
||||
{
|
||||
$db = JFactory::getDBO();
|
||||
|
||||
$query = 'SELECT m.* FROM #__k2_categories m WHERE trash = 0 ORDER BY parent, ordering';
|
||||
$db->setQuery($query);
|
||||
$mitems = $db->loadObjectList();
|
||||
$children = array();
|
||||
if ($mitems)
|
||||
{
|
||||
foreach ($mitems as $v)
|
||||
{
|
||||
if (K2_JVERSION != '15')
|
||||
{
|
||||
$v->title = $v->name;
|
||||
$v->parent_id = $v->parent;
|
||||
}
|
||||
$pt = $v->parent;
|
||||
$list = @$children[$pt] ? $children[$pt] : array();
|
||||
array_push($list, $v);
|
||||
$children[$pt] = $list;
|
||||
}
|
||||
}
|
||||
$list = JHTML::_('menu.treerecurse', 0, '', array(), $children, 9999, 0, 0);
|
||||
$mitems = array();
|
||||
$mitems[] = JHTML::_('select.option', '0', JText::_('K2_NONE_ONSELECTLISTS'));
|
||||
|
||||
foreach ($list as $item)
|
||||
{
|
||||
$item->treename = JString::str_ireplace(' ', ' -', $item->treename);
|
||||
$mitems[] = JHTML::_('select.option', $item->id, $item->treename);
|
||||
}
|
||||
|
||||
$attributes = 'class="inputbox"';
|
||||
if (K2_JVERSION != '15')
|
||||
{
|
||||
$attribute = K2_JVERSION == '25' ? $node->getAttribute('multiple') : $node->attributes()->multiple;
|
||||
if ($attribute)
|
||||
{
|
||||
$attributes .= ' multiple="multiple" size="10"';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($node->attributes('multiple'))
|
||||
{
|
||||
$attributes .= ' multiple="multiple" size="10"';
|
||||
}
|
||||
}
|
||||
|
||||
if (K2_JVERSION != '15')
|
||||
{
|
||||
$fieldName = $name;
|
||||
}
|
||||
else
|
||||
{
|
||||
$fieldName = $control_name.'['.$name.']';
|
||||
if ($node->attributes('multiple'))
|
||||
{
|
||||
$fieldName .= '[]';
|
||||
}
|
||||
}
|
||||
|
||||
return JHTML::_('select.genericlist', $mitems, $fieldName, $attributes, 'value', 'text', $value);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class JFormFieldCategories extends K2ElementCategories
|
||||
{
|
||||
var $type = 'categories';
|
||||
}
|
||||
|
||||
class JElementCategories extends K2ElementCategories
|
||||
{
|
||||
var $_name = 'categories';
|
||||
}
|
||||
139
administrator/components/com_k2/elements/categorieslatest.php
Normal file
139
administrator/components/com_k2/elements/categorieslatest.php
Normal file
@@ -0,0 +1,139 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: categorieslatest.php 1978 2013-05-15 19:34:16Z joomlaworks $
|
||||
* @package K2
|
||||
* @author JoomlaWorks http://www.joomlaworks.net
|
||||
* @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.
|
||||
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die ;
|
||||
|
||||
require_once (JPATH_ADMINISTRATOR.'/components/com_k2/elements/base.php');
|
||||
|
||||
class K2ElementCategoriesLatest extends K2Element
|
||||
{
|
||||
|
||||
function fetchElement($name, $value, &$node, $control_name)
|
||||
{
|
||||
JHTML::_('behavior.modal');
|
||||
|
||||
$params = JComponentHelper::getParams('com_k2');
|
||||
|
||||
$document = JFactory::getDocument();
|
||||
|
||||
if (version_compare(JVERSION, '1.6.0', 'ge'))
|
||||
{
|
||||
JHtml::_('behavior.framework');
|
||||
}
|
||||
else
|
||||
{
|
||||
JHTML::_('behavior.mootools');
|
||||
}
|
||||
K2HelperHTML::loadjQuery();
|
||||
|
||||
$mainframe = JFactory::getApplication();
|
||||
|
||||
if (K2_JVERSION != '15')
|
||||
{
|
||||
$fieldName = $name;
|
||||
if (!$node->attributes()->multiple)
|
||||
{
|
||||
$fieldName .= '[]';
|
||||
}
|
||||
$image = JURI::root(true).'/administrator/templates/'.$mainframe->getTemplate().'/images/admin/publish_x.png';
|
||||
}
|
||||
else
|
||||
{
|
||||
$fieldName = $control_name.'['.$name.'][]';
|
||||
$image = JURI::root(true).'/administrator/images/publish_x.png';
|
||||
}
|
||||
|
||||
$js = "
|
||||
function jSelectCategory(id, title, object) {
|
||||
var exists = false;
|
||||
\$K2('#categoriesList input').each(function(){
|
||||
if(\$K2(this).val()==id){
|
||||
alert('".JText::_('K2_THE_SELECTED_CATEGORY_IS_ALREADY_IN_THE_LIST', true)."');
|
||||
exists = true;
|
||||
}
|
||||
});
|
||||
if(!exists){
|
||||
var container = \$K2('<li/>').appendTo(\$K2('#categoriesList'));
|
||||
var img = \$K2('<img/>',{'class':'remove', src:'".$image."'}).appendTo(container);
|
||||
img.click(function(){\$K2(this).parent().remove();});
|
||||
var span = \$K2('<span/>',{'class':'handle'}).html(title).appendTo(container);
|
||||
var input = \$K2('<input/>',{value:id, type:'hidden', name:'".$fieldName."'}).appendTo(container);
|
||||
var div = \$K2('<div/>',{style:'clear:both;'}).appendTo(container);
|
||||
\$K2('#categoriesList').sortable('refresh');
|
||||
alert('".JText::_('K2_CATEGORY_ADDED_IN_THE_LIST', true)."');
|
||||
}
|
||||
}
|
||||
|
||||
\$K2(document).ready(function(){
|
||||
\$K2('#categoriesList').sortable({
|
||||
containment: '#categoriesList',
|
||||
items: 'li',
|
||||
handle: 'span.handle'
|
||||
});
|
||||
\$K2('body').css('overflow-y', 'scroll');
|
||||
\$K2('#categoriesList .remove').click(function(){
|
||||
\$K2(this).parent().remove();
|
||||
});
|
||||
});
|
||||
";
|
||||
|
||||
$document->addScriptDeclaration($js);
|
||||
$document->addStyleSheet(JURI::root(true).'/media/k2/assets/css/k2.modules.css?v=2.6.7');
|
||||
|
||||
$current = array();
|
||||
if (is_string($value) && !empty($value))
|
||||
{
|
||||
$current[] = $value;
|
||||
}
|
||||
if (is_array($value))
|
||||
{
|
||||
$current = $value;
|
||||
}
|
||||
|
||||
$output = '
|
||||
<div class="button2-left">
|
||||
<div class="blank">
|
||||
<a class="modal btn" title="'.JText::_('K2_CLICK_TO_SELECT_ONE_OR_MORE_CATEGORIES').'" href="index.php?option=com_k2&view=categories&task=element&tmpl=component" rel="{handler: \'iframe\', size: {x: 700, y: 450}}">'.JText::_('K2_CLICK_TO_SELECT_ONE_OR_MORE_CATEGORIES').'</a>
|
||||
</div>
|
||||
</div>
|
||||
<div style="clear:both;"></div>
|
||||
';
|
||||
|
||||
JTable::addIncludePath(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_k2'.DS.'tables');
|
||||
|
||||
$output .= '<ul id="categoriesList">';
|
||||
foreach ($current as $id)
|
||||
{
|
||||
$row = JTable::getInstance('K2Category', 'Table');
|
||||
$row->load($id);
|
||||
$output .= '
|
||||
<li>
|
||||
<img class="remove" src="'.$image.'"/>
|
||||
<span class="handle">'.$row->name.'</span>
|
||||
<input type="hidden" value="'.$row->id.'" name="'.$fieldName.'"/>
|
||||
<span style="clear:both;"></span>
|
||||
</li>
|
||||
';
|
||||
}
|
||||
$output .= '</ul>';
|
||||
return $output;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class JFormFieldCategoriesLatest extends K2ElementCategoriesLatest
|
||||
{
|
||||
var $type = 'categorieslatest';
|
||||
}
|
||||
|
||||
class JElementCategoriesLatest extends K2ElementCategoriesLatest
|
||||
{
|
||||
var $_name = 'categorieslatest';
|
||||
}
|
||||
160
administrator/components/com_k2/elements/categoriesmultiple.php
Normal file
160
administrator/components/com_k2/elements/categoriesmultiple.php
Normal file
@@ -0,0 +1,160 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: categoriesmultiple.php 1812 2013-01-14 18:45:06Z lefteris.kavadas $
|
||||
* @package K2
|
||||
* @author JoomlaWorks http://www.joomlaworks.net
|
||||
* @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.
|
||||
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die ;
|
||||
|
||||
require_once (JPATH_ADMINISTRATOR.'/components/com_k2/elements/base.php');
|
||||
|
||||
class K2ElementCategoriesMultiple extends K2Element
|
||||
{
|
||||
|
||||
function fetchElement($name, $value, &$node, $control_name)
|
||||
{
|
||||
$params = JComponentHelper::getParams('com_k2');
|
||||
$document = JFactory::getDocument();
|
||||
if (version_compare(JVERSION, '1.6.0', 'ge'))
|
||||
{
|
||||
JHtml::_('behavior.framework');
|
||||
}
|
||||
else
|
||||
{
|
||||
JHTML::_('behavior.mootools');
|
||||
}
|
||||
K2HelperHTML::loadjQuery();
|
||||
|
||||
$db = JFactory::getDBO();
|
||||
$query = 'SELECT m.* FROM #__k2_categories m WHERE trash = 0 ORDER BY parent, ordering';
|
||||
$db->setQuery($query);
|
||||
$mitems = $db->loadObjectList();
|
||||
$children = array();
|
||||
if ($mitems)
|
||||
{
|
||||
foreach ($mitems as $v)
|
||||
{
|
||||
if (K2_JVERSION != '15')
|
||||
{
|
||||
$v->title = $v->name;
|
||||
$v->parent_id = $v->parent;
|
||||
}
|
||||
$pt = $v->parent;
|
||||
$list = @$children[$pt] ? $children[$pt] : array();
|
||||
array_push($list, $v);
|
||||
$children[$pt] = $list;
|
||||
}
|
||||
}
|
||||
$list = JHTML::_('menu.treerecurse', 0, '', array(), $children, 9999, 0, 0);
|
||||
$mitems = array();
|
||||
|
||||
foreach ($list as $item)
|
||||
{
|
||||
$item->treename = JString::str_ireplace(' ', '- ', $item->treename);
|
||||
$mitems[] = JHTML::_('select.option', $item->id, ' '.$item->treename);
|
||||
}
|
||||
|
||||
$doc = JFactory::getDocument();
|
||||
if (K2_JVERSION != '15')
|
||||
{
|
||||
$js = "
|
||||
\$K2(document).ready(function(){
|
||||
|
||||
\$K2('#jform_params_catfilter0').click(function(){
|
||||
\$K2('#jformparamscategory_id').attr('disabled', 'disabled');
|
||||
\$K2('#jformparamscategory_id option').each(function() {
|
||||
\$K2(this).attr('selected', 'selected');
|
||||
});
|
||||
\$K2('#jformparamscategory_id').trigger('liszt:updated');
|
||||
});
|
||||
|
||||
\$K2('#jform_params_catfilter1').click(function(){
|
||||
\$K2('#jformparamscategory_id').removeAttr('disabled');
|
||||
\$K2('#jformparamscategory_id option').each(function() {
|
||||
\$K2(this).removeAttr('selected');
|
||||
});
|
||||
\$K2('#jformparamscategory_id').trigger('liszt:updated');
|
||||
});
|
||||
|
||||
if (\$K2('#jform_params_catfilter0').attr('checked')) {
|
||||
\$K2('#jformparamscategory_id').attr('disabled', 'disabled');
|
||||
\$K2('#jformparamscategory_id option').each(function() {
|
||||
\$K2(this).attr('selected', 'selected');
|
||||
});
|
||||
\$K2('#jformparamscategory_id').trigger('liszt:updated');
|
||||
}
|
||||
|
||||
if (\$K2('#jform_params_catfilter1').attr('checked')) {
|
||||
\$K2('#jformparamscategory_id').removeAttr('disabled');
|
||||
\$K2('#jformparamscategory_id').trigger('liszt:updated');
|
||||
}
|
||||
|
||||
});
|
||||
";
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$js = "
|
||||
\$K2(document).ready(function(){
|
||||
|
||||
\$K2('#paramscatfilter0').click(function(){
|
||||
\$K2('#paramscategory_id').attr('disabled', 'disabled');
|
||||
\$K2('#paramscategory_id option').each(function() {
|
||||
\$K2(this).attr('selected', 'selected');
|
||||
});
|
||||
});
|
||||
|
||||
\$K2('#paramscatfilter1').click(function(){
|
||||
\$K2('#paramscategory_id').removeAttr('disabled');
|
||||
\$K2('#paramscategory_id option').each(function() {
|
||||
\$K2(this).removeAttr('selected');
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
if (\$K2('#paramscatfilter0').attr('checked')) {
|
||||
\$K2('#paramscategory_id').attr('disabled', 'disabled');
|
||||
\$K2('#paramscategory_id option').each(function() {
|
||||
\$K2(this).attr('selected', 'selected');
|
||||
});
|
||||
}
|
||||
|
||||
if (\$K2('#paramscatfilter1').attr('checked')) {
|
||||
\$K2('#paramscategory_id').removeAttr('disabled');
|
||||
}
|
||||
|
||||
});
|
||||
";
|
||||
|
||||
}
|
||||
|
||||
if (K2_JVERSION != '15')
|
||||
{
|
||||
$fieldName = $name.'[]';
|
||||
}
|
||||
else
|
||||
{
|
||||
$fieldName = $control_name.'['.$name.'][]';
|
||||
}
|
||||
|
||||
$doc->addScriptDeclaration($js);
|
||||
$output = JHTML::_('select.genericlist', $mitems, $fieldName, 'class="inputbox" multiple="multiple" size="10"', 'value', 'text', $value);
|
||||
return $output;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class JFormFieldCategoriesMultiple extends K2ElementCategoriesMultiple
|
||||
{
|
||||
var $type = 'categoriesmultiple';
|
||||
}
|
||||
|
||||
class JElementCategoriesMultiple extends K2ElementCategoriesMultiple
|
||||
{
|
||||
var $_name = 'categoriesmultiple';
|
||||
}
|
||||
255
administrator/components/com_k2/elements/category.php
Normal file
255
administrator/components/com_k2/elements/category.php
Normal file
@@ -0,0 +1,255 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: category.php 1812 2013-01-14 18:45:06Z lefteris.kavadas $
|
||||
* @package K2
|
||||
* @author JoomlaWorks http://www.joomlaworks.net
|
||||
* @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.
|
||||
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die ;
|
||||
|
||||
require_once (JPATH_ADMINISTRATOR.'/components/com_k2/elements/base.php');
|
||||
|
||||
class K2ElementCategory extends K2Element
|
||||
{
|
||||
|
||||
function fetchElement($name, $value, &$node, $control_name)
|
||||
{
|
||||
$db = JFactory::getDBO();
|
||||
$query = 'SELECT m.* FROM #__k2_categories m WHERE trash = 0 ORDER BY parent, ordering';
|
||||
$db->setQuery($query);
|
||||
$mitems = $db->loadObjectList();
|
||||
$children = array();
|
||||
if ($mitems)
|
||||
{
|
||||
foreach ($mitems as $v)
|
||||
{
|
||||
if (K2_JVERSION != '15')
|
||||
{
|
||||
$v->title = $v->name;
|
||||
$v->parent_id = $v->parent;
|
||||
}
|
||||
$pt = $v->parent;
|
||||
$list = @$children[$pt] ? $children[$pt] : array();
|
||||
array_push($list, $v);
|
||||
$children[$pt] = $list;
|
||||
}
|
||||
}
|
||||
|
||||
$list = JHTML::_('menu.treerecurse', 0, '', array(), $children, 9999, 0, 0);
|
||||
$mitems = array();
|
||||
$option = JRequest::getCmd('option');
|
||||
$prefix = ($option == 'com_joomfish') ? 'refField_' : '';
|
||||
if ($name == 'categories' || $name == 'jform[params][categories]')
|
||||
{
|
||||
$doc = JFactory::getDocument();
|
||||
$js = "
|
||||
window.addEvent('domready', function(){
|
||||
setTask();
|
||||
});
|
||||
|
||||
function setTask() {
|
||||
var counter=0;
|
||||
$$('#".$prefix."paramscategories option').each(function(el) {
|
||||
if (el.selected){
|
||||
value=el.value;
|
||||
counter++;
|
||||
}
|
||||
});
|
||||
if (counter>1 || counter==0){
|
||||
$('urlparamsid').setProperty('value','');
|
||||
$('urlparamstask').setProperty('value','');
|
||||
$('".$prefix."paramssingleCatOrdering').setProperty('disabled', 'disabled');
|
||||
enableParams();
|
||||
}
|
||||
if (counter==1){
|
||||
$('urlparamsid').setProperty('value',value);
|
||||
$('urlparamstask').setProperty('value','category');
|
||||
$('".$prefix."paramssingleCatOrdering').removeProperty('disabled');
|
||||
disableParams();
|
||||
}
|
||||
}
|
||||
|
||||
function disableParams(){
|
||||
$('".$prefix."paramsnum_leading_items').setProperty('disabled','disabled');
|
||||
$('".$prefix."paramsnum_leading_columns').setProperty('disabled','disabled');
|
||||
$('".$prefix."paramsleadingImgSize').setProperty('disabled','disabled');
|
||||
$('".$prefix."paramsnum_primary_items').setProperty('disabled','disabled');
|
||||
$('".$prefix."paramsnum_primary_columns').setProperty('disabled','disabled');
|
||||
$('".$prefix."paramsprimaryImgSize').setProperty('disabled','disabled');
|
||||
$('".$prefix."paramsnum_secondary_items').setProperty('disabled','disabled');
|
||||
$('".$prefix."paramsnum_secondary_columns').setProperty('disabled','disabled');
|
||||
$('".$prefix."paramssecondaryImgSize').setProperty('disabled','disabled');
|
||||
$('".$prefix."paramsnum_links').setProperty('disabled','disabled');
|
||||
$('".$prefix."paramsnum_links_columns').setProperty('disabled','disabled');
|
||||
$('".$prefix."paramslinksImgSize').setProperty('disabled','disabled');
|
||||
$('".$prefix."paramscatCatalogMode').setProperty('disabled','disabled');
|
||||
$('".$prefix."paramscatFeaturedItems').setProperty('disabled','disabled');
|
||||
$('".$prefix."paramscatOrdering').setProperty('disabled','disabled');
|
||||
$('".$prefix."paramscatPagination').setProperty('disabled','disabled');
|
||||
$('".$prefix."paramscatPaginationResults0').setProperty('disabled','disabled');
|
||||
$('".$prefix."paramscatPaginationResults1').setProperty('disabled','disabled');
|
||||
$('".$prefix."paramscatFeedLink0').setProperty('disabled','disabled');
|
||||
$('".$prefix."paramscatFeedLink1').setProperty('disabled','disabled');
|
||||
$('".$prefix."paramscatFeedIcon0').setProperty('disabled','disabled');
|
||||
$('".$prefix."paramscatFeedIcon1').setProperty('disabled','disabled');
|
||||
$('".$prefix."paramstheme').setProperty('disabled','disabled');
|
||||
}
|
||||
|
||||
function enableParams(){
|
||||
$('".$prefix."paramsnum_leading_items').removeProperty('disabled');
|
||||
$('".$prefix."paramsnum_leading_columns').removeProperty('disabled');
|
||||
$('".$prefix."paramsleadingImgSize').removeProperty('disabled');
|
||||
$('".$prefix."paramsnum_primary_items').removeProperty('disabled');
|
||||
$('".$prefix."paramsnum_primary_columns').removeProperty('disabled');
|
||||
$('".$prefix."paramsprimaryImgSize').removeProperty('disabled');
|
||||
$('".$prefix."paramsnum_secondary_items').removeProperty('disabled');
|
||||
$('".$prefix."paramsnum_secondary_columns').removeProperty('disabled');
|
||||
$('".$prefix."paramssecondaryImgSize').removeProperty('disabled');
|
||||
$('".$prefix."paramsnum_links').removeProperty('disabled');
|
||||
$('".$prefix."paramsnum_links_columns').removeProperty('disabled');
|
||||
$('".$prefix."paramslinksImgSize').removeProperty('disabled');
|
||||
$('".$prefix."paramscatCatalogMode').removeProperty('disabled');
|
||||
$('".$prefix."paramscatFeaturedItems').removeProperty('disabled');
|
||||
$('".$prefix."paramscatOrdering').removeProperty('disabled');
|
||||
$('".$prefix."paramscatPagination').removeProperty('disabled');
|
||||
$('".$prefix."paramscatPaginationResults0').removeProperty('disabled');
|
||||
$('".$prefix."paramscatPaginationResults1').removeProperty('disabled');
|
||||
$('".$prefix."paramscatFeedLink0').removeProperty('disabled');
|
||||
$('".$prefix."paramscatFeedLink1').removeProperty('disabled');
|
||||
$('".$prefix."paramscatFeedIcon0').removeProperty('disabled');
|
||||
$('".$prefix."paramscatFeedIcon1').removeProperty('disabled');
|
||||
$('".$prefix."paramstheme').removeProperty('disabled');
|
||||
}
|
||||
";
|
||||
|
||||
if (K2_JVERSION != '15')
|
||||
{
|
||||
$js = "
|
||||
function disableParams(){
|
||||
$('jform_params_num_leading_items').setProperty('disabled','disabled');
|
||||
$('jform_params_num_leading_columns').setProperty('disabled','disabled');
|
||||
$('jform_params_leadingImgSize').setProperty('disabled','disabled');
|
||||
$('jform_params_num_primary_items').setProperty('disabled','disabled');
|
||||
$('jform_params_num_primary_columns').setProperty('disabled','disabled');
|
||||
$('jform_params_primaryImgSize').setProperty('disabled','disabled');
|
||||
$('jform_params_num_secondary_items').setProperty('disabled','disabled');
|
||||
$('jform_params_num_secondary_columns').setProperty('disabled','disabled');
|
||||
$('jform_params_secondaryImgSize').setProperty('disabled','disabled');
|
||||
$('jform_params_num_links').setProperty('disabled','disabled');
|
||||
$('jform_params_num_links_columns').setProperty('disabled','disabled');
|
||||
$('jform_params_linksImgSize').setProperty('disabled','disabled');
|
||||
$('jform_params_catCatalogMode').setProperty('disabled','disabled');
|
||||
$('jform_params_catFeaturedItems').setProperty('disabled','disabled');
|
||||
$('jform_params_catOrdering').setProperty('disabled','disabled');
|
||||
$('jform_params_catPagination').setProperty('disabled','disabled');
|
||||
$('jform_params_catPaginationResults0').setProperty('disabled','disabled');
|
||||
$('jform_params_catPaginationResults1').setProperty('disabled','disabled');
|
||||
$('jform_params_catFeedLink0').setProperty('disabled','disabled');
|
||||
$('jform_params_catFeedLink1').setProperty('disabled','disabled');
|
||||
$('jform_params_catFeedIcon0').setProperty('disabled','disabled');
|
||||
$('jform_params_catFeedIcon1').setProperty('disabled','disabled');
|
||||
$('jformparamstheme').setProperty('disabled','disabled');
|
||||
}
|
||||
|
||||
function enableParams(){
|
||||
$('jform_params_num_leading_items').removeProperty('disabled');
|
||||
$('jform_params_num_leading_columns').removeProperty('disabled');
|
||||
$('jform_params_leadingImgSize').removeProperty('disabled');
|
||||
$('jform_params_num_primary_items').removeProperty('disabled');
|
||||
$('jform_params_num_primary_columns').removeProperty('disabled');
|
||||
$('jform_params_primaryImgSize').removeProperty('disabled');
|
||||
$('jform_params_num_secondary_items').removeProperty('disabled');
|
||||
$('jform_params_num_secondary_columns').removeProperty('disabled');
|
||||
$('jform_params_secondaryImgSize').removeProperty('disabled');
|
||||
$('jform_params_num_links').removeProperty('disabled');
|
||||
$('jform_params_num_links_columns').removeProperty('disabled');
|
||||
$('jform_params_linksImgSize').removeProperty('disabled');
|
||||
$('jform_params_catCatalogMode').removeProperty('disabled');
|
||||
$('jform_params_catFeaturedItems').removeProperty('disabled');
|
||||
$('jform_params_catOrdering').removeProperty('disabled');
|
||||
$('jform_params_catPagination').removeProperty('disabled');
|
||||
$('jform_params_catPaginationResults0').removeProperty('disabled');
|
||||
$('jform_params_catPaginationResults1').removeProperty('disabled');
|
||||
$('jform_params_catFeedLink0').removeProperty('disabled');
|
||||
$('jform_params_catFeedLink1').removeProperty('disabled');
|
||||
$('jform_params_catFeedIcon0').removeProperty('disabled');
|
||||
$('jform_params_catFeedIcon1').removeProperty('disabled');
|
||||
$('jformparamstheme').removeProperty('disabled');
|
||||
}
|
||||
|
||||
function setTask() {
|
||||
var counter=0;
|
||||
$$('#jformparamscategories option').each(function(el) {
|
||||
if (el.selected){
|
||||
value=el.value;
|
||||
counter++;
|
||||
}
|
||||
});
|
||||
if (counter>1 || counter==0){
|
||||
$('jform_request_id').setProperty('value','');
|
||||
$('jform_request_task').setProperty('value','');
|
||||
$('jform_params_singleCatOrdering').setProperty('disabled', 'disabled');
|
||||
enableParams();
|
||||
}
|
||||
if (counter==1){
|
||||
$('jform_request_id').setProperty('value',value);
|
||||
$('jform_request_task').setProperty('value','category');
|
||||
$('jform_params_singleCatOrdering').removeProperty('disabled');
|
||||
disableParams();
|
||||
}
|
||||
}
|
||||
|
||||
window.addEvent('domready', function(){
|
||||
if($('request-options')) {
|
||||
$$('.panel')[0].setStyle('display', 'none');
|
||||
}
|
||||
setTask();
|
||||
});
|
||||
";
|
||||
}
|
||||
|
||||
$doc->addScriptDeclaration($js);
|
||||
}
|
||||
|
||||
foreach ($list as $item)
|
||||
{
|
||||
$item->treename = JString::str_ireplace(' ', '- ', $item->treename);
|
||||
@$mitems[] = JHTML::_('select.option', $item->id, $item->treename);
|
||||
}
|
||||
|
||||
if (K2_JVERSION != '15')
|
||||
{
|
||||
$fieldName = $name.'[]';
|
||||
}
|
||||
else
|
||||
{
|
||||
$fieldName = $control_name.'['.$name.'][]';
|
||||
}
|
||||
|
||||
if ($name == 'categories' || $name == 'jform[params][categories]')
|
||||
{
|
||||
$onChange = 'onchange="setTask();"';
|
||||
}
|
||||
else
|
||||
{
|
||||
$onChange = '';
|
||||
}
|
||||
|
||||
return JHTML::_('select.genericlist', $mitems, $fieldName, $onChange.' class="inputbox" style="width:90%;" multiple="multiple" size="15"', 'value', 'text', $value);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class JFormFieldCategory extends K2ElementCategory
|
||||
{
|
||||
var $type = 'category';
|
||||
}
|
||||
|
||||
class JElementCategory extends K2ElementCategory
|
||||
{
|
||||
var $_name = 'category';
|
||||
}
|
||||
47
administrator/components/com_k2/elements/header.php
Normal file
47
administrator/components/com_k2/elements/header.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: header.php 1978 2013-05-15 19:34:16Z joomlaworks $
|
||||
* @package K2
|
||||
* @author JoomlaWorks http://www.joomlaworks.net
|
||||
* @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.
|
||||
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die ;
|
||||
|
||||
require_once (JPATH_ADMINISTRATOR.'/components/com_k2/elements/base.php');
|
||||
|
||||
class K2ElementHeader extends K2Element
|
||||
{
|
||||
public function fetchElement($name, $value, &$node, $control_name)
|
||||
{
|
||||
|
||||
$document = JFactory::getDocument();
|
||||
$document->addStyleSheet(JURI::root(true).'/media/k2/assets/css/k2.modules.css?v=2.6.7');
|
||||
if (K2_JVERSION == '15')
|
||||
{
|
||||
return '<div class="paramHeaderContainer15"><div class="paramHeaderContent">'.JText::_($value).'</div><div class="k2clr"></div></div>';
|
||||
}
|
||||
else
|
||||
{
|
||||
return '<div class="paramHeaderContainer"><div class="paramHeaderContent">'.JText::_($value).'</div><div class="k2clr"></div></div>';
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public function fetchTooltip($label, $description, &$node, $control_name, $name)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class JFormFieldHeader extends K2ElementHeader
|
||||
{
|
||||
var $type = 'header';
|
||||
}
|
||||
|
||||
class JElementHeader extends K2ElementHeader
|
||||
{
|
||||
var $_name = 'header';
|
||||
}
|
||||
85
administrator/components/com_k2/elements/item.php
Normal file
85
administrator/components/com_k2/elements/item.php
Normal file
@@ -0,0 +1,85 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: item.php 1812 2013-01-14 18:45:06Z lefteris.kavadas $
|
||||
* @package K2
|
||||
* @author JoomlaWorks http://www.joomlaworks.net
|
||||
* @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.
|
||||
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die ;
|
||||
|
||||
require_once (JPATH_ADMINISTRATOR.'/components/com_k2/elements/base.php');
|
||||
|
||||
class K2ElementItem extends K2Element
|
||||
{
|
||||
|
||||
function fetchElement($name, $value, &$node, $control_name)
|
||||
{
|
||||
$mainframe = JFactory::getApplication();
|
||||
$db = JFactory::getDBO();
|
||||
$doc = JFactory::getDocument();
|
||||
$fieldName = (K2_JVERSION != '15') ? $name : $control_name.'['.$name.']';
|
||||
JTable::addIncludePath(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_k2'.DS.'tables');
|
||||
$item = JTable::getInstance('K2Item', 'Table');
|
||||
if ($value)
|
||||
{
|
||||
$item->load($value);
|
||||
}
|
||||
else
|
||||
{
|
||||
$item->title = JText::_('K2_SELECT_AN_ITEM');
|
||||
}
|
||||
|
||||
$js = "
|
||||
function jSelectItem(id, title, object) {
|
||||
document.getElementById('".$name."' + '_id').value = id;
|
||||
document.getElementById('".$name."' + '_name').value = title;
|
||||
if(typeof(window.parent.SqueezeBox.close=='function')){
|
||||
window.parent.SqueezeBox.close();
|
||||
}
|
||||
else {
|
||||
document.getElementById('sbox-window').close();
|
||||
}
|
||||
}
|
||||
";
|
||||
$doc->addScriptDeclaration($js);
|
||||
$link = 'index.php?option=com_k2&view=items&task=element&tmpl=component&object='.$name;
|
||||
JHTML::_('behavior.modal', 'a.modal');
|
||||
if (K2_JVERSION == '30')
|
||||
{
|
||||
$html = '<span class="input-append">
|
||||
<input type="text" id="'.$name.'_name" value="'.htmlspecialchars($item->title, ENT_QUOTES, 'UTF-8').'" disabled="disabled" />
|
||||
<a class="modal btn" title="'.JText::_('K2_SELECT_AN_ITEM').'" href="'.$link.'" rel="{handler: \'iframe\', size: {x: 700, y: 450}}"><i class="icon-file"></i>'.JText::_('K2_SELECT').'</a>
|
||||
<input type="hidden" class="required modal-value" id="'.$name.'_id" name="'.$fieldName.'" value="'.( int )$value.'" />
|
||||
</span>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$html = '
|
||||
<div style="float:left;">
|
||||
<input style="background:#fff;margin:3px 0;" type="text" id="'.$name.'_name" value="'.htmlspecialchars($item->title, ENT_QUOTES, 'UTF-8').'" disabled="disabled" />
|
||||
</div>
|
||||
<div class="button2-left">
|
||||
<div class="blank">
|
||||
<a class="modal btn" title="'.JText::_('K2_SELECT_AN_ITEM').'" href="'.$link.'" rel="{handler: \'iframe\', size: {x: 700, y: 450}}">'.JText::_('K2_SELECT').'</a>
|
||||
</div>
|
||||
</div>
|
||||
<input type="hidden" id="'.$name.'_id" name="'.$fieldName.'" value="'.( int )$value.'" />';
|
||||
}
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class JFormFieldItem extends K2ElementItem
|
||||
{
|
||||
var $type = 'item';
|
||||
}
|
||||
|
||||
class JElementItem extends K2ElementItem
|
||||
{
|
||||
var $_name = 'item';
|
||||
}
|
||||
56
administrator/components/com_k2/elements/itemform.php
Normal file
56
administrator/components/com_k2/elements/itemform.php
Normal file
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: itemform.php 1812 2013-01-14 18:45:06Z lefteris.kavadas $
|
||||
* @package K2
|
||||
* @author JoomlaWorks http://www.joomlaworks.net
|
||||
* @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.
|
||||
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die ;
|
||||
|
||||
require_once (JPATH_ADMINISTRATOR.'/components/com_k2/elements/base.php');
|
||||
|
||||
class K2ElementItemForm extends K2Element
|
||||
{
|
||||
function fetchElement($name, $value, &$node, $control_name)
|
||||
{
|
||||
$document = JFactory::getDocument();
|
||||
$document->addScriptDeclaration("
|
||||
window.addEvent('domready', function() {
|
||||
if($('request-options')) {
|
||||
$$('.panel')[0].setStyle('display', 'none');
|
||||
}
|
||||
if($('jform_browserNav')) {
|
||||
$('jform_browserNav').setProperty('value', 2);
|
||||
$('jform_browserNav').getElements('option')[0].destroy();
|
||||
}
|
||||
if($('browserNav')) {
|
||||
$('browserNav').setProperty('value', 2);
|
||||
options = $('browserNav').getElements('option');
|
||||
if(options.length == 3) {
|
||||
options[0].remove();
|
||||
}
|
||||
}
|
||||
});
|
||||
");
|
||||
return '';
|
||||
}
|
||||
|
||||
function fetchTooltip($label, $description, &$node, $control_name, $name)
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class JFormFielditemform extends K2ElementItemForm
|
||||
{
|
||||
var $type = 'itemform';
|
||||
}
|
||||
|
||||
class JElementitemform extends K2ElementItemForm
|
||||
{
|
||||
var $_name = 'itemform';
|
||||
}
|
||||
123
administrator/components/com_k2/elements/items.php
Normal file
123
administrator/components/com_k2/elements/items.php
Normal file
@@ -0,0 +1,123 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: items.php 1978 2013-05-15 19:34:16Z joomlaworks $
|
||||
* @package K2
|
||||
* @author JoomlaWorks http://www.joomlaworks.net
|
||||
* @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.
|
||||
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die ;
|
||||
|
||||
require_once (JPATH_ADMINISTRATOR.'/components/com_k2/elements/base.php');
|
||||
|
||||
class K2ElementItems extends K2Element
|
||||
{
|
||||
function fetchElement($name, $value, &$node, $control_name)
|
||||
{
|
||||
$params = JComponentHelper::getParams('com_k2');
|
||||
$document = JFactory::getDocument();
|
||||
if (version_compare(JVERSION, '1.6.0', 'ge'))
|
||||
{
|
||||
JHtml::_('behavior.framework');
|
||||
}
|
||||
else
|
||||
{
|
||||
JHTML::_('behavior.mootools');
|
||||
}
|
||||
K2HelperHTML::loadjQuery();
|
||||
$mainframe = JFactory::getApplication();
|
||||
if (K2_JVERSION != '15')
|
||||
{
|
||||
$fieldName = $name;
|
||||
$attribute = K2_JVERSION == '25' ? $node->getAttribute('multiple') : $node->attributes()->multiple;
|
||||
if (!$attribute)
|
||||
{
|
||||
$fieldName .= '[]';
|
||||
}
|
||||
$image = JURI::root(true).'/administrator/templates/'.$mainframe->getTemplate().'/images/admin/publish_x.png';
|
||||
}
|
||||
else
|
||||
{
|
||||
$fieldName = $control_name.'['.$name.'][]';
|
||||
$image = JURI::root(true).'/administrator/images/publish_x.png';
|
||||
}
|
||||
|
||||
$js = "
|
||||
function jSelectItem(id, title, object) {
|
||||
var exists = false;
|
||||
\$K2('#itemsList input').each(function(){
|
||||
if(\$K2(this).val()==id){
|
||||
alert('".JText::_('K2_THE_SELECTED_ITEM_IS_ALREADY_IN_THE_LIST')."');
|
||||
exists = true;
|
||||
}
|
||||
});
|
||||
if(!exists){
|
||||
var container = \$K2('<li/>').appendTo(\$K2('#itemsList'));
|
||||
var img = \$K2('<img/>',{'class':'remove', src:'".$image."'}).appendTo(container);
|
||||
img.click(function(){\$K2(this).parent().remove();});
|
||||
var span = \$K2('<span/>',{'class':'handle'}).html(title).appendTo(container);
|
||||
var input = \$K2('<input/>',{value:id, type:'hidden', name:'".$fieldName."'}).appendTo(container);
|
||||
var div = \$K2('<div/>',{style:'clear:both;'}).appendTo(container);
|
||||
\$K2('#itemsList').sortable('refresh');
|
||||
alert('".JText::_('K2_ITEM_ADDED_IN_THE_LIST', true)."');
|
||||
}
|
||||
}
|
||||
|
||||
\$K2(document).ready(function(){
|
||||
\$K2('#itemsList').sortable({
|
||||
containment: '#itemsList',
|
||||
items: 'li',
|
||||
handle: 'span.handle'
|
||||
});
|
||||
\$K2('body').css('overflow-y', 'scroll');
|
||||
\$K2('#itemsList .remove').click(function(){
|
||||
\$K2(this).parent().remove();
|
||||
});
|
||||
});
|
||||
";
|
||||
|
||||
$document->addScriptDeclaration($js);
|
||||
$document->addStyleSheet(JURI::root(true).'/media/k2/assets/css/k2.modules.css?v=2.6.7');
|
||||
|
||||
$current = array();
|
||||
if (is_string($value) && !empty($value))
|
||||
{
|
||||
$current[] = $value;
|
||||
}
|
||||
if (is_array($value))
|
||||
{
|
||||
$current = $value;
|
||||
}
|
||||
|
||||
JTable::addIncludePath(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_k2'.DS.'tables');
|
||||
$output = '<div style="clear:both"></div><ul id="itemsList">';
|
||||
foreach ($current as $id)
|
||||
{
|
||||
$row = JTable::getInstance('K2Item', 'Table');
|
||||
$row->load($id);
|
||||
$output .= '
|
||||
<li>
|
||||
<img class="remove" src="'.$image.'" alt="'.JText::_('K2_REMOVE_ENTRY_FROM_LIST').'" />
|
||||
<span class="handle">'.$row->title.'</span>
|
||||
<input type="hidden" value="'.$row->id.'" name="'.$fieldName.'"/>
|
||||
<span style="clear:both;"></span>
|
||||
</li>
|
||||
';
|
||||
}
|
||||
$output .= '</ul>';
|
||||
return $output;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class JFormFieldItems extends K2ElementItems
|
||||
{
|
||||
var $type = 'items';
|
||||
}
|
||||
|
||||
class JElementItems extends K2ElementItems
|
||||
{
|
||||
var $_name = 'items';
|
||||
}
|
||||
255
administrator/components/com_k2/elements/k2category.php
Normal file
255
administrator/components/com_k2/elements/k2category.php
Normal file
@@ -0,0 +1,255 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: k2category.php 1812 2013-01-14 18:45:06Z lefteris.kavadas $
|
||||
* @package K2
|
||||
* @author JoomlaWorks http://www.joomlaworks.net
|
||||
* @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.
|
||||
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die ;
|
||||
|
||||
require_once (JPATH_ADMINISTRATOR.'/components/com_k2/elements/base.php');
|
||||
|
||||
class K2ElementK2Category extends K2Element
|
||||
{
|
||||
|
||||
function fetchElement($name, $value, &$node, $control_name)
|
||||
{
|
||||
$db = JFactory::getDBO();
|
||||
$query = 'SELECT m.* FROM #__k2_categories m WHERE trash = 0 ORDER BY parent, ordering';
|
||||
$db->setQuery($query);
|
||||
$mitems = $db->loadObjectList();
|
||||
$children = array();
|
||||
if ($mitems)
|
||||
{
|
||||
foreach ($mitems as $v)
|
||||
{
|
||||
if (K2_JVERSION != '15')
|
||||
{
|
||||
$v->title = $v->name;
|
||||
$v->parent_id = $v->parent;
|
||||
}
|
||||
$pt = $v->parent;
|
||||
$list = @$children[$pt] ? $children[$pt] : array();
|
||||
array_push($list, $v);
|
||||
$children[$pt] = $list;
|
||||
}
|
||||
}
|
||||
|
||||
$list = JHTML::_('menu.treerecurse', 0, '', array(), $children, 9999, 0, 0);
|
||||
$mitems = array();
|
||||
$option = JRequest::getCmd('option');
|
||||
$prefix = ($option == 'com_joomfish') ? 'refField_' : '';
|
||||
if ($name == 'categories' || $name == 'jform[params][categories]')
|
||||
{
|
||||
$doc = JFactory::getDocument();
|
||||
$js = "
|
||||
window.addEvent('domready', function(){
|
||||
setTask();
|
||||
});
|
||||
|
||||
function setTask() {
|
||||
var counter=0;
|
||||
$$('#".$prefix."paramscategories option').each(function(el) {
|
||||
if (el.selected){
|
||||
value=el.value;
|
||||
counter++;
|
||||
}
|
||||
});
|
||||
if (counter>1 || counter==0){
|
||||
$('urlparamsid').setProperty('value','');
|
||||
$('urlparamstask').setProperty('value','');
|
||||
$('".$prefix."paramssingleCatOrdering').setProperty('disabled', 'disabled');
|
||||
enableParams();
|
||||
}
|
||||
if (counter==1){
|
||||
$('urlparamsid').setProperty('value',value);
|
||||
$('urlparamstask').setProperty('value','category');
|
||||
$('".$prefix."paramssingleCatOrdering').removeProperty('disabled');
|
||||
disableParams();
|
||||
}
|
||||
}
|
||||
|
||||
function disableParams(){
|
||||
$('".$prefix."paramsnum_leading_items').setProperty('disabled','disabled');
|
||||
$('".$prefix."paramsnum_leading_columns').setProperty('disabled','disabled');
|
||||
$('".$prefix."paramsleadingImgSize').setProperty('disabled','disabled');
|
||||
$('".$prefix."paramsnum_primary_items').setProperty('disabled','disabled');
|
||||
$('".$prefix."paramsnum_primary_columns').setProperty('disabled','disabled');
|
||||
$('".$prefix."paramsprimaryImgSize').setProperty('disabled','disabled');
|
||||
$('".$prefix."paramsnum_secondary_items').setProperty('disabled','disabled');
|
||||
$('".$prefix."paramsnum_secondary_columns').setProperty('disabled','disabled');
|
||||
$('".$prefix."paramssecondaryImgSize').setProperty('disabled','disabled');
|
||||
$('".$prefix."paramsnum_links').setProperty('disabled','disabled');
|
||||
$('".$prefix."paramsnum_links_columns').setProperty('disabled','disabled');
|
||||
$('".$prefix."paramslinksImgSize').setProperty('disabled','disabled');
|
||||
$('".$prefix."paramscatCatalogMode').setProperty('disabled','disabled');
|
||||
$('".$prefix."paramscatFeaturedItems').setProperty('disabled','disabled');
|
||||
$('".$prefix."paramscatOrdering').setProperty('disabled','disabled');
|
||||
$('".$prefix."paramscatPagination').setProperty('disabled','disabled');
|
||||
$('".$prefix."paramscatPaginationResults0').setProperty('disabled','disabled');
|
||||
$('".$prefix."paramscatPaginationResults1').setProperty('disabled','disabled');
|
||||
$('".$prefix."paramscatFeedLink0').setProperty('disabled','disabled');
|
||||
$('".$prefix."paramscatFeedLink1').setProperty('disabled','disabled');
|
||||
$('".$prefix."paramscatFeedIcon0').setProperty('disabled','disabled');
|
||||
$('".$prefix."paramscatFeedIcon1').setProperty('disabled','disabled');
|
||||
$('".$prefix."paramstheme').setProperty('disabled','disabled');
|
||||
}
|
||||
|
||||
function enableParams(){
|
||||
$('".$prefix."paramsnum_leading_items').removeProperty('disabled');
|
||||
$('".$prefix."paramsnum_leading_columns').removeProperty('disabled');
|
||||
$('".$prefix."paramsleadingImgSize').removeProperty('disabled');
|
||||
$('".$prefix."paramsnum_primary_items').removeProperty('disabled');
|
||||
$('".$prefix."paramsnum_primary_columns').removeProperty('disabled');
|
||||
$('".$prefix."paramsprimaryImgSize').removeProperty('disabled');
|
||||
$('".$prefix."paramsnum_secondary_items').removeProperty('disabled');
|
||||
$('".$prefix."paramsnum_secondary_columns').removeProperty('disabled');
|
||||
$('".$prefix."paramssecondaryImgSize').removeProperty('disabled');
|
||||
$('".$prefix."paramsnum_links').removeProperty('disabled');
|
||||
$('".$prefix."paramsnum_links_columns').removeProperty('disabled');
|
||||
$('".$prefix."paramslinksImgSize').removeProperty('disabled');
|
||||
$('".$prefix."paramscatCatalogMode').removeProperty('disabled');
|
||||
$('".$prefix."paramscatFeaturedItems').removeProperty('disabled');
|
||||
$('".$prefix."paramscatOrdering').removeProperty('disabled');
|
||||
$('".$prefix."paramscatPagination').removeProperty('disabled');
|
||||
$('".$prefix."paramscatPaginationResults0').removeProperty('disabled');
|
||||
$('".$prefix."paramscatPaginationResults1').removeProperty('disabled');
|
||||
$('".$prefix."paramscatFeedLink0').removeProperty('disabled');
|
||||
$('".$prefix."paramscatFeedLink1').removeProperty('disabled');
|
||||
$('".$prefix."paramscatFeedIcon0').removeProperty('disabled');
|
||||
$('".$prefix."paramscatFeedIcon1').removeProperty('disabled');
|
||||
$('".$prefix."paramstheme').removeProperty('disabled');
|
||||
}
|
||||
";
|
||||
|
||||
if (K2_JVERSION != '15')
|
||||
{
|
||||
$js = "
|
||||
function disableParams(){
|
||||
$('jform_params_num_leading_items').setProperty('disabled','disabled');
|
||||
$('jform_params_num_leading_columns').setProperty('disabled','disabled');
|
||||
$('jform_params_leadingImgSize').setProperty('disabled','disabled');
|
||||
$('jform_params_num_primary_items').setProperty('disabled','disabled');
|
||||
$('jform_params_num_primary_columns').setProperty('disabled','disabled');
|
||||
$('jform_params_primaryImgSize').setProperty('disabled','disabled');
|
||||
$('jform_params_num_secondary_items').setProperty('disabled','disabled');
|
||||
$('jform_params_num_secondary_columns').setProperty('disabled','disabled');
|
||||
$('jform_params_secondaryImgSize').setProperty('disabled','disabled');
|
||||
$('jform_params_num_links').setProperty('disabled','disabled');
|
||||
$('jform_params_num_links_columns').setProperty('disabled','disabled');
|
||||
$('jform_params_linksImgSize').setProperty('disabled','disabled');
|
||||
$('jform_params_catCatalogMode').setProperty('disabled','disabled');
|
||||
$('jform_params_catFeaturedItems').setProperty('disabled','disabled');
|
||||
$('jform_params_catOrdering').setProperty('disabled','disabled');
|
||||
$('jform_params_catPagination').setProperty('disabled','disabled');
|
||||
$('jform_params_catPaginationResults0').setProperty('disabled','disabled');
|
||||
$('jform_params_catPaginationResults1').setProperty('disabled','disabled');
|
||||
$('jform_params_catFeedLink0').setProperty('disabled','disabled');
|
||||
$('jform_params_catFeedLink1').setProperty('disabled','disabled');
|
||||
$('jform_params_catFeedIcon0').setProperty('disabled','disabled');
|
||||
$('jform_params_catFeedIcon1').setProperty('disabled','disabled');
|
||||
$('jformparamstheme').setProperty('disabled','disabled');
|
||||
}
|
||||
|
||||
function enableParams(){
|
||||
$('jform_params_num_leading_items').removeProperty('disabled');
|
||||
$('jform_params_num_leading_columns').removeProperty('disabled');
|
||||
$('jform_params_leadingImgSize').removeProperty('disabled');
|
||||
$('jform_params_num_primary_items').removeProperty('disabled');
|
||||
$('jform_params_num_primary_columns').removeProperty('disabled');
|
||||
$('jform_params_primaryImgSize').removeProperty('disabled');
|
||||
$('jform_params_num_secondary_items').removeProperty('disabled');
|
||||
$('jform_params_num_secondary_columns').removeProperty('disabled');
|
||||
$('jform_params_secondaryImgSize').removeProperty('disabled');
|
||||
$('jform_params_num_links').removeProperty('disabled');
|
||||
$('jform_params_num_links_columns').removeProperty('disabled');
|
||||
$('jform_params_linksImgSize').removeProperty('disabled');
|
||||
$('jform_params_catCatalogMode').removeProperty('disabled');
|
||||
$('jform_params_catFeaturedItems').removeProperty('disabled');
|
||||
$('jform_params_catOrdering').removeProperty('disabled');
|
||||
$('jform_params_catPagination').removeProperty('disabled');
|
||||
$('jform_params_catPaginationResults0').removeProperty('disabled');
|
||||
$('jform_params_catPaginationResults1').removeProperty('disabled');
|
||||
$('jform_params_catFeedLink0').removeProperty('disabled');
|
||||
$('jform_params_catFeedLink1').removeProperty('disabled');
|
||||
$('jform_params_catFeedIcon0').removeProperty('disabled');
|
||||
$('jform_params_catFeedIcon1').removeProperty('disabled');
|
||||
$('jformparamstheme').removeProperty('disabled');
|
||||
}
|
||||
|
||||
function setTask() {
|
||||
var counter=0;
|
||||
$$('#jformparamscategories option').each(function(el) {
|
||||
if (el.selected){
|
||||
value=el.value;
|
||||
counter++;
|
||||
}
|
||||
});
|
||||
if (counter>1 || counter==0){
|
||||
$('jform_request_id').setProperty('value','');
|
||||
$('jform_request_task').setProperty('value','');
|
||||
$('jform_params_singleCatOrdering').setProperty('disabled', 'disabled');
|
||||
enableParams();
|
||||
}
|
||||
if (counter==1){
|
||||
$('jform_request_id').setProperty('value',value);
|
||||
$('jform_request_task').setProperty('value','category');
|
||||
$('jform_params_singleCatOrdering').removeProperty('disabled');
|
||||
disableParams();
|
||||
}
|
||||
}
|
||||
|
||||
window.addEvent('domready', function(){
|
||||
if($('request-options')) {
|
||||
$$('.panel')[0].setStyle('display', 'none');
|
||||
}
|
||||
setTask();
|
||||
});
|
||||
";
|
||||
}
|
||||
|
||||
$doc->addScriptDeclaration($js);
|
||||
}
|
||||
|
||||
foreach ($list as $item)
|
||||
{
|
||||
$item->treename = JString::str_ireplace(' ', '- ', $item->treename);
|
||||
@$mitems[] = JHTML::_('select.option', $item->id, $item->treename);
|
||||
}
|
||||
|
||||
if (K2_JVERSION != '15')
|
||||
{
|
||||
$fieldName = $name.'[]';
|
||||
}
|
||||
else
|
||||
{
|
||||
$fieldName = $control_name.'['.$name.'][]';
|
||||
}
|
||||
|
||||
if ($name == 'categories' || $name == 'jform[params][categories]')
|
||||
{
|
||||
$onChange = 'onchange="setTask();"';
|
||||
}
|
||||
else
|
||||
{
|
||||
$onChange = '';
|
||||
}
|
||||
|
||||
return JHTML::_('select.genericlist', $mitems, $fieldName, $onChange.' class="inputbox" multiple="multiple" size="15"', 'value', 'text', $value);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class JFormFieldK2Category extends K2ElementK2Category
|
||||
{
|
||||
var $type = 'k2category';
|
||||
}
|
||||
|
||||
class JElementK2Category extends K2ElementK2Category
|
||||
{
|
||||
var $_name = 'k2category';
|
||||
}
|
||||
89
administrator/components/com_k2/elements/k2tag.php
Normal file
89
administrator/components/com_k2/elements/k2tag.php
Normal file
@@ -0,0 +1,89 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: k2tag.php 1975 2013-05-08 12:51:47Z lefteris.kavadas $
|
||||
* @package K2
|
||||
* @author JoomlaWorks http://www.joomlaworks.net
|
||||
* @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.
|
||||
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die ;
|
||||
|
||||
require_once (JPATH_ADMINISTRATOR.'/components/com_k2/elements/base.php');
|
||||
|
||||
class K2ElementK2Tag extends K2Element
|
||||
{
|
||||
|
||||
function fetchElement($name, $value, &$node, $control_name)
|
||||
{
|
||||
$mainframe = JFactory::getApplication();
|
||||
$db = JFactory::getDBO();
|
||||
$doc = JFactory::getDocument();
|
||||
$fieldName = (K2_JVERSION != '15') ? $name : $control_name.'['.$name.']';
|
||||
JTable::addIncludePath(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_k2'.DS.'tables');
|
||||
$tag = JTable::getInstance('K2Tag', 'Table');
|
||||
if ($value)
|
||||
{
|
||||
$db = JFactory::getDBO();
|
||||
$query = "SELECT * FROM #__k2_tags WHERE name=".$db->Quote($value);
|
||||
$db->setQuery($query);
|
||||
$tag = $db->loadObject();
|
||||
}
|
||||
if (is_null($tag))
|
||||
{
|
||||
$tag = new stdClass;
|
||||
$tag->name = JText::_('K2_SELECT_A_TAG');
|
||||
}
|
||||
// Move this to main JS file
|
||||
$js = "
|
||||
function jSelectTag(id, title, object) {
|
||||
document.getElementById('".$name."' + '_id').value = id;
|
||||
document.getElementById('".$name."' + '_name').value = title;
|
||||
if(typeof(window.parent.SqueezeBox.close=='function')){
|
||||
window.parent.SqueezeBox.close();
|
||||
}
|
||||
else {
|
||||
document.getElementById('sbox-window').close();
|
||||
}
|
||||
}
|
||||
";
|
||||
$doc->addScriptDeclaration($js);
|
||||
$link = 'index.php?option=com_k2&view=tags&task=element&tmpl=component&object='.$name;
|
||||
JHTML::_('behavior.modal', 'a.modal');
|
||||
if (K2_JVERSION == '30')
|
||||
{
|
||||
$html = '<span class="input-append">
|
||||
<input type="text" id="'.$name.'_name" value="'.htmlspecialchars($tag->name, ENT_QUOTES, 'UTF-8').'" disabled="disabled" />
|
||||
<a class="modal btn" title="'.JText::_('K2_SELECT_A_TAG').'" href="'.$link.'" rel="{handler: \'iframe\', size: {x: 700, y: 450}}"><i class="icon-file"></i>'.JText::_('K2_SELECT').'</a>
|
||||
<input type="hidden" class="required modal-value" id="'.$name.'_id" name="'.$fieldName.'" value="'.$value.'" />
|
||||
</span>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$html = '
|
||||
<div style="float:left;">
|
||||
<input style="background:#fff;margin:3px 0;" type="text" id="'.$name.'_name" value="'.htmlspecialchars($tag->name, ENT_QUOTES, 'UTF-8').'" disabled="disabled" />
|
||||
</div>
|
||||
<div class="button2-left">
|
||||
<div class="blank">
|
||||
<a class="modal" title="'.JText::_('K2_SELECT_A_TAG').'" href="'.$link.'" rel="{handler: \'iframe\', size: {x: 700, y: 450}}">'.JText::_('K2_SELECT').'</a>
|
||||
</div>
|
||||
</div>
|
||||
<input type="hidden" id="'.$name.'_id" name="'.$fieldName.'" value="'.$value.'" />
|
||||
';
|
||||
}
|
||||
return $html;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class JFormFieldK2Tag extends K2ElementK2Tag
|
||||
{
|
||||
var $type = 'k2tag';
|
||||
}
|
||||
|
||||
class JElementK2Tag extends K2ElementK2Tag
|
||||
{
|
||||
var $_name = 'k2tag';
|
||||
}
|
||||
84
administrator/components/com_k2/elements/k2user.php
Normal file
84
administrator/components/com_k2/elements/k2user.php
Normal file
@@ -0,0 +1,84 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: k2user.php 1812 2013-01-14 18:45:06Z lefteris.kavadas $
|
||||
* @package K2
|
||||
* @author JoomlaWorks http://www.joomlaworks.net
|
||||
* @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.
|
||||
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die ;
|
||||
|
||||
require_once (JPATH_ADMINISTRATOR.'/components/com_k2/elements/base.php');
|
||||
|
||||
class K2ElementK2User extends K2Element
|
||||
{
|
||||
|
||||
function fetchElement($name, $value, &$node, $control_name)
|
||||
{
|
||||
$mainframe = JFactory::getApplication();
|
||||
$db = JFactory::getDBO();
|
||||
$doc = JFactory::getDocument();
|
||||
$fieldName = (K2_JVERSION != '15') ? $name : $control_name.'['.$name.']';
|
||||
if ($value)
|
||||
{
|
||||
$user = JFactory::getUser($value);
|
||||
}
|
||||
else
|
||||
{
|
||||
$user = new stdClass;
|
||||
$user->name = JText::_('K2_SELECT_A_USER');
|
||||
}
|
||||
// Move this to main JS file
|
||||
$js = "
|
||||
function jSelectUser(id, title, object) {
|
||||
document.getElementById('".$name."' + '_id').value = id;
|
||||
document.getElementById('".$name."' + '_name').value = title;
|
||||
if(typeof(window.parent.SqueezeBox.close=='function')){
|
||||
window.parent.SqueezeBox.close();
|
||||
}
|
||||
else {
|
||||
document.getElementById('sbox-window').close();
|
||||
}
|
||||
}
|
||||
";
|
||||
$doc->addScriptDeclaration($js);
|
||||
$link = 'index.php?option=com_k2&view=users&task=element&tmpl=component&object='.$name;
|
||||
JHTML::_('behavior.modal', 'a.modal');
|
||||
if (K2_JVERSION == '30')
|
||||
{
|
||||
$html = '<span class="input-append">
|
||||
<input type="text" id="'.$name.'_name" value="'.htmlspecialchars($user->name, ENT_QUOTES, 'UTF-8').'" disabled="disabled" />
|
||||
<a class="modal btn" title="'.JText::_('K2_SELECT_A_USER').'" href="'.$link.'" rel="{handler: \'iframe\', size: {x: 700, y: 450}}"><i class="icon-file"></i>'.JText::_('K2_SELECT').'</a>
|
||||
<input type="hidden" class="required modal-value" id="'.$name.'_id" name="'.$fieldName.'" value="'.(int)$value.'" />
|
||||
</span>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$html = '
|
||||
<div style="float:left;">
|
||||
<input style="background:#fff;margin:3px 0;" type="text" id="'.$name.'_name" value="'.htmlspecialchars($user->name, ENT_QUOTES, 'UTF-8').'" disabled="disabled" />
|
||||
</div>
|
||||
<div class="button2-left">
|
||||
<div class="blank">
|
||||
<a class="modal" title="'.JText::_('K2_SELECT_A_USER').'" href="'.$link.'" rel="{handler: \'iframe\', size: {x: 700, y: 450}}">'.JText::_('K2_SELECT').'</a>
|
||||
</div>
|
||||
</div>
|
||||
<input type="hidden" id="'.$name.'_id" name="'.$fieldName.'" value="'.(int)$value.'" />
|
||||
';
|
||||
}
|
||||
return $html;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class JFormFieldK2User extends K2ElementK2User
|
||||
{
|
||||
var $type = 'k2user';
|
||||
}
|
||||
|
||||
class JElementK2User extends K2ElementK2User
|
||||
{
|
||||
var $_name = 'k2user';
|
||||
}
|
||||
152
administrator/components/com_k2/elements/menuitem.php
Normal file
152
administrator/components/com_k2/elements/menuitem.php
Normal file
@@ -0,0 +1,152 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: menuitem.php 1949 2013-03-11 16:59:08Z lefteris.kavadas $
|
||||
* @package K2
|
||||
* @author JoomlaWorks http://www.joomlaworks.net
|
||||
* @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.
|
||||
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
// Check to ensure this file is within the rest of the framework
|
||||
defined('JPATH_BASE') or die();
|
||||
|
||||
require_once (JPATH_ADMINISTRATOR.'/components/com_k2/elements/base.php');
|
||||
|
||||
class K2ElementMenuItem extends K2Element
|
||||
{
|
||||
|
||||
function fetchElement($name, $value, &$node, $control_name)
|
||||
{
|
||||
$db = JFactory::getDBO();
|
||||
|
||||
// load the list of menu types
|
||||
// TODO: move query to model
|
||||
$query = 'SELECT menutype, title'.' FROM #__menu_types'.' ORDER BY title';
|
||||
$db->setQuery($query);
|
||||
$menuTypes = $db->loadObjectList();
|
||||
|
||||
$where = '';
|
||||
if ($state = $node->attributes('state'))
|
||||
{
|
||||
$where .= ' AND published = '.(int)$state;
|
||||
}
|
||||
|
||||
// load the list of menu items
|
||||
// TODO: move query to model
|
||||
if (K2_JVERSION != '15')
|
||||
{
|
||||
$query = 'SELECT id, parent_id, title, menutype, type, published'.' FROM #__menu'.$where.' ORDER BY menutype, parent_id, ordering';
|
||||
}
|
||||
else
|
||||
{
|
||||
$query = 'SELECT id, parent, name, menutype, type, published'.' FROM #__menu'.$where.' ORDER BY menutype, parent, ordering';
|
||||
|
||||
}
|
||||
|
||||
$db->setQuery($query);
|
||||
$menuItems = $db->loadObjectList();
|
||||
|
||||
// establish the hierarchy of the menu
|
||||
// TODO: use node model
|
||||
$children = array();
|
||||
|
||||
if ($menuItems)
|
||||
{
|
||||
// first pass - collect children
|
||||
foreach ($menuItems as $v)
|
||||
{
|
||||
if (K2_JVERSION != '15')
|
||||
{
|
||||
$v->parent = $v->parent_id;
|
||||
$v->name = $v->title;
|
||||
}
|
||||
$pt = $v->parent;
|
||||
$list = @$children[$pt] ? $children[$pt] : array();
|
||||
array_push($list, $v);
|
||||
$children[$pt] = $list;
|
||||
}
|
||||
}
|
||||
|
||||
// second pass - get an indent list of the items
|
||||
$list = JHTML::_('menu.treerecurse', 0, '', array(), $children, 9999, 0, 0);
|
||||
|
||||
foreach ($list as $item)
|
||||
{
|
||||
$item->treename = JString::str_ireplace(' ', ' -', $item->treename);
|
||||
$mitems[] = JHTML::_('select.option', $item->id, ' '.$item->treename);
|
||||
}
|
||||
|
||||
// assemble into menutype groups
|
||||
$n = count($list);
|
||||
$groupedList = array();
|
||||
foreach ($list as $k => $v)
|
||||
{
|
||||
$groupedList[$v->menutype][] = &$list[$k];
|
||||
}
|
||||
|
||||
// assemble menu items to the array
|
||||
$options = array();
|
||||
$options[] = JHTML::_('select.option', '', '- '.JText::_('K2_SELECT_MENU_ITEM').' -');
|
||||
|
||||
foreach ($menuTypes as $type)
|
||||
{
|
||||
if ($type != '')
|
||||
{
|
||||
$options[] = JHTML::_('select.option', '0', ' ', 'value', 'text', true);
|
||||
$options[] = JHTML::_('select.option', $type->menutype, $type->title.' - '.JText::_('K2_TOP'), 'value', 'text', true);
|
||||
}
|
||||
if (isset($groupedList[$type->menutype]))
|
||||
{
|
||||
$n = count($groupedList[$type->menutype]);
|
||||
for ($i = 0; $i < $n; $i++)
|
||||
{
|
||||
$item = &$groupedList[$type->menutype][$i];
|
||||
|
||||
//If menutype is changed but item is not saved yet, use the new type in the list
|
||||
if (JRequest::getString('option', '', 'get') == 'com_menus')
|
||||
{
|
||||
$currentItemArray = JRequest::getVar('cid', array(0), '', 'array');
|
||||
$currentItemId = (int)$currentItemArray[0];
|
||||
$currentItemType = JRequest::getString('type', $item->type, 'get');
|
||||
if ($currentItemId == $item->id && $currentItemType != $item->type)
|
||||
{
|
||||
$item->type = $currentItemType;
|
||||
}
|
||||
}
|
||||
|
||||
$disable = @strpos($node->attributes('disable'), $item->type) !== false ? true : false;
|
||||
|
||||
if ($item->published == 0)
|
||||
$item->treename .= ' [**'.JText::_('K2_UNPUBLISHED').'**]';
|
||||
if ($item->published == -2)
|
||||
$item->treename .= ' [**'.JText::_('K2_TRASHED').'**]';
|
||||
|
||||
$options[] = JHTML::_('select.option', $item->id, $item->treename, 'value', 'text', $disable);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (K2_JVERSION != '15')
|
||||
{
|
||||
$fieldName = $name;
|
||||
}
|
||||
else
|
||||
{
|
||||
$fieldName = $control_name.'['.$name.']';
|
||||
}
|
||||
|
||||
return JHTML::_('select.genericlist', $options, $fieldName, 'class="inputbox"', 'value', 'text', $value, $control_name.$name);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class JFormFieldMenuItem extends K2ElementMenuItem
|
||||
{
|
||||
var $type = 'MenuItem';
|
||||
}
|
||||
|
||||
class JElementMenuItem extends K2ElementMenuItem
|
||||
{
|
||||
var $_name = 'MenuItem';
|
||||
}
|
||||
44
administrator/components/com_k2/elements/menus.php
Normal file
44
administrator/components/com_k2/elements/menus.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: menus.php 1812 2013-01-14 18:45:06Z lefteris.kavadas $
|
||||
* @package K2
|
||||
* @author JoomlaWorks http://www.joomlaworks.net
|
||||
* @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.
|
||||
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die ;
|
||||
|
||||
require_once (JPATH_ADMINISTRATOR.'/components/com_k2/elements/base.php');
|
||||
|
||||
class K2ElementMenus extends K2Element
|
||||
{
|
||||
|
||||
function fetchElement($name, $value, &$node, $control_name)
|
||||
{
|
||||
$fieldName = (K2_JVERSION != '15') ? $name : $control_name.'['.$name.']';
|
||||
$db = JFactory::getDBO();
|
||||
$query = "SELECT menutype, title FROM #__menu_types";
|
||||
$db->setQuery($query);
|
||||
$menus = $db->loadObjectList();
|
||||
$options = array();
|
||||
$options[] = JHTML::_('select.option', '', JText::_('K2_NONE_ONSELECTLISTS'));
|
||||
foreach ($menus as $menu)
|
||||
{
|
||||
$options[] = JHTML::_('select.option', $menu->menutype, $menu->title);
|
||||
}
|
||||
return JHTML::_('select.genericlist', $options, $fieldName, 'class="inputbox"', 'value', 'text', $value);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class JFormFieldMenus extends K2ElementMenus
|
||||
{
|
||||
var $type = 'menus';
|
||||
}
|
||||
|
||||
class JElementMenus extends K2ElementMenus
|
||||
{
|
||||
var $_name = 'menus';
|
||||
}
|
||||
93
administrator/components/com_k2/elements/moduletemplate.php
Normal file
93
administrator/components/com_k2/elements/moduletemplate.php
Normal file
@@ -0,0 +1,93 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: moduletemplate.php 1812 2013-01-14 18:45:06Z lefteris.kavadas $
|
||||
* @package K2
|
||||
* @author JoomlaWorks http://www.joomlaworks.net
|
||||
* @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.
|
||||
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die ;
|
||||
|
||||
require_once (JPATH_ADMINISTRATOR.'/components/com_k2/elements/base.php');
|
||||
|
||||
class K2ElementModuleTemplate extends K2Element
|
||||
{
|
||||
function fetchElement($name, $value, &$node, $control_name)
|
||||
{
|
||||
|
||||
jimport('joomla.filesystem.folder');
|
||||
if (K2_JVERSION != '15')
|
||||
{
|
||||
$moduleName = $node->attributes()->modulename;
|
||||
}
|
||||
else
|
||||
{
|
||||
$moduleName = $node->_attributes['modulename'];
|
||||
}
|
||||
$moduleTemplatesPath = JPATH_SITE.DS.'modules'.DS.$moduleName.DS.'tmpl';
|
||||
$moduleTemplatesFolders = JFolder::folders($moduleTemplatesPath);
|
||||
|
||||
$db = JFactory::getDBO();
|
||||
if (K2_JVERSION != '15')
|
||||
{
|
||||
$query = "SELECT template FROM #__template_styles WHERE client_id = 0 AND home = 1";
|
||||
}
|
||||
else
|
||||
{
|
||||
$query = "SELECT template FROM #__templates_menu WHERE client_id = 0 AND menuid = 0";
|
||||
}
|
||||
$db->setQuery($query);
|
||||
$defaultemplate = $db->loadResult();
|
||||
$templatePath = JPATH_SITE.DS.'templates'.DS.$defaultemplate.DS.'html'.DS.$moduleName;
|
||||
|
||||
if (JFolder::exists($templatePath))
|
||||
{
|
||||
$templateFolders = JFolder::folders($templatePath);
|
||||
$folders = @array_merge($templateFolders, $moduleTemplatesFolders);
|
||||
$folders = @array_unique($folders);
|
||||
}
|
||||
else
|
||||
{
|
||||
$folders = $moduleTemplatesFolders;
|
||||
}
|
||||
|
||||
$exclude = 'Default';
|
||||
$options = array();
|
||||
|
||||
foreach ($folders as $folder)
|
||||
{
|
||||
if (preg_match(chr(1).$exclude.chr(1), $folder))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
$options[] = JHTML::_('select.option', $folder, $folder);
|
||||
}
|
||||
|
||||
array_unshift($options, JHTML::_('select.option', 'Default', '-- '.JText::_('K2_USE_DEFAULT').' --'));
|
||||
|
||||
if (K2_JVERSION != '15')
|
||||
{
|
||||
$fieldName = $name;
|
||||
}
|
||||
else
|
||||
{
|
||||
$fieldName = $control_name.'['.$name.']';
|
||||
}
|
||||
|
||||
return JHTML::_('select.genericlist', $options, $fieldName, 'class="inputbox"', 'value', 'text', $value, $control_name.$name);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class JFormFieldModuleTemplate extends K2ElementModuleTemplate
|
||||
{
|
||||
var $type = 'moduletemplate';
|
||||
}
|
||||
|
||||
class JElementModuleTemplate extends K2ElementModuleTemplate
|
||||
{
|
||||
var $_name = 'moduletemplate';
|
||||
}
|
||||
85
administrator/components/com_k2/elements/template.php
Normal file
85
administrator/components/com_k2/elements/template.php
Normal file
@@ -0,0 +1,85 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: template.php 1812 2013-01-14 18:45:06Z lefteris.kavadas $
|
||||
* @package K2
|
||||
* @author JoomlaWorks http://www.joomlaworks.net
|
||||
* @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.
|
||||
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die ;
|
||||
|
||||
require_once (JPATH_ADMINISTRATOR.'/components/com_k2/elements/base.php');
|
||||
|
||||
class K2ElementTemplate extends K2Element
|
||||
{
|
||||
|
||||
public function fetchElement($name, $value, &$node, $control_name)
|
||||
{
|
||||
|
||||
jimport('joomla.filesystem.folder');
|
||||
$mainframe = JFactory::getApplication();
|
||||
$fieldName = (K2_JVERSION != '15') ? $name : $control_name.'['.$name.']';
|
||||
$componentPath = JPATH_SITE.DS.'components'.DS.'com_k2'.DS.'templates';
|
||||
$componentFolders = JFolder::folders($componentPath);
|
||||
$db = JFactory::getDBO();
|
||||
if (K2_JVERSION != '15')
|
||||
{
|
||||
$query = "SELECT template FROM #__template_styles WHERE client_id = 0 AND home = 1";
|
||||
}
|
||||
else
|
||||
{
|
||||
$query = "SELECT template FROM #__templates_menu WHERE client_id = 0 AND menuid = 0";
|
||||
}
|
||||
$db->setQuery($query);
|
||||
$defaultemplate = $db->loadResult();
|
||||
|
||||
if (JFolder::exists(JPATH_SITE.DS.'templates'.DS.$defaultemplate.DS.'html'.DS.'com_k2'.DS.'templates'))
|
||||
{
|
||||
$templatePath = JPATH_SITE.DS.'templates'.DS.$defaultemplate.DS.'html'.DS.'com_k2'.DS.'templates';
|
||||
}
|
||||
else
|
||||
{
|
||||
$templatePath = JPATH_SITE.DS.'templates'.DS.$defaultemplate.DS.'html'.DS.'com_k2';
|
||||
}
|
||||
|
||||
if (JFolder::exists($templatePath))
|
||||
{
|
||||
$templateFolders = JFolder::folders($templatePath);
|
||||
$folders = @array_merge($templateFolders, $componentFolders);
|
||||
$folders = @array_unique($folders);
|
||||
}
|
||||
else
|
||||
{
|
||||
$folders = $componentFolders;
|
||||
}
|
||||
|
||||
$exclude = 'default';
|
||||
$options = array();
|
||||
foreach ($folders as $folder)
|
||||
{
|
||||
if (preg_match(chr(1).$exclude.chr(1), $folder))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
$options[] = JHTML::_('select.option', $folder, $folder);
|
||||
}
|
||||
|
||||
array_unshift($options, JHTML::_('select.option', '', '-- '.JText::_('K2_USE_DEFAULT').' --'));
|
||||
|
||||
return JHTML::_('select.genericlist', $options, $fieldName, 'class="inputbox"', 'value', 'text', $value, $control_name.$name);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class JFormFieldTemplate extends K2ElementTemplate
|
||||
{
|
||||
var $type = 'template';
|
||||
}
|
||||
|
||||
class JElementTemplate extends K2ElementTemplate
|
||||
{
|
||||
var $_name = 'template';
|
||||
}
|
||||
84
administrator/components/com_k2/elements/user.php
Normal file
84
administrator/components/com_k2/elements/user.php
Normal file
@@ -0,0 +1,84 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: user.php 1812 2013-01-14 18:45:06Z lefteris.kavadas $
|
||||
* @package K2
|
||||
* @author JoomlaWorks http://www.joomlaworks.net
|
||||
* @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.
|
||||
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die ;
|
||||
|
||||
require_once (JPATH_ADMINISTRATOR.'/components/com_k2/elements/base.php');
|
||||
|
||||
class K2ElementUser extends K2Element
|
||||
{
|
||||
|
||||
function fetchElement($name, $value, &$node, $control_name)
|
||||
{
|
||||
$mainframe = JFactory::getApplication();
|
||||
$db = JFactory::getDBO();
|
||||
$doc = JFactory::getDocument();
|
||||
$fieldName = (K2_JVERSION != '15') ? $name : $control_name.'['.$name.']';
|
||||
if ($value)
|
||||
{
|
||||
$user = JFactory::getUser($value);
|
||||
}
|
||||
else
|
||||
{
|
||||
$user = new stdClass;
|
||||
$user->name = JText::_('K2_SELECT_A_USER');
|
||||
}
|
||||
// Move this to main JS file
|
||||
$js = "
|
||||
function jSelectUser(id, title, object) {
|
||||
document.getElementById('".$name."' + '_id').value = id;
|
||||
document.getElementById('".$name."' + '_name').value = title;
|
||||
if(typeof(window.parent.SqueezeBox.close=='function')){
|
||||
window.parent.SqueezeBox.close();
|
||||
}
|
||||
else {
|
||||
document.getElementById('sbox-window').close();
|
||||
}
|
||||
}
|
||||
";
|
||||
$doc->addScriptDeclaration($js);
|
||||
$link = 'index.php?option=com_k2&view=users&task=element&tmpl=component&object='.$name;
|
||||
JHTML::_('behavior.modal', 'a.modal');
|
||||
if (K2_JVERSION == '30')
|
||||
{
|
||||
$html = '<span class="input-append">
|
||||
<input type="text" id="'.$name.'_name" value="'.htmlspecialchars($user->name, ENT_QUOTES, 'UTF-8').'" disabled="disabled" />
|
||||
<a class="modal btn" title="'.JText::_('K2_SELECT_A_USER').'" href="'.$link.'" rel="{handler: \'iframe\', size: {x: 700, y: 450}}"><i class="icon-file"></i>'.JText::_('K2_SELECT').'</a>
|
||||
<input type="hidden" class="required modal-value" id="'.$name.'_id" name="'.$fieldName.'" value="'.(int)$value.'" />
|
||||
</span>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$html = '
|
||||
<div style="float:left;">
|
||||
<input style="background:#fff;margin:3px 0;" type="text" id="'.$name.'_name" value="'.htmlspecialchars($user->name, ENT_QUOTES, 'UTF-8').'" disabled="disabled" />
|
||||
</div>
|
||||
<div class="button2-left">
|
||||
<div class="blank">
|
||||
<a class="modal" title="'.JText::_('K2_SELECT_A_USER').'" href="'.$link.'" rel="{handler: \'iframe\', size: {x: 700, y: 450}}">'.JText::_('K2_SELECT').'</a>
|
||||
</div>
|
||||
</div>
|
||||
<input type="hidden" id="'.$name.'_id" name="'.$fieldName.'" value="'.(int)$value.'" />
|
||||
';
|
||||
}
|
||||
return $html;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class JFormFieldUser extends K2ElementUser
|
||||
{
|
||||
var $type = 'k2user';
|
||||
}
|
||||
|
||||
class JElementHeader extends K2ElementUser
|
||||
{
|
||||
var $_name = 'k2user';
|
||||
}
|
||||
122
administrator/components/com_k2/elements/users.php
Normal file
122
administrator/components/com_k2/elements/users.php
Normal file
@@ -0,0 +1,122 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: users.php 1978 2013-05-15 19:34:16Z joomlaworks $
|
||||
* @package K2
|
||||
* @author JoomlaWorks http://www.joomlaworks.net
|
||||
* @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.
|
||||
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die ;
|
||||
|
||||
require_once (JPATH_ADMINISTRATOR.'/components/com_k2/elements/base.php');
|
||||
|
||||
class K2ElementUsers extends K2Element
|
||||
{
|
||||
|
||||
function fetchElement($name, $value, &$node, $control_name)
|
||||
{
|
||||
JHTML::_('behavior.modal');
|
||||
$params = JComponentHelper::getParams('com_k2');
|
||||
$document = JFactory::getDocument();
|
||||
if (version_compare(JVERSION, '1.6.0', 'ge'))
|
||||
{
|
||||
JHtml::_('behavior.framework');
|
||||
}
|
||||
else
|
||||
{
|
||||
JHTML::_('behavior.mootools');
|
||||
}
|
||||
K2HelperHTML::loadjQuery();
|
||||
$mainframe = JFactory::getApplication();
|
||||
if (K2_JVERSION != '15')
|
||||
{
|
||||
$fieldName = $name;
|
||||
if (!$node->attributes('multiple'))
|
||||
{
|
||||
$fieldName .= '[]';
|
||||
}
|
||||
$image = JURI::root(true).'/administrator/templates/'.$mainframe->getTemplate().'/images/admin/publish_x.png';
|
||||
}
|
||||
else
|
||||
{
|
||||
$fieldName = $control_name.'['.$name.'][]';
|
||||
$image = JURI::root(true).'/administrator/images/publish_x.png';
|
||||
}
|
||||
|
||||
$js = "
|
||||
function jSelectUser(id, title, object) {
|
||||
var exists = false;
|
||||
\$K2('#usersList input').each(function(){
|
||||
if(\$K2(this).val()==id){
|
||||
alert('".JText::_('K2_THE_SELECTED_USER_IS_ALREADY_IN_THE_LIST', true)."');
|
||||
exists = true;
|
||||
}
|
||||
});
|
||||
if(!exists){
|
||||
var container = \$K2('<li/>').appendTo(\$K2('#usersList'));
|
||||
var img = \$K2('<img/>',{'class':'remove', src:'".$image."'}).appendTo(container);
|
||||
img.click(function(){\$K2(this).parent().remove();});
|
||||
var span = \$K2('<span/>',{'class':'handle'}).html(title).appendTo(container);
|
||||
var input = \$K2('<input/>',{value:id, type:'hidden', name:'".$fieldName."'}).appendTo(container);
|
||||
var div = \$K2('<div/>',{style:'clear:both;'}).appendTo(container);
|
||||
\$K2('#usersList').sortable('refresh');
|
||||
alert('".JText::_('K2_USER_ADDED_IN_THE_LIST', true)."');
|
||||
}
|
||||
}
|
||||
|
||||
\$K2(document).ready(function(){
|
||||
\$K2('#usersList').sortable({
|
||||
containment: '#usersList',
|
||||
items: 'li',
|
||||
handle: 'span.handle'
|
||||
});
|
||||
\$K2('body').css('overflow-y', 'scroll');
|
||||
\$K2('#usersList .remove').click(function(){
|
||||
\$K2(this).parent().remove();
|
||||
});
|
||||
});
|
||||
";
|
||||
|
||||
$document->addScriptDeclaration($js);
|
||||
$document->addStyleSheet(JURI::root(true).'/media/k2/assets/css/k2.modules.css?v=2.6.7');
|
||||
|
||||
$current = array();
|
||||
if (is_string($value) && !empty($value))
|
||||
{
|
||||
$current[] = $value;
|
||||
}
|
||||
if (is_array($value))
|
||||
{
|
||||
$current = $value;
|
||||
}
|
||||
|
||||
$output = '<ul id="usersList">';
|
||||
foreach ($current as $id)
|
||||
{
|
||||
$row = JFactory::getUser($id);
|
||||
$output .= '
|
||||
<li>
|
||||
<img class="remove" src="'.$image.'" alt="'.JText::_('K2_REMOVE_ENTRY_FROM_LIST').'" />
|
||||
<span class="handle">'.$row->name.'</span>
|
||||
<input type="hidden" value="'.$row->id.'" name="'.$fieldName.'"/>
|
||||
<div style="clear:both;"></div>
|
||||
</li>
|
||||
';
|
||||
}
|
||||
$output .= '</ul>';
|
||||
return $output;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class JFormFieldUsers extends K2ElementUsers
|
||||
{
|
||||
var $type = 'users';
|
||||
}
|
||||
|
||||
class JElementUsers extends K2ElementUsers
|
||||
{
|
||||
var $_name = 'users';
|
||||
}
|
||||
133
administrator/components/com_k2/elements/userslatest.php
Normal file
133
administrator/components/com_k2/elements/userslatest.php
Normal file
@@ -0,0 +1,133 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: userslatest.php 1978 2013-05-15 19:34:16Z joomlaworks $
|
||||
* @package K2
|
||||
* @author JoomlaWorks http://www.joomlaworks.net
|
||||
* @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.
|
||||
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die ;
|
||||
|
||||
require_once (JPATH_ADMINISTRATOR.'/components/com_k2/elements/base.php');
|
||||
|
||||
class K2ElementUsersLatest extends K2Element
|
||||
{
|
||||
|
||||
function fetchElement($name, $value, &$node, $control_name)
|
||||
{
|
||||
JHTML::_('behavior.modal');
|
||||
$params = JComponentHelper::getParams('com_k2');
|
||||
$document = JFactory::getDocument();
|
||||
if (version_compare(JVERSION, '1.6.0', 'ge'))
|
||||
{
|
||||
JHtml::_('behavior.framework');
|
||||
}
|
||||
else
|
||||
{
|
||||
JHTML::_('behavior.mootools');
|
||||
}
|
||||
|
||||
K2HelperHTML::loadjQuery();
|
||||
|
||||
$mainframe = JFactory::getApplication();
|
||||
if (K2_JVERSION != '15')
|
||||
{
|
||||
$fieldName = $name;
|
||||
if (!$node->attributes('multiple'))
|
||||
{
|
||||
$fieldName .= '[]';
|
||||
}
|
||||
$image = JURI::root(true).'/administrator/templates/'.$mainframe->getTemplate().'/images/admin/publish_x.png';
|
||||
}
|
||||
else
|
||||
{
|
||||
$fieldName = $control_name.'['.$name.'][]';
|
||||
$image = JURI::root(true).'/administrator/images/publish_x.png';
|
||||
}
|
||||
|
||||
$js = "
|
||||
function jSelectUser(id, title, object) {
|
||||
var exists = false;
|
||||
\$K2('#usersList input').each(function(){
|
||||
if(\$K2(this).val()==id){
|
||||
alert('".JText::_('K2_THE_SELECTED_USER_IS_ALREADY_IN_THE_LIST', true)."');
|
||||
exists = true;
|
||||
}
|
||||
});
|
||||
if(!exists){
|
||||
var container = \$K2('<li/>').appendTo(\$K2('#usersList'));
|
||||
var img = \$K2('<img/>',{'class':'remove', src:'".$image."'}).appendTo(container);
|
||||
img.click(function(){\$K2(this).parent().remove();});
|
||||
var span = \$K2('<span/>',{'class':'handle'}).html(title).appendTo(container);
|
||||
var input = \$K2('<input/>',{value:id, type:'hidden', name:'".$fieldName."'}).appendTo(container);
|
||||
var div = \$K2('<div/>',{style:'clear:both;'}).appendTo(container);
|
||||
\$K2('#usersList').sortable('refresh');
|
||||
alert('".JText::_('K2_USER_ADDED_IN_THE_LIST', true)."');
|
||||
}
|
||||
}
|
||||
|
||||
\$K2(document).ready(function(){
|
||||
\$K2('#usersList').sortable({
|
||||
containment: '#usersList',
|
||||
items: 'li',
|
||||
handle: 'span.handle'
|
||||
});
|
||||
\$K2('body').css('overflow-y', 'scroll');
|
||||
\$K2('#usersList .remove').click(function(){
|
||||
\$K2(this).parent().remove();
|
||||
});
|
||||
});
|
||||
";
|
||||
|
||||
$document->addScriptDeclaration($js);
|
||||
$document->addStyleSheet(JURI::root(true).'/media/k2/assets/css/k2.modules.css?v=2.6.7');
|
||||
|
||||
$current = array();
|
||||
if (is_string($value) && !empty($value))
|
||||
{
|
||||
$current[] = $value;
|
||||
}
|
||||
if (is_array($value))
|
||||
{
|
||||
$current = $value;
|
||||
}
|
||||
|
||||
$output = '
|
||||
<div class="button2-left">
|
||||
<div class="blank">
|
||||
<a class="modal btn" title="'.JText::_('K2_CLICK_TO_SELECT_ONE_OR_MORE_USERS').'" href="index.php?option=com_k2&view=users&task=element&tmpl=component" rel="{handler: \'iframe\', size: {x: 700, y: 450}}">'.JText::_('K2_CLICK_TO_SELECT_ONE_OR_MORE_USERS').'</a>
|
||||
</div>
|
||||
</div>
|
||||
<div style="clear:both;"></div>
|
||||
';
|
||||
|
||||
$output .= '<ul id="usersList">';
|
||||
foreach ($current as $id)
|
||||
{
|
||||
$row = JFactory::getUser($id);
|
||||
$output .= '
|
||||
<li>
|
||||
<img class="remove" src="'.$image.'" alt="'.JText::_('K2_REMOVE_ENTRY_FROM_LIST').'" />
|
||||
<span class="handle">'.$row->name.'</span>
|
||||
<input type="hidden" value="'.$row->id.'" name="'.$fieldName.'"/>
|
||||
<span style="clear:both;"></span>
|
||||
</li>
|
||||
';
|
||||
}
|
||||
$output .= '</ul>';
|
||||
return $output;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class JFormFieldUsersLatest extends K2ElementUsersLatest
|
||||
{
|
||||
var $type = 'userslatest';
|
||||
}
|
||||
|
||||
class JElementUsersLatest extends K2ElementUsersLatest
|
||||
{
|
||||
var $_name = 'userslatest';
|
||||
}
|
||||
132
administrator/components/com_k2/helpers/html.php
Normal file
132
administrator/components/com_k2/helpers/html.php
Normal file
@@ -0,0 +1,132 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: html.php 2002 2013-07-08 15:43:14Z joomlaworks $
|
||||
* @package K2
|
||||
* @author JoomlaWorks http://www.joomlaworks.net
|
||||
* @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.
|
||||
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die ;
|
||||
|
||||
class K2HelperHTML
|
||||
{
|
||||
|
||||
public static function subMenu()
|
||||
{
|
||||
$user = JFactory::getUser();
|
||||
$view = JRequest::getCmd('view');
|
||||
$view = JString::strtolower($view);
|
||||
$params = JComponentHelper::getParams('com_k2');
|
||||
JSubMenuHelper::addEntry(JText::_('K2_ITEMS'), 'index.php?option=com_k2&view=items', $view == 'items');
|
||||
JSubMenuHelper::addEntry(JText::_('K2_CATEGORIES'), 'index.php?option=com_k2&view=categories', $view == 'categories');
|
||||
if (!$params->get('lockTags') || $user->gid > 23)
|
||||
{
|
||||
JSubMenuHelper::addEntry(JText::_('K2_TAGS'), 'index.php?option=com_k2&view=tags', $view == 'tags');
|
||||
}
|
||||
JSubMenuHelper::addEntry(JText::_('K2_COMMENTS'), 'index.php?option=com_k2&view=comments', $view == 'comments');
|
||||
if ($user->gid > 23)
|
||||
{
|
||||
JSubMenuHelper::addEntry(JText::_('K2_USERS'), 'index.php?option=com_k2&view=users', $view == 'users');
|
||||
JSubMenuHelper::addEntry(JText::_('K2_USER_GROUPS'), 'index.php?option=com_k2&view=usergroups', $view == 'usergroups');
|
||||
JSubMenuHelper::addEntry(JText::_('K2_EXTRA_FIELDS'), 'index.php?option=com_k2&view=extrafields', $view == 'extrafields');
|
||||
JSubMenuHelper::addEntry(JText::_('K2_EXTRA_FIELD_GROUPS'), 'index.php?option=com_k2&view=extrafieldsgroups', $view == 'extrafieldsgroups');
|
||||
}
|
||||
JSubMenuHelper::addEntry(JText::_('K2_MEDIA_MANAGER'), 'index.php?option=com_k2&view=media', $view == 'media');
|
||||
JSubMenuHelper::addEntry(JText::_('K2_INFORMATION'), 'index.php?option=com_k2&view=info', $view == 'info');
|
||||
}
|
||||
|
||||
public static function stateToggler(&$row, $key, $property = 'published', $tasks = array('publish', 'unpublish'), $labels = array('K2_PUBLISH', 'K2_UNPUBLISH'))
|
||||
{
|
||||
$task = $row->$property ? $tasks[1] : $tasks[0];
|
||||
$action = $row->$property ? JText::_($labels[1]) : JText::_($labels[0]);
|
||||
$class = 'k2Toggler';
|
||||
$status = $row->$property ? 'k2Active' : 'k2Inactive';
|
||||
$href = '<a class="'.$class.' '.$status.'" href="javascript:void(0);" onclick="return listItemTask(\'cb'.$key.'\',\''.$task.'\')" title="'.$action.'">'.$action.'</a>';
|
||||
return $href;
|
||||
}
|
||||
|
||||
public static function loadjQuery($ui = false, $mediaManager = false)
|
||||
{
|
||||
JLoader::register('K2HelperUtilities', JPATH_SITE.DS.'components'.DS.'com_k2'.DS.'helpers'.DS.'utilities.php');
|
||||
|
||||
$application = JFactory::getApplication();
|
||||
$document = JFactory::getDocument();
|
||||
$params = K2HelperUtilities::getParams('com_k2');
|
||||
|
||||
if ($document->getType() == 'html')
|
||||
{
|
||||
|
||||
if (K2_JVERSION == '15')
|
||||
{
|
||||
JHtml::_('behavior.mootools');
|
||||
}
|
||||
else if (K2_JVERSION == '25')
|
||||
{
|
||||
JHtml::_('behavior.framework');
|
||||
}
|
||||
else
|
||||
{
|
||||
JHtml::_('behavior.framework');
|
||||
if ($application->isAdmin() || ($application->isSite() && $params->get('jQueryHandling')))
|
||||
{
|
||||
JHtml::_('jquery.framework');
|
||||
}
|
||||
}
|
||||
|
||||
$handling = $application->isAdmin() ? $params->get('backendJQueryHandling', 'remote') : $params->get('jQueryHandling', '1.8remote');
|
||||
// jQuery
|
||||
if (K2_JVERSION != '30')
|
||||
{
|
||||
if ($handling == 'remote')
|
||||
{
|
||||
$document->addScript('//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js');
|
||||
}
|
||||
else if ($handling == 'local')
|
||||
{
|
||||
$document->addScript(JURI::root(true).'/media/k2/assets/js/jquery-1.8.3.min.js');
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($handling && JString::strpos($handling, 'remote') !== false)
|
||||
{
|
||||
if ($handling == '1.9remote')
|
||||
{
|
||||
$handling = '1remote';
|
||||
}
|
||||
$document->addScript('//ajax.googleapis.com/ajax/libs/jquery/'.str_replace('remote', '', $handling).'/jquery.min.js');
|
||||
}
|
||||
else if ($handling && JString::strpos($handling, 'remote') === false)
|
||||
{
|
||||
$document->addScript(JURI::root(true).'/media/k2/assets/js/jquery-'.$handling.'.min.js');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// jQuery UI
|
||||
if ($application->isAdmin() || $ui)
|
||||
{
|
||||
|
||||
// No conflict loaded when $ui requested or in the backend.
|
||||
// No need to reload for $mediaManager as the latter is always called with $ui
|
||||
$document->addScript(JURI::root(true).'/media/k2/assets/js/k2.noconflict.js');
|
||||
|
||||
if ($handling == 'local')
|
||||
{
|
||||
$document->addScript(JURI::root(true).'/media/k2/assets/js/jquery-ui-1.8.24.custom.min.js');
|
||||
}
|
||||
else
|
||||
{
|
||||
$document->addScript('//ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js');
|
||||
}
|
||||
}
|
||||
|
||||
if ($mediaManager)
|
||||
{
|
||||
$document->addScript(JURI::root(true).'/media/k2/assets/js/elfinder.min.js?v=2.6.7');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
174
administrator/components/com_k2/install.mysql.sql
Normal file
174
administrator/components/com_k2/install.mysql.sql
Normal file
@@ -0,0 +1,174 @@
|
||||
CREATE TABLE IF NOT EXISTS `#__k2_attachments` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`itemID` int(11) NOT NULL,
|
||||
`filename` varchar(255) NOT NULL,
|
||||
`title` varchar(255) NOT NULL,
|
||||
`titleAttribute` text NOT NULL,
|
||||
`hits` int(11) NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `itemID` (`itemID`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `#__k2_categories` (
|
||||
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`name` varchar(255) NOT NULL,
|
||||
`alias` varchar(255) NOT NULL,
|
||||
`description` text NOT NULL,
|
||||
`parent` int(11) DEFAULT '0',
|
||||
`extraFieldsGroup` int(11) NOT NULL,
|
||||
`published` smallint(6) NOT NULL DEFAULT '0',
|
||||
`access` int(11) NOT NULL DEFAULT '0',
|
||||
`ordering` int(11) NOT NULL DEFAULT '0',
|
||||
`image` varchar(255) NOT NULL,
|
||||
`params` text NOT NULL,
|
||||
`trash` smallint(6) NOT NULL DEFAULT '0',
|
||||
`plugins` text NOT NULL,
|
||||
`language` char(7) NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `category` (`published`,`access`,`trash`),
|
||||
KEY `parent` (`parent`),
|
||||
KEY `ordering` (`ordering`),
|
||||
KEY `published` (`published`),
|
||||
KEY `access` (`access`),
|
||||
KEY `trash` (`trash`),
|
||||
KEY `language` (`language`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `#__k2_comments` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`itemID` int(11) NOT NULL,
|
||||
`userID` int(11) NOT NULL,
|
||||
`userName` varchar(255) NOT NULL,
|
||||
`commentDate` datetime NOT NULL,
|
||||
`commentText` text NOT NULL,
|
||||
`commentEmail` varchar(255) NOT NULL,
|
||||
`commentURL` varchar(255) NOT NULL,
|
||||
`published` int(11) NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `itemID` (`itemID`),
|
||||
KEY `userID` (`userID`),
|
||||
KEY `published` (`published`),
|
||||
KEY `latestComments` (`published`,`commentDate`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `#__k2_extra_fields` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`name` varchar(255) NOT NULL,
|
||||
`value` text NOT NULL,
|
||||
`type` varchar(255) NOT NULL,
|
||||
`group` int(11) NOT NULL,
|
||||
`published` tinyint(4) NOT NULL,
|
||||
`ordering` int(11) NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `group` (`group`),
|
||||
KEY `published` (`published`),
|
||||
KEY `ordering` (`ordering`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `#__k2_extra_fields_groups` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`name` varchar(255) NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `#__k2_items` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`title` varchar(255) NOT NULL,
|
||||
`alias` varchar(255) DEFAULT NULL,
|
||||
`catid` int(11) NOT NULL,
|
||||
`published` smallint(6) NOT NULL DEFAULT '0',
|
||||
`introtext` mediumtext NOT NULL,
|
||||
`fulltext` mediumtext NOT NULL,
|
||||
`video` text,
|
||||
`gallery` varchar(255) DEFAULT NULL,
|
||||
`extra_fields` text CHARACTER SET utf8 COLLATE utf8_unicode_ci,
|
||||
`extra_fields_search` text NOT NULL,
|
||||
`created` datetime NOT NULL,
|
||||
`created_by` int(11) NOT NULL DEFAULT '0',
|
||||
`created_by_alias` varchar(255) NOT NULL,
|
||||
`checked_out` int(10) unsigned NOT NULL,
|
||||
`checked_out_time` datetime NOT NULL,
|
||||
`modified` datetime NOT NULL,
|
||||
`modified_by` int(11) NOT NULL DEFAULT '0',
|
||||
`publish_up` datetime NOT NULL,
|
||||
`publish_down` datetime NOT NULL,
|
||||
`trash` smallint(6) NOT NULL DEFAULT '0',
|
||||
`access` int(11) NOT NULL DEFAULT '0',
|
||||
`ordering` int(11) NOT NULL DEFAULT '0',
|
||||
`featured` smallint(6) NOT NULL DEFAULT '0',
|
||||
`featured_ordering` int(11) NOT NULL DEFAULT '0',
|
||||
`image_caption` text NOT NULL,
|
||||
`image_credits` varchar(255) NOT NULL,
|
||||
`video_caption` text NOT NULL,
|
||||
`video_credits` varchar(255) NOT NULL,
|
||||
`hits` int(10) unsigned NOT NULL,
|
||||
`params` text NOT NULL,
|
||||
`metadesc` text NOT NULL,
|
||||
`metadata` text NOT NULL,
|
||||
`metakey` text NOT NULL,
|
||||
`plugins` text NOT NULL,
|
||||
`language` char(7) NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `item` (`published`,`publish_up`,`publish_down`,`trash`,`access`),
|
||||
KEY `catid` (`catid`),
|
||||
KEY `created_by` (`created_by`),
|
||||
KEY `ordering` (`ordering`),
|
||||
KEY `featured` (`featured`),
|
||||
KEY `featured_ordering` (`featured_ordering`),
|
||||
KEY `hits` (`hits`),
|
||||
KEY `created` (`created`),
|
||||
KEY `language` (`language`),
|
||||
FULLTEXT KEY `search` (`title`,`introtext`,`fulltext`,`extra_fields_search`,`image_caption`,`image_credits`,`video_caption`,`video_credits`,`metadesc`,`metakey`),
|
||||
FULLTEXT KEY `title` (`title`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `#__k2_rating` (
|
||||
`itemID` int(11) NOT NULL DEFAULT '0',
|
||||
`rating_sum` int(11) unsigned NOT NULL DEFAULT '0',
|
||||
`rating_count` int(11) unsigned NOT NULL DEFAULT '0',
|
||||
`lastip` varchar(50) NOT NULL DEFAULT '',
|
||||
PRIMARY KEY (`itemID`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `#__k2_tags` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`name` varchar(255) NOT NULL,
|
||||
`published` smallint(6) NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `published` (`published`),
|
||||
FULLTEXT KEY `name` (`name`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `#__k2_tags_xref` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`tagID` int(11) NOT NULL,
|
||||
`itemID` int(11) NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `tagID` (`tagID`),
|
||||
KEY `itemID` (`itemID`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `#__k2_users` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`userID` int(11) NOT NULL,
|
||||
`userName` varchar(255) DEFAULT NULL,
|
||||
`gender` enum('m','f') NOT NULL DEFAULT 'm',
|
||||
`description` text NOT NULL,
|
||||
`image` varchar(255) DEFAULT NULL,
|
||||
`url` varchar(255) DEFAULT NULL,
|
||||
`group` int(11) NOT NULL DEFAULT '0',
|
||||
`plugins` text NOT NULL,
|
||||
`ip` varchar(15) NOT NULL,
|
||||
`hostname` varchar(255) NOT NULL,
|
||||
`notes` text NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `userID` (`userID`),
|
||||
KEY `group` (`group`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `#__k2_user_groups` (
|
||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`name` varchar(255) NOT NULL,
|
||||
`permissions` text NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||
92
administrator/components/com_k2/jupgrade/j16upgrade.php
Normal file
92
administrator/components/com_k2/jupgrade/j16upgrade.php
Normal file
@@ -0,0 +1,92 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: j16upgrade.php 1812 2013-01-14 18:45:06Z lefteris.kavadas $
|
||||
* @package K2
|
||||
* @author JoomlaWorks http://www.joomlaworks.net
|
||||
* @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.
|
||||
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
defined('JPATH_BASE') or die();
|
||||
|
||||
/**
|
||||
* K2 migration class from Joomla 1.5 to Joomla 1.6+
|
||||
*
|
||||
* You can also put this class into your own extension, which makes jUpgrade to use your own copy instead of this adapter class.
|
||||
* In order to do that you should have j16upgrade.xml file somewhere in your extension path containing:
|
||||
* <jupgrade>
|
||||
* <!-- Adapter class location and name -->
|
||||
* <installer>
|
||||
* <file>administrator/components/com_k2/jupgrade/j16upgrade.php</file>
|
||||
* <class>jUpgradeComponentK2</class>
|
||||
* </installer>
|
||||
* </jupgrade>
|
||||
* For more information, see ./j16upgrade.xml
|
||||
*/
|
||||
class jUpgradeComponentK2 extends jUpgrade
|
||||
{
|
||||
/**
|
||||
* Check if K2 migration is supported.
|
||||
*/
|
||||
protected function detectExtension()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Migrate custom information.
|
||||
*
|
||||
* This function gets called after all folders and tables have been copied.
|
||||
*
|
||||
* If you want to split this task into smaller chunks,
|
||||
* please store your custom state variables into $this->state and return false.
|
||||
* Returning false will force jUpgrade to call this function again,
|
||||
* which allows you to continue import by reading $this->state before continuing.
|
||||
*
|
||||
* @return boolean Ready (true/false)
|
||||
* @since 1.6.4
|
||||
* @throws Exception
|
||||
*/
|
||||
protected function migrateExtensionCustom()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
protected function copyTable_k2_categories($table) {
|
||||
$this->source = $this->destination = "#__{$table}";
|
||||
|
||||
// Clone table
|
||||
$this->cloneTable($this->source, $this->destination);
|
||||
|
||||
// Get data
|
||||
$rows = parent::getSourceData('*');
|
||||
|
||||
// Do some custom post processing on the list.
|
||||
foreach ($rows as &$row) {
|
||||
$row['access'] = $row['access'] == 0 ? 1 : $row['access'] + 1;
|
||||
$row['params'] = $this->convertParams($row['params']);
|
||||
}
|
||||
$this->setDestinationData($rows);
|
||||
return true;
|
||||
}
|
||||
|
||||
protected function copyTable_k2_items($table) {
|
||||
$this->source = $this->destination = "#__{$table}";
|
||||
|
||||
// Clone table
|
||||
$this->cloneTable($this->source, $this->destination);
|
||||
|
||||
// Get data
|
||||
$rows = parent::getSourceData('*');
|
||||
|
||||
// Do some custom post processing on the list.
|
||||
foreach ($rows as &$row) {
|
||||
$row['access'] = $row['access'] == 0 ? 1 : $row['access'] + 1;
|
||||
$row['params'] = $this->convertParams($row['params']);
|
||||
$row['plugins'] = $this->convertParams($row['plugins']);
|
||||
}
|
||||
$this->setDestinationData($rows);
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
49
administrator/components/com_k2/jupgrade/j16upgrade.xml
Normal file
49
administrator/components/com_k2/jupgrade/j16upgrade.xml
Normal file
@@ -0,0 +1,49 @@
|
||||
<?xml version="1.0" ?>
|
||||
<!DOCTYPE jupgrade>
|
||||
<jupgrade>
|
||||
<collection>http://getk2.org/collection.xml</collection>
|
||||
<installer>
|
||||
<file>administrator/components/com_k2/jupgrade/j16upgrade.php</file>
|
||||
<class>jUpgradeComponentK2</class>
|
||||
</installer>
|
||||
<!-- The tables to copy to the new site. -->
|
||||
<tables>
|
||||
<table>k2_attachments</table>
|
||||
<table>k2_categories</table>
|
||||
<table>k2_comments</table>
|
||||
<table>k2_extra_fields</table>
|
||||
<table>k2_extra_fields_groups</table>
|
||||
<table>k2_items</table>
|
||||
<table>k2_rating</table>
|
||||
<table>k2_tags</table>
|
||||
<table>k2_tags_xref</table>
|
||||
<table>k2_users</table>
|
||||
<table>k2_user_groups</table>
|
||||
</tables>
|
||||
<!-- The folders to copy to the new site. -->
|
||||
<folders>
|
||||
<folder>administrator/components/com_k2</folder>
|
||||
<folder>components/com_k2</folder>
|
||||
<folder>media/k2</folder>
|
||||
</folders>
|
||||
<package>
|
||||
<extension>
|
||||
<name>mod_k2_comments</name>
|
||||
</extension>
|
||||
<extension>
|
||||
<name>mod_k2_content</name>
|
||||
</extension>
|
||||
<extension>
|
||||
<name>mod_k2_login</name>
|
||||
</extension>
|
||||
<extension>
|
||||
<name>mod_k2_tools</name>
|
||||
</extension>
|
||||
<extension>
|
||||
<name>mod_k2_user</name>
|
||||
</extension>
|
||||
<extension>
|
||||
<name>mod_k2_users</name>
|
||||
</extension>
|
||||
</package>
|
||||
</jupgrade>
|
||||
92
administrator/components/com_k2/jupgrade/j25upgrade.php
Normal file
92
administrator/components/com_k2/jupgrade/j25upgrade.php
Normal file
@@ -0,0 +1,92 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: j25upgrade.php 1812 2013-01-14 18:45:06Z lefteris.kavadas $
|
||||
* @package K2
|
||||
* @author JoomlaWorks http://www.joomlaworks.net
|
||||
* @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.
|
||||
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
defined('JPATH_BASE') or die();
|
||||
|
||||
/**
|
||||
* K2 migration class from Joomla 1.5 to Joomla 1.6+
|
||||
*
|
||||
* You can also put this class into your own extension, which makes jUpgrade to use your own copy instead of this adapter class.
|
||||
* In order to do that you should have j16upgrade.xml file somewhere in your extension path containing:
|
||||
* <jupgrade>
|
||||
* <!-- Adapter class location and name -->
|
||||
* <installer>
|
||||
* <file>administrator/components/com_k2/jupgrade/j16upgrade.php</file>
|
||||
* <class>jUpgradeComponentK2</class>
|
||||
* </installer>
|
||||
* </jupgrade>
|
||||
* For more information, see ./j16upgrade.xml
|
||||
*/
|
||||
class jUpgradeComponentK2 extends jUpgradeExtensions
|
||||
{
|
||||
/**
|
||||
* Check if K2 migration is supported.
|
||||
*/
|
||||
protected function detectExtension()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Migrate custom information.
|
||||
*
|
||||
* This function gets called after all folders and tables have been copied.
|
||||
*
|
||||
* If you want to split this task into smaller chunks,
|
||||
* please store your custom state variables into $this->state and return false.
|
||||
* Returning false will force jUpgrade to call this function again,
|
||||
* which allows you to continue import by reading $this->state before continuing.
|
||||
*
|
||||
* @return boolean Ready (true/false)
|
||||
* @since 1.6.4
|
||||
* @throws Exception
|
||||
*/
|
||||
protected function migrateExtensionCustom()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
protected function copyTable_k2_categories($table) {
|
||||
$this->source = $this->destination = "#__{$table}";
|
||||
|
||||
// Clone table
|
||||
$this->cloneTable($this->source, $this->destination);
|
||||
|
||||
// Get data
|
||||
$rows = parent::getSourceData('*');
|
||||
|
||||
// Do some custom post processing on the list.
|
||||
foreach ($rows as &$row) {
|
||||
$row['access'] = $row['access'] == 0 ? 1 : $row['access'] + 1;
|
||||
$row['params'] = $this->convertParams($row['params']);
|
||||
}
|
||||
$this->setDestinationData($rows);
|
||||
return true;
|
||||
}
|
||||
|
||||
protected function copyTable_k2_items($table) {
|
||||
$this->source = $this->destination = "#__{$table}";
|
||||
|
||||
// Clone table
|
||||
$this->cloneTable($this->source, $this->destination);
|
||||
|
||||
// Get data
|
||||
$rows = parent::getSourceData('*');
|
||||
|
||||
// Do some custom post processing on the list.
|
||||
foreach ($rows as &$row) {
|
||||
$row['access'] = $row['access'] == 0 ? 1 : $row['access'] + 1;
|
||||
$row['params'] = $this->convertParams($row['params']);
|
||||
$row['plugins'] = $this->convertParams($row['plugins']);
|
||||
}
|
||||
$this->setDestinationData($rows);
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
49
administrator/components/com_k2/jupgrade/j25upgrade.xml
Normal file
49
administrator/components/com_k2/jupgrade/j25upgrade.xml
Normal file
@@ -0,0 +1,49 @@
|
||||
<?xml version="1.0" ?>
|
||||
<!DOCTYPE jupgrade>
|
||||
<jupgrade>
|
||||
<collection>http://getk2.org/collection.xml</collection>
|
||||
<installer>
|
||||
<file>administrator/components/com_k2/jupgrade/j25upgrade.php</file>
|
||||
<class>jUpgradeComponentK2</class>
|
||||
</installer>
|
||||
<!-- The tables to copy to the new site. -->
|
||||
<tables>
|
||||
<table>k2_attachments</table>
|
||||
<table>k2_categories</table>
|
||||
<table>k2_comments</table>
|
||||
<table>k2_extra_fields</table>
|
||||
<table>k2_extra_fields_groups</table>
|
||||
<table>k2_items</table>
|
||||
<table>k2_rating</table>
|
||||
<table>k2_tags</table>
|
||||
<table>k2_tags_xref</table>
|
||||
<table>k2_users</table>
|
||||
<table>k2_user_groups</table>
|
||||
</tables>
|
||||
<!-- The folders to copy to the new site. -->
|
||||
<folders>
|
||||
<folder>administrator/components/com_k2</folder>
|
||||
<folder>components/com_k2</folder>
|
||||
<folder>media/k2</folder>
|
||||
</folders>
|
||||
<package>
|
||||
<extension>
|
||||
<name>mod_k2_comments</name>
|
||||
</extension>
|
||||
<extension>
|
||||
<name>mod_k2_content</name>
|
||||
</extension>
|
||||
<extension>
|
||||
<name>mod_k2_login</name>
|
||||
</extension>
|
||||
<extension>
|
||||
<name>mod_k2_tools</name>
|
||||
</extension>
|
||||
<extension>
|
||||
<name>mod_k2_user</name>
|
||||
</extension>
|
||||
<extension>
|
||||
<name>mod_k2_users</name>
|
||||
</extension>
|
||||
</package>
|
||||
</jupgrade>
|
||||
143
administrator/components/com_k2/k2.php
Normal file
143
administrator/components/com_k2/k2.php
Normal file
@@ -0,0 +1,143 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: k2.php 1995 2013-07-04 17:27:53Z lefteris.kavadas $
|
||||
* @package K2
|
||||
* @author JoomlaWorks http://www.joomlaworks.net
|
||||
* @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.
|
||||
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
JHTML::_('behavior.tooltip');
|
||||
$user = JFactory::getUser();
|
||||
$view = JRequest::getWord('view', 'items');
|
||||
$view = JString::strtolower($view);
|
||||
$task = JRequest::getCmd('task');
|
||||
$params = JComponentHelper::getParams('com_k2');
|
||||
|
||||
if(K2_JVERSION=='15'){
|
||||
if(($params->get('lockTags') && $user->gid<=23 && ($view=='tags' || $view=='tag')) || ($user->gid <= 23) && (
|
||||
$view=='extrafield' ||
|
||||
$view=='extrafields' ||
|
||||
$view=='extrafieldsgroup' ||
|
||||
$view=='extrafieldsgroups' ||
|
||||
$view=='user' ||
|
||||
($view=='users' && $task != 'element') ||
|
||||
$view=='usergroup' ||
|
||||
$view=='usergroups'
|
||||
)
|
||||
)
|
||||
{
|
||||
JError::raiseError( 403, JText::_('K2_ALERTNOTAUTH') );
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
JLoader::register('K2HelperPermissions', JPATH_SITE.DS.'components'.DS.'com_k2'.DS.'helpers'.DS.'permissions.j16.php');
|
||||
K2HelperPermissions::checkPermissions();
|
||||
|
||||
// Compatibility for gid variable
|
||||
if($user->authorise('core.admin', 'com_k2')){
|
||||
$user->gid = 1000;
|
||||
}
|
||||
else {
|
||||
$user->gid = 1;
|
||||
}
|
||||
|
||||
if( ($params->get('lockTags') && !$user->authorise('core.admin', 'com_k2') && ($view=='tags' || $view=='tag')) ||
|
||||
(!$user->authorise('core.admin', 'com_k2')) && (
|
||||
$view=='extrafield' ||
|
||||
$view=='extrafields' ||
|
||||
$view=='extrafieldsgroup' ||
|
||||
$view=='extrafieldsgroups' ||
|
||||
$view=='user' ||
|
||||
($view=='users' && $task != 'element') ||
|
||||
$view=='usergroup' ||
|
||||
$view=='usergroups'
|
||||
)
|
||||
)
|
||||
{
|
||||
JError::raiseError( 403, JText::_('K2_ALERTNOTAUTH') );
|
||||
}
|
||||
}
|
||||
|
||||
$document = JFactory::getDocument();
|
||||
|
||||
if(version_compare(JVERSION,'1.6.0','ge')) {
|
||||
JHtml::_('behavior.framework');
|
||||
} else {
|
||||
JHTML::_('behavior.mootools');
|
||||
}
|
||||
|
||||
// CSS
|
||||
$document->addStyleSheet(JURI::root(true).'/media/k2/assets/css/k2.css?v=2.6.7');
|
||||
|
||||
K2HelperHTML::loadjQuery(true, JRequest::getCmd('view') == 'media');
|
||||
|
||||
// JS
|
||||
if(K2_JVERSION == '30')
|
||||
{
|
||||
JHtml::_('formbehavior.chosen', 'select');
|
||||
}
|
||||
$document->addScriptDeclaration('K2JVersion = "'.K2_JVERSION.'";');
|
||||
$document->addScript(JURI::root(true).'/media/k2/assets/js/k2.js?v=2.6.7&sitepath='.JURI::root(true).'/');
|
||||
|
||||
// Container CSS class definition
|
||||
if(K2_JVERSION == '15'){
|
||||
$k2CSSContainerClass = ' isJ15';
|
||||
} elseif(K2_JVERSION == '25'){
|
||||
$k2CSSContainerClass = ' isJ25';
|
||||
} elseif(K2_JVERSION == '30'){
|
||||
$k2CSSContainerClass = ' isJ25 isJ30';
|
||||
} else {
|
||||
$k2CSSContainerClass = '';
|
||||
}
|
||||
|
||||
if( $document->getType() != 'raw' && JRequest::getWord('task')!='deleteAttachment' && JRequest::getWord('task')!='connector' && JRequest::getWord('task')!='tag' && JRequest::getWord('task')!='extrafields' && JRequest::getWord('task')!='download' && JRequest::getWord('task')!='saveComment'): ?>
|
||||
<!--[if lt IE 7]>
|
||||
<div style="border:1px solid #F7941D;background:#FEEFDA;text-align:center;clear:both;height:75px;position:relative;margin-bottom:16px;">
|
||||
<div style="position:absolute;right:3px;top:3px;font-family:courier new;font-weight:bold;">
|
||||
<a href="#" onclick="javascript:this.parentNode.parentNode.style.display='none';return false;"><img src="<?php echo JURI::root(true); ?>/media/k2/assets/images/ie6nomore/ie6nomore-cornerx.jpg" style="border:none;" alt="<?php echo JText::_('K2_CLOSE_THIS_NOTICE'); ?>"/></a>
|
||||
</div>
|
||||
<div style="width:640px;margin:0 auto;text-align:left;padding:0;overflow:hidden;color:black;">
|
||||
<div style="width:75px;float:left;">
|
||||
<img src="<?php echo JURI::root(true); ?>/media/k2/assets/images/ie6nomore/ie6nomore-warning.jpg" alt="<?php echo JText::_('K2_WARNING'); ?>"/>
|
||||
</div>
|
||||
<div style="width:275px;float:left;font-family:Arial,sans-serif;">
|
||||
<div style="font-size:14px;font-weight:bold;margin-top:12px;">
|
||||
<?php echo JText::_('K2_YOU_ARE_USING_AN_OUTDATED_BROWSER'); ?>
|
||||
</div>
|
||||
<div style="font-size:12px;margin-top:6px;line-height:12px;">
|
||||
<?php echo JText::_('K2_FOR_A_BETTER_EXPERIENCE_USING_THIS_SITE_PLEASE_UPGRADE_TO_A_MODERN_WEB_BROWSER'); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div style="width:75px;float:left;"><a href="http://www.firefox.com" target="_blank"><img src="<?php echo JURI::root(true); ?>/media/k2/assets/images/ie6nomore/ie6nomore-firefox.jpg" style="border:none;" alt="<?php echo JText::_('K2_GET_FIREFOX_35'); ?>"/></a></div>
|
||||
<div style="width:75px;float:left;"><a href="http://www.browserforthebetter.com/download.html" target="_blank"><img src="<?php echo JURI::root(true); ?>/media/k2/assets/images/ie6nomore/ie6nomore-ie8.jpg" style="border:none;" alt="<?php echo JText::_('K2_GET_INTERNET_EXPLORER_8'); ?>"/></a></div>
|
||||
<div style="width:73px;float:left;"><a href="http://www.apple.com/safari/download/" target="_blank"><img src="<?php echo JURI::root(true); ?>/media/k2/assets/images/ie6nomore/ie6nomore-safari.jpg" style="border:none;" alt="<?php echo JText::_('K2_GET_SAFARI_4'); ?>"/></a></div>
|
||||
<div style="float:left;"><a href="http://www.google.com/chrome" target="_blank"><img src="<?php echo JURI::root(true); ?>/media/k2/assets/images/ie6nomore/ie6nomore-chrome.jpg" style="border:none;" alt="<?php echo JText::_('K2_GET_GOOGLE_CHROME'); ?>"/></a></div>
|
||||
</div>
|
||||
</div>
|
||||
<![endif]-->
|
||||
<div id="k2AdminContainer" class="K2AdminView<?php echo ucfirst($view).$k2CSSContainerClass; ?>">
|
||||
<?php endif;
|
||||
JLoader::register('K2Controller', JPATH_COMPONENT.'/controllers/controller.php');
|
||||
JLoader::register('K2View', JPATH_COMPONENT.'/views/view.php');
|
||||
JLoader::register('K2Model', JPATH_COMPONENT.'/models/model.php');
|
||||
|
||||
$controller = JRequest::getWord('view', 'items');
|
||||
$controller = JString::strtolower($controller);
|
||||
require_once (JPATH_COMPONENT.DS.'controllers'.DS.$controller.'.php');
|
||||
$classname = 'K2Controller'.$controller;
|
||||
$controller = new $classname();
|
||||
$controller->registerTask('saveAndNew', 'save');
|
||||
$controller->execute(JRequest::getWord('task'));
|
||||
$controller->redirect();
|
||||
|
||||
if( $document->getType() != 'raw' && JRequest::getWord('task')!='deleteAttachment' && JRequest::getWord('task')!='connector' && JRequest::getWord('task')!='tag' && JRequest::getWord('task')!='extrafields' && JRequest::getWord('task')!='download' && JRequest::getWord('task')!='saveComment'): ?>
|
||||
</div>
|
||||
<div id="k2AdminFooter">
|
||||
<a target="_blank" href="http://getk2.org/">K2 v2.6.7</a> | Copyright © 2006-<?php echo date('Y'); ?> <a target="_blank" href="http://www.joomlaworks.net/">JoomlaWorks Ltd.</a>
|
||||
</div>
|
||||
<?php endif;
|
||||
316
administrator/components/com_k2/k2.xml
Normal file
316
administrator/components/com_k2/k2.xml
Normal file
@@ -0,0 +1,316 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<extension type="component" version="2.5" method="upgrade">
|
||||
<name>COM_K2</name>
|
||||
<author>JoomlaWorks</author>
|
||||
<creationDate>July 8th, 2013</creationDate>
|
||||
<copyright>Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.</copyright>
|
||||
<authorEmail>please-use-the-contact-form@joomlaworks.net</authorEmail>
|
||||
<authorUrl>www.joomlaworks.net</authorUrl>
|
||||
<version>2.6.7</version>
|
||||
<license>http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL</license>
|
||||
<description>Thank you for installing K2 by JoomlaWorks, the powerful content extension for Joomla!</description>
|
||||
<installfile>install.k2.php</installfile>
|
||||
<uninstallfile>uninstall.k2.php</uninstallfile>
|
||||
<scriptfile>script.k2.php</scriptfile>
|
||||
<install>
|
||||
<sql>
|
||||
<file driver="mysqli" charset="utf8">install.mysql.sql</file>
|
||||
<file driver="mysql" charset="utf8">install.mysql.sql</file>
|
||||
</sql>
|
||||
</install>
|
||||
<uninstall>
|
||||
<sql>
|
||||
<file driver="mysqli" charset="utf8">uninstall.mysql.sql</file>
|
||||
<file driver="mysql" charset="utf8">uninstall.mysql.sql</file>
|
||||
</sql>
|
||||
</uninstall>
|
||||
<updateservers>
|
||||
<server type="extension" priority="1" name="K2 Updates">http://getk2.org/update.xml</server>
|
||||
</updateservers>
|
||||
<files folder="components/com_k2">
|
||||
<folder>controllers</folder>
|
||||
<folder>css</folder>
|
||||
<folder>helpers</folder>
|
||||
<folder>images</folder>
|
||||
<folder>js</folder>
|
||||
<folder>models</folder>
|
||||
<folder>sef_ext</folder>
|
||||
<folder>templates</folder>
|
||||
<folder>views</folder>
|
||||
<filename>k2.php</filename>
|
||||
<filename>router.php</filename>
|
||||
</files>
|
||||
<media destination="k2" folder="media/k2">
|
||||
<folder>assets</folder>
|
||||
<folder>attachments</folder>
|
||||
<folder>categories</folder>
|
||||
<folder>galleries</folder>
|
||||
<folder>items</folder>
|
||||
<folder>users</folder>
|
||||
<folder>videos</folder>
|
||||
</media>
|
||||
<languages folder="language/en-GB">
|
||||
<language tag="en-GB">en-GB.com_k2.ini</language>
|
||||
<language tag="en-GB">en-GB.mod_k2_comments.ini</language>
|
||||
<language tag="en-GB">en-GB.mod_k2_comments.sys.ini</language>
|
||||
<language tag="en-GB">en-GB.mod_k2_content.ini</language>
|
||||
<language tag="en-GB">en-GB.mod_k2_content.sys.ini</language>
|
||||
<language tag="en-GB">en-GB.mod_k2_tools.ini</language>
|
||||
<language tag="en-GB">en-GB.mod_k2_tools.sys.ini</language>
|
||||
<language tag="en-GB">en-GB.mod_k2_users.ini</language>
|
||||
<language tag="en-GB">en-GB.mod_k2_users.sys.ini</language>
|
||||
<language tag="en-GB">en-GB.mod_k2_user.ini</language>
|
||||
<language tag="en-GB">en-GB.mod_k2_user.sys.ini</language>
|
||||
</languages>
|
||||
<administration>
|
||||
<menu img="../media/k2/assets/images/system/k2_16x16.png" view="items">COM_K2</menu>
|
||||
<submenu>
|
||||
<menu view="items" link="option=com_k2&view=items">K2_ITEMS</menu>
|
||||
<menu view="categories" link="option=com_k2&view=categories">K2_CATEGORIES</menu>
|
||||
<menu view="tags" link="option=com_k2&view=tags">K2_TAGS</menu>
|
||||
<menu view="comments" link="option=com_k2&view=comments">K2_COMMENTS</menu>
|
||||
<menu view="usergroups" link="option=com_k2&view=users">K2_USERS</menu>
|
||||
<menu view="usergroups" link="option=com_k2&view=usergroups">K2_USER_GROUPS</menu>
|
||||
<menu view="extrafields" link="option=com_k2&view=extrafields">K2_EXTRA_FIELDS</menu>
|
||||
<menu view="extrafieldgroups" link="option=com_k2&view=extrafieldsgroups">K2_EXTRA_FIELD_GROUPS</menu>
|
||||
<menu view="media" link="option=com_k2&view=media">K2_MEDIA_MANAGER</menu>
|
||||
<menu view="info" link="option=com_k2&view=info">K2_INFORMATION</menu>
|
||||
</submenu>
|
||||
<files folder="administrator/components/com_k2">
|
||||
<folder>controllers</folder>
|
||||
<folder>elements</folder>
|
||||
<folder>helpers</folder>
|
||||
<folder>jupgrade</folder>
|
||||
<folder>lib</folder>
|
||||
<folder>models</folder>
|
||||
<folder>tables</folder>
|
||||
<folder>views</folder>
|
||||
<filename>access.xml</filename>
|
||||
<filename>k2.php</filename>
|
||||
<filename>config.xml</filename>
|
||||
<filename>install.mysql.sql</filename>
|
||||
<filename>uninstall.mysql.sql</filename>
|
||||
</files>
|
||||
<languages folder="administrator/language/en-GB">
|
||||
<language tag="en-GB">en-GB.com_k2.ini</language>
|
||||
<language tag="en-GB">en-GB.com_k2.menu.ini</language>
|
||||
<language tag="en-GB">en-GB.com_k2.j16.ini</language>
|
||||
<language tag="en-GB">en-GB.mod_k2_quickicons.ini</language>
|
||||
<language tag="en-GB">en-GB.mod_k2_quickicons.sys.ini</language>
|
||||
<language tag="en-GB">en-GB.mod_k2_stats.ini</language>
|
||||
<language tag="en-GB">en-GB.mod_k2_stats.sys.ini</language>
|
||||
<language tag="en-GB">en-GB.mod_k2.j16.ini</language>
|
||||
<language tag="en-GB">en-GB.plg_finder_k2.ini</language>
|
||||
<language tag="en-GB">en-GB.plg_finder_k2.sys.ini</language>
|
||||
<language tag="en-GB">en-GB.plg_search_k2.ini</language>
|
||||
<language tag="en-GB">en-GB.plg_search_k2.sys.ini</language>
|
||||
<language tag="en-GB">en-GB.plg_system_k2.ini</language>
|
||||
<language tag="en-GB">en-GB.plg_system_k2.sys.ini</language>
|
||||
<language tag="en-GB">en-GB.plg_user_k2.ini</language>
|
||||
<language tag="en-GB">en-GB.plg_user_k2.sys.ini</language>
|
||||
</languages>
|
||||
</administration>
|
||||
<config>
|
||||
<fields>
|
||||
<fieldset>
|
||||
<!-- ######################### CSS Settings ######################### -->
|
||||
<field name="enable_css" default="1" />
|
||||
<field name="jQueryHandling" default="1.8remote" />
|
||||
<field name="backendJQueryHandling" default="remote" />
|
||||
<!-- ######################### Layout and view options for user (blog/profile) pages ######################### -->
|
||||
<field name="userName" default="1" />
|
||||
<field name="userImage" default="1" />
|
||||
<field name="userDescription" default="1" />
|
||||
<field name="userURL" default="1" />
|
||||
<field name="userEmail" default="0" />
|
||||
<field name="userFeedLink" default="1" />
|
||||
<field name="userFeedIcon" default="1" />
|
||||
<field name="userItemCount" default="10" />
|
||||
<field name="userItemTitle" default="1" />
|
||||
<field name="userItemTitleLinked" default="1" />
|
||||
<field name="userItemDateCreated" default="1" />
|
||||
<field name="userItemImage" default="1" />
|
||||
<field name="userItemIntroText" default="1" />
|
||||
<field name="userItemCategory" default="1" />
|
||||
<field name="userItemTags" default="1" />
|
||||
<field name="userItemCommentsAnchor" default="1" />
|
||||
<field name="userItemReadMore" default="1" />
|
||||
<field name="userItemK2Plugins" default="1" />
|
||||
<!-- ######################### Layout and view options for Tag listings ######################### -->
|
||||
<field name="tagItemCount" default="10" />
|
||||
<field name="tagItemTitle" default="1" />
|
||||
<field name="tagItemTitleLinked" default="1" />
|
||||
<field name="tagItemDateCreated" default="1" />
|
||||
<field name="tagItemImage" default="1" />
|
||||
<field name="tagItemIntroText" default="1" />
|
||||
<field name="tagItemCategory" default="1" />
|
||||
<field name="tagItemReadMore" default="1" />
|
||||
<field name="tagItemExtraFields" default="0" />
|
||||
<field name="tagOrdering" default="" />
|
||||
<field name="tagFeedLink" default="1" />
|
||||
<field name="tagFeedIcon" default="1" />
|
||||
<!-- ######################### Layout and view options for Search and Date listings ######################### -->
|
||||
<field name="genericItemCount" default="10" />
|
||||
<field name="genericItemTitle" default="1" />
|
||||
<field name="genericItemTitleLinked" default="1" />
|
||||
<field name="genericItemDateCreated" default="1" />
|
||||
<field name="genericItemImage" default="1" />
|
||||
<field name="genericItemIntroText" default="1" />
|
||||
<field name="genericItemCategory" default="1" />
|
||||
<field name="genericItemReadMore" default="1" />
|
||||
<field name="genericItemExtraFields" default="0" />
|
||||
<field name="genericFeedLink" default="1" />
|
||||
<field name="genericFeedIcon" default="1" />
|
||||
<!-- ######################### RSS Feed Settings ######################### -->
|
||||
<field name="feedLimit" default="10" />
|
||||
<field name="feedItemImage" default="1" />
|
||||
<field name="feedImgSize" default="S" />
|
||||
<field name="feedItemIntroText" default="1" />
|
||||
<field name="feedTextWordLimit" default="" />
|
||||
<field name="feedItemFullText" default="1" />
|
||||
<field name="feedItemTags" default="0" />
|
||||
<field name="feedItemVideo" default="0" />
|
||||
<field name="feedItemGallery" default="0" />
|
||||
<field name="feedItemAttachments" default="0" />
|
||||
<field name="feedBogusEmail" default="" />
|
||||
<!-- ######################### Content Cleanup Settings ######################### -->
|
||||
<field name="introTextCleanup" default="0" />
|
||||
<field name="introTextCleanupExcludeTags" default="" />
|
||||
<field name="introTextCleanupTagAttr" default="" />
|
||||
<field name="fullTextCleanup" default="0" />
|
||||
<field name="fullTextCleanupExcludeTags" default="" />
|
||||
<field name="fullTextCleanupTagAttr" default="" />
|
||||
<field name="xssFiltering" default="0" />
|
||||
<!-- ######################### Extra Fields Settings ######################### -->
|
||||
<field name="linkPopupWidth" default="900" />
|
||||
<field name="linkPopupHeight" default="600" />
|
||||
<!-- ######################### Image Settings ######################### -->
|
||||
<field name="imagesQuality" default="100" />
|
||||
<field name="itemImageXS" default="100" />
|
||||
<field name="itemImageS" default="200" />
|
||||
<field name="itemImageM" default="400" />
|
||||
<field name="itemImageL" default="600" />
|
||||
<field name="itemImageXL" default="900" />
|
||||
<field name="itemImageGeneric" default="300" />
|
||||
<field name="catImageWidth" default="100" />
|
||||
<field name="catImageDefault" default="1" />
|
||||
<field name="userImageWidth" default="100" />
|
||||
<field name="userImageDefault" default="1" />
|
||||
<field name="commenterImgWidth" default="48" />
|
||||
<field name="onlineImageEditor" default="splashup" />
|
||||
<field name="imageTimestamp" default="0" />
|
||||
<field name="imageMemoryLimit" default="" />
|
||||
<!-- ######################### Social Settings ######################### -->
|
||||
<field name="socialButtonCode" default="" />
|
||||
<field name="twitterUsername" default="" />
|
||||
<field name="facebookImage" default="Medium" />
|
||||
<!-- ######################### Comments ######################### -->
|
||||
<field name="comments" default="1" />
|
||||
<field name="commentsOrdering" default="DESC" />
|
||||
<field name="commentsLimit" default="10" />
|
||||
<field name="commentsFormPosition" default="below" />
|
||||
<field name="commentsPublishing" default="1" />
|
||||
<field name="commentsReporting" default="2" />
|
||||
<field name="commentsReportRecipient" default="" />
|
||||
<field name="inlineCommentsModeration" default="0" />
|
||||
<field name="gravatar" default="1" />
|
||||
<field name="recaptcha" default="0" />
|
||||
<field name="recaptchaForRegistered" default="1" />
|
||||
<field name="commentsFormNotes" default="1" />
|
||||
<field name="commentsFormNotesText" default="" />
|
||||
<!-- ######################### Frontend Editing ######################### -->
|
||||
<field name="frontendEditing" default="1" />
|
||||
<field name="showImageTab" default="1" />
|
||||
<field name="showImageGalleryTab" default="1" />
|
||||
<field name="showVideoTab" default="1" />
|
||||
<field name="showExtraFieldsTab" default="1" />
|
||||
<field name="showAttachmentsTab" default="1" />
|
||||
<field name="showK2Plugins" default="1" />
|
||||
<field name="sideBarDisplayFrontend" default="0" />
|
||||
<!-- ######################### Advanced Settings ######################### -->
|
||||
<field name="mergeEditors" default="1" />
|
||||
<field name="sideBarDisplay" default="1" />
|
||||
<field name="attachmentsFolder" default="" />
|
||||
<field name="hideImportButton" default="0" />
|
||||
<field name="googleSearch" default="0" />
|
||||
<field name="googleSearchContainer" default="k2GoogleSearchContainer" />
|
||||
<field name="K2UserProfile" default="1" />
|
||||
<field name="K2UserGroup" default="" />
|
||||
<field name="redirect" default="" />
|
||||
<field name="adminSearch" default="simple" />
|
||||
<field name="cookieDomain" default="" />
|
||||
<!-- ######################### Tag System Settings ######################### -->
|
||||
<field name="taggingSystem" default="1" />
|
||||
<field name="lockTags" default="0" />
|
||||
<field name="showTagFilter" default="0" />
|
||||
<field name="k2TagNorm" default="0" />
|
||||
<field name="k2TagNormCase" default="lower" />
|
||||
<field name="k2TagNormAdditionalReplacements" default="" />
|
||||
<!-- ######################### Anti-spam Settings ######################### -->
|
||||
<field name="recaptcha_public_key" default="" />
|
||||
<field name="recaptcha_private_key" default="" />
|
||||
<field name="recaptcha_theme" default="clean" />
|
||||
<field name="recaptchaOnRegistration" default="0" />
|
||||
<field name="stopForumSpam" default="0" />
|
||||
<field name="stopForumSpamApiKey" default="" />
|
||||
<!-- ######################### Performance Settings ######################### -->
|
||||
<field name="showItemsCounterAdmin" default="1" />
|
||||
<field name="showChildCatItems" default="1" />
|
||||
<field name="disableCompactOrdering" default="0" />
|
||||
<!-- ######################### SEO Settings ######################### -->
|
||||
<field name="metaDescLimit" default="150" />
|
||||
<field name="enforceSEFReplacements" default="0" />
|
||||
<field name="SEFReplacements" default="" />
|
||||
<!-- ######################### Advanced SEF Settings ######################### -->
|
||||
<field name="k2Sef" default="0" />
|
||||
<field name="k2SefLabelCat" default="content" />
|
||||
<field name="k2SefLabelTag" default="tag" />
|
||||
<field name="k2SefLabelUser" default="author" />
|
||||
<field name="k2SefLabelSearch" default="search" />
|
||||
<field name="k2SefLabelDate" default="date" />
|
||||
<field name="k2SefLabelItem" default="0" />
|
||||
<field name="k2SefLabelItemCustomPrefix" default="" />
|
||||
<field name="k2SefInsertItemId" default="1" />
|
||||
<field name="k2SefItemIdTitleAliasSep" default="dash" />
|
||||
<field name="k2SefUseItemTitleAlias" default="1" />
|
||||
<field name="k2SefInsertCatId" default="1" />
|
||||
<field name="k2SefCatIdTitleAliasSep" default="dash" />
|
||||
<field name="k2SefUseCatTitleAlias" default="1" />
|
||||
<!-- ######################### sh404SEF Settings ######################### -->
|
||||
<field name="sh404SefLabelCat" default="" />
|
||||
<field name="sh404SefLabelUser" default="blog" />
|
||||
<field name="sh404SefLabelItem" default="2" />
|
||||
<field name="sh404SefTitleAlias" default="alias" />
|
||||
<field name="sh404SefModK2ContentFeedAlias" default="feed" />
|
||||
<field name="sh404SefInsertItemId" default="0" />
|
||||
<field name="sh404SefInsertUniqueItemId" default="0" />
|
||||
<field name="cbIntegration" default="0" />
|
||||
</fieldset>
|
||||
</fields>
|
||||
</config>
|
||||
<modules>
|
||||
<module module="mod_k2_comments" client="site" />
|
||||
<module module="mod_k2_content" client="site" />
|
||||
<module module="mod_k2_tools" client="site" />
|
||||
<module module="mod_k2_users" client="site" />
|
||||
<module module="mod_k2_user" client="site" />
|
||||
<module module="mod_k2_quickicons" client="administrator" />
|
||||
<module module="mod_k2_stats" client="administrator" />
|
||||
</modules>
|
||||
<plugins>
|
||||
<plugin plugin="k2" group="finder" />
|
||||
<plugin plugin="k2" group="search" />
|
||||
<plugin plugin="k2" group="system" />
|
||||
<plugin plugin="k2" group="user" />
|
||||
<plugin plugin="k2category" group="josetta_ext" />
|
||||
<plugin plugin="k2item" group="josetta_ext" />
|
||||
</plugins>
|
||||
<joomfish>
|
||||
<file>k2_attachments.xml</file>
|
||||
<file>k2_categories.xml</file>
|
||||
<file>k2_extra_fields.xml</file>
|
||||
<file>k2_items.xml</file>
|
||||
<file>k2_tags.xml</file>
|
||||
<file>k2_users.xml</file>
|
||||
</joomfish>
|
||||
</extension>
|
||||
815
administrator/components/com_k2/lib/JSON.php
Normal file
815
administrator/components/com_k2/lib/JSON.php
Normal file
@@ -0,0 +1,815 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: JSON.php 1812 2013-01-14 18:45:06Z lefteris.kavadas $
|
||||
* @package K2
|
||||
* @author JoomlaWorks http://www.joomlaworks.net
|
||||
* @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.
|
||||
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
|
||||
|
||||
/**
|
||||
* Converts to and from JSON format.
|
||||
*
|
||||
* JSON (JavaScript Object Notation) is a lightweight data-interchange
|
||||
* format. It is easy for humans to read and write. It is easy for machines
|
||||
* to parse and generate. It is based on a subset of the JavaScript
|
||||
* Programming Language, Standard ECMA-262 3rd Edition - December 1999.
|
||||
* This feature can also be found in Python. JSON is a text format that is
|
||||
* completely language independent but uses conventions that are familiar
|
||||
* to programmers of the C-family of languages, including C, C++, C#, Java,
|
||||
* JavaScript, Perl, TCL, and many others. These properties make JSON an
|
||||
* ideal data-interchange language.
|
||||
*
|
||||
* This package provides a simple encoder and decoder for JSON notation. It
|
||||
* is intended for use with client-side Javascript applications that make
|
||||
* use of HTTPRequest to perform server communication functions - data can
|
||||
* be encoded into JSON notation for use in a client-side javascript, or
|
||||
* decoded from incoming Javascript requests. JSON format is native to
|
||||
* Javascript, and can be directly eval()'ed with no further parsing
|
||||
* overhead
|
||||
*
|
||||
* All strings should be in ASCII or UTF-8 format!
|
||||
*
|
||||
* LICENSE: Redistribution and use in source and binary forms, with or
|
||||
* without modification, are permitted provided that the following
|
||||
* conditions are met: Redistributions of source code must retain the
|
||||
* above copyright notice, this list of conditions and the following
|
||||
* disclaimer. Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following disclaimer
|
||||
* in the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
|
||||
* NO EVENT SHALL CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
|
||||
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
|
||||
* DAMAGE.
|
||||
*
|
||||
* @category
|
||||
* @package Services_JSON
|
||||
* @author Michal Migurski <mike-json@teczno.com>
|
||||
* @author Matt Knapp <mdknapp[at]gmail[dot]com>
|
||||
* @author Brett Stimmerman <brettstimmerman[at]gmail[dot]com>
|
||||
* @copyright 2005 Michal Migurski
|
||||
* @version CVS: $Id: JSON.php 1812 2013-01-14 18:45:06Z lefteris.kavadas $
|
||||
* @license http://www.opensource.org/licenses/bsd-license.php
|
||||
* @link http://pear.php.net/pepr/pepr-proposal-show.php?id=198
|
||||
*/
|
||||
|
||||
/**
|
||||
* Marker constant for Services_JSON::decode(), used to flag stack state
|
||||
*/
|
||||
if(!defined('SERVICES_JSON_SLICE')) define('SERVICES_JSON_SLICE', 1);
|
||||
|
||||
/**
|
||||
* Marker constant for Services_JSON::decode(), used to flag stack state
|
||||
*/
|
||||
if(!defined('SERVICES_JSON_IN_STR')) define('SERVICES_JSON_IN_STR', 2);
|
||||
|
||||
/**
|
||||
* Marker constant for Services_JSON::decode(), used to flag stack state
|
||||
*/
|
||||
if(!defined('SERVICES_JSON_IN_ARR')) define('SERVICES_JSON_IN_ARR', 3);
|
||||
|
||||
/**
|
||||
* Marker constant for Services_JSON::decode(), used to flag stack state
|
||||
*/
|
||||
if(!defined('SERVICES_JSON_IN_OBJ')) define('SERVICES_JSON_IN_OBJ', 4);
|
||||
|
||||
/**
|
||||
* Marker constant for Services_JSON::decode(), used to flag stack state
|
||||
*/
|
||||
if(!defined('SERVICES_JSON_IN_CMT')) define('SERVICES_JSON_IN_CMT', 5);
|
||||
|
||||
/**
|
||||
* Behavior switch for Services_JSON::decode()
|
||||
*/
|
||||
if(!defined('SERVICES_JSON_LOOSE_TYPE')) define('SERVICES_JSON_LOOSE_TYPE', 16);
|
||||
|
||||
/**
|
||||
* Behavior switch for Services_JSON::decode()
|
||||
*/
|
||||
if(!defined('SERVICES_JSON_SUPPRESS_ERRORS')) define('SERVICES_JSON_SUPPRESS_ERRORS', 32);
|
||||
|
||||
/**
|
||||
* Converts to and from JSON format.
|
||||
*
|
||||
* Brief example of use:
|
||||
*
|
||||
* <code>
|
||||
* // create a new instance of Services_JSON
|
||||
* $json = new Services_JSON();
|
||||
*
|
||||
* // convert a complexe value to JSON notation, and send it to the browser
|
||||
* $value = array('foo', 'bar', array(1, 2, 'baz'), array(3, array(4)));
|
||||
* $output = $json->encode($value);
|
||||
*
|
||||
* print($output);
|
||||
* // prints: ["foo","bar",[1,2,"baz"],[3,[4]]]
|
||||
*
|
||||
* // accept incoming POST data, assumed to be in JSON notation
|
||||
* $input = file_get_contents('php://input', 1000000);
|
||||
* $value = $json->decode($input);
|
||||
* </code>
|
||||
*/
|
||||
if(!class_exists('Services_JSON')){
|
||||
class Services_JSON
|
||||
{
|
||||
/**
|
||||
* constructs a new JSON instance
|
||||
*
|
||||
* @param int $use object behavior flags; combine with boolean-OR
|
||||
*
|
||||
* possible values:
|
||||
* - SERVICES_JSON_LOOSE_TYPE: loose typing.
|
||||
* "{...}" syntax creates associative arrays
|
||||
* instead of objects in decode().
|
||||
* - SERVICES_JSON_SUPPRESS_ERRORS: error suppression.
|
||||
* Values which can't be encoded (e.g. resources)
|
||||
* appear as NULL instead of throwing errors.
|
||||
* By default, a deeply-nested resource will
|
||||
* bubble up with an error, so all return values
|
||||
* from encode() should be checked with isError()
|
||||
*/
|
||||
function Services_JSON($use = 0)
|
||||
{
|
||||
$this->use = $use;
|
||||
}
|
||||
|
||||
/**
|
||||
* convert a string from one UTF-16 char to one UTF-8 char
|
||||
*
|
||||
* Normally should be handled by mb_convert_encoding, but
|
||||
* provides a slower PHP-only method for installations
|
||||
* that lack the multibye string extension.
|
||||
*
|
||||
* @param string $utf16 UTF-16 character
|
||||
* @return string UTF-8 character
|
||||
* @access private
|
||||
*/
|
||||
function utf162utf8($utf16)
|
||||
{
|
||||
// oh please oh please oh please oh please oh please
|
||||
if(function_exists('mb_convert_encoding')) {
|
||||
return mb_convert_encoding($utf16, 'UTF-8', 'UTF-16');
|
||||
}
|
||||
|
||||
$bytes = (ord($utf16{0}) << 8) | ord($utf16{1});
|
||||
|
||||
switch(true) {
|
||||
case ((0x7F & $bytes) == $bytes):
|
||||
// this case should never be reached, because we are in ASCII range
|
||||
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
return chr(0x7F & $bytes);
|
||||
|
||||
case (0x07FF & $bytes) == $bytes:
|
||||
// return a 2-byte UTF-8 character
|
||||
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
return chr(0xC0 | (($bytes >> 6) & 0x1F))
|
||||
. chr(0x80 | ($bytes & 0x3F));
|
||||
|
||||
case (0xFFFF & $bytes) == $bytes:
|
||||
// return a 3-byte UTF-8 character
|
||||
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
return chr(0xE0 | (($bytes >> 12) & 0x0F))
|
||||
. chr(0x80 | (($bytes >> 6) & 0x3F))
|
||||
. chr(0x80 | ($bytes & 0x3F));
|
||||
}
|
||||
|
||||
// ignoring UTF-32 for now, sorry
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* convert a string from one UTF-8 char to one UTF-16 char
|
||||
*
|
||||
* Normally should be handled by mb_convert_encoding, but
|
||||
* provides a slower PHP-only method for installations
|
||||
* that lack the multibye string extension.
|
||||
*
|
||||
* @param string $utf8 UTF-8 character
|
||||
* @return string UTF-16 character
|
||||
* @access private
|
||||
*/
|
||||
function utf82utf16($utf8)
|
||||
{
|
||||
// oh please oh please oh please oh please oh please
|
||||
if(function_exists('mb_convert_encoding')) {
|
||||
return mb_convert_encoding($utf8, 'UTF-16', 'UTF-8');
|
||||
}
|
||||
|
||||
switch(strlen($utf8)) {
|
||||
case 1:
|
||||
// this case should never be reached, because we are in ASCII range
|
||||
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
return $utf8;
|
||||
|
||||
case 2:
|
||||
// return a UTF-16 character from a 2-byte UTF-8 char
|
||||
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
return chr(0x07 & (ord($utf8{0}) >> 2))
|
||||
. chr((0xC0 & (ord($utf8{0}) << 6))
|
||||
| (0x3F & ord($utf8{1})));
|
||||
|
||||
case 3:
|
||||
// return a UTF-16 character from a 3-byte UTF-8 char
|
||||
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
return chr((0xF0 & (ord($utf8{0}) << 4))
|
||||
| (0x0F & (ord($utf8{1}) >> 2)))
|
||||
. chr((0xC0 & (ord($utf8{1}) << 6))
|
||||
| (0x7F & ord($utf8{2})));
|
||||
}
|
||||
|
||||
// ignoring UTF-32 for now, sorry
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* encodes an arbitrary variable into JSON format
|
||||
*
|
||||
* @param mixed $var any number, boolean, string, array, or object to be encoded.
|
||||
* see argument 1 to Services_JSON() above for array-parsing behavior.
|
||||
* if var is a strng, note that encode() always expects it
|
||||
* to be in ASCII or UTF-8 format!
|
||||
*
|
||||
* @return mixed JSON string representation of input var or an error if a problem occurs
|
||||
* @access public
|
||||
*/
|
||||
function encode($var)
|
||||
{
|
||||
switch (gettype($var)) {
|
||||
case 'boolean':
|
||||
return $var ? 'true' : 'false';
|
||||
|
||||
case 'NULL':
|
||||
return 'null';
|
||||
|
||||
case 'integer':
|
||||
return (int) $var;
|
||||
|
||||
case 'double':
|
||||
case 'float':
|
||||
return (float) $var;
|
||||
|
||||
case 'string':
|
||||
// STRINGS ARE EXPECTED TO BE IN ASCII OR UTF-8 FORMAT
|
||||
$ascii = '';
|
||||
$strlen_var = strlen($var);
|
||||
|
||||
/*
|
||||
* Iterate over every character in the string,
|
||||
* escaping with a slash or encoding to UTF-8 where necessary
|
||||
*/
|
||||
for ($c = 0; $c < $strlen_var; ++$c) {
|
||||
|
||||
$ord_var_c = ord($var{$c});
|
||||
|
||||
switch (true) {
|
||||
case $ord_var_c == 0x08:
|
||||
$ascii .= '\b';
|
||||
break;
|
||||
case $ord_var_c == 0x09:
|
||||
$ascii .= '\t';
|
||||
break;
|
||||
case $ord_var_c == 0x0A:
|
||||
$ascii .= '\n';
|
||||
break;
|
||||
case $ord_var_c == 0x0C:
|
||||
$ascii .= '\f';
|
||||
break;
|
||||
case $ord_var_c == 0x0D:
|
||||
$ascii .= '\r';
|
||||
break;
|
||||
|
||||
case $ord_var_c == 0x22:
|
||||
case $ord_var_c == 0x2F:
|
||||
case $ord_var_c == 0x5C:
|
||||
// double quote, slash, slosh
|
||||
$ascii .= '\\'.$var{$c};
|
||||
break;
|
||||
|
||||
case (($ord_var_c >= 0x20) && ($ord_var_c <= 0x7F)):
|
||||
// characters U-00000000 - U-0000007F (same as ASCII)
|
||||
$ascii .= $var{$c};
|
||||
break;
|
||||
|
||||
case (($ord_var_c & 0xE0) == 0xC0):
|
||||
// characters U-00000080 - U-000007FF, mask 110XXXXX
|
||||
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
$char = pack('C*', $ord_var_c, ord($var{$c + 1}));
|
||||
$c += 1;
|
||||
$utf16 = $this->utf82utf16($char);
|
||||
$ascii .= sprintf('\u%04s', bin2hex($utf16));
|
||||
break;
|
||||
|
||||
case (($ord_var_c & 0xF0) == 0xE0):
|
||||
// characters U-00000800 - U-0000FFFF, mask 1110XXXX
|
||||
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
$char = pack('C*', $ord_var_c,
|
||||
ord($var{$c + 1}),
|
||||
ord($var{$c + 2}));
|
||||
$c += 2;
|
||||
$utf16 = $this->utf82utf16($char);
|
||||
$ascii .= sprintf('\u%04s', bin2hex($utf16));
|
||||
break;
|
||||
|
||||
case (($ord_var_c & 0xF8) == 0xF0):
|
||||
// characters U-00010000 - U-001FFFFF, mask 11110XXX
|
||||
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
$char = pack('C*', $ord_var_c,
|
||||
ord($var{$c + 1}),
|
||||
ord($var{$c + 2}),
|
||||
ord($var{$c + 3}));
|
||||
$c += 3;
|
||||
$utf16 = $this->utf82utf16($char);
|
||||
$ascii .= sprintf('\u%04s', bin2hex($utf16));
|
||||
break;
|
||||
|
||||
case (($ord_var_c & 0xFC) == 0xF8):
|
||||
// characters U-00200000 - U-03FFFFFF, mask 111110XX
|
||||
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
$char = pack('C*', $ord_var_c,
|
||||
ord($var{$c + 1}),
|
||||
ord($var{$c + 2}),
|
||||
ord($var{$c + 3}),
|
||||
ord($var{$c + 4}));
|
||||
$c += 4;
|
||||
$utf16 = $this->utf82utf16($char);
|
||||
$ascii .= sprintf('\u%04s', bin2hex($utf16));
|
||||
break;
|
||||
|
||||
case (($ord_var_c & 0xFE) == 0xFC):
|
||||
// characters U-04000000 - U-7FFFFFFF, mask 1111110X
|
||||
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
$char = pack('C*', $ord_var_c,
|
||||
ord($var{$c + 1}),
|
||||
ord($var{$c + 2}),
|
||||
ord($var{$c + 3}),
|
||||
ord($var{$c + 4}),
|
||||
ord($var{$c + 5}));
|
||||
$c += 5;
|
||||
$utf16 = $this->utf82utf16($char);
|
||||
$ascii .= sprintf('\u%04s', bin2hex($utf16));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return '"'.$ascii.'"';
|
||||
|
||||
case 'array':
|
||||
/*
|
||||
* As per JSON spec if any array key is not an integer
|
||||
* we must treat the the whole array as an object. We
|
||||
* also try to catch a sparsely populated associative
|
||||
* array with numeric keys here because some JS engines
|
||||
* will create an array with empty indexes up to
|
||||
* max_index which can cause memory issues and because
|
||||
* the keys, which may be relevant, will be remapped
|
||||
* otherwise.
|
||||
*
|
||||
* As per the ECMA and JSON specification an object may
|
||||
* have any string as a property. Unfortunately due to
|
||||
* a hole in the ECMA specification if the key is a
|
||||
* ECMA reserved word or starts with a digit the
|
||||
* parameter is only accessible using ECMAScript's
|
||||
* bracket notation.
|
||||
*/
|
||||
|
||||
// treat as a JSON object
|
||||
if (is_array($var) && count($var) && (array_keys($var) !== range(0, sizeof($var) - 1))) {
|
||||
$properties = array_map(array($this, 'name_value'),
|
||||
array_keys($var),
|
||||
array_values($var));
|
||||
|
||||
foreach($properties as $property) {
|
||||
if(Services_JSON::isError($property)) {
|
||||
return $property;
|
||||
}
|
||||
}
|
||||
|
||||
return '{' . join(',', $properties) . '}';
|
||||
}
|
||||
|
||||
// treat it like a regular array
|
||||
$elements = array_map(array($this, 'encode'), $var);
|
||||
|
||||
foreach($elements as $element) {
|
||||
if(Services_JSON::isError($element)) {
|
||||
return $element;
|
||||
}
|
||||
}
|
||||
|
||||
return '[' . join(',', $elements) . ']';
|
||||
|
||||
case 'object':
|
||||
$vars = get_object_vars($var);
|
||||
|
||||
$properties = array_map(array($this, 'name_value'),
|
||||
array_keys($vars),
|
||||
array_values($vars));
|
||||
|
||||
foreach($properties as $property) {
|
||||
if(Services_JSON::isError($property)) {
|
||||
return $property;
|
||||
}
|
||||
}
|
||||
|
||||
return '{' . join(',', $properties) . '}';
|
||||
|
||||
default:
|
||||
return ($this->use & SERVICES_JSON_SUPPRESS_ERRORS)
|
||||
? 'null'
|
||||
: new Services_JSON_Error(gettype($var)." can not be encoded as JSON string");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* array-walking function for use in generating JSON-formatted name-value pairs
|
||||
*
|
||||
* @param string $name name of key to use
|
||||
* @param mixed $value reference to an array element to be encoded
|
||||
*
|
||||
* @return string JSON-formatted name-value pair, like '"name":value'
|
||||
* @access private
|
||||
*/
|
||||
function name_value($name, $value)
|
||||
{
|
||||
$encoded_value = $this->encode($value);
|
||||
|
||||
if(Services_JSON::isError($encoded_value)) {
|
||||
return $encoded_value;
|
||||
}
|
||||
|
||||
return $this->encode(strval($name)) . ':' . $encoded_value;
|
||||
}
|
||||
|
||||
/**
|
||||
* reduce a string by removing leading and trailing comments and whitespace
|
||||
*
|
||||
* @param $str string string value to strip of comments and whitespace
|
||||
*
|
||||
* @return string string value stripped of comments and whitespace
|
||||
* @access private
|
||||
*/
|
||||
function reduce_string($str)
|
||||
{
|
||||
$str = preg_replace(array(
|
||||
|
||||
// eliminate single line comments in '// ...' form
|
||||
'#^\s*//(.+)$#m',
|
||||
|
||||
// eliminate multi-line comments in '/* ... */' form, at start of string
|
||||
'#^\s*/\*(.+)\*/#Us',
|
||||
|
||||
// eliminate multi-line comments in '/* ... */' form, at end of string
|
||||
'#/\*(.+)\*/\s*$#Us'
|
||||
|
||||
), '', $str);
|
||||
|
||||
// eliminate extraneous space
|
||||
return trim($str);
|
||||
}
|
||||
|
||||
/**
|
||||
* decodes a JSON string into appropriate variable
|
||||
*
|
||||
* @param string $str JSON-formatted string
|
||||
*
|
||||
* @return mixed number, boolean, string, array, or object
|
||||
* corresponding to given JSON input string.
|
||||
* See argument 1 to Services_JSON() above for object-output behavior.
|
||||
* Note that decode() always returns strings
|
||||
* in ASCII or UTF-8 format!
|
||||
* @access public
|
||||
*/
|
||||
function decode($str)
|
||||
{
|
||||
$str = $this->reduce_string($str);
|
||||
|
||||
switch (strtolower($str)) {
|
||||
case 'true':
|
||||
return true;
|
||||
|
||||
case 'false':
|
||||
return false;
|
||||
|
||||
case 'null':
|
||||
return null;
|
||||
|
||||
default:
|
||||
$m = array();
|
||||
|
||||
if (is_numeric($str)) {
|
||||
// Lookie-loo, it's a number
|
||||
|
||||
// This would work on its own, but I'm trying to be
|
||||
// good about returning integers where appropriate:
|
||||
// return (float)$str;
|
||||
|
||||
// Return float or int, as appropriate
|
||||
return ((float)$str == (integer)$str)
|
||||
? (integer)$str
|
||||
: (float)$str;
|
||||
|
||||
} elseif (preg_match('/^("|\').*(\1)$/s', $str, $m) && $m[1] == $m[2]) {
|
||||
// STRINGS RETURNED IN UTF-8 FORMAT
|
||||
$delim = substr($str, 0, 1);
|
||||
$chrs = substr($str, 1, -1);
|
||||
$utf8 = '';
|
||||
$strlen_chrs = strlen($chrs);
|
||||
|
||||
for ($c = 0; $c < $strlen_chrs; ++$c) {
|
||||
|
||||
$substr_chrs_c_2 = substr($chrs, $c, 2);
|
||||
$ord_chrs_c = ord($chrs{$c});
|
||||
|
||||
switch (true) {
|
||||
case $substr_chrs_c_2 == '\b':
|
||||
$utf8 .= chr(0x08);
|
||||
++$c;
|
||||
break;
|
||||
case $substr_chrs_c_2 == '\t':
|
||||
$utf8 .= chr(0x09);
|
||||
++$c;
|
||||
break;
|
||||
case $substr_chrs_c_2 == '\n':
|
||||
$utf8 .= chr(0x0A);
|
||||
++$c;
|
||||
break;
|
||||
case $substr_chrs_c_2 == '\f':
|
||||
$utf8 .= chr(0x0C);
|
||||
++$c;
|
||||
break;
|
||||
case $substr_chrs_c_2 == '\r':
|
||||
$utf8 .= chr(0x0D);
|
||||
++$c;
|
||||
break;
|
||||
|
||||
case $substr_chrs_c_2 == '\\"':
|
||||
case $substr_chrs_c_2 == '\\\'':
|
||||
case $substr_chrs_c_2 == '\\\\':
|
||||
case $substr_chrs_c_2 == '\\/':
|
||||
if (($delim == '"' && $substr_chrs_c_2 != '\\\'') ||
|
||||
($delim == "'" && $substr_chrs_c_2 != '\\"')) {
|
||||
$utf8 .= $chrs{++$c};
|
||||
}
|
||||
break;
|
||||
|
||||
case preg_match('/\\\u[0-9A-F]{4}/i', substr($chrs, $c, 6)):
|
||||
// single, escaped unicode character
|
||||
$utf16 = chr(hexdec(substr($chrs, ($c + 2), 2)))
|
||||
. chr(hexdec(substr($chrs, ($c + 4), 2)));
|
||||
$utf8 .= $this->utf162utf8($utf16);
|
||||
$c += 5;
|
||||
break;
|
||||
|
||||
case ($ord_chrs_c >= 0x20) && ($ord_chrs_c <= 0x7F):
|
||||
$utf8 .= $chrs{$c};
|
||||
break;
|
||||
|
||||
case ($ord_chrs_c & 0xE0) == 0xC0:
|
||||
// characters U-00000080 - U-000007FF, mask 110XXXXX
|
||||
//see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
$utf8 .= substr($chrs, $c, 2);
|
||||
++$c;
|
||||
break;
|
||||
|
||||
case ($ord_chrs_c & 0xF0) == 0xE0:
|
||||
// characters U-00000800 - U-0000FFFF, mask 1110XXXX
|
||||
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
$utf8 .= substr($chrs, $c, 3);
|
||||
$c += 2;
|
||||
break;
|
||||
|
||||
case ($ord_chrs_c & 0xF8) == 0xF0:
|
||||
// characters U-00010000 - U-001FFFFF, mask 11110XXX
|
||||
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
$utf8 .= substr($chrs, $c, 4);
|
||||
$c += 3;
|
||||
break;
|
||||
|
||||
case ($ord_chrs_c & 0xFC) == 0xF8:
|
||||
// characters U-00200000 - U-03FFFFFF, mask 111110XX
|
||||
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
$utf8 .= substr($chrs, $c, 5);
|
||||
$c += 4;
|
||||
break;
|
||||
|
||||
case ($ord_chrs_c & 0xFE) == 0xFC:
|
||||
// characters U-04000000 - U-7FFFFFFF, mask 1111110X
|
||||
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
$utf8 .= substr($chrs, $c, 6);
|
||||
$c += 5;
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $utf8;
|
||||
|
||||
} elseif (preg_match('/^\[.*\]$/s', $str) || preg_match('/^\{.*\}$/s', $str)) {
|
||||
// array, or object notation
|
||||
|
||||
if ($str{0} == '[') {
|
||||
$stk = array(SERVICES_JSON_IN_ARR);
|
||||
$arr = array();
|
||||
} else {
|
||||
if ($this->use & SERVICES_JSON_LOOSE_TYPE) {
|
||||
$stk = array(SERVICES_JSON_IN_OBJ);
|
||||
$obj = array();
|
||||
} else {
|
||||
$stk = array(SERVICES_JSON_IN_OBJ);
|
||||
$obj = new stdClass();
|
||||
}
|
||||
}
|
||||
|
||||
array_push($stk, array('what' => SERVICES_JSON_SLICE,
|
||||
'where' => 0,
|
||||
'delim' => false));
|
||||
|
||||
$chrs = substr($str, 1, -1);
|
||||
$chrs = $this->reduce_string($chrs);
|
||||
|
||||
if ($chrs == '') {
|
||||
if (reset($stk) == SERVICES_JSON_IN_ARR) {
|
||||
return $arr;
|
||||
|
||||
} else {
|
||||
return $obj;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//print("\nparsing {$chrs}\n");
|
||||
|
||||
$strlen_chrs = strlen($chrs);
|
||||
|
||||
for ($c = 0; $c <= $strlen_chrs; ++$c) {
|
||||
|
||||
$top = end($stk);
|
||||
$substr_chrs_c_2 = substr($chrs, $c, 2);
|
||||
|
||||
if (($c == $strlen_chrs) || (($chrs{$c} == ',') && ($top['what'] == SERVICES_JSON_SLICE))) {
|
||||
// found a comma that is not inside a string, array, etc.,
|
||||
// OR we've reached the end of the character list
|
||||
$slice = substr($chrs, $top['where'], ($c - $top['where']));
|
||||
array_push($stk, array('what' => SERVICES_JSON_SLICE, 'where' => ($c + 1), 'delim' => false));
|
||||
//print("Found split at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
|
||||
|
||||
if (reset($stk) == SERVICES_JSON_IN_ARR) {
|
||||
// we are in an array, so just push an element onto the stack
|
||||
array_push($arr, $this->decode($slice));
|
||||
|
||||
} elseif (reset($stk) == SERVICES_JSON_IN_OBJ) {
|
||||
// we are in an object, so figure
|
||||
// out the property name and set an
|
||||
// element in an associative array,
|
||||
// for now
|
||||
$parts = array();
|
||||
|
||||
if (preg_match('/^\s*(["\'].*[^\\\]["\'])\s*:\s*(\S.*),?$/Uis', $slice, $parts)) {
|
||||
// "name":value pair
|
||||
$key = $this->decode($parts[1]);
|
||||
$val = $this->decode($parts[2]);
|
||||
|
||||
if ($this->use & SERVICES_JSON_LOOSE_TYPE) {
|
||||
$obj[$key] = $val;
|
||||
} else {
|
||||
$obj->$key = $val;
|
||||
}
|
||||
} elseif (preg_match('/^\s*(\w+)\s*:\s*(\S.*),?$/Uis', $slice, $parts)) {
|
||||
// name:value pair, where name is unquoted
|
||||
$key = $parts[1];
|
||||
$val = $this->decode($parts[2]);
|
||||
|
||||
if ($this->use & SERVICES_JSON_LOOSE_TYPE) {
|
||||
$obj[$key] = $val;
|
||||
} else {
|
||||
$obj->$key = $val;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} elseif ((($chrs{$c} == '"') || ($chrs{$c} == "'")) && ($top['what'] != SERVICES_JSON_IN_STR)) {
|
||||
// found a quote, and we are not inside a string
|
||||
array_push($stk, array('what' => SERVICES_JSON_IN_STR, 'where' => $c, 'delim' => $chrs{$c}));
|
||||
//print("Found start of string at {$c}\n");
|
||||
|
||||
} elseif (($chrs{$c} == $top['delim']) &&
|
||||
($top['what'] == SERVICES_JSON_IN_STR) &&
|
||||
((strlen(substr($chrs, 0, $c)) - strlen(rtrim(substr($chrs, 0, $c), '\\'))) % 2 != 1)) {
|
||||
// found a quote, we're in a string, and it's not escaped
|
||||
// we know that it's not escaped becase there is _not_ an
|
||||
// odd number of backslashes at the end of the string so far
|
||||
array_pop($stk);
|
||||
//print("Found end of string at {$c}: ".substr($chrs, $top['where'], (1 + 1 + $c - $top['where']))."\n");
|
||||
|
||||
} elseif (($chrs{$c} == '[') &&
|
||||
in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) {
|
||||
// found a left-bracket, and we are in an array, object, or slice
|
||||
array_push($stk, array('what' => SERVICES_JSON_IN_ARR, 'where' => $c, 'delim' => false));
|
||||
//print("Found start of array at {$c}\n");
|
||||
|
||||
} elseif (($chrs{$c} == ']') && ($top['what'] == SERVICES_JSON_IN_ARR)) {
|
||||
// found a right-bracket, and we're in an array
|
||||
array_pop($stk);
|
||||
//print("Found end of array at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
|
||||
|
||||
} elseif (($chrs{$c} == '{') &&
|
||||
in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) {
|
||||
// found a left-brace, and we are in an array, object, or slice
|
||||
array_push($stk, array('what' => SERVICES_JSON_IN_OBJ, 'where' => $c, 'delim' => false));
|
||||
//print("Found start of object at {$c}\n");
|
||||
|
||||
} elseif (($chrs{$c} == '}') && ($top['what'] == SERVICES_JSON_IN_OBJ)) {
|
||||
// found a right-brace, and we're in an object
|
||||
array_pop($stk);
|
||||
//print("Found end of object at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
|
||||
|
||||
} elseif (($substr_chrs_c_2 == '/*') &&
|
||||
in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) {
|
||||
// found a comment start, and we are in an array, object, or slice
|
||||
array_push($stk, array('what' => SERVICES_JSON_IN_CMT, 'where' => $c, 'delim' => false));
|
||||
$c++;
|
||||
//print("Found start of comment at {$c}\n");
|
||||
|
||||
} elseif (($substr_chrs_c_2 == '*/') && ($top['what'] == SERVICES_JSON_IN_CMT)) {
|
||||
// found a comment end, and we're in one now
|
||||
array_pop($stk);
|
||||
$c++;
|
||||
|
||||
for ($i = $top['where']; $i <= $c; ++$i)
|
||||
$chrs = substr_replace($chrs, ' ', $i, 1);
|
||||
|
||||
//print("Found end of comment at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (reset($stk) == SERVICES_JSON_IN_ARR) {
|
||||
return $arr;
|
||||
|
||||
} elseif (reset($stk) == SERVICES_JSON_IN_OBJ) {
|
||||
return $obj;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo Ultimately, this should just call PEAR::isError()
|
||||
*/
|
||||
function isError($data, $code = null)
|
||||
{
|
||||
if (class_exists('pear')) {
|
||||
return PEAR::isError($data, $code);
|
||||
} elseif (is_object($data) && (get_class($data) == 'services_json_error' ||
|
||||
is_subclass_of($data, 'services_json_error'))) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!class_exists('Services_JSON_Error')) {
|
||||
if (class_exists('PEAR_Error')) {
|
||||
class Services_JSON_Error extends PEAR_Error
|
||||
{
|
||||
function Services_JSON_Error($message = 'unknown error', $code = null,
|
||||
$mode = null, $options = null, $userinfo = null)
|
||||
{
|
||||
parent::PEAR_Error($message, $code, $mode, $options, $userinfo);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
/**
|
||||
* @todo Ultimately, this class shall be descended from PEAR_Error
|
||||
*/
|
||||
class Services_JSON_Error
|
||||
{
|
||||
function Services_JSON_Error($message = 'unknown error', $code = null,
|
||||
$mode = null, $options = null, $userinfo = null)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
536
administrator/components/com_k2/lib/akismet.class.php
Normal file
536
administrator/components/com_k2/lib/akismet.class.php
Normal file
@@ -0,0 +1,536 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: akismet.class.php 1994 2013-07-04 17:25:25Z lefteris.kavadas $
|
||||
* @package K2
|
||||
* @author JoomlaWorks http://www.joomlaworks.net
|
||||
* @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.
|
||||
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die ;
|
||||
|
||||
/**
|
||||
* Akismet anti-comment spam service
|
||||
*
|
||||
* The class in this package allows use of the {@link http://akismet.com Akismet} anti-comment spam service in any PHP5 application.
|
||||
*
|
||||
* This service performs a number of checks on submitted data and returns whether or not the data is likely to be spam.
|
||||
*
|
||||
* Please note that in order to use this class, you must have a vaild {@link http://wordpress.com/api-keys/ WordPress API key}. They are free for non/small-profit types and getting one will only take a couple of minutes.
|
||||
*
|
||||
* For commercial use, please {@link http://akismet.com/commercial/ visit the Akismet commercial licensing page}.
|
||||
*
|
||||
* Please be aware that this class is PHP5 only. Attempts to run it under PHP4 will most likely fail.
|
||||
*
|
||||
* See the Akismet class documentation page linked to below for usage information.
|
||||
*
|
||||
* @package akismet
|
||||
* @author Alex Potsides, {@link http://www.achingbrain.net http://www.achingbrain.net}
|
||||
* @version 0.5
|
||||
* @copyright Alex Potsides, {@link http://www.achingbrain.net http://www.achingbrain.net}
|
||||
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
|
||||
*/
|
||||
|
||||
/**
|
||||
* The Akismet PHP5 Class
|
||||
*
|
||||
* This class takes the functionality from the Akismet WordPress plugin written by {@link http://photomatt.net/ Matt Mullenweg} and allows it to be integrated into any PHP5 application or website.
|
||||
*
|
||||
* The original plugin is {@link http://akismet.com/download/ available on the Akismet website}.
|
||||
*
|
||||
* <code>
|
||||
* $akismet = new Akismet('http://www.example.com/blog/', 'aoeu1aoue');
|
||||
* $akismet->setCommentAuthor($name);
|
||||
* $akismet->setCommentAuthorEmail($email);
|
||||
* $akismet->setCommentAuthorURL($url);
|
||||
* $akismet->setCommentContent($comment);
|
||||
* $akismet->setPermalink('http://www.example.com/blog/alex/someurl/');
|
||||
*
|
||||
* if($akismet->isCommentSpam())
|
||||
* // store the comment but mark it as spam (in case of a mis-diagnosis)
|
||||
* else
|
||||
* // store the comment normally
|
||||
* </code>
|
||||
*
|
||||
* Optionally you may wish to check if your WordPress API key is valid as in the example below.
|
||||
*
|
||||
* <code>
|
||||
* $akismet = new Akismet('http://www.example.com/blog/', 'aoeu1aoue');
|
||||
*
|
||||
* if($akismet->isKeyValid()) {
|
||||
* // api key is okay
|
||||
* } else {
|
||||
* // api key is invalid
|
||||
* }
|
||||
* </code>
|
||||
*
|
||||
* @package akismet
|
||||
* @name Akismet
|
||||
* @version 0.5
|
||||
* @author Alex Potsides
|
||||
* @link http://www.achingbrain.net/
|
||||
*/
|
||||
class Akismet
|
||||
{
|
||||
private $version = '0.5';
|
||||
private $wordPressAPIKey;
|
||||
private $blogURL;
|
||||
private $comment;
|
||||
private $apiPort;
|
||||
private $akismetServer;
|
||||
private $akismetVersion;
|
||||
private $requestFactory;
|
||||
|
||||
// This prevents some potentially sensitive information from being sent accross the wire.
|
||||
private $ignore = array(
|
||||
'HTTP_COOKIE',
|
||||
'HTTP_X_FORWARDED_FOR',
|
||||
'HTTP_X_FORWARDED_HOST',
|
||||
'HTTP_MAX_FORWARDS',
|
||||
'HTTP_X_FORWARDED_SERVER',
|
||||
'REDIRECT_STATUS',
|
||||
'SERVER_PORT',
|
||||
'PATH',
|
||||
'DOCUMENT_ROOT',
|
||||
'SERVER_ADMIN',
|
||||
'QUERY_STRING',
|
||||
'PHP_SELF'
|
||||
);
|
||||
|
||||
/**
|
||||
* @param string $blogURL The URL of your blog.
|
||||
* @param string $wordPressAPIKey WordPress API key.
|
||||
*/
|
||||
public function __construct($blogURL, $wordPressAPIKey)
|
||||
{
|
||||
$this->blogURL = $blogURL;
|
||||
$this->wordPressAPIKey = $wordPressAPIKey;
|
||||
|
||||
// Set some default values
|
||||
$this->apiPort = 80;
|
||||
$this->akismetServer = 'rest.akismet.com';
|
||||
$this->akismetVersion = '1.1';
|
||||
$this->requestFactory = new SocketWriteReadFactory();
|
||||
|
||||
// Start to populate the comment data
|
||||
$this->comment['blog'] = $blogURL;
|
||||
|
||||
if (isset($_SERVER['HTTP_USER_AGENT']))
|
||||
{
|
||||
$this->comment['user_agent'] = $_SERVER['HTTP_USER_AGENT'];
|
||||
}
|
||||
|
||||
if (isset($_SERVER['HTTP_REFERER']))
|
||||
{
|
||||
$this->comment['referrer'] = $_SERVER['HTTP_REFERER'];
|
||||
}
|
||||
|
||||
/*
|
||||
* This is necessary if the server PHP5 is running on has been set up to run PHP4 and
|
||||
* PHP5 concurently and is actually running through a separate proxy al a these instructions:
|
||||
* http://www.schlitt.info/applications/blog/archives/83_How_to_run_PHP4_and_PHP_5_parallel.html
|
||||
* and http://wiki.coggeshall.org/37.html
|
||||
* Otherwise the user_ip appears as the IP address of the PHP4 server passing the requests to the
|
||||
* PHP5 one...
|
||||
*/
|
||||
if (isset($_SERVER['REMOTE_ADDR']) && $_SERVER['REMOTE_ADDR'] != getenv('SERVER_ADDR'))
|
||||
{
|
||||
$this->comment['user_ip'] = $_SERVER['REMOTE_ADDR'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->comment['user_ip'] = getenv('HTTP_X_FORWARDED_FOR');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes a request to the Akismet service to see if the API key passed to the constructor is valid.
|
||||
*
|
||||
* Use this method if you suspect your API key is invalid.
|
||||
*
|
||||
* @return bool True is if the key is valid, false if not.
|
||||
*/
|
||||
public function isKeyValid()
|
||||
{
|
||||
// Check to see if the key is valid
|
||||
$response = $this->sendRequest('key='.$this->wordPressAPIKey.'&blog='.$this->blogURL, $this->akismetServer, '/'.$this->akismetVersion.'/verify-key');
|
||||
return $response[1] == 'valid';
|
||||
}
|
||||
|
||||
// makes a request to the Akismet service
|
||||
private function sendRequest($request, $host, $path)
|
||||
{
|
||||
$http_request = "POST ".$path." HTTP/1.0\r\n";
|
||||
$http_request .= "Host: ".$host."\r\n";
|
||||
$http_request .= "Content-Type: application/x-www-form-urlencoded; charset=utf-8\r\n";
|
||||
$http_request .= "Content-Length: ".strlen($request)."\r\n";
|
||||
$http_request .= "User-Agent: Akismet PHP5 Class ".$this->version." | Akismet/1.11\r\n";
|
||||
$http_request .= "\r\n";
|
||||
$http_request .= $request;
|
||||
|
||||
$requestSender = $this->requestFactory->createRequestSender();
|
||||
$response = $requestSender->send($host, $this->apiPort, $http_request);
|
||||
|
||||
return explode("\r\n\r\n", $response, 2);
|
||||
}
|
||||
|
||||
// Formats the data for transmission
|
||||
private function getQueryString()
|
||||
{
|
||||
foreach ($_SERVER as $key => $value)
|
||||
{
|
||||
if (!in_array($key, $this->ignore))
|
||||
{
|
||||
if ($key == 'REMOTE_ADDR')
|
||||
{
|
||||
$this->comment[$key] = $this->comment['user_ip'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->comment[$key] = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$query_string = '';
|
||||
|
||||
foreach ($this->comment as $key => $data)
|
||||
{
|
||||
if (!is_array($data))
|
||||
{
|
||||
$query_string .= $key.'='.urlencode(stripslashes($data)).'&';
|
||||
}
|
||||
}
|
||||
|
||||
return $query_string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests for spam.
|
||||
*
|
||||
* Uses the web service provided by {@link http://www.akismet.com Akismet} to see whether or not the submitted comment is spam. Returns a boolean value.
|
||||
*
|
||||
* @return bool True if the comment is spam, false if not
|
||||
* @throws Will throw an exception if the API key passed to the constructor is invalid.
|
||||
*/
|
||||
public function isCommentSpam()
|
||||
{
|
||||
$response = $this->sendRequest($this->getQueryString(), $this->wordPressAPIKey.'.rest.akismet.com', '/'.$this->akismetVersion.'/comment-check');
|
||||
|
||||
if ($response[1] == 'invalid' && !$this->isKeyValid())
|
||||
{
|
||||
throw new exception('The Wordpress API key passed to the Akismet constructor is invalid. Please obtain a valid one from http://wordpress.com/api-keys/');
|
||||
}
|
||||
|
||||
return ($response[1] == 'true');
|
||||
}
|
||||
|
||||
/**
|
||||
* Submit spam that is incorrectly tagged as ham.
|
||||
*
|
||||
* Using this function will make you a good citizen as it helps Akismet to learn from its mistakes. This will improve the service for everybody.
|
||||
*/
|
||||
public function submitSpam()
|
||||
{
|
||||
$this->sendRequest($this->getQueryString(), $this->wordPressAPIKey.'.'.$this->akismetServer, '/'.$this->akismetVersion.'/submit-spam');
|
||||
}
|
||||
|
||||
/**
|
||||
* Submit ham that is incorrectly tagged as spam.
|
||||
*
|
||||
* Using this function will make you a good citizen as it helps Akismet to learn from its mistakes. This will improve the service for everybody.
|
||||
*/
|
||||
public function submitHam()
|
||||
{
|
||||
$this->sendRequest($this->getQueryString(), $this->wordPressAPIKey.'.'.$this->akismetServer, '/'.$this->akismetVersion.'/submit-ham');
|
||||
}
|
||||
|
||||
/**
|
||||
* To override the user IP address when submitting spam/ham later on
|
||||
*
|
||||
* @param string $userip An IP address. Optional.
|
||||
*/
|
||||
public function setUserIP($userip)
|
||||
{
|
||||
$this->comment['user_ip'] = $userip;
|
||||
}
|
||||
|
||||
/**
|
||||
* To override the referring page when submitting spam/ham later on
|
||||
*
|
||||
* @param string $referrer The referring page. Optional.
|
||||
*/
|
||||
public function setReferrer($referrer)
|
||||
{
|
||||
$this->comment['referrer'] = $referrer;
|
||||
}
|
||||
|
||||
/**
|
||||
* A permanent URL referencing the blog post the comment was submitted to.
|
||||
*
|
||||
* @param string $permalink The URL. Optional.
|
||||
*/
|
||||
public function setPermalink($permalink)
|
||||
{
|
||||
$this->comment['permalink'] = $permalink;
|
||||
}
|
||||
|
||||
/**
|
||||
* The type of comment being submitted.
|
||||
*
|
||||
* May be blank, comment, trackback, pingback, or a made up value like "registration" or "wiki".
|
||||
*/
|
||||
public function setCommentType($commentType)
|
||||
{
|
||||
$this->comment['comment_type'] = $commentType;
|
||||
}
|
||||
|
||||
/**
|
||||
* The name that the author submitted with the comment.
|
||||
*/
|
||||
public function setCommentAuthor($commentAuthor)
|
||||
{
|
||||
$this->comment['comment_author'] = $commentAuthor;
|
||||
}
|
||||
|
||||
/**
|
||||
* The email address that the author submitted with the comment.
|
||||
*
|
||||
* The address is assumed to be valid.
|
||||
*/
|
||||
public function setCommentAuthorEmail($authorEmail)
|
||||
{
|
||||
$this->comment['comment_author_email'] = $authorEmail;
|
||||
}
|
||||
|
||||
/**
|
||||
* The URL that the author submitted with the comment.
|
||||
*/
|
||||
public function setCommentAuthorURL($authorURL)
|
||||
{
|
||||
$this->comment['comment_author_url'] = $authorURL;
|
||||
}
|
||||
|
||||
/**
|
||||
* The comment's body text.
|
||||
*/
|
||||
public function setCommentContent($commentBody)
|
||||
{
|
||||
$this->comment['comment_content'] = $commentBody;
|
||||
}
|
||||
|
||||
/**
|
||||
* Lets you override the user agent used to submit the comment.
|
||||
* you may wish to do this when submitting ham/spam.
|
||||
* Defaults to $_SERVER['HTTP_USER_AGENT']
|
||||
*/
|
||||
public function setCommentUserAgent($userAgent)
|
||||
{
|
||||
$this->comment['user_agent'] = $userAgent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Defaults to 80
|
||||
*/
|
||||
public function setAPIPort($apiPort)
|
||||
{
|
||||
$this->apiPort = $apiPort;
|
||||
}
|
||||
|
||||
/**
|
||||
* Defaults to rest.akismet.com
|
||||
*/
|
||||
public function setAkismetServer($akismetServer)
|
||||
{
|
||||
$this->akismetServer = $akismetServer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Defaults to '1.1'
|
||||
*
|
||||
* @param string $akismetVersion
|
||||
*/
|
||||
public function setAkismetVersion($akismetVersion)
|
||||
{
|
||||
$this->akismetVersion = $akismetVersion;
|
||||
}
|
||||
|
||||
/**
|
||||
* Used by unit tests to mock transport layer
|
||||
*
|
||||
* @param AkismetRequestFactory $requestFactory
|
||||
*/
|
||||
public function setRequestFactory($requestFactory)
|
||||
{
|
||||
$this->requestFactory = $requestFactory;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Used internally by Akismet
|
||||
*
|
||||
* This class is used by Akismet to do the actual sending and receiving of data. It opens a connection to a remote host, sends some data and the reads the response and makes it available to the calling program.
|
||||
*
|
||||
* The code that makes up this class originates in the Akismet WordPress plugin, which is {@link http://akismet.com/download/ available on the Akismet website}.
|
||||
*
|
||||
* N.B. It is not necessary to call this class directly to use the Akismet class.
|
||||
*
|
||||
* @package akismet
|
||||
* @name SocketWriteRead
|
||||
* @version 0.5
|
||||
* @author Alex Potsides
|
||||
* @link http://www.achingbrain.net/
|
||||
*/
|
||||
class SocketWriteRead implements AkismetRequestSender
|
||||
{
|
||||
private $response;
|
||||
private $errorNumber;
|
||||
private $errorString;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->errorNumber = 0;
|
||||
$this->errorString = '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends the data to the remote host.
|
||||
*
|
||||
* @param string $host The host to send/receive data.
|
||||
* @param int $port The port on the remote host.
|
||||
* @param string $request The data to send.
|
||||
* @param int $responseLength The amount of data to read. Defaults to 1160 bytes.
|
||||
* @throws An exception is thrown if a connection cannot be made to the remote host.
|
||||
* @returns The server response
|
||||
*/
|
||||
public function send($host, $port, $request, $responseLength = 1160)
|
||||
{
|
||||
$response = '';
|
||||
|
||||
$fs = fsockopen($host, $port, $this->errorNumber, $this->errorString, 3);
|
||||
|
||||
if ($this->errorNumber != 0)
|
||||
{
|
||||
throw new Exception('Error connecting to host: '.$host.' Error number: '.$this->errorNumber.' Error message: '.$this->errorString);
|
||||
}
|
||||
|
||||
if ($fs !== false)
|
||||
{
|
||||
@fwrite($fs, $request);
|
||||
|
||||
while (!feof($fs))
|
||||
{
|
||||
$response .= fgets($fs, $responseLength);
|
||||
}
|
||||
|
||||
fclose($fs);
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the server response text
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getResponse()
|
||||
{
|
||||
return $this->response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the error number
|
||||
*
|
||||
* If there was no error, 0 will be returned.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getErrorNumner()
|
||||
{
|
||||
return $this->errorNumber;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the error string
|
||||
*
|
||||
* If there was no error, an empty string will be returned.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getErrorString()
|
||||
{
|
||||
return $this->errorString;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Used internally by the Akismet class and to mock the Akismet anti spam service in
|
||||
* the unit tests.
|
||||
*
|
||||
* N.B. It is not necessary to call this class directly to use the Akismet class.
|
||||
*
|
||||
* @package akismet
|
||||
* @name SocketWriteReadFactory
|
||||
* @version 0.5
|
||||
* @author Alex Potsides
|
||||
* @link http://www.achingbrain.net/
|
||||
*/
|
||||
class SocketWriteReadFactory implements AkismetRequestFactory
|
||||
{
|
||||
|
||||
public function createRequestSender()
|
||||
{
|
||||
return new SocketWriteRead();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Used internally by the Akismet class and to mock the Akismet anti spam service in
|
||||
* the unit tests.
|
||||
*
|
||||
* N.B. It is not necessary to implement this class to use the Akismet class.
|
||||
*
|
||||
* @package akismet
|
||||
* @name AkismetRequestSender
|
||||
* @version 0.5
|
||||
* @author Alex Potsides
|
||||
* @link http://www.achingbrain.net/
|
||||
*/
|
||||
interface AkismetRequestSender
|
||||
{
|
||||
|
||||
/**
|
||||
* Sends the data to the remote host.
|
||||
*
|
||||
* @param string $host The host to send/receive data.
|
||||
* @param int $port The port on the remote host.
|
||||
* @param string $request The data to send.
|
||||
* @param int $responseLength The amount of data to read. Defaults to 1160 bytes.
|
||||
* @throws An exception is thrown if a connection cannot be made to the remote host.
|
||||
* @returns The server response
|
||||
*/
|
||||
public function send($host, $port, $request, $responseLength = 1160);
|
||||
}
|
||||
|
||||
/**
|
||||
* Used internally by the Akismet class and to mock the Akismet anti spam service in
|
||||
* the unit tests.
|
||||
*
|
||||
* N.B. It is not necessary to implement this class to use the Akismet class.
|
||||
*
|
||||
* @package akismet
|
||||
* @name AkismetRequestFactory
|
||||
* @version 0.5
|
||||
* @author Alex Potsides
|
||||
* @link http://www.achingbrain.net/
|
||||
*/
|
||||
interface AkismetRequestFactory
|
||||
{
|
||||
|
||||
public function createRequestSender();
|
||||
}
|
||||
5308
administrator/components/com_k2/lib/class.upload.php
Normal file
5308
administrator/components/com_k2/lib/class.upload.php
Normal file
File diff suppressed because it is too large
Load Diff
1113
administrator/components/com_k2/lib/elfinder/elFinder.class.php
Normal file
1113
administrator/components/com_k2/lib/elfinder/elFinder.class.php
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,143 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: elFinderConnector.class.php 1812 2013-01-14 18:45:06Z lefteris.kavadas $
|
||||
* @package K2
|
||||
* @author JoomlaWorks http://www.joomlaworks.net
|
||||
* @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.
|
||||
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* Default elFinder connector
|
||||
*
|
||||
* @author Dmitry (dio) Levashov
|
||||
**/
|
||||
class elFinderConnector {
|
||||
/**
|
||||
* elFinder instance
|
||||
*
|
||||
* @var elFinder
|
||||
**/
|
||||
protected $elFinder;
|
||||
|
||||
/**
|
||||
* Options
|
||||
*
|
||||
* @var aray
|
||||
**/
|
||||
protected $options = array();
|
||||
|
||||
/**
|
||||
* undocumented class variable
|
||||
*
|
||||
* @var string
|
||||
**/
|
||||
protected $header = 'Content-Type: application/json';
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @return void
|
||||
* @author Dmitry (dio) Levashov
|
||||
**/
|
||||
public function __construct($elFinder, $debug=false) {
|
||||
|
||||
$this->elFinder = $elFinder;
|
||||
if ($debug) {
|
||||
$this->header = 'Content-Type: text/html; charset=utf-8';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute elFinder command and output result
|
||||
*
|
||||
* @return void
|
||||
* @author Dmitry (dio) Levashov
|
||||
**/
|
||||
public function run() {
|
||||
$isPost = $_SERVER["REQUEST_METHOD"] == 'POST';
|
||||
$src = $_SERVER["REQUEST_METHOD"] == 'POST' ? $_POST : $_GET;
|
||||
$cmd = isset($src['cmd']) ? $src['cmd'] : '';
|
||||
$args = array();
|
||||
|
||||
if (!function_exists('json_encode')) {
|
||||
$error = $this->elFinder->error(elFinder::ERROR_CONF, elFinder::ERROR_CONF_NO_JSON);
|
||||
$this->output(array('error' => '{"error":["'.implode('","', $error).'"]}', 'raw' => true));
|
||||
}
|
||||
|
||||
if (!$this->elFinder->loaded()) {
|
||||
$this->output(array('error' => $this->elFinder->error(elFinder::ERROR_CONF, elFinder::ERROR_CONF_NO_VOL), 'debug' => $this->elFinder->mountErrors));
|
||||
}
|
||||
|
||||
// telepat_mode: on
|
||||
if (!$cmd && $isPost) {
|
||||
$this->output(array('error' => $this->elFinder->error(elFinder::ERROR_UPLOAD, elFinder::ERROR_UPLOAD_TOTAL_SIZE), 'header' => 'Content-Type: text/html'));
|
||||
}
|
||||
// telepat_mode: off
|
||||
|
||||
if (!$this->elFinder->commandExists($cmd)) {
|
||||
$this->output(array('error' => $this->elFinder->error(elFinder::ERROR_UNKNOWN_CMD)));
|
||||
}
|
||||
|
||||
// collect required arguments to exec command
|
||||
foreach ($this->elFinder->commandArgsList($cmd) as $name => $req) {
|
||||
$arg = $name == 'FILES'
|
||||
? $_FILES
|
||||
: (isset($src[$name]) ? $src[$name] : '');
|
||||
|
||||
if (!is_array($arg)) {
|
||||
$arg = trim($arg);
|
||||
}
|
||||
if ($req && (!isset($arg) || $arg === '')) {
|
||||
$this->output(array('error' => $this->elFinder->error(elFinder::ERROR_INV_PARAMS, $cmd)));
|
||||
}
|
||||
$args[$name] = $arg;
|
||||
}
|
||||
|
||||
$args['debug'] = isset($src['debug']) ? !!$src['debug'] : false;
|
||||
|
||||
$this->output($this->elFinder->exec($cmd, $args));
|
||||
}
|
||||
|
||||
/**
|
||||
* Output json
|
||||
*
|
||||
* @param array data to output
|
||||
* @return void
|
||||
* @author Dmitry (dio) Levashov
|
||||
**/
|
||||
protected function output(array $data) {
|
||||
$header = isset($data['header']) ? $data['header'] : $this->header;
|
||||
unset($data['header']);
|
||||
if ($header) {
|
||||
if (is_array($header)) {
|
||||
foreach ($header as $h) {
|
||||
header($h);
|
||||
}
|
||||
} else {
|
||||
header($header);
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($data['pointer'])) {
|
||||
rewind($data['pointer']);
|
||||
fpassthru($data['pointer']);
|
||||
if (!empty($data['volume'])) {
|
||||
$data['volume']->close($data['pointer'], $data['info']['hash']);
|
||||
}
|
||||
exit();
|
||||
} else {
|
||||
if (!empty($data['raw']) && !empty($data['error'])) {
|
||||
exit($data['error']);
|
||||
} else {
|
||||
exit(json_encode($data));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}// END class
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,845 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: elFinderVolumeLocalFileSystem.class.php 1989 2013-07-04 13:52:28Z lefteris.kavadas $
|
||||
* @package K2
|
||||
* @author JoomlaWorks http://www.joomlaworks.net
|
||||
* @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.
|
||||
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* elFinder driver for local filesystem.
|
||||
*
|
||||
* @author Dmitry (dio) Levashov
|
||||
* @author Troex Nevelin
|
||||
**/
|
||||
class elFinderVolumeLocalFileSystem extends elFinderVolumeDriver {
|
||||
|
||||
/**
|
||||
* Driver id
|
||||
* Must be started from letter and contains [a-z0-9]
|
||||
* Used as part of volume id
|
||||
*
|
||||
* @var string
|
||||
**/
|
||||
protected $driverId = 'l';
|
||||
|
||||
/**
|
||||
* Required to count total archive files size
|
||||
*
|
||||
* @var int
|
||||
**/
|
||||
protected $archiveSize = 0;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* Extend options with required fields
|
||||
*
|
||||
* @return void
|
||||
* @author Dmitry (dio) Levashov
|
||||
**/
|
||||
public function __construct() {
|
||||
$this->options['alias'] = ''; // alias to replace root dir name
|
||||
$this->options['dirMode'] = 0755; // new dirs mode
|
||||
$this->options['fileMode'] = 0644; // new files mode
|
||||
$this->options['quarantine'] = '.quarantine'; // quarantine folder name - required to check archive (must be hidden)
|
||||
$this->options['maxArcFilesSize'] = 0; // max allowed archive files size (0 - no limit)
|
||||
}
|
||||
|
||||
/*********************************************************************/
|
||||
/* INIT AND CONFIGURE */
|
||||
/*********************************************************************/
|
||||
|
||||
/**
|
||||
* Configure after successfull mount.
|
||||
*
|
||||
* @return void
|
||||
* @author Dmitry (dio) Levashov
|
||||
**/
|
||||
protected function configure() {
|
||||
$this->aroot = realpath($this->root);
|
||||
$root = $this->stat($this->root);
|
||||
|
||||
if ($this->options['quarantine']) {
|
||||
$this->attributes[] = array(
|
||||
'pattern' => '~^'.preg_quote(DIRECTORY_SEPARATOR.$this->options['quarantine']).'$~',
|
||||
'read' => false,
|
||||
'write' => false,
|
||||
'locked' => true,
|
||||
'hidden' => true
|
||||
);
|
||||
}
|
||||
|
||||
// chek thumbnails path
|
||||
if ($this->options['tmbPath']) {
|
||||
$this->options['tmbPath'] = strpos($this->options['tmbPath'], DIRECTORY_SEPARATOR) === false
|
||||
// tmb path set as dirname under root dir
|
||||
? $this->root.DIRECTORY_SEPARATOR.$this->options['tmbPath']
|
||||
// tmb path as full path
|
||||
: $this->_normpath($this->options['tmbPath']);
|
||||
}
|
||||
|
||||
parent::configure();
|
||||
|
||||
// if no thumbnails url - try detect it
|
||||
if ($root['read'] && !$this->tmbURL && $this->URL) {
|
||||
if (strpos($this->tmbPath, $this->root) === 0) {
|
||||
$this->tmbURL = $this->URL.str_replace(DIRECTORY_SEPARATOR, '/', substr($this->tmbPath, strlen($this->root)+1));
|
||||
if (preg_match("|[^/?&=]$|", $this->tmbURL)) {
|
||||
$this->tmbURL .= '/';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// check quarantine dir
|
||||
if (!empty($this->options['quarantine'])) {
|
||||
$this->quarantine = $this->root.DIRECTORY_SEPARATOR.$this->options['quarantine'];
|
||||
if ((!is_dir($this->quarantine) && !$this->_mkdir($this->root, $this->options['quarantine'])) || !is_writable($this->quarantine)) {
|
||||
$this->archivers['extract'] = array();
|
||||
$this->disabled[] = 'extract';
|
||||
}
|
||||
} else {
|
||||
$this->archivers['extract'] = array();
|
||||
$this->disabled[] = 'extract';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*********************************************************************/
|
||||
/* FS API */
|
||||
/*********************************************************************/
|
||||
|
||||
/*********************** paths/urls *************************/
|
||||
|
||||
/**
|
||||
* Return parent directory path
|
||||
*
|
||||
* @param string $path file path
|
||||
* @return string
|
||||
* @author Dmitry (dio) Levashov
|
||||
**/
|
||||
protected function _dirname($path) {
|
||||
return dirname($path);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return file name
|
||||
*
|
||||
* @param string $path file path
|
||||
* @return string
|
||||
* @author Dmitry (dio) Levashov
|
||||
**/
|
||||
protected function _basename($path) {
|
||||
return basename($path);
|
||||
}
|
||||
|
||||
/**
|
||||
* Join dir name and file name and retur full path
|
||||
*
|
||||
* @param string $dir
|
||||
* @param string $name
|
||||
* @return string
|
||||
* @author Dmitry (dio) Levashov
|
||||
**/
|
||||
protected function _joinPath($dir, $name) {
|
||||
return $dir.DIRECTORY_SEPARATOR.$name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return normalized path, this works the same as os.path.normpath() in Python
|
||||
*
|
||||
* @param string $path path
|
||||
* @return string
|
||||
* @author Troex Nevelin
|
||||
**/
|
||||
protected function _normpath($path) {
|
||||
if (empty($path)) {
|
||||
return '.';
|
||||
}
|
||||
|
||||
if (strpos($path, '/') === 0) {
|
||||
$initial_slashes = true;
|
||||
} else {
|
||||
$initial_slashes = false;
|
||||
}
|
||||
|
||||
if (($initial_slashes)
|
||||
&& (strpos($path, '//') === 0)
|
||||
&& (strpos($path, '///') === false)) {
|
||||
$initial_slashes = 2;
|
||||
}
|
||||
|
||||
$initial_slashes = (int) $initial_slashes;
|
||||
|
||||
$comps = explode('/', $path);
|
||||
$new_comps = array();
|
||||
foreach ($comps as $comp) {
|
||||
if (in_array($comp, array('', '.'))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (($comp != '..')
|
||||
|| (!$initial_slashes && !$new_comps)
|
||||
|| ($new_comps && (end($new_comps) == '..'))) {
|
||||
array_push($new_comps, $comp);
|
||||
} elseif ($new_comps) {
|
||||
array_pop($new_comps);
|
||||
}
|
||||
}
|
||||
$comps = $new_comps;
|
||||
$path = implode('/', $comps);
|
||||
if ($initial_slashes) {
|
||||
$path = str_repeat('/', $initial_slashes) . $path;
|
||||
}
|
||||
|
||||
return $path ? $path : '.';
|
||||
}
|
||||
|
||||
/**
|
||||
* Return file path related to root dir
|
||||
*
|
||||
* @param string $path file path
|
||||
* @return string
|
||||
* @author Dmitry (dio) Levashov
|
||||
**/
|
||||
protected function _relpath($path) {
|
||||
return $path == $this->root ? '' : substr($path, strlen($this->root)+1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert path related to root dir into real path
|
||||
*
|
||||
* @param string $path file path
|
||||
* @return string
|
||||
* @author Dmitry (dio) Levashov
|
||||
**/
|
||||
protected function _abspath($path) {
|
||||
return $path == DIRECTORY_SEPARATOR ? $this->root : $this->root.DIRECTORY_SEPARATOR.$path;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return fake path started from root dir
|
||||
*
|
||||
* @param string $path file path
|
||||
* @return string
|
||||
* @author Dmitry (dio) Levashov
|
||||
**/
|
||||
protected function _path($path) {
|
||||
return $this->rootName.($path == $this->root ? '' : $this->separator.$this->_relpath($path));
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if $path is children of $parent
|
||||
*
|
||||
* @param string $path path to check
|
||||
* @param string $parent parent path
|
||||
* @return bool
|
||||
* @author Dmitry (dio) Levashov
|
||||
**/
|
||||
protected function _inpath($path, $parent) {
|
||||
return $path == $parent || strpos($path, $parent.DIRECTORY_SEPARATOR) === 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/***************** file stat ********************/
|
||||
|
||||
/**
|
||||
* Return stat for given path.
|
||||
* Stat contains following fields:
|
||||
* - (int) size file size in b. required
|
||||
* - (int) ts file modification time in unix time. required
|
||||
* - (string) mime mimetype. required for folders, others - optionally
|
||||
* - (bool) read read permissions. required
|
||||
* - (bool) write write permissions. required
|
||||
* - (bool) locked is object locked. optionally
|
||||
* - (bool) hidden is object hidden. optionally
|
||||
* - (string) alias for symlinks - link target path relative to root path. optionally
|
||||
* - (string) target for symlinks - link target path. optionally
|
||||
*
|
||||
* If file does not exists - returns empty array or false.
|
||||
*
|
||||
* @param string $path file path
|
||||
* @return array|false
|
||||
* @author Dmitry (dio) Levashov
|
||||
**/
|
||||
protected function _stat($path) {
|
||||
$stat = array();
|
||||
|
||||
if (!file_exists($path)) {
|
||||
return $stat;
|
||||
}
|
||||
|
||||
if ($path != $this->root && is_link($path)) {
|
||||
if (($target = $this->readlink($path)) == false
|
||||
|| $target == $path) {
|
||||
$stat['mime'] = 'symlink-broken';
|
||||
$stat['read'] = false;
|
||||
$stat['write'] = false;
|
||||
$stat['size'] = 0;
|
||||
return $stat;
|
||||
}
|
||||
$stat['alias'] = $this->_path($target);
|
||||
$stat['target'] = $target;
|
||||
$path = $target;
|
||||
$lstat = lstat($path);
|
||||
$size = $lstat['size'];
|
||||
} else {
|
||||
$size = @filesize($path);
|
||||
}
|
||||
|
||||
$dir = is_dir($path);
|
||||
|
||||
$stat['mime'] = $dir ? 'directory' : $this->mimetype($path);
|
||||
$stat['ts'] = filemtime($path);
|
||||
$stat['read'] = is_readable($path);
|
||||
$stat['write'] = is_writable($path);
|
||||
if ($stat['read']) {
|
||||
$stat['size'] = $dir ? 0 : $size;
|
||||
}
|
||||
|
||||
return $stat;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return true if path is dir and has at least one childs directory
|
||||
*
|
||||
* @param string $path dir path
|
||||
* @return bool
|
||||
* @author Dmitry (dio) Levashov
|
||||
**/
|
||||
protected function _subdirs($path) {
|
||||
|
||||
if (($dir = dir($path))) {
|
||||
$dir = dir($path);
|
||||
while (($entry = $dir->read()) !== false) {
|
||||
$p = $dir->path.DIRECTORY_SEPARATOR.$entry;
|
||||
if ($entry != '.' && $entry != '..' && is_dir($p) && !$this->attr($p, 'hidden')) {
|
||||
$dir->close();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
$dir->close();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return object width and height
|
||||
* Ususaly used for images, but can be realize for video etc...
|
||||
*
|
||||
* @param string $path file path
|
||||
* @param string $mime file mime type
|
||||
* @return string
|
||||
* @author Dmitry (dio) Levashov
|
||||
**/
|
||||
protected function _dimensions($path, $mime) {
|
||||
clearstatcache();
|
||||
return strpos($mime, 'image') === 0 && ($s = @getimagesize($path)) !== false
|
||||
? $s[0].'x'.$s[1]
|
||||
: false;
|
||||
}
|
||||
/******************** file/dir content *********************/
|
||||
|
||||
/**
|
||||
* Return symlink target file
|
||||
*
|
||||
* @param string $path link path
|
||||
* @return string
|
||||
* @author Dmitry (dio) Levashov
|
||||
**/
|
||||
protected function readlink($path) {
|
||||
if (!($target = @readlink($path))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (substr($target, 0, 1) != DIRECTORY_SEPARATOR) {
|
||||
$target = dirname($path).DIRECTORY_SEPARATOR.$target;
|
||||
}
|
||||
|
||||
$atarget = realpath($target);
|
||||
|
||||
if (!$atarget) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$root = $this->root;
|
||||
$aroot = $this->aroot;
|
||||
|
||||
if ($this->_inpath($atarget, $this->aroot)) {
|
||||
return $this->_normpath($this->root.DIRECTORY_SEPARATOR.substr($atarget, strlen($this->aroot)+1));
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return files list in directory.
|
||||
*
|
||||
* @param string $path dir path
|
||||
* @return array
|
||||
* @author Dmitry (dio) Levashov
|
||||
**/
|
||||
protected function _scandir($path) {
|
||||
$files = array();
|
||||
|
||||
foreach (scandir($path) as $name) {
|
||||
if ($name != '.' && $name != '..') {
|
||||
$files[] = $path.DIRECTORY_SEPARATOR.$name;
|
||||
}
|
||||
}
|
||||
return $files;
|
||||
}
|
||||
|
||||
/**
|
||||
* Open file and return file pointer
|
||||
*
|
||||
* @param string $path file path
|
||||
* @param bool $write open file for writing
|
||||
* @return resource|false
|
||||
* @author Dmitry (dio) Levashov
|
||||
**/
|
||||
protected function _fopen($path, $mode='rb') {
|
||||
return @fopen($path, 'r');
|
||||
}
|
||||
|
||||
/**
|
||||
* Close opened file
|
||||
*
|
||||
* @param resource $fp file pointer
|
||||
* @return bool
|
||||
* @author Dmitry (dio) Levashov
|
||||
**/
|
||||
protected function _fclose($fp, $path='') {
|
||||
return @fclose($fp);
|
||||
}
|
||||
|
||||
/******************** file/dir manipulations *************************/
|
||||
|
||||
/**
|
||||
* Create dir and return created dir path or false on failed
|
||||
*
|
||||
* @param string $path parent dir path
|
||||
* @param string $name new directory name
|
||||
* @return string|bool
|
||||
* @author Dmitry (dio) Levashov
|
||||
**/
|
||||
protected function _mkdir($path, $name) {
|
||||
$path = $path.DIRECTORY_SEPARATOR.$name;
|
||||
|
||||
if (@mkdir($path)) {
|
||||
@chmod($path, $this->options['dirMode']);
|
||||
return $path;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create file and return it's path or false on failed
|
||||
*
|
||||
* @param string $path parent dir path
|
||||
* @param string $name new file name
|
||||
* @return string|bool
|
||||
* @author Dmitry (dio) Levashov
|
||||
**/
|
||||
protected function _mkfile($path, $name) {
|
||||
$path = $path.DIRECTORY_SEPARATOR.$name;
|
||||
|
||||
if (($fp = @fopen($path, 'w'))) {
|
||||
@fclose($fp);
|
||||
@chmod($path, $this->options['fileMode']);
|
||||
return $path;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create symlink
|
||||
*
|
||||
* @param string $source file to link to
|
||||
* @param string $targetDir folder to create link in
|
||||
* @param string $name symlink name
|
||||
* @return bool
|
||||
* @author Dmitry (dio) Levashov
|
||||
**/
|
||||
protected function _symlink($source, $targetDir, $name) {
|
||||
return @symlink($source, $targetDir.DIRECTORY_SEPARATOR.$name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy file into another file
|
||||
*
|
||||
* @param string $source source file path
|
||||
* @param string $targetDir target directory path
|
||||
* @param string $name new file name
|
||||
* @return bool
|
||||
* @author Dmitry (dio) Levashov
|
||||
**/
|
||||
protected function _copy($source, $targetDir, $name) {
|
||||
return copy($source, $targetDir.DIRECTORY_SEPARATOR.$name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Move file into another parent dir.
|
||||
* Return new file path or false.
|
||||
*
|
||||
* @param string $source source file path
|
||||
* @param string $target target dir path
|
||||
* @param string $name file name
|
||||
* @return string|bool
|
||||
* @author Dmitry (dio) Levashov
|
||||
**/
|
||||
protected function _move($source, $targetDir, $name) {
|
||||
$target = $targetDir.DIRECTORY_SEPARATOR.$name;
|
||||
return @rename($source, $target) ? $target : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove file
|
||||
*
|
||||
* @param string $path file path
|
||||
* @return bool
|
||||
* @author Dmitry (dio) Levashov
|
||||
**/
|
||||
protected function _unlink($path) {
|
||||
return @unlink($path);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove dir
|
||||
*
|
||||
* @param string $path dir path
|
||||
* @return bool
|
||||
* @author Dmitry (dio) Levashov
|
||||
**/
|
||||
protected function _rmdir($path) {
|
||||
return @rmdir($path);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create new file and write into it from file pointer.
|
||||
* Return new file path or false on error.
|
||||
*
|
||||
* @param resource $fp file pointer
|
||||
* @param string $dir target dir path
|
||||
* @param string $name file name
|
||||
* @return bool|string
|
||||
* @author Dmitry (dio) Levashov
|
||||
**/
|
||||
protected function _save($fp, $dir, $name, $mime, $w, $h) {
|
||||
$path = $dir.DIRECTORY_SEPARATOR.$name;
|
||||
|
||||
if (!($target = @fopen($path, 'wb'))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
while (!feof($fp)) {
|
||||
fwrite($target, fread($fp, 8192));
|
||||
}
|
||||
fclose($target);
|
||||
@chmod($path, $this->options['fileMode']);
|
||||
clearstatcache();
|
||||
return $path;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get file contents
|
||||
*
|
||||
* @param string $path file path
|
||||
* @return string|false
|
||||
* @author Dmitry (dio) Levashov
|
||||
**/
|
||||
protected function _getContents($path) {
|
||||
return file_get_contents($path);
|
||||
}
|
||||
|
||||
/**
|
||||
* Write a string to a file
|
||||
*
|
||||
* @param string $path file path
|
||||
* @param string $content new file content
|
||||
* @return bool
|
||||
* @author Dmitry (dio) Levashov
|
||||
**/
|
||||
protected function _filePutContents($path, $content) {
|
||||
if (@file_put_contents($path, $content, LOCK_EX) !== false) {
|
||||
clearstatcache();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Detect available archivers
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
protected function _checkArchivers() {
|
||||
if (!function_exists('exec')) {
|
||||
$this->options['archivers'] = $this->options['archive'] = array();
|
||||
return;
|
||||
}
|
||||
$arcs = array(
|
||||
'create' => array(),
|
||||
'extract' => array()
|
||||
);
|
||||
|
||||
//exec('tar --version', $o, $ctar);
|
||||
$this->procExec('tar --version', $o, $ctar);
|
||||
|
||||
if ($ctar == 0) {
|
||||
$arcs['create']['application/x-tar'] = array('cmd' => 'tar', 'argc' => '-cf', 'ext' => 'tar');
|
||||
$arcs['extract']['application/x-tar'] = array('cmd' => 'tar', 'argc' => '-xf', 'ext' => 'tar');
|
||||
//$test = exec('gzip --version', $o, $c);
|
||||
unset($o);
|
||||
$test = $this->procExec('gzip --version', $o, $c);
|
||||
|
||||
if ($c == 0) {
|
||||
$arcs['create']['application/x-gzip'] = array('cmd' => 'tar', 'argc' => '-czf', 'ext' => 'tgz');
|
||||
$arcs['extract']['application/x-gzip'] = array('cmd' => 'tar', 'argc' => '-xzf', 'ext' => 'tgz');
|
||||
}
|
||||
unset($o);
|
||||
//$test = exec('bzip2 --version', $o, $c);
|
||||
$test = $this->procExec('bzip2 --version', $o, $c);
|
||||
if ($c == 0) {
|
||||
$arcs['create']['application/x-bzip2'] = array('cmd' => 'tar', 'argc' => '-cjf', 'ext' => 'tbz');
|
||||
$arcs['extract']['application/x-bzip2'] = array('cmd' => 'tar', 'argc' => '-xjf', 'ext' => 'tbz');
|
||||
}
|
||||
}
|
||||
unset($o);
|
||||
//exec('zip --version', $o, $c);
|
||||
$this->procExec('zip -v', $o, $c);
|
||||
if ($c == 0) {
|
||||
$arcs['create']['application/zip'] = array('cmd' => 'zip', 'argc' => '-r9', 'ext' => 'zip');
|
||||
}
|
||||
unset($o);
|
||||
$this->procExec('unzip --help', $o, $c);
|
||||
if ($c == 0) {
|
||||
$arcs['extract']['application/zip'] = array('cmd' => 'unzip', 'argc' => '', 'ext' => 'zip');
|
||||
}
|
||||
unset($o);
|
||||
//exec('rar --version', $o, $c);
|
||||
$this->procExec('rar --version', $o, $c);
|
||||
if ($c == 0 || $c == 7) {
|
||||
$arcs['create']['application/x-rar'] = array('cmd' => 'rar', 'argc' => 'a -inul', 'ext' => 'rar');
|
||||
$arcs['extract']['application/x-rar'] = array('cmd' => 'rar', 'argc' => 'x -y', 'ext' => 'rar');
|
||||
} else {
|
||||
unset($o);
|
||||
//$test = exec('unrar', $o, $c);
|
||||
$test = $this->procExec('unrar', $o, $c);
|
||||
if ($c==0 || $c == 7) {
|
||||
$arcs['extract']['application/x-rar'] = array('cmd' => 'unrar', 'argc' => 'x -y', 'ext' => 'rar');
|
||||
}
|
||||
}
|
||||
unset($o);
|
||||
//exec('7za --help', $o, $c);
|
||||
$this->procExec('7za --help', $o, $c);
|
||||
if ($c == 0) {
|
||||
$arcs['create']['application/x-7z-compressed'] = array('cmd' => '7za', 'argc' => 'a', 'ext' => '7z');
|
||||
$arcs['extract']['application/x-7z-compressed'] = array('cmd' => '7za', 'argc' => 'e -y', 'ext' => '7z');
|
||||
|
||||
if (empty($arcs['create']['application/x-gzip'])) {
|
||||
$arcs['create']['application/x-gzip'] = array('cmd' => '7za', 'argc' => 'a -tgzip', 'ext' => 'tar.gz');
|
||||
}
|
||||
if (empty($arcs['extract']['application/x-gzip'])) {
|
||||
$arcs['extract']['application/x-gzip'] = array('cmd' => '7za', 'argc' => 'e -tgzip -y', 'ext' => 'tar.gz');
|
||||
}
|
||||
if (empty($arcs['create']['application/x-bzip2'])) {
|
||||
$arcs['create']['application/x-bzip2'] = array('cmd' => '7za', 'argc' => 'a -tbzip2', 'ext' => 'tar.bz');
|
||||
}
|
||||
if (empty($arcs['extract']['application/x-bzip2'])) {
|
||||
$arcs['extract']['application/x-bzip2'] = array('cmd' => '7za', 'argc' => 'a -tbzip2 -y', 'ext' => 'tar.bz');
|
||||
}
|
||||
if (empty($arcs['create']['application/zip'])) {
|
||||
$arcs['create']['application/zip'] = array('cmd' => '7za', 'argc' => 'a -tzip -l', 'ext' => 'zip');
|
||||
}
|
||||
if (empty($arcs['extract']['application/zip'])) {
|
||||
$arcs['extract']['application/zip'] = array('cmd' => '7za', 'argc' => 'e -tzip -y', 'ext' => 'zip');
|
||||
}
|
||||
if (empty($arcs['create']['application/x-tar'])) {
|
||||
$arcs['create']['application/x-tar'] = array('cmd' => '7za', 'argc' => 'a -ttar -l', 'ext' => 'tar');
|
||||
}
|
||||
if (empty($arcs['extract']['application/x-tar'])) {
|
||||
$arcs['extract']['application/x-tar'] = array('cmd' => '7za', 'argc' => 'e -ttar -y', 'ext' => 'tar');
|
||||
}
|
||||
}
|
||||
|
||||
$this->archivers = $arcs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unpack archive
|
||||
*
|
||||
* @param string $path archive path
|
||||
* @param array $arc archiver command and arguments (same as in $this->archivers)
|
||||
* @return void
|
||||
* @author Dmitry (dio) Levashov
|
||||
* @author Alexey Sukhotin
|
||||
**/
|
||||
protected function _unpack($path, $arc) {
|
||||
$cwd = getcwd();
|
||||
$dir = $this->_dirname($path);
|
||||
chdir($dir);
|
||||
$cmd = $arc['cmd'].' '.$arc['argc'].' '.escapeshellarg($this->_basename($path));
|
||||
$this->procExec($cmd, $o, $c);
|
||||
chdir($cwd);
|
||||
}
|
||||
|
||||
/**
|
||||
* Recursive symlinks search
|
||||
*
|
||||
* @param string $path file/dir path
|
||||
* @return bool
|
||||
* @author Dmitry (dio) Levashov
|
||||
**/
|
||||
protected function _findSymlinks($path) {
|
||||
if (is_link($path)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (is_dir($path)) {
|
||||
foreach (scandir($path) as $name) {
|
||||
if ($name != '.' && $name != '..') {
|
||||
$p = $path.DIRECTORY_SEPARATOR.$name;
|
||||
if (is_link($p)) {
|
||||
return true;
|
||||
}
|
||||
if (is_dir($p) && $this->_findSymlinks($p)) {
|
||||
return true;
|
||||
} elseif (is_file($p)) {
|
||||
$this->archiveSize += filesize($p);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$this->archiveSize += filesize($path);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extract files from archive
|
||||
*
|
||||
* @param string $path archive path
|
||||
* @param array $arc archiver command and arguments (same as in $this->archivers)
|
||||
* @return true
|
||||
* @author Dmitry (dio) Levashov,
|
||||
* @author Alexey Sukhotin
|
||||
**/
|
||||
protected function _extract($path, $arc) {
|
||||
|
||||
if ($this->quarantine) {
|
||||
$dir = $this->quarantine.DIRECTORY_SEPARATOR.str_replace(' ', '_', microtime()).basename($path);
|
||||
$archive = $dir.DIRECTORY_SEPARATOR.basename($path);
|
||||
|
||||
if (!@mkdir($dir)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
chmod($dir, 0755);
|
||||
|
||||
// copy in quarantine
|
||||
if (!copy($path, $archive)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// extract in quarantine
|
||||
$this->_unpack($archive, $arc);
|
||||
@unlink($archive);
|
||||
|
||||
// get files list
|
||||
$ls = array();
|
||||
foreach (scandir($dir) as $i => $name) {
|
||||
if ($name != '.' && $name != '..') {
|
||||
$ls[] = $name;
|
||||
}
|
||||
}
|
||||
|
||||
// no files - extract error ?
|
||||
if (empty($ls)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->archiveSize = 0;
|
||||
|
||||
// find symlinks
|
||||
$symlinks = $this->_findSymlinks($dir);
|
||||
// remove arc copy
|
||||
$this->remove($dir);
|
||||
|
||||
if ($symlinks) {
|
||||
return $this->setError(elFinder::ERROR_ARC_SYMLINKS);
|
||||
}
|
||||
|
||||
// check max files size
|
||||
if ($this->options['maxArcFilesSize'] > 0 && $this->options['maxArcFilesSize'] < $this->archiveSize) {
|
||||
return $this->setError(elFinder::ERROR_ARC_MAXSIZE);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// archive contains one item - extract in archive dir
|
||||
if (count($ls) == 1) {
|
||||
$this->_unpack($path, $arc);
|
||||
$result = dirname($path).DIRECTORY_SEPARATOR.$ls[0];
|
||||
|
||||
|
||||
} else {
|
||||
// for several files - create new directory
|
||||
// create unique name for directory
|
||||
$name = basename($path);
|
||||
if (preg_match('/\.((tar\.(gz|bz|bz2|z|lzo))|cpio\.gz|ps\.gz|xcf\.(gz|bz2)|[a-z0-9]{1,4})$/i', $name, $m)) {
|
||||
$name = substr($name, 0, strlen($name)-strlen($m[0]));
|
||||
}
|
||||
$test = dirname($path).DIRECTORY_SEPARATOR.$name;
|
||||
if (file_exists($test) || is_link($test)) {
|
||||
$name = $this->uniqueName(dirname($path), $name, '-', false);
|
||||
}
|
||||
|
||||
$result = dirname($path).DIRECTORY_SEPARATOR.$name;
|
||||
$archive = $result.DIRECTORY_SEPARATOR.basename($path);
|
||||
|
||||
if (!$this->_mkdir(dirname($path), $name) || !copy($path, $archive)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->_unpack($archive, $arc);
|
||||
@unlink($archive);
|
||||
}
|
||||
|
||||
return file_exists($result) ? $result : false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create archive and return its path
|
||||
*
|
||||
* @param string $dir target dir
|
||||
* @param array $files files names list
|
||||
* @param string $name archive name
|
||||
* @param array $arc archiver options
|
||||
* @return string|bool
|
||||
* @author Dmitry (dio) Levashov,
|
||||
* @author Alexey Sukhotin
|
||||
**/
|
||||
protected function _archive($dir, $files, $name, $arc) {
|
||||
$cwd = getcwd();
|
||||
chdir($dir);
|
||||
|
||||
$files = array_map('escapeshellarg', $files);
|
||||
|
||||
$cmd = $arc['cmd'].' '.$arc['argc'].' '.escapeshellarg($name).' '.implode(' ', $files);
|
||||
$this->procExec($cmd, $o, $c);
|
||||
chdir($cwd);
|
||||
|
||||
$path = $dir.DIRECTORY_SEPARATOR.$name;
|
||||
return file_exists($path) ? $path : false;
|
||||
}
|
||||
|
||||
} // END class
|
||||
512
administrator/components/com_k2/lib/elfinder/mime.types
Normal file
512
administrator/components/com_k2/lib/elfinder/mime.types
Normal file
@@ -0,0 +1,512 @@
|
||||
# This file controls what Internet media types are sent to the client for
|
||||
# given file extension(s). Sending the correct media type to the client
|
||||
# is important so they know how to handle the content of the file.
|
||||
# For more information about Internet media types, please read
|
||||
# RFC 2045, 2046, 2047, 2048, and 2077. The Internet media type
|
||||
# registry is at <ftp://ftp.iana.org/assignments/media-types/>.
|
||||
|
||||
# MIME type Extension
|
||||
application/andrew-inset ez
|
||||
application/chemtool cht
|
||||
application/dicom dcm
|
||||
application/docbook+xml docbook
|
||||
application/ecmascript ecma
|
||||
application/flash-video flv
|
||||
application/illustrator ai
|
||||
application/javascript js
|
||||
application/mac-binhex40
|
||||
application/mathematica nb
|
||||
application/msword doc
|
||||
application/octet-stream bin
|
||||
application/oda oda
|
||||
application/ogg ogg
|
||||
application/pdf pdf
|
||||
application/pgp pgp
|
||||
application/pgp-encrypted
|
||||
application/pgp-encrypted pgp gpg
|
||||
application/pgp-keys
|
||||
application/pgp-keys skr pkr
|
||||
application/pgp-signature
|
||||
application/pgp-signature sig
|
||||
application/pkcs7-mime
|
||||
application/pkcs7-signature p7s
|
||||
application/postscript ps
|
||||
application/rtf rtf
|
||||
application/sdp sdp
|
||||
application/smil smil smi sml
|
||||
application/stuffit sit
|
||||
application/vnd.corel-draw cdr
|
||||
application/vnd.hp-hpgl hpgl
|
||||
application/vnd.hp-pcl pcl
|
||||
application/vnd.lotus-1-2-3 123 wk1 wk3 wk4 wks
|
||||
application/vnd.mozilla.xul+xml xul
|
||||
application/vnd.ms-excel xls xlc xll xlm xlw xla xlt xld
|
||||
application/vnd.ms-powerpoint ppz ppt pps pot
|
||||
application/vnd.oasis.opendocument.chart odc
|
||||
application/vnd.oasis.opendocument.database odb
|
||||
application/vnd.oasis.opendocument.formula odf
|
||||
application/vnd.oasis.opendocument.graphics odg
|
||||
application/vnd.oasis.opendocument.graphics-template otg
|
||||
application/vnd.oasis.opendocument.image odi
|
||||
application/vnd.oasis.opendocument.presentation odp
|
||||
application/vnd.oasis.opendocument.presentation-template otp
|
||||
application/vnd.oasis.opendocument.spreadsheet ods
|
||||
application/vnd.oasis.opendocument.spreadsheet-template ots
|
||||
application/vnd.oasis.opendocument.text odt
|
||||
application/vnd.oasis.opendocument.text-master odm
|
||||
application/vnd.oasis.opendocument.text-template ott
|
||||
application/vnd.oasis.opendocument.text-web oth
|
||||
application/vnd.palm pdb
|
||||
application/vnd.rn-realmedia
|
||||
application/vnd.rn-realmedia rm
|
||||
application/vnd.rn-realmedia-secure rms
|
||||
application/vnd.rn-realmedia-vbr rmvb
|
||||
application/vnd.stardivision.calc sdc
|
||||
application/vnd.stardivision.chart sds
|
||||
application/vnd.stardivision.draw sda
|
||||
application/vnd.stardivision.impress sdd sdp
|
||||
application/vnd.stardivision.mail smd
|
||||
application/vnd.stardivision.math smf
|
||||
application/vnd.stardivision.writer sdw vor sgl
|
||||
application/vnd.sun.xml.calc sxc
|
||||
application/vnd.sun.xml.calc.template stc
|
||||
application/vnd.sun.xml.draw sxd
|
||||
application/vnd.sun.xml.draw.template std
|
||||
application/vnd.sun.xml.impress sxi
|
||||
application/vnd.sun.xml.impress.template sti
|
||||
application/vnd.sun.xml.math sxm
|
||||
application/vnd.sun.xml.writer sxw
|
||||
application/vnd.sun.xml.writer.global sxg
|
||||
application/vnd.sun.xml.writer.template stw
|
||||
application/vnd.wordperfect wpd
|
||||
application/x-abiword abw abw.CRASHED abw.gz zabw
|
||||
application/x-amipro sam
|
||||
application/x-anjuta-project prj
|
||||
application/x-applix-spreadsheet as
|
||||
application/x-applix-word aw
|
||||
application/x-arc
|
||||
application/x-archive a
|
||||
application/x-arj arj
|
||||
application/x-asax asax
|
||||
application/x-ascx ascx
|
||||
application/x-ashx ashx
|
||||
application/x-asix asix
|
||||
application/x-asmx asmx
|
||||
application/x-asp asp
|
||||
application/x-awk
|
||||
application/x-axd axd
|
||||
application/x-bcpio bcpio
|
||||
application/x-bittorrent torrent
|
||||
application/x-blender blender blend BLEND
|
||||
application/x-bzip bz bz2
|
||||
application/x-bzip bz2 bz
|
||||
application/x-bzip-compressed-tar tar.bz tar.bz2
|
||||
application/x-bzip-compressed-tar tar.bz tar.bz2 tbz tbz2
|
||||
application/x-cd-image iso
|
||||
application/x-cgi cgi
|
||||
application/x-chess-pgn pgn
|
||||
application/x-chm chm
|
||||
application/x-class-file
|
||||
application/x-cmbx cmbx
|
||||
application/x-compress Z
|
||||
application/x-compressed-tar tar.gz tar.Z tgz taz
|
||||
application/x-compressed-tar tar.gz tgz
|
||||
application/x-config config
|
||||
application/x-core
|
||||
application/x-cpio cpio
|
||||
application/x-cpio-compressed cpio.gz
|
||||
application/x-csh csh
|
||||
application/x-cue cue
|
||||
application/x-dbase dbf
|
||||
application/x-dbm
|
||||
application/x-dc-rom dc
|
||||
application/x-deb deb
|
||||
application/x-designer ui
|
||||
application/x-desktop desktop kdelnk
|
||||
application/x-devhelp devhelp
|
||||
application/x-dia-diagram dia
|
||||
application/x-disco disco
|
||||
application/x-dvi dvi
|
||||
application/x-e-theme etheme
|
||||
application/x-egon egon
|
||||
application/x-executable exe
|
||||
application/x-font-afm afm
|
||||
application/x-font-bdf bdf
|
||||
application/x-font-dos
|
||||
application/x-font-framemaker
|
||||
application/x-font-libgrx
|
||||
application/x-font-linux-psf psf
|
||||
application/x-font-otf
|
||||
application/x-font-pcf pcf
|
||||
application/x-font-pcf pcf.gz
|
||||
application/x-font-speedo spd
|
||||
application/x-font-sunos-news
|
||||
application/x-font-tex
|
||||
application/x-font-tex-tfm
|
||||
application/x-font-ttf ttc TTC
|
||||
application/x-font-ttf ttf
|
||||
application/x-font-type1 pfa pfb gsf pcf.Z
|
||||
application/x-font-vfont
|
||||
application/x-frame
|
||||
application/x-frontline aop
|
||||
application/x-gameboy-rom gb
|
||||
application/x-gdbm
|
||||
application/x-gdesklets-display display
|
||||
application/x-genesis-rom gen md
|
||||
application/x-gettext-translation gmo
|
||||
application/x-glabels glabels
|
||||
application/x-glade glade
|
||||
application/x-gmc-link
|
||||
application/x-gnome-db-connection connection
|
||||
application/x-gnome-db-database database
|
||||
application/x-gnome-stones caves
|
||||
application/x-gnucash gnucash gnc xac
|
||||
application/x-gnumeric gnumeric
|
||||
application/x-graphite gra
|
||||
application/x-gtar gtar
|
||||
application/x-gtktalog
|
||||
application/x-gzip gz
|
||||
application/x-gzpostscript ps.gz
|
||||
application/x-hdf hdf
|
||||
application/x-ica ica
|
||||
application/x-ipod-firmware
|
||||
application/x-jamin jam
|
||||
application/x-jar jar
|
||||
application/x-java class
|
||||
application/x-java-archive jar ear war
|
||||
|
||||
application/x-jbuilder-project jpr jpx
|
||||
application/x-karbon karbon
|
||||
application/x-kchart chrt
|
||||
application/x-kformula kfo
|
||||
application/x-killustrator kil
|
||||
application/x-kivio flw
|
||||
application/x-kontour kon
|
||||
application/x-kpovmodeler kpm
|
||||
application/x-kpresenter kpr kpt
|
||||
application/x-krita kra
|
||||
application/x-kspread ksp
|
||||
application/x-kspread-crypt
|
||||
application/x-ksysv-package
|
||||
application/x-kugar kud
|
||||
application/x-kword kwd kwt
|
||||
application/x-kword-crypt
|
||||
application/x-lha lha lzh
|
||||
application/x-lha lzh
|
||||
application/x-lhz lhz
|
||||
application/x-linguist ts
|
||||
application/x-lyx lyx
|
||||
application/x-lzop lzo
|
||||
application/x-lzop-compressed-tar tar.lzo tzo
|
||||
application/x-macbinary
|
||||
application/x-machine-config
|
||||
application/x-magicpoint mgp
|
||||
application/x-master-page master
|
||||
application/x-matroska mkv
|
||||
application/x-mdp mdp
|
||||
application/x-mds mds
|
||||
application/x-mdsx mdsx
|
||||
application/x-mergeant mergeant
|
||||
application/x-mif mif
|
||||
application/x-mozilla-bookmarks
|
||||
application/x-mps mps
|
||||
application/x-ms-dos-executable exe
|
||||
application/x-mswinurl
|
||||
application/x-mswrite wri
|
||||
application/x-msx-rom msx
|
||||
application/x-n64-rom n64
|
||||
application/x-nautilus-link
|
||||
application/x-nes-rom nes
|
||||
application/x-netcdf cdf nc
|
||||
application/x-netscape-bookmarks
|
||||
application/x-object o
|
||||
application/x-ole-storage
|
||||
application/x-oleo oleo
|
||||
application/x-palm-database
|
||||
application/x-palm-database pdb prc
|
||||
application/x-par2 PAR2 par2
|
||||
application/x-pef-executable
|
||||
application/x-perl pl pm al perl
|
||||
application/x-php php php3 php4
|
||||
application/x-pkcs12 p12 pfx
|
||||
application/x-planner planner mrproject
|
||||
application/x-planperfect pln
|
||||
application/x-prjx prjx
|
||||
application/x-profile
|
||||
application/x-ptoptimizer-script pto
|
||||
application/x-pw pw
|
||||
application/x-python-bytecode pyc pyo
|
||||
application/x-quattro-pro wb1 wb2 wb3
|
||||
application/x-quattropro wb1 wb2 wb3
|
||||
application/x-qw qif
|
||||
application/x-rar rar
|
||||
application/x-rar-compressed rar
|
||||
application/x-rdp rdp
|
||||
application/x-reject rej
|
||||
application/x-remoting rem
|
||||
application/x-resources resources
|
||||
application/x-resourcesx resx
|
||||
application/x-rpm rpm
|
||||
application/x-ruby
|
||||
application/x-sc
|
||||
application/x-sc sc
|
||||
application/x-scribus sla sla.gz scd scd.gz
|
||||
application/x-shar shar
|
||||
application/x-shared-library-la la
|
||||
application/x-sharedlib so
|
||||
application/x-shellscript sh
|
||||
application/x-shockwave-flash swf
|
||||
application/x-siag siag
|
||||
application/x-slp
|
||||
application/x-smil kino
|
||||
application/x-smil smi smil
|
||||
application/x-sms-rom sms gg
|
||||
application/x-soap-remoting soap
|
||||
application/x-streamingmedia ssm
|
||||
application/x-stuffit
|
||||
application/x-stuffit bin sit
|
||||
application/x-sv4cpio sv4cpio
|
||||
application/x-sv4crc sv4crc
|
||||
application/x-tar tar
|
||||
application/x-tarz tar.Z
|
||||
application/x-tex-gf gf
|
||||
application/x-tex-pk k
|
||||
application/x-tgif obj
|
||||
application/x-theme theme
|
||||
application/x-toc toc
|
||||
application/x-toutdoux
|
||||
application/x-trash bak old sik
|
||||
application/x-troff tr roff t
|
||||
application/x-troff-man man
|
||||
application/x-troff-man-compressed
|
||||
application/x-tzo tar.lzo tzo
|
||||
application/x-ustar ustar
|
||||
application/x-wais-source src
|
||||
application/x-web-config
|
||||
application/x-wpg wpg
|
||||
application/x-wsdl wsdl
|
||||
application/x-x509-ca-cert der cer crt cert pem
|
||||
application/x-xbel xbel
|
||||
application/x-zerosize
|
||||
application/x-zoo zoo
|
||||
application/xhtml+xml xhtml
|
||||
application/zip zip
|
||||
audio/ac3 ac3
|
||||
audio/basic au snd
|
||||
audio/midi mid midi
|
||||
audio/mpeg mp3
|
||||
audio/prs.sid sid psid
|
||||
audio/vnd.rn-realaudio ra
|
||||
audio/x-aac aac
|
||||
audio/x-adpcm
|
||||
audio/x-aifc
|
||||
audio/x-aiff aif aiff
|
||||
audio/x-aiff aiff aif aifc
|
||||
audio/x-aiffc
|
||||
audio/x-flac flac
|
||||
audio/x-m4a m4a
|
||||
audio/x-mod mod ult uni XM m15 mtm 669
|
||||
audio/x-mp3-playlist
|
||||
audio/x-mpeg
|
||||
audio/x-mpegurl m3u
|
||||
audio/x-ms-asx
|
||||
audio/x-pn-realaudio ra ram rm
|
||||
audio/x-pn-realaudio ram rmm
|
||||
audio/x-riff
|
||||
audio/x-s3m s3m
|
||||
audio/x-scpls pls
|
||||
audio/x-scpls pls xpl
|
||||
audio/x-stm stm
|
||||
audio/x-voc voc
|
||||
audio/x-wav wav
|
||||
audio/x-xi xi
|
||||
audio/x-xm xm
|
||||
image/bmp bmp
|
||||
image/cgm cgm
|
||||
image/dpx
|
||||
image/fax-g3 g3
|
||||
image/g3fax
|
||||
image/gif gif
|
||||
image/ief ief
|
||||
image/jpeg jpeg jpg jpe
|
||||
image/jpeg2000 jp2
|
||||
image/png png
|
||||
image/rle rle
|
||||
image/svg+xml svg
|
||||
image/tiff tif tiff
|
||||
image/vnd.djvu djvu djv
|
||||
image/vnd.dwg dwg
|
||||
image/vnd.dxf dxf
|
||||
image/x-3ds 3ds
|
||||
image/x-applix-graphics ag
|
||||
image/x-cmu-raster ras
|
||||
image/x-compressed-xcf xcf.gz xcf.bz2
|
||||
image/x-dcraw bay BAY bmq BMQ cr2 CR2 crw CRW cs1 CS1 dc2 DC2 dcr DCR fff FFF k25 K25 kdc KDC mos MOS mrw MRW nef NEF orf ORF pef PEF raf RAF rdc RDC srf SRF x3f X3F
|
||||
image/x-dib
|
||||
image/x-eps eps epsi epsf
|
||||
image/x-fits fits
|
||||
image/x-fpx
|
||||
image/x-icb icb
|
||||
image/x-ico ico
|
||||
image/x-iff iff
|
||||
image/x-ilbm ilbm
|
||||
image/x-jng jng
|
||||
image/x-lwo lwo lwob
|
||||
image/x-lws lws
|
||||
image/x-msod msod
|
||||
image/x-niff
|
||||
image/x-pcx
|
||||
image/x-photo-cd pcd
|
||||
image/x-pict pict pict1 pict2
|
||||
image/x-portable-anymap pnm
|
||||
image/x-portable-bitmap pbm
|
||||
image/x-portable-graymap pgm
|
||||
image/x-portable-pixmap ppm
|
||||
image/x-psd psd
|
||||
image/x-rgb rgb
|
||||
image/x-sgi sgi
|
||||
image/x-sun-raster sun
|
||||
image/x-tga tga
|
||||
image/x-win-bitmap cur
|
||||
image/x-wmf wmf
|
||||
image/x-xbitmap xbm
|
||||
image/x-xcf xcf
|
||||
image/x-xfig fig
|
||||
image/x-xpixmap xpm
|
||||
image/x-xwindowdump xwd
|
||||
inode/blockdevice
|
||||
inode/chardevice
|
||||
inode/directory
|
||||
inode/fifo
|
||||
inode/mount-point
|
||||
inode/socket
|
||||
inode/symlink
|
||||
message/delivery-status
|
||||
message/disposition-notification
|
||||
message/external-body
|
||||
message/news
|
||||
message/partial
|
||||
message/rfc822
|
||||
message/x-gnu-rmail
|
||||
model/vrml wrl
|
||||
multipart/alternative
|
||||
multipart/appledouble
|
||||
multipart/digest
|
||||
multipart/encrypted
|
||||
multipart/mixed
|
||||
multipart/related
|
||||
multipart/report
|
||||
multipart/signed
|
||||
multipart/x-mixed-replace
|
||||
text/calendar vcs ics
|
||||
text/css css CSSL
|
||||
text/directory vcf vct gcrd
|
||||
text/enriched
|
||||
text/html html htm
|
||||
text/htmlh
|
||||
text/mathml mml
|
||||
text/plain txt asc
|
||||
text/rdf rdf
|
||||
text/rfc822-headers
|
||||
text/richtext rtx
|
||||
text/rss rss
|
||||
text/sgml sgml sgm
|
||||
text/spreadsheet sylk slk
|
||||
text/tab-separated-values tsv
|
||||
text/vnd.rn-realtext rt
|
||||
text/vnd.wap.wml wml
|
||||
text/x-adasrc adb ads
|
||||
text/x-authors
|
||||
text/x-bibtex bib
|
||||
text/x-boo boo
|
||||
text/x-c++hdr hh
|
||||
text/x-c++src cpp cxx cc C c++
|
||||
text/x-chdr h h++ hp
|
||||
text/x-comma-separated-values csv
|
||||
text/x-copying
|
||||
text/x-credits
|
||||
text/x-csrc c
|
||||
text/x-dcl dcl
|
||||
text/x-dsl dsl
|
||||
text/x-dsrc d
|
||||
text/x-dtd dtd
|
||||
text/x-emacs-lisp el
|
||||
text/x-fortran f
|
||||
text/x-gettext-translation po
|
||||
text/x-gettext-translation-template pot
|
||||
text/x-gtkrc
|
||||
text/x-haskell hs
|
||||
text/x-idl idl
|
||||
text/x-install
|
||||
text/x-java java
|
||||
text/x-js js
|
||||
text/x-ksysv-log
|
||||
text/x-literate-haskell lhs
|
||||
text/x-log log
|
||||
text/x-makefile
|
||||
text/x-moc moc
|
||||
text/x-msil il
|
||||
text/x-nemerle n
|
||||
text/x-objcsrc m
|
||||
text/x-pascal p pas
|
||||
text/x-patch diff patch
|
||||
text/x-python py
|
||||
text/x-readme
|
||||
text/x-rng rng
|
||||
text/x-scheme scm
|
||||
text/x-setext etx
|
||||
text/x-speech
|
||||
text/x-sql sql
|
||||
text/x-suse-ymp ymp
|
||||
text/x-suse-ymu ymu
|
||||
text/x-tcl tcl tk
|
||||
text/x-tex tex ltx sty cls
|
||||
text/x-texinfo texi texinfo
|
||||
text/x-texmacs tm ts
|
||||
text/x-troff-me me
|
||||
text/x-troff-mm mm
|
||||
text/x-troff-ms ms
|
||||
text/x-uil uil
|
||||
text/x-uri uri url
|
||||
text/x-vb vb
|
||||
text/x-xds xds
|
||||
text/x-xmi xmi
|
||||
text/x-xsl xsl
|
||||
text/x-xslfo fo xslfo
|
||||
text/x-xslt xslt xsl
|
||||
text/xmcd
|
||||
text/xml xml
|
||||
video/3gpp 3gp
|
||||
video/dv dv dif
|
||||
video/isivideo
|
||||
video/mpeg mpeg mpg mp2 mpe vob dat
|
||||
video/quicktime qt mov moov qtvr
|
||||
video/vivo
|
||||
video/vnd.rn-realvideo rv
|
||||
video/wavelet
|
||||
video/x-3gpp2 3g2
|
||||
video/x-anim anim[1-9j]
|
||||
video/x-avi
|
||||
video/x-flic fli flc
|
||||
video/x-mng mng
|
||||
video/x-ms-asf asf asx
|
||||
video/x-ms-wmv wmv
|
||||
video/x-msvideo avi
|
||||
video/x-nsv nsv NSV
|
||||
video/x-real-video
|
||||
video/x-sgi-movie movie
|
||||
application/x-java-jnlp-file jnlp
|
||||
application/vnd.openxmlformats-officedocument.wordprocessingml.document docx
|
||||
application/vnd.openxmlformats-officedocument.wordprocessingml.template dotx
|
||||
application/vnd.ms-word.document.macroEnabled.12 docm
|
||||
application/vnd.ms-word.template.macroEnabled.12 dotm
|
||||
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet xlsx
|
||||
application/vnd.openxmlformats-officedocument.spreadsheetml.template xltx
|
||||
application/vnd.ms-excel.sheet.macroEnabled.12 xlsm
|
||||
application/vnd.ms-excel.template.macroEnabled.12 xltm
|
||||
application/vnd.ms-excel.addin.macroEnabled.12 xlam
|
||||
application/vnd.ms-excel.sheet.binary.macroEnabled.12 xlsb
|
||||
application/vnd.openxmlformats-officedocument.presentationml.presentation pptx
|
||||
application/vnd.openxmlformats-officedocument.presentationml.template potx
|
||||
application/vnd.openxmlformats-officedocument.presentationml.slideshow ppsx
|
||||
application/vnd.ms-powerpoint.addin.macroEnabled.12 ppam
|
||||
257
administrator/components/com_k2/lib/k2parameter.php
Normal file
257
administrator/components/com_k2/lib/k2parameter.php
Normal file
@@ -0,0 +1,257 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: k2parameter.php 1829 2013-01-25 15:36:59Z lefteris.kavadas $
|
||||
* @package K2
|
||||
* @author JoomlaWorks http://www.joomlaworks.net
|
||||
* @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.
|
||||
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die ;
|
||||
|
||||
if (K2_JVERSION == '30')
|
||||
{
|
||||
class K2Parameter
|
||||
{
|
||||
function __construct($data, $path = '', $namespace)
|
||||
{
|
||||
$this->namespace = $namespace;
|
||||
$this->values = new JRegistry($data);
|
||||
}
|
||||
|
||||
function get($path, $default = null)
|
||||
{
|
||||
return $this->values->get($this->namespace.$path, $default);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
jimport('joomla.html.parameter');
|
||||
|
||||
/**
|
||||
* Parameter handler
|
||||
*
|
||||
* @package Joomla.Framework
|
||||
* @subpackage Parameter
|
||||
* @since 1.5
|
||||
*/
|
||||
class K2Parameter extends JParameter
|
||||
{
|
||||
|
||||
/**
|
||||
* optional namespace
|
||||
*
|
||||
* @access private
|
||||
* @var array
|
||||
* @since 1.5
|
||||
*/
|
||||
var $namespace = null;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @access protected
|
||||
* @param string The raw parms text
|
||||
* @param string Path to the xml setup file
|
||||
* @param string Namespace to the xml setup file
|
||||
* @since 1.5
|
||||
*/
|
||||
function __construct($data, $path = '', $namespace)
|
||||
{
|
||||
parent::__construct('_default');
|
||||
|
||||
// Set base path
|
||||
$this->_elementPath[] = JPATH_COMPONENT_ADMINISTRATOR.DS.'elements';
|
||||
|
||||
if (trim($data))
|
||||
{
|
||||
$this->loadINI($data);
|
||||
}
|
||||
|
||||
if ($path)
|
||||
{
|
||||
@$this->loadSetupFile($path);
|
||||
}
|
||||
|
||||
if ($namespace)
|
||||
{
|
||||
$this->namespace = $namespace;
|
||||
}
|
||||
|
||||
$this->_raw = $data;
|
||||
|
||||
if (K2_JVERSION != '15')
|
||||
{
|
||||
$this->bind($data);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a value
|
||||
*
|
||||
* @access public
|
||||
* @param string The name of the param
|
||||
* @param mixed The default value if not found
|
||||
* @return string
|
||||
* @since 1.5
|
||||
*/
|
||||
function get($key, $default = '', $group = '_default')
|
||||
{
|
||||
if (K2_JVERSION != '15')
|
||||
{
|
||||
return parent::get($this->namespace.$key, $default);
|
||||
}
|
||||
$value = $this->getValue($group.'.'.$this->namespace.$key);
|
||||
$result = (empty($value) && ($value !== 0) && ($value !== '0')) ? $default : $value;
|
||||
//if($group != '_default') { echo ($group); }
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Render a parameter type
|
||||
*
|
||||
* @param object A param tag node
|
||||
* @param string The control name
|
||||
* @return array Any array of the label, the form element and the tooltip
|
||||
* @since 1.5
|
||||
*/
|
||||
function getParam(&$node, $control_name = 'params', $group = '_default')
|
||||
{
|
||||
//get the type of the parameter
|
||||
$type = $node->attributes('type');
|
||||
|
||||
//remove any occurance of a mos_ prefix
|
||||
$type = str_replace('mos_', '', $type);
|
||||
|
||||
$element = $this->loadElement($type);
|
||||
|
||||
// error happened
|
||||
if ($element === false)
|
||||
{
|
||||
$result = array();
|
||||
$result[0] = $node->attributes('name');
|
||||
$result[1] = JText::_('K2_ELEMENT_NOT_DEFINED_FOR_TYPE').' = '.$type;
|
||||
$result[5] = $result[0];
|
||||
return $result;
|
||||
}
|
||||
|
||||
//get value
|
||||
$value = $this->get($node->attributes('name'), $node->attributes('default'), $group);
|
||||
|
||||
//set name
|
||||
$node->_attributes['name'] = $this->namespace.$node->_attributes['name'];
|
||||
|
||||
return $element->render($node, $value, $control_name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a registry value
|
||||
*
|
||||
* @access public
|
||||
* @param string $regpath Registry path (e.g. joomla.content.showauthor)
|
||||
* @param mixed $default Optional default value
|
||||
* @return mixed Value of entry or null
|
||||
* @since 1.5
|
||||
*/
|
||||
function getValue($regpath, $default = null)
|
||||
{
|
||||
$result = $default;
|
||||
|
||||
// Explode the registry path into an array
|
||||
if ($nodes = explode('.', $regpath))
|
||||
{
|
||||
// Get the namespace
|
||||
//$namespace = array_shift($nodes);
|
||||
$count = count($nodes);
|
||||
if ($count < 2)
|
||||
{
|
||||
$namespace = $this->_defaultNameSpace;
|
||||
$nodes[1] = $nodes[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
$namespace = $nodes[0];
|
||||
}
|
||||
|
||||
if (isset($this->_registry[$namespace]))
|
||||
{
|
||||
$ns = &$this->_registry[$namespace]['data'];
|
||||
$pathNodes = $count - 1;
|
||||
|
||||
//for ($i = 0; $i < $pathNodes; $i ++) {
|
||||
for ($i = 1; $i < $pathNodes; $i++)
|
||||
{
|
||||
if ((isset($ns->$nodes[$i])))
|
||||
$ns = &$ns->$nodes[$i];
|
||||
}
|
||||
|
||||
if (isset($ns->$nodes[$i]))
|
||||
{
|
||||
$result = $ns->$nodes[$i];
|
||||
}
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Render
|
||||
*
|
||||
* @access public
|
||||
* @param string The name of the control, or the default text area if a setup file is not found
|
||||
* @return string HTML
|
||||
* @since 1.5
|
||||
*/
|
||||
function render($name = 'params', $group = '_default')
|
||||
{
|
||||
if (!isset($this->_xml[$group]))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
$params = $this->getParams($name, $group);
|
||||
$html = array();
|
||||
$html[] = '<table class="paramlist admintable" cellspacing="1">';
|
||||
|
||||
if ($description = $this->_xml[$group]->attributes('description'))
|
||||
{
|
||||
// add the params description to the display
|
||||
$desc = JText::_($description);
|
||||
$html[] = '<tr><td class="paramlist_description" colspan="2">'.$desc.'</td></tr>';
|
||||
}
|
||||
|
||||
foreach ($params as $param)
|
||||
{
|
||||
$html[] = '<tr>';
|
||||
|
||||
if ($param[0])
|
||||
{
|
||||
$html[] = '<td class="paramlist_key"><span class="editlinktip">'.$param[0].'</span></td>';
|
||||
$html[] = '<td class="paramlist_value">'.$param[1].'</td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$html[] = '<td class="paramlist_value" colspan="2">'.$param[1].'</td>';
|
||||
}
|
||||
|
||||
$html[] = '</tr>';
|
||||
}
|
||||
|
||||
if (count($params) < 1)
|
||||
{
|
||||
$html[] = "<tr><td colspan=\"2\"><i>".(K2_JVERSION != '15') ? JText::_('JLIB_HTML_NO_PARAMETERS_FOR_THIS_ITEM') : JText::_('There are no Parameters for this item')."</i></td></tr>";
|
||||
}
|
||||
|
||||
$html[] = '</table>';
|
||||
|
||||
return implode("\n", $html);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
89
administrator/components/com_k2/lib/k2plugin.php
Normal file
89
administrator/components/com_k2/lib/k2plugin.php
Normal file
@@ -0,0 +1,89 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: k2plugin.php 1964 2013-04-29 13:14:09Z lefteris.kavadas $
|
||||
* @package K2
|
||||
* @author JoomlaWorks http://www.joomlaworks.net
|
||||
* @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.
|
||||
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die ;
|
||||
|
||||
jimport('joomla.plugin.plugin');
|
||||
|
||||
JLoader::register('K2Parameter', JPATH_ADMINISTRATOR.DS.'components'.DS.'com_k2'.DS.'lib'.DS.'k2parameter.php');
|
||||
|
||||
class K2Plugin extends JPlugin
|
||||
{
|
||||
|
||||
/**
|
||||
* Below we list all available BACKEND events, to trigger K2 plugins and generate additional fields in the item, category and user forms.
|
||||
*/
|
||||
|
||||
/* ------------ Functions to render plugin parameters in the backend - no need to change anything ------------ */
|
||||
function onRenderAdminForm(&$item, $type, $tab = '')
|
||||
{
|
||||
|
||||
$mainframe = JFactory::getApplication();
|
||||
$manifest = (K2_JVERSION == '15') ? JPATH_SITE.DS.'plugins'.DS.'k2'.DS.$this->pluginName.'.xml' : JPATH_SITE.DS.'plugins'.DS.'k2'.DS.$this->pluginName.DS.$this->pluginName.'.xml';
|
||||
if (!empty($tab))
|
||||
{
|
||||
$path = $type.'-'.$tab;
|
||||
}
|
||||
else
|
||||
{
|
||||
$path = $type;
|
||||
}
|
||||
if (!isset($item->plugins))
|
||||
{
|
||||
$item->plugins = NULL;
|
||||
}
|
||||
|
||||
if (K2_JVERSION == '15')
|
||||
{
|
||||
|
||||
$form = new K2Parameter($item->plugins, $manifest, $this->pluginName);
|
||||
$fields = $form->render('plugins', $path);
|
||||
}
|
||||
else
|
||||
{
|
||||
jimport('joomla.form.form');
|
||||
$form = JForm::getInstance('plg_k2_'.$this->pluginName.'_'.$path, $manifest, array(), true, 'fields[@group="'.$path.'"]');
|
||||
$values = array();
|
||||
if ($item->plugins)
|
||||
{
|
||||
foreach (json_decode($item->plugins) as $name => $value)
|
||||
{
|
||||
$count = 1;
|
||||
$values[str_replace($this->pluginName, '', $name, $count)] = $value;
|
||||
}
|
||||
$form->bind($values);
|
||||
}
|
||||
$fields = '';
|
||||
foreach ($form->getFieldset() as $field)
|
||||
{
|
||||
$search = 'name="'.$field->name.'"';
|
||||
$replace = 'name="plugins['.$this->pluginName.$field->name.']"';
|
||||
$input = JString::str_ireplace($search, $replace, $field->__get('input'));
|
||||
$fields .= $field->__get('label').' '.$input;
|
||||
}
|
||||
|
||||
// Legacy code to maintain compatibillity with existing plugins that use params instead of JForm
|
||||
if (empty($fields) && K2_JVERSION == '25')
|
||||
{
|
||||
$form = new K2Parameter($item->plugins, $manifest, $this->pluginName);
|
||||
$fields = $form->render('plugins', $path);
|
||||
}
|
||||
|
||||
}
|
||||
if ($fields)
|
||||
{
|
||||
$plugin = new stdClass;
|
||||
$plugin->name = $this->pluginNameHumanReadable;
|
||||
$plugin->fields = $fields;
|
||||
return $plugin;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
288
administrator/components/com_k2/lib/recaptchalib.php
Normal file
288
administrator/components/com_k2/lib/recaptchalib.php
Normal file
@@ -0,0 +1,288 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: recaptchalib.php 1812 2013-01-14 18:45:06Z lefteris.kavadas $
|
||||
* @package K2
|
||||
* @author JoomlaWorks http://www.joomlaworks.net
|
||||
* @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.
|
||||
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
/*
|
||||
* This is a PHP library that handles calling reCAPTCHA.
|
||||
* - Documentation and latest version
|
||||
* http://recaptcha.net/plugins/php/
|
||||
* - Get a reCAPTCHA API Key
|
||||
* https://www.google.com/recaptcha/admin/create
|
||||
* - Discussion group
|
||||
* http://groups.google.com/group/recaptcha
|
||||
*
|
||||
* Copyright (c) 2007 reCAPTCHA -- http://recaptcha.net
|
||||
* AUTHORS:
|
||||
* Mike Crawford
|
||||
* Ben Maurer
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* The reCAPTCHA server URL's
|
||||
*/
|
||||
define("RECAPTCHA_API_SERVER", "http://www.google.com/recaptcha/api");
|
||||
define("RECAPTCHA_API_SECURE_SERVER", "https://www.google.com/recaptcha/api");
|
||||
define("RECAPTCHA_VERIFY_SERVER", "www.google.com");
|
||||
|
||||
/**
|
||||
* Encodes the given data into a query string format
|
||||
* @param $data - array of string elements to be encoded
|
||||
* @return string - encoded request
|
||||
*/
|
||||
function _recaptcha_qsencode ($data) {
|
||||
$req = "";
|
||||
foreach ( $data as $key => $value )
|
||||
$req .= $key . '=' . urlencode( stripslashes($value) ) . '&';
|
||||
|
||||
// Cut the last '&'
|
||||
$req=substr($req,0,strlen($req)-1);
|
||||
return $req;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Submits an HTTP POST to a reCAPTCHA server
|
||||
* @param string $host
|
||||
* @param string $path
|
||||
* @param array $data
|
||||
* @param int port
|
||||
* @return array response
|
||||
*/
|
||||
function _recaptcha_http_post($host, $path, $data, $port = 80) {
|
||||
|
||||
$req = _recaptcha_qsencode ($data);
|
||||
|
||||
$http_request = "POST $path HTTP/1.0\r\n";
|
||||
$http_request .= "Host: $host\r\n";
|
||||
$http_request .= "Content-Type: application/x-www-form-urlencoded;\r\n";
|
||||
$http_request .= "Content-Length: " . strlen($req) . "\r\n";
|
||||
$http_request .= "User-Agent: reCAPTCHA/PHP\r\n";
|
||||
$http_request .= "\r\n";
|
||||
$http_request .= $req;
|
||||
|
||||
$response = '';
|
||||
if( false == ( $fs = @fsockopen($host, $port, $errno, $errstr, 10) ) ) {
|
||||
die ('Could not open socket');
|
||||
}
|
||||
|
||||
fwrite($fs, $http_request);
|
||||
|
||||
while ( !feof($fs) )
|
||||
$response .= fgets($fs, 1160); // One TCP-IP packet
|
||||
fclose($fs);
|
||||
$response = explode("\r\n\r\n", $response, 2);
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets the challenge HTML (javascript and non-javascript version).
|
||||
* This is called from the browser, and the resulting reCAPTCHA HTML widget
|
||||
* is embedded within the HTML form it was called from.
|
||||
* @param string $pubkey A public key for reCAPTCHA
|
||||
* @param string $error The error given by reCAPTCHA (optional, default is null)
|
||||
* @param boolean $use_ssl Should the request be made over ssl? (optional, default is false)
|
||||
|
||||
* @return string - The HTML to be embedded in the user's form.
|
||||
*/
|
||||
function recaptcha_get_html ($pubkey, $error = null, $use_ssl = false)
|
||||
{
|
||||
if ($pubkey == null || $pubkey == '') {
|
||||
die ("To use reCAPTCHA you must get an API key from <a href='https://www.google.com/recaptcha/admin/create'>https://www.google.com/recaptcha/admin/create</a>");
|
||||
}
|
||||
|
||||
if ($use_ssl) {
|
||||
$server = RECAPTCHA_API_SECURE_SERVER;
|
||||
} else {
|
||||
$server = RECAPTCHA_API_SERVER;
|
||||
}
|
||||
|
||||
$errorpart = "";
|
||||
if ($error) {
|
||||
$errorpart = "&error=" . $error;
|
||||
}
|
||||
return '<script type="text/javascript" src="'. $server . '/challenge?k=' . $pubkey . $errorpart . '"></script>
|
||||
|
||||
<noscript>
|
||||
<iframe src="'. $server . '/noscript?k=' . $pubkey . $errorpart . '" height="300" width="500" frameborder="0"></iframe><br/>
|
||||
<textarea name="recaptcha_challenge_field" rows="3" cols="40"></textarea>
|
||||
<input type="hidden" name="recaptcha_response_field" value="manual_challenge"/>
|
||||
</noscript>';
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* A ReCaptchaResponse is returned from recaptcha_check_answer()
|
||||
*/
|
||||
class ReCaptchaResponse {
|
||||
var $is_valid;
|
||||
var $error;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Calls an HTTP POST function to verify if the user's guess was correct
|
||||
* @param string $privkey
|
||||
* @param string $remoteip
|
||||
* @param string $challenge
|
||||
* @param string $response
|
||||
* @param array $extra_params an array of extra variables to post to the server
|
||||
* @return ReCaptchaResponse
|
||||
*/
|
||||
function recaptcha_check_answer ($privkey, $remoteip, $challenge, $response, $extra_params = array())
|
||||
{
|
||||
if ($privkey == null || $privkey == '') {
|
||||
die ("To use reCAPTCHA you must get an API key from <a href='https://www.google.com/recaptcha/admin/create'>https://www.google.com/recaptcha/admin/create</a>");
|
||||
}
|
||||
|
||||
if ($remoteip == null || $remoteip == '') {
|
||||
die ("For security reasons, you must pass the remote ip to reCAPTCHA");
|
||||
}
|
||||
|
||||
|
||||
|
||||
//discard spam submissions
|
||||
if ($challenge == null || strlen($challenge) == 0 || $response == null || strlen($response) == 0) {
|
||||
$recaptcha_response = new ReCaptchaResponse();
|
||||
$recaptcha_response->is_valid = false;
|
||||
$recaptcha_response->error = 'incorrect-captcha-sol';
|
||||
return $recaptcha_response;
|
||||
}
|
||||
|
||||
$response = _recaptcha_http_post (RECAPTCHA_VERIFY_SERVER, "/recaptcha/api/verify",
|
||||
array (
|
||||
'privatekey' => $privkey,
|
||||
'remoteip' => $remoteip,
|
||||
'challenge' => $challenge,
|
||||
'response' => $response
|
||||
) + $extra_params
|
||||
);
|
||||
|
||||
$answers = explode ("\n", $response [1]);
|
||||
$recaptcha_response = new ReCaptchaResponse();
|
||||
|
||||
if (trim ($answers [0]) == 'true') {
|
||||
$recaptcha_response->is_valid = true;
|
||||
}
|
||||
else {
|
||||
$recaptcha_response->is_valid = false;
|
||||
$recaptcha_response->error = $answers [1];
|
||||
}
|
||||
return $recaptcha_response;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* gets a URL where the user can sign up for reCAPTCHA. If your application
|
||||
* has a configuration page where you enter a key, you should provide a link
|
||||
* using this function.
|
||||
* @param string $domain The domain where the page is hosted
|
||||
* @param string $appname The name of your application
|
||||
*/
|
||||
function recaptcha_get_signup_url ($domain = null, $appname = null) {
|
||||
return "https://www.google.com/recaptcha/admin/create?" . _recaptcha_qsencode (array ('domains' => $domain, 'app' => $appname));
|
||||
}
|
||||
|
||||
function _recaptcha_aes_pad($val) {
|
||||
$block_size = 16;
|
||||
$numpad = $block_size - (strlen ($val) % $block_size);
|
||||
return str_pad($val, strlen ($val) + $numpad, chr($numpad));
|
||||
}
|
||||
|
||||
/* Mailhide related code */
|
||||
|
||||
function _recaptcha_aes_encrypt($val,$ky) {
|
||||
if (! function_exists ("mcrypt_encrypt")) {
|
||||
die ("To use reCAPTCHA Mailhide, you need to have the mcrypt php module installed.");
|
||||
}
|
||||
$mode=MCRYPT_MODE_CBC;
|
||||
$enc=MCRYPT_RIJNDAEL_128;
|
||||
$val=_recaptcha_aes_pad($val);
|
||||
return mcrypt_encrypt($enc, $ky, $val, $mode, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0");
|
||||
}
|
||||
|
||||
|
||||
function _recaptcha_mailhide_urlbase64 ($x) {
|
||||
return strtr(base64_encode ($x), '+/', '-_');
|
||||
}
|
||||
|
||||
/* gets the reCAPTCHA Mailhide url for a given email, public key and private key */
|
||||
function recaptcha_mailhide_url($pubkey, $privkey, $email) {
|
||||
if ($pubkey == '' || $pubkey == null || $privkey == "" || $privkey == null) {
|
||||
die ("To use reCAPTCHA Mailhide, you have to sign up for a public and private key, " .
|
||||
"you can do so at <a href='http://www.google.com/recaptcha/mailhide/apikey'>http://www.google.com/recaptcha/mailhide/apikey</a>");
|
||||
}
|
||||
|
||||
|
||||
$ky = pack('H*', $privkey);
|
||||
$cryptmail = _recaptcha_aes_encrypt ($email, $ky);
|
||||
|
||||
return "http://www.google.com/recaptcha/mailhide/d?k=" . $pubkey . "&c=" . _recaptcha_mailhide_urlbase64 ($cryptmail);
|
||||
}
|
||||
|
||||
/**
|
||||
* gets the parts of the email to expose to the user.
|
||||
* eg, given johndoe@example,com return ["john", "example.com"].
|
||||
* the email is then displayed as john...@example.com
|
||||
*/
|
||||
function _recaptcha_mailhide_email_parts ($email) {
|
||||
$arr = preg_split("/@/", $email );
|
||||
|
||||
if (strlen ($arr[0]) <= 4) {
|
||||
$arr[0] = substr ($arr[0], 0, 1);
|
||||
} else if (strlen ($arr[0]) <= 6) {
|
||||
$arr[0] = substr ($arr[0], 0, 3);
|
||||
} else {
|
||||
$arr[0] = substr ($arr[0], 0, 4);
|
||||
}
|
||||
return $arr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets html to display an email address given a public an private key.
|
||||
* to get a key, go to:
|
||||
*
|
||||
* http://www.google.com/recaptcha/mailhide/apikey
|
||||
*/
|
||||
function recaptcha_mailhide_html($pubkey, $privkey, $email) {
|
||||
$emailparts = _recaptcha_mailhide_email_parts ($email);
|
||||
$url = recaptcha_mailhide_url ($pubkey, $privkey, $email);
|
||||
|
||||
return htmlentities($emailparts[0]) . "<a href='" . htmlentities ($url) .
|
||||
"' onclick=\"window.open('" . htmlentities ($url) . "', '', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=500,height=300'); return false;\" title=\"Reveal this e-mail address\">...</a>@" . htmlentities ($emailparts [1]);
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
647
administrator/components/com_k2/models/categories.php
Normal file
647
administrator/components/com_k2/models/categories.php
Normal file
@@ -0,0 +1,647 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: categories.php 1937 2013-03-07 15:19:16Z lefteris.kavadas $
|
||||
* @package K2
|
||||
* @author JoomlaWorks http://www.joomlaworks.net
|
||||
* @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.
|
||||
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die ;
|
||||
|
||||
jimport('joomla.application.component.model');
|
||||
|
||||
JTable::addIncludePath(JPATH_COMPONENT.DS.'tables');
|
||||
|
||||
class K2ModelCategories extends K2Model
|
||||
{
|
||||
|
||||
function getData()
|
||||
{
|
||||
|
||||
$mainframe = JFactory::getApplication();
|
||||
$option = JRequest::getCmd('option');
|
||||
$view = JRequest::getCmd('view');
|
||||
$db = JFactory::getDBO();
|
||||
$limit = $mainframe->getUserStateFromRequest('global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int');
|
||||
$limitstart = $mainframe->getUserStateFromRequest($option.$view.'.limitstart', 'limitstart', 0, 'int');
|
||||
$search = $mainframe->getUserStateFromRequest($option.$view.'search', 'search', '', 'string');
|
||||
$search = JString::strtolower($search);
|
||||
$filter_order = $mainframe->getUserStateFromRequest($option.$view.'filter_order', 'filter_order', 'c.ordering', 'cmd');
|
||||
$filter_order_Dir = $mainframe->getUserStateFromRequest($option.$view.'filter_order_Dir', 'filter_order_Dir', '', 'word');
|
||||
$filter_trash = $mainframe->getUserStateFromRequest($option.$view.'filter_trash', 'filter_trash', 0, 'int');
|
||||
$filter_state = $mainframe->getUserStateFromRequest($option.$view.'filter_state', 'filter_state', -1, 'int');
|
||||
$language = $mainframe->getUserStateFromRequest($option.$view.'language', 'language', '', 'string');
|
||||
$filter_category = $mainframe->getUserStateFromRequest($option.$view.'filter_category', 'filter_category', 0, 'int');
|
||||
|
||||
$query = "SELECT c.*, g.name AS groupname, exfg.name as extra_fields_group FROM #__k2_categories as c LEFT JOIN #__groups AS g ON g.id = c.access LEFT JOIN #__k2_extra_fields_groups AS exfg ON exfg.id = c.extraFieldsGroup WHERE c.id>0";
|
||||
|
||||
if (!$filter_trash)
|
||||
{
|
||||
$query .= " AND c.trash=0";
|
||||
}
|
||||
|
||||
if ($search)
|
||||
{
|
||||
$escaped = K2_JVERSION == '15' ? $db->getEscaped($search, true) : $db->escape($search, true);
|
||||
$query .= " AND LOWER( c.name ) LIKE ".$db->Quote('%'.$escaped.'%', false);
|
||||
}
|
||||
|
||||
if ($filter_state > -1)
|
||||
{
|
||||
$query .= " AND c.published={$filter_state}";
|
||||
}
|
||||
if ($language)
|
||||
{
|
||||
$query .= " AND (c.language = ".$db->Quote($language)." OR c.language = '*')";
|
||||
}
|
||||
|
||||
if ($filter_category)
|
||||
{
|
||||
K2Model::addIncludePath(JPATH_SITE.DS.'components'.DS.'com_k2'.DS.'models');
|
||||
$ItemlistModel = K2Model::getInstance('Itemlist', 'K2Model');
|
||||
$tree = $ItemlistModel->getCategoryTree($filter_category);
|
||||
$query .= " AND c.id IN (".implode(',', $tree).")";
|
||||
}
|
||||
|
||||
$query .= " ORDER BY {$filter_order} {$filter_order_Dir}";
|
||||
|
||||
if (K2_JVERSION != '15')
|
||||
{
|
||||
$query = JString::str_ireplace('#__groups', '#__viewlevels', $query);
|
||||
$query = JString::str_ireplace('g.name AS groupname', 'g.title AS groupname', $query);
|
||||
}
|
||||
|
||||
$db->setQuery($query);
|
||||
$rows = $db->loadObjectList();
|
||||
if (K2_JVERSION != '15')
|
||||
{
|
||||
foreach ($rows as $row)
|
||||
{
|
||||
$row->parent_id = $row->parent;
|
||||
$row->title = $row->name;
|
||||
}
|
||||
}
|
||||
$categories = array();
|
||||
|
||||
if ($search)
|
||||
{
|
||||
foreach ($rows as $row)
|
||||
{
|
||||
$row->treename = $row->name;
|
||||
$categories[] = $row;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($filter_category)
|
||||
{
|
||||
$db->setQuery('SELECT parent FROM #__k2_categories WHERE id = '.$filter_category);
|
||||
$root = $db->loadResult();
|
||||
}
|
||||
else
|
||||
{
|
||||
$root = 0;
|
||||
}
|
||||
$categories = $this->indentRows($rows, $root);
|
||||
}
|
||||
if (isset($categories))
|
||||
{
|
||||
$total = count($categories);
|
||||
}
|
||||
else
|
||||
{
|
||||
$total = 0;
|
||||
}
|
||||
jimport('joomla.html.pagination');
|
||||
$pageNav = new JPagination($total, $limitstart, $limit);
|
||||
$categories = @array_slice($categories, $pageNav->limitstart, $pageNav->limit);
|
||||
foreach ($categories as $category)
|
||||
{
|
||||
$category->parameters = class_exists('JParameter') ? new JParameter($category->params) : new JRegistry($category->params);
|
||||
if ($category->parameters->get('inheritFrom'))
|
||||
{
|
||||
$db->setQuery("SELECT name FROM #__k2_categories WHERE id = ".(int)$category->parameters->get('inheritFrom'));
|
||||
$category->inheritFrom = $db->loadResult();
|
||||
}
|
||||
else
|
||||
{
|
||||
$category->inheritFrom = '';
|
||||
}
|
||||
}
|
||||
return $categories;
|
||||
}
|
||||
|
||||
function getTotal()
|
||||
{
|
||||
|
||||
$mainframe = JFactory::getApplication();
|
||||
$option = JRequest::getCmd('option');
|
||||
$view = JRequest::getCmd('view');
|
||||
$db = JFactory::getDBO();
|
||||
$limit = $mainframe->getUserStateFromRequest('global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int');
|
||||
$limitstart = $mainframe->getUserStateFromRequest($option.'.limitstart', 'limitstart', 0, 'int');
|
||||
$search = $mainframe->getUserStateFromRequest($option.$view.'search', 'search', '', 'string');
|
||||
$search = JString::strtolower($search);
|
||||
$filter_trash = $mainframe->getUserStateFromRequest($option.$view.'filter_trash', 'filter_trash', 0, 'int');
|
||||
$filter_state = $mainframe->getUserStateFromRequest($option.$view.'filter_state', 'filter_state', 1, 'int');
|
||||
$language = $mainframe->getUserStateFromRequest($option.$view.'language', 'language', '', 'string');
|
||||
$filter_category = $mainframe->getUserStateFromRequest($option.$view.'filter_category', 'filter_category', 0, 'int');
|
||||
|
||||
$query = "SELECT COUNT(*) FROM #__k2_categories WHERE id>0";
|
||||
|
||||
if (!$filter_trash)
|
||||
{
|
||||
$query .= " AND trash=0";
|
||||
}
|
||||
|
||||
if ($search)
|
||||
{
|
||||
$escaped = K2_JVERSION == '15' ? $db->getEscaped($search, true) : $db->escape($search, true);
|
||||
$query .= " AND LOWER( name ) LIKE ".$db->Quote('%'.$escaped.'%', false);
|
||||
}
|
||||
|
||||
if ($filter_state > -1)
|
||||
{
|
||||
$query .= " AND published={$filter_state}";
|
||||
}
|
||||
|
||||
if ($language)
|
||||
{
|
||||
$query .= " AND (language = ".$db->Quote($language)." OR language = '*')";
|
||||
}
|
||||
|
||||
if ($filter_category)
|
||||
{
|
||||
K2Model::addIncludePath(JPATH_SITE.DS.'components'.DS.'com_k2'.DS.'models');
|
||||
$ItemlistModel = K2Model::getInstance('Itemlist', 'K2Model');
|
||||
$tree = $ItemlistModel->getCategoryTree($filter_category);
|
||||
$query .= " AND id IN (".implode(',', $tree).")";
|
||||
}
|
||||
|
||||
$db->setQuery($query);
|
||||
$total = $db->loadResult();
|
||||
return $total;
|
||||
|
||||
}
|
||||
|
||||
function indentRows(&$rows, $root = 0)
|
||||
{
|
||||
$children = array();
|
||||
if (count($rows))
|
||||
{
|
||||
foreach ($rows as $v)
|
||||
{
|
||||
$pt = $v->parent;
|
||||
$list = @$children[$pt] ? $children[$pt] : array();
|
||||
array_push($list, $v);
|
||||
$children[$pt] = $list;
|
||||
}
|
||||
}
|
||||
$categories = JHTML::_('menu.treerecurse', $root, '', array(), $children);
|
||||
return $categories;
|
||||
}
|
||||
|
||||
function publish()
|
||||
{
|
||||
|
||||
$mainframe = JFactory::getApplication();
|
||||
$cid = JRequest::getVar('cid');
|
||||
foreach ($cid as $id)
|
||||
{
|
||||
$row = JTable::getInstance('K2Category', 'Table');
|
||||
$row->load($id);
|
||||
$row->publish($id, 1);
|
||||
}
|
||||
JPluginHelper::importPlugin('finder');
|
||||
$dispatcher = JDispatcher::getInstance();
|
||||
$dispatcher->trigger('onFinderChangeState', array('com_k2.category', $cid, 1));
|
||||
$cache = JFactory::getCache('com_k2');
|
||||
$cache->clean();
|
||||
$mainframe->redirect('index.php?option=com_k2&view=categories');
|
||||
}
|
||||
|
||||
function unpublish()
|
||||
{
|
||||
|
||||
$mainframe = JFactory::getApplication();
|
||||
$cid = JRequest::getVar('cid');
|
||||
foreach ($cid as $id)
|
||||
{
|
||||
$row = JTable::getInstance('K2Category', 'Table');
|
||||
$row->load($id);
|
||||
$row->publish($id, 0);
|
||||
}
|
||||
JPluginHelper::importPlugin('finder');
|
||||
$dispatcher = JDispatcher::getInstance();
|
||||
$dispatcher->trigger('onFinderChangeState', array('com_k2.category', $cid, 0));
|
||||
$cache = JFactory::getCache('com_k2');
|
||||
$cache->clean();
|
||||
$mainframe->redirect('index.php?option=com_k2&view=categories');
|
||||
}
|
||||
|
||||
function saveorder()
|
||||
{
|
||||
|
||||
$mainframe = JFactory::getApplication();
|
||||
$db = JFactory::getDBO();
|
||||
$cid = JRequest::getVar('cid', array(0), 'post', 'array');
|
||||
$total = count($cid);
|
||||
$order = JRequest::getVar('order', array(0), 'post', 'array');
|
||||
JArrayHelper::toInteger($order, array(0));
|
||||
$groupings = array();
|
||||
for ($i = 0; $i < $total; $i++)
|
||||
{
|
||||
$row = JTable::getInstance('K2Category', 'Table');
|
||||
$row->load(( int )$cid[$i]);
|
||||
$groupings[] = $row->parent;
|
||||
if ($row->ordering != $order[$i])
|
||||
{
|
||||
$row->ordering = $order[$i];
|
||||
if (!$row->store())
|
||||
{
|
||||
JError::raiseError(500, $db->getErrorMsg());
|
||||
}
|
||||
}
|
||||
}
|
||||
$params = JComponentHelper::getParams('com_k2');
|
||||
if (!$params->get('disableCompactOrdering'))
|
||||
{
|
||||
$groupings = array_unique($groupings);
|
||||
foreach ($groupings as $group)
|
||||
{
|
||||
$row = JTable::getInstance('K2Category', 'Table');
|
||||
$row->reorder('parent = '.( int )$group.' AND trash=0');
|
||||
}
|
||||
}
|
||||
$cache = JFactory::getCache('com_k2');
|
||||
$cache->clean();
|
||||
return true;
|
||||
}
|
||||
|
||||
function orderup()
|
||||
{
|
||||
|
||||
$mainframe = JFactory::getApplication();
|
||||
$cid = JRequest::getVar('cid');
|
||||
$row = JTable::getInstance('K2Category', 'Table');
|
||||
$row->load($cid[0]);
|
||||
$row->move(-1, 'parent = '.$row->parent.' AND trash=0');
|
||||
$params = JComponentHelper::getParams('com_k2');
|
||||
if (!$params->get('disableCompactOrdering'))
|
||||
$row->reorder('parent = '.$row->parent.' AND trash=0');
|
||||
$cache = JFactory::getCache('com_k2');
|
||||
$cache->clean();
|
||||
$msg = JText::_('K2_NEW_ORDERING_SAVED');
|
||||
$mainframe->redirect('index.php?option=com_k2&view=categories', $msg);
|
||||
}
|
||||
|
||||
function orderdown()
|
||||
{
|
||||
|
||||
$mainframe = JFactory::getApplication();
|
||||
$cid = JRequest::getVar('cid');
|
||||
$row = JTable::getInstance('K2Category', 'Table');
|
||||
$row->load($cid[0]);
|
||||
$row->move(1, 'parent = '.$row->parent.' AND trash=0');
|
||||
$params = JComponentHelper::getParams('com_k2');
|
||||
if (!$params->get('disableCompactOrdering'))
|
||||
$row->reorder('parent = '.$row->parent.' AND trash=0');
|
||||
$cache = JFactory::getCache('com_k2');
|
||||
$cache->clean();
|
||||
$msg = JText::_('K2_NEW_ORDERING_SAVED');
|
||||
$mainframe->redirect('index.php?option=com_k2&view=categories', $msg);
|
||||
}
|
||||
|
||||
function accessregistered()
|
||||
{
|
||||
|
||||
$mainframe = JFactory::getApplication();
|
||||
$db = JFactory::getDBO();
|
||||
$row = JTable::getInstance('K2Category', 'Table');
|
||||
$cid = JRequest::getVar('cid');
|
||||
$row->load($cid[0]);
|
||||
$row->access = 1;
|
||||
if (!$row->check())
|
||||
{
|
||||
return $row->getError();
|
||||
}
|
||||
if (!$row->store())
|
||||
{
|
||||
return $row->getError();
|
||||
}
|
||||
$cache = JFactory::getCache('com_k2');
|
||||
$cache->clean();
|
||||
$msg = JText::_('K2_NEW_ACCESS_SETTING_SAVED');
|
||||
$mainframe->redirect('index.php?option=com_k2&view=categories', $msg);
|
||||
}
|
||||
|
||||
function accessspecial()
|
||||
{
|
||||
|
||||
$mainframe = JFactory::getApplication();
|
||||
$db = JFactory::getDBO();
|
||||
$row = JTable::getInstance('K2Category', 'Table');
|
||||
$cid = JRequest::getVar('cid');
|
||||
$row->load($cid[0]);
|
||||
$row->access = 2;
|
||||
if (!$row->check())
|
||||
{
|
||||
return $row->getError();
|
||||
}
|
||||
if (!$row->store())
|
||||
{
|
||||
return $row->getError();
|
||||
}
|
||||
$cache = JFactory::getCache('com_k2');
|
||||
$cache->clean();
|
||||
$msg = JText::_('K2_NEW_ACCESS_SETTING_SAVED');
|
||||
$mainframe->redirect('index.php?option=com_k2&view=categories', $msg);
|
||||
}
|
||||
|
||||
function accesspublic()
|
||||
{
|
||||
|
||||
$mainframe = JFactory::getApplication();
|
||||
$db = JFactory::getDBO();
|
||||
$row = JTable::getInstance('K2Category', 'Table');
|
||||
$cid = JRequest::getVar('cid');
|
||||
$row->load($cid[0]);
|
||||
$row->access = 0;
|
||||
if (!$row->check())
|
||||
{
|
||||
return $row->getError();
|
||||
}
|
||||
if (!$row->store())
|
||||
{
|
||||
return $row->getError();
|
||||
}
|
||||
$cache = JFactory::getCache('com_k2');
|
||||
$cache->clean();
|
||||
$msg = JText::_('K2_NEW_ACCESS_SETTING_SAVED');
|
||||
$mainframe->redirect('index.php?option=com_k2&view=categories', $msg);
|
||||
}
|
||||
|
||||
function trash()
|
||||
{
|
||||
|
||||
$mainframe = JFactory::getApplication();
|
||||
$db = JFactory::getDBO();
|
||||
$cid = JRequest::getVar('cid');
|
||||
$row = JTable::getInstance('K2Category', 'Table');
|
||||
JArrayHelper::toInteger($cid);
|
||||
K2Model::addIncludePath(JPATH_SITE.DS.'components'.DS.'com_k2'.DS.'models');
|
||||
$model = K2Model::getInstance('Itemlist', 'K2Model');
|
||||
$categories = $model->getCategoryTree($cid);
|
||||
$sql = @implode(',', $categories);
|
||||
$db = JFactory::getDBO();
|
||||
$query = "UPDATE #__k2_categories SET trash=1 WHERE id IN ({$sql})";
|
||||
$db->setQuery($query);
|
||||
$db->query();
|
||||
$query = "UPDATE #__k2_items SET trash=1 WHERE catid IN ({$sql})";
|
||||
$db->setQuery($query);
|
||||
$db->query();
|
||||
|
||||
$cache = JFactory::getCache('com_k2');
|
||||
$cache->clean();
|
||||
$mainframe->redirect('index.php?option=com_k2&view=categories', JText::_('K2_CATEGORIES_MOVED_TO_TRASH'));
|
||||
|
||||
}
|
||||
|
||||
function restore()
|
||||
{
|
||||
|
||||
$mainframe = JFactory::getApplication();
|
||||
$db = JFactory::getDBO();
|
||||
$cid = JRequest::getVar('cid');
|
||||
$warning = false;
|
||||
$restored = array();
|
||||
foreach ($cid as $id)
|
||||
{
|
||||
$row = JTable::getInstance('K2Category', 'Table');
|
||||
$row->load($id);
|
||||
if ((int)$row->parent == 0)
|
||||
{
|
||||
$row->trash = 0;
|
||||
$row->store();
|
||||
$restored[] = $id;
|
||||
}
|
||||
else
|
||||
{
|
||||
$query = "SELECT COUNT(*) FROM #__k2_categories WHERE id={$row->parent} AND trash = 0";
|
||||
$db->setQuery($query);
|
||||
$result = $db->loadResult();
|
||||
if ($result)
|
||||
{
|
||||
$row->trash = 0;
|
||||
$row->store();
|
||||
$restored[] = $id;
|
||||
}
|
||||
else
|
||||
{
|
||||
$warning = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
// Restore also the items of the categories
|
||||
if (count($restored))
|
||||
{
|
||||
JArrayHelper::toInteger($restored);
|
||||
$db->setQuery('UPDATE #__k2_items SET trash = 0 WHERE catid IN ('.implode(',', $restored).') AND trash = 1');
|
||||
$db->query();
|
||||
}
|
||||
$cache = JFactory::getCache('com_k2');
|
||||
$cache->clean();
|
||||
if ($warning)
|
||||
$mainframe->enqueueMessage(JText::_('K2_SOME_OF_THE_CATEGORIES_HAVE_NOT_BEEN_RESTORED_BECAUSE_THEIR_PARENT_CATEGORY_IS_IN_TRASH'), 'notice');
|
||||
$mainframe->redirect('index.php?option=com_k2&view=categories', JText::_('K2_CATEGORIES_RESTORED'));
|
||||
|
||||
}
|
||||
|
||||
function remove()
|
||||
{
|
||||
|
||||
$mainframe = JFactory::getApplication();
|
||||
jimport('joomla.filesystem.file');
|
||||
$db = JFactory::getDBO();
|
||||
$cid = JRequest::getVar('cid');
|
||||
JArrayHelper::toInteger($cid);
|
||||
JPluginHelper::importPlugin('finder');
|
||||
$dispatcher = JDispatcher::getInstance();
|
||||
$warningItems = false;
|
||||
$warningChildren = false;
|
||||
$cid = array_reverse($cid);
|
||||
for ($i = 0; $i < sizeof($cid); $i++)
|
||||
{
|
||||
$row = JTable::getInstance('K2Category', 'Table');
|
||||
$row->load($cid[$i]);
|
||||
|
||||
$query = "SELECT COUNT(*) FROM #__k2_items WHERE catid={$cid[$i]}";
|
||||
$db->setQuery($query);
|
||||
$num = $db->loadResult();
|
||||
|
||||
if ($num > 0)
|
||||
{
|
||||
$warningItems = true;
|
||||
}
|
||||
|
||||
$query = "SELECT COUNT(*) FROM #__k2_categories WHERE parent={$cid[$i]}";
|
||||
$db->setQuery($query);
|
||||
$children = $db->loadResult();
|
||||
|
||||
if ($children > 0)
|
||||
{
|
||||
$warningChildren = true;
|
||||
}
|
||||
|
||||
if ($children == 0 && $num == 0)
|
||||
{
|
||||
|
||||
if ($row->image)
|
||||
{
|
||||
JFile::delete(JPATH_ROOT.DS.'media'.DS.'k2'.DS.'categories'.DS.$row->image);
|
||||
}
|
||||
$row->delete($cid[$i]);
|
||||
$dispatcher->trigger('onFinderAfterDelete', array('com_k2.category', $row));
|
||||
|
||||
}
|
||||
}
|
||||
$cache = JFactory::getCache('com_k2');
|
||||
$cache->clean();
|
||||
|
||||
if ($warningItems)
|
||||
{
|
||||
$mainframe->enqueueMessage(JText::_('K2_SOME_OF_THE_CATEGORIES_HAVE_NOT_BEEN_DELETED_BECAUSE_THEY_HAVE_ITEMS'), 'notice');
|
||||
}
|
||||
if ($warningChildren)
|
||||
{
|
||||
$mainframe->enqueueMessage(JText::_('K2_SOME_OF_THE_CATEGORIES_HAVE_NOT_BEEN_DELETED_BECAUSE_THEY_HAVE_CHILD_CATEGORIES'), 'notice');
|
||||
}
|
||||
|
||||
$mainframe->redirect('index.php?option=com_k2&view=categories', JText::_('K2_DELETE_COMPLETED'));
|
||||
}
|
||||
|
||||
function categoriesTree($row = NULL, $hideTrashed = false, $hideUnpublished = true)
|
||||
{
|
||||
|
||||
$db = JFactory::getDBO();
|
||||
if (isset($row->id))
|
||||
{
|
||||
$idCheck = ' AND id != '.( int )$row->id;
|
||||
}
|
||||
else
|
||||
{
|
||||
$idCheck = null;
|
||||
}
|
||||
if (!isset($row->parent))
|
||||
{
|
||||
if (is_null($row))
|
||||
{
|
||||
$row = new stdClass;
|
||||
}
|
||||
$row->parent = 0;
|
||||
}
|
||||
$query = "SELECT m.* FROM #__k2_categories m WHERE id > 0 {$idCheck}";
|
||||
|
||||
if ($hideUnpublished)
|
||||
{
|
||||
$query .= " AND published=1 ";
|
||||
}
|
||||
|
||||
if ($hideTrashed)
|
||||
{
|
||||
$query .= " AND trash=0 ";
|
||||
}
|
||||
|
||||
$query .= " ORDER BY parent, ordering";
|
||||
$db->setQuery($query);
|
||||
$mitems = $db->loadObjectList();
|
||||
$children = array();
|
||||
if ($mitems)
|
||||
{
|
||||
foreach ($mitems as $v)
|
||||
{
|
||||
if (K2_JVERSION != '15')
|
||||
{
|
||||
$v->title = $v->name;
|
||||
$v->parent_id = $v->parent;
|
||||
}
|
||||
$pt = $v->parent;
|
||||
$list = @$children[$pt] ? $children[$pt] : array();
|
||||
array_push($list, $v);
|
||||
$children[$pt] = $list;
|
||||
}
|
||||
}
|
||||
$list = JHTML::_('menu.treerecurse', 0, '', array(), $children, 9999, 0, 0);
|
||||
$mitems = array();
|
||||
foreach ($list as $item)
|
||||
{
|
||||
$item->treename = JString::str_ireplace(' ', '- ', $item->treename);
|
||||
|
||||
if ($item->trash)
|
||||
$item->treename .= ' [**'.JText::_('K2_TRASHED_CATEGORY').'**]';
|
||||
if (!$item->published)
|
||||
$item->treename .= ' [**'.JText::_('K2_UNPUBLISHED_CATEGORY').'**]';
|
||||
|
||||
$mitems[] = JHTML::_('select.option', $item->id, $item->treename);
|
||||
}
|
||||
return $mitems;
|
||||
}
|
||||
|
||||
function copy()
|
||||
{
|
||||
jimport('joomla.filesystem.file');
|
||||
$mainframe = JFactory::getApplication();
|
||||
$cid = JRequest::getVar('cid');
|
||||
JArrayHelper::toInteger($cid);
|
||||
foreach ($cid as $id)
|
||||
{
|
||||
//Load source category
|
||||
$category = JTable::getInstance('K2Category', 'Table');
|
||||
$category->load($id);
|
||||
|
||||
//Save target category
|
||||
$row = JTable::getInstance('K2Category', 'Table');
|
||||
$row = $category;
|
||||
$row->id = NULL;
|
||||
$row->name = JText::_('K2_COPY_OF').' '.$category->name;
|
||||
$row->published = 0;
|
||||
$row->store();
|
||||
//Target image
|
||||
if ($category->image && JFile::exists(JPATH_SITE.DS.'media'.DS.'k2'.DS.'categories'.DS.$category->image))
|
||||
{
|
||||
JFile::copy(JPATH_SITE.DS.'media'.DS.'k2'.DS.'categories'.DS.$category->image, JPATH_SITE.DS.'media'.DS.'k2'.DS.'categories'.DS.$row->id.'.jpg');
|
||||
$row->image = $row->id.'.jpg';
|
||||
$row->store();
|
||||
}
|
||||
}
|
||||
|
||||
$mainframe->redirect('index.php?option=com_k2&view=categories', JText::_('K2_COPY_COMPLETED'));
|
||||
}
|
||||
|
||||
function move()
|
||||
{
|
||||
|
||||
$mainframe = JFactory::getApplication();
|
||||
$cid = JRequest::getVar('cid');
|
||||
$catid = JRequest::getInt('category');
|
||||
|
||||
foreach ($cid as $id)
|
||||
{
|
||||
$row = JTable::getInstance('K2Category', 'Table');
|
||||
$row->load($id);
|
||||
$row->parent = $catid;
|
||||
$row->ordering = $row->getNextOrder('parent = '.$row->parent.' AND published = 1');
|
||||
$row->store();
|
||||
}
|
||||
$cache = JFactory::getCache('com_k2');
|
||||
$cache->clean();
|
||||
$mainframe->redirect('index.php?option=com_k2&view=categories', JText::_('K2_MOVE_COMPLETED'));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
170
administrator/components/com_k2/models/category.php
Normal file
170
administrator/components/com_k2/models/category.php
Normal file
@@ -0,0 +1,170 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: category.php 1812 2013-01-14 18:45:06Z lefteris.kavadas $
|
||||
* @package K2
|
||||
* @author JoomlaWorks http://www.joomlaworks.net
|
||||
* @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.
|
||||
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
jimport('joomla.application.component.model');
|
||||
|
||||
JTable::addIncludePath(JPATH_COMPONENT.DS.'tables');
|
||||
|
||||
class K2ModelCategory extends K2Model
|
||||
{
|
||||
|
||||
function getData()
|
||||
{
|
||||
$cid = JRequest::getVar('cid');
|
||||
$row = JTable::getInstance('K2Category', 'Table');
|
||||
$row->load($cid);
|
||||
return $row;
|
||||
}
|
||||
|
||||
function save()
|
||||
{
|
||||
$mainframe = JFactory::getApplication();
|
||||
jimport('joomla.filesystem.file');
|
||||
require_once (JPATH_COMPONENT.DS.'lib'.DS.'class.upload.php');
|
||||
$row = JTable::getInstance('K2Category', 'Table');
|
||||
$params = JComponentHelper::getParams('com_k2');
|
||||
|
||||
if (!$row->bind(JRequest::get('post')))
|
||||
{
|
||||
$mainframe->redirect('index.php?option=com_k2&view=categories', $row->getError(), 'error');
|
||||
}
|
||||
|
||||
$isNew = ($row->id) ? false : true;
|
||||
|
||||
//Trigger the finder before save event
|
||||
$dispatcher = JDispatcher::getInstance();
|
||||
JPluginHelper::importPlugin('finder');
|
||||
$results = $dispatcher->trigger('onFinderBeforeSave', array('com_k2.category', $row, $isNew));
|
||||
|
||||
$row->description = JRequest::getVar('description', '', 'post', 'string', 2);
|
||||
if ($params->get('xssFiltering'))
|
||||
{
|
||||
$filter = new JFilterInput( array(), array(), 1, 1, 0);
|
||||
$row->description = $filter->clean($row->description);
|
||||
}
|
||||
|
||||
if (!$row->id)
|
||||
{
|
||||
$row->ordering = $row->getNextOrder('parent = '.$row->parent.' AND trash=0');
|
||||
}
|
||||
|
||||
if (!$row->check())
|
||||
{
|
||||
$mainframe->redirect('index.php?option=com_k2&view=category&cid='.$row->id, $row->getError(), 'error');
|
||||
}
|
||||
|
||||
if (!$row->store())
|
||||
{
|
||||
$mainframe->redirect('index.php?option=com_k2&view=categories', $row->getError(), 'error');
|
||||
}
|
||||
|
||||
if (!$params->get('disableCompactOrdering'))
|
||||
$row->reorder('parent = '.$row->parent.' AND trash=0');
|
||||
|
||||
if ((int)$params->get('imageMemoryLimit'))
|
||||
{
|
||||
ini_set('memory_limit', (int)$params->get('imageMemoryLimit').'M');
|
||||
}
|
||||
|
||||
$files = JRequest::get('files');
|
||||
|
||||
$savepath = JPATH_ROOT.DS.'media'.DS.'k2'.DS.'categories'.DS;
|
||||
|
||||
$existingImage = JRequest::getVar('existingImage');
|
||||
if (($files['image']['error'] === 0 || $existingImage) && !JRequest::getBool('del_image'))
|
||||
{
|
||||
if ($files['image']['error'] === 0)
|
||||
{
|
||||
$image = $files['image'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$image = JPATH_SITE.DS.JPath::clean($existingImage);
|
||||
}
|
||||
|
||||
$handle = new Upload($image);
|
||||
if ($handle->uploaded)
|
||||
{
|
||||
$handle->file_auto_rename = false;
|
||||
$handle->jpeg_quality = $params->get('imagesQuality', '85');
|
||||
$handle->file_overwrite = true;
|
||||
$handle->file_new_name_body = $row->id;
|
||||
$handle->image_resize = true;
|
||||
$handle->image_ratio_y = true;
|
||||
$handle->image_x = $params->get('catImageWidth', '100');
|
||||
$handle->Process($savepath);
|
||||
if ($files['image']['error'] === 0)
|
||||
$handle->Clean();
|
||||
}
|
||||
else
|
||||
{
|
||||
$mainframe->redirect('index.php?option=com_k2&view=categories', $handle->error, 'error');
|
||||
}
|
||||
$row->image = $handle->file_dst_name;
|
||||
}
|
||||
|
||||
if (JRequest::getBool('del_image'))
|
||||
{
|
||||
$currentRow = JTable::getInstance('K2Category', 'Table');
|
||||
$currentRow->load($row->id);
|
||||
if (JFile::exists(JPATH_ROOT.DS.'media'.DS.'k2'.DS.'categories'.DS.$currentRow->image))
|
||||
{
|
||||
JFile::delete(JPATH_ROOT.DS.'media'.DS.'k2'.DS.'categories'.DS.$currentRow->image);
|
||||
}
|
||||
$row->image = '';
|
||||
}
|
||||
|
||||
if (!$row->store())
|
||||
{
|
||||
$mainframe->redirect('index.php?option=com_k2&view=categories', $row->getError(), 'error');
|
||||
}
|
||||
|
||||
//Trigger the finder after save event
|
||||
$dispatcher = JDispatcher::getInstance();
|
||||
JPluginHelper::importPlugin('finder');
|
||||
$results = $dispatcher->trigger('onFinderAfterSave', array('com_k2.category', $row, $isNew));
|
||||
|
||||
$cache = JFactory::getCache('com_k2');
|
||||
$cache->clean();
|
||||
|
||||
switch(JRequest::getCmd('task'))
|
||||
{
|
||||
case 'apply' :
|
||||
$msg = JText::_('K2_CHANGES_TO_CATEGORY_SAVED');
|
||||
$link = 'index.php?option=com_k2&view=category&cid='.$row->id;
|
||||
break;
|
||||
case 'saveAndNew' :
|
||||
$msg = JText::_('K2_CATEGORY_SAVED');
|
||||
$link = 'index.php?option=com_k2&view=category';
|
||||
break;
|
||||
case 'save' :
|
||||
default :
|
||||
$msg = JText::_('K2_CATEGORY_SAVED');
|
||||
$link = 'index.php?option=com_k2&view=categories';
|
||||
break;
|
||||
}
|
||||
$mainframe->redirect($link, $msg);
|
||||
}
|
||||
|
||||
function countCategoryItems($catid, $trash = 0)
|
||||
{
|
||||
|
||||
$db = JFactory::getDBO();
|
||||
$catid = (int)$catid;
|
||||
$query = "SELECT COUNT(*) FROM #__k2_items WHERE catid={$catid} AND trash = ".(int)$trash;
|
||||
$db->setQuery($query);
|
||||
$result = $db->loadResult();
|
||||
return $result;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
938
administrator/components/com_k2/models/category.xml
Normal file
938
administrator/components/com_k2/models/category.xml
Normal file
@@ -0,0 +1,938 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<form>
|
||||
<name>K2_CATEGORY_EDIT_FORM</name>
|
||||
<params group="category-item-layout" addpath="/administrator/components/com_k2/elements">
|
||||
<param name="" type="header" default="K2_LAYOUT_TEMPLATE" label="" description=""/>
|
||||
<param name="theme" type="template" default="default" label="K2_SELECT_A_TEMPLATE"/>
|
||||
<param name="" type="header" default="K2_LAYOUT_GRID" label="" description=""/>
|
||||
<param name="num_leading_items" type="text" size="4" default="2" label="K2_LEADING_COUNT" description="K2_NUMBER_OF_ITEMS_TO_DISPLAY_AS_LEADING"/>
|
||||
<param name="num_leading_columns" type="text" size="4" default="1" label="K2_COLUMNS_FOR_LEADING" description=""/>
|
||||
<param name="leadingImgSize" type="list" default="Large" label="K2_IMAGE_SIZE_FOR_LEADING_ITEMS" description="K2_YOU_CAN_OVERRIDE_THE_GLOBAL_DIMENSIONS_FOR_EACH_SIZE_BY_ADJUSTING_THE_RELATED_SETTING_IN_THE_ITEM_IMAGE_OPTIONS_PANE_BELOW">
|
||||
<option value="XSmall">K2_XSMALL</option>
|
||||
<option value="Small">K2_SMALL</option>
|
||||
<option value="Medium">K2_MEDIUM</option>
|
||||
<option value="Large">K2_LARGE</option>
|
||||
<option value="XLarge">K2_XLARGE</option>
|
||||
<option value="none">K2_NO_IMAGE</option>
|
||||
</param>
|
||||
<param name="@spacer" type="spacer" default="" label="" description=""/>
|
||||
<param name="num_primary_items" type="text" size="4" default="4" label="K2_PRIMARY_COUNT" description="K2_NUMBER_OF_ITEMS_TO_DISPLAY_AS_PRIMARY"/>
|
||||
<param name="num_primary_columns" type="text" size="4" default="2" label="K2_COLUMNS_FOR_PRIMARY" description=""/>
|
||||
<param name="primaryImgSize" type="list" default="Medium" label="K2_IMAGE_SIZE_FOR_PRIMARY_ITEMS" description="K2_YOU_CAN_OVERRIDE_THE_GLOBAL_DIMENSIONS_FOR_EACH_SIZE_BY_ADJUSTING_THE_RELATED_SETTING_IN_THE_ITEM_IMAGE_OPTIONS_PANE_BELOW">
|
||||
<option value="XSmall">K2_XSMALL</option>
|
||||
<option value="Small">K2_SMALL</option>
|
||||
<option value="Medium">K2_MEDIUM</option>
|
||||
<option value="Large">K2_LARGE</option>
|
||||
<option value="XLarge">K2_XLARGE</option>
|
||||
<option value="none">K2_NO_IMAGE</option>
|
||||
</param>
|
||||
<param name="@spacer" type="spacer" default="" label="" description=""/>
|
||||
<param name="num_secondary_items" type="text" size="4" default="4" label="K2_SECONDARY_COUNT" description="K2_NUMBER_OF_ITEMS_TO_DISPLAY_AS_SECONDARY"/>
|
||||
<param name="num_secondary_columns" type="text" size="4" default="1" label="K2_COLUMNS_FOR_SECONDARY" description=""/>
|
||||
<param name="secondaryImgSize" type="list" default="Small" label="K2_IMAGE_SIZE_FOR_SECONDARY_ITEMS" description="K2_YOU_CAN_OVERRIDE_THE_GLOBAL_DIMENSIONS_FOR_EACH_SIZE_BY_ADJUSTING_THE_RELATED_SETTING_IN_THE_ITEM_IMAGE_OPTIONS_PANE_BELOW">
|
||||
<option value="XSmall">K2_XSMALL</option>
|
||||
<option value="Small">K2_SMALL</option>
|
||||
<option value="Medium">K2_MEDIUM</option>
|
||||
<option value="Large">K2_LARGE</option>
|
||||
<option value="XLarge">K2_XLARGE</option>
|
||||
<option value="none">K2_NO_IMAGE</option>
|
||||
</param>
|
||||
<param name="@spacer" type="spacer" default="" label="" description=""/>
|
||||
<param name="num_links" type="text" size="4" default="4" label="K2_LINKS_COUNT" description="K2_NUMBER_OF_ITEMS_TO_DISPLAY_AS_LINKS"/>
|
||||
<param name="num_links_columns" type="text" size="4" default="1" label="K2_COLUMNS_FOR_LINKS" description=""/>
|
||||
<param name="linksImgSize" type="list" default="XSmall" label="K2_IMAGE_SIZE_FOR_LINK_ITEMS" description="K2_YOU_CAN_OVERRIDE_THE_GLOBAL_DIMENSIONS_FOR_EACH_SIZE_BY_ADJUSTING_THE_RELATED_SETTING_IN_THE_ITEM_IMAGE_OPTIONS_PANE_BELOW">
|
||||
<option value="XSmall">K2_XSMALL</option>
|
||||
<option value="Small">K2_SMALL</option>
|
||||
<option value="Medium">K2_MEDIUM</option>
|
||||
<option value="Large">K2_LARGE</option>
|
||||
<option value="XLarge">K2_XLARGE</option>
|
||||
<option value="none">K2_NO_IMAGE</option>
|
||||
</param>
|
||||
<param name="" type="header" default="K2_OTHER_LAYOUT_OPTIONS" label="" description=""/>
|
||||
<param name="catCatalogMode" type="list" default="0" label="K2_CATALOG_MODE" description="K2_IF_YOU_SELECT_YES_THEN_ONLY_THE_ITEMS_DIRECTLY_BELONGING_TO_THIS_CATEGORY_WILL_BE_RETRIEVED_IF_YOU_SELECT_NO_THEN_ITEMS_FROM_ALL_SUBCATEGORIES_WILL_BE_RETRIEVED_SETTING_THIS_OPTION_TO_NO_IS_IDEAL_FOR_NEWSPORTALMAGAZINEBLOG_LAYOUTS">
|
||||
<option value="0">K2_NO</option>
|
||||
<option value="1">K2_YES</option>
|
||||
</param>
|
||||
<param name="catFeaturedItems" type="list" default="1" label="K2_FEATURED_ITEMS" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
<option value="2">K2_SHOW_ONLY_FEATURED_ITEMS</option>
|
||||
</param>
|
||||
<param name="catOrdering" type="list" default="" label="K2_ITEM_ORDERING" description="">
|
||||
<option value="">K2_DEFAULT</option>
|
||||
<option value="date">K2_OLDEST_FIRST</option>
|
||||
<option value="rdate">K2_MOST_RECENT_FIRST</option>
|
||||
<option value="publishUp">K2_RECENTLY_PUBLISHED</option>
|
||||
<option value="alpha">K2_TITLE_ALPHABETICAL</option>
|
||||
<option value="ralpha">K2_TITLE_REVERSEALPHABETICAL</option>
|
||||
<option value="order">K2_ORDERING</option>
|
||||
<option value="rorder">K2_ORDERING_REVERSE</option>
|
||||
<option value="featured">K2_FEATURED_FIRST</option>
|
||||
<option value="hits">K2_MOST_POPULAR</option>
|
||||
<option value="best">K2_HIGHEST_RATED</option>
|
||||
<option value="modified">K2_LATEST_MODIFIED</option>
|
||||
<option value="rand">K2_RANDOM_ORDERING</option>
|
||||
</param>
|
||||
<param name="catPagination" type="list" default="2" label="K2_PAGINATION" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
<option value="2">K2_AUTO</option>
|
||||
</param>
|
||||
<param name="catPaginationResults" type="radio" default="1" label="K2_PAGINATION_RESULTS" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
</params>
|
||||
<params group="category-view-options" addpath="/administrator/components/com_k2/elements">
|
||||
<param name="catTitle" type="radio" default="1" label="K2_TITLE" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="catTitleItemCounter" type="radio" default="1" label="K2_ITEM_COUNTER_NEXT_TO_TITLE" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="catDescription" type="radio" default="1" label="K2_DESCRIPTION" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="catImage" type="radio" default="1" label="K2_IMAGE" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="catFeedLink" type="radio" default="1" label="K2_RSS_FEED_LINK" description="">
|
||||
<option value="0">K2_DISABLE</option>
|
||||
<option value="1">K2_ENABLE</option>
|
||||
</param>
|
||||
<param name="catFeedIcon" type="radio" default="1" label="K2_RSS_FEED_ICON" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="" type="header" default="K2_SUBCATEGORY_HANDLING" label="" description=""/>
|
||||
<param name="subCategories" type="radio" default="1" label="K2_SUBCATEGORY_BLOCKS" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="subCatColumns" type="text" default="2" size="4" label="K2_COLUMNS" description=""/>
|
||||
<param name="subCatOrdering" type="list" default="" label="K2_SUBCATEGORY_ORDERING" description="">
|
||||
<option value="">K2_DEFAULT_BY_ID_ASCENDING</option>
|
||||
<option value="reversedefault">K2_REVERSE_DEFAULT_BY_ID_DESCENDING</option>
|
||||
<option value="alpha">K2_TITLE_ALPHABETICAL</option>
|
||||
<option value="ralpha">K2_TITLE_REVERSEALPHABETICAL</option>
|
||||
<option value="order">K2_ORDERING</option>
|
||||
</param>
|
||||
<param name="subCatTitle" type="radio" default="1" label="K2_SUBCATEGORY_TITLE" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="subCatTitleItemCounter" type="radio" default="1" label="K2_ITEM_COUNTER_NEXT_TO_SUBCATEGORY_TITLE" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="subCatDescription" type="radio" default="1" label="K2_SUBCATEGORY_DESCRIPTION" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="subCatImage" type="radio" default="1" label="K2_SUBCATEGORY_IMAGE" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
</params>
|
||||
<params group="item-image-options" addpath="/administrator/components/com_k2/elements">
|
||||
<param name="itemImageXS" type="text" default="" label="K2_XSMALL_IMAGE_WIDTH_IN_PX" size="4" description="K2_IF_NO_VALUE_IS_ENTERED_THE_RELATED_SETTING_FROM_THE_COMPONENTS_GLOBAL_PARAMETERS_WILL_BE_RETRIEVED"/>
|
||||
<param name="itemImageS" type="text" default="" label="K2_SMALL_IMAGE_WIDTH_IN_PX" size="4" description="K2_IF_NO_VALUE_IS_ENTERED_THE_RELATED_SETTING_FROM_THE_COMPONENTS_GLOBAL_PARAMETERS_WILL_BE_RETRIEVED"/>
|
||||
<param name="itemImageM" type="text" default="" label="K2_MEDIUM_IMAGE_WIDTH_IN_PX" size="4" description="K2_IF_NO_VALUE_IS_ENTERED_THE_RELATED_SETTING_FROM_THE_COMPONENTS_GLOBAL_PARAMETERS_WILL_BE_RETRIEVED"/>
|
||||
<param name="itemImageL" type="text" default="" label="K2_LARGE_IMAGE_WIDTH_IN_PX" size="4" description="K2_IF_NO_VALUE_IS_ENTERED_THE_RELATED_SETTING_FROM_THE_COMPONENTS_GLOBAL_PARAMETERS_WILL_BE_RETRIEVED"/>
|
||||
<param name="itemImageXL" type="text" default="" label="K2_XLARGE_IMAGE_WIDTH_IN_PX" size="4" description="K2_IF_NO_VALUE_IS_ENTERED_THE_RELATED_SETTING_FROM_THE_COMPONENTS_GLOBAL_PARAMETERS_WILL_BE_RETRIEVED"/>
|
||||
</params>
|
||||
<params group="item-view-options-listings" addpath="/administrator/components/com_k2/elements">
|
||||
<param name="catItemTitle" type="radio" default="1" label="K2_TITLE" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="catItemTitleLinked" type="radio" default="1" label="K2_LINK_ON_TITLE" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="catItemFeaturedNotice" type="radio" default="0" label="K2_FEATURED_NOTICE_NEXT_TO_TITLE" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="catItemAuthor" type="radio" default="1" label="K2_AUTHOR" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="catItemDateCreated" type="radio" default="1" label="K2_ITEM_CREATED_DATE_AND_TIME" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="catItemRating" type="radio" default="0" label="K2_RATING_VOTING" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="catItemImage" type="radio" default="1" label="K2_IMAGE" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="catItemIntroText" type="radio" default="1" label="K2_INTROTEXT" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="catItemIntroTextWordLimit" type="text" default="" size="4" label="K2_INTROTEXT_WORD_LIMIT" description="K2_IF_THIS_OPTION_IS_ENABLED_ALL_HTML_TAGS_IN_THE_INTROTEXT_WILL_BE_CLEANED_UP_TO_MAKE_SURE_THE_SITE_MARKUP_WILL_NOT_BREAK"/>
|
||||
<param name="catItemExtraFields" type="radio" default="0" label="K2_EXTRA_FIELDS" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="catItemHits" type="radio" default="0" label="K2_HITS" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="catItemCategory" type="radio" default="1" label="K2_CATEGORY" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="catItemTags" type="radio" default="1" label="K2_TAGS" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="catItemAttachments" type="radio" default="0" label="K2_ATTACHMENTS" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="catItemAttachmentsCounter" type="radio" default="0" label="K2_ATTACHMENTS_COUNTER" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="catItemVideo" type="radio" default="0" label="K2_MEDIA" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="catItemVideoWidth" type="text" default="" size="4" label="K2_VIDEO_WIDTH" description=""/>
|
||||
<param name="catItemVideoHeight" type="text" default="" size="4" label="K2_VIDEO_HEIGHT" description=""/>
|
||||
<param name="catItemAudioWidth" type="text" default="" size="4" label="K2_AUDIO_WIDTH" description=""/>
|
||||
<param name="catItemAudioHeight" type="text" default="" size="4" label="K2_AUDIO_HEIGHT" description=""/>
|
||||
<param name="catItemVideoAutoPlay" type="radio" default="0" label="K2_MEDIA_AUTOPLAY" description="">
|
||||
<option value="0">K2_NO</option>
|
||||
<option value="1">K2_YES</option>
|
||||
</param>
|
||||
<param name="catItemImageGallery" type="radio" default="0" label="K2_IMAGE_GALLERY" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="catItemDateModified" type="radio" default="0" label="K2_ITEM_MODIFIED_DATE_AND_TIME" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="catItemReadMore" type="radio" default="1" label="K2_READ_MORE_LINK" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="catItemCommentsAnchor" type="radio" default="1" label="K2_ANCHOR_LINK_WITH_COMMENTS_COUNTER_TO_ITEMS_COMMENT_FORM" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="" type="header" default="K2_ADVANCED" label="" description=""/>
|
||||
<param name="catItemK2Plugins" type="radio" default="1" label="K2_ENABLE_K2_PLUGINS" description="">
|
||||
<option value="0">K2_NO</option>
|
||||
<option value="1">K2_YES</option>
|
||||
</param>
|
||||
</params>
|
||||
<params group="item-view-options" addpath="/administrator/components/com_k2/elements">
|
||||
<param name="itemDateCreated" type="radio" default="1" label="K2_ITEM_CREATED_DATE_AND_TIME" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="itemTitle" type="radio" default="1" label="K2_TITLE" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="itemFeaturedNotice" type="radio" default="1" label="K2_FEATURED_NOTICE_NEXT_TO_TITLE" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="itemAuthor" type="radio" default="1" label="K2_AUTHOR" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="itemFontResizer" type="radio" default="1" label="K2_FONT_RESIZER" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="itemPrintButton" type="radio" default="1" label="K2_PRINT_BUTTON" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="itemEmailButton" type="radio" default="1" label="K2_EMAIL_BUTTON" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="itemSocialButton" type="radio" default="1" label="K2_SOCIAL_BUTTON_LIKE_SHARETHIS_ADDTHIS_ETC" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="itemVideoAnchor" type="radio" default="1" label="K2_ANCHOR_LINK_TO_VIDEO" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="itemImageGalleryAnchor" type="radio" default="1" label="K2_ANCHOR_LINK_TO_IMAGE_GALLERY" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="itemCommentsAnchor" type="radio" default="1" label="K2_ANCHOR_LINK_WITH_COMMENTS_COUNTER_TO_COMMENT_FORM" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="itemRating" type="radio" default="1" label="K2_RATING_VOTING" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="itemImage" type="radio" default="1" label="K2_IMAGE" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="itemImgSize" type="list" default="Large" label="K2_IMAGE_SIZE" description="">
|
||||
<option value="XSmall">K2_XSMALL</option>
|
||||
<option value="Small">K2_SMALL</option>
|
||||
<option value="Medium">K2_MEDIUM</option>
|
||||
<option value="Large">K2_LARGE</option>
|
||||
<option value="XLarge">K2_XLARGE</option>
|
||||
</param>
|
||||
<param name="itemImageMainCaption" type="radio" default="1" label="K2_IMAGE_CAPTION" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="itemImageMainCredits" type="radio" default="1" label="K2_IMAGE_CREDITS" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="itemIntroText" type="radio" default="1" label="K2_INTROTEXT" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="itemFullText" type="radio" default="1" label="K2_FULLTEXT" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="itemExtraFields" type="radio" default="1" label="K2_EXTRA_FIELDS" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="itemDateModified" type="radio" default="1" label="K2_ITEM_MODIFIED_DATE_AND_TIME" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="itemHits" type="radio" default="1" label="K2_HITS_PAGE_VIEWS" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="itemCategory" type="radio" default="1" label="K2_CATEGORY" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="itemTags" type="radio" default="1" label="K2_TAGS" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="itemAttachments" type="radio" default="1" label="K2_ATTACHMENTS" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="itemAttachmentsCounter" type="radio" default="1" label="K2_ATTACHMENTS_COUNTER" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="itemVideo" type="radio" default="1" label="K2_MEDIA" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="itemVideoWidth" type="text" default="" size="4" label="K2_VIDEO_WIDTH" description=""/>
|
||||
<param name="itemVideoHeight" type="text" default="" size="4" label="K2_VIDEO_HEIGHT" description=""/>
|
||||
<param name="itemAudioWidth" type="text" default="" size="4" label="K2_AUDIO_WIDTH" description=""/>
|
||||
<param name="itemAudioHeight" type="text" default="" size="4" label="K2_AUDIO_HEIGHT" description=""/>
|
||||
<param name="itemVideoAutoPlay" type="radio" default="0" label="K2_MEDIA_AUTOPLAY" description="">
|
||||
<option value="0">K2_NO</option>
|
||||
<option value="1">K2_YES</option>
|
||||
</param>
|
||||
<param name="itemVideoCaption" type="radio" default="1" label="K2_MEDIA_CAPTION" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="itemVideoCredits" type="radio" default="1" label="K2_MEDIA_CREDITS" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="itemImageGallery" type="radio" default="1" label="K2_IMAGE_GALLERY" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="itemNavigation" type="radio" default="1" label="K2_ITEM_NAVIGATION" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="itemComments" type="radio" default="1" label="K2_COMMENTS" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="" type="header" default="K2_SOCIAL_SHARING" label="" description=""/>
|
||||
<param name="itemTwitterButton" type="radio" default="1" label="K2_TWITTER_SHARE" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="itemFacebookButton" type="radio" default="1" label="K2_FACEBOOK_SHARE" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="itemGooglePlusOneButton" type="radio" default="1" label="K2_GOOGLEPLUSONE_SHARE" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="" type="header" default="K2_AUTHOR_OPTIONS" label="" description=""/>
|
||||
<param name="itemAuthorBlock" type="radio" default="1" label="K2_DISPLAY_EXTENDED_AUTHOR_INFO" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="itemAuthorImage" type="radio" default="1" label="K2_AUTHOR_IMAGE" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="itemAuthorDescription" type="radio" default="1" label="K2_AUTHOR_DESCRIPTION" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="itemAuthorURL" type="radio" default="1" label="K2_AUTHOR_URL" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="itemAuthorEmail" type="radio" default="0" label="K2_AUTHOR_EMAIL" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="itemAuthorLatest" type="radio" default="1" label="K2_LATEST_ITEMS_FROM_AUTHOR" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="itemAuthorLatestLimit" type="text" default="5" size="4" label="K2_LIMIT_FOR_LATEST_ITEMS_FROM_AUTHOR" description=""/>
|
||||
<param name="" type="header" default="K2_RELATED_ITEMS" label="" description=""/>
|
||||
<param name="itemRelated" type="radio" default="1" label="K2_RELATED_ITEMS_BY_TAG" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="itemRelatedLimit" type="text" default="5" size="4" label="K2_RELATED_ITEMS_LIMIT" description=""/>
|
||||
<param name="itemRelatedTitle" type="radio" default="1" label="K2_RELATED_ITEMS_TITLE" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="itemRelatedCategory" type="radio" default="0" label="K2_RELATED_ITEMS_CATEGORY" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="itemRelatedImageSize" type="list" default="0" label="K2_RELATED_ITEMS_IMAGE" description="">
|
||||
<option value="0">K2_NONE_SELECTED</option>
|
||||
<option value="XSmall">K2_XSMALL</option>
|
||||
<option value="Small">K2_SMALL</option>
|
||||
<option value="Medium">K2_MEDIUM</option>
|
||||
<option value="Large">K2_LARGE</option>
|
||||
<option value="XLarge">K2_XLARGE</option>
|
||||
</param>
|
||||
<param name="itemRelatedIntrotext" type="radio" default="0" label="K2_RELATED_ITEMS_INTROTEXT" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="itemRelatedFulltext" type="radio" default="0" label="K2_RELATED_ITEMS_FULLTEXT" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="itemRelatedAuthor" type="radio" default="0" label="K2_RELATED_ITEMS_AUTHOR" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="itemRelatedMedia" type="radio" default="0" label="K2_RELATED_ITEMS_MEDIA" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="itemRelatedImageGallery" type="radio" default="0" label="K2_RELATED_ITEMS_IMAGE_GALLERY" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="" type="header" default="K2_ADVANCED" label="" description=""/>
|
||||
<param name="itemK2Plugins" type="radio" default="1" label="K2_ENABLE_K2_PLUGINS" description="">
|
||||
<option value="0">K2_NO</option>
|
||||
<option value="1">K2_YES</option>
|
||||
</param>
|
||||
</params>
|
||||
<!-- Metadata Information -->
|
||||
<params group="category-metadata-information" addpath="/administrator/components/com_k2/elements">
|
||||
<param name="catMetaDesc" type="textarea" default="" label="K2_DESCRIPTION" description="" rows="4" cols="25" />
|
||||
<param name="catMetaKey" type="textarea" default="" label="K2_KEYWORDS" description="" rows="4" cols="25" />
|
||||
<param name="catMetaRobots" type="text" default="" label="K2_ROBOTS" description=""/>
|
||||
<param name="catMetaAuthor" type="text" default="" label="K2_AUTHOR" description=""/>
|
||||
</params>
|
||||
<fields name="params">
|
||||
<fieldset name="category-item-layout" addfieldpath="/administrator/components/com_k2/elements">
|
||||
<param name="" type="header" default="K2_LAYOUT_TEMPLATE" label="" description=""/>
|
||||
<field name="theme" type="template" default="default" label="K2_SELECT_A_TEMPLATE"/>
|
||||
<field name="" type="header" default="K2_LAYOUT_GRID" label="" description=""/>
|
||||
<field name="num_leading_items" type="text" size="4" default="2" label="K2_LEADING_COUNT" description="K2_NUMBER_OF_ITEMS_TO_DISPLAY_AS_LEADING"/>
|
||||
<field name="num_leading_columns" type="text" size="4" default="1" label="K2_COLUMNS_FOR_LEADING" description=""/>
|
||||
<field name="leadingImgSize" type="list" default="Large" label="K2_IMAGE_SIZE_FOR_LEADING_ITEMS" description="K2_YOU_CAN_OVERRIDE_THE_GLOBAL_DIMENSIONS_FOR_EACH_SIZE_BY_ADJUSTING_THE_RELATED_SETTING_IN_THE_ITEM_IMAGE_OPTIONS_PANE_BELOW">
|
||||
<option value="XSmall">K2_XSMALL</option>
|
||||
<option value="Small">K2_SMALL</option>
|
||||
<option value="Medium">K2_MEDIUM</option>
|
||||
<option value="Large">K2_LARGE</option>
|
||||
<option value="XLarge">K2_XLARGE</option>
|
||||
<option value="none">K2_NO_IMAGE</option>
|
||||
</field>
|
||||
<field name="@spacer" type="spacer" default="" label="" description=""/>
|
||||
<field name="num_primary_items" type="text" size="4" default="4" label="K2_PRIMARY_COUNT" description="K2_NUMBER_OF_ITEMS_TO_DISPLAY_AS_PRIMARY"/>
|
||||
<field name="num_primary_columns" type="text" size="4" default="2" label="K2_COLUMNS_FOR_PRIMARY" description=""/>
|
||||
<field name="primaryImgSize" type="list" default="Medium" label="K2_IMAGE_SIZE_FOR_PRIMARY_ITEMS" description="K2_YOU_CAN_OVERRIDE_THE_GLOBAL_DIMENSIONS_FOR_EACH_SIZE_BY_ADJUSTING_THE_RELATED_SETTING_IN_THE_ITEM_IMAGE_OPTIONS_PANE_BELOW">
|
||||
<option value="XSmall">K2_XSMALL</option>
|
||||
<option value="Small">K2_SMALL</option>
|
||||
<option value="Medium">K2_MEDIUM</option>
|
||||
<option value="Large">K2_LARGE</option>
|
||||
<option value="XLarge">K2_XLARGE</option>
|
||||
<option value="none">K2_NO_IMAGE</option>
|
||||
</field>
|
||||
<field name="@spacer" type="spacer" default="" label="" description=""/>
|
||||
<field name="num_secondary_items" type="text" size="4" default="4" label="K2_SECONDARY_COUNT" description="K2_NUMBER_OF_ITEMS_TO_DISPLAY_AS_SECONDARY"/>
|
||||
<field name="num_secondary_columns" type="text" size="4" default="1" label="K2_COLUMNS_FOR_SECONDARY" description=""/>
|
||||
<field name="secondaryImgSize" type="list" default="Small" label="K2_IMAGE_SIZE_FOR_SECONDARY_ITEMS" description="K2_YOU_CAN_OVERRIDE_THE_GLOBAL_DIMENSIONS_FOR_EACH_SIZE_BY_ADJUSTING_THE_RELATED_SETTING_IN_THE_ITEM_IMAGE_OPTIONS_PANE_BELOW">
|
||||
<option value="XSmall">K2_XSMALL</option>
|
||||
<option value="Small">K2_SMALL</option>
|
||||
<option value="Medium">K2_MEDIUM</option>
|
||||
<option value="Large">K2_LARGE</option>
|
||||
<option value="XLarge">K2_XLARGE</option>
|
||||
<option value="none">K2_NO_IMAGE</option>
|
||||
</field>
|
||||
<field name="@spacer" type="spacer" default="" label="" description=""/>
|
||||
<field name="num_links" type="text" size="4" default="4" label="K2_LINKS_COUNT" description="K2_NUMBER_OF_ITEMS_TO_DISPLAY_AS_LINKS"/>
|
||||
<field name="num_links_columns" type="text" size="4" default="1" label="K2_COLUMNS_FOR_LINKS" description=""/>
|
||||
<field name="linksImgSize" type="list" default="XSmall" label="K2_IMAGE_SIZE_FOR_LINK_ITEMS" description="K2_YOU_CAN_OVERRIDE_THE_GLOBAL_DIMENSIONS_FOR_EACH_SIZE_BY_ADJUSTING_THE_RELATED_SETTING_IN_THE_ITEM_IMAGE_OPTIONS_PANE_BELOW">
|
||||
<option value="XSmall">K2_XSMALL</option>
|
||||
<option value="Small">K2_SMALL</option>
|
||||
<option value="Medium">K2_MEDIUM</option>
|
||||
<option value="Large">K2_LARGE</option>
|
||||
<option value="XLarge">K2_XLARGE</option>
|
||||
<option value="none">K2_NO_IMAGE</option>
|
||||
</field>
|
||||
<field name="" type="header" default="K2_OTHER_LAYOUT_OPTIONS" label="" description=""/>
|
||||
<field name="catCatalogMode" type="list" default="0" label="K2_CATALOG_MODE" description="K2_IF_YOU_SELECT_YES_THEN_ONLY_THE_ITEMS_DIRECTLY_BELONGING_TO_THIS_CATEGORY_WILL_BE_RETRIEVED_IF_YOU_SELECT_NO_THEN_ITEMS_FROM_ALL_SUBCATEGORIES_WILL_BE_RETRIEVED_SETTING_THIS_OPTION_TO_NO_IS_IDEAL_FOR_NEWSPORTALMAGAZINEBLOG_LAYOUTS">
|
||||
<option value="0">K2_NO</option>
|
||||
<option value="1">K2_YES</option>
|
||||
</field>
|
||||
<field name="catFeaturedItems" type="list" default="1" label="K2_FEATURED_ITEMS" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
<option value="2">K2_SHOW_ONLY_FEATURED_ITEMS</option>
|
||||
</field>
|
||||
<field name="catOrdering" type="list" default="" label="K2_ITEM_ORDERING" description="">
|
||||
<option value="">K2_DEFAULT</option>
|
||||
<option value="date">K2_OLDEST_FIRST</option>
|
||||
<option value="rdate">K2_MOST_RECENT_FIRST</option>
|
||||
<option value="publishUp">K2_RECENTLY_PUBLISHED</option>
|
||||
<option value="alpha">K2_TITLE_ALPHABETICAL</option>
|
||||
<option value="ralpha">K2_TITLE_REVERSEALPHABETICAL</option>
|
||||
<option value="order">K2_ORDERING</option>
|
||||
<option value="rorder">K2_ORDERING_REVERSE</option>
|
||||
<option value="featured">K2_FEATURED_FIRST</option>
|
||||
<option value="hits">K2_MOST_POPULAR</option>
|
||||
<option value="best">K2_HIGHEST_RATED</option>
|
||||
<option value="modified">K2_LATEST_MODIFIED</option>
|
||||
<option value="rand">K2_RANDOM_ORDERING</option>
|
||||
</field>
|
||||
<field name="catPagination" type="list" default="2" label="K2_PAGINATION" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
<option value="2">K2_AUTO</option>
|
||||
</field>
|
||||
<field name="catPaginationResults" type="radio" default="1" label="K2_PAGINATION_RESULTS" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
</fieldset>
|
||||
<fieldset name="category-view-options" addfieldpath="/administrator/components/com_k2/elements">
|
||||
<field name="catTitle" type="radio" default="1" label="K2_TITLE" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="catTitleItemCounter" type="radio" default="1" label="K2_ITEM_COUNTER_NEXT_TO_TITLE" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="catDescription" type="radio" default="1" label="K2_DESCRIPTION" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="catImage" type="radio" default="1" label="K2_IMAGE" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="catFeedLink" type="radio" default="1" label="K2_RSS_FEED_LINK" description="">
|
||||
<option value="0">K2_DISABLE</option>
|
||||
<option value="1">K2_ENABLE</option>
|
||||
</field>
|
||||
<field name="catFeedIcon" type="radio" default="1" label="K2_RSS_FEED_ICON" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="" type="header" default="K2_SUBCATEGORY_HANDLING" label="" description=""/>
|
||||
<field name="subCategories" type="radio" default="1" label="K2_SUBCATEGORY_BLOCKS" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="subCatColumns" type="text" default="2" size="4" label="K2_COLUMNS" description=""/>
|
||||
<field name="subCatOrdering" type="list" default="" label="K2_SUBCATEGORY_ORDERING" description="">
|
||||
<option value="">K2_DEFAULT_BY_ID_ASCENDING</option>
|
||||
<option value="reversedefault">K2_REVERSE_DEFAULT_BY_ID_DESCENDING</option>
|
||||
<option value="alpha">K2_TITLE_ALPHABETICAL</option>
|
||||
<option value="ralpha">K2_TITLE_REVERSEALPHABETICAL</option>
|
||||
<option value="order">K2_ORDERING</option>
|
||||
</field>
|
||||
<field name="subCatTitle" type="radio" default="1" label="K2_SUBCATEGORY_TITLE" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="subCatTitleItemCounter" type="radio" default="1" label="K2_ITEM_COUNTER_NEXT_TO_SUBCATEGORY_TITLE" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="subCatDescription" type="radio" default="1" label="K2_SUBCATEGORY_DESCRIPTION" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="subCatImage" type="radio" default="1" label="K2_SUBCATEGORY_IMAGE" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
</fieldset>
|
||||
<fieldset name="item-image-options" addfieldpath="/administrator/components/com_k2/elements">
|
||||
<field name="itemImageXS" type="text" default="" label="K2_XSMALL_IMAGE_WIDTH_IN_PX" size="4" description="K2_IF_NO_VALUE_IS_ENTERED_THE_RELATED_SETTING_FROM_THE_COMPONENTS_GLOBAL_PARAMETERS_WILL_BE_RETRIEVED"/>
|
||||
<field name="itemImageS" type="text" default="" label="K2_SMALL_IMAGE_WIDTH_IN_PX" size="4" description="K2_IF_NO_VALUE_IS_ENTERED_THE_RELATED_SETTING_FROM_THE_COMPONENTS_GLOBAL_PARAMETERS_WILL_BE_RETRIEVED"/>
|
||||
<field name="itemImageM" type="text" default="" label="K2_MEDIUM_IMAGE_WIDTH_IN_PX" size="4" description="K2_IF_NO_VALUE_IS_ENTERED_THE_RELATED_SETTING_FROM_THE_COMPONENTS_GLOBAL_PARAMETERS_WILL_BE_RETRIEVED"/>
|
||||
<field name="itemImageL" type="text" default="" label="K2_LARGE_IMAGE_WIDTH_IN_PX" size="4" description="K2_IF_NO_VALUE_IS_ENTERED_THE_RELATED_SETTING_FROM_THE_COMPONENTS_GLOBAL_PARAMETERS_WILL_BE_RETRIEVED"/>
|
||||
<field name="itemImageXL" type="text" default="" label="K2_XLARGE_IMAGE_WIDTH_IN_PX" size="4" description="K2_IF_NO_VALUE_IS_ENTERED_THE_RELATED_SETTING_FROM_THE_COMPONENTS_GLOBAL_PARAMETERS_WILL_BE_RETRIEVED"/>
|
||||
</fieldset>
|
||||
<fieldset name="item-view-options-listings" addfieldpath="/administrator/components/com_k2/elements">
|
||||
<field name="catItemTitle" type="radio" default="1" label="K2_TITLE" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="catItemTitleLinked" type="radio" default="1" label="K2_LINK_ON_TITLE" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="catItemFeaturedNotice" type="radio" default="0" label="K2_FEATURED_NOTICE_NEXT_TO_TITLE" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="catItemAuthor" type="radio" default="1" label="K2_AUTHOR" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="catItemDateCreated" type="radio" default="1" label="K2_ITEM_CREATED_DATE_AND_TIME" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="catItemRating" type="radio" default="0" label="K2_RATING_VOTING" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="catItemImage" type="radio" default="1" label="K2_IMAGE" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="catItemIntroText" type="radio" default="1" label="K2_INTROTEXT" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="catItemIntroTextWordLimit" type="text" default="" size="4" label="K2_INTROTEXT_WORD_LIMIT" description="K2_IF_THIS_OPTION_IS_ENABLED_ALL_HTML_TAGS_IN_THE_INTROTEXT_WILL_BE_CLEANED_UP_TO_MAKE_SURE_THE_SITE_MARKUP_WILL_NOT_BREAK"/>
|
||||
<field name="catItemExtraFields" type="radio" default="0" label="K2_EXTRA_FIELDS" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="catItemHits" type="radio" default="0" label="K2_HITS" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="catItemCategory" type="radio" default="1" label="K2_CATEGORY" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="catItemTags" type="radio" default="1" label="K2_TAGS" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="catItemAttachments" type="radio" default="0" label="K2_ATTACHMENTS" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="catItemAttachmentsCounter" type="radio" default="0" label="K2_ATTACHMENTS_COUNTER" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="catItemVideo" type="radio" default="0" label="K2_MEDIA" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="catItemVideoWidth" type="text" default="" size="4" label="K2_VIDEO_WIDTH" description=""/>
|
||||
<field name="catItemVideoHeight" type="text" default="" size="4" label="K2_VIDEO_HEIGHT" description=""/>
|
||||
<field name="catItemAudioWidth" type="text" default="" size="4" label="K2_AUDIO_WIDTH" description=""/>
|
||||
<field name="catItemAudioHeight" type="text" default="" size="4" label="K2_AUDIO_HEIGHT" description=""/>
|
||||
<field name="catItemVideoAutoPlay" type="radio" default="0" label="K2_MEDIA_AUTOPLAY" description="">
|
||||
<option value="0">K2_NO</option>
|
||||
<option value="1">K2_YES</option>
|
||||
</field>
|
||||
<field name="catItemImageGallery" type="radio" default="0" label="K2_IMAGE_GALLERY" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="catItemDateModified" type="radio" default="0" label="K2_ITEM_MODIFIED_DATE_AND_TIME" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="catItemReadMore" type="radio" default="1" label="K2_READ_MORE_LINK" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="catItemCommentsAnchor" type="radio" default="1" label="K2_ANCHOR_LINK_WITH_COMMENTS_COUNTER_TO_ITEMS_COMMENT_FORM" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="" type="header" default="K2_ADVANCED" label="" description=""/>
|
||||
<field name="catItemK2Plugins" type="radio" default="1" label="K2_ENABLE_K2_PLUGINS" description="">
|
||||
<option value="0">K2_NO</option>
|
||||
<option value="1">K2_YES</option>
|
||||
</field>
|
||||
</fieldset>
|
||||
<fieldset name="item-view-options" addfieldpath="/administrator/components/com_k2/elements">
|
||||
<field name="itemDateCreated" type="radio" default="1" label="K2_ITEM_CREATED_DATE_AND_TIME" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="itemTitle" type="radio" default="1" label="K2_TITLE" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="itemFeaturedNotice" type="radio" default="1" label="K2_FEATURED_NOTICE_NEXT_TO_TITLE" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="itemAuthor" type="radio" default="1" label="K2_AUTHOR" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="itemFontResizer" type="radio" default="1" label="K2_FONT_RESIZER" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="itemPrintButton" type="radio" default="1" label="K2_PRINT_BUTTON" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="itemEmailButton" type="radio" default="1" label="K2_EMAIL_BUTTON" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="itemSocialButton" type="radio" default="1" label="K2_SOCIAL_BUTTON_LIKE_SHARETHIS_ADDTHIS_ETC" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="itemVideoAnchor" type="radio" default="1" label="K2_ANCHOR_LINK_TO_VIDEO" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="itemImageGalleryAnchor" type="radio" default="1" label="K2_ANCHOR_LINK_TO_IMAGE_GALLERY" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="itemCommentsAnchor" type="radio" default="1" label="K2_ANCHOR_LINK_WITH_COMMENTS_COUNTER_TO_COMMENT_FORM" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="itemRating" type="radio" default="1" label="K2_RATING_VOTING" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="itemImage" type="radio" default="1" label="K2_IMAGE" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="itemImgSize" type="list" default="Large" label="K2_IMAGE_SIZE" description="">
|
||||
<option value="XSmall">K2_XSMALL</option>
|
||||
<option value="Small">K2_SMALL</option>
|
||||
<option value="Medium">K2_MEDIUM</option>
|
||||
<option value="Large">K2_LARGE</option>
|
||||
<option value="XLarge">K2_XLARGE</option>
|
||||
</field>
|
||||
<field name="itemImageMainCaption" type="radio" default="1" label="K2_IMAGE_CAPTION" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="itemImageMainCredits" type="radio" default="1" label="K2_IMAGE_CREDITS" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="itemIntroText" type="radio" default="1" label="K2_INTROTEXT" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="itemFullText" type="radio" default="1" label="K2_FULLTEXT" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="itemExtraFields" type="radio" default="1" label="K2_EXTRA_FIELDS" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="itemDateModified" type="radio" default="1" label="K2_ITEM_MODIFIED_DATE_AND_TIME" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="itemHits" type="radio" default="1" label="K2_HITS_PAGE_VIEWS" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="itemCategory" type="radio" default="1" label="K2_CATEGORY" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="itemTags" type="radio" default="1" label="K2_TAGS" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="itemAttachments" type="radio" default="1" label="K2_ATTACHMENTS" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="itemAttachmentsCounter" type="radio" default="1" label="K2_ATTACHMENTS_COUNTER" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="itemVideo" type="radio" default="1" label="K2_MEDIA" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="itemVideoWidth" type="text" default="" size="4" label="K2_VIDEO_WIDTH" description=""/>
|
||||
<field name="itemVideoHeight" type="text" default="" size="4" label="K2_VIDEO_HEIGHT" description=""/>
|
||||
<field name="itemAudioWidth" type="text" default="" size="4" label="K2_AUDIO_WIDTH" description=""/>
|
||||
<field name="itemAudioHeight" type="text" default="" size="4" label="K2_AUDIO_HEIGHT" description=""/>
|
||||
<field name="itemVideoAutoPlay" type="radio" default="0" label="K2_MEDIA_AUTOPLAY" description="">
|
||||
<option value="0">K2_NO</option>
|
||||
<option value="1">K2_YES</option>
|
||||
</field>
|
||||
<field name="itemVideoCaption" type="radio" default="1" label="K2_MEDIA_CAPTION" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="itemVideoCredits" type="radio" default="1" label="K2_MEDIA_CREDITS" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="itemImageGallery" type="radio" default="1" label="K2_IMAGE_GALLERY" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="itemNavigation" type="radio" default="1" label="K2_ITEM_NAVIGATION" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="itemComments" type="radio" default="1" label="K2_COMMENTS" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="" type="header" default="K2_SOCIAL_SHARING" label="" description=""/>
|
||||
<field name="itemTwitterButton" type="radio" default="1" label="K2_TWITTER_SHARE" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="itemFacebookButton" type="radio" default="1" label="K2_FACEBOOK_SHARE" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="itemGooglePlusOneButton" type="radio" default="1" label="K2_GOOGLEPLUSONE_SHARE" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="" type="header" default="K2_AUTHOR_OPTIONS" label="" description=""/>
|
||||
<field name="itemAuthorBlock" type="radio" default="1" label="K2_DISPLAY_EXTENDED_AUTHOR_INFO" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="itemAuthorImage" type="radio" default="1" label="K2_AUTHOR_IMAGE" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="itemAuthorDescription" type="radio" default="1" label="K2_AUTHOR_DESCRIPTION" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="itemAuthorURL" type="radio" default="1" label="K2_AUTHOR_URL" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="itemAuthorEmail" type="radio" default="0" label="K2_AUTHOR_EMAIL" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="itemAuthorLatest" type="radio" default="1" label="K2_LATEST_ITEMS_FROM_AUTHOR" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="itemAuthorLatestLimit" type="text" default="5" size="4" label="K2_LIMIT_FOR_LATEST_ITEMS_FROM_AUTHOR" description=""/>
|
||||
<field name="" type="header" default="K2_RELATED_ITEMS" label="" description=""/>
|
||||
<field name="itemRelated" type="radio" default="1" label="K2_RELATED_ITEMS_BY_TAG" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="itemRelatedLimit" type="text" default="5" size="4" label="K2_RELATED_ITEMS_LIMIT" description=""/>
|
||||
<field name="itemRelatedTitle" type="radio" default="1" label="K2_RELATED_ITEMS_TITLE" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="itemRelatedCategory" type="radio" default="0" label="K2_RELATED_ITEMS_CATEGORY" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="itemRelatedImageSize" type="list" default="0" label="K2_RELATED_ITEMS_IMAGE" description="">
|
||||
<option value="0">K2_NONE_SELECTED</option>
|
||||
<option value="XSmall">K2_XSMALL</option>
|
||||
<option value="Small">K2_SMALL</option>
|
||||
<option value="Medium">K2_MEDIUM</option>
|
||||
<option value="Large">K2_LARGE</option>
|
||||
<option value="XLarge">K2_XLARGE</option>
|
||||
</field>
|
||||
<field name="itemRelatedIntrotext" type="radio" default="0" label="K2_RELATED_ITEMS_INTROTEXT" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="itemRelatedFulltext" type="radio" default="0" label="K2_RELATED_ITEMS_FULLTEXT" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="itemRelatedAuthor" type="radio" default="0" label="K2_RELATED_ITEMS_AUTHOR" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="itemRelatedMedia" type="radio" default="0" label="K2_RELATED_ITEMS_MEDIA" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="itemRelatedImageGallery" type="radio" default="0" label="K2_RELATED_ITEMS_IMAGE_GALLERY" description="">
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="" type="header" default="K2_ADVANCED" label="" description=""/>
|
||||
<field name="itemK2Plugins" type="radio" default="1" label="K2_ENABLE_K2_PLUGINS" description="">
|
||||
<option value="0">K2_NO</option>
|
||||
<option value="1">K2_YES</option>
|
||||
</field>
|
||||
</fieldset>
|
||||
<!-- Metadata Information -->
|
||||
<fieldset name="category-metadata-information" addfieldpath="/administrator/components/com_k2/elements">
|
||||
<field name="catMetaDesc" type="textarea" default="" label="K2_DESCRIPTION" description="" rows="4" cols="25" />
|
||||
<field name="catMetaKey" type="textarea" default="" label="K2_KEYWORDS" description="" rows="4" cols="25" />
|
||||
<field name="catMetaRobots" type="text" default="" label="K2_ROBOTS" description="" />
|
||||
<field name="catMetaAuthor" type="text" default="" label="K2_AUTHOR" description="" />
|
||||
</fieldset>
|
||||
</fields>
|
||||
</form>
|
||||
313
administrator/components/com_k2/models/comments.php
Normal file
313
administrator/components/com_k2/models/comments.php
Normal file
@@ -0,0 +1,313 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: comments.php 1992 2013-07-04 16:36:38Z lefteris.kavadas $
|
||||
* @package K2
|
||||
* @author JoomlaWorks http://www.joomlaworks.net
|
||||
* @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.
|
||||
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
jimport('joomla.application.component.model');
|
||||
|
||||
JTable::addIncludePath(JPATH_COMPONENT.DS.'tables');
|
||||
|
||||
class K2ModelComments extends K2Model {
|
||||
|
||||
function getData() {
|
||||
|
||||
$mainframe = JFactory::getApplication();
|
||||
$option = JRequest::getCmd('option');
|
||||
$view = JRequest::getCmd('view');
|
||||
$db = JFactory::getDBO();
|
||||
$limit = $mainframe->getUserStateFromRequest('global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int');
|
||||
$limitstart = $mainframe->getUserStateFromRequest($option.$view.'.limitstart', 'limitstart', 0, 'int');
|
||||
$filter_order = $mainframe->getUserStateFromRequest($option.$view.'filter_order', 'filter_order', 'c.id', 'cmd');
|
||||
$filter_order_Dir = $mainframe->getUserStateFromRequest($option.$view.'filter_order_Dir', 'filter_order_Dir', 'DESC', 'word');
|
||||
$filter_state = $mainframe->getUserStateFromRequest($option.$view.'filter_state', 'filter_state', -1, 'int');
|
||||
$filter_category = $mainframe->getUserStateFromRequest($option.$view.'filter_category', 'filter_category', 0, 'int');
|
||||
$filter_author = $mainframe->getUserStateFromRequest($option.$view.'filter_author', 'filter_author', 0, 'int');
|
||||
$search = $mainframe->getUserStateFromRequest($option.$view.'search', 'search', '', 'string');
|
||||
$search = JString::strtolower($search);
|
||||
|
||||
$query = "SELECT c.*, i.title , i.catid, i.alias AS itemAlias, i.created_by, cat.alias AS catAlias, cat.name as catName FROM #__k2_comments AS c LEFT JOIN #__k2_items AS i ON c.itemID=i.id LEFT JOIN #__k2_categories AS cat ON cat.id=i.catid WHERE c.id>0";
|
||||
|
||||
if ($filter_state > - 1) {
|
||||
$query .= " AND c.published={$filter_state}";
|
||||
}
|
||||
|
||||
if ($filter_category) {
|
||||
$query .= " AND i.catid={$filter_category}";
|
||||
}
|
||||
|
||||
if ($filter_author) {
|
||||
$query .= " AND i.created_by={$filter_author}";
|
||||
}
|
||||
|
||||
if ($search) {
|
||||
$escaped = K2_JVERSION == '15' ? $db->getEscaped($search, true) : $db->escape($search, true);
|
||||
$query .= " AND LOWER( c.commentText ) LIKE ".$db->Quote('%'.$escaped.'%', false);
|
||||
}
|
||||
|
||||
if (!$filter_order) {
|
||||
$filter_order = "c.commentDate";
|
||||
}
|
||||
|
||||
$query .= " ORDER BY {$filter_order} {$filter_order_Dir}";
|
||||
$db->setQuery($query, $limitstart, $limit);
|
||||
$rows = $db->loadObjectList();
|
||||
return $rows;
|
||||
}
|
||||
|
||||
function getTotal() {
|
||||
|
||||
$mainframe = JFactory::getApplication();
|
||||
$option = JRequest::getCmd('option');
|
||||
$view = JRequest::getCmd('view');
|
||||
$db = JFactory::getDBO();
|
||||
$limit = $mainframe->getUserStateFromRequest('global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int');
|
||||
$limitstart = $mainframe->getUserStateFromRequest($option.'.limitstart', 'limitstart', 0, 'int');
|
||||
$filter_state = $mainframe->getUserStateFromRequest($option.$view.'filter_state', 'filter_state', 1, 'int');
|
||||
$filter_category = $mainframe->getUserStateFromRequest($option.$view.'filter_category', 'filter_category', 0, 'int');
|
||||
$filter_author = $mainframe->getUserStateFromRequest($option.$view.'filter_author', 'filter_author', 0, 'int');
|
||||
$search = $mainframe->getUserStateFromRequest($option.$view.'search', 'search', '', 'string');
|
||||
$search = JString::strtolower($search);
|
||||
|
||||
$query = "SELECT COUNT(*) FROM #__k2_comments AS c LEFT JOIN #__k2_items AS i ON c.itemID=i.id WHERE c.id>0";
|
||||
|
||||
if ($filter_state > - 1) {
|
||||
$query .= " AND c.published={$filter_state}";
|
||||
}
|
||||
|
||||
if ($filter_category) {
|
||||
$query .= " AND i.catid={$filter_category}";
|
||||
}
|
||||
|
||||
if ($filter_author) {
|
||||
$query .= " AND i.created_by={$filter_author}";
|
||||
}
|
||||
|
||||
if ($search) {
|
||||
$escaped = K2_JVERSION == '15' ? $db->getEscaped($search, true) : $db->escape($search, true);
|
||||
$query .= " AND LOWER( c.commentText ) LIKE ".$db->Quote('%'.$escaped.'%', false);
|
||||
}
|
||||
|
||||
$db->setQuery($query);
|
||||
$total = $db->loadresult();
|
||||
return $total;
|
||||
}
|
||||
|
||||
function publish() {
|
||||
|
||||
$mainframe = JFactory::getApplication();
|
||||
$user = JFactory::getUser();
|
||||
$cid = JRequest::getVar('cid');
|
||||
if(!count($cid)){
|
||||
$cid[]=JRequest::getInt('commentID');
|
||||
}
|
||||
|
||||
foreach ($cid as $id) {
|
||||
$row = JTable::getInstance('K2Comment', 'Table');
|
||||
$row->load($id);
|
||||
if($mainframe->isSite()){
|
||||
$item = JTable::getInstance('K2Item', 'Table');
|
||||
$item->load($row->itemID);
|
||||
if ($item->created_by != $user->id) {
|
||||
JError::raiseError(403, JText::_('K2_ALERTNOTAUTH'));
|
||||
$mainframe->close();
|
||||
}
|
||||
}
|
||||
$row->publish($id, 1);
|
||||
}
|
||||
$cache = JFactory::getCache('com_k2');
|
||||
$cache->clean();
|
||||
if(JRequest::getCmd('format')=='raw'){
|
||||
echo 'true';
|
||||
$mainframe->close();
|
||||
}
|
||||
$mainframe->redirect('index.php?option=com_k2&view=comments');
|
||||
}
|
||||
|
||||
function unpublish() {
|
||||
|
||||
$mainframe = JFactory::getApplication();
|
||||
$user = JFactory::getUser();
|
||||
$cid = JRequest::getVar('cid');
|
||||
foreach ($cid as $id) {
|
||||
$row = JTable::getInstance('K2Comment', 'Table');
|
||||
$row->load($id);
|
||||
if($mainframe->isSite()){
|
||||
$item = JTable::getInstance('K2Item', 'Table');
|
||||
$item->load($row->itemID);
|
||||
if ($item->created_by != $user->id) {
|
||||
JError::raiseError(403, JText::_('K2_ALERTNOTAUTH'));
|
||||
$mainframe->close();
|
||||
}
|
||||
}
|
||||
$row->publish($id, 0);
|
||||
}
|
||||
$cache = JFactory::getCache('com_k2');
|
||||
$cache->clean();
|
||||
$mainframe->redirect('index.php?option=com_k2&view=comments');
|
||||
}
|
||||
|
||||
function remove() {
|
||||
|
||||
$mainframe = JFactory::getApplication();
|
||||
$user = JFactory::getUser();
|
||||
$db = JFactory::getDBO();
|
||||
$cid = JRequest::getVar('cid');
|
||||
if(!count($cid)){
|
||||
$cid[]=JRequest::getInt('commentID');
|
||||
}
|
||||
foreach ($cid as $id) {
|
||||
$row = JTable::getInstance('K2Comment', 'Table');
|
||||
$row->load($id);
|
||||
if($mainframe->isSite()){
|
||||
$item = JTable::getInstance('K2Item', 'Table');
|
||||
$item->load($row->itemID);
|
||||
if ($item->created_by != $user->id) {
|
||||
JError::raiseError(403, JText::_('K2_ALERTNOTAUTH'));
|
||||
$mainframe->close();
|
||||
}
|
||||
}
|
||||
$row->delete($id);
|
||||
}
|
||||
$cache = JFactory::getCache('com_k2');
|
||||
$cache->clean();
|
||||
if(JRequest::getCmd('format')=='raw'){
|
||||
echo 'true';
|
||||
$mainframe->close();
|
||||
}
|
||||
$mainframe->redirect('index.php?option=com_k2&view=comments', JText::_('K2_DELETE_COMPLETED'));
|
||||
}
|
||||
|
||||
function deleteUnpublished() {
|
||||
|
||||
$mainframe = JFactory::getApplication();
|
||||
$db = JFactory::getDBO();
|
||||
$user = JFactory::getUser();
|
||||
$userID = $user->id;
|
||||
if($mainframe->isSite()){
|
||||
$query = "SELECT c.id FROM #__k2_comments AS c
|
||||
LEFT JOIN #__k2_items AS i ON c.itemID=i.id
|
||||
WHERE i.created_by = {$userID} AND c.published=0";
|
||||
$db->setQuery($query);
|
||||
$ids = K2_JVERSION == '30' ? $db->loadColumn() : $db->loadResultArray();
|
||||
if (count($ids)){
|
||||
$query = "DELETE FROM #__k2_comments WHERE id IN(".implode(',', $ids).")";
|
||||
$db->setQuery($query);
|
||||
$db->query();
|
||||
}
|
||||
}
|
||||
else {
|
||||
$query = "DELETE FROM #__k2_comments WHERE published=0";
|
||||
$db->setQuery($query);
|
||||
$db->query();
|
||||
}
|
||||
|
||||
$cache = JFactory::getCache('com_k2');
|
||||
$cache->clean();
|
||||
$mainframe->redirect('index.php?option=com_k2&view=comments', JText::_('K2_DELETE_COMPLETED'));
|
||||
}
|
||||
|
||||
function save() {
|
||||
|
||||
$mainframe = JFactory::getApplication();
|
||||
$user = JFactory::getUser();
|
||||
$db = JFactory::getDBO();
|
||||
$id = JRequest::getInt('commentID');
|
||||
$item = JTable::getInstance('K2Item', 'Table');
|
||||
$row = JTable::getInstance('K2Comment', 'Table');
|
||||
$row->load($id);
|
||||
if($mainframe->isSite()){
|
||||
$item->load($row->itemID);
|
||||
if ($item->created_by != $user->id) {
|
||||
JError::raiseError(403, JText::_('K2_ALERTNOTAUTH'));
|
||||
}
|
||||
}
|
||||
$row->commentText = JRequest::getVar('commentText', '', 'default', 'string', 4);
|
||||
$row->store();
|
||||
$cache = JFactory::getCache('com_k2');
|
||||
$cache->clean();
|
||||
$response = new JObject;
|
||||
$response->comment = $row->commentText;
|
||||
$response->message = JText::_('K2_COMMENT_SAVED');
|
||||
unset($response->_errors);
|
||||
require_once (JPATH_COMPONENT_ADMINISTRATOR.DS.'lib'.DS.'JSON.php');
|
||||
$json = new Services_JSON;
|
||||
echo $json->encode($response);
|
||||
$mainframe->close();
|
||||
}
|
||||
|
||||
function report(){
|
||||
$id = $this->getState('id');
|
||||
$name = JString::trim($this->getState('name'));
|
||||
$reportReason = JString::trim($this->getState('reportReason'));
|
||||
$params = &K2HelperUtilities::getParams('com_k2');
|
||||
$user = JFactory::getUser();
|
||||
$row = JTable::getInstance('K2Comment', 'Table');
|
||||
$row->load($id);
|
||||
if(!$row->published){
|
||||
$this->setError(JText::_('K2_COMMENT_NOT_FOUND'));
|
||||
return false;
|
||||
}
|
||||
if(empty($name)){
|
||||
$this->setError(JText::_('K2_PLEASE_TYPE_YOUR_NAME'));
|
||||
return false;
|
||||
}
|
||||
if(empty($reportReason)){
|
||||
$this->setError(JText::_('K2_PLEASE_TYPE_THE_REPORT_REASON'));
|
||||
return false;
|
||||
}
|
||||
if (($params->get('antispam') == 'recaptcha' || $params->get('antispam') == 'both') && $user->guest) {
|
||||
if(!function_exists('_recaptcha_qsencode'))
|
||||
{
|
||||
require_once (JPATH_ADMINISTRATOR.DS.'components'.DS.'com_k2'.DS.'lib'.DS.'recaptchalib.php');
|
||||
}
|
||||
$privatekey = $params->get('recaptcha_private_key');
|
||||
$resp = recaptcha_check_answer($privatekey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]);
|
||||
if (!$resp->is_valid) {
|
||||
$this->setError(JText::_('K2_THE_WORDS_YOU_TYPED_DID_NOT_MATCH_THE_ONES_DISPLAYED_PLEASE_TRY_AGAIN'));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
$mainframe = JFactory::getApplication();
|
||||
$mail = JFactory::getMailer();
|
||||
$senderEmail = $mainframe->getCfg('mailfrom');
|
||||
$senderName = $mainframe->getCfg('fromname');
|
||||
|
||||
$mail->setSender(array($senderEmail, $senderName));
|
||||
$mail->setSubject(JText::_('K2_COMMENT_REPORT'));
|
||||
$mail->IsHTML(true);
|
||||
|
||||
switch(substr(strtoupper(PHP_OS), 0, 3)) {
|
||||
case 'WIN':
|
||||
$mail->LE = "\r\n";
|
||||
break;
|
||||
case 'MAC':
|
||||
case 'DAR':
|
||||
$mail->LE = "\r";
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
$body = "
|
||||
<strong>".JText::_('K2_NAME')."</strong>: ".$name." <br/>
|
||||
<strong>".JText::_('K2_REPORT_REASON')."</strong>: ".$reportReason." <br/>
|
||||
<strong>".JText::_('K2_COMMENT')."</strong>: ".nl2br($row->commentText)." <br/>
|
||||
";
|
||||
|
||||
$mail->setBody($body);
|
||||
$mail->ClearAddresses();
|
||||
$mail->AddAddress($params->get('commentsReportRecipient', $mainframe->getCfg('mailfrom')));
|
||||
$mail->Send();
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
457
administrator/components/com_k2/models/extrafield.php
Normal file
457
administrator/components/com_k2/models/extrafield.php
Normal file
@@ -0,0 +1,457 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: extrafield.php 1965 2013-04-29 16:01:44Z lefteris.kavadas $
|
||||
* @package K2
|
||||
* @author JoomlaWorks http://www.joomlaworks.net
|
||||
* @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.
|
||||
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die ;
|
||||
|
||||
jimport('joomla.application.component.model');
|
||||
|
||||
JTable::addIncludePath(JPATH_COMPONENT.DS.'tables');
|
||||
|
||||
class K2ModelExtraField extends K2Model
|
||||
{
|
||||
|
||||
function getData()
|
||||
{
|
||||
|
||||
$cid = JRequest::getVar('cid');
|
||||
$row = JTable::getInstance('K2ExtraField', 'Table');
|
||||
$row->load($cid);
|
||||
return $row;
|
||||
}
|
||||
|
||||
function save()
|
||||
{
|
||||
|
||||
$mainframe = JFactory::getApplication();
|
||||
$row = JTable::getInstance('K2ExtraField', 'Table');
|
||||
if (!$row->bind(JRequest::get('post')))
|
||||
{
|
||||
$mainframe->redirect('index.php?option=com_k2&view=extrafields', $row->getError(), 'error');
|
||||
}
|
||||
|
||||
$isNewGroup = JRequest::getInt('isNew');
|
||||
|
||||
if ($isNewGroup)
|
||||
{
|
||||
|
||||
$group = JTable::getInstance('K2ExtraFieldsGroup', 'Table');
|
||||
$group->set('name', JRequest::getVar('group'));
|
||||
$group->store();
|
||||
$row->group = $group->id;
|
||||
}
|
||||
|
||||
if (!$row->id)
|
||||
{
|
||||
$row->ordering = $row->getNextOrder("`group` = {$row->group}");
|
||||
}
|
||||
|
||||
$objects = array();
|
||||
$values = JRequest::getVar('option_value', null, 'default', 'none', 4);
|
||||
$names = JRequest::getVar('option_name');
|
||||
$target = JRequest::getVar('option_target');
|
||||
$editor = JRequest::getVar('option_editor');
|
||||
$rows = JRequest::getVar('option_rows');
|
||||
$cols = JRequest::getVar('option_cols');
|
||||
$alias = JRequest::getWord('alias');
|
||||
$required = JRequest::getInt('required');
|
||||
$showNull = JRequest::getInt('showNull');
|
||||
$displayInFrontEnd = JRequest::getInt('displayInFrontEnd');
|
||||
|
||||
if (JString::strtolower($alias) == 'this')
|
||||
{
|
||||
$alias = '';
|
||||
}
|
||||
|
||||
for ($i = 0; $i < sizeof($values); $i++)
|
||||
{
|
||||
$object = new JObject;
|
||||
$object->set('name', $names[$i]);
|
||||
|
||||
if ($row->type == 'select' || $row->type == 'multipleSelect' || $row->type == 'radio')
|
||||
{
|
||||
$object->set('value', $i + 1);
|
||||
}
|
||||
elseif ($row->type == 'link')
|
||||
{
|
||||
if (substr($values[$i], 0, 7) == 'http://')
|
||||
{
|
||||
$values[$i] = $values[$i];
|
||||
}
|
||||
else
|
||||
{
|
||||
$values[$i] = 'http://'.$values[$i];
|
||||
}
|
||||
$object->set('value', $values[$i]);
|
||||
}
|
||||
elseif ($row->type == 'csv')
|
||||
{
|
||||
$file = JRequest::getVar('csv_file', NULL, 'FILES');
|
||||
$csvFile = $file['tmp_name'];
|
||||
if (!empty($csvFile) && JFile::getExt($file['name']) == 'csv')
|
||||
{
|
||||
$handle = @fopen($csvFile, 'r');
|
||||
$csvData = array();
|
||||
while (($data = fgetcsv($handle, 1000)) !== FALSE)
|
||||
{
|
||||
$csvData[] = $data;
|
||||
}
|
||||
fclose($handle);
|
||||
$object->set('value', $csvData);
|
||||
}
|
||||
else
|
||||
{
|
||||
require_once (JPATH_COMPONENT.DS.'lib'.DS.'JSON.php');
|
||||
$json = new Services_JSON;
|
||||
$object->set('value', $json->decode($values[$i]));
|
||||
if (JRequest::getBool('K2ResetCSV'))
|
||||
$object->set('value', null);
|
||||
}
|
||||
|
||||
}
|
||||
elseif ($row->type == 'textarea')
|
||||
{
|
||||
$object->set('value', $values[$i]);
|
||||
$object->set('editor', $editor[$i]);
|
||||
$object->set('rows', $rows[$i]);
|
||||
$object->set('cols', $cols[$i]);
|
||||
}
|
||||
elseif ($row->type == 'image')
|
||||
{
|
||||
$object->set('value', $values[$i]);
|
||||
}
|
||||
elseif ($row->type == 'header')
|
||||
{
|
||||
$object->set('value', JRequest::getString('name'));
|
||||
$object->set('displayInFrontEnd', $displayInFrontEnd);
|
||||
}
|
||||
else
|
||||
{
|
||||
$object->set('value', $values[$i]);
|
||||
}
|
||||
|
||||
$object->set('target', $target[$i]);
|
||||
$object->set('alias', $alias);
|
||||
$object->set('required', $required);
|
||||
$object->set('showNull', $showNull);
|
||||
unset($object->_errors);
|
||||
$objects[] = $object;
|
||||
}
|
||||
|
||||
require_once (JPATH_COMPONENT.DS.'lib'.DS.'JSON.php');
|
||||
$json = new Services_JSON;
|
||||
$row->value = $json->encode($objects);
|
||||
|
||||
if (!$row->check())
|
||||
{
|
||||
$mainframe->redirect('index.php?option=com_k2&view=extrafield&cid='.$row->id, $row->getError(), 'error');
|
||||
}
|
||||
|
||||
if (!$row->store())
|
||||
{
|
||||
$mainframe->redirect('index.php?option=com_k2&view=extrafields', $row->getError(), 'error');
|
||||
}
|
||||
|
||||
$params = JComponentHelper::getParams('com_k2');
|
||||
if (!$params->get('disableCompactOrdering'))
|
||||
$row->reorder("`group` = {$row->group}");
|
||||
|
||||
$cache = JFactory::getCache('com_k2');
|
||||
$cache->clean();
|
||||
|
||||
switch(JRequest::getCmd('task'))
|
||||
{
|
||||
case 'apply' :
|
||||
$msg = JText::_('K2_CHANGES_TO_EXTRA_FIELD_SAVED');
|
||||
$link = 'index.php?option=com_k2&view=extrafield&cid='.$row->id;
|
||||
break;
|
||||
case 'save' :
|
||||
default :
|
||||
$msg = JText::_('K2_EXTRA_FIELD_SAVED');
|
||||
$link = 'index.php?option=com_k2&view=extrafields';
|
||||
break;
|
||||
}
|
||||
|
||||
$mainframe->redirect($link, $msg);
|
||||
}
|
||||
|
||||
function getExtraFieldsByGroup($group)
|
||||
{
|
||||
|
||||
$db = JFactory::getDBO();
|
||||
$group = (int)$group;
|
||||
$query = "SELECT * FROM #__k2_extra_fields WHERE `group`={$group} AND published=1 ORDER BY ordering";
|
||||
$db->setQuery($query);
|
||||
$rows = $db->loadObjectList();
|
||||
return $rows;
|
||||
}
|
||||
|
||||
function renderExtraField($extraField, $itemID = NULL)
|
||||
{
|
||||
|
||||
$mainframe = JFactory::getApplication();
|
||||
require_once (JPATH_COMPONENT_ADMINISTRATOR.DS.'lib'.DS.'JSON.php');
|
||||
$json = new Services_JSON;
|
||||
|
||||
if (!is_null($itemID))
|
||||
{
|
||||
$item = JTable::getInstance('K2Item', 'Table');
|
||||
$item->load($itemID);
|
||||
}
|
||||
|
||||
$defaultValues = $json->decode($extraField->value);
|
||||
|
||||
foreach ($defaultValues as $value)
|
||||
{
|
||||
|
||||
$required = isset($value->required) ? $value->required : 0;
|
||||
$showNull = isset($value->showNull) ? $value->showNull : 0;
|
||||
|
||||
if ($extraField->type == 'textfield' || $extraField->type == 'csv' || $extraField->type == 'labels' || $extraField->type == 'date')
|
||||
{
|
||||
$active = $value->value;
|
||||
}
|
||||
elseif ($extraField->type == 'textarea')
|
||||
{
|
||||
$active[0] = $value->value;
|
||||
$active[1] = $value->editor;
|
||||
$active[2] = (int)$value->rows ? (int)$value->rows : 10;
|
||||
$active[3] = (int)$value->cols ? (int)$value->cols : 40;
|
||||
}
|
||||
elseif ($extraField->type == 'link')
|
||||
{
|
||||
$active[0] = $value->name;
|
||||
$active[1] = $value->value;
|
||||
$active[2] = $value->target;
|
||||
}
|
||||
else
|
||||
{
|
||||
$active = '';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (!isset($active))
|
||||
{
|
||||
$active = '';
|
||||
}
|
||||
|
||||
if (isset($item))
|
||||
{
|
||||
$currentValues = $json->decode($item->extra_fields);
|
||||
if (count($currentValues))
|
||||
{
|
||||
foreach ($currentValues as $value)
|
||||
{
|
||||
if ($value->id == $extraField->id)
|
||||
{
|
||||
if ($extraField->type == 'textarea')
|
||||
{
|
||||
$active[0] = $value->value;
|
||||
}
|
||||
else if ($extraField->type == 'date')
|
||||
{
|
||||
$active = (is_array($value->value)) ? $value->value[0] : $value->value;
|
||||
}
|
||||
else if ($extraField->type == 'header')
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
$active = $value->value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$attributes = '';
|
||||
if ($required)
|
||||
{
|
||||
$attributes .= 'class="k2Required"';
|
||||
}
|
||||
|
||||
if ($showNull && in_array($extraField->type, array(
|
||||
'select',
|
||||
'multipleSelect'
|
||||
)))
|
||||
{
|
||||
$nullOption = new stdClass;
|
||||
$nullOption->name = JText::_('K2_PLEASE_SELECT');
|
||||
$nullOption->value = '';
|
||||
array_unshift($defaultValues, $nullOption);
|
||||
}
|
||||
|
||||
if (in_array($extraField->type, array(
|
||||
'textfield',
|
||||
'labels',
|
||||
'date',
|
||||
'image'
|
||||
)))
|
||||
{
|
||||
$active = htmlspecialchars($active, ENT_QUOTES, 'UTF-8');
|
||||
}
|
||||
|
||||
switch ($extraField->type)
|
||||
{
|
||||
|
||||
case 'textfield' :
|
||||
$output = '<input type="text" name="K2ExtraField_'.$extraField->id.'" id="K2ExtraField_'.$extraField->id.'" value="'.$active.'" '.$attributes.' />';
|
||||
break;
|
||||
|
||||
case 'labels' :
|
||||
$output = '<input type="text" name="K2ExtraField_'.$extraField->id.'" id="K2ExtraField_'.$extraField->id.'" value="'.$active.'" '.$attributes.' /> '.JText::_('K2_COMMA_SEPARATED_VALUES');
|
||||
break;
|
||||
|
||||
case 'textarea' :
|
||||
if ($active[1])
|
||||
{
|
||||
if ($required)
|
||||
{
|
||||
$attributes = 'class="k2ExtraFieldEditor k2Required"';
|
||||
}
|
||||
else
|
||||
{
|
||||
$attributes = 'class="k2ExtraFieldEditor"';
|
||||
}
|
||||
}
|
||||
$output = '<textarea name="K2ExtraField_'.$extraField->id.'" id="K2ExtraField_'.$extraField->id.'" rows="'.$active[2].'" cols="'.$active[3].'" '.$attributes.'>'.htmlspecialchars($active[0], ENT_QUOTES, 'UTF-8').'</textarea>';
|
||||
break;
|
||||
|
||||
case 'select' :
|
||||
$attributes .= ' id="'.$extraField->id.'.$extraField->id"';
|
||||
$output = JHTML::_('select.genericlist', $defaultValues, 'K2ExtraField_'.$extraField->id, $attributes, 'value', 'name', $active);
|
||||
break;
|
||||
|
||||
case 'multipleSelect' :
|
||||
$attributes .= ' id="'.$extraField->id.'.$extraField->id" multiple="multiple"';
|
||||
$output = JHTML::_('select.genericlist', $defaultValues, 'K2ExtraField_'.$extraField->id.'[]', $attributes, 'value', 'name', $active);
|
||||
break;
|
||||
|
||||
case 'radio' :
|
||||
if (!$active && isset($defaultValues[0]))
|
||||
{
|
||||
$active = $defaultValues[0]->value;
|
||||
}
|
||||
$output = JHTML::_('select.radiolist', $defaultValues, 'K2ExtraField_'.$extraField->id, $attributes, 'value', 'name', $active);
|
||||
break;
|
||||
|
||||
case 'link' :
|
||||
$output = '<label>'.JText::_('K2_TEXT').'</label>';
|
||||
$output .= '<input type="text" name="K2ExtraField_'.$extraField->id.'[]" value="'.htmlspecialchars($active[0], ENT_QUOTES, 'UTF-8').'" />';
|
||||
$output .= '<label>'.JText::_('K2_URL').'</label>';
|
||||
$output .= '<input type="text" name="K2ExtraField_'.$extraField->id.'[]" id="K2ExtraField_'.$extraField->id.'" value="'.htmlspecialchars($active[1], ENT_QUOTES, 'UTF-8').'" '.$attributes.'/>';
|
||||
$output .= '<label>'.JText::_('K2_OPEN_IN').'</label>';
|
||||
$targetOptions[] = JHTML::_('select.option', 'same', JText::_('K2_SAME_WINDOW'));
|
||||
$targetOptions[] = JHTML::_('select.option', 'new', JText::_('K2_NEW_WINDOW'));
|
||||
$targetOptions[] = JHTML::_('select.option', 'popup', JText::_('K2_CLASSIC_JAVASCRIPT_POPUP'));
|
||||
$targetOptions[] = JHTML::_('select.option', 'lightbox', JText::_('K2_LIGHTBOX_POPUP'));
|
||||
$output .= JHTML::_('select.genericlist', $targetOptions, 'K2ExtraField_'.$extraField->id.'[]', '', 'value', 'text', $active[2]);
|
||||
break;
|
||||
|
||||
case 'csv' :
|
||||
if ($active)
|
||||
{
|
||||
$attributes = '';
|
||||
}
|
||||
$output = '<input type="file" id="K2ExtraField_'.$extraField->id.'" name="K2ExtraField_'.$extraField->id.'[]" '.$attributes.' />';
|
||||
|
||||
if (is_array($active) && count($active))
|
||||
{
|
||||
$output .= '<input type="hidden" name="K2CSV_'.$extraField->id.'" value="'.htmlspecialchars($json->encode($active)).'"/>';
|
||||
$output .= '<table class="csvTable">';
|
||||
foreach ($active as $key => $row)
|
||||
{
|
||||
$output .= '<tr>';
|
||||
foreach ($row as $cell)
|
||||
{
|
||||
$output .= ($key > 0) ? '<td>'.$cell.'</td>' : '<th>'.$cell.'</th>';
|
||||
}
|
||||
$output .= '</tr>';
|
||||
}
|
||||
$output .= '</table>';
|
||||
$output .= '<label>'.JText::_('K2_DELETE_CSV_DATA').'</label>';
|
||||
$output .= '<input type="checkbox" name="K2ResetCSV_'.$extraField->id.'"/>';
|
||||
}
|
||||
break;
|
||||
|
||||
case 'date' :
|
||||
$output = JHTML::_('calendar', $active, 'K2ExtraField_'.$extraField->id, 'K2ExtraField_'.$extraField->id, '%Y-%m-%d', $attributes);
|
||||
break;
|
||||
case 'image' :
|
||||
$output = '<input type="text" name="K2ExtraField_'.$extraField->id.'" id="K2ExtraField_'.$extraField->id.'" value="'.$active.'" '.$attributes.' />
|
||||
<a class="k2ExtraFieldImageButton" href="'.JRoute::_('index.php?option=com_k2&view=media&type=image&tmpl=component&fieldID=K2ExtraField_'.$extraField->id).'">'.JText::_('K2_SELECT').'</a>';
|
||||
break;
|
||||
case 'header' :
|
||||
$output = '';
|
||||
break;
|
||||
}
|
||||
|
||||
return $output;
|
||||
|
||||
}
|
||||
|
||||
function getExtraFieldInfo($fieldID)
|
||||
{
|
||||
|
||||
$db = JFactory::getDBO();
|
||||
$fieldID = (int)$fieldID;
|
||||
$query = "SELECT * FROM #__k2_extra_fields WHERE published=1 AND id = ".$fieldID;
|
||||
$db->setQuery($query, 0, 1);
|
||||
$row = $db->loadObject();
|
||||
return $row;
|
||||
}
|
||||
|
||||
function getSearchValue($id, $currentValue)
|
||||
{
|
||||
|
||||
$row = JTable::getInstance('K2ExtraField', 'Table');
|
||||
$row->load($id);
|
||||
|
||||
require_once (JPATH_COMPONENT_ADMINISTRATOR.DS.'lib'.DS.'JSON.php');
|
||||
$json = new Services_JSON;
|
||||
$jsonObject = $json->decode($row->value);
|
||||
|
||||
$value = '';
|
||||
if ($row->type == 'textfield' || $row->type == 'textarea')
|
||||
{
|
||||
$value = $currentValue;
|
||||
}
|
||||
else if ($row->type == 'multipleSelect')
|
||||
{
|
||||
foreach ($jsonObject as $option)
|
||||
{
|
||||
if (in_array($option->value, $currentValue))
|
||||
$value .= $option->name.' ';
|
||||
}
|
||||
}
|
||||
else if ($row->type == 'link')
|
||||
{
|
||||
$value .= $currentValue[0].' ';
|
||||
$value .= $currentValue[1].' ';
|
||||
}
|
||||
else if ($row->type == 'labels')
|
||||
{
|
||||
$parts = explode(',', $currentValue);
|
||||
$value .= implode(' ', $parts);
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach ($jsonObject as $option)
|
||||
{
|
||||
if ($option->value == $currentValue)
|
||||
$value .= $option->name;
|
||||
}
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
|
||||
}
|
||||
361
administrator/components/com_k2/models/extrafields.php
Normal file
361
administrator/components/com_k2/models/extrafields.php
Normal file
@@ -0,0 +1,361 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: extrafields.php 1937 2013-03-07 15:19:16Z lefteris.kavadas $
|
||||
* @package K2
|
||||
* @author JoomlaWorks http://www.joomlaworks.net
|
||||
* @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.
|
||||
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
jimport('joomla.application.component.model');
|
||||
|
||||
JTable::addIncludePath(JPATH_COMPONENT.DS.'tables');
|
||||
|
||||
class K2ModelExtraFields extends K2Model
|
||||
{
|
||||
|
||||
function getData()
|
||||
{
|
||||
|
||||
$mainframe = JFactory::getApplication();
|
||||
$option = JRequest::getCmd('option');
|
||||
$view = JRequest::getCmd('view');
|
||||
$db = JFactory::getDBO();
|
||||
$limit = $mainframe->getUserStateFromRequest('global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int');
|
||||
$limitstart = $mainframe->getUserStateFromRequest($option.$view.'.limitstart', 'limitstart', 0, 'int');
|
||||
$filter_order = $mainframe->getUserStateFromRequest($option.$view.'filter_order', 'filter_order', 'groupname', 'cmd');
|
||||
$filter_order_Dir = $mainframe->getUserStateFromRequest($option.$view.'filter_order_Dir', 'filter_order_Dir', 'ASC', 'word');
|
||||
$filter_state = $mainframe->getUserStateFromRequest($option.$view.'filter_state', 'filter_state', -1, 'int');
|
||||
$search = $mainframe->getUserStateFromRequest($option.$view.'search', 'search', '', 'string');
|
||||
$search = JString::strtolower($search);
|
||||
$filter_type = $mainframe->getUserStateFromRequest($option.$view.'filter_type', 'filter_type', '', 'string');
|
||||
$filter_group = $mainframe->getUserStateFromRequest($option.$view.'filter_group', 'filter_group', 0, 'int');
|
||||
|
||||
$query = "SELECT exf.*, exfg.name as groupname FROM #__k2_extra_fields AS exf LEFT JOIN #__k2_extra_fields_groups exfg ON exf.group=exfg.id WHERE exf.id>0";
|
||||
|
||||
if ($filter_state > -1)
|
||||
{
|
||||
$query .= " AND published={$filter_state}";
|
||||
}
|
||||
|
||||
if ($search)
|
||||
{
|
||||
$escaped = K2_JVERSION == '15' ? $db->getEscaped($search, true) : $db->escape($search, true);
|
||||
$query .= " AND LOWER( exf.name ) LIKE ".$db->Quote('%'.$escaped.'%', false);
|
||||
}
|
||||
|
||||
if ($filter_type)
|
||||
{
|
||||
$query .= " AND `type`=".$db->Quote($filter_type);
|
||||
}
|
||||
|
||||
if ($filter_group)
|
||||
{
|
||||
$query .= " AND `group`={$filter_group}";
|
||||
}
|
||||
|
||||
if (!$filter_order)
|
||||
{
|
||||
$filter_order = '`group`';
|
||||
}
|
||||
|
||||
if ($filter_order == 'ordering')
|
||||
{
|
||||
$query .= " ORDER BY `group`, ordering {$filter_order_Dir}";
|
||||
}
|
||||
else
|
||||
{
|
||||
$query .= " ORDER BY {$filter_order} {$filter_order_Dir}, `group`, ordering";
|
||||
}
|
||||
|
||||
$db->setQuery($query, $limitstart, $limit);
|
||||
$rows = $db->loadObjectList();
|
||||
return $rows;
|
||||
}
|
||||
|
||||
function getTotal()
|
||||
{
|
||||
|
||||
$mainframe = JFactory::getApplication();
|
||||
$option = JRequest::getCmd('option');
|
||||
$view = JRequest::getCmd('view');
|
||||
$db = JFactory::getDBO();
|
||||
$limit = $mainframe->getUserStateFromRequest('global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int');
|
||||
$limitstart = $mainframe->getUserStateFromRequest($option.'.limitstart', 'limitstart', 0, 'int');
|
||||
$filter_state = $mainframe->getUserStateFromRequest($option.$view.'filter_state', 'filter_state', 1, 'int');
|
||||
$search = $mainframe->getUserStateFromRequest($option.$view.'search', 'search', '', 'string');
|
||||
$search = JString::strtolower($search);
|
||||
$filter_type = $mainframe->getUserStateFromRequest($option.$view.'filter_type', 'filter_type', '', 'string');
|
||||
$filter_group = $mainframe->getUserStateFromRequest($option.$view.'filter_group', 'filter_group', '', 'string');
|
||||
|
||||
$query = "SELECT COUNT(*) FROM #__k2_extra_fields WHERE id>0";
|
||||
|
||||
if ($filter_state > -1)
|
||||
{
|
||||
$query .= " AND published={$filter_state}";
|
||||
}
|
||||
|
||||
if ($search)
|
||||
{
|
||||
$escaped = K2_JVERSION == '15' ? $db->getEscaped($search, true) : $db->escape($search, true);
|
||||
$query .= " AND LOWER( name ) LIKE ".$db->Quote('%'.$escaped.'%', false);
|
||||
}
|
||||
|
||||
if ($filter_type)
|
||||
{
|
||||
$query .= " AND `type`=".$db->Quote($filter_type);
|
||||
}
|
||||
|
||||
if ($filter_group)
|
||||
{
|
||||
$query .= " AND `group`=".$db->Quote($filter_group);
|
||||
}
|
||||
|
||||
$db->setQuery($query);
|
||||
$total = $db->loadresult();
|
||||
return $total;
|
||||
}
|
||||
|
||||
function publish()
|
||||
{
|
||||
|
||||
$mainframe = JFactory::getApplication();
|
||||
$cid = JRequest::getVar('cid');
|
||||
foreach ($cid as $id)
|
||||
{
|
||||
$row = JTable::getInstance('K2ExtraField', 'Table');
|
||||
$row->load($id);
|
||||
$row->publish($id, 1);
|
||||
}
|
||||
$cache = JFactory::getCache('com_k2');
|
||||
$cache->clean();
|
||||
$mainframe->redirect('index.php?option=com_k2&view=extrafields');
|
||||
}
|
||||
|
||||
function unpublish()
|
||||
{
|
||||
|
||||
$mainframe = JFactory::getApplication();
|
||||
$cid = JRequest::getVar('cid');
|
||||
foreach ($cid as $id)
|
||||
{
|
||||
$row = JTable::getInstance('K2ExtraField', 'Table');
|
||||
$row->load($id);
|
||||
$row->publish($id, 0);
|
||||
}
|
||||
$cache = JFactory::getCache('com_k2');
|
||||
$cache->clean();
|
||||
$mainframe->redirect('index.php?option=com_k2&view=extrafields');
|
||||
}
|
||||
|
||||
function saveorder()
|
||||
{
|
||||
|
||||
$mainframe = JFactory::getApplication();
|
||||
$db = JFactory::getDBO();
|
||||
$cid = JRequest::getVar('cid', array(0), 'post', 'array');
|
||||
$total = count($cid);
|
||||
$order = JRequest::getVar('order', array(0), 'post', 'array');
|
||||
JArrayHelper::toInteger($order, array(0));
|
||||
$groupings = array();
|
||||
for ($i = 0; $i < $total; $i++)
|
||||
{
|
||||
$row = JTable::getInstance('K2ExtraField', 'Table');
|
||||
$row->load((int)$cid[$i]);
|
||||
$groupings[] = $row->group;
|
||||
if ($row->ordering != $order[$i])
|
||||
{
|
||||
$row->ordering = $order[$i];
|
||||
if (!$row->store())
|
||||
{
|
||||
JError::raiseError(500, $db->getErrorMsg());
|
||||
}
|
||||
}
|
||||
}
|
||||
$params = JComponentHelper::getParams('com_k2');
|
||||
if (!$params->get('disableCompactOrdering'))
|
||||
{
|
||||
$groupings = array_unique($groupings);
|
||||
foreach ($groupings as $group)
|
||||
{
|
||||
$row = JTable::getInstance('K2ExtraField', 'Table');
|
||||
$row->reorder("`group` = {$group}");
|
||||
}
|
||||
}
|
||||
$cache = JFactory::getCache('com_k2');
|
||||
$cache->clean();
|
||||
return true;
|
||||
}
|
||||
|
||||
function orderup()
|
||||
{
|
||||
|
||||
$mainframe = JFactory::getApplication();
|
||||
$cid = JRequest::getVar('cid');
|
||||
$row = JTable::getInstance('K2ExtraField', 'Table');
|
||||
$row->load($cid[0]);
|
||||
$row->move(-1, "`group` = '{$row->group}'");
|
||||
$params = JComponentHelper::getParams('com_k2');
|
||||
if (!$params->get('disableCompactOrdering'))
|
||||
$row->reorder("`group` = '{$row->group}'");
|
||||
$cache = JFactory::getCache('com_k2');
|
||||
$cache->clean();
|
||||
$msg = JText::_('K2_NEW_ORDERING_SAVED');
|
||||
$mainframe->redirect('index.php?option=com_k2&view=extrafields', $msg);
|
||||
}
|
||||
|
||||
function orderdown()
|
||||
{
|
||||
|
||||
$mainframe = JFactory::getApplication();
|
||||
$cid = JRequest::getVar('cid');
|
||||
$row = JTable::getInstance('K2ExtraField', 'Table');
|
||||
$row->load($cid[0]);
|
||||
$row->move(1, "`group` = '{$row->group}'");
|
||||
$params = JComponentHelper::getParams('com_k2');
|
||||
if (!$params->get('disableCompactOrdering'))
|
||||
$row->reorder("`group` = '{$row->group}'");
|
||||
$cache = JFactory::getCache('com_k2');
|
||||
$cache->clean();
|
||||
$msg = JText::_('K2_NEW_ORDERING_SAVED');
|
||||
$mainframe->redirect('index.php?option=com_k2&view=extrafields', $msg);
|
||||
}
|
||||
|
||||
function remove()
|
||||
{
|
||||
|
||||
$mainframe = JFactory::getApplication();
|
||||
$db = JFactory::getDBO();
|
||||
$cid = JRequest::getVar('cid');
|
||||
foreach ($cid as $id)
|
||||
{
|
||||
$row = JTable::getInstance('K2ExtraField', 'Table');
|
||||
$row->load($id);
|
||||
$row->delete($id);
|
||||
}
|
||||
$cache = JFactory::getCache('com_k2');
|
||||
$cache->clean();
|
||||
$mainframe->redirect('index.php?option=com_k2&view=extrafields', JText::_('K2_DELETE_COMPLETED'));
|
||||
}
|
||||
|
||||
function getExtraFieldsGroup()
|
||||
{
|
||||
|
||||
$cid = JRequest::getVar('cid');
|
||||
$row = JTable::getInstance('K2ExtraFieldsGroup', 'Table');
|
||||
$row->load($cid);
|
||||
return $row;
|
||||
}
|
||||
|
||||
function getGroups($filter = false)
|
||||
{
|
||||
|
||||
$mainframe = JFactory::getApplication();
|
||||
$option = JRequest::getCmd('option');
|
||||
$view = JRequest::getCmd('view');
|
||||
$limit = $mainframe->getUserStateFromRequest('global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int');
|
||||
$limitstart = $mainframe->getUserStateFromRequest($option.$view.'.limitstart', 'limitstart', 0, 'int');
|
||||
$db = JFactory::getDBO();
|
||||
$query = "SELECT * FROM #__k2_extra_fields_groups ORDER BY `name`";
|
||||
if ($filter)
|
||||
{
|
||||
$db->setQuery($query);
|
||||
}
|
||||
else
|
||||
{
|
||||
$db->setQuery($query, $limitstart, $limit);
|
||||
}
|
||||
|
||||
$rows = $db->loadObjectList();
|
||||
for ($i = 0; $i < sizeof($rows); $i++)
|
||||
{
|
||||
$query = "SELECT name FROM #__k2_categories WHERE extraFieldsGroup=".(int)$rows[$i]->id;
|
||||
$db->setQuery($query);
|
||||
$categories = K2_JVERSION == '30' ? $db->loadColumn() : $db->loadResultArray();
|
||||
if (is_array($categories))
|
||||
{
|
||||
$rows[$i]->categories = implode(', ', $categories);
|
||||
}
|
||||
else
|
||||
{
|
||||
$rows[$i]->categories = '';
|
||||
}
|
||||
|
||||
}
|
||||
return $rows;
|
||||
}
|
||||
|
||||
function getTotalGroups()
|
||||
{
|
||||
|
||||
$db = JFactory::getDBO();
|
||||
$query = "SELECT COUNT(*) FROM #__k2_extra_fields_groups";
|
||||
$db->setQuery($query);
|
||||
$total = $db->loadResult();
|
||||
return $total;
|
||||
}
|
||||
|
||||
function saveGroup()
|
||||
{
|
||||
|
||||
$mainframe = JFactory::getApplication();
|
||||
$id = JRequest::getInt('id');
|
||||
$row = JTable::getInstance('K2ExtraFieldsGroup', 'Table');
|
||||
if (!$row->bind(JRequest::get('post')))
|
||||
{
|
||||
$mainframe->redirect('index.php?option=com_k2&view=extrafieldsgroups', $row->getError(), 'error');
|
||||
}
|
||||
|
||||
if (!$row->check())
|
||||
{
|
||||
$mainframe->redirect('index.php?option=com_k2&view=extrafieldsgroup&cid='.$row->id, $row->getError(), 'error');
|
||||
}
|
||||
|
||||
if (!$row->store())
|
||||
{
|
||||
$mainframe->redirect('index.php?option=com_k2&view=extrafieldsgroup', $row->getError(), 'error');
|
||||
}
|
||||
|
||||
switch(JRequest::getCmd('task'))
|
||||
{
|
||||
case 'apply' :
|
||||
$msg = JText::_('K2_CHANGES_TO_GROUP_SAVED');
|
||||
$link = 'index.php?option=com_k2&view=extrafieldsgroup&cid='.$row->id;
|
||||
break;
|
||||
case 'save' :
|
||||
default :
|
||||
$msg = JText::_('K2_GROUP_SAVED');
|
||||
$link = 'index.php?option=com_k2&view=extrafieldsgroups';
|
||||
break;
|
||||
}
|
||||
|
||||
$cache = JFactory::getCache('com_k2');
|
||||
$cache->clean();
|
||||
$mainframe->redirect($link, $msg);
|
||||
}
|
||||
|
||||
function removeGroups()
|
||||
{
|
||||
|
||||
$mainframe = JFactory::getApplication();
|
||||
$db = &JFactory::getDBO();
|
||||
$cid = JRequest::getVar('cid');
|
||||
JArrayHelper::toInteger($cid);
|
||||
foreach ($cid as $id)
|
||||
{
|
||||
$row = JTable::getInstance('K2ExtraFieldsGroup', 'Table');
|
||||
$row->load($id);
|
||||
$query = "DELETE FROM #__k2_extra_fields WHERE `group`={$id}";
|
||||
$db->setQuery($query);
|
||||
$db->query();
|
||||
$row->delete($id);
|
||||
}
|
||||
$cache = &JFactory::getCache('com_k2');
|
||||
$cache->clean();
|
||||
$mainframe->redirect('index.php?option=com_k2&view=extrafieldsgroups', JText::_('K2_DELETE_COMPLETED'));
|
||||
}
|
||||
|
||||
}
|
||||
1323
administrator/components/com_k2/models/item.php
Normal file
1323
administrator/components/com_k2/models/item.php
Normal file
File diff suppressed because it is too large
Load Diff
778
administrator/components/com_k2/models/item.xml
Normal file
778
administrator/components/com_k2/models/item.xml
Normal file
@@ -0,0 +1,778 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<form>
|
||||
<name>K2_ITEM_EDIT_FORM</name>
|
||||
<params group="item-view-options-listings" addpath="/administrator/components/com_k2/elements">
|
||||
<param name="catItemTitle" type="list" default="" label="K2_TITLE" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="catItemTitleLinked" type="list" default="" label="K2_LINK_ON_TITLE" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="catItemFeaturedNotice" type="list" default="" label="K2_FEATURED_NOTICE_NEXT_TO_TITLE" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="catItemAuthor" type="list" default="" label="K2_AUTHOR" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="catItemDateCreated" type="list" default="" label="K2_ITEM_CREATED_DATE_AND_TIME" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="catItemRating" type="list" default="" label="K2_RATING_VOTING" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="catItemImage" type="list" default="" label="K2_IMAGE" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="catItemIntroText" type="list" default="" label="K2_INTROTEXT" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="catItemExtraFields" type="list" default="" label="K2_EXTRA_FIELDS" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="catItemHits" type="list" default="" label="K2_HITS" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="catItemCategory" type="list" default="" label="K2_CATEGORY" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="catItemTags" type="list" default="" label="K2_TAGS" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="catItemAttachments" type="list" default="" label="K2_ATTACHMENTS" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="catItemAttachmentsCounter" type="list" default="" label="K2_ATTACHMENTS_COUNTER" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="catItemVideo" type="list" default="" label="K2_MEDIA" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="catItemVideoWidth" type="text" default="" size="4" label="K2_VIDEO_WIDTH" description=""/>
|
||||
<param name="catItemVideoHeight" type="text" default="" size="4" label="K2_VIDEO_HEIGHT" description=""/>
|
||||
<param name="catItemAudioWidth" type="text" default="" size="4" label="K2_AUDIO_WIDTH" description=""/>
|
||||
<param name="catItemAudioHeight" type="text" default="" size="4" label="K2_AUDIO_HEIGHT" description=""/>
|
||||
<param name="catItemVideoAutoPlay" type="list" default="" label="K2_MEDIA_AUTOPLAY" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_NO</option>
|
||||
<option value="1">K2_YES</option>
|
||||
</param>
|
||||
<param name="catItemImageGallery" type="list" default="" label="K2_IMAGE_GALLERY" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="catItemDateModified" type="list" default="" label="K2_ITEM_MODIFIED_DATE_AND_TIME" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="catItemReadMore" type="list" default="" label="K2_READ_MORE_LINK" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="catItemCommentsAnchor" type="list" default="" label="K2_ANCHOR_LINK_WITH_COMMENTS_COUNTER_TO_ITEMS_COMMENT_FORM" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="" type="header" default="K2_ADVANCED" label="" description=""/>
|
||||
<param name="catItemK2Plugins" type="list" default="" label="K2_ENABLE_K2_PLUGINS" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_NO</option>
|
||||
<option value="1">K2_YES</option>
|
||||
</param>
|
||||
</params>
|
||||
<params group="item-view-options" addpath="/administrator/components/com_k2/elements">
|
||||
<param name="itemDateCreated" type="list" default="" label="K2_ITEM_CREATED_DATE_AND_TIME" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="itemTitle" type="list" default="" label="K2_TITLE" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="itemFeaturedNotice" type="list" default="" label="K2_FEATURED_NOTICE_NEXT_TO_TITLE" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="itemAuthor" type="list" default="" label="K2_AUTHOR" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="itemFontResizer" type="list" default="" label="K2_FONT_RESIZER" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="itemPrintButton" type="list" default="" label="K2_PRINT_BUTTON" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="itemEmailButton" type="list" default="" label="K2_EMAIL_BUTTON" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="itemSocialButton" type="list" default="" label="K2_SOCIAL_BUTTON_LIKE_SHARETHIS_ADDTHIS_ETC" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="itemVideoAnchor" type="list" default="" label="K2_ANCHOR_LINK_TO_VIDEO" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="itemImageGalleryAnchor" type="list" default="" label="K2_ANCHOR_LINK_TO_IMAGE_GALLERY" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="itemCommentsAnchor" type="list" default="" label="K2_ANCHOR_LINK_WITH_COMMENTS_COUNTER_TO_COMMENT_FORM" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="itemRating" type="list" default="" label="K2_RATING_VOTING" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="itemImage" type="list" default="" label="K2_IMAGE" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="itemImgSize" type="list" default="" label="K2_IMAGE_SIZE" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="XSmall">K2_XSMALL</option>
|
||||
<option value="Small">K2_SMALL</option>
|
||||
<option value="Medium">K2_MEDIUM</option>
|
||||
<option value="Large">K2_LARGE</option>
|
||||
<option value="XLarge">K2_XLARGE</option>
|
||||
</param>
|
||||
<param name="itemImageMainCaption" type="list" default="" label="K2_IMAGE_CAPTION" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="itemImageMainCredits" type="list" default="" label="K2_IMAGE_CREDITS" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="itemIntroText" type="list" default="" label="K2_INTROTEXT" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="itemFullText" type="list" default="" label="K2_FULLTEXT" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="itemExtraFields" type="list" default="" label="K2_EXTRA_FIELDS" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="itemDateModified" type="list" default="" label="K2_ITEM_MODIFIED_DATE_AND_TIME" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="itemHits" type="list" default="" label="K2_HITS_PAGE_VIEWS" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="itemCategory" type="list" default="" label="K2_CATEGORY" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="itemTags" type="list" default="" label="K2_TAGS" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="itemAttachments" type="list" default="" label="K2_ATTACHMENTS" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="itemAttachmentsCounter" type="list" default="" label="K2_ATTACHMENTS_COUNTER" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="itemVideo" type="list" default="" label="K2_MEDIA" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="itemVideoWidth" type="text" default="" size="4" label="K2_VIDEO_WIDTH" description=""/>
|
||||
<param name="itemVideoHeight" type="text" default="" size="4" label="K2_VIDEO_HEIGHT" description=""/>
|
||||
<param name="itemAudioWidth" type="text" default="" size="4" label="K2_AUDIO_WIDTH" description=""/>
|
||||
<param name="itemAudioHeight" type="text" default="" size="4" label="K2_AUDIO_HEIGHT" description=""/>
|
||||
<param name="itemVideoAutoPlay" type="list" default="" label="K2_MEDIA_AUTOPLAY" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_NO</option>
|
||||
<option value="1">K2_YES</option>
|
||||
</param>
|
||||
<param name="itemVideoCaption" type="list" default="" label="K2_MEDIA_CAPTION" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="itemVideoCredits" type="list" default="" label="K2_MEDIA_CREDITS" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="itemImageGallery" type="list" default="" label="K2_IMAGE_GALLERY" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="itemNavigation" type="list" default="" label="K2_ITEM_NAVIGATION" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="itemComments" type="list" default="" label="K2_COMMENTS" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="" type="header" default="K2_SOCIAL_SHARING" label="" description=""/>
|
||||
<param name="itemTwitterButton" type="list" default="" label="K2_TWITTER_SHARE" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="itemFacebookButton" type="list" default="" label="K2_FACEBOOK_SHARE" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="itemGooglePlusOneButton" type="list" default="" label="K2_GOOGLEPLUSONE_SHARE" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="" type="header" default="K2_AUTHOR_OPTIONS" label="" description=""/>
|
||||
<param name="itemAuthorBlock" type="list" default="" label="K2_DISPLAY_EXTENDED_AUTHOR_INFO" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="itemAuthorImage" type="list" default="" label="K2_AUTHOR_IMAGE" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="itemAuthorDescription" type="list" default="" label="K2_AUTHOR_DESCRIPTION" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="itemAuthorURL" type="list" default="" label="K2_AUTHOR_URL" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="itemAuthorEmail" type="list" default="" label="K2_AUTHOR_EMAIL" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="itemAuthorLatest" type="list" default="" label="K2_LATEST_ITEMS_FROM_AUTHOR" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="itemAuthorLatestLimit" type="text" default="" size="4" label="K2_LIMIT_FOR_LATEST_ITEMS_FROM_AUTHOR" description="K2_LEAVE_BLANK_TO_INHERIT_FROM_CATEGORY"/>
|
||||
<param name="" type="header" default="K2_RELATED_ITEMS" label="" description=""/>
|
||||
<param name="itemRelated" type="list" default="" label="K2_RELATED_ITEMS_BY_TAG" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="itemRelatedLimit" type="text" default="" size="4" label="K2_RELATED_ITEMS_LIMIT" description=""/>
|
||||
<param name="itemRelatedTitle" type="list" default="" label="K2_RELATED_ITEMS_TITLE" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="itemRelatedCategory" type="list" default="" label="K2_RELATED_ITEMS_CATEGORY" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="itemRelatedImageSize" type="list" default="" label="K2_RELATED_ITEMS_IMAGE" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_NONE_SELECTED</option>
|
||||
<option value="XSmall">K2_XSMALL</option>
|
||||
<option value="Small">K2_SMALL</option>
|
||||
<option value="Medium">K2_MEDIUM</option>
|
||||
<option value="Large">K2_LARGE</option>
|
||||
<option value="XLarge">K2_XLARGE</option>
|
||||
</param>
|
||||
<param name="itemRelatedIntrotext" type="list" default="" label="K2_RELATED_ITEMS_INTROTEXT" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="itemRelatedFulltext" type="list" default="" label="K2_RELATED_ITEMS_FULLTEXT" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="itemRelatedAuthor" type="list" default="" label="K2_RELATED_ITEMS_AUTHOR" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="itemRelatedMedia" type="list" default="" label="K2_RELATED_ITEMS_MEDIA" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="itemRelatedImageGallery" type="list" default="" label="K2_RELATED_ITEMS_IMAGE_GALLERY" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</param>
|
||||
<param name="" type="header" default="K2_ADVANCED" label="" description=""/>
|
||||
<param name="itemK2Plugins" type="list" default="" label="K2_ENABLE_K2_PLUGINS" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_NO</option>
|
||||
<option value="1">K2_YES</option>
|
||||
</param>
|
||||
</params>
|
||||
<fields name="params">
|
||||
<fieldset name="item-view-options-listings" addfieldpath="/administrator/components/com_k2/elements">
|
||||
<field name="catItemTitle" type="list" default="" label="K2_TITLE" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="catItemTitleLinked" type="list" default="" label="K2_LINK_ON_TITLE" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="catItemFeaturedNotice" type="list" default="" label="K2_FEATURED_NOTICE_NEXT_TO_TITLE" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="catItemAuthor" type="list" default="" label="K2_AUTHOR" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="catItemDateCreated" type="list" default="" label="K2_ITEM_CREATED_DATE_AND_TIME" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="catItemRating" type="list" default="" label="K2_RATING_VOTING" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="catItemImage" type="list" default="" label="K2_IMAGE" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="catItemIntroText" type="list" default="" label="K2_INTROTEXT" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="catItemExtraFields" type="list" default="" label="K2_EXTRA_FIELDS" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="catItemHits" type="list" default="" label="K2_HITS" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="catItemCategory" type="list" default="" label="K2_CATEGORY" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="catItemTags" type="list" default="" label="K2_TAGS" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="catItemAttachments" type="list" default="" label="K2_ATTACHMENTS" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="catItemAttachmentsCounter" type="list" default="" label="K2_ATTACHMENTS_COUNTER" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="catItemVideo" type="list" default="" label="K2_MEDIA" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="catItemVideoWidth" type="text" default="" size="4" label="K2_VIDEO_WIDTH" description=""/>
|
||||
<field name="catItemVideoHeight" type="text" default="" size="4" label="K2_VIDEO_HEIGHT" description=""/>
|
||||
<field name="catItemAudioWidth" type="text" default="" size="4" label="K2_AUDIO_WIDTH" description=""/>
|
||||
<field name="catItemAudioHeight" type="text" default="" size="4" label="K2_AUDIO_HEIGHT" description=""/>
|
||||
<field name="catItemVideoAutoPlay" type="list" default="" label="K2_MEDIA_AUTOPLAY" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_NO</option>
|
||||
<option value="1">K2_YES</option>
|
||||
</field>
|
||||
<field name="catItemImageGallery" type="list" default="" label="K2_IMAGE_GALLERY" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="catItemDateModified" type="list" default="" label="K2_ITEM_MODIFIED_DATE_AND_TIME" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="catItemReadMore" type="list" default="" label="K2_READ_MORE_LINK" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="catItemCommentsAnchor" type="list" default="" label="K2_ANCHOR_LINK_WITH_COMMENTS_COUNTER_TO_ITEMS_COMMENT_FORM" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="" type="header" default="K2_ADVANCED" label="" description=""/>
|
||||
<field name="catItemK2Plugins" type="list" default="" label="K2_ENABLE_K2_PLUGINS" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_NO</option>
|
||||
<option value="1">K2_YES</option>
|
||||
</field>
|
||||
</fieldset>
|
||||
<fieldset name="item-view-options" addfieldpath="/administrator/components/com_k2/elements">
|
||||
<field name="itemDateCreated" type="list" default="" label="K2_ITEM_CREATED_DATE_AND_TIME" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="itemTitle" type="list" default="" label="K2_TITLE" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="itemFeaturedNotice" type="list" default="" label="K2_FEATURED_NOTICE_NEXT_TO_TITLE" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="itemAuthor" type="list" default="" label="K2_AUTHOR" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="itemFontResizer" type="list" default="" label="K2_FONT_RESIZER" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="itemPrintButton" type="list" default="" label="K2_PRINT_BUTTON" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="itemEmailButton" type="list" default="" label="K2_EMAIL_BUTTON" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="itemSocialButton" type="list" default="" label="K2_SOCIAL_BUTTON_LIKE_SHARETHIS_ADDTHIS_ETC" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="itemVideoAnchor" type="list" default="" label="K2_ANCHOR_LINK_TO_VIDEO" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="itemImageGalleryAnchor" type="list" default="" label="K2_ANCHOR_LINK_TO_IMAGE_GALLERY" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="itemCommentsAnchor" type="list" default="" label="K2_ANCHOR_LINK_WITH_COMMENTS_COUNTER_TO_COMMENT_FORM" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="itemRating" type="list" default="" label="K2_RATING_VOTING" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="itemImage" type="list" default="" label="K2_IMAGE" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="itemImgSize" type="list" default="" label="K2_IMAGE_SIZE" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="XSmall">K2_XSMALL</option>
|
||||
<option value="Small">K2_SMALL</option>
|
||||
<option value="Medium">K2_MEDIUM</option>
|
||||
<option value="Large">K2_LARGE</option>
|
||||
<option value="XLarge">K2_XLARGE</option>
|
||||
</field>
|
||||
<field name="itemImageMainCaption" type="list" default="" label="K2_IMAGE_CAPTION" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="itemImageMainCredits" type="list" default="" label="K2_IMAGE_CREDITS" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="itemIntroText" type="list" default="" label="K2_INTROTEXT" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="itemFullText" type="list" default="" label="K2_FULLTEXT" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="itemExtraFields" type="list" default="" label="K2_EXTRA_FIELDS" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="itemDateModified" type="list" default="" label="K2_ITEM_MODIFIED_DATE_AND_TIME" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="itemHits" type="list" default="" label="K2_HITS_PAGE_VIEWS" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="itemCategory" type="list" default="" label="K2_CATEGORY" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="itemTags" type="list" default="" label="K2_TAGS" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="itemAttachments" type="list" default="" label="K2_ATTACHMENTS" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="itemAttachmentsCounter" type="list" default="" label="K2_ATTACHMENTS_COUNTER" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="itemVideo" type="list" default="" label="K2_MEDIA" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="itemVideoWidth" type="text" default="" size="4" label="K2_VIDEO_WIDTH" description=""/>
|
||||
<field name="itemVideoHeight" type="text" default="" size="4" label="K2_VIDEO_HEIGHT" description=""/>
|
||||
<field name="itemAudioWidth" type="text" default="" size="4" label="K2_AUDIO_WIDTH" description=""/>
|
||||
<field name="itemAudioHeight" type="text" default="" size="4" label="K2_AUDIO_HEIGHT" description=""/>
|
||||
<field name="itemVideoAutoPlay" type="list" default="" label="K2_MEDIA_AUTOPLAY" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_NO</option>
|
||||
<option value="1">K2_YES</option>
|
||||
</field>
|
||||
<field name="itemVideoCaption" type="list" default="" label="K2_MEDIA_CAPTION" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="itemVideoCredits" type="list" default="" label="K2_MEDIA_CREDITS" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="itemImageGallery" type="list" default="" label="K2_IMAGE_GALLERY" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="itemNavigation" type="list" default="" label="K2_ITEM_NAVIGATION" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="itemComments" type="list" default="" label="K2_COMMENTS" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="" type="header" default="K2_SOCIAL_SHARING" label="" description=""/>
|
||||
<field name="itemTwitterButton" type="list" default="" label="K2_TWITTER_SHARE" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="itemFacebookButton" type="list" default="" label="K2_FACEBOOK_SHARE" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="itemGooglePlusOneButton" type="list" default="" label="K2_GOOGLEPLUSONE_SHARE" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="" type="header" default="K2_AUTHOR_OPTIONS" label="" description=""/>
|
||||
<field name="itemAuthorBlock" type="list" default="" label="K2_DISPLAY_EXTENDED_AUTHOR_INFO" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="itemAuthorImage" type="list" default="" label="K2_AUTHOR_IMAGE" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="itemAuthorDescription" type="list" default="" label="K2_AUTHOR_DESCRIPTION" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="itemAuthorURL" type="list" default="" label="K2_AUTHOR_URL" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="itemAuthorEmail" type="list" default="" label="K2_AUTHOR_EMAIL" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="itemAuthorLatest" type="list" default="" label="K2_LATEST_ITEMS_FROM_AUTHOR" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="itemAuthorLatestLimit" type="text" default="" size="4" label="K2_LIMIT_FOR_LATEST_ITEMS_FROM_AUTHOR" description="K2_LEAVE_BLANK_TO_INHERIT_FROM_CATEGORY"/>
|
||||
<field name="" type="header" default="K2_RELATED_ITEMS" label="" description=""/>
|
||||
<field name="itemRelated" type="list" default="" label="K2_RELATED_ITEMS_BY_TAG" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="itemRelatedLimit" type="text" default="" size="4" label="K2_RELATED_ITEMS_LIMIT" description=""/>
|
||||
<field name="itemRelatedTitle" type="list" default="" label="K2_RELATED_ITEMS_TITLE" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="itemRelatedCategory" type="list" default="" label="K2_RELATED_ITEMS_CATEGORY" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="itemRelatedImageSize" type="list" default="" label="K2_RELATED_ITEMS_IMAGE" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_NONE_SELECTED</option>
|
||||
<option value="XSmall">K2_XSMALL</option>
|
||||
<option value="Small">K2_SMALL</option>
|
||||
<option value="Medium">K2_MEDIUM</option>
|
||||
<option value="Large">K2_LARGE</option>
|
||||
<option value="XLarge">K2_XLARGE</option>
|
||||
</field>
|
||||
<field name="itemRelatedIntrotext" type="list" default="" label="K2_RELATED_ITEMS_INTROTEXT" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="itemRelatedFulltext" type="list" default="" label="K2_RELATED_ITEMS_FULLTEXT" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="itemRelatedAuthor" type="list" default="" label="K2_RELATED_ITEMS_AUTHOR" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="itemRelatedMedia" type="list" default="" label="K2_RELATED_ITEMS_MEDIA" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="itemRelatedImageGallery" type="list" default="" label="K2_RELATED_ITEMS_IMAGE_GALLERY" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_HIDE</option>
|
||||
<option value="1">K2_SHOW</option>
|
||||
</field>
|
||||
<field name="" type="header" default="K2_ADVANCED" label="" description=""/>
|
||||
<field name="itemK2Plugins" type="list" default="" label="K2_ENABLE_K2_PLUGINS" description="">
|
||||
<option value="">K2_INHERIT_FROM_CATEGORY</option>
|
||||
<option value="0">K2_NO</option>
|
||||
<option value="1">K2_YES</option>
|
||||
</field>
|
||||
</fieldset>
|
||||
</fields>
|
||||
</form>
|
||||
1339
administrator/components/com_k2/models/items.php
Normal file
1339
administrator/components/com_k2/models/items.php
Normal file
File diff suppressed because it is too large
Load Diff
49
administrator/components/com_k2/models/model.php
Normal file
49
administrator/components/com_k2/models/model.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: model.php 1812 2013-01-14 18:45:06Z lefteris.kavadas $
|
||||
* @package K2
|
||||
* @author JoomlaWorks http://www.joomlaworks.net
|
||||
* @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.
|
||||
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die ;
|
||||
|
||||
jimport('joomla.application.component.model');
|
||||
|
||||
if (version_compare(JVERSION, '3.0', 'ge'))
|
||||
{
|
||||
class K2Model extends JModelLegacy
|
||||
{
|
||||
public static function addIncludePath($path = '', $prefix = '')
|
||||
{
|
||||
return parent::addIncludePath($path, $prefix);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
else if (version_compare(JVERSION, '2.5', 'ge'))
|
||||
{
|
||||
class K2Model extends JModel
|
||||
{
|
||||
public static function addIncludePath($path = '', $prefix = '')
|
||||
{
|
||||
return parent::addIncludePath($path, $prefix);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
class K2Model extends JModel
|
||||
{
|
||||
public function addIncludePath($path = '', $prefix = '')
|
||||
{
|
||||
return parent::addIncludePath($path);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
50
administrator/components/com_k2/models/settings.php
Normal file
50
administrator/components/com_k2/models/settings.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: settings.php 1812 2013-01-14 18:45:06Z lefteris.kavadas $
|
||||
* @package K2
|
||||
* @author JoomlaWorks http://www.joomlaworks.net
|
||||
* @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.
|
||||
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die ;
|
||||
|
||||
jimport('joomla.application.component.model');
|
||||
|
||||
class K2ModelSettings extends K2Model
|
||||
{
|
||||
|
||||
function save()
|
||||
{
|
||||
$mainframe = JFactory::getApplication();
|
||||
$component = JTable::getInstance('component');
|
||||
$component->loadByOption('com_k2');
|
||||
$post = JRequest::get('post');
|
||||
$component->bind($post);
|
||||
if (!$component->check())
|
||||
{
|
||||
$mainframe->enqueueMessage($component->getError(), 'error');
|
||||
return false;
|
||||
}
|
||||
if (!$component->store())
|
||||
{
|
||||
$mainframe->enqueueMessage($component->getError(), 'error');
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function & getParams()
|
||||
{
|
||||
static $instance;
|
||||
if ($instance == null)
|
||||
{
|
||||
$component = JTable::getInstance('component');
|
||||
$component->loadByOption('com_k2');
|
||||
$instance = new JParameter($component->params, JPATH_ADMINISTRATOR.DS.'components'.DS.'com_k2'.DS.'config.xml');
|
||||
}
|
||||
return $instance;
|
||||
}
|
||||
|
||||
}
|
||||
146
administrator/components/com_k2/models/tag.php
Normal file
146
administrator/components/com_k2/models/tag.php
Normal file
@@ -0,0 +1,146 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: tag.php 1812 2013-01-14 18:45:06Z lefteris.kavadas $
|
||||
* @package K2
|
||||
* @author JoomlaWorks http://www.joomlaworks.net
|
||||
* @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.
|
||||
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die ;
|
||||
|
||||
jimport('joomla.application.component.model');
|
||||
|
||||
JTable::addIncludePath(JPATH_COMPONENT.DS.'tables');
|
||||
|
||||
class K2ModelTag extends K2Model
|
||||
{
|
||||
|
||||
function getData()
|
||||
{
|
||||
|
||||
$cid = JRequest::getVar('cid');
|
||||
$row = JTable::getInstance('K2Tag', 'Table');
|
||||
$row->load($cid);
|
||||
return $row;
|
||||
}
|
||||
|
||||
function save()
|
||||
{
|
||||
|
||||
$mainframe = JFactory::getApplication();
|
||||
$row = JTable::getInstance('K2Tag', 'Table');
|
||||
|
||||
if (!$row->bind(JRequest::get('post')))
|
||||
{
|
||||
$mainframe->redirect('index.php?option=com_k2&view=tags', $row->getError(), 'error');
|
||||
}
|
||||
|
||||
if (!$row->check())
|
||||
{
|
||||
$mainframe->redirect('index.php?option=com_k2&view=tag&cid='.$row->id, $row->getError(), 'error');
|
||||
}
|
||||
|
||||
if (!$row->store())
|
||||
{
|
||||
$mainframe->redirect('index.php?option=com_k2&view=tags', $row->getError(), 'error');
|
||||
}
|
||||
|
||||
$cache = JFactory::getCache('com_k2');
|
||||
$cache->clean();
|
||||
|
||||
switch(JRequest::getCmd('task'))
|
||||
{
|
||||
case 'apply' :
|
||||
$msg = JText::_('K2_CHANGES_TO_TAG_SAVED');
|
||||
$link = 'index.php?option=com_k2&view=tag&cid='.$row->id;
|
||||
break;
|
||||
case 'save' :
|
||||
default :
|
||||
$msg = JText::_('K2_TAG_SAVED');
|
||||
$link = 'index.php?option=com_k2&view=tags';
|
||||
break;
|
||||
}
|
||||
$mainframe->redirect($link, $msg);
|
||||
}
|
||||
|
||||
function addTag()
|
||||
{
|
||||
|
||||
$mainframe = JFactory::getApplication();
|
||||
|
||||
$user = JFactory::getUser();
|
||||
$params = JComponentHelper::getParams('com_k2');
|
||||
if ($user->gid < 24 && $params->get('lockTags'))
|
||||
JError::raiseError(403, JText::_('K2_ALERTNOTAUTH'));
|
||||
|
||||
$tag = JRequest::getString('tag');
|
||||
$tag = str_replace('-', '', $tag);
|
||||
$tag = str_replace('.', '', $tag);
|
||||
|
||||
$response = new JObject;
|
||||
$response->set('name', $tag);
|
||||
|
||||
require_once (JPATH_COMPONENT_ADMINISTRATOR.DS.'lib'.DS.'JSON.php');
|
||||
$json = new Services_JSON;
|
||||
|
||||
if (empty($tag))
|
||||
{
|
||||
$response->set('msg', JText::_('K2_YOU_NEED_TO_ENTER_A_TAG', true));
|
||||
echo $json->encode($response);
|
||||
$mainframe->close();
|
||||
}
|
||||
|
||||
$db = JFactory::getDBO();
|
||||
$query = "SELECT COUNT(*) FROM #__k2_tags WHERE name=".$db->Quote($tag);
|
||||
$db->setQuery($query);
|
||||
$result = $db->loadResult();
|
||||
|
||||
if ($result > 0)
|
||||
{
|
||||
$response->set('msg', JText::_('K2_TAG_ALREADY_EXISTS', true));
|
||||
echo $json->encode($response);
|
||||
$mainframe->close();
|
||||
}
|
||||
|
||||
$row = JTable::getInstance('K2Tag', 'Table');
|
||||
$row->name = $tag;
|
||||
$row->published = 1;
|
||||
$row->store();
|
||||
|
||||
$cache = JFactory::getCache('com_k2');
|
||||
$cache->clean();
|
||||
|
||||
$response->set('id', $row->id);
|
||||
$response->set('status', 'success');
|
||||
$response->set('msg', JText::_('K2_TAG_ADDED_TO_AVAILABLE_TAGS_LIST', true));
|
||||
echo $json->encode($response);
|
||||
|
||||
$mainframe->close();
|
||||
|
||||
}
|
||||
|
||||
function tags()
|
||||
{
|
||||
$mainframe = JFactory::getApplication();
|
||||
$db = JFactory::getDBO();
|
||||
$word = JRequest::getString('q', null);
|
||||
if (K2_JVERSION == '15')
|
||||
{
|
||||
$word = $db->Quote($db->getEscaped($word, true).'%', false);
|
||||
}
|
||||
else
|
||||
{
|
||||
$word = $db->Quote($db->escape($word, true).'%', false);
|
||||
}
|
||||
$query = "SELECT name FROM #__k2_tags WHERE name LIKE ".$word;
|
||||
$db->setQuery($query);
|
||||
$result = K2_JVERSION == '30' ? $db->loadColumn() : $db->loadResultArray();
|
||||
require_once (JPATH_COMPONENT_ADMINISTRATOR.DS.'lib'.DS.'JSON.php');
|
||||
$json = new Services_JSON;
|
||||
echo $json->encode($result);
|
||||
$mainframe->close();
|
||||
}
|
||||
|
||||
}
|
||||
175
administrator/components/com_k2/models/tags.php
Normal file
175
administrator/components/com_k2/models/tags.php
Normal file
@@ -0,0 +1,175 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: tags.php 1947 2013-03-11 11:46:13Z lefteris.kavadas $
|
||||
* @package K2
|
||||
* @author JoomlaWorks http://www.joomlaworks.net
|
||||
* @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.
|
||||
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die ;
|
||||
|
||||
jimport('joomla.application.component.model');
|
||||
|
||||
JTable::addIncludePath(JPATH_COMPONENT.DS.'tables');
|
||||
|
||||
class K2ModelTags extends K2Model
|
||||
{
|
||||
|
||||
function getData()
|
||||
{
|
||||
|
||||
$mainframe = JFactory::getApplication();
|
||||
$option = JRequest::getCmd('option');
|
||||
$view = JRequest::getCmd('view');
|
||||
$db = JFactory::getDBO();
|
||||
$limit = $mainframe->getUserStateFromRequest('global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int');
|
||||
$limitstart = $mainframe->getUserStateFromRequest($option.$view.'.limitstart', 'limitstart', 0, 'int');
|
||||
$filter_order = $mainframe->getUserStateFromRequest($option.$view.'filter_order', 'filter_order', 'id', 'cmd');
|
||||
$filter_order_Dir = $mainframe->getUserStateFromRequest($option.$view.'filter_order_Dir', 'filter_order_Dir', 'DESC', 'word');
|
||||
$filter_state = $mainframe->getUserStateFromRequest($option.$view.'filter_state', 'filter_state', -1, 'int');
|
||||
$search = $mainframe->getUserStateFromRequest($option.$view.'search', 'search', '', 'string');
|
||||
$search = JString::strtolower($search);
|
||||
|
||||
$query = "SELECT #__k2_tags.*, (SELECT COUNT(*) FROM #__k2_tags_xref WHERE #__k2_tags_xref.tagID = #__k2_tags.id) AS numOfItems FROM #__k2_tags";
|
||||
|
||||
$conditions = array();
|
||||
|
||||
if ($filter_state > -1)
|
||||
{
|
||||
$conditions[] = "published={$filter_state}";
|
||||
}
|
||||
if ($search)
|
||||
{
|
||||
$escaped = K2_JVERSION == '15' ? $db->getEscaped($search, true) : $db->escape($search, true);
|
||||
$conditions[] = "LOWER( name ) LIKE ".$db->Quote('%'.$escaped.'%', false);
|
||||
}
|
||||
|
||||
if (count($conditions))
|
||||
{
|
||||
$query .= " WHERE ".implode(' AND ', $conditions);
|
||||
}
|
||||
|
||||
if (!$filter_order)
|
||||
{
|
||||
$filter_order = "name";
|
||||
}
|
||||
|
||||
$query .= " ORDER BY {$filter_order} {$filter_order_Dir}";
|
||||
|
||||
$db->setQuery($query, $limitstart, $limit);
|
||||
$rows = $db->loadObjectList();
|
||||
return $rows;
|
||||
}
|
||||
|
||||
function getTotal()
|
||||
{
|
||||
|
||||
$mainframe = JFactory::getApplication();
|
||||
$option = JRequest::getCmd('option');
|
||||
$view = JRequest::getCmd('view');
|
||||
$db = JFactory::getDBO();
|
||||
$limit = $mainframe->getUserStateFromRequest('global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int');
|
||||
$limitstart = $mainframe->getUserStateFromRequest($option.'.limitstart', 'limitstart', 0, 'int');
|
||||
$filter_state = $mainframe->getUserStateFromRequest($option.$view.'filter_state', 'filter_state', 1, 'int');
|
||||
$search = $mainframe->getUserStateFromRequest($option.$view.'search', 'search', '', 'string');
|
||||
$search = JString::strtolower($search);
|
||||
|
||||
$query = "SELECT COUNT(*) FROM #__k2_tags WHERE id>0";
|
||||
|
||||
if ($filter_state > -1)
|
||||
{
|
||||
$query .= " AND published={$filter_state}";
|
||||
}
|
||||
|
||||
if ($search)
|
||||
{
|
||||
$escaped = K2_JVERSION == '15' ? $db->getEscaped($search, true) : $db->escape($search, true);
|
||||
$query .= " AND LOWER( name ) LIKE ".$db->Quote('%'.$escaped.'%', false);
|
||||
}
|
||||
|
||||
$db->setQuery($query);
|
||||
$total = $db->loadresult();
|
||||
return $total;
|
||||
}
|
||||
|
||||
function publish()
|
||||
{
|
||||
|
||||
$mainframe = JFactory::getApplication();
|
||||
$cid = JRequest::getVar('cid');
|
||||
foreach ($cid as $id)
|
||||
{
|
||||
$row = JTable::getInstance('K2Tag', 'Table');
|
||||
$row->load($id);
|
||||
$row->publish($id, 1);
|
||||
}
|
||||
$cache = JFactory::getCache('com_k2');
|
||||
$cache->clean();
|
||||
$mainframe->redirect('index.php?option=com_k2&view=tags');
|
||||
}
|
||||
|
||||
function unpublish()
|
||||
{
|
||||
|
||||
$mainframe = JFactory::getApplication();
|
||||
$cid = JRequest::getVar('cid');
|
||||
foreach ($cid as $id)
|
||||
{
|
||||
$row = JTable::getInstance('K2Tag', 'Table');
|
||||
$row->load($id);
|
||||
$row->publish($id, 0);
|
||||
}
|
||||
$cache = JFactory::getCache('com_k2');
|
||||
$cache->clean();
|
||||
$mainframe->redirect('index.php?option=com_k2&view=tags');
|
||||
}
|
||||
|
||||
function remove()
|
||||
{
|
||||
|
||||
$mainframe = JFactory::getApplication();
|
||||
$db = JFactory::getDBO();
|
||||
$cid = JRequest::getVar('cid');
|
||||
foreach ($cid as $id)
|
||||
{
|
||||
$row = JTable::getInstance('K2Tag', 'Table');
|
||||
$row->load($id);
|
||||
$row->delete($id);
|
||||
}
|
||||
$cache = JFactory::getCache('com_k2');
|
||||
$cache->clean();
|
||||
$mainframe->redirect('index.php?option=com_k2&view=tags', JText::_('K2_DELETE_COMPLETED'));
|
||||
}
|
||||
|
||||
function getFilter()
|
||||
{
|
||||
|
||||
$db = JFactory::getDBO();
|
||||
$query = "SELECT name, id FROM #__k2_tags ORDER BY name";
|
||||
$db->setQuery($query, 0, 1000);
|
||||
$rows = $db->loadObjectList();
|
||||
return $rows;
|
||||
|
||||
}
|
||||
|
||||
function countTagItems($id)
|
||||
{
|
||||
$db = JFactory::getDBO();
|
||||
$query = "SELECT COUNT(*) FROM #__k2_tags_xref WHERE tagID = ".(int)$id;
|
||||
$db->setQuery($query);
|
||||
$result = $db->loadResult();
|
||||
return $result;
|
||||
}
|
||||
|
||||
function removeOrphans()
|
||||
{
|
||||
$db = JFactory::getDBO();
|
||||
$db->setQuery("DELETE FROM #__k2_tags WHERE id NOT IN (SELECT DISTINCT tagID FROM #__k2_tags_xref)");
|
||||
$db->query();
|
||||
$mainframe = JFactory::getApplication();
|
||||
$mainframe->redirect('index.php?option=com_k2&view=tags', JText::_('K2_DELETE_COMPLETED'));
|
||||
}
|
||||
|
||||
}
|
||||
196
administrator/components/com_k2/models/user.php
Normal file
196
administrator/components/com_k2/models/user.php
Normal file
@@ -0,0 +1,196 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: user.php 1812 2013-01-14 18:45:06Z lefteris.kavadas $
|
||||
* @package K2
|
||||
* @author JoomlaWorks http://www.joomlaworks.net
|
||||
* @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.
|
||||
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
jimport('joomla.application.component.model');
|
||||
|
||||
JTable::addIncludePath(JPATH_COMPONENT.DS.'tables');
|
||||
|
||||
class K2ModelUser extends K2Model
|
||||
{
|
||||
|
||||
function getData()
|
||||
{
|
||||
$cid = JRequest::getInt('cid');
|
||||
$db = JFactory::getDBO();
|
||||
$query = "SELECT * FROM #__k2_users WHERE userID = ".$cid;
|
||||
$db->setQuery($query);
|
||||
$row = $db->loadObject();
|
||||
if (!$row)
|
||||
{
|
||||
$row = JTable::getInstance('K2User', 'Table');
|
||||
}
|
||||
return $row;
|
||||
}
|
||||
|
||||
function save()
|
||||
{
|
||||
|
||||
$mainframe = JFactory::getApplication();
|
||||
jimport('joomla.filesystem.file');
|
||||
require_once (JPATH_COMPONENT.DS.'lib'.DS.'class.upload.php');
|
||||
$row = JTable::getInstance('K2User', 'Table');
|
||||
$params = JComponentHelper::getParams('com_k2');
|
||||
|
||||
if (!$row->bind(JRequest::get('post')))
|
||||
{
|
||||
$mainframe->redirect('index.php?option=com_k2&view=users', $row->getError(), 'error');
|
||||
}
|
||||
|
||||
$row->description = JRequest::getVar('description', '', 'post', 'string', 2);
|
||||
if ($params->get('xssFiltering'))
|
||||
{
|
||||
$filter = new JFilterInput( array(), array(), 1, 1, 0);
|
||||
$row->description = $filter->clean($row->description);
|
||||
}
|
||||
$jUser = JFactory::getUser($row->userID);
|
||||
$row->userName = $jUser->name;
|
||||
|
||||
if (!$row->store())
|
||||
{
|
||||
$mainframe->redirect('index.php?option=com_k2&view=users', $row->getError(), 'error');
|
||||
}
|
||||
|
||||
//Image
|
||||
if ((int)$params->get('imageMemoryLimit'))
|
||||
{
|
||||
ini_set('memory_limit', (int)$params->get('imageMemoryLimit').'M');
|
||||
}
|
||||
|
||||
$file = JRequest::get('files');
|
||||
|
||||
$savepath = JPATH_ROOT.DS.'media'.DS.'k2'.DS.'users'.DS;
|
||||
|
||||
if ($file['image']['error'] == 0 && !JRequest::getBool('del_image'))
|
||||
{
|
||||
$handle = new Upload($file['image']);
|
||||
if ($handle->uploaded)
|
||||
{
|
||||
$handle->file_auto_rename = false;
|
||||
$handle->file_overwrite = true;
|
||||
$handle->file_new_name_body = $row->id;
|
||||
$handle->image_resize = true;
|
||||
$handle->image_ratio_y = true;
|
||||
$handle->image_x = $params->get('userImageWidth', '100');
|
||||
$handle->Process($savepath);
|
||||
$handle->Clean();
|
||||
}
|
||||
else
|
||||
{
|
||||
$mainframe->redirect('index.php?option=com_k2&view=users', $handle->error, 'error');
|
||||
}
|
||||
$row->image = $handle->file_dst_name;
|
||||
}
|
||||
|
||||
if (JRequest::getBool('del_image'))
|
||||
{
|
||||
|
||||
$current = JTable::getInstance('K2User', 'Table');
|
||||
$current->load($row->id);
|
||||
if (JFile::exists(JPATH_ROOT.DS.'media'.DS.'k2'.DS.'users'.DS.$current->image))
|
||||
{
|
||||
JFile::delete(JPATH_ROOT.DS.'media'.DS.'k2'.DS.'users'.DS.$current->image);
|
||||
}
|
||||
$row->image = '';
|
||||
}
|
||||
|
||||
if (!$row->check())
|
||||
{
|
||||
$mainframe->redirect('index.php?option=com_k2&view=user&cid='.$row->id, $row->getError(), 'error');
|
||||
}
|
||||
|
||||
if (!$row->store())
|
||||
{
|
||||
$mainframe->redirect('index.php?option=com_k2&view=users', $row->getError(), 'error');
|
||||
}
|
||||
|
||||
$cache = JFactory::getCache('com_k2');
|
||||
$cache->clean();
|
||||
|
||||
switch(JRequest::getCmd('task'))
|
||||
{
|
||||
case 'apply' :
|
||||
$msg = JText::_('K2_CHANGES_TO_USER_SAVED');
|
||||
$link = 'index.php?option=com_k2&view=user&cid='.$row->userID;
|
||||
break;
|
||||
case 'save' :
|
||||
default :
|
||||
$msg = JText::_('K2_USER_SAVED');
|
||||
$link = 'index.php?option=com_k2&view=users';
|
||||
break;
|
||||
}
|
||||
$mainframe->redirect($link, $msg);
|
||||
}
|
||||
|
||||
function getUserGroups()
|
||||
{
|
||||
|
||||
$db = JFactory::getDBO();
|
||||
$query = "SELECT * FROM #__k2_user_groups";
|
||||
$db->setQuery($query);
|
||||
$rows = $db->loadObjectList();
|
||||
return $rows;
|
||||
}
|
||||
|
||||
function reportSpammer()
|
||||
{
|
||||
$mainframe = JFactory::getApplication();
|
||||
$params = JComponentHelper::getParams('com_k2');
|
||||
$id = (int)$this->getState('id');
|
||||
if (!$id)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
$user = JFactory::getUser();
|
||||
if ($user->id == $id)
|
||||
{
|
||||
$mainframe->enqueueMessage(JText::_('K2_YOU_CANNOT_REPORT_YOURSELF'), 'error');
|
||||
return false;
|
||||
}
|
||||
$db = JFactory::getDBO();
|
||||
|
||||
// Unpublish user comments
|
||||
$db->setQuery("UPDATE #__k2_comments SET published = 0 WHERE userID = ".$id);
|
||||
$db->query();
|
||||
$mainframe->enqueueMessage(JText::_('K2_USER_COMMENTS_UNPUBLISHED'));
|
||||
|
||||
// Unpublish user items
|
||||
$db->setQuery("UPDATE #__k2_items SET published = 0 WHERE created_by = ".$id);
|
||||
$db->query();
|
||||
$mainframe->enqueueMessage(JText::_('K2_USER_ITEMS_UNPUBLISHED'));
|
||||
|
||||
// Report the user to http://www.stopforumspam.com/
|
||||
// We need the IP for this, so the user has to be a registered K2 user
|
||||
$spammer = JFactory::getUser($id);
|
||||
$db->setQuery("SELECT ip FROM #__k2_users WHERE userID=".$id, 0, 1);
|
||||
$ip = $db->loadResult();
|
||||
if ($ip && function_exists('fsockopen') && $params->get('stopForumSpamApiKey'))
|
||||
{
|
||||
$data = "username=".$spammer->username."&ip_addr=".$ip."&email=".$spammer->email."&api_key=".$params->get('stopForumSpamApiKey');
|
||||
$fp = fsockopen("www.stopforumspam.com", 80);
|
||||
fputs($fp, "POST /add.php HTTP/1.1\n");
|
||||
fputs($fp, "Host: www.stopforumspam.com\n");
|
||||
fputs($fp, "Content-type: application/x-www-form-urlencoded\n");
|
||||
fputs($fp, "Content-length: ".strlen($data)."\n");
|
||||
fputs($fp, "Connection: close\n\n");
|
||||
fputs($fp, $data);
|
||||
fclose($fp);
|
||||
$mainframe->enqueueMessage(JText::_('K2_USER_DATA_SUBMITTED_TO_STOPFORUMSPAM'));
|
||||
}
|
||||
|
||||
// Finally block the user
|
||||
$db->setQuery("UPDATE #__users SET block = 1 WHERE id=".$id);
|
||||
$db->query();
|
||||
$mainframe->enqueueMessage(JText::_('K2_USER_BLOCKED'));
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
66
administrator/components/com_k2/models/usergroup.php
Normal file
66
administrator/components/com_k2/models/usergroup.php
Normal file
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: usergroup.php 1812 2013-01-14 18:45:06Z lefteris.kavadas $
|
||||
* @package K2
|
||||
* @author JoomlaWorks http://www.joomlaworks.net
|
||||
* @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.
|
||||
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
jimport('joomla.application.component.model');
|
||||
|
||||
JTable::addIncludePath(JPATH_COMPONENT.DS.'tables');
|
||||
|
||||
class K2ModelUserGroup extends K2Model
|
||||
{
|
||||
|
||||
function getData()
|
||||
{
|
||||
$cid = JRequest::getVar('cid');
|
||||
$row = JTable::getInstance('K2UserGroup', 'Table');
|
||||
$row->load($cid);
|
||||
return $row;
|
||||
}
|
||||
|
||||
function save()
|
||||
{
|
||||
$mainframe = JFactory::getApplication();
|
||||
$row = JTable::getInstance('K2UserGroup', 'Table');
|
||||
|
||||
if (!$row->bind(JRequest::get('post')))
|
||||
{
|
||||
$mainframe->redirect('index.php?option=com_k2&view=usergroups', $row->getError(), 'error');
|
||||
}
|
||||
|
||||
if (!$row->check())
|
||||
{
|
||||
$mainframe->redirect('index.php?option=com_k2&view=usergroup&cid='.$row->id, $row->getError(), 'error');
|
||||
}
|
||||
|
||||
if (!$row->store())
|
||||
{
|
||||
$mainframe->redirect('index.php?option=com_k2&view=usergroups', $row->getError(), 'error');
|
||||
}
|
||||
|
||||
$cache = JFactory::getCache('com_k2');
|
||||
$cache->clean();
|
||||
|
||||
switch(JRequest::getCmd('task'))
|
||||
{
|
||||
case 'apply' :
|
||||
$msg = JText::_('K2_CHANGES_TO_USER_GROUP_SAVED');
|
||||
$link = 'index.php?option=com_k2&view=usergroup&cid='.$row->id;
|
||||
break;
|
||||
case 'save' :
|
||||
default :
|
||||
$msg = JText::_('K2_USER_GROUP_SAVED');
|
||||
$link = 'index.php?option=com_k2&view=usergroups';
|
||||
break;
|
||||
}
|
||||
$mainframe->redirect($link, $msg);
|
||||
}
|
||||
|
||||
}
|
||||
66
administrator/components/com_k2/models/usergroup.xml
Normal file
66
administrator/components/com_k2/models/usergroup.xml
Normal file
@@ -0,0 +1,66 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<form>
|
||||
<name>K2_USER_GROUP_EDIT_FORM</name>
|
||||
<params addpath="/administrator/components/com_k2/elements">
|
||||
<param name="comment" type="radio" default="1" label="K2_POST_COMMENTS" description="">
|
||||
<option value="0">K2_NO</option>
|
||||
<option value="1">K2_YES</option>
|
||||
</param>
|
||||
<param name="frontEdit" type="radio" default="0" label="K2_FRONTEND_ITEM_EDITING" description="">
|
||||
<option value="0">K2_NO</option>
|
||||
<option value="1">K2_YES</option>
|
||||
</param>
|
||||
<param name="add" type="radio" default="0" label="K2_ADD_ITEMS" description="">
|
||||
<option value="0">K2_NO</option>
|
||||
<option value="1">K2_YES</option>
|
||||
</param>
|
||||
<param name="editOwn" type="radio" default="0" label="K2_EDIT_OWN_ITEMS" description="">
|
||||
<option value="0">K2_NO</option>
|
||||
<option value="1">K2_YES</option>
|
||||
</param>
|
||||
<param name="editAll" type="radio" default="0" label="K2_EDIT_ANY_ITEM" description="">
|
||||
<option value="0">K2_NO</option>
|
||||
<option value="1">K2_YES</option>
|
||||
</param>
|
||||
<param name="publish" type="radio" default="0" label="K2_PUBLISH_ITEMS" description="K2_PERMISSION_TO_PUBLISH_NEW_OR_EDITED_ITEMS">
|
||||
<option value="0">K2_NO</option>
|
||||
<option value="1">K2_YES</option>
|
||||
</param>
|
||||
<param name="editPublished" type="radio" default="0" label="K2_ALLOW_EDITING_OF_ALREADY_PUBLISHED_ITEMS" description="">
|
||||
<option value="0">K2_NO</option>
|
||||
<option value="1">K2_YES</option>
|
||||
</param>
|
||||
</params>
|
||||
<fields name="params">
|
||||
<fieldset name="user-permissions" addfieldpath="/administrator/components/com_k2/elements">
|
||||
<field name="comment" type="radio" default="1" label="K2_POST_COMMENTS" description="">
|
||||
<option value="0">K2_NO</option>
|
||||
<option value="1">K2_YES</option>
|
||||
</field>
|
||||
<field name="frontEdit" type="radio" default="0" label="K2_FRONTEND_ITEM_EDITING" description="">
|
||||
<option value="0">K2_NO</option>
|
||||
<option value="1">K2_YES</option>
|
||||
</field>
|
||||
<field name="add" type="radio" default="0" label="K2_ADD_ITEMS" description="">
|
||||
<option value="0">K2_NO</option>
|
||||
<option value="1">K2_YES</option>
|
||||
</field>
|
||||
<field name="editOwn" type="radio" default="0" label="K2_EDIT_OWN_ITEMS" description="">
|
||||
<option value="0">K2_NO</option>
|
||||
<option value="1">K2_YES</option>
|
||||
</field>
|
||||
<field name="editAll" type="radio" default="0" label="K2_EDIT_ANY_ITEM" description="">
|
||||
<option value="0">K2_NO</option>
|
||||
<option value="1">K2_YES</option>
|
||||
</field>
|
||||
<field name="publish" type="radio" default="0" label="K2_PUBLISH_ITEMS" description="K2_PERMISSION_TO_PUBLISH_NEW_OR_EDITED_ITEMS">
|
||||
<option value="0">K2_NO</option>
|
||||
<option value="1">K2_YES</option>
|
||||
</field>
|
||||
<field name="editPublished" type="radio" default="0" label="K2_ALLOW_EDITING_OF_ALREADY_PUBLISHED_ITEMS" description="">
|
||||
<option value="0">K2_NO</option>
|
||||
<option value="1">K2_YES</option>
|
||||
</field>
|
||||
</fieldset>
|
||||
</fields>
|
||||
</form>
|
||||
78
administrator/components/com_k2/models/usergroups.php
Normal file
78
administrator/components/com_k2/models/usergroups.php
Normal file
@@ -0,0 +1,78 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: usergroups.php 1937 2013-03-07 15:19:16Z lefteris.kavadas $
|
||||
* @package K2
|
||||
* @author JoomlaWorks http://www.joomlaworks.net
|
||||
* @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.
|
||||
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
jimport('joomla.application.component.model');
|
||||
|
||||
JTable::addIncludePath(JPATH_COMPONENT.DS.'tables');
|
||||
|
||||
class K2ModelUserGroups extends K2Model
|
||||
{
|
||||
|
||||
function getData()
|
||||
{
|
||||
|
||||
$mainframe = JFactory::getApplication();
|
||||
$option = JRequest::getCmd('option');
|
||||
$view = JRequest::getCmd('view');
|
||||
$db = JFactory::getDBO();
|
||||
$limit = $mainframe->getUserStateFromRequest('global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int');
|
||||
$limitstart = $mainframe->getUserStateFromRequest($option.$view.'.limitstart', 'limitstart', 0, 'int');
|
||||
$filter_order = $mainframe->getUserStateFromRequest($option.$view.'filter_order', 'filter_order', '', 'cmd');
|
||||
$filter_order_Dir = $mainframe->getUserStateFromRequest($option.$view.'filter_order_Dir', 'filter_order_Dir', '', 'word');
|
||||
|
||||
$query = "SELECT userGroup.*, (SELECT COUNT(DISTINCT userID) FROM #__k2_users WHERE `group`=userGroup.id) AS numOfUsers FROM #__k2_user_groups AS userGroup";
|
||||
|
||||
if (!$filter_order)
|
||||
{
|
||||
$filter_order = "name";
|
||||
}
|
||||
|
||||
$query .= " ORDER BY {$filter_order} {$filter_order_Dir}";
|
||||
|
||||
$db->setQuery($query, $limitstart, $limit);
|
||||
$rows = $db->loadObjectList();
|
||||
return $rows;
|
||||
}
|
||||
|
||||
function getTotal()
|
||||
{
|
||||
|
||||
$mainframe = JFactory::getApplication();
|
||||
$option = JRequest::getCmd('option');
|
||||
$view = JRequest::getCmd('view');
|
||||
$db = JFactory::getDBO();
|
||||
|
||||
$query = "SELECT COUNT(*) FROM #__k2_user_groups";
|
||||
|
||||
$db->setQuery($query);
|
||||
$total = $db->loadresult();
|
||||
return $total;
|
||||
}
|
||||
|
||||
function remove()
|
||||
{
|
||||
|
||||
$mainframe = JFactory::getApplication();
|
||||
$db = JFactory::getDBO();
|
||||
$cid = JRequest::getVar('cid');
|
||||
foreach ($cid as $id)
|
||||
{
|
||||
$row = JTable::getInstance('K2UserGroup', 'Table');
|
||||
$row->load($id);
|
||||
$row->delete($id);
|
||||
}
|
||||
$cache = JFactory::getCache('com_k2');
|
||||
$cache->clean();
|
||||
$mainframe->redirect('index.php?option=com_k2&view=usergroups', JText::_('K2_DELETE_COMPLETED'));
|
||||
}
|
||||
|
||||
}
|
||||
560
administrator/components/com_k2/models/users.php
Normal file
560
administrator/components/com_k2/models/users.php
Normal file
@@ -0,0 +1,560 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: users.php 1937 2013-03-07 15:19:16Z lefteris.kavadas $
|
||||
* @package K2
|
||||
* @author JoomlaWorks http://www.joomlaworks.net
|
||||
* @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.
|
||||
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die ;
|
||||
|
||||
jimport('joomla.application.component.model');
|
||||
|
||||
JTable::addIncludePath(JPATH_COMPONENT.DS.'tables');
|
||||
|
||||
class K2ModelUsers extends K2Model
|
||||
{
|
||||
|
||||
function getData()
|
||||
{
|
||||
|
||||
$mainframe = JFactory::getApplication();
|
||||
$option = JRequest::getCmd('option');
|
||||
$view = JRequest::getCmd('view');
|
||||
$db = JFactory::getDBO();
|
||||
$limit = $mainframe->getUserStateFromRequest('global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int');
|
||||
$limitstart = $mainframe->getUserStateFromRequest($option.$view.'.limitstart', 'limitstart', 0, 'int');
|
||||
$filter_order = $mainframe->getUserStateFromRequest($option.$view.'filter_order', 'filter_order', 'juser.name', 'cmd');
|
||||
$filter_order_Dir = $mainframe->getUserStateFromRequest($option.$view.'filter_order_Dir', 'filter_order_Dir', '', 'word');
|
||||
$filter_status = $mainframe->getUserStateFromRequest($option.$view.'filter_status', 'filter_status', -1, 'int');
|
||||
$filter_group = $mainframe->getUserStateFromRequest($option.$view.'filter_group', 'filter_group', '', 'string');
|
||||
$filter_group_k2 = $mainframe->getUserStateFromRequest($option.$view.'filter_group_k2', 'filter_group_k2', '', 'string');
|
||||
$search = $mainframe->getUserStateFromRequest($option.$view.'search', 'search', '', 'string');
|
||||
$search = JString::strtolower($search);
|
||||
|
||||
$query = "SELECT juser.*, k2user.group, k2group.name as groupname FROM #__users as juser "."LEFT JOIN #__k2_users as k2user ON juser.id=k2user.userID "."LEFT JOIN #__k2_user_groups as k2group ON k2user.group=k2group.id ";
|
||||
|
||||
if (K2_JVERSION != '15')
|
||||
{
|
||||
$query .= " LEFT JOIN #__user_usergroup_map as `map` ON juser.id=map.user_id ";
|
||||
}
|
||||
|
||||
$query .= " WHERE juser.id>0";
|
||||
|
||||
if ($filter_status > -1)
|
||||
{
|
||||
$query .= " AND juser.block = {$filter_status}";
|
||||
}
|
||||
|
||||
if ($filter_group)
|
||||
{
|
||||
if (K2_JVERSION != '15')
|
||||
{
|
||||
$query .= " AND `map`.group_id =".(int)$filter_group;
|
||||
}
|
||||
else
|
||||
{
|
||||
switch($filter_group)
|
||||
{
|
||||
case 'Public Frontend' :
|
||||
$query .= " AND juser.usertype IN ('Registered', 'Author', 'Editor', 'Publisher')";
|
||||
break;
|
||||
|
||||
case 'Public Backend' :
|
||||
$query .= " AND juser.usertype IN ('Manager', 'Administrator', 'Super Administrator')";
|
||||
break;
|
||||
|
||||
default :
|
||||
$filter_group = strtolower(trim($filter_group));
|
||||
$query .= " AND juser.usertype = ".$db->Quote($filter_group);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ($filter_group_k2)
|
||||
{
|
||||
$query .= " AND k2user.group = ".$db->Quote($filter_group_k2);
|
||||
}
|
||||
|
||||
if ($search)
|
||||
{
|
||||
$escaped = K2_JVERSION == '15' ? $db->getEscaped($search, true) : $db->escape($search, true);
|
||||
$query .= " AND (LOWER( juser.name ) LIKE ".$db->Quote('%'.$escaped.'%', false)." OR LOWER( juser.email ) LIKE ".$db->Quote('%'.$escaped.'%', false).")";
|
||||
}
|
||||
|
||||
if (!$filter_order)
|
||||
{
|
||||
$filter_order = "juser.name";
|
||||
}
|
||||
|
||||
if (K2_JVERSION != '15')
|
||||
{
|
||||
$query .= " GROUP BY juser.id ";
|
||||
}
|
||||
|
||||
$query .= " ORDER BY {$filter_order} {$filter_order_Dir}";
|
||||
|
||||
$db->setQuery($query, $limitstart, $limit);
|
||||
$rows = $db->loadObjectList();
|
||||
|
||||
if (K2_JVERSION != '15' && count($rows))
|
||||
{
|
||||
foreach ($rows as $row)
|
||||
{
|
||||
$IDs[] = $row->id;
|
||||
}
|
||||
$query = "SELECT map.user_id, COUNT(map.group_id) AS group_count,GROUP_CONCAT(g2.title SEPARATOR '\n') AS group_names
|
||||
FROM #__user_usergroup_map AS map
|
||||
LEFT JOIN #__usergroups AS g2
|
||||
ON g2.id = map.group_id
|
||||
WHERE map.user_id IN (".implode(',', $IDs).")
|
||||
GROUP BY map.user_id";
|
||||
$db->setQuery($query);
|
||||
$groups = $db->loadObjectList();
|
||||
foreach ($rows as $row)
|
||||
{
|
||||
foreach ($groups as $group)
|
||||
{
|
||||
if ($row->id == $group->user_id)
|
||||
{
|
||||
$row->usertype = nl2br($group->group_names);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $rows;
|
||||
}
|
||||
|
||||
function getTotal()
|
||||
{
|
||||
|
||||
$mainframe = JFactory::getApplication();
|
||||
$option = JRequest::getCmd('option');
|
||||
$view = JRequest::getCmd('view');
|
||||
$db = JFactory::getDBO();
|
||||
$limit = $mainframe->getUserStateFromRequest('global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int');
|
||||
$limitstart = $mainframe->getUserStateFromRequest($option.'.limitstart', 'limitstart', 0, 'int');
|
||||
$filter_status = $mainframe->getUserStateFromRequest($option.$view.'filter_status', 'filter_status', -1, 'int');
|
||||
$filter_group = $mainframe->getUserStateFromRequest($option.$view.'filter_group', 'filter_group', '', 'string');
|
||||
$filter_group_k2 = $mainframe->getUserStateFromRequest($option.$view.'filter_group_k2', 'filter_group_k2', '', 'string');
|
||||
$search = $mainframe->getUserStateFromRequest($option.$view.'search', 'search', '', 'string');
|
||||
$search = JString::strtolower($search);
|
||||
|
||||
$query = "SELECT COUNT(DISTINCT juser.id) FROM #__users as juser "."LEFT JOIN #__k2_users as k2user ON juser.id=k2user.userID "."LEFT JOIN #__k2_user_groups as k2group ON k2user.group=k2group.id ";
|
||||
|
||||
if (K2_JVERSION != '15')
|
||||
{
|
||||
$query .= " LEFT JOIN #__user_usergroup_map as `map` ON juser.id=map.user_id ";
|
||||
}
|
||||
|
||||
$query .= " WHERE juser.id>0";
|
||||
|
||||
if ($filter_status > -1)
|
||||
{
|
||||
$query .= " AND juser.block = {$filter_status}";
|
||||
}
|
||||
|
||||
if ($filter_group)
|
||||
{
|
||||
if (K2_JVERSION != '15')
|
||||
{
|
||||
$query .= " AND `map`.group_id =".(int)$filter_group;
|
||||
}
|
||||
else
|
||||
{
|
||||
switch($filter_group)
|
||||
{
|
||||
case 'Public Frontend' :
|
||||
$query .= " AND juser.usertype IN ('Registered', 'Author', 'Editor', 'Publisher')";
|
||||
break;
|
||||
|
||||
case 'Public Backend' :
|
||||
$query .= " AND juser.usertype IN ('Manager', 'Administrator', 'Super Administrator')";
|
||||
break;
|
||||
|
||||
default :
|
||||
$filter_group = strtolower(trim($filter_group));
|
||||
$query .= " AND juser.usertype = ".$db->Quote($filter_group);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($filter_group_k2)
|
||||
{
|
||||
$query .= " AND k2user.group = ".$db->Quote($filter_group_k2);
|
||||
}
|
||||
|
||||
if ($search)
|
||||
{
|
||||
$escaped = K2_JVERSION == '15' ? $db->getEscaped($search, true) : $db->escape($search, true);
|
||||
$query .= " AND (LOWER( juser.name ) LIKE ".$db->Quote('%'.$escaped.'%', false)." OR LOWER( juser.email ) LIKE ".$db->Quote('%'.$escaped.'%', false).")";
|
||||
|
||||
}
|
||||
|
||||
$db->setQuery($query);
|
||||
$total = $db->loadResult();
|
||||
return $total;
|
||||
}
|
||||
|
||||
function remove()
|
||||
{
|
||||
|
||||
$mainframe = JFactory::getApplication();
|
||||
$cid = JRequest::getVar('cid');
|
||||
JArrayHelper::toInteger($cid);
|
||||
$db = JFactory::getDBO();
|
||||
$query = "DELETE FROM #__k2_users WHERE userID IN(".implode(',', $cid).")";
|
||||
$db->setQuery($query);
|
||||
$db->query();
|
||||
$cache = JFactory::getCache('com_k2');
|
||||
$cache->clean();
|
||||
$mainframe->redirect('index.php?option=com_k2&view=users', JText::_('K2_USER_PROFILE_DELETED'));
|
||||
}
|
||||
|
||||
function getUserGroups($type = 'joomla')
|
||||
{
|
||||
|
||||
$db = JFactory::getDBO();
|
||||
|
||||
if ($type == 'joomla')
|
||||
{
|
||||
|
||||
$query = 'SELECT (lft - 3) AS lft, name AS value, name AS text'.' FROM #__core_acl_aro_groups'.' WHERE name != "ROOT"'.' AND name != "USERS"'.' ORDER BY `lft` ASC';
|
||||
|
||||
if (K2_JVERSION != '15')
|
||||
{
|
||||
$query = "SELECT a.lft AS lft, a.id AS value, a.title AS text, COUNT(DISTINCT b.id) AS level
|
||||
FROM #__usergroups AS a
|
||||
LEFT JOIN #__usergroups AS b
|
||||
ON a.lft > b.lft
|
||||
AND a.rgt < b.rgt
|
||||
GROUP BY a.id
|
||||
ORDER BY a.lft ASC";
|
||||
}
|
||||
|
||||
$db->setQuery($query);
|
||||
$groups = $db->loadObjectList();
|
||||
$userGroups = array();
|
||||
|
||||
foreach ($groups as $group)
|
||||
{
|
||||
if ($group->lft >= 10)
|
||||
$group->lft = (int)$group->lft - 10;
|
||||
if (K2_JVERSION != '15')
|
||||
{
|
||||
$group->text = $this->indent($group->level, '- ').$group->text;
|
||||
}
|
||||
else
|
||||
{
|
||||
$group->text = $this->indent($group->lft).$group->text;
|
||||
}
|
||||
|
||||
array_push($userGroups, $group);
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$query = "SELECT * FROM #__k2_user_groups";
|
||||
$db->setQuery($query);
|
||||
$userGroups = $db->loadObjectList();
|
||||
|
||||
}
|
||||
|
||||
return $userGroups;
|
||||
}
|
||||
|
||||
function indent($times, $char = ' ', $start_char = '', $end_char = '')
|
||||
{
|
||||
$return = $start_char;
|
||||
for ($i = 0; $i < $times; $i++)
|
||||
$return .= $char;
|
||||
$return .= $end_char;
|
||||
return $return;
|
||||
}
|
||||
|
||||
function checkLogin($id)
|
||||
{
|
||||
|
||||
$db = JFactory::getDBO();
|
||||
$query = "SELECT COUNT(s.userid) FROM #__session AS s WHERE s.userid = ".(int)$id;
|
||||
$db->setQuery($query);
|
||||
$result = $db->loadResult();
|
||||
return $result;
|
||||
}
|
||||
|
||||
function hasProfile($id)
|
||||
{
|
||||
|
||||
$db = JFactory::getDBO();
|
||||
$query = "SELECT id FROM #__k2_users WHERE userID = ".(int)$id;
|
||||
$db->setQuery($query);
|
||||
$result = $db->loadResult();
|
||||
return $result;
|
||||
}
|
||||
|
||||
function enable()
|
||||
{
|
||||
$mainframe = JFactory::getApplication();
|
||||
$cid = JRequest::getVar('cid');
|
||||
JArrayHelper::toInteger($cid);
|
||||
$db = JFactory::getDBO();
|
||||
$query = "UPDATE #__users SET block=0 WHERE id IN(".implode(',', $cid).")";
|
||||
$db->setQuery($query);
|
||||
$db->query();
|
||||
$mainframe->redirect('index.php?option=com_k2&view=users', JText::_('K2_USERS_ENABLED'));
|
||||
}
|
||||
|
||||
function disable()
|
||||
{
|
||||
$mainframe = JFactory::getApplication();
|
||||
$cid = JRequest::getVar('cid');
|
||||
JArrayHelper::toInteger($cid);
|
||||
$db = JFactory::getDBO();
|
||||
$query = "UPDATE #__users SET block=1 WHERE id IN(".implode(',', $cid).")";
|
||||
$db->setQuery($query);
|
||||
$db->query();
|
||||
$mainframe->redirect('index.php?option=com_k2&view=users', JText::_('K2_USERS_DISABLED'));
|
||||
}
|
||||
|
||||
function delete()
|
||||
{
|
||||
$mainframe = JFactory::getApplication();
|
||||
$user = JFactory::getUser();
|
||||
$cid = JRequest::getVar('cid');
|
||||
JArrayHelper::toInteger($cid);
|
||||
$db = JFactory::getDBO();
|
||||
if (in_array($user->id, $cid))
|
||||
{
|
||||
foreach ($cid as $key => $id)
|
||||
{
|
||||
if ($id == $user->id)
|
||||
{
|
||||
unset($cid[$key]);
|
||||
}
|
||||
}
|
||||
$mainframe->enqueueMessage(JText::_('K2_YOU_CANNOT_DELETE_YOURSELF'), 'notice');
|
||||
}
|
||||
if (count($cid) < 1)
|
||||
{
|
||||
$mainframe->redirect('index.php?option=com_k2&view=users', JText::_('K2_DELETE_COMPLETED'));
|
||||
}
|
||||
if (K2_JVERSION != '15')
|
||||
{
|
||||
JPluginHelper::importPlugin('user');
|
||||
$dispatcher = JDispatcher::getInstance();
|
||||
$iAmSuperAdmin = $user->authorise('core.admin');
|
||||
foreach ($cid as $key => $id)
|
||||
{
|
||||
$table = JTable::getInstance('user');
|
||||
$table->load($id);
|
||||
$allow = $user->authorise('core.delete', 'com_users');
|
||||
// Don't allow non-super-admin to delete a super admin
|
||||
$allow = (!$iAmSuperAdmin && JAccess::check($id, 'core.admin')) ? false : $allow;
|
||||
if ($allow)
|
||||
{
|
||||
// Get users data for the users to delete.
|
||||
$user_to_delete = JFactory::getUser($id);
|
||||
// Fire the onUserBeforeDelete event.
|
||||
$dispatcher->trigger('onUserBeforeDelete', array($table->getProperties()));
|
||||
if (!$table->delete($id))
|
||||
{
|
||||
$this->setError($table->getError());
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Trigger the onUserAfterDelete event.
|
||||
$dispatcher->trigger('onUserAfterDelete', array($user_to_delete->getProperties(), true, $this->getError()));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Prune items that you can't change.
|
||||
unset($cid[$key]);
|
||||
JError::raiseWarning(403, JText::_('JERROR_CORE_DELETE_NOT_PERMITTED'));
|
||||
}
|
||||
}
|
||||
$IDsToDelete = $cid;
|
||||
}
|
||||
else
|
||||
{
|
||||
$query = "SELECT * FROM #__users WHERE id IN(".implode(',', $cid).") AND gid<={$user->gid}";
|
||||
$db->setQuery($query);
|
||||
$IDsToDelete = K2_JVERSION == '30' ? $db->loadColumn() : $db->loadResultArray();
|
||||
|
||||
$query = "DELETE FROM #__users WHERE id IN(".implode(',', $IDsToDelete).") AND id!={$user->id}";
|
||||
$db->setQuery($query);
|
||||
$db->query();
|
||||
}
|
||||
$query = "DELETE FROM #__k2_users WHERE userID IN(".implode(',', $IDsToDelete).") AND userID!={$user->id}";
|
||||
$db->setQuery($query);
|
||||
$db->query();
|
||||
|
||||
$mainframe->redirect('index.php?option=com_k2&view=users', JText::_('K2_DELETE_COMPLETED'));
|
||||
}
|
||||
|
||||
function saveMove()
|
||||
{
|
||||
$mainframe = JFactory::getApplication();
|
||||
$db = JFactory::getDBO();
|
||||
$cid = JRequest::getVar('cid');
|
||||
JArrayHelper::toInteger($cid);
|
||||
$group = JRequest::getVar('group');
|
||||
$k2group = JRequest::getInt('k2group');
|
||||
if (K2_JVERSION != '15')
|
||||
{
|
||||
JArrayHelper::toInteger($group);
|
||||
$group = array_filter($group);
|
||||
if (count($group))
|
||||
{
|
||||
foreach ($cid as $id)
|
||||
{
|
||||
$query = "DELETE FROM #__user_usergroup_map WHERE user_id = ".$id;
|
||||
$db->setQuery($query);
|
||||
$db->query();
|
||||
$query = "INSERT INTO #__user_usergroup_map VALUES (".$id.", ".implode("), (".$id.", ", $group).")";
|
||||
$db->setQuery($query);
|
||||
$db->query();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($group)
|
||||
{
|
||||
$query = "SELECT id FROM #__core_acl_aro_groups WHERE name=".$db->Quote($group);
|
||||
$db->setQuery($query);
|
||||
$gid = $db->loadResult();
|
||||
$query = "UPDATE #__users SET gid={$gid}, usertype=".$db->Quote($group)." WHERE id IN(".implode(',', $cid).")";
|
||||
$db->setQuery($query);
|
||||
$db->query();
|
||||
}
|
||||
}
|
||||
|
||||
if ($k2group)
|
||||
{
|
||||
foreach ($cid as $id)
|
||||
{
|
||||
$query = "SELECT COUNT(*) FROM #__k2_users WHERE userID = ".$id;
|
||||
$db->setQuery($query);
|
||||
$result = $db->loadResult();
|
||||
if ($result)
|
||||
{
|
||||
$query = "UPDATE #__k2_users SET `group`={$k2group} WHERE userID = ".$id;
|
||||
}
|
||||
else
|
||||
{
|
||||
$user = JFactory::getUser($id);
|
||||
$query = "INSERT INTO #__k2_users VALUES ('', {$id}, {$db->Quote($user->username)}, '', '', '', '', {$k2group}, '')";
|
||||
}
|
||||
$db->setQuery($query);
|
||||
$db->query();
|
||||
}
|
||||
}
|
||||
$mainframe->redirect('index.php?option=com_k2&view=users', JText::_('K2_MOVE_COMPLETED'));
|
||||
|
||||
}
|
||||
|
||||
function import()
|
||||
{
|
||||
|
||||
$mainframe = JFactory::getApplication();
|
||||
$db = JFactory::getDBO();
|
||||
if (K2_JVERSION != '15')
|
||||
{
|
||||
$db->setQuery("SELECT id, title AS name FROM #__usergroups");
|
||||
$usergroups = $db->loadObjectList();
|
||||
$xml = new JXMLElement(JFile::read(JPATH_COMPONENT.DS.'models'.DS.'usergroup.xml'));
|
||||
$permissions = class_exists('JParameter') ? new JParameter('') : new JRegistry('');
|
||||
foreach ($xml->params as $paramGroup)
|
||||
{
|
||||
foreach ($paramGroup->param as $param)
|
||||
{
|
||||
$attribute = K2_JVERSION == '30' ? $param->attributes()->type : $param->getAttribute('type');
|
||||
if ($attribute != 'spacer')
|
||||
{
|
||||
if (K2_JVERSION == '30')
|
||||
{
|
||||
$permissions->set((string)$param->attributes()->name, (string)$param->attributes()->default);
|
||||
}
|
||||
else
|
||||
{
|
||||
$permissions->set($param->getAttribute('name'), $param->getAttribute('default'));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$acl = JFactory::getACL();
|
||||
$frontEndGroups = $acl->_getBelow('#__core_acl_aro_groups', 'g1.id, g1.name, COUNT(g2.name) AS level', 'g1.name', false, 'Public Frontend', false);
|
||||
$backEndGroups = $acl->_getBelow('#__core_acl_aro_groups', 'g1.id, g1.name, COUNT(g2.name) AS level', 'g1.name', false, 'Public Backend', false);
|
||||
$usergroups = array_merge($frontEndGroups, $backEndGroups);
|
||||
|
||||
$xml = new JSimpleXML;
|
||||
$xml->loadFile(JPATH_COMPONENT.DS.'models'.DS.'usergroup.xml');
|
||||
$permissions = class_exists('JParameter') ? new JParameter('') : new JRegistry('');
|
||||
foreach ($xml->document->params as $paramGroup)
|
||||
{
|
||||
foreach ($paramGroup->param as $param)
|
||||
{
|
||||
if ($param->attributes('type') != 'spacer')
|
||||
{
|
||||
$permissions->set($param->attributes('name'), $param->attributes('default'));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$permissions->set('inheritance', 0);
|
||||
$permissions->set('categories', 'all');
|
||||
$permissions = $permissions->toString();
|
||||
|
||||
foreach ($usergroups as $usergroup)
|
||||
{
|
||||
$K2UserGroup = JTable::getInstance('K2UserGroup', 'Table');
|
||||
$K2UserGroup->name = JString::trim($usergroup->name)." (Imported from Joomla!)";
|
||||
$K2UserGroup->permissions = $permissions;
|
||||
$K2UserGroup->store();
|
||||
|
||||
if (K2_JVERSION != '15')
|
||||
{
|
||||
$query = "SELECT * FROM #__users AS user JOIN #__user_usergroup_map AS map ON user.id = map.user_id
|
||||
WHERE map.group_id = ".$usergroup->id;
|
||||
}
|
||||
else
|
||||
{
|
||||
$query = "SELECT * FROM #__users WHERE gid={$usergroup->id}";
|
||||
}
|
||||
|
||||
$db->setQuery($query);
|
||||
$users = $db->loadObjectList();
|
||||
|
||||
foreach ($users as $user)
|
||||
{
|
||||
|
||||
$query = "SELECT COUNT(*) FROM #__k2_users WHERE userID={$user->id}";
|
||||
$db->setQuery($query);
|
||||
$result = $db->loadResult();
|
||||
if (!$result)
|
||||
{
|
||||
$K2User = JTable::getInstance('K2User', 'Table');
|
||||
$K2User->userID = $user->id;
|
||||
$K2User->group = $K2UserGroup->id;
|
||||
$K2User->store();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$mainframe->redirect('index.php?option=com_k2&view=users', JText::_('K2_IMPORT_COMPLETED'));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
401
administrator/components/com_k2/script.k2.php
Normal file
401
administrator/components/com_k2/script.k2.php
Normal file
@@ -0,0 +1,401 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: script.k2.php 1967 2013-04-29 17:00:30Z lefteris.kavadas $
|
||||
* @package K2
|
||||
* @author JoomlaWorks http://www.joomlaworks.net
|
||||
* @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.
|
||||
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die ;
|
||||
|
||||
class Com_K2InstallerScript
|
||||
{
|
||||
|
||||
public function postflight($type, $parent)
|
||||
{
|
||||
$db = JFactory::getDBO();
|
||||
$status = new stdClass;
|
||||
$status->modules = array();
|
||||
$status->plugins = array();
|
||||
$src = $parent->getParent()->getPath('source');
|
||||
$manifest = $parent->getParent()->manifest;
|
||||
$plugins = $manifest->xpath('plugins/plugin');
|
||||
foreach ($plugins as $plugin)
|
||||
{
|
||||
$name = (string)$plugin->attributes()->plugin;
|
||||
$group = (string)$plugin->attributes()->group;
|
||||
$path = $src.'/plugins/'.$group;
|
||||
if (JFolder::exists($src.'/plugins/'.$group.'/'.$name))
|
||||
{
|
||||
$path = $src.'/plugins/'.$group.'/'.$name;
|
||||
}
|
||||
$installer = new JInstaller;
|
||||
$result = $installer->install($path);
|
||||
if ($result && $group != 'finder' && $group != 'josetta_ext')
|
||||
{
|
||||
if (JFile::exists(JPATH_SITE.'/plugins/'.$group.'/'.$name.'/'.$name.'.xml'))
|
||||
{
|
||||
JFile::delete(JPATH_SITE.'/plugins/'.$group.'/'.$name.'/'.$name.'.xml');
|
||||
}
|
||||
JFile::move(JPATH_SITE.'/plugins/'.$group.'/'.$name.'/'.$name.'.j25.xml', JPATH_SITE.'/plugins/'.$group.'/'.$name.'/'.$name.'.xml');
|
||||
}
|
||||
$query = "UPDATE #__extensions SET enabled=1 WHERE type='plugin' AND element=".$db->Quote($name)." AND folder=".$db->Quote($group);
|
||||
$db->setQuery($query);
|
||||
$db->query();
|
||||
$status->plugins[] = array('name' => $name, 'group' => $group, 'result' => $result);
|
||||
}
|
||||
$modules = $manifest->xpath('modules/module');
|
||||
foreach ($modules as $module)
|
||||
{
|
||||
$name = (string)$module->attributes()->module;
|
||||
$client = (string)$module->attributes()->client;
|
||||
if (is_null($client))
|
||||
{
|
||||
$client = 'site';
|
||||
}
|
||||
($client == 'administrator') ? $path = $src.'/administrator/modules/'.$name : $path = $src.'/modules/'.$name;
|
||||
|
||||
if($client == 'administrator')
|
||||
{
|
||||
$db->setQuery("SELECT id FROM #__modules WHERE `module` = ".$db->quote($name));
|
||||
$isUpdate = (int)$db->loadResult();
|
||||
}
|
||||
|
||||
$installer = new JInstaller;
|
||||
$result = $installer->install($path);
|
||||
if ($result)
|
||||
{
|
||||
$root = $client == 'administrator' ? JPATH_ADMINISTRATOR : JPATH_SITE;
|
||||
if (JFile::exists($root.'/modules/'.$name.'/'.$name.'.xml'))
|
||||
{
|
||||
JFile::delete($root.'/modules/'.$name.'/'.$name.'.xml');
|
||||
}
|
||||
JFile::move($root.'/modules/'.$name.'/'.$name.'.j25.xml', $root.'/modules/'.$name.'/'.$name.'.xml');
|
||||
}
|
||||
$status->modules[] = array('name' => $name, 'client' => $client, 'result' => $result);
|
||||
if($client == 'administrator' && !$isUpdate)
|
||||
{
|
||||
$position = version_compare(JVERSION, '3.0', '<') && $name == 'mod_k2_quickicons'? 'icon' : 'cpanel';
|
||||
$db->setQuery("UPDATE #__modules SET `position`=".$db->quote($position).",`published`='1' WHERE `module`=".$db->quote($name));
|
||||
$db->query();
|
||||
|
||||
$db->setQuery("SELECT id FROM #__modules WHERE `module` = ".$db->quote($name));
|
||||
$id = (int)$db->loadResult();
|
||||
|
||||
$db->setQuery("INSERT IGNORE INTO #__modules_menu (`moduleid`,`menuid`) VALUES (".$id.", 0)");
|
||||
$db->query();
|
||||
}
|
||||
}
|
||||
|
||||
if (JFile::exists(JPATH_ADMINISTRATOR.'/components/com_k2/admin.k2.php'))
|
||||
{
|
||||
JFile::delete(JPATH_ADMINISTRATOR.'/components/com_k2/admin.k2.php');
|
||||
}
|
||||
|
||||
if (JFile::exists(JPATH_ADMINISTRATOR.'/components/com_k2/models/cpanel.php'))
|
||||
{
|
||||
JFile::delete(JPATH_ADMINISTRATOR.'/components/com_k2/models/cpanel.php');
|
||||
}
|
||||
if (version_compare(JVERSION, '3.0', 'lt') && JFolder::exists(JPATH_ADMINISTRATOR.'/components/com_joomfish/contentelements'))
|
||||
{
|
||||
$elements = $manifest->xpath('joomfish/file');
|
||||
foreach ($elements as $element)
|
||||
{
|
||||
JFile::copy($src.'/administrator/components/com_joomfish/contentelements/'.$element->data(), JPATH_ADMINISTRATOR.'/components/com_joomfish/contentelements/'.$element->data());
|
||||
}
|
||||
}
|
||||
|
||||
// Clean up empty entries in #__k2_users table caused by an issue in the K2 user plugin. Fix details: http://code.google.com/p/getk2/source/detail?r=1966
|
||||
$query = "DELETE FROM #__k2_users WHERE userID = 0";
|
||||
$db->setQuery($query);
|
||||
$db->query();
|
||||
|
||||
$this->installationResults($status);
|
||||
|
||||
}
|
||||
|
||||
public function uninstall($parent)
|
||||
{
|
||||
$db = JFactory::getDBO();
|
||||
$status = new stdClass;
|
||||
$status->modules = array();
|
||||
$status->plugins = array();
|
||||
$manifest = $parent->getParent()->manifest;
|
||||
$plugins = $manifest->xpath('plugins/plugin');
|
||||
foreach ($plugins as $plugin)
|
||||
{
|
||||
$name = (string)$plugin->attributes()->plugin;
|
||||
$group = (string)$plugin->attributes()->group;
|
||||
$query = "SELECT `extension_id` FROM #__extensions WHERE `type`='plugin' AND element = ".$db->Quote($name)." AND folder = ".$db->Quote($group);
|
||||
$db->setQuery($query);
|
||||
$extensions = $db->loadColumn();
|
||||
if (count($extensions))
|
||||
{
|
||||
foreach ($extensions as $id)
|
||||
{
|
||||
$installer = new JInstaller;
|
||||
$result = $installer->uninstall('plugin', $id);
|
||||
}
|
||||
$status->plugins[] = array('name' => $name, 'group' => $group, 'result' => $result);
|
||||
}
|
||||
|
||||
}
|
||||
$modules = $manifest->xpath('modules/module');
|
||||
foreach ($modules as $module)
|
||||
{
|
||||
$name = (string)$module->attributes()->module;
|
||||
$client = (string)$module->attributes()->client;
|
||||
$db = JFactory::getDBO();
|
||||
$query = "SELECT `extension_id` FROM `#__extensions` WHERE `type`='module' AND element = ".$db->Quote($name)."";
|
||||
$db->setQuery($query);
|
||||
$extensions = $db->loadColumn();
|
||||
if (count($extensions))
|
||||
{
|
||||
foreach ($extensions as $id)
|
||||
{
|
||||
$installer = new JInstaller;
|
||||
$result = $installer->uninstall('module', $id);
|
||||
}
|
||||
$status->modules[] = array('name' => $name, 'client' => $client, 'result' => $result);
|
||||
}
|
||||
|
||||
}
|
||||
$this->uninstallationResults($status);
|
||||
}
|
||||
|
||||
public function update($type)
|
||||
{
|
||||
$db = JFactory::getDBO();
|
||||
$fields = $db->getTableColumns('#__k2_categories');
|
||||
if (!array_key_exists('language', $fields))
|
||||
{
|
||||
$query = "ALTER TABLE #__k2_categories ADD `language` CHAR(7) NOT NULL";
|
||||
$db->setQuery($query);
|
||||
$db->query();
|
||||
|
||||
$query = "ALTER TABLE #__k2_categories ADD INDEX (`language`)";
|
||||
$db->setQuery($query);
|
||||
$db->query();
|
||||
}
|
||||
|
||||
$fields = $db->getTableColumns('#__k2_items');
|
||||
if (!array_key_exists('featured_ordering', $fields))
|
||||
{
|
||||
$query = "ALTER TABLE #__k2_items ADD `featured_ordering` INT(11) NOT NULL default '0' AFTER `featured`";
|
||||
$db->setQuery($query);
|
||||
$db->query();
|
||||
}
|
||||
if (!array_key_exists('language', $fields))
|
||||
{
|
||||
$query = "ALTER TABLE #__k2_items ADD `language` CHAR(7) NOT NULL";
|
||||
$db->setQuery($query);
|
||||
$db->query();
|
||||
|
||||
$query = "ALTER TABLE #__k2_items ADD INDEX (`language`)";
|
||||
$db->setQuery($query);
|
||||
$db->query();
|
||||
}
|
||||
|
||||
if ($fields['video'] != 'text')
|
||||
{
|
||||
$query = "ALTER TABLE #__k2_items MODIFY `video` TEXT";
|
||||
$db->setQuery($query);
|
||||
$db->query();
|
||||
}
|
||||
|
||||
if ($fields['introtext'] == 'text')
|
||||
{
|
||||
$query = "ALTER TABLE #__k2_items MODIFY `introtext` MEDIUMTEXT";
|
||||
$db->setQuery($query);
|
||||
$db->query();
|
||||
}
|
||||
|
||||
if ($fields['fulltext'] == 'text')
|
||||
{
|
||||
$query = "ALTER TABLE #__k2_items MODIFY `fulltext` MEDIUMTEXT";
|
||||
$db->setQuery($query);
|
||||
$db->query();
|
||||
}
|
||||
|
||||
$query = "SHOW INDEX FROM #__k2_items";
|
||||
$db->setQuery($query);
|
||||
$indexes = $db->loadObjectList();
|
||||
$indexExists = false;
|
||||
foreach ($indexes as $index)
|
||||
{
|
||||
if ($index->Key_name == 'search')
|
||||
$indexExists = true;
|
||||
}
|
||||
|
||||
if (!$indexExists)
|
||||
{
|
||||
$query = "ALTER TABLE #__k2_items ADD FULLTEXT `search` (`title`,`introtext`,`fulltext`,`extra_fields_search`,`image_caption`,`image_credits`,`video_caption`,`video_credits`,`metadesc`,`metakey`)";
|
||||
$db->setQuery($query);
|
||||
$db->query();
|
||||
|
||||
$query = "ALTER TABLE #__k2_items ADD FULLTEXT (`title`)";
|
||||
$db->setQuery($query);
|
||||
$db->query();
|
||||
}
|
||||
|
||||
$query = "SHOW INDEX FROM #__k2_tags";
|
||||
$db->setQuery($query);
|
||||
$indexes = $db->loadObjectList();
|
||||
$indexExists = false;
|
||||
foreach ($indexes as $index)
|
||||
{
|
||||
if ($index->Key_name == 'name')
|
||||
$indexExists = true;
|
||||
}
|
||||
|
||||
if (!$indexExists)
|
||||
{
|
||||
$query = "ALTER TABLE #__k2_tags ADD FULLTEXT (`name`)";
|
||||
$db->setQuery($query);
|
||||
$db->query();
|
||||
}
|
||||
|
||||
$query = "SELECT COUNT(*) FROM #__k2_user_groups";
|
||||
$db->setQuery($query);
|
||||
$num = $db->loadResult();
|
||||
|
||||
if ($num == 0)
|
||||
{
|
||||
$query = "INSERT INTO #__k2_user_groups (`id`, `name`, `permissions`) VALUES('', 'Registered', '{\"comment\":\"1\",\"frontEdit\":\"0\",\"add\":\"0\",\"editOwn\":\"0\",\"editAll\":\"0\",\"publish\":\"0\",\"inheritance\":0,\"categories\":\"all\"}')";
|
||||
$db->setQuery($query);
|
||||
$db->Query();
|
||||
|
||||
$query = "INSERT INTO #__k2_user_groups (`id`, `name`, `permissions`) VALUES('', 'Site Owner', '{\"comment\":\"1\",\"frontEdit\":\"1\",\"add\":\"1\",\"editOwn\":\"1\",\"editAll\":\"1\",\"publish\":\"1\",\"inheritance\":1,\"categories\":\"all\"}')";
|
||||
$db->setQuery($query);
|
||||
$db->Query();
|
||||
|
||||
}
|
||||
|
||||
$fields = $db->getTableColumns('#__k2_users');
|
||||
if (!array_key_exists('ip', $fields))
|
||||
{
|
||||
$query = "ALTER TABLE `#__k2_users`
|
||||
ADD `ip` VARCHAR( 15 ) NOT NULL ,
|
||||
ADD `hostname` VARCHAR( 255 ) NOT NULL ,
|
||||
ADD `notes` TEXT NOT NULL";
|
||||
$db->setQuery($query);
|
||||
$db->query();
|
||||
}
|
||||
}
|
||||
private function installationResults($status)
|
||||
{
|
||||
$language = JFactory::getLanguage();
|
||||
$language->load('com_k2');
|
||||
$rows = 0; ?>
|
||||
<img src="<?php echo JURI::root(true); ?>/media/k2/assets/images/system/K2_Logo_126x48_24.png" alt="K2" align="right" />
|
||||
<h2><?php echo JText::_('K2_INSTALLATION_STATUS'); ?></h2>
|
||||
<table class="adminlist table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="title" colspan="2"><?php echo JText::_('K2_EXTENSION'); ?></th>
|
||||
<th width="30%"><?php echo JText::_('K2_STATUS'); ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="3"></td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
<tbody>
|
||||
<tr class="row0">
|
||||
<td class="key" colspan="2"><?php echo 'K2 '.JText::_('K2_COMPONENT'); ?></td>
|
||||
<td><strong><?php echo JText::_('K2_INSTALLED'); ?></strong></td>
|
||||
</tr>
|
||||
<?php if (count($status->modules)): ?>
|
||||
<tr>
|
||||
<th><?php echo JText::_('K2_MODULE'); ?></th>
|
||||
<th><?php echo JText::_('K2_CLIENT'); ?></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
<?php foreach ($status->modules as $module): ?>
|
||||
<tr class="row<?php echo(++$rows % 2); ?>">
|
||||
<td class="key"><?php echo $module['name']; ?></td>
|
||||
<td class="key"><?php echo ucfirst($module['client']); ?></td>
|
||||
<td><strong><?php echo ($module['result'])?JText::_('K2_INSTALLED'):JText::_('K2_NOT_INSTALLED'); ?></strong></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
<?php if (count($status->plugins)): ?>
|
||||
<tr>
|
||||
<th><?php echo JText::_('K2_PLUGIN'); ?></th>
|
||||
<th><?php echo JText::_('K2_GROUP'); ?></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
<?php foreach ($status->plugins as $plugin): ?>
|
||||
<tr class="row<?php echo(++$rows % 2); ?>">
|
||||
<td class="key"><?php echo ucfirst($plugin['name']); ?></td>
|
||||
<td class="key"><?php echo ucfirst($plugin['group']); ?></td>
|
||||
<td><strong><?php echo ($plugin['result'])?JText::_('K2_INSTALLED'):JText::_('K2_NOT_INSTALLED'); ?></strong></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php
|
||||
}
|
||||
private function uninstallationResults($status)
|
||||
{
|
||||
$language = JFactory::getLanguage();
|
||||
$language->load('com_k2');
|
||||
$rows = 0;
|
||||
?>
|
||||
<h2><?php echo JText::_('K2_REMOVAL_STATUS'); ?></h2>
|
||||
<table class="adminlist table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="title" colspan="2"><?php echo JText::_('K2_EXTENSION'); ?></th>
|
||||
<th width="30%"><?php echo JText::_('K2_STATUS'); ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="3"></td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
<tbody>
|
||||
<tr class="row0">
|
||||
<td class="key" colspan="2"><?php echo 'K2 '.JText::_('K2_COMPONENT'); ?></td>
|
||||
<td><strong><?php echo JText::_('K2_REMOVED'); ?></strong></td>
|
||||
</tr>
|
||||
<?php if (count($status->modules)): ?>
|
||||
<tr>
|
||||
<th><?php echo JText::_('K2_MODULE'); ?></th>
|
||||
<th><?php echo JText::_('K2_CLIENT'); ?></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
<?php foreach ($status->modules as $module): ?>
|
||||
<tr class="row<?php echo(++$rows % 2); ?>">
|
||||
<td class="key"><?php echo $module['name']; ?></td>
|
||||
<td class="key"><?php echo ucfirst($module['client']); ?></td>
|
||||
<td><strong><?php echo ($module['result'])?JText::_('K2_REMOVED'):JText::_('K2_NOT_REMOVED'); ?></strong></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (count($status->plugins)): ?>
|
||||
<tr>
|
||||
<th><?php echo JText::_('K2_PLUGIN'); ?></th>
|
||||
<th><?php echo JText::_('K2_GROUP'); ?></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
<?php foreach ($status->plugins as $plugin): ?>
|
||||
<tr class="row<?php echo(++$rows % 2); ?>">
|
||||
<td class="key"><?php echo ucfirst($plugin['name']); ?></td>
|
||||
<td class="key"><?php echo ucfirst($plugin['group']); ?></td>
|
||||
<td><strong><?php echo ($plugin['result'])?JText::_('K2_REMOVED'):JText::_('K2_NOT_REMOVED'); ?></strong></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
28
administrator/components/com_k2/tables/k2attachment.php
Normal file
28
administrator/components/com_k2/tables/k2attachment.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: k2attachment.php 1812 2013-01-14 18:45:06Z lefteris.kavadas $
|
||||
* @package K2
|
||||
* @author JoomlaWorks http://www.joomlaworks.net
|
||||
* @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.
|
||||
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
class TableK2Attachment extends K2Table
|
||||
{
|
||||
|
||||
var $id = null;
|
||||
var $itemID = null;
|
||||
var $filename = null;
|
||||
var $title = null;
|
||||
var $titleAttribute = null;
|
||||
var $hits = null;
|
||||
|
||||
function __construct(&$db)
|
||||
{
|
||||
parent::__construct('#__k2_attachments', 'id', $db);
|
||||
}
|
||||
|
||||
}
|
||||
225
administrator/components/com_k2/tables/k2category.php
Normal file
225
administrator/components/com_k2/tables/k2category.php
Normal file
@@ -0,0 +1,225 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: k2category.php 1901 2013-02-08 19:29:12Z lefteris.kavadas $
|
||||
* @package K2
|
||||
* @author JoomlaWorks http://www.joomlaworks.net
|
||||
* @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.
|
||||
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die ;
|
||||
|
||||
class TableK2Category extends K2Table
|
||||
{
|
||||
|
||||
var $id = null;
|
||||
var $name = null;
|
||||
var $alias = null;
|
||||
var $description = null;
|
||||
var $parent = null;
|
||||
var $extraFieldsGroup = null;
|
||||
var $published = null;
|
||||
var $image = null;
|
||||
var $access = null;
|
||||
var $ordering = null;
|
||||
var $params = null;
|
||||
var $trash = null;
|
||||
var $plugins = null;
|
||||
var $language = null;
|
||||
|
||||
function __construct(&$db)
|
||||
{
|
||||
|
||||
parent::__construct('#__k2_categories', 'id', $db);
|
||||
}
|
||||
|
||||
function load($oid = null, $reset = false)
|
||||
{
|
||||
|
||||
static $K2CategoriesInstances = array();
|
||||
if (isset($K2CategoriesInstances[$oid]))
|
||||
{
|
||||
return $this->bind($K2CategoriesInstances[$oid]);
|
||||
}
|
||||
|
||||
$k = $this->_tbl_key;
|
||||
|
||||
if ($oid !== null)
|
||||
{
|
||||
$this->$k = $oid;
|
||||
}
|
||||
|
||||
$oid = $this->$k;
|
||||
|
||||
if ($oid === null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
$this->reset();
|
||||
|
||||
$db = $this->getDBO();
|
||||
|
||||
$query = 'SELECT *'.' FROM '.$this->_tbl.' WHERE '.$this->_tbl_key.' = '.$db->Quote($oid);
|
||||
$db->setQuery($query);
|
||||
$result = $db->loadAssoc();
|
||||
if ($result)
|
||||
{
|
||||
$K2CategoriesInstances[$oid] = $result;
|
||||
return $this->bind($K2CategoriesInstances[$oid]);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->setError($db->getErrorMsg());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function check()
|
||||
{
|
||||
|
||||
jimport('joomla.filter.output');
|
||||
$params = JComponentHelper::getParams('com_k2');
|
||||
$this->name = JString::trim($this->name);
|
||||
if ($this->name == '')
|
||||
{
|
||||
$this->setError(JText::_('K2_CATEGORY_MUST_HAVE_A_NAME'));
|
||||
return false;
|
||||
}
|
||||
if (empty($this->alias))
|
||||
{
|
||||
$this->alias = $this->name;
|
||||
}
|
||||
|
||||
if (K2_JVERSION == '15')
|
||||
{
|
||||
if (JPluginHelper::isEnabled('system', 'unicodeslug') || JPluginHelper::isEnabled('system', 'jw_unicodeSlugsExtended'))
|
||||
{
|
||||
$this->alias = JFilterOutput::stringURLSafe($this->alias);
|
||||
}
|
||||
else
|
||||
{
|
||||
mb_internal_encoding("UTF-8");
|
||||
mb_regex_encoding("UTF-8");
|
||||
$this->alias = trim(mb_strtolower($this->alias));
|
||||
$this->alias = str_replace('-', ' ', $this->alias);
|
||||
$this->alias = str_replace('/', '-', $this->alias);
|
||||
$this->alias = mb_ereg_replace('[[:space:]]+', ' ', $this->alias);
|
||||
$this->alias = trim(str_replace(' ', '-', $this->alias));
|
||||
$this->alias = str_replace('.', '', $this->alias);
|
||||
$this->alias = str_replace('"', '', $this->alias);
|
||||
$this->alias = str_replace("'", '', $this->alias);
|
||||
$stripthese = ',|~|!|@|%|^|(|)|<|>|:|;|{|}|[|]|&|`|„|‹|’|‘|“|â€<C3A2>|•|›|«|´|»|°|«|»|…';
|
||||
$strips = explode('|', $stripthese);
|
||||
foreach ($strips as $strip)
|
||||
{
|
||||
$this->alias = str_replace($strip, '', $this->alias);
|
||||
}
|
||||
if (trim(str_replace('-', '', $this->alias)) == '')
|
||||
{
|
||||
$datenow = JFactory::getDate();
|
||||
$this->alias = $datenow->toFormat("%Y-%m-%d-%H-%M-%S");
|
||||
}
|
||||
$this->alias = trim($this->alias, '-.');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (JFactory::getConfig()->get('unicodeslugs') == 1)
|
||||
{
|
||||
$this->alias = JFilterOutput::stringURLUnicodeSlug($this->alias);
|
||||
}
|
||||
// Transliterate properly...
|
||||
else
|
||||
{
|
||||
// Detect the site language we will transliterate
|
||||
if ($this->language == '*')
|
||||
{
|
||||
$langParams = JComponentHelper::getParams('com_languages');
|
||||
$languageTag = $langParams->get('site');
|
||||
}
|
||||
else
|
||||
{
|
||||
$languageTag = $this->language;
|
||||
}
|
||||
$language = JLanguage::getInstance($languageTag);
|
||||
$this->alias = $language->transliterate($this->alias);
|
||||
$this->alias = JFilterOutput::stringURLSafe($this->alias);
|
||||
if (trim(str_replace('-', '', $this->alias)) == '')
|
||||
{
|
||||
$this->alias = JFactory::getDate()->format('Y-m-d-H-i-s');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (K2_JVERSION == '15' || $params->get('enforceSEFReplacements'))
|
||||
{
|
||||
|
||||
$SEFReplacements = array();
|
||||
$items = explode(',', $params->get('SEFReplacements'));
|
||||
foreach ($items as $item)
|
||||
{
|
||||
if (!empty($item))
|
||||
{
|
||||
@list($src, $dst) = explode('|', trim($item));
|
||||
$SEFReplacements[trim($src)] = trim($dst);
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($SEFReplacements as $key => $value)
|
||||
{
|
||||
$this->alias = str_replace($key, $value, $this->alias);
|
||||
}
|
||||
|
||||
$this->alias = trim($this->alias, '-.');
|
||||
}
|
||||
|
||||
if (K2_JVERSION == '15')
|
||||
{
|
||||
if (trim(str_replace('-', '', $this->alias)) == '')
|
||||
{
|
||||
$datenow = JFactory::getDate();
|
||||
$this->alias = $datenow->toFormat("%Y-%m-%d-%H-%M-%S");
|
||||
}
|
||||
}
|
||||
|
||||
// Check if alias already exists. If so warn the user
|
||||
$params = JComponentHelper::getParams('com_k2');
|
||||
if ($params->get('k2Sef') && !$params->get('k2SefInsertCatId'))
|
||||
{
|
||||
$db = JFactory::getDBO();
|
||||
$db->setQuery("SELECT id FROM #__k2_categories WHERE alias = ".$db->quote($this->alias)." AND id != ".(int)$this->id);
|
||||
$result = count($db->loadObjectList());
|
||||
if ($result > 1)
|
||||
{
|
||||
$this->alias .= '-'.(int)$result + 1;
|
||||
$application = JFactory::getApplication();
|
||||
$application->enqueueMessage(JText::_('K2_WARNING_DUPLICATE_TITLE_ALIAS_DETECTED'), 'notice');
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
function bind($array, $ignore = '')
|
||||
{
|
||||
|
||||
if (key_exists('params', $array) && is_array($array['params']))
|
||||
{
|
||||
$registry = new JRegistry();
|
||||
$registry->loadArray($array['params']);
|
||||
$array['params'] = $registry->toString();
|
||||
}
|
||||
|
||||
if (key_exists('plugins', $array) && is_array($array['plugins']))
|
||||
{
|
||||
$registry = new JRegistry();
|
||||
$registry->loadArray($array['plugins']);
|
||||
$array['plugins'] = $registry->toString();
|
||||
}
|
||||
|
||||
return parent::bind($array, $ignore);
|
||||
}
|
||||
|
||||
}
|
||||
35
administrator/components/com_k2/tables/k2comment.php
Normal file
35
administrator/components/com_k2/tables/k2comment.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: k2comment.php 1812 2013-01-14 18:45:06Z lefteris.kavadas $
|
||||
* @package K2
|
||||
* @author JoomlaWorks http://www.joomlaworks.net
|
||||
* @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.
|
||||
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
class TableK2Comment extends K2Table
|
||||
{
|
||||
|
||||
var $id = null;
|
||||
var $itemID = null;
|
||||
var $userID = null;
|
||||
var $userName = null;
|
||||
var $commentDate = null;
|
||||
var $commentText = null;
|
||||
var $commentEmail = null;
|
||||
var $commentURL = null;
|
||||
var $published = null;
|
||||
|
||||
function __construct(&$db)
|
||||
{
|
||||
parent::__construct('#__k2_comments', 'id', $db);
|
||||
}
|
||||
function check()
|
||||
{
|
||||
$this->commentText = JString::trim($this->commentText);
|
||||
}
|
||||
|
||||
}
|
||||
39
administrator/components/com_k2/tables/k2extrafield.php
Normal file
39
administrator/components/com_k2/tables/k2extrafield.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: k2extrafield.php 1812 2013-01-14 18:45:06Z lefteris.kavadas $
|
||||
* @package K2
|
||||
* @author JoomlaWorks http://www.joomlaworks.net
|
||||
* @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.
|
||||
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
class TableK2ExtraField extends K2Table
|
||||
{
|
||||
|
||||
var $id = null;
|
||||
var $name = null;
|
||||
var $value = null;
|
||||
var $type = null;
|
||||
var $group = null;
|
||||
var $published = null;
|
||||
var $ordering = null;
|
||||
|
||||
function __construct(&$db)
|
||||
{
|
||||
parent::__construct('#__k2_extra_fields', 'id', $db);
|
||||
}
|
||||
|
||||
function check()
|
||||
{
|
||||
$this->name = JString::trim($this->name);
|
||||
if ($this->name == '')
|
||||
{
|
||||
$this->setError(JText::_('K2_NAME_CANNOT_BE_EMPTY'));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: k2extrafieldsgroup.php 1812 2013-01-14 18:45:06Z lefteris.kavadas $
|
||||
* @package K2
|
||||
* @author JoomlaWorks http://www.joomlaworks.net
|
||||
* @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.
|
||||
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
class TableK2ExtraFieldsGroup extends K2Table
|
||||
{
|
||||
|
||||
var $id = null;
|
||||
var $name = null;
|
||||
|
||||
function __construct(&$db)
|
||||
{
|
||||
parent::__construct('#__k2_extra_fields_groups', 'id', $db);
|
||||
}
|
||||
|
||||
function check()
|
||||
{
|
||||
$this->name = JString::trim($this->name);
|
||||
if ($this->name == '')
|
||||
{
|
||||
$this->setError(JText::_('K2_GROUP_MUST_HAVE_A_NAME'));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
324
administrator/components/com_k2/tables/k2item.php
Normal file
324
administrator/components/com_k2/tables/k2item.php
Normal file
@@ -0,0 +1,324 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: k2item.php 1901 2013-02-08 19:29:12Z lefteris.kavadas $
|
||||
* @package K2
|
||||
* @author JoomlaWorks http://www.joomlaworks.net
|
||||
* @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.
|
||||
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die ;
|
||||
|
||||
class TableK2Item extends K2Table
|
||||
{
|
||||
|
||||
var $id = null;
|
||||
var $title = null;
|
||||
var $alias = null;
|
||||
var $catid = null;
|
||||
var $published = null;
|
||||
var $introtext = null;
|
||||
var $fulltext = null;
|
||||
var $image_caption = null;
|
||||
var $image_credits = null;
|
||||
var $video = null;
|
||||
var $video_caption = null;
|
||||
var $video_credits = null;
|
||||
var $gallery = null;
|
||||
var $extra_fields = null;
|
||||
var $extra_fields_search = null;
|
||||
var $created = null;
|
||||
var $created_by = null;
|
||||
var $created_by_alias = null;
|
||||
var $modified = null;
|
||||
var $modified_by = null;
|
||||
var $publish_up = null;
|
||||
var $publish_down = null;
|
||||
var $checked_out = null;
|
||||
var $checked_out_time = null;
|
||||
var $trash = null;
|
||||
var $access = null;
|
||||
var $ordering = null;
|
||||
var $featured = null;
|
||||
var $featured_ordering = null;
|
||||
var $hits = null;
|
||||
var $metadata = null;
|
||||
var $metadesc = null;
|
||||
var $metakey = null;
|
||||
var $params = null;
|
||||
var $plugins = null;
|
||||
var $language = null;
|
||||
|
||||
function __construct(&$db)
|
||||
{
|
||||
|
||||
parent::__construct('#__k2_items', 'id', $db);
|
||||
}
|
||||
|
||||
function check()
|
||||
{
|
||||
|
||||
jimport('joomla.filter.output');
|
||||
$params = JComponentHelper::getParams('com_k2');
|
||||
$this->title = JString::trim($this->title);
|
||||
if ($this->title == '')
|
||||
{
|
||||
$this->setError(JText::_('K2_ITEM_MUST_HAVE_A_TITLE'));
|
||||
return false;
|
||||
}
|
||||
if (!$this->catid)
|
||||
{
|
||||
$this->setError(JText::_('K2_ITEM_MUST_HAVE_A_CATEGORY'));
|
||||
return false;
|
||||
}
|
||||
if (empty($this->alias))
|
||||
{
|
||||
$this->alias = $this->title;
|
||||
}
|
||||
|
||||
if (K2_JVERSION == '15')
|
||||
{
|
||||
if (JPluginHelper::isEnabled('system', 'unicodeslug') || JPluginHelper::isEnabled('system', 'jw_unicodeSlugsExtended'))
|
||||
{
|
||||
$this->alias = JFilterOutput::stringURLSafe($this->alias);
|
||||
}
|
||||
else
|
||||
{
|
||||
mb_internal_encoding("UTF-8");
|
||||
mb_regex_encoding("UTF-8");
|
||||
$this->alias = trim(mb_strtolower($this->alias));
|
||||
$this->alias = str_replace('-', ' ', $this->alias);
|
||||
$this->alias = str_replace('/', '-', $this->alias);
|
||||
$this->alias = mb_ereg_replace('[[:space:]]+', ' ', $this->alias);
|
||||
$this->alias = trim(str_replace(' ', '-', $this->alias));
|
||||
$this->alias = str_replace('.', '', $this->alias);
|
||||
$this->alias = str_replace('"', '', $this->alias);
|
||||
$this->alias = str_replace("'", '', $this->alias);
|
||||
$stripthese = ',|~|!|@|%|^|(|)|<|>|:|;|{|}|[|]|&|`|„|‹|’|‘|“|â€<C3A2>|•|›|«|´|»|°|«|»|…';
|
||||
$strips = explode('|', $stripthese);
|
||||
foreach ($strips as $strip)
|
||||
{
|
||||
$this->alias = str_replace($strip, '', $this->alias);
|
||||
}
|
||||
if (trim(str_replace('-', '', $this->alias)) == '')
|
||||
{
|
||||
$datenow = JFactory::getDate();
|
||||
$this->alias = $datenow->toFormat("%Y-%m-%d-%H-%M-%S");
|
||||
}
|
||||
$this->alias = trim($this->alias, '-.');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (JFactory::getConfig()->get('unicodeslugs') == 1)
|
||||
{
|
||||
$this->alias = JFilterOutput::stringURLUnicodeSlug($this->alias);
|
||||
}
|
||||
// Transliterate properly...
|
||||
else
|
||||
{
|
||||
// Detect the site language we will transliterate
|
||||
if ($this->language == '*')
|
||||
{
|
||||
$langParams = JComponentHelper::getParams('com_languages');
|
||||
$languageTag = $langParams->get('site');
|
||||
}
|
||||
else
|
||||
{
|
||||
$languageTag = $this->language;
|
||||
}
|
||||
$language = JLanguage::getInstance($languageTag);
|
||||
$this->alias = $language->transliterate($this->alias);
|
||||
$this->alias = JFilterOutput::stringURLSafe($this->alias);
|
||||
if (trim(str_replace('-', '', $this->alias)) == '')
|
||||
{
|
||||
$this->alias = JFactory::getDate()->format('Y-m-d-H-i-s');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (K2_JVERSION == '15' || $params->get('enforceSEFReplacements'))
|
||||
{
|
||||
|
||||
$SEFReplacements = array();
|
||||
$items = explode(',', $params->get('SEFReplacements'));
|
||||
foreach ($items as $item)
|
||||
{
|
||||
if (!empty($item))
|
||||
{
|
||||
@list($src, $dst) = explode('|', trim($item));
|
||||
$SEFReplacements[trim($src)] = trim($dst);
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($SEFReplacements as $key => $value)
|
||||
{
|
||||
$this->alias = str_replace($key, $value, $this->alias);
|
||||
}
|
||||
|
||||
$this->alias = trim($this->alias, '-.');
|
||||
}
|
||||
|
||||
if (K2_JVERSION == '15')
|
||||
{
|
||||
if (trim(str_replace('-', '', $this->alias)) == '')
|
||||
{
|
||||
$datenow = JFactory::getDate();
|
||||
$this->alias = $datenow->toFormat("%Y-%m-%d-%H-%M-%S");
|
||||
}
|
||||
}
|
||||
|
||||
// Check if alias already exists. If so warn the user
|
||||
$params = JComponentHelper::getParams('com_k2');
|
||||
if ($params->get('k2Sef') && !$params->get('k2SefInsertItemId'))
|
||||
{
|
||||
$db = JFactory::getDBO();
|
||||
$db->setQuery("SELECT id FROM #__k2_items WHERE alias = ".$db->quote($this->alias)." AND id != ".(int)$this->id);
|
||||
$result = count($db->loadObjectList());
|
||||
if ($result > 1)
|
||||
{
|
||||
$this->alias .= '-'.(int)$result + 1;
|
||||
$application = JFactory::getApplication();
|
||||
$application->enqueueMessage(JText::_('K2_WARNING_DUPLICATE_TITLE_ALIAS_DETECTED'), 'notice');
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
function bind($array, $ignore = '')
|
||||
{
|
||||
|
||||
if (key_exists('params', $array) && is_array($array['params']))
|
||||
{
|
||||
$registry = new JRegistry();
|
||||
$registry->loadArray($array['params']);
|
||||
$array['params'] = $registry->toString();
|
||||
}
|
||||
|
||||
if (key_exists('plugins', $array) && is_array($array['plugins']))
|
||||
{
|
||||
$registry = new JRegistry();
|
||||
$registry->loadArray($array['plugins']);
|
||||
$array['plugins'] = $registry->toString();
|
||||
}
|
||||
|
||||
return parent::bind($array, $ignore);
|
||||
}
|
||||
|
||||
function getNextOrder($where = '', $column = 'ordering')
|
||||
{
|
||||
|
||||
$query = "SELECT MAX({$column}) FROM #__k2_items";
|
||||
$query .= ($where ? " WHERE ".$where : "");
|
||||
$this->_db->setQuery($query);
|
||||
$maxord = $this->_db->loadResult();
|
||||
if ($this->_db->getErrorNum())
|
||||
{
|
||||
$this->setError($this->_db->getErrorMsg());
|
||||
return false;
|
||||
}
|
||||
return $maxord + 1;
|
||||
}
|
||||
|
||||
function reorder($where = '', $column = 'ordering')
|
||||
{
|
||||
|
||||
$k = $this->_tbl_key;
|
||||
$query = "SELECT {$this->_tbl_key}, {$column} FROM #__k2_items WHERE {$column}>0";
|
||||
$query .= ($where ? " AND ".$where : "");
|
||||
$query .= " ORDER BY {$column}";
|
||||
|
||||
$this->_db->setQuery($query);
|
||||
if (!($orders = $this->_db->loadObjectList()))
|
||||
{
|
||||
$this->setError($this->_db->getErrorMsg());
|
||||
return false;
|
||||
}
|
||||
|
||||
for ($i = 0, $n = count($orders); $i < $n; $i++)
|
||||
{
|
||||
if ($orders[$i]->$column >= 0)
|
||||
{
|
||||
if ($orders[$i]->$column != $i + 1)
|
||||
{
|
||||
$orders[$i]->$column = $i + 1;
|
||||
$query = "UPDATE #__k2_items SET {$column}=".(int)$orders[$i]->$column;
|
||||
$query .= ' WHERE '.$k.' = '.$this->_db->Quote($orders[$i]->$k);
|
||||
$this->_db->setQuery($query);
|
||||
$this->_db->query();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function move($dirn, $where = '', $column = 'ordering')
|
||||
{
|
||||
|
||||
$k = $this->_tbl_key;
|
||||
|
||||
$sql = "SELECT $this->_tbl_key, {$column} FROM $this->_tbl";
|
||||
|
||||
if ($dirn < 0)
|
||||
{
|
||||
$sql .= ' WHERE '.$column.' < '.(int)$this->$column;
|
||||
$sql .= ($where ? ' AND '.$where : '');
|
||||
$sql .= ' ORDER BY '.$column.' DESC';
|
||||
}
|
||||
else if ($dirn > 0)
|
||||
{
|
||||
$sql .= ' WHERE '.$column.' > '.(int)$this->$column;
|
||||
$sql .= ($where ? ' AND '.$where : '');
|
||||
$sql .= ' ORDER BY '.$column;
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql .= ' WHERE '.$column.' = '.(int)$this->$column;
|
||||
$sql .= ($where ? ' AND '.$where : '');
|
||||
$sql .= ' ORDER BY '.$column;
|
||||
}
|
||||
|
||||
$this->_db->setQuery($sql, 0, 1);
|
||||
|
||||
$row = null;
|
||||
$row = $this->_db->loadObject();
|
||||
|
||||
if (isset($row))
|
||||
{
|
||||
$query = 'UPDATE '.$this->_tbl.' SET '.$column.' = '.(int)$row->$column.' WHERE '.$this->_tbl_key.' = '.$this->_db->Quote($this->$k);
|
||||
$this->_db->setQuery($query);
|
||||
|
||||
if (!$this->_db->query())
|
||||
{
|
||||
$err = $this->_db->getErrorMsg();
|
||||
JError::raiseError(500, $err);
|
||||
}
|
||||
|
||||
$query = 'UPDATE '.$this->_tbl.' SET '.$column.' = '.(int)$this->$column.' WHERE '.$this->_tbl_key.' = '.$this->_db->Quote($row->$k);
|
||||
$this->_db->setQuery($query);
|
||||
|
||||
if (!$this->_db->query())
|
||||
{
|
||||
$err = $this->_db->getErrorMsg();
|
||||
JError::raiseError(500, $err);
|
||||
}
|
||||
$this->$column = $row->$column;
|
||||
}
|
||||
else
|
||||
{
|
||||
$query = 'UPDATE '.$this->_tbl.' SET '.$column.' = '.(int)$this->$column.' WHERE '.$this->_tbl_key.' = '.$this->_db->Quote($this->$k);
|
||||
$this->_db->setQuery($query);
|
||||
|
||||
if (!$this->_db->query())
|
||||
{
|
||||
$err = $this->_db->getErrorMsg();
|
||||
JError::raiseError(500, $err);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
100
administrator/components/com_k2/tables/k2tag.php
Normal file
100
administrator/components/com_k2/tables/k2tag.php
Normal file
@@ -0,0 +1,100 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: k2tag.php 1909 2013-02-08 21:02:38Z joomlaworks $
|
||||
* @package K2
|
||||
* @author JoomlaWorks http://www.joomlaworks.net
|
||||
* @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.
|
||||
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die ;
|
||||
|
||||
class TableK2Tag extends K2Table
|
||||
{
|
||||
|
||||
var $id = null;
|
||||
var $name = null;
|
||||
var $published = null;
|
||||
|
||||
function __construct(&$db)
|
||||
{
|
||||
|
||||
parent::__construct('#__k2_tags', 'id', $db);
|
||||
}
|
||||
|
||||
function check()
|
||||
{
|
||||
$this->name = JString::trim($this->name);
|
||||
$this->name = JString::str_ireplace('-', '', $this->name);
|
||||
$this->name = JString::str_ireplace('.', '', $this->name);
|
||||
|
||||
$params = JComponentHelper::getParams('com_k2');
|
||||
if ($params->get('k2TagNorm'))
|
||||
{
|
||||
$searches = array('À', 'Á', 'Â', 'Ã', 'Ä', 'Å', 'à', 'á', 'â', 'ã', 'ä', 'å', 'Ā', 'ā', 'Ă', 'ă', 'Ą', 'ą', 'Ç', 'ç', 'Ć', 'ć', 'Ĉ', 'ĉ', 'Ċ', 'ċ', 'Č', 'č', 'Ð', 'ð', 'Ď', 'ď', 'Đ', 'đ', 'È', 'É', 'Ê', 'Ë', 'è', 'é', 'ê', 'ë', 'Ē', 'ē', 'Ĕ', 'ĕ', 'Ė', 'ė', 'Ę', 'ę', 'Ě', 'ě', 'Ĝ', 'ĝ', 'Ğ', 'ğ', 'Ġ', 'ġ', 'Ģ', 'ģ', 'Ĥ', 'ĥ', 'Ħ', 'ħ', 'Ì', 'Í', 'Î', 'Ï', 'ì', 'í', 'î', 'ï', 'Ĩ', 'ĩ', 'Ī', 'ī', 'Ĭ', 'ĭ', 'Į', 'į', 'İ', 'ı', 'Ĵ', 'ĵ', 'Ķ', 'ķ', 'ĸ', 'Ĺ', 'ĺ', 'Ļ', 'ļ', 'Ľ', 'ľ', 'Ŀ', 'ŀ', 'Ł', 'ł', 'Ñ', 'ñ', 'Ń', 'ń', 'Ņ', 'ņ', 'Ň', 'ň', 'ʼn', 'Ŋ', 'ŋ', 'Ò', 'Ó', 'Ô', 'Õ', 'Ö', 'Ø', 'ò', 'ó', 'ô', 'õ', 'ö', 'ø', 'Ō', 'ō', 'Ŏ', 'ŏ', 'Ő', 'ő', 'Ŕ', 'ŕ', 'Ŗ', 'ŗ', 'Ř', 'ř', 'Ś', 'ś', 'Ŝ', 'ŝ', 'Ş', 'ş', 'Š', 'š', 'ſ', 'Ţ', 'ţ', 'Ť', 'ť', 'Ŧ', 'ŧ', 'Ù', 'Ú', 'Û', 'Ü', 'ù', 'ú', 'û', 'ü', 'Ũ', 'ũ', 'Ū', 'ū', 'Ŭ', 'ŭ', 'Ů', 'ů', 'Ű', 'ű', 'Ų', 'ų', 'Ŵ', 'ŵ', 'Ý', 'ý', 'ÿ', 'Ŷ', 'ŷ', 'Ÿ', 'Ź', 'ź', 'Ż', 'ż', 'Ž', 'ž', 'Ά', 'ά', 'Έ', 'έ', 'Ή', 'ή', 'Ί', 'ί', 'Ό', 'ό', 'Ύ', 'ύ', 'Ώ', 'ώ', 'ϋ', 'ϊ', 'ΐ');
|
||||
$replacements = array('A', 'A', 'A', 'A', 'A', 'A', 'a', 'a', 'a', 'a', 'a', 'a', 'A', 'a', 'A', 'a', 'A', 'a', 'C', 'c', 'C', 'c', 'C', 'c', 'C', 'c', 'C', 'c', 'D', 'd', 'D', 'd', 'D', 'd', 'E', 'E', 'E', 'E', 'e', 'e', 'e', 'e', 'E', 'e', 'E', 'e', 'E', 'e', 'E', 'e', 'E', 'e', 'G', 'g', 'G', 'g', 'G', 'g', 'G', 'g', 'H', 'h', 'H', 'h', 'I', 'I', 'I', 'I', 'i', 'i', 'i', 'i', 'I', 'i', 'I', 'i', 'I', 'i', 'I', 'i', 'I', 'i', 'J', 'j', 'K', 'k', 'k', 'L', 'l', 'L', 'l', 'L', 'l', 'L', 'l', 'L', 'l', 'N', 'n', 'N', 'n', 'N', 'n', 'N', 'n', 'n', 'N', 'n', 'O', 'O', 'O', 'O', 'O', 'O', 'o', 'o', 'o', 'o', 'o', 'o', 'O', 'o', 'O', 'o', 'O', 'o', 'R', 'r', 'R', 'r', 'R', 'r', 'S', 's', 'S', 's', 'S', 's', 'S', 's', 's', 'T', 't', 'T', 't', 'T', 't', 'U', 'U', 'U', 'U', 'u', 'u', 'u', 'u', 'U', 'u', 'U', 'u', 'U', 'u', 'U', 'u', 'U', 'u', 'U', 'u', 'W', 'w', 'Y', 'y', 'y', 'Y', 'y', 'Y', 'Z', 'z', 'Z', 'z', 'Z', 'z', 'Α', 'α', 'Ε', 'ε', 'Η', 'η', 'Ι', 'ι', 'Ο', 'ο', 'Υ', 'υ', 'Ω', 'ω', 'υ', 'ι', 'ι');
|
||||
$additionalReplacements = $params->get('k2TagNormAdditionalReplacements');
|
||||
$pairs = @explode(',', $additionalReplacements);
|
||||
if(is_array($pairs))
|
||||
{
|
||||
foreach ($pairs as $pair) {
|
||||
@list($search, $replace) = @explode('|', $pair);
|
||||
if(isset($search) && $search && isset($replace) && $replace)
|
||||
{
|
||||
$searches[] = $search;
|
||||
$replacements[] = $replace;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//$this->name = JString::str_ireplace($searches, $replacements, $this->name); // This causes character stripping in J!1.5!!
|
||||
$this->name = str_ireplace($searches, $replacements, $this->name);
|
||||
|
||||
// Switch case
|
||||
if ($params->get('k2TagNormCase') == 'upper')
|
||||
{
|
||||
$this->name = JString::strtoupper($this->name);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->name = JString::strtolower($this->name);
|
||||
|
||||
// Special case for Greek letter s final
|
||||
$this->name = JString::str_ireplace('σ ', 'ς ', $this->name);
|
||||
if(JString::substr($this->name, -1) == 'σ')
|
||||
{
|
||||
$this->name = JString::substr($this->name, 0, -1);
|
||||
$this->name .= 'ς';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->name = JString::trim($this->name);
|
||||
if ($this->name == '')
|
||||
{
|
||||
$this->setError(JText::_('K2_TAG_CANNOT_BE_EMPTY'));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (strlen(utf8_decode($this->name)) < 2)
|
||||
{
|
||||
$this->setError(JText::_('K2_TAG_CANNOT_BE_A_SINGLE_CHARACTER'));
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check if tag exists already for new tags
|
||||
if (!$this->id)
|
||||
{
|
||||
$this->_db->setQuery("SELECT id FROM #__k2_tags WHERE name = ".$this->_db->Quote($this->name));
|
||||
if ($this->_db->loadResult())
|
||||
{
|
||||
$this->setError(JText::_('K2_THIS_TAG_EXISTS_ALREADY'));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
56
administrator/components/com_k2/tables/k2user.php
Normal file
56
administrator/components/com_k2/tables/k2user.php
Normal file
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: k2user.php 1812 2013-01-14 18:45:06Z lefteris.kavadas $
|
||||
* @package K2
|
||||
* @author JoomlaWorks http://www.joomlaworks.net
|
||||
* @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.
|
||||
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
class TableK2User extends K2Table
|
||||
{
|
||||
|
||||
var $id = null;
|
||||
var $userID = null;
|
||||
var $userName = null;
|
||||
var $gender = null;
|
||||
var $description = null;
|
||||
var $image = null;
|
||||
var $url = null;
|
||||
var $group = null;
|
||||
var $plugins = null;
|
||||
var $ip = null;
|
||||
var $hostname = null;
|
||||
var $notes = null;
|
||||
|
||||
function __construct(&$db)
|
||||
{
|
||||
|
||||
parent::__construct('#__k2_users', 'id', $db);
|
||||
}
|
||||
|
||||
function check()
|
||||
{
|
||||
|
||||
if (JString::trim($this->url) != '' && substr($this->url, 0, 7) != 'http://')
|
||||
$this->url = 'http://'.$this->url;
|
||||
return true;
|
||||
}
|
||||
|
||||
function bind($array, $ignore = '')
|
||||
{
|
||||
|
||||
if (key_exists('plugins', $array) && is_array($array['plugins']))
|
||||
{
|
||||
$registry = new JRegistry();
|
||||
$registry->loadArray($array['plugins']);
|
||||
$array['plugins'] = $registry->toString();
|
||||
}
|
||||
|
||||
return parent::bind($array, $ignore);
|
||||
}
|
||||
|
||||
}
|
||||
51
administrator/components/com_k2/tables/k2usergroup.php
Normal file
51
administrator/components/com_k2/tables/k2usergroup.php
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: k2usergroup.php 1812 2013-01-14 18:45:06Z lefteris.kavadas $
|
||||
* @package K2
|
||||
* @author JoomlaWorks http://www.joomlaworks.net
|
||||
* @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.
|
||||
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
class TableK2UserGroup extends K2Table
|
||||
{
|
||||
|
||||
var $id = null;
|
||||
var $name = null;
|
||||
var $permissions = null;
|
||||
|
||||
function __construct(&$db)
|
||||
{
|
||||
|
||||
parent::__construct('#__k2_user_groups', 'id', $db);
|
||||
}
|
||||
|
||||
function check()
|
||||
{
|
||||
$this->name = JString::trim($this->name);
|
||||
if ($this->name == '')
|
||||
{
|
||||
$this->setError(JText::_('K2_GROUP_CANNOT_BE_EMPTY'));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function bind($array, $ignore = '')
|
||||
{
|
||||
|
||||
if (key_exists('params', $array) && is_array($array['params']))
|
||||
{
|
||||
$registry = new JRegistry();
|
||||
$registry->loadArray($array['params']);
|
||||
if (JRequest::getVar('categories') == 'all' || JRequest::getVar('categories') == 'none')
|
||||
$registry->set('categories', JRequest::getVar('categories'));
|
||||
$array['permissions'] = $registry->toString();
|
||||
}
|
||||
return parent::bind($array, $ignore);
|
||||
}
|
||||
|
||||
}
|
||||
27
administrator/components/com_k2/tables/table.php
Normal file
27
administrator/components/com_k2/tables/table.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: table.php 1812 2013-01-14 18:45:06Z lefteris.kavadas $
|
||||
* @package K2
|
||||
* @author JoomlaWorks http://www.joomlaworks.net
|
||||
* @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.
|
||||
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die ;
|
||||
|
||||
class K2Table extends JTable
|
||||
{
|
||||
public function load($keys = null, $reset = true)
|
||||
{
|
||||
if (K2_JVERSION == '15')
|
||||
{
|
||||
return parent::load($keys);
|
||||
}
|
||||
else
|
||||
{
|
||||
return parent::load($keys, $reset);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
11
administrator/components/com_k2/uninstall.mysql.sql
Normal file
11
administrator/components/com_k2/uninstall.mysql.sql
Normal file
@@ -0,0 +1,11 @@
|
||||
DROP TABLE IF EXISTS `#__k2_attachments`;
|
||||
DROP TABLE IF EXISTS `#__k2_categories`;
|
||||
DROP TABLE IF EXISTS `#__k2_comments`;
|
||||
DROP TABLE IF EXISTS `#__k2_extra_fields`;
|
||||
DROP TABLE IF EXISTS `#__k2_extra_fields_groups`;
|
||||
DROP TABLE IF EXISTS `#__k2_items`;
|
||||
DROP TABLE IF EXISTS `#__k2_rating`;
|
||||
DROP TABLE IF EXISTS `#__k2_tags`;
|
||||
DROP TABLE IF EXISTS `#__k2_tags_xref`;
|
||||
DROP TABLE IF EXISTS `#__k2_users`;
|
||||
DROP TABLE IF EXISTS `#__k2_user_groups`;
|
||||
@@ -0,0 +1,195 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: default.php 1971 2013-05-01 16:04:17Z lefteris.kavadas $
|
||||
* @package K2
|
||||
* @author JoomlaWorks http://www.joomlaworks.net
|
||||
* @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.
|
||||
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
$document = JFactory::getDocument();
|
||||
$document->addScriptDeclaration("
|
||||
Joomla.submitbutton = function(pressbutton) {
|
||||
if (pressbutton == 'trash') {
|
||||
var answer = confirm('".JText::_('K2_WARNING_YOU_ARE_ABOUT_TO_TRASH_THE_SELECTED_CATEGORIES_THEIR_CHILDREN_CATEGORIES_AND_ALL_THEIR_INCLUDED_ITEMS', true)."')
|
||||
if (answer){
|
||||
submitform( pressbutton );
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
submitform( pressbutton );
|
||||
}
|
||||
}
|
||||
");
|
||||
|
||||
?>
|
||||
|
||||
<form action="index.php" method="post" name="adminForm" id="adminForm">
|
||||
<table class="k2AdminTableFilters table">
|
||||
<tr>
|
||||
<td class="k2AdminTableFiltersSearch">
|
||||
<?php echo JText::_('K2_FILTER'); ?>
|
||||
<input type="text" name="search" value="<?php echo $this->lists['search'] ?>" class="text_area" title="<?php echo JText::_('K2_FILTER_BY_TITLE'); ?>"/>
|
||||
<button id="k2SubmitButton"><?php echo JText::_('K2_GO'); ?></button>
|
||||
<button id="k2ResetButton"><?php echo JText::_('K2_RESET'); ?></button>
|
||||
</td>
|
||||
<td class="k2AdminTableFiltersSelects hidden-phone">
|
||||
<?php echo $this->lists['categories']; ?>
|
||||
<?php echo $this->lists['trash']; ?> <?php echo $this->lists['state']; ?>
|
||||
<?php if(isset($this->lists['language'])): ?>
|
||||
<?php echo $this->lists['language']; ?>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table class="adminlist table table-striped" id="k2CategoriesList">
|
||||
<thead>
|
||||
<tr>
|
||||
<?php if(K2_JVERSION == '30'): ?>
|
||||
<th width="1%" class="center hidden-phone">
|
||||
<?php echo JHtml::_('grid.sort', '<i class="icon-menu-2"></i>', 'c.ordering', @$this->lists['order_Dir'], @$this->lists['order'], null, 'asc', 'K2_ORDER'); ?>
|
||||
</th>
|
||||
<?php else: ?>
|
||||
<th>
|
||||
#
|
||||
</th>
|
||||
<?php endif; ?>
|
||||
<th>
|
||||
<input id="jToggler" type="checkbox" name="toggle" value="" />
|
||||
</th>
|
||||
<th>
|
||||
<?php echo JHTML::_('grid.sort', 'K2_TITLE', 'c.name', @$this->lists['order_Dir'], @$this->lists['order'] ); ?>
|
||||
</th>
|
||||
<?php if(K2_JVERSION != '30'): ?>
|
||||
<th>
|
||||
<?php echo JHTML::_('grid.sort', 'K2_ORDER', 'c.ordering', @$this->lists['order_Dir'], @$this->lists['order'] ); ?> <?php echo $this->ordering ?JHTML::_('grid.order', $this->rows ,'filesave.png' ):''; ?>
|
||||
</th>
|
||||
<?php endif ;?>
|
||||
<th class="center hidden-phone">
|
||||
<?php echo JText::_('K2_PARAMETER_INHERITANCE'); ?>
|
||||
</th>
|
||||
<th class="center hidden-phone">
|
||||
<?php echo JHTML::_('grid.sort', 'K2_ASSOCIATED_EXTRA_FIELD_GROUPS', 'extra_fields_group', @$this->lists['order_Dir'], @$this->lists['order'] ); ?>
|
||||
</th>
|
||||
<th class="center hidden-phone">
|
||||
<?php echo JText::_('K2_TEMPLATE'); ?>
|
||||
</th>
|
||||
<th class="hidden-phone center">
|
||||
<?php echo JHTML::_('grid.sort', 'K2_ACCESS_LEVEL', 'c.access', @$this->lists['order_Dir'], @$this->lists['order'] ); ?>
|
||||
</th>
|
||||
<th class="center">
|
||||
<?php echo JHTML::_('grid.sort', 'K2_PUBLISHED', 'c.published', @$this->lists['order_Dir'], @$this->lists['order'] ); ?>
|
||||
</th>
|
||||
<th class="center hidden-phone">
|
||||
<?php echo JText::_('K2_IMAGE'); ?>
|
||||
</th>
|
||||
<?php if(isset($this->lists['language'])): ?>
|
||||
<th class="hidden-phone"> <?php echo JHTML::_('grid.sort', 'K2_LANGUAGE', 'c.language', @$this->lists['order_Dir'], @$this->lists['order']); ?> </th>
|
||||
<?php endif; ?>
|
||||
<th class="hidden-phone center">
|
||||
<?php echo JHTML::_('grid.sort', 'K2_ID', 'c.id', @$this->lists['order_Dir'], @$this->lists['order'] ); ?>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="12">
|
||||
<?php if(K2_JVERSION == '30'): ?>
|
||||
<div class="k2LimitBox">
|
||||
<?php echo $this->page->getLimitBox(); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php echo $this->page->getListFooter(); ?>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
<tbody>
|
||||
<?php foreach ($this->rows as $key => $row) : ?>
|
||||
<tr class="row<?php echo ($key%2); ?>" sortable-group-id="<?php echo $row->parent; ?>">
|
||||
|
||||
<?php if(K2_JVERSION == '30'): ?>
|
||||
<td class="order center hidden-phone">
|
||||
<?php if($row->canChange): ?>
|
||||
<span class="sortable-handler <?php echo ($this->ordering) ? '' : 'inactive tip-top' ;?>" title="<?php echo ($this->ordering) ? '' :JText::_('JORDERINGDISABLED');?>" rel="tooltip"><i class="icon-menu"></i></span>
|
||||
<input type="text" style="display:none" name="order[]" size="5" value="<?php echo $row->ordering;?>" class="width-20 text-area-order " />
|
||||
<?php else: ?>
|
||||
<span class="sortable-handler inactive" ><i class="icon-menu"></i></span>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<?php else: ?>
|
||||
<td><?php echo $key+1; ?></td>
|
||||
<?php endif; ?>
|
||||
<td class="k2Center center">
|
||||
<?php if(!$this->filter_trash || $row->trash) { $row->checked_out = 0; echo @JHTML::_('grid.checkedout', $row, $key );}?>
|
||||
</td>
|
||||
<td>
|
||||
<?php if ($this->filter_trash): ?>
|
||||
<?php if ($row->trash): ?>
|
||||
<strong><?php echo $row->treename; ?> (<?php echo $row->numOfTrashedItems; ?>)</strong>
|
||||
<?php else: ?>
|
||||
<?php echo $row->treename; ?> (<?php echo $row->numOfItems.' '.JText::_('K2_ACTIVE'); ?> / <?php echo $row->numOfTrashedItems.' '.JText::_('K2_TRASHED'); ?>)
|
||||
<?php endif; ?>
|
||||
<?php else: ?>
|
||||
<a href="<?php echo JRoute::_('index.php?option=com_k2&view=category&cid='.$row->id); ?>"><?php echo $row->treename; ?>
|
||||
<?php if($this->params->get('showItemsCounterAdmin')): ?>
|
||||
<span class="small">
|
||||
(<?php echo $row->numOfItems.' '.JText::_('K2_ACTIVE'); ?> / <?php echo $row->numOfTrashedItems.' '.JText::_('K2_TRASHED'); ?>)
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<?php if(K2_JVERSION != '30'): ?>
|
||||
<td class="order k2Order">
|
||||
<span><?php echo $this->page->orderUpIcon( $key, $row->parent == 0 || $row->parent == @$this->rows[$key-1]->parent, 'orderup', 'K2_MOVE_UP', $this->ordering); ?></span> <span><?php echo $this->page->orderDownIcon( $key, count($this->rows), $row->parent == 0 || $row->parent == @$this->rows[$key+1]->parent, 'orderdown', 'K2_MOVE_DOWN', $this->ordering ); ?></span>
|
||||
<input type="text" name="order[]" size="5" value="<?php echo $row->ordering; ?>" <?php echo ($this->ordering)?'':'disabled="disabled"'; ?> class="text_area k2OrderBox" />
|
||||
</td>
|
||||
<?php endif; ?>
|
||||
<td class="k2Center center hidden-phone">
|
||||
<?php echo $row->inheritFrom; ?>
|
||||
</td>
|
||||
<td class="k2Center center hidden-phone">
|
||||
<?php echo $row->extra_fields_group; ?>
|
||||
</td>
|
||||
<td class="k2Center center hidden-phone">
|
||||
<?php echo $row->template; ?>
|
||||
</td>
|
||||
<td class="k2Center hidden-phone center">
|
||||
<?php echo ($this->filter_trash || K2_JVERSION != '15')? $row->groupname:JHTML::_('grid.access', $row, $key ); ?>
|
||||
</td>
|
||||
<td class="k2Center center">
|
||||
<?php echo $row->status; ?>
|
||||
</td>
|
||||
<td class="k2Center center hidden-phone">
|
||||
<?php if($row->image): ?>
|
||||
<a href="<?php echo JURI::root().'media/k2/categories/'.$row->image; ?>" class="modal">
|
||||
<?php if (K2_JVERSION == '30') : ?>
|
||||
<?php echo JText::_('K2_PREVIEW_IMAGE'); ?>
|
||||
<?php else: ?>
|
||||
<img src="templates/<?php echo $this->template; ?>/images/menu/icon-16-media.png" alt="<?php echo JText::_('K2_PREVIEW_IMAGE'); ?>" />
|
||||
<?php endif; ?>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<?php if(isset($this->lists['language'])): ?>
|
||||
<td class="center hidden-phone"><?php echo $row->language; ?></td>
|
||||
<?php endif; ?>
|
||||
<td class="k2Center center hidden-phone">
|
||||
<?php echo $row->id; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<input type="hidden" name="option" value="com_k2" />
|
||||
<input type="hidden" name="view" value="<?php echo JRequest::getVar('view'); ?>" />
|
||||
<input type="hidden" name="task" value="" />
|
||||
<input type="hidden" name="filter_order" value="<?php echo $this->lists['order']; ?>" />
|
||||
<input type="hidden" name="filter_order_Dir" value="<?php echo $this->lists['order_Dir']; ?>" />
|
||||
<input type="hidden" name="boxchecked" value="0" />
|
||||
<?php echo JHTML::_( 'form.token' ); ?>
|
||||
</form>
|
||||
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: element.php 1971 2013-05-01 16:04:17Z lefteris.kavadas $
|
||||
* @package K2
|
||||
* @author JoomlaWorks http://www.joomlaworks.net
|
||||
* @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.
|
||||
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die;
|
||||
?>
|
||||
<form action="index.php" method="post" name="adminForm" id="adminForm">
|
||||
<h1><?php echo JText::_('K2_SELECT_CATEGORIES'); ?></h1>
|
||||
<table class="k2AdminTableFilters">
|
||||
<tr>
|
||||
<td class="k2AdminTableFiltersSearch">
|
||||
<?php echo JText::_('K2_FILTER'); ?>
|
||||
<input type="text" name="search" value="<?php echo $this->lists['search'] ?>" class="text_area" title="<?php echo JText::_('K2_FILTER_BY_TITLE'); ?>"/>
|
||||
<button id="k2SubmitButton"><?php echo JText::_('K2_GO'); ?></button>
|
||||
<button id="k2ResetButton"><?php echo JText::_('K2_RESET'); ?></button>
|
||||
</td>
|
||||
<td class="k2AdminTableFiltersSelects hidden-phone">
|
||||
<?php echo $this->lists['state']; ?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table class="adminlist table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>#</th>
|
||||
<th> <?php echo JHTML::_('grid.sort', 'K2_TITLE', 'c.name', @$this->lists['order_Dir'], @$this->lists['order'] ); ?></th>
|
||||
<th><?php echo JHTML::_('grid.sort', 'K2_ASSOCIATED_EXTRA_FIELD_GROUPS', 'extra_fields_group', @$this->lists['order_Dir'], @$this->lists['order'] ); ?></th>
|
||||
<th><?php echo JHTML::_('grid.sort', 'K2_ACCESS_LEVEL', 'c.access', @$this->lists['order_Dir'], @$this->lists['order'] ); ?></th>
|
||||
<th><?php echo JHTML::_('grid.sort', 'K2_PUBLISHED', 'c.published', @$this->lists['order_Dir'], @$this->lists['order'] ); ?></th>
|
||||
<th><?php echo JHTML::_('grid.sort', 'K2_ID', 'c.id', @$this->lists['order_Dir'], @$this->lists['order'] ); ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($this->rows as $key => $row): ?>
|
||||
<tr class="row<?php echo ($key%2); ?>">
|
||||
<td><?php echo $key+1; ?></td>
|
||||
<td><a class="k2ListItemDisabled" title="<?php echo JText::_('K2_CLICK_TO_ADD_THIS_ITEM'); ?>" onclick="window.parent.jSelectCategory('<?php echo $row->id; ?>', '<?php echo str_replace(array("'", "\""), array("\\'", ""),$row->name); ?>', 'id');"><?php echo $row->treename; ?></a></td>
|
||||
<td class="k2Center"><?php echo $row->extra_fields_group; ?></td>
|
||||
<td class="k2Center"><?php echo $row->groupname; ?></td>
|
||||
<td class="k2Center"><?php echo $row->status; ?></td>
|
||||
<td><?php echo $row->id; ?></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="6">
|
||||
<?php if(K2_JVERSION == '30'): ?>
|
||||
<div class="k2LimitBox">
|
||||
<?php echo $this->page->getLimitBox(); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php echo $this->page->getListFooter(); ?>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
<input type="hidden" name="option" value="com_k2" />
|
||||
<input type="hidden" name="view" value="<?php echo JRequest::getVar('view'); ?>" />
|
||||
<input type="hidden" name="task" value="element" />
|
||||
<input type="hidden" name="tmpl" value="component" />
|
||||
<input type="hidden" name="filter_order" value="<?php echo $this->lists['order']; ?>" />
|
||||
<input type="hidden" name="filter_order_Dir" value="<?php echo $this->lists['order_Dir']; ?>" />
|
||||
<?php echo JHTML::_( 'form.token' ); ?>
|
||||
</form>
|
||||
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: move.php 1877 2013-02-07 14:37:58Z joomlaworks $
|
||||
* @package K2
|
||||
* @author JoomlaWorks http://www.joomlaworks.net
|
||||
* @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.
|
||||
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
$document = & JFactory::getDocument();
|
||||
$document->addScriptDeclaration("
|
||||
Joomla.submitbutton = function(pressbutton) {
|
||||
if (pressbutton == 'cancel') {
|
||||
submitform( pressbutton );
|
||||
return;
|
||||
}
|
||||
if (\$K2.trim(\$K2('#category').val()) == '') {
|
||||
alert( '".JText::_('K2_YOU_MUST_SELECT_A_PARENT_CATEGORY', true)."' );
|
||||
} else {
|
||||
submitform( pressbutton );
|
||||
}
|
||||
}
|
||||
");
|
||||
|
||||
?>
|
||||
|
||||
<form action="index.php" method="post" name="adminForm" id="adminForm">
|
||||
<fieldset>
|
||||
<legend><?php echo JText::_('K2_PARENT_CATEGORY'); ?></legend>
|
||||
<?php echo $this->lists['categories']; ?>
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<legend>(<?php echo count($this->rows); ?>) <?php echo JText::_('K2_CATEGORIES_BEING_MOVED'); ?></legend>
|
||||
<ol>
|
||||
<?php foreach ($this->rows as $row): ?>
|
||||
<li><?php echo $row->name; ?><input type="hidden" name="cid[]" value="<?php echo $row->id; ?>" /></li>
|
||||
<?php endforeach; ?>
|
||||
</ol>
|
||||
</fieldset>
|
||||
<input type="hidden" name="option" value="com_k2" />
|
||||
<input type="hidden" name="view" value="<?php echo JRequest::getVar('view'); ?>" />
|
||||
<input type="hidden" name="task" value="<?php echo JRequest::getVar('task'); ?>" />
|
||||
</form>
|
||||
238
administrator/components/com_k2/views/categories/view.html.php
Normal file
238
administrator/components/com_k2/views/categories/view.html.php
Normal file
@@ -0,0 +1,238 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: view.html.php 1962 2013-04-29 12:29:34Z lefteris.kavadas $
|
||||
* @package K2
|
||||
* @author JoomlaWorks http://www.joomlaworks.net
|
||||
* @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.
|
||||
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die ;
|
||||
|
||||
jimport('joomla.application.component.view');
|
||||
|
||||
class K2ViewCategories extends K2View
|
||||
{
|
||||
|
||||
function display($tpl = null)
|
||||
{
|
||||
|
||||
$mainframe = JFactory::getApplication();
|
||||
$user = JFactory::getUser();
|
||||
$option = JRequest::getCmd('option');
|
||||
$view = JRequest::getCmd('view');
|
||||
$limit = $mainframe->getUserStateFromRequest('global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int');
|
||||
$limitstart = $mainframe->getUserStateFromRequest($option.$view.'.limitstart', 'limitstart', 0, 'int');
|
||||
$filter_order = $mainframe->getUserStateFromRequest($option.$view.'filter_order', 'filter_order', 'c.ordering', 'cmd');
|
||||
$filter_order_Dir = $mainframe->getUserStateFromRequest($option.$view.'filter_order_Dir', 'filter_order_Dir', '', 'word');
|
||||
$filter_trash = $mainframe->getUserStateFromRequest($option.$view.'filter_trash', 'filter_trash', 0, 'int');
|
||||
$filter_category = $mainframe->getUserStateFromRequest($option.$view.'filter_category', 'filter_category', 0, 'int');
|
||||
$filter_state = $mainframe->getUserStateFromRequest($option.$view.'filter_state', 'filter_state', -1, 'int');
|
||||
$language = $mainframe->getUserStateFromRequest($option.$view.'language', 'language', '', 'string');
|
||||
$search = $mainframe->getUserStateFromRequest($option.$view.'search', 'search', '', 'string');
|
||||
$search = JString::strtolower($search);
|
||||
$model = $this->getModel();
|
||||
$total = $model->getTotal();
|
||||
$task = JRequest::getCmd('task');
|
||||
if ($limitstart > $total - $limit)
|
||||
{
|
||||
$limitstart = max(0, (int)(ceil($total / $limit) - 1) * $limit);
|
||||
JRequest::setVar('limitstart', $limitstart);
|
||||
}
|
||||
|
||||
$categories = $model->getData();
|
||||
$categoryModel = K2Model::getInstance('Category', 'K2Model');
|
||||
|
||||
$params = JComponentHelper::getParams('com_k2');
|
||||
$this->assignRef('params', $params);
|
||||
|
||||
if (K2_JVERSION != '15')
|
||||
{
|
||||
$langs = JLanguageHelper::getLanguages();
|
||||
$langsMapping = array();
|
||||
$langsMapping['*'] = JText::_('K2_ALL');
|
||||
foreach ($langs as $lang)
|
||||
{
|
||||
$langsMapping[$lang->lang_code] = $lang->title;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for ($i = 0; $i < sizeof($categories); $i++)
|
||||
{
|
||||
$categories[$i]->status = K2_JVERSION == '15' ? JHTML::_('grid.published', $categories[$i], $i) : JHtml::_('jgrid.published', $categories[$i]->published, $i, '', $filter_trash == 0 && $task != 'element');
|
||||
if ($params->get('showItemsCounterAdmin'))
|
||||
{
|
||||
$categories[$i]->numOfItems = $categoryModel->countCategoryItems($categories[$i]->id);
|
||||
$categories[$i]->numOfTrashedItems = $categoryModel->countCategoryItems($categories[$i]->id, 1);
|
||||
}
|
||||
if (K2_JVERSION == '30')
|
||||
{
|
||||
$categories[$i]->canChange = $user->authorise('core.edit.state', 'com_k2.category.'.$categories[$i]->id);
|
||||
}
|
||||
// Detect the category template
|
||||
if (K2_JVERSION != '15')
|
||||
{
|
||||
$categoryParams = json_decode($categories[$i]->params);
|
||||
$categories[$i]->template = $categoryParams->theme;
|
||||
$categories[$i]->language = $categories[$i]->language ? $categories[$i]->language : '*';
|
||||
if (isset($langsMapping))
|
||||
{
|
||||
$categories[$i]->language = $langsMapping[$categories[$i]->language];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (function_exists('parse_ini_string'))
|
||||
{
|
||||
$categoryParams = parse_ini_string($categories[$i]->params);
|
||||
$categories[$i]->template = $categoryParams['theme'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$categoryParams = new JParameter($categories[$i]->params);
|
||||
$categories[$i]->template = $categoryParams->get('theme');
|
||||
}
|
||||
}
|
||||
if (!$categories[$i]->template)
|
||||
{
|
||||
$categories[$i]->template = 'default';
|
||||
}
|
||||
}
|
||||
|
||||
$this->assignRef('rows', $categories);
|
||||
|
||||
jimport('joomla.html.pagination');
|
||||
$pageNav = new JPagination($total, $limitstart, $limit);
|
||||
$this->assignRef('page', $pageNav);
|
||||
|
||||
$lists = array();
|
||||
$lists['search'] = $search;
|
||||
$lists['order_Dir'] = $filter_order_Dir;
|
||||
$lists['order'] = $filter_order;
|
||||
|
||||
$filter_trash_options[] = JHTML::_('select.option', 0, JText::_('K2_CURRENT'));
|
||||
$filter_trash_options[] = JHTML::_('select.option', 1, JText::_('K2_TRASHED'));
|
||||
$lists['trash'] = JHTML::_('select.genericlist', $filter_trash_options, 'filter_trash', '', 'value', 'text', $filter_trash);
|
||||
|
||||
$filter_state_options[] = JHTML::_('select.option', -1, JText::_('K2_SELECT_STATE'));
|
||||
$filter_state_options[] = JHTML::_('select.option', 1, JText::_('K2_PUBLISHED'));
|
||||
$filter_state_options[] = JHTML::_('select.option', 0, JText::_('K2_UNPUBLISHED'));
|
||||
$lists['state'] = JHTML::_('select.genericlist', $filter_state_options, 'filter_state', '', 'value', 'text', $filter_state);
|
||||
|
||||
require_once JPATH_ADMINISTRATOR.'/components/com_k2/models/categories.php';
|
||||
$categoriesModel = K2Model::getInstance('Categories', 'K2Model');
|
||||
$categories_option[] = JHTML::_('select.option', 0, JText::_('K2_SELECT_CATEGORY'));
|
||||
$categoriesFilter = $categoriesModel->categoriesTree(NULL, true, false);
|
||||
$categories_options = @array_merge($categories_option, $categoriesFilter);
|
||||
$lists['categories'] = JHTML::_('select.genericlist', $categories_options, 'filter_category', '', 'value', 'text', $filter_category);
|
||||
|
||||
if (version_compare(JVERSION, '1.6.0', 'ge'))
|
||||
{
|
||||
$languages = JHTML::_('contentlanguage.existing', true, true);
|
||||
array_unshift($languages, JHTML::_('select.option', '', JText::_('K2_SELECT_LANGUAGE')));
|
||||
$lists['language'] = JHTML::_('select.genericlist', $languages, 'language', '', 'value', 'text', $language);
|
||||
}
|
||||
$this->assignRef('lists', $lists);
|
||||
|
||||
JToolBarHelper::title(JText::_('K2_CATEGORIES'), 'k2.png');
|
||||
|
||||
if ($filter_trash == 1)
|
||||
{
|
||||
JToolBarHelper::custom('restore', 'publish.png', 'publish_f2.png', 'K2_RESTORE', true);
|
||||
JToolBarHelper::deleteList('K2_ARE_YOU_SURE_YOU_WANT_TO_DELETE_SELECTED_CATEGORIES', 'remove', 'K2_DELETE');
|
||||
}
|
||||
else
|
||||
{
|
||||
JToolBarHelper::publishList();
|
||||
JToolBarHelper::unpublishList();
|
||||
JToolBarHelper::custom('move', 'move.png', 'move_f2.png', 'K2_MOVE', true);
|
||||
JToolBarHelper::custom('copy', 'copy.png', 'copy_f2.png', 'K2_COPY', true);
|
||||
JToolBarHelper::editList();
|
||||
JToolBarHelper::addNew();
|
||||
JToolBarHelper::trash('trash');
|
||||
}
|
||||
|
||||
if (K2_JVERSION != '15')
|
||||
{
|
||||
JToolBarHelper::preferences('com_k2', 550, 875, 'K2_PARAMETERS');
|
||||
}
|
||||
else
|
||||
{
|
||||
$toolbar = JToolBar::getInstance('toolbar');
|
||||
$toolbar->appendButton('Popup', 'config', 'Parameters', 'index.php?option=com_k2&view=settings');
|
||||
}
|
||||
|
||||
$this->loadHelper('html');
|
||||
K2HelperHTML::subMenu();
|
||||
|
||||
$this->assignRef('filter_trash', $filter_trash);
|
||||
$template = $mainframe->getTemplate();
|
||||
$this->assignRef('template', $template);
|
||||
$ordering = (($this->lists['order'] == 'c.ordering' || $this->lists['order'] == 'c.parent, c.ordering') && (!$this->filter_trash));
|
||||
$this->assignRef('ordering', $ordering);
|
||||
|
||||
// Joomla! 3.0 drag-n-drop sorting variables
|
||||
if (K2_JVERSION == '30')
|
||||
{
|
||||
if ($ordering)
|
||||
{
|
||||
JHtml::_('sortablelist.sortable', 'k2CategoriesList', 'adminForm', strtolower($this->lists['order_Dir']), 'index.php?option=com_k2&view=categories&task=saveorder&format=raw');
|
||||
}
|
||||
$document = JFactory::getDocument();
|
||||
$document->addScriptDeclaration('
|
||||
Joomla.orderTable = function() {
|
||||
table = document.getElementById("sortTable");
|
||||
direction = document.getElementById("directionTable");
|
||||
order = table.options[table.selectedIndex].value;
|
||||
if (order != \''.$this->lists['order'].'\') {
|
||||
dirn = \'asc\';
|
||||
} else {
|
||||
dirn = direction.options[direction.selectedIndex].value;
|
||||
}
|
||||
Joomla.tableOrdering(order, dirn, "");
|
||||
}');
|
||||
}
|
||||
|
||||
parent::display($tpl);
|
||||
|
||||
}
|
||||
|
||||
function move()
|
||||
{
|
||||
|
||||
$mainframe = JFactory::getApplication();
|
||||
JTable::addIncludePath(JPATH_COMPONENT.DS.'tables');
|
||||
$cid = JRequest::getVar('cid');
|
||||
|
||||
foreach ($cid as $id)
|
||||
{
|
||||
$row = &JTable::getInstance('K2Category', 'Table');
|
||||
$row->load($id);
|
||||
$rows[] = $row;
|
||||
}
|
||||
|
||||
$categoriesModel = K2Model::getInstance('Categories', 'K2Model');
|
||||
$categories_option[] = JHTML::_('select.option', 0, JText::_('K2_NONE_ONSELECTLISTS'));
|
||||
$categories = $categoriesModel->categoriesTree(NULL, true, false);
|
||||
$categories_options = @array_merge($categories_option, $categories);
|
||||
foreach ($categories_options as $option)
|
||||
{
|
||||
if (in_array($option->value, $cid))
|
||||
$option->disable = true;
|
||||
}
|
||||
$lists['categories'] = JHTML::_('select.genericlist', $categories_options, 'category', 'class="inputbox" size="8"', 'value', 'text');
|
||||
|
||||
$this->assignRef('rows', $rows);
|
||||
$this->assignRef('lists', $lists);
|
||||
|
||||
JToolBarHelper::title(JText::_('K2_MOVE_CATEGORIES'), 'k2.png');
|
||||
|
||||
JToolBarHelper::custom('saveMove', 'save.png', 'save_f2.png', 'K2_SAVE', false);
|
||||
JToolBarHelper::cancel();
|
||||
|
||||
parent::display();
|
||||
}
|
||||
|
||||
}
|
||||
330
administrator/components/com_k2/views/category/tmpl/default.php
Normal file
330
administrator/components/com_k2/views/category/tmpl/default.php
Normal file
@@ -0,0 +1,330 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: default.php 1822 2013-01-18 16:47:59Z lefteris.kavadas $
|
||||
* @package K2
|
||||
* @author JoomlaWorks http://www.joomlaworks.net
|
||||
* @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.
|
||||
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
$document = JFactory::getDocument();
|
||||
$document->addScriptDeclaration("
|
||||
Joomla.submitbutton = function(pressbutton){
|
||||
if (pressbutton == 'cancel') {
|
||||
submitform( pressbutton );
|
||||
return;
|
||||
}
|
||||
if (\$K2.trim(\$K2('#name').val()) == '') {
|
||||
alert( '".JText::_('K2_A_CATEGORY_MUST_AT_LEAST_HAVE_A_TITLE', true)."' );
|
||||
} else {
|
||||
".$this->onSave."
|
||||
submitform( pressbutton );
|
||||
}
|
||||
}
|
||||
");
|
||||
|
||||
?>
|
||||
|
||||
<form action="index.php" enctype="multipart/form-data" method="post" name="adminForm" id="adminForm">
|
||||
<table cellspacing="0" cellpadding="0" border="0" class="adminFormK2Container adminK2Category table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<table class="adminFormK2 table">
|
||||
<tr>
|
||||
<td class="adminK2LeftCol">
|
||||
<label for="name"><?php echo JText::_('K2_TITLE'); ?></label>
|
||||
</td>
|
||||
<td class="adminK2RightCol">
|
||||
<input class="text_area k2TitleBox" type="text" name="name" id="name" value="<?php echo $this->row->name; ?>" maxlength="250" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="adminK2LeftCol">
|
||||
<label for="alias"><?php echo JText::_('K2_TITLE_ALIAS'); ?></label>
|
||||
</td>
|
||||
<td class="adminK2RightCol">
|
||||
<input class="text_area k2TitleAliasBox" type="text" name="alias" value="<?php echo $this->row->alias; ?>" maxlength="250" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="adminK2LeftCol">
|
||||
<label for="parent"><?php echo JText::_('K2_PARENT_CATEGORY'); ?></label>
|
||||
</td>
|
||||
<td class="adminK2RightCol">
|
||||
<?php echo $this->lists['parent']; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="adminK2LeftCol">
|
||||
<label for="paramsinheritFrom"><?php echo JText::_('K2_INHERIT_PARAMETER_OPTIONS_FROM_CATEGORY'); ?></label>
|
||||
</td>
|
||||
<td class="adminK2RightCol">
|
||||
<?php echo $this->lists['inheritFrom']; ?> <span class="hasTip k2Notice" title="<?php echo JText::_('K2_INHERIT_PARAMETER_OPTIONS_FROM_CATEGORY'); ?>::<?php echo JText::_('K2_SETTING_THIS_OPTION_WILL_MAKE_THIS_CATEGORY_INHERIT_ALL_PARAMETERS_FROM_ANOTHER_CATEGORY_THUS_YOU_DONT_HAVE_TO_RESET_ALL_OPTIONS_IN_THIS_ONE_IF_THEY_ARE_THE_SAME_WITH_ANOTHER_CATEGORYS_THIS_SETTING_IS_VERY_USEFUL_WHEN_YOU_ARE_CREATING_CHILD_CATEGORIES_WHICH_SHARE_THE_SAME_PARAMETERS_WITH_THEIR_PARENT_CATEGORY_EG_IN_THE_CASE_OF_A_CATALOG_OR_A_NEWS_PORTALMAGAZINE'); ?>"><?php echo JText::_('K2_LEARN_WHAT_THIS_MEANS'); ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="adminK2LeftCol">
|
||||
<label for="extraFieldsGroup"><?php echo JText::_('K2_ASSOCIATED_EXTRA_FIELDS_GROUP'); ?></label>
|
||||
</td>
|
||||
<td class="adminK2RightCol">
|
||||
<?php echo $this->lists['extraFieldsGroup']; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="adminK2LeftCol">
|
||||
<label><?php echo JText::_('K2_PUBLISHED'); ?></label>
|
||||
</td>
|
||||
<td class="adminK2RightCol k2RadioButtonContainer">
|
||||
<?php echo $this->lists['published']; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="adminK2LeftCol">
|
||||
<label for="access"><?php echo JText::_('K2_ACCESS_LEVEL'); ?></label>
|
||||
</td>
|
||||
<td class="adminK2RightCol">
|
||||
<?php echo $this->lists['access']; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php if(isset($this->lists['language'])): ?>
|
||||
<tr>
|
||||
<td class="adminK2LeftCol">
|
||||
<label><?php echo JText::_('K2_LANGUAGE'); ?></label>
|
||||
</td>
|
||||
<td class="adminK2RightCol">
|
||||
<?php echo $this->lists['language']; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
</table>
|
||||
|
||||
<!-- Tabs start here -->
|
||||
<div class="simpleTabs" id="k2Tabs">
|
||||
<ul class="simpleTabsNavigation">
|
||||
<li id="tabContent"><a href="#k2Tab1"><?php echo JText::_('K2_DESCRIPTION'); ?></a></li>
|
||||
<li id="tabImage"><a href="#k2Tab2"><?php echo JText::_('K2_IMAGE'); ?></a></li>
|
||||
</ul>
|
||||
|
||||
<!-- Tab content -->
|
||||
<div class="simpleTabsContent" id="k2Tab1">
|
||||
<div class="k2ItemFormEditor"> <span class="k2ItemFormEditorTitle"> <?php echo JText::_('K2_CATEGORY_DESCRIPTION'); ?> </span> <?php echo $this->editor; ?>
|
||||
<div class="dummyHeight"></div>
|
||||
<div class="clr"></div>
|
||||
</div>
|
||||
<div class="clr"></div>
|
||||
</div>
|
||||
|
||||
<!-- Tab image -->
|
||||
<div class="simpleTabsContent" id="k2Tab2">
|
||||
<table class="admintable table">
|
||||
<tr>
|
||||
<td align="right" class="key">
|
||||
<?php echo JText::_('K2_CATEGORY_IMAGE'); ?>
|
||||
</td>
|
||||
<td>
|
||||
<input type="file" name="image" class="fileUpload" />
|
||||
<i>(<?php echo JText::_('K2_MAX_UPLOAD_SIZE'); ?>: <?php echo ini_get('upload_max_filesize'); ?>)</i>
|
||||
<br />
|
||||
<br />
|
||||
<input type="text" name="existingImage" id="existingImageValue" class="text_area" readonly />
|
||||
<input type="button" value="<?php echo JText::_('K2_BROWSE_SERVER'); ?>" id="k2ImageBrowseServer" />
|
||||
<br />
|
||||
<br />
|
||||
<?php if (!empty($this->row->image)): ?>
|
||||
<img src="<?php echo JURI::root(true); ?>/media/k2/categories/<?php echo $this->row->image; ?>" alt="<?php echo $this->row->name; ?>" class="k2AdminImage" />
|
||||
<input type="checkbox" name="del_image" id="del_image" />
|
||||
<label for="del_image"><?php echo JText::_('K2_CHECK_THIS_BOX_TO_DELETE_CURRENT_IMAGE_OR_JUST_UPLOAD_A_NEW_IMAGE_TO_REPLACE_THE_EXISTING_ONE'); ?></label>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Tabs end here -->
|
||||
|
||||
<!-- K2 Category Plugins -->
|
||||
<?php if (count($this->K2Plugins)): ?>
|
||||
<div class="itemPlugins">
|
||||
<?php foreach ($this->K2Plugins as $K2Plugin): ?>
|
||||
<?php if(!is_null($K2Plugin)): ?>
|
||||
<fieldset class="adminform">
|
||||
<legend><?php echo $K2Plugin->name; ?></legend>
|
||||
<?php echo $K2Plugin->fields; ?>
|
||||
</fieldset>
|
||||
<?php endif; ?>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<div class="clr"></div>
|
||||
</td>
|
||||
<td id="adminFormK2Sidebar" class="xmlParamsFields">
|
||||
<div id="k2Accordion">
|
||||
<h3><a href="#"><?php echo JText::_('K2_CATEGORY_ITEM_LAYOUT'); ?></a></h3>
|
||||
<div>
|
||||
<?php if(K2_JVERSION != '15'): ?>
|
||||
<fieldset class="panelform">
|
||||
<ul class="adminformlist">
|
||||
<?php foreach ($this->form->getFieldset('category-item-layout') as $field): ?>
|
||||
<li>
|
||||
<?php if($field->type=='header'): ?>
|
||||
<div class="paramValueHeader"><?php echo $field->input; ?></div>
|
||||
<?php elseif($field->type=='Spacer'): ?>
|
||||
<div class="paramValueSpacer"> </div>
|
||||
<div class="clr"></div>
|
||||
<?php else: ?>
|
||||
<div class="paramLabel"><?php echo $field->label; ?></div>
|
||||
<div class="paramValue"><?php echo $field->input; ?></div>
|
||||
<div class="clr"></div>
|
||||
<?php endif; ?>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
</fieldset>
|
||||
<?php else: ?>
|
||||
<?php echo $this->form->render('params', 'category-item-layout'); ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<h3><a href="#"><?php echo JText::_('K2_CATEGORY_VIEW_OPTIONS'); ?></a></h3>
|
||||
<div>
|
||||
<?php if(K2_JVERSION != '15'): ?>
|
||||
<fieldset class="panelform">
|
||||
<ul class="adminformlist">
|
||||
<?php foreach ($this->form->getFieldset('category-view-options') as $field): ?>
|
||||
<li>
|
||||
<?php if($field->type=='header'): ?>
|
||||
<div class="paramValueHeader"><?php echo $field->input; ?></div>
|
||||
<?php elseif($field->type=='Spacer'): ?>
|
||||
<div class="paramValueSpacer"> </div>
|
||||
<div class="clr"></div>
|
||||
<?php else: ?>
|
||||
<div class="paramLabel"><?php echo $field->label; ?></div>
|
||||
<div class="paramValue"><?php echo $field->input; ?></div>
|
||||
<div class="clr"></div>
|
||||
<?php endif; ?>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
</fieldset>
|
||||
<?php else: ?>
|
||||
<?php echo $this->form->render('params', 'category-view-options'); ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<h3><a href="#"><?php echo JText::_('K2_ITEM_IMAGE_OPTIONS'); ?></a></h3>
|
||||
<div>
|
||||
<?php if(K2_JVERSION != '15'): ?>
|
||||
<fieldset class="panelform">
|
||||
<ul class="adminformlist">
|
||||
<?php foreach ($this->form->getFieldset('item-image-options') as $field): ?>
|
||||
<li>
|
||||
<?php if($field->type=='header'): ?>
|
||||
<div class="paramValueHeader"><?php echo $field->input; ?></div>
|
||||
<?php elseif($field->type=='Spacer'): ?>
|
||||
<div class="paramValueSpacer"> </div>
|
||||
<div class="clr"></div>
|
||||
<?php else: ?>
|
||||
<div class="paramLabel"><?php echo $field->label; ?></div>
|
||||
<div class="paramValue"><?php echo $field->input; ?></div>
|
||||
<div class="clr"></div>
|
||||
<?php endif; ?>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
</fieldset>
|
||||
<?php else: ?>
|
||||
<?php echo $this->form->render('params', 'item-image-options'); ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<h3><a href="#"><?php echo JText::_('K2_ITEM_VIEW_OPTIONS_IN_CATEGORY_LISTINGS'); ?></a></h3>
|
||||
<div>
|
||||
<?php if(K2_JVERSION != '15'): ?>
|
||||
<fieldset class="panelform">
|
||||
<ul class="adminformlist">
|
||||
<?php foreach ($this->form->getFieldset('item-view-options-listings') as $field): ?>
|
||||
<li>
|
||||
<?php if($field->type=='header'): ?>
|
||||
<div class="paramValueHeader"><?php echo $field->input; ?></div>
|
||||
<?php elseif($field->type=='Spacer'): ?>
|
||||
<div class="paramValueSpacer"> </div>
|
||||
<div class="clr"></div>
|
||||
<?php else: ?>
|
||||
<div class="paramLabel"><?php echo $field->label; ?></div>
|
||||
<div class="paramValue"><?php echo $field->input; ?></div>
|
||||
<div class="clr"></div>
|
||||
<?php endif; ?>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
</fieldset>
|
||||
<?php else: ?>
|
||||
<?php echo $this->form->render('params', 'item-view-options-listings'); ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<h3><a href="#"><?php echo JText::_('K2_ITEM_VIEW_OPTIONS'); ?></a></h3>
|
||||
<div>
|
||||
<?php if(K2_JVERSION != '15'): ?>
|
||||
<fieldset class="panelform">
|
||||
<ul class="adminformlist">
|
||||
<?php foreach ($this->form->getFieldset('item-view-options') as $field): ?>
|
||||
<li>
|
||||
<?php if($field->type=='header'): ?>
|
||||
<div class="paramValueHeader"><?php echo $field->input; ?></div>
|
||||
<?php elseif($field->type=='Spacer'): ?>
|
||||
<div class="paramValueSpacer"> </div>
|
||||
<div class="clr"></div>
|
||||
<?php else: ?>
|
||||
<div class="paramLabel"><?php echo $field->label; ?></div>
|
||||
<div class="paramValue"><?php echo $field->input; ?></div>
|
||||
<div class="clr"></div>
|
||||
<?php endif; ?>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
</fieldset>
|
||||
<?php else: ?>
|
||||
<?php echo $this->form->render('params', 'item-view-options'); ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<h3><a href="#"><?php echo JText::_('K2_METADATA_INFORMATION'); ?></a></h3>
|
||||
<div>
|
||||
<?php if(K2_JVERSION != '15'): ?>
|
||||
<fieldset class="panelform">
|
||||
<ul class="adminformlist">
|
||||
<?php foreach ($this->form->getFieldset('category-metadata-information') as $field): ?>
|
||||
<li>
|
||||
<?php if($field->type=='header'): ?>
|
||||
<div class="paramValueHeader"><?php echo $field->input; ?></div>
|
||||
<?php elseif($field->type=='Spacer'): ?>
|
||||
<div class="paramValueSpacer"> </div>
|
||||
<div class="clr"></div>
|
||||
<?php else: ?>
|
||||
<div class="paramLabel"><?php echo $field->label; ?></div>
|
||||
<div class="paramValue"><?php echo $field->input; ?></div>
|
||||
<div class="clr"></div>
|
||||
<?php endif; ?>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
</fieldset>
|
||||
<?php else: ?>
|
||||
<?php echo $this->form->render('params', 'category-metadata-information'); ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php if($this->aceAclFlag): ?>
|
||||
<h3><a href="#"><?php echo JText::_('AceACL') . ' ' . JText::_('COM_ACEACL_COMMON_PERMISSIONS'); ?></a></h3>
|
||||
<div><?php AceaclApi::getWidget('com_k2.category.'.$this->row->id, true); ?></div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<input type="hidden" name="id" value="<?php echo $this->row->id; ?>" />
|
||||
<input type="hidden" name="option" value="com_k2" />
|
||||
<input type="hidden" name="view" value="category" />
|
||||
<input type="hidden" name="task" value="<?php echo JRequest::getVar('task'); ?>" />
|
||||
<?php echo JHTML::_('form.token'); ?>
|
||||
</form>
|
||||
129
administrator/components/com_k2/views/category/view.html.php
Normal file
129
administrator/components/com_k2/views/category/view.html.php
Normal file
@@ -0,0 +1,129 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: view.html.php 1962 2013-04-29 12:29:34Z lefteris.kavadas $
|
||||
* @package K2
|
||||
* @author JoomlaWorks http://www.joomlaworks.net
|
||||
* @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.
|
||||
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
jimport('joomla.application.component.view');
|
||||
|
||||
class K2ViewCategory extends K2View
|
||||
{
|
||||
|
||||
function display($tpl = null)
|
||||
{
|
||||
|
||||
JRequest::setVar('hidemainmenu', 1);
|
||||
$model = $this->getModel();
|
||||
$category = $model->getData();
|
||||
if (K2_JVERSION == '15')
|
||||
{
|
||||
JFilterOutput::objectHTMLSafe($category);
|
||||
}
|
||||
else
|
||||
{
|
||||
JFilterOutput::objectHTMLSafe($category, ENT_QUOTES, array('params', 'plugins'));
|
||||
}
|
||||
if (!$category->id)
|
||||
$category->published = 1;
|
||||
$this->assignRef('row', $category);
|
||||
$wysiwyg = JFactory::getEditor();
|
||||
$editor = $wysiwyg->display('description', $category->description, '100%', '250px', '', '', array('pagebreak', 'readmore'));
|
||||
$this->assignRef('editor', $editor);
|
||||
$onSave = '';
|
||||
if(K2_JVERSION == '30')
|
||||
{
|
||||
$onSave = $wysiwyg->save('description');
|
||||
}
|
||||
$this->assignRef('onSave', $onSave);
|
||||
|
||||
$document = JFactory::getDocument();
|
||||
/*
|
||||
$js = "
|
||||
var K2SitePath = '".JURI::root(true)."/';
|
||||
var K2BasePath = '".JURI::base(true)."/';
|
||||
";
|
||||
*/
|
||||
$document->addScriptDeclaration("var K2BasePath = '".JURI::base(true)."/';");
|
||||
|
||||
$lists = array();
|
||||
$lists['published'] = JHTML::_('select.booleanlist', 'published', 'class="inputbox"', $category->published);
|
||||
$lists['access'] = version_compare(JVERSION, '3.0', 'ge') ? JHTML::_('access.level', 'access', $category->access) : JHTML::_('list.accesslevel', $category);
|
||||
$query = 'SELECT ordering AS value, name AS text FROM #__k2_categories ORDER BY ordering';
|
||||
$lists['ordering'] = version_compare(JVERSION, '3.0', 'ge') ? NUll : JHTML::_('list.specificordering', $category, $category->id, $query);
|
||||
$categories[] = JHTML::_('select.option', '0', JText::_('K2_NONE_ONSELECTLISTS'));
|
||||
|
||||
require_once JPATH_ADMINISTRATOR.'/components/com_k2/models/categories.php';
|
||||
$categoriesModel = K2Model::getInstance('Categories', 'K2Model');
|
||||
$tree = $categoriesModel->categoriesTree($category, true, false);
|
||||
$categories = array_merge($categories, $tree);
|
||||
$lists['parent'] = JHTML::_('select.genericlist', $categories, 'parent', 'class="inputbox"', 'value', 'text', $category->parent);
|
||||
|
||||
$extraFieldsModel = K2Model::getInstance('ExtraFields', 'K2Model');
|
||||
$groups = $extraFieldsModel->getGroups();
|
||||
$group[] = JHTML::_('select.option', '0', JText::_('K2_NONE_ONSELECTLISTS'), 'id', 'name');
|
||||
$group = array_merge($group, $groups);
|
||||
$lists['extraFieldsGroup'] = JHTML::_('select.genericlist', $group, 'extraFieldsGroup', 'class="inputbox" size="1" ', 'id', 'name', $category->extraFieldsGroup);
|
||||
|
||||
if (version_compare(JVERSION, '1.6.0', 'ge'))
|
||||
{
|
||||
$languages = JHTML::_('contentlanguage.existing', true, true);
|
||||
$lists['language'] = JHTML::_('select.genericlist', $languages, 'language', '', 'value', 'text', $category->language);
|
||||
}
|
||||
|
||||
JPluginHelper::importPlugin('k2');
|
||||
$dispatcher = JDispatcher::getInstance();
|
||||
$K2Plugins = $dispatcher->trigger('onRenderAdminForm', array(&$category, 'category'));
|
||||
$this->assignRef('K2Plugins', $K2Plugins);
|
||||
|
||||
$params = JComponentHelper::getParams('com_k2');
|
||||
$this->assignRef('params', $params);
|
||||
|
||||
if (version_compare(JVERSION, '1.6.0', 'ge'))
|
||||
{
|
||||
jimport('joomla.form.form');
|
||||
$form = JForm::getInstance('categoryForm', JPATH_COMPONENT_ADMINISTRATOR.DS.'models'.DS.'category.xml');
|
||||
$values = array('params' => json_decode($category->params));
|
||||
$form->bind($values);
|
||||
$inheritFrom = (isset($values['params']->inheritFrom)) ? $values['params']->inheritFrom : 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
$form = new JParameter('', JPATH_COMPONENT_ADMINISTRATOR.DS.'models'.DS.'category.xml');
|
||||
$form->loadINI($category->params);
|
||||
$inheritFrom = $form->get('inheritFrom');
|
||||
}
|
||||
$this->assignRef('form', $form);
|
||||
|
||||
$categories[0] = JHTML::_('select.option', '0', JText::_('K2_NONE_ONSELECTLISTS'));
|
||||
$lists['inheritFrom'] = JHTML::_('select.genericlist', $categories, 'params[inheritFrom]', 'class="inputbox"', 'value', 'text', $inheritFrom);
|
||||
|
||||
$this->assignRef('lists', $lists);
|
||||
(JRequest::getInt('cid')) ? $title = JText::_('K2_EDIT_CATEGORY') : $title = JText::_('K2_ADD_CATEGORY');
|
||||
JToolBarHelper::title($title, 'k2.png');
|
||||
JToolBarHelper::save();
|
||||
JToolBarHelper::custom('saveAndNew', 'save.png', 'save_f2.png', 'K2_SAVE_AND_NEW', false);
|
||||
JToolBarHelper::apply();
|
||||
JToolBarHelper::cancel();
|
||||
|
||||
// ACE ACL integration
|
||||
$definedConstants = get_defined_constants();
|
||||
if (!empty($definedConstants['ACEACL']) && AceaclApi::authorize('permissions', 'com_aceacl'))
|
||||
{
|
||||
$aceAclFlag = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$aceAclFlag = false;
|
||||
}
|
||||
$this->assignRef('aceAclFlag', $aceAclFlag);
|
||||
|
||||
parent::display($tpl);
|
||||
}
|
||||
|
||||
}
|
||||
225
administrator/components/com_k2/views/comments/tmpl/default.php
Normal file
225
administrator/components/com_k2/views/comments/tmpl/default.php
Normal file
@@ -0,0 +1,225 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: default.php 1971 2013-05-01 16:04:17Z lefteris.kavadas $
|
||||
* @package K2
|
||||
* @author JoomlaWorks http://www.joomlaworks.net
|
||||
* @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.
|
||||
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die;
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
Joomla.submitbutton = function(pressbutton) {
|
||||
if (pressbutton == 'remove') {
|
||||
if (document.adminForm.boxchecked.value==0){
|
||||
alert('<?php echo JText::_('K2_PLEASE_MAKE_A_SELECTION_FROM_THE_LIST_TO_DELETE', true); ?>');
|
||||
return false;
|
||||
}
|
||||
if (confirm('<?php echo JText::_('K2_ARE_YOU_SURE_YOU_WANT_TO_DELETE_SELECTED_COMMENTS', true); ?>')){
|
||||
submitform( pressbutton );
|
||||
}
|
||||
} else if (pressbutton == 'deleteUnpublished') {
|
||||
if (confirm('<?php echo JText::_('K2_THIS_WILL_PERMANENTLY_DELETE_ALL_UNPUBLISHED_COMMENTS_ARE_YOU_SURE', true); ?>')){
|
||||
submitform( pressbutton );
|
||||
}
|
||||
} else if (pressbutton == 'publish') {
|
||||
if (document.adminForm.boxchecked.value==0){
|
||||
alert('<?php echo JText::_('K2_PLEASE_MAKE_A_SELECTION_FROM_THE_LIST_TO_PUBLISH', true); ?>');
|
||||
return false;
|
||||
}
|
||||
submitform( pressbutton );
|
||||
} else if (pressbutton == 'unpublish') {
|
||||
if (document.adminForm.boxchecked.value==0){
|
||||
alert('<?php echo JText::_('K2_PLEASE_MAKE_A_SELECTION_FROM_THE_LIST_TO_UNPUBLISH', true); ?>');
|
||||
return false;
|
||||
}
|
||||
submitform( pressbutton );
|
||||
} else {
|
||||
submitform( pressbutton );
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<form action="<?php echo JRoute::_('index.php'); ?>" method="post" name="adminForm" id="adminForm">
|
||||
<?php if($this->mainframe->isSite()): ?>
|
||||
<div id="k2FrontendContainer">
|
||||
<div id="k2Frontend">
|
||||
<table class="k2FrontendToolbar" cellpadding="2" cellspacing="4">
|
||||
<tr>
|
||||
<td id="toolbar-publish" class="button">
|
||||
<a class="toolbar" onclick="Joomla.submitbutton('publish'); return false;" href="#"><?php echo JText::_('K2_PUBLISH'); ?></a>
|
||||
</td>
|
||||
<td id="toolbar-unpublish" class="button">
|
||||
<a class="toolbar" onclick="Joomla.submitbutton('unpublish'); return false;" href="#"><?php echo JText::_('K2_UNPUBLISH'); ?></a>
|
||||
</td>
|
||||
<td id="toolbar-delete" class="button">
|
||||
<a class="toolbar" onclick="Joomla.submitbutton('remove'); return false;" href="#"><?php echo JText::_('K2_DELETE'); ?></a>
|
||||
</td>
|
||||
<td id="toolbar-Link" class="button">
|
||||
<a onclick="Joomla.submitbutton('deleteUnpublished'); return false;" href="#"><?php echo JText::_('K2_DELETE_ALL_UNPUBLISHED'); ?></a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<div id="k2FrontendEditToolbar">
|
||||
<h2 class="header icon-48-k2"><?php echo JText::_('K2_MODERATE_COMMENTS_TO_MY_ITEMS'); ?></h2>
|
||||
</div>
|
||||
<div class="clr"></div>
|
||||
<hr class="sep" />
|
||||
<?php endif; ?>
|
||||
<table class="k2AdminTableFilters table">
|
||||
<tr>
|
||||
<td class="k2AdminTableFiltersSearch">
|
||||
<?php echo JText::_('K2_FILTER'); ?>
|
||||
<input type="text" name="search" value="<?php echo $this->lists['search'] ?>" class="text_area" title="<?php echo JText::_('K2_FILTER_BY_COMMENT'); ?>"/>
|
||||
<button id="k2SubmitButton"><?php echo JText::_('K2_GO'); ?></button>
|
||||
<button id="k2ResetButton"><?php echo JText::_('K2_RESET'); ?></button>
|
||||
</td>
|
||||
<td class="k2AdminTableFiltersSelects hidden-phone">
|
||||
<?php echo $this->lists['categories']; ?>
|
||||
<?php if($this->mainframe->isAdmin()): ?>
|
||||
<?php echo $this->lists['authors']; ?>
|
||||
<?php endif; ?>
|
||||
<?php echo $this->lists['state']; ?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table class="adminlist table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="center hidden-phone">
|
||||
#
|
||||
</th>
|
||||
<th class="center">
|
||||
<input id="jToggler" type="checkbox" name="toggle" value="" />
|
||||
</th>
|
||||
<th>
|
||||
<?php echo JHTML::_('grid.sort', 'K2_COMMENT', 'c.commentText', @$this->lists['order_Dir'], @$this->lists['order'] ); ?>
|
||||
</th>
|
||||
<th class="center">
|
||||
<?php echo JHTML::_('grid.sort', 'K2_PUBLISHED', 'c.published', @$this->lists['order_Dir'], @$this->lists['order'] ); ?>
|
||||
</th>
|
||||
<th class="hidden-phone">
|
||||
<?php echo JHTML::_('grid.sort', 'K2_NAME', 'c.userName', @$this->lists['order_Dir'], @$this->lists['order'] ); ?>
|
||||
</th>
|
||||
<th>
|
||||
<?php echo JHTML::_('grid.sort', 'K2_EMAIL', 'c.commentEmail', @$this->lists['order_Dir'], @$this->lists['order'] ); ?>
|
||||
</th>
|
||||
<th class="hidden-phone">
|
||||
<?php echo JHTML::_('grid.sort', 'K2_URL', 'c.commentURL', @$this->lists['order_Dir'], @$this->lists['order'] ); ?>
|
||||
</th>
|
||||
<th class="center hidden-phone">
|
||||
<?php echo JText::_('K2_LAST_RECORDED_IP'); ?>
|
||||
</th>
|
||||
<th class="center">
|
||||
<?php echo JText::_('K2_FLAG_AS_SPAMMER'); ?>
|
||||
</th>
|
||||
<th class="hidden-phone">
|
||||
<?php echo JHTML::_('grid.sort', 'K2_ITEM', 'i.title', @$this->lists['order_Dir'], @$this->lists['order'] ); ?>
|
||||
</th>
|
||||
<th class="hidden-phone">
|
||||
<?php echo JHTML::_('grid.sort', 'K2_CATEGORY', 'cat.name', @$this->lists['order_Dir'], @$this->lists['order'] ); ?>
|
||||
</th>
|
||||
<th class="hidden-phone">
|
||||
<?php echo JText::_('K2_AUTHOR'); ?>
|
||||
</th>
|
||||
<th class="hidden-phone">
|
||||
<?php echo JHTML::_('grid.sort', 'K2_DATE', 'c.commentDate', @$this->lists['order_Dir'], @$this->lists['order'] ); ?>
|
||||
</th>
|
||||
<th class="hidden-phone">
|
||||
<?php echo JHTML::_('grid.sort', 'K2_ID', 'c.id', @$this->lists['order_Dir'], @$this->lists['order'] ); ?>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="15">
|
||||
<div class="k2CommentsPagination">
|
||||
<?php if(K2_JVERSION == '30'): ?>
|
||||
<div class="k2LimitBox">
|
||||
<?php echo $this->page->getLimitBox(); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php echo $this->page->getListFooter(); ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
<tbody>
|
||||
<?php foreach ($this->rows as $key=>$row): ?>
|
||||
<tr class="row<?php echo ($key%2); ?>">
|
||||
<td class="center hidden-phone">
|
||||
<?php echo $key+1; ?>
|
||||
</td>
|
||||
<td class="center">
|
||||
<?php $row->checked_out = 0; echo @JHTML::_('grid.checkedout', $row, $key ); ?>
|
||||
</td>
|
||||
<td id="k2Comment<?php echo $row->id; ?>">
|
||||
<div class="commentText"><?php echo $row->commentText; ?></div>
|
||||
<div class="commentToolbar"><span class="k2CommentsLog"></span> <a href="#" rel="<?php echo $row->id; ?>" class="editComment"><?php echo JText::_('K2_EDIT'); ?></a> <a href="#" rel="<?php echo $row->id; ?>" class="saveComment"><?php echo JText::_('K2_SAVE'); ?></a> <a href="#" rel="<?php echo $row->id; ?>" class="closeComment"><?php echo JText::_('K2_CANCEL'); ?></a>
|
||||
<div class="clr"></div>
|
||||
</div>
|
||||
<input type="hidden" name="currentValue[]" value="<?php echo $row->commentText; ?>" />
|
||||
</td>
|
||||
<td class="k2Center center">
|
||||
<?php echo $row->status; ?>
|
||||
</td>
|
||||
<td class="hidden-phone">
|
||||
<?php if($this->mainframe->isAdmin() && $row->userID): ?>
|
||||
<a href="<?php echo $this->userEditLink.$row->userID;?>"><?php echo $row->userName; ?></a>
|
||||
<?php else :?>
|
||||
<?php echo $row->userName; ?>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<td class="k2ForceWrap">
|
||||
<?php echo $row->commentEmail; ?>
|
||||
</td>
|
||||
<td class="k2ForceWrap hidden-phone">
|
||||
<a target="_blank" href="<?php echo JFilterOutput::cleanText($row->commentURL); ?>"><?php echo str_replace(array('http://www.','https://www.','http://','https://'),array('','','',''),$row->commentURL); ?></a>
|
||||
</td>
|
||||
<td class="k2Center center hidden-phone">
|
||||
<?php if($row->commenterLastVisitIP): ?>
|
||||
<a target="_blank" href="http://www.ipchecking.com/?ip=<?php echo $row->commenterLastVisitIP; ?>&check=Lookup">
|
||||
<?php echo $row->commenterLastVisitIP; ?>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<td class="k2Center center">
|
||||
<?php if($row->reportUserLink): ?>
|
||||
<a class="k2ReportUserButton k2IsIcon" href="<?php echo $row->reportUserLink; ?>">×</a>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<td class="hidden-phone">
|
||||
<a class="modal" rel="{handler: 'iframe', size: {x: 1000, y: 600}}" href="<?php echo JURI::root().K2HelperRoute::getItemRoute($row->itemID.':'.urlencode($row->itemAlias),$row->catid.':'.urlencode($row->catAlias)); ?>"><?php echo $row->title; ?></a>
|
||||
</td>
|
||||
<td class="hidden-phone">
|
||||
<?php echo $row->catName; ?>
|
||||
</td>
|
||||
<td class="hidden-phone">
|
||||
<?php $user = JFactory::getUser($row->created_by); echo $user->name; ?>
|
||||
</td>
|
||||
<td class="k2Date hidden-phone">
|
||||
<?php echo JHTML::_('date', $row->commentDate , $this->dateFormat); ?>
|
||||
</td>
|
||||
<td class="hidden-phone">
|
||||
<?php echo $row->id; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<input type="hidden" name="isSite" value="<?php echo (int)$this->mainframe->isSite(); ?>" />
|
||||
<input type="hidden" name="option" value="com_k2" />
|
||||
<input type="hidden" name="view" value="<?php echo JRequest::getCmd('view'); ?>" />
|
||||
<input type="hidden" id="task" name="task" value="" />
|
||||
<input type="hidden" name="filter_order" value="<?php echo $this->lists['order']; ?>" />
|
||||
<input type="hidden" name="filter_order_Dir" value="<?php echo $this->lists['order_Dir']; ?>" />
|
||||
<input type="hidden" name="boxchecked" value="0" />
|
||||
<input type="hidden" id="commentID" name="commentID" value="" />
|
||||
<input type="hidden" id="commentText" name="commentText" value="" />
|
||||
<?php echo JHTML::_( 'form.token' ); ?>
|
||||
<?php if($this->mainframe->isSite()): ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</form>
|
||||
207
administrator/components/com_k2/views/comments/view.html.php
Normal file
207
administrator/components/com_k2/views/comments/view.html.php
Normal file
@@ -0,0 +1,207 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: view.html.php 1988 2013-06-27 11:58:48Z lefteris.kavadas $
|
||||
* @package K2
|
||||
* @author JoomlaWorks http://www.joomlaworks.net
|
||||
* @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.
|
||||
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die ;
|
||||
|
||||
jimport('joomla.application.component.view');
|
||||
|
||||
class K2ViewComments extends K2View
|
||||
{
|
||||
|
||||
function display($tpl = null)
|
||||
{
|
||||
|
||||
$mainframe = JFactory::getApplication();
|
||||
$user = JFactory::getUser();
|
||||
$option = JRequest::getCmd('option');
|
||||
$view = JRequest::getCmd('view');
|
||||
$limit = $mainframe->getUserStateFromRequest('global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int');
|
||||
$limitstart = $mainframe->getUserStateFromRequest($option.$view.'.limitstart', 'limitstart', 0, 'int');
|
||||
$filter_order = $mainframe->getUserStateFromRequest($option.$view.'filter_order', 'filter_order', 'c.id', 'cmd');
|
||||
$filter_order_Dir = $mainframe->getUserStateFromRequest($option.$view.'filter_order_Dir', 'filter_order_Dir', 'DESC', 'word');
|
||||
$filter_state = $mainframe->getUserStateFromRequest($option.$view.'filter_state', 'filter_state', -1, 'int');
|
||||
$filter_category = $mainframe->getUserStateFromRequest($option.$view.'filter_category', 'filter_category', 0, 'int');
|
||||
$filter_author = $mainframe->getUserStateFromRequest($option.$view.'filter_author', 'filter_author', 0, 'int');
|
||||
$search = $mainframe->getUserStateFromRequest($option.$view.'search', 'search', '', 'string');
|
||||
$search = JString::strtolower($search);
|
||||
if ($mainframe->isSite())
|
||||
{
|
||||
$filter_author = $user->id;
|
||||
JRequest::setVar('filter_author', $user->id);
|
||||
}
|
||||
$this->loadHelper('html');
|
||||
K2Model::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR.DS.'models');
|
||||
$model = K2Model::getInstance('Comments', 'K2Model');
|
||||
$params = JComponentHelper::getParams('com_k2');
|
||||
$total = $model->getTotal();
|
||||
if ($limitstart > $total - $limit)
|
||||
{
|
||||
$limitstart = max(0, (int)(ceil($total / $limit) - 1) * $limit);
|
||||
JRequest::setVar('limitstart', $limitstart);
|
||||
}
|
||||
$comments = $model->getData();
|
||||
|
||||
$reportLink = $mainframe->isAdmin() ? 'index.php?option=com_k2&view=user&task=report&id=' : 'index.php?option=com_k2&view=comments&task=reportSpammer&id=';
|
||||
foreach ($comments as $key => $comment)
|
||||
{
|
||||
$comment->reportUserLink = false;
|
||||
$comment->commenterLastVisitIP = NULL;
|
||||
if ($comment->userID)
|
||||
{
|
||||
|
||||
$db = JFactory::getDBO();
|
||||
$db->setQuery("SELECT ip FROM #__k2_users WHERE userID = ".$comment->userID);
|
||||
$comment->commenterLastVisitIP = $db->loadResult();
|
||||
|
||||
$commenter = JFactory::getUser($comment->userID);
|
||||
if ($commenter->name)
|
||||
{
|
||||
$comment->userName = $commenter->name;
|
||||
}
|
||||
if ($mainframe->isSite())
|
||||
{
|
||||
if (K2_JVERSION != '15')
|
||||
{
|
||||
if ($user->authorise('core.admin', 'com_k2'))
|
||||
{
|
||||
$comment->reportUserLink = JRoute::_($reportLink.$comment->userID);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($user->gid > 24)
|
||||
{
|
||||
$comment->reportUserLink = JRoute::_($reportLink.$comment->userID);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$comment->reportUserLink = JRoute::_($reportLink.$comment->userID);
|
||||
}
|
||||
}
|
||||
|
||||
if ($mainframe->isSite())
|
||||
{
|
||||
$comment->status = K2HelperHTML::stateToggler($comment, $key);
|
||||
}
|
||||
else
|
||||
{
|
||||
$comment->status = K2_JVERSION == '15' ? JHTML::_('grid.published', $comment, $key) : JHtml::_('jgrid.published', $comment->published, $key);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$this->assignRef('rows', $comments);
|
||||
|
||||
jimport('joomla.html.pagination');
|
||||
$pageNav = new JPagination($total, $limitstart, $limit);
|
||||
$this->assignRef('page', $pageNav);
|
||||
|
||||
$lists = array();
|
||||
$lists['search'] = $search;
|
||||
$lists['order_Dir'] = $filter_order_Dir;
|
||||
$lists['order'] = $filter_order;
|
||||
|
||||
$filter_state_options[] = JHTML::_('select.option', -1, JText::_('K2_SELECT_STATE'));
|
||||
$filter_state_options[] = JHTML::_('select.option', 1, JText::_('K2_PUBLISHED'));
|
||||
$filter_state_options[] = JHTML::_('select.option', 0, JText::_('K2_UNPUBLISHED'));
|
||||
$lists['state'] = JHTML::_('select.genericlist', $filter_state_options, 'filter_state', '', 'value', 'text', $filter_state);
|
||||
|
||||
require_once JPATH_ADMINISTRATOR.'/components/com_k2/models/categories.php';
|
||||
$categoriesModel = K2Model::getInstance('Categories', 'K2Model');
|
||||
$categories_option[] = JHTML::_('select.option', 0, JText::_('K2_SELECT_CATEGORY'));
|
||||
$categories = $categoriesModel->categoriesTree(null, true, false);
|
||||
$categories_options = @array_merge($categories_option, $categories);
|
||||
$lists['categories'] = JHTML::_('select.genericlist', $categories_options, 'filter_category', '', 'value', 'text', $filter_category);
|
||||
|
||||
require_once JPATH_ADMINISTRATOR.'/components/com_k2/models/items.php';
|
||||
$itemsModel = K2Model::getInstance('Items', 'K2Model');
|
||||
$authors = $itemsModel->getItemsAuthors();
|
||||
$options = array();
|
||||
$options[] = JHTML::_('select.option', 0, '- '.JText::_('K2_NO_USER').' -');
|
||||
foreach ($authors as $author)
|
||||
{
|
||||
$name = $author->name;
|
||||
if ($author->block)
|
||||
{
|
||||
$name .= ' ['.JText::_('K2_USER_DISABLED').']';
|
||||
}
|
||||
$options[] = JHTML::_('select.option', $author->id, $name);
|
||||
}
|
||||
$lists['authors'] = JHTML::_('select.genericlist', $options, 'filter_author', '', 'value', 'text', $filter_author);
|
||||
$this->assignRef('lists', $lists);
|
||||
$this->assignRef('mainframe', $mainframe);
|
||||
|
||||
if (K2_JVERSION != '15')
|
||||
{
|
||||
$dateFormat = JText::_('K2_J16_DATE_FORMAT');
|
||||
}
|
||||
else
|
||||
{
|
||||
$dateFormat = JText::_('K2_DATE_FORMAT');
|
||||
}
|
||||
$this->assignRef('dateFormat', $dateFormat);
|
||||
|
||||
if ($mainframe->isAdmin())
|
||||
{
|
||||
JToolBarHelper::title(JText::_('K2_COMMENTS'), 'k2.png');
|
||||
JToolBarHelper::publishList();
|
||||
JToolBarHelper::unpublishList();
|
||||
JToolBarHelper::deleteList('', 'remove', 'K2_DELETE');
|
||||
JToolBarHelper::custom('deleteUnpublished', 'delete', 'delete', 'K2_DELETE_ALL_UNPUBLISHED', false);
|
||||
$toolbar = JToolBar::getInstance('toolbar');
|
||||
|
||||
if (K2_JVERSION != '15')
|
||||
{
|
||||
JToolBarHelper::preferences('com_k2', 550, 875, 'K2_PARAMETERS');
|
||||
}
|
||||
else
|
||||
{
|
||||
$toolbar->appendButton('Popup', 'config', 'Parameters', 'index.php?option=com_k2&view=settings');
|
||||
}
|
||||
K2HelperHTML::subMenu();
|
||||
|
||||
if (K2_JVERSION != '15')
|
||||
{
|
||||
$userEditLink = JURI::base().'index.php?option=com_k2&view=user&cid=';
|
||||
}
|
||||
else
|
||||
{
|
||||
$userEditLink = JURI::base().'index.php?option=com_k2&view=user&cid=';
|
||||
}
|
||||
$this->assignRef('userEditLink', $userEditLink);
|
||||
|
||||
}
|
||||
|
||||
$document = JFactory::getDocument();
|
||||
$document->addScriptDeclaration('var K2Language = ["'.JText::_('K2_YOU_CANNOT_EDIT_TWO_COMMENTS_AT_THE_SAME_TIME', true).'", "'.JText::_('K2_THIS_WILL_PERMANENTLY_DELETE_ALL_UNPUBLISHED_COMMENTS_ARE_YOU_SURE', true).'", "'.JText::_('K2_REPORT_USER_WARNING', true).'"];');
|
||||
|
||||
if ($mainframe->isSite())
|
||||
{
|
||||
// CSS
|
||||
$document->addStyleSheet(JURI::root(true).'/media/k2/assets/css/k2.frontend.css?v=2.6.7');
|
||||
$document->addStyleSheet(JURI::root(true).'/templates/system/css/general.css');
|
||||
$document->addStyleSheet(JURI::root(true).'/templates/system/css/system.css');
|
||||
if (K2_JVERSION != '15')
|
||||
{
|
||||
$document->addStyleSheet(JURI::root(true).'/administrator/templates/bluestork/css/template.css');
|
||||
$document->addStyleSheet(JURI::root(true).'/media/system/css/system.css');
|
||||
}
|
||||
else
|
||||
{
|
||||
$document->addStyleSheet(JURI::root(true).'/administrator/templates/khepri/css/general.css');
|
||||
}
|
||||
}
|
||||
|
||||
parent::display($tpl);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: default.php 1991 2013-07-04 14:59:52Z lefteris.kavadas $
|
||||
* @package K2
|
||||
* @author JoomlaWorks http://www.joomlaworks.net
|
||||
* @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.
|
||||
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
$document = JFactory::getDocument();
|
||||
$document->addScriptDeclaration("
|
||||
Joomla.submitbutton = function(pressbutton) {
|
||||
if (pressbutton == 'cancel') {
|
||||
submitform( pressbutton );
|
||||
return;
|
||||
}
|
||||
if (\$K2.trim(\$K2('#group').val()) == '') {
|
||||
alert( '".JText::_('K2_PLEASE_SELECT_A_GROUP_OR_CREATE_A_NEW_ONE', true)."' );
|
||||
}
|
||||
else if (\$K2.trim(\$K2('#name').val()) == '') {
|
||||
alert( '".JText::_('K2_NAME_CANNOT_BE_EMPTY', true)."' );
|
||||
}
|
||||
else if (\$K2('#type').val() == '0') {
|
||||
alert( '".JText::_('K2_PLEASE_SELECT_THE_TYPE_OF_THE_EXTRA_FIELD', true)."' );
|
||||
}
|
||||
else {
|
||||
submitform( pressbutton );
|
||||
}
|
||||
}
|
||||
");
|
||||
|
||||
?>
|
||||
|
||||
<form action="index.php" method="post" enctype="multipart/form-data" name="adminForm" id="adminForm">
|
||||
<table class="admintable table">
|
||||
<tr>
|
||||
<td class="key"><?php echo JText::_('K2_NAME'); ?></td>
|
||||
<td><input class="text_area k2TitleBox" type="text" name="name" id="name" value="<?php echo $this->row->name; ?>" size="50" maxlength="250" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="key"><?php echo JText::_('K2_ALIAS'); ?></td>
|
||||
<td><input id="alias" type="text" name="alias" value="<?php echo $this->row->alias; ?>" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="key"><?php echo JText::_('K2_PUBLISHED'); ?></td>
|
||||
<td><?php echo $this->lists['published']; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="key"><?php echo JText::_('K2_GROUP'); ?></td>
|
||||
<td>
|
||||
<?php echo $this->lists['group']; ?>
|
||||
<div id="groupContainer">
|
||||
<span><?php echo JText::_('K2_NEW_GROUP_NAME'); ?></span>
|
||||
<input id="group" type="text" name="group" value="<?php echo $this->row->group; ?>" />
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="key"><?php echo JText::_('K2_TYPE'); ?></td>
|
||||
<td><?php echo $this->lists['type']; ?></td>
|
||||
</tr>
|
||||
<tr id="k2ExtraFieldsRequiredFlag" <?php if($this->row->type == 'header') { echo 'style="display: none;"'; } ?>>
|
||||
<td class="key"><?php echo JText::_('K2_REQUIRED'); ?></td>
|
||||
<td>
|
||||
<input id="required-yes" type="radio" name="required" value="1" <?php if($this->row->required) { echo 'checked="checked"';} ?>/><label for="required-yes"><?php echo JText::_('K2_YES'); ?></label>
|
||||
<input id="required-no" type="radio" name="required" value="0"<?php if(!$this->row->required) { echo 'checked="checked"';} ?>/><label for="required-no"><?php echo JText::_('K2_NO'); ?></label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="k2ExtraFieldsShowNullFlag" <?php if($this->row->type != 'select' && $this->row->type != 'multipleSelect') { echo 'style="display: none;"'; } ?>>
|
||||
<td class="key"><?php echo JText::_('K2_SHOW_NULL'); ?></td>
|
||||
<td>
|
||||
<input id="showNull-yes" type="radio" name="showNull" value="1" <?php if($this->row->showNull) { echo 'checked="checked"';} ?>/><label for="showNull-yes"><?php echo JText::_('K2_YES'); ?></label>
|
||||
<input id="showNull-no" type="radio" name="showNull" value="0"<?php if(!$this->row->showNull) { echo 'checked="checked"';} ?>/><label for="showNull-no"><?php echo JText::_('K2_NO'); ?></label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="k2ExtraFieldsDisplayInFrontEndFlag" <?php if($this->row->type != 'header') { echo 'style="display: none;"'; } ?>>
|
||||
<td class="key"><?php echo JText::_('K2_DISPLAY_IN_THE_FRONTEND'); ?></td>
|
||||
<td>
|
||||
<input id="displayInFrontEnd-yes" type="radio" name="displayInFrontEnd" value="1" <?php if($this->row->displayInFrontEnd) { echo 'checked="checked"';} ?>/><label for="displayInFrontEnd-yes"><?php echo JText::_('K2_YES'); ?></label>
|
||||
<input id="displayInFrontEnd-no" type="radio" name="displayInFrontEnd" value="0"<?php if(!$this->row->displayInFrontEnd) { echo 'checked="checked"';} ?>/><label for="displayInFrontEnd-no"><?php echo JText::_('K2_NO'); ?></label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="key"><?php echo JText::_('K2_DEFAULT_VALUES'); ?></td>
|
||||
<td><div id="exFieldsTypesDiv"></div></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<input type="hidden" name="id" value="<?php echo $this->row->id; ?>" />
|
||||
<input type="hidden" name="isNew" id="isNew" value="<?php echo ($this->row->group)?'0':'1'; ?>" />
|
||||
<input type="hidden" name="option" value="com_k2" />
|
||||
<input type="hidden" name="view" value="<?php echo JRequest::getVar('view'); ?>" />
|
||||
<input type="hidden" name="task" value="<?php echo JRequest::getVar('task'); ?>" />
|
||||
<input type="hidden" id="value" name="value" value="<?php echo htmlentities($this->row->value); ?>" />
|
||||
<?php echo JHTML::_( 'form.token' ); ?>
|
||||
</form>
|
||||
142
administrator/components/com_k2/views/extrafield/view.html.php
Normal file
142
administrator/components/com_k2/views/extrafield/view.html.php
Normal file
@@ -0,0 +1,142 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: view.html.php 1965 2013-04-29 16:01:44Z lefteris.kavadas $
|
||||
* @package K2
|
||||
* @author JoomlaWorks http://www.joomlaworks.net
|
||||
* @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.
|
||||
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die ;
|
||||
|
||||
jimport('joomla.application.component.view');
|
||||
|
||||
class K2ViewExtraField extends K2View
|
||||
{
|
||||
|
||||
function display($tpl = null)
|
||||
{
|
||||
JRequest::setVar('hidemainmenu', 1);
|
||||
JHTML::_('behavior.keepalive');
|
||||
$model = $this->getModel();
|
||||
$extraField = $model->getData();
|
||||
if (!$extraField->id)
|
||||
{
|
||||
$extraField->published = 1;
|
||||
$extraField->alias = '';
|
||||
$extraField->required = 1;
|
||||
$extraField->showNull = 0;
|
||||
$extraField->displayInFrontEnd = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
require_once (JPATH_COMPONENT.DS.'lib'.DS.'JSON.php');
|
||||
$json = new Services_JSON;
|
||||
$values = $json->decode($extraField->value);
|
||||
if (isset($values[0]->alias) && !empty($values[0]->alias))
|
||||
{
|
||||
$extraField->alias = $values[0]->alias;
|
||||
}
|
||||
else
|
||||
{
|
||||
$extraField->alias = $extraField->name;
|
||||
}
|
||||
$searches = array('À', 'Á', 'Â', 'Ã', 'Ä', 'Å', 'à', 'á', 'â', 'ã', 'ä', 'å', 'Ā', 'ā', 'Ă', 'ă', 'Ą', 'ą', 'Ç', 'ç', 'Ć', 'ć', 'Ĉ', 'ĉ', 'Ċ', 'ċ', 'Č', 'č', 'Ð', 'ð', 'Ď', 'ď', 'Đ', 'đ', 'È', 'É', 'Ê', 'Ë', 'è', 'é', 'ê', 'ë', 'Ē', 'ē', 'Ĕ', 'ĕ', 'Ė', 'ė', 'Ę', 'ę', 'Ě', 'ě', 'Ĝ', 'ĝ', 'Ğ', 'ğ', 'Ġ', 'ġ', 'Ģ', 'ģ', 'Ĥ', 'ĥ', 'Ħ', 'ħ', 'Ì', 'Í', 'Î', 'Ï', 'ì', 'í', 'î', 'ï', 'Ĩ', 'ĩ', 'Ī', 'ī', 'Ĭ', 'ĭ', 'Į', 'į', 'İ', 'ı', 'Ĵ', 'ĵ', 'Ķ', 'ķ', 'ĸ', 'Ĺ', 'ĺ', 'Ļ', 'ļ', 'Ľ', 'ľ', 'Ŀ', 'ŀ', 'Ł', 'ł', 'Ñ', 'ñ', 'Ń', 'ń', 'Ņ', 'ņ', 'Ň', 'ň', 'ʼn', 'Ŋ', 'ŋ', 'Ò', 'Ó', 'Ô', 'Õ', 'Ö', 'Ø', 'ò', 'ó', 'ô', 'õ', 'ö', 'ø', 'Ō', 'ō', 'Ŏ', 'ŏ', 'Ő', 'ő', 'Ŕ', 'ŕ', 'Ŗ', 'ŗ', 'Ř', 'ř', 'Ś', 'ś', 'Ŝ', 'ŝ', 'Ş', 'ş', 'Š', 'š', 'ſ', 'Ţ', 'ţ', 'Ť', 'ť', 'Ŧ', 'ŧ', 'Ù', 'Ú', 'Û', 'Ü', 'ù', 'ú', 'û', 'ü', 'Ũ', 'ũ', 'Ū', 'ū', 'Ŭ', 'ŭ', 'Ů', 'ů', 'Ű', 'ű', 'Ų', 'ų', 'Ŵ', 'ŵ', 'Ý', 'ý', 'ÿ', 'Ŷ', 'ŷ', 'Ÿ', 'Ź', 'ź', 'Ż', 'ż', 'Ž', 'ž', 'α', 'β', 'γ', 'δ', 'ε', 'ζ', 'η', 'θ', 'ι', 'κ', 'λ', 'μ', 'ν', 'ξ', 'ο', 'π', 'ρ', 'σ', 'τ', 'υ', 'φ', 'χ', 'ψ', 'ω', 'Α', 'Β', 'Γ', 'Δ', 'Ε', 'Ζ', 'Η', 'Θ', 'Ι', 'Κ', 'Λ', 'Μ', 'Ξ', 'Ο', 'Π', 'Ρ', 'Σ', 'Τ', 'Υ', 'Φ', 'Χ', 'Ψ', 'Ω', 'ά', 'έ', 'ή', 'ί', 'ό', 'ύ', 'ώ', 'Ά', 'Έ', 'Ή', 'Ί', 'Ό', 'Ύ', 'Ώ', 'ϊ', 'ΐ', 'ϋ', 'ς', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', 'А', 'Ӑ', 'Ӓ', 'Ә', 'Ӛ', 'Ӕ', 'Б', 'В', 'Г', 'Ґ', 'Ѓ', 'Ғ', 'Ӷ', 'y', 'Д', 'Е', 'Ѐ', 'Ё', 'Ӗ', 'Ҽ', 'Ҿ', 'Є', 'Ж', 'Ӂ', 'Җ', 'Ӝ', 'З', 'Ҙ', 'Ӟ', 'Ӡ', 'Ѕ', 'И', 'Ѝ', 'Ӥ', 'Ӣ', 'І', 'Ї', 'Ӏ', 'Й', 'Ҋ', 'Ј', 'К', 'Қ', 'Ҟ', 'Ҡ', 'Ӄ', 'Ҝ', 'Л', 'Ӆ', 'Љ', 'М', 'Ӎ', 'Н', 'Ӊ', 'Ң', 'Ӈ', 'Ҥ', 'Њ', 'О', 'Ӧ', 'Ө', 'Ӫ', 'Ҩ', 'П', 'Ҧ', 'Р', 'Ҏ', 'С', 'Ҫ', 'Т', 'Ҭ', 'Ћ', 'Ќ', 'У', 'Ў', 'Ӳ', 'Ӱ', 'Ӯ', 'Ү', 'Ұ', 'Ф', 'Х', 'Ҳ', 'Һ', 'Ц', 'Ҵ', 'Ч', 'Ӵ', 'Ҷ', 'Ӌ', 'Ҹ', 'Џ', 'Ш', 'Щ', 'Ъ', 'Ы', 'Ӹ', 'Ь', 'Ҍ', 'Э', 'Ӭ', 'Ю', 'Я', 'а', 'ӑ', 'ӓ', 'ә', 'ӛ', 'ӕ', 'б', 'в', 'г', 'ґ', 'ѓ', 'ғ', 'ӷ', 'y', 'д', 'е', 'ѐ', 'ё', 'ӗ', 'ҽ', 'ҿ', 'є', 'ж', 'ӂ', 'җ', 'ӝ', 'з', 'ҙ', 'ӟ', 'ӡ', 'ѕ', 'и', 'ѝ', 'ӥ', 'ӣ', 'і', 'ї', 'Ӏ', 'й', 'ҋ', 'ј', 'к', 'қ', 'ҟ', 'ҡ', 'ӄ', 'ҝ', 'л', 'ӆ', 'љ', 'м', 'ӎ', 'н', 'ӊ', 'ң', 'ӈ', 'ҥ', 'њ', 'о', 'ӧ', 'ө', 'ӫ', 'ҩ', 'п', 'ҧ', 'р', 'ҏ', 'с', 'ҫ', 'т', 'ҭ', 'ћ', 'ќ', 'у', 'ў', 'ӳ', 'ӱ', 'ӯ', 'ү', 'ұ', 'ф', 'х', 'ҳ', 'һ', 'ц', 'ҵ', 'ч', 'ӵ', 'ҷ', 'ӌ', 'ҹ', 'џ', 'ш', 'щ', 'ъ', 'ы', 'ӹ', 'ь', 'ҍ', 'э', 'ӭ', 'ю', 'я');
|
||||
$replacements = array('A', 'A', 'A', 'A', 'A', 'A', 'a', 'a', 'a', 'a', 'a', 'a', 'A', 'a', 'A', 'a', 'A', 'a', 'C', 'c', 'C', 'c', 'C', 'c', 'C', 'c', 'C', 'c', 'D', 'd', 'D', 'd', 'D', 'd', 'E', 'E', 'E', 'E', 'e', 'e', 'e', 'e', 'E', 'e', 'E', 'e', 'E', 'e', 'E', 'e', 'E', 'e', 'G', 'g', 'G', 'g', 'G', 'g', 'G', 'g', 'H', 'h', 'H', 'h', 'I', 'I', 'I', 'I', 'i', 'i', 'i', 'i', 'I', 'i', 'I', 'i', 'I', 'i', 'I', 'i', 'I', 'i', 'J', 'j', 'K', 'k', 'k', 'L', 'l', 'L', 'l', 'L', 'l', 'L', 'l', 'L', 'l', 'N', 'n', 'N', 'n', 'N', 'n', 'N', 'n', 'n', 'N', 'n', 'O', 'O', 'O', 'O', 'O', 'O', 'o', 'o', 'o', 'o', 'o', 'o', 'O', 'o', 'O', 'o', 'O', 'o', 'R', 'r', 'R', 'r', 'R', 'r', 'S', 's', 'S', 's', 'S', 's', 'S', 's', 's', 'T', 't', 'T', 't', 'T', 't', 'U', 'U', 'U', 'U', 'u', 'u', 'u', 'u', 'U', 'u', 'U', 'u', 'U', 'u', 'U', 'u', 'U', 'u', 'U', 'u', 'W', 'w', 'Y', 'y', 'y', 'Y', 'y', 'Y', 'Z', 'z', 'Z', 'z', 'Z', 'z', 'a', 'b', 'g', 'd', 'e', 'z', 'h', 'th', 'i', 'k', 'l', 'm', 'n', 'x', 'o', 'p', 'r', 's', 't', 'y', 'f', 'ch', 'ps', 'w', 'A', 'B', 'G', 'D', 'E', 'Z', 'H', 'Th', 'I', 'K', 'L', 'M', 'X', 'O', 'P', 'R', 'S', 'T', 'Y', 'F', 'Ch', 'Ps', 'W', 'a', 'e', 'h', 'i', 'o', 'y', 'w', 'A', 'E', 'H', 'I', 'O', 'Y', 'W', 'i', 'i', 'y', 's', 'One', 'Two', 'Three', 'Four', 'Five', 'Six', 'Seven', 'Eight', 'Nine', 'Zero', 'A', 'A', 'A', 'E', 'E', 'E', 'B', 'V', 'G', 'G', 'G', 'G', 'G', 'Y', 'D', 'E', 'E', 'YO', 'E', 'E', 'E', 'YE', 'ZH', 'DZH', 'ZH', 'DZH', 'Z', 'Z', 'DZ', 'DZ', 'DZ', 'I', 'I', 'I', 'I', 'I', 'JI', 'I', 'Y', 'Y', 'J', 'K', 'Q', 'Q', 'K', 'Q', 'K', 'L', 'L', 'L', 'M', 'M', 'N', 'N', 'N', 'N', 'N', 'N', 'O', 'O', 'O', 'O', 'O', 'P', 'PF', 'P', 'P', 'S', 'S', 'T', 'TH', 'T', 'K', 'U', 'U', 'U', 'U', 'U', 'U', 'U', 'F', 'H', 'H', 'H', 'TS', 'TS', 'CH', 'CH', 'CH', 'CH', 'CH', 'DZ', 'SH', 'SHT', 'A', 'Y', 'Y', 'Y', 'Y', 'E', 'E', 'YU', 'YA', 'a', 'a', 'a', 'e', 'e', 'e', 'b', 'v', 'g', 'g', 'g', 'g', 'g', 'y', 'd', 'e', 'e', 'yo', 'e', 'e', 'e', 'ye', 'zh', 'dzh', 'zh', 'dzh', 'z', 'z', 'dz', 'dz', 'dz', 'i', 'i', 'i', 'i', 'i', 'ji', 'i', 'y', 'y', 'j', 'k', 'q', 'q', 'k', 'q', 'k', 'l', 'l', 'l', 'm', 'm', 'n', 'n', 'n', 'n', 'n', 'n', 'o', 'o', 'o', 'o', 'o', 'p', 'pf', 'p', 'p', 's', 's', 't', 'th', 't', 'k', 'u', 'u', 'u', 'u', 'u', 'u', 'u', 'f', 'h', 'h', 'h', 'ts', 'ts', 'ch', 'ch', 'ch', 'ch', 'ch', 'dz', 'sh', 'sht', 'a', 'y', 'y', 'y', 'y', 'e', 'e', 'yu', 'ya');
|
||||
$extraField->alias = str_replace($searches, $replacements, $extraField->alias);
|
||||
$filter = JFilterInput::getInstance();
|
||||
$extraField->alias = $filter->clean($extraField->alias, 'WORD');
|
||||
|
||||
if (isset($values[0]->required))
|
||||
{
|
||||
$extraField->required = $values[0]->required;
|
||||
}
|
||||
else
|
||||
{
|
||||
$extraField->required = 0;
|
||||
}
|
||||
if (isset($values[0]->showNull))
|
||||
{
|
||||
$extraField->showNull = $values[0]->showNull;
|
||||
}
|
||||
else
|
||||
{
|
||||
$extraField->showNull = 0;
|
||||
}
|
||||
if (isset($values[0]->displayInFrontEnd))
|
||||
{
|
||||
$extraField->displayInFrontEnd = $values[0]->displayInFrontEnd;
|
||||
}
|
||||
else
|
||||
{
|
||||
$extraField->displayInFrontEnd = 0;
|
||||
}
|
||||
}
|
||||
$extraField->name = htmlspecialchars($extraField->name, ENT_QUOTES, 'UTF-8');
|
||||
$this->assignRef('row', $extraField);
|
||||
|
||||
$lists = array();
|
||||
$lists['published'] = JHTML::_('select.booleanlist', 'published', 'class="inputbox"', $extraField->published);
|
||||
|
||||
$groups[] = JHTML::_('select.option', 0, JText::_('K2_CREATE_NEW_GROUP'));
|
||||
|
||||
$extraFieldModel = K2Model::getInstance('ExtraFields', 'K2Model');
|
||||
$uniqueGroups = $extraFieldModel->getGroups(true);
|
||||
foreach ($uniqueGroups as $group)
|
||||
{
|
||||
$groups[] = JHTML::_('select.option', $group->id, $group->name);
|
||||
}
|
||||
|
||||
$lists['group'] = JHTML::_('select.genericlist', $groups, 'groups', '', 'value', 'text', $extraField->group);
|
||||
|
||||
$typeOptions[] = JHTML::_('select.option', 0, JText::_('K2_SELECT_TYPE'));
|
||||
$typeOptions[] = JHTML::_('select.option', 'textfield', JText::_('K2_TEXT_FIELD'));
|
||||
$typeOptions[] = JHTML::_('select.option', 'textarea', JText::_('K2_TEXTAREA'));
|
||||
$typeOptions[] = JHTML::_('select.option', 'select', JText::_('K2_DROPDOWN_SELECTION'));
|
||||
$typeOptions[] = JHTML::_('select.option', 'multipleSelect', JText::_('K2_MULTISELECT_LIST'));
|
||||
$typeOptions[] = JHTML::_('select.option', 'radio', JText::_('K2_RADIO_BUTTONS'));
|
||||
$typeOptions[] = JHTML::_('select.option', 'link', JText::_('K2_LINK'));
|
||||
$typeOptions[] = JHTML::_('select.option', 'csv', JText::_('K2_CSV_DATA'));
|
||||
$typeOptions[] = JHTML::_('select.option', 'labels', JText::_('K2_SEARCHABLE_LABELS'));
|
||||
$typeOptions[] = JHTML::_('select.option', 'date', JText::_('K2_DATE'));
|
||||
$typeOptions[] = JHTML::_('select.option', 'image', JText::_('K2_IMAGE'));
|
||||
$typeOptions[] = JHTML::_('select.option', 'header', JText::_('K2_HEADER'));
|
||||
$lists['type'] = JHTML::_('select.genericlist', $typeOptions, 'type', '', 'value', 'text', $extraField->type);
|
||||
|
||||
$this->assignRef('lists', $lists);
|
||||
(JRequest::getInt('cid')) ? $title = JText::_('K2_EDIT_EXTRA_FIELD') : $title = JText::_('K2_ADD_EXTRA_FIELD');
|
||||
JToolBarHelper::title($title, 'k2.png');
|
||||
JToolBarHelper::save();
|
||||
JToolBarHelper::apply();
|
||||
JToolBarHelper::cancel();
|
||||
JHTML::_('behavior.calendar');
|
||||
|
||||
$document = JFactory::getDocument();
|
||||
$document->addScriptDeclaration('
|
||||
var K2BasePath = "'.JURI::base(true).'/";
|
||||
var K2Language = [
|
||||
"'.JText::_('K2_REMOVE', true).'",
|
||||
"'.JText::_('K2_OPTIONAL', true).'",
|
||||
"'.JText::_('K2_COMMA_SEPARATED_VALUES', true).'",
|
||||
"'.JText::_('K2_USE_EDITOR', true).'",
|
||||
"'.JText::_('K2_ALL_SETTINGS_ABOVE_ARE_OPTIONAL', true).'",
|
||||
"'.JText::_('K2_ADD_AN_OPTION', true).'",
|
||||
"'.JText::_('K2_LINK_TEXT', true).'",
|
||||
"'.JText::_('K2_URL', true).'",
|
||||
"'.JText::_('K2_OPEN_IN', true).'",
|
||||
"'.JText::_('K2_SAME_WINDOW', true).'",
|
||||
"'.JText::_('K2_NEW_WINDOW', true).'",
|
||||
"'.JText::_('K2_CLASSIC_JAVASCRIPT_POPUP', true).'",
|
||||
"'.JText::_('K2_LIGHTBOX_POPUP', true).'",
|
||||
"'.JText::_('K2_RESET_VALUE', true).'",
|
||||
"'.JText::_('K2_CALENDAR', true).'",
|
||||
"'.JText::_('K2_PLEASE_SELECT_A_FIELD_TYPE_FROM_THE_LIST_ABOVE', true).'",
|
||||
"'.JText::_('K2_COLUMNS', true).'",
|
||||
"'.JText::_('K2_ROWS', true).'",
|
||||
];');
|
||||
JHTML::_('behavior.modal');
|
||||
parent::display($tpl);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: default.php 1971 2013-05-01 16:04:17Z lefteris.kavadas $
|
||||
* @package K2
|
||||
* @author JoomlaWorks http://www.joomlaworks.net
|
||||
* @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.
|
||||
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
?>
|
||||
<form action="index.php" method="post" name="adminForm" id="adminForm">
|
||||
<table class="k2AdminTableFilters table">
|
||||
<tr>
|
||||
<td class="k2AdminTableFiltersSearch">
|
||||
<?php echo JText::_('K2_FILTER'); ?>
|
||||
<input type="text" name="search" value="<?php echo $this->lists['search'] ?>" class="text_area" title="<?php echo JText::_('K2_FILTER_BY_TITLE'); ?>"/>
|
||||
<button id="k2SubmitButton"><?php echo JText::_('K2_GO'); ?></button>
|
||||
<button id="k2ResetButton"><?php echo JText::_('K2_RESET'); ?></button>
|
||||
</td>
|
||||
<td class="k2AdminTableFiltersSelects hidden-phone">
|
||||
<?php echo $this->lists['type']; ?>
|
||||
<?php echo $this->lists['group']; ?>
|
||||
<?php echo $this->lists['state']; ?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table class="adminlist table table-striped" id="k2ExtraFieldsList">
|
||||
<thead>
|
||||
<tr>
|
||||
<?php if(K2_JVERSION == '30'): ?>
|
||||
<th width="1%" class="center hidden-phone">
|
||||
<?php echo JHtml::_('grid.sort', '<i class="icon-menu-2"></i>', 'ordering', @$this->lists['order_Dir'], @$this->lists['order'], null, 'asc', 'K2_ORDER'); ?>
|
||||
</th>
|
||||
<?php else: ?>
|
||||
<th>#</th>
|
||||
<?php endif; ?>
|
||||
<th class="k2Center center"><input id="jToggler" type="checkbox" name="toggle" value="" /></th>
|
||||
<th><?php echo JHTML::_('grid.sort', 'K2_NAME', 'name', @$this->lists['order_Dir'], @$this->lists['order'] ); ?></th>
|
||||
<th class="k2Center center hidden-phone"><?php echo JHTML::_('grid.sort', 'K2_GROUP', 'groupname', @$this->lists['order_Dir'], @$this->lists['order'] ); ?></th>
|
||||
<?php if(K2_JVERSION != '30'): ?>
|
||||
<th><?php echo JHTML::_('grid.sort', 'K2_ORDER', 'ordering', @$this->lists['order_Dir'], @$this->lists['order']); ?> <?php if ($this->ordering) echo JHTML::_('grid.order', $this->rows ); ?></th>
|
||||
<?php endif; ?>
|
||||
<th class="k2Center center hidden-phone"><?php echo JHTML::_('grid.sort', 'K2_TYPE', 'type', @$this->lists['order_Dir'], @$this->lists['order'] ); ?></th>
|
||||
<th class="k2Center center"><?php echo JHTML::_('grid.sort', 'K2_PUBLISHED', 'published', @$this->lists['order_Dir'], @$this->lists['order'] ); ?></th>
|
||||
<th class="k2Center center hidden-phone"><?php echo JHTML::_('grid.sort', 'K2_ID', 'exf.id', @$this->lists['order_Dir'], @$this->lists['order'] ); ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($this->rows as $key=>$row): ?>
|
||||
<tr class="row<?php echo ($key%2); ?>" sortable-group-id="<?php echo $row->group; ?>">
|
||||
<?php if(K2_JVERSION == '30'): ?>
|
||||
<td class="order hidden-phone">
|
||||
<span class="sortable-handler <?php echo ($this->ordering) ? '' : 'inactive tip-top' ;?>" title="<?php echo ($this->ordering) ? '' :JText::_('JORDERINGDISABLED');?>" rel="tooltip"><i class="icon-menu"></i></span>
|
||||
<input type="text" style="display:none" name="order[]" size="5" value="<?php echo $row->ordering;?>" class="width-20 text-area-order " />
|
||||
</td>
|
||||
<?php else: ?>
|
||||
<td><?php echo $key+1; ?></td>
|
||||
<?php endif; ?>
|
||||
<td class="k2Center center"><?php $row->checked_out = 0; echo @JHTML::_('grid.checkedout', $row, $key ); ?></td>
|
||||
<td><a href="<?php echo JRoute::_('index.php?option=com_k2&view=extrafield&cid='.$row->id); ?>"><?php echo $row->name; ?></a><br /><?php echo JText::_('K2_ALIAS'); ?>: <?php echo $row->alias; ?></td>
|
||||
<td class="k2Center center hidden-phone"><?php echo $row->groupname; ?></td>
|
||||
<?php if(K2_JVERSION != '30'): ?>
|
||||
<td class="order">
|
||||
<span><?php echo $this->page->orderUpIcon($key, ($row->group == @$this->rows[$key-1]->group), 'orderup', 'Move Up', $this->ordering); ?></span>
|
||||
<span><?php echo $this->page->orderDownIcon($key, count($this->rows), ($row->group == @$this->rows[$key+1]->group), 'orderdown', 'Move Down', $this->ordering); ?></span>
|
||||
<?php $disabled = $this->ordering ? '' : 'disabled="disabled"'; ?>
|
||||
<input type="text" name="order[]" size="5" value="<?php echo $row->ordering; ?>" <?php echo $disabled ?> class="text_area" style="text-align: center" />
|
||||
</td>
|
||||
<?php endif; ?>
|
||||
<td class="k2Center center hidden-phone"><?php echo JText::_('K2_EXTRA_FIELD_'.JString::strtoupper($row->type)); ?></td>
|
||||
<td class="k2Center center"><?php echo $row->status; ?></td>
|
||||
<td class="k2Center center hidden-phone"><?php echo $row->id; ?></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="8">
|
||||
<?php if(K2_JVERSION == '30'): ?>
|
||||
<div class="k2LimitBox">
|
||||
<?php echo $this->page->getLimitBox(); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php echo $this->page->getListFooter(); ?>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
<input type="hidden" name="option" value="com_k2" />
|
||||
<input type="hidden" name="view" value="<?php echo JRequest::getVar('view'); ?>" />
|
||||
<input type="hidden" name="task" value="" />
|
||||
<input type="hidden" name="filter_order" value="<?php echo $this->lists['order']; ?>" />
|
||||
<input type="hidden" name="filter_order_Dir" value="<?php echo $this->lists['order_Dir']; ?>" />
|
||||
<input type="hidden" name="boxchecked" value="0" />
|
||||
<?php echo JHTML::_( 'form.token' ); ?>
|
||||
</form>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user